@datadog/mobile-react-native 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +31 -1
  2. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +222 -0
  3. package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +6 -0
  4. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +106 -0
  5. package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +2 -0
  6. package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +116 -0
  7. package/ios/Sources/Attributes.swift +14 -0
  8. package/ios/Sources/DdSdk.swift +18 -0
  9. package/lib/commonjs/DdSdkReactNative.js +40 -8
  10. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  11. package/lib/commonjs/DdSdkReactNativeConfiguration.js +42 -2
  12. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  13. package/lib/commonjs/foundation.js +2 -139
  14. package/lib/commonjs/foundation.js.map +1 -1
  15. package/lib/commonjs/index.js +18 -14
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/logs/DdLogs.js +71 -0
  18. package/lib/commonjs/logs/DdLogs.js.map +1 -0
  19. package/lib/commonjs/logs/eventMapper.js +39 -0
  20. package/lib/commonjs/logs/eventMapper.js.map +1 -0
  21. package/lib/commonjs/logs/types.js +2 -0
  22. package/lib/commonjs/{rum/instrumentation/EventsInterceptor.js.map → logs/types.js.map} +0 -0
  23. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  24. package/lib/commonjs/rum/DdRum.js +234 -0
  25. package/lib/commonjs/rum/DdRum.js.map +1 -0
  26. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +36 -0
  27. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -0
  28. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +32 -0
  29. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -0
  30. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +38 -0
  31. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -0
  32. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -4
  33. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  34. package/lib/commonjs/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  35. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  36. package/lib/commonjs/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +4 -4
  37. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  38. package/lib/commonjs/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  39. package/lib/{module/rum/instrumentation → commonjs/rum/instrumentation/interactionTracking}/EventsInterceptor.js.map +0 -0
  40. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  41. package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  42. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  43. package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  44. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  45. package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  46. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
  47. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  48. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  49. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  50. package/lib/commonjs/rum/types.js +42 -0
  51. package/lib/commonjs/rum/types.js.map +1 -0
  52. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +45 -0
  53. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  54. package/lib/commonjs/sdk/AttributesSingleton/types.js +2 -0
  55. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -0
  56. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  57. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  58. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  59. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  60. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  61. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  62. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  63. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  64. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  65. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  66. package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  67. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  68. package/lib/commonjs/sdk/EventMappers/EventMapper.js +85 -0
  69. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -0
  70. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +98 -0
  71. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -0
  72. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +43 -0
  73. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  74. package/lib/commonjs/sdk/UserInfoSingleton/types.js +2 -0
  75. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -0
  76. package/lib/commonjs/types.js +1 -26
  77. package/lib/commonjs/types.js.map +1 -1
  78. package/lib/commonjs/version.js +1 -1
  79. package/lib/commonjs/version.js.map +1 -1
  80. package/lib/module/DdSdkReactNative.js +33 -7
  81. package/lib/module/DdSdkReactNative.js.map +1 -1
  82. package/lib/module/DdSdkReactNativeConfiguration.js +42 -2
  83. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  84. package/lib/module/foundation.js +2 -124
  85. package/lib/module/foundation.js.map +1 -1
  86. package/lib/module/index.js +5 -3
  87. package/lib/module/index.js.map +1 -1
  88. package/lib/module/logs/DdLogs.js +64 -0
  89. package/lib/module/logs/DdLogs.js.map +1 -0
  90. package/lib/module/logs/eventMapper.js +20 -0
  91. package/lib/module/logs/eventMapper.js.map +1 -0
  92. package/lib/module/logs/types.js +2 -0
  93. package/lib/module/logs/types.js.map +1 -0
  94. package/lib/module/nativeModulesTypes.js.map +1 -1
  95. package/lib/module/rum/DdRum.js +212 -0
  96. package/lib/module/rum/DdRum.js.map +1 -0
  97. package/lib/module/rum/eventMappers/actionEventMapper.js +26 -0
  98. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -0
  99. package/lib/module/rum/eventMappers/errorEventMapper.js +22 -0
  100. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -0
  101. package/lib/module/rum/eventMappers/resourceEventMapper.js +28 -0
  102. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -0
  103. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +2 -2
  104. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  105. package/lib/module/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
  106. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
  107. package/lib/module/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +4 -4
  108. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
  109. package/lib/module/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
  110. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -0
  111. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
  112. package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
  113. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
  114. package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
  115. package/lib/module/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
  116. package/lib/module/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
  117. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -2
  118. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  119. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
  120. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
  121. package/lib/module/rum/types.js +33 -0
  122. package/lib/module/rum/types.js.map +1 -0
  123. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +36 -0
  124. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
  125. package/lib/module/sdk/AttributesSingleton/types.js +2 -0
  126. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -0
  127. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
  128. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
  129. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
  130. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
  131. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
  132. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
  133. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
  134. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
  135. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
  136. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
  137. package/lib/module/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
  138. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
  139. package/lib/module/sdk/EventMappers/EventMapper.js +72 -0
  140. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -0
  141. package/lib/module/sdk/EventMappers/utils/deepClone.js +89 -0
  142. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -0
  143. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +34 -0
  144. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
  145. package/lib/module/sdk/UserInfoSingleton/types.js +2 -0
  146. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -0
  147. package/lib/module/types.js +0 -23
  148. package/lib/module/types.js.map +1 -1
  149. package/lib/module/version.js +1 -1
  150. package/lib/module/version.js.map +1 -1
  151. package/lib/typescript/DdSdkReactNative.d.ts +7 -3
  152. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +22 -0
  153. package/lib/typescript/foundation.d.ts +2 -4
  154. package/lib/typescript/index.d.ts +5 -3
  155. package/lib/typescript/logs/DdLogs.d.ts +14 -0
  156. package/lib/typescript/logs/eventMapper.d.ts +11 -0
  157. package/lib/typescript/logs/types.d.ts +54 -0
  158. package/lib/typescript/nativeModulesTypes.d.ts +1 -1
  159. package/lib/typescript/rum/DdRum.d.ts +36 -0
  160. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +21 -0
  161. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +21 -0
  162. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +25 -0
  163. package/lib/typescript/rum/instrumentation/{DdEventsInterceptor.d.ts → interactionTracking/DdEventsInterceptor.d.ts} +0 -0
  164. package/lib/typescript/rum/instrumentation/{DdRumUserInteractionTracking.d.ts → interactionTracking/DdRumUserInteractionTracking.d.ts} +0 -0
  165. package/lib/typescript/rum/instrumentation/{EventsInterceptor.d.ts → interactionTracking/EventsInterceptor.d.ts} +0 -0
  166. package/lib/typescript/rum/instrumentation/{NoOpEventsInterceptor.d.ts → interactionTracking/NoOpEventsInterceptor.d.ts} +0 -0
  167. package/lib/typescript/rum/instrumentation/{ShallowObjectEqualityChecker.d.ts → interactionTracking/ShallowObjectEqualityChecker.d.ts} +0 -0
  168. package/lib/typescript/rum/instrumentation/{getJsxRuntime.d.ts → interactionTracking/getJsxRuntime.d.ts} +0 -0
  169. package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +3 -1
  170. package/lib/typescript/rum/types.d.ts +110 -0
  171. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
  172. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +3 -0
  173. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.d.ts +0 -0
  174. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.d.ts +0 -0
  175. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.d.ts +0 -0
  176. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.d.ts +0 -0
  177. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.d.ts +0 -0
  178. package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.d.ts +2 -2
  179. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +24 -0
  180. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +10 -0
  181. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
  182. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +6 -0
  183. package/lib/typescript/types.d.ts +0 -139
  184. package/lib/typescript/version.d.ts +1 -1
  185. package/package.json +2 -2
  186. package/scripts/replace-react-require.js +3 -2
  187. package/src/DdSdkReactNative.tsx +41 -7
  188. package/src/DdSdkReactNativeConfiguration.tsx +83 -3
  189. package/src/__tests__/DdSdkReactNative.test.tsx +244 -13
  190. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +22 -1
  191. package/src/__tests__/{longTasksUtils.ts → longTasksUtils.test.ts} +0 -0
  192. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +4 -3
  193. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +1 -1
  194. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +5 -3
  195. package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +1 -1
  196. package/src/foundation.tsx +4 -114
  197. package/src/index.tsx +5 -3
  198. package/src/logs/DdLogs.ts +67 -0
  199. package/src/logs/__tests__/DdLogs.test.ts +51 -0
  200. package/src/logs/__tests__/eventMapper.test.ts +53 -0
  201. package/src/logs/eventMapper.ts +43 -0
  202. package/src/logs/types.ts +70 -0
  203. package/src/nativeModulesTypes.ts +1 -1
  204. package/src/rum/DdRum.ts +387 -0
  205. package/src/rum/__tests__/DdRum.test.ts +386 -0
  206. package/src/rum/eventMappers/actionEventMapper.ts +66 -0
  207. package/src/rum/eventMappers/errorEventMapper.ts +57 -0
  208. package/src/rum/eventMappers/resourceEventMapper.ts +74 -0
  209. package/src/rum/instrumentation/DdRumErrorTracking.tsx +2 -2
  210. package/src/rum/instrumentation/{DdEventsInterceptor.tsx → interactionTracking/DdEventsInterceptor.tsx} +14 -6
  211. package/src/rum/instrumentation/{DdRumUserInteractionTracking.tsx → interactionTracking/DdRumUserInteractionTracking.tsx} +4 -4
  212. package/src/rum/instrumentation/{EventsInterceptor.tsx → interactionTracking/EventsInterceptor.tsx} +0 -0
  213. package/src/rum/instrumentation/{NoOpEventsInterceptor.tsx → interactionTracking/NoOpEventsInterceptor.tsx} +0 -0
  214. package/src/rum/instrumentation/{ShallowObjectEqualityChecker.ts → interactionTracking/ShallowObjectEqualityChecker.ts} +0 -0
  215. package/src/rum/instrumentation/{getJsxRuntime.ts → interactionTracking/getJsxRuntime.ts} +0 -0
  216. package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +1 -1
  217. package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +2 -1
  218. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +3 -2
  219. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +1 -1
  220. package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +2 -1
  221. package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +83 -39
  222. package/src/rum/types.ts +182 -0
  223. package/src/sdk/AttributesSingleton/AttributesSingleton.ts +34 -0
  224. package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +44 -0
  225. package/src/sdk/AttributesSingleton/types.ts +9 -0
  226. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.ts +4 -4
  227. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.ts +0 -0
  228. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.ts +0 -0
  229. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.ts +0 -0
  230. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BoundedBuffer.test.ts +2 -2
  231. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BufferSingleton.test.ts +0 -0
  232. package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.ts +0 -0
  233. package/src/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.tsx +5 -5
  234. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/__utils__/renderWithProvider.tsx +2 -2
  235. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initialization.test.tsx +8 -6
  236. package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initializationModes.test.tsx +5 -5
  237. package/src/sdk/EventMappers/EventMapper.ts +94 -0
  238. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +50 -0
  239. package/src/sdk/EventMappers/utils/__tests__/deepClone.test.ts +79 -0
  240. package/src/sdk/EventMappers/utils/deepClone.ts +86 -0
  241. package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +31 -0
  242. package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +29 -0
  243. package/src/sdk/UserInfoSingleton/types.ts +12 -0
  244. package/src/types.tsx +0 -210
  245. package/src/version.ts +1 -1
  246. package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  247. package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +0 -1
  248. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  249. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  250. package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
  251. package/lib/module/DatadogProvider/DatadogProvider.js.map +0 -1
  252. package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
  253. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
  254. package/src/__tests__/DdRumWrapper.test.tsx +0 -74
  255. package/src/__tests__/foundation.test.ts +0 -88
