@datadog/mobile-react-native 2.14.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +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/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/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 +15 -25
- 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/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 +15 -24
- 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/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 +20 -32
- 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,9 +7,9 @@
|
|
|
7
7
|
import { version as reactNativeVersion } from 'react-native/package.json';
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { InitializationMode } from '../../../
|
|
10
|
+
import { InitializationMode } from '../../../config/types';
|
|
11
11
|
import { DdRum } from '../../../rum/DdRum';
|
|
12
|
-
import { RumActionType } from '../../../rum/types';
|
|
12
|
+
import { PropagatorType, RumActionType } from '../../../rum/types';
|
|
13
13
|
import { DdTrace } from '../../../trace/DdTrace';
|
|
14
14
|
import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
|
|
15
15
|
import { GlobalState } from '../../GlobalState/GlobalState';
|
|
@@ -42,7 +42,7 @@ const flushPromises = () =>
|
|
|
42
42
|
describe('DatadogProvider', () => {
|
|
43
43
|
afterEach(() => {
|
|
44
44
|
jest.clearAllMocks();
|
|
45
|
-
GlobalState.
|
|
45
|
+
GlobalState.isInitialized = false;
|
|
46
46
|
__internalResetIsInitializedForTesting();
|
|
47
47
|
BufferSingleton.reset();
|
|
48
48
|
(nowMock as any).mockReturnValue('timestamp_not_specified');
|
|
@@ -63,17 +63,14 @@ describe('DatadogProvider', () => {
|
|
|
63
63
|
'_dd.sdk_version'
|
|
64
64
|
];
|
|
65
65
|
expect(receivedConfiguration).toMatchInlineSnapshot(`
|
|
66
|
-
|
|
66
|
+
DdSdkNativeConfiguration {
|
|
67
67
|
"additionalConfiguration": {
|
|
68
68
|
"_dd.react_native_version": "${reactNativeVersion}",
|
|
69
69
|
"_dd.source": "react-native",
|
|
70
70
|
},
|
|
71
|
-
"
|
|
72
|
-
"applicationId": "fakeApplicationId",
|
|
71
|
+
"attributeEncoders": [],
|
|
73
72
|
"batchProcessingLevel": "MEDIUM",
|
|
74
73
|
"batchSize": "MEDIUM",
|
|
75
|
-
"bundleLogsWithRum": true,
|
|
76
|
-
"bundleLogsWithTraces": true,
|
|
77
74
|
"clientToken": "fakeToken",
|
|
78
75
|
"configurationForTelemetry": {
|
|
79
76
|
"initializationType": "SYNC",
|
|
@@ -83,29 +80,44 @@ describe('DatadogProvider', () => {
|
|
|
83
80
|
"trackInteractions": true,
|
|
84
81
|
"trackNetworkRequests": false,
|
|
85
82
|
},
|
|
86
|
-
"customEndpoints": {},
|
|
87
83
|
"env": "fakeEnv",
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
"logsConfiguration": undefined,
|
|
85
|
+
"proxyConfiguration": undefined,
|
|
86
|
+
"rumConfiguration": RumConfiguration {
|
|
87
|
+
"actionEventMapper": null,
|
|
88
|
+
"actionNameAttribute": undefined,
|
|
89
|
+
"appHangThreshold": undefined,
|
|
90
|
+
"applicationId": "fakeApplicationId",
|
|
91
|
+
"customEndpoint": undefined,
|
|
92
|
+
"errorEventMapper": null,
|
|
93
|
+
"firstPartyHosts": [],
|
|
94
|
+
"initialResourceThreshold": undefined,
|
|
95
|
+
"longTaskThresholdMs": 0,
|
|
96
|
+
"nativeCrashReportEnabled": false,
|
|
97
|
+
"nativeInteractionTracking": false,
|
|
98
|
+
"nativeLongTaskThresholdMs": 200,
|
|
99
|
+
"nativeViewTracking": false,
|
|
100
|
+
"resourceEventMapper": null,
|
|
101
|
+
"resourceTraceSampleRate": 100,
|
|
102
|
+
"sessionSampleRate": 100,
|
|
103
|
+
"telemetrySampleRate": 20,
|
|
104
|
+
"trackBackgroundEvents": false,
|
|
105
|
+
"trackErrors": true,
|
|
106
|
+
"trackFrustrations": true,
|
|
107
|
+
"trackInteractions": true,
|
|
108
|
+
"trackMemoryWarnings": true,
|
|
109
|
+
"trackNonFatalAnrs": undefined,
|
|
110
|
+
"trackResources": false,
|
|
111
|
+
"trackWatchdogTerminations": false,
|
|
112
|
+
"useAccessibilityLabel": true,
|
|
113
|
+
"vitalsUpdateFrequency": "AVERAGE",
|
|
114
|
+
},
|
|
115
|
+
"service": undefined,
|
|
99
116
|
"site": "US1",
|
|
100
|
-
"
|
|
101
|
-
"trackBackgroundEvents": false,
|
|
102
|
-
"trackFrustrations": true,
|
|
103
|
-
"trackNonFatalAnrs": undefined,
|
|
104
|
-
"trackWatchdogTerminations": false,
|
|
117
|
+
"traceConfiguration": undefined,
|
|
105
118
|
"trackingConsent": "granted",
|
|
106
119
|
"uploadFrequency": "AVERAGE",
|
|
107
120
|
"verbosity": undefined,
|
|
108
|
-
"vitalsUpdateFrequency": "AVERAGE",
|
|
109
121
|
}
|
|
110
122
|
`);
|
|
111
123
|
|
|
@@ -185,11 +197,23 @@ describe('DatadogProvider', () => {
|
|
|
185
197
|
const { getByText } = renderWithProvider({
|
|
186
198
|
onInitialization,
|
|
187
199
|
configuration: {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
rumConfiguration: {
|
|
201
|
+
trackErrors: true,
|
|
202
|
+
trackResources: true,
|
|
203
|
+
trackInteractions: true,
|
|
204
|
+
resourceTraceSampleRate: 100,
|
|
205
|
+
firstPartyHosts: [
|
|
206
|
+
{
|
|
207
|
+
match: 'api.com',
|
|
208
|
+
propagatorTypes: [
|
|
209
|
+
PropagatorType.DATADOG,
|
|
210
|
+
PropagatorType.TRACECONTEXT
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
traceConfiguration: {},
|
|
216
|
+
logsConfiguration: {}
|
|
193
217
|
}
|
|
194
218
|
});
|
|
195
219
|
getByText('I am a test application');
|
|
@@ -197,9 +221,11 @@ describe('DatadogProvider', () => {
|
|
|
197
221
|
expect(onInitialization).not.toHaveBeenCalled();
|
|
198
222
|
|
|
199
223
|
await DatadogProvider.initialize({
|
|
200
|
-
applicationId: 'fake-application-id',
|
|
201
224
|
clientToken: 'fake-client-token',
|
|
202
|
-
env: 'fake-env'
|
|
225
|
+
env: 'fake-env',
|
|
226
|
+
rumConfiguration: {
|
|
227
|
+
applicationId: 'fake-application-id'
|
|
228
|
+
}
|
|
203
229
|
});
|
|
204
230
|
await flushPromises();
|
|
205
231
|
expect(onInitialization).toHaveBeenCalledTimes(1);
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
import { fireEvent } from '@testing-library/react-native';
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { InitializationMode } from '../../../DdSdkReactNativeConfiguration';
|
|
11
10
|
import { DdSdkReactNative } from '../../../DdSdkReactNative';
|
|
11
|
+
import { InitializationMode } from '../../../config/types';
|
|
12
12
|
import { DdRumUserInteractionTracking } from '../../../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
13
13
|
import { XMLHttpRequestMock } from '../../../rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock';
|
|
14
|
+
import { PropagatorType } from '../../../rum/types';
|
|
14
15
|
import { DefaultTimeProvider } from '../../../utils/time-provider/DefaultTimeProvider';
|
|
15
16
|
import { GlobalState } from '../../GlobalState/GlobalState';
|
|
16
17
|
import { BufferSingleton } from '../Buffer/BufferSingleton';
|
|
@@ -42,7 +43,7 @@ const flushPromises = () =>
|
|
|
42
43
|
describe('DatadogProvider', () => {
|
|
43
44
|
beforeEach(() => {
|
|
44
45
|
jest.clearAllMocks();
|
|
45
|
-
GlobalState.
|
|
46
|
+
GlobalState.isInitialized = false;
|
|
46
47
|
DdSdkReactNative['wasAutoInstrumented'] = false;
|
|
47
48
|
__internalResetIsInitializedForTesting();
|
|
48
49
|
BufferSingleton.reset();
|
|
@@ -140,11 +141,23 @@ describe('DatadogProvider', () => {
|
|
|
140
141
|
it('does not start reporting auto-instrumentation', async () => {
|
|
141
142
|
const { getByText } = renderWithProvider({
|
|
142
143
|
configuration: {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
rumConfiguration: {
|
|
145
|
+
trackErrors: true,
|
|
146
|
+
trackResources: true,
|
|
147
|
+
trackInteractions: true,
|
|
148
|
+
resourceTraceSampleRate: 100,
|
|
149
|
+
firstPartyHosts: [
|
|
150
|
+
{
|
|
151
|
+
match: 'api.com',
|
|
152
|
+
propagatorTypes: [
|
|
153
|
+
PropagatorType.DATADOG,
|
|
154
|
+
PropagatorType.TRACECONTEXT
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
traceConfiguration: {},
|
|
160
|
+
logsConfiguration: {}
|
|
148
161
|
}
|
|
149
162
|
});
|
|
150
163
|
await flushPromises();
|
|
@@ -162,15 +175,18 @@ describe('DatadogProvider', () => {
|
|
|
162
175
|
expect(NativeModules.DdRum.addAction).not.toHaveBeenCalled();
|
|
163
176
|
|
|
164
177
|
await DatadogProvider.initialize({
|
|
165
|
-
applicationId: 'fake-application-id',
|
|
166
178
|
clientToken: 'fake-client-token',
|
|
167
|
-
env: 'fake-env'
|
|
179
|
+
env: 'fake-env',
|
|
180
|
+
rumConfiguration: {
|
|
181
|
+
applicationId: 'fake-application-id'
|
|
182
|
+
}
|
|
168
183
|
});
|
|
169
184
|
await flushPromises();
|
|
170
185
|
|
|
171
186
|
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
172
187
|
expect(
|
|
173
|
-
NativeModules.DdSdk.initialize.mock.calls[0][0].
|
|
188
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0].rumConfiguration
|
|
189
|
+
.firstPartyHosts
|
|
174
190
|
).toEqual([
|
|
175
191
|
{
|
|
176
192
|
match: 'api.com',
|
package/src/sdk/DdSdk.ts
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
|
+
import { getGlobalInstance } from '../utils/singletonUtils';
|
|
6
7
|
|
|
7
|
-
import
|
|
8
|
+
import { DdSdkWrapper } from './DdSdkInternal';
|
|
9
|
+
import type { DdSdkType } from './DdSdkInternal';
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
const DdSdk
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const CORE_MODULE = 'com.datadog.reactnative.core';
|
|
12
|
+
export const DdSdk = getGlobalInstance(
|
|
13
|
+
CORE_MODULE,
|
|
14
|
+
() => new DdSdkWrapper()
|
|
15
|
+
) as DdSdkType;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { DdSdkNativeConfiguration } from '../config/features/CoreConfigurationNative';
|
|
8
|
+
import type { DdNativeSdkType } from '../nativeModulesTypes';
|
|
9
|
+
|
|
10
|
+
import type { AttributeEncoder } from './AttributesEncoding/types';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
13
|
+
const NativeDdSdk: DdNativeSdkType = require('../specs/NativeDdSdk').default;
|
|
14
|
+
|
|
15
|
+
export type DdSdkType = {
|
|
16
|
+
readonly attributeEncoders: AttributeEncoder<any>[];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Initializes Datadog's features.
|
|
20
|
+
* @param configuration: The configuration to use.
|
|
21
|
+
*/
|
|
22
|
+
initialize(configuration: DdSdkNativeConfiguration): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export class DdSdkWrapper implements DdNativeSdkType {
|
|
26
|
+
get attributeEncoders(): AttributeEncoder<any>[] {
|
|
27
|
+
return this._attributeEncoders;
|
|
28
|
+
}
|
|
29
|
+
private _attributeEncoders: AttributeEncoder<any>[] = [];
|
|
30
|
+
|
|
31
|
+
initialize(configuration: DdSdkNativeConfiguration): Promise<void> {
|
|
32
|
+
this._attributeEncoders = [...configuration.attributeEncoders];
|
|
33
|
+
return NativeDdSdk.initialize(configuration);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getConstants() {
|
|
37
|
+
return NativeDdSdk.getConstants();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
setUserInfo(user: object): Promise<object> {
|
|
41
|
+
return NativeDdSdk.setUserInfo(user);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
clearUserInfo(): Promise<void> {
|
|
45
|
+
return NativeDdSdk.clearUserInfo();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
addUserExtraInfo(extraInfo: object): Promise<object> {
|
|
49
|
+
return NativeDdSdk.addUserExtraInfo(extraInfo);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
addAttribute(key: string, value: object): Promise<void> {
|
|
53
|
+
return NativeDdSdk.addAttribute(key, value);
|
|
54
|
+
}
|
|
55
|
+
removeAttribute(key: string): Promise<void> {
|
|
56
|
+
return NativeDdSdk.removeAttribute(key);
|
|
57
|
+
}
|
|
58
|
+
addAttributes(attributes: object): Promise<void> {
|
|
59
|
+
return NativeDdSdk.addAttributes(attributes);
|
|
60
|
+
}
|
|
61
|
+
removeAttributes(keys: string[]): Promise<void> {
|
|
62
|
+
return NativeDdSdk.removeAttributes(keys);
|
|
63
|
+
}
|
|
64
|
+
setAccountInfo(account: object): Promise<object> {
|
|
65
|
+
return NativeDdSdk.setAccountInfo(account);
|
|
66
|
+
}
|
|
67
|
+
clearAccountInfo(): Promise<void> {
|
|
68
|
+
return NativeDdSdk.clearAccountInfo();
|
|
69
|
+
}
|
|
70
|
+
addAccountExtraInfo(extraInfo: object): Promise<object> {
|
|
71
|
+
return NativeDdSdk.addAccountExtraInfo(extraInfo);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setTrackingConsent(trackingConsent: string): Promise<void> {
|
|
75
|
+
return NativeDdSdk.setTrackingConsent(trackingConsent);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sendTelemetryLog(
|
|
79
|
+
message: string,
|
|
80
|
+
attributes: object,
|
|
81
|
+
config: object
|
|
82
|
+
): Promise<void> {
|
|
83
|
+
return NativeDdSdk.sendTelemetryLog(message, attributes, config);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
telemetryDebug(message: string): Promise<void> {
|
|
87
|
+
return NativeDdSdk.telemetryDebug(message);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
telemetryError(
|
|
91
|
+
message: string,
|
|
92
|
+
stack: string,
|
|
93
|
+
kind: string
|
|
94
|
+
): Promise<void> {
|
|
95
|
+
return NativeDdSdk.telemetryError(message, stack, kind);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
consumeWebviewEvent(message: string): Promise<void> {
|
|
99
|
+
return NativeDdSdk.consumeWebviewEvent(message);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
clearAllData(): Promise<void> {
|
|
103
|
+
return NativeDdSdk.clearAllData();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
addListener(eventType: string): void {
|
|
107
|
+
return NativeDdSdk.addListener(eventType);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
removeListeners(count: number): void {
|
|
111
|
+
return NativeDdSdk.removeListeners(count);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_setAttributeEncodersForTesting(
|
|
115
|
+
attributeEncoders: AttributeEncoder<any>[]
|
|
116
|
+
) {
|
|
117
|
+
this._attributeEncoders = [...attributeEncoders];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { NativeDdSdk };
|
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { InternalLog } from '../../InternalLog';
|
|
8
|
-
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
9
|
-
import {
|
|
8
|
+
import { SdkVerbosity } from '../../config/types/SdkVerbosity';
|
|
9
|
+
import { AccountInfoSingleton } from '../AccountInfoSingleton/AccountInfoSingleton';
|
|
10
|
+
import type { AccountInfo } from '../AccountInfoSingleton/types';
|
|
10
11
|
import { AttributesSingleton } from '../AttributesSingleton/AttributesSingleton';
|
|
11
12
|
import type { Attributes } from '../AttributesSingleton/types';
|
|
13
|
+
import { NativeDdSdk } from '../DdSdkInternal';
|
|
12
14
|
import { UserInfoSingleton } from '../UserInfoSingleton/UserInfoSingleton';
|
|
13
15
|
import type { UserInfo } from '../UserInfoSingleton/types';
|
|
14
16
|
|
|
15
17
|
import { deepClone } from './utils/deepClone';
|
|
16
18
|
|
|
17
19
|
export type AdditionalEventDataForMapper = {
|
|
18
|
-
userInfo
|
|
20
|
+
userInfo?: UserInfo;
|
|
21
|
+
accountInfo?: AccountInfo;
|
|
19
22
|
attributes: Attributes;
|
|
20
23
|
};
|
|
21
24
|
|
|
@@ -66,9 +69,11 @@ export class EventMapper<RawEvent, MapperEvent, NativeEvent> {
|
|
|
66
69
|
|
|
67
70
|
// formatting
|
|
68
71
|
const userInfo = UserInfoSingleton.getInstance().getUserInfo();
|
|
72
|
+
const accountInfo = AccountInfoSingleton.getInstance().getAccountInfo();
|
|
69
73
|
const attributes = AttributesSingleton.getInstance().getAttributes();
|
|
70
74
|
const initialEvent = this.formatRawEventForMapper(rawEvent, {
|
|
71
75
|
userInfo,
|
|
76
|
+
accountInfo,
|
|
72
77
|
attributes
|
|
73
78
|
});
|
|
74
79
|
|
|
@@ -87,7 +92,7 @@ export class EventMapper<RawEvent, MapperEvent, NativeEvent> {
|
|
|
87
92
|
)}: ${error}`,
|
|
88
93
|
SdkVerbosity.WARN
|
|
89
94
|
);
|
|
90
|
-
|
|
95
|
+
NativeDdSdk.telemetryDebug('Error while running the event mapper');
|
|
91
96
|
return this.formatMapperEventForNative(backupEvent, backupEvent);
|
|
92
97
|
}
|
|
93
98
|
};
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { NativeDdSdk } from '../../DdSdkInternal';
|
|
8
8
|
import { EventMapper } from '../EventMapper';
|
|
9
9
|
|
|
10
10
|
describe('EventMapper', () => {
|
|
11
11
|
it('returns the original log when the event log mapper crashes', () => {
|
|
12
12
|
const eventMapper = new EventMapper(
|
|
13
13
|
(event: object) => {
|
|
14
|
-
event['badData'] = 'bad data';
|
|
14
|
+
(event as { badData: string })['badData'] = 'bad data';
|
|
15
15
|
throw new Error('crashed');
|
|
16
16
|
},
|
|
17
17
|
(event: object) => event,
|
|
@@ -26,7 +26,7 @@ describe('EventMapper', () => {
|
|
|
26
26
|
).toEqual({
|
|
27
27
|
someData: 'some data'
|
|
28
28
|
});
|
|
29
|
-
expect(
|
|
29
|
+
expect(NativeDdSdk.telemetryDebug).toHaveBeenCalledWith(
|
|
30
30
|
'Error while running the event mapper'
|
|
31
31
|
);
|
|
32
32
|
});
|
|
@@ -4,23 +4,22 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { getGlobalInstance } from '../../utils/singletonUtils';
|
|
8
|
+
|
|
9
|
+
const GLOBAL_STATE_MODULE = 'com.datadog.reactnative.sdk.global_state';
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* A singleton container for attributes that are shared internally across all
|
|
9
13
|
* the SDK classes.
|
|
10
14
|
*/
|
|
11
|
-
|
|
15
|
+
class _GlobalState {
|
|
12
16
|
/**
|
|
13
17
|
* `true` if the SDK is initialized, `false` otherwise.
|
|
14
18
|
*/
|
|
15
19
|
public isInitialized = false;
|
|
16
|
-
|
|
17
|
-
// Singleton implementation
|
|
18
|
-
private static _instance: GlobalState | undefined = undefined;
|
|
19
|
-
public static get instance(): GlobalState {
|
|
20
|
-
if (this._instance === undefined) {
|
|
21
|
-
this._instance = new GlobalState();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return this._instance;
|
|
25
|
-
}
|
|
26
20
|
}
|
|
21
|
+
|
|
22
|
+
export const GlobalState = getGlobalInstance(
|
|
23
|
+
GLOBAL_STATE_MODULE,
|
|
24
|
+
() => new _GlobalState()
|
|
25
|
+
);
|
|
@@ -4,18 +4,25 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import { setCachedUserId } from '../../rum/helper';
|
|
8
|
+
|
|
7
9
|
import type { UserInfo } from './types';
|
|
8
10
|
|
|
9
11
|
class UserInfoProvider {
|
|
10
|
-
private userInfo: UserInfo =
|
|
12
|
+
private userInfo: UserInfo | undefined = undefined;
|
|
11
13
|
|
|
12
14
|
setUserInfo = (userInfo: UserInfo) => {
|
|
13
15
|
this.userInfo = userInfo;
|
|
16
|
+
setCachedUserId(this.userInfo.id);
|
|
14
17
|
};
|
|
15
18
|
|
|
16
|
-
getUserInfo = (): UserInfo => {
|
|
19
|
+
getUserInfo = (): UserInfo | undefined => {
|
|
17
20
|
return this.userInfo;
|
|
18
21
|
};
|
|
22
|
+
|
|
23
|
+
clearUserInfo = () => {
|
|
24
|
+
this.userInfo = undefined;
|
|
25
|
+
};
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
export class UserInfoSingleton {
|
|
@@ -7,23 +7,60 @@
|
|
|
7
7
|
import { UserInfoSingleton } from '../UserInfoSingleton';
|
|
8
8
|
|
|
9
9
|
describe('UserInfoSingleton', () => {
|
|
10
|
-
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
UserInfoSingleton.reset();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('returns undefined by default', () => {
|
|
15
|
+
expect(UserInfoSingleton.getInstance().getUserInfo()).toBeUndefined();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('stores and returns user info after setUserInfo', () => {
|
|
19
|
+
const info = {
|
|
20
|
+
id: 'test',
|
|
21
|
+
email: 'user@mail.com',
|
|
22
|
+
extraInfo: { loggedIn: true }
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
UserInfoSingleton.getInstance().setUserInfo(info);
|
|
26
|
+
|
|
27
|
+
expect(UserInfoSingleton.getInstance().getUserInfo()).toEqual(info);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('clears user info with clearUserInfo', () => {
|
|
11
31
|
UserInfoSingleton.getInstance().setUserInfo({
|
|
32
|
+
id: 'test',
|
|
12
33
|
email: 'user@mail.com',
|
|
13
|
-
extraInfo: {
|
|
14
|
-
loggedIn: true
|
|
15
|
-
}
|
|
34
|
+
extraInfo: { loggedIn: true }
|
|
16
35
|
});
|
|
17
36
|
|
|
18
|
-
|
|
37
|
+
UserInfoSingleton.getInstance().clearUserInfo();
|
|
38
|
+
|
|
39
|
+
expect(UserInfoSingleton.getInstance().getUserInfo()).toBeUndefined();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('reset() replaces the provider and clears stored user info', () => {
|
|
43
|
+
const instanceBefore = UserInfoSingleton.getInstance();
|
|
44
|
+
|
|
45
|
+
UserInfoSingleton.getInstance().setUserInfo({
|
|
46
|
+
id: 'test',
|
|
19
47
|
email: 'user@mail.com',
|
|
20
|
-
extraInfo: {
|
|
21
|
-
loggedIn: true
|
|
22
|
-
}
|
|
48
|
+
extraInfo: { loggedIn: true }
|
|
23
49
|
});
|
|
24
50
|
|
|
25
51
|
UserInfoSingleton.reset();
|
|
26
52
|
|
|
27
|
-
|
|
53
|
+
const instanceAfter = UserInfoSingleton.getInstance();
|
|
54
|
+
|
|
55
|
+
expect(instanceAfter).not.toBe(instanceBefore);
|
|
56
|
+
|
|
57
|
+
expect(instanceAfter.getUserInfo()).toBeUndefined();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('getInstance returns the same provider between calls (singleton behavior)', () => {
|
|
61
|
+
const a = UserInfoSingleton.getInstance();
|
|
62
|
+
const b = UserInfoSingleton.getInstance();
|
|
63
|
+
|
|
64
|
+
expect(a).toBe(b);
|
|
28
65
|
});
|
|
29
66
|
});
|
|
@@ -5,11 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export type UserInfo = {
|
|
8
|
-
readonly id
|
|
8
|
+
readonly id: string;
|
|
9
9
|
readonly name?: string;
|
|
10
10
|
readonly email?: string;
|
|
11
11
|
readonly extraInfo?: Record<string, unknown>;
|
|
12
|
-
readonly [
|
|
13
|
-
key: string
|
|
14
|
-
]: unknown /** @deprecated To be removed alongside DdSdkReactnative.setUser */;
|
|
15
12
|
};
|
package/src/specs/NativeDdRum.ts
CHANGED
|
@@ -136,6 +136,31 @@ export interface Spec extends TurboModule {
|
|
|
136
136
|
*/
|
|
137
137
|
addTiming(name: string): Promise<void>;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Adds a custom attribute to the active RUM View. It will be propagated to all future RUM events associated with the active View.
|
|
141
|
+
* @param key: key for this view attribute.
|
|
142
|
+
* @param value: value for this attribute.
|
|
143
|
+
*/
|
|
144
|
+
addViewAttribute(key: string, value: Object): Promise<void>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Removes an attribute from the active RUM View.
|
|
148
|
+
* @param key: key for the attribute to be removed from the view.
|
|
149
|
+
*/
|
|
150
|
+
removeViewAttribute(key: string): Promise<void>;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Adds multiple attributes to the active RUM View. They will be propagated to all future RUM events associated with the active View.
|
|
154
|
+
* @param attributes: key/value object containing all attributes to be added to the view.
|
|
155
|
+
*/
|
|
156
|
+
addViewAttributes(attributes: Object): Promise<void>;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Removes multiple attributes from the active RUM View.
|
|
160
|
+
* @param keys: keys for the attributes to be removed from the view.
|
|
161
|
+
*/
|
|
162
|
+
removeViewAttributes(keys: string[]): Promise<void>;
|
|
163
|
+
|
|
139
164
|
/**
|
|
140
165
|
* Adds the loading time of the view to the active view.
|
|
141
166
|
* It is calculated as the difference between the current time and the start time of the view.
|
|
@@ -160,6 +185,46 @@ export interface Spec extends TurboModule {
|
|
|
160
185
|
* Get current Session ID, or `undefined` if not available.
|
|
161
186
|
*/
|
|
162
187
|
getCurrentSessionId(): Promise<string | undefined>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Starts a Feature Operation, representing a high-level logical flow within your application (e.g., `login_flow`).
|
|
191
|
+
* @param name - The name of the feature operation (for example, `"login_flow"`).
|
|
192
|
+
* @param operationKey - An optional key to uniquely identify a specific instance of this operation when multiple are running concurrently.
|
|
193
|
+
* @param attributes - Custom attributes to attach to this operation.
|
|
194
|
+
*/
|
|
195
|
+
startFeatureOperation(
|
|
196
|
+
name: string,
|
|
197
|
+
operationKey: string | null,
|
|
198
|
+
attributes: Object
|
|
199
|
+
): Promise<void>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Marks a Feature Operation as successfully completed.
|
|
203
|
+
* Should be called when a previously started operation (via `startFeatureOperation`) finishes without error.
|
|
204
|
+
* @param name - The name of the feature operation (for example, `"login_flow"`).
|
|
205
|
+
* @param operationKey - The key for the operation instance to complete, if it was specified when starting it.
|
|
206
|
+
* @param attributes - Custom attributes to attach to this operation’s completion event.
|
|
207
|
+
*/
|
|
208
|
+
succeedFeatureOperation(
|
|
209
|
+
name: string,
|
|
210
|
+
operationKey: string | null,
|
|
211
|
+
attributes: Object
|
|
212
|
+
): Promise<void>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Marks a Feature Operation as failed.
|
|
216
|
+
* Should be called when a previously started operation (via `startFeatureOperation`) ends with an error.
|
|
217
|
+
* @param name - The name of the feature operation (for example, `"login_flow"`).
|
|
218
|
+
* @param operationKey - The key for the operation instance to fail, if it was specified when starting it.
|
|
219
|
+
* @param reason - The reason for the failure.
|
|
220
|
+
* @param attributes - Custom attributes to attach to this operation’s failure event.
|
|
221
|
+
*/
|
|
222
|
+
failFeatureOperation(
|
|
223
|
+
name: string,
|
|
224
|
+
operationKey: string | null,
|
|
225
|
+
reason: string,
|
|
226
|
+
attributes: Object
|
|
227
|
+
): Promise<void>;
|
|
163
228
|
}
|
|
164
229
|
|
|
165
230
|
// eslint-disable-next-line import/no-default-export
|