UNPKG

@dynatrace/react-native-plugin

Version:

This plugin gives you the ability to use the Dynatrace Mobile agent in your react native application.

38 lines (37 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseDataEventModifier = void 0; const ConfigurationHandler_1 = require("../../../core/configuration/ConfigurationHandler"); const ConsoleLogger_1 = require("../../../core/logging/ConsoleLogger"); const EventModifierUtil_1 = require("./EventModifierUtil"); class BaseDataEventModifier { constructor(viewInfo) { this.viewInfo = viewInfo; this.logger = new ConsoleLogger_1.ConsoleLogger('BaseDataEventModifier'); } modifyEvent(event) { if (event == null) { this.logger.debug(`modifyEvent(${JSON.stringify(event)}): Event is null!`); return event; } Object.assign(event, this.viewInfo); event["dt.rum.event.source.type"] = 'react_native'; const bundleName = ConfigurationHandler_1.ConfigurationHandler.getBundleName(); if (bundleName !== undefined) { event["react_native.bundle.name"] = bundleName; } const bundleVersion = ConfigurationHandler_1.ConfigurationHandler.getBundleVersion(); if (bundleVersion !== undefined) { event["react_native.bundle.version"] = bundleVersion; } const reactNativeVersion = (0, EventModifierUtil_1.getReactNativeVersion)(); if (reactNativeVersion) { event["react_native.version"] = reactNativeVersion; } return event; } } exports.BaseDataEventModifier = BaseDataEventModifier;