@datadog/mobile-react-native 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +58 -64
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +31 -1
  4. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +242 -14
  5. package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +6 -0
  6. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +106 -0
  7. package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +2 -0
  8. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +116 -0
  9. package/ios/Sources/Attributes.swift +14 -0
  10. package/ios/Sources/DdSdk.swift +18 -0
  11. package/lib/commonjs/DdSdkReactNative.js +40 -8
  12. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  13. package/lib/commonjs/DdSdkReactNativeConfiguration.js +42 -2
  14. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  15. package/lib/commonjs/foundation.js +2 -139
  16. package/lib/commonjs/foundation.js.map +1 -1
  17. package/lib/commonjs/index.js +18 -14
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/commonjs/logs/DdLogs.js +71 -0
  20. package/lib/commonjs/logs/DdLogs.js.map +1 -0
  21. package/lib/commonjs/logs/eventMapper.js +39 -0
  22. package/lib/commonjs/logs/eventMapper.js.map +1 -0
  23. package/lib/commonjs/logs/types.js +2 -0
  24. package/lib/commonjs/{rum/instrumentation/EventsInterceptor.js.map → logs/types.js.map} +0 -0
  25. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  26. package/lib/commonjs/rum/DdRum.js +234 -0
  27. package/lib/commonjs/rum/DdRum.js.map +1 -0
  28. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +36 -0
  29. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -0
  30. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +32 -0
  31. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -0
  32. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +38 -0
  33. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -0
  34. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -4
  35. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  36. package/lib/commonjs/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  37. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  38. package/lib/commonjs/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
  39. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  40. package/lib/commonjs/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  41. package/lib/{module/rum/instrumentation → commonjs/rum/instrumentation/interactionTracking}/EventsInterceptor.js.map +0 -0
  42. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  43. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  44. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  45. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  46. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  47. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  48. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
  49. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  50. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  51. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  52. package/lib/commonjs/rum/types.js +42 -0
  53. package/lib/commonjs/rum/types.js.map +1 -0
  54. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +45 -0
  55. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  56. package/lib/commonjs/sdk/AttributesSingleton/types.js +2 -0
  57. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -0
  58. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  59. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  60. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  61. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  62. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  63. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  64. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  65. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  66. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  67. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  68. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  69. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  70. package/lib/commonjs/sdk/EventMappers/EventMapper.js +85 -0
  71. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -0
  72. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +98 -0
  73. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -0
  74. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +43 -0
  75. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  76. package/lib/commonjs/sdk/UserInfoSingleton/types.js +2 -0
  77. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -0
  78. package/lib/commonjs/types.js +1 -26
  79. package/lib/commonjs/types.js.map +1 -1
  80. package/lib/commonjs/version.js +1 -1
  81. package/lib/commonjs/version.js.map +1 -1
  82. package/lib/module/DdSdkReactNative.js +33 -7
  83. package/lib/module/DdSdkReactNative.js.map +1 -1
  84. package/lib/module/DdSdkReactNativeConfiguration.js +42 -2
  85. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  86. package/lib/module/foundation.js +2 -124
  87. package/lib/module/foundation.js.map +1 -1
  88. package/lib/module/index.js +5 -3
  89. package/lib/module/index.js.map +1 -1
  90. package/lib/module/logs/DdLogs.js +64 -0
  91. package/lib/module/logs/DdLogs.js.map +1 -0
  92. package/lib/module/logs/eventMapper.js +20 -0
  93. package/lib/module/logs/eventMapper.js.map +1 -0
  94. package/lib/module/logs/types.js +2 -0
  95. package/lib/module/logs/types.js.map +1 -0
  96. package/lib/module/nativeModulesTypes.js.map +1 -1
  97. package/lib/module/rum/DdRum.js +212 -0
  98. package/lib/module/rum/DdRum.js.map +1 -0
  99. package/lib/module/rum/eventMappers/actionEventMapper.js +26 -0
  100. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -0
  101. package/lib/module/rum/eventMappers/errorEventMapper.js +22 -0
  102. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -0
  103. package/lib/module/rum/eventMappers/resourceEventMapper.js +28 -0
  104. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -0
  105. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +2 -2
  106. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  107. package/lib/module/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  108. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  109. package/lib/module/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
  110. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  111. package/lib/module/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  112. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -0
  113. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  114. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  115. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  116. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  117. package/lib/module/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  118. package/lib/module/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  119. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -2
  120. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  121. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  122. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  123. package/lib/module/rum/types.js +33 -0
  124. package/lib/module/rum/types.js.map +1 -0
  125. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +36 -0
  126. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  127. package/lib/module/sdk/AttributesSingleton/types.js +2 -0
  128. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -0
  129. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  130. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  131. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  132. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  133. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  134. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  135. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  136. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  137. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  138. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  139. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  140. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  141. package/lib/module/sdk/EventMappers/EventMapper.js +72 -0
  142. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -0
  143. package/lib/module/sdk/EventMappers/utils/deepClone.js +89 -0
  144. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -0
  145. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +34 -0
  146. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  147. package/lib/module/sdk/UserInfoSingleton/types.js +2 -0
  148. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -0
  149. package/lib/module/types.js +0 -23
  150. package/lib/module/types.js.map +1 -1
  151. package/lib/module/version.js +1 -1
  152. package/lib/module/version.js.map +1 -1
  153. package/lib/typescript/DdSdkReactNative.d.ts +7 -3
  154. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +22 -0
  155. package/lib/typescript/foundation.d.ts +2 -4
  156. package/lib/typescript/index.d.ts +5 -3
  157. package/lib/typescript/logs/DdLogs.d.ts +14 -0
  158. package/lib/typescript/logs/eventMapper.d.ts +11 -0
  159. package/lib/typescript/logs/types.d.ts +54 -0
  160. package/lib/typescript/nativeModulesTypes.d.ts +1 -1
  161. package/lib/typescript/rum/DdRum.d.ts +36 -0
  162. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +21 -0
  163. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +21 -0
  164. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +24 -0
  165. package/lib/typescript/rum/instrumentation/{DdEventsInterceptor.d.ts → interactionTracking/DdEventsInterceptor.d.ts} +0 -0
  166. package/lib/typescript/rum/instrumentation/{DdRumUserInteractionTracking.d.ts → interactionTracking/DdRumUserInteractionTracking.d.ts} +1 -0
  167. package/lib/typescript/rum/instrumentation/{EventsInterceptor.d.ts → interactionTracking/EventsInterceptor.d.ts} +0 -0
  168. package/lib/typescript/rum/instrumentation/{NoOpEventsInterceptor.d.ts → interactionTracking/NoOpEventsInterceptor.d.ts} +0 -0
  169. package/lib/typescript/rum/instrumentation/{ShallowObjectEqualityChecker.d.ts → interactionTracking/ShallowObjectEqualityChecker.d.ts} +0 -0
  170. package/lib/typescript/rum/instrumentation/{getJsxRuntime.d.ts → interactionTracking/getJsxRuntime.d.ts} +0 -0
  171. package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +2 -1
  172. package/lib/typescript/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +0 -1
  173. package/lib/typescript/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +0 -1
  174. package/lib/typescript/rum/types.d.ts +110 -0
  175. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
  176. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +3 -0
  177. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.d.ts +0 -0
  178. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.d.ts +0 -0
  179. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.d.ts +0 -0
  180. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.d.ts +0 -0
  181. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.d.ts +0 -0
  182. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.d.ts +2 -2
  183. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +24 -0
  184. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +10 -0
  185. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
  186. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +6 -0
  187. package/lib/typescript/types.d.ts +0 -139
  188. package/lib/typescript/version.d.ts +1 -1
  189. package/package.json +2 -2
  190. package/scripts/replace-react-require.js +3 -2
  191. package/src/DdSdkReactNative.tsx +41 -7
  192. package/src/DdSdkReactNativeConfiguration.tsx +83 -3
  193. package/src/__tests__/DdSdkReactNative.test.tsx +244 -13
  194. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +29 -7
  195. package/src/__tests__/{longTasksUtils.ts → longTasksUtils.test.ts} +0 -0
  196. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +4 -3
  197. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +3 -2
  198. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +135 -117
  199. package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +1 -1
  200. package/src/foundation.tsx +4 -114
  201. package/src/index.tsx +5 -3
  202. package/src/logs/DdLogs.ts +67 -0
  203. package/src/logs/__tests__/DdLogs.test.ts +51 -0
  204. package/src/logs/__tests__/eventMapper.test.ts +53 -0
  205. package/src/logs/eventMapper.ts +43 -0
  206. package/src/logs/types.ts +70 -0
  207. package/src/nativeModulesTypes.ts +1 -1
  208. package/src/rum/DdRum.ts +387 -0
  209. package/src/rum/__tests__/DdRum.test.ts +386 -0
  210. package/src/rum/eventMappers/actionEventMapper.ts +66 -0
  211. package/src/rum/eventMappers/errorEventMapper.ts +57 -0
  212. package/src/rum/eventMappers/resourceEventMapper.ts +74 -0
  213. package/src/rum/instrumentation/DdRumErrorTracking.tsx +2 -2
  214. package/src/rum/instrumentation/{DdEventsInterceptor.tsx → interactionTracking/DdEventsInterceptor.tsx} +14 -6
  215. package/src/rum/instrumentation/{DdRumUserInteractionTracking.tsx → interactionTracking/DdRumUserInteractionTracking.tsx} +12 -4
  216. package/src/rum/instrumentation/{EventsInterceptor.tsx → interactionTracking/EventsInterceptor.tsx} +0 -0
  217. package/src/rum/instrumentation/{NoOpEventsInterceptor.tsx → interactionTracking/NoOpEventsInterceptor.tsx} +0 -0
  218. package/src/rum/instrumentation/{ShallowObjectEqualityChecker.ts → interactionTracking/ShallowObjectEqualityChecker.ts} +0 -0
  219. package/src/rum/instrumentation/{getJsxRuntime.ts → interactionTracking/getJsxRuntime.ts} +0 -0
  220. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +3 -2
  221. package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +2 -1
  222. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +3 -2
  223. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +3 -2
  224. package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +2 -1
  225. package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +89 -40
  226. package/src/rum/types.ts +182 -0
  227. package/src/sdk/AttributesSingleton/AttributesSingleton.ts +34 -0
  228. package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +44 -0
  229. package/src/sdk/AttributesSingleton/types.ts +9 -0
  230. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.ts +4 -4
  231. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.ts +0 -0
  232. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.ts +0 -0
  233. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.ts +0 -0
  234. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BoundedBuffer.test.ts +2 -2
  235. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BufferSingleton.test.ts +2 -1
  236. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.ts +0 -0
  237. package/src/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.tsx +5 -5
  238. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/__utils__/renderWithProvider.tsx +2 -2
  239. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initialization.test.tsx +13 -10
  240. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initializationModes.test.tsx +10 -6
  241. package/src/sdk/EventMappers/EventMapper.ts +94 -0
  242. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +50 -0
  243. package/src/sdk/EventMappers/utils/__tests__/deepClone.test.ts +79 -0
  244. package/src/sdk/EventMappers/utils/deepClone.ts +86 -0
  245. package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +31 -0
  246. package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +29 -0
  247. package/src/sdk/UserInfoSingleton/types.ts +12 -0
  248. package/src/types.tsx +0 -210
  249. package/src/version.ts +1 -1
  250. package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  251. package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +0 -1
  252. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  253. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  254. package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  255. package/lib/module/DatadogProvider/DatadogProvider.js.map +0 -1
  256. package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  257. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  258. package/src/__tests__/DdRumWrapper.test.tsx +0 -74
  259. package/src/__tests__/foundation.test.ts +0 -88
