@datadog/mobile-react-native 2.14.1 → 3.0.0

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 (670) hide show
  1. package/DatadogSDKReactNative.podspec +6 -6
  2. package/README.md +23 -13
  3. package/android/build.gradle +10 -11
  4. package/android/gradle.properties +1 -1
  5. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +36 -93
  6. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +46 -59
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +2 -1
  8. package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +98 -0
  9. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +125 -75
  10. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +199 -90
  11. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +151 -24
  12. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +57 -33
  13. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +2 -1
  14. package/android/src/main/kotlin/com/datadog/reactnative/DdTelemetry.kt +96 -0
  15. package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +20 -19
  16. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  17. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +100 -1
  18. package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +68 -14
  19. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +94 -0
  20. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +70 -11
  21. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +58 -0
  22. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +63 -43
  23. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +2024 -1199
  24. package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +44 -40
  25. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +60 -91
  26. package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +34 -14
  27. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +47 -43
  28. package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +0 -1
  29. package/android/src/test/resources/input/complete-configuration.json +32 -28
  30. package/android/src/test/resources/input/malformed-configuration.json +1 -1
  31. package/android/src/test/resources/input/minimal-configuration.json +4 -2
  32. package/datadog-configuration.schema.json +187 -139
  33. package/ios/Sources/AnyEncodable.swift +14 -7
  34. package/ios/Sources/Attributes.swift +0 -7
  35. package/ios/Sources/DatadogSDKWrapper.swift +12 -128
  36. package/ios/Sources/DdLogsImplementation.swift +9 -39
  37. package/ios/Sources/DdRum.mm +89 -1
  38. package/ios/Sources/DdRumImplementation.swift +79 -0
  39. package/ios/Sources/DdSdk.mm +76 -11
  40. package/ios/Sources/DdSdkConfiguration.swift +159 -117
  41. package/ios/Sources/DdSdkImplementation.swift +235 -82
  42. package/ios/Sources/DdSdkNativeInitialization.swift +116 -80
  43. package/ios/Sources/DdTelemetry.swift +49 -0
  44. package/ios/Sources/GlobalState.swift +1 -1
  45. package/ios/Sources/RNDdSdkConfiguration.swift +334 -172
  46. package/ios/Sources/SdkVersion.swift +1 -1
  47. package/jest/mock.js +43 -4
  48. package/lib/commonjs/DdAttributes.js.map +1 -0
  49. package/lib/commonjs/DdSdkReactNative.js +159 -56
  50. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  51. package/lib/commonjs/InternalLog.js +1 -1
  52. package/lib/commonjs/config/DatadogProviderConfiguration.js +25 -0
  53. package/lib/commonjs/config/DatadogProviderConfiguration.js.map +1 -0
  54. package/lib/commonjs/config/FileBasedConfiguration.js +349 -0
  55. package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -0
  56. package/lib/commonjs/config/FileBasedConfiguration.type.js +6 -0
  57. package/lib/commonjs/config/FileBasedConfiguration.type.js.map +1 -0
  58. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +51 -0
  59. package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -0
  60. package/lib/commonjs/config/async/PartialInitializationConfiguration.js +6 -0
  61. package/lib/commonjs/config/async/PartialInitializationConfiguration.js.map +1 -0
  62. package/lib/commonjs/config/async/asyncInitializationHelper.js +44 -0
  63. package/lib/commonjs/config/async/asyncInitializationHelper.js.map +1 -0
  64. package/lib/commonjs/config/features/CoreConfiguration.js +104 -0
  65. package/lib/commonjs/config/features/CoreConfiguration.js.map +1 -0
  66. package/lib/commonjs/config/features/CoreConfiguration.type.js +6 -0
  67. package/lib/commonjs/config/features/CoreConfiguration.type.js.map +1 -0
  68. package/lib/commonjs/config/features/CoreConfigurationNative.js +38 -0
  69. package/lib/commonjs/config/features/CoreConfigurationNative.js.map +1 -0
  70. package/lib/commonjs/config/features/LogsConfiguration.js +36 -0
  71. package/lib/commonjs/config/features/LogsConfiguration.js.map +1 -0
  72. package/lib/commonjs/config/features/LogsConfiguration.type.js +6 -0
  73. package/lib/commonjs/config/features/LogsConfiguration.type.js.map +1 -0
  74. package/lib/commonjs/config/features/LogsConfigurationNative.js +2 -0
  75. package/lib/commonjs/config/features/LogsConfigurationNative.js.map +1 -0
  76. package/lib/commonjs/config/features/RumConfiguration.js +120 -0
  77. package/lib/commonjs/config/features/RumConfiguration.js.map +1 -0
  78. package/lib/commonjs/config/features/RumConfiguration.type.js +6 -0
  79. package/lib/commonjs/config/features/RumConfiguration.type.js.map +1 -0
  80. package/lib/commonjs/config/features/RumConfigurationNative.js +2 -0
  81. package/lib/commonjs/config/features/RumConfigurationNative.js.map +1 -0
  82. package/lib/commonjs/config/features/TraceConfiguration.js +24 -0
  83. package/lib/commonjs/config/features/TraceConfiguration.js.map +1 -0
  84. package/lib/commonjs/config/features/TraceConfiguration.type.js +2 -0
  85. package/lib/commonjs/config/features/TraceConfiguration.type.js.map +1 -0
  86. package/lib/commonjs/config/features/TraceConfigurationNative.js +2 -0
  87. package/lib/commonjs/config/features/TraceConfigurationNative.js.map +1 -0
  88. package/lib/commonjs/config/types/BatchProcessingLevel.js +30 -0
  89. package/lib/commonjs/config/types/BatchProcessingLevel.js.map +1 -0
  90. package/lib/commonjs/config/types/BatchSize.js +31 -0
  91. package/lib/commonjs/config/types/BatchSize.js.map +1 -0
  92. package/lib/commonjs/config/types/InitializationMode.js +17 -0
  93. package/lib/commonjs/config/types/InitializationMode.js.map +1 -0
  94. package/lib/commonjs/config/types/InitializationModeForTelemetry.js +2 -0
  95. package/lib/commonjs/config/types/InitializationModeForTelemetry.js.map +1 -0
  96. package/lib/commonjs/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
  97. package/lib/commonjs/config/types/ProxyConfiguration.js.map +1 -0
  98. package/lib/commonjs/config/types/SdkVerbosity.js.map +1 -0
  99. package/lib/commonjs/config/types/TrackingConsent.js.map +1 -0
  100. package/lib/commonjs/config/types/UploadFrequency.js +30 -0
  101. package/lib/commonjs/config/types/UploadFrequency.js.map +1 -0
  102. package/lib/commonjs/config/types/VitalsUpdateFrequency.js +19 -0
  103. package/lib/commonjs/config/types/VitalsUpdateFrequency.js.map +1 -0
  104. package/lib/commonjs/config/types/index.js +68 -0
  105. package/lib/commonjs/config/types/index.js.map +1 -0
  106. package/lib/commonjs/index.js +51 -21
  107. package/lib/commonjs/index.js.map +1 -1
  108. package/lib/commonjs/logs/DdLogs.js +13 -9
  109. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  110. package/lib/commonjs/logs/eventMapper.js +4 -1
  111. package/lib/commonjs/logs/eventMapper.js.map +1 -1
  112. package/lib/commonjs/nativeModulesTypes.js +0 -45
  113. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  114. package/lib/commonjs/rum/DdRum.js +56 -28
  115. package/lib/commonjs/rum/DdRum.js.map +1 -1
  116. package/lib/commonjs/rum/helper.js +63 -0
  117. package/lib/commonjs/rum/helper.js.map +1 -0
  118. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +14 -18
  119. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  120. package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -25
  121. package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
  122. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
  123. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
  124. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  125. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +34 -22
  126. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  127. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +21 -1
  128. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
  129. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +16 -3
  130. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  131. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -12
  132. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  133. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +6 -0
  134. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
  135. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +41 -47
  136. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  137. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +62 -0
  138. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
  139. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
  140. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js +36 -0
  141. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
  142. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
  143. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +19 -8
  144. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  145. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
  146. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
  147. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
  148. package/lib/commonjs/rum/types.js +1 -9
  149. package/lib/commonjs/rum/types.js.map +1 -1
  150. package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +46 -0
  151. package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
  152. package/lib/commonjs/sdk/AccountInfoSingleton/types.js +2 -0
  153. package/lib/commonjs/sdk/AccountInfoSingleton/types.js.map +1 -0
  154. package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js +51 -0
  155. package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
  156. package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js +140 -0
  157. package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
  158. package/lib/commonjs/{utils → sdk/AttributesEncoding}/errorUtils.js +39 -22
  159. package/lib/commonjs/sdk/AttributesEncoding/errorUtils.js.map +1 -0
  160. package/lib/commonjs/sdk/AttributesEncoding/helpers.js +123 -0
  161. package/lib/commonjs/sdk/AttributesEncoding/helpers.js.map +1 -0
  162. package/lib/commonjs/sdk/AttributesEncoding/types.js +2 -0
  163. package/lib/commonjs/sdk/AttributesEncoding/types.js.map +1 -0
  164. package/lib/commonjs/sdk/AttributesEncoding/utils.js +36 -0
  165. package/lib/commonjs/sdk/AttributesEncoding/utils.js.map +1 -0
  166. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
  167. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  168. package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +3 -3
  169. package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
  170. package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
  171. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
  172. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  173. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +10 -9
  174. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  175. package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js +28 -0
  176. package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
  177. package/lib/commonjs/sdk/DdSdk.js +4 -2
  178. package/lib/commonjs/sdk/DdSdk.js.map +1 -1
  179. package/lib/commonjs/sdk/DdSdkInternal.js +86 -0
  180. package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -0
  181. package/lib/commonjs/sdk/EventMappers/EventMapper.js +6 -3
  182. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
  183. package/lib/commonjs/sdk/GlobalState/GlobalState.js +5 -11
  184. package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
  185. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
  186. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  187. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  188. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  189. package/lib/commonjs/trace/DdTrace.js +7 -5
  190. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  191. package/lib/commonjs/types.js +19 -46
  192. package/lib/commonjs/types.js.map +1 -1
  193. package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
  194. package/lib/commonjs/utils/singletonUtils.js +21 -0
  195. package/lib/commonjs/utils/singletonUtils.js.map +1 -0
  196. package/lib/commonjs/version.js +1 -1
  197. package/lib/commonjs/version.js.map +1 -1
  198. package/lib/module/DdAttributes.js.map +1 -0
  199. package/lib/module/DdSdkReactNative.js +155 -52
  200. package/lib/module/DdSdkReactNative.js.map +1 -1
  201. package/lib/module/InternalLog.js +1 -1
  202. package/lib/module/InternalLog.js.map +1 -1
  203. package/lib/module/config/DatadogProviderConfiguration.js +18 -0
  204. package/lib/module/config/DatadogProviderConfiguration.js.map +1 -0
  205. package/lib/module/config/FileBasedConfiguration.js +341 -0
  206. package/lib/module/config/FileBasedConfiguration.js.map +1 -0
  207. package/lib/module/config/FileBasedConfiguration.type.js +2 -0
  208. package/lib/module/config/FileBasedConfiguration.type.js.map +1 -0
  209. package/lib/module/config/async/AutoInstrumentationConfiguration.js +45 -0
  210. package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -0
  211. package/lib/module/config/async/PartialInitializationConfiguration.js +2 -0
  212. package/lib/module/config/async/PartialInitializationConfiguration.js.map +1 -0
  213. package/lib/module/config/async/asyncInitializationHelper.js +36 -0
  214. package/lib/module/config/async/asyncInitializationHelper.js.map +1 -0
  215. package/lib/module/config/features/CoreConfiguration.js +98 -0
  216. package/lib/module/config/features/CoreConfiguration.js.map +1 -0
  217. package/lib/module/config/features/CoreConfiguration.type.js +2 -0
  218. package/lib/module/config/features/CoreConfiguration.type.js.map +1 -0
  219. package/lib/module/config/features/CoreConfigurationNative.js +31 -0
  220. package/lib/module/config/features/CoreConfigurationNative.js.map +1 -0
  221. package/lib/module/config/features/LogsConfiguration.js +30 -0
  222. package/lib/module/config/features/LogsConfiguration.js.map +1 -0
  223. package/lib/module/config/features/LogsConfiguration.type.js +2 -0
  224. package/lib/module/config/features/LogsConfiguration.type.js.map +1 -0
  225. package/lib/module/config/features/LogsConfigurationNative.js +2 -0
  226. package/lib/module/config/features/LogsConfigurationNative.js.map +1 -0
  227. package/lib/module/config/features/RumConfiguration.js +114 -0
  228. package/lib/module/config/features/RumConfiguration.js.map +1 -0
  229. package/lib/module/config/features/RumConfiguration.type.js +2 -0
  230. package/lib/module/config/features/RumConfiguration.type.js.map +1 -0
  231. package/lib/module/config/features/RumConfigurationNative.js +2 -0
  232. package/lib/module/config/features/RumConfigurationNative.js.map +1 -0
  233. package/lib/module/config/features/TraceConfiguration.js +18 -0
  234. package/lib/module/config/features/TraceConfiguration.js.map +1 -0
  235. package/lib/module/config/features/TraceConfiguration.type.js +2 -0
  236. package/lib/module/config/features/TraceConfiguration.type.js.map +1 -0
  237. package/lib/module/config/features/TraceConfigurationNative.js +2 -0
  238. package/lib/module/config/features/TraceConfigurationNative.js.map +1 -0
  239. package/lib/module/config/types/BatchProcessingLevel.js +25 -0
  240. package/lib/module/config/types/BatchProcessingLevel.js.map +1 -0
  241. package/lib/module/config/types/BatchSize.js +26 -0
  242. package/lib/module/config/types/BatchSize.js.map +1 -0
  243. package/lib/module/config/types/InitializationMode.js +11 -0
  244. package/lib/module/config/types/InitializationMode.js.map +1 -0
  245. package/lib/module/config/types/InitializationModeForTelemetry.js +2 -0
  246. package/lib/module/config/types/InitializationModeForTelemetry.js.map +1 -0
  247. package/lib/module/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
  248. package/lib/module/config/types/ProxyConfiguration.js.map +1 -0
  249. package/lib/module/config/types/SdkVerbosity.js.map +1 -0
  250. package/lib/module/config/types/TrackingConsent.js.map +1 -0
  251. package/lib/module/config/types/UploadFrequency.js +25 -0
  252. package/lib/module/config/types/UploadFrequency.js.map +1 -0
  253. package/lib/module/config/types/VitalsUpdateFrequency.js +13 -0
  254. package/lib/module/config/types/VitalsUpdateFrequency.js.map +1 -0
  255. package/lib/module/config/types/index.js +15 -0
  256. package/lib/module/config/types/index.js.map +1 -0
  257. package/lib/module/index.js +13 -7
  258. package/lib/module/index.js.map +1 -1
  259. package/lib/module/logs/DdLogs.js +13 -9
  260. package/lib/module/logs/DdLogs.js.map +1 -1
  261. package/lib/module/logs/eventMapper.js +4 -1
  262. package/lib/module/logs/eventMapper.js.map +1 -1
  263. package/lib/module/nativeModulesTypes.js +1 -43
  264. package/lib/module/nativeModulesTypes.js.map +1 -1
  265. package/lib/module/rum/DdRum.js +54 -26
  266. package/lib/module/rum/DdRum.js.map +1 -1
  267. package/lib/module/rum/helper.js +49 -0
  268. package/lib/module/rum/helper.js.map +1 -0
  269. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +14 -18
  270. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  271. package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +15 -24
  272. package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
  273. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
  274. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  275. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
  276. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  277. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +33 -21
  278. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  279. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +22 -1
  280. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
  281. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +13 -2
  282. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  283. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -11
  284. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  285. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +2 -0
  286. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
  287. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +27 -33
  288. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  289. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +54 -0
  290. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
  291. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
  292. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  293. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js +30 -0
  294. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
  295. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
  296. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  297. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +14 -3
  298. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  299. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
  300. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
  301. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
  302. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  303. package/lib/module/rum/types.js +0 -9
  304. package/lib/module/rum/types.js.map +1 -1
  305. package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +39 -0
  306. package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
  307. package/lib/module/sdk/AccountInfoSingleton/types.js +2 -0
  308. package/lib/module/sdk/AccountInfoSingleton/types.js.map +1 -0
  309. package/lib/module/sdk/AttributesEncoding/attributesEncoding.js +46 -0
  310. package/lib/module/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
  311. package/lib/module/sdk/AttributesEncoding/defaultEncoders.js +134 -0
  312. package/lib/module/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
  313. package/lib/module/{utils → sdk/AttributesEncoding}/errorUtils.js +37 -20
  314. package/lib/module/sdk/AttributesEncoding/errorUtils.js.map +1 -0
  315. package/lib/module/sdk/AttributesEncoding/helpers.js +115 -0
  316. package/lib/module/sdk/AttributesEncoding/helpers.js.map +1 -0
  317. package/lib/module/sdk/AttributesEncoding/types.js +2 -0
  318. package/lib/module/sdk/AttributesEncoding/types.js.map +1 -0
  319. package/lib/module/sdk/AttributesEncoding/utils.js +28 -0
  320. package/lib/module/sdk/AttributesEncoding/utils.js.map +1 -0
  321. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
  322. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  323. package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +2 -2
  324. package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
  325. package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
  326. package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js.map +1 -1
  327. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
  328. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  329. package/lib/module/sdk/DatadogProvider/DatadogProvider.js +9 -8
  330. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  331. package/lib/module/sdk/DatadogProvider/DatadogProviderState.js +21 -0
  332. package/lib/module/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
  333. package/lib/module/sdk/DdSdk.js +4 -4
  334. package/lib/module/sdk/DdSdk.js.map +1 -1
  335. package/lib/module/sdk/DdSdkInternal.js +80 -0
  336. package/lib/module/sdk/DdSdkInternal.js.map +1 -0
  337. package/lib/module/sdk/EventMappers/EventMapper.js +6 -3
  338. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
  339. package/lib/module/sdk/GlobalState/GlobalState.js +5 -10
  340. package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
  341. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
  342. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  343. package/lib/module/specs/NativeDdRum.js.map +1 -1
  344. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  345. package/lib/module/trace/DdTrace.js +7 -6
  346. package/lib/module/trace/DdTrace.js.map +1 -1
  347. package/lib/module/types.js +22 -42
  348. package/lib/module/types.js.map +1 -1
  349. package/lib/module/utils/longTasksUtils.js.map +1 -1
  350. package/lib/module/utils/singletonUtils.js +14 -0
  351. package/lib/module/utils/singletonUtils.js.map +1 -0
  352. package/lib/module/version.js +1 -1
  353. package/lib/module/version.js.map +1 -1
  354. package/lib/typescript/DdAttributes.d.ts.map +1 -0
  355. package/lib/typescript/DdSdkReactNative.d.ts +49 -12
  356. package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
  357. package/lib/typescript/InternalLog.d.ts +1 -1
  358. package/lib/typescript/InternalLog.d.ts.map +1 -1
  359. package/lib/typescript/config/DatadogProviderConfiguration.d.ts +12 -0
  360. package/lib/typescript/config/DatadogProviderConfiguration.d.ts.map +1 -0
  361. package/lib/typescript/config/FileBasedConfiguration.d.ts +17 -0
  362. package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -0
  363. package/lib/typescript/config/FileBasedConfiguration.type.d.ts +52 -0
  364. package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -0
  365. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
  366. package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
  367. package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +47 -0
  368. package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
  369. package/lib/typescript/config/async/asyncInitializationHelper.d.ts +5 -0
  370. package/lib/typescript/config/async/asyncInitializationHelper.d.ts.map +1 -0
  371. package/lib/typescript/config/features/CoreConfiguration.d.ts +52 -0
  372. package/lib/typescript/config/features/CoreConfiguration.d.ts.map +1 -0
  373. package/lib/typescript/config/features/CoreConfiguration.type.d.ts +90 -0
  374. package/lib/typescript/config/features/CoreConfiguration.type.d.ts.map +1 -0
  375. package/lib/typescript/config/features/CoreConfigurationNative.d.ts +54 -0
  376. package/lib/typescript/config/features/CoreConfigurationNative.d.ts.map +1 -0
  377. package/lib/typescript/config/features/LogsConfiguration.d.ts +17 -0
  378. package/lib/typescript/config/features/LogsConfiguration.d.ts.map +1 -0
  379. package/lib/typescript/config/features/LogsConfiguration.type.d.ts +24 -0
  380. package/lib/typescript/config/features/LogsConfiguration.type.d.ts.map +1 -0
  381. package/lib/typescript/config/features/LogsConfigurationNative.d.ts +6 -0
  382. package/lib/typescript/config/features/LogsConfigurationNative.d.ts.map +1 -0
  383. package/lib/typescript/config/features/RumConfiguration.d.ts +66 -0
  384. package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -0
  385. package/lib/typescript/config/features/RumConfiguration.type.d.ts +131 -0
  386. package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -0
  387. package/lib/typescript/config/features/RumConfigurationNative.d.ts +25 -0
  388. package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -0
  389. package/lib/typescript/config/features/TraceConfiguration.d.ts +10 -0
  390. package/lib/typescript/config/features/TraceConfiguration.d.ts.map +1 -0
  391. package/lib/typescript/config/features/TraceConfiguration.type.d.ts +11 -0
  392. package/lib/typescript/config/features/TraceConfiguration.type.d.ts.map +1 -0
  393. package/lib/typescript/config/features/TraceConfigurationNative.d.ts +4 -0
  394. package/lib/typescript/config/features/TraceConfigurationNative.d.ts.map +1 -0
  395. package/lib/typescript/config/types/BatchProcessingLevel.d.ts +18 -0
  396. package/lib/typescript/config/types/BatchProcessingLevel.d.ts.map +1 -0
  397. package/lib/typescript/config/types/BatchSize.d.ts +19 -0
  398. package/lib/typescript/config/types/BatchSize.d.ts.map +1 -0
  399. package/lib/typescript/config/types/InitializationMode.d.ts +5 -0
  400. package/lib/typescript/config/types/InitializationMode.d.ts.map +1 -0
  401. package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts +2 -0
  402. package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
  403. package/lib/typescript/config/types/ProxyConfiguration.d.ts.map +1 -0
  404. package/lib/typescript/config/types/SdkVerbosity.d.ts.map +1 -0
  405. package/lib/typescript/config/types/TrackingConsent.d.ts.map +1 -0
  406. package/lib/typescript/config/types/UploadFrequency.d.ts +18 -0
  407. package/lib/typescript/config/types/UploadFrequency.d.ts.map +1 -0
  408. package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts +7 -0
  409. package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
  410. package/lib/typescript/config/types/index.d.ts +10 -0
  411. package/lib/typescript/config/types/index.d.ts.map +1 -0
  412. package/lib/typescript/index.d.ts +20 -9
  413. package/lib/typescript/index.d.ts.map +1 -1
  414. package/lib/typescript/logs/DdLogs.d.ts +2 -1
  415. package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
  416. package/lib/typescript/logs/eventMapper.d.ts +3 -2
  417. package/lib/typescript/logs/eventMapper.d.ts.map +1 -1
  418. package/lib/typescript/logs/types.d.ts +1 -16
  419. package/lib/typescript/logs/types.d.ts.map +1 -1
  420. package/lib/typescript/nativeModulesTypes.d.ts +2 -15
  421. package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
  422. package/lib/typescript/rum/DdRum.d.ts +10 -1
  423. package/lib/typescript/rum/DdRum.d.ts.map +1 -1
  424. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +1 -1
  425. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
  426. package/lib/typescript/rum/helper.d.ts +10 -0
  427. package/lib/typescript/rum/helper.d.ts.map +1 -0
  428. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
  429. package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
  430. package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
  431. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
  432. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
  433. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
  434. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
  435. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
  436. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
  437. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
  438. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
  439. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
  440. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
  441. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
  442. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
  443. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
  444. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
  445. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
  446. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
  447. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
  448. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
  449. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
  450. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
  451. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
  452. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
  453. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
  454. package/lib/typescript/rum/types.d.ts +47 -7
  455. package/lib/typescript/rum/types.d.ts.map +1 -1
  456. package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
  457. package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
  458. package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts +6 -0
  459. package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
  460. package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
  461. package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
  462. package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
  463. package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
  464. package/lib/typescript/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
  465. package/lib/typescript/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
  466. package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts +17 -0
  467. package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
  468. package/lib/typescript/sdk/AttributesEncoding/types.d.ts +21 -0
  469. package/lib/typescript/sdk/AttributesEncoding/types.d.ts.map +1 -0
  470. package/lib/typescript/sdk/AttributesEncoding/utils.d.ts +7 -0
  471. package/lib/typescript/sdk/AttributesEncoding/utils.d.ts.map +1 -0
  472. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
  473. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
  474. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
  475. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
  476. package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
  477. package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
  478. package/lib/typescript/sdk/DdSdk.d.ts +2 -3
  479. package/lib/typescript/sdk/DdSdk.d.ts.map +1 -1
  480. package/lib/typescript/sdk/DdSdkInternal.d.ts +39 -0
  481. package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -0
  482. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +3 -1
  483. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -1
  484. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +3 -3
  485. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -1
  486. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
  487. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
  488. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -2
  489. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -1
  490. package/lib/typescript/specs/NativeDdRum.d.ts +45 -0
  491. package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
  492. package/lib/typescript/specs/NativeDdSdk.d.ts +34 -6
  493. package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
  494. package/lib/typescript/trace/DdTrace.d.ts +1 -2
  495. package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
  496. package/lib/typescript/types.d.ts +74 -92
  497. package/lib/typescript/types.d.ts.map +1 -1
  498. package/lib/typescript/utils/longTasksUtils.d.ts +1 -1
  499. package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -1
  500. package/lib/typescript/utils/singletonUtils.d.ts +2 -0
  501. package/lib/typescript/utils/singletonUtils.d.ts.map +1 -0
  502. package/lib/typescript/version.d.ts +1 -1
  503. package/lib/typescript/version.d.ts.map +1 -1
  504. package/package.json +2 -2
  505. package/src/DdSdkReactNative.tsx +246 -104
  506. package/src/InternalLog.tsx +1 -1
  507. package/src/__tests__/DdSdkReactNative.test.tsx +415 -207
  508. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +237 -153
  509. package/src/__tests__/InternalLog.test.tsx +1 -1
  510. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +2 -2
  511. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +139 -216
  512. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +10 -7
  513. package/src/config/DatadogProviderConfiguration.ts +17 -0
  514. package/src/config/FileBasedConfiguration.ts +464 -0
  515. package/src/config/FileBasedConfiguration.type.ts +66 -0
  516. package/src/config/__tests__/FileBasedConfiguration.test.ts +334 -0
  517. package/src/config/__tests__/__fixtures__/configuration-all-fields.json +57 -0
  518. package/src/config/__tests__/__fixtures__/malformed-configuration.json +4 -0
  519. package/src/config/async/AutoInstrumentationConfiguration.ts +126 -0
  520. package/src/config/async/PartialInitializationConfiguration.ts +58 -0
  521. package/src/config/async/asyncInitializationHelper.tsx +51 -0
  522. package/src/config/features/CoreConfiguration.ts +130 -0
  523. package/src/config/features/CoreConfiguration.type.ts +119 -0
  524. package/src/config/features/CoreConfigurationNative.ts +50 -0
  525. package/src/config/features/LogsConfiguration.ts +38 -0
  526. package/src/config/features/LogsConfiguration.type.ts +33 -0
  527. package/src/config/features/LogsConfigurationNative.ts +10 -0
  528. package/src/config/features/RumConfiguration.ts +137 -0
  529. package/src/config/features/RumConfiguration.type.ts +164 -0
  530. package/src/config/features/RumConfigurationNative.ts +26 -0
  531. package/src/config/features/TraceConfiguration.ts +24 -0
  532. package/src/config/features/TraceConfiguration.type.ts +17 -0
  533. package/src/config/features/TraceConfigurationNative.ts +8 -0
  534. package/src/config/types/BatchProcessingLevel.ts +23 -0
  535. package/src/config/types/BatchSize.ts +24 -0
  536. package/src/config/types/InitializationMode.ts +9 -0
  537. package/src/config/types/InitializationModeForTelemetry.ts +11 -0
  538. package/src/{ProxyConfiguration.tsx → config/types/ProxyConfiguration.ts} +6 -0
  539. package/src/config/types/UploadFrequency.tsx +23 -0
  540. package/src/config/types/VitalsUpdateFrequency.ts +11 -0
  541. package/src/config/types/index.ts +15 -0
  542. package/src/index.tsx +33 -16
  543. package/src/logs/DdLogs.ts +14 -13
  544. package/src/logs/__tests__/DdLogs.test.ts +60 -107
  545. package/src/logs/__tests__/eventMapper.test.ts +1 -1
  546. package/src/logs/eventMapper.ts +5 -4
  547. package/src/logs/types.ts +1 -20
  548. package/src/nativeModulesTypes.ts +2 -17
  549. package/src/rum/DdRum.ts +139 -42
  550. package/src/rum/__tests__/DdRum.test.ts +217 -47
  551. package/src/rum/eventMappers/errorEventMapper.ts +1 -1
  552. package/src/rum/helper.ts +62 -0
  553. package/src/rum/instrumentation/DdRumErrorTracking.tsx +20 -38
  554. package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +20 -32
  555. package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +1 -1
  556. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +18 -5
  557. package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +44 -23
  558. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -2
  559. package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +44 -23
  560. package/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.ts +24 -1
  561. package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +17 -2
  562. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +327 -1
  563. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +22 -31
  564. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.ts +29 -0
  565. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +54 -35
  566. package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.ts +80 -0
  567. package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
  568. package/src/rum/instrumentation/resourceTracking/distributedTracing/headers.ts +29 -0
  569. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts +1 -1
  570. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +19 -7
  571. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +177 -119
  572. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/baggageHeaderUtils.test.ts +85 -13
  573. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +110 -52
  574. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
  575. package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +1 -1
  576. package/src/rum/types.ts +68 -8
  577. package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +49 -0
  578. package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +90 -0
  579. package/src/sdk/AccountInfoSingleton/types.ts +11 -0
  580. package/src/sdk/AttributesEncoding/__tests__/attributesEncoding.test.ts +518 -0
  581. package/src/sdk/AttributesEncoding/__tests__/defaultEncoders.test.ts +198 -0
  582. package/src/sdk/AttributesEncoding/attributesEncoding.ts +56 -0
  583. package/src/sdk/AttributesEncoding/defaultEncoders.ts +175 -0
  584. package/src/{utils → sdk/AttributesEncoding}/errorUtils.ts +50 -22
  585. package/src/sdk/AttributesEncoding/helpers.ts +176 -0
  586. package/src/sdk/AttributesEncoding/types.ts +33 -0
  587. package/src/sdk/AttributesEncoding/utils.ts +31 -0
  588. package/src/sdk/AttributesSingleton/AttributesSingleton.ts +25 -1
  589. package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +52 -8
  590. package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.tsx +2 -2
  591. package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.tsx +1 -1
  592. package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +1 -1
  593. package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +4 -4
  594. package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
  595. package/src/sdk/DatadogProvider/DatadogProvider.tsx +12 -16
  596. package/src/sdk/DatadogProvider/DatadogProviderState.ts +30 -0
  597. package/src/sdk/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +18 -7
  598. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +59 -33
  599. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +26 -10
  600. package/src/sdk/DdSdk.ts +8 -5
  601. package/src/sdk/DdSdkInternal.ts +121 -0
  602. package/src/sdk/EventMappers/EventMapper.ts +9 -4
  603. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +3 -3
  604. package/src/sdk/GlobalState/GlobalState.tsx +10 -11
  605. package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +9 -2
  606. package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +46 -9
  607. package/src/sdk/UserInfoSingleton/types.ts +1 -4
  608. package/src/specs/NativeDdRum.ts +65 -0
  609. package/src/specs/NativeDdSdk.ts +40 -6
  610. package/src/trace/DdTrace.ts +11 -7
  611. package/src/trace/__tests__/DdTrace.test.ts +7 -8
  612. package/src/types.tsx +97 -76
  613. package/src/utils/__tests__/errorUtils.test.ts +1 -1
  614. package/src/utils/__tests__/singletonUtils.test.ts +75 -0
  615. package/src/utils/longTasksUtils.ts +1 -3
  616. package/src/utils/singletonUtils.ts +17 -0
  617. package/src/version.ts +1 -1
  618. package/lib/commonjs/DdSdkReactNativeConfiguration.js +0 -412
  619. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +0 -1
  620. package/lib/commonjs/ProxyConfiguration.js.map +0 -1
  621. package/lib/commonjs/SdkVerbosity.js.map +0 -1
  622. package/lib/commonjs/TrackingConsent.js.map +0 -1
  623. package/lib/commonjs/rum/DdAttributes.js.map +0 -1
  624. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -185
  625. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
  626. package/lib/commonjs/utils/argsUtils.js +0 -41
  627. package/lib/commonjs/utils/argsUtils.js.map +0 -1
  628. package/lib/commonjs/utils/errorUtils.js.map +0 -1
  629. package/lib/module/DdSdkReactNativeConfiguration.js +0 -403
  630. package/lib/module/DdSdkReactNativeConfiguration.js.map +0 -1
  631. package/lib/module/ProxyConfiguration.js.map +0 -1
  632. package/lib/module/SdkVerbosity.js.map +0 -1
  633. package/lib/module/TrackingConsent.js.map +0 -1
  634. package/lib/module/rum/DdAttributes.js.map +0 -1
  635. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -176
  636. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
  637. package/lib/module/utils/argsUtils.js +0 -35
  638. package/lib/module/utils/argsUtils.js.map +0 -1
  639. package/lib/module/utils/errorUtils.js.map +0 -1
  640. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +0 -376
  641. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +0 -1
  642. package/lib/typescript/ProxyConfiguration.d.ts.map +0 -1
  643. package/lib/typescript/SdkVerbosity.d.ts.map +0 -1
  644. package/lib/typescript/TrackingConsent.d.ts.map +0 -1
  645. package/lib/typescript/rum/DdAttributes.d.ts.map +0 -1
  646. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
  647. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
  648. package/lib/typescript/utils/argsUtils.d.ts +0 -8
  649. package/lib/typescript/utils/argsUtils.d.ts.map +0 -1
  650. package/lib/typescript/utils/errorUtils.d.ts.map +0 -1
  651. package/src/DdSdkReactNativeConfiguration.tsx +0 -582
  652. package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +0 -241
  653. package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +0 -255
  654. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +0 -27
  655. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +0 -5
  656. package/src/utils/__tests__/argsUtils.test.ts +0 -66
  657. package/src/utils/argsUtils.ts +0 -41
  658. /package/lib/commonjs/{rum/DdAttributes.js → DdAttributes.js} +0 -0
  659. /package/lib/commonjs/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
  660. /package/lib/commonjs/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
  661. /package/lib/module/{rum/DdAttributes.js → DdAttributes.js} +0 -0
  662. /package/lib/module/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
  663. /package/lib/module/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
  664. /package/lib/typescript/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
  665. /package/lib/typescript/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
  666. /package/lib/typescript/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
  667. /package/lib/typescript/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
  668. /package/src/{rum/DdAttributes.ts → DdAttributes.ts} +0 -0
  669. /package/src/{SdkVerbosity.tsx → config/types/SdkVerbosity.ts} +0 -0
  670. /package/src/{TrackingConsent.tsx → config/types/TrackingConsent.ts} +0 -0
