@datadog/mobile-react-native 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/DatadogSDKReactNative.podspec +6 -6
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +6 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +31 -24
  5. package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +63 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  7. package/android/src/main/kotlin/com/datadog/reactnative/UiThreadExecutor.kt +25 -0
  8. package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  9. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +10 -1
  10. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +29 -0
  11. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +34 -14
  12. package/android/src/test/kotlin/com/datadog/tools/unit/TestUiThreadExecutor.kt +16 -0
  13. package/datadog-sourcemaps.gradle +3 -5
  14. package/ios/Sources/DdRum.mm +4 -3
  15. package/ios/Sources/DdRumImplementation.swift +15 -2
  16. package/ios/Sources/SdkVersion.swift +1 -1
  17. package/lib/commonjs/DdSdkReactNative.js +107 -145
  18. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  19. package/lib/commonjs/DdSdkReactNativeConfiguration.js +54 -119
  20. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  21. package/lib/commonjs/InternalLog.js +8 -19
  22. package/lib/commonjs/InternalLog.js.map +1 -1
  23. package/lib/commonjs/ProxyConfiguration.js +3 -15
  24. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  25. package/lib/commonjs/SdkVerbosity.js +3 -7
  26. package/lib/commonjs/SdkVerbosity.js.map +1 -1
  27. package/lib/commonjs/TrackingConsent.js +3 -7
  28. package/lib/commonjs/TrackingConsent.js.map +1 -1
  29. package/lib/commonjs/index.js +50 -66
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/logs/DdLogs.js +103 -123
  32. package/lib/commonjs/logs/DdLogs.js.map +1 -1
  33. package/lib/commonjs/logs/eventMapper.js +4 -11
  34. package/lib/commonjs/logs/eventMapper.js.map +1 -1
  35. package/lib/commonjs/logs/types.js +4 -0
  36. package/lib/commonjs/logs/types.js.map +1 -1
  37. package/lib/commonjs/nativeModulesTypes.js +4 -3
  38. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  39. package/lib/commonjs/polyfills.js +1 -4
  40. package/lib/commonjs/polyfills.js.map +1 -1
  41. package/lib/commonjs/rum/DdAttributes.js +26 -0
  42. package/lib/commonjs/rum/DdAttributes.js.map +1 -0
  43. package/lib/commonjs/rum/DdRum.js +143 -208
  44. package/lib/commonjs/rum/DdRum.js.map +1 -1
  45. package/lib/commonjs/rum/eventMappers/actionEventMapper.js +5 -8
  46. package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -1
  47. package/lib/commonjs/rum/eventMappers/errorEventMapper.js +3 -7
  48. package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -1
  49. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +5 -8
  50. package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -1
  51. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +68 -89
  52. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  53. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +13 -46
  54. package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  55. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +52 -66
  56. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  57. package/lib/commonjs/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  58. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -4
  59. package/lib/commonjs/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  60. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -6
  61. package/lib/commonjs/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  62. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js +18 -19
  63. package/lib/commonjs/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  64. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -21
  65. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  66. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +32 -55
  67. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  68. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -9
  69. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  70. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +15 -41
  71. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  72. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -13
  73. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  74. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +5 -10
  75. package/lib/commonjs/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  76. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +16 -35
  77. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  78. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -5
  79. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  80. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -7
  81. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  82. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -10
  83. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  84. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +25 -58
  85. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  86. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +4 -26
  87. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  88. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -11
  89. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  90. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +4 -0
  91. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  92. package/lib/commonjs/rum/types.js +15 -27
  93. package/lib/commonjs/rum/types.js.map +1 -1
  94. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +20 -30
  95. package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  96. package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -1
  97. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +112 -144
  98. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  99. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js +19 -22
  100. package/lib/commonjs/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  101. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -15
  102. package/lib/commonjs/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  103. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +9 -16
  104. package/lib/commonjs/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  105. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js +2 -8
  106. package/lib/commonjs/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  107. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +8 -25
  108. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  109. package/lib/commonjs/sdk/DdSdk.js +2 -4
  110. package/lib/commonjs/sdk/DdSdk.js.map +1 -1
  111. package/lib/commonjs/sdk/EventMappers/EventMapper.js +31 -51
  112. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
  113. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +9 -24
  114. package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -1
  115. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +6 -38
  116. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  117. package/lib/commonjs/sdk/GlobalState/GlobalState.js +6 -11
  118. package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
  119. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -28
  120. package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  121. package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -1
  122. package/lib/commonjs/specs/NativeDdLogs.js +4 -6
  123. package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
  124. package/lib/commonjs/specs/NativeDdRum.js +4 -6
  125. package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
  126. package/lib/commonjs/specs/NativeDdSdk.js +4 -6
  127. package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
  128. package/lib/commonjs/specs/NativeDdTrace.js +4 -6
  129. package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
  130. package/lib/commonjs/trace/DdTrace.js +17 -29
  131. package/lib/commonjs/trace/DdTrace.js.map +1 -1
  132. package/lib/commonjs/types.js +4 -3
  133. package/lib/commonjs/types.js.map +1 -1
  134. package/lib/commonjs/utils/Timer.js +7 -22
  135. package/lib/commonjs/utils/Timer.js.map +1 -1
  136. package/lib/commonjs/utils/argsUtils.js +3 -11
  137. package/lib/commonjs/utils/argsUtils.js.map +1 -1
  138. package/lib/commonjs/utils/errorUtils.js +9 -22
  139. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  140. package/lib/commonjs/utils/jsUtils.js +1 -2
  141. package/lib/commonjs/utils/jsUtils.js.map +1 -1
  142. package/lib/commonjs/utils/longTasksUtils.js +2 -7
  143. package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
  144. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js +9 -15
  145. package/lib/commonjs/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  146. package/lib/commonjs/utils/time-provider/TimeProvider.js +1 -11
  147. package/lib/commonjs/utils/time-provider/TimeProvider.js.map +1 -1
  148. package/lib/commonjs/version.js +1 -2
  149. package/lib/commonjs/version.js.map +1 -1
  150. package/lib/module/DdSdkReactNative.js +104 -116
  151. package/lib/module/DdSdkReactNative.js.map +1 -1
  152. package/lib/module/DdSdkReactNativeConfiguration.js +49 -101
  153. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  154. package/lib/module/InternalLog.js +4 -15
  155. package/lib/module/InternalLog.js.map +1 -1
  156. package/lib/module/ProxyConfiguration.js +3 -14
  157. package/lib/module/ProxyConfiguration.js.map +1 -1
  158. package/lib/module/SdkVerbosity.js +3 -4
  159. package/lib/module/SdkVerbosity.js.map +1 -1
  160. package/lib/module/TrackingConsent.js +3 -4
  161. package/lib/module/TrackingConsent.js.map +1 -1
  162. package/lib/module/index.js +2 -2
  163. package/lib/module/index.js.map +1 -1
  164. package/lib/module/logs/DdLogs.js +98 -117
  165. package/lib/module/logs/DdLogs.js.map +1 -1
  166. package/lib/module/logs/eventMapper.js +3 -1
  167. package/lib/module/logs/eventMapper.js.map +1 -1
  168. package/lib/module/logs/types.js +1 -1
  169. package/lib/module/logs/types.js.map +1 -1
  170. package/lib/module/nativeModulesTypes.js +5 -1
  171. package/lib/module/nativeModulesTypes.js.map +1 -1
  172. package/lib/module/polyfills.js +1 -3
  173. package/lib/module/polyfills.js.map +1 -1
  174. package/lib/module/rum/DdAttributes.js +20 -0
  175. package/lib/module/rum/DdAttributes.js.map +1 -0
  176. package/lib/module/rum/DdRum.js +138 -185
  177. package/lib/module/rum/DdRum.js.map +1 -1
  178. package/lib/module/rum/eventMappers/actionEventMapper.js +5 -5
  179. package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -1
  180. package/lib/module/rum/eventMappers/errorEventMapper.js +3 -4
  181. package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -1
  182. package/lib/module/rum/eventMappers/resourceEventMapper.js +5 -5
  183. package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -1
  184. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +64 -79
  185. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  186. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +7 -36
  187. package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
  188. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +49 -54
  189. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  190. package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -1
  191. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js +3 -2
  192. package/lib/module/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.js.map +1 -1
  193. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js +0 -4
  194. package/lib/module/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.js.map +1 -1
  195. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js +16 -14
  196. package/lib/module/rum/instrumentation/interactionTracking/getJsxRuntime.js.map +1 -1
  197. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +2 -12
  198. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  199. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +33 -45
  200. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
  201. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +1 -4
  202. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
  203. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +2 -10
  204. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
  205. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +3 -5
  206. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
  207. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js +1 -0
  208. package/lib/module/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.js.map +1 -1
  209. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +12 -30
  210. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
  211. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +2 -3
  212. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
  213. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js +4 -4
  214. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.js.map +1 -1
  215. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +4 -5
  216. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
  217. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +20 -48
  218. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
  219. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +2 -20
  220. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
  221. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js +1 -9
  222. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -1
  223. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js +1 -1
  224. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.js.map +1 -1
  225. package/lib/module/rum/types.js +14 -18
  226. package/lib/module/rum/types.js.map +1 -1
  227. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +20 -28
  228. package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
  229. package/lib/module/sdk/AttributesSingleton/types.js.map +1 -1
  230. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +108 -137
  231. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  232. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js +14 -18
  233. package/lib/module/sdk/DatadogProvider/Buffer/BufferSingleton.js.map +1 -1
  234. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js +1 -13
  235. package/lib/module/sdk/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -1
  236. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js +5 -14
  237. package/lib/module/sdk/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -1
  238. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js +1 -0
  239. package/lib/module/sdk/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -1
  240. package/lib/module/sdk/DatadogProvider/DatadogProvider.js +6 -14
  241. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  242. package/lib/module/sdk/DdSdk.js +1 -1
  243. package/lib/module/sdk/DdSdk.js.map +1 -1
  244. package/lib/module/sdk/EventMappers/EventMapper.js +27 -41
  245. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
  246. package/lib/module/sdk/EventMappers/utils/deepClone.js +9 -22
  247. package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -1
  248. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +5 -29
  249. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -1
  250. package/lib/module/sdk/GlobalState/GlobalState.js +6 -9
  251. package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
  252. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +17 -26
  253. package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
  254. package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -1
  255. package/lib/module/specs/NativeDdLogs.js +2 -0
  256. package/lib/module/specs/NativeDdLogs.js.map +1 -1
  257. package/lib/module/specs/NativeDdRum.js +2 -0
  258. package/lib/module/specs/NativeDdRum.js.map +1 -1
  259. package/lib/module/specs/NativeDdSdk.js +2 -0
  260. package/lib/module/specs/NativeDdSdk.js.map +1 -1
  261. package/lib/module/specs/NativeDdTrace.js +2 -0
  262. package/lib/module/specs/NativeDdTrace.js.map +1 -1
  263. package/lib/module/trace/DdTrace.js +12 -19
  264. package/lib/module/trace/DdTrace.js.map +1 -1
  265. package/lib/module/types.js +5 -1
  266. package/lib/module/types.js.map +1 -1
  267. package/lib/module/utils/Timer.js +3 -20
  268. package/lib/module/utils/Timer.js.map +1 -1
  269. package/lib/module/utils/argsUtils.js +3 -5
  270. package/lib/module/utils/argsUtils.js.map +1 -1
  271. package/lib/module/utils/errorUtils.js +6 -9
  272. package/lib/module/utils/errorUtils.js.map +1 -1
  273. package/lib/module/utils/jsUtils.js +1 -0
  274. package/lib/module/utils/jsUtils.js.map +1 -1
  275. package/lib/module/utils/longTasksUtils.js +2 -5
  276. package/lib/module/utils/longTasksUtils.js.map +1 -1
  277. package/lib/module/utils/time-provider/DefaultTimeProvider.js +5 -13
  278. package/lib/module/utils/time-provider/DefaultTimeProvider.js.map +1 -1
  279. package/lib/module/utils/time-provider/TimeProvider.js +1 -9
  280. package/lib/module/utils/time-provider/TimeProvider.js.map +1 -1
  281. package/lib/module/version.js +1 -1
  282. package/lib/module/version.js.map +1 -1
  283. package/lib/typescript/DdSdkReactNative.d.ts +1 -0
  284. package/lib/typescript/DdSdkReactNative.d.ts.map +1 -0
  285. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -0
  286. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +1 -0
  287. package/lib/typescript/InternalLog.d.ts +1 -0
  288. package/lib/typescript/InternalLog.d.ts.map +1 -0
  289. package/lib/typescript/ProxyConfiguration.d.ts +1 -0
  290. package/lib/typescript/ProxyConfiguration.d.ts.map +1 -0
  291. package/lib/typescript/SdkVerbosity.d.ts +1 -0
  292. package/lib/typescript/SdkVerbosity.d.ts.map +1 -0
  293. package/lib/typescript/TrackingConsent.d.ts +1 -0
  294. package/lib/typescript/TrackingConsent.d.ts.map +1 -0
  295. package/lib/typescript/index.d.ts +1 -0
  296. package/lib/typescript/index.d.ts.map +1 -0
  297. package/lib/typescript/logs/DdLogs.d.ts +1 -0
  298. package/lib/typescript/logs/DdLogs.d.ts.map +1 -0
  299. package/lib/typescript/logs/eventMapper.d.ts +1 -0
  300. package/lib/typescript/logs/eventMapper.d.ts.map +1 -0
  301. package/lib/typescript/logs/types.d.ts +6 -1
  302. package/lib/typescript/logs/types.d.ts.map +1 -0
  303. package/lib/typescript/nativeModulesTypes.d.ts +3 -1
  304. package/lib/typescript/nativeModulesTypes.d.ts.map +1 -0
  305. package/lib/typescript/rum/DdAttributes.d.ts +14 -0
  306. package/lib/typescript/rum/DdAttributes.d.ts.map +1 -0
  307. package/lib/typescript/rum/DdRum.d.ts +3 -2
  308. package/lib/typescript/rum/DdRum.d.ts.map +1 -0
  309. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +1 -0
  310. package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts.map +1 -0
  311. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +3 -0
  312. package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -0
  313. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +1 -0
  314. package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts.map +1 -0
  315. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +1 -0
  316. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -0
  317. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +1 -0
  318. package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts.map +1 -0
  319. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -0
  320. package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -0
  321. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts +1 -0
  322. package/lib/typescript/rum/instrumentation/interactionTracking/EventsInterceptor.d.ts.map +1 -0
  323. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts +1 -0
  324. package/lib/typescript/rum/instrumentation/interactionTracking/NoOpEventsInterceptor.d.ts.map +1 -0
  325. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts +1 -0
  326. package/lib/typescript/rum/instrumentation/interactionTracking/ShallowObjectEqualityChecker.d.ts.map +1 -0
  327. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts +2 -1
  328. package/lib/typescript/rum/instrumentation/interactionTracking/getJsxRuntime.d.ts.map +1 -0
  329. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +1 -0
  330. package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -0
  331. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +1 -0
  332. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -0
  333. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -0
  334. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -0
  335. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +1 -0
  336. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -0
  337. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -0
  338. package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts.map +1 -0
  339. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts +1 -0
  340. package/lib/typescript/rum/instrumentation/resourceTracking/graphql/graphqlHeaders.d.ts.map +1 -0
  341. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -0
  342. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts.map +1 -0
  343. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -0
  344. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.d.ts.map +1 -0
  345. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts +1 -0
  346. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/resourceTiming.d.ts.map +1 -0
  347. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts +1 -0
  348. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.d.ts.map +1 -0
  349. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -0
  350. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -0
  351. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -0
  352. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts.map +1 -0
  353. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -0
  354. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts.map +1 -0
  355. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -0
  356. package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -0
  357. package/lib/typescript/rum/types.d.ts +1 -0
  358. package/lib/typescript/rum/types.d.ts.map +1 -0
  359. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +1 -0
  360. package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -0
  361. package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -0
  362. package/lib/typescript/sdk/AttributesSingleton/types.d.ts.map +1 -0
  363. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts +1 -0
  364. package/lib/typescript/sdk/DatadogProvider/Buffer/BoundedBuffer.d.ts.map +1 -0
  365. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts +1 -0
  366. package/lib/typescript/sdk/DatadogProvider/Buffer/BufferSingleton.d.ts.map +1 -0
  367. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts +1 -0
  368. package/lib/typescript/sdk/DatadogProvider/Buffer/DatadogBuffer.d.ts.map +1 -0
  369. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts +1 -0
  370. package/lib/typescript/sdk/DatadogProvider/Buffer/PassThroughBuffer.d.ts.map +1 -0
  371. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts +1 -0
  372. package/lib/typescript/sdk/DatadogProvider/Buffer/bufferNativeCall.d.ts.map +1 -0
  373. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +1 -0
  374. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -0
  375. package/lib/typescript/sdk/DdSdk.d.ts +1 -0
  376. package/lib/typescript/sdk/DdSdk.d.ts.map +1 -0
  377. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -0
  378. package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -0
  379. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +1 -0
  380. package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts.map +1 -0
  381. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +1 -0
  382. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +1 -0
  383. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +1 -0
  384. package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -0
  385. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +1 -0
  386. package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -0
  387. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -0
  388. package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -0
  389. package/lib/typescript/specs/NativeDdLogs.d.ts +1 -0
  390. package/lib/typescript/specs/NativeDdLogs.d.ts.map +1 -0
  391. package/lib/typescript/specs/NativeDdRum.d.ts +3 -1
  392. package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -0
  393. package/lib/typescript/specs/NativeDdSdk.d.ts +1 -0
  394. package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -0
  395. package/lib/typescript/specs/NativeDdTrace.d.ts +1 -0
  396. package/lib/typescript/specs/NativeDdTrace.d.ts.map +1 -0
  397. package/lib/typescript/trace/DdTrace.d.ts +1 -0
  398. package/lib/typescript/trace/DdTrace.d.ts.map +1 -0
  399. package/lib/typescript/types.d.ts +1 -0
  400. package/lib/typescript/types.d.ts.map +1 -0
  401. package/lib/typescript/utils/Timer.d.ts +1 -0
  402. package/lib/typescript/utils/Timer.d.ts.map +1 -0
  403. package/lib/typescript/utils/argsUtils.d.ts +1 -0
  404. package/lib/typescript/utils/argsUtils.d.ts.map +1 -0
  405. package/lib/typescript/utils/errorUtils.d.ts +1 -0
  406. package/lib/typescript/utils/errorUtils.d.ts.map +1 -0
  407. package/lib/typescript/utils/jsUtils.d.ts +1 -0
  408. package/lib/typescript/utils/jsUtils.d.ts.map +1 -0
  409. package/lib/typescript/utils/longTasksUtils.d.ts +1 -0
  410. package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -0
  411. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts +1 -0
  412. package/lib/typescript/utils/time-provider/DefaultTimeProvider.d.ts.map +1 -0
  413. package/lib/typescript/utils/time-provider/TimeProvider.d.ts +1 -0
  414. package/lib/typescript/utils/time-provider/TimeProvider.d.ts.map +1 -0
  415. package/lib/typescript/version.d.ts +2 -1
  416. package/lib/typescript/version.d.ts.map +1 -0
  417. package/package.json +3 -3
  418. package/src/__tests__/DdSdkReactNative.test.tsx +2 -1
  419. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +32 -16
  420. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +17 -15
  421. package/src/logs/DdLogs.ts +25 -8
  422. package/src/logs/__tests__/DdLogs.test.ts +122 -0
  423. package/src/logs/types.ts +5 -1
  424. package/src/nativeModulesTypes.ts +3 -1
  425. package/src/rum/DdAttributes.ts +20 -0
  426. package/src/rum/DdRum.ts +11 -6
  427. package/src/rum/__tests__/DdRum.test.ts +40 -4
  428. package/src/rum/eventMappers/errorEventMapper.ts +2 -0
  429. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +33 -10
  430. package/src/rum/instrumentation/interactionTracking/getJsxRuntime.ts +10 -3
  431. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -1
  432. package/src/specs/NativeDdRum.ts +3 -1
  433. package/src/version.ts +1 -1
  434. package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +0 -41