@@ -7,8 +7,6 @@ exports.DdSdkReactNative = void 0;
7
7
 
8
8
  var _reactNative = require("react-native");
9
9
 
10
- var _BufferSingleton = require("./DatadogProvider/Buffer/BufferSingleton");
11
-
12
10
  var _DdSdkReactNativeConfiguration = require("./DdSdkReactNativeConfiguration");
13
11
 
14
12
  var _InternalLog = require("./InternalLog");
@@ -19,14 +17,24 @@ var _SdkVerbosity = require("./SdkVerbosity");
19
17
 
20
18
  var _foundation = require("./foundation");
21
19
 
20
+ var _DdLogs = require("./logs/DdLogs");
21
+
22
22
  var _longTasksUtils = require("./longTasksUtils");
23
23
 
24
+ var _DdRum = require("./rum/DdRum");
25
+
24
26
  var _DdRumErrorTracking = require("./rum/instrumentation/DdRumErrorTracking");
25
27
 
26
- var _DdRumUserInteractionTracking = require("./rum/instrumentation/DdRumUserInteractionTracking");
28
+ var _DdRumUserInteractionTracking = require("./rum/instrumentation/interactionTracking/DdRumUserInteractionTracking");
27
29
 
28
30
  var _DdRumResourceTracking = require("./rum/instrumentation/resourceTracking/DdRumResourceTracking");
29
31
 
32
+ var _AttributesSingleton = require("./sdk/AttributesSingleton/AttributesSingleton");
33
+
34
+ var _BufferSingleton = require("./sdk/DatadogProvider/Buffer/BufferSingleton");
35
+
36
+ var _UserInfoSingleton = require("./sdk/UserInfoSingleton/UserInfoSingleton");
37
+
30
38
  var _types = require("./types");
31
39
 
32
40
  var _version = require("./version");