@@ -6,30 +6,28 @@
6
6
 
7
7
  package com.datadog.reactnative
8
8
 
9
- import com.datadog.android.trace.AndroidTracer
10
- import com.datadog.android.trace.Trace
11
- import com.datadog.android.trace.TraceConfiguration
9
+ import com.datadog.android.Datadog
10
+ import com.datadog.android.trace.DatadogTracing
12
11
  import com.facebook.react.bridge.Promise
13
12
  import com.facebook.react.bridge.ReadableMap
14
- import io.opentracing.Scope
15
- import io.opentracing.Span
16
- import io.opentracing.Tracer
17
- import io.opentracing.util.GlobalTracer
13
+ import com.datadog.android.trace.api.scope.DatadogScope
14
+ import com.datadog.android.trace.api.span.DatadogSpan
15
+ import com.datadog.android.trace.api.tracer.DatadogTracer
16
+ import com.datadog.android.trace.GlobalDatadogTracer
18
17
  import java.util.concurrent.TimeUnit
19
18
 
20
19
  /**
21
20
  * The entry point to use Datadog's Trace feature.
22
21
  */
23
22
  class DdTraceImplementation(
24
- private val tracerProvider: () -> Tracer = {
25
- val tracer = AndroidTracer.Builder().build()
26
- GlobalTracer.registerIfAbsent(tracer)
27
-
28
- GlobalTracer.get()
23
+ private val tracerProvider: () -> DatadogTracer = {
24
+ val tracer = DatadogTracing.newTracerBuilder(Datadog.getInstance()).build()
25
+ GlobalDatadogTracer.registerIfAbsent(tracer)
26
+ GlobalDatadogTracer.get()
29
27
  }
30
28
  ) {
31
- private val spanMap: MutableMap<String, Span> = mutableMapOf()
32
- private val scopeMap: MutableMap<String, Scope> = mutableMapOf()
29
+ private val spanMap: MutableMap<String, DatadogSpan> = mutableMapOf()
30
+ private val scopeMap: MutableMap<String, DatadogScope> = mutableMapOf()
33
31
 
34
32
  // lazy here is on purpose. The thing is that this class will be instantiated even
35
33
  // before Sdk.initialize is called, but Tracer can be created only after SDK is initialized.
@@ -47,15 +45,18 @@ class DdTraceImplementation(
47
45
  .start()
48
46
 
49
47
  // This is required for traces to be able to be bundled with logs.
50
- val scope = tracer.scopeManager().activate(span)
51
-
48
+ val scope = tracer.activateSpan(span)
52
49
  val spanContext = span.context()
53
50
 
54
51
  span.setTags(context.toHashMap())
55
52
  span.setTags(GlobalState.globalAttributes)
56
- val spanId = spanContext.toSpanId()
53
+ val spanId = spanContext.spanId.toString()
54
+
57
55
  spanMap[spanId] = span
58
- scopeMap[spanId] = scope
56
+ if (scope != null) {
57
+ scopeMap[spanId] = scope
58
+ }
59
+
59
60
 
60
61
  promise.resolve(spanId)
61
62
  }
@@ -82,7 +83,7 @@ class DdTraceImplementation(
82
83
  promise.resolve(null)
83
84
  }
84
85
 
85
- private fun Span.setTags(tags: Map<String, Any?>) {
86
+ private fun DatadogSpan.setTags(tags: Map<String, Any?>) {
86
87
  for ((key, value) in tags) {
87
88
  when (value) {
88
89
  is Boolean -> setTag(key, value)
@@ -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.14.1"
10
+ internal const val SDK_VERSION = "3.0.0"
@@ -6,9 +6,11 @@
6
6
 
7
7
  package com.datadog.reactnative
8
8
 
9
+ import com.datadog.android.rum.featureoperations.FailureReason
9
10
  import com.facebook.react.bridge.Promise
10
11
  import com.facebook.react.bridge.ReactApplicationContext
11
12
  import com.facebook.react.bridge.ReactMethod
13
+ import com.facebook.react.bridge.ReadableArray
12
14
  import com.facebook.react.bridge.ReadableMap
13
15
 
14
16
  /**
@@ -51,7 +53,12 @@ class DdRum(
51
53
  * If not provided, current timestamp will be used.
52
54
  */
53
55
  @ReactMethod
54
- override fun stopView(key: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
56
+ override fun stopView(
57
+ key: String,
58
+ context: ReadableMap,
59
+ timestampMs: Double,
60
+ promise: Promise
61
+ ) {
55
62
  implementation.stopView(key, context, timestampMs, promise)
56
63
  }
57
64
 
@@ -201,6 +208,43 @@ class DdRum(
201
208
  implementation.addTiming(name, promise)
202
209
  }
203
210
 
211
+ /**
212
+ * Adds a custom attribute to the active RUM View. It will be propagated to all future RUM events associated with the active View.
213
+ * @param key: key for this view attribute.
214
+ * @param value: value for this attribute.
215
+ */
216
+ @ReactMethod
217
+ override fun addViewAttribute(key: String, value: ReadableMap, promise: Promise) {
218
+ implementation.addViewAttribute(key, value, promise)
219
+ }
220
+
221
+ /**
222
+ * Removes an attribute from the active RUM View.
223
+ * @param key: key for the attribute to be removed from the view.
224
+ */
225
+ @ReactMethod
226
+ override fun removeViewAttribute(key: String, promise: Promise) {
227
+ implementation.removeViewAttribute(key, promise)
228
+ }
229
+
230
+ /**
231
+ * Adds multiple attributes to the active RUM View. They will be propagated to all future RUM events associated with the active View.
232
+ * @param attributes: key/value object containing all attributes to be added to the view.
233
+ */
234
+ @ReactMethod
235
+ override fun addViewAttributes(attributes: ReadableMap, promise: Promise) {
236
+ implementation.addViewAttributes(attributes, promise)
237
+ }
238
+
239
+ /**
240
+ * Removes multiple attributes from the active RUM View.
241
+ * @param keys: keys for the attributes to be removed from the view.
242
+ */
243
+ @ReactMethod
244
+ override fun removeViewAttributes(keys: ReadableArray, promise: Promise) {
245
+ implementation.removeViewAttributes(keys, promise)
246
+ }
247
+
204
248
  /**
205
249
  * Adds the loading time of the view to the active view.
206
250
  * It is calculated as the difference between the current time and the start time of the view.
@@ -238,4 +282,59 @@ class DdRum(
238
282
  override fun getCurrentSessionId(promise: Promise) {
239
283
  implementation.getCurrentSessionId(promise)
240
284
  }
285
+
286
+ /**
287
+ * Starts a RUM Feature Operation.
288
+ *
289
+ * @param name Human-readable operation name (e.g., "login_flow").
290
+ * @param operationKey Optional key that uniquely identifies this operation instance.
291
+ * @param attributes Additional attributes to attach to the operation.
292
+ * @param promise Resolved with `null` when the call completes.
293
+ */
294
+ @ReactMethod
295
+ override fun startFeatureOperation(
296
+ name: String,
297
+ operationKey: String?,
298
+ attributes: ReadableMap,
299
+ promise: Promise
300
+ ) {
301
+ implementation.startFeatureOperation(name, operationKey, attributes, promise)
302
+ }
303
+
304
+ /**
305
+ * Marks a Feature Operation as successfully completed.
306
+ *
307
+ * @param name The name of the feature operation (for example, `"login_flow"`).
308
+ * @param operationKey The key of the operation instance to complete, if one was provided when starting it.
309
+ * @param attributes A map of custom attributes to attach to this completion event.
310
+ */
311
+ @ReactMethod
312
+ override fun succeedFeatureOperation(
313
+ name: String,
314
+ operationKey: String?,
315
+ attributes: ReadableMap,
316
+ promise: Promise
317
+ ) {
318
+ implementation.succeedFeatureOperation(name, operationKey, attributes, promise)
319
+ }
320
+
321
+ /**
322
+ * Marks a Feature Operation as failed.
323
+ *
324
+ * @param name The name of the feature operation (for example, `"login_flow"`).
325
+ * @param operationKey The key of the operation instance to fail, if one was provided when starting it.
326
+ * @param failureReason The reason for the failure. Possible values are defined in [FailureReason]
327
+ * (e.g., `FailureReason.ERROR`, `FailureReason.ABANDONED`, `FailureReason.OTHER`).
328
+ * @param attributes A map of custom attributes to attach to this failure event.
329
+ */
330
+ @ReactMethod
331
+ override fun failFeatureOperation(
332
+ name: String,
333
+ operationKey: String?,
334
+ failureReason: String,
335
+ attributes: ReadableMap,
336
+ promise: Promise
337
+ ) {
338
+ implementation.failFeatureOperation(name, operationKey, failureReason, attributes, promise)
339
+ }
241
340
  }
@@ -12,16 +12,18 @@ import com.facebook.react.bridge.LifecycleEventListener
12
12
  import com.facebook.react.bridge.Promise
13
13
  import com.facebook.react.bridge.ReactApplicationContext
14
14
  import com.facebook.react.bridge.ReactMethod
15
+ import com.facebook.react.bridge.ReadableArray
15
16
  import com.facebook.react.bridge.ReadableMap
16
17
  import com.facebook.react.modules.core.DeviceEventManagerModule
17
18
 
18
19
  /** The entry point to initialize Datadog's features. */
19
20
  class DdSdk(
20
21
  reactContext: ReactApplicationContext,
21
- datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
22
+ datadogWrapper: DatadogWrapper = DatadogSDKWrapper(),
23
+ ddTelemetry: DdTelemetry = DdTelemetry()
22
24
  ) : NativeDdSdkSpec(reactContext) {
23
25
 
24
- private val implementation = DdSdkImplementation(reactContext, datadog = datadogWrapper)
26
+ private val implementation = DdSdkImplementation(reactContext, datadog = datadogWrapper, ddTelemetry)
25
27
 
26
28
  override fun getName(): String = DdSdkImplementation.NAME
27
29
 
@@ -39,30 +41,48 @@ class DdSdk(
39
41
  }
40
42
 
41
43
  /**
42
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM
44
+ * Sets a specific attribute in the global context attached with all future Logs, Spans and RUM
45
+ *
46
+ * @param key: Key that identifies the attribute.
47
+ * @param value: Value linked to the attribute.
48
+ */
49
+ @ReactMethod
50
+ override fun addAttribute(key: String, value: ReadableMap, promise: Promise) {
51
+ implementation.addAttribute(key, value, promise)
52
+ }
53
+
54
+ /**
55
+ * Removes an attribute from the context attached with all future Logs, Spans and RUM events.
56
+ * @param key: They key associated with the attribute to be removed.
57
+ */
58
+ @ReactMethod
59
+ override fun removeAttribute(key: String, promise: Promise) {
60
+ implementation.removeAttribute(key, promise)
61
+ }
62
+
63
+ /**
64
+ * Adds a set of attributes to the global context that is attached with all future Logs, Spans and RUM
43
65
  * events.
44
66
  * @param attributes The global context attributes.
45
67
  */
46
68
  @ReactMethod
47
- override fun setAttributes(attributes: ReadableMap, promise: Promise) {
48
- implementation.setAttributes(attributes, promise)
69
+ override fun addAttributes(attributes: ReadableMap, promise: Promise) {
70
+ implementation.addAttributes(attributes, promise)
49
71
  }
50
72
 
51
73
  /**
52
- * Set the user information.
53
- * @param user The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom
54
- * attribute).
74
+ * Removes a set of attributes from the global context that is attached with all future Logs, Spans and RUM
75
+ * events.
76
+ * @param keys: They keys associated with the attributes to be removed.
55
77
  */
56
- @Deprecated("Use setUserInfo instead; the user ID is now required.")
57
78
  @ReactMethod
58
- override fun setUser(user: ReadableMap, promise: Promise) {
59
- implementation.setUser(user, promise)
79
+ override fun removeAttributes(keys: ReadableArray, promise: Promise) {
80
+ implementation.removeAttributes(keys, promise)
60
81
  }
61
82
 
62
- /**
83
+ /**
63
84
  * Set the user information.
64
- * @param user The user object (use builtin attributes: 'id', 'email', 'name', and any custom
65
- * attribute inside 'extraInfo').
85
+ * @param user The user object (use builtin attributes: 'id', 'email', 'name', and any custom * attribute inside 'extraInfo').
66
86
  */
67
87
  @ReactMethod
68
88
  override fun setUserInfo(user: ReadableMap, promise: Promise) {
@@ -78,6 +98,40 @@ class DdSdk(
78
98
  implementation.addUserExtraInfo(extraInfo, promise)
79
99
  }
80
100
 
101
+ /**
102
+ * Clears the user information.
103
+ */
104
+ @ReactMethod
105
+ override fun clearUserInfo(promise: Promise) {
106
+ implementation.clearUserInfo(promise)
107
+ }
108
+
109
+ /**
110
+ * Set the account information.
111
+ * @param account The account object (use builtin attributes: 'id', 'name', and any custom * attribute inside 'extraInfo').
112
+ */
113
+ @ReactMethod
114
+ override fun setAccountInfo(account: ReadableMap, promise: Promise) {
115
+ implementation.setAccountInfo(account, promise)
116
+ }
117
+
118
+ /**
119
+ * Sets the account information.
120
+ * @param extraAccountInfo: The additional information. (To set the id or name please use setAccountInfo).
121
+ */
122
+ @ReactMethod
123
+ override fun addAccountExtraInfo(extraInfo: ReadableMap, promise: Promise) {
124
+ implementation.addAccountExtraInfo(extraInfo, promise)
125
+ }
126
+
127
+ /**
128
+ * Clears the account information.
129
+ */
130
+ @ReactMethod
131
+ override fun clearAccountInfo(promise: Promise) {
132
+ implementation.clearAccountInfo(promise)
133
+ }
134
+
81
135
  /**
82
136
  * Set the tracking consent regarding the data collection.
83
137
  * @param trackingConsent Consent, which can take one of the following values: 'pending',
@@ -6,10 +6,12 @@
6
6
 
7
7
  package com.datadog.reactnative
8
8
 
9
+ import com.datadog.android.rum.featureoperations.FailureReason
9
10
  import com.facebook.react.bridge.Promise
10
11
  import com.facebook.react.bridge.ReactApplicationContext
11
12
  import com.facebook.react.bridge.ReactContextBaseJavaModule
12
13
  import com.facebook.react.bridge.ReactMethod
14
+ import com.facebook.react.bridge.ReadableArray
13
15
  import com.facebook.react.bridge.ReadableMap
14
16
 
15
17
  /**
@@ -192,6 +194,43 @@ class DdRum(
192
194
  implementation.addTiming(name, promise)
193
195
  }
194
196
 
197
+ /**
198
+ * Adds a custom attribute to the active RUM View. It will be propagated to all future RUM events associated with the active View.
199
+ * @param key: key for this view attribute.
200
+ * @param value: value for this attribute.
201
+ */
202
+ @ReactMethod
203
+ fun addViewAttribute(key: String, value: ReadableMap, promise: Promise) {
204
+ implementation.addViewAttribute(key, value, promise)
205
+ }
206
+
207
+ /**
208
+ * Removes an attribute from the active RUM View.
209
+ * @param key: key for the attribute to be removed from the view.
210
+ */
211
+ @ReactMethod
212
+ fun removeViewAttribute(key: String, promise: Promise) {
213
+ implementation.removeViewAttribute(key, promise)
214
+ }
215
+
216
+ /**
217
+ * Adds multiple attributes to the active RUM View. They will be propagated to all future RUM events associated with the active View.
218
+ * @param attributes: key/value object containing all attributes to be added to the view.
219
+ */
220
+ @ReactMethod
221
+ fun addViewAttributes(attributes: ReadableMap, promise: Promise) {
222
+ implementation.addViewAttributes(attributes, promise)
223
+ }
224
+
225
+ /**
226
+ * Removes multiple attributes from the active RUM View.
227
+ * @param keys: keys for the attributes to be removed from the view.
228
+ */
229
+ @ReactMethod
230
+ fun removeViewAttributes(keys: ReadableArray, promise: Promise) {
231
+ implementation.removeViewAttributes(keys, promise)
232
+ }
233
+
195
234
  /**
196
235
  * Adds the loading time of the view to the active view.
197
236
  * It is calculated as the difference between the current time and the start time of the view.
@@ -228,4 +267,59 @@ class DdRum(
228
267
  fun getCurrentSessionId(promise: Promise) {
229
268
  implementation.getCurrentSessionId(promise)
230
269
  }
270
+
271
+ /**
272
+ * Starts a RUM Feature Operation.
273
+ *
274
+ * @param name Human-readable operation name (e.g., "login_flow").
275
+ * @param operationKey Optional key that uniquely identifies this operation instance.
276
+ * @param attributes Additional attributes to attach to the operation.
277
+ * @param promise Resolved with `null` when the call completes.
278
+ */
279
+ @ReactMethod
280
+ fun startFeatureOperation(
281
+ name: String,
282
+ operationKey: String? = null,
283
+ attributes: ReadableMap,
284
+ promise: Promise
285
+ ) {
286
+ implementation.startFeatureOperation(name, operationKey, attributes, promise)
287
+ }
288
+
289
+ /**
290
+ * Marks a Feature Operation as successfully completed.
291
+ *
292
+ * @param name The name of the feature operation (for example, "login_flow").
293
+ * @param operationKey The key of the operation instance to complete, if one was provided.
294
+ * @param attributes A map of custom attributes to attach to this completion event.
295
+ */
296
+ @ReactMethod
297
+ fun succeedFeatureOperation(
298
+ name: String,
299
+ operationKey: String? = null,
300
+ attributes: ReadableMap,
301
+ promise: Promise
302
+ ) {
303
+ implementation.succeedFeatureOperation(name, operationKey, attributes, promise)
304
+ }
305
+
306
+ /**
307
+ * Marks a Feature Operation as failed.
308
+ *
309
+ * @param name The name of the feature operation (for example, "login_flow").
310
+ * @param operationKey The key of the operation instance to fail, if one was provided.
311
+ * @param failureReason The reason for the failure. Values are defined in [FailureReason]
312
+ * (e.g., `FailureReason.ERROR`, `FailureReason.ABANDONED`, `FailureReason.OTHER`).
313
+ * @param attributes A map of custom attributes to attach to this failure event.
314
+ */
315
+ @ReactMethod
316
+ fun failFeatureOperation(
317
+ name: String,
318
+ operationKey: String? = null,
319
+ failureReason: String,
320
+ attributes: ReadableMap,
321
+ promise: Promise
322
+ ) {
323
+ implementation.failFeatureOperation(name, operationKey, failureReason, attributes, promise)
324
+ }
231
325
  }
@@ -12,15 +12,21 @@ import com.facebook.react.bridge.Promise
12
12
  import com.facebook.react.bridge.ReactApplicationContext
13
13
  import com.facebook.react.bridge.ReactContextBaseJavaModule
14
14
  import com.facebook.react.bridge.ReactMethod
15
+ import com.facebook.react.bridge.ReadableArray
15
16
  import com.facebook.react.bridge.ReadableMap
16
17
 
17
18
  /** The entry point to initialize Datadog's features. */
18
19
  class DdSdk(
19
20
  reactContext: ReactApplicationContext,
20
- datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
21
+ datadogWrapper: DatadogWrapper = DatadogSDKWrapper(),
22
+ ddTelemetry: DdTelemetry = DdTelemetry()
21
23
  ) : ReactContextBaseJavaModule(reactContext) {
22
24
 
23
- private val implementation = DdSdkImplementation(reactContext, datadog = datadogWrapper)
25
+ private val implementation = DdSdkImplementation(
26
+ reactContext,
27
+ datadog = datadogWrapper,
28
+ ddTelemetry
29
+ )
24
30
  private var lifecycleEventListener: LifecycleEventListener? = null
25
31
 
26
32
  override fun getName(): String = DdSdkImplementation.NAME
@@ -61,24 +67,43 @@ class DdSdk(
61
67
  }
62
68
 
63
69
  /**
64
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM
70
+ * Sets a specific attribute in the global context attached with all future Logs, Spans and RUM
71
+ *
72
+ * @param key: Key that identifies the attribute.
73
+ * @param value: Value linked to the attribute.
74
+ */
75
+ @ReactMethod
76
+ fun addAttribute(key: String, value: ReadableMap, promise: Promise) {
77
+ implementation.addAttribute(key, value, promise)
78
+ }
79
+
80
+ /**
81
+ * Removes an attribute from the context attached with all future Logs, Spans and RUM events.
82
+ * @param key: They key associated with the attribute to be removed.
83
+ */
84
+ @ReactMethod
85
+ fun removeAttribute(key: String, promise: Promise) {
86
+ implementation.removeAttribute(key, promise)
87
+ }
88
+
89
+ /**
90
+ * Adds a set of attributes to the global context that is attached with all future Logs, Spans and RUM
65
91
  * events.
66
92
  * @param attributes The global context attributes.
67
93
  */
68
94
  @ReactMethod
69
- fun setAttributes(attributes: ReadableMap, promise: Promise) {
70
- implementation.setAttributes(attributes, promise)
95
+ fun addAttributes(attributes: ReadableMap, promise: Promise) {
96
+ implementation.addAttributes(attributes, promise)
71
97
  }
72
98
 
73
99
  /**
74
- * Set the user information.
75
- * @param user The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom
76
- * attribute).
100
+ * Removes a set of attributes from the global context that is attached with all future Logs, Spans and RUM
101
+ * events.
102
+ * @param keys: They keys associated with the attributes to be removed.
77
103
  */
78
- @Deprecated("Use setUserInfo instead; the user ID is now required.")
79
104
  @ReactMethod
80
- fun setUser(user: ReadableMap, promise: Promise) {
81
- implementation.setUser(user, promise)
105
+ fun removeAttributes(keys: ReadableArray, promise: Promise) {
106
+ implementation.removeAttributes(keys, promise)
82
107
  }
83
108
 
84
109
  /**
@@ -99,6 +124,40 @@ class DdSdk(
99
124
  implementation.addUserExtraInfo(extraInfo, promise)
100
125
  }
101
126
 
127
+ /**
128
+ * Clears the user information.
129
+ */
130
+ @ReactMethod
131
+ fun clearUserInfo(promise: Promise) {
132
+ implementation.clearUserInfo(promise)
133
+ }
134
+
135
+ /**
136
+ * Set the account information.
137
+ * @param account The account object (use builtin attributes: 'id', 'name', and any custom * attribute inside 'extraInfo').
138
+ */
139
+ @ReactMethod
140
+ fun setAccountInfo(account: ReadableMap, promise: Promise) {
141
+ implementation.setAccountInfo(account, promise)
142
+ }
143
+
144
+ /**
145
+ * Sets the account information.
146
+ * @param extraAccountInfo: The additional information. (To set the id or name please use setAccountInfo).
147
+ */
148
+ @ReactMethod
149
+ fun addAccountExtraInfo(extraInfo: ReadableMap, promise: Promise) {
150
+ implementation.addAccountExtraInfo(extraInfo, promise)
151
+ }
152
+
153
+ /**
154
+ * Clears the account information.
155
+ */
156
+ @ReactMethod
157
+ fun clearAccountInfo(promise: Promise) {
158
+ implementation.clearAccountInfo(promise)
159
+ }
160
+
102
161
  /**
103
162
  * Set the tracking consent regarding the data collection.
104
163
  * @param trackingConsent Consent, which can take one of the following values: 'pending',
@@ -13,13 +13,16 @@ import com.datadog.android.rum.RumMonitor
13
13
  import com.datadog.android.rum.RumResourceKind
14
14
  import com.datadog.android.rum.RumResourceMethod
15
15
  import com.datadog.tools.unit.forge.BaseConfigurator
16
+ import com.datadog.tools.unit.toReadableArray
16
17
  import com.datadog.tools.unit.toReadableMap
17
18
  import com.facebook.react.bridge.Promise
18
19
  import fr.xgouchet.elmyr.Forge
20
+ import fr.xgouchet.elmyr.annotation.AdvancedForgery
19
21
  import fr.xgouchet.elmyr.annotation.BoolForgery
20
22
  import fr.xgouchet.elmyr.annotation.DoubleForgery
21
23
  import fr.xgouchet.elmyr.annotation.Forgery
22
24
  import fr.xgouchet.elmyr.annotation.IntForgery
25
+ import fr.xgouchet.elmyr.annotation.MapForgery
23
26
  import fr.xgouchet.elmyr.annotation.StringForgery
24
27
  import fr.xgouchet.elmyr.annotation.StringForgeryType
25
28
  import fr.xgouchet.elmyr.junit5.ForgeConfiguration
@@ -456,6 +459,61 @@ internal class DdRumTest {
456
459
  verify(mockRumMonitor).addTiming(timing)
457
460
  }
458
461
 
462
+ @Test
463
+ fun `M call addViewAttribute W addViewAttribute()`(
464
+ @StringForgery key: String,
465
+ @StringForgery value: String
466
+ ) {
467
+ var attributeMap = mutableMapOf<String, Any?>()
468
+ attributeMap.put("value", value)
469
+
470
+ var attributes = mutableMapOf<String, Any?>()
471
+ attributes.put(key, value)
472
+
473
+ // When
474
+ testedDdRum.addViewAttribute(key, attributeMap.toReadableMap(), mockPromise)
475
+
476
+ // Then
477
+ verify(mockRumMonitor).addViewAttributes(attributes)
478
+ }
479
+
480
+ @Test
481
+ fun `M call removeViewAttribute W removeViewAttribute()`(@StringForgery key: String) {
482
+ // When
483
+ testedDdRum.removeViewAttribute(key, mockPromise)
484
+
485
+ // Then
486
+ verify(mockRumMonitor).removeViewAttributes(listOf(key))
487
+ }
488
+
489
+ @Test
490
+ fun `M call addViewAttributes W addViewAttributes()`(
491
+ @MapForgery(
492
+ key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
493
+ value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
494
+ ) customAttributes: Map<String, String>
495
+ ) {
496
+ // When
497
+ testedDdRum.addViewAttributes(customAttributes.toReadableMap(), mockPromise)
498
+
499
+ // Then
500
+ verify(mockRumMonitor).addViewAttributes(customAttributes)
501
+ }
502
+
503
+ @Test
504
+ fun `𝕄 call removeViewAttributes 𝕎 removeViewAttributes`(
505
+ @MapForgery(
506
+ key = AdvancedForgery(string = [StringForgery(StringForgeryType.NUMERICAL)]),
507
+ value = AdvancedForgery(string = [StringForgery(StringForgeryType.ASCII)])
508
+ ) customAttributes: Map<String, String>
509
+ ) {
510
+ // When
511
+ testedDdRum.removeViewAttributes(customAttributes.keys.toReadableArray(), mockPromise)
512
+
513
+ // Then
514
+ verify(mockRumMonitor).removeViewAttributes(customAttributes.keys.toList())
515
+ }
516
+
459
517
  @Test
460
518
  fun `M call addViewLoadingTime w addViewLoadingTime()`(@BoolForgery overwrite: Boolean) {
461
519
  // When