@datadog/mobile-react-native 2.4.0 → 2.4.2

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 (447) hide show
  1. package/DatadogSDKReactNative.podspec +7 -7
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +6 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +31 -24
  5. package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +63 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  7. package/android/src/main/kotlin/com/datadog/reactnative/UiThreadExecutor.kt +25 -0
  8. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  9. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  10. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +29 -0
  11. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +34 -14
  12. package/android/src/test/kotlin/com/datadog/tools/unit/TestUiThreadExecutor.kt +16 -0
  13. package/datadog-sourcemaps.gradle +3 -5
  14. package/ios/Sources/DdRum.mm +4 -3
  15. package/ios/Sources/DdRumImplementation.swift +15 -2
  16. package/ios/Sources/SdkVersion.swift +1 -1
  17. package/lib/commonjs/DdSdkReactNative.js +105 -150
  18. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  19. package/lib/commonjs/DdSdkReactNativeConfiguration.js +54 -119
  20. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  21. package/lib/commonjs/InternalLog.js +8 -19
  22. package/lib/commonjs/InternalLog.js.map +1 -1
  23. package/lib/commonjs/ProxyConfiguration.js +3 -15
  24. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  25. package/lib/commonjs/SdkVerbosity.js +3 -7
  26. package/lib/commonjs/SdkVerbosity.js.map +1 -1
  27. package/lib/commonjs/TrackingConsent.js +3 -7
  28. package/lib/commonjs/TrackingConsent.js.map +1 -1
  29. package/lib/commonjs/index.js +51 -65
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/logs/DdLogs.js +103 -123
  32. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  33. package/lib/commonjs/logs/eventMapper.js +4 -11
  34. package/lib/commonjs/logs/eventMapper.js.map +1 -1
  35. package/lib/commonjs/logs/types.js +4 -0
  36. package/lib/commonjs/logs/types.js.map +1 -1
  37. package/lib/commonjs/nativeModulesTypes.js +4 -3
  38. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  39. package/lib/commonjs/polyfills.js +28 -0
  40. package/lib/commonjs/polyfills.js.map +1 -0
  41. package/lib/commonjs/rum/DdAttributes.js +26 -0
  42. package/lib/commonjs/rum/DdAttributes.js.map +1 -0
  43. package/lib/commonjs/rum/DdRum.js +145 -210
  44. package/lib/commonjs/rum/DdRum.js.map +1 -1
  45. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +5 -8
  46. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -1
  47. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +3 -7
  48. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -1
  49. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +5 -8
  50. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -1
  51. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +68 -89
  52. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  53. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +13 -46
  54. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  55. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +52 -66
  56. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  57. package/lib/commonjs/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  58. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -4
  59. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  60. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -6
  61. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  62. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js +18 -19
  63. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  64. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -21
  65. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  66. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +32 -55
  67. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  68. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -9
  69. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  70. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +15 -41
  71. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  72. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -13
  73. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  74. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +5 -10
  75. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  76. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +16 -35
  77. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  78. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -5
  79. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  80. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -7
  81. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  82. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -10
  83. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  84. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -58
  85. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  86. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +4 -26
  87. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  88. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -11
  89. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  90. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +4 -0
  91. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  92. package/lib/commonjs/rum/types.js +15 -27
  93. package/lib/commonjs/rum/types.js.map +1 -1
  94. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +20 -30
  95. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  96. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -1
  97. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +112 -144
  98. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  99. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js +19 -22
  100. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  101. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -15
  102. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  103. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +9 -16
  104. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  105. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js +2 -8
  106. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  107. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +8 -25
  108. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  109. package/lib/commonjs/sdk/DdSdk.js +2 -4
  110. package/lib/commonjs/sdk/DdSdk.js.map +1 -1
  111. package/lib/commonjs/sdk/EventMappers/EventMapper.js +31 -51
  112. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
  113. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +9 -24
  114. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -1
  115. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +6 -38
  116. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  117. package/lib/commonjs/sdk/GlobalState/GlobalState.js +33 -0
  118. package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -0
  119. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -28
  120. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  121. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -1
  122. package/lib/commonjs/specs/NativeDdLogs.js +5 -6
  123. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
  124. package/lib/commonjs/specs/NativeDdRum.js +5 -6
  125. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  126. package/lib/commonjs/specs/NativeDdSdk.js +5 -6
  127. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  128. package/lib/commonjs/specs/NativeDdTrace.js +5 -6
  129. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
  130. package/lib/commonjs/trace/DdTrace.js +17 -29
  131. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  132. package/lib/commonjs/types.js +4 -3
  133. package/lib/commonjs/types.js.map +1 -1
  134. package/lib/commonjs/utils/Timer.js +7 -22
  135. package/lib/commonjs/utils/Timer.js.map +1 -1
  136. package/lib/commonjs/utils/argsUtils.js +3 -11
  137. package/lib/commonjs/utils/argsUtils.js.map +1 -1
  138. package/lib/commonjs/utils/errorUtils.js +9 -22
  139. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  140. package/lib/commonjs/utils/jsUtils.js +1 -2
  141. package/lib/commonjs/utils/jsUtils.js.map +1 -1
  142. package/lib/commonjs/utils/longTasksUtils.js +2 -7
  143. package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
  144. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js +9 -15
  145. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  146. package/lib/commonjs/utils/time-provider/TimeProvider.js +1 -11
  147. package/lib/commonjs/utils/time-provider/TimeProvider.js.map +1 -1
  148. package/lib/commonjs/version.js +1 -2
  149. package/lib/commonjs/version.js.map +1 -1
  150. package/lib/module/DdSdkReactNative.js +102 -122
  151. package/lib/module/DdSdkReactNative.js.map +1 -1
  152. package/lib/module/DdSdkReactNativeConfiguration.js +49 -101
  153. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  154. package/lib/module/InternalLog.js +4 -15
  155. package/lib/module/InternalLog.js.map +1 -1
  156. package/lib/module/ProxyConfiguration.js +3 -14
  157. package/lib/module/ProxyConfiguration.js.map +1 -1
  158. package/lib/module/SdkVerbosity.js +3 -4
  159. package/lib/module/SdkVerbosity.js.map +1 -1
  160. package/lib/module/TrackingConsent.js +3 -4
  161. package/lib/module/TrackingConsent.js.map +1 -1
  162. package/lib/module/index.js +5 -0
  163. package/lib/module/index.js.map +1 -1
  164. package/lib/module/logs/DdLogs.js +98 -117
  165. package/lib/module/logs/DdLogs.js.map +1 -1
  166. package/lib/module/logs/eventMapper.js +3 -1
  167. package/lib/module/logs/eventMapper.js.map +1 -1
  168. package/lib/module/logs/types.js +1 -1
  169. package/lib/module/logs/types.js.map +1 -1
  170. package/lib/module/nativeModulesTypes.js +5 -1
  171. package/lib/module/nativeModulesTypes.js.map +1 -1
  172. package/lib/module/polyfills.js +26 -0
  173. package/lib/module/polyfills.js.map +1 -0
  174. package/lib/module/rum/DdAttributes.js +20 -0
  175. package/lib/module/rum/DdAttributes.js.map +1 -0
  176. package/lib/module/rum/DdRum.js +140 -187
  177. package/lib/module/rum/DdRum.js.map +1 -1
  178. package/lib/module/rum/eventMappers/actionEventMapper.js +5 -5
  179. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -1
  180. package/lib/module/rum/eventMappers/errorEventMapper.js +3 -4
  181. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -1
  182. package/lib/module/rum/eventMappers/resourceEventMapper.js +5 -5
  183. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -1
  184. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +64 -79
  185. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  186. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +7 -36
  187. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  188. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +49 -54
  189. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  190. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  191. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -2
  192. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  193. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -4
  194. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  195. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js +16 -14
  196. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  197. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +2 -12
  198. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  199. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +33 -45
  200. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  201. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -4
  202. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  203. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +2 -10
  204. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  205. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -5
  206. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  207. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +1 -0
  208. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  209. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +12 -30
  210. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  211. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -3
  212. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  213. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -4
  214. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  215. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -5
  216. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  217. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +20 -48
  218. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  219. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +2 -20
  220. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  221. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -9
  222. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  223. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +1 -1
  224. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  225. package/lib/module/rum/types.js +14 -18
  226. package/lib/module/rum/types.js.map +1 -1
  227. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +20 -28
  228. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  229. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -1
  230. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +108 -137
  231. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  232. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js +14 -18
  233. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  234. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -13
  235. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  236. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +5 -14
  237. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  238. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js +1 -0
  239. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  240. package/lib/module/sdk/DatadogProvider/DatadogProvider.js +6 -14
  241. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  242. package/lib/module/sdk/DdSdk.js +1 -1
  243. package/lib/module/sdk/DdSdk.js.map +1 -1
  244. package/lib/module/sdk/EventMappers/EventMapper.js +27 -41
  245. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
  246. package/lib/module/sdk/EventMappers/utils/deepClone.js +9 -22
  247. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -1
  248. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +5 -29
  249. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  250. package/lib/module/sdk/GlobalState/GlobalState.js +26 -0
  251. package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -0
  252. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -26
  253. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  254. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -1
  255. package/lib/module/specs/NativeDdLogs.js +3 -0
  256. package/lib/module/specs/NativeDdLogs.js.map +1 -1
  257. package/lib/module/specs/NativeDdRum.js +3 -0
  258. package/lib/module/specs/NativeDdRum.js.map +1 -1
  259. package/lib/module/specs/NativeDdSdk.js +3 -0
  260. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  261. package/lib/module/specs/NativeDdTrace.js +3 -0
  262. package/lib/module/specs/NativeDdTrace.js.map +1 -1
  263. package/lib/module/trace/DdTrace.js +12 -19
  264. package/lib/module/trace/DdTrace.js.map +1 -1
  265. package/lib/module/types.js +5 -1
  266. package/lib/module/types.js.map +1 -1
  267. package/lib/module/utils/Timer.js +3 -20
  268. package/lib/module/utils/Timer.js.map +1 -1
  269. package/lib/module/utils/argsUtils.js +3 -5
  270. package/lib/module/utils/argsUtils.js.map +1 -1
  271. package/lib/module/utils/errorUtils.js +6 -9
  272. package/lib/module/utils/errorUtils.js.map +1 -1
  273. package/lib/module/utils/jsUtils.js +1 -0
  274. package/lib/module/utils/jsUtils.js.map +1 -1
  275. package/lib/module/utils/longTasksUtils.js +2 -5
  276. package/lib/module/utils/longTasksUtils.js.map +1 -1
  277. package/lib/module/utils/time-provider/DefaultTimeProvider.js +5 -13
  278. package/lib/module/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  279. package/lib/module/utils/time-provider/TimeProvider.js +1 -9
  280. package/lib/module/utils/time-provider/TimeProvider.js.map +1 -1
  281. package/lib/module/version.js +1 -1
  282. package/lib/module/version.js.map +1 -1
  283. package/lib/typescript/DdSdkReactNative.d.ts +1 -5
  284. package/lib/typescript/DdSdkReactNative.d.ts.map +1 -0
  285. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -0
  286. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +1 -0
  287. package/lib/typescript/InternalLog.d.ts +1 -0
  288. package/lib/typescript/InternalLog.d.ts.map +1 -0
  289. package/lib/typescript/ProxyConfiguration.d.ts +1 -0
  290. package/lib/typescript/ProxyConfiguration.d.ts.map +1 -0
  291. package/lib/typescript/SdkVerbosity.d.ts +1 -0
  292. package/lib/typescript/SdkVerbosity.d.ts.map +1 -0
  293. package/lib/typescript/TrackingConsent.d.ts +1 -0
  294. package/lib/typescript/TrackingConsent.d.ts.map +1 -0
  295. package/lib/typescript/index.d.ts +2 -0
  296. package/lib/typescript/index.d.ts.map +1 -0
  297. package/lib/typescript/logs/DdLogs.d.ts +1 -0
  298. package/lib/typescript/logs/DdLogs.d.ts.map +1 -0
  299. package/lib/typescript/logs/eventMapper.d.ts +1 -0
  300. package/lib/typescript/logs/eventMapper.d.ts.map +1 -0
  301. package/lib/typescript/logs/types.d.ts +6 -1
  302. package/lib/typescript/logs/types.d.ts.map +1 -0
  303. package/lib/typescript/nativeModulesTypes.d.ts +3 -1
  304. package/lib/typescript/nativeModulesTypes.d.ts.map +1 -0
  305. package/lib/typescript/rum/DdAttributes.d.ts +14 -0
  306. package/lib/typescript/rum/DdAttributes.d.ts.map +1 -0
  307. package/lib/typescript/rum/DdRum.d.ts +3 -2
  308. package/lib/typescript/rum/DdRum.d.ts.map +1 -0
  309. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +1 -0
  310. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts.map +1 -0
  311. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +3 -0
  312. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -0
  313. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +1 -0
  314. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts.map +1 -0
  315. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
  316. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -0
  317. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -0
  318. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts.map +1 -0
  319. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -0
  320. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -0
  321. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +1 -0
  322. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts.map +1 -0
  323. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +1 -0
  324. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts.map +1 -0
  325. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +1 -0
  326. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts.map +1 -0
  327. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +2 -1
  328. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts.map +1 -0
  329. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +1 -0
  330. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -0
  331. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +1 -0
  332. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -0
  333. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -0
  334. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -0
  335. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +1 -0
  336. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -0
  337. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
  338. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -0
  339. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +1 -0
  340. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts.map +1 -0
  341. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -0
  342. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts.map +1 -0
  343. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -0
  344. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts.map +1 -0
  345. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +1 -0
  346. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts.map +1 -0
  347. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +1 -0
  348. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts.map +1 -0
  349. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -0
  350. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -0
  351. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -0
  352. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts.map +1 -0
  353. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -0
  354. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -0
  355. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -0
  356. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -0
  357. package/lib/typescript/rum/types.d.ts +1 -0
  358. package/lib/typescript/rum/types.d.ts.map +1 -0
  359. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +1 -0
  360. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -0
  361. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -0
  362. package/lib/typescript/sdk/AttributesSingleton/types.d.ts.map +1 -0
  363. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +1 -0
  364. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts.map +1 -0
  365. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +1 -0
  366. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -0
  367. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +1 -0
  368. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts.map +1 -0
  369. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +1 -0
  370. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts.map +1 -0
  371. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +1 -0
  372. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts.map +1 -0
  373. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +1 -0
  374. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -0
  375. package/lib/typescript/sdk/DdSdk.d.ts +1 -0
  376. package/lib/typescript/sdk/DdSdk.d.ts.map +1 -0
  377. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -0
  378. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -0
  379. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +1 -0
  380. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts.map +1 -0
  381. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +1 -0
  382. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +1 -0
  383. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +13 -0
  384. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -0
  385. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +1 -0
  386. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -0
  387. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -0
  388. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -0
  389. package/lib/typescript/specs/NativeDdLogs.d.ts +1 -0
  390. package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -0
  391. package/lib/typescript/specs/NativeDdRum.d.ts +3 -1
  392. package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -0
  393. package/lib/typescript/specs/NativeDdSdk.d.ts +1 -0
  394. package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -0
  395. package/lib/typescript/specs/NativeDdTrace.d.ts +1 -0
  396. package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -0
  397. package/lib/typescript/trace/DdTrace.d.ts +1 -0
  398. package/lib/typescript/trace/DdTrace.d.ts.map +1 -0
  399. package/lib/typescript/types.d.ts +1 -0
  400. package/lib/typescript/types.d.ts.map +1 -0
  401. package/lib/typescript/utils/Timer.d.ts +1 -0
  402. package/lib/typescript/utils/Timer.d.ts.map +1 -0
  403. package/lib/typescript/utils/argsUtils.d.ts +1 -0
  404. package/lib/typescript/utils/argsUtils.d.ts.map +1 -0
  405. package/lib/typescript/utils/errorUtils.d.ts +1 -0
  406. package/lib/typescript/utils/errorUtils.d.ts.map +1 -0
  407. package/lib/typescript/utils/jsUtils.d.ts +1 -0
  408. package/lib/typescript/utils/jsUtils.d.ts.map +1 -0
  409. package/lib/typescript/utils/longTasksUtils.d.ts +1 -0
  410. package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -0
  411. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts +1 -0
  412. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts.map +1 -0
  413. package/lib/typescript/utils/time-provider/TimeProvider.d.ts +1 -0
  414. package/lib/typescript/utils/time-provider/TimeProvider.d.ts.map +1 -0
  415. package/lib/typescript/version.d.ts +2 -1
  416. package/lib/typescript/version.d.ts.map +1 -0
  417. package/package.json +3 -3
  418. package/src/DdSdkReactNative.tsx +3 -10
  419. package/src/__tests__/DdSdkReactNative.test.tsx +5 -3
  420. package/src/__tests__/mock.test.ts +0 -1
  421. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +32 -16
  422. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +17 -15
  423. package/src/index.tsx +4 -0
  424. package/src/logs/DdLogs.ts +25 -8
  425. package/src/logs/__tests__/DdLogs.test.ts +122 -0
  426. package/src/logs/types.ts +5 -1
  427. package/src/nativeModulesTypes.ts +3 -1
  428. package/src/polyfills.js +37 -0
  429. package/src/rum/DdAttributes.ts +20 -0
  430. package/src/rum/DdRum.ts +13 -8
  431. package/src/rum/__tests__/DdRum.test.ts +43 -7
  432. package/src/rum/eventMappers/errorEventMapper.ts +2 -0
  433. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +33 -10
  434. package/src/rum/instrumentation/interactionTracking/getJsxRuntime.ts +10 -3
  435. package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -0
  436. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/__utils__/TracingIdentifierUtils.ts +1 -1
  437. package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +1 -1
  438. package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +1 -1
  439. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +3 -3
  440. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +3 -2
  441. package/src/sdk/GlobalState/GlobalState.tsx +26 -0
  442. package/src/specs/NativeDdLogs.ts +1 -0
  443. package/src/specs/NativeDdRum.ts +4 -1
  444. package/src/specs/NativeDdSdk.ts +1 -0
  445. package/src/specs/NativeDdTrace.ts +1 -0
  446. package/src/version.ts +1 -1
  447. package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +0 -41