@@ -0,0 +1,89 @@
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
+ const isDate = object => {
7
+ const type = {}.toString.call(object).slice(8, -1);
8
+ return type === 'Date';
9
+ };
10
+
11
+ const isArray = object => {
12
+ const type = {}.toString.call(object).slice(8, -1);
13
+ return type === 'Array';
14
+ };
15
+
16
+ const isObject = object => {
17
+ const type = {}.toString.call(object).slice(8, -1);
18
+ return type === 'Object';
19
+ };
20
+
21
+ const isSet = object => {
22
+ const type = {}.toString.call(object).slice(8, -1);
23
+ return type === 'Set';
24
+ };
25
+
26
+ const isMap = object => {
27
+ const type = {}.toString.call(object).slice(8, -1);
28
+ return type === 'Map';
29
+ };
30
+ /**
31
+ * Simple deep clone inspired from https://github.com/angus-c/just/blob/master/packages/collection-clone/index.cjs
32
+ * Functions and RegExp will be returned as they are.
33
+ * Maps and Sets are cloned even though they won't be accepted by React Native, just in case they are mutated by the user to avoid side effects.
34
+ *
35
+ * We added support for circular references by limiting the number of depth levels to 8.
36
+ * @param originalObject
37
+ * @returns
38
+ */
39
+
40
+
41
+ export const deepClone = (originalObject, depth = 0) => {
42
+ if (isDate(originalObject)) {
43
+ return new Date(originalObject.getTime());
44
+ }
45
+
46
+ if (isSet(originalObject)) {
47
+ return new Set([...originalObject].map(value => deepClone(value)));
48
+ }
49
+
50
+ if (isMap(originalObject)) {
51
+ return new Map([...originalObject].map(kv => [deepClone(kv[0]), deepClone(kv[1])]));
52
+ }
53
+
54
+ if (isArray(originalObject)) {
55
+ if (depth >= 7) {
56
+ // Break the circular reference here
57
+ return originalObject;
58
+ }
59
+
60
+ const result = []; // eslint-disable-next-line guard-for-in
61
+
62
+ for (const key in originalObject) {
63
+ // include prototype properties
64
+ result[key] = deepClone(originalObject[key], depth + 1);
65
+ }
66
+
67
+ return result;
68
+ }
69
+
70
+ if (isObject(originalObject)) {
71
+ if (depth >= 7) {
72
+ // Break the circular reference here
73
+ return originalObject;
74
+ }
75
+
76
+ const result = {}; // eslint-disable-next-line guard-for-in
77
+
78
+ for (const key in originalObject) {
79
+ // include prototype properties
80
+ result[key] = deepClone(originalObject[key], depth + 1);
81
+ }
82
+
83
+ return result;
84
+ } // primitives and non-supported objects (e.g. functions) land here
85
+
86
+
87
+ return originalObject;
88
+ };
89
+ //# sourceMappingURL=deepClone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["deepClone.ts"],"names":["isDate","object","type","toString","call","slice","isArray","isObject","isSet","isMap","deepClone","originalObject","depth","Date","getTime","Set","map","value","Map","kv","result","key"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,MAAMA,MAAM,GAAIC,MAAD,IAAqC;AAChD,QAAMC,IAAI,GAAG,GAAGC,QAAH,CAAYC,IAAZ,CAAiBH,MAAjB,EAAyBI,KAAzB,CAA+B,CAA/B,EAAkC,CAAC,CAAnC,CAAb;AACA,SAAOH,IAAI,KAAK,MAAhB;AACH,CAHD;;AAKA,MAAMI,OAAO,GAAIL,MAAD,IAA0C;AACtD,QAAMC,IAAI,GAAG,GAAGC,QAAH,CAAYC,IAAZ,CAAiBH,MAAjB,EAAyBI,KAAzB,CAA+B,CAA/B,EAAkC,CAAC,CAAnC,CAAb;AACA,SAAOH,IAAI,KAAK,OAAhB;AACH,CAHD;;AAKA,MAAMK,QAAQ,GAAIN,MAAD,IAAwD;AACrE,QAAMC,IAAI,GAAG,GAAGC,QAAH,CAAYC,IAAZ,CAAiBH,MAAjB,EAAyBI,KAAzB,CAA+B,CAA/B,EAAkC,CAAC,CAAnC,CAAb;AACA,SAAOH,IAAI,KAAK,QAAhB;AACH,CAHD;;AAKA,MAAMM,KAAK,GAAIP,MAAD,IAA6C;AACvD,QAAMC,IAAI,GAAG,GAAGC,QAAH,CAAYC,IAAZ,CAAiBH,MAAjB,EAAyBI,KAAzB,CAA+B,CAA/B,EAAkC,CAAC,CAAnC,CAAb;AACA,SAAOH,IAAI,KAAK,KAAhB;AACH,CAHD;;AAKA,MAAMO,KAAK,GAAIR,MAAD,IAAqD;AAC/D,QAAMC,IAAI,GAAG,GAAGC,QAAH,CAAYC,IAAZ,CAAiBH,MAAjB,EAAyBI,KAAzB,CAA+B,CAA/B,EAAkC,CAAC,CAAnC,CAAb;AACA,SAAOH,IAAI,KAAK,KAAhB;AACH,CAHD;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMQ,SAAS,GAAG,CAAIC,cAAJ,EAAuBC,KAAa,GAAG,CAAvC,KAAgD;AACrE,MAAIZ,MAAM,CAACW,cAAD,CAAV,EAA4B;AACxB,WAAQ,IAAIE,IAAJ,CAASF,cAAc,CAACG,OAAf,EAAT,CAAR;AACH;;AACD,MAAIN,KAAK,CAACG,cAAD,CAAT,EAA2B;AACvB,WAAQ,IAAII,GAAJ,CACJ,CAAC,GAAGJ,cAAJ,EAAoBK,GAApB,CAAwBC,KAAK,IAAIP,SAAS,CAACO,KAAD,CAA1C,CADI,CAAR;AAGH;;AACD,MAAIR,KAAK,CAACE,cAAD,CAAT,EAA2B;AACvB,WAAQ,IAAIO,GAAJ,CACJ,CAAC,GAAGP,cAAJ,EAAoBK,GAApB,CAAwBG,EAAE,IAAI,CAACT,SAAS,CAACS,EAAE,CAAC,CAAD,CAAH,CAAV,EAAmBT,SAAS,CAACS,EAAE,CAAC,CAAD,CAAH,CAA5B,CAA9B,CADI,CAAR;AAGH;;AACD,MAAIb,OAAO,CAACK,cAAD,CAAX,EAA6B;AACzB,QAAIC,KAAK,IAAI,CAAb,EAAgB;AACZ;AACA,aAAOD,cAAP;AACH;;AACD,UAAMS,MAAiB,GAAG,EAA1B,CALyB,CAMzB;;AACA,SAAK,MAAMC,GAAX,IAAkBV,cAAlB,EAAkC;AAC9B;AACAS,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAcX,SAAS,CAACC,cAAc,CAACU,GAAD,CAAf,EAAsBT,KAAK,GAAG,CAA9B,CAAvB;AACH;;AAED,WAAQQ,MAAR;AACH;;AACD,MAAIb,QAAQ,CAACI,cAAD,CAAZ,EAA8B;AAC1B,QAAIC,KAAK,IAAI,CAAb,EAAgB;AACZ;AACA,aAAOD,cAAP;AACH;;AACD,UAAMS,MAA+B,GAAG,EAAxC,CAL0B,CAM1B;;AACA,SAAK,MAAMC,GAAX,IAAkBV,cAAlB,EAAkC;AAC9B;AACAS,MAAAA,MAAM,CAACC,GAAD,CAAN,GAAcX,SAAS,CAACC,cAAc,CAACU,GAAD,CAAf,EAAsBT,KAAK,GAAG,CAA9B,CAAvB;AACH;;AAED,WAAQQ,MAAR;AACH,GAzCoE,CA2CrE;;;AACA,SAAOT,cAAP;AACH,CA7CM","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nconst isDate = (object: unknown): object is Date => {\n const type = {}.toString.call(object).slice(8, -1);\n return type === 'Date';\n};\n\nconst isArray = (object: unknown): object is unknown[] => {\n const type = {}.toString.call(object).slice(8, -1);\n return type === 'Array';\n};\n\nconst isObject = (object: unknown): object is Record<string, unknown> => {\n const type = {}.toString.call(object).slice(8, -1);\n return type === 'Object';\n};\n\nconst isSet = (object: unknown): object is Set<unknown> => {\n const type = {}.toString.call(object).slice(8, -1);\n return type === 'Set';\n};\n\nconst isMap = (object: unknown): object is Map<string, unknown> => {\n const type = {}.toString.call(object).slice(8, -1);\n return type === 'Map';\n};\n\n/**\n * Simple deep clone inspired from https://github.com/angus-c/just/blob/master/packages/collection-clone/index.cjs\n * Functions and RegExp will be returned as they are.\n * Maps and Sets are cloned even though they won't be accepted by React Native, just in case they are mutated by the user to avoid side effects.\n *\n * We added support for circular references by limiting the number of depth levels to 8.\n * @param originalObject\n * @returns\n */\nexport const deepClone = <T>(originalObject: T, depth: number = 0): T => {\n if (isDate(originalObject)) {\n return (new Date(originalObject.getTime()) as unknown) as T;\n }\n if (isSet(originalObject)) {\n return (new Set(\n [...originalObject].map(value => deepClone(value))\n ) as unknown) as T;\n }\n if (isMap(originalObject)) {\n return (new Map(\n [...originalObject].map(kv => [deepClone(kv[0]), deepClone(kv[1])])\n ) as unknown) as T;\n }\n if (isArray(originalObject)) {\n if (depth >= 7) {\n // Break the circular reference here\n return originalObject;\n }\n const result: unknown[] = [];\n // eslint-disable-next-line guard-for-in\n for (const key in originalObject) {\n // include prototype properties\n result[key] = deepClone(originalObject[key], depth + 1);\n }\n\n return (result as unknown) as T;\n }\n if (isObject(originalObject)) {\n if (depth >= 7) {\n // Break the circular reference here\n return originalObject;\n }\n const result: Record<string, unknown> = {};\n // eslint-disable-next-line guard-for-in\n for (const key in originalObject) {\n // include prototype properties\n result[key] = deepClone(originalObject[key], depth + 1);\n }\n\n return (result as unknown) as T;\n }\n\n // primitives and non-supported objects (e.g. functions) land here\n return originalObject;\n};\n"]}
@@ -0,0 +1,34 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ /*
4
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
5
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
6
+ * Copyright 2016-Present Datadog, Inc.
7
+ */
8
+ class UserInfoProvider {
9
+ constructor() {
10
+ _defineProperty(this, "userInfo", {});
11
+
12
+ _defineProperty(this, "setUserInfo", userInfo => {
13
+ this.userInfo = userInfo;
14
+ });
15
+
16
+ _defineProperty(this, "getUserInfo", () => {
17
+ return this.userInfo;
18
+ });
19
+ }
20
+
21
+ }
22
+
23
+ export class UserInfoSingleton {}
24
+
25
+ _defineProperty(UserInfoSingleton, "userInfoProvider", new UserInfoProvider());
26
+
27
+ _defineProperty(UserInfoSingleton, "getInstance", () => {
28
+ return UserInfoSingleton.userInfoProvider;
29
+ });
30
+
31
+ _defineProperty(UserInfoSingleton, "reset", () => {
32
+ UserInfoSingleton.userInfoProvider = new UserInfoProvider();
33
+ });
34
+ //# sourceMappingURL=UserInfoSingleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["UserInfoSingleton.ts"],"names":["UserInfoProvider","userInfo","UserInfoSingleton","userInfoProvider"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,MAAMA,gBAAN,CAAuB;AAAA;AAAA,sCACU,EADV;;AAAA,yCAGJC,QAAD,IAAwB;AAClC,WAAKA,QAAL,GAAgBA,QAAhB;AACH,KALkB;;AAAA,yCAOL,MAAgB;AAC1B,aAAO,KAAKA,QAAZ;AACH,KATkB;AAAA;;AAAA;;AAYvB,OAAO,MAAMC,iBAAN,CAAwB;;gBAAlBA,iB,sBACyB,IAAIF,gBAAJ,E;;gBADzBE,iB,iBAGY,MAAwB;AACzC,SAAOA,iBAAiB,CAACC,gBAAzB;AACH,C;;gBALQD,iB,WAOM,MAAM;AACjBA,EAAAA,iBAAiB,CAACC,gBAAlB,GAAqC,IAAIH,gBAAJ,EAArC;AACH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { UserInfo } from './types';\n\nclass UserInfoProvider {\n private userInfo: UserInfo = {};\n\n setUserInfo = (userInfo: UserInfo) => {\n this.userInfo = userInfo;\n };\n\n getUserInfo = (): UserInfo => {\n return this.userInfo;\n };\n}\n\nexport class UserInfoSingleton {\n private static userInfoProvider = new UserInfoProvider();\n\n static getInstance = (): UserInfoProvider => {\n return UserInfoSingleton.userInfoProvider;\n };\n\n static reset = () => {\n UserInfoSingleton.userInfoProvider = new UserInfoProvider();\n };\n}\n"]}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -28,27 +28,4 @@ export class DdSdkConfiguration {
28
28
  /**
29
29
  * The entry point to initialize Datadog's features.
30
30
  */
