@datadog/mobile-react-native 2.4.0 → 2.4.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.
Files changed (67) hide show
  1. package/DatadogSDKReactNative.podspec +1 -1
  2. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  3. package/ios/Sources/SdkVersion.swift +1 -1
  4. package/lib/commonjs/DdSdkReactNative.js +4 -11
  5. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  6. package/lib/commonjs/index.js +2 -0
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/polyfills.js +31 -0
  9. package/lib/commonjs/polyfills.js.map +1 -0
  10. package/lib/commonjs/rum/DdRum.js +3 -3
  11. package/lib/commonjs/rum/DdRum.js.map +1 -1
  12. package/lib/commonjs/sdk/GlobalState/GlobalState.js +38 -0
  13. package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -0
  14. package/lib/commonjs/specs/NativeDdLogs.js +1 -0
  15. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
  16. package/lib/commonjs/specs/NativeDdRum.js +1 -0
  17. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  18. package/lib/commonjs/specs/NativeDdSdk.js +1 -0
  19. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  20. package/lib/commonjs/specs/NativeDdTrace.js +1 -0
  21. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
  22. package/lib/commonjs/version.js +1 -1
  23. package/lib/commonjs/version.js.map +1 -1
  24. package/lib/module/DdSdkReactNative.js +3 -11
  25. package/lib/module/DdSdkReactNative.js.map +1 -1
  26. package/lib/module/index.js +5 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/polyfills.js +28 -0
  29. package/lib/module/polyfills.js.map +1 -0
  30. package/lib/module/rum/DdRum.js +2 -2
  31. package/lib/module/rum/DdRum.js.map +1 -1
  32. package/lib/module/sdk/GlobalState/GlobalState.js +29 -0
  33. package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -0
  34. package/lib/module/specs/NativeDdLogs.js +1 -0
  35. package/lib/module/specs/NativeDdLogs.js.map +1 -1
  36. package/lib/module/specs/NativeDdRum.js +1 -0
  37. package/lib/module/specs/NativeDdRum.js.map +1 -1
  38. package/lib/module/specs/NativeDdSdk.js +1 -0
  39. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  40. package/lib/module/specs/NativeDdTrace.js +1 -0
  41. package/lib/module/specs/NativeDdTrace.js.map +1 -1
  42. package/lib/module/version.js +1 -1
  43. package/lib/module/version.js.map +1 -1
  44. package/lib/typescript/DdSdkReactNative.d.ts +0 -5
  45. package/lib/typescript/index.d.ts +1 -0
  46. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +12 -0
  47. package/lib/typescript/version.d.ts +1 -1
  48. package/package.json +2 -2
  49. package/src/DdSdkReactNative.tsx +3 -10
  50. package/src/__tests__/DdSdkReactNative.test.tsx +3 -2
  51. package/src/__tests__/mock.test.ts +0 -1
  52. package/src/index.tsx +4 -0
  53. package/src/polyfills.js +37 -0
  54. package/src/rum/DdRum.ts +2 -2
  55. package/src/rum/__tests__/DdRum.test.ts +3 -3
  56. package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -0
  57. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/__utils__/TracingIdentifierUtils.ts +1 -1
  58. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +1 -1
  59. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +1 -1
  60. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -2
  61. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +3 -2
  62. package/src/sdk/GlobalState/GlobalState.tsx +26 -0
  63. package/src/specs/NativeDdLogs.ts +1 -0
  64. package/src/specs/NativeDdRum.ts +1 -0
  65. package/src/specs/NativeDdSdk.ts +1 -0
  66. package/src/specs/NativeDdTrace.ts +1 -0
  67. package/src/version.ts +1 -1
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
12
 
13
- s.platforms = { :ios => "11.0", :tvos => "11.0" }
13
+ s.platforms = { :ios => "12.0", :tvos => "12.0" }
14
14
  s.source = { :git => "https://github.com/DataDog/dd-sdk-reactnative.git", :tag => "#{s.version}" }
15
15
 
16
16
 
@@ -7,4 +7,4 @@
7
7
  package com.datadog.reactnative
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- internal const val SDK_VERSION = "2.4.0"
10
+ internal const val SDK_VERSION = "2.4.1"
@@ -7,4 +7,4 @@
7
7
  import Foundation
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- let SdkVersion = "2.4.0"
10
+ let SdkVersion = "2.4.1"
@@ -31,6 +31,8 @@ var _DdSdk = require("./sdk/DdSdk");
31
31
 
32
32
  var _FileBasedConfiguration = require("./sdk/FileBasedConfiguration/FileBasedConfiguration");
33
33
 
34
+ var _GlobalState = require("./sdk/GlobalState/GlobalState");
35
+
34
36
  var _UserInfoSingleton = require("./sdk/UserInfoSingleton/UserInfoSingleton");
35
37
 
36
38
  var _types = require("./types");