@@ -4,3 +4,4 @@
4
4
  * bridge cannot handle values with dual types.
5
5
  */
6
6
  export declare const adaptLongTaskThreshold: (longTaskThreshold: number | false) => number;
7
+ //# sourceMappingURL=longTasksUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"longTasksUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/longTasksUtils.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,sBACZ,MAAM,GAAG,KAAK,KAClC,MAYF,CAAC"}
@@ -5,3 +5,4 @@ export declare class DefaultTimeProvider extends TimeProvider {
5
5
  getTimestamp(): Timestamp;
6
6
  private performanceNow;
7
7
  }
8
+ //# sourceMappingURL=DefaultTimeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultTimeProvider.d.ts","sourceRoot":"","sources":["../../../../src/utils/time-provider/DefaultTimeProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,qBAAa,mBAAoB,SAAQ,YAAY;IACjD,OAAO,CAAC,oBAAoB,CAGoC;IAEhE,YAAY,IAAI,SAAS;IAOzB,OAAO,CAAC,cAAc;CAQzB"}
@@ -16,3 +16,4 @@ export declare abstract class TimeProvider {
16
16
  abstract getTimestamp(): Timestamp;
17
17
  now(): number;
18
18
  }
19
+ //# sourceMappingURL=TimeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeProvider.d.ts","sourceRoot":"","sources":["../../../../src/utils/time-provider/TimeProvider.tsx"],"names":[],"mappings":"AAMA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IAEpB,IAAI,EAAE,MAAM,CAAC;IAGb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,8BAAsB,YAAY;IAC9B,gFAAgF;IAChF,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;;IAW7B,QAAQ,CAAC,YAAY,IAAI,SAAS;IAElC,GAAG,IAAI,MAAM;CAahB"}
@@ -1 +1,2 @@
1
- export declare const version = "2.4.0";
1
+ export declare const version = "2.4.2";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@testing-library/react-native": "7.0.2",
56
- "react-native-builder-bob": "0.17.1"
56
+ "react-native-builder-bob": "0.26.0"
57
57
  },
