@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
@@ -184,6 +184,128 @@ describe('DdLogs', () => {
184
184
  }
185
185
  );
186
186
 
187
+ it.each([
188
+ [
189
+ 'kind',
190
+ 'message',
191
+ 'stacktrace',
192
+ { context: 'value' },
193
+ 'custom-fingerprint-0'
194
+ ],
195
+ // 1 argument is undefined
196
+ [
197
+ undefined,
198
+ 'message',
199
+ 'stacktrace',
200
+ { context: 'value' },
201
+ 'custom-fingerprint-1'
202
+ ],
203
+ [
204
+ 'kind',
205
+ undefined,
206
+ 'stacktrace',
207
+ { context: 'value' },
208
+ 'custom-fingerprint-2'
209
+ ],
210
+ [
211
+ 'kind',
212
+ 'message',
213
+ undefined,
214
+ { context: 'value' },
215
+ 'custom-fingerprint-3'
216
+ ],
217
+ ['kind', 'message', 'stacktrace', undefined, 'custom-fingerprint'],
218
+ // 2 arguments are undefined
219
+ [
220
+ undefined,
221
+ undefined,
222
+ 'stacktrace',
223
+ { context: 'value' },
224
+ 'custom-fingerprint-4'
225
+ ],
226
+ [
227
+ undefined,
228
+ 'message',
229
+ undefined,
230
+ { context: 'value' },
231
+ 'custom-fingerprint-5'
232
+ ],
233
+ [
234
+ undefined,
235
+ 'message',
236
+ 'stacktrace',
237
+ undefined,
238
+ 'custom-fingerprint-6'
239
+ ],
240
+ [
241
+ 'kind',
242
+ undefined,
243
+ undefined,
244
+ { context: 'value' },
245
+ 'custom-fingerprint-7'
246
+ ],
247
+ [
248
+ 'kind',
249
+ undefined,
250
+ 'stacktrace',
251
+ undefined,
252
+ 'custom-fingerprint-8'
253
+ ],
254
+ ['kind', 'message', undefined, undefined, 'custom-fingerprint-9'],
255
+ // 3 arguments are undefined
256
+ [
257
+ undefined,
258
+ undefined,
259
+ 'stacktrace',
260
+ undefined,
261
+ 'custom-fingerprint-10'
262
+ ],
263
+ [
264
+ undefined,
265
+ 'message',
266
+ undefined,
267
+ undefined,
268
+ 'custom-fingerprint-11'
269
+ ],
270
+ ['kind', undefined, undefined, undefined, 'custom-fingerprint-12'],
271
+ [
272
+ undefined,
273
+ undefined,
274
+ undefined,
275
+ { context: 'value' },
276
+ 'custom-fingerprint-13'
277
+ ]
278
+ ])(
279
+ 'sends error info with custom fingerprint when provided for %s %s %s %s %s',
280
+ async (
281
+ errorKind,
282
+ errorMessage,
283
+ stacktrace,
284
+ context,
285
+ fingerprint
286
+ ) => {
287
+ await DdLogs.info(
288
+ 'message',
289
+ errorKind,
290
+ errorMessage,
291
+ stacktrace,
292
+ context,
293
+ fingerprint
294
+ );
295
+ expect(NativeModules.DdLogs.infoWithError).toHaveBeenCalledWith(
296
+ 'message',
297
+ errorKind,
298
+ errorMessage,
299
+ stacktrace,
300
+ {
301
+ ...(context || {}),
302
+ '_dd.error.source_type': 'react-native',
303
+ '_dd.error.fingerprint': fingerprint
304
+ }
305
+ );
306
+ }
307
+ );
308
+
187
309
  it('does not send error info when no error and no context is passed', async () => {
188
310
  await DdLogs.info(
189
311
  'message',
package/src/logs/types.ts CHANGED
@@ -54,6 +54,7 @@ export type RawLogWithError = {
54
54
  stacktrace: string;
55
55
  context: object;
56
56
  status: LogStatus;
57
+ fingerprint?: string;
57
58
  };
58
59
 
59
60
  /**
@@ -69,6 +70,7 @@ export type NativeLogWithError = {
69
70
  errorMessage: string;
70
71
  stacktrace: string;
71
72
  context: object;
73
+ fingerprint?: string;
72
74
  };
73
75
 
74
76
  export type LogStatus = 'debug' | 'info' | 'warn' | 'error';
@@ -79,6 +81,7 @@ export type LogEvent = {
79
81
  errorKind?: string;
80
82
  errorMessage?: string;
81
83
  stacktrace?: string;
84
+ fingerprint?: string;
82
85
  // readonly date: number; // TODO: RUMM-2446 & RUMM-2447
83
86
  readonly status: LogStatus;
84
87
  readonly userInfo: UserInfo;
@@ -94,5 +97,6 @@ export type LogWithErrorArguments = [
94
97
  errorKind?: string,
95
98
  errorMessage?: string,
96
99
  stacktrace?: string,
97
- context?: object
100
+ context?: object,
101
+ fingerprint?: string
98
102
  ];
@@ -139,12 +139,14 @@ export interface DdNativeRumType extends NativeDdRum {
139
139
  * @param stacktrace: The error stacktrace.
140
140
  * @param context: The additional context to send.
141
141
  * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
142
+ * @param fingerprint: Optional custom error fingerprint.
142
143
  */
143
144
  addError(
144
145
  message: string,
145
146
  source: ErrorSource,
146
147
  stacktrace: string,
147
148
  context: object,
148
- timestampMs: number
149
+ timestampMs: number,
150
+ fingerprint: string | undefined
149
151
  ): Promise<void>;
150
152
  }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ import { version as reactNativeVersion } from 'react-native/package.json';
8
+
9
+ function applyBigIntPolyfill() {
10
+ const rnVersion = reactNativeVersion.split('.').map(Number);
11
+ const isRn63 = rnVersion[0] === 0 && rnVersion[1] === 63;
12
+
13
+ if (isRn63 && typeof BigInt === 'undefined') {
14
+ try {
15
+ // eslint-disable-next-line global-require, import/no-extraneous-dependencies
16
+ global.BigInt = require('big-integer');
17
+ console.warn(
18
+ 'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +
19
+ 'The missing type has been polyfilled using `big-integer` to grant back-compatibility. ' +
20
+ 'We strongly suggest updating to a greater version of React Native (>= 0.64).'
21
+ );
22
+ } catch (e) {
23
+ if (e instanceof Error && e.code === 'MODULE_NOT_FOUND') {
24
+ throw new Error(
25
+ 'React Native 0.63 does not support BigInt, which is required starting from v2.4.0 of Datadog React Native SDK. ' +
26
+ 'We strongly suggest updating to a greater version of React Native (>= 0.64).\n\n' +
27
+ 'You can install `big-integer` to enable our polyfill that grants back-compatibility with RN 63:\n\n' +
28
+ '`yarn add big-integer`\n\nOR\n\n`npm install --save big-integer`'
29
+ );
30
+ } else {
31
+ throw e;
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ applyBigIntPolyfill();
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ export const DdAttributes = {
8
+ /**
9
+ * Custom "source type" of the error. Used in RUM errors. It names the
10
+ * language or platform of the RUM error stack trace, so the SCI backend
11
+ * knows how to symbolize it. Expects {@link String} value.
12
+ */
13
+ errorSourceType: '_dd.error.source_type',
14
+
15
+ /**
16
+ * Custom fingerprint to an error.
17
+ * Expects {@link String} value.
18
+ */
19
+ errorFingerprint: '_dd.error.fingerprint'
20
+ };
package/src/rum/DdRum.ts CHANGED
@@ -6,16 +6,17 @@
6
6
 
7
7
  import type { GestureResponderEvent } from 'react-native';
8
8
 
9
- import { DdSdkReactNative } from '../DdSdkReactNative';
10
9
  import { InternalLog } from '../InternalLog';
11
10
  import { SdkVerbosity } from '../SdkVerbosity';
12
11
  import type { DdNativeRumType } from '../nativeModulesTypes';
13
12
  import { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
14
13
  import { DdSdk } from '../sdk/DdSdk';
14
+ import { GlobalState } from '../sdk/GlobalState/GlobalState';
15
15
  import { validateContext } from '../utils/argsUtils';
16
16
  import { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';
17
17
  import type { TimeProvider } from '../utils/time-provider/TimeProvider';
18
18
 
19
+ import { DdAttributes } from './DdAttributes';
19
20
  import type { ActionEventMapper } from './eventMappers/actionEventMapper';
20
21
  import { generateActionEventMapper } from './eventMappers/actionEventMapper';
21
22
  import type { ErrorEventMapper } from './eventMappers/errorEventMapper';
@@ -23,10 +24,10 @@ import { generateErrorEventMapper } from './eventMappers/errorEventMapper';
23
24
  import type { ResourceEventMapper } from './eventMappers/resourceEventMapper';
24
25
  import { generateResourceEventMapper } from './eventMappers/resourceEventMapper';
25
26
  import type {
27
+ ErrorSource,
26
28
  DdRumType,
27
29
  RumActionType,
28
- ResourceKind,
29
- ErrorSource
30
+ ResourceKind
30
31
  } from './types';
31
32
 
32
33
  const generateEmptyPromise = () => new Promise<void>(resolve => resolve());
@@ -229,28 +230,32 @@ class DdRumWrapper implements DdRumType {
229
230
  source: ErrorSource,
230
231
  stacktrace: string,
231
232
  context: object = {},
232
- timestampMs: number = this.timeProvider.now()
233
+ timestampMs: number = this.timeProvider.now(),
234
+ fingerprint?: string
233
235
  ): Promise<void> => {
234
236
  const mappedEvent = this.errorEventMapper.applyEventMapper({
235
237
  message,
236
238
  source,
237
239
  stacktrace,
238
240
  context: validateContext(context),
239
- timestampMs
241
+ timestampMs,
242
+ fingerprint: fingerprint ?? ''
240
243
  });
244
+
241
245
  if (!mappedEvent) {
242
246
  return generateEmptyPromise();
243
247
  }
244
248
  InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);
245
249
  const updatedContext: any = mappedEvent.context;
246
- updatedContext['_dd.error.source_type'] = 'react-native';
250
+ updatedContext[DdAttributes.errorSourceType] = 'react-native';
247
251
  return bufferVoidNativeCall(() =>
248
252
  this.nativeRum.addError(
249
253
  mappedEvent.message,
250
254
  mappedEvent.source,
251
255
  mappedEvent.stacktrace,
252
256
  updatedContext,
253
- mappedEvent.timestampMs
257
+ mappedEvent.timestampMs,
258
+ mappedEvent.fingerprint
254
259
  )
255
260
  );
256
261
  };
@@ -284,7 +289,7 @@ class DdRumWrapper implements DdRumType {
284
289
  };
285
290
 
286
291
  async getCurrentSessionId(): Promise<string | undefined> {
287
- if (!DdSdkReactNative.isInitialized()) {
292
+ if (!GlobalState.instance.isInitialized) {
288
293
  return undefined;
289
294
  }
290
295
  return this.nativeRum.getCurrentSessionId();
@@ -7,11 +7,11 @@
7
7
 
8
8
  import { NativeModules } from 'react-native';
9
9
 
10
- import { DdSdkReactNative } from '../../DdSdkReactNative';
11
10
  import { InternalLog } from '../../InternalLog';
12
11
  import { SdkVerbosity } from '../../SdkVerbosity';
13
12
  import { BufferSingleton } from '../../sdk/DatadogProvider/Buffer/BufferSingleton';
14
13
  import { DdSdk } from '../../sdk/DdSdk';
14
+ import { GlobalState } from '../../sdk/GlobalState/GlobalState';
15
15
  import { DdRum } from '../DdRum';
16
16
  import type { ActionEventMapper } from '../eventMappers/actionEventMapper';
17
17
  import type { ErrorEventMapper } from '../eventMappers/errorEventMapper';
@@ -523,7 +523,8 @@ describe('DdRum', () => {
523
523
  ...context,
524
524
  '_dd.error.source_type': 'react-native'
525
525
  },
526
- expect.anything()
526
+ expect.anything(),
527
+ ''
527
528
  );
528
529
  });
529
530
 
@@ -549,7 +550,8 @@ describe('DdRum', () => {
549
550
  {
550
551
  '_dd.error.source_type': 'react-native'
551
552
  },
552
- expect.anything()
553
+ expect.anything(),
554
+ ''
553
555
  );
554
556
  });
555
557
 
@@ -576,7 +578,8 @@ describe('DdRum', () => {
576
578
  context,
577
579
  '_dd.error.source_type': 'react-native'
578
580
  },
579
- expect.anything()
581
+ expect.anything(),
582
+ ''
580
583
  );
581
584
  });
582
585
  });
@@ -678,6 +681,38 @@ describe('DdRum', () => {
678
681
  );
679
682
  });
680
683
 
684
+ it('M add error fingerprint W addError() { with custom fingerprint }', async () => {
685
+ // Given
686
+ const message = 'Oops I did it again!';
687
+ const source = ErrorSource.SOURCE;
688
+ const stacktrace = 'doSomething() at ./path/to/file.js:67:3';
689
+
690
+ // When
691
+ DdRum.addError(
692
+ message,
693
+ source,
694
+ stacktrace,
695
+ undefined,
696
+ undefined,
697
+ 'custom-fingerprint'
698
+ );
699
+
700
+ // Then
701
+ expect(NativeModules.DdRum.addError.mock.calls.length).toBe(1);
702
+ expect(NativeModules.DdRum.addError.mock.calls[0][0]).toBe(message);
703
+ expect(NativeModules.DdRum.addError.mock.calls[0][1]).toBe(source);
704
+ expect(NativeModules.DdRum.addError.mock.calls[0][2]).toBe(
705
+ stacktrace
706
+ );
707
+ const context = NativeModules.DdRum.addError.mock.calls[0][3];
708
+ expect(context['_dd.error.source_type']).toStrictEqual(
709
+ 'react-native'
710
+ );
711
+ expect(NativeModules.DdRum.addError.mock.calls[0][5]).toBe(
712
+ 'custom-fingerprint'
713
+ );
714
+ });
715
+
681
716
  it('M add error source type W addError() {with custom attributes}', async () => {
682
717
  // Given
683
718
  const message = 'Oops I did it again!';
@@ -730,7 +765,8 @@ describe('DdRum', () => {
730
765
  '_dd.error.source_type': 'react-native',
731
766
  isFatal: true
732
767
  },
733
- 456
768
+ 456,
769
+ ''
734
770
  );
735
771
  });
736
772
 
@@ -929,7 +965,7 @@ describe('DdRum', () => {
929
965
 
930
966
  describe('DdRum.getCurrentSessionId', () => {
931
967
  it('calls the native API if SDK is initialized', async () => {
932
- DdSdkReactNative['_isInitialized'] = true;
968
+ GlobalState.instance.isInitialized = true;
933
969
  const sessionId = await DdRum.getCurrentSessionId();
934
970
  expect(NativeModules.DdRum.getCurrentSessionId).toHaveBeenCalled();
935
971
  expect(sessionId).toBe('test-session-id');
@@ -938,7 +974,7 @@ describe('DdRum', () => {
938
974
 
939
975
  describe('DdRum.getCurrentSessionId', () => {
940
976
  it('returns undefined if SDK is not initialized', async () => {
941
- DdSdkReactNative['_isInitialized'] = false;
977
+ GlobalState.instance.isInitialized = false;
942
978
  const sessionId = await DdRum.getCurrentSessionId();
943
979
  expect(
944
980
  NativeModules.DdRum.getCurrentSessionId
@@ -14,6 +14,7 @@ type RawError = {
14
14
  stacktrace: string;
15
15
  context: object;
16
16
  timestampMs: number;
17
+ fingerprint: string;
17
18
  };
18
19
 
19
20
  type ErrorEvent = RawError & AdditionalEventDataForMapper;
@@ -24,6 +25,7 @@ type NativeError = {
24
25
  stacktrace: string;
25
26
  context: object;
26
27
  timestampMs: number;
28
+ fingerprint: string;
27
29
  };
28
30
 
29
31
  export type ErrorEventMapper = (event: ErrorEvent) => ErrorEvent | null;
@@ -16,7 +16,7 @@ import type { DdEventsInterceptorOptions } from './DdEventsInterceptor';
16
16
  import type EventsInterceptor from './EventsInterceptor';
17
17
  import NoOpEventsInterceptor from './NoOpEventsInterceptor';
18
18
  import { areObjectShallowEqual } from './ShallowObjectEqualityChecker';
19
- import { getJsxRuntime } from './getJsxRuntime';
19
+ import { getJsxRuntimes } from './getJsxRuntime';
20
20
 
21
21
  /**
22
22
  * Provides RUM auto-instrumentation feature to track user interaction as RUM events.
@@ -28,6 +28,7 @@ export class DdRumUserInteractionTracking {
28
28
  private static originalCreateElement = React.createElement;
29
29
  private static originalMemo = React.memo;
30
30
  private static originalJsx = null;
31
+ private static originalDevJsx = null;
31
32
 
32
33
  private static patchCreateElementFunction = (
33
34
  originalFunction: typeof React.createElement,
@@ -68,6 +69,7 @@ export class DdRumUserInteractionTracking {
68
69
  );
69
70
  return;
70
71
  }
72
+
71
73
  DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor(
72
74
  options
73
75
  );
@@ -80,14 +82,31 @@ export class DdRumUserInteractionTracking {
80
82
  };
81
83
 
82
84
  try {
83
- const jsxRuntime = getJsxRuntime();
84
- const originalJsx = jsxRuntime.jsx;
85
+ const [jsxRuntime, jsxDevRuntime] = getJsxRuntimes();
86
+ const originalJsx = jsxRuntime?.jsx;
87
+ const originalDevJsx = jsxDevRuntime?.jsxDEV;
88
+
85
89
  this.originalJsx = originalJsx;
86
- jsxRuntime.jsx = (
87
- ...args: Parameters<typeof React.createElement>
88
- ): ReturnType<typeof React.createElement> => {
89
- return this.patchCreateElementFunction(originalJsx, args);
90
- };
90
+ this.originalDevJsx = originalDevJsx;
91
+
92
+ if (originalJsx) {
93
+ jsxRuntime.jsx = (
94
+ ...args: Parameters<typeof React.createElement>
95
+ ): ReturnType<typeof React.createElement> => {
96
+ return this.patchCreateElementFunction(originalJsx, args);
97
+ };
98
+ }
99
+
100
+ if (originalDevJsx) {
101
+ jsxRuntime.jsxDEV = (
102
+ ...args: Parameters<typeof React.createElement>
103
+ ): ReturnType<typeof React.createElement> => {
104
+ return this.patchCreateElementFunction(
105
+ originalDevJsx,
106
+ args
107
+ );
108
+ };
109
+ }
91
110
  } catch (e) {
92
111
  DdSdk.telemetryDebug(getErrorMessage(e));
93
112
  }
@@ -135,10 +154,14 @@ export class DdRumUserInteractionTracking {
135
154
  React.createElement = this.originalCreateElement;
136
155
  React.memo = this.originalMemo;
137
156
  DdRumUserInteractionTracking.isTracking = false;
138
- if (this.originalJsx) {
139
- const jsxRuntime = getJsxRuntime();
157
+ if (this.originalJsx || this.originalDevJsx) {
158
+ const [jsxRuntime, jsxDevRuntime] = getJsxRuntimes();
159
+
140
160
  jsxRuntime.jsx = this.originalJsx;
161
+ jsxDevRuntime.jsxDEV = this.originalDevJsx;
162
+
141
163
  this.originalJsx = null;
164
+ this.originalDevJsx = null;
142
165
  }
143
166
  }
144
167
  }
@@ -4,7 +4,7 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- export const getJsxRuntime = () => {
7
+ export const getJsxRuntimes = () => {
8
8
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
9
9
  const [major, minor] = require('react/package.json').version.split('.');
10
10
  // We need to check on the version of React before requiring 'react/jsx-runtime') as
@@ -21,12 +21,19 @@ export const getJsxRuntime = () => {
21
21
  // disable all further imports.
22
22
  // /!\/!\/!\/!\/!\/!\
23
23
  //
24
+ let jsxDevRuntime;
25
+ if (__DEV__) {
26
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
27
+ jsxDevRuntime = require('react/jsx-dev-runtime');
28
+ }
29
+
24
30
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
25
31
  const jsxRuntime = require('react/jsx-runtime');
26
- if (!jsxRuntime.jsx) {
32
+ if (!jsxRuntime.jsx && !__DEV__) {
27
33
  throw new Error('React jsx runtime does not export new jsx transform');
28
34
  }
29
- return jsxRuntime;
35
+
36
+ return [jsxRuntime, jsxDevRuntime];
30
37
  };
31
38
 
32
39
  /**
@@ -18,6 +18,7 @@ export class XMLHttpRequestMock implements XMLHttpRequest {
18
18
  public requestHeaders: Map<string, string> = new Map();
19
19
  public responseHeaders: Map<string, string> = new Map();
20
20
 
21
+ // eslint-disable-next-line no-empty-function
21
22
  constructor() {}
22
23
  responseText: string;
23
24
  responseURL: string;
@@ -4,7 +4,7 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- export default class TracingIdentifierUtils {
7
+ export class TracingIdentifierUtils {
8
8
  /**
9
9
  * Extracts the Unix timestamp from the 128-bit hex string representation.
10
10
  * @param idHex - The 128-bit ID as a hexadecimal string.
@@ -6,7 +6,7 @@
6
6
 
7
7
  import { TracingIdentifier, TracingIdFormat } from '../TracingIdentifier';
8
8
 
9
- import TracingIdentifierUtils from './__utils__/tracingIdentifierUtils';
9
+ import { TracingIdentifierUtils } from './__utils__/tracingIdentifierUtils';
10
10
 
11
11
  describe('TracingIdentifier', () => {
12
12
  it('M return an unique identifier W toString', async () => {
@@ -12,7 +12,7 @@ import { BufferSingleton } from '../../../../../../sdk/DatadogProvider/Buffer/Bu
12
12
  import { DdRum } from '../../../../../DdRum';
13
13
  import { PropagatorType } from '../../../../../types';
14
14
  import { XMLHttpRequestMock } from '../../../__tests__/__utils__/XMLHttpRequestMock';
15
- import TracingIdentifierUtils from '../../../distributedTracing/__tests__/__utils__/tracingIdentifierUtils';
15
+ import { TracingIdentifierUtils } from '../../../distributedTracing/__tests__/__utils__/tracingIdentifierUtils';
16
16
  import {
17
17
  PARENT_ID_HEADER_KEY,
18
18
  TRACE_ID_HEADER_KEY,
@@ -7,11 +7,11 @@
7
7
  import { NativeModules } from 'react-native';
8
8
 
9
9
  import { InitializationMode } from '../../../DdSdkReactNativeConfiguration';
10
- import { DdSdkReactNative } from '../../../DdSdkReactNative';
11
10
  import { DdRum } from '../../../rum/DdRum';
12
11
  import { RumActionType } from '../../../rum/types';
13
12
  import { DdTrace } from '../../../trace/DdTrace';
14
13
  import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
14
+ import { GlobalState } from '../../GlobalState/GlobalState';
15
15
  import { BufferSingleton } from '../Buffer/BufferSingleton';
16
16
  import {
17
17
  DatadogProvider,
@@ -41,7 +41,7 @@ const flushPromises = () =>
41
41
  describe('DatadogProvider', () => {
42
42
  afterEach(() => {
43
43
  jest.clearAllMocks();
44
- DdSdkReactNative['_isInitialized'] = false;
44
+ GlobalState.instance.isInitialized = false;
45
45
  __internalResetIsInitializedForTesting();
46
46
  BufferSingleton.reset();
47
47
  (nowMock as any).mockReturnValue('timestamp_not_specified');
@@ -73,7 +73,7 @@ describe('DatadogProvider', () => {
73
73
  "clientToken": "fakeToken",
74
74
  "configurationForTelemetry": {
75
75
  "initializationType": "SYNC",
76
- "reactNativeVersion": "0.73.6",
76
+ "reactNativeVersion": "0.73.9",
77
77
  "reactVersion": "18.2.0",
78
78
  "trackErrors": true,
79
79
  "trackInteractions": true,
@@ -12,6 +12,7 @@ import { DdSdkReactNative } from '../../../DdSdkReactNative';
12
12
  import { DdRumUserInteractionTracking } from '../../../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
13
13
  import { XMLHttpRequestMock } from '../../../rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock';
14
14
  import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
15
+ import { GlobalState } from '../../GlobalState/GlobalState';
15
16
  import { BufferSingleton } from '../Buffer/BufferSingleton';
16
17
  import {
17
18
  DatadogProvider,
@@ -41,13 +42,13 @@ const flushPromises = () =>
41
42
  describe('DatadogProvider', () => {
42
43
  beforeEach(() => {
43
44
  jest.clearAllMocks();
44
- DdSdkReactNative['_isInitialized'] = false;
45
+ GlobalState.instance.isInitialized = false;
45
46
  DdSdkReactNative['wasAutoInstrumented'] = false;
46
47
  __internalResetIsInitializedForTesting();
47
48
  BufferSingleton.reset();
48
49
  DdRumUserInteractionTracking.stopTracking();
49
50
  (nowMock as any).mockReturnValue('timestamp_not_specified');
50
- global.XMLHttpRequest = XMLHttpRequestMock;
51
+ global.XMLHttpRequest = XMLHttpRequestMock as any;
51
52
  });
52
53
 
53
54
  describe('initializationMode SYNC', () => {
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /**
8
+ * A singleton container for attributes that are shared internally across all
9
+ * the SDK classes.
10
+ */
11
+ export class GlobalState {
12
+ /**
13
+ * `true` if the SDK is initialized, `false` otherwise.
14
+ */
15
+ public isInitialized = false;
16
+
17
+ // Singleton implementation
18
+ private static _instance: GlobalState | undefined = undefined;
19
+ public static get instance(): GlobalState {
20
+ if (this._instance === undefined) {
21
+ this._instance = new GlobalState();
22
+ }
23
+
24
+ return this._instance;
25
+ }
26
+ }