31
-
32
- /**
33
- * Describe the type of a RUM Action.
34
- */
35
- export let RumActionType;
36
-
37
- (function (RumActionType) {
38
- RumActionType["TAP"] = "TAP";
39
- RumActionType["SCROLL"] = "SCROLL";
40
- RumActionType["SWIPE"] = "SWIPE";
41
- RumActionType["BACK"] = "BACK";
42
- RumActionType["CUSTOM"] = "CUSTOM";
43
- })(RumActionType || (RumActionType = {}));
44
-
45
- export let ErrorSource;
46
-
47
- (function (ErrorSource) {
48
- ErrorSource["NETWORK"] = "NETWORK";
49
- ErrorSource["SOURCE"] = "SOURCE";
50
- ErrorSource["CONSOLE"] = "CONSOLE";
51
- ErrorSource["WEBVIEW"] = "WEBVIEW";
52
- ErrorSource["CUSTOM"] = "CUSTOM";
53
- })(ErrorSource || (ErrorSource = {}));
54
31
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry","RumActionType","ErrorSource"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA;;AAqOA;AACA;AACA;AACA,WAAYC,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a;;AA0BZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
1
+ {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '1.2.1';
2
+ export const version = '1.3.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.2.1';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.3.1';\n"]}
@@ -1,6 +1,8 @@
1
1
  import { DdSdkReactNativeConfiguration } from './DdSdkReactNativeConfiguration';
2
2
  import type { DatadogProviderConfiguration, PartialInitializationConfiguration, AutoInstrumentationConfiguration } from './DdSdkReactNativeConfiguration';
3
3
  import type { TrackingConsent } from './TrackingConsent';
4
+ import type { Attributes } from './sdk/AttributesSingleton/types';
5
+ import type { UserInfo } from './sdk/UserInfoSingleton/types';
4
6
  /**
5
7
  * This class initializes the Datadog SDK, and sets up communication with the server.
6
8
  */
@@ -10,6 +12,7 @@ export declare class DdSdkReactNative {
10
12
  private static readonly DD_SERVICE_NAME;
11
13
  private static readonly DD_SDK_VERBOSITY_KEY;
12
14
  private static readonly DD_NATIVE_VIEW_TRACKING_KEY;
15
+ private static readonly DD_NATIVE_INTERACTION_TRACKING_KEY;
13
16
  private static readonly DD_VERSION;
14
17
  private static readonly DD_VERSION_SUFFIX;
15
18
  private static readonly DD_PROXY_TYPE_KEY;
@@ -40,17 +43,18 @@ export declare class DdSdkReactNative {
40
43
  */
41
44
  static _initializeFromDatadogProviderWithConfigurationAsync: (configuration: PartialInitializationConfiguration) => Promise<void>;
42
45
  /**
43
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
46
+ * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.
47
+ * To remove an attribute, set it to `undefined` in a call to `setAttributes`.
44
48
  * @param attributes: The global context attributes.
45
49
  * @returns a Promise.
46
50
  */
47
- static setAttributes(attributes: object): Promise<void>;
51
+ static setAttributes(attributes: Attributes): Promise<void>;
48
52
  /**
49
53
  * Set the user information.
50
54
  * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
51
55
  * @returns a Promise.
52
56
  */
53
- static setUser(user: object): Promise<void>;
57
+ static setUser(user: UserInfo): Promise<void>;
54
58
  /**
55
59
  * Set the tracking consent regarding the data collection.
56
60
  * @param trackingConsent: One of TrackingConsent values.
@@ -1,6 +1,10 @@
1
1
  import type { ProxyConfiguration } from './ProxyConfiguration';
2
2
  import type { SdkVerbosity } from './SdkVerbosity';
3
3
  import { TrackingConsent } from './TrackingConsent';
4
+ import type { LogEventMapper } from './logs/types';
5
+ import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';
6
+ import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';
7
+ import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';
4
8
  export declare enum VitalsUpdateFrequency {
5
9
  FREQUENT = "FREQUENT",
6
10
  AVERAGE = "AVERAGE",
@@ -46,6 +50,11 @@ export declare class DdSdkReactNativeConfiguration {
46
50
  * Set to `true` if you use a custom navigation system relying on native views.
47
51
  */
48
52
  nativeViewTracking: boolean;
53
+ /**
54
+ * Enables native interaction tracking.
55
+ * Set to `true` if you want to track interactions on native screens.
56
+ */
57
+ nativeInteractionTracking: boolean;
49
58
  proxyConfig?: ProxyConfiguration;
50
59
  serviceName?: string;
51
60
  /**
@@ -109,6 +118,10 @@ export declare class DdSdkReactNativeConfiguration {
109
118
  * Sets the preferred frequency for collecting mobile vitals.
110
119
  */
111
120
  vitalsUpdateFrequency: VitalsUpdateFrequency;
121
+ logEventMapper: LogEventMapper | null;
122
+ errorEventMapper: ErrorEventMapper | null;
123
+ resourceEventMapper: ResourceEventMapper | null;
124
+ actionEventMapper: ActionEventMapper | null;
112
125
  additionalConfig: {
113
126
  [k: string]: any;
114
127
  };
@@ -124,6 +137,10 @@ export declare type AutoInstrumentationConfiguration = {
124
137
  readonly firstPartyHosts?: string[];
125
138
  readonly resourceTracingSamplingRate?: number;
126
139
  readonly trackErrors: boolean;
140
+ readonly logEventMapper?: LogEventMapper | null;
141
+ readonly errorEventMapper?: ErrorEventMapper | null;
142
+ readonly resourceEventMapper?: ResourceEventMapper | null;
143
+ readonly actionEventMapper?: ActionEventMapper | null;
127
144
  };
128
145
  /**
129
146
  * Parameters needed to start auto instrumentation. Includes default values.
@@ -134,6 +151,10 @@ export declare type AutoInstrumentationParameters = {
134
151
  readonly firstPartyHosts: string[];
135
152
  readonly resourceTracingSamplingRate: number;
136
153
  readonly trackErrors: boolean;
154
+ readonly logEventMapper: LogEventMapper | null;
155
+ readonly errorEventMapper: ErrorEventMapper | null;
156
+ readonly resourceEventMapper: ResourceEventMapper | null;
157
+ readonly actionEventMapper: ActionEventMapper | null;
137
158
  };
138
159
  /**
139
160
  * We could use `Proxy` instead of this function, but `Proxy` is not available on
@@ -148,6 +169,7 @@ export declare type PartialInitializationConfiguration = {
148
169
  readonly site?: string;
149
170
  readonly verbosity?: SdkVerbosity | undefined;
150
171
  readonly nativeViewTracking?: boolean;
172
+ readonly nativeInteractionTracking?: boolean;
151
173
  readonly proxyConfig?: ProxyConfiguration;
152
174
  readonly serviceName?: string;
153
175
  readonly version?: string;
@@ -1,7 +1,5 @@
1
- import { DdSdkConfiguration, DdLogsType, DdTraceType, DdRumType } from './types';
1
+ import { DdSdkConfiguration, DdTraceType } from './types';
2
2
  import type { DdNativeSdkType } from './nativeModulesTypes';
3
3
  declare const DdSdk: DdNativeSdkType;
4
- declare const DdLogs: DdLogsType;
5
4
  declare const DdTrace: DdTraceType;
6
- declare const DdRum: DdRumType;
7
- export { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };
5
+ export { DdSdkConfiguration, DdSdk, DdTrace };
@@ -1,10 +1,12 @@
1
- import { DatadogProvider } from './DatadogProvider/DatadogProvider';
2
1
  import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode } from './DdSdkReactNativeConfiguration';
3
2
  import { DdSdkReactNative } from './DdSdkReactNative';
4
3
  import { InternalLog } from './InternalLog';
5
4
  import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
6
5
  import { SdkVerbosity } from './SdkVerbosity';
7
6
  import { TrackingConsent } from './TrackingConsent';
8
- import { DdLogs, DdTrace, DdRum } from './foundation';
9
- import { RumActionType, ErrorSource } from './types';
7
+ import { DdTrace } from './foundation';
8
+ import { DdLogs } from './logs/DdLogs';
9
+ import { DdRum } from './rum/DdRum';
10
+ import { RumActionType, ErrorSource } from './rum/types';
11
+ import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
10
12
  export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };
@@ -0,0 +1,14 @@
1
+ import type { DdLogsType, LogEventMapper } from './types';
2
+ declare class DdLogsWrapper implements DdLogsType {
3
+ private nativeLogs;
4
+ private logEventMapper;
5
+ debug(message: string, context?: object): Promise<void>;
6
+ info(message: string, context?: object): Promise<void>;
7
+ warn(message: string, context?: object): Promise<void>;
8
+ error(message: string, context?: object): Promise<void>;
9
+ private log;
10
+ registerLogEventMapper(logEventMapper: LogEventMapper): void;
11
+ unregisterLogEventMapper(): void;
12
+ }
13
+ export declare const DdLogs: DdLogsWrapper;
14
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Attributes } from '../sdk/AttributesSingleton/types';
2
+ import { EventMapper } from '../sdk/EventMappers/EventMapper';
3
+ import type { UserInfo } from '../sdk/UserInfoSingleton/types';
4
+ import type { LogEvent, LogEventMapper, NativeLog, RawLog } from './types';
5
+ export declare const formatLogEventToNativeLog: (logEvent: LogEvent) => NativeLog;
6
+ export declare const formatRawLogToNativeEvent: (rawLog: RawLog) => NativeLog;
7
+ export declare const formatRawLogToLogEvent: (rawLog: RawLog, additionalInformation: {
8
+ userInfo: UserInfo;
9
+ attributes: Attributes;
10
+ }) => LogEvent;
11
+ export declare const generateEventMapper: (logEventMapper: LogEventMapper | undefined) => EventMapper<RawLog, LogEvent, NativeLog>;
@@ -0,0 +1,54 @@
1
+ import type { UserInfo } from '../sdk/UserInfoSingleton/types';
2
+ /**
3
+ * The entry point to use Datadog's Logs feature.
4
+ */
5
+ export declare type DdLogsType = {
6
+ /**
7
+ * Send a log with level debug.
8
+ * @param message: The message to send.
9
+ * @param context: The additional context to send.
10
+ */
11
+ debug(message: string, context?: object): Promise<void>;
12
+ /**
13
+ * Send a log with level info.
14
+ * @param message: The message to send.
15
+ * @param context: The additional context to send.
16
+ */
17
+ info(message: string, context?: object): Promise<void>;
18
+ /**
19
+ * Send a log with level warn.
20
+ * @param message: The message to send.
21
+ * @param context: The additional context to send.
22
+ */
23
+ warn(message: string, context?: object): Promise<void>;
24
+ /**
25
+ * Send a log with level error.
26
+ * @param message: The message to send.
27
+ * @param context: The additional context to send.
28
+ */
29
+ error(message: string, context?: object): Promise<void>;
30
+ };
31
+ /**
32
+ * Log input from developers
33
+ */
34
+ export declare type RawLog = {
35
+ message: string;
36
+ context: object;
37
+ status: LogStatus;
38
+ };
39
+ /**
40
+ * Log input for native SDKs
41
+ */
42
+ export declare type NativeLog = {
43
+ message: string;
44
+ context: object;
45
+ };
46
+ export declare type LogStatus = 'debug' | 'info' | 'warn' | 'error';
47
+ export declare type LogEvent = {
48
+ message: string;
49
+ context: object;
50
+ readonly status: LogStatus;
51
+ readonly userInfo: UserInfo;
52
+ readonly attributes?: object;
53
+ };
54
+ export declare type LogEventMapper = (logEvent: LogEvent) => LogEvent | null;
@@ -30,7 +30,7 @@ export declare type DdNativeSdkType = {
30
30
  * Set the user information.
31
31
  * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
32
32
  */
33
- setUser(user: object): Promise<void>;
33
+ setUser(user: object): Promise<object>;
34
34
  /**
35
35
  * Set the tracking consent regarding the data collection.
36
36
  * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
@@ -0,0 +1,36 @@
1
+ import type { GestureResponderEvent } from 'react-native';
2
+ import type { ActionEventMapper } from './eventMappers/actionEventMapper';
3
+ import type { ErrorEventMapper } from './eventMappers/errorEventMapper';
4
+ import type { ResourceEventMapper } from './eventMappers/resourceEventMapper';
5
+ import type { DdRumType, RumActionType, ResourceKind, ErrorSource } from './types';
6
+ declare class DdRumWrapper implements DdRumType {
7
+ private nativeRum;
8
+ private lastActionData?;
9
+ private errorEventMapper;
10
+ private resourceEventMapper;
11
+ private actionEventMapper;
12
+ startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
13
+ stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
14
+ startAction(type: RumActionType, name: string, context?: object, timestampMs?: number): Promise<void>;
15
+ stopAction(...args: [
16
+ type: RumActionType,
17
+ name: string,
18
+ context?: object,
19
+ timestampMs?: number
20
+ ] | [context?: object, timestampMs?: number]): Promise<void>;
21
+ private callNativeStopAction;
22
+ private getStopActionNativeCallArgs;
23
+ addAction(type: RumActionType, name: string, context?: object, timestampMs?: number, actionContext?: GestureResponderEvent): Promise<void>;
24
+ startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
25
+ stopResource(key: string, statusCode: number, kind: ResourceKind, size?: number, context?: object, timestampMs?: number, resourceContext?: XMLHttpRequest): Promise<void>;
26
+ addError(message: string, source: ErrorSource, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
27
+ addTiming(name: string): Promise<void>;
28
+ registerErrorEventMapper(errorEventMapper: ErrorEventMapper): void;
29
+ unregisterErrorEventMapper(): void;
30
+ registerResourceEventMapper(resourceEventMapper: ResourceEventMapper): void;
31
+ unregisterResourceEventMapper(): void;
32
+ registerActionEventMapper(actionEventMapper: ActionEventMapper): void;
33
+ unregisterActionEventMapper(): void;
34
+ }
35
+ export declare const DdRum: DdRumWrapper;
36
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { GestureResponderEvent } from 'react-native';
2
+ import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
3
+ import { EventMapper } from '../../sdk/EventMappers/EventMapper';
4
+ import type { RumActionType } from '../types';
5
+ declare type RawAction = {
6
+ readonly type: RumActionType;
7
+ readonly name: string;
8
+ context: object;
9
+ readonly timestampMs: number;
10
+ actionContext?: GestureResponderEvent;
11
+ };
12
+ declare type ActionEvent = RawAction & AdditionalEventDataForMapper;
13
+ declare type NativeAction = {
14
+ type: RumActionType;
15
+ name: string;
16
+ context: object;
17
+ timestampMs: number;
18
+ };
19
+ export declare type ActionEventMapper = (event: ActionEvent) => ActionEvent | null;
20
+ export declare const generateActionEventMapper: (eventMapper: ActionEventMapper | undefined) => EventMapper<RawAction, ActionEvent, NativeAction>;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
2
+ import { EventMapper } from '../../sdk/EventMappers/EventMapper';
3
+ import type { ErrorSource } from '../types';
4
+ declare type RawError = {
5
+ message: string;
6
+ source: ErrorSource;
7
+ stacktrace: string;
8
+ context?: object;
9
+ timestampMs?: number;
10
+ };
11
+ declare type ErrorEvent = RawError & AdditionalEventDataForMapper;
12
+ declare type NativeError = {
13
+ message: string;
14
+ source: ErrorSource;
15
+ stacktrace: string;
16
+ context?: object;
17
+ timestampMs?: number;
18
+ };
19
+ export declare type ErrorEventMapper = (event: ErrorEvent) => ErrorEvent | null;
20
+ export declare const generateErrorEventMapper: (eventMapper: ErrorEventMapper | undefined) => EventMapper<RawError, ErrorEvent, NativeError>;
21
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { AdditionalEventDataForMapper } from '../../sdk/EventMappers/EventMapper';
2
+ import { EventMapper } from '../../sdk/EventMappers/EventMapper';
3
+ import type { ResourceKind } from '../types';
4
+ declare type RawResource = {
5
+ readonly key: string;
6
+ readonly statusCode: number;
7
+ readonly kind: ResourceKind;
8
+ readonly size: number;
9
+ context: object;
10
+ readonly timestampMs: number;
11
+ resourceContext: XMLHttpRequest | undefined;
12
+ };
13
+ declare type ResourceEvent = RawResource & AdditionalEventDataForMapper;
14
+ declare type NativeResource = {
15
+ key: string;
16
+ statusCode: number;
17
+ kind: ResourceKind;
18
+ size: number;
19
+ context: object;
20
+ timestampMs: number;
21
+ };
22
+ export declare type ResourceEventMapper = (event: ResourceEvent) => ResourceEvent | null;
23
+ export declare const generateResourceEventMapper: (eventMapper: ResourceEventMapper | undefined) => EventMapper<RawResource, ResourceEvent, NativeResource>;
24
+ export {};
@@ -7,6 +7,7 @@ export declare class DdRumUserInteractionTracking {
7
7
  private static eventsInterceptor;
8
8
  private static originalCreateElement;
9
9
  private static originalMemo;
10
+ private static originalJsx;
10
11
  private static patchCreateElementFunction;
11
12
  /**
12
13
  * Starts tracking user interactions and sends a RUM Action event every time a new interaction was detected.
@@ -1,4 +1,4 @@
1
- import type { ResourceKind } from '../../../../../../src/types';
1
+ import type { ResourceKind } from '../../../../types';
2
2
  import type { DdRumResourceTracingAttributes } from '../distributedTracing';
3
3
  export interface RUMResource {
4
4
  key: string;
@@ -17,4 +17,5 @@ export interface RUMResource {
17
17
  stopTime: number;
18
18
  responseStartTime?: number;
19
19
  };
20
+ resourceContext?: XMLHttpRequest;
20
21
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react-native" />
2
1
  import type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';
3
2
  import { RequestProxy } from '../domain/interfaces/RequestProxy';
4
3
  import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
@@ -1,3 +1,2 @@
1
- /// <reference types="react-native" />
2
1
  export declare const RESOURCE_SIZE_ERROR_MESSAGE = "Couldn't get resource size, because an error occured: ";
3
2
  export declare function calculateResponseSize(xhr: XMLHttpRequest): number;