@@ -93,15 +101,18 @@ class DdSdkReactNative {
93
101
 
94
102
 
95
103
  /**
96
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
104
+ * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.
105
+ * To remove an attribute, set it to `undefined` in a call to `setAttributes`.
97
106
  * @param attributes: The global context attributes.
98
107
  * @returns a Promise.
99
108
  */
100
109
  // eslint-disable-next-line @typescript-eslint/ban-types
101
- static setAttributes(attributes) {
110
+ static async setAttributes(attributes) {
102
111
  _InternalLog.InternalLog.log(`Setting attributes ${JSON.stringify(attributes)}`, _SdkVerbosity.SdkVerbosity.DEBUG);
103
112
 
104
- return _foundation.DdSdk.setAttributes(attributes);
113
+ await _foundation.DdSdk.setAttributes(attributes);
114
+
115
+ _AttributesSingleton.AttributesSingleton.getInstance().setAttributes(attributes);
105
116
  }
106
117
  /**
107
118
  * Set the user information.
@@ -111,10 +122,12 @@ class DdSdkReactNative {
111
122
  // eslint-disable-next-line @typescript-eslint/ban-types
112
123
 
113
124
 
114
- static setUser(user) {
125
+ static async setUser(user) {
115
126
  _InternalLog.InternalLog.log(`Setting user ${JSON.stringify(user)}`, _SdkVerbosity.SdkVerbosity.DEBUG);
116
127
 
117
- return _foundation.DdSdk.setUser(user);
128
+ await _foundation.DdSdk.setUser(user);
129
+
130
+ _UserInfoSingleton.UserInfoSingleton.getInstance().setUserInfo(user);
118
131
  }
119
132
  /**
120
133
  * Set the tracking consent regarding the data collection.
@@ -151,6 +164,22 @@ class DdSdkReactNative {
151
164
  _DdRumErrorTracking.DdRumErrorTracking.startTracking();
152
165
  }
153
166
 
167
+ if (configuration.logEventMapper) {
168
+ _DdLogs.DdLogs.registerLogEventMapper(configuration.logEventMapper);
169
+ }
170
+
171
+ if (configuration.errorEventMapper) {
172
+ _DdRum.DdRum.registerErrorEventMapper(configuration.errorEventMapper);
173
+ }
174
+
175
+ if (configuration.resourceEventMapper) {
176
+ _DdRum.DdRum.registerResourceEventMapper(configuration.resourceEventMapper);
177
+ }
178
+
179
+ if (configuration.actionEventMapper) {
180
+ _DdRum.DdRum.registerActionEventMapper(configuration.actionEventMapper);
181
+ }
182
+
154
183
  DdSdkReactNative.wasAutoInstrumented = true;
155
184
  }
156
185
 
@@ -168,6 +197,8 @@ _defineProperty(DdSdkReactNative, "DD_SDK_VERBOSITY_KEY", '_dd.sdk_verbosity');
168
197
 
169
198
  _defineProperty(DdSdkReactNative, "DD_NATIVE_VIEW_TRACKING_KEY", '_dd.native_view_tracking');
170
199
 
200
+ _defineProperty(DdSdkReactNative, "DD_NATIVE_INTERACTION_TRACKING_KEY", '_dd.native_interaction_tracking');
201
+
171
202
  _defineProperty(DdSdkReactNative, "DD_VERSION", '_dd.version');
172
203
 
173
204
  _defineProperty(DdSdkReactNative, "DD_VERSION_SUFFIX", '_dd.version_suffix');
@@ -231,6 +262,7 @@ _defineProperty(DdSdkReactNative, "buildConfiguration", configuration => {
231
262
  configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] = 'react-native';
232
263
  configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERSION] = _version.version;
233
264
  configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY] = configuration.nativeViewTracking;
265
+ configuration.additionalConfig[DdSdkReactNative.DD_NATIVE_INTERACTION_TRACKING_KEY] = configuration.nativeInteractionTracking;
234
266
 
235
267
  if (configuration.verbosity) {
236
268
  configuration.additionalConfig[DdSdkReactNative.DD_SDK_VERBOSITY_KEY] = configuration.verbosity;
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","initialize","configuration","initializeNativeSDK","initializationModeForTelemetry","enableFeatures","_initializeFromDatadogProvider","initializationMode","InitializationMode","SYNC","ASYNC","InteractionManager","runAfterInteractions","DdSdkReactNativeConfiguration","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","InternalLog","log","JSON","stringify","SdkVerbosity","DEBUG","DdSdk","setUser","user","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","DdRumUserInteractionTracking","startTracking","trackResources","DdRumResourceTracking","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","DdRumErrorTracking","params","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","initializationType","trackNetworkRequests","INFO","BufferSingleton","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","sdkVersion","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","ProxyType","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","version","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AAaA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAU1B;;AAWA;AACJ;AACA;AACA;AACA;AAC2B,eAAVC,UAAU,CACnBC,aADmB,EAEN;AACb,UAAMF,gBAAgB,CAACG,mBAAjB,CAAqCD,aAArC,EAAoD;AACtDE,MAAAA,8BAA8B,EAAE;AADsB,KAApD,CAAN;AAGAJ,IAAAA,gBAAgB,CAACK,cAAjB,CAAgCH,aAAhC;AACH;;AAsDD;AACJ;AACA;AAC+C,eAA9BI,8BAA8B,CACvCJ,aADuC,EAE1B;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BAAgB,CAACgF,iBAAlB,CAAhB,GACIL,WAAW,CAACM,IADhB;;AAEA,QAAIN,WAAW,CAACO,QAAZ,IAAwBP,WAAW,CAACQ,QAAxC,EAAkD;AAC9C,UAAIR,WAAW,CAACE,IAAZ,KAAqBO,8BAAUC,KAAnC,EAA0C;AACtCC,QAAAA,OAAO,CAACC,IAAR,CACI,iEADJ;AAGH,OAJD,MAIO;AACH1B,QAAAA,gBAAgB,CAAC7D,gBAAgB,CAACwF,qBAAlB,CAAhB,GACIb,WAAW,CAACO,QADhB;AAEArB,QAAAA,gBAAgB,CAAC7D,gBAAgB,CAACyF,qBAAlB,CAAhB,GACId,WAAW,CAACQ,QADhB;AAEH;AACJ;AACJ;;AAED,MAAIjF,aAAa,CAACwF,WAAlB,EAA+B;AAC3BxF,IAAAA,aAAa,CAAC2D,gBAAd,CAA+B7D,gBAAgB,CAAC2F,eAAhD,IACIzF,aAAa,CAACwF,WADlB;AAEH;;AAED,MAAIxF,aAAa,CAAC0F,OAAlB,EAA2B;AACvB1F,IAAAA,aAAa,CAAC2D,gBAAd,CAA+B7D,gBAAgB,CAAC6F,UAAhD,IAA+D,GAC3D3F,aAAa,CAAC0F,OACjB,GACG1F,aAAa,CAAC4F,aAAd,GACO,IAAG5F,aAAa,CAAC4F,aAAc,EADtC,GAEM,EACT,EAND;AAOH,GApDA,CAsDD;AACA;;;AACA,MAAI5F,aAAa,CAAC4F,aAAd,IAA+B,CAAC5F,aAAa,CAAC0F,OAAlD,EAA2D;AACvD1F,IAAAA,aAAa,CAAC2D,gBAAd,CACI7D,gBAAgB,CAAC+F,iBADrB,IAEK,IAAG7F,aAAa,CAAC4F,aAAc,EAFpC;AAGH;;AAED5F,EAAAA,aAAa,CAAC2D,gBAAd,CAA+B,uBAA/B,IACI3D,aAAa,CAACoC,eADlB;AAEH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InteractionManager } from 'react-native';\n\nimport { BufferSingleton } from './DatadogProvider/Buffer/BufferSingleton';\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { adaptLongTaskThreshold } from './longTasksUtils';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources\n }\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setAttributes(attributes: object): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static setUser(user: object): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n return DdSdk.setUser(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
1
+ {"version":3,"sources":["DdSdkReactNative.tsx"],"names":["DdSdkReactNative","initialize","configuration","initializeNativeSDK","initializationModeForTelemetry","enableFeatures","_initializeFromDatadogProvider","initializationMode","InitializationMode","SYNC","ASYNC","InteractionManager","runAfterInteractions","DdSdkReactNativeConfiguration","_enableFeaturesFromDatadogProvider","features","setAttributes","attributes","InternalLog","log","JSON","stringify","SdkVerbosity","DEBUG","DdSdk","AttributesSingleton","getInstance","setUser","user","UserInfoSingleton","setUserInfo","setTrackingConsent","consent","wasAutoInstrumented","WARN","trackInteractions","DdRumUserInteractionTracking","startTracking","trackResources","DdRumResourceTracking","tracingSamplingRate","resourceTracingSamplingRate","firstPartyHosts","trackErrors","DdRumErrorTracking","logEventMapper","DdLogs","registerLogEventMapper","errorEventMapper","DdRum","registerErrorEventMapper","resourceEventMapper","registerResourceEventMapper","actionEventMapper","registerActionEventMapper","params","wasInitialized","__DEV__","telemetryDebug","Promise","resolve","verbosity","buildConfiguration","DdSdkConfiguration","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","undefined","sessionSamplingRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","initializationType","trackNetworkRequests","INFO","BufferSingleton","onInitialization","DD_SOURCE_KEY","DD_SDK_VERSION","sdkVersion","DD_NATIVE_VIEW_TRACKING_KEY","nativeViewTracking","DD_NATIVE_INTERACTION_TRACKING_KEY","nativeInteractionTracking","DD_SDK_VERBOSITY_KEY","proxyConfig","DD_PROXY_TYPE_KEY","type","DD_PROXY_ADDRESS_KEY","address","DD_PROXY_PORT_KEY","port","username","password","ProxyType","SOCKS","console","warn","DD_PROXY_USERNAME_KEY","DD_PROXY_PASSWORD_KEY","serviceName","DD_SERVICE_NAME","version","DD_VERSION","versionSuffix","DD_VERSION_SUFFIX"],"mappings":";;;;;;;AAMA;;AAEA;;AAaA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;AAEA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;AAY1B;;AAWA;AACJ;AACA;AACA;AACA;AAC2B,eAAVC,UAAU,CACnBC,aADmB,EAEN;AACb,UAAMF,gBAAgB,CAACG,mBAAjB,CAAqCD,aAArC,EAAoD;AACtDE,MAAAA,8BAA8B,EAAE;AADsB,KAApD,CAAN;AAGAJ,IAAAA,gBAAgB,CAACK,cAAjB,CAAgCH,aAAhC;AACH;;AAsDD;AACJ;AACA;AAC+C,eAA9BI,8BAA8B,CACvCJ,aADuC,EAE1B;AACbF,IAAAA,gBAAgB,CAACK,cAAjB,CAAgCH,aAAhC;;AACA,QAAIA,aAAa,CAACK,kBAAd,KAAqCC,kDA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AAC6G,UAAhD,IAA+D,GAC3D3G,aAAa,CAAC0G,OACjB,GACG1G,aAAa,CAAC4G,aAAd,GACO,IAAG5G,aAAa,CAAC4G,aAAc,EADtC,GAEM,EACT,EAND;AAOH,GAxDA,CA0DD;AACA;;;AACA,MAAI5G,aAAa,CAAC4G,aAAd,IAA+B,CAAC5G,aAAa,CAAC0G,OAAlD,EAA2D;AACvD1G,IAAAA,aAAa,CAACyE,gBAAd,CACI3E,gBAAgB,CAAC+G,iBADrB,IAEK,IAAG7G,aAAa,CAAC4G,aAAc,EAFpC;AAGH;;AAED5G,EAAAA,aAAa,CAACyE,gBAAd,CAA+B,uBAA/B,IACIzE,aAAa,CAACwC,eADlB;AAEH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { InteractionManager } from 'react-native';\n\nimport {\n DdSdkReactNativeConfiguration,\n buildConfigurationFromPartialConfiguration,\n addDefaultValuesToAutoInstrumentationConfiguration,\n InitializationMode\n} from './DdSdkReactNativeConfiguration';\nimport type {\n AutoInstrumentationParameters,\n DatadogProviderConfiguration,\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration,\n InitializationModeForTelemetry\n} from './DdSdkReactNativeConfiguration';\nimport { InternalLog } from './InternalLog';\nimport { ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport type { TrackingConsent } from './TrackingConsent';\nimport { DdSdk } from './foundation';\nimport { DdLogs } from './logs/DdLogs';\nimport { adaptLongTaskThreshold } from './longTasksUtils';\nimport { DdRum } from './rum/DdRum';\nimport { DdRumErrorTracking } from './rum/instrumentation/DdRumErrorTracking';\nimport { DdRumUserInteractionTracking } from './rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';\nimport { DdRumResourceTracking } from './rum/instrumentation/resourceTracking/DdRumResourceTracking';\nimport { AttributesSingleton } from './sdk/AttributesSingleton/AttributesSingleton';\nimport type { Attributes } from './sdk/AttributesSingleton/types';\nimport { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';\nimport { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';\nimport type { UserInfo } from './sdk/UserInfoSingleton/types';\nimport { DdSdkConfiguration } from './types';\nimport { version as sdkVersion } from './version';\n\n/**\n * This class initializes the Datadog SDK, and sets up communication with the server.\n */\nexport class DdSdkReactNative {\n private static readonly DD_SOURCE_KEY = '_dd.source';\n private static readonly DD_SDK_VERSION = '_dd.sdk_version';\n private static readonly DD_SERVICE_NAME = '_dd.service_name';\n private static readonly DD_SDK_VERBOSITY_KEY = '_dd.sdk_verbosity';\n private static readonly DD_NATIVE_VIEW_TRACKING_KEY =\n '_dd.native_view_tracking';\n private static readonly DD_NATIVE_INTERACTION_TRACKING_KEY =\n '_dd.native_interaction_tracking';\n private static readonly DD_VERSION = '_dd.version';\n private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';\n\n // Proxy\n private static readonly DD_PROXY_TYPE_KEY = '_dd.proxy.type';\n private static readonly DD_PROXY_ADDRESS_KEY = '_dd.proxy.address';\n private static readonly DD_PROXY_PORT_KEY = '_dd.proxy.port';\n private static readonly DD_PROXY_USERNAME_KEY = '_dd.proxy.username';\n private static readonly DD_PROXY_PASSWORD_KEY = '_dd.proxy.password';\n\n private static wasInitialized = false;\n private static wasAutoInstrumented = false;\n private static features?: AutoInstrumentationConfiguration;\n\n /**\n * Initializes the Datadog SDK.\n * @param configuration the configuration for the SDK library\n * @returns a Promise.\n */\n static async initialize(\n configuration: DdSdkReactNativeConfiguration\n ): Promise<void> {\n await DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'LEGACY'\n });\n DdSdkReactNative.enableFeatures(configuration);\n }\n\n private static initializeNativeSDK = async (\n configuration: DdSdkReactNativeConfiguration,\n params: {\n initializationModeForTelemetry: InitializationModeForTelemetry;\n }\n ): Promise<void> => {\n if (DdSdkReactNative.wasInitialized) {\n InternalLog.log(\n \"Can't initialize Datadog, SDK was already initialized\",\n SdkVerbosity.WARN\n );\n if (!__DEV__) {\n DdSdk.telemetryDebug(\n 'RN SDK was already initialized in javascript'\n );\n }\n return new Promise(resolve => resolve());\n }\n\n InternalLog.verbosity = configuration.verbosity;\n\n DdSdkReactNative.buildConfiguration(configuration);\n\n await DdSdk.initialize(\n new DdSdkConfiguration(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.nativeCrashReportEnabled,\n adaptLongTaskThreshold(configuration.nativeLongTaskThresholdMs),\n adaptLongTaskThreshold(configuration.longTaskThresholdMs),\n configuration.sampleRate === undefined\n ? configuration.sessionSamplingRate\n : configuration.sampleRate,\n configuration.site,\n configuration.trackingConsent,\n configuration.additionalConfig,\n configuration.telemetrySampleRate,\n configuration.vitalsUpdateFrequency,\n {\n initializationType: params.initializationModeForTelemetry,\n trackErrors: configuration.trackErrors,\n trackInteractions: configuration.trackInteractions,\n trackNetworkRequests: configuration.trackResources\n }\n )\n );\n InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);\n DdSdkReactNative.wasInitialized = true;\n BufferSingleton.onInitialization();\n };\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _initializeFromDatadogProvider(\n configuration: DatadogProviderConfiguration\n ): Promise<void> {\n DdSdkReactNative.enableFeatures(configuration);\n if (configuration.initializationMode === InitializationMode.SYNC) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n if (configuration.initializationMode === InitializationMode.ASYNC) {\n return InteractionManager.runAfterInteractions(() => {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'ASYNC'\n });\n });\n }\n // TODO: Remove when DdSdkReactNativeConfiguration is deprecated\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n return DdSdkReactNative.initializeNativeSDK(configuration, {\n initializationModeForTelemetry: 'SYNC'\n });\n }\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static async _enableFeaturesFromDatadogProvider(\n features: AutoInstrumentationConfiguration\n ): Promise<void> {\n DdSdkReactNative.features = features;\n DdSdkReactNative.enableFeatures(\n addDefaultValuesToAutoInstrumentationConfiguration(features)\n );\n }\n\n /**\n * FOR INTERNAL USE ONLY.\n */\n static _initializeFromDatadogProviderWithConfigurationAsync = async (\n configuration: PartialInitializationConfiguration\n ): Promise<void> => {\n if (!DdSdkReactNative.features) {\n InternalLog.log(\n \"Can't initialize Datadog, make sure the DatadogProvider component is mounted before calling this function\",\n SdkVerbosity.WARN\n );\n return new Promise(resolve => resolve());\n }\n\n return DdSdkReactNative.initializeNativeSDK(\n buildConfigurationFromPartialConfiguration(\n DdSdkReactNative.features,\n configuration\n ),\n { initializationModeForTelemetry: 'PARTIAL' }\n );\n };\n\n /**\n * Adds a set of attributes to the global context attached with all future Logs, Spans and RUM events.\n * To remove an attribute, set it to `undefined` in a call to `setAttributes`.\n * @param attributes: The global context attributes.\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static async setAttributes(attributes: Attributes): Promise<void> {\n InternalLog.log(\n `Setting attributes ${JSON.stringify(attributes)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setAttributes(attributes);\n AttributesSingleton.getInstance().setAttributes(attributes);\n }\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n * @returns a Promise.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n static async setUser(user: UserInfo): Promise<void> {\n InternalLog.log(\n `Setting user ${JSON.stringify(user)}`,\n SdkVerbosity.DEBUG\n );\n await DdSdk.setUser(user);\n UserInfoSingleton.getInstance().setUserInfo(user);\n }\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: One of TrackingConsent values.\n * @returns a Promise.\n */\n static setTrackingConsent(consent: TrackingConsent): Promise<void> {\n InternalLog.log(`Setting consent ${consent}`, SdkVerbosity.DEBUG);\n return DdSdk.setTrackingConsent(consent);\n }\n\n private static buildConfiguration = (\n configuration: DdSdkReactNativeConfiguration\n ) => {\n configuration.additionalConfig[DdSdkReactNative.DD_SOURCE_KEY] =\n 'react-native';\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERSION\n ] = sdkVersion;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_VIEW_TRACKING_KEY\n ] = configuration.nativeViewTracking;\n configuration.additionalConfig[\n DdSdkReactNative.DD_NATIVE_INTERACTION_TRACKING_KEY\n ] = configuration.nativeInteractionTracking;\n\n if (configuration.verbosity) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_SDK_VERBOSITY_KEY\n ] = configuration.verbosity;\n }\n\n if (configuration.proxyConfig) {\n const additionalConfig = configuration.additionalConfig;\n const proxyConfig = configuration.proxyConfig;\n\n additionalConfig[DdSdkReactNative.DD_PROXY_TYPE_KEY] =\n proxyConfig.type;\n additionalConfig[DdSdkReactNative.DD_PROXY_ADDRESS_KEY] =\n proxyConfig.address;\n additionalConfig[DdSdkReactNative.DD_PROXY_PORT_KEY] =\n proxyConfig.port;\n if (proxyConfig.username && proxyConfig.password) {\n if (proxyConfig.type === ProxyType.SOCKS) {\n console.warn(\n \"SOCKS proxy configuration doesn't support Basic authentication.\"\n );\n } else {\n additionalConfig[DdSdkReactNative.DD_PROXY_USERNAME_KEY] =\n proxyConfig.username;\n additionalConfig[DdSdkReactNative.DD_PROXY_PASSWORD_KEY] =\n proxyConfig.password;\n }\n }\n }\n\n if (configuration.serviceName) {\n configuration.additionalConfig[DdSdkReactNative.DD_SERVICE_NAME] =\n configuration.serviceName;\n }\n\n if (configuration.version) {\n configuration.additionalConfig[DdSdkReactNative.DD_VERSION] = `${\n configuration.version\n }${\n configuration.versionSuffix\n ? `-${configuration.versionSuffix}`\n : ''\n }`;\n }\n\n // If both version and version suffix are provided, we merge them into the version field.\n // To avoid adding it in again the native part, we only set it if the version isn't set.\n if (configuration.versionSuffix && !configuration.version) {\n configuration.additionalConfig[\n DdSdkReactNative.DD_VERSION_SUFFIX\n ] = `-${configuration.versionSuffix}`;\n }\n\n configuration.additionalConfig['_dd.first_party_hosts'] =\n configuration.firstPartyHosts;\n };\n\n private static enableFeatures(\n configuration: AutoInstrumentationParameters\n ) {\n if (DdSdkReactNative.wasAutoInstrumented) {\n InternalLog.log(\n \"Can't auto instrument Datadog, SDK was already instrumented\",\n SdkVerbosity.WARN\n );\n return;\n }\n if (configuration.trackInteractions) {\n DdRumUserInteractionTracking.startTracking();\n }\n\n if (configuration.trackResources) {\n DdRumResourceTracking.startTracking({\n tracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: configuration.firstPartyHosts\n });\n }\n\n if (configuration.trackErrors) {\n DdRumErrorTracking.startTracking();\n }\n\n if (configuration.logEventMapper) {\n DdLogs.registerLogEventMapper(configuration.logEventMapper);\n }\n\n if (configuration.errorEventMapper) {\n DdRum.registerErrorEventMapper(configuration.errorEventMapper);\n }\n\n if (configuration.resourceEventMapper) {\n DdRum.registerResourceEventMapper(\n configuration.resourceEventMapper\n );\n }\n\n if (configuration.actionEventMapper) {\n DdRum.registerActionEventMapper(configuration.actionEventMapper);\n }\n\n DdSdkReactNative.wasAutoInstrumented = true;\n }\n}\n"]}
@@ -27,11 +27,16 @@ const DEFAULTS = {
27
27
  longTaskThresholdMs: 0,
28
28
  nativeLongTaskThresholdMs: 200,
29
29
  nativeViewTracking: false,
30
+ nativeInteractionTracking: false,
30
31
  getFirstPartyHosts: () => [],
31
32
  getAdditionalConfig: () => ({}),
32
33
  trackingConsent: _TrackingConsent.TrackingConsent.GRANTED,
33
34
  telemetrySampleRate: 20.0,
34
- vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE
35
+ vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,
36
+ logEventMapper: null,
37
+ errorEventMapper: null,
38
+ resourceEventMapper: null,
39
+ actionEventMapper: null
35
40
  };
36
41
  /**
37
42
  * The SDK configuration class.
@@ -65,6 +70,11 @@ class DdSdkReactNativeConfiguration {
65
70
  * Set to `true` if you use a custom navigation system relying on native views.
66
71
  */
67
72
 
73
+ /**
74
+ * Enables native interaction tracking.
75
+ * Set to `true` if you want to track interactions on native screens.
76
+ */
77
+
68
78
  /**
69
79
  * List of your backends hosts to enable tracing with.
70
80
  * Regular expressions are NOT supported.
@@ -148,6 +158,8 @@ class DdSdkReactNativeConfiguration {
148
158
 
149
159
  _defineProperty(this, "nativeViewTracking", DEFAULTS.nativeViewTracking);
150
160
 
161
+ _defineProperty(this, "nativeInteractionTracking", DEFAULTS.nativeInteractionTracking);
162
+
151
163
  _defineProperty(this, "proxyConfig", undefined);
152
164
 
153
165
  _defineProperty(this, "serviceName", undefined);
@@ -166,6 +178,14 @@ class DdSdkReactNativeConfiguration {
166
178
 
167
179
  _defineProperty(this, "vitalsUpdateFrequency", DEFAULTS.vitalsUpdateFrequency);
168
180
 
181
+ _defineProperty(this, "logEventMapper", DEFAULTS.logEventMapper);
182
+
183
+ _defineProperty(this, "errorEventMapper", DEFAULTS.errorEventMapper);
184
+
185
+ _defineProperty(this, "resourceEventMapper", DEFAULTS.resourceEventMapper);
186
+
187
+ _defineProperty(this, "actionEventMapper", DEFAULTS.actionEventMapper);
188
+
169
189
  _defineProperty(this, "additionalConfig", DEFAULTS.getAdditionalConfig());
170
190
  }
171
191
 
@@ -185,7 +205,11 @@ exports.DdSdkReactNativeConfiguration = DdSdkReactNativeConfiguration;
185
205
  const addDefaultValuesToAutoInstrumentationConfiguration = features => {
186
206
  return { ...features,
187
207
  firstPartyHosts: features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),
188
- resourceTracingSamplingRate: features.resourceTracingSamplingRate || DEFAULTS.resourceTracingSamplingRate
208
+ resourceTracingSamplingRate: features.resourceTracingSamplingRate === undefined ? DEFAULTS.resourceTracingSamplingRate : features.resourceTracingSamplingRate,
209
+ logEventMapper: features.logEventMapper === undefined ? DEFAULTS.logEventMapper : features.logEventMapper,
210
+ errorEventMapper: features.errorEventMapper === undefined ? DEFAULTS.errorEventMapper : features.errorEventMapper,
211
+ resourceEventMapper: features.resourceEventMapper === undefined ? DEFAULTS.resourceEventMapper : features.resourceEventMapper,
212
+ actionEventMapper: features.actionEventMapper === undefined ? DEFAULTS.actionEventMapper : features.actionEventMapper
189
213
  };
190
214
  };
191
215
 
@@ -219,6 +243,22 @@ const buildConfigurationFromPartialConfiguration = (features, configuration) =>
219
243
  name: 'firstPartyHosts',
220
244
  value: features.firstPartyHosts
221
245
  }, SdkConfiguration);
246
+ setConfigurationAttribute({
247
+ name: 'logEventMapper',
248
+ value: features.logEventMapper
249
+ }, SdkConfiguration);
250
+ setConfigurationAttribute({
251
+ name: 'errorEventMapper',
252
+ value: features.errorEventMapper
253
+ }, SdkConfiguration);
254
+ setConfigurationAttribute({
255
+ name: 'resourceEventMapper',
256
+ value: features.resourceEventMapper
257
+ }, SdkConfiguration);
258
+ setConfigurationAttribute({
259
+ name: 'actionEventMapper',
260
+ value: features.actionEventMapper
261
+ }, SdkConfiguration);
222
262
  return SdkConfiguration;
223
263
  };
224
264
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;;;IAEYA,qB;;;WAA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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 { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;;;IAMYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;AAOZ,MAAMC,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,mBAAmB,EAAE,CALR;AAMbC,EAAAA,yBAAyB,EAAE,GANd;AAObC,EAAAA,kBAAkB,EAAE,KAPP;AAQbC,EAAAA,yBAAyB,EAAE,KARd;AASbC,EAAAA,kBAAkB,EAAE,MAAM,EATb;AAUbC,EAAAA,mBAAmB,EAAE,OAAO,EAAP,CAVR;AAWbC,EAAAA,eAAe,EAAEC,iCAAgBC,OAXpB;AAYbC,EAAAA,mBAAmB,EAAE,IAZR;AAabC,EAAAA,qBAAqB,EAAEhB,qBAAqB,CAACiB,OAbhC;AAcbC,EAAAA,cAAc,EAAE,IAdH;AAebC,EAAAA,gBAAgB,EAAE,IAfL;AAgBbC,EAAAA,mBAAmB,EAAE,IAhBR;AAiBbC,EAAAA,iBAAiB,EAAE;AAjBN,CAAjB;AAoBA;AACA;AACA;AACA;;AACO,MAAMC,6BAAN,CAAoC;AACvC;AACJ;AAC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B,CACrB;AACII,IAAAA,IAAI,EAAE,kBADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACb;AAFpB,GADqB,EAKrBsB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACZ;AAFpB,GADqB,EAKrBqB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACX;AAFpB,GADqB,EAKrBoB,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CAtEM;;;;AAwEA,MAAMI,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","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 { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "DdSdkConfiguration", {
9
9
  return _types.DdSdkConfiguration;
10
10
  }
11
11
  });
12
- exports.DdRum = exports.DdTrace = exports.DdLogs = exports.DdSdk = void 0;
12
+ exports.DdTrace = exports.DdSdk = void 0;
13
13
 
14
14
  var _reactNative = require("react-native");
15
15
 
@@ -21,43 +21,12 @@ var _SdkVerbosity = require("./SdkVerbosity");
21
21
 
22
22
  var _TimeProvider = require("./TimeProvider");
23
23
 
24
- var _bufferNativeCall = require("./DatadogProvider/Buffer/bufferNativeCall");
24
+ var _bufferNativeCall = require("./sdk/DatadogProvider/Buffer/bufferNativeCall");
25
25
 
26
26
  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; }
27
27
 
28
28
  const timeProvider = new _TimeProvider.TimeProvider();
29
29
 
30
- class DdLogsWrapper {
31
- constructor() {
32
- _defineProperty(this, "nativeLogs", _reactNative.NativeModules.DdLogs);
33
- }
34
-
35
- debug(message, context = {}) {
36
- _InternalLog.InternalLog.log("Tracking debug log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
37
-
38
- return this.nativeLogs.debug(message, context);
39
- }
40
-
41
- info(message, context = {}) {
42
- _InternalLog.InternalLog.log("Tracking info log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
43
-
44
- return this.nativeLogs.info(message, context);
45
- }
46
-
47
- warn(message, context = {}) {
48
- _InternalLog.InternalLog.log("Tracking warn log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
49
-
50
- return this.nativeLogs.warn(message, context);
51
- }
52
-
53
- error(message, context = {}) {
54
- _InternalLog.InternalLog.log("Tracking error log “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
55
-
56
- return this.nativeLogs.error(message, context);
57
- }
58
-
59
- }
60
-
61
30
  class DdTraceWrapper {
62
31
  constructor() {
63
32
  _defineProperty(this, "nativeTrace", _reactNative.NativeModules.DdTrace);
@@ -79,114 +48,8 @@ class DdTraceWrapper {
79
48
 
80
49
  }
81
50
 
82
- const isNewStopActionAPI = args => {
83
- return typeof args[0] === 'string';
84
- };
85
-
86
- const isOldStopActionAPI = args => {
87
- return typeof args[0] === 'object' || typeof args[0] === 'undefined';
88
- };
89
-
90
- class DdRumWrapper {
91
- constructor() {
92
- _defineProperty(this, "nativeRum", _reactNative.NativeModules.DdRum);
93
-
94
- _defineProperty(this, "lastActionData", void 0);
95
-
96
- _defineProperty(this, "getStopActionNativeCall", args => {
97
- if (isNewStopActionAPI(args)) {
98
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopAction(args[0], args[1], args[2] || {}, args[3] || timeProvider.now()));
99
- }
100
-
101
- if (isOldStopActionAPI(args)) {
102
- if (this.lastActionData) {
103
- DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature');
104
- const {
105
- type,
106
- name
107
- } = this.lastActionData;
108
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopAction(type, name, args[0] || {}, args[1] || timeProvider.now()));
109
- }
110
-
111
- _InternalLog.InternalLog.log("DdRum.startAction needs to be called before DdRum.stopAction", _SdkVerbosity.SdkVerbosity.WARN);
112
- } else {
113
- _InternalLog.InternalLog.log("DdRum.stopAction was called with wrong arguments", _SdkVerbosity.SdkVerbosity.WARN);
114
- }
115
-
116
- return new Promise(resolve => resolve());
117
- });
118
- }
119
-
120
- startView(key, name, context = {}, timestampMs = timeProvider.now()) {
121
- _InternalLog.InternalLog.log("Starting RUM View “" + name + "” #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
122
-
123
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startView(key, name, context, timestampMs));
124
- }
125
-
126
- stopView(key, context = {}, timestampMs = timeProvider.now()) {
127
- _InternalLog.InternalLog.log("Stopping RUM View #" + key, _SdkVerbosity.SdkVerbosity.DEBUG);
128
-
129
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopView(key, context, timestampMs));
130
- }
131
-
132
- startAction(type, name, context = {}, timestampMs = timeProvider.now()) {
133
- _InternalLog.InternalLog.log("Starting RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
134
-
135
- this.lastActionData = {
136
- type,
137
- name
138
- };
139
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startAction(type, name, context, timestampMs));
140
- }
141
-
142
- stopAction(...args) {
143
- _InternalLog.InternalLog.log("Stopping current RUM Action", _SdkVerbosity.SdkVerbosity.DEBUG);
144
-
145
- let returnPromise = this.getStopActionNativeCall(args);
146
- this.lastActionData = undefined;
147
- return returnPromise;
148
- }
149
-
150
- addAction(type, name, context = {}, timestampMs = timeProvider.now()) {
151
- _InternalLog.InternalLog.log("Adding RUM Action “" + name + "” (" + type + ")", _SdkVerbosity.SdkVerbosity.DEBUG);
152
-
153
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addAction(type, name, context, timestampMs));
154
- }
155
-
156
- startResource(key, method, url, context = {}, timestampMs = timeProvider.now()) {
157
- _InternalLog.InternalLog.log("Starting RUM Resource #" + key + " " + method + ": " + url, _SdkVerbosity.SdkVerbosity.DEBUG);
158
-
159
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.startResource(key, method, url, context, timestampMs));
160
- }
161
-
162
- stopResource(key, statusCode, kind, size = -1, context = {}, timestampMs = timeProvider.now()) {
163
- _InternalLog.InternalLog.log("Stopping RUM Resource #" + key + " status:" + statusCode, _SdkVerbosity.SdkVerbosity.DEBUG);
164
-
165
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs));
166
- }
167
-
168
- addError(message, source, stacktrace, context = {}, timestampMs = timeProvider.now()) {
169
- _InternalLog.InternalLog.log("Adding RUM Error “" + message + "”", _SdkVerbosity.SdkVerbosity.DEBUG);
170
-
171
- let updatedContext = context;
172
- updatedContext["_dd.error.source_type"] = "react-native";
173
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs));
174
- }
175
-
176
- addTiming(name) {
177
- _InternalLog.InternalLog.log("Adding timing “" + name + "” to RUM View", _SdkVerbosity.SdkVerbosity.DEBUG);
178
-
179
- return (0, _bufferNativeCall.bufferVoidNativeCall)(() => this.nativeRum.addTiming(name));
180
- }
181
-
182
- }
183
-
184
51
  const DdSdk = _reactNative.NativeModules.DdSdk;
185
52
  exports.DdSdk = DdSdk;
186
- const DdLogs = new DdLogsWrapper();
187
- exports.DdLogs = DdLogs;
188
53
  const DdTrace = new DdTraceWrapper();
189
54
  exports.DdTrace = DdTrace;
190
- const DdRum = new DdRumWrapper();
191
- exports.DdRum = DdRum;
192
55
  //# sourceMappingURL=foundation.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdLogsWrapper","NativeModules","DdLogs","debug","message","context","InternalLog","log","SdkVerbosity","DEBUG","nativeLogs","info","warn","error","DdTraceWrapper","DdTrace","startSpan","operation","timestampMs","now","spanId","nativeTrace","finishSpan","id","isNewStopActionAPI","args","isOldStopActionAPI","DdRumWrapper","DdRum","nativeRum","stopAction","lastActionData","DdSdk","telemetryDebug","type","name","WARN","Promise","resolve","startView","key","stopView","startAction","returnPromise","getStopActionNativeCall","undefined","addAction","startResource","method","url","stopResource","statusCode","kind","size","addError","source","stacktrace","updatedContext","addTiming"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAECC,2BAAcC,MAFf;AAAA;;AAItCC,EAAAA,KAAK,CAACC,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACxDC,6BAAYC,GAAZ,CAAgB,yBAA0BH,OAA1B,GAAoC,GAApD,EAAyDI,2BAAaC,KAAtE;;AACA,WAAO,KAAKC,UAAL,CAAgBP,KAAhB,CAAsBC,OAAtB,EAA+BC,OAA/B,CAAP;AACH;;AAEDM,EAAAA,IAAI,CAACP,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBC,IAAhB,CAAqBP,OAArB,EAA8BC,OAA9B,CAAP;AACH;;AAEDO,EAAAA,IAAI,CAACR,OAAD,EAAkBC,OAAe,GAAG,EAApC,EAAuD;AACvDC,6BAAYC,GAAZ,CAAgB,wBAAyBH,OAAzB,GAAmC,GAAnD,EAAwDI,2BAAaC,KAArE;;AACA,WAAO,KAAKC,UAAL,CAAgBE,IAAhB,CAAqBR,OAArB,EAA8BC,OA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M,KAAKoB,SAAL,CAAeqB,YAAf,CAA4BV,GAA5B,EAAiCW,UAAjC,EAA6CC,IAA7C,EAAmDC,IAAnD,EAAyDhD,OAAzD,EAAkEa,WAAlE,CAA3B,CAAP;AACH;;AAEDoC,EAAAA,QAAQ,CAAClD,OAAD,EAAkBmD,MAAlB,EAAuCC,UAAvC,EAA2DnD,OAAe,GAAG,EAA7E,EAAiFa,WAAmB,GAAGpB,YAAY,CAACqB,GAAb,EAAvG,EAA0I;AAC9Ib,6BAAYC,GAAZ,CAAgB,uBAAuBH,OAAvB,GAAiC,GAAjD,EAAsDI,2BAAaC,KAAnE;;AACA,QAAIgD,cAAmB,GAAGpD,OAA1B;AACAoD,IAAAA,cAAc,CAAC,uBAAD,CAAd,GAA0C,cAA1C;AACA,WAAO,4CAAqB,MAAM,KAAK5B,SAAL,CAAeyB,QAAf,CAAwBlD,OAAxB,EAAiCmD,MAAjC,EAAyCC,UAAzC,EAAqDC,cAArD,EAAqEvC,WAArE,CAA3B,CAAP;AACH;;AAEDwC,EAAAA,SAAS,CAACvB,IAAD,EAA8B;AACnC7B,6BAAYC,GAAZ,CAAgB,oBAAoB4B,IAApB,GAA2B,eAA3C,EAA4D3B,2BAAaC,KAAzE;;AACA,WAAO,4CAAqB,MAAM,KAAKoB,SAAL,CAAe6B,SAAf,CAAyBvB,IAAzB,CAA3B,CAAP;AACH;;AAvEmC;;AA0ExC,MAAMH,KAAsB,GAAG/B,2BAAc+B,KAA7C;;AACA,MAAM9B,MAAkB,GAAG,IAAIF,aAAJ,EAA3B;;AACA,MAAMe,OAAoB,GAAG,IAAID,cAAJ,EAA7B;;AACA,MAAMc,KAAgB,GAAG,IAAID,YAAJ,EAAzB","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 { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdLogsType, DdTraceType, DdRumType, RumActionType, ResourceKind, ErrorSource } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeLogsType, DdNativeRumType, DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId, bufferVoidNativeCall } from './DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdLogsWrapper implements DdLogsType {\n\n private nativeLogs: DdNativeLogsType = NativeModules.DdLogs;\n\n debug(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking debug log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.debug(message, context);\n }\n\n info(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking info log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.info(message, context);\n }\n\n warn(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking warn log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.warn(message, context);\n }\n\n error(message: string, context: object = {}): Promise<void> {\n InternalLog.log(\"Tracking error log “\" + message + \"”\", SdkVerbosity.DEBUG);\n return this.nativeLogs.error(message, context);\n }\n\n}\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst isNewStopActionAPI = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): args is [type: RumActionType, name: string, context?: object, timestampMs?: number] => {\n return typeof args[0] === 'string'\n}\n\nconst isOldStopActionAPI = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined' \n}\n\nclass DdRumWrapper implements DdRumType {\n\n private nativeRum: DdNativeRumType = NativeModules.DdRum;\n private lastActionData?: {type: RumActionType, name: string}\n\n startView(key: string, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM View “\" + name + \"” #\" + key, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.startView(key, name, context, timestampMs));\n }\n\n stopView(key: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM View #\" + key, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopView(key, context, timestampMs));\n }\n\n startAction(type: RumActionType, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n this.lastActionData={type, name}\n return bufferVoidNativeCall(() => this.nativeRum.startAction(type, name, context, timestampMs));\n }\n\n stopAction(...args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): Promise<void> {\n InternalLog.log(\"Stopping current RUM Action\", SdkVerbosity.DEBUG);\n let returnPromise = this.getStopActionNativeCall(args)\n this.lastActionData = undefined\n return returnPromise\n }\n\n private getStopActionNativeCall = (args: [type: RumActionType, name: string, context?: object, timestampMs?: number] | [context?: object, timestampMs?: number]): Promise<void> => {\n if (isNewStopActionAPI(args)) {\n return bufferVoidNativeCall(() => this.nativeRum.stopAction(args[0], args[1], args[2] || {}, args[3] || timeProvider.now()))\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature')\n const {type, name} = this.lastActionData;\n return bufferVoidNativeCall(() => this.nativeRum.stopAction(type, name, args[0] || {}, args[1] || timeProvider.now()));\n } \n InternalLog.log(\"DdRum.startAction needs to be called before DdRum.stopAction\", SdkVerbosity.WARN);\n } else {\n InternalLog.log(\"DdRum.stopAction was called with wrong arguments\", SdkVerbosity.WARN);\n }\n\n return new Promise<void>(resolve => resolve())\n }\n\n addAction(type: RumActionType, name: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Action “\" + name + \"” (\" + type + \")\", SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.addAction(type, name, context, timestampMs));\n }\n\n startResource(key: string, method: string, url: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Starting RUM Resource #\" + key + \" \" + method + \": \" + url, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.startResource(key, method, url, context, timestampMs));\n }\n\n stopResource(key: string, statusCode: number, kind: ResourceKind, size: number = -1, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Stopping RUM Resource #\" + key + \" status:\" + statusCode, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.stopResource(key, statusCode, kind, size, context, timestampMs));\n }\n\n addError(message: string, source: ErrorSource, stacktrace: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Adding RUM Error “\" + message + \"”\", SdkVerbosity.DEBUG);\n let updatedContext: any = context;\n updatedContext[\"_dd.error.source_type\"] = \"react-native\";\n return bufferVoidNativeCall(() => this.nativeRum.addError(message, source, stacktrace, updatedContext, timestampMs));\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\"Adding timing “\" + name + \"” to RUM View\", SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdLogs: DdLogsType = new DdLogsWrapper();\nconst DdTrace: DdTraceType = new DdTraceWrapper();\nconst DdRum: DdRumType = new DdRumWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdLogs, DdTrace, DdRum };\n"]}
1
+ {"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdTraceWrapper","NativeModules","DdTrace","startSpan","operation","context","timestampMs","now","spanId","nativeTrace","InternalLog","log","SdkVerbosity","DEBUG","finishSpan","id","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,cAAN,CAA4C;AAAA;AAAA,yCAECC,2BAAcC,OAFf;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBC,OAAe,GAAG,EAAtC,EAA0CC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAAhE,EAAqG;AAC1G,QAAIC,MAAM,GAAG,mDAA4B,MAAK,KAAKC,WAAL,CAAiBN,SAAjB,CAA2BC,SAA3B,EAAsCC,OAAtC,EAA+CC,WAA/C,CAAjC,CAAb;;AACAI,6BAAYC,GAAZ,CAAgB,oBAAqBP,SAArB,GAAiC,KAAjC,GAAyCI,MAAzD,EAAiEI,2BAAaC,KAA9E;;AACA,WAAOL,MAAP;AACH;;AAEDM,EAAAA,UAAU,CAACN,MAAD,EAAiBH,OAAe,GAAG,EAAnC,EAAuCC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAA7D,EAAgG;AACtGG,6BAAYC,GAAZ,CAAgB,qBAAsBH,MAAtC,EAA8CI,2BAAaC,KAA3D;;AACA,WAAO,8CAAwBE,EAAD,IAAS,KAAKN,WAAL,CAAiBK,UAAjB,CAA4BC,EAA5B,EAAgCV,OAAhC,EAAyCC,WAAzC,CAAhC,EAAuFE,MAAvF,CAAP;AACH;;AAbuC;;AAgB5C,MAAMQ,KAAsB,GAAGf,2BAAce,KAA7C;;AACA,MAAMd,OAAoB,GAAG,IAAIF,cAAJ,EAA7B","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 { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdTraceType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdTrace };\n"]}