UNPKG

@dynatrace/react-native-plugin

Version:

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

1,366 lines (1,291 loc) 65.3 kB
/** * react-native-dynatrace.d.ts * * Type definition file for the react native dynatrace package */ /** * Specifying a platform when you want individual behaviour and * commands will only be sent to a certain platform. */ export declare enum Platform { /** * If set, the command will only be sent to the Android platform. * * Usage: * * ```ts * import { Dynatrace, Platform } from '@dynatrace/react-native-plugin'; * * let myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Android); * //Perform the action and whatever else is needed. * myAction.leaveAction(); * ``` */ Android, /** * If set, the command will only be sent to the iOS platform. * * Usage: * * ```ts * import { Dynatrace, Platform } from '@dynatrace/react-native-plugin'; * * let myAction = Dynatrace.enterAutoAction("MyButton tapped", Platform.Ios); * //Perform the action and whatever else is needed. * myAction.leaveAction(); * ``` */ Ios } /** * Level of log message that will be printed */ export declare enum LogLevel { /** * With debug log level, a lot of diagnostic infos will be printed by the plugin. * * Usage: * * - via `dynatrace.config.js` by setting `react.debug` to `true` * - via code and manual startup by using the `ConfigurationBuilder`: * * ```ts * import { ConfigurationBuilder, Dynatrace, LogLevel } from '@dynatrace/react-native-plugin'; * * const configurationBuilder = new ConfigurationBuilder("beaconUrl", "applicationId"); * await Dynatrace.start(configurationBuilder.withLogLevel(LogLevel.Debug).buildConfiguration()); * ``` */ Debug, /** * With info log level, only the necessary infos will be printed by the plugin. * * Usage: * * By default `LogLevel.Info` is used, so usually setting this property is not needed. * * - via `dynatrace.config.js` by setting `react.debug` to `false` * - via code and manual startup by using the `ConfigurationBuilder`: * * ```ts * import { ConfigurationBuilder, Dynatrace, LogLevel } from '@dynatrace/react-native-plugin'; * * const configurationBuilder = new ConfigurationBuilder("beaconUrl", "applicationId"); * await Dynatrace.start(configurationBuilder.withLogLevel(LogLevel.Info).buildConfiguration()); * ``` */ Info } /** * Enum that represents the different privacy levels. Every level decides about the amount of data, * which is actually collected and sent by the agent. * * Usage: * * Using `DataCollectionLevel` is only possible when `UserOptIn` was enabled. * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-opt-in-mode * * General information: * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options * @see https://docs.dynatrace.com/docs/platform-modules/digital-experience/mobile-applications/additional-configuration/configure-rum-privacy-mobile#data-collection-levels */ export declare enum DataCollectionLevel { /** * Monitoring data is not sent. * - No personal data is sent; all identifiers are randomized on every launch. * - A single Loading <App> event is sent to track the number of users that opted out. * * Usage: * * ```ts * import { DataCollectionLevel, Dynatrace, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * Dynatrace.applyUserPrivacyOptions(privacyConfig); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options * @see https://docs.dynatrace.com/docs/platform-modules/digital-experience/mobile-applications/additional-configuration/configure-rum-privacy-mobile#data-collection-levels */ Off, /** * Only performance, automatically captured data is sent. * - No personal data is sent; all identifiers are randomized on every launch. * * Usage: * * ```ts * import { DataCollectionLevel, Dynatrace, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Performance, true); * Dynatrace.applyUserPrivacyOptions(privacyConfig); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options * @see https://docs.dynatrace.com/docs/platform-modules/digital-experience/mobile-applications/additional-configuration/configure-rum-privacy-mobile#data-collection-levels */ Performance, /** * @deprecated Replaced by `DataCollectionLevel.UserBehavior` */ User, /** * Performance data and user data is sent. * - Personal data is sent; OneAgent recognizes and reports users who revisit in the future. * - If you haven't configured user tagging and custom event or value reporting, the User behavior level works similarly to the Performance level. * * Usage: * * ```ts * import { DataCollectionLevel, Dynatrace, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.UserBehavior, true); * Dynatrace.applyUserPrivacyOptions(privacyConfig); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options * @see https://docs.dynatrace.com/docs/platform-modules/digital-experience/mobile-applications/additional-configuration/configure-rum-privacy-mobile#data-collection-levels */ UserBehavior, } type Primitive = string | number | boolean; type JSONArray = JSONValue[]; type JSONValue = Primitive | JSONArray | JSONObject; /** * JSON Object which can be used for sendEvent API */ export declare interface JSONObject { [key: string]: JSONValue; } export declare const Dynatrace: { /** * Starting the React Native plugin and OneAgent for Android or iOS. This method is only necessary * in case of manual startup and should be ignored in auto startup scenarios. The start method will * set the error handler for reporting crashes and will apply the provided configuration globally. * * @param {IConfiguration} configuration Configuration for a manual startup of the plugin * * Usage: * * ```ts * import { ConfigurationBuilder, Dynatrace } from '@dynatrace/react-native-plugin'; * * const configurationBuilder = new ConfigurationBuilder("beaconUrl", "applicationId"); * // Use several configuration options like withLogLevel(LogLevel.Debug) * await Dynatrace.start(configurationBuilder.buildConfiguration()); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#plugin-startup */ start(configuration: IConfiguration): Promise<void>; /** * This call allows to monitor the passed in component. Depending on the type of the component * (Function Component or Class Component), it will be wrapped and data of renderings will be * automatically reported. * * The name of the Component, which can be passed as parameter, is important because the build * process will remove the name of a Functional Component. Still this parameter is optional as * other properties can be used at runtime as well (e.g. dtActionName). * * @param Component Functional or Class Component * @param {string} name The name of the Component * @returns The Component which was wrapped to be monitored * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * export function MyFunctionalComponent(){ * // Content of component * } * * Dynatrace.withMonitoring(MyFunctionalComponent, "MyFunctionalComponent"); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#monitor-a-component */ withMonitoring(Component: React.FunctionComponent<any> | React.ComponentClass<any>, name?: string): React.FunctionComponent<any> | React.ComponentClass<any> /** * Reroutes to `Dynatrace.enterAutoAction` * * @deprecated Please use either {@link enterAutoAction}, which is doing the same or alternatively {@link enterManualAction}. */ enterAction(name: string, platform?: Platform): IDynatraceAction; /** * Creates an Action which will NOT be handled by the plugin. This means that you have full control * about the hierachy of your actions. This function will create a {@link IDynatraceRootAction} for you, * which has the ability to create child actions via {@link IDynatraceRootAction.enterAction}. Be aware, * because of the full manual approach the plugin will not link webrequest automatically. Webrequest * have to be manually tagged by using the tag provided by the action via {@link IDynatraceAction.getRequestTag}. * * @param {string} name Name of the action, which will be created. This name must not be empty. * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @returns {IDynatraceRootAction} Action that is created. If name was empty a NullRootAction will be provided, * which will act as normal root action, but has no functionality. * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * let myAction = Dynatrace.enterManualAction("MyButton tapped"); * // Perform the action and whatever else is needed. * myAction.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#create-custom-actions */ enterManualAction(name: string, platform?: Platform): IDynatraceRootAction; /** * Creates an Action which will be automatically handled by the plugin. This means that the * plugin decides about the hierachy of this action. If there is no open action, the following * action will be a root action. All other actions created by this method, while a root action * is open, will be automatically inserted as a child action. Furthermore the plugin will automatically * link webrequest (if they are not tagged manually) to the open root action. * * @param {string} name Name of the action, which will be created. This name must not be empty. * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @returns {IDynatraceAction} Action that is created. If name was empty a NullAction will be provided, * which will act as normal action, but has no functionality. * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * let myAction = Dynatrace.enterAutoAction("MyButton tapped"); * // Perform the action and whatever else is needed. * myAction.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#create-custom-actions */ enterAutoAction(name: string, platform?: Platform): IDynatraceAction; /** * Can be called to end the current visit and start a new visit. All current actions are * closed and sent to the server. * * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.endSession(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#end-the-current-user-session */ endSession(platform?: Platform): void; /** * The current visit/session will be tagged with the provided user id. * The value will not be stored and has to be renewed for every new session. * * @param {string} user a unique id that allows you to identify the current user. * If user is null or empty, then the user tag will be removed from the session. * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.identifyUser('User'); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#identify-a-user */ identifyUser(user: string, platform?: Platform): void; /** * Saves the given GPS location for reporting along with the captured data. * * @param {Number} latitude latitude data of the position * @param {Number} longitude longitude data of the position * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.setGPSLocation(48.31518732698596, 14.305245274594471); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-gps-location */ setGPSLocation(latitude: Number, longitude: Number, platform?: Platform): void; /** * Call this function to flush all collected events immediately. To reduce network chatter, the collected events are usually * sent in packages where the oldest event has an age of up to 2 minutes (the default; the maximum age can be configured). * Using this function, you can force sending of all collected events regardless of their age. * * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.flushEvents(); * ``` * */ flushEvents(platform?: Platform): void; /** * Tells you if you opted into crash reporting. If this value is false, which means off, * the native agent will not report a single crash that is happening within the application. * This method will always return true, when the user optin feature is not used. * * @deprecated Please use {@link getUserPrivacyOptions} to get the crash reporting opt-in value. * * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @returns {Promise<boolean>} Promise which resolves true if crash reporting is opted in. */ isCrashReportingOptedIn(platform?: Platform): Promise<boolean>; /** * Allows the user to activate/deactivate crash reporting and stores the users decisions for future sessions. * This method can only be used, when the configuration (dynatrace.config.js) for android or iOS is using the userOptIn mode. * * @deprecated Please use {@link applyUserPrivacyOptions} to set crash reporting opt-in. * * @param {boolean} crashReporting Pass true, if you want to enable crash reporting * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). */ setCrashReportingOptedIn(crashReporting: boolean, platform?: Platform): void; /** * Returns the current {@link DataCollectionLevel} which is used by the plugin. This method will always * return {@link DataCollectionLevel.UserBehavior}, when the user opt-in feature is not used. * * @deprecated Please use {@link getUserPrivacyOptions} to get the current data collection level value. * * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @returns promise which resolve a data collection level string */ getDataCollectionLevel(platform?: Platform): Promise<DataCollectionLevel>; /** * Allows the user to set the {@link DataCollectionLevel} and stores the users decisions for future sessions. * This method can only be used, when the configuration (dynatrace.config.js) for android or iOS is using the userOptIn mode. * When the user changes the {@link DataCollectionLevel} a new session will be started. * * @deprecated Please use {@link applyUserPrivacyOptions} to apply the current data collection level value. * * @param {DataCollectionLevel} dataCollectionLevel New data collection level * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). */ setDataCollectionLevel(dataCollectionLevel: DataCollectionLevel, platform?: Platform): void; /** * Get the current user privacy options including data collection level (Off, Performance, UserBehavior) * and if crash reporting opt-in is enabled * * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @returns {Promise<UserPrivacyOptions>} current user privacy options * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * let privacyOptions = await Dynatrace.getUserPrivacyOptions(); * ``` * */ getUserPrivacyOptions(platform?: Platform): Promise<UserPrivacyOptions>; /** * Creates a new session with the specified privacy settings and stores the privacy settings for future sessions. * This method can only be used, when user opt-in feature is enabled. This method call has no effect, * if the given privacy settings are identical to the previously specified privacy settings. * * @param {UserPrivacyOptions} userPrivacyOptions the new privacy settings from the user * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { DataCollectionLevel, Dynatrace, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * Dynatrace.applyUserPrivacyOptions(new UserPrivacyOptions(DataCollectionLevel.Performance, true)); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ applyUserPrivacyOptions(userPrivacyOptions: UserPrivacyOptions, platform?: Platform): void; /** * Similar to {@link IDynatraceAction.reportError}. But the error event is reported as root action. * * @param {string} errorName Name of the error event * @param {number} errorCode The code of the error * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.reportError("Page not found", 404); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportError(errorName: string, errorCode: number, platform?: Platform): void; /** * Reports a stacktrace * * @deprecated Please use {@link reportErrorStacktrace} instead. * * @param {string} errorName Name of the Error - SyntaxError * @param {string} reason Reason for the Error * @param {string} stacktrace Whole Stacktrace * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). */ reportErrorWithStacktrace(errorName: string, reason: string, stacktrace: string, platform?: Platform): void; /** * Reports a stacktrace * * @param {string} errorName Name of the error * @param {string} errorValue Value of the error * @param {string} reason Reason for the error * @param {string} stacktrace Whole stacktrace * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.reportErrorStacktrace("Error Name", "Error Value", "Reason", "Stacktrace"); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-an-error-stacktrace */ reportErrorStacktrace(errorName: string, errorValue: string, reason: string, stacktrace: string, platform?: Platform): void; /** * Reports a custom crash * * @param {string} crashName Name of the crash * @param {string} reason Reason for the crash * @param {string} stacktrace Whole stacktrace * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.reportCrash("Crash Name", "Reason", "Stacktrace"); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manually-report-a-crash */ reportCrash(crashName: string, reason: string, stacktrace: string, platform?: Platform): void; /** * Reports a crash with an error object (which needs to contain a stacktrace) * * @param {string} crashName Name of the crash * @param {Error} crash error object * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * Dynatrace.reportCrashWithException("Crash Name", error); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manually-report-a-crash */ reportCrashWithException(crashName: string, crash: Error, platform?: Platform); /** * Puts a set of http headers on every agent http request (eg. the Authorization header). It also triggers the agent to * reconnect to the beacon endpoint with the new headers. To clear the previous headers, * call the method with a null or empty value. * * @param {Map<string, string>} headers a set of http headers * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const beaconHeaders = new Map<string, string>(); * beaconHeaders.set('headerName', 'headerValue'); * Dynatrace.setBeaconHeaders(beaconHeaders); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#setting-beacon-headers */ setBeaconHeaders(headers?: Map<string, string> | null, platform?: Platform): void; /** * Send a Business Event * * With sendBizEvent, you can report a business event. These standalone events are being sent * detached from user actions or sessions. * * Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace * and will be stripped from the passed in attributes. * * Note: Business events are only supported on Dynatrace SaaS deployments currently. * * @param {string} type Mandatory event type * @param {JSONObject} attributes Must be a valid JSON object and cannot contain functions, * undefined, Infinity and NaN as values, otherwise they will be removed. * Attributes need to be serializable using JSON.stringify. * The resulting event will be populated with attributes parameter, * and enriched with additional properties, thus also empty objects are valid. * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace, JSONObject } from '@dynatrace/react-native-plugin'; * * Dynatrace.sendBizEvent('type', { custom : 123 }); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#business-event-capturing */ sendBizEvent(type: string, attributes?: JSONObject, platform?: Platform): void; /** * Adds an event modifier, which will be executed in the end before * the event is transfered. This allows to modify the event to some extent. * * @param eventModifier Function which is modify an event */ addEventModifier(eventModifier: IEventModifier): IEventModifier; /** * Is removing an event modifier again, so it will not modify events anymore. * * @param eventModifier Function which should be removed */ removeEventModifier(eventModifier: IEventModifier): boolean; /** * Send a Event * * With sendEvent, you can report a event. * * Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace * and will be stripped from the passed in attributes. TODO: Add Others here. * * @param {string} type Mandatory event type * @param {JSONObject} properties Must be a valid JSON object and cannot contain functions, * undefined, Infinity and NaN as values, otherwise they will be removed. * Attributes need to be serializable using JSON.stringify. * The resulting event will be populated with attributes parameter, * and enriched with additional properties, thus also empty objects are valid. * @param {any} context optional context that can be used to manipulate the resulting event * using an event modifier */ sendEvent(properties: JSONObject, context?: any): void; /** * Sets the current view context which will be used for every event happening in the meantime. * * @param name Name of the current view */ startView(name: string): void; /** * Removes the current view context */ stopView(): void; /** * Send a Session Properties Event. * * With sendSessionPropertyEvent you can report properties that apply to all events in the current session. Any * custom properties must be added in the 'session_properties.*' namespace, otherwise they will be dropped. Only one * session properties event may be active for every session. * * @param properties any attributes that should be reported for every event in the session. */ sendSessionPropertyEvent(properties: JSONObject): void; } /** * Interface which declares event modification through modifyEvent */ export declare interface IEventModifier { /** * Event as JSONObject is received and can be modified. If instead of the event * null is returned, the event will be canceled. * * @param event Event as JSONObject * @param context optional context that can be used to manipulate the resulting event * using an event modifier or undefined if not available * @returns Either the modified event or null if you want to cancel the event */ modifyEvent(event: JSONObject | null, context?: any): JSONObject | null; } export declare interface IDynatraceAction { /** * Reports an error as key-value pair with the time at which it occurred. * This event can be used to report error codes. * * @param {string} errorName Name of the error event * @param {number} errorCode The code of the error * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.reportError("Page Not Found", 404); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportError(errorName: string, errorCode: number, platform?: Platform): void; /** * Reports the time when a specific event occurred. This event can be used to determine when a user passed * through a specific part of your application. The reportEvent method is a simple way to track user * behavior in your application. * * @param eventName Name of the event * @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.reportEvent("Event Name"); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportEvent(eventName: string, platform?: Platform): void; /** * Reports a key-value pair with the time at which this event occurred. This event can be used to report * important measurement data. * * @param {string} valueName Name of the value * @param {string} value The string value * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.reportStringValue("Value Name", "Value"); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportStringValue(valueName: string, value: string, platform?: Platform): void; /** * Reports a key-value pair with the time at which this event occurred. This event can be used to report * important measurement data. * * @param valueName Name of the value * @param value Integer value * @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.reportIntValue("Value Name", 123); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportIntValue(valueName: string, value: number, platform?: Platform): void; /** * Reports a key-value pair with the time at which this event occurred. This event can be used to report * important measurement data. * * @param valueName Name of the value * @param value Double value * @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.reportDoubleValue("Value Name", 123.123); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#report-values */ reportDoubleValue(valueName: string, value: number, platform?: Platform): void; /** * Completes this action and prepares the data for the next sending interval. * When an outer/parent action is exited, all nested/child actions are automatically closed. * * @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#create-custom-actions */ leaveAction(platform?: Platform): void; /** * Cancels this action and discards all associated data * * @param platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * action.cancelAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#cancel-actions */ cancel(platform?: Platform): void; /** * Retrieve the request tag for this certain root action. This will * allow you to manually link a web request to this action if you use * this tag as header value. * * @param {string} url URL that you want to track * @returns {Promise<string>} header tag which should be applied onto the request * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * const requestTag = await action.getRequestTag("http://dynatrace.com"); * // Attach requestTag as x-dynatrace header to a request * * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTag(url: string): Promise<string>; /** * If you want to manually link a web request with an action this is * the name of the header you need to set. * * @returns {string} name of the header that should be used for tagging a request * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const action = Dynatrace.enterAutoAction("Action Name"); * const requestTagHeader = await action.getRequestTagHeader(); * // Use requestTagHeader as header name * * action.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTagHeader(): string; } /** * Root action which can additionally to the normal IDynatraceAction * create another layer of actions underneath. */ export declare interface IDynatraceRootAction extends IDynatraceAction { /** * Create a child action * * @param {string} actionName - name of action * @param {Platform} platform Is optional, which means by default this call will be applied on both platforms (Android & iOS). * @return {IDynatraceAction} created action * * Usage: * * ```ts * import { Dynatrace } from '@dynatrace/react-native-plugin'; * * const parentAction = Dynatrace.enterManualAction("Parent Action Name"); * const childAction = parentAction.enterAction("Child Action Name"); * // Do something with actions * * childAction.leaveAction(); * parentAction.leaveAction(); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#create-custom-sub-actions */ enterAction(name: string, platform?: Platform): IDynatraceAction; } /** * The Web request timing interface which can be used to measure a web request manually */ export declare interface IDynatraceWebRequestTiming { /** * Start the measurment of the web request. Call this before the request is started. * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTiming(axiosResponse.status, axiosResponse.data); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ startWebRequestTiming(): void; /** * Stops the measurment of the web request. This needs to be called after the request is executed. * The responseCode and responseMessage will be transfered and shown in the web UI. * * @param {number} responseCode Status Code of the response e.g. 200 * @param {string} responseMessage Message of the response * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTiming(axiosResponse.status, axiosResponse.data); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ stopWebRequestTiming(responseCode: number, responseMessage: string): void; /** * Stops the measurment of the web request. This needs to be called after the request is executed. * The responseCode and responseMessage will be transfered and shown in the web UI. * * @param {number} responseCode Status Code of the response e.g. 200 * @param {string} responseMessage Message of the response * @param requestSize Request size * @param responseSize Response size * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTimingWithSize(axiosResponse.status, axiosResponse.data, 122, 63); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ stopWebRequestTimingWithSize(responseCode: number, responseMessage: string, requestSize: number, responseSize: number): void; /** * Returns the content for the header that is needed in order to track a request * * @returns {string} header tag which should be applied onto the request * * Usage: * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * // Printing the same tag which was used as input for DynatraceWebRequestTiming * console.log(timing.getRequestTag()); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTag(): string; /** * Returns the name for the header that is needed in order to track a request * * @returns {string} name of the header that should be used for tagging a request * * Usage: * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * // Printing the header name * console.log(timing.getRequestTagHeader()); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTagHeader(): string; } /** * Class which gives you the option to measure a web request */ export declare class DynatraceWebRequestTiming implements IDynatraceWebRequestTiming{ /** * Constructor for creating a DynatraceWebRequestTiming * * @param {string} requestTag Request Tag for the action to be linked to * @param {string} url URL that should be linked * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTiming(axiosResponse.status, axiosResponse.data); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ constructor(requestTag: string, url: string); /** * Start the measurment of the web request. Call this before the request is started. * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTiming(axiosResponse.status, axiosResponse.data); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ startWebRequestTiming(): void; /** * Stops the measurment of the web request. This needs to be called after the request is executed. * The responseCode and responseMessage will be transfered and shown in the web UI. * * @param {number} responseCode Status Code of the response e.g. 200 * @param {string} responseMessage Message of the response * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTiming(axiosResponse.status, axiosResponse.data); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ stopWebRequestTiming(responseCode: number, responseMessage: string): void; /** * Stops the measurment of the web request. This needs to be called after the request is executed. * The responseCode and responseMessage will be transfered and shown in the web UI. * * @param {number} responseCode Status Code of the response e.g. 200 * @param {string} responseMessage Message of the response * @param requestSize Request size * @param responseSize Response size * * Usage (with Axios example): * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * try { * timing.startWebRequestTiming(); * const axiosResponse = await axios.get(url, { * headers: { * timing.getRequestTagHeader(): tag * } * }); * timing.stopWebRequestTimingWithSize(axiosResponse.status, axiosResponse.data, 122, 63); * } catch (error) { * timing.stopWebRequestTiming(-1, error); * } finally { * action.leaveAction(); * } * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ stopWebRequestTimingWithSize(responseCode: number, responseMessage: string, requestSize: number, responseSize: number): void; /** * Returns the content for the header that is needed in order to track a request * * @returns {string} header tag which should be applied onto the request * * Usage: * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * // Printing the same tag which was used as input for DynatraceWebRequestTiming * console.log(timing.getRequestTag()); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTag(): string; /** * Returns the name for the header that is needed in order to track a request * * @returns {string} name of the header that should be used for tagging a request * * Usage: * * ```ts * import { Dynatrace, DynatraceWebRequestTiming } from '@dynatrace/react-native-plugin' * * const action = Dynatrace.enterManualAction("Manual Web Request"); * const tag = await action.getRequestTag(url); * const timing = new DynatraceWebRequestTiming(url, tag); * * // Printing the header name * console.log(timing.getRequestTagHeader()); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#manual-web-request-tagging */ getRequestTagHeader(): string; } /** * Represents the privacy settings that the user can select */ export declare class UserPrivacyOptions { /** * Constructor for creation of a privacy settings object * @param {DataCollectionLevel} dataCollectionLevel Data collection level. * @param {boolean} crashReportingOptedIn If crash reporting should be enabled. * * Usage: * * ```ts * import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ constructor(dataCollectionLevel: DataCollectionLevel, crashReportingOptedIn: boolean); /** * Returns the specified data collection level. * * @returns {DataCollectionLevel} the specified data collection level * * Usage: * * ```ts * import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * const dataCollectionLevel = privacyConfig.dataCollectionLevel; * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ get dataCollectionLevel(): DataCollectionLevel; /** * Sets the data collection level specified by the user. * * @param {DataCollectionLevel} dataCollectionLevel the specified data collection level from the user * * Usage: * * ```ts * import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * privacyConfig.dataCollectionLevel = DataCollectionLevel.Performance; * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ set dataCollectionLevel(dataCollectionLevel: DataCollectionLevel); /** * Returns the opt-in value for crash reporting. * * @return {boolean} the opt-in value for crash reporting * * Usage: * * ```ts * import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * const crashReporting = privacyConfig.crashReportingOptedIn; * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ get crashReportingOptedIn(): boolean; /** * Sets the privacy setting for crash reporting. * * @param {boolean} crashReportingOptedIn the opt-in value specified by the user * * Usage: * * ```ts * import { DataCollectionLevel, UserPrivacyOptions } from '@dynatrace/react-native-plugin'; * * const privacyConfig = new UserPrivacyOptions(DataCollectionLevel.Off, false); * privacyConfig.crashReportingOptedIn = true; * ``` * * @see https://www.npmjs.com/package/@dynatrace/react-native-plugin#user-privacy-options */ set crashReportingOptedIn(crashReportingOptedIn: boolean); } /** * Configuration interface which should be used during a manual startup */ export declare interface IConfiguration { /** * Beacon url which is used for communicate with the beacon endpoint. This value is mandatory. * * Be aware this value is only important for manual startup. In case of auto startup this needs to be handled via * native agent configuration. */ readonly beaconUrl: string; /** * Needed to identify and report data for this application. This value is mandatory. * * Be aware this value is only important for manual startup. In case of auto startup this needs to be handled via * native agent configuration. */ readonly applicationId: string; /** * Enables reporting of crashes. By default this value is true if nothing is passed. * * Be aware this value is only important for manual startup. In case of auto startup this needs to be handled via * native agent configuration. */ readonly reportCrash: boolean; /** * Enables the react native error/crash handler. By default this value is true if nothing is passed. * * Be aware this value is only important for manual startup. In case of auto startup this needs to be handled via * react configuration. */ readonly errorHandler: boolean; /** * Reports a fatal error as a crash or as an error. * The default value of true results in an unhandled fatal error being reported as a crash which will also end the current session. * If the value is false, the unhandled fatal error will be reported as an error and the current session will continue. * * Be aware this value is only important for manual startup. In case of auto startup this needs to be handled via * react configuration. */ readonly reportFatalErrorAsCrash: boolean; /** * Log level of our plugin d