@datadog/mobile-react-native 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +2 -2
- package/android/build.gradle +58 -64
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +31 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +242 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +6 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +106 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +116 -0
- package/ios/Sources/Attributes.swift +14 -0
- package/ios/Sources/DdSdk.swift +18 -0
- package/lib/commonjs/DdSdkReactNative.js +40 -8
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +42 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/foundation.js +2 -139
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +18 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +71 -0
- package/lib/commonjs/logs/DdLogs.js.map +1 -0
- package/lib/commonjs/logs/eventMapper.js +39 -0
- package/lib/commonjs/logs/eventMapper.js.map +1 -0
- package/lib/commonjs/logs/types.js +2 -0
- package/lib/commonjs/{rum/instrumentation/EventsInterceptor.js.map → logs/types.js.map} +0 -0
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +234 -0
- package/lib/commonjs/rum/DdRum.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js +36 -0
- package/lib/commonjs/rum/eventMappers/actionEventMapper.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js +32 -0
- package/lib/commonjs/rum/eventMappers/errorEventMapper.js.map +1 -0
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js +38 -0
- package/lib/commonjs/rum/eventMappers/resourceEventMapper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -4
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
- package/lib/{module/rum/instrumentation → commonjs/rum/instrumentation/interactionTracking}/EventsInterceptor.js.map +0 -0
- package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
- package/lib/commonjs/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/types.js +42 -0
- package/lib/commonjs/rum/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +45 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AttributesSingleton/types.js.map +1 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
- package/lib/commonjs/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +85 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js +98 -0
- package/lib/commonjs/sdk/EventMappers/utils/deepClone.js.map +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +43 -0
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/UserInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/UserInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/types.js +1 -26
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +33 -7
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +42 -2
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/foundation.js +2 -124
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +5 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +64 -0
- package/lib/module/logs/DdLogs.js.map +1 -0
- package/lib/module/logs/eventMapper.js +20 -0
- package/lib/module/logs/eventMapper.js.map +1 -0
- package/lib/module/logs/types.js +2 -0
- package/lib/module/logs/types.js.map +1 -0
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +212 -0
- package/lib/module/rum/DdRum.js.map +1 -0
- package/lib/module/rum/eventMappers/actionEventMapper.js +26 -0
- package/lib/module/rum/eventMappers/actionEventMapper.js.map +1 -0
- package/lib/module/rum/eventMappers/errorEventMapper.js +22 -0
- package/lib/module/rum/eventMappers/errorEventMapper.js.map +1 -0
- package/lib/module/rum/eventMappers/resourceEventMapper.js +28 -0
- package/lib/module/rum/eventMappers/resourceEventMapper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +2 -2
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/{DdEventsInterceptor.js → interactionTracking/DdEventsInterceptor.js} +6 -6
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -0
- package/lib/module/rum/instrumentation/{DdRumUserInteractionTracking.js → interactionTracking/DdRumUserInteractionTracking.js} +13 -4
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -0
- package/lib/module/rum/instrumentation/{EventsInterceptor.js → interactionTracking/EventsInterceptor.js} +0 -0
- package/lib/module/rum/instrumentation/interactionTracking/EventsInterceptor.js.map +1 -0
- package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js → interactionTracking/NoOpEventsInterceptor.js} +0 -0
- package/lib/module/rum/instrumentation/{NoOpEventsInterceptor.js.map → interactionTracking/NoOpEventsInterceptor.js.map} +0 -0
- package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js → interactionTracking/ShallowObjectEqualityChecker.js} +0 -0
- package/lib/module/rum/instrumentation/{ShallowObjectEqualityChecker.js.map → interactionTracking/ShallowObjectEqualityChecker.js.map} +0 -0
- package/lib/module/rum/instrumentation/{getJsxRuntime.js → interactionTracking/getJsxRuntime.js} +0 -0
- package/lib/module/rum/instrumentation/{getJsxRuntime.js.map → interactionTracking/getJsxRuntime.js.map} +0 -0
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +2 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/module/rum/types.js +33 -0
- package/lib/module/rum/types.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +36 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/types.js +2 -0
- package/lib/module/sdk/AttributesSingleton/types.js.map +1 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.js.map +0 -0
- package/lib/module/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.js +4 -4
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +72 -0
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -0
- package/lib/module/sdk/EventMappers/utils/deepClone.js +89 -0
- package/lib/module/sdk/EventMappers/utils/deepClone.js.map +1 -0
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +34 -0
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -0
- package/lib/module/sdk/UserInfoSingleton/types.js +2 -0
- package/lib/module/sdk/UserInfoSingleton/types.js.map +1 -0
- package/lib/module/types.js +0 -23
- package/lib/module/types.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +7 -3
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +22 -0
- package/lib/typescript/foundation.d.ts +2 -4
- package/lib/typescript/index.d.ts +5 -3
- package/lib/typescript/logs/DdLogs.d.ts +14 -0
- package/lib/typescript/logs/eventMapper.d.ts +11 -0
- package/lib/typescript/logs/types.d.ts +54 -0
- package/lib/typescript/nativeModulesTypes.d.ts +1 -1
- package/lib/typescript/rum/DdRum.d.ts +36 -0
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +21 -0
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +21 -0
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/{DdEventsInterceptor.d.ts → interactionTracking/DdEventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{DdRumUserInteractionTracking.d.ts → interactionTracking/DdRumUserInteractionTracking.d.ts} +1 -0
- package/lib/typescript/rum/instrumentation/{EventsInterceptor.d.ts → interactionTracking/EventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{NoOpEventsInterceptor.d.ts → interactionTracking/NoOpEventsInterceptor.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{ShallowObjectEqualityChecker.d.ts → interactionTracking/ShallowObjectEqualityChecker.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/{getJsxRuntime.d.ts → interactionTracking/getJsxRuntime.d.ts} +0 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +0 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +0 -1
- package/lib/typescript/rum/types.d.ts +110 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +12 -0
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts +3 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.d.ts +0 -0
- package/lib/typescript/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.d.ts +2 -2
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +24 -0
- package/lib/typescript/sdk/EventMappers/utils/deepClone.d.ts +10 -0
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +12 -0
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/types.d.ts +0 -139
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/replace-react-require.js +3 -2
- package/src/DdSdkReactNative.tsx +41 -7
- package/src/DdSdkReactNativeConfiguration.tsx +83 -3
- package/src/__tests__/DdSdkReactNative.test.tsx +244 -13
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +29 -7
- package/src/__tests__/{longTasksUtils.ts → longTasksUtils.test.ts} +0 -0
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +4 -3
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +3 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +135 -117
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +1 -1
- package/src/foundation.tsx +4 -114
- package/src/index.tsx +5 -3
- package/src/logs/DdLogs.ts +67 -0
- package/src/logs/__tests__/DdLogs.test.ts +51 -0
- package/src/logs/__tests__/eventMapper.test.ts +53 -0
- package/src/logs/eventMapper.ts +43 -0
- package/src/logs/types.ts +70 -0
- package/src/nativeModulesTypes.ts +1 -1
- package/src/rum/DdRum.ts +387 -0
- package/src/rum/__tests__/DdRum.test.ts +386 -0
- package/src/rum/eventMappers/actionEventMapper.ts +66 -0
- package/src/rum/eventMappers/errorEventMapper.ts +57 -0
- package/src/rum/eventMappers/resourceEventMapper.ts +74 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +2 -2
- package/src/rum/instrumentation/{DdEventsInterceptor.tsx → interactionTracking/DdEventsInterceptor.tsx} +14 -6
- package/src/rum/instrumentation/{DdRumUserInteractionTracking.tsx → interactionTracking/DdRumUserInteractionTracking.tsx} +12 -4
- package/src/rum/instrumentation/{EventsInterceptor.tsx → interactionTracking/EventsInterceptor.tsx} +0 -0
- package/src/rum/instrumentation/{NoOpEventsInterceptor.tsx → interactionTracking/NoOpEventsInterceptor.tsx} +0 -0
- package/src/rum/instrumentation/{ShallowObjectEqualityChecker.ts → interactionTracking/ShallowObjectEqualityChecker.ts} +0 -0
- package/src/rum/instrumentation/{getJsxRuntime.ts → interactionTracking/getJsxRuntime.ts} +0 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +3 -2
- package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +89 -40
- package/src/rum/types.ts +182 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +34 -0
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +44 -0
- package/src/sdk/AttributesSingleton/types.ts +9 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BoundedBuffer.ts +4 -4
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/BufferSingleton.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/DatadogBuffer.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/PassThroughBuffer.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BoundedBuffer.test.ts +2 -2
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/__tests__/BufferSingleton.test.ts +2 -1
- package/src/{DatadogProvider → sdk/DatadogProvider}/Buffer/bufferNativeCall.ts +0 -0
- package/src/{DatadogProvider → sdk/DatadogProvider}/DatadogProvider.tsx +5 -5
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/__utils__/renderWithProvider.tsx +2 -2
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initialization.test.tsx +13 -10
- package/src/{DatadogProvider → sdk/DatadogProvider}/__tests__/initializationModes.test.tsx +10 -6
- package/src/sdk/EventMappers/EventMapper.ts +94 -0
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +50 -0
- package/src/sdk/EventMappers/utils/__tests__/deepClone.test.ts +79 -0
- package/src/sdk/EventMappers/utils/deepClone.ts +86 -0
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +31 -0
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +29 -0
- package/src/sdk/UserInfoSingleton/types.ts +12 -0
- package/src/types.tsx +0 -210
- package/src/version.ts +1 -1
- package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
- package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
- package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +0 -1
- package/lib/module/DatadogProvider/DatadogProvider.js.map +0 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +0 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +0 -1
- package/src/__tests__/DdRumWrapper.test.tsx +0 -74
- package/src/__tests__/foundation.test.ts +0 -88
|
@@ -17,8 +17,8 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/Sources/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency 'DatadogSDK', '~> 1.
|
|
21
|
-
s.dependency 'DatadogSDKCrashReporting', '~> 1.
|
|
20
|
+
s.dependency 'DatadogSDK', '~> 1.15.0'
|
|
21
|
+
s.dependency 'DatadogSDKCrashReporting', '~> 1.15.0'
|
|
22
22
|
|
|
23
23
|
s.test_spec 'Tests' do |test_spec|
|
|
24
24
|
test_spec.source_files = 'ios/Tests/*.swift'
|
package/android/build.gradle
CHANGED
|
@@ -25,6 +25,46 @@ apply plugin: 'kotlin-android'
|
|
|
25
25
|
apply plugin: 'org.jlleitschuh.gradle.ktlint'
|
|
26
26
|
apply plugin: "io.gitlab.arturbosch.detekt"
|
|
27
27
|
|
|
28
|
+
def resolveReactNativeDirectory() {
|
|
29
|
+
def reactNativeLocation = rootProject.hasProperty("reactNativeDir") ? rootProject.getProperty("reactNativeDir") : null
|
|
30
|
+
|
|
31
|
+
if (reactNativeLocation != null) {
|
|
32
|
+
return file(reactNativeLocation)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
// Resolve React Native location with Node
|
|
37
|
+
// This will make sure that we get installation location correctly in monorepos
|
|
38
|
+
def reactNativePackageJsonPathStdout = new ByteArrayOutputStream()
|
|
39
|
+
|
|
40
|
+
exec {
|
|
41
|
+
commandLine("node", "-p", "require.resolve('react-native/package.json')")
|
|
42
|
+
ignoreExitValue true
|
|
43
|
+
standardOutput = reactNativePackageJsonPathStdout
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
def reactNativeFromProjectNodeModules = file(reactNativePackageJsonPathStdout.toString().trim()).getParentFile();
|
|
47
|
+
|
|
48
|
+
if (reactNativeFromProjectNodeModules.exists()) {
|
|
49
|
+
return reactNativeFromProjectNodeModules
|
|
50
|
+
}
|
|
51
|
+
} catch (e) {
|
|
52
|
+
// Ignore
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
throw new Exception(
|
|
56
|
+
"${project.name}: Failed to resolve 'react-native' in the project. " +
|
|
57
|
+
"Altenatively, you can specify 'reactNativeDir' with the path to 'react-native' in your 'gradle.properties' file."
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
def reactNativeRootDir = resolveReactNativeDirectory()
|
|
62
|
+
def reactProperties = new Properties()
|
|
63
|
+
file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
|
|
64
|
+
|
|
65
|
+
def reactNativeVersion = reactProperties.getProperty("VERSION_NAME")
|
|
66
|
+
def (reactNativeMajorVersion, reactNativeMinorVersion) = reactNativeVersion.split("\\.").collect { it.isInteger() ? it.toInteger() : it }
|
|
67
|
+
|
|
28
68
|
def getExtOrDefault(name) {
|
|
29
69
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['DdSdkReactNative_' + name]
|
|
30
70
|
}
|
|
@@ -78,81 +118,35 @@ repositories {
|
|
|
78
118
|
maven { url "https://jitpack.io" }
|
|
79
119
|
mavenLocal()
|
|
80
120
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
86
|
-
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
87
|
-
} else {
|
|
88
|
-
defaultDir = new File(
|
|
89
|
-
projectDir,
|
|
90
|
-
'/../../../node_modules/react-native/android'
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (defaultDir.exists()) {
|
|
95
|
-
maven {
|
|
96
|
-
url defaultDir.toString()
|
|
97
|
-
name androidSourcesName
|
|
98
|
-
}
|
|
121
|
+
if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71) {
|
|
122
|
+
def androidSourcesDir = file("$reactNativeRootDir/android")
|
|
123
|
+
def androidSourcesName = "React Native sources"
|
|
99
124
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
1.upto(5, {
|
|
106
|
-
if (found) return true
|
|
107
|
-
parentDir = parentDir.parentFile
|
|
108
|
-
|
|
109
|
-
def androidSourcesDir = new File(
|
|
110
|
-
parentDir,
|
|
111
|
-
'node_modules/react-native'
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
def androidPrebuiltBinaryDir = new File(
|
|
115
|
-
parentDir,
|
|
116
|
-
'node_modules/react-native/android'
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
if (androidPrebuiltBinaryDir.exists()) {
|
|
120
|
-
maven {
|
|
121
|
-
url androidPrebuiltBinaryDir.toString()
|
|
122
|
-
name androidSourcesName
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
126
|
-
found = true
|
|
127
|
-
} else if (androidSourcesDir.exists()) {
|
|
128
|
-
maven {
|
|
129
|
-
url androidSourcesDir.toString()
|
|
130
|
-
name androidSourcesName
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
134
|
-
found = true
|
|
125
|
+
if (androidSourcesDir.exists()) {
|
|
126
|
+
maven {
|
|
127
|
+
url androidSourcesDir.toString()
|
|
128
|
+
name androidSourcesName
|
|
135
129
|
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (!found) {
|
|
140
|
-
throw new GradleException(
|
|
141
|
-
"${project.name}: unable to locate React Native android sources. " +
|
|
142
|
-
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
143
|
-
)
|
|
130
|
+
}
|
|
144
131
|
}
|
|
145
132
|
}
|
|
146
133
|
|
|
147
134
|
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
148
135
|
|
|
149
136
|
dependencies {
|
|
150
|
-
|
|
151
|
-
|
|
137
|
+
if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71) {
|
|
138
|
+
// noinspection GradleDynamicVersion
|
|
139
|
+
api 'com.facebook.react:react-native:+'
|
|
140
|
+
} else {
|
|
141
|
+
// We specify the $reactNativeVersion, like it's done on the react-native-gradle-plugin, as the plugin is not applied in tests.
|
|
142
|
+
// There is no impact for apps as we apply the same logic:
|
|
143
|
+
// https://github.com/facebook/react-native/blob/e1a1e6aa8030bf11d691c3dcf7abd13b25175027/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/DependencyUtils.kt
|
|
144
|
+
api "com.facebook.react:react-android:$reactNativeVersion"
|
|
145
|
+
}
|
|
152
146
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
153
147
|
compileOnly "com.squareup.okhttp3:okhttp:3.12.13"
|
|
154
148
|
|
|
155
|
-
implementation "com.datadoghq:dd-sdk-android:1.
|
|
149
|
+
implementation "com.datadoghq:dd-sdk-android:1.17.0"
|
|
156
150
|
testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
|
|
157
151
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
|
|
158
152
|
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
|
@@ -20,6 +20,8 @@ import com.datadog.android.privacy.TrackingConsent
|
|
|
20
20
|
import com.datadog.android.rum.GlobalRum
|
|
21
21
|
import com.datadog.android.rum.RumMonitor
|
|
22
22
|
import com.datadog.android.rum.RumPerformanceMetric
|
|
23
|
+
import com.datadog.android.rum.model.ActionEvent
|
|
24
|
+
import com.datadog.android.rum.model.ResourceEvent
|
|
23
25
|
import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
|
|
24
26
|
import com.datadog.android.telemetry.model.TelemetryConfigurationEvent
|
|
25
27
|
import com.facebook.react.bridge.Promise
|
|
@@ -165,7 +167,7 @@ class DdSdk(
|
|
|
165
167
|
} ?: DEFAULT_APP_VERSION
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
@Suppress("ComplexMethod", "UnsafeCallOnNullableType")
|
|
170
|
+
@Suppress("ComplexMethod", "LongMethod", "UnsafeCallOnNullableType")
|
|
169
171
|
private fun buildConfiguration(configuration: DdSdkConfiguration): Configuration {
|
|
170
172
|
val additionalConfig = configuration.additionalConfig?.toMutableMap()
|
|
171
173
|
|
|
@@ -211,6 +213,13 @@ class DdSdk(
|
|
|
211
213
|
configBuilder.useViewTrackingStrategy(NoOpViewTrackingStrategy)
|
|
212
214
|
}
|
|
213
215
|
|
|
216
|
+
val interactionTracking = configuration.additionalConfig?.get(
|
|
217
|
+
DD_NATIVE_INTERACTION_TRACKING
|
|
218
|
+
) as? Boolean
|
|
219
|
+
if (interactionTracking == false) {
|
|
220
|
+
configBuilder.disableInteractionTracking()
|
|
221
|
+
}
|
|
222
|
+
|
|
214
223
|
val firstPartyHosts =
|
|
215
224
|
(configuration.additionalConfig?.get(DD_FIRST_PARTY_HOSTS) as? List<String>)
|
|
216
225
|
if (firstPartyHosts != null) {
|
|
@@ -221,6 +230,24 @@ class DdSdk(
|
|
|
221
230
|
configBuilder.setProxy(proxy, authenticator)
|
|
222
231
|
}
|
|
223
232
|
|
|
233
|
+
configBuilder.setRumResourceEventMapper(object : EventMapper<ResourceEvent> {
|
|
234
|
+
override fun map(event: ResourceEvent): ResourceEvent? {
|
|
235
|
+
if (event.context?.additionalProperties?.containsKey(DD_DROP_RESOURCE) == true) {
|
|
236
|
+
return null
|
|
237
|
+
}
|
|
238
|
+
return event
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
configBuilder.setRumActionEventMapper(object : EventMapper<ActionEvent> {
|
|
243
|
+
override fun map(event: ActionEvent): ActionEvent? {
|
|
244
|
+
if (event.context?.additionalProperties?.containsKey(DD_DROP_ACTION) == true) {
|
|
245
|
+
return null
|
|
246
|
+
}
|
|
247
|
+
return event
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
|
|
224
251
|
_InternalProxy.setTelemetryConfigurationEventMapper(
|
|
225
252
|
configBuilder,
|
|
226
253
|
object : EventMapper<TelemetryConfigurationEvent> {
|
|
@@ -399,6 +426,7 @@ class DdSdk(
|
|
|
399
426
|
companion object {
|
|
400
427
|
internal const val DEFAULT_APP_VERSION = "?"
|
|
401
428
|
internal const val DD_NATIVE_VIEW_TRACKING = "_dd.native_view_tracking"
|
|
429
|
+
internal const val DD_NATIVE_INTERACTION_TRACKING = "_dd.native_interaction_tracking"
|
|
402
430
|
internal const val DD_SDK_VERBOSITY = "_dd.sdk_verbosity"
|
|
403
431
|
internal const val DD_SERVICE_NAME = "_dd.service_name"
|
|
404
432
|
internal const val DD_FIRST_PARTY_HOSTS = "_dd.first_party_hosts"
|
|
@@ -409,6 +437,8 @@ class DdSdk(
|
|
|
409
437
|
internal const val DD_PROXY_TYPE = "_dd.proxy.type"
|
|
410
438
|
internal const val DD_PROXY_USERNAME = "_dd.proxy.username"
|
|
411
439
|
internal const val DD_PROXY_PASSWORD = "_dd.proxy.password"
|
|
440
|
+
internal const val DD_DROP_RESOURCE = "_dd.resource.drop_resource"
|
|
441
|
+
internal const val DD_DROP_ACTION = "_dd.action.drop_action"
|
|
412
442
|
internal const val MONITOR_JS_ERROR_MESSAGE = "Error monitoring JS refresh rate"
|
|
413
443
|
internal const val PACKAGE_INFO_NOT_FOUND_ERROR_MESSAGE = "Error getting package info"
|
|
414
444
|
}
|
|
@@ -22,8 +22,11 @@ import com.datadog.android.rum.GlobalRum
|
|
|
22
22
|
import com.datadog.android.rum.RumMonitor
|
|
23
23
|
import com.datadog.android.rum.RumPerformanceMetric
|
|
24
24
|
import com.datadog.android.rum._RumInternalProxy
|
|
25
|
+
import com.datadog.android.rum.model.ActionEvent
|
|
26
|
+
import com.datadog.android.rum.model.ResourceEvent
|
|
25
27
|
import com.datadog.android.rum.tracking.ActivityViewTrackingStrategy
|
|
26
28
|
import com.datadog.android.telemetry.model.TelemetryConfigurationEvent
|
|
29
|
+
import com.datadog.android.tracing.TracingHeaderType
|
|
27
30
|
import com.datadog.tools.unit.GenericAssert.Companion.assertThat
|
|
28
31
|
import com.datadog.tools.unit.forge.BaseConfigurator
|
|
29
32
|
import com.datadog.tools.unit.getStaticValue
|
|
@@ -176,7 +179,7 @@ internal class DdSdkTest {
|
|
|
176
179
|
assertThat(configCaptor.firstValue)
|
|
177
180
|
.hasField("coreConfig") {
|
|
178
181
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
179
|
-
it.hasFieldEqualTo("
|
|
182
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
180
183
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
181
184
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
182
185
|
}
|
|
@@ -226,7 +229,7 @@ internal class DdSdkTest {
|
|
|
226
229
|
assertThat(configCaptor.firstValue)
|
|
227
230
|
.hasField("coreConfig") {
|
|
228
231
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
229
|
-
it.hasFieldEqualTo("
|
|
232
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
230
233
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
231
234
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
232
235
|
}
|
|
@@ -274,7 +277,7 @@ internal class DdSdkTest {
|
|
|
274
277
|
assertThat(configCaptor.firstValue)
|
|
275
278
|
.hasField("coreConfig") {
|
|
276
279
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
277
|
-
it.hasFieldEqualTo("
|
|
280
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
278
281
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
279
282
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
280
283
|
}
|
|
@@ -326,7 +329,7 @@ internal class DdSdkTest {
|
|
|
326
329
|
assertThat(configCaptor.firstValue)
|
|
327
330
|
.hasField("coreConfig") {
|
|
328
331
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
329
|
-
it.hasFieldEqualTo("
|
|
332
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
330
333
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
331
334
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
332
335
|
}
|
|
@@ -378,7 +381,7 @@ internal class DdSdkTest {
|
|
|
378
381
|
assertThat(configCaptor.firstValue)
|
|
379
382
|
.hasField("coreConfig") {
|
|
380
383
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
381
|
-
it.hasFieldEqualTo("
|
|
384
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
382
385
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
383
386
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
384
387
|
}
|
|
@@ -430,7 +433,7 @@ internal class DdSdkTest {
|
|
|
430
433
|
assertThat(configCaptor.firstValue)
|
|
431
434
|
.hasField("coreConfig") {
|
|
432
435
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
433
|
-
it.hasFieldEqualTo("
|
|
436
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
434
437
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
435
438
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
436
439
|
}
|
|
@@ -473,7 +476,7 @@ internal class DdSdkTest {
|
|
|
473
476
|
assertThat(configCaptor.firstValue)
|
|
474
477
|
.hasField("coreConfig") {
|
|
475
478
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
476
|
-
it.hasFieldEqualTo("
|
|
479
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
477
480
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
478
481
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
479
482
|
}
|
|
@@ -526,7 +529,7 @@ internal class DdSdkTest {
|
|
|
526
529
|
assertThat(configCaptor.firstValue)
|
|
527
530
|
.hasField("coreConfig") {
|
|
528
531
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
529
|
-
it.hasFieldEqualTo("
|
|
532
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
530
533
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
531
534
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
532
535
|
}
|
|
@@ -583,7 +586,7 @@ internal class DdSdkTest {
|
|
|
583
586
|
assertThat(configCaptor.firstValue)
|
|
584
587
|
.hasField("coreConfig") {
|
|
585
588
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
586
|
-
it.hasFieldEqualTo("
|
|
589
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
587
590
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
588
591
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
589
592
|
}
|
|
@@ -640,7 +643,7 @@ internal class DdSdkTest {
|
|
|
640
643
|
assertThat(configCaptor.firstValue)
|
|
641
644
|
.hasField("coreConfig") {
|
|
642
645
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
643
|
-
it.hasFieldEqualTo("
|
|
646
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
644
647
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
645
648
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
646
649
|
}
|
|
@@ -697,7 +700,7 @@ internal class DdSdkTest {
|
|
|
697
700
|
assertThat(configCaptor.firstValue)
|
|
698
701
|
.hasField("coreConfig") {
|
|
699
702
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
700
|
-
it.hasFieldEqualTo("
|
|
703
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
701
704
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
702
705
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
703
706
|
}
|
|
@@ -754,7 +757,7 @@ internal class DdSdkTest {
|
|
|
754
757
|
assertThat(configCaptor.firstValue)
|
|
755
758
|
.hasField("coreConfig") {
|
|
756
759
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
757
|
-
it.hasFieldEqualTo("
|
|
760
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
758
761
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
759
762
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
760
763
|
}
|
|
@@ -811,7 +814,7 @@ internal class DdSdkTest {
|
|
|
811
814
|
assertThat(configCaptor.firstValue)
|
|
812
815
|
.hasField("coreConfig") {
|
|
813
816
|
it.hasFieldEqualTo("needsClearTextHttp", false)
|
|
814
|
-
it.hasFieldEqualTo("
|
|
817
|
+
it.hasFieldEqualTo("firstPartyHostsWithHeaderTypes", emptyMap<String, String>())
|
|
815
818
|
it.hasFieldEqualTo("batchSize", BatchSize.MEDIUM)
|
|
816
819
|
it.hasFieldEqualTo("uploadFrequency", UploadFrequency.AVERAGE)
|
|
817
820
|
}
|
|
@@ -1037,6 +1040,112 @@ internal class DdSdkTest {
|
|
|
1037
1040
|
}
|
|
1038
1041
|
}
|
|
1039
1042
|
|
|
1043
|
+
@Test
|
|
1044
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {no user action tracking}`(
|
|
1045
|
+
@Forgery configuration: DdSdkConfiguration
|
|
1046
|
+
) {
|
|
1047
|
+
// Given
|
|
1048
|
+
val bridgeConfiguration = configuration.copy(
|
|
1049
|
+
additionalConfig = mapOf(
|
|
1050
|
+
DdSdk.DD_NATIVE_INTERACTION_TRACKING to false
|
|
1051
|
+
)
|
|
1052
|
+
)
|
|
1053
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
1054
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1055
|
+
|
|
1056
|
+
// When
|
|
1057
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1058
|
+
|
|
1059
|
+
// Then
|
|
1060
|
+
inOrder(mockDatadog) {
|
|
1061
|
+
verify(mockDatadog).initialize(
|
|
1062
|
+
same(mockContext),
|
|
1063
|
+
credentialCaptor.capture(),
|
|
1064
|
+
configCaptor.capture(),
|
|
1065
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1066
|
+
)
|
|
1067
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
1068
|
+
}
|
|
1069
|
+
assertThat(configCaptor.firstValue)
|
|
1070
|
+
.hasField("rumConfig") {
|
|
1071
|
+
it.hasFieldWithClass(
|
|
1072
|
+
"userActionTrackingStrategy",
|
|
1073
|
+
"com.datadog.android.rum.internal.tracking.NoOpUserActionTrackingStrategy"
|
|
1074
|
+
)
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
@Test
|
|
1079
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {with user action tracking}`(
|
|
1080
|
+
@Forgery configuration: DdSdkConfiguration
|
|
1081
|
+
) {
|
|
1082
|
+
// Given
|
|
1083
|
+
val bridgeConfiguration = configuration.copy(
|
|
1084
|
+
additionalConfig = mapOf(
|
|
1085
|
+
DdSdk.DD_NATIVE_INTERACTION_TRACKING to true
|
|
1086
|
+
)
|
|
1087
|
+
)
|
|
1088
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
1089
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1090
|
+
|
|
1091
|
+
// When
|
|
1092
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1093
|
+
|
|
1094
|
+
// Then
|
|
1095
|
+
inOrder(mockDatadog) {
|
|
1096
|
+
verify(mockDatadog).initialize(
|
|
1097
|
+
same(mockContext),
|
|
1098
|
+
credentialCaptor.capture(),
|
|
1099
|
+
configCaptor.capture(),
|
|
1100
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1101
|
+
)
|
|
1102
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
1103
|
+
}
|
|
1104
|
+
assertThat(configCaptor.firstValue)
|
|
1105
|
+
.hasField("rumConfig") {
|
|
1106
|
+
it.hasFieldWithClass(
|
|
1107
|
+
"userActionTrackingStrategy",
|
|
1108
|
+
"com.datadog.android.rum.internal" +
|
|
1109
|
+
".instrumentation.UserActionTrackingStrategyLegacy"
|
|
1110
|
+
)
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
@Test
|
|
1115
|
+
fun `𝕄 initialize native SDK 𝕎 initialize() {invalid user action tracking}`(
|
|
1116
|
+
@Forgery configuration: DdSdkConfiguration
|
|
1117
|
+
) {
|
|
1118
|
+
// Given
|
|
1119
|
+
val bridgeConfiguration = configuration.copy(
|
|
1120
|
+
additionalConfig = mapOf(
|
|
1121
|
+
DdSdk.DD_NATIVE_INTERACTION_TRACKING to null
|
|
1122
|
+
)
|
|
1123
|
+
)
|
|
1124
|
+
val credentialCaptor = argumentCaptor<Credentials>()
|
|
1125
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1126
|
+
|
|
1127
|
+
// When
|
|
1128
|
+
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1129
|
+
|
|
1130
|
+
// Then
|
|
1131
|
+
inOrder(mockDatadog) {
|
|
1132
|
+
verify(mockDatadog).initialize(
|
|
1133
|
+
same(mockContext),
|
|
1134
|
+
credentialCaptor.capture(),
|
|
1135
|
+
configCaptor.capture(),
|
|
1136
|
+
eq(configuration.trackingConsent.asTrackingConsent())
|
|
1137
|
+
)
|
|
1138
|
+
verify(mockDatadog).registerRumMonitor(any())
|
|
1139
|
+
}
|
|
1140
|
+
assertThat(configCaptor.firstValue)
|
|
1141
|
+
.hasField("rumConfig") {
|
|
1142
|
+
it.hasFieldWithClass(
|
|
1143
|
+
"userActionTrackingStrategy",
|
|
1144
|
+
"com.datadog.android.rum.internal" +
|
|
1145
|
+
".instrumentation.UserActionTrackingStrategyLegacy"
|
|
1146
|
+
)
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1040
1149
|
@Test
|
|
1041
1150
|
fun `𝕄 initialize native SDK 𝕎 initialize() {sdk verbosity}`(
|
|
1042
1151
|
@Forgery configuration: DdSdkConfiguration,
|
|
@@ -1201,7 +1310,12 @@ internal class DdSdkTest {
|
|
|
1201
1310
|
)
|
|
1202
1311
|
assertThat(configCaptor.firstValue)
|
|
1203
1312
|
.hasField("coreConfig") { coreConfig ->
|
|
1204
|
-
coreConfig.hasFieldEqualTo(
|
|
1313
|
+
coreConfig.hasFieldEqualTo(
|
|
1314
|
+
"firstPartyHostsWithHeaderTypes",
|
|
1315
|
+
firstPartyHosts.associateWith {
|
|
1316
|
+
setOf(TracingHeaderType.DATADOG)
|
|
1317
|
+
}
|
|
1318
|
+
)
|
|
1205
1319
|
}
|
|
1206
1320
|
}
|
|
1207
1321
|
|
|
@@ -1505,6 +1619,120 @@ internal class DdSdkTest {
|
|
|
1505
1619
|
|
|
1506
1620
|
// endregion
|
|
1507
1621
|
|
|
1622
|
+
// region resource mapper
|
|
1623
|
+
|
|
1624
|
+
@Test
|
|
1625
|
+
fun `𝕄 set a resource mapper that does not drop resources 𝕎 initialize() {}`(
|
|
1626
|
+
@Forgery resourceEvent: ResourceEvent,
|
|
1627
|
+
) {
|
|
1628
|
+
// Given
|
|
1629
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1630
|
+
|
|
1631
|
+
// When
|
|
1632
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1633
|
+
|
|
1634
|
+
// Then
|
|
1635
|
+
verify(mockDatadog).initialize(
|
|
1636
|
+
same(mockContext),
|
|
1637
|
+
any(),
|
|
1638
|
+
configCaptor.capture(),
|
|
1639
|
+
any()
|
|
1640
|
+
)
|
|
1641
|
+
assertThat(configCaptor.firstValue)
|
|
1642
|
+
.hasField("rumConfig") {
|
|
1643
|
+
val resourceMapper = it
|
|
1644
|
+
.getActualValue<EventMapper<ResourceEvent>>("rumEventMapper")
|
|
1645
|
+
val notDroppedEvent = resourceMapper.map(resourceEvent)
|
|
1646
|
+
assertThat(notDroppedEvent).isNotNull
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
@Test
|
|
1651
|
+
fun `𝕄 set a resource mapper that drops flagged resources 𝕎 initialize() {}`(
|
|
1652
|
+
@Forgery resourceEvent: ResourceEvent,
|
|
1653
|
+
) {
|
|
1654
|
+
// Given
|
|
1655
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1656
|
+
resourceEvent.context?.additionalProperties?.put("_dd.resource.drop_resource", true)
|
|
1657
|
+
|
|
1658
|
+
// When
|
|
1659
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1660
|
+
|
|
1661
|
+
// Then
|
|
1662
|
+
verify(mockDatadog).initialize(
|
|
1663
|
+
same(mockContext),
|
|
1664
|
+
any(),
|
|
1665
|
+
configCaptor.capture(),
|
|
1666
|
+
any()
|
|
1667
|
+
)
|
|
1668
|
+
assertThat(configCaptor.firstValue)
|
|
1669
|
+
.hasField("rumConfig") {
|
|
1670
|
+
val resourceMapper = it
|
|
1671
|
+
.getActualValue<EventMapper<ResourceEvent>>("rumEventMapper")
|
|
1672
|
+
val droppedEvent = resourceMapper.map(resourceEvent)
|
|
1673
|
+
assertThat(droppedEvent).isNull()
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// endregion
|
|
1678
|
+
|
|
1679
|
+
// region action mapper
|
|
1680
|
+
|
|
1681
|
+
@Test
|
|
1682
|
+
fun `𝕄 set a action mapper that does not drop actions 𝕎 initialize() {}`(
|
|
1683
|
+
@Forgery actionEvent: ActionEvent,
|
|
1684
|
+
) {
|
|
1685
|
+
// Given
|
|
1686
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1687
|
+
|
|
1688
|
+
// When
|
|
1689
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1690
|
+
|
|
1691
|
+
// Then
|
|
1692
|
+
verify(mockDatadog).initialize(
|
|
1693
|
+
same(mockContext),
|
|
1694
|
+
any(),
|
|
1695
|
+
configCaptor.capture(),
|
|
1696
|
+
any()
|
|
1697
|
+
)
|
|
1698
|
+
assertThat(configCaptor.firstValue)
|
|
1699
|
+
.hasField("rumConfig") {
|
|
1700
|
+
val actionMapper = it
|
|
1701
|
+
.getActualValue<EventMapper<ActionEvent>>("rumEventMapper")
|
|
1702
|
+
val notDroppedEvent = actionMapper.map(actionEvent)
|
|
1703
|
+
assertThat(notDroppedEvent).isNotNull
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
@Test
|
|
1708
|
+
fun `𝕄 set a action mapper that drops flagged actions 𝕎 initialize() {}`(
|
|
1709
|
+
@Forgery actionEvent: ActionEvent,
|
|
1710
|
+
) {
|
|
1711
|
+
// Given
|
|
1712
|
+
val configCaptor = argumentCaptor<Configuration>()
|
|
1713
|
+
actionEvent.context?.additionalProperties?.put("_dd.action.drop_action", true)
|
|
1714
|
+
|
|
1715
|
+
// When
|
|
1716
|
+
testedBridgeSdk.initialize(fakeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1717
|
+
|
|
1718
|
+
// Then
|
|
1719
|
+
verify(mockDatadog).initialize(
|
|
1720
|
+
same(mockContext),
|
|
1721
|
+
any(),
|
|
1722
|
+
configCaptor.capture(),
|
|
1723
|
+
any()
|
|
1724
|
+
)
|
|
1725
|
+
assertThat(configCaptor.firstValue)
|
|
1726
|
+
.hasField("rumConfig") {
|
|
1727
|
+
val actionMapper = it
|
|
1728
|
+
.getActualValue<EventMapper<ActionEvent>>("rumEventMapper")
|
|
1729
|
+
val droppedEvent = actionMapper.map(actionEvent)
|
|
1730
|
+
assertThat(droppedEvent).isNull()
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// endregion
|
|
1735
|
+
|
|
1508
1736
|
// region misc
|
|
1509
1737
|
|
|
1510
1738
|
@Test
|
|
@@ -49,6 +49,12 @@ class GenericAssert(actual: Any) :
|
|
|
49
49
|
return this
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
fun hasFieldWithClass(name: String, expectedClassName: String): GenericAssert {
|
|
53
|
+
val field: Any? = actual.getFieldValue(name)
|
|
54
|
+
assertThat(field?.javaClass?.name).isEqualTo(expectedClassName)
|
|
55
|
+
return this
|
|
56
|
+
}
|
|
57
|
+
|
|
52
58
|
fun isInstanceOf(expectedClassName: String): GenericAssert {
|
|
53
59
|
val className = actual.javaClass.canonicalName!!
|
|
54
60
|
assertThat(className).isEqualTo(expectedClassName)
|