58
58
  "jest": {
59
59
  "preset": "react-native",
@@ -97,5 +97,5 @@
97
97
  "javaPackageName": "com.datadog.reactnative"
98
98
  }
99
99
  },
100
- "gitHead": "3717f76f94bb68f6d871f84e38db5ba606eb7b06"
100
+ "gitHead": "5630e332e53904502cacc07d15012ce3009b2a55"
101
101
  }
@@ -33,6 +33,7 @@ import type { Attributes } from './sdk/AttributesSingleton/types';
33
33
  import { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';
34
34
  import { DdSdk } from './sdk/DdSdk';
35
35
  import { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';
36
+ import { GlobalState } from './sdk/GlobalState/GlobalState';
36
37
  import { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';
37
38
  import type { UserInfo } from './sdk/UserInfoSingleton/types';
38
39
  import { DdSdkConfiguration } from './types';
@@ -50,7 +51,6 @@ export class DdSdkReactNative {
50
51
 
51
52
  private static wasAutoInstrumented = false;
52
53
  private static features?: AutoInstrumentationConfiguration;
53
- private static _isInitialized = false;
54
54
 
55
55
  /**
56
56
  * Initializes the Datadog SDK.
@@ -72,7 +72,7 @@ export class DdSdkReactNative {
72
72
  initializationModeForTelemetry: InitializationModeForTelemetry;
73
73
  }
74
74
  ): Promise<void> => {
75
- if (DdSdkReactNative._isInitialized) {
75
+ if (GlobalState.instance.isInitialized) {
76
76
  InternalLog.log(
77
77
  "Can't initialize Datadog, SDK was already initialized",
78
78
  SdkVerbosity.WARN
@@ -91,7 +91,7 @@ export class DdSdkReactNative {
91
91
  DdSdkReactNative.buildConfiguration(configuration, params)
92
92
  );
93
93
  InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);
94
- DdSdkReactNative._isInitialized = true;
94
+ GlobalState.instance.isInitialized = true;
95
95
  BufferSingleton.onInitialization();
96
96
  };
97
97
 
@@ -212,13 +212,6 @@ export class DdSdkReactNative {
212
212
  return DdSdk.clearAllData();
213
213
  };
214
214
 
215
- /**
216
- * Returns `true` if the SDK was initialized, `false` otherwise.
217
- */
218
- public static isInitialized() {
219
- return DdSdkReactNative._isInitialized;
220
- }
221
-
222
215
  private static buildConfiguration = (
223
216
  configuration: DdSdkReactNativeConfiguration,
224
217
  params: {
@@ -19,6 +19,7 @@ import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/D
19
19
  import { ErrorSource, PropagatorType, RumActionType } from '../rum/types';
20
20
  import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingleton';
21
21
  import { DdSdk } from '../sdk/DdSdk';
22
+ import { GlobalState } from '../sdk/GlobalState/GlobalState';
22
23
  import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
23
24
  import type { DdSdkConfiguration } from '../types';
24
25
  import { version as sdkVersion } from '../version';
@@ -56,7 +57,7 @@ jest.mock('../rum/instrumentation/DdRumErrorTracking', () => {
56
57
  });
57
58
 
58
59
  beforeEach(async () => {
59
- DdSdkReactNative['_isInitialized'] = false;
60
+ GlobalState.instance.isInitialized = false;
60
61
  DdSdkReactNative['wasAutoInstrumented'] = false;
61
62
  NativeModules.DdSdk.initialize.mockClear();
62
63
  NativeModules.DdSdk.setAttributes.mockClear();
@@ -151,7 +152,7 @@ describe('DdSdkReactNative', () => {
151
152
  '_dd.sdk_version': sdkVersion
152
153
  });
153
154
 
154
- expect(DdSdkReactNative['_isInitialized']).toBe(false);
155
+ expect(GlobalState.instance.isInitialized).toBe(false);
155
156
  expect(DdRumUserInteractionTracking.startTracking).toBeCalledTimes(
156
157
  0
157
158
  );
@@ -678,7 +679,8 @@ describe('DdSdkReactNative', () => {
678
679
  {
679
680
  '_dd.error.source_type': 'react-native'
680
681
  },
681
- 456
682
+ 456,
683
+ ''
682
684
  );
683
685
  });
684
686
 
@@ -45,7 +45,6 @@ const privateProperties = {
45
45
  'DD_SDK_VERSION',
46
46
  'DD_VERSION',
47
47
  'DD_VERSION_SUFFIX',
48
- '_isInitialized',
49
48
  'wasAutoInstrumented',
50
49
  'initializeNativeSDK',
51
50
  '_initializeFromDatadogProviderWithConfigurationAsync',
@@ -73,7 +73,8 @@ it('M intercept and send a RUM event W onGlobalError() {no message}', async () =
73
73
  '_dd.error.is_crash': is_fatal,
74
74
  '_dd.error.source_type': 'react-native'
75
75
  },
76
- expect.any(Number)
76
+ expect.any(Number),
77
+ ''
77
78
  );
78
79
  expect(baseErrorHandlerCalled).toStrictEqual(true);
79
80
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -114,7 +115,8 @@ it('M intercept and send a RUM event W onGlobalError() {empty stack trace}', asy
114
115
  '_dd.error.is_crash': is_fatal,
115
116
  '_dd.error.source_type': 'react-native'
116
117
  },
117
- expect.any(Number)
118
+ expect.any(Number),
119
+ ''
118
120
  );
119
121
  expect(baseErrorHandlerCalled).toStrictEqual(true);
120
122
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -153,7 +155,8 @@ it('M intercept and send a RUM event W onGlobalError() {Error object}', async ()
153
155
  '_dd.error.is_crash': is_fatal,
154
156
  '_dd.error.source_type': 'react-native'
155
157
  },
156
- expect.any(Number)
158
+ expect.any(Number),
159
+ ''
157
160
  );
158
161
  expect(DdRum.addError.mock.calls[0][2]).toContain(
159
162
  '/packages/core/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx'
@@ -199,7 +202,8 @@ it('M intercept and send a RUM event W onGlobalError() {CustomError object}', as
199
202
  '_dd.error.is_crash': is_fatal,
200
203
  '_dd.error.source_type': 'react-native'
201
204
  },
202
- expect.any(Number)
205
+ expect.any(Number),
206
+ ''
203
207
  );
204
208
  expect(DdRum.addError.mock.calls[0][2]).toContain(
205
209
  '/packages/core/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx'
@@ -246,7 +250,8 @@ it('M intercept and send a RUM event W onGlobalError() {with source file info}',
246
250
  '_dd.error.is_crash': is_fatal,
247
251
  '_dd.error.source_type': 'react-native'
248
252
  },
249
- expect.any(Number)
253
+ expect.any(Number),
254
+ ''
250
255
  );
251
256
  expect(baseErrorHandlerCalled).toStrictEqual(true);
252
257
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -292,7 +297,8 @@ it('M intercept and send a RUM event W onGlobalError() {with component stack}',
292
297
  '_dd.error.is_crash': is_fatal,
293
298
  '_dd.error.source_type': 'react-native'
294
299
  },
295
- expect.any(Number)
300
+ expect.any(Number),
301
+ ''
296
302
  );
297
303
  expect(baseErrorHandlerCalled).toStrictEqual(true);
298
304
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -338,7 +344,8 @@ it('M intercept and send a RUM event W onGlobalError() {with stack}', async () =
338
344
  '_dd.error.is_crash': is_fatal,
339
345
  '_dd.error.source_type': 'react-native'
340
346
  },
341
- expect.any(Number)
347
+ expect.any(Number),
348
+ ''
342
349
  );
343
350
  expect(baseErrorHandlerCalled).toStrictEqual(true);
344
351
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -384,7 +391,8 @@ it('M intercept and send a RUM event W onGlobalError() {with stacktrace}', async
384
391
  '_dd.error.is_crash': is_fatal,
385
392
  '_dd.error.source_type': 'react-native'
386
393
  },
387
- expect.any(Number)
394
+ expect.any(Number),
395
+ ''
388
396
  );
389
397
  expect(baseErrorHandlerCalled).toStrictEqual(true);
390
398
  expect(baseErrorHandlerCalled).toStrictEqual(true);
@@ -436,7 +444,8 @@ it('M not report error in console handler W onGlobalError() {with console report
436
444
  '_dd.error.is_crash': is_fatal,
437
445
  '_dd.error.source_type': 'react-native'
438
446
  },
439
- expect.any(Number)
447
+ expect.any(Number),
448
+ ''
440
449
  );
441
450
  expect(consoleReportingErrorHandler).toBeCalledTimes(1);
442
451
  expect(baseConsoleErrorCalled).toStrictEqual(false);
@@ -480,7 +489,8 @@ it('M intercept and send a RUM event W onConsole() {Error with source file info}
480
489
  {
481
490
  '_dd.error.source_type': 'react-native'
482
491
  },
483
- expect.any(Number)
492
+ expect.any(Number),
493
+ ''
484
494
  );
485
495
  expect(baseConsoleErrorCalled).toStrictEqual(true);
486
496
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -522,7 +532,8 @@ it('M intercept and send a RUM event W onConsole() {Error with component stack}'
522
532
  {
523
533
  '_dd.error.source_type': 'react-native'
524
534
  },
525
- expect.any(Number)
535
+ expect.any(Number),
536
+ ''
526
537
  );
527
538
  expect(baseConsoleErrorCalled).toStrictEqual(true);
528
539
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -556,7 +567,8 @@ it('M intercept and send a RUM event W onConsole() {message only}', async () =>
556
567
  {
557
568
  '_dd.error.source_type': 'react-native'
558
569
  },
559
- expect.any(Number)
570
+ expect.any(Number),
571
+ ''
560
572
  );
561
573
  expect(baseConsoleErrorCalled).toStrictEqual(true);
562
574
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -597,7 +609,8 @@ it('M intercept and send a RUM event W onConsole() {Error with source file and n
597
609
  {
598
610
  '_dd.error.source_type': 'react-native'
599
611
  },
600
- expect.any(Number)
612
+ expect.any(Number),
613
+ ''
601
614
  );
602
615
  expect(baseConsoleErrorCalled).toStrictEqual(true);
603
616
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -644,7 +657,8 @@ describe.each([
644
657
  {
645
658
  '_dd.error.source_type': 'react-native'
646
659
  },
647
- expect.any(Number)
660
+ expect.any(Number),
661
+ ''
648
662
  );
649
663
  expect(baseConsoleErrorCalled).toStrictEqual(true);
650
664
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -683,7 +697,8 @@ it('M intercept and send a RUM event W on error() {called from RNErrorHandler}',
683
697
  '_dd.error.is_crash': is_fatal,
684
698
  '_dd.error.source_type': 'react-native'
685
699
  },
686
- expect.any(Number)
700
+ expect.any(Number),
701
+ ''
687
702
  );
688
703
  expect(DdRum.addError.mock.calls[0][2]).toContain(
689
704
  '/packages/core/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx'
@@ -723,7 +738,8 @@ it('M intercept and send a RUM event W onConsole() {called from RNErrorHandler}'
723
738
  {
724
739
  '_dd.error.source_type': 'react-native'
725
740
  },
726
- expect.any(Number)
741
+ expect.any(Number),
742
+ ''
727
743
  );
728
744
  expect(baseConsoleErrorCalled).toStrictEqual(true);
729
745
  expect(DdLogs.errorWithError).toHaveBeenCalledTimes(1);
@@ -43,6 +43,7 @@ beforeEach(() => {
43
43
  });
44
44
 
45
45
  afterEach(() => {
46
+ jest.restoreAllMocks();
46
47
  DdRumUserInteractionTracking.stopTracking();
47
48
  });
48
49
 
@@ -51,7 +52,7 @@ afterEach(() => {
51
52
 
52
53
  it('M intercept and send a RUM event W onPress { Button component }', async () => {
53
54
  // GIVEN
54
- DdRumUserInteractionTracking.startTracking();
55
+ DdRumUserInteractionTracking.startTracking({});
55
56
  const { getByText } = render(
56
57
  <View>
57
58
  <Button title="Click me" onPress={event => {}} />
@@ -142,9 +143,9 @@ it('M intercept and send a RUM event W onPress { custom action name prop used }'
142
143
 
143
144
  it('M intercept only once W startTracking { called multiple times }', async () => {
144
145
  // GIVEN
145
- DdRumUserInteractionTracking.startTracking();
146
- DdRumUserInteractionTracking.startTracking();
147
- DdRumUserInteractionTracking.startTracking();
146
+ DdRumUserInteractionTracking.startTracking({});
147
+ DdRumUserInteractionTracking.startTracking({});
148
+ DdRumUserInteractionTracking.startTracking({});
148
149
  const { getByText } = render(
149
150
  <View>
150
151
  <Button title="Click me" onPress={event => {}} />
@@ -172,7 +173,7 @@ it('M intercept only once W startTracking { called multiple times }', async () =
172
173
 
173
174
  it('M intercept and send a RUM event W onPress { TouchableOpacity component }', async () => {
174
175
  // GIVEN
175
- DdRumUserInteractionTracking.startTracking();
176
+ DdRumUserInteractionTracking.startTracking({});
176
177
  const { getByText } = render(
177
178
  <View>
178
179
  <TouchableOpacity style={styles.button} onPress={event => {}}>
@@ -202,7 +203,7 @@ it('M intercept and send a RUM event W onPress { TouchableOpacity component }',
202
203
 
203
204
  it('M intercept and send a RUM event W onPress { TouchableHighlight component }', async () => {
204
205
  // GIVEN
205
- DdRumUserInteractionTracking.startTracking();
206
+ DdRumUserInteractionTracking.startTracking({});
206
207
  const { getByText } = render(
207
208
  <View>
208
209
  <TouchableHighlight onPress={event => {}} underlayColor="white">
@@ -234,7 +235,7 @@ it('M intercept and send a RUM event W onPress { TouchableHighlight component }'
234
235
 
235
236
  it('M intercept and send a RUM event W onPress { TouchableNativeFeedback component }', async () => {
236
237
  // GIVEN
237
- DdRumUserInteractionTracking.startTracking();
238
+ DdRumUserInteractionTracking.startTracking({});
238
239
  const { getByText } = render(
239
240
  <View>
240
241
  <TouchableNativeFeedback onPress={event => {}}>
@@ -266,7 +267,7 @@ it('M intercept and send a RUM event W onPress { TouchableNativeFeedback compone
266
267
 
267
268
  it('M intercept and send a RUM event W onPress { TouchableWithoutFeedback component }', async () => {
268
269
  // GIVEN
269
- DdRumUserInteractionTracking.startTracking();
270
+ DdRumUserInteractionTracking.startTracking({});
270
271
  const { getByText } = render(
271
272
  <View>
272
273
  <TouchableWithoutFeedback onPress={event => {}}>
@@ -308,7 +309,7 @@ describe('startTracking memoization', () => {
308
309
 
309
310
  it('M keep memoization working for elements W an onPress prop is passed', async () => {
310
311
  // GIVEN
311
- DdRumUserInteractionTracking.startTracking();
312
+ DdRumUserInteractionTracking.startTracking({});
312
313
  let rendersCount = 0;
313
314
  const DummyComponent = props => {
314
315
  rendersCount++;
@@ -340,7 +341,7 @@ describe('startTracking memoization', () => {
340
341
 
341
342
  it('M keep memoization working for elements W no onPress prop is passed', async () => {
342
343
  // GIVEN
343
- DdRumUserInteractionTracking.startTracking();
344
+ DdRumUserInteractionTracking.startTracking({});
344
345
  let rendersCount = 0;
345
346
  const DummyComponent = props => {
346
347
  rendersCount++;
@@ -367,7 +368,7 @@ describe('startTracking memoization', () => {
367
368
 
368
369
  it('M keep memoization working for elements W an onPress prop is passed and custom arePropsEqual specified', async () => {
369
370
  // GIVEN
370
- DdRumUserInteractionTracking.startTracking();
371
+ DdRumUserInteractionTracking.startTracking({});
371
372
  let rendersCount = 0;
372
373
  const DummyComponent = props => {
373
374
  rendersCount++;
@@ -407,7 +408,7 @@ describe('startTracking memoization', () => {
407
408
 
408
409
  it('M keep memoization working for elements W an onPress prop is passed and custom arePropsEqual specified including onPress check', async () => {
409
410
  // GIVEN
410
- DdRumUserInteractionTracking.startTracking();
411
+ DdRumUserInteractionTracking.startTracking({});
411
412
  let rendersCount = 0;
412
413
  const DummyComponent = props => {
413
414
  rendersCount++;
@@ -449,10 +450,11 @@ describe('startTracking', () => {
449
450
  * to be run in this order
450
451
  */
451
452
  it('does not crash if jsx-runtime does not contain jsx', () => {
453
+ jest.replaceProperty(global, '__DEV__' as any, false);
454
+
452
455
  expect(DdRumUserInteractionTracking['isTracking']).toBe(false);
453
456
  jest.setMock('react/jsx-runtime', {});
454
-
455
- DdRumUserInteractionTracking.startTracking();
457
+ DdRumUserInteractionTracking.startTracking({});
456
458
  expect(DdRumUserInteractionTracking['isTracking']).toBe(true);
457
459
  expect(DdSdk.telemetryDebug).toBeCalledWith(
458
460
  'React jsx runtime does not export new jsx transform'
@@ -462,7 +464,7 @@ describe('startTracking', () => {
462
464
  expect(DdRumUserInteractionTracking['isTracking']).toBe(false);
463
465
  jest.setMock('react/package.json', { version: '16.13.0' });
464
466
 
465
- DdRumUserInteractionTracking.startTracking();
467
+ DdRumUserInteractionTracking.startTracking({});
466
468
  expect(DdRumUserInteractionTracking['isTracking']).toBe(true);
467
469
  expect(DdSdk.telemetryDebug).toBeCalledWith(
468
470
  'React version does not support new jsx transform'
package/src/index.tsx CHANGED
@@ -3,7 +3,9 @@
3
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
+ /* eslint-disable arca/import-ordering */
6
7
 
8
+ import './polyfills';
7
9
  import {
8
10
  DatadogProviderConfiguration,
9
11
  DdSdkReactNativeConfiguration,
@@ -32,6 +34,8 @@ import { DefaultTimeProvider } from './utils/time-provider/DefaultTimeProvider';
32
34
  import { TimeProvider } from './utils/time-provider/TimeProvider';
33
35
  import type { Timestamp } from './utils/time-provider/TimeProvider';
34
36
 
37
+ /* eslint-enable arca/import-ordering */
38
+
35
39
  export {
36
40
  DatadogProvider,
37
41
  DatadogProviderConfiguration,
@@ -7,6 +7,7 @@
7
7
  import { DATADOG_MESSAGE_PREFIX, InternalLog } from '../InternalLog';
8
8
  import { SdkVerbosity } from '../SdkVerbosity';
9
9
  import type { DdNativeLogsType } from '../nativeModulesTypes';
10
+ import { DdAttributes } from '../rum/DdAttributes';
10
11
  import { validateContext } from '../utils/argsUtils';
11
12
 
12
13
  import { generateEventMapper } from './eventMapper';
@@ -33,7 +34,8 @@ const isLogWithError = (
33
34
  typeof args[1] === 'string' ||
34
35
  typeof args[2] === 'string' ||
35
36
  typeof args[3] === 'string' ||
36
- typeof args[4] === 'object'
37
+ typeof args[4] === 'object' ||
38
+ typeof args[5] === 'string'
37
39
  );
38
40
  };
39
41
 
@@ -51,7 +53,8 @@ class DdLogsWrapper implements DdLogsType {
51
53
  args[2],
52
54
  args[3],
53
55
  validateContext(args[4]),
54
- 'debug'
56
+ 'debug',
57
+ args[5]
55
58
  );
56
59
  }
57
60
  return this.log(args[0], validateContext(args[1]), 'debug');
@@ -65,7 +68,8 @@ class DdLogsWrapper implements DdLogsType {
65
68
  args[2],
66
69
  args[3],
67
70
  validateContext(args[4]),
68
- 'info'
71
+ 'info',
72
+ args[5]
69
73
  );
70
74
  }
71
75
  return this.log(args[0], validateContext(args[1]), 'info');
@@ -79,7 +83,8 @@ class DdLogsWrapper implements DdLogsType {
79
83
  args[2],
80
84
  args[3],
81
85
  validateContext(args[4]),
82
- 'warn'
86
+ 'warn',
87
+ args[5]
83
88
  );
84
89
  }
85
90
  return this.log(args[0], validateContext(args[1]), 'warn');
@@ -93,7 +98,8 @@ class DdLogsWrapper implements DdLogsType {
93
98
  args[2],
94
99
  args[3],
95
100
  validateContext(args[4]),
96
- 'error'
101
+ 'error',
102
+ args[5]
97
103
  );
98
104
  }
99
105
  return this.log(args[0], validateContext(args[1]), 'error');
@@ -170,7 +176,8 @@ class DdLogsWrapper implements DdLogsType {
170
176
  errorMessage: string | undefined,
171
177
  stacktrace: string | undefined,
172
178
  context: object,
173
- status: 'debug' | 'info' | 'warn' | 'error'
179
+ status: 'debug' | 'info' | 'warn' | 'error',
180
+ fingerprint?: string
174
181
  ): Promise<void> => {
175
182
  const event = this.logEventMapper.applyEventMapper({
176
183
  message,
@@ -178,7 +185,8 @@ class DdLogsWrapper implements DdLogsType {
178
185
  errorMessage,
179
186
  stacktrace,
180
187
  context,
181
- status
188
+ status,
189
+ fingerprint: fingerprint ?? ''
182
190
  });
183
191
  if (!event) {
184
192
  this.printLogDroppedByMapper(message, status);
@@ -187,12 +195,21 @@ class DdLogsWrapper implements DdLogsType {
187
195
 
188
196
  this.printLogTracked(event.message, status);
189
197
  try {
198
+ const updatedContext = {
199
+ ...event.context,
200
+ [DdAttributes.errorSourceType]: 'react-native'
201
+ };
202
+
203
+ if (fingerprint && fingerprint !== '') {
204
+ updatedContext[DdAttributes.errorFingerprint] = fingerprint;
205
+ }
206
+
190
207
  return await this.nativeLogs[`${status}WithError`](
191
208
  event.message,
192
209
  (event as NativeLogWithError).errorKind,
193
210
  (event as NativeLogWithError).errorMessage,
194
211
  (event as NativeLogWithError).stacktrace,
195
- { ...event.context, '_dd.error.source_type': 'react-native' }
212
+ updatedContext
196
213
  );
197
214
  } catch (error) {
198
215
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment