@datadog/mobile-react-native 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +5 -5
  3. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -0
  5. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +124 -95
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +2 -0
  8. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +148 -25
  9. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
  10. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +2 -1
  11. package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +10 -0
  12. package/datadog-sourcemaps.gradle +6 -1
  13. package/ios/Sources/DdSdk.m +4 -0
  14. package/ios/Sources/DdSdk.swift +17 -0
  15. package/ios/Sources/DdSdkConfiguration.swift +6 -0
  16. package/ios/Sources/RNDdSdkConfiguration.swift +2 -0
  17. package/jest/mock.js +1 -1
  18. package/lib/commonjs/DdSdkReactNative.js +7 -7
  19. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  20. package/lib/commonjs/DdSdkReactNativeConfiguration.js +8 -1
  21. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  22. package/lib/commonjs/index.js +8 -8
  23. package/lib/commonjs/index.js.map +1 -1
  24. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  25. package/lib/commonjs/rum/DdRum.js +3 -3
  26. package/lib/commonjs/rum/DdRum.js.map +1 -1
  27. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -2
  28. package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  29. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +4 -4
  30. package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  31. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
  32. package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
  33. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
  34. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
  35. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
  36. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
  37. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js.map +1 -1
  38. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
  39. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
  40. package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
  41. package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
  42. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +2 -2
  43. package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  44. package/lib/commonjs/sdk/DdSdk.js +17 -0
  45. package/lib/commonjs/sdk/DdSdk.js.map +1 -0
  46. package/lib/commonjs/sdk/EventMappers/EventMapper.js +2 -2
  47. package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
  48. package/lib/commonjs/{foundation.js → trace/DdTrace.js} +9 -19
  49. package/lib/commonjs/trace/DdTrace.js.map +1 -0
  50. package/lib/commonjs/types.js +2 -1
  51. package/lib/commonjs/types.js.map +1 -1
  52. package/lib/commonjs/version.js +1 -1
  53. package/lib/commonjs/version.js.map +1 -1
  54. package/lib/module/DdSdkReactNative.js +2 -2
  55. package/lib/module/DdSdkReactNative.js.map +1 -1
  56. package/lib/module/DdSdkReactNativeConfiguration.js +8 -1
  57. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  58. package/lib/module/index.js +1 -1
  59. package/lib/module/index.js.map +1 -1
  60. package/lib/module/nativeModulesTypes.js.map +1 -1
  61. package/lib/module/rum/DdRum.js +1 -1
  62. package/lib/module/rum/DdRum.js.map +1 -1
  63. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +1 -1
  64. package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
  65. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
  66. package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
  67. package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
  68. package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js.map +1 -1
  69. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
  70. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
  71. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
  72. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
  73. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -0
  74. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
  75. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
  76. package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
  77. package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
  78. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +1 -1
  79. package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
  80. package/lib/module/sdk/DdSdk.js +9 -0
  81. package/lib/module/sdk/DdSdk.js.map +1 -0
  82. package/lib/module/sdk/EventMappers/EventMapper.js +1 -1
  83. package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
  84. package/lib/module/{foundation.js → trace/DdTrace.js} +9 -11
  85. package/lib/module/trace/DdTrace.js.map +1 -0
  86. package/lib/module/types.js +2 -1
  87. package/lib/module/types.js.map +1 -1
  88. package/lib/module/version.js +1 -1
  89. package/lib/module/version.js.map +1 -1
  90. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +5 -0
  91. package/lib/typescript/index.d.ts +1 -1
  92. package/lib/typescript/nativeModulesTypes.d.ts +5 -0
  93. package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.d.ts +1 -1
  94. package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.d.ts +1 -1
  95. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.d.ts +1 -1
  96. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -1
  97. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.d.ts +1 -1
  98. package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.d.ts +2 -2
  99. package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
  100. package/lib/typescript/sdk/DdSdk.d.ts +3 -0
  101. package/lib/typescript/trace/DdTrace.d.ts +3 -0
  102. package/lib/typescript/types.d.ts +2 -1
  103. package/lib/typescript/version.d.ts +1 -1
  104. package/package.json +76 -76
  105. package/src/DdSdkReactNative.tsx +2 -1
  106. package/src/DdSdkReactNativeConfiguration.tsx +8 -1
  107. package/src/__tests__/DdSdkReactNative.test.tsx +1 -1
  108. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
  109. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +1 -1
  110. package/src/index.tsx +1 -1
  111. package/src/nativeModulesTypes.ts +6 -0
  112. package/src/rum/DdRum.ts +1 -1
  113. package/src/rum/__tests__/DdRum.test.ts +1 -1
  114. package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +1 -1
  115. package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +5 -5
  116. package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.tsx +1 -1
  117. package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +1 -2
  118. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +2 -2
  119. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -2
  120. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/__utils__/ResourceMockFactory.ts +1 -1
  121. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.ts +1 -1
  122. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.ts +3 -3
  123. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.ts +6 -6
  124. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +9 -9
  125. package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
  126. package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
  127. package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +1 -1
  128. package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +1 -1
  129. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -1
  130. package/src/sdk/DdSdk.ts +13 -0
  131. package/src/sdk/EventMappers/EventMapper.ts +1 -1
  132. package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +1 -1
  133. package/src/trace/DdTrace.ts +54 -0
  134. package/src/types.tsx +1 -0
  135. package/src/version.ts +1 -1
  136. package/lib/commonjs/foundation.js.map +0 -1
  137. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
  138. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
  139. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
  140. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
  141. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
  142. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
  143. package/lib/module/foundation.js.map +0 -1
  144. package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
  145. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
  146. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
  147. package/lib/module/rum/instrumentation/resourceTracking/implementation/URLHostParser.js.map +0 -1
  148. package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
  149. package/lib/module/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
  150. package/lib/typescript/foundation.d.ts +0 -5
  151. package/src/foundation.tsx +0 -36
  152. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
  153. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
  154. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
  155. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
  156. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
  157. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
  158. /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
  159. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
  160. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
  161. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
  162. /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
  163. /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
  164. /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
  165. /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
  166. /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
  167. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
  168. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
  169. /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
  170. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
  171. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
  172. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
  173. /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
  174. /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.d.ts +0 -0
  175. /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.d.ts +0 -0
  176. /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.d.ts +0 -0
  177. /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +0 -0
  178. /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/distributedTracing.test.ts +0 -0
  179. /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/firstPartyHosts.test.ts +0 -0
  180. /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.ts +0 -0
  181. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +0 -0
  182. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.ts +0 -0
  183. /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/URLHostParser.test.ts +0 -0
  184. /package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +0 -0
@@ -61,7 +61,8 @@ const DEFAULTS = {
61
61
  logEventMapper: null,
62
62
  errorEventMapper: null,
63
63
  resourceEventMapper: null,
64
- actionEventMapper: null
64
+ actionEventMapper: null,
65
+ trackFrustrations: true
65
66
  };
66
67
  /**
67
68
  * The SDK configuration class.
@@ -160,6 +161,10 @@ class DdSdkReactNativeConfiguration {
160
161
  /**
161
162
  * Sets the preferred frequency for collecting mobile vitals.
162
163
  */
164
+
165
+ /**
166
+ * Enables tracking of frustration signals (error taps). Defaults to `true`.
167
+ */
163
168
  constructor(clientToken, env, applicationId, trackInteractions = false, trackResources = false, trackErrors = false, trackingConsent = DEFAULTS.trackingConsent) {
164
169
  this.clientToken = clientToken;
165
170
  this.env = env;
@@ -203,6 +208,8 @@ class DdSdkReactNativeConfiguration {
203
208
 
204
209
  _defineProperty(this, "vitalsUpdateFrequency", DEFAULTS.vitalsUpdateFrequency);
205
210
 
211
+ _defineProperty(this, "trackFrustrations", DEFAULTS.trackFrustrations);
212
+
206
213
  _defineProperty(this, "logEventMapper", DEFAULTS.logEventMapper);
207
214
 
208
215
  _defineProperty(this, "errorEventMapper", DEFAULTS.errorEventMapper);
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","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","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;AAcZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;AAMA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAC9BC,eADiC,IAEd;AACnB,SAAOA,eAAe,CAACC,GAAhB,CAAoBC,IAAI,IAAI;AAC/B,QAAIL,sBAAsB,CAACK,IAAD,CAA1B,EAAkC;AAC9B,aAAO;AACHC,QAAAA,KAAK,EAAED,IADJ;AAEHE,QAAAA,eAAe,EAAE,CAACC,sBAAeC,OAAhB;AAFd,OAAP;AAIH;;AACD,WAAOJ,IAAP;AACH,GARM,CAAP;AASH,CAZM;;;AAcP,MAAMK,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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B,CAACF,IAAD,CAA/B;AAAuCA,MAAAA;AAAvC,KADqB,EAErBG,gBAFqB,CAAzB;AAIH,GAPD;AASAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,6BADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAC5B;AAFpB,GADqB,EAKrBoC,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEJ,QAAQ,CAACtC;AAA3C,GADqB,EAErB8C,gBAFqB,CAAzB;AAIAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,gBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACd;AAFpB,GADqB,EAKrBsB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,kBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACb;AAFpB,GADqB,EAKrBqB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACZ;AAFpB,GADqB,EAKrBoB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACX;AAFpB,GADqB,EAKrBmB,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CAtEM;;;;AAwEA,MAAMI,4BAAN,SAA2CtB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BuB,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';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [PropagatorType.DATADOG]\n };\n }\n return host;\n });\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: FirstPartyHostsConfiguration = 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?: FirstPartyHostsConfiguration;\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: FirstPartyHostsConfiguration;\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"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA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AAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,kBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACd;AAFpB,GADqB,EAKrBsB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACb;AAFpB,GADqB,EAKrBqB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACZ;AAFpB,GADqB,EAKrBoB,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CAtEM;;;;AAwEA,MAAMI,4BAAN,SAA2CtB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BuB,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';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [PropagatorType.DATADOG]\n };\n }\n return host;\n });\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 trackFrustrations: true\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: FirstPartyHostsConfiguration = 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 /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\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?: FirstPartyHostsConfiguration;\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: FirstPartyHostsConfiguration;\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 readonly trackFrustrations?: boolean;\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"]}
@@ -63,12 +63,6 @@ Object.defineProperty(exports, "TrackingConsent", {
63
63
  return _TrackingConsent.TrackingConsent;
64
64
  }
65
65
  });
66
- Object.defineProperty(exports, "DdTrace", {
67
- enumerable: true,
68
- get: function () {
69
- return _foundation.DdTrace;
70
- }
71
- });
72
66
  Object.defineProperty(exports, "DdLogs", {
73
67
  enumerable: true,
74
68
  get: function () {
@@ -105,6 +99,12 @@ Object.defineProperty(exports, "DatadogProvider", {
105
99
  return _DatadogProvider.DatadogProvider;
106
100
  }
107
101
  });
102
+ Object.defineProperty(exports, "DdTrace", {
103
+ enumerable: true,
104
+ get: function () {
105
+ return _DdTrace.DdTrace;
106
+ }
107
+ });
108
108
 
109
109
  var _DdSdkReactNativeConfiguration = require("./DdSdkReactNativeConfiguration");
110
110
 
@@ -118,8 +118,6 @@ var _SdkVerbosity = require("./SdkVerbosity");
118
118
 
119
119
  var _TrackingConsent = require("./TrackingConsent");
120
120
 
121
- var _foundation = require("./foundation");
122
-
123
121
  var _DdLogs = require("./logs/DdLogs");
124
122
 
125
123
  var _DdRum = require("./rum/DdRum");
@@ -127,4 +125,6 @@ var _DdRum = require("./rum/DdRum");
127
125
  var _types = require("./rum/types");
128
126
 
129
127
  var _DatadogProvider = require("./sdk/DatadogProvider/DatadogProvider");
128
+
129
+ var _DdTrace = require("./trace/DdTrace");
130
130
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode,\n VitalsUpdateFrequency\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdTrace } from './foundation';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport { RumActionType, ErrorSource, PropagatorType } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity,\n VitalsUpdateFrequency,\n PropagatorType\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;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\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration,\n InitializationMode,\n VitalsUpdateFrequency\n} from './DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from './DdSdkReactNative';\nimport { InternalLog } from './InternalLog';\nimport { ProxyConfiguration, ProxyType } from './ProxyConfiguration';\nimport { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport { DdLogs } from './logs/DdLogs';\nimport { DdRum } from './rum/DdRum';\nimport { RumActionType, ErrorSource, PropagatorType } from './rum/types';\nimport { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';\nimport { DdTrace } from './trace/DdTrace';\n\nexport {\n DatadogProvider,\n DatadogProviderConfiguration,\n InitializationMode,\n DdLogs,\n DdTrace,\n DdRum,\n RumActionType,\n ErrorSource,\n DdSdkReactNativeConfiguration,\n DdSdkReactNative,\n InternalLog,\n ProxyConfiguration,\n ProxyType,\n TrackingConsent,\n SdkVerbosity,\n VitalsUpdateFrequency,\n PropagatorType\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,wBAAN,CAA+B;AAClCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EAST;AAAA,SARWP,WAQX,GARWA,WAQX;AAAA,SAPWC,GAOX,GAPWA,GAOX;AAAA,SANWC,aAMX,GANWA,aAMX;AAAA,SALWC,wBAKX,GALWA,wBAKX;AAAA,SAJWC,UAIX,GAJWA,UAIX;AAAA,SAHWC,IAGX,GAHWA,IAGX;AAAA,SAFWC,eAEX,GAFWA,eAEX;AAAA,SADWC,gBACX,GADWA,gBACX;AAAE;;AAV8B;AAatC;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 DdNativeSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdNativeSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdNativeSdkConfiguration): 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/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdNativeLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdNativeTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdNativeRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: ActionType,\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: ActionType,\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: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\ntype ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';\n\ntype ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\ntype ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';\n"]}
1
+ {"version":3,"sources":["nativeModulesTypes.ts"],"names":["DdNativeSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACO,MAAMA,wBAAN,CAA+B;AAClCC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EAST;AAAA,SARWP,WAQX,GARWA,WAQX;AAAA,SAPWC,GAOX,GAPWA,GAOX;AAAA,SANWC,aAMX,GANWA,aAMX;AAAA,SALWC,wBAKX,GALWA,wBAKX;AAAA,SAJWC,UAIX,GAJWA,UAIX;AAAA,SAHWC,IAGX,GAHWA,IAGX;AAAA,SAFWC,eAEX,GAFWA,eAEX;AAAA,SADWC,gBACX,GADWA,gBACX;AAAE;;AAV8B;AAatC;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 DdNativeSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdNativeSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdNativeSdkConfiguration): 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/**\n * The entry point to use Datadog's Logs feature.\n */\nexport type DdNativeLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdNativeTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdNativeRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: ActionType,\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: ActionType,\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: ActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\ntype ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';\n\ntype ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\ntype ErrorSource = 'NETWORK' | 'SOURCE' | 'CONSOLE' | 'WEBVIEW' | 'CUSTOM';\n"]}
@@ -13,10 +13,10 @@ var _SdkVerbosity = require("../SdkVerbosity");
13
13
 
14
14
  var _TimeProvider = require("../TimeProvider");
15
15
 
16
- var _foundation = require("../foundation");
17
-
18
16
  var _bufferNativeCall = require("../sdk/DatadogProvider/Buffer/bufferNativeCall");
19
17
 
18
+ var _DdSdk = require("../sdk/DdSdk");
19
+
20
20
  var _actionEventMapper = require("./eventMappers/actionEventMapper");
21
21
 
22
22
  var _errorEventMapper = require("./eventMappers/errorEventMapper");
@@ -65,7 +65,7 @@ class DdRumWrapper {
65
65
 
66
66
  if (isOldStopActionAPI(args)) {
67
67
  if (this.lastActionData) {
68
- _foundation.DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature');
68
+ _DdSdk.DdSdk.telemetryDebug('DDdRum.stopAction called with the old signature');
69
69
 
70
70
  const {
71
71
  type,
@@ -1 +1 @@
1
- {"version":3,"sources":["DdRum.ts"],"names":["timeProvider","TimeProvider","generateEmptyPromise","Promise","resolve","DdRumWrapper","NativeModules","DdRum","undefined","type","name","context","timestampMs","mappedEvent","actionEventMapper","applyEventMapper","nativeRum","stopAction","args","isNewStopActionAPI","now","isOldStopActionAPI","lastActionData","DdSdk","telemetryDebug","InternalLog","log","SdkVerbosity","WARN","startView","key","DEBUG","stopView","startAction","nativeCallArgs","getStopActionNativeCallArgs","callNativeStopAction","addAction","actionContext","startResource","method","url","stopResource","statusCode","kind","size","resourceContext","resourceEventMapper","addError","message","source","stacktrace","errorEventMapper","updatedContext","addTiming","registerErrorEventMapper","unregisterErrorEventMapper","registerResourceEventMapper","unregisterResourceEventMapper","registerActionEventMapper","unregisterActionEventMapper"],"mappings":";;;;;;;AAOA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAGA;;AAEA;;AAEA;;;;AAQA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,EAApC,CAAnC;;AAEA,MAAMC,YAAN,CAAwC;AAAA;AAAA,uCACCC,2BAAcC,KADf;;AAAA;;AAAA,8CAGT,gDAAyBC,SAAzB,CAHS;;AAAA,iDAIN,sDAA4BA,SAA5B,CAJM;;AAAA,+CAKR,kDAA0BA,SAA1B,CALQ;;AAAA,kDAoEL,CAC3BC,IAD2B,EAE3BC,IAF2B,EAG3BC,OAH2B,EAI3BC,WAJ2B,KAKX;AAChB,YAAMC,WAAW,GAAG,KAAKC,iBAAL,CA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AAL,GAAyB,kDAA0BA,iBAA1B,CAAzB;AACH;;AAED8C,EAAAA,2BAA2B,GAAG;AAC1B,SAAK9C,iBAAL,GAAyB,kDAA0BN,SAA1B,CAAzB;AACH;;AA/TmC;;AAkUxC,MAAMW,kBAAkB,GACpBD,IADuB,IActB;AACD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAA1B;AACH,CAhBD;;AAkBA,MAAMG,kBAAkB,GACpBH,IADuB,IAS4B;AACnD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IAA+B,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,WAAzD;AACH,CAXD;;AAaO,MAAMX,KAAK,GAAG,IAAIF,YAAJ,EAAd","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 { GestureResponderEvent } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport { TimeProvider } from '../TimeProvider';\nimport { DdSdk } from '../foundation';\nimport type { DdNativeRumType } from '../nativeModulesTypes';\nimport { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\n\nimport type { ActionEventMapper } from './eventMappers/actionEventMapper';\nimport { generateActionEventMapper } from './eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './eventMappers/errorEventMapper';\nimport { generateErrorEventMapper } from './eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport { generateResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport type {\n DdRumType,\n RumActionType,\n ResourceKind,\n ErrorSource\n} from './types';\n\nconst timeProvider = new TimeProvider();\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\nclass DdRumWrapper implements DdRumType {\n private nativeRum: DdNativeRumType = NativeModules.DdRum;\n private lastActionData?: { type: RumActionType; name: string };\n private errorEventMapper = generateErrorEventMapper(undefined);\n private resourceEventMapper = generateResourceEventMapper(undefined);\n private actionEventMapper = generateActionEventMapper(undefined);\n\n startView(\n key: string,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM View “${name}” #${key}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startView(key, name, context, timestampMs)\n );\n }\n\n stopView(\n key: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(`Stopping RUM View #${key}`, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopView(key, context, timestampMs)\n );\n }\n\n startAction(\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n this.lastActionData = { type, name };\n return bufferVoidNativeCall(() =>\n this.nativeRum.startAction(type, name, context, timestampMs)\n );\n }\n\n stopAction(\n ...args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ): Promise<void> {\n InternalLog.log('Stopping current RUM Action', SdkVerbosity.DEBUG);\n const nativeCallArgs = this.getStopActionNativeCallArgs(args);\n this.lastActionData = undefined;\n if (!nativeCallArgs) {\n return generateEmptyPromise();\n }\n return this.callNativeStopAction(...nativeCallArgs);\n }\n\n private callNativeStopAction = (\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context,\n timestampMs\n });\n if (!mappedEvent) {\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n type,\n name,\n {\n '_dd.action.drop_action': true\n },\n timestampMs\n )\n );\n }\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n private getStopActionNativeCallArgs = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ):\n | [\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ]\n | null => {\n if (isNewStopActionAPI(args)) {\n return [\n args[0],\n args[1],\n args[2] || {},\n args[3] || timeProvider.now()\n ];\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug(\n 'DDdRum.stopAction called with the old signature'\n );\n const { type, name } = this.lastActionData;\n return [\n type,\n name,\n args[0] || {},\n args[1] || timeProvider.now()\n ];\n }\n InternalLog.log(\n 'DdRum.startAction needs to be called before DdRum.stopAction',\n SdkVerbosity.WARN\n );\n } else {\n InternalLog.log(\n 'DdRum.stopAction was called with wrong arguments',\n SdkVerbosity.WARN\n );\n }\n\n return null;\n };\n\n addAction(\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now(),\n actionContext?: GestureResponderEvent\n ): Promise<void> {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context,\n timestampMs,\n actionContext\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(\n `Adding RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n }\n\n startResource(\n key: string,\n method: string,\n url: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM Resource #${key} ${method}: ${url}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startResource(key, method, url, context, timestampMs)\n );\n }\n\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size: number = -1,\n context: object = {},\n timestampMs: number = timeProvider.now(),\n resourceContext?: XMLHttpRequest\n ): Promise<void> {\n const mappedEvent = this.resourceEventMapper.applyEventMapper({\n key,\n statusCode,\n kind,\n size,\n context,\n timestampMs,\n resourceContext\n });\n if (!mappedEvent) {\n /**\n * To drop the resource we call `stopResource` and pass the `_dd.drop_resource` attribute in the context.\n * It will be picked up by the resource mappers we implement on the native side that will drop the resource.\n * This ensures we don't have any \"started\" resource left in memory on the native side.\n */\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n key,\n statusCode,\n kind,\n size,\n {\n '_dd.resource.drop_resource': true\n },\n timestampMs\n )\n );\n }\n\n InternalLog.log(\n `Stopping RUM Resource #${key} status:${statusCode}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n mappedEvent.key,\n mappedEvent.statusCode,\n mappedEvent.kind,\n mappedEvent.size,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n }\n\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n const mappedEvent = this.errorEventMapper.applyEventMapper({\n message,\n source,\n stacktrace,\n context,\n timestampMs\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);\n const updatedContext: any = mappedEvent.context;\n updatedContext['_dd.error.source_type'] = 'react-native';\n return bufferVoidNativeCall(() =>\n this.nativeRum.addError(\n mappedEvent.message,\n mappedEvent.source,\n mappedEvent.stacktrace,\n updatedContext,\n mappedEvent.timestampMs\n )\n );\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\n `Adding timing “${name}” to RUM View`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n }\n\n registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {\n this.errorEventMapper = generateErrorEventMapper(errorEventMapper);\n }\n\n unregisterErrorEventMapper() {\n this.errorEventMapper = generateErrorEventMapper(undefined);\n }\n\n registerResourceEventMapper(resourceEventMapper: ResourceEventMapper) {\n this.resourceEventMapper = generateResourceEventMapper(\n resourceEventMapper\n );\n }\n\n unregisterResourceEventMapper() {\n this.resourceEventMapper = generateResourceEventMapper(undefined);\n }\n\n registerActionEventMapper(actionEventMapper: ActionEventMapper) {\n this.actionEventMapper = generateActionEventMapper(actionEventMapper);\n }\n\n unregisterActionEventMapper() {\n this.actionEventMapper = generateActionEventMapper(undefined);\n }\n}\n\nconst isNewStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n] => {\n return typeof args[0] === 'string';\n};\n\nconst isOldStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined';\n};\n\nexport const DdRum = new DdRumWrapper();\n"]}
1
+ {"version":3,"sources":["DdRum.ts"],"names":["timeProvider","TimeProvider","generateEmptyPromise","Promise","resolve","DdRumWrapper","NativeModules","DdRum","undefined","type","name","context","timestampMs","mappedEvent","actionEventMapper","applyEventMapper","nativeRum","stopAction","args","isNewStopActionAPI","now","isOldStopActionAPI","lastActionData","DdSdk","telemetryDebug","InternalLog","log","SdkVerbosity","WARN","startView","key","DEBUG","stopView","startAction","nativeCallArgs","getStopActionNativeCallArgs","callNativeStopAction","addAction","actionContext","startResource","method","url","stopResource","statusCode","kind","size","resourceContext","resourceEventMapper","addError","message","source","stacktrace","errorEventMapper","updatedContext","addTiming","registerErrorEventMapper","unregisterErrorEventMapper","registerResourceEventMapper","unregisterResourceEventMapper","registerActionEventMapper","unregisterActionEventMapper"],"mappings":";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MAAM,KAAKf,SAAL,CAAesC,SAAf,CAAyB5C,IAAzB,CAA3B,CAAP;AACH;;AAED6C,EAAAA,wBAAwB,CAACH,gBAAD,EAAqC;AACzD,SAAKA,gBAAL,GAAwB,gDAAyBA,gBAAzB,CAAxB;AACH;;AAEDI,EAAAA,0BAA0B,GAAG;AACzB,SAAKJ,gBAAL,GAAwB,gDAAyB5C,SAAzB,CAAxB;AACH;;AAEDiD,EAAAA,2BAA2B,CAACV,mBAAD,EAA2C;AAClE,SAAKA,mBAAL,GAA2B,sDACvBA,mBADuB,CAA3B;AAGH;;AAEDW,EAAAA,6BAA6B,GAAG;AAC5B,SAAKX,mBAAL,GAA2B,sDAA4BvC,SAA5B,CAA3B;AACH;;AAEDmD,EAAAA,yBAAyB,CAAC7C,iBAAD,EAAuC;AAC5D,SAAKA,iBAAL,GAAyB,kDAA0BA,iBAA1B,CAAzB;AACH;;AAED8C,EAAAA,2BAA2B,GAAG;AAC1B,SAAK9C,iBAAL,GAAyB,kDAA0BN,SAA1B,CAAzB;AACH;;AA/TmC;;AAkUxC,MAAMW,kBAAkB,GACpBD,IADuB,IActB;AACD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAA1B;AACH,CAhBD;;AAkBA,MAAMG,kBAAkB,GACpBH,IADuB,IAS4B;AACnD,SAAO,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IAA+B,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,WAAzD;AACH,CAXD;;AAaO,MAAMX,KAAK,GAAG,IAAIF,YAAJ,EAAd","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 { GestureResponderEvent } from 'react-native';\nimport { NativeModules } from 'react-native';\n\nimport { InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport { TimeProvider } from '../TimeProvider';\nimport type { DdNativeRumType } from '../nativeModulesTypes';\nimport { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';\nimport { DdSdk } from '../sdk/DdSdk';\n\nimport type { ActionEventMapper } from './eventMappers/actionEventMapper';\nimport { generateActionEventMapper } from './eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './eventMappers/errorEventMapper';\nimport { generateErrorEventMapper } from './eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport { generateResourceEventMapper } from './eventMappers/resourceEventMapper';\nimport type {\n DdRumType,\n RumActionType,\n ResourceKind,\n ErrorSource\n} from './types';\n\nconst timeProvider = new TimeProvider();\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\nclass DdRumWrapper implements DdRumType {\n private nativeRum: DdNativeRumType = NativeModules.DdRum;\n private lastActionData?: { type: RumActionType; name: string };\n private errorEventMapper = generateErrorEventMapper(undefined);\n private resourceEventMapper = generateResourceEventMapper(undefined);\n private actionEventMapper = generateActionEventMapper(undefined);\n\n startView(\n key: string,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM View “${name}” #${key}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startView(key, name, context, timestampMs)\n );\n }\n\n stopView(\n key: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(`Stopping RUM View #${key}`, SdkVerbosity.DEBUG);\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopView(key, context, timestampMs)\n );\n }\n\n startAction(\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n this.lastActionData = { type, name };\n return bufferVoidNativeCall(() =>\n this.nativeRum.startAction(type, name, context, timestampMs)\n );\n }\n\n stopAction(\n ...args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ): Promise<void> {\n InternalLog.log('Stopping current RUM Action', SdkVerbosity.DEBUG);\n const nativeCallArgs = this.getStopActionNativeCallArgs(args);\n this.lastActionData = undefined;\n if (!nativeCallArgs) {\n return generateEmptyPromise();\n }\n return this.callNativeStopAction(...nativeCallArgs);\n }\n\n private callNativeStopAction = (\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ): Promise<void> => {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context,\n timestampMs\n });\n if (!mappedEvent) {\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n type,\n name,\n {\n '_dd.action.drop_action': true\n },\n timestampMs\n )\n );\n }\n\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n };\n\n private getStopActionNativeCallArgs = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n ):\n | [\n type: RumActionType,\n name: string,\n context: object,\n timestampMs: number\n ]\n | null => {\n if (isNewStopActionAPI(args)) {\n return [\n args[0],\n args[1],\n args[2] || {},\n args[3] || timeProvider.now()\n ];\n }\n if (isOldStopActionAPI(args)) {\n if (this.lastActionData) {\n DdSdk.telemetryDebug(\n 'DDdRum.stopAction called with the old signature'\n );\n const { type, name } = this.lastActionData;\n return [\n type,\n name,\n args[0] || {},\n args[1] || timeProvider.now()\n ];\n }\n InternalLog.log(\n 'DdRum.startAction needs to be called before DdRum.stopAction',\n SdkVerbosity.WARN\n );\n } else {\n InternalLog.log(\n 'DdRum.stopAction was called with wrong arguments',\n SdkVerbosity.WARN\n );\n }\n\n return null;\n };\n\n addAction(\n type: RumActionType,\n name: string,\n context: object = {},\n timestampMs: number = timeProvider.now(),\n actionContext?: GestureResponderEvent\n ): Promise<void> {\n const mappedEvent = this.actionEventMapper.applyEventMapper({\n type,\n name,\n context,\n timestampMs,\n actionContext\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(\n `Adding RUM Action “${name}” (${type})`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.addAction(\n mappedEvent.type,\n mappedEvent.name,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n }\n\n startResource(\n key: string,\n method: string,\n url: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n InternalLog.log(\n `Starting RUM Resource #${key} ${method}: ${url}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.startResource(key, method, url, context, timestampMs)\n );\n }\n\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size: number = -1,\n context: object = {},\n timestampMs: number = timeProvider.now(),\n resourceContext?: XMLHttpRequest\n ): Promise<void> {\n const mappedEvent = this.resourceEventMapper.applyEventMapper({\n key,\n statusCode,\n kind,\n size,\n context,\n timestampMs,\n resourceContext\n });\n if (!mappedEvent) {\n /**\n * To drop the resource we call `stopResource` and pass the `_dd.drop_resource` attribute in the context.\n * It will be picked up by the resource mappers we implement on the native side that will drop the resource.\n * This ensures we don't have any \"started\" resource left in memory on the native side.\n */\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n key,\n statusCode,\n kind,\n size,\n {\n '_dd.resource.drop_resource': true\n },\n timestampMs\n )\n );\n }\n\n InternalLog.log(\n `Stopping RUM Resource #${key} status:${statusCode}`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() =>\n this.nativeRum.stopResource(\n mappedEvent.key,\n mappedEvent.statusCode,\n mappedEvent.kind,\n mappedEvent.size,\n mappedEvent.context,\n mappedEvent.timestampMs\n )\n );\n }\n\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context: object = {},\n timestampMs: number = timeProvider.now()\n ): Promise<void> {\n const mappedEvent = this.errorEventMapper.applyEventMapper({\n message,\n source,\n stacktrace,\n context,\n timestampMs\n });\n if (!mappedEvent) {\n return generateEmptyPromise();\n }\n InternalLog.log(`Adding RUM Error “${message}”`, SdkVerbosity.DEBUG);\n const updatedContext: any = mappedEvent.context;\n updatedContext['_dd.error.source_type'] = 'react-native';\n return bufferVoidNativeCall(() =>\n this.nativeRum.addError(\n mappedEvent.message,\n mappedEvent.source,\n mappedEvent.stacktrace,\n updatedContext,\n mappedEvent.timestampMs\n )\n );\n }\n\n addTiming(name: string): Promise<void> {\n InternalLog.log(\n `Adding timing “${name}” to RUM View`,\n SdkVerbosity.DEBUG\n );\n return bufferVoidNativeCall(() => this.nativeRum.addTiming(name));\n }\n\n registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {\n this.errorEventMapper = generateErrorEventMapper(errorEventMapper);\n }\n\n unregisterErrorEventMapper() {\n this.errorEventMapper = generateErrorEventMapper(undefined);\n }\n\n registerResourceEventMapper(resourceEventMapper: ResourceEventMapper) {\n this.resourceEventMapper = generateResourceEventMapper(\n resourceEventMapper\n );\n }\n\n unregisterResourceEventMapper() {\n this.resourceEventMapper = generateResourceEventMapper(undefined);\n }\n\n registerActionEventMapper(actionEventMapper: ActionEventMapper) {\n this.actionEventMapper = generateActionEventMapper(actionEventMapper);\n }\n\n unregisterActionEventMapper() {\n this.actionEventMapper = generateActionEventMapper(undefined);\n }\n}\n\nconst isNewStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n] => {\n return typeof args[0] === 'string';\n};\n\nconst isOldStopActionAPI = (\n args:\n | [\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ]\n | [context?: object, timestampMs?: number]\n): args is [context?: object, timestampMs?: number] => {\n return typeof args[0] === 'object' || typeof args[0] === 'undefined';\n};\n\nexport const DdRum = new DdRumWrapper();\n"]}
@@ -13,7 +13,7 @@ var _SdkVerbosity = require("../../../SdkVerbosity");
13
13
 
14
14
  var _errorUtils = require("../../../errorUtils");
15
15
 
16
- var _foundation = require("../../../foundation");
16
+ var _DdSdk = require("../../../sdk/DdSdk");
17
17
 
18
18
  var _DdEventsInterceptor = require("./DdEventsInterceptor");
19
19
 
@@ -61,7 +61,7 @@ class DdRumUserInteractionTracking {
61
61
  return this.patchCreateElementFunction(originaljsx, args);
62
62
  };
63
63
  } catch (e) {
64
- _foundation.DdSdk.telemetryDebug((0, _errorUtils.getErrorMessage)(e));
64
+ _DdSdk.DdSdk.telemetryDebug((0, _errorUtils.getErrorMessage)(e));
65
65
  }
66
66
 
67
67
  const originalMemo = _react.default.memo;
@@ -1 +1 @@
1
- {"version":3,"sources":["DdRumUserInteractionTracking.tsx"],"names":["DdRumUserInteractionTracking","startTracking","isTracking","InternalLog","log","SdkVerbosity","WARN","eventsInterceptor","DdEventsInterceptor","original","React","createElement","args","patchCreateElementFunction","jsxRuntime","originaljsx","jsx","originalJsx","e","DdSdk","telemetryDebug","originalMemo","memo","component","propsAreEqual","prev","next","onPress","_prevOnPress","partialPrevProps","prevProps","__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__","_nextOnPress","partialNextProps","nextProps","INFO","stopTracking","originalCreateElement","NoOpEventsInterceptor","originalFunction","element","props","rest","originalOnPress","interceptOnPress"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACO,MAAMA,4BAAN,CAAmC;AAgCtC;AACJ;AACA;AACA;AACA;AACwB,SAAbC,aAAa,GAAS;AACzB;AACA,QAAID,4BAA4B,CAACE,UAAjC,EAA6C;AACzCC,+BAAYC,GAAZ,CACI,8CADJ,EAEIC,2BAAaC,IAFjB;;AAIA;AACH;;AACDN,IAAAA,4BAA4B,CAACO,iBAA7B,GAAiD,IA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AAG/B,IAAJ,CAAtB;AACH,KALD,CAHF,CASE;;;AACC6B,IAAAA,KAAD,CAGGV,sCAHH,GAG4CY,eAH5C;AAIH;;AACD,SAAOJ,gBAAgB,CAACC,OAAD,EAAUC,KAAV,EAAiB,GAAGC,IAApB,CAAvB;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 React from 'react';\n\nimport { InternalLog } from '../../../InternalLog';\nimport { SdkVerbosity } from '../../../SdkVerbosity';\nimport { getErrorMessage } from '../../../errorUtils';\nimport { DdSdk } from '../../../foundation';\n\nimport { DdEventsInterceptor } from './DdEventsInterceptor';\nimport type EventsInterceptor from './EventsInterceptor';\nimport NoOpEventsInterceptor from './NoOpEventsInterceptor';\nimport { areObjectShallowEqual } from './ShallowObjectEqualityChecker';\nimport { getJsxRuntime } from './getJsxRuntime';\n\n/**\n * Provides RUM auto-instrumentation feature to track user interaction as RUM events.\n * For now we are only covering the \"onPress\" events.\n */\nexport class DdRumUserInteractionTracking {\n private static isTracking = false;\n private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor();\n private static originalCreateElement = React.createElement;\n private static originalMemo = React.memo;\n private static originalJsx = null;\n\n private static patchCreateElementFunction = (\n originalFunction: typeof React.createElement,\n [element, props, ...rest]: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n if (\n props &&\n typeof (props as Record<string, unknown>).onPress === 'function'\n ) {\n const originalOnPress = (props as Record<string, unknown>) // eslint-disable-next-line @typescript-eslint/ban-types\n .onPress as Function;\n (props as Record<string, unknown>).onPress = (...args: any[]) => {\n DdRumUserInteractionTracking.eventsInterceptor.interceptOnPress(\n ...args\n );\n return originalOnPress(...args);\n };\n // we store the original onPress prop so we can keep memoization working\n (props as Record<\n string,\n unknown\n >).__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__ = originalOnPress;\n }\n return originalFunction(element, props, ...rest);\n };\n\n /**\n * Starts tracking user interactions and sends a RUM Action event every time a new interaction was detected.\n * Please note that we are only considering as valid - for - tracking only the user interactions that have\n * a visible output (either an UI state change or a Resource request)\n */\n static startTracking(): void {\n // extra safety to avoid wrapping more than 1 time this function\n if (DdRumUserInteractionTracking.isTracking) {\n InternalLog.log(\n 'Datadog SDK is already tracking interactions',\n SdkVerbosity.WARN\n );\n return;\n }\n DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor();\n\n const original = React.createElement;\n React.createElement = (\n ...args: Parameters<typeof React.createElement>\n ): any => {\n return this.patchCreateElementFunction(original, args);\n };\n\n try {\n const jsxRuntime = getJsxRuntime();\n const originaljsx = jsxRuntime.jsx;\n this.originalJsx = originaljsx;\n jsxRuntime.jsx = (\n ...args: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n return this.patchCreateElementFunction(originaljsx, args);\n };\n } catch (e) {\n DdSdk.telemetryDebug(getErrorMessage(e));\n }\n\n const originalMemo = React.memo;\n\n React.memo = (\n component: any,\n propsAreEqual?: (prevProps: any, newProps: any) => boolean\n ) => {\n return originalMemo(component, (prev, next) => {\n if (!next.onPress || !prev.onPress) {\n return propsAreEqual\n ? propsAreEqual(prev, next)\n : areObjectShallowEqual(prev, next);\n }\n // we replace \"our\" onPress from the props by the original for comparison\n const { onPress: _prevOnPress, ...partialPrevProps } = prev;\n const prevProps = {\n ...partialPrevProps,\n onPress: prev.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n const { onPress: _nextOnPress, ...partialNextProps } = next;\n const nextProps = {\n ...partialNextProps,\n onPress: next.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n // if no comparison function is provided we do shallow comparison\n return propsAreEqual\n ? propsAreEqual(prevProps, nextProps)\n : areObjectShallowEqual(nextProps, prevProps);\n });\n };\n\n DdRumUserInteractionTracking.isTracking = true;\n InternalLog.log(\n 'Datadog SDK is tracking interactions',\n SdkVerbosity.INFO\n );\n }\n\n static stopTracking() {\n React.createElement = this.originalCreateElement;\n React.memo = this.originalMemo;\n DdRumUserInteractionTracking.isTracking = false;\n if (this.originalJsx) {\n const jsxRuntime = getJsxRuntime();\n jsxRuntime.jsx = this.originalJsx;\n this.originalJsx = null;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["DdRumUserInteractionTracking.tsx"],"names":["DdRumUserInteractionTracking","startTracking","isTracking","InternalLog","log","SdkVerbosity","WARN","eventsInterceptor","DdEventsInterceptor","original","React","createElement","args","patchCreateElementFunction","jsxRuntime","originaljsx","jsx","originalJsx","e","DdSdk","telemetryDebug","originalMemo","memo","component","propsAreEqual","prev","next","onPress","_prevOnPress","partialPrevProps","prevProps","__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__","_nextOnPress","partialNextProps","nextProps","INFO","stopTracking","originalCreateElement","NoOpEventsInterceptor","originalFunction","element","props","rest","originalOnPress","interceptOnPress"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACO,MAAMA,4BAAN,CAAmC;AAgCtC;AACJ;AACA;AACA;AACA;AACwB,SAAbC,aAAa,GAAS;AACzB;AACA,QAAID,4BAA4B,CAACE,UAAjC,EAA6C;AACzCC,+BAAYC,GAAZ,CACI,8CADJ,EAEIC,2BAAaC,IAFjB;;AAIA;AACH;;AACDN,IAAAA,4BAA4B,CAACO,iBAA7B,GAAiD,IAAIC,wCAAJ,EAAjD;AAEA,UAAMC,QAAQ,GAAGC,eAAMC,aAAvB;;AACAD,mBAAMC,aAAN,GAAsB,CAClB,GAAGC,IADe,KAEZ;AACN,aAAO,KAAKC,0BAAL,CAAgCJ,QAAhC,EAA0CG,IAA1C,CAAP;AACH,KAJD;;AAMA,QAAI;AACA,YAAME,UAAU,GAAG,mCAAnB;AACA,YAAMC,WAAW,GAAGD,UAAU,CAACE,GAA/B;AACA,WAAKC,WA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AEIC,2BAAa8B,IAFjB;AAIH;;AAEkB,SAAZC,YAAY,GAAG;AAClB1B,mBAAMC,aAAN,GAAsB,KAAK0B,qBAA3B;AACA3B,mBAAMY,IAAN,GAAa,KAAKD,YAAlB;AACArB,IAAAA,4BAA4B,CAACE,UAA7B,GAA0C,KAA1C;;AACA,QAAI,KAAKe,WAAT,EAAsB;AAClB,YAAMH,UAAU,GAAG,mCAAnB;AACAA,MAAAA,UAAU,CAACE,GAAX,GAAiB,KAAKC,WAAtB;AACA,WAAKA,WAAL,GAAmB,IAAnB;AACH;AACJ;;AApHqC;;;;gBAA7BjB,4B,gBACmB,K;;gBADnBA,4B,uBAE6C,IAAIsC,8BAAJ,E;;gBAF7CtC,4B,2BAG8BU,eAAMC,a;;gBAHpCX,4B,kBAIqBU,eAAMY,I;;gBAJ3BtB,4B,iBAKoB,I;;gBALpBA,4B,gCAOmC,CACxCuC,gBADwC,EAExC,CAACC,OAAD,EAAUC,KAAV,EAAiB,GAAGC,IAApB,CAFwC,KAGC;AACzC,MACID,KAAK,IACL,OAAQA,KAAD,CAAmCd,OAA1C,KAAsD,UAF1D,EAGE;AACE,UAAMgB,eAAe,GAAIF,KAAD,EAAmC;AACtDd,IAAAA,OADL;;AAECc,IAAAA,KAAD,CAAmCd,OAAnC,GAA6C,CAAC,GAAGf,IAAJ,KAAoB;AAC7DZ,MAAAA,4BAA4B,CAACO,iBAA7B,CAA+CqC,gBAA/C,CACI,GAAGhC,IADP;AAGA,aAAO+B,eAAe,CAAC,GAAG/B,IAAJ,CAAtB;AACH,KALD,CAHF,CASE;;;AACC6B,IAAAA,KAAD,CAGGV,sCAHH,GAG4CY,eAH5C;AAIH;;AACD,SAAOJ,gBAAgB,CAACC,OAAD,EAAUC,KAAV,EAAiB,GAAGC,IAApB,CAAvB;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 React from 'react';\n\nimport { InternalLog } from '../../../InternalLog';\nimport { SdkVerbosity } from '../../../SdkVerbosity';\nimport { getErrorMessage } from '../../../errorUtils';\nimport { DdSdk } from '../../../sdk/DdSdk';\n\nimport { DdEventsInterceptor } from './DdEventsInterceptor';\nimport type EventsInterceptor from './EventsInterceptor';\nimport NoOpEventsInterceptor from './NoOpEventsInterceptor';\nimport { areObjectShallowEqual } from './ShallowObjectEqualityChecker';\nimport { getJsxRuntime } from './getJsxRuntime';\n\n/**\n * Provides RUM auto-instrumentation feature to track user interaction as RUM events.\n * For now we are only covering the \"onPress\" events.\n */\nexport class DdRumUserInteractionTracking {\n private static isTracking = false;\n private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor();\n private static originalCreateElement = React.createElement;\n private static originalMemo = React.memo;\n private static originalJsx = null;\n\n private static patchCreateElementFunction = (\n originalFunction: typeof React.createElement,\n [element, props, ...rest]: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n if (\n props &&\n typeof (props as Record<string, unknown>).onPress === 'function'\n ) {\n const originalOnPress = (props as Record<string, unknown>) // eslint-disable-next-line @typescript-eslint/ban-types\n .onPress as Function;\n (props as Record<string, unknown>).onPress = (...args: any[]) => {\n DdRumUserInteractionTracking.eventsInterceptor.interceptOnPress(\n ...args\n );\n return originalOnPress(...args);\n };\n // we store the original onPress prop so we can keep memoization working\n (props as Record<\n string,\n unknown\n >).__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__ = originalOnPress;\n }\n return originalFunction(element, props, ...rest);\n };\n\n /**\n * Starts tracking user interactions and sends a RUM Action event every time a new interaction was detected.\n * Please note that we are only considering as valid - for - tracking only the user interactions that have\n * a visible output (either an UI state change or a Resource request)\n */\n static startTracking(): void {\n // extra safety to avoid wrapping more than 1 time this function\n if (DdRumUserInteractionTracking.isTracking) {\n InternalLog.log(\n 'Datadog SDK is already tracking interactions',\n SdkVerbosity.WARN\n );\n return;\n }\n DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor();\n\n const original = React.createElement;\n React.createElement = (\n ...args: Parameters<typeof React.createElement>\n ): any => {\n return this.patchCreateElementFunction(original, args);\n };\n\n try {\n const jsxRuntime = getJsxRuntime();\n const originaljsx = jsxRuntime.jsx;\n this.originalJsx = originaljsx;\n jsxRuntime.jsx = (\n ...args: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n return this.patchCreateElementFunction(originaljsx, args);\n };\n } catch (e) {\n DdSdk.telemetryDebug(getErrorMessage(e));\n }\n\n const originalMemo = React.memo;\n\n React.memo = (\n component: any,\n propsAreEqual?: (prevProps: any, newProps: any) => boolean\n ) => {\n return originalMemo(component, (prev, next) => {\n if (!next.onPress || !prev.onPress) {\n return propsAreEqual\n ? propsAreEqual(prev, next)\n : areObjectShallowEqual(prev, next);\n }\n // we replace \"our\" onPress from the props by the original for comparison\n const { onPress: _prevOnPress, ...partialPrevProps } = prev;\n const prevProps = {\n ...partialPrevProps,\n onPress: prev.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n const { onPress: _nextOnPress, ...partialNextProps } = next;\n const nextProps = {\n ...partialNextProps,\n onPress: next.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n // if no comparison function is provided we do shallow comparison\n return propsAreEqual\n ? propsAreEqual(prevProps, nextProps)\n : areObjectShallowEqual(nextProps, prevProps);\n });\n };\n\n DdRumUserInteractionTracking.isTracking = true;\n InternalLog.log(\n 'Datadog SDK is tracking interactions',\n SdkVerbosity.INFO\n );\n }\n\n static stopTracking() {\n React.createElement = this.originalCreateElement;\n React.memo = this.originalMemo;\n DdRumUserInteractionTracking.isTracking = false;\n if (this.originalJsx) {\n const jsxRuntime = getJsxRuntime();\n jsxRuntime.jsx = this.originalJsx;\n this.originalJsx = null;\n }\n }\n}\n"]}
@@ -9,13 +9,13 @@ var _InternalLog = require("../../../InternalLog");
9
9
 
10
10
  var _SdkVerbosity = require("../../../SdkVerbosity");
11
11
 
12
- var _firstPartyHosts = require("./domain/firstPartyHosts");
12
+ var _firstPartyHosts = require("./distributedTracing/firstPartyHosts");
13
13
 
14
- var _ResourceReporter = require("./implementation/DatadogRumResource/ResourceReporter");
14
+ var _ResourceReporter = require("./requestProxy/XHRProxy/DatadogRumResource/ResourceReporter");
15
15
 
16
- var _internalDevResourceBlocklist = require("./implementation/DatadogRumResource/internalDevResourceBlocklist");
16
+ var _internalDevResourceBlocklist = require("./requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist");
17
17
 
18
- var _XHRProxy = require("./implementation/XHRProxy");
18
+ var _XHRProxy = require("./requestProxy/XHRProxy/XHRProxy");
19
19
 
20
20
  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; }
21
21
 
@@ -1 +1 @@
1
- {"version":3,"sources":["DdRumResourceTracking.tsx"],"names":["DdRumResourceTracking","startTracking","tracingSamplingRate","firstPartyHosts","isTracking","InternalLog","log","SdkVerbosity","WARN","requestProxy","XHRProxy","xhrType","XMLHttpRequest","resourceReporter","ResourceReporter","filterDevResource","onTrackingStart","firstPartyHostsRegexMap","INFO","stopTracking","onTrackingStop"],"mappings":";;;;;;;AAMA;;AACA;;AAGA;;AAEA;;AACA;;AACA;;;;AAEA;AACA;AACA;AACO,MAAMA,qBAAN,CAA4B;AAI/B;AACJ;AACA;AACwB,SAAbC,aAAa,CAAC;AACjBC,IAAAA,mBADiB;AAEjBC,IAAAA;AAFiB,GAAD,EAMX;AACL;AACA,QAAIH,qBAAqB,CAACI,UAA1B,EAAsC;AAClCC,+BAAYC,GAAZ,CACI,+CADJ,EAEIC,2BAAaC,IAFjB;;AAIA;AACH;;AAED,SAAKC,YAAL,GAAoB,IAAIC,kBAAJ,CAAa;AAC7BC,MAAAA,OAAO,EAAEC,cADoB;AAE7BC,MAAAA,gBAAgB,EAAE,IAAIC,kCAAJ,CAAqB,CAACC,+CAAD,CAArB;AAFW,KAAb,CAApB;AAIA,SAAKN,YAAL,CAAkBO,eAAlB,CAAkC;AAC9Bd,MAAAA,mBAD8B;AAE9Be,MAAAA,uBAAuB,EAAE,qDACrBd,eADqB;AAFK,KAAlC;;AAOAE,6BAAYC,GAAZ,CACI,uCADJ,EAEIC,2BAAaW,IAFjB;;AAIAlB,IAAAA,qBAAqB,CAACI,UAAtB,GAAmC,IAAnC;AACH;;AAEkB,SAAZe,YAAY,GAAS;AACxB,QAAInB,qBAAqB,CAACI,UAA1B,EAAsC;AAClCJ,MAAAA,qBAAqB,CAACI,UAAtB,GAAmC,KAAnC;;AACA,UAAI,KAAKK,YAAT,EAAuB;AACnB,aAAKA,YAAL,CAAkBW,cAAlB;AACH;;AACD,WAAKX,YAAL,GAAoB,IAApB;AACH;AACJ;;AAjD8B;;;;gBAAtBT,qB,gBACmB,K;;gBADnBA,qB","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 { FirstPartyHost } from '../../types';\n\nimport { firstPartyHostsRegexMapBuilder } from './domain/firstPartyHosts';\nimport type { RequestProxy } from './domain/interfaces/RequestProxy';\nimport { ResourceReporter } from './implementation/DatadogRumResource/ResourceReporter';\nimport { filterDevResource } from './implementation/DatadogRumResource/internalDevResourceBlocklist';\nimport { XHRProxy } from './implementation/XHRProxy';\n\n/**\n * Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.\n */\nexport class DdRumResourceTracking {\n private static isTracking = false;\n private static requestProxy: RequestProxy | null;\n\n /**\n * Starts tracking resources and sends a RUM Resource event every time a network request is detected.\n */\n static startTracking({\n tracingSamplingRate,\n firstPartyHosts\n }: {\n tracingSamplingRate: number;\n firstPartyHosts: FirstPartyHost[];\n }): void {\n // extra safety to avoid proxying the XHR class twice\n if (DdRumResourceTracking.isTracking) {\n InternalLog.log(\n 'Datadog SDK is already tracking XHR resources',\n SdkVerbosity.WARN\n );\n return;\n }\n\n this.requestProxy = new XHRProxy({\n xhrType: XMLHttpRequest,\n resourceReporter: new ResourceReporter([filterDevResource])\n });\n this.requestProxy.onTrackingStart({\n tracingSamplingRate,\n firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder(\n firstPartyHosts\n )\n });\n\n InternalLog.log(\n 'Datadog SDK is tracking XHR resources',\n SdkVerbosity.INFO\n );\n DdRumResourceTracking.isTracking = true;\n }\n\n static stopTracking(): void {\n if (DdRumResourceTracking.isTracking) {\n DdRumResourceTracking.isTracking = false;\n if (this.requestProxy) {\n this.requestProxy.onTrackingStop();\n }\n this.requestProxy = null;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["DdRumResourceTracking.tsx"],"names":["DdRumResourceTracking","startTracking","tracingSamplingRate","firstPartyHosts","isTracking","InternalLog","log","SdkVerbosity","WARN","requestProxy","XHRProxy","xhrType","XMLHttpRequest","resourceReporter","ResourceReporter","filterDevResource","onTrackingStart","firstPartyHostsRegexMap","INFO","stopTracking","onTrackingStop"],"mappings":";;;;;;;AAMA;;AACA;;AAGA;;AACA;;AACA;;AACA;;;;AAGA;AACA;AACA;AACO,MAAMA,qBAAN,CAA4B;AAI/B;AACJ;AACA;AACwB,SAAbC,aAAa,CAAC;AACjBC,IAAAA,mBADiB;AAEjBC,IAAAA;AAFiB,GAAD,EAMX;AACL;AACA,QAAIH,qBAAqB,CAACI,UAA1B,EAAsC;AAClCC,+BAAYC,GAAZ,CACI,+CADJ,EAEIC,2BAAaC,IAFjB;;AAIA;AACH;;AAED,SAAKC,YAAL,GAAoB,IAAIC,kBAAJ,CAAa;AAC7BC,MAAAA,OAAO,EAAEC,cADoB;AAE7BC,MAAAA,gBAAgB,EAAE,IAAIC,kCAAJ,CAAqB,CAACC,+CAAD,CAArB;AAFW,KAAb,CAApB;AAIA,SAAKN,YAAL,CAAkBO,eAAlB,CAAkC;AAC9Bd,MAAAA,mBAD8B;AAE9Be,MAAAA,uBAAuB,EAAE,qDACrBd,eADqB;AAFK,KAAlC;;AAOAE,6BAAYC,GAAZ,CACI,uCADJ,EAEIC,2BAAaW,IAFjB;;AAIAlB,IAAAA,qBAAqB,CAACI,UAAtB,GAAmC,IAAnC;AACH;;AAEkB,SAAZe,YAAY,GAAS;AACxB,QAAInB,qBAAqB,CAACI,UAA1B,EAAsC;AAClCJ,MAAAA,qBAAqB,CAACI,UAAtB,GAAmC,KAAnC;;AACA,UAAI,KAAKK,YAAT,EAAuB;AACnB,aAAKA,YAAL,CAAkBW,cAAlB;AACH;;AACD,WAAKX,YAAL,GAAoB,IAApB;AACH;AACJ;;AAjD8B;;;;gBAAtBT,qB,gBACmB,K;;gBADnBA,qB","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 { FirstPartyHost } from '../../types';\n\nimport { firstPartyHostsRegexMapBuilder } from './distributedTracing/firstPartyHosts';\nimport { ResourceReporter } from './requestProxy/XHRProxy/DatadogRumResource/ResourceReporter';\nimport { filterDevResource } from './requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist';\nimport { XHRProxy } from './requestProxy/XHRProxy/XHRProxy';\nimport type { RequestProxy } from './requestProxy/interfaces/RequestProxy';\n\n/**\n * Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.\n */\nexport class DdRumResourceTracking {\n private static isTracking = false;\n private static requestProxy: RequestProxy | null;\n\n /**\n * Starts tracking resources and sends a RUM Resource event every time a network request is detected.\n */\n static startTracking({\n tracingSamplingRate,\n firstPartyHosts\n }: {\n tracingSamplingRate: number;\n firstPartyHosts: FirstPartyHost[];\n }): void {\n // extra safety to avoid proxying the XHR class twice\n if (DdRumResourceTracking.isTracking) {\n InternalLog.log(\n 'Datadog SDK is already tracking XHR resources',\n SdkVerbosity.WARN\n );\n return;\n }\n\n this.requestProxy = new XHRProxy({\n xhrType: XMLHttpRequest,\n resourceReporter: new ResourceReporter([filterDevResource])\n });\n this.requestProxy.onTrackingStart({\n tracingSamplingRate,\n firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder(\n firstPartyHosts\n )\n });\n\n InternalLog.log(\n 'Datadog SDK is tracking XHR resources',\n SdkVerbosity.INFO\n );\n DdRumResourceTracking.isTracking = true;\n }\n\n static stopTracking(): void {\n if (DdRumResourceTracking.isTracking) {\n DdRumResourceTracking.isTracking = false;\n if (this.requestProxy) {\n this.requestProxy.onTrackingStop();\n }\n this.requestProxy = null;\n }\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["distributedTracing.tsx"],"names":["DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegexMap","tracingSamplingRate","propagatorsForHost","generateTracingAttributesWithSampling","propagatorTypes","isSampled","Math","random","tracingAttributes","traceId","TraceIdentifier","spanId","rulePsr","MAX_32_BITS_NUMBER","MAX_31_BITS_NUMBER","constructor","radix","low","high","str","mod","floor","toString","length","Array","join"],"mappings":";;;;;;;AAUA;;;;AAkBA,MAAMA,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;;AAKO,MAAMC,oBAAoB,GAAG,CAAC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,uBAFiC;AAGjCC,EAAAA;AAHiC,CAAD,KAQE;AAClC,MAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACnB,WAAOJ,0BAAP;AACH;;AACD,QAAMO,kBAAkB,GAAG,4CACvBH,QADuB,EAEvBC,uBAFuB,CAA3B;;AAIA,MAAIE,kB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N;AACAG,QAAAA,GAAG,GAAG,CAACC,GAAG,GAAGJ,KAAP,EAAcM,QAAd,CAAuBN,KAAvB,IAAgCG,GAAtC;AACH;;AACD,aAAOA,GAAP;AACH,KAlBa;;AAAA,4CA2BG,CAACH,KAAD,EAAgBO,MAAhB,KAAmC;AAChD,YAAMd,OAAO,GAAG,KAAKa,QAAL,CAAcN,KAAd,CAAhB;;AACA,UAAIP,OAAO,CAACc,MAAR,GAAiBA,MAArB,EAA6B;AACzB,eAAOd,OAAP;AACH;;AACD,aAAOe,KAAK,CAACD,MAAM,GAAGd,OAAO,CAACc,MAAjB,GAA0B,CAA3B,CAAL,CAAmCE,IAAnC,CAAwC,GAAxC,IAA+ChB,OAAtD;AACH,KAjCa;;AACV;AACA,SAAKS,IAAL,GAAYZ,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBO,kBAA3B,CAAZ;AACA,SAAKG,GAAL,GAAWX,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAX;AACH;;AARwB","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 { PropagatorType } from '../../../types';\nimport type { RegexMap } from '../requestProxy/interfaces/RequestProxy';\n\nimport type { Hostname } from './firstPartyHosts';\nimport { getPropagatorsForHost } from './firstPartyHosts';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: TraceId;\n spanId: SpanId;\n samplingPriorityHeader: '1' | '0';\n rulePsr: number;\n propagatorTypes: PropagatorType[];\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegexMap,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegexMap: RegexMap;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n const propagatorsForHost = getPropagatorsForHost(\n hostname,\n firstPartyHostsRegexMap\n );\n if (propagatorsForHost) {\n return generateTracingAttributesWithSampling(\n tracingSamplingRate,\n propagatorsForHost\n );\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number,\n propagatorTypes: PropagatorType[]\n): DdRumResourceTracingAttributes => {\n const isSampled = Math.random() * 100 <= tracingSamplingRate;\n const tracingAttributes: DdRumResourceTracingAttributes = {\n traceId: new TraceIdentifier() as TraceId,\n spanId: new TraceIdentifier() as SpanId,\n samplingPriorityHeader: isSampled ? '1' : '0',\n tracingStrategy: 'KEEP',\n rulePsr: tracingSamplingRate / 100,\n propagatorTypes\n };\n\n return tracingAttributes;\n};\n\n/**\n * Using branded types will ensure we don't accidentally use\n * traceId for spanId when generating headers.\n */\nexport type TraceId = TraceIdentifier & {\n _brand: 'traceId';\n};\n\nexport type SpanId = TraceIdentifier & {\n _brand: 'spanId';\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/0e9722d5b06f6d49264bc82cd254a207d647d66c/packages/rum-core/src/domain/tracing/tracer.ts#L190)\n */\nconst MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\nconst MAX_31_BITS_NUMBER = 2147483647; // 2^31-1\nexport class TraceIdentifier {\n private low: number;\n private high: number;\n\n constructor() {\n // We need to have a 63 bits number max\n this.high = Math.floor(Math.random() * MAX_31_BITS_NUMBER);\n this.low = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n }\n\n toString = (radix: number) => {\n let low = this.low;\n let high = this.high;\n let str = '';\n\n while (high > 0 || low > 0) {\n const mod = (high % radix) * (MAX_32_BITS_NUMBER + 1) + low;\n high = Math.floor(high / radix);\n low = Math.floor(mod / radix);\n str = (mod % radix).toString(radix) + str;\n }\n return str;\n };\n\n /**\n * This function pads the trace with `0`.\n * It should not be used with a `length` lower than the trace, as we return the full trace in this case.\n * @param radix radix for the trace\n * @param length minimum length\n * @returns padded string\n */\n toPaddedString = (radix: number, length: number) => {\n const traceId = this.toString(radix);\n if (traceId.length > length) {\n return traceId;\n }\n return Array(length - traceId.length + 1).join('0') + traceId;\n };\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["firstPartyHosts.ts"],"names":["NO_MATCH_REGEX","RegExp","escapeRegExp","string","replace","firstPartyHostsRegexMapBuilder","firstPartyHosts","hostsMap","datadog","tracecontext","b3","b3multi","forEach","host","propagatorTypes","propagatorType","push","match","regexMap","Object","entries","hosts","length","regex","firstPartyHostsRegexBuilder","firstPartyHostsRegex","map","join","test","e","InternalLog","log","JSON","stringify","SdkVerbosity","WARN","getPropagatorsForHost","hostname","firstPartyHostsRegexMap","matchedPropagatorTypes"],"mappings":";;;;;;;AAMA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AASA;AACO,MAAMA,cAAc,GAAG,IAAIC,MAAJ,CAAW,IAAX,CAAvB,C,CAEP;;;;AACA,MAAMC,YAAY,GAAIC,MAAD,IAAoB;AACrC,SAAOA,MAAM,CAACC,OAAP,CAAe,qBAAf,EAAsC,MAAtC,CAAP,CADqC,CACiB;AACzD,CAFD;;AAIO,MAAMC,8BAA8B,GACvCC,eAD0C,IAE/B;AACX,QAAMC,QAA0C,GAAG;AAC/CC,IAAAA,OAAO,EAAE,EADsC;AAE/CC,IAAAA,YAAY,EAAE,EAFiC;AAG/CC,IAAAA,EAAE,EAAE,EAH2C;AAI/CC,IAAAA,OAAO,EAAE;AAJsC,GAAnD;AAOAL,EAAAA,eAAe,CAACM,OAAhB,CAAwBC,IAAI,IAAI;AAC5BA,IAAAA,IAAI,CAACC,eAAL,CA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,CAAC1B,OAAxB,CAAgC,CAAC;AAAEW,IAAAA,KAAF;AAASR,IAAAA;AAAT,GAAD,KAA+B;AAC3D,QAAIQ,KAAK,CAACK,IAAN,CAAWS,QAAX,CAAJ,EAA0B;AACtBE,MAAAA,sBAAsB,CAACvB,IAAvB,CAA4BD,cAA5B;AACH;AACJ,GAJD;AAKA,SAAOwB,sBAAsB,CAACjB,MAAvB,GAAgC,CAAhC,GAAoCiB,sBAApC,GAA6D,IAApE;AACH,CAXM","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 { FirstPartyHost, PropagatorType } from '../../../types';\nimport type { RegexMap } from '../requestProxy/interfaces/RequestProxy';\n\nexport type Hostname = { _type: 'Hostname' } & string;\n\n// This regex does not match anything\nexport const NO_MATCH_REGEX = new RegExp('a^');\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\nconst escapeRegExp = (string: string) => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n};\n\nexport const firstPartyHostsRegexMapBuilder = (\n firstPartyHosts: FirstPartyHost[]\n): RegexMap => {\n const hostsMap: Record<PropagatorType, string[]> = {\n datadog: [],\n tracecontext: [],\n b3: [],\n b3multi: []\n };\n\n firstPartyHosts.forEach(host => {\n host.propagatorTypes.forEach(propagatorType => {\n hostsMap[propagatorType].push(host.match);\n });\n });\n\n const regexMap: { regex: RegExp; propagatorType: PropagatorType }[] = [];\n Object.entries(hostsMap).forEach(([propagatorType, hosts]) => {\n if (hosts.length > 0) {\n regexMap.push({\n propagatorType: propagatorType as PropagatorType,\n regex: firstPartyHostsRegexBuilder(hosts)\n });\n }\n });\n\n return regexMap;\n};\n\nconst firstPartyHostsRegexBuilder = (firstPartyHosts: string[]): RegExp => {\n if (firstPartyHosts.length === 0) {\n return NO_MATCH_REGEX;\n }\n try {\n // A regexp for matching hosts, e.g. when `hosts` is \"example.com\", it will match\n // \"example.com\", \"api.example.com\", but not \"foo.com\".\n const firstPartyHostsRegex = new RegExp(\n `^(.*\\\\.)*(${firstPartyHosts\n .map(host => `${escapeRegExp(host)}$`)\n .join('|')})`\n );\n firstPartyHostsRegex.test('test_the_regex_is_valid');\n return firstPartyHostsRegex;\n } catch (e) {\n InternalLog.log(\n `Invalid first party hosts list ${JSON.stringify(\n firstPartyHosts\n )}. Regular expressions are not allowed.`,\n SdkVerbosity.WARN\n );\n return NO_MATCH_REGEX;\n }\n};\n\nexport const getPropagatorsForHost = (\n hostname: Hostname,\n firstPartyHostsRegexMap: RegexMap\n): PropagatorType[] | null => {\n const matchedPropagatorTypes: PropagatorType[] = [];\n firstPartyHostsRegexMap.forEach(({ regex, propagatorType }) => {\n if (regex.test(hostname)) {\n matchedPropagatorTypes.push(propagatorType);\n }\n });\n return matchedPropagatorTypes.length > 0 ? matchedPropagatorTypes : null;\n};\n"]}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ResourceReporter = void 0;
7
7
 
8
- var _DdRum = require("../../../../DdRum");
8
+ var _DdRum = require("../../../../../DdRum");
9
9
 
10
10
  var _resourceTiming = require("./resourceTiming");
11
11
 
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ResourceReporter.ts"],"names":["ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","samplingPriorityHeader","undefined","spanId","toString","traceId","rulePsr","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","DdRum","startResource","key","request","method","url","stopResource","response","statusCode","kind","size","resourceContext"],"mappings":";;;;;;;AAMA;;AAGA;;;;AAIO,MAAMA,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAoC;AAAA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CAACyB,QAAT,CAAkBC,UAFtB,EAGI1B,QAAQ,CAACqB,OAAT,CAAiBM,IAHrB,EAII3B,QAAQ,CAACyB,QAAT,CAAkBG,IAJtB,EAKIf,yBAAyB,CAACb,QAAQ,CAACc,OAAV,CAL7B,EAMId,QAAQ,CAACc,OAAT,CAAiBG,QANrB,EAOIjB,QAAQ,CAAC6B,eAPb;AASH,CAlBD","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 { DdRum } from '../../../../../DdRum';\nimport type { RUMResource } from '../../interfaces/RumResource';\n\nimport { createTimings } from './resourceTiming';\n\ntype ResourceMapper = (resource: RUMResource) => RUMResource | null;\n\nexport class ResourceReporter {\n private mappers: ResourceMapper[];\n\n constructor(resourceMappers: ResourceMapper[]) {\n this.mappers = resourceMappers;\n }\n\n reportResource = (resource: RUMResource) => {\n let modifiedResource: RUMResource | null = resource;\n\n for (const mapper of this.mappers) {\n modifiedResource = mapper(resource);\n if (modifiedResource === null) {\n return;\n }\n }\n\n reportResource(modifiedResource);\n };\n}\n\nconst formatResourceStartContext = (\n tracingAttributes: RUMResource['tracingAttributes']\n): Record<string, string | number> | undefined => {\n return tracingAttributes.samplingPriorityHeader === '0'\n ? undefined\n : {\n '_dd.span_id': tracingAttributes.spanId.toString(10),\n '_dd.trace_id': tracingAttributes.traceId.toString(10),\n '_dd.rule_psr': tracingAttributes.rulePsr\n };\n};\n\nconst formatResourceStopContext = (\n timings: RUMResource['timings']\n): Record<string, unknown> => {\n return {\n '_dd.resource_timings':\n timings.responseStartTime !== undefined\n ? createTimings(\n timings.startTime,\n timings.responseStartTime,\n timings.stopTime\n )\n : null\n };\n};\n\nconst reportResource = async (resource: RUMResource) => {\n await DdRum.startResource(\n resource.key,\n resource.request.method,\n resource.request.url,\n formatResourceStartContext(resource.tracingAttributes),\n resource.timings.startTime\n );\n\n DdRum.stopResource(\n resource.key,\n resource.response.statusCode,\n resource.request.kind,\n resource.response.size,\n formatResourceStopContext(resource.timings),\n resource.timings.stopTime,\n resource.resourceContext\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["internalDevResourceBlocklist.ts"],"names":["EXPO_DEV_LOGS_REGEX","RegExp","RN_PACKAGER_SYMBOLICATE_REGEX","internalResourceBlocklist","filterDevResource","resource","resourceRegex","test","request","url"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,IAAIC,MAAJ,CACxB,oEADwB,CAA5B;AAIA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAG,IAAID,MAAJ,CAClC,uCADkC,CAAtC;AAIA,MAAME,yBAAmC,GAAG,CACxCH,mBADwC,EAExCE,6BAFwC,CAA5C;AAKA;AACA;AACA;AACA;;AACO,MAAME,iBAAiB,GAC1BC,QAD6B,IAER;AACrB;AACA;AACA;AACA,OAAK,MAAMC,aAAX,IAA4BH,yBAA5B,EAAuD;AACnD,QAAIG,aAAa,CAACC,IAAd,CAAmBF,QAAQ,CAACG,OAAT,CAAiBC,GAApC,CAAJ,EAA8C;AAC1C,aAAO,IAAP;AACH;AACJ;;AACD,SAAOJ,QAAP;AACH,CAZM","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 { RUMResource } from '../../interfaces/RumResource';\n\n/**\n * Expo sends all console.* calls to the packager. As we log all API calls\n * when the SDKVerbosity is DEBUG, this would result in an infinite loop of\n * `console.log` and API calls, creating 250 RUM resources per second.\n *\n * The hostname is always going to be localhost or a local IP.\n *\n * An example URL is http://192.168.1.20:8081/logs or http://10.46.29.155:19000/logs\n */\nconst EXPO_DEV_LOGS_REGEX = new RegExp(\n '^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost):[0-9]+/logs$'\n);\n\n/**\n * This call is made every time the RN packager reloads the js in dev mode.\n */\nconst RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp(\n '^http://localhost:[0-9]+/symbolicate$'\n);\n\nconst internalResourceBlocklist: RegExp[] = [\n EXPO_DEV_LOGS_REGEX,\n RN_PACKAGER_SYMBOLICATE_REGEX\n];\n\n/**\n * Filters RN symbolicate calls and Expo logs calls that happen only in dev.\n * @param resource RUMResource\n */\nexport const filterDevResource = (\n resource: RUMResource\n): RUMResource | null => {\n // TODO: if we get the confirmation by Expo that the\n // logs call is only made when __DEV__ is true, add an\n // early return for when it is false.\n for (const resourceRegex of internalResourceBlocklist) {\n if (resourceRegex.test(resource.request.url)) {\n return null;\n }\n }\n return resource;\n};\n"]}
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.URLHostParser = void 0;
7
7
 
8
- var _InternalLog = require("../../../../InternalLog");
8
+ var _InternalLog = require("../../../../../InternalLog");
9
9
 
10
- var _SdkVerbosity = require("../../../../SdkVerbosity");
10
+ var _SdkVerbosity = require("../../../../../SdkVerbosity");
11
11
 
12
12
  /*
13
13
  * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
@@ -1 +1 @@
1
- {"version":3,"sources":["URLHostParser.ts"],"names":["hostRegex","URLHostParser","url","matchedHost","match","e","InternalLog","log","SdkVerbosity","WARN"],"mappings":";;;;;;;AAMA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAMA;AACA,MAAMA,SAAS,GAAG,mBAAlB;AAEA;AACA;AACA;AACA;;AACO,MAAMC,aAAa,GAAIC,GAAD,IAAkC;AAC3D,MAAI;AACA,UAAMC,WAAW,GAAGD,GAAG,CAACE,KAAJ,CAAUJ,SAAV,CAApB;;AACA,QAAIG,WAAW,KAAK,IAApB,EAA0B;AACtB,aAAO,IAAP;AACH,KAJD,CAKA;;;AACA,WAAOA,WAAW,CAAC,CAAD,CAAlB;AACH,GAPD,CAOE,OAAOE,CAAP,EAAU;AACRC,6BAAYC,GAAZ,CAAiB,sBAAqBL,GAAI,SAA1C,EAAoDM,2BAAaC,IAAjE;;AACA,WAAO,IAAP;AACH;AACJ,CAZM","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 { Hostname } from '../domain/firstPartyHosts';\n\n// matches what is between the first \"://\" and the next \"/\", \":\" or whitespace\nconst hostRegex = '^.+://([^:/\\\\s]+)';\n\n/**\n * Returns the host from an URL.\n * @returns the host (without the port) or null if could not cast the URL as host\n */\nexport const URLHostParser = (url: string): Hostname | null => {\n try {\n const matchedHost = url.match(hostRegex);\n if (matchedHost === null) {\n return null;\n }\n // [0] is the input, [1] is the captured group\n return matchedHost[1] as Hostname;\n } catch (e) {\n InternalLog.log(`Impossible to cast ${url} as URL`, SdkVerbosity.WARN);\n return null;\n }\n};\n"]}
1
+ {"version":3,"sources":["URLHostParser.ts"],"names":["hostRegex","URLHostParser","url","matchedHost","match","e","InternalLog","log","SdkVerbosity","WARN"],"mappings":";;;;;;;AAMA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAMA;AACA,MAAMA,SAAS,GAAG,mBAAlB;AAEA;AACA;AACA;AACA;;AACO,MAAMC,aAAa,GAAIC,GAAD,IAAkC;AAC3D,MAAI;AACA,UAAMC,WAAW,GAAGD,GAAG,CAACE,KAAJ,CAAUJ,SAAV,CAApB;;AACA,QAAIG,WAAW,KAAK,IAApB,EAA0B;AACtB,aAAO,IAAP;AACH,KAJD,CAKA;;;AACA,WAAOA,WAAW,CAAC,CAAD,CAAlB;AACH,GAPD,CAOE,OAAOE,CAAP,EAAU;AACRC,6BAAYC,GAAZ,CAAiB,sBAAqBL,GAAI,SAA1C,EAAoDM,2BAAaC,IAAjE;;AACA,WAAO,IAAP;AACH;AACJ,CAZM","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 { Hostname } from '../../distributedTracing/firstPartyHosts';\n\n// matches what is between the first \"://\" and the next \"/\", \":\" or whitespace\nconst hostRegex = '^.+://([^:/\\\\s]+)';\n\n/**\n * Returns the host from an URL.\n * @returns the host (without the port) or null if could not cast the URL as host\n */\nexport const URLHostParser = (url: string): Hostname | null => {\n try {\n const matchedHost = url.match(hostRegex);\n if (matchedHost === null) {\n return null;\n }\n // [0] is the input, [1] is the captured group\n return matchedHost[1] as Hostname;\n } catch (e) {\n InternalLog.log(`Impossible to cast ${url} as URL`, SdkVerbosity.WARN);\n return null;\n }\n};\n"]}
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.XHRProxy = void 0;
7
7
 
8
- var _Timer = _interopRequireDefault(require("../../../../Timer"));
8
+ var _Timer = _interopRequireDefault(require("../../../../../Timer"));
9
9
 
10
- var _distributedTracingHeaders = require("../domain/distributedTracingHeaders");
10
+ var _distributedTracingHeaders = require("../../distributedTracing/distributedTracingHeaders");
11
11
 
12
- var _distributedTracing = require("../domain/distributedTracing");
12
+ var _distributedTracing = require("../../distributedTracing/distributedTracing");
13
13
 
14
- var _RequestProxy = require("../domain/interfaces/RequestProxy");
14
+ var _RequestProxy = require("../interfaces/RequestProxy");
15
15
 
16
16
  var _URLHostParser = require("./URLHostParser");
17
17