@@ -3,26 +3,25 @@
3
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
+
6
7
  import { DatadogProviderConfiguration, DEFAULTS } from '../../DdSdkReactNativeConfiguration';
7
8
  import { SdkVerbosity } from '../../SdkVerbosity';
8
9
  import { TrackingConsent } from '../../TrackingConsent';
9
10
  import { PropagatorType } from '../../rum/types';
10
11
  export class FileBasedConfiguration extends DatadogProviderConfiguration {
11
12
  constructor(params) {
12
- const configuration = getJSONConfiguration(params === null || params === void 0 ? void 0 : params.configuration);
13
+ const configuration = getJSONConfiguration(params?.configuration);
13
14
  super(configuration.clientToken, configuration.env, configuration.applicationId, configuration.trackInteractions, configuration.trackResources, configuration.trackErrors, configuration.trackingConsent);
14
15
  this.longTaskThresholdMs = configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;
15
16
  this.verbosity = configuration.verbosity;
16
17
  this.actionNameAttribute = configuration.actionNameAttribute;
17
18
  this.resourceTracingSamplingRate = configuration.resourceTracingSamplingRate || DEFAULTS.resourceTracingSamplingRate;
18
19
  this.firstPartyHosts = configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();
19
- this.errorEventMapper = (params === null || params === void 0 ? void 0 : params.errorEventMapper) || DEFAULTS.errorEventMapper;
20
- this.resourceEventMapper = (params === null || params === void 0 ? void 0 : params.resourceEventMapper) || DEFAULTS.resourceEventMapper;
21
- this.actionEventMapper = (params === null || params === void 0 ? void 0 : params.actionEventMapper) || DEFAULTS.actionEventMapper;
20
+ this.errorEventMapper = params?.errorEventMapper || DEFAULTS.errorEventMapper;
21
+ this.resourceEventMapper = params?.resourceEventMapper || DEFAULTS.resourceEventMapper;
22
+ this.actionEventMapper = params?.actionEventMapper || DEFAULTS.actionEventMapper;
22
23
  }
23
-
24
24
  }
