UNPKG

@dynatrace/react-native-plugin

Version:

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

29 lines (28 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const SendEventValidation_1 = require("./modifier/SendEventValidation"); const EventModifierUtil_1 = require("./modifier/EventModifierUtil"); const EventBuilderUtil_1 = require("./EventBuilderUtil"); class EventData { constructor() { this.rawEventProperties = {}; } addEventProperty(key, value) { this.rawEventProperties[key] = value; return this; } withDuration(duration) { this.duration = duration; return this; } toJSON() { const sanitizedEventProperties = SendEventValidation_1.SendEventValidation.modifyEvent(Object.assign(Object.assign({}, this.rawEventProperties), (0, EventBuilderUtil_1.includeIfDefined)("duration", this.duration))); if (sanitizedEventProperties === null) { return null; } (0, EventModifierUtil_1.flagEventProperties)(sanitizedEventProperties); (0, EventModifierUtil_1.addIsApiReported)(sanitizedEventProperties); return sanitizedEventProperties; } } exports.default = EventData;