@@ -98,13 +100,6 @@ class DdSdkReactNative {
98
100
  */
99
101
 
100
102
 
101
- /**
102
- * Returns `true` if the SDK was initialized, `false` otherwise.
103
- */
104
- static isInitialized() {
105
- return DdSdkReactNative._isInitialized;
106
- }
107
-
108
103
  static enableFeatures(configuration) {
109
104
  if (DdSdkReactNative.wasAutoInstrumented) {
110
105
  _InternalLog.InternalLog.log("Can't auto instrument Datadog, SDK was already instrumented", _SdkVerbosity.SdkVerbosity.WARN);
@@ -165,8 +160,6 @@ _defineProperty(DdSdkReactNative, "wasAutoInstrumented", false);
165
160
 
166
161
  _defineProperty(DdSdkReactNative, "features", void 0);
167
162
 
168
- _defineProperty(DdSdkReactNative, "_isInitialized", false);
169
-
170
163
  _defineProperty(DdSdkReactNative, "initialize", async configuration => {
171
164
  await DdSdkReactNative.initializeNativeSDK(configuration, {
172
165
  initializationModeForTelemetry: 'LEGACY'
@@ -175,7 +168,7 @@ _defineProperty(DdSdkReactNative, "initialize", async configuration => {
175
168
  });
176
169
 
177
170
  _defineProperty(DdSdkReactNative, "initializeNativeSDK", async (configuration, params) => {
178
- if (DdSdkReactNative._isInitialized) {
171
+ if (_GlobalState.GlobalState.instance.isInitialized) {
179
172
  _InternalLog.InternalLog.log("Can't initialize Datadog, SDK was already initialized", _SdkVerbosity.SdkVerbosity.WARN);
180
173
 
181
174
  if (!__DEV__) {
@@ -190,7 +183,7 @@ _defineProperty(DdSdkReactNative, "initializeNativeSDK", async (configuration, p
190
183
 
191
184
  _InternalLog.InternalLog.log('Datadog SDK was initialized', _SdkVerbosity.SdkVerbosity.INFO);
192
185
 
193
- DdSdkReactNative._isInitialized = true;
186
+ _GlobalState.GlobalState.instance.isInitialized = true;
194
187
 
195
188
  _BufferSingleton.BufferSingleton.onInitialization();
196
189
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","_initializeFromDatadogProvider","configuration","enableFeatures","FileBasedConfiguration","initializeNativeSDK","initializationModeForTelemetry","initializationMode","InitializationMode","SYNC","ASYNC","InteractionManager","runAfterInteractions","DdSdkReactNativeConfiguration","_enableFeaturesFromDatadogProvider","features","isInitialized","_isInitialized","wasAutoInstrumented","InternalLog","log","SdkVerbosity","WARN","trackInteractions","DdRumUserInteractionTracking","startTracking","actionNameAttribute","useAccessibilityLabel","trackResources","DdRumResourceTracking","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","DdRumErrorTracking","logEventMapper","DdLogs","registerLogEventMapper","errorEventMapper","DdRum","registerErrorEventMapper","resourceEventMapper","registerResourceEventMapper","actionEventMapper","registerActionEventMapper","params","__DEV__","DdSdk","telemetryDebug","Promise","resolve","verbosity","initialize","buildConfiguration","INFO","BufferSingleton","onInitialization","attributes","JSON","stringify","DEBUG","setAttributes","AttributesSingleton","getInstance","user","setUser","UserInfoSingleton","setUserInfo","consent","setTrackingConsent","clearAllData","additionalConfiguration","DD_SOURCE_KEY","DD_SDK_VERSION","sdkVersion","version","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","initializationType","trackNetworkRequests","reactNativeVersion","require","reactVersion","nativeViewTracking","nativeInteractionTracking","proxyConfig","serviceName","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":";;;;;;;AAMA;;AAEA;;AAcA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAU1B;AACJ;AACA;AACA;AACA;;AAuCI;AACJ;AACA;AAC+C,eAA9BC,8BAA8B,CACvCC,aADuC,EAE1B;AACbF,IAAAA,gBAAgB,CAACG,cAAjB,CAAgCD,aAAhC;;AACA,QAAIA,aAAa,YAAYE,8CAA7B,EAAqD;AACjD,aAAOJ,gBAAgB,CAACK,mBAAjB,CAAqCH,aAArC,EAAoD;AACvDI,QAAAA,8BAA8B,EAAE;AADuB,OAApD,CAAP;AAGH;;AACD,QAAIJ,aAAa,CAACK,kBAAd,KAAqCC,kDAAmBC,IAA5D,EAAkE;AAC9D,aAAOT,gBAAgB,CAACK,mBAAjB,CAAqCH,aAArC,EAAoD;AACvDI,QAAAA,8BAA8B,EAAE;AADuB,OAApD,CAAP;AAGH;;AACD,QAAIJ,aAAa,CAACK,kBAAd,KAAqCC,kDAAmBE,KAA5D,EAAmE;AAC/D,aAAOC,gCAAmBC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Aa,CAACuF,IAVX,EAWHvF,aAAa,CAACwF,eAXX,EAYHxF,aAAa,CAACqE,uBAZX,EAaHrE,aAAa,CAACyF,mBAbX,EAcHzF,aAAa,CAAC0F,qBAdX,EAeH1F,aAAa,CAAC2F,eAfX,EAgBH3F,aAAa,CAAC4F,SAhBX,EAiBH5F,aAAa,CAAC6F,iBAjBX,EAkBH7F,aAAa,CAAC8F,qBAlBX,EAmBH9F,aAAa,CAAC+F,eAnBX,EAoBH;AACIC,IAAAA,kBAAkB,EAAErD,MAAM,CAACvC,8BAD/B;AAEI2B,IAAAA,WAAW,EAAE/B,aAAa,CAAC+B,WAF/B;AAGIV,IAAAA,iBAAiB,EAAErB,aAAa,CAACqB,iBAHrC;AAII4E,IAAAA,oBAAoB,EAAEjG,aAAa,CAAC0B,cAJxC;AAKI;AACAwE,IAAAA,kBAAkB,EAAEC,OAAO,CAAC,2BAAD,CAAP,CACf1B,OAPT;AAQI;AACA2B,IAAAA,YAAY,EAAED,OAAO,CAAC,oBAAD,CAAP,CAA8B1B;AAThD,GApBG,EA+BHzE,aAAa,CAACqG,kBA/BX,EAgCHrG,aAAa,CAACsG,yBAhCX,EAiCHtG,aAAa,CAACiD,SAjCX,EAkCHjD,aAAa,CAACuG,WAlCX,EAmCHvG,aAAa,CAACwG,WAnCX,EAoCH,0DAAsBxG,aAAa,CAAC8B,eAApC,CApCG,EAqCH9B,aAAa,CAACyG,iBArCX,EAsCHzG,aAAa,CAAC0G,oBAtCX,CAAP;AAwCH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InteractionManager } from 'react-native';\n\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode,\n formatFirstPartyHosts\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';\nimport type { Attributes } from './sdk/AttributesSingleton/types';\nimport { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';\nimport { DdSdk } from './sdk/DdSdk';\nimport { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';\nimport { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';\nimport type { UserInfo } from './sdk/UserInfoSingleton/types';\nimport { DdSdkConfiguration } from './types';\nimport { adaptLongTaskThreshold } from './utils/longTasksUtils';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n private static _isInitialized = false;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static initialize = async (\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> => {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n };\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative._isInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n await DdSdk.initialize(\n DdSdkReactNative.buildConfiguration(configuration, params)\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative._isInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration instanceof FileBasedConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'FILE'\n });\n }\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.\n * To remove an attribute, set it to `undefined` in a call to `setAttributes`.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes = async (attributes: Attributes): Promise<void> => {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setAttributes(attributes);\n AttributesSingleton.getInstance().setAttributes(attributes);\n };\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser = async (user: UserInfo): Promise<void> => {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setUser(user);\n UserInfoSingleton.getInstance().setUserInfo(user);\n };\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent = (consent: TrackingConsent): Promise<void> => {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n };\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n * @returns a Promise\n */\n static clearAllData = (): Promise<void> => {\n InternalLog.log('Clearing all data', SdkVerbosity.DEBUG);\n return DdSdk.clearAllData();\n };\n\n /**\n * Returns `true` if the SDK was initialized, `false` otherwise.\n */\n public static isInitialized() {\n return DdSdkReactNative._isInitialized;\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): DdSdkConfiguration => {\n configuration.additionalConfiguration[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n\n if (configuration.version) {\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_VERSION\n ] = `${configuration.version}${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n return new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfiguration,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n configuration.uploadFrequency,\n configuration.batchSize,\n configuration.trackFrustrations,\n configuration.trackBackgroundEvents,\n configuration.customEndpoints,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources,\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n reactNativeVersion: require('react-native/package.json')\n .version,\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n reactVersion: require('react/package.json').version\n },\n configuration.nativeViewTracking,\n configuration.nativeInteractionTracking,\n configuration.verbosity,\n configuration.proxyConfig,\n configuration.serviceName,\n formatFirstPartyHosts(configuration.firstPartyHosts),\n configuration.bundleLogsWithRum,\n configuration.bundleLogsWithTraces\n );\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking({\n actionNameAttribute: configuration.actionNameAttribute,\n useAccessibilityLabel: configuration.useAccessibilityLabel\n });\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: formatFirstPartyHosts(\n configuration.firstPartyHosts\n )\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n\n if (configuration.logEventMapper) {\n DdLogs.registerLogEventMapper(configuration.logEventMapper);\n }\n\n if (configuration.errorEventMapper) {\n DdRum.registerErrorEventMapper(configuration.errorEventMapper);\n }\n\n if (configuration.resourceEventMapper) {\n DdRum.registerResourceEventMapper(\n configuration.resourceEventMapper\n );\n }\n\n if (configuration.actionEventMapper) {\n DdRum.registerActionEventMapper(configuration.actionEventMapper);\n }\n\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","_initializeFromDatadogProvider","configuration","enableFeatures","FileBasedConfiguration","initializeNativeSDK","initializationModeForTelemetry","initializationMode","InitializationMode","SYNC","ASYNC","InteractionManager","runAfterInteractions","DdSdkReactNativeConfiguration","_enableFeaturesFromDatadogProvider","features","wasAutoInstrumented","InternalLog","log","SdkVerbosity","WARN","trackInteractions","DdRumUserInteractionTracking","startTracking","actionNameAttribute","useAccessibilityLabel","trackResources","DdRumResourceTracking","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","DdRumErrorTracking","logEventMapper","DdLogs","registerLogEventMapper","errorEventMapper","DdRum","registerErrorEventMapper","resourceEventMapper","registerResourceEventMapper","actionEventMapper","registerActionEventMapper","params","GlobalState","instance","isInitialized","__DEV__","DdSdk","telemetryDebug","Promise","resolve","verbosity","initialize","buildConfiguration","INFO","BufferSingleton","onInitialization","attributes","JSON","stringify","DEBUG","setAttributes","AttributesSingleton","getInstance","user","setUser","UserInfoSingleton","setUserInfo","consent","setTrackingConsent","clearAllData","additionalConfiguration","DD_SOURCE_KEY","DD_SDK_VERSION","sdkVersion","version","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","initializationType","trackNetworkRequests","reactNativeVersion","require","reactVersion","nativeViewTracking","nativeInteractionTracking","proxyConfig","serviceName","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":";;;;;;;AAMA;;AAEA;;AAcA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAS1B;AACJ;AACA;AACA;AACA;;AAuCI;AACJ;AACA;AAC+C,eAA9BC,8BAA8B,CACvCC,aADuC,EAE1B;AACbF,IAAAA,gBAAgB,CAACG,cAAjB,CAAgCD,aAAhC;;AACA,QAAIA,aAAa,YAAYE,8CAA7B,EAAqD;AACjD,aAAOJ,gBAAgB,CAACK,mBAAjB,CAAqCH,aAArC,EAAoD;AACvDI,QAAAA,8BAA8B,EAAE;AADuB,OAApD,CAAP;AAGH;;AACD,QAAIJ,aAAa,CAACK,kBAAd,KAAqCC,kDAAmBC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mBAArC,CANG,EAOHpF,aAAa,CAACqF,UAAd,KAA6BC,SAA7B,GACMtF,aAAa,CAACuF,mBADpB,GAEMvF,aAAa,CAACqF,UATjB,EAUHrF,aAAa,CAACwF,IAVX,EAWHxF,aAAa,CAACyF,eAXX,EAYHzF,aAAa,CAACsE,uBAZX,EAaHtE,aAAa,CAAC0F,mBAbX,EAcH1F,aAAa,CAAC2F,qBAdX,EAeH3F,aAAa,CAAC4F,eAfX,EAgBH5F,aAAa,CAAC6F,SAhBX,EAiBH7F,aAAa,CAAC8F,iBAjBX,EAkBH9F,aAAa,CAAC+F,qBAlBX,EAmBH/F,aAAa,CAACgG,eAnBX,EAoBH;AACIC,IAAAA,kBAAkB,EAAExD,MAAM,CAACrC,8BAD/B;AAEIyB,IAAAA,WAAW,EAAE7B,aAAa,CAAC6B,WAF/B;AAGIV,IAAAA,iBAAiB,EAAEnB,aAAa,CAACmB,iBAHrC;AAII+E,IAAAA,oBAAoB,EAAElG,aAAa,CAACwB,cAJxC;AAKI;AACA2E,IAAAA,kBAAkB,EAAEC,OAAO,CAAC,2BAAD,CAAP,CACf1B,OAPT;AAQI;AACA2B,IAAAA,YAAY,EAAED,OAAO,CAAC,oBAAD,CAAP,CAA8B1B;AAThD,GApBG,EA+BH1E,aAAa,CAACsG,kBA/BX,EAgCHtG,aAAa,CAACuG,yBAhCX,EAiCHvG,aAAa,CAACkD,SAjCX,EAkCHlD,aAAa,CAACwG,WAlCX,EAmCHxG,aAAa,CAACyG,WAnCX,EAoCH,0DAAsBzG,aAAa,CAAC4B,eAApC,CApCG,EAqCH5B,aAAa,CAAC0G,iBArCX,EAsCH1G,aAAa,CAAC2G,oBAtCX,CAAP;AAwCH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InteractionManager } from 'react-native';\n\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode,\n formatFirstPartyHosts\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';\nimport type { Attributes } from './sdk/AttributesSingleton/types';\nimport { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';\nimport { DdSdk } from './sdk/DdSdk';\nimport { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';\nimport { GlobalState } from './sdk/GlobalState/GlobalState';\nimport { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';\nimport type { UserInfo } from './sdk/UserInfoSingleton/types';\nimport { DdSdkConfiguration } from './types';\nimport { adaptLongTaskThreshold } from './utils/longTasksUtils';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static initialize = async (\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> => {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n };\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (GlobalState.instance.isInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n await DdSdk.initialize(\n DdSdkReactNative.buildConfiguration(configuration, params)\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n GlobalState.instance.isInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration instanceof FileBasedConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'FILE'\n });\n }\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.\n * To remove an attribute, set it to `undefined` in a call to `setAttributes`.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes = async (attributes: Attributes): Promise<void> => {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setAttributes(attributes);\n AttributesSingleton.getInstance().setAttributes(attributes);\n };\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser = async (user: UserInfo): Promise<void> => {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setUser(user);\n UserInfoSingleton.getInstance().setUserInfo(user);\n };\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent = (consent: TrackingConsent): Promise<void> => {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n };\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n * @returns a Promise\n */\n static clearAllData = (): Promise<void> => {\n InternalLog.log('Clearing all data', SdkVerbosity.DEBUG);\n return DdSdk.clearAllData();\n };\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): DdSdkConfiguration => {\n configuration.additionalConfiguration[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n\n if (configuration.version) {\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_VERSION\n ] = `${configuration.version}${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfiguration[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n return new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfiguration,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n configuration.uploadFrequency,\n configuration.batchSize,\n configuration.trackFrustrations,\n configuration.trackBackgroundEvents,\n configuration.customEndpoints,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources,\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n reactNativeVersion: require('react-native/package.json')\n .version,\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n reactVersion: require('react/package.json').version\n },\n configuration.nativeViewTracking,\n configuration.nativeInteractionTracking,\n configuration.verbosity,\n configuration.proxyConfig,\n configuration.serviceName,\n formatFirstPartyHosts(configuration.firstPartyHosts),\n configuration.bundleLogsWithRum,\n configuration.bundleLogsWithTraces\n );\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking({\n actionNameAttribute: configuration.actionNameAttribute,\n useAccessibilityLabel: configuration.useAccessibilityLabel\n });\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: formatFirstPartyHosts(\n configuration.firstPartyHosts\n )\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n\n if (configuration.logEventMapper) {\n DdLogs.registerLogEventMapper(configuration.logEventMapper);\n }\n\n if (configuration.errorEventMapper) {\n DdRum.registerErrorEventMapper(configuration.errorEventMapper);\n }\n\n if (configuration.resourceEventMapper) {\n DdRum.registerResourceEventMapper(\n configuration.resourceEventMapper\n );\n }\n\n if (configuration.actionEventMapper) {\n DdRum.registerActionEventMapper(configuration.actionEventMapper);\n }\n\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
@@ -154,6 +154,8 @@ Object.defineProperty(exports, "TimeProvider", {
154
154
  }
155
155
  });
156
156
 
157
+ require("./polyfills");
158
+
157
159
  var _DdSdkReactNativeConfiguration = require("./DdSdkReactNativeConfiguration");
158
160
 
159
161
  var _DdSdkReactNative = require("./DdSdkReactNative");
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode,\n VitalsUpdateFrequency,\n UploadFrequency,\n BatchSize\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport {\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n} from './rum/instrumentation/resourceTracking/graphql/graphqlHeaders';\nimport { RumActionType, ErrorSource, PropagatorType } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\nimport { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';\nimport { DdTrace } from './trace/DdTrace';\nimport { DefaultTimeProvider } from './utils/time-provider/DefaultTimeProvider';\nimport { TimeProvider } from './utils/time-provider/TimeProvider';\nimport type { Timestamp } from './utils/time-provider/TimeProvider';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n FileBasedConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity,\n VitalsUpdateFrequency,\n PropagatorType,\n UploadFrequency,\n BatchSize,\n TimeProvider,\n DefaultTimeProvider,\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n};\n\nexport type { Timestamp };\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n/* eslint-disable arca/import-ordering */\n\nimport './polyfills';\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode,\n VitalsUpdateFrequency,\n UploadFrequency,\n BatchSize\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport {\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n} from './rum/instrumentation/resourceTracking/graphql/graphqlHeaders';\nimport { RumActionType, ErrorSource, PropagatorType } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\nimport { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';\nimport { DdTrace } from './trace/DdTrace';\nimport { DefaultTimeProvider } from './utils/time-provider/DefaultTimeProvider';\nimport { TimeProvider } from './utils/time-provider/TimeProvider';\nimport type { Timestamp } from './utils/time-provider/TimeProvider';\n\n/* eslint-enable arca/import-ordering */\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n FileBasedConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity,\n VitalsUpdateFrequency,\n PropagatorType,\n UploadFrequency,\n BatchSize,\n TimeProvider,\n DefaultTimeProvider,\n DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER,\n DATADOG_GRAPH_QL_OPERATION_NAME_HEADER,\n DATADOG_GRAPH_QL_VARIABLES_HEADER\n};\n\nexport type { Timestamp };\n"]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _package = require("react-native/package.json");
4
+
5
+ /*
6
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
7
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
8
+ * Copyright 2016-Present Datadog, Inc.
9
+ */
10
+ function applyBigIntPolyfill() {
11
+ const rnVersion = _package.version.split('.').map(Number);
12
+
13
+ const isRn63 = rnVersion[0] === 0 && rnVersion[1] === 63;
14
+
15
+ if (isRn63 && typeof BigInt === 'undefined') {
16
+ try {
17
+ // eslint-disable-next-line global-require, import/no-extraneous-dependencies
18
+ global.BigInt = require('big-integer');
19
+ console.warn('React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' + 'The missing type has been polyfilled using `big-integer` to grant back-compatibility. ' + 'We strongly suggest updating to a greater version of React Native (>= 0.64).');
20
+ } catch (e) {
21
+ if (e instanceof Error && e.code === 'MODULE_NOT_FOUND') {
22
+ throw new Error('React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' + 'We strongly suggest updating to a greater version of React Native (>= 0.64).\n\n' + 'You can install `big-integer` to enable our polyfill that grants back-compatibility with RN 63:\n\n' + '`yarn add big-integer`\n\nOR\n\n`npm install --save big-integer`');
23
+ } else {
24
+ throw e;
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ applyBigIntPolyfill();
31
+ //# sourceMappingURL=polyfills.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["polyfills.js"],"names":["applyBigIntPolyfill","rnVersion","reactNativeVersion","split","map","Number","isRn63","BigInt","global","require","console","warn","e","Error","code"],"mappings":";;AAMA;;AANA;AACA;AACA;AACA;AACA;AAIA,SAASA,mBAAT,GAA+B;AAC3B,QAAMC,SAAS,GAAGC,iBAAmBC,KAAnB,CAAyB,GAAzB,EAA8BC,GAA9B,CAAkCC,MAAlC,CAAlB;;AACA,QAAMC,MAAM,GAAGL,SAAS,CAAC,CAAD,CAAT,KAAiB,CAAjB,IAAsBA,SAAS,CAAC,CAAD,CAAT,KAAiB,EAAtD;;AAEA,MAAIK,MAAM,IAAI,OAAOC,MAAP,KAAkB,WAAhC,EAA6C;AACzC,QAAI;AACA;AACAC,MAAAA,MAAM,CAACD,MAAP,GAAgBE,OAAO,CAAC,aAAD,CAAvB;AACAC,MAAAA,OAAO,CAACC,IAAR,CACI,oHACI,wFADJ,GAEI,8EAHR;AAKH,KARD,CAQE,OAAOC,CAAP,EAAU;AACR,UAAIA,CAAC,YAAYC,KAAb,IAAsBD,CAAC,CAACE,IAAF,KAAW,kBAArC,EAAyD;AACrD,cAAM,IAAID,KAAJ,CACF,oHACI,kFADJ,GAEI,qGAFJ,GAGI,kEAJF,CAAN;AAMH,OAPD,MAOO;AACH,cAAMD,CAAN;AACH;AACJ;AACJ;AACJ;;AAEDZ,mBAAmB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { version as reactNativeVersion } from 'react-native/package.json';\n\nfunction applyBigIntPolyfill() {\n const rnVersion = reactNativeVersion.split('.').map(Number);\n const isRn63 = rnVersion[0] === 0 && rnVersion[1] === 63;\n\n if (isRn63 && typeof BigInt === 'undefined') {\n try {\n // eslint-disable-next-line global-require, import/no-extraneous-dependencies\n global.BigInt = require('big-integer');\n console.warn(\n 'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +\n 'The missing type has been polyfilled using `big-integer` to grant back-compatibility. ' +\n 'We strongly suggest updating to a greater version of React Native (>= 0.64).'\n );\n } catch (e) {\n if (e instanceof Error && e.code === 'MODULE_NOT_FOUND') {\n throw new Error(\n 'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +\n 'We strongly suggest updating to a greater version of React Native (>= 0.64).\\n\\n' +\n 'You can install `big-integer` to enable our polyfill that grants back-compatibility with RN 63:\\n\\n' +\n '`yarn add big-integer`\\n\\nOR\\n\\n`npm install --save big-integer`'\n );\n } else {\n throw e;\n }\n }\n }\n}\n\napplyBigIntPolyfill();\n"]}
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.DdRum = void 0;
7
7
 
8
- var _DdSdkReactNative = require("../DdSdkReactNative");
9
-
10
8
  var _InternalLog = require("../InternalLog");
11
9
 
12
10
  var _SdkVerbosity = require("../SdkVerbosity");
@@ -15,6 +13,8 @@ var _bufferNativeCall = require("../sdk/DatadogProvider/Buffer/bufferNativeCall"
15
13
 
16
14
  var _DdSdk = require("../sdk/DdSdk");
17
15
 
16
+ var _GlobalState = require("../sdk/GlobalState/GlobalState");
17
+
18
18
  var _argsUtils = require("../utils/argsUtils");
19
19
 
20
20
  var _DefaultTimeProvider = require("../utils/time-provider/DefaultTimeProvider");
@@ -216,7 +216,7 @@ class DdRumWrapper {
216
216
  }
217
217
 
218
218
  async getCurrentSessionId() {
219
- if (!_DdSdkReactNative.DdSdkReactNative.isInitialized()) {
219
+ if (!_GlobalState.GlobalState.instance.isInitialized) {
220
220
  return undefined;
221
221
  }
222
222
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DdRum.ts"],"names":["generateEmptyPromise","Promise","resolve","DdRumWrapper","require","default","undefined","DefaultTimeProvider","key","name","context","timestampMs","timeProvider","now","InternalLog","log","SdkVerbosity","DEBUG","nativeRum","startView","stopView","type","lastActionData","startAction","args","nativeCallArgs","getStopActionNativeCallArgs","callNativeStopAction","actionContext","mappedEvent","actionEventMapper","applyEventMapper","addAction","method","url","startResource","statusCode","kind","size","resourceContext","resourceEventMapper","stopResource","message","source","stacktrace","errorEventMapper","updatedContext","addError","addTiming","stopSession","value","JSON","stringify","addFeatureFlagEvaluation","stopAction","isNewStopActionAPI","isOldStopActionAPI","DdSdk","telemetryDebug","WARN","getCurrentSessionId","DdSdkReactNative","isInitialized","registerErrorEventMapper","unregisterErrorEventMapper","registerResourceEventMapper","unregisterResourceEventMapper","registerActionEventMapper","unregisterActionEventMapper","DdRum"],"mappings":";;;;;;;AAQA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAIA;;AAEA;;AAEA;;;;AAQA,MAAMA,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,EAApC,CAAnC;;AAEA,MAAMC,YAAN,CAAwC;AAAA;AAAA,uCAECC,OAAO,CAAC,sBAAD,CAAP,CAChCC,OAH+B;;AAAA;;AAAA,8CAKT,gDAAyBC,SAAzB,CALS;;AAAA,iDAMN,sDAA4BA,SAA5B,CANM;;AAAA,+CAOR,kDAA0BA,SAA1B,CAPQ;;AAAA,0CAQC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GAAyB,kDAA0BxB,SAA1B,CAAzB;AACH;;AA3RmC;;AAqXxC,MAAMiD,kBAAkB,GACpB/B,IADuB,IActB;AACD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAA1B;AACH,CAhBD;;AAkBA,MAAMgC,kBAAkB,GACpBhC,IADuB,IAS4B;AACnD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IAA+B,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,WAAzD;AACH,CAXD;;AAaO,MAAM6C,KAAK,GAAG,IAAIlE,YAAJ,EAAd","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { GestureResponderEvent } from 'react-native';\n\nimport { DdSdkReactNative } from '../DdSdkReactNative';\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeRumType } from '../nativeModulesTypes';\nimport { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\nimport { DdSdk } from '../sdk/DdSdk';\nimport { validateContext } from '../utils/argsUtils';\nimport { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';\nimport type { TimeProvider } from '../utils/time-provider/TimeProvider';\n\nimport type { ActionEventMapper } from './eventMappers/actionEventMapper';\nimport { generateActionEventMapper } from './eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './eventMappers/errorEventMapper';\nimport { generateErrorEventMapper } from './eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport { generateResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport type {\n DdRumType,\n RumActionType,\n ResourceKind,\n ErrorSource\n} from './types';\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\nclass DdRumWrapper implements DdRumType {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n private nativeRum: DdNativeRumType = require('../specs/NativeDdRum')\n .default;\n private lastActionData?: { type: RumActionType; name: string };\n private errorEventMapper = generateErrorEventMapper(undefined);\n private resourceEventMapper = generateResourceEventMapper(undefined);\n private actionEventMapper = generateActionEventMapper(undefined);\n private timeProvider: TimeProvider = new DefaultTimeProvider();\n\n startView = (\n key: string,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM View “${name}” #${key}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startView(\n key,\n name,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopView = (\n key: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(`Stopping RUM View #${key}`, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopView(key, validateContext(context), timestampMs)\n );\n };\n\n startAction = (\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n this.lastActionData = { type, name };\n return bufferVoidNativeCall(() =>\n this.nativeRum.startAction(\n type,\n name,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopAction = (\n ...args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ): Promise<void> => {\n InternalLog.log('Stopping current RUM Action', SdkVerbosity.DEBUG);\n const nativeCallArgs = this.getStopActionNativeCallArgs(args);\n this.lastActionData = undefined;\n if (!nativeCallArgs) {\n return generateEmptyPromise();\n }\n return this.callNativeStopAction(...nativeCallArgs);\n };\n\n setTimeProvider = (timeProvider: TimeProvider): void => {\n this.timeProvider = timeProvider;\n };\n\n addAction = (\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now(),\n actionContext?: GestureResponderEvent\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context: validateContext(context),\n timestampMs,\n actionContext\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(\n `Adding RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n startResource = (\n key: string,\n method: string,\n url: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM Resource #${key} ${method}: ${url}`,\n SdkVerbosity.DEBUG\n );\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.startResource(\n key,\n method,\n url,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopResource = (\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size: number = -1,\n context: object = {},\n timestampMs: number = this.timeProvider.now(),\n resourceContext?: XMLHttpRequest\n ): Promise<void> => {\n const mappedEvent = this.resourceEventMapper.applyEventMapper({\n key,\n statusCode,\n kind,\n size,\n context: validateContext(context),\n timestampMs,\n resourceContext\n });\n if (!mappedEvent) {\n /**\n * To drop the resource we call `stopResource` and pass the `_dd.drop_resource` attribute in the context.\n * It will be picked up by the resource mappers we implement on the native side that will drop the resource.\n * This ensures we don't have any \"started\" resource left in memory on the native side.\n */\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n key,\n statusCode,\n kind,\n size,\n {\n '_dd.resource.drop_resource': true\n },\n timestampMs\n )\n );\n }\n\n InternalLog.log(\n `Stopping RUM Resource #${key} status:${statusCode}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n mappedEvent.key,\n mappedEvent.statusCode,\n mappedEvent.kind,\n mappedEvent.size,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n addError = (\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n const mappedEvent = this.errorEventMapper.applyEventMapper({\n message,\n source,\n stacktrace,\n context: validateContext(context),\n timestampMs\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);\n const updatedContext: any = mappedEvent.context;\n updatedContext['_dd.error.source_type'] = 'react-native';\n return bufferVoidNativeCall(() =>\n this.nativeRum.addError(\n mappedEvent.message,\n mappedEvent.source,\n mappedEvent.stacktrace,\n updatedContext,\n mappedEvent.timestampMs\n )\n );\n };\n\n addTiming = (name: string): Promise<void> => {\n InternalLog.log(\n `Adding timing “${name}” to RUM View`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n };\n\n stopSession = (): Promise<void> => {\n InternalLog.log('Stopping RUM Session', SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopSession());\n };\n\n addFeatureFlagEvaluation = (\n name: string,\n value: unknown\n ): Promise<void> => {\n InternalLog.log(\n `Adding feature flag evaluation for name: ${name} with value: ${JSON.stringify(\n value\n )}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addFeatureFlagEvaluation(name, { value })\n );\n };\n\n async getCurrentSessionId(): Promise<string | undefined> {\n if (!DdSdkReactNative.isInitialized()) {\n return undefined;\n }\n return this.nativeRum.getCurrentSessionId();\n }\n\n registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {\n this.errorEventMapper = generateErrorEventMapper(errorEventMapper);\n }\n\n unregisterErrorEventMapper() {\n this.errorEventMapper = generateErrorEventMapper(undefined);\n }\n\n registerResourceEventMapper(resourceEventMapper: ResourceEventMapper) {\n this.resourceEventMapper = generateResourceEventMapper(\n resourceEventMapper\n );\n }\n\n unregisterResourceEventMapper() {\n this.resourceEventMapper = generateResourceEventMapper(undefined);\n }\n\n registerActionEventMapper(actionEventMapper: ActionEventMapper) {\n this.actionEventMapper = generateActionEventMapper(actionEventMapper);\n }\n\n unregisterActionEventMapper() {\n this.actionEventMapper = generateActionEventMapper(undefined);\n }\n\n private callNativeStopAction = (\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context: validateContext(context),\n timestampMs\n });\n if (!mappedEvent) {\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n type,\n name,\n {\n '_dd.action.drop_action': true\n },\n timestampMs\n )\n );\n }\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n private getStopActionNativeCallArgs = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ):\n | [\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ]\n | null => {\n if (isNewStopActionAPI(args)) {\n return [\n args[0],\n args[1],\n validateContext(args[2]),\n args[3] || this.timeProvider.now()\n ];\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug(\n 'DDdRum.stopAction called with the old signature'\n );\n const { type, name } = this.lastActionData;\n return [\n type,\n name,\n validateContext(args[0]),\n args[1] || this.timeProvider.now()\n ];\n }\n InternalLog.log(\n 'DdRum.startAction needs to be called before DdRum.stopAction',\n SdkVerbosity.WARN\n );\n } else {\n InternalLog.log(\n 'DdRum.stopAction was called with wrong arguments',\n SdkVerbosity.WARN\n );\n }\n\n return null;\n };\n}\n\nconst isNewStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n] => {\n return typeof args[0] === 'string';\n};\n\nconst isOldStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined';\n};\n\nexport const DdRum = new DdRumWrapper();\n"]}
1
+ {"version":3,"sources":["DdRum.ts"],"names":["generateEmptyPromise","Promise","resolve","DdRumWrapper","require","default","undefined","DefaultTimeProvider","key","name","context","timestampMs","timeProvider","now","InternalLog","log","SdkVerbosity","DEBUG","nativeRum","startView","stopView","type","lastActionData","startAction","args","nativeCallArgs","getStopActionNativeCallArgs","callNativeStopAction","actionContext","mappedEvent","actionEventMapper","applyEventMapper","addAction","method","url","startResource","statusCode","kind","size","resourceContext","resourceEventMapper","stopResource","message","source","stacktrace","errorEventMapper","updatedContext","addError","addTiming","stopSession","value","JSON","stringify","addFeatureFlagEvaluation","stopAction","isNewStopActionAPI","isOldStopActionAPI","DdSdk","telemetryDebug","WARN","getCurrentSessionId","GlobalState","instance","isInitialized","registerErrorEventMapper","unregisterErrorEventMapper","registerResourceEventMapper","unregisterResourceEventMapper","registerActionEventMapper","unregisterActionEventMapper","DdRum"],"mappings":";;;;;;;AAQA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAEA;;AAEA;;;;AAQA,MAAMA,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,EAApC,CAAnC;;AAEA,MAAMC,YAAN,CAAwC;AAAA;AAAA,uCAECC,OAAO,CAAC,sBAAD,CAAP,CAChCC,OAH+B;;AAAA;;AAAA,8CAKT,gDAAyBC,SAAzB,CALS;;AAAA,iDAMN,sDAA4BA,SAA5B,CANM;;AAAA,+CAOR,kDAA0BA,SAA1B,CAPQ;;AAAA,0CAQC,IAAIC,wCAAJ,EARD;;AAAA,uCAUxB,CACRC,GADQ,EAERC,IAFQ,EAGRC,OAAe,GAAG,EAHV,EAIR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ADuB,IActB;AACD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAA1B;AACH,CAhBD;;AAkBA,MAAMgC,kBAAkB,GACpBhC,IADuB,IAS4B;AACnD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IAA+B,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,WAAzD;AACH,CAXD;;AAaO,MAAM8C,KAAK,GAAG,IAAInE,YAAJ,EAAd","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { GestureResponderEvent } from 'react-native';\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeRumType } from '../nativeModulesTypes';\nimport { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\nimport { DdSdk } from '../sdk/DdSdk';\nimport { GlobalState } from '../sdk/GlobalState/GlobalState';\nimport { validateContext } from '../utils/argsUtils';\nimport { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';\nimport type { TimeProvider } from '../utils/time-provider/TimeProvider';\n\nimport type { ActionEventMapper } from './eventMappers/actionEventMapper';\nimport { generateActionEventMapper } from './eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './eventMappers/errorEventMapper';\nimport { generateErrorEventMapper } from './eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport { generateResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport type {\n DdRumType,\n RumActionType,\n ResourceKind,\n ErrorSource\n} from './types';\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\nclass DdRumWrapper implements DdRumType {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n private nativeRum: DdNativeRumType = require('../specs/NativeDdRum')\n .default;\n private lastActionData?: { type: RumActionType; name: string };\n private errorEventMapper = generateErrorEventMapper(undefined);\n private resourceEventMapper = generateResourceEventMapper(undefined);\n private actionEventMapper = generateActionEventMapper(undefined);\n private timeProvider: TimeProvider = new DefaultTimeProvider();\n\n startView = (\n key: string,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM View “${name}” #${key}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startView(\n key,\n name,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopView = (\n key: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(`Stopping RUM View #${key}`, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopView(key, validateContext(context), timestampMs)\n );\n };\n\n startAction = (\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n this.lastActionData = { type, name };\n return bufferVoidNativeCall(() =>\n this.nativeRum.startAction(\n type,\n name,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopAction = (\n ...args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ): Promise<void> => {\n InternalLog.log('Stopping current RUM Action', SdkVerbosity.DEBUG);\n const nativeCallArgs = this.getStopActionNativeCallArgs(args);\n this.lastActionData = undefined;\n if (!nativeCallArgs) {\n return generateEmptyPromise();\n }\n return this.callNativeStopAction(...nativeCallArgs);\n };\n\n setTimeProvider = (timeProvider: TimeProvider): void => {\n this.timeProvider = timeProvider;\n };\n\n addAction = (\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now(),\n actionContext?: GestureResponderEvent\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context: validateContext(context),\n timestampMs,\n actionContext\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(\n `Adding RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n startResource = (\n key: string,\n method: string,\n url: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(\n `Starting RUM Resource #${key} ${method}: ${url}`,\n SdkVerbosity.DEBUG\n );\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.startResource(\n key,\n method,\n url,\n validateContext(context),\n timestampMs\n )\n );\n };\n\n stopResource = (\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size: number = -1,\n context: object = {},\n timestampMs: number = this.timeProvider.now(),\n resourceContext?: XMLHttpRequest\n ): Promise<void> => {\n const mappedEvent = this.resourceEventMapper.applyEventMapper({\n key,\n statusCode,\n kind,\n size,\n context: validateContext(context),\n timestampMs,\n resourceContext\n });\n if (!mappedEvent) {\n /**\n * To drop the resource we call `stopResource` and pass the `_dd.drop_resource` attribute in the context.\n * It will be picked up by the resource mappers we implement on the native side that will drop the resource.\n * This ensures we don't have any \"started\" resource left in memory on the native side.\n */\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n key,\n statusCode,\n kind,\n size,\n {\n '_dd.resource.drop_resource': true\n },\n timestampMs\n )\n );\n }\n\n InternalLog.log(\n `Stopping RUM Resource #${key} status:${statusCode}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n mappedEvent.key,\n mappedEvent.statusCode,\n mappedEvent.kind,\n mappedEvent.size,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n addError = (\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context: object = {},\n timestampMs: number = this.timeProvider.now()\n ): Promise<void> => {\n const mappedEvent = this.errorEventMapper.applyEventMapper({\n message,\n source,\n stacktrace,\n context: validateContext(context),\n timestampMs\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);\n const updatedContext: any = mappedEvent.context;\n updatedContext['_dd.error.source_type'] = 'react-native';\n return bufferVoidNativeCall(() =>\n this.nativeRum.addError(\n mappedEvent.message,\n mappedEvent.source,\n mappedEvent.stacktrace,\n updatedContext,\n mappedEvent.timestampMs\n )\n );\n };\n\n addTiming = (name: string): Promise<void> => {\n InternalLog.log(\n `Adding timing “${name}” to RUM View`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n };\n\n stopSession = (): Promise<void> => {\n InternalLog.log('Stopping RUM Session', SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopSession());\n };\n\n addFeatureFlagEvaluation = (\n name: string,\n value: unknown\n ): Promise<void> => {\n InternalLog.log(\n `Adding feature flag evaluation for name: ${name} with value: ${JSON.stringify(\n value\n )}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addFeatureFlagEvaluation(name, { value })\n );\n };\n\n async getCurrentSessionId(): Promise<string | undefined> {\n if (!GlobalState.instance.isInitialized) {\n return undefined;\n }\n return this.nativeRum.getCurrentSessionId();\n }\n\n registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {\n this.errorEventMapper = generateErrorEventMapper(errorEventMapper);\n }\n\n unregisterErrorEventMapper() {\n this.errorEventMapper = generateErrorEventMapper(undefined);\n }\n\n registerResourceEventMapper(resourceEventMapper: ResourceEventMapper) {\n this.resourceEventMapper = generateResourceEventMapper(\n resourceEventMapper\n );\n }\n\n unregisterResourceEventMapper() {\n this.resourceEventMapper = generateResourceEventMapper(undefined);\n }\n\n registerActionEventMapper(actionEventMapper: ActionEventMapper) {\n this.actionEventMapper = generateActionEventMapper(actionEventMapper);\n }\n\n unregisterActionEventMapper() {\n this.actionEventMapper = generateActionEventMapper(undefined);\n }\n\n private callNativeStopAction = (\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context: validateContext(context),\n timestampMs\n });\n if (!mappedEvent) {\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n type,\n name,\n {\n '_dd.action.drop_action': true\n },\n timestampMs\n )\n );\n }\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n private getStopActionNativeCallArgs = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ):\n | [\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ]\n | null => {\n if (isNewStopActionAPI(args)) {\n return [\n args[0],\n args[1],\n validateContext(args[2]),\n args[3] || this.timeProvider.now()\n ];\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug(\n 'DDdRum.stopAction called with the old signature'\n );\n const { type, name } = this.lastActionData;\n return [\n type,\n name,\n validateContext(args[0]),\n args[1] || this.timeProvider.now()\n ];\n }\n InternalLog.log(\n 'DdRum.startAction needs to be called before DdRum.stopAction',\n SdkVerbosity.WARN\n );\n } else {\n InternalLog.log(\n 'DdRum.stopAction was called with wrong arguments',\n SdkVerbosity.WARN\n );\n }\n\n return null;\n };\n}\n\nconst isNewStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n] => {\n return typeof args[0] === 'string';\n};\n\nconst isOldStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined';\n};\n\nexport const DdRum = new DdRumWrapper();\n"]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GlobalState = void 0;
7
+
8
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
+
10
+ /*
11
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
12
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
13
+ * Copyright 2016-Present Datadog, Inc.
14
+ */
15
+
16
+ /**
17
+ * A singleton container for attributes that are shared internally across all
18
+ * the SDK classes.
19
+ */
20
+ class GlobalState {
21
+ constructor() {
22
+ _defineProperty(this, "isInitialized", false);
23
+ }
24
+
25
+ static get instance() {
26
+ if (this._instance === undefined) {
27
+ this._instance = new GlobalState();
28
+ }
29
+
30
+ return this._instance;
31
+ }
32
+
33
+ }
34
+
35
+ exports.GlobalState = GlobalState;
36
+
37
+ _defineProperty(GlobalState, "_instance", undefined);
38
+ //# sourceMappingURL=GlobalState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["GlobalState.tsx"],"names":["GlobalState","instance","_instance","undefined"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO,MAAMA,WAAN,CAAkB;AAAA;AAAA,2CAIE,KAJF;AAAA;;AAQK,aAARC,QAAQ,GAAgB;AACtC,QAAI,KAAKC,SAAL,KAAmBC,SAAvB,EAAkC;AAC9B,WAAKD,SAAL,GAAiB,IAAIF,WAAJ,EAAjB;AACH;;AAED,WAAO,KAAKE,SAAZ;AACH;;AAdoB;;;;gBAAZF,W,eAO2CG,S","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A singleton container for attributes that are shared internally across all\n * the SDK classes.\n */\nexport class GlobalState {\n /**\n * `true` if the SDK is initialized, `false` otherwise.\n */\n public isInitialized = false;\n\n // Singleton implementation\n private static _instance: GlobalState | undefined = undefined;\n public static get instance(): GlobalState {\n if (this._instance === undefined) {\n this._instance = new GlobalState();\n }\n\n return this._instance;\n }\n}\n"]}
@@ -14,6 +14,7 @@ var _reactNative = require("react-native");
14
14
  */
15
15
 
16
16
  /* eslint-disable @typescript-eslint/ban-types */
17
+ // eslint-disable-next-line import/no-default-export
17
18
  var _default = _reactNative.TurboModuleRegistry.get('DdLogs');
18
19
 
19
20
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdLogs.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;eAuGeA,iCAAoBC,GAApB,CAA8B,QAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeLogsType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Send a log with DEBUG level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly debug: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with INFO level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly info: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with WARN level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly warn: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with ERROR level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly error: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log containing an error with DEBUG level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly debugWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with INFO level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly infoWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with WARN level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly warnWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with ERROR level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly errorWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdLogs');\n"]}
1
+ {"version":3,"sources":["NativeDdLogs.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;AAuGA;eACeA,iCAAoBC,GAApB,CAA8B,QAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeLogsType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Send a log with DEBUG level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly debug: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with INFO level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly info: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with WARN level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly warn: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with ERROR level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly error: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log containing an error with DEBUG level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly debugWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with INFO level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly infoWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with WARN level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly warnWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with ERROR level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly errorWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdLogs');\n"]}
@@ -14,6 +14,7 @@ var _reactNative = require("react-native");
14
14
  */
15
15
 
16
16
  /* eslint-disable @typescript-eslint/ban-types */
17
+ // eslint-disable-next-line import/no-default-export
17
18
  var _default = _reactNative.TurboModuleRegistry.get('DdRum');
18
19
 
19
20
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdRum.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;eAqJeA,iCAAoBC,GAApB,CAA8B,OAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeRumType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(key: string, context: Object, timestampMs: number): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: string,\n size: number,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: string,\n stacktrace: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n\n /**\n * Stops the current RUM Session.\n */\n stopSession(): Promise<void>;\n\n /**\n * Adds the result of evaluating a feature flag with a given name and value to the view.\n * Feature flag evaluations are local to the active view and are cleared when the view is stopped.\n * @param name: The name of the feature flag\n * @param value: The value of the feature flag, encapsulated in an Object to accept all types\n */\n addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;\n\n /**\n * Get current Session ID, or `undefined` if not available.\n */\n getCurrentSessionId(): Promise<string | undefined>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdRum');\n"]}
1
+ {"version":3,"sources":["NativeDdRum.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;AAqJA;eACeA,iCAAoBC,GAApB,CAA8B,OAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeRumType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(key: string, context: Object, timestampMs: number): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: string,\n size: number,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: string,\n stacktrace: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n\n /**\n * Stops the current RUM Session.\n */\n stopSession(): Promise<void>;\n\n /**\n * Adds the result of evaluating a feature flag with a given name and value to the view.\n * Feature flag evaluations are local to the active view and are cleared when the view is stopped.\n * @param name: The name of the feature flag\n * @param value: The value of the feature flag, encapsulated in an Object to accept all types\n */\n addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;\n\n /**\n * Get current Session ID, or `undefined` if not available.\n */\n getCurrentSessionId(): Promise<string | undefined>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdRum');\n"]}
@@ -14,6 +14,7 @@ var _reactNative = require("react-native");
14
14
  */
15
15
 
16
16
  /* eslint-disable @typescript-eslint/ban-types */
17
+ // eslint-disable-next-line import/no-default-export
17
18
  var _default = _reactNative.TurboModuleRegistry.get('DdSdk');
18
19
 
19
20
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdSdk.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;eA4DeA,iCAAoBC,GAApB,CAA8B,OAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeSdkType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: Object): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: Object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: Object): Promise<Object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n\n /**\n * Send webview telemetry logs\n * @param message event description\n */\n consumeWebviewEvent(message: string): Promise<void>;\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n */\n clearAllData(): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdSdk');\n"]}
1
+ {"version":3,"sources":["NativeDdSdk.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;AA4DA;eACeA,iCAAoBC,GAApB,CAA8B,OAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeSdkType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: Object): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: Object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: Object): Promise<Object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n\n /**\n * Send webview telemetry logs\n * @param message event description\n */\n consumeWebviewEvent(message: string): Promise<void>;\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n */\n clearAllData(): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdSdk');\n"]}
@@ -14,6 +14,7 @@ var _reactNative = require("react-native");
14
14
  */
15
15
 
16
16
  /* eslint-disable @typescript-eslint/ban-types */
17
+ // eslint-disable-next-line import/no-default-export
17
18
  var _default = _reactNative.TurboModuleRegistry.get('DdTrace');
18
19
 
19
20
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdTrace.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;eAmCeA,iCAAoBC,GAApB,CAA8B,SAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeTraceType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context: Object,\n timestampMs: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdTrace');\n"]}
1
+ {"version":3,"sources":["NativeDdTrace.ts"],"names":["TurboModuleRegistry","get"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;AACA;AACA;;AAEA;AAmCA;eACeA,iCAAoBC,GAApB,CAA8B,SAA9B,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeTraceType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context: Object,\n timestampMs: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdTrace');\n"]}
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = '2.4.0';
8
+ const version = '2.4.1';
9
9
  exports.version = version;
10
10
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.4.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.4.1';\n"]}