25
-
26
25
  const resolveJSONConfiguration = userSpecifiedConfiguration => {
27
26
  if (userSpecifiedConfiguration === undefined || userSpecifiedConfiguration === null) {
28
27
  try {
@@ -30,7 +29,6 @@ const resolveJSONConfiguration = userSpecifiedConfiguration => {
30
29
  // /!\ We have to write the require this way as dynamic requires are not supported by Hermes.
31
30
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
32
31
  const jsonContent = require('../../../../../../datadog-configuration.json');
33
-
34
32
  if (typeof jsonContent !== 'object' || !jsonContent['configuration']) {
35
33
  console.error(`Failed to parse the Datadog configuration file located at the root of the project.
36
34
  Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
@@ -40,7 +38,6 @@ You can use VSCode to check your configuration by adding the following line to y
40
38
  }`);
41
39
  return {};
42
40
  }
43
-
44
41
  return jsonContent.configuration;
45
42
  } catch (error) {
46
43
  console.error(`Failed to read Datadog configuration file at the root of the project.
@@ -51,7 +48,6 @@ new FileBasedConfiguration({configuration: require('./file/to/configuration-file
51
48
  return {};
52
49
  }
53
50
  }
54
-
55
51
  if (typeof userSpecifiedConfiguration !== 'object' || !userSpecifiedConfiguration['configuration']) {
56
52
  console.error(`Failed to parse the Datadog configuration file you provided.
57
53
  Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
@@ -61,10 +57,8 @@ You can use VSCode to check your configuration by adding the following line to y
61
57
  }`);
62
58
  return {};
63
59
  }
64
-
65
60
  return userSpecifiedConfiguration['configuration'];
66
61
  };
67
-
68
62
  export const getJSONConfiguration = userSpecifiedConfiguration => {
69
63
  const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);
70
64
  return {
@@ -82,12 +76,10 @@ export const getJSONConfiguration = userSpecifiedConfiguration => {
82
76
  firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)
83
77
  };
84
78
  };
85
-
86
79
  const buildFirstPartyHosts = firstPartyHosts => {
87
80
  if (!firstPartyHosts) {
88
81
  return undefined;
89
82
  }
90
-
91
83
  try {
92
84
  return firstPartyHosts.map(({
93
85
  match,
@@ -104,90 +96,74 @@ The first party hosts will not be set for this session.
104
96
  return undefined;
105
97
  }
106
98
  };
107
-
108
99
  export const formatPropagatorType = propagatorType => {
109
100
  switch (propagatorType.toLowerCase()) {
110
101
  case 'b3':
111
102
  {
112
103
  return PropagatorType.B3;
113
104
  }
114
-
115
105
  case 'b3multi':
116
106
  {
117
107
  return PropagatorType.B3MULTI;
118
108
  }
119
-
120
109
  case 'datadog':
121
110
  {
122
111
  return PropagatorType.DATADOG;
123
112
  }
124
-
125
113
  case 'tracecontext':
126
114
  {
127
115
  return PropagatorType.TRACECONTEXT;
128
116
  }
129
-
130
117
  default:
131
118
  {
132
119
  throw new Error(`Failed to parse propagator type ${propagatorType}.`);
133
120
  }
134
121
  }
135
122
  };
136
-
137
123
  const buildTrackingConsent = trackingConsent => {
138
124
  if (trackingConsent === undefined) {
139
125
  return undefined;
140
126
  }
141
-
142
127
  switch (trackingConsent.toLowerCase()) {
143
128
  case 'granted':
144
129
  {
145
130
  return TrackingConsent.GRANTED;
146
131
  }
147
-
148
132
  case 'pending':
149
133
  {
150
134
  return TrackingConsent.PENDING;
151
135
  }
152
-
153
136
  case 'not_granted':
154
137
  {
155
138
  return TrackingConsent.NOT_GRANTED;
156
139
  }
157
-
158
140
  default:
159
141
  {
160
142
  return DEFAULTS.trackingConsent;
161
143
  }
162
144
  }
163
145
  };
164
-
165
146
  const buildSdkVerbosity = verbosity => {
166
147
  if (verbosity === undefined) {
167
148
  return undefined;
168
149
  }
169
-
170
150
  switch (verbosity.toLowerCase()) {
171
151
  case 'debug':
172
152
  {
173
153
  return SdkVerbosity.DEBUG;
174
154
  }
175
-
176
155
  case 'info':
177
156
  {
178
157
  return SdkVerbosity.INFO;
179
158
  }
180
-
181
159
  case 'warn':
182
160
  {
183
161
  return SdkVerbosity.WARN;
184
162
  }
185
-
186
163
  case 'error':
187
164
  {
188
165
  return SdkVerbosity.ERROR;
189
166
  }
190
-
191
167
  default:
192
168
  {
193
169
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["FileBasedConfiguration.ts"],"names":["DatadogProviderConfiguration","DEFAULTS","SdkVerbosity","TrackingConsent","PropagatorType","FileBasedConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","GRANTED","PENDING","NOT_GRANTED","DEBUG","INFO","WARN","ERROR"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAGA,SACIA,4BADJ,EAEIC,QAFJ,QAGO,qCAHP;AAIA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AAIA,SAASC,cAAT,QAA+B,iBAA/B;AAEA,OAAO,MAAMC,sBAAN,SAAqCL,4BAArC,CAAkE;AACrEM,EAAAA,WAAW,CAACC,MAAD,EAKR;AACC,UAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAD,aAACA,MAAD,uBAACA,MAAM,CAAEC,aAAT,CAA1C;AACA,UACIA,aAAa,CAACE,WADlB,EAEIF,aAAa,CAACG,GAFlB,EAGIH,aAAa,CAACI,aAHlB,EAIIJ,aAAa,CAACK,iBAJlB,EAKIL,aAAa,CAACM,cALlB,EAMIN,aAAa,CAACO,WANlB,EAOIP,aAAa,CAACQ,eAPlB;AASA,SAAKC,mBAAL,GACIT,aAAa,CAACS,mBAAd,IAAqChB,QAAQ,CAACgB,mBADlD;AAEA,SAAKC,SAAL,GAAiBV,aAAa,CAACU,SAA/B;AACA,SAAKC,mBAAL,GAA2BX,aAAa,CAACW,mBAAzC;AACA,SAAKC,2BAAL,GACIZ,aAAa,CAACY,2BAAd,IACAnB,QAAQ,CAACmB,2BAFb;AAGA,SAAKC,eAAL,GACIb,aAAa,CAACa,eAAd,IAAiCpB,QAAQ,CAACqB,kBAAT,EADrC;AAEA,SAAKC,gBAAL,GACI,CAAAhB,MAAM,SAAN,IAAAA,MAAM,W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* 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 { FirstPartyHostsConfiguration } from '../../DdSdkReactNativeConfiguration';\nimport {\n DatadogProviderConfiguration,\n DEFAULTS\n} from '../../DdSdkReactNativeConfiguration';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { TrackingConsent } from '../../TrackingConsent';\nimport type { ActionEventMapper } from '../../rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from '../../rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMapper';\nimport { PropagatorType } from '../../rum/types';\n\nexport class FileBasedConfiguration extends DatadogProviderConfiguration {\n constructor(params?: {\n configuration?: unknown;\n errorEventMapper?: ErrorEventMapper;\n resourceEventMapper?: ResourceEventMapper;\n actionEventMapper?: ActionEventMapper;\n }) {\n const configuration = getJSONConfiguration(params?.configuration);\n super(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.trackInteractions,\n configuration.trackResources,\n configuration.trackErrors,\n configuration.trackingConsent\n );\n this.longTaskThresholdMs =\n configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;\n this.verbosity = configuration.verbosity;\n this.actionNameAttribute = configuration.actionNameAttribute;\n this.resourceTracingSamplingRate =\n configuration.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate;\n this.firstPartyHosts =\n configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();\n this.errorEventMapper =\n params?.errorEventMapper || DEFAULTS.errorEventMapper;\n this.resourceEventMapper =\n params?.resourceEventMapper || DEFAULTS.resourceEventMapper;\n this.actionEventMapper =\n params?.actionEventMapper || DEFAULTS.actionEventMapper;\n }\n}\n\nconst resolveJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): Record<string, any> => {\n if (\n userSpecifiedConfiguration === undefined ||\n userSpecifiedConfiguration === null\n ) {\n try {\n // This corresponds to a file located at the root of a RN project.\n // /!\\ We have to write the require this way as dynamic requires are not supported by Hermes.\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonContent = require('../../../../../../datadog-configuration.json');\n\n if (\n typeof jsonContent !== 'object' ||\n !jsonContent['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file located at the root of the project.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return jsonContent.configuration as Record<string, any>;\n } catch (error) {\n console.error(`Failed to read Datadog configuration file at the root of the project.\nIf you don't have a datadog-configuration.json file at the same level as your node_modules directory,\\\nplease use the following syntax:\\n\nnew FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})\n`);\n return {};\n }\n }\n if (\n typeof userSpecifiedConfiguration !== 'object' ||\n !(userSpecifiedConfiguration as any)['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file you provided.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return (userSpecifiedConfiguration as any)['configuration'] as Record<\n string,\n any\n >;\n};\n\nexport const getJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): {\n clientToken: string;\n env: string;\n applicationId: string;\n trackInteractions: boolean | undefined;\n trackResources: boolean | undefined;\n trackErrors: boolean | undefined;\n trackingConsent: TrackingConsent | undefined;\n longTaskThresholdMs: number | undefined;\n verbosity: SdkVerbosity | undefined;\n actionNameAttribute: string | undefined;\n resourceTracingSamplingRate: number | undefined;\n firstPartyHosts: FirstPartyHostsConfiguration | undefined;\n} => {\n const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);\n\n return {\n clientToken: configuration.clientToken,\n env: configuration.env,\n applicationId: configuration.applicationId,\n trackInteractions: configuration.trackInteractions,\n trackResources: configuration.trackResources,\n trackErrors: configuration.trackErrors,\n trackingConsent: buildTrackingConsent(configuration.trackingConsent),\n longTaskThresholdMs: configuration.longTaskThresholdMs,\n verbosity: buildSdkVerbosity(configuration.verbosity),\n actionNameAttribute: configuration.actionNameAttribute,\n resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)\n };\n};\n\nconst buildFirstPartyHosts = (\n firstPartyHosts: { match: string; propagatorTypes: string[] }[] | undefined\n): FirstPartyHostsConfiguration | undefined => {\n if (!firstPartyHosts) {\n return undefined;\n }\n\n try {\n return firstPartyHosts.map(({ match, propagatorTypes }) => ({\n match,\n propagatorTypes: propagatorTypes.map(formatPropagatorType)\n }));\n } catch (error) {\n console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:\n${(error as any).message}\nThe first party hosts will not be set for this session.\n`);\n return undefined;\n }\n};\n\nexport const formatPropagatorType = (\n propagatorType: string\n): PropagatorType => {\n switch (propagatorType.toLowerCase()) {\n case 'b3': {\n return PropagatorType.B3;\n }\n case 'b3multi': {\n return PropagatorType.B3MULTI;\n }\n case 'datadog': {\n return PropagatorType.DATADOG;\n }\n case 'tracecontext': {\n return PropagatorType.TRACECONTEXT;\n }\n default: {\n throw new Error(\n `Failed to parse propagator type ${propagatorType}.`\n );\n }\n }\n};\n\nconst buildTrackingConsent = (\n trackingConsent: string | undefined\n): TrackingConsent | undefined => {\n if (trackingConsent === undefined) {\n return undefined;\n }\n switch (trackingConsent.toLowerCase()) {\n case 'granted': {\n return TrackingConsent.GRANTED;\n }\n case 'pending': {\n return TrackingConsent.PENDING;\n }\n case 'not_granted': {\n return TrackingConsent.NOT_GRANTED;\n }\n default: {\n return DEFAULTS.trackingConsent;\n }\n }\n};\n\nconst buildSdkVerbosity = (\n verbosity: string | undefined\n): SdkVerbosity | undefined => {\n if (verbosity === undefined) {\n return undefined;\n }\n switch (verbosity.toLowerCase()) {\n case 'debug': {\n return SdkVerbosity.DEBUG;\n }\n case 'info': {\n return SdkVerbosity.INFO;\n }\n case 'warn': {\n return SdkVerbosity.WARN;\n }\n case 'error': {\n return SdkVerbosity.ERROR;\n }\n default: {\n return undefined;\n }\n }\n};\n"]}
1
+ {"version":3,"names":["DatadogProviderConfiguration","DEFAULTS","SdkVerbosity","TrackingConsent","PropagatorType","FileBasedConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","GRANTED","PENDING","NOT_GRANTED","DEBUG","INFO","WARN","ERROR"],"sourceRoot":"../../../../src","sources":["sdk/FileBasedConfiguration/FileBasedConfiguration.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAGA,SACIA,4BAA4B,EAC5BC,QAAQ,QACL,qCAAqC;AAC5C,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,eAAe,QAAQ,uBAAuB;AAIvD,SAASC,cAAc,QAAQ,iBAAiB;AAEhD,OAAO,MAAMC,sBAAsB,SAASL,4BAA4B,CAAC;EACrEM,WAAWA,CAACC,MAKX,EAAE;IACC,MAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAM,EAAEC,aAAa,CAAC;IACjE,KAAK,CACDA,aAAa,CAACE,WAAW,EACzBF,aAAa,CAACG,GAAG,EACjBH,aAAa,CAACI,aAAa,EAC3BJ,aAAa,CAACK,iBAAiB,EAC/BL,aA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AAK,MAAM;MAAE;QACT,OAAOjD,YAAY,CAACkD,IAAI;MAC5B;IACA,KAAK,MAAM;MAAE;QACT,OAAOlD,YAAY,CAACmD,IAAI;MAC5B;IACA,KAAK,OAAO;MAAE;QACV,OAAOnD,YAAY,CAACoD,KAAK;MAC7B;IACA;MAAS;QACL,OAAO1B,SAAS;MACpB;EACJ;AACJ,CAAC","ignoreList":[]}
@@ -1,5 +1,3 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /*
4
2
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
5
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
@@ -11,19 +9,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
11
9
  * the SDK classes.
12
10
  */
13
11
  export class GlobalState {
14
- constructor() {
15
- _defineProperty(this, "isInitialized", false);
16
- }
12
+ /**
13
+ * `true` if the SDK is initialized, `false` otherwise.
14
+ */
15
+ isInitialized = false;
17
16
 
17
+ // Singleton implementation
18
+ static _instance = undefined;
18
19
  static get instance() {
19
20
  if (this._instance === undefined) {
20
21
  this._instance = new GlobalState();
21
22
  }
22
-
23
23
  return this._instance;
24
24
  }
25
-
26
25
  }
27
-
28
- _defineProperty(GlobalState, "_instance", undefined);
29
26
  //# sourceMappingURL=GlobalState.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["GlobalState.tsx"],"names":["GlobalState","instance","_instance","undefined"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAN,CAAkB;AAAA;AAAA,2CAIE,KAJF;AAAA;;AAQK,aAARC,QAAQ,GAAgB;AACtC,QAAI,KAAKC,SAAL,KAAmBC,SAAvB,EAAkC;AAC9B,WAAKD,SAAL,GAAiB,IAAIF,WAAJ,EAAjB;AACH;;AAED,WAAO,KAAKE,SAAZ;AACH;;AAdoB;;gBAAZF,W,eAO2CG,S","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A singleton container for attributes that are shared internally across all\n * the SDK classes.\n */\nexport class GlobalState {\n /**\n * `true` if the SDK is initialized, `false` otherwise.\n */\n public isInitialized = false;\n\n // Singleton implementation\n private static _instance: GlobalState | undefined = undefined;\n public static get instance(): GlobalState {\n if (this._instance === undefined) {\n this._instance = new GlobalState();\n }\n\n return this._instance;\n }\n}\n"]}
1
+ {"version":3,"names":["GlobalState","isInitialized","_instance","undefined","instance"],"sourceRoot":"../../../../src","sources":["sdk/GlobalState/GlobalState.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,CAAC;EACrB;AACJ;AACA;EACWC,aAAa,GAAG,KAAK;;EAE5B;EACA,OAAeC,SAAS,GAA4BC,SAAS;EAC7D,WAAkBC,QAAQA,CAAA,EAAgB;IACtC,IAAI,IAAI,CAACF,SAAS,KAAKC,SAAS,EAAE;MAC9B,IAAI,CAACD,SAAS,GAAG,IAAIF,WAAW,CAAC,CAAC;IACtC;IAEA,OAAO,IAAI,CAACE,SAAS;EACzB;AACJ","ignoreList":[]}
@@ -1,34 +1,25 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /*
4
2
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
5
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
6
4
  * Copyright 2016-Present Datadog, Inc.
7
5
  */
8
- class UserInfoProvider {
9
- constructor() {
10
- _defineProperty(this, "userInfo", {});
11
-
12
- _defineProperty(this, "setUserInfo", userInfo => {
13
- this.userInfo = userInfo;
14
- });
15
-
16
- _defineProperty(this, "getUserInfo", () => {
17
- return this.userInfo;
18
- });
19
- }
20
6
 
7
+ class UserInfoProvider {
8
+ userInfo = {};
9
+ setUserInfo = userInfo => {
10
+ this.userInfo = userInfo;
11
+ };
12
+ getUserInfo = () => {
13
+ return this.userInfo;
14
+ };
15
+ }
16
+ export class UserInfoSingleton {
17
+ static userInfoProvider = new UserInfoProvider();
18
+ static getInstance = () => {
19
+ return UserInfoSingleton.userInfoProvider;
20
+ };
21
+ static reset = () => {
22
+ UserInfoSingleton.userInfoProvider = new UserInfoProvider();
23
+ };
21
24
  }
22
-
23
- export class UserInfoSingleton {}
24
-
25
- _defineProperty(UserInfoSingleton, "userInfoProvider", new UserInfoProvider());
26
-
27
- _defineProperty(UserInfoSingleton, "getInstance", () => {
28
- return UserInfoSingleton.userInfoProvider;
29
- });
30
-
31
- _defineProperty(UserInfoSingleton, "reset", () => {
32
- UserInfoSingleton.userInfoProvider = new UserInfoProvider();
33
- });
34
25
  //# sourceMappingURL=UserInfoSingleton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["UserInfoSingleton.ts"],"names":["UserInfoProvider","userInfo","UserInfoSingleton","userInfoProvider"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,MAAMA,gBAAN,CAAuB;AAAA;AAAA,sCACU,EADV;;AAAA,yCAGJC,QAAD,IAAwB;AAClC,WAAKA,QAAL,GAAgBA,QAAhB;AACH,KALkB;;AAAA,yCAOL,MAAgB;AAC1B,aAAO,KAAKA,QAAZ;AACH,KATkB;AAAA;;AAAA;;AAYvB,OAAO,MAAMC,iBAAN,CAAwB;;gBAAlBA,iB,sBACyB,IAAIF,gBAAJ,E;;gBADzBE,iB,iBAGY,MAAwB;AACzC,SAAOA,iBAAiB,CAACC,gBAAzB;AACH,C;;gBALQD,iB,WAOM,MAAM;AACjBA,EAAAA,iBAAiB,CAACC,gBAAlB,GAAqC,IAAIH,gBAAJ,EAArC;AACH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { UserInfo } from './types';\n\nclass UserInfoProvider {\n private userInfo: UserInfo = {};\n\n setUserInfo = (userInfo: UserInfo) => {\n this.userInfo = userInfo;\n };\n\n getUserInfo = (): UserInfo => {\n return this.userInfo;\n };\n}\n\nexport class UserInfoSingleton {\n private static userInfoProvider = new UserInfoProvider();\n\n static getInstance = (): UserInfoProvider => {\n return UserInfoSingleton.userInfoProvider;\n };\n\n static reset = () => {\n UserInfoSingleton.userInfoProvider = new UserInfoProvider();\n };\n}\n"]}
1
+ {"version":3,"names":["UserInfoProvider","userInfo","setUserInfo","getUserInfo","UserInfoSingleton","userInfoProvider","getInstance","reset"],"sourceRoot":"../../../../src","sources":["sdk/UserInfoSingleton/UserInfoSingleton.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAIA,MAAMA,gBAAgB,CAAC;EACXC,QAAQ,GAAa,CAAC,CAAC;EAE/BC,WAAW,GAAID,QAAkB,IAAK;IAClC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B,CAAC;EAEDE,WAAW,GAAGA,CAAA,KAAgB;IAC1B,OAAO,IAAI,CAACF,QAAQ;EACxB,CAAC;AACL;AAEA,OAAO,MAAMG,iBAAiB,CAAC;EAC3B,OAAeC,gBAAgB,GAAG,IAAIL,gBAAgB,CAAC,CAAC;EAExD,OAAOM,WAAW,GAAGA,CAAA,KAAwB;IACzC,OAAOF,iBAAiB,CAACC,gBAAgB;EAC7C,CAAC;EAED,OAAOE,KAAK,GAAGA,CAAA,KAAM;IACjBH,iBAAiB,CAACC,gBAAgB,GAAG,IAAIL,gBAAgB,CAAC,CAAC;EAC/D,CAAC;AACL","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["sdk/UserInfoSingleton/types.ts"],"mappings":"","ignoreList":[]}
@@ -5,7 +5,9 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable @typescript-eslint/ban-types */
8
+
8
9
  import { TurboModuleRegistry } from 'react-native';
10
+
9
11
  /**
10
12
  * Do not import this Spec directly, use DdNativeLogsType instead.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdLogs.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AAiGA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,QAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeLogsType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Send a log with DEBUG level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly debug: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with INFO level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly info: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with WARN level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly warn: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log with ERROR level.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n readonly error: (message: string, context: Object) => Promise<void>;\n\n /**\n * Send a log containing an error with DEBUG level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly debugWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with INFO level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly infoWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with WARN level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly warnWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n\n /**\n * Send a log containing an error with ERROR level.\n * @param message: The message to send.\n * @param errorKind: The error kind to send.\n * @param errorMessage: The error message to send.\n * @param stacktrace: The stack trace to send.\n * @param context: The additional context to send.\n */\n readonly errorWithError: (\n message: string,\n errorKind: string,\n errorMessage: string,\n stacktrace: string,\n context: Object\n ) => Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdLogs');\n"]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdLogs.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAiGA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,QAAQ,CAAC","ignoreList":[]}
@@ -5,7 +5,9 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable @typescript-eslint/ban-types */
8
+
8
9
  import { TurboModuleRegistry } from 'react-native';
10
+
9
11
  /**
10
12
  * Do not import this Spec directly, use DdNativeRumType instead.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdRum.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA+IA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeRumType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(key: string, context: Object, timestampMs: number): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: string,\n size: number,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: string,\n stacktrace: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n\n /**\n * Stops the current RUM Session.\n */\n stopSession(): Promise<void>;\n\n /**\n * Adds the result of evaluating a feature flag with a given name and value to the view.\n * Feature flag evaluations are local to the active view and are cleared when the view is stopped.\n * @param name: The name of the feature flag\n * @param value: The value of the feature flag, encapsulated in an Object to accept all types\n */\n addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;\n\n /**\n * Get current Session ID, or `undefined` if not available.\n */\n getCurrentSessionId(): Promise<string | undefined>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdRum');\n"]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdRum.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAiJA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,OAAO,CAAC","ignoreList":[]}
@@ -5,7 +5,9 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable @typescript-eslint/ban-types */
8
+
8
9
  import { TurboModuleRegistry } from 'react-native';
10
+
9
11
  /**
10
12
  * Do not import this Spec directly, use DdNativeSdkType instead.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdSdk.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AAsDA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeSdkType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: Object): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: Object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: Object): Promise<Object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n\n /**\n * Send webview telemetry logs\n * @param message event description\n */\n consumeWebviewEvent(message: string): Promise<void>;\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n */\n clearAllData(): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdSdk');\n"]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdSdk.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AAsDA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,OAAO,CAAC","ignoreList":[]}
@@ -5,7 +5,9 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable @typescript-eslint/ban-types */
8
+
8
9
  import { TurboModuleRegistry } from 'react-native';
10
+
9
11
  /**
10
12
  * Do not import this Spec directly, use DdNativeTraceType instead.
11
13
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["NativeDdTrace.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA6BA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,SAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeTraceType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context: Object,\n timestampMs: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdTrace');\n"]}
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../../src","sources":["specs/NativeDdTrace.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;;AAElD;AACA;AACA;;AA6BA;AACA,eAAeA,mBAAmB,CAACC,GAAG,CAAO,SAAS,CAAC","ignoreList":[]}
@@ -1,35 +1,28 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /*
4
2
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
5
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
6
4
  * Copyright 2016-Present Datadog, Inc.
7
5
  */
6
+
8
7
  import { InternalLog } from '../InternalLog';
9
8
  import { SdkVerbosity } from '../SdkVerbosity';
10
9
  import { bufferNativeCallReturningId, bufferNativeCallWithId } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
11
10
  import { validateContext } from '../utils/argsUtils';
12
11
  import { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';
13
12
  const timeProvider = new DefaultTimeProvider();
14
-
15
13
  class DdTraceWrapper {
16
- constructor() {
17
- _defineProperty(this, "nativeTrace", require('../specs/NativeDdTrace').default);
18
-
19
- _defineProperty(this, "startSpan", (operation, context = {}, timestampMs = timeProvider.now()) => {
20
- const spanId = bufferNativeCallReturningId(() => this.nativeTrace.startSpan(operation, validateContext(context), timestampMs));
21
- InternalLog.log(`Starting span “${operation}” #${spanId}`, SdkVerbosity.DEBUG);
22
- return spanId;
23
- });
24
-
25
- _defineProperty(this, "finishSpan", (spanId, context = {}, timestampMs = timeProvider.now()) => {
26
- InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
27
- return bufferNativeCallWithId(id => this.nativeTrace.finishSpan(id, validateContext(context), timestampMs), spanId);
28
- });
29
- }
30
-
14
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
15
+ nativeTrace = require('../specs/NativeDdTrace').default;
16
+ startSpan = (operation, context = {}, timestampMs = timeProvider.now()) => {
17
+ const spanId = bufferNativeCallReturningId(() => this.nativeTrace.startSpan(operation, validateContext(context), timestampMs));
18
+ InternalLog.log(`Starting span “${operation}” #${spanId}`, SdkVerbosity.DEBUG);
19
+ return spanId;
20
+ };
21
+ finishSpan = (spanId, context = {}, timestampMs = timeProvider.now()) => {
22
+ InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
23
+ return bufferNativeCallWithId(id => this.nativeTrace.finishSpan(id, validateContext(context), timestampMs), spanId);
24
+ };
31
25
  }
