@datadog/mobile-react-native 2.14.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +6 -6
- package/README.md +23 -13
- package/android/build.gradle +10 -11
- package/android/gradle.properties +1 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +36 -93
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +46 -59
- package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdRumImplementation.kt +98 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +125 -75
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +199 -90
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +151 -24
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +57 -33
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +2 -1
- package/android/src/main/kotlin/com/datadog/reactnative/DdTelemetry.kt +96 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +20 -19
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +100 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +68 -14
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +94 -0
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +70 -11
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +58 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +63 -43
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +2024 -1199
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +44 -40
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +60 -91
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +34 -14
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +47 -43
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +0 -1
- package/android/src/test/resources/input/complete-configuration.json +32 -28
- package/android/src/test/resources/input/malformed-configuration.json +1 -1
- package/android/src/test/resources/input/minimal-configuration.json +4 -2
- package/datadog-configuration.schema.json +187 -139
- package/datadog-sourcemaps.gradle +2 -1
- package/ios/Sources/AnyEncodable.swift +14 -7
- package/ios/Sources/Attributes.swift +0 -7
- package/ios/Sources/DatadogSDKWrapper.swift +12 -128
- package/ios/Sources/DdLogsImplementation.swift +9 -39
- package/ios/Sources/DdRum.mm +89 -1
- package/ios/Sources/DdRumImplementation.swift +79 -0
- package/ios/Sources/DdSdk.mm +76 -11
- package/ios/Sources/DdSdkConfiguration.swift +159 -117
- package/ios/Sources/DdSdkImplementation.swift +235 -82
- package/ios/Sources/DdSdkNativeInitialization.swift +116 -80
- package/ios/Sources/DdTelemetry.swift +49 -0
- package/ios/Sources/GlobalState.swift +1 -1
- package/ios/Sources/RNDdSdkConfiguration.swift +334 -172
- package/ios/Sources/SdkVersion.swift +1 -1
- package/jest/mock.js +43 -4
- package/lib/commonjs/DdAttributes.js.map +1 -0
- package/lib/commonjs/DdSdkReactNative.js +159 -56
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/InternalLog.js +1 -1
- package/lib/commonjs/config/DatadogProviderConfiguration.js +25 -0
- package/lib/commonjs/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.js +349 -0
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js +6 -0
- package/lib/commonjs/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +51 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js +6 -0
- package/lib/commonjs/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js +44 -0
- package/lib/commonjs/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.js +104 -0
- package/lib/commonjs/config/features/CoreConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js +38 -0
- package/lib/commonjs/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.js +36 -0
- package/lib/commonjs/config/features/LogsConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.js +120 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js +6 -0
- package/lib/commonjs/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.js +24 -0
- package/lib/commonjs/config/features/TraceConfiguration.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js +2 -0
- package/lib/commonjs/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js +2 -0
- package/lib/commonjs/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js +30 -0
- package/lib/commonjs/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/commonjs/config/types/BatchSize.js +31 -0
- package/lib/commonjs/config/types/BatchSize.js.map +1 -0
- package/lib/commonjs/config/types/InitializationMode.js +17 -0
- package/lib/commonjs/config/types/InitializationMode.js.map +1 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/commonjs/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/commonjs/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/commonjs/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/commonjs/config/types/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/config/types/TrackingConsent.js.map +1 -0
- package/lib/commonjs/config/types/UploadFrequency.js +30 -0
- package/lib/commonjs/config/types/UploadFrequency.js.map +1 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js +19 -0
- package/lib/commonjs/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/commonjs/config/types/index.js +68 -0
- package/lib/commonjs/config/types/index.js.map +1 -0
- package/lib/commonjs/index.js +51 -21
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +13 -9
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/logs/eventMapper.js +4 -1
- package/lib/commonjs/logs/eventMapper.js.map +1 -1
- package/lib/commonjs/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js +0 -45
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +56 -28
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/helper.js +63 -0
- package/lib/commonjs/rum/helper.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +16 -27
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +34 -22
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +21 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +16 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -12
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +6 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +41 -47
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +62 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js +36 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +19 -8
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/types.js +1 -9
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js +46 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/commonjs/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js +51 -0
- package/lib/commonjs/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js +140 -0
- package/lib/commonjs/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/commonjs/{utils → sdk/AttributesEncoding}/errorUtils.js +39 -22
- package/lib/commonjs/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js +123 -0
- package/lib/commonjs/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js +2 -0
- package/lib/commonjs/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js +36 -0
- package/lib/commonjs/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/commonjs/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +3 -3
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/commonjs/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +10 -9
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js +28 -0
- package/lib/commonjs/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/commonjs/sdk/DdSdk.js +4 -2
- package/lib/commonjs/sdk/DdSdk.js.map +1 -1
- package/lib/commonjs/sdk/DdSdkInternal.js +86 -0
- package/lib/commonjs/sdk/DdSdkInternal.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +5 -11
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/commonjs/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/trace/DdTrace.js +7 -5
- package/lib/commonjs/trace/DdTrace.js.map +1 -1
- package/lib/commonjs/types.js +19 -46
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/utils/longTasksUtils.js.map +1 -1
- package/lib/commonjs/utils/singletonUtils.js +21 -0
- package/lib/commonjs/utils/singletonUtils.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdAttributes.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +155 -52
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/InternalLog.js +1 -1
- package/lib/module/InternalLog.js.map +1 -1
- package/lib/module/config/DatadogProviderConfiguration.js +18 -0
- package/lib/module/config/DatadogProviderConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.js +341 -0
- package/lib/module/config/FileBasedConfiguration.js.map +1 -0
- package/lib/module/config/FileBasedConfiguration.type.js +2 -0
- package/lib/module/config/FileBasedConfiguration.type.js.map +1 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +45 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js +2 -0
- package/lib/module/config/async/PartialInitializationConfiguration.js.map +1 -0
- package/lib/module/config/async/asyncInitializationHelper.js +36 -0
- package/lib/module/config/async/asyncInitializationHelper.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.js +98 -0
- package/lib/module/config/features/CoreConfiguration.js.map +1 -0
- package/lib/module/config/features/CoreConfiguration.type.js +2 -0
- package/lib/module/config/features/CoreConfiguration.type.js.map +1 -0
- package/lib/module/config/features/CoreConfigurationNative.js +31 -0
- package/lib/module/config/features/CoreConfigurationNative.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.js +30 -0
- package/lib/module/config/features/LogsConfiguration.js.map +1 -0
- package/lib/module/config/features/LogsConfiguration.type.js +2 -0
- package/lib/module/config/features/LogsConfiguration.type.js.map +1 -0
- package/lib/module/config/features/LogsConfigurationNative.js +2 -0
- package/lib/module/config/features/LogsConfigurationNative.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.js +114 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -0
- package/lib/module/config/features/RumConfiguration.type.js +2 -0
- package/lib/module/config/features/RumConfiguration.type.js.map +1 -0
- package/lib/module/config/features/RumConfigurationNative.js +2 -0
- package/lib/module/config/features/RumConfigurationNative.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.js +18 -0
- package/lib/module/config/features/TraceConfiguration.js.map +1 -0
- package/lib/module/config/features/TraceConfiguration.type.js +2 -0
- package/lib/module/config/features/TraceConfiguration.type.js.map +1 -0
- package/lib/module/config/features/TraceConfigurationNative.js +2 -0
- package/lib/module/config/features/TraceConfigurationNative.js.map +1 -0
- package/lib/module/config/types/BatchProcessingLevel.js +25 -0
- package/lib/module/config/types/BatchProcessingLevel.js.map +1 -0
- package/lib/module/config/types/BatchSize.js +26 -0
- package/lib/module/config/types/BatchSize.js.map +1 -0
- package/lib/module/config/types/InitializationMode.js +11 -0
- package/lib/module/config/types/InitializationMode.js.map +1 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js +2 -0
- package/lib/module/config/types/InitializationModeForTelemetry.js.map +1 -0
- package/lib/module/{ProxyConfiguration.js → config/types/ProxyConfiguration.js} +6 -0
- package/lib/module/config/types/ProxyConfiguration.js.map +1 -0
- package/lib/module/config/types/SdkVerbosity.js.map +1 -0
- package/lib/module/config/types/TrackingConsent.js.map +1 -0
- package/lib/module/config/types/UploadFrequency.js +25 -0
- package/lib/module/config/types/UploadFrequency.js.map +1 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js +13 -0
- package/lib/module/config/types/VitalsUpdateFrequency.js.map +1 -0
- package/lib/module/config/types/index.js +15 -0
- package/lib/module/config/types/index.js.map +1 -0
- package/lib/module/index.js +13 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/logs/DdLogs.js +13 -9
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/logs/eventMapper.js +4 -1
- package/lib/module/logs/eventMapper.js.map +1 -1
- package/lib/module/metro/plugin/metroSerializer.js.map +1 -1
- package/lib/module/nativeModulesTypes.js +1 -43
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +54 -26
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/helper.js +49 -0
- package/lib/module/rum/helper.js.map +1 -0
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +14 -18
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js +16 -26
- package/lib/module/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +15 -5
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +33 -21
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js +22 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +13 -2
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -11
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js +2 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +27 -33
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js +54 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js +30 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/headers.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +14 -3
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js +90 -48
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/rum/types.js +0 -9
- package/lib/module/rum/types.js.map +1 -1
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js +39 -0
- package/lib/module/sdk/AccountInfoSingleton/AccountInfoSingleton.js.map +1 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js +2 -0
- package/lib/module/sdk/AccountInfoSingleton/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js +46 -0
- package/lib/module/sdk/AttributesEncoding/attributesEncoding.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js +134 -0
- package/lib/module/sdk/AttributesEncoding/defaultEncoders.js.map +1 -0
- package/lib/module/{utils → sdk/AttributesEncoding}/errorUtils.js +37 -20
- package/lib/module/sdk/AttributesEncoding/errorUtils.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js +115 -0
- package/lib/module/sdk/AttributesEncoding/helpers.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/types.js +2 -0
- package/lib/module/sdk/AttributesEncoding/types.js.map +1 -0
- package/lib/module/sdk/AttributesEncoding/utils.js +28 -0
- package/lib/module/sdk/AttributesEncoding/utils.js.map +1 -0
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js +27 -1
- package/lib/module/sdk/AttributesSingleton/AttributesSingleton.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js +2 -2
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.js.map +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js +1 -1
- package/lib/module/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +9 -8
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js +21 -0
- package/lib/module/sdk/DatadogProvider/DatadogProviderState.js.map +1 -0
- package/lib/module/sdk/DdSdk.js +4 -4
- package/lib/module/sdk/DdSdk.js.map +1 -1
- package/lib/module/sdk/DdSdkInternal.js +80 -0
- package/lib/module/sdk/DdSdkInternal.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +6 -3
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +5 -10
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js +6 -1
- package/lib/module/sdk/UserInfoSingleton/UserInfoSingleton.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/trace/DdTrace.js +7 -6
- package/lib/module/trace/DdTrace.js.map +1 -1
- package/lib/module/types.js +22 -42
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/longTasksUtils.js.map +1 -1
- package/lib/module/utils/singletonUtils.js +14 -0
- package/lib/module/utils/singletonUtils.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/DdSdkReactNative.d.ts +49 -12
- package/lib/typescript/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/InternalLog.d.ts +1 -1
- package/lib/typescript/InternalLog.d.ts.map +1 -1
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts +12 -0
- package/lib/typescript/config/DatadogProviderConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts +17 -0
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +52 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +47 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts +5 -0
- package/lib/typescript/config/async/asyncInitializationHelper.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts +52 -0
- package/lib/typescript/config/features/CoreConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts +90 -0
- package/lib/typescript/config/features/CoreConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts +54 -0
- package/lib/typescript/config/features/CoreConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts +17 -0
- package/lib/typescript/config/features/LogsConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts +24 -0
- package/lib/typescript/config/features/LogsConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts +6 -0
- package/lib/typescript/config/features/LogsConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts +66 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +131 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +25 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts +10 -0
- package/lib/typescript/config/features/TraceConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts +11 -0
- package/lib/typescript/config/features/TraceConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts +4 -0
- package/lib/typescript/config/features/TraceConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts +18 -0
- package/lib/typescript/config/types/BatchProcessingLevel.d.ts.map +1 -0
- package/lib/typescript/config/types/BatchSize.d.ts +19 -0
- package/lib/typescript/config/types/BatchSize.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationMode.d.ts +5 -0
- package/lib/typescript/config/types/InitializationMode.d.ts.map +1 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts +2 -0
- package/lib/typescript/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
- package/lib/typescript/config/types/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/config/types/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/config/types/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts +18 -0
- package/lib/typescript/config/types/UploadFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts +7 -0
- package/lib/typescript/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
- package/lib/typescript/config/types/index.d.ts +10 -0
- package/lib/typescript/config/types/index.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +20 -9
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +2 -1
- package/lib/typescript/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/logs/eventMapper.d.ts +3 -2
- package/lib/typescript/logs/eventMapper.d.ts.map +1 -1
- package/lib/typescript/logs/types.d.ts +1 -16
- package/lib/typescript/logs/types.d.ts.map +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +2 -15
- package/lib/typescript/nativeModulesTypes.d.ts.map +1 -1
- package/lib/typescript/rum/DdRum.d.ts +10 -1
- package/lib/typescript/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +1 -1
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
- package/lib/typescript/rum/helper.d.ts +10 -0
- package/lib/typescript/rum/helper.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
- package/lib/typescript/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/rum/types.d.ts +47 -7
- package/lib/typescript/rum/types.d.ts.map +1 -1
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
- package/lib/typescript/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
- package/lib/typescript/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
- package/lib/typescript/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
- package/lib/typescript/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
- package/lib/typescript/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts +17 -0
- package/lib/typescript/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts +21 -0
- package/lib/typescript/sdk/AttributesEncoding/types.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts +7 -0
- package/lib/typescript/sdk/AttributesEncoding/utils.d.ts.map +1 -0
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
- package/lib/typescript/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
- package/lib/typescript/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
- package/lib/typescript/sdk/DdSdk.d.ts +2 -3
- package/lib/typescript/sdk/DdSdk.d.ts.map +1 -1
- package/lib/typescript/sdk/DdSdkInternal.d.ts +39 -0
- package/lib/typescript/sdk/DdSdkInternal.d.ts.map +1 -0
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +3 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts.map +1 -1
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +3 -3
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
- package/lib/typescript/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -2
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdRum.d.ts +45 -0
- package/lib/typescript/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/specs/NativeDdSdk.d.ts +34 -6
- package/lib/typescript/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/trace/DdTrace.d.ts +1 -2
- package/lib/typescript/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +74 -92
- package/lib/typescript/types.d.ts.map +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts +1 -1
- package/lib/typescript/utils/longTasksUtils.d.ts.map +1 -1
- package/lib/typescript/utils/singletonUtils.d.ts +2 -0
- package/lib/typescript/utils/singletonUtils.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +246 -104
- package/src/InternalLog.tsx +1 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +415 -207
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +237 -153
- package/src/__tests__/InternalLog.test.tsx +1 -1
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +2 -2
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +139 -216
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +10 -7
- package/src/config/DatadogProviderConfiguration.ts +17 -0
- package/src/config/FileBasedConfiguration.ts +464 -0
- package/src/config/FileBasedConfiguration.type.ts +66 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +334 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +57 -0
- package/src/config/__tests__/__fixtures__/malformed-configuration.json +4 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +126 -0
- package/src/config/async/PartialInitializationConfiguration.ts +58 -0
- package/src/config/async/asyncInitializationHelper.tsx +51 -0
- package/src/config/features/CoreConfiguration.ts +130 -0
- package/src/config/features/CoreConfiguration.type.ts +119 -0
- package/src/config/features/CoreConfigurationNative.ts +50 -0
- package/src/config/features/LogsConfiguration.ts +38 -0
- package/src/config/features/LogsConfiguration.type.ts +33 -0
- package/src/config/features/LogsConfigurationNative.ts +10 -0
- package/src/config/features/RumConfiguration.ts +137 -0
- package/src/config/features/RumConfiguration.type.ts +164 -0
- package/src/config/features/RumConfigurationNative.ts +26 -0
- package/src/config/features/TraceConfiguration.ts +24 -0
- package/src/config/features/TraceConfiguration.type.ts +17 -0
- package/src/config/features/TraceConfigurationNative.ts +8 -0
- package/src/config/types/BatchProcessingLevel.ts +23 -0
- package/src/config/types/BatchSize.ts +24 -0
- package/src/config/types/InitializationMode.ts +9 -0
- package/src/config/types/InitializationModeForTelemetry.ts +11 -0
- package/src/{ProxyConfiguration.tsx → config/types/ProxyConfiguration.ts} +6 -0
- package/src/config/types/UploadFrequency.tsx +23 -0
- package/src/config/types/VitalsUpdateFrequency.ts +11 -0
- package/src/config/types/index.ts +15 -0
- package/src/index.tsx +33 -16
- package/src/logs/DdLogs.ts +14 -13
- package/src/logs/__tests__/DdLogs.test.ts +60 -107
- package/src/logs/__tests__/eventMapper.test.ts +1 -1
- package/src/logs/eventMapper.ts +5 -4
- package/src/logs/types.ts +1 -20
- package/src/metro/plugin/metroSerializer.ts +3 -3
- package/src/nativeModulesTypes.ts +2 -17
- package/src/rum/DdRum.ts +139 -42
- package/src/rum/__tests__/DdRum.test.ts +217 -47
- package/src/rum/eventMappers/errorEventMapper.ts +1 -1
- package/src/rum/helper.ts +62 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +20 -38
- package/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.ts +21 -35
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +18 -5
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +44 -23
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +44 -23
- package/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.ts +24 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +17 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +327 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +22 -31
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +54 -35
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.ts +80 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/distributedTracing/headers.ts +29 -0
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +19 -7
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +177 -119
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/baggageHeaderUtils.test.ts +85 -13
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.ts +110 -52
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +68 -8
- package/src/sdk/AccountInfoSingleton/AccountInfoSingleton.ts +49 -0
- package/src/sdk/AccountInfoSingleton/__tests__/AccountInfoSingleton.test.ts +90 -0
- package/src/sdk/AccountInfoSingleton/types.ts +11 -0
- package/src/sdk/AttributesEncoding/__tests__/attributesEncoding.test.ts +518 -0
- package/src/sdk/AttributesEncoding/__tests__/defaultEncoders.test.ts +198 -0
- package/src/sdk/AttributesEncoding/attributesEncoding.ts +56 -0
- package/src/sdk/AttributesEncoding/defaultEncoders.ts +175 -0
- package/src/{utils → sdk/AttributesEncoding}/errorUtils.ts +50 -22
- package/src/sdk/AttributesEncoding/helpers.ts +176 -0
- package/src/sdk/AttributesEncoding/types.ts +33 -0
- package/src/sdk/AttributesEncoding/utils.ts +31 -0
- package/src/sdk/AttributesSingleton/AttributesSingleton.ts +25 -1
- package/src/sdk/AttributesSingleton/__tests__/AttributesSingleton.test.ts +52 -8
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridge.tsx +2 -2
- package/src/sdk/DatadogInternalBridge/DdSdkInternalNativeBridgeEvent.tsx +1 -1
- package/src/sdk/DatadogInternalBridge/__tests__/DdSdkNativeBridge.test.tsx +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +4 -4
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +12 -16
- package/src/sdk/DatadogProvider/DatadogProviderState.ts +30 -0
- package/src/sdk/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +18 -7
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +59 -33
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +26 -10
- package/src/sdk/DdSdk.ts +8 -5
- package/src/sdk/DdSdkInternal.ts +121 -0
- package/src/sdk/EventMappers/EventMapper.ts +9 -4
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +3 -3
- package/src/sdk/GlobalState/GlobalState.tsx +10 -11
- package/src/sdk/UserInfoSingleton/UserInfoSingleton.ts +9 -2
- package/src/sdk/UserInfoSingleton/__tests__/UserInfoSingleton.test.ts +46 -9
- package/src/sdk/UserInfoSingleton/types.ts +1 -4
- package/src/specs/NativeDdRum.ts +65 -0
- package/src/specs/NativeDdSdk.ts +40 -6
- package/src/trace/DdTrace.ts +11 -7
- package/src/trace/__tests__/DdTrace.test.ts +7 -8
- package/src/types.tsx +97 -76
- package/src/utils/__tests__/errorUtils.test.ts +1 -1
- package/src/utils/__tests__/singletonUtils.test.ts +75 -0
- package/src/utils/longTasksUtils.ts +1 -3
- package/src/utils/singletonUtils.ts +17 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +0 -412
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/commonjs/ProxyConfiguration.js.map +0 -1
- package/lib/commonjs/SdkVerbosity.js.map +0 -1
- package/lib/commonjs/TrackingConsent.js.map +0 -1
- package/lib/commonjs/rum/DdAttributes.js.map +0 -1
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -185
- package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/commonjs/utils/argsUtils.js +0 -41
- package/lib/commonjs/utils/argsUtils.js.map +0 -1
- package/lib/commonjs/utils/errorUtils.js.map +0 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +0 -403
- package/lib/module/DdSdkReactNativeConfiguration.js.map +0 -1
- package/lib/module/ProxyConfiguration.js.map +0 -1
- package/lib/module/SdkVerbosity.js.map +0 -1
- package/lib/module/TrackingConsent.js.map +0 -1
- package/lib/module/rum/DdAttributes.js.map +0 -1
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +0 -176
- package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +0 -1
- package/lib/module/utils/argsUtils.js +0 -35
- package/lib/module/utils/argsUtils.js.map +0 -1
- package/lib/module/utils/errorUtils.js.map +0 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +0 -376
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts.map +0 -1
- package/lib/typescript/ProxyConfiguration.d.ts.map +0 -1
- package/lib/typescript/SdkVerbosity.d.ts.map +0 -1
- package/lib/typescript/TrackingConsent.d.ts.map +0 -1
- package/lib/typescript/rum/DdAttributes.d.ts.map +0 -1
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
- package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
- package/lib/typescript/utils/argsUtils.d.ts +0 -8
- package/lib/typescript/utils/argsUtils.d.ts.map +0 -1
- package/lib/typescript/utils/errorUtils.d.ts.map +0 -1
- package/src/DdSdkReactNativeConfiguration.tsx +0 -582
- package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +0 -241
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +0 -255
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +0 -27
- package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +0 -5
- package/src/utils/__tests__/argsUtils.test.ts +0 -66
- package/src/utils/argsUtils.ts +0 -41
- /package/lib/commonjs/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/commonjs/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/commonjs/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/module/{rum/DdAttributes.js → DdAttributes.js} +0 -0
- /package/lib/module/{SdkVerbosity.js → config/types/SdkVerbosity.js} +0 -0
- /package/lib/module/{TrackingConsent.js → config/types/TrackingConsent.js} +0 -0
- /package/lib/typescript/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
- /package/lib/typescript/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
- /package/lib/typescript/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
- /package/lib/typescript/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
- /package/src/{rum/DdAttributes.ts → DdAttributes.ts} +0 -0
- /package/src/{SdkVerbosity.tsx → config/types/SdkVerbosity.ts} +0 -0
- /package/src/{TrackingConsent.tsx → config/types/TrackingConsent.ts} +0 -0
|
@@ -7,22 +7,26 @@
|
|
|
7
7
|
import { version as reactNativeVersion } from 'react-native/package.json';
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { DdSdkReactNativeConfiguration } from '../DdSdkReactNativeConfiguration';
|
|
11
10
|
import { DdSdkReactNative } from '../DdSdkReactNative';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import type { DdSdkNativeConfiguration } from '../config/features/CoreConfigurationNative';
|
|
12
|
+
import { CoreConfiguration } from '../config/features/CoreConfiguration';
|
|
13
|
+
import { LogsConfiguration } from '../config/features/LogsConfiguration';
|
|
14
|
+
import { RumConfiguration } from '../config/features/RumConfiguration';
|
|
15
|
+
import { TraceConfiguration } from '../config/features/TraceConfiguration';
|
|
16
|
+
import { TrackingConsent } from '../config/types/TrackingConsent';
|
|
17
|
+
import { ProxyConfiguration, ProxyType, SdkVerbosity } from '../config/types';
|
|
15
18
|
import { DdLogs } from '../logs/DdLogs';
|
|
16
19
|
import { DdRum } from '../rum/DdRum';
|
|
17
20
|
import { DdRumErrorTracking } from '../rum/instrumentation/DdRumErrorTracking';
|
|
18
21
|
import { DdRumUserInteractionTracking } from '../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
19
22
|
import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
20
|
-
import {
|
|
23
|
+
import { PropagatorType, RumActionType } from '../rum/types';
|
|
21
24
|
import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingleton';
|
|
22
|
-
import {
|
|
25
|
+
import { NativeDdSdk } from '../sdk/DdSdkInternal';
|
|
23
26
|
import { GlobalState } from '../sdk/GlobalState/GlobalState';
|
|
24
27
|
import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
|
|
25
|
-
import type {
|
|
28
|
+
import type { LogEvent } from '../types';
|
|
29
|
+
import { ErrorSource } from '../types';
|
|
26
30
|
import { version as sdkVersion } from '../version';
|
|
27
31
|
|
|
28
32
|
jest.mock('../InternalLog');
|
|
@@ -58,11 +62,10 @@ jest.mock('../rum/instrumentation/DdRumErrorTracking', () => {
|
|
|
58
62
|
});
|
|
59
63
|
|
|
60
64
|
beforeEach(async () => {
|
|
61
|
-
GlobalState.
|
|
65
|
+
GlobalState.isInitialized = false;
|
|
62
66
|
DdSdkReactNative['wasAutoInstrumented'] = false;
|
|
63
67
|
NativeModules.DdSdk.initialize.mockClear();
|
|
64
|
-
NativeModules.DdSdk.
|
|
65
|
-
NativeModules.DdSdk.setUser.mockClear();
|
|
68
|
+
NativeModules.DdSdk.addAttributes.mockClear();
|
|
66
69
|
NativeModules.DdSdk.setTrackingConsent.mockClear();
|
|
67
70
|
NativeModules.DdSdk.onRUMSessionStarted.mockClear();
|
|
68
71
|
|
|
@@ -88,11 +91,12 @@ describe('DdSdkReactNative', () => {
|
|
|
88
91
|
const fakeAppId = '1';
|
|
89
92
|
const fakeClientToken = '2';
|
|
90
93
|
const fakeEnvName = 'env';
|
|
91
|
-
const configuration = new
|
|
94
|
+
const configuration = new CoreConfiguration(
|
|
92
95
|
fakeClientToken,
|
|
93
|
-
fakeEnvName
|
|
94
|
-
fakeAppId
|
|
96
|
+
fakeEnvName
|
|
95
97
|
);
|
|
98
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
99
|
+
configuration.logsConfiguration = new LogsConfiguration();
|
|
96
100
|
|
|
97
101
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
98
102
|
|
|
@@ -102,18 +106,30 @@ describe('DdSdkReactNative', () => {
|
|
|
102
106
|
// THEN
|
|
103
107
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
104
108
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
105
|
-
.calls[0][0] as
|
|
109
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
106
110
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
107
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
111
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
112
|
+
fakeAppId
|
|
113
|
+
);
|
|
108
114
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
109
115
|
expect(ddSdkConfiguration.trackingConsent).toBe(
|
|
110
116
|
TrackingConsent.GRANTED
|
|
111
117
|
);
|
|
112
|
-
expect(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
expect(
|
|
116
|
-
|
|
118
|
+
expect(
|
|
119
|
+
ddSdkConfiguration.rumConfiguration?.nativeInteractionTracking
|
|
120
|
+
).toBe(false);
|
|
121
|
+
expect(
|
|
122
|
+
ddSdkConfiguration.rumConfiguration?.nativeViewTracking
|
|
123
|
+
).toBe(false);
|
|
124
|
+
expect(
|
|
125
|
+
ddSdkConfiguration.rumConfiguration?.firstPartyHosts
|
|
126
|
+
).toEqual([]);
|
|
127
|
+
expect(
|
|
128
|
+
ddSdkConfiguration.logsConfiguration?.bundleLogsWithRum
|
|
129
|
+
).toBe(true);
|
|
130
|
+
expect(
|
|
131
|
+
ddSdkConfiguration.logsConfiguration?.bundleLogsWithTraces
|
|
132
|
+
).toBe(true);
|
|
117
133
|
|
|
118
134
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
119
135
|
'_dd.react_native_version': reactNativeVersion,
|
|
@@ -127,11 +143,11 @@ describe('DdSdkReactNative', () => {
|
|
|
127
143
|
const fakeAppId = '1';
|
|
128
144
|
const fakeClientToken = '2';
|
|
129
145
|
const fakeEnvName = 'env';
|
|
130
|
-
const configuration = new
|
|
146
|
+
const configuration = new CoreConfiguration(
|
|
131
147
|
fakeClientToken,
|
|
132
|
-
fakeEnvName
|
|
133
|
-
fakeAppId
|
|
148
|
+
fakeEnvName
|
|
134
149
|
);
|
|
150
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
135
151
|
|
|
136
152
|
NativeModules.DdSdk.initialize.mockRejectedValue('rejection');
|
|
137
153
|
|
|
@@ -143,9 +159,11 @@ describe('DdSdkReactNative', () => {
|
|
|
143
159
|
// THEN
|
|
144
160
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
145
161
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
146
|
-
.calls[0][0] as
|
|
162
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
147
163
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
148
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
164
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
165
|
+
fakeAppId
|
|
166
|
+
);
|
|
149
167
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
150
168
|
expect(ddSdkConfiguration.trackingConsent).toBe(
|
|
151
169
|
TrackingConsent.GRANTED
|
|
@@ -156,7 +174,7 @@ describe('DdSdkReactNative', () => {
|
|
|
156
174
|
'_dd.sdk_version': sdkVersion
|
|
157
175
|
});
|
|
158
176
|
|
|
159
|
-
expect(GlobalState.
|
|
177
|
+
expect(GlobalState.isInitialized).toBe(false);
|
|
160
178
|
expect(
|
|
161
179
|
DdRumUserInteractionTracking.startTracking
|
|
162
180
|
).toHaveBeenCalledTimes(0);
|
|
@@ -172,14 +190,16 @@ describe('DdSdkReactNative', () => {
|
|
|
172
190
|
const fakeClientToken = '2';
|
|
173
191
|
const fakeEnvName = 'env';
|
|
174
192
|
const fakeConsent = TrackingConsent.NOT_GRANTED;
|
|
175
|
-
const configuration = new
|
|
193
|
+
const configuration = new CoreConfiguration(
|
|
176
194
|
fakeClientToken,
|
|
177
195
|
fakeEnvName,
|
|
196
|
+
fakeConsent
|
|
197
|
+
);
|
|
198
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
178
199
|
fakeAppId,
|
|
179
200
|
false,
|
|
180
201
|
false,
|
|
181
|
-
false
|
|
182
|
-
fakeConsent
|
|
202
|
+
false
|
|
183
203
|
);
|
|
184
204
|
|
|
185
205
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
@@ -190,9 +210,11 @@ describe('DdSdkReactNative', () => {
|
|
|
190
210
|
// THEN
|
|
191
211
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
192
212
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
193
|
-
.calls[0][0] as
|
|
213
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
194
214
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
195
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
215
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
216
|
+
fakeAppId
|
|
217
|
+
);
|
|
196
218
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
197
219
|
expect(ddSdkConfiguration.trackingConsent).toBe(fakeConsent);
|
|
198
220
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
@@ -207,12 +229,13 @@ describe('DdSdkReactNative', () => {
|
|
|
207
229
|
const fakeAppId = '1';
|
|
208
230
|
const fakeClientToken = '2';
|
|
209
231
|
const fakeEnvName = 'env';
|
|
210
|
-
const configuration = new
|
|
232
|
+
const configuration = new CoreConfiguration(
|
|
211
233
|
fakeClientToken,
|
|
212
|
-
fakeEnvName
|
|
213
|
-
fakeAppId
|
|
234
|
+
fakeEnvName
|
|
214
235
|
);
|
|
215
236
|
|
|
237
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
238
|
+
|
|
216
239
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
217
240
|
|
|
218
241
|
// WHEN
|
|
@@ -224,9 +247,11 @@ describe('DdSdkReactNative', () => {
|
|
|
224
247
|
// THEN
|
|
225
248
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
226
249
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
227
|
-
.calls[0][0] as
|
|
250
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
228
251
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
229
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
252
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
253
|
+
fakeAppId
|
|
254
|
+
);
|
|
230
255
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
231
256
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
232
257
|
'_dd.react_native_version': reactNativeVersion,
|
|
@@ -250,15 +275,17 @@ describe('DdSdkReactNative', () => {
|
|
|
250
275
|
const proxyUsername = 'foo';
|
|
251
276
|
const proxyPassword = 'bar';
|
|
252
277
|
|
|
253
|
-
const configuration = new
|
|
278
|
+
const configuration = new CoreConfiguration(
|
|
254
279
|
fakeClientToken,
|
|
255
|
-
fakeEnvName
|
|
280
|
+
fakeEnvName
|
|
281
|
+
);
|
|
282
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
256
283
|
fakeAppId,
|
|
257
284
|
false,
|
|
258
285
|
false,
|
|
259
286
|
false
|
|
260
287
|
);
|
|
261
|
-
configuration.
|
|
288
|
+
configuration.proxyConfiguration = new ProxyConfiguration(
|
|
262
289
|
proxyType,
|
|
263
290
|
proxyAddress,
|
|
264
291
|
proxyPort,
|
|
@@ -277,11 +304,13 @@ describe('DdSdkReactNative', () => {
|
|
|
277
304
|
1
|
|
278
305
|
);
|
|
279
306
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
280
|
-
.calls[0][0] as
|
|
307
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
281
308
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
282
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
309
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
310
|
+
fakeAppId
|
|
311
|
+
);
|
|
283
312
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
284
|
-
expect(ddSdkConfiguration.
|
|
313
|
+
expect(ddSdkConfiguration.proxyConfiguration).toEqual({
|
|
285
314
|
type: proxyType,
|
|
286
315
|
address: proxyAddress,
|
|
287
316
|
port: proxyPort
|
|
@@ -299,16 +328,16 @@ describe('DdSdkReactNative', () => {
|
|
|
299
328
|
}
|
|
300
329
|
});
|
|
301
330
|
|
|
302
|
-
it('initializes with default
|
|
331
|
+
it('initializes with default sessionSampleRate when not specified', async () => {
|
|
303
332
|
// GIVEN
|
|
304
333
|
const fakeAppId = '1';
|
|
305
334
|
const fakeClientToken = '2';
|
|
306
335
|
const fakeEnvName = 'env';
|
|
307
|
-
const configuration = new
|
|
336
|
+
const configuration = new CoreConfiguration(
|
|
308
337
|
fakeClientToken,
|
|
309
|
-
fakeEnvName
|
|
310
|
-
fakeAppId
|
|
338
|
+
fakeEnvName
|
|
311
339
|
);
|
|
340
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
312
341
|
|
|
313
342
|
// WHEN
|
|
314
343
|
await DdSdkReactNative.initialize(configuration);
|
|
@@ -316,22 +345,25 @@ describe('DdSdkReactNative', () => {
|
|
|
316
345
|
// THEN
|
|
317
346
|
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledWith(
|
|
318
347
|
expect.objectContaining({
|
|
319
|
-
|
|
348
|
+
rumConfiguration: expect.objectContaining({
|
|
349
|
+
sessionSampleRate: 100
|
|
350
|
+
})
|
|
320
351
|
})
|
|
321
352
|
);
|
|
322
353
|
});
|
|
323
354
|
|
|
324
|
-
it('initializes with
|
|
355
|
+
it('initializes with sessionSampleRate when it is specified', async () => {
|
|
325
356
|
// GIVEN
|
|
326
357
|
const fakeAppId = '1';
|
|
327
358
|
const fakeClientToken = '2';
|
|
328
359
|
const fakeEnvName = 'env';
|
|
329
|
-
|
|
360
|
+
|
|
361
|
+
const configuration = new CoreConfiguration(
|
|
330
362
|
fakeClientToken,
|
|
331
|
-
fakeEnvName
|
|
332
|
-
fakeAppId
|
|
363
|
+
fakeEnvName
|
|
333
364
|
);
|
|
334
|
-
configuration.
|
|
365
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
366
|
+
configuration.rumConfiguration.sessionSampleRate = 0;
|
|
335
367
|
|
|
336
368
|
// WHEN
|
|
337
369
|
await DdSdkReactNative.initialize(configuration);
|
|
@@ -339,22 +371,24 @@ describe('DdSdkReactNative', () => {
|
|
|
339
371
|
// THEN
|
|
340
372
|
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledWith(
|
|
341
373
|
expect.objectContaining({
|
|
342
|
-
|
|
374
|
+
rumConfiguration: expect.objectContaining({
|
|
375
|
+
sessionSampleRate: 0
|
|
376
|
+
})
|
|
343
377
|
})
|
|
344
378
|
);
|
|
345
379
|
});
|
|
346
380
|
|
|
347
|
-
it('initializes with
|
|
381
|
+
it('initializes with sessionSampleRate when it is specified', async () => {
|
|
348
382
|
// GIVEN
|
|
349
383
|
const fakeAppId = '1';
|
|
350
384
|
const fakeClientToken = '2';
|
|
351
385
|
const fakeEnvName = 'env';
|
|
352
|
-
const configuration = new
|
|
386
|
+
const configuration = new CoreConfiguration(
|
|
353
387
|
fakeClientToken,
|
|
354
|
-
fakeEnvName
|
|
355
|
-
fakeAppId
|
|
388
|
+
fakeEnvName
|
|
356
389
|
);
|
|
357
|
-
configuration.
|
|
390
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
391
|
+
configuration.rumConfiguration.sessionSampleRate = 70;
|
|
358
392
|
|
|
359
393
|
// WHEN
|
|
360
394
|
await DdSdkReactNative.initialize(configuration);
|
|
@@ -362,7 +396,9 @@ describe('DdSdkReactNative', () => {
|
|
|
362
396
|
// THEN
|
|
363
397
|
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledWith(
|
|
364
398
|
expect.objectContaining({
|
|
365
|
-
|
|
399
|
+
rumConfiguration: expect.objectContaining({
|
|
400
|
+
sessionSampleRate: 70
|
|
401
|
+
})
|
|
366
402
|
})
|
|
367
403
|
);
|
|
368
404
|
});
|
|
@@ -372,20 +408,23 @@ describe('DdSdkReactNative', () => {
|
|
|
372
408
|
const fakeAppId = '1';
|
|
373
409
|
const fakeClientToken = '2';
|
|
374
410
|
const fakeEnvName = 'env';
|
|
375
|
-
const configuration = new
|
|
411
|
+
const configuration = new CoreConfiguration(
|
|
376
412
|
fakeClientToken,
|
|
377
|
-
fakeEnvName
|
|
378
|
-
fakeAppId
|
|
413
|
+
fakeEnvName
|
|
379
414
|
);
|
|
380
|
-
configuration.
|
|
415
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
416
|
+
configuration.logsConfiguration = new LogsConfiguration();
|
|
417
|
+
configuration.logsConfiguration.bundleLogsWithRum = false;
|
|
381
418
|
|
|
382
419
|
// WHEN
|
|
383
420
|
await DdSdkReactNative.initialize(configuration);
|
|
384
421
|
|
|
385
422
|
// THEN
|
|
386
423
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
387
|
-
.calls[0][0] as
|
|
388
|
-
expect(
|
|
424
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
425
|
+
expect(
|
|
426
|
+
ddSdkConfiguration.logsConfiguration?.bundleLogsWithRum
|
|
427
|
+
).toBe(false);
|
|
389
428
|
});
|
|
390
429
|
|
|
391
430
|
it('initializes with bundleLogsWithTraces false when it is specified', async () => {
|
|
@@ -393,20 +432,23 @@ describe('DdSdkReactNative', () => {
|
|
|
393
432
|
const fakeAppId = '1';
|
|
394
433
|
const fakeClientToken = '2';
|
|
395
434
|
const fakeEnvName = 'env';
|
|
396
|
-
const configuration = new
|
|
435
|
+
const configuration = new CoreConfiguration(
|
|
397
436
|
fakeClientToken,
|
|
398
|
-
fakeEnvName
|
|
399
|
-
fakeAppId
|
|
437
|
+
fakeEnvName
|
|
400
438
|
);
|
|
401
|
-
configuration.
|
|
439
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
440
|
+
configuration.logsConfiguration = new LogsConfiguration();
|
|
441
|
+
configuration.logsConfiguration.bundleLogsWithTraces = false;
|
|
402
442
|
|
|
403
443
|
// WHEN
|
|
404
444
|
await DdSdkReactNative.initialize(configuration);
|
|
405
445
|
|
|
406
446
|
// THEN
|
|
407
447
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
408
|
-
.calls[0][0] as
|
|
409
|
-
expect(
|
|
448
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
449
|
+
expect(
|
|
450
|
+
ddSdkConfiguration.logsConfiguration?.bundleLogsWithTraces
|
|
451
|
+
).toBe(false);
|
|
410
452
|
});
|
|
411
453
|
|
|
412
454
|
it('initializes with the version when a version is specified', async () => {
|
|
@@ -414,11 +456,11 @@ describe('DdSdkReactNative', () => {
|
|
|
414
456
|
const fakeAppId = '1';
|
|
415
457
|
const fakeClientToken = '2';
|
|
416
458
|
const fakeEnvName = 'env';
|
|
417
|
-
const configuration = new
|
|
459
|
+
const configuration = new CoreConfiguration(
|
|
418
460
|
fakeClientToken,
|
|
419
|
-
fakeEnvName
|
|
420
|
-
fakeAppId
|
|
461
|
+
fakeEnvName
|
|
421
462
|
);
|
|
463
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
422
464
|
configuration.version = '2.0.0';
|
|
423
465
|
|
|
424
466
|
// WHEN
|
|
@@ -426,9 +468,11 @@ describe('DdSdkReactNative', () => {
|
|
|
426
468
|
|
|
427
469
|
// THEN
|
|
428
470
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
429
|
-
.calls[0][0] as
|
|
471
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
430
472
|
expect(
|
|
431
|
-
ddSdkConfiguration.additionalConfiguration
|
|
473
|
+
(ddSdkConfiguration.additionalConfiguration as {
|
|
474
|
+
'_dd.version': string;
|
|
475
|
+
})['_dd.version']
|
|
432
476
|
).toBe('2.0.0');
|
|
433
477
|
});
|
|
434
478
|
|
|
@@ -437,11 +481,11 @@ describe('DdSdkReactNative', () => {
|
|
|
437
481
|
const fakeAppId = '1';
|
|
438
482
|
const fakeClientToken = '2';
|
|
439
483
|
const fakeEnvName = 'env';
|
|
440
|
-
const configuration = new
|
|
484
|
+
const configuration = new CoreConfiguration(
|
|
441
485
|
fakeClientToken,
|
|
442
|
-
fakeEnvName
|
|
443
|
-
fakeAppId
|
|
486
|
+
fakeEnvName
|
|
444
487
|
);
|
|
488
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
445
489
|
configuration.versionSuffix = 'codepush-3';
|
|
446
490
|
|
|
447
491
|
// WHEN
|
|
@@ -449,12 +493,16 @@ describe('DdSdkReactNative', () => {
|
|
|
449
493
|
|
|
450
494
|
// THEN
|
|
451
495
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
452
|
-
.calls[0][0] as
|
|
496
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
453
497
|
expect(
|
|
454
|
-
ddSdkConfiguration.additionalConfiguration
|
|
498
|
+
(ddSdkConfiguration.additionalConfiguration as {
|
|
499
|
+
'_dd.version': string;
|
|
500
|
+
})['_dd.version']
|
|
455
501
|
).toBeUndefined();
|
|
456
502
|
expect(
|
|
457
|
-
ddSdkConfiguration.additionalConfiguration
|
|
503
|
+
(ddSdkConfiguration.additionalConfiguration as {
|
|
504
|
+
'_dd.version_suffix': string;
|
|
505
|
+
})['_dd.version_suffix']
|
|
458
506
|
).toBe('-codepush-3');
|
|
459
507
|
});
|
|
460
508
|
|
|
@@ -463,11 +511,11 @@ describe('DdSdkReactNative', () => {
|
|
|
463
511
|
const fakeAppId = '1';
|
|
464
512
|
const fakeClientToken = '2';
|
|
465
513
|
const fakeEnvName = 'env';
|
|
466
|
-
const configuration = new
|
|
514
|
+
const configuration = new CoreConfiguration(
|
|
467
515
|
fakeClientToken,
|
|
468
|
-
fakeEnvName
|
|
469
|
-
fakeAppId
|
|
516
|
+
fakeEnvName
|
|
470
517
|
);
|
|
518
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
471
519
|
configuration.version = '2.0.0';
|
|
472
520
|
configuration.versionSuffix = 'codepush-3';
|
|
473
521
|
|
|
@@ -476,12 +524,16 @@ describe('DdSdkReactNative', () => {
|
|
|
476
524
|
|
|
477
525
|
// THEN
|
|
478
526
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
479
|
-
.calls[0][0] as
|
|
527
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
480
528
|
expect(
|
|
481
|
-
ddSdkConfiguration.additionalConfiguration
|
|
529
|
+
(ddSdkConfiguration.additionalConfiguration as {
|
|
530
|
+
'_dd.version': string;
|
|
531
|
+
})['_dd.version']
|
|
482
532
|
).toBe('2.0.0-codepush-3');
|
|
483
533
|
expect(
|
|
484
|
-
ddSdkConfiguration.additionalConfiguration
|
|
534
|
+
(ddSdkConfiguration.additionalConfiguration as {
|
|
535
|
+
'_dd.version_suffix': string;
|
|
536
|
+
})['_dd.version_suffix']
|
|
485
537
|
).toBeUndefined();
|
|
486
538
|
});
|
|
487
539
|
|
|
@@ -490,12 +542,12 @@ describe('DdSdkReactNative', () => {
|
|
|
490
542
|
const fakeAppId = '1';
|
|
491
543
|
const fakeClientToken = '2';
|
|
492
544
|
const fakeEnvName = 'env';
|
|
493
|
-
const configuration = new
|
|
545
|
+
const configuration = new CoreConfiguration(
|
|
494
546
|
fakeClientToken,
|
|
495
|
-
fakeEnvName
|
|
496
|
-
fakeAppId
|
|
547
|
+
fakeEnvName
|
|
497
548
|
);
|
|
498
|
-
configuration.
|
|
549
|
+
configuration.rumConfiguration = new RumConfiguration(fakeAppId);
|
|
550
|
+
configuration.rumConfiguration.initialResourceThreshold = 0.123;
|
|
499
551
|
|
|
500
552
|
// WHEN
|
|
501
553
|
await DdSdkReactNative.initialize(configuration);
|
|
@@ -503,7 +555,9 @@ describe('DdSdkReactNative', () => {
|
|
|
503
555
|
// THEN
|
|
504
556
|
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledWith(
|
|
505
557
|
expect.objectContaining({
|
|
506
|
-
|
|
558
|
+
rumConfiguration: expect.objectContaining({
|
|
559
|
+
initialResourceThreshold: 0.123
|
|
560
|
+
})
|
|
507
561
|
})
|
|
508
562
|
);
|
|
509
563
|
});
|
|
@@ -515,9 +569,11 @@ describe('DdSdkReactNative', () => {
|
|
|
515
569
|
const fakeAppId = '1';
|
|
516
570
|
const fakeClientToken = '2';
|
|
517
571
|
const fakeEnvName = 'env';
|
|
518
|
-
const configuration = new
|
|
572
|
+
const configuration = new CoreConfiguration(
|
|
519
573
|
fakeClientToken,
|
|
520
|
-
fakeEnvName
|
|
574
|
+
fakeEnvName
|
|
575
|
+
);
|
|
576
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
521
577
|
fakeAppId,
|
|
522
578
|
true
|
|
523
579
|
);
|
|
@@ -530,9 +586,11 @@ describe('DdSdkReactNative', () => {
|
|
|
530
586
|
// THEN
|
|
531
587
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
532
588
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
533
|
-
.calls[0][0] as
|
|
589
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
534
590
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
535
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
591
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
592
|
+
fakeAppId
|
|
593
|
+
);
|
|
536
594
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
537
595
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
538
596
|
'_dd.react_native_version': reactNativeVersion,
|
|
@@ -549,16 +607,24 @@ describe('DdSdkReactNative', () => {
|
|
|
549
607
|
const fakeAppId = '1';
|
|
550
608
|
const fakeClientToken = '2';
|
|
551
609
|
const fakeEnvName = 'env';
|
|
552
|
-
const configuration = new
|
|
610
|
+
const configuration = new CoreConfiguration(
|
|
553
611
|
fakeClientToken,
|
|
554
|
-
fakeEnvName
|
|
612
|
+
fakeEnvName
|
|
613
|
+
);
|
|
614
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
555
615
|
fakeAppId,
|
|
556
616
|
false,
|
|
557
617
|
true
|
|
558
618
|
);
|
|
559
|
-
configuration.
|
|
560
|
-
configuration.firstPartyHosts = [
|
|
561
|
-
|
|
619
|
+
configuration.rumConfiguration.resourceTraceSampleRate = 42;
|
|
620
|
+
configuration.rumConfiguration.firstPartyHosts = [
|
|
621
|
+
{
|
|
622
|
+
match: 'api.example.com',
|
|
623
|
+
propagatorTypes: [
|
|
624
|
+
PropagatorType.DATADOG,
|
|
625
|
+
PropagatorType.TRACECONTEXT
|
|
626
|
+
]
|
|
627
|
+
},
|
|
562
628
|
{
|
|
563
629
|
match: 'something.fr',
|
|
564
630
|
propagatorTypes: [PropagatorType.DATADOG]
|
|
@@ -573,11 +639,15 @@ describe('DdSdkReactNative', () => {
|
|
|
573
639
|
// THEN
|
|
574
640
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
575
641
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
576
|
-
.calls[0][0] as
|
|
642
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
577
643
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
578
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
644
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
645
|
+
fakeAppId
|
|
646
|
+
);
|
|
579
647
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
580
|
-
expect(
|
|
648
|
+
expect(
|
|
649
|
+
ddSdkConfiguration.rumConfiguration?.firstPartyHosts
|
|
650
|
+
).toEqual([
|
|
581
651
|
{
|
|
582
652
|
match: 'api.example.com',
|
|
583
653
|
propagatorTypes: ['datadog', 'tracecontext']
|
|
@@ -596,7 +666,7 @@ describe('DdSdkReactNative', () => {
|
|
|
596
666
|
1
|
|
597
667
|
);
|
|
598
668
|
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith({
|
|
599
|
-
|
|
669
|
+
resourceTraceSampleRate: 42,
|
|
600
670
|
firstPartyHosts: [
|
|
601
671
|
{
|
|
602
672
|
match: 'api.example.com',
|
|
@@ -615,16 +685,17 @@ describe('DdSdkReactNative', () => {
|
|
|
615
685
|
const fakeAppId = '1';
|
|
616
686
|
const fakeClientToken = '2';
|
|
617
687
|
const fakeEnvName = 'env';
|
|
618
|
-
const configuration = new
|
|
688
|
+
const configuration = new CoreConfiguration(
|
|
619
689
|
fakeClientToken,
|
|
620
|
-
fakeEnvName
|
|
690
|
+
fakeEnvName
|
|
691
|
+
);
|
|
692
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
621
693
|
fakeAppId,
|
|
622
694
|
false,
|
|
623
695
|
false,
|
|
624
696
|
true
|
|
625
697
|
);
|
|
626
|
-
configuration.
|
|
627
|
-
|
|
698
|
+
configuration.rumConfiguration.resourceTraceSampleRate = 2;
|
|
628
699
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
629
700
|
|
|
630
701
|
// WHEN
|
|
@@ -633,9 +704,11 @@ describe('DdSdkReactNative', () => {
|
|
|
633
704
|
// THEN
|
|
634
705
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
635
706
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
636
|
-
.calls[0][0] as
|
|
707
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
637
708
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
638
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
709
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
710
|
+
fakeAppId
|
|
711
|
+
);
|
|
639
712
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
640
713
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
641
714
|
'_dd.react_native_version': reactNativeVersion,
|
|
@@ -650,18 +723,22 @@ describe('DdSdkReactNative', () => {
|
|
|
650
723
|
const fakeAppId = '1';
|
|
651
724
|
const fakeClientToken = '2';
|
|
652
725
|
const fakeEnvName = 'env';
|
|
653
|
-
const configuration = new
|
|
726
|
+
const configuration = new CoreConfiguration(
|
|
654
727
|
fakeClientToken,
|
|
655
|
-
fakeEnvName
|
|
728
|
+
fakeEnvName
|
|
729
|
+
);
|
|
730
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
656
731
|
fakeAppId,
|
|
657
732
|
false,
|
|
658
733
|
false,
|
|
659
734
|
true
|
|
660
735
|
);
|
|
661
|
-
configuration.
|
|
662
|
-
log
|
|
663
|
-
|
|
664
|
-
|
|
736
|
+
configuration.logsConfiguration = new LogsConfiguration({
|
|
737
|
+
logEventMapper: (log: LogEvent) => {
|
|
738
|
+
log.message = 'new message';
|
|
739
|
+
return log;
|
|
740
|
+
}
|
|
741
|
+
});
|
|
665
742
|
|
|
666
743
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
667
744
|
|
|
@@ -681,15 +758,17 @@ describe('DdSdkReactNative', () => {
|
|
|
681
758
|
const fakeAppId = '1';
|
|
682
759
|
const fakeClientToken = '2';
|
|
683
760
|
const fakeEnvName = 'env';
|
|
684
|
-
const configuration = new
|
|
761
|
+
const configuration = new CoreConfiguration(
|
|
685
762
|
fakeClientToken,
|
|
686
|
-
fakeEnvName
|
|
763
|
+
fakeEnvName
|
|
764
|
+
);
|
|
765
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
687
766
|
fakeAppId,
|
|
688
767
|
false,
|
|
689
768
|
false,
|
|
690
769
|
true
|
|
691
770
|
);
|
|
692
|
-
configuration.errorEventMapper = event => {
|
|
771
|
+
configuration.rumConfiguration.errorEventMapper = event => {
|
|
693
772
|
event.message = 'new error massage';
|
|
694
773
|
return event;
|
|
695
774
|
};
|
|
@@ -724,15 +803,17 @@ describe('DdSdkReactNative', () => {
|
|
|
724
803
|
const fakeAppId = '1';
|
|
725
804
|
const fakeClientToken = '2';
|
|
726
805
|
const fakeEnvName = 'env';
|
|
727
|
-
const configuration = new
|
|
806
|
+
const configuration = new CoreConfiguration(
|
|
728
807
|
fakeClientToken,
|
|
729
|
-
fakeEnvName
|
|
808
|
+
fakeEnvName
|
|
809
|
+
);
|
|
810
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
730
811
|
fakeAppId,
|
|
731
812
|
false,
|
|
732
813
|
false,
|
|
733
814
|
true
|
|
734
815
|
);
|
|
735
|
-
configuration.resourceEventMapper = event => {
|
|
816
|
+
configuration.rumConfiguration.resourceEventMapper = event => {
|
|
736
817
|
event.context = {
|
|
737
818
|
...event.context,
|
|
738
819
|
body: 'content'
|
|
@@ -771,15 +852,17 @@ describe('DdSdkReactNative', () => {
|
|
|
771
852
|
const fakeAppId = '1';
|
|
772
853
|
const fakeClientToken = '2';
|
|
773
854
|
const fakeEnvName = 'env';
|
|
774
|
-
const configuration = new
|
|
855
|
+
const configuration = new CoreConfiguration(
|
|
775
856
|
fakeClientToken,
|
|
776
|
-
fakeEnvName
|
|
857
|
+
fakeEnvName
|
|
858
|
+
);
|
|
859
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
777
860
|
fakeAppId,
|
|
778
861
|
false,
|
|
779
862
|
false,
|
|
780
863
|
true
|
|
781
864
|
);
|
|
782
|
-
configuration.actionEventMapper = event => {
|
|
865
|
+
configuration.rumConfiguration.actionEventMapper = event => {
|
|
783
866
|
event.context = {
|
|
784
867
|
...event.context,
|
|
785
868
|
body: 'content'
|
|
@@ -814,16 +897,18 @@ describe('DdSdkReactNative', () => {
|
|
|
814
897
|
const fakeAppId = '1';
|
|
815
898
|
const fakeClientToken = '2';
|
|
816
899
|
const fakeEnvName = 'env';
|
|
817
|
-
const
|
|
818
|
-
const configuration = new
|
|
900
|
+
const fakeService = 'aFakeService';
|
|
901
|
+
const configuration = new CoreConfiguration(
|
|
819
902
|
fakeClientToken,
|
|
820
|
-
fakeEnvName
|
|
903
|
+
fakeEnvName
|
|
904
|
+
);
|
|
905
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
821
906
|
fakeAppId,
|
|
822
907
|
false,
|
|
823
908
|
false,
|
|
824
909
|
true
|
|
825
910
|
);
|
|
826
|
-
configuration.
|
|
911
|
+
configuration.service = fakeService;
|
|
827
912
|
|
|
828
913
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
829
914
|
|
|
@@ -833,11 +918,13 @@ describe('DdSdkReactNative', () => {
|
|
|
833
918
|
// THEN
|
|
834
919
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
835
920
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
836
|
-
.calls[0][0] as
|
|
921
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
837
922
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
838
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
923
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
924
|
+
fakeAppId
|
|
925
|
+
);
|
|
839
926
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
840
|
-
expect(ddSdkConfiguration.
|
|
927
|
+
expect(ddSdkConfiguration.service).toBe(fakeService);
|
|
841
928
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
842
929
|
'_dd.react_native_version': reactNativeVersion,
|
|
843
930
|
'_dd.source': 'react-native',
|
|
@@ -851,9 +938,11 @@ describe('DdSdkReactNative', () => {
|
|
|
851
938
|
const fakeAppId = '1';
|
|
852
939
|
const fakeClientToken = '2';
|
|
853
940
|
const fakeEnvName = 'env';
|
|
854
|
-
const configuration = new
|
|
941
|
+
const configuration = new CoreConfiguration(
|
|
855
942
|
fakeClientToken,
|
|
856
|
-
fakeEnvName
|
|
943
|
+
fakeEnvName
|
|
944
|
+
);
|
|
945
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
857
946
|
fakeAppId,
|
|
858
947
|
false,
|
|
859
948
|
false,
|
|
@@ -869,9 +958,11 @@ describe('DdSdkReactNative', () => {
|
|
|
869
958
|
// THEN
|
|
870
959
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
871
960
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
872
|
-
.calls[0][0] as
|
|
961
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
873
962
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
874
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
963
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
964
|
+
fakeAppId
|
|
965
|
+
);
|
|
875
966
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
876
967
|
expect(ddSdkConfiguration.verbosity).toBe(SdkVerbosity.DEBUG);
|
|
877
968
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
@@ -887,15 +978,17 @@ describe('DdSdkReactNative', () => {
|
|
|
887
978
|
const fakeAppId = '1';
|
|
888
979
|
const fakeClientToken = '2';
|
|
889
980
|
const fakeEnvName = 'env';
|
|
890
|
-
const configuration = new
|
|
981
|
+
const configuration = new CoreConfiguration(
|
|
891
982
|
fakeClientToken,
|
|
892
|
-
fakeEnvName
|
|
983
|
+
fakeEnvName
|
|
984
|
+
);
|
|
985
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
893
986
|
fakeAppId,
|
|
894
987
|
false,
|
|
895
988
|
false,
|
|
896
989
|
true
|
|
897
990
|
);
|
|
898
|
-
configuration.nativeViewTracking = true;
|
|
991
|
+
configuration.rumConfiguration.nativeViewTracking = true;
|
|
899
992
|
|
|
900
993
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
901
994
|
|
|
@@ -905,11 +998,15 @@ describe('DdSdkReactNative', () => {
|
|
|
905
998
|
// THEN
|
|
906
999
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
907
1000
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
908
|
-
.calls[0][0] as
|
|
1001
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
909
1002
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
910
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
1003
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
1004
|
+
fakeAppId
|
|
1005
|
+
);
|
|
911
1006
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
912
|
-
expect(
|
|
1007
|
+
expect(
|
|
1008
|
+
ddSdkConfiguration.rumConfiguration?.nativeViewTracking
|
|
1009
|
+
).toBe(true);
|
|
913
1010
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
914
1011
|
'_dd.react_native_version': reactNativeVersion,
|
|
915
1012
|
'_dd.source': 'react-native',
|
|
@@ -923,15 +1020,17 @@ describe('DdSdkReactNative', () => {
|
|
|
923
1020
|
const fakeAppId = '1';
|
|
924
1021
|
const fakeClientToken = '2';
|
|
925
1022
|
const fakeEnvName = 'env';
|
|
926
|
-
const configuration = new
|
|
1023
|
+
const configuration = new CoreConfiguration(
|
|
927
1024
|
fakeClientToken,
|
|
928
|
-
fakeEnvName
|
|
1025
|
+
fakeEnvName
|
|
1026
|
+
);
|
|
1027
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
929
1028
|
fakeAppId,
|
|
930
1029
|
false,
|
|
931
1030
|
false,
|
|
932
1031
|
true
|
|
933
1032
|
);
|
|
934
|
-
configuration.nativeInteractionTracking = true;
|
|
1033
|
+
configuration.rumConfiguration.nativeInteractionTracking = true;
|
|
935
1034
|
|
|
936
1035
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
937
1036
|
|
|
@@ -941,11 +1040,15 @@ describe('DdSdkReactNative', () => {
|
|
|
941
1040
|
// THEN
|
|
942
1041
|
expect(NativeModules.DdSdk.initialize.mock.calls.length).toBe(1);
|
|
943
1042
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
944
|
-
.calls[0][0] as
|
|
1043
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
945
1044
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
946
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
1045
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
1046
|
+
fakeAppId
|
|
1047
|
+
);
|
|
947
1048
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
948
|
-
expect(
|
|
1049
|
+
expect(
|
|
1050
|
+
ddSdkConfiguration.rumConfiguration?.nativeInteractionTracking
|
|
1051
|
+
).toBe(true);
|
|
949
1052
|
expect(ddSdkConfiguration.additionalConfiguration).toStrictEqual({
|
|
950
1053
|
'_dd.react_native_version': reactNativeVersion,
|
|
951
1054
|
'_dd.source': 'react-native',
|
|
@@ -959,16 +1062,18 @@ describe('DdSdkReactNative', () => {
|
|
|
959
1062
|
const fakeAppId = '1';
|
|
960
1063
|
const fakeClientToken = '2';
|
|
961
1064
|
const fakeEnvName = 'env';
|
|
962
|
-
const configuration = new
|
|
1065
|
+
const configuration = new CoreConfiguration(
|
|
963
1066
|
fakeClientToken,
|
|
964
|
-
fakeEnvName
|
|
1067
|
+
fakeEnvName
|
|
1068
|
+
);
|
|
1069
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
965
1070
|
fakeAppId,
|
|
966
1071
|
false,
|
|
967
1072
|
false,
|
|
968
1073
|
true
|
|
969
1074
|
);
|
|
970
|
-
configuration.nativeLongTaskThresholdMs = 234;
|
|
971
|
-
configuration.longTaskThresholdMs = 456;
|
|
1075
|
+
configuration.rumConfiguration.nativeLongTaskThresholdMs = 234;
|
|
1076
|
+
configuration.rumConfiguration.longTaskThresholdMs = 456;
|
|
972
1077
|
|
|
973
1078
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
974
1079
|
|
|
@@ -977,9 +1082,13 @@ describe('DdSdkReactNative', () => {
|
|
|
977
1082
|
|
|
978
1083
|
// THEN
|
|
979
1084
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
980
|
-
.calls[0][0] as
|
|
981
|
-
expect(
|
|
982
|
-
|
|
1085
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
1086
|
+
expect(
|
|
1087
|
+
ddSdkConfiguration.rumConfiguration?.nativeLongTaskThresholdMs
|
|
1088
|
+
).toBe(234);
|
|
1089
|
+
expect(
|
|
1090
|
+
ddSdkConfiguration.rumConfiguration?.longTaskThresholdMs
|
|
1091
|
+
).toBe(456);
|
|
983
1092
|
});
|
|
984
1093
|
|
|
985
1094
|
it('enables long task tracking when initialize { native and javascript long task false threshold }', async () => {
|
|
@@ -987,16 +1096,18 @@ describe('DdSdkReactNative', () => {
|
|
|
987
1096
|
const fakeAppId = '1';
|
|
988
1097
|
const fakeClientToken = '2';
|
|
989
1098
|
const fakeEnvName = 'env';
|
|
990
|
-
const configuration = new
|
|
1099
|
+
const configuration = new CoreConfiguration(
|
|
991
1100
|
fakeClientToken,
|
|
992
|
-
fakeEnvName
|
|
1101
|
+
fakeEnvName
|
|
1102
|
+
);
|
|
1103
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
993
1104
|
fakeAppId,
|
|
994
1105
|
false,
|
|
995
1106
|
false,
|
|
996
1107
|
true
|
|
997
1108
|
);
|
|
998
|
-
configuration.nativeLongTaskThresholdMs =
|
|
999
|
-
configuration.longTaskThresholdMs = false;
|
|
1109
|
+
configuration.rumConfiguration.nativeLongTaskThresholdMs = 0;
|
|
1110
|
+
configuration.rumConfiguration.longTaskThresholdMs = false;
|
|
1000
1111
|
|
|
1001
1112
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
1002
1113
|
|
|
@@ -1005,9 +1116,13 @@ describe('DdSdkReactNative', () => {
|
|
|
1005
1116
|
|
|
1006
1117
|
// THEN
|
|
1007
1118
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
1008
|
-
.calls[0][0] as
|
|
1009
|
-
expect(
|
|
1010
|
-
|
|
1119
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
1120
|
+
expect(
|
|
1121
|
+
ddSdkConfiguration.rumConfiguration?.nativeLongTaskThresholdMs
|
|
1122
|
+
).toBe(0);
|
|
1123
|
+
expect(
|
|
1124
|
+
ddSdkConfiguration.rumConfiguration?.longTaskThresholdMs
|
|
1125
|
+
).toBe(0);
|
|
1011
1126
|
});
|
|
1012
1127
|
|
|
1013
1128
|
it('enables custom endpoints when initialize { custom endpoints specified }', async () => {
|
|
@@ -1015,19 +1130,24 @@ describe('DdSdkReactNative', () => {
|
|
|
1015
1130
|
const fakeAppId = '1';
|
|
1016
1131
|
const fakeClientToken = '2';
|
|
1017
1132
|
const fakeEnvName = 'env';
|
|
1018
|
-
const configuration = new
|
|
1133
|
+
const configuration = new CoreConfiguration(
|
|
1019
1134
|
fakeClientToken,
|
|
1020
|
-
fakeEnvName
|
|
1135
|
+
fakeEnvName
|
|
1136
|
+
);
|
|
1137
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
1021
1138
|
fakeAppId,
|
|
1022
1139
|
false,
|
|
1023
1140
|
false,
|
|
1024
1141
|
true
|
|
1025
1142
|
);
|
|
1026
|
-
configuration.
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1143
|
+
configuration.rumConfiguration.customEndpoint =
|
|
1144
|
+
'https://rum.example.com/';
|
|
1145
|
+
configuration.logsConfiguration = new LogsConfiguration();
|
|
1146
|
+
configuration.logsConfiguration.customEndpoint =
|
|
1147
|
+
'https://logs.example.com/';
|
|
1148
|
+
configuration.traceConfiguration = new TraceConfiguration();
|
|
1149
|
+
configuration.traceConfiguration.customEndpoint =
|
|
1150
|
+
'https://trace.example.com/';
|
|
1031
1151
|
|
|
1032
1152
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
1033
1153
|
|
|
@@ -1036,45 +1156,95 @@ describe('DdSdkReactNative', () => {
|
|
|
1036
1156
|
|
|
1037
1157
|
// THEN
|
|
1038
1158
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
1039
|
-
.calls[0][0] as
|
|
1040
|
-
expect(ddSdkConfiguration.
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1159
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
1160
|
+
expect(ddSdkConfiguration.rumConfiguration?.customEndpoint).toEqual(
|
|
1161
|
+
'https://rum.example.com/'
|
|
1162
|
+
);
|
|
1163
|
+
expect(
|
|
1164
|
+
ddSdkConfiguration.logsConfiguration?.customEndpoint
|
|
1165
|
+
).toEqual('https://logs.example.com/');
|
|
1166
|
+
expect(
|
|
1167
|
+
ddSdkConfiguration.traceConfiguration?.customEndpoint
|
|
1168
|
+
).toEqual('https://trace.example.com/');
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
describe('addAttribute', () => {
|
|
1173
|
+
it('calls SDK method when addAttribute', async () => {
|
|
1174
|
+
// GIVEN
|
|
1175
|
+
const key = 'foo';
|
|
1176
|
+
const value = 'bar';
|
|
1177
|
+
|
|
1178
|
+
// WHEN
|
|
1179
|
+
|
|
1180
|
+
await DdSdkReactNative.addAttribute(key, value);
|
|
1181
|
+
|
|
1182
|
+
// THEN
|
|
1183
|
+
expect(NativeDdSdk.addAttribute).toHaveBeenCalledTimes(1);
|
|
1184
|
+
expect(NativeDdSdk.addAttribute).toHaveBeenCalledWith(key, {
|
|
1185
|
+
value
|
|
1044
1186
|
});
|
|
1187
|
+
expect(AttributesSingleton.getInstance().getAttribute(key)).toEqual(
|
|
1188
|
+
value
|
|
1189
|
+
);
|
|
1190
|
+
});
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
describe('removeAttribute', () => {
|
|
1194
|
+
it('calls SDK method when removeAttribute', async () => {
|
|
1195
|
+
// GIVEN
|
|
1196
|
+
const key = 'foo';
|
|
1197
|
+
const value = 'bar';
|
|
1198
|
+
await DdSdkReactNative.addAttribute(key, value);
|
|
1199
|
+
|
|
1200
|
+
// WHEN
|
|
1201
|
+
await DdSdkReactNative.removeAttribute(key);
|
|
1202
|
+
|
|
1203
|
+
// THEN
|
|
1204
|
+
expect(NativeDdSdk.removeAttribute).toHaveBeenCalledTimes(1);
|
|
1205
|
+
expect(NativeDdSdk.removeAttribute).toHaveBeenCalledWith(key);
|
|
1206
|
+
expect(AttributesSingleton.getInstance().getAttribute(key)).toEqual(
|
|
1207
|
+
undefined
|
|
1208
|
+
);
|
|
1045
1209
|
});
|
|
1046
1210
|
});
|
|
1047
1211
|
|
|
1048
|
-
describe('
|
|
1049
|
-
it('calls SDK method when
|
|
1212
|
+
describe('addAttributes', () => {
|
|
1213
|
+
it('calls SDK method when addAttributes', async () => {
|
|
1050
1214
|
// GIVEN
|
|
1051
1215
|
const attributes = { foo: 'bar' };
|
|
1052
1216
|
|
|
1053
1217
|
// WHEN
|
|
1054
1218
|
|
|
1055
|
-
await DdSdkReactNative.
|
|
1219
|
+
await DdSdkReactNative.addAttributes(attributes);
|
|
1056
1220
|
|
|
1057
1221
|
// THEN
|
|
1058
|
-
expect(
|
|
1059
|
-
expect(
|
|
1222
|
+
expect(NativeDdSdk.addAttributes).toHaveBeenCalledTimes(1);
|
|
1223
|
+
expect(NativeDdSdk.addAttributes).toHaveBeenCalledWith(attributes);
|
|
1060
1224
|
expect(AttributesSingleton.getInstance().getAttributes()).toEqual({
|
|
1061
1225
|
foo: 'bar'
|
|
1062
1226
|
});
|
|
1063
1227
|
});
|
|
1064
1228
|
});
|
|
1065
1229
|
|
|
1066
|
-
describe('
|
|
1067
|
-
it('calls SDK method when
|
|
1230
|
+
describe('removeAttributes', () => {
|
|
1231
|
+
it('calls SDK method when removeAttributes', async () => {
|
|
1068
1232
|
// GIVEN
|
|
1069
|
-
const
|
|
1233
|
+
const attributes = { foo: 'bar', baz: 'quux' };
|
|
1234
|
+
await DdSdkReactNative.addAttributes(attributes);
|
|
1070
1235
|
|
|
1071
1236
|
// WHEN
|
|
1072
|
-
await DdSdkReactNative.
|
|
1237
|
+
await DdSdkReactNative.removeAttributes(['foo', 'baz']);
|
|
1073
1238
|
|
|
1074
1239
|
// THEN
|
|
1075
|
-
expect(
|
|
1076
|
-
expect(
|
|
1077
|
-
|
|
1240
|
+
expect(NativeDdSdk.removeAttributes).toHaveBeenCalledTimes(1);
|
|
1241
|
+
expect(NativeDdSdk.removeAttributes).toHaveBeenCalledWith([
|
|
1242
|
+
'foo',
|
|
1243
|
+
'baz'
|
|
1244
|
+
]);
|
|
1245
|
+
expect(AttributesSingleton.getInstance().getAttributes()).toEqual(
|
|
1246
|
+
{}
|
|
1247
|
+
);
|
|
1078
1248
|
});
|
|
1079
1249
|
});
|
|
1080
1250
|
|
|
@@ -1094,8 +1264,8 @@ describe('DdSdkReactNative', () => {
|
|
|
1094
1264
|
await DdSdkReactNative.setUserInfo(userInfo);
|
|
1095
1265
|
|
|
1096
1266
|
// THEN
|
|
1097
|
-
expect(
|
|
1098
|
-
expect(
|
|
1267
|
+
expect(NativeDdSdk.setUserInfo).toHaveBeenCalledTimes(1);
|
|
1268
|
+
expect(NativeDdSdk.setUserInfo).toHaveBeenCalledWith(userInfo);
|
|
1099
1269
|
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual(
|
|
1100
1270
|
userInfo
|
|
1101
1271
|
);
|
|
@@ -1115,8 +1285,10 @@ describe('DdSdkReactNative', () => {
|
|
|
1115
1285
|
await DdSdkReactNative.addUserExtraInfo(extraInfo);
|
|
1116
1286
|
|
|
1117
1287
|
// THEN
|
|
1118
|
-
expect(
|
|
1119
|
-
expect(
|
|
1288
|
+
expect(NativeDdSdk.addUserExtraInfo).toHaveBeenCalledTimes(1);
|
|
1289
|
+
expect(NativeDdSdk.addUserExtraInfo).toHaveBeenCalledWith(
|
|
1290
|
+
extraInfo
|
|
1291
|
+
);
|
|
1120
1292
|
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual({
|
|
1121
1293
|
id: 'id',
|
|
1122
1294
|
extraInfo: {
|
|
@@ -1127,6 +1299,32 @@ describe('DdSdkReactNative', () => {
|
|
|
1127
1299
|
});
|
|
1128
1300
|
});
|
|
1129
1301
|
|
|
1302
|
+
describe('clearUserInfo', () => {
|
|
1303
|
+
it('calls SDK method when clearUserInfo, and clears the user in UserProvider', async () => {
|
|
1304
|
+
// GIVEN
|
|
1305
|
+
const userInfo = {
|
|
1306
|
+
id: 'id',
|
|
1307
|
+
name: 'name',
|
|
1308
|
+
email: 'email',
|
|
1309
|
+
extraInfo: {
|
|
1310
|
+
foo: 'bar'
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
|
|
1314
|
+
await DdSdkReactNative.setUserInfo(userInfo);
|
|
1315
|
+
|
|
1316
|
+
// WHEN
|
|
1317
|
+
await DdSdkReactNative.clearUserInfo();
|
|
1318
|
+
|
|
1319
|
+
// THEN
|
|
1320
|
+
expect(NativeDdSdk.clearUserInfo).toHaveBeenCalledTimes(1);
|
|
1321
|
+
expect(NativeDdSdk.setUserInfo).toHaveBeenCalled();
|
|
1322
|
+
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual(
|
|
1323
|
+
undefined
|
|
1324
|
+
);
|
|
1325
|
+
});
|
|
1326
|
+
});
|
|
1327
|
+
|
|
1130
1328
|
describe('setTrackingConsent', () => {
|
|
1131
1329
|
it('calls SDK method when setTrackingConsent', async () => {
|
|
1132
1330
|
// GIVEN
|
|
@@ -1137,8 +1335,10 @@ describe('DdSdkReactNative', () => {
|
|
|
1137
1335
|
DdSdkReactNative.setTrackingConsent(consent);
|
|
1138
1336
|
|
|
1139
1337
|
// THEN
|
|
1140
|
-
expect(
|
|
1141
|
-
expect(
|
|
1338
|
+
expect(NativeDdSdk.setTrackingConsent).toHaveBeenCalledTimes(1);
|
|
1339
|
+
expect(NativeDdSdk.setTrackingConsent).toHaveBeenCalledWith(
|
|
1340
|
+
consent
|
|
1341
|
+
);
|
|
1142
1342
|
});
|
|
1143
1343
|
});
|
|
1144
1344
|
|
|
@@ -1148,7 +1348,7 @@ describe('DdSdkReactNative', () => {
|
|
|
1148
1348
|
DdSdkReactNative.clearAllData();
|
|
1149
1349
|
|
|
1150
1350
|
// THEN
|
|
1151
|
-
expect(
|
|
1351
|
+
expect(NativeDdSdk.clearAllData).toHaveBeenCalledTimes(1);
|
|
1152
1352
|
});
|
|
1153
1353
|
});
|
|
1154
1354
|
|
|
@@ -1163,16 +1363,18 @@ describe('DdSdkReactNative', () => {
|
|
|
1163
1363
|
const proxyAddress = '1.1.1.1';
|
|
1164
1364
|
const proxyPort = 8080;
|
|
1165
1365
|
|
|
1166
|
-
const configuration = new
|
|
1366
|
+
const configuration = new CoreConfiguration(
|
|
1167
1367
|
fakeClientToken,
|
|
1168
|
-
fakeEnvName
|
|
1368
|
+
fakeEnvName
|
|
1369
|
+
);
|
|
1370
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
1169
1371
|
fakeAppId,
|
|
1170
1372
|
false,
|
|
1171
1373
|
false,
|
|
1172
1374
|
false
|
|
1173
1375
|
);
|
|
1174
1376
|
|
|
1175
|
-
configuration.
|
|
1377
|
+
configuration.proxyConfiguration = {
|
|
1176
1378
|
type: proxyType,
|
|
1177
1379
|
address: proxyAddress,
|
|
1178
1380
|
port: proxyPort
|
|
@@ -1188,11 +1390,13 @@ describe('DdSdkReactNative', () => {
|
|
|
1188
1390
|
1
|
|
1189
1391
|
);
|
|
1190
1392
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
1191
|
-
.calls[0][0] as
|
|
1393
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
1192
1394
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
1193
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
1395
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
1396
|
+
fakeAppId
|
|
1397
|
+
);
|
|
1194
1398
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
1195
|
-
expect(ddSdkConfiguration.
|
|
1399
|
+
expect(ddSdkConfiguration.proxyConfiguration).toStrictEqual({
|
|
1196
1400
|
type: proxyType,
|
|
1197
1401
|
address: proxyAddress,
|
|
1198
1402
|
port: proxyPort
|
|
@@ -1222,16 +1426,18 @@ describe('DdSdkReactNative', () => {
|
|
|
1222
1426
|
const proxyUsername = 'foo';
|
|
1223
1427
|
const proxyPassword = 'bar';
|
|
1224
1428
|
|
|
1225
|
-
const configuration = new
|
|
1429
|
+
const configuration = new CoreConfiguration(
|
|
1226
1430
|
fakeClientToken,
|
|
1227
|
-
fakeEnvName
|
|
1431
|
+
fakeEnvName
|
|
1432
|
+
);
|
|
1433
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
1228
1434
|
fakeAppId,
|
|
1229
1435
|
false,
|
|
1230
1436
|
false,
|
|
1231
1437
|
false
|
|
1232
1438
|
);
|
|
1233
1439
|
|
|
1234
|
-
configuration.
|
|
1440
|
+
configuration.proxyConfiguration = {
|
|
1235
1441
|
type: proxyType,
|
|
1236
1442
|
address: proxyAddress,
|
|
1237
1443
|
port: proxyPort,
|
|
@@ -1249,11 +1455,13 @@ describe('DdSdkReactNative', () => {
|
|
|
1249
1455
|
1
|
|
1250
1456
|
);
|
|
1251
1457
|
const ddSdkConfiguration = NativeModules.DdSdk.initialize.mock
|
|
1252
|
-
.calls[0][0] as
|
|
1458
|
+
.calls[0][0] as DdSdkNativeConfiguration;
|
|
1253
1459
|
expect(ddSdkConfiguration.clientToken).toBe(fakeClientToken);
|
|
1254
|
-
expect(ddSdkConfiguration.applicationId).toBe(
|
|
1460
|
+
expect(ddSdkConfiguration.rumConfiguration?.applicationId).toBe(
|
|
1461
|
+
fakeAppId
|
|
1462
|
+
);
|
|
1255
1463
|
expect(ddSdkConfiguration.env).toBe(fakeEnvName);
|
|
1256
|
-
expect(ddSdkConfiguration.
|
|
1464
|
+
expect(ddSdkConfiguration.proxyConfiguration).toStrictEqual({
|
|
1257
1465
|
type: proxyType,
|
|
1258
1466
|
address: proxyAddress,
|
|
1259
1467
|
port: proxyPort,
|