32
-
33
26
  const DdTrace = new DdTraceWrapper();
34
27
  export { DdTrace };
35
28
  //# sourceMappingURL=DdTrace.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DdTrace.ts"],"names":["InternalLog","SdkVerbosity","bufferNativeCallReturningId","bufferNativeCallWithId","validateContext","DefaultTimeProvider","timeProvider","DdTraceWrapper","require","default","operation","context","timestampMs","now","spanId","nativeTrace","startSpan","log","DEBUG","id","finishSpan","DdTrace"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,WAAT,QAA4B,gBAA5B;AACA,SAASC,YAAT,QAA6B,iBAA7B;AAEA,SACIC,2BADJ,EAEIC,sBAFJ,QAGO,gDAHP;AAKA,SAASC,eAAT,QAAgC,oBAAhC;AACA,SAASC,mBAAT,QAAoC,4CAApC;AAEA,MAAMC,YAAY,GAAG,IAAID,mBAAJ,EAArB;;AAEA,MAAME,cAAN,CAA4C;AAAA;AAAA,yCAECC,OAAO,CAAC,wBAAD,CAAP,CACpCC,OAHmC;;AAAA,uCAK5B,CACRC,SADQ,EAERC,OAAe,GAAG,EAFV,EAGRC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAHd,KAIU;AAClB,YAAMC,MAAM,GAAGZ,2BAA2B,CAAC,MACvC,KAAKa,WAAL,CAAiBC,SAAjB,CACIN,SADJ,EAEIN,eAAe,CAACO,OAAD,CAFnB,EAGIC,WAHJ,CADsC,CAA1C;AAOAZ,MAAAA,WAAW,CAACiB,GAAZ,CACK,kBAAiBP,SAAU,MAAKI,MAAO,EAD5C,EAEIb,YAAY,CAACiB,KAFjB;AAIA,aAAOJ,MAAP;AACH,KAtBuC;;AAAA,wCAwB3B,CACTA,MADS,EAETH,OAAe,GAAG,EAFT,EAGTC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAHb,KAIO;AAChBb,MAAAA,WAAW,CAACiB,GAAZ,CAAiB,mBAAkBH,MAAO,EAA1C,EAA6Cb,YAAY,CAACiB,KAA1D;AACA,aAAOf,sBAAsB,CACzBgB,EAAE,IACE,KAAKJ,WAAL,CAAiBK,UAAjB,CACID,EADJ,EAEIf,eAAe,CAACO,OAAD,CAFnB,EAGIC,WAHJ,CAFqB,EAOzBE,MAPyB,CAA7B;AASH,KAvCuC;AAAA;;AAAA;;AA0C5C,MAAMO,OAAoB,GAAG,IAAId,cAAJ,EAA7B;AAEA,SAASc,OAAT","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 { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeTraceType } from '../nativeModulesTypes';\nimport {\n bufferNativeCallReturningId,\n bufferNativeCallWithId\n} from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\nimport type { DdTraceType } from '../types';\nimport { validateContext } from '../utils/argsUtils';\nimport { DefaultTimeProvider } from '../utils/time-provider/DefaultTimeProvider';\n\nconst timeProvider = new DefaultTimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n private nativeTrace: DdNativeTraceType = require('../specs/NativeDdTrace')\n .default;\n\n startSpan = (\n operation: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<string> => {\n const spanId = bufferNativeCallReturningId(() =>\n this.nativeTrace.startSpan(\n operation,\n validateContext(context),\n timestampMs\n )\n );\n InternalLog.log(\n `Starting span “${operation}” #${spanId}`,\n SdkVerbosity.DEBUG\n );\n return spanId;\n };\n\n finishSpan = (\n spanId: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> => {\n InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId(\n id =>\n this.nativeTrace.finishSpan(\n id,\n validateContext(context),\n timestampMs\n ),\n spanId\n );\n };\n}\n\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdTrace };\n"]}
1
+ {"version":3,"names":["InternalLog","SdkVerbosity","bufferNativeCallReturningId","bufferNativeCallWithId","validateContext","DefaultTimeProvider","timeProvider","DdTraceWrapper","nativeTrace","require","default","startSpan","operation","context","timestampMs","now","spanId","log","DEBUG","finishSpan","id","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C,CAAC;AAEjD,SAASc,OAAO","ignoreList":[]}
@@ -36,9 +36,13 @@ export class DdSdkConfiguration {
36
36
  this.bundleLogsWithRum = bundleLogsWithRum;
37
37
  this.bundleLogsWithTraces = bundleLogsWithTraces;
38
38
  }
39
-
40
39
  }
40
+
41
41
  /**
42
42
  * The entry point to initialize Datadog's features.
43
43
  */
44
+
45
+ /**
46
+ * The entry point to use Datadog's Trace feature.
47
+ */
44
48
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,uBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,eAbF,EAcEC,SAdF,EAeEC,iBAfF,EAgBEC,qBAhBF,EAiBEC,eAjBF,EAsBEC,yBAtBF,EA8BEC,kBA9BF,EA+BEC,yBA/BF,EAgCEC,SAhCF,EAiCEC,WAjCF,EA0CEC,WA1CF,EA2CEC,eA3CF,EA+CEC,iBA/CF,EAgDEC,oBAhDF,EAiDT;AAAA,SAhDWzB,WAgDX,GAhDWA,WAgDX;AAAA,SA/CWC,GA+CX,GA/CWA,GA+CX;AAAA,SA9CWC,aA8CX,GA9CWA,aA8CX;AAAA,SA7CWC,wBA6CX,GA7CWA,wBA6CX;AAAA,SA5CWC,yBA4CX,GA5CWA,yBA4CX;AAAA,SA3CWC,mBA2CX,GA3CWA,mBA2CX;AAAA,SA1CWC,UA0CX,GA1CWA,UA0CX;AAAA,SAzCWC,IAyCX,GAzCWA,IAyCX;AAAA,SAxCWC,eAwCX,GAxCWA,eAwCX;AAAA,SAvCWC,uBAuCX,GAvCWA,uBAuCX;AAAA,SAtCWC,mBAsCX,GAtCWA,mBAsCX;AAAA,SArCWC,qBAqCX,GArCWA,qBAqCX;AAAA,SApCWC,eAoCX,GApCWA,eAoCX;AAAA,SAnCWC,SAmCX,GAnCWA,SAmCX;AAAA,SAlCWC,iBAkCX,GAlCWA,iBAkCX;AAAA,SAjCWC,qBAiCX,GAjCWA,qBAiCX;AAAA,SAhCWC,eAgCX,GAhCWA,eAgCX;AAAA,SA3BWC,yBA2BX,GA3BWA,yBA2BX;AAAA,SAnBWC,kBAmBX,GAnBWA,kBAmBX;AAAA,SAlBWC,yBAkBX,GAlBWA,yBAkBX;AAAA,SAjBWC,SAiBX,GAjBWA,SAiBX;AAAA,SAhBWC,WAgBX,GAhBWA,WAgBX;AAAA,SAPWC,WAOX,GAPWA,WAOX;AAAA,SANWC,eAMX,GANWA,eAMX;AAAA,SAFWC,iBAEX,GAFWA,iBAEX;AAAA,SADWC,oBACX,GADWA,oBACX;AAAE;;AAlDwB;AAqDhC;AACA;AACA","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/**\n * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfiguration: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly uploadFrequency: string,\n readonly batchSize: string,\n readonly trackFrustrations: boolean,\n readonly trackBackgroundEvents: boolean,\n readonly customEndpoints: {\n rum?: string;\n trace?: string;\n logs?: string;\n },\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n reactVersion: string;\n reactNativeVersion: string;\n },\n readonly nativeViewTracking: boolean,\n readonly nativeInteractionTracking: boolean,\n readonly verbosity: string | undefined,\n readonly proxyConfig:\n | {\n type: string;\n address: string;\n port: number;\n username?: string;\n password?: string;\n }\n | undefined,\n readonly serviceName: string | undefined,\n readonly firstPartyHosts: {\n match: string;\n propagatorTypes: string[];\n }[],\n readonly bundleLogsWithRum: boolean,\n readonly bundleLogsWithTraces: boolean\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
1
+ {"version":3,"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"sourceRoot":"../../src","sources":["types.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAkB,CAAC;EAC5BC,WAAWA,CACEC,WAAmB,EACnBC,GAAW,EACXC,aAAqB,EACrBC,wBAAiC,EACjCC,yBAAiC,EACjCC,mBAA2B,EAC3BC,UAAkB,EAClBC,IAAY,EACZC,eAAuB,EACvBC,uBAA+B,EAC/BC,mBAA2B,EAC3BC,qBAA6B,EAC7BC,eAAuB,EACvBC,SAAiB,EACjBC,iBAA0B,EAC1BC,qBAA8B,EAC9BC,eAIR,EACQC,yBAOR,EACQC,kBAA2B,EAC3BC,yBAAkC,EAClCC,SAA6B,EAC7BC,WAQM,EACNC,WAA+B,EAC/BC,eAGN,EACMC,iBAA0B,EAC1BC,oBAA6B,EACxC;IAAA,KAhDWzB,WAAmB,GAAnBA,WAAmB;IAAA,KACnBC,GAAW,GAAXA,GAAW;IAAA,KACXC,aAAqB,GAArBA,aAAqB;IAAA,KACrBC,wBAAiC,GAAjCA,wBAAiC;IAAA,KACjCC,yBAAiC,GAAjCA,yBAAiC;IAAA,KACjCC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAC3BC,UAAkB,GAAlBA,UAAkB;IAAA,KAClBC,IAAY,GAAZA,IAAY;IAAA,KACZC,eAAuB,GAAvBA,eAAuB;IAAA,KACvBC,uBAA+B,GAA/BA,uBAA+B;IAAA,KAC/BC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAC3BC,qBAA6B,GAA7BA,qBAA6B;IAAA,KAC7BC,eAAuB,GAAvBA,eAAuB;IAAA,KACvBC,SAAiB,GAAjBA,SAAiB;IAAA,KACjBC,iBAA0B,GAA1BA,iBAA0B;IAAA,KAC1BC,qBAA8B,GAA9BA,qBAA8B;IAAA,KAC9BC,eAIR,GAJQA,eAIR;IAAA,KACQC,yBAOR,GAPQA,yBAOR;IAAA,KACQC,kBAA2B,GAA3BA,kBAA2B;IAAA,KAC3BC,yBAAkC,GAAlCA,yBAAkC;IAAA,KAClCC,SAA6B,GAA7BA,SAA6B;IAAA,KAC7BC,WAQM,GARNA,WAQM;IAAA,KACNC,WAA+B,GAA/BA,WAA+B;IAAA,KAC/BC,eAGN,GAHMA,eAGN;IAAA,KACMC,iBAA0B,GAA1BA,iBAA0B;IAAA,KAC1BC,oBAA6B,GAA7BA,oBAA6B;EACvC;AACP;;AAEA;AACA;AACA;;AA2BA;AACA;AACA","ignoreList":[]}
@@ -1,51 +1,40 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
1
  /*
4
2
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
5
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
6
4
  * Copyright 2016-Present Datadog, Inc.
7
5
  */
6
+
8
7
  import { DefaultTimeProvider } from './time-provider/DefaultTimeProvider';
9
8
  const START_LABEL = '__start';
10
9
  const STOP_LABEL = '__stop';
10
+
11
11
  /**
12
12
  * Simple timer which records time ticks. Shouldn't be re-used once stopped.
13
13
  * All timestamps/durations returned are in milliseconds.
14
14
  */
15
-
16
15
  export default class Timer {
16
+ times = {};
17
17
  constructor(timeProvider = new DefaultTimeProvider()) {
18
- _defineProperty(this, "timeProvider", void 0);
19
-
20
- _defineProperty(this, "times", {});
21
-
22
18
  this.timeProvider = timeProvider;
23
19
  }
24
-
25
20
  get startTime() {
26
21
  return this.times[START_LABEL].unix;
27
22
  }
28
-
29
23
  get stopTime() {
30
24
  return this.startTime + this.durationBetween(START_LABEL, STOP_LABEL);
31
25
  }
32
-
33
26
  start() {
34
27
  this.recordTick(START_LABEL);
35
28
  }
36
-
37
29
  stop() {
38
30
  this.recordTick(STOP_LABEL);
39
31
  }
40
-
41
32
  recordTick(label) {
42
33
  this.times[label] = this.timeProvider.getTimestamp();
43
34
  }
44
-
45
35
  hasTickFor(label) {
46
36
  return label in this.times;
47
37
  }
48
-
49
38
  durationBetween(startLabel, endLabel) {
50
39
  this.checkLabelExists(startLabel);
51
40
  this.checkLabelExists(endLabel);
@@ -53,29 +42,23 @@ export default class Timer {
53
42
  const endTick = this.times[endLabel];
54
43
  return this.durationBetweenTicks(startTick, endTick);
55
44
  }
56
-
57
45
  timeAt(label) {
58
46
  this.checkLabelExists(label);
59
47
  return this.startTime + this.durationBetween(START_LABEL, label);
60
48
  }
61
-
62
49
  reset() {
63
50
  this.times = {};
64
51
  }
65
-
66
52
  durationBetweenTicks(start, end) {
67
53
  if (start.reactNative != null && end.reactNative != null) {
68
54
  return end.reactNative - start.reactNative;
69
55
  }
70
-
71
56
  return end.unix - start.unix;
72
57
  }
73
-
74
58
  checkLabelExists(label) {
75
59
  if (!this.hasTickFor(label)) {
76
60
  throw new Error(`Label ${label} is not registered`);
77
61
  }
78
62
  }
79
-
80
63
  }
81
64
  //# sourceMappingURL=Timer.js.map