@datadog/mobile-react-native 2.3.6 → 2.4.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 +7 -7
- package/android/build.gradle +4 -4
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +15 -0
- package/android/src/test/resources/input/complete-configuration.json +5 -1
- package/datadog-configuration.schema.json +54 -9
- package/ios/Sources/DatadogSDKWrapper.swift +3 -3
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +6 -12
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +7 -4
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +2 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/polyfills.js +31 -0
- package/lib/commonjs/polyfills.js.map +1 -0
- package/lib/commonjs/rum/DdRum.js +3 -3
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +14 -9
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -6
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +182 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -57
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +18 -10
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +4 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/sdk/GlobalState/GlobalState.js +38 -0
- package/lib/commonjs/sdk/GlobalState/GlobalState.js.map +1 -0
- package/lib/commonjs/specs/NativeDdLogs.js +1 -0
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/specs/NativeDdRum.js +1 -0
- package/lib/commonjs/specs/NativeDdRum.js.map +1 -1
- package/lib/commonjs/specs/NativeDdSdk.js +1 -0
- package/lib/commonjs/specs/NativeDdSdk.js.map +1 -1
- package/lib/commonjs/specs/NativeDdTrace.js +1 -0
- package/lib/commonjs/specs/NativeDdTrace.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +5 -12
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +7 -4
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/polyfills.js +28 -0
- package/lib/module/polyfills.js.map +1 -0
- package/lib/module/rum/DdRum.js +2 -2
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +14 -9
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -6
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +169 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +3 -54
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +13 -8
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +3 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/sdk/GlobalState/GlobalState.js +29 -0
- package/lib/module/sdk/GlobalState/GlobalState.js.map +1 -0
- package/lib/module/specs/NativeDdLogs.js +1 -0
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/specs/NativeDdRum.js +1 -0
- package/lib/module/specs/NativeDdRum.js.map +1 -1
- package/lib/module/specs/NativeDdSdk.js +1 -0
- package/lib/module/specs/NativeDdSdk.js.map +1 -1
- package/lib/module/specs/NativeDdTrace.js +1 -0
- package/lib/module/specs/NativeDdTrace.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNative.d.ts +0 -5
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +5 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +12 -3
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -3
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +111 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +2 -0
- package/lib/typescript/sdk/GlobalState/GlobalState.d.ts +12 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +7 -11
- package/src/DdSdkReactNativeConfiguration.tsx +10 -4
- package/src/__tests__/DdSdkReactNative.test.tsx +3 -2
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/__tests__/mock.test.ts +0 -1
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +32 -0
- package/src/index.tsx +4 -0
- package/src/polyfills.js +37 -0
- package/src/rum/DdRum.ts +2 -2
- package/src/rum/__tests__/DdRum.test.ts +3 -3
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +23 -7
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +3 -4
- package/src/rum/instrumentation/resourceTracking/__tests__/__utils__/XMLHttpRequestMock.ts +1 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +227 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/__utils__/TracingIdentifierUtils.ts +64 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +314 -42
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +4 -59
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +33 -19
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.ts +7 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +134 -11
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -2
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +3 -2
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +3 -0
- package/src/sdk/GlobalState/GlobalState.tsx +26 -0
- package/src/specs/NativeDdLogs.ts +1 -0
- package/src/specs/NativeDdRum.ts +1 -0
- package/src/specs/NativeDdSdk.ts +1 -0
- package/src/specs/NativeDdTrace.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NativeDdRum.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA+IA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeRumType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(key: string, context: Object, timestampMs: number): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: string,\n size: number,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: string,\n stacktrace: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n\n /**\n * Stops the current RUM Session.\n */\n stopSession(): Promise<void>;\n\n /**\n * Adds the result of evaluating a feature flag with a given name and value to the view.\n * Feature flag evaluations are local to the active view and are cleared when the view is stopped.\n * @param name: The name of the feature flag\n * @param value: The value of the feature flag, encapsulated in an Object to accept all types\n */\n addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;\n\n /**\n * Get current Session ID, or `undefined` if not available.\n */\n getCurrentSessionId(): Promise<string | undefined>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdRum');\n"]}
|
|
1
|
+
{"version":3,"sources":["NativeDdRum.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA+IA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeRumType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(key: string, context: Object, timestampMs: number): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: string,\n name: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: string,\n size: number,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: string,\n stacktrace: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n\n /**\n * Stops the current RUM Session.\n */\n stopSession(): Promise<void>;\n\n /**\n * Adds the result of evaluating a feature flag with a given name and value to the view.\n * Feature flag evaluations are local to the active view and are cleared when the view is stopped.\n * @param name: The name of the feature flag\n * @param value: The value of the feature flag, encapsulated in an Object to accept all types\n */\n addFeatureFlagEvaluation(name: string, value: Object): Promise<void>;\n\n /**\n * Get current Session ID, or `undefined` if not available.\n */\n getCurrentSessionId(): Promise<string | undefined>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdRum');\n"]}
|
|
@@ -10,5 +10,6 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
10
10
|
* Do not import this Spec directly, use DdNativeSdkType instead.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line import/no-default-export
|
|
13
14
|
export default TurboModuleRegistry.get('DdSdk');
|
|
14
15
|
//# sourceMappingURL=NativeDdSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NativeDdSdk.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AAsDA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeSdkType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: Object): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: Object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: Object): Promise<Object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n\n /**\n * Send webview telemetry logs\n * @param message event description\n */\n consumeWebviewEvent(message: string): Promise<void>;\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n */\n clearAllData(): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdSdk');\n"]}
|
|
1
|
+
{"version":3,"sources":["NativeDdSdk.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AAsDA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,OAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeSdkType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: Object): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: Object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: Object): Promise<Object>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n\n /**\n * Sends internal telemetry debug message\n * @param message debug message\n */\n telemetryDebug(message: string): Promise<void>;\n\n /**\n * Sends internal telemetry error\n * @param message error message\n * @param stack error stack\n * @param kind error kind\n */\n telemetryError(message: string, stack: string, kind: string): Promise<void>;\n\n /**\n * Send webview telemetry logs\n * @param message event description\n */\n consumeWebviewEvent(message: string): Promise<void>;\n\n /**\n * Clears all data that has not already been sent to Datadog servers\n */\n clearAllData(): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdSdk');\n"]}
|
|
@@ -10,5 +10,6 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
10
10
|
* Do not import this Spec directly, use DdNativeTraceType instead.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
// eslint-disable-next-line import/no-default-export
|
|
13
14
|
export default TurboModuleRegistry.get('DdTrace');
|
|
14
15
|
//# sourceMappingURL=NativeDdTrace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NativeDdTrace.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA6BA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,SAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeTraceType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context: Object,\n timestampMs: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n}\n\nexport default TurboModuleRegistry.get<Spec>('DdTrace');\n"]}
|
|
1
|
+
{"version":3,"sources":["NativeDdTrace.ts"],"names":["TurboModuleRegistry","get"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AAEA,SAASA,mBAAT,QAAoC,cAApC;AAEA;AACA;AACA;;AA6BA;AACA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,SAA9B,CAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\n/**\n * Do not import this Spec directly, use DdNativeTraceType instead.\n */\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context: Object,\n timestampMs: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context: Object,\n timestampMs: number\n ): Promise<void>;\n}\n\n// eslint-disable-next-line import/no-default-export\nexport default TurboModuleRegistry.get<Spec>('DdTrace');\n"]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.4.1';\n"]}
|
|
@@ -13,7 +13,6 @@ export declare class DdSdkReactNative {
|
|
|
13
13
|
private static readonly DD_VERSION_SUFFIX;
|
|
14
14
|
private static wasAutoInstrumented;
|
|
15
15
|
private static features?;
|
|
16
|
-
private static _isInitialized;
|
|
17
16
|
/**
|
|
18
17
|
* Initializes the Datadog SDK.
|
|
19
18
|
* @param configuration the configuration for the SDK library
|
|
@@ -57,10 +56,6 @@ export declare class DdSdkReactNative {
|
|
|
57
56
|
* @returns a Promise
|
|
58
57
|
*/
|
|
59
58
|
static clearAllData: () => Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Returns `true` if the SDK was initialized, `false` otherwise.
|
|
62
|
-
*/
|
|
63
|
-
static isInitialized(): boolean;
|
|
64
59
|
private static buildConfiguration;
|
|
65
60
|
private static enableFeatures;
|
|
66
61
|
}
|
|
@@ -77,6 +77,7 @@ export declare const DEFAULTS: {
|
|
|
77
77
|
getCustomEndpoints: () => {};
|
|
78
78
|
bundleLogsWithRum: boolean;
|
|
79
79
|
bundleLogsWithTraces: boolean;
|
|
80
|
+
useAccessibilityLabel: boolean;
|
|
80
81
|
};
|
|
81
82
|
/**
|
|
82
83
|
* The SDK configuration class.
|
|
@@ -90,6 +91,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
90
91
|
readonly trackResources: boolean;
|
|
91
92
|
readonly trackErrors: boolean;
|
|
92
93
|
readonly trackingConsent: TrackingConsent;
|
|
94
|
+
readonly useAccessibilityLabel: boolean;
|
|
93
95
|
/**
|
|
94
96
|
* Enables crash reporting for native platforms (iOS, Android). Default `false`.
|
|
95
97
|
*/
|
|
@@ -237,7 +239,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
237
239
|
[k: string]: any;
|
|
238
240
|
};
|
|
239
241
|
customEndpoints: CustomEndpoints;
|
|
240
|
-
constructor(clientToken: string, env: string, applicationId: string, trackInteractions?: boolean, trackResources?: boolean, trackErrors?: boolean, trackingConsent?: TrackingConsent);
|
|
242
|
+
constructor(clientToken: string, env: string, applicationId: string, trackInteractions?: boolean, trackResources?: boolean, trackErrors?: boolean, trackingConsent?: TrackingConsent, useAccessibilityLabel?: boolean);
|
|
241
243
|
}
|
|
242
244
|
/**
|
|
243
245
|
* Auto Instrumentation configuration passed to DatadogProvider.
|
|
@@ -253,6 +255,7 @@ export type AutoInstrumentationConfiguration = {
|
|
|
253
255
|
readonly errorEventMapper?: ErrorEventMapper | null;
|
|
254
256
|
readonly resourceEventMapper?: ResourceEventMapper | null;
|
|
255
257
|
readonly actionEventMapper?: ActionEventMapper | null;
|
|
258
|
+
readonly useAccessibilityLabel?: boolean;
|
|
256
259
|
readonly actionNameAttribute?: string;
|
|
257
260
|
};
|
|
258
261
|
/**
|
|
@@ -268,6 +271,7 @@ export type AutoInstrumentationParameters = {
|
|
|
268
271
|
readonly errorEventMapper: ErrorEventMapper | null;
|
|
269
272
|
readonly resourceEventMapper: ResourceEventMapper | null;
|
|
270
273
|
readonly actionEventMapper: ActionEventMapper | null;
|
|
274
|
+
readonly useAccessibilityLabel: boolean;
|
|
271
275
|
readonly actionNameAttribute?: string;
|
|
272
276
|
};
|
|
273
277
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import './polyfills';
|
|
1
2
|
import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode, VitalsUpdateFrequency, UploadFrequency, BatchSize } from './DdSdkReactNativeConfiguration';
|
|
2
3
|
import { DdSdkReactNative } from './DdSdkReactNative';
|
|
3
4
|
import { InternalLog } from './InternalLog';
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type EventsInterceptor from './EventsInterceptor';
|
|
2
2
|
export declare const UNKNOWN_TARGET_NAME = "unknown_target";
|
|
3
|
+
export type DdEventsInterceptorOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Specifies a custom prop to name RUM actions on elements having an `onPress` prop
|
|
6
|
+
* */
|
|
7
|
+
actionNameAttribute?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Determines whether the accessibility label can be used to resolve the action name.
|
|
10
|
+
* */
|
|
11
|
+
useAccessibilityLabel?: boolean;
|
|
12
|
+
};
|
|
3
13
|
export declare class DdEventsInterceptor implements EventsInterceptor {
|
|
4
14
|
static ACTION_EVENT_DROPPED_DEBUG_MESSAGE: string;
|
|
5
15
|
private debouncingStartedTimestamp;
|
|
6
16
|
private actionNameAttribute?;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
17
|
+
private useAccessibilityLabel;
|
|
18
|
+
constructor(options?: DdEventsInterceptorOptions);
|
|
10
19
|
interceptOnPress(...args: any[]): void;
|
|
11
20
|
private handleTargetEvent;
|
|
12
21
|
private resolveTargetName;
|
package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DdEventsInterceptorOptions } from './DdEventsInterceptor';
|
|
1
2
|
/**
|
|
2
3
|
* Provides RUM auto-instrumentation feature to track user interaction as RUM events.
|
|
3
4
|
* For now we are only covering the "onPress" events.
|
|
@@ -14,8 +15,6 @@ export declare class DdRumUserInteractionTracking {
|
|
|
14
15
|
* Please note that we are only considering as valid - for - tracking only the user interactions that have
|
|
15
16
|
* a visible output (either an UI state change or a Resource request)
|
|
16
17
|
*/
|
|
17
|
-
static startTracking(
|
|
18
|
-
actionNameAttribute?: string;
|
|
19
|
-
}): void;
|
|
18
|
+
static startTracking(options: DdEventsInterceptorOptions): void;
|
|
20
19
|
static stopTracking(): void;
|
|
21
20
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available formats for representing the {@link TracingIdentifier} as a string.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum TracingIdFormat {
|
|
5
|
+
/**
|
|
6
|
+
* Decimal string representation of the full tracing id.
|
|
7
|
+
*/
|
|
8
|
+
decimal = 0,
|
|
9
|
+
/**
|
|
10
|
+
* The low bits of the tracing id as a decimal.
|
|
11
|
+
*/
|
|
12
|
+
lowDecimal = 1,
|
|
13
|
+
/**
|
|
14
|
+
* The high bits of the tracing id as a decimal.
|
|
15
|
+
*/
|
|
16
|
+
highDecimal = 2,
|
|
17
|
+
/**
|
|
18
|
+
* Hexadecimal string representation of the full tracing id.
|
|
19
|
+
*/
|
|
20
|
+
hex = 3,
|
|
21
|
+
/**
|
|
22
|
+
* Hexadecimal string representation of the low bits of the tracing id.
|
|
23
|
+
*/
|
|
24
|
+
lowHex = 4,
|
|
25
|
+
/**
|
|
26
|
+
* Hexadecimal string representation of the high bits of the tracing id.
|
|
27
|
+
*/
|
|
28
|
+
highHex = 5,
|
|
29
|
+
/**
|
|
30
|
+
* Padded hexadecimal string representation of the full tracing id.
|
|
31
|
+
*/
|
|
32
|
+
paddedHex = 6,
|
|
33
|
+
/**
|
|
34
|
+
* Padded hexadecimal string representation of the low bits of the tracing id.
|
|
35
|
+
*/
|
|
36
|
+
paddedLowHex = 7,
|
|
37
|
+
/**
|
|
38
|
+
* Padded hexadecimal string representation of the high bits of the tracing id.
|
|
39
|
+
*/
|
|
40
|
+
paddedHighHex = 8
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A {@link TracingIdentifier} used for Traces (128 bit).
|
|
44
|
+
*/
|
|
45
|
+
export type TraceId = TracingIdentifier & {
|
|
46
|
+
_brand: 'traceId';
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* A {@link TracingIdentifier} used for Spans (64 bit).
|
|
50
|
+
*/
|
|
51
|
+
export type SpanId = TracingIdentifier & {
|
|
52
|
+
_brand: 'spanId';
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The tracing identifier type.
|
|
56
|
+
*/
|
|
57
|
+
export declare enum TracingIdType {
|
|
58
|
+
/**
|
|
59
|
+
* 128-bit UUID.
|
|
60
|
+
*/
|
|
61
|
+
trace = 0,
|
|
62
|
+
/**
|
|
63
|
+
* 64-bit UUID.
|
|
64
|
+
*/
|
|
65
|
+
span = 1
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A {@link TracingIdentifier} is a unique UUID that can be 64bit or 128bit, and provides
|
|
69
|
+
* convenient methods to represent it as a HEX or DECIMAL string, and it allows the masking
|
|
70
|
+
* of its low or high bits.
|
|
71
|
+
*
|
|
72
|
+
* Create a new identifier by calling {@link TracingIdentifier.createTraceId()} or
|
|
73
|
+
* {@link TracingIdentifier.createSpanId()}.
|
|
74
|
+
*/
|
|
75
|
+
export declare class TracingIdentifier {
|
|
76
|
+
/**
|
|
77
|
+
* Read-only generated ID as a {@link bigint}.
|
|
78
|
+
*/
|
|
79
|
+
readonly id: bigint;
|
|
80
|
+
/**
|
|
81
|
+
* Read-only type to determine whether the identifier is a {@link TraceId} or a {@link SpanId}.
|
|
82
|
+
*/
|
|
83
|
+
readonly type: TracingIdType;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new unique Trace ID.
|
|
86
|
+
* @returns the generated {@link TraceId}.
|
|
87
|
+
*/
|
|
88
|
+
static createTraceId(): TraceId;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new unique Span ID.
|
|
91
|
+
* @returns the generated {@link SpanId}.
|
|
92
|
+
*/
|
|
93
|
+
static createSpanId(): SpanId;
|
|
94
|
+
/**
|
|
95
|
+
* Private constructor to initialize the {@link TracingIdentifier} based on the given
|
|
96
|
+
* {@link TracingIdType}.
|
|
97
|
+
*/
|
|
98
|
+
private constructor();
|
|
99
|
+
/**
|
|
100
|
+
* Generates a unique ID with the given format.
|
|
101
|
+
* @param format - the desired format (64bit or 128bit).
|
|
102
|
+
* @returns the generated UUID as a {@link bigint}.
|
|
103
|
+
*/
|
|
104
|
+
private generateUUID;
|
|
105
|
+
/**
|
|
106
|
+
* Returns a string representation of the Tracing ID.
|
|
107
|
+
* @param format - The type of representation to use.
|
|
108
|
+
* @returns The ID as a string in the specified representation type.
|
|
109
|
+
*/
|
|
110
|
+
toString(format: TracingIdFormat): string;
|
|
111
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PropagatorType } from '../../../types';
|
|
2
2
|
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
|
+
import type { SpanId, TraceId } from './TracingIdentifier';
|
|
3
4
|
import type { Hostname } from './firstPartyHosts';
|
|
4
5
|
export type DdRumResourceTracingAttributes = {
|
|
5
6
|
tracingStrategy: 'KEEP';
|
|
@@ -19,27 +20,3 @@ export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegexMap,
|
|
|
19
20
|
firstPartyHostsRegexMap: RegexMap;
|
|
20
21
|
tracingSamplingRate: number;
|
|
21
22
|
}) => DdRumResourceTracingAttributes;
|
|
22
|
-
/**
|
|
23
|
-
* Using branded types will ensure we don't accidentally use
|
|
24
|
-
* traceId for spanId when generating headers.
|
|
25
|
-
*/
|
|
26
|
-
export type TraceId = TraceIdentifier & {
|
|
27
|
-
_brand: 'traceId';
|
|
28
|
-
};
|
|
29
|
-
export type SpanId = TraceIdentifier & {
|
|
30
|
-
_brand: 'spanId';
|
|
31
|
-
};
|
|
32
|
-
export declare class TraceIdentifier {
|
|
33
|
-
private low;
|
|
34
|
-
private high;
|
|
35
|
-
constructor();
|
|
36
|
-
toString: (radix: number) => string;
|
|
37
|
-
/**
|
|
38
|
-
* This function pads the trace with `0`.
|
|
39
|
-
* It should not be used with a `length` lower than the trace, as we return the full trace in this case.
|
|
40
|
-
* @param radix radix for the trace
|
|
41
|
-
* @param length minimum length
|
|
42
|
-
* @returns padded string
|
|
43
|
-
*/
|
|
44
|
-
toPaddedString: (radix: number, length: number) => string;
|
|
45
|
-
}
|
|
@@ -7,6 +7,8 @@ export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
|
|
|
7
7
|
export declare const ORIGIN_RUM = "rum";
|
|
8
8
|
export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
|
|
9
9
|
export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
|
|
10
|
+
export declare const TAGS_HEADER_KEY = "x-datadog-tags";
|
|
11
|
+
export declare const DD_TRACE_ID_TAG = "_dd.p.tid";
|
|
10
12
|
/**
|
|
11
13
|
* OTel headers
|
|
12
14
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A singleton container for attributes that are shared internally across all
|
|
3
|
+
* the SDK classes.
|
|
4
|
+
*/
|
|
5
|
+
export declare class GlobalState {
|
|
6
|
+
/**
|
|
7
|
+
* `true` if the SDK is initialized, `false` otherwise.
|
|
8
|
+
*/
|
|
9
|
+
isInitialized: boolean;
|
|
10
|
+
private static _instance;
|
|
11
|
+
static get instance(): GlobalState;
|
|
12
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.4.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "A client-side React Native module to interact with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"javaPackageName": "com.datadog.reactnative"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "f527de2facb85c3e5bdfcc7e46e2931c1f9e8039"
|
|
101
101
|
}
|
package/src/DdSdkReactNative.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import type { Attributes } from './sdk/AttributesSingleton/types';
|
|
|
33
33
|
import { BufferSingleton } from './sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
34
34
|
import { DdSdk } from './sdk/DdSdk';
|
|
35
35
|
import { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';
|
|
36
|
+
import { GlobalState } from './sdk/GlobalState/GlobalState';
|
|
36
37
|
import { UserInfoSingleton } from './sdk/UserInfoSingleton/UserInfoSingleton';
|
|
37
38
|
import type { UserInfo } from './sdk/UserInfoSingleton/types';
|
|
38
39
|
import { DdSdkConfiguration } from './types';
|
|
@@ -47,9 +48,9 @@ export class DdSdkReactNative {
|
|
|
47
48
|
private static readonly DD_SDK_VERSION = '_dd.sdk_version';
|
|
48
49
|
private static readonly DD_VERSION = '_dd.version';
|
|
49
50
|
private static readonly DD_VERSION_SUFFIX = '_dd.version_suffix';
|
|
51
|
+
|
|
50
52
|
private static wasAutoInstrumented = false;
|
|
51
53
|
private static features?: AutoInstrumentationConfiguration;
|
|
52
|
-
private static _isInitialized = false;
|
|
53
54
|
|
|
54
55
|
/**
|
|
55
56
|
* Initializes the Datadog SDK.
|
|
@@ -71,7 +72,7 @@ export class DdSdkReactNative {
|
|
|
71
72
|
initializationModeForTelemetry: InitializationModeForTelemetry;
|
|
72
73
|
}
|
|
73
74
|
): Promise<void> => {
|
|
74
|
-
if (
|
|
75
|
+
if (GlobalState.instance.isInitialized) {
|
|
75
76
|
InternalLog.log(
|
|
76
77
|
"Can't initialize Datadog, SDK was already initialized",
|
|
77
78
|
SdkVerbosity.WARN
|
|
@@ -90,7 +91,7 @@ export class DdSdkReactNative {
|
|
|
90
91
|
DdSdkReactNative.buildConfiguration(configuration, params)
|
|
91
92
|
);
|
|
92
93
|
InternalLog.log('Datadog SDK was initialized', SdkVerbosity.INFO);
|
|
93
|
-
|
|
94
|
+
GlobalState.instance.isInitialized = true;
|
|
94
95
|
BufferSingleton.onInitialization();
|
|
95
96
|
};
|
|
96
97
|
|
|
@@ -211,13 +212,6 @@ export class DdSdkReactNative {
|
|
|
211
212
|
return DdSdk.clearAllData();
|
|
212
213
|
};
|
|
213
214
|
|
|
214
|
-
/**
|
|
215
|
-
* Returns `true` if the SDK was initialized, `false` otherwise.
|
|
216
|
-
*/
|
|
217
|
-
public static isInitialized() {
|
|
218
|
-
return DdSdkReactNative._isInitialized;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
215
|
private static buildConfiguration = (
|
|
222
216
|
configuration: DdSdkReactNativeConfiguration,
|
|
223
217
|
params: {
|
|
@@ -299,9 +293,11 @@ export class DdSdkReactNative {
|
|
|
299
293
|
);
|
|
300
294
|
return;
|
|
301
295
|
}
|
|
296
|
+
|
|
302
297
|
if (configuration.trackInteractions) {
|
|
303
298
|
DdRumUserInteractionTracking.startTracking({
|
|
304
|
-
actionNameAttribute: configuration.actionNameAttribute
|
|
299
|
+
actionNameAttribute: configuration.actionNameAttribute,
|
|
300
|
+
useAccessibilityLabel: configuration.useAccessibilityLabel
|
|
305
301
|
});
|
|
306
302
|
}
|
|
307
303
|
|
|
@@ -115,7 +115,8 @@ export const DEFAULTS = {
|
|
|
115
115
|
trackBackgroundEvents: false,
|
|
116
116
|
getCustomEndpoints: () => ({}),
|
|
117
117
|
bundleLogsWithRum: true,
|
|
118
|
-
bundleLogsWithTraces: true
|
|
118
|
+
bundleLogsWithTraces: true,
|
|
119
|
+
useAccessibilityLabel: true
|
|
119
120
|
};
|
|
120
121
|
|
|
121
122
|
/**
|
|
@@ -303,7 +304,8 @@ export class DdSdkReactNativeConfiguration {
|
|
|
303
304
|
readonly trackInteractions: boolean = false,
|
|
304
305
|
readonly trackResources: boolean = false,
|
|
305
306
|
readonly trackErrors: boolean = false,
|
|
306
|
-
readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent
|
|
307
|
+
readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent,
|
|
308
|
+
readonly useAccessibilityLabel: boolean = DEFAULTS.useAccessibilityLabel
|
|
307
309
|
) {}
|
|
308
310
|
}
|
|
309
311
|
|
|
@@ -321,6 +323,7 @@ export type AutoInstrumentationConfiguration = {
|
|
|
321
323
|
readonly errorEventMapper?: ErrorEventMapper | null;
|
|
322
324
|
readonly resourceEventMapper?: ResourceEventMapper | null;
|
|
323
325
|
readonly actionEventMapper?: ActionEventMapper | null;
|
|
326
|
+
readonly useAccessibilityLabel?: boolean;
|
|
324
327
|
readonly actionNameAttribute?: string;
|
|
325
328
|
};
|
|
326
329
|
|
|
@@ -337,6 +340,7 @@ export type AutoInstrumentationParameters = {
|
|
|
337
340
|
readonly errorEventMapper: ErrorEventMapper | null;
|
|
338
341
|
readonly resourceEventMapper: ResourceEventMapper | null;
|
|
339
342
|
readonly actionEventMapper: ActionEventMapper | null;
|
|
343
|
+
readonly useAccessibilityLabel: boolean;
|
|
340
344
|
readonly actionNameAttribute?: string;
|
|
341
345
|
};
|
|
342
346
|
|
|
@@ -370,7 +374,8 @@ export const addDefaultValuesToAutoInstrumentationConfiguration = (
|
|
|
370
374
|
actionEventMapper:
|
|
371
375
|
features.actionEventMapper === undefined
|
|
372
376
|
? DEFAULTS.actionEventMapper
|
|
373
|
-
: features.actionEventMapper
|
|
377
|
+
: features.actionEventMapper,
|
|
378
|
+
useAccessibilityLabel: DEFAULTS.useAccessibilityLabel
|
|
374
379
|
};
|
|
375
380
|
};
|
|
376
381
|
|
|
@@ -434,7 +439,8 @@ export const buildConfigurationFromPartialConfiguration = (
|
|
|
434
439
|
features.trackInteractions,
|
|
435
440
|
features.trackResources,
|
|
436
441
|
features.trackErrors,
|
|
437
|
-
configuration.trackingConsent
|
|
442
|
+
configuration.trackingConsent,
|
|
443
|
+
features.useAccessibilityLabel
|
|
438
444
|
);
|
|
439
445
|
|
|
440
446
|
(Object.keys(
|
|
@@ -19,6 +19,7 @@ import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/D
|
|
|
19
19
|
import { ErrorSource, PropagatorType, RumActionType } from '../rum/types';
|
|
20
20
|
import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingleton';
|
|
21
21
|
import { DdSdk } from '../sdk/DdSdk';
|
|
22
|
+
import { GlobalState } from '../sdk/GlobalState/GlobalState';
|
|
22
23
|
import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
|
|
23
24
|
import type { DdSdkConfiguration } from '../types';
|
|
24
25
|
import { version as sdkVersion } from '../version';
|
|
@@ -56,7 +57,7 @@ jest.mock('../rum/instrumentation/DdRumErrorTracking', () => {
|
|
|
56
57
|
});
|
|
57
58
|
|
|
58
59
|
beforeEach(async () => {
|
|
59
|
-
|
|
60
|
+
GlobalState.instance.isInitialized = false;
|
|
60
61
|
DdSdkReactNative['wasAutoInstrumented'] = false;
|
|
61
62
|
NativeModules.DdSdk.initialize.mockClear();
|
|
62
63
|
NativeModules.DdSdk.setAttributes.mockClear();
|
|
@@ -151,7 +152,7 @@ describe('DdSdkReactNative', () => {
|
|
|
151
152
|
'_dd.sdk_version': sdkVersion
|
|
152
153
|
});
|
|
153
154
|
|
|
154
|
-
expect(
|
|
155
|
+
expect(GlobalState.instance.isInitialized).toBe(false);
|
|
155
156
|
expect(DdRumUserInteractionTracking.startTracking).toBeCalledTimes(
|
|
156
157
|
0
|
|
157
158
|
);
|
|
@@ -62,6 +62,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
62
62
|
"trackResources": false,
|
|
63
63
|
"trackingConsent": "granted",
|
|
64
64
|
"uploadFrequency": "AVERAGE",
|
|
65
|
+
"useAccessibilityLabel": true,
|
|
65
66
|
"verbosity": undefined,
|
|
66
67
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
67
68
|
}
|
|
@@ -81,7 +82,8 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
81
82
|
errorEventMapper: event => event,
|
|
82
83
|
resourceEventMapper: event => event,
|
|
83
84
|
actionEventMapper: event => event,
|
|
84
|
-
actionNameAttribute: 'testID'
|
|
85
|
+
actionNameAttribute: 'testID',
|
|
86
|
+
useAccessibilityLabel: true
|
|
85
87
|
},
|
|
86
88
|
{
|
|
87
89
|
applicationId: 'fake-app-id',
|
|
@@ -166,6 +168,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
166
168
|
"trackResources": true,
|
|
167
169
|
"trackingConsent": "pending",
|
|
168
170
|
"uploadFrequency": "FREQUENT",
|
|
171
|
+
"useAccessibilityLabel": true,
|
|
169
172
|
"verbosity": "debug",
|
|
170
173
|
"version": "1.4.5",
|
|
171
174
|
"versionSuffix": "codepush-3",
|
|
@@ -181,7 +184,8 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
181
184
|
trackErrors: false,
|
|
182
185
|
trackInteractions: false,
|
|
183
186
|
trackResources: false,
|
|
184
|
-
resourceTracingSamplingRate: 0
|
|
187
|
+
resourceTracingSamplingRate: 0,
|
|
188
|
+
useAccessibilityLabel: false
|
|
185
189
|
},
|
|
186
190
|
{
|
|
187
191
|
applicationId: '',
|
|
@@ -238,6 +242,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
238
242
|
"trackResources": false,
|
|
239
243
|
"trackingConsent": "granted",
|
|
240
244
|
"uploadFrequency": "AVERAGE",
|
|
245
|
+
"useAccessibilityLabel": false,
|
|
241
246
|
"verbosity": undefined,
|
|
242
247
|
"version": "",
|
|
243
248
|
"versionSuffix": "",
|
|
@@ -77,6 +77,38 @@ it('M intercept and send a RUM event W onPress { Button component }', async () =
|
|
|
77
77
|
);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
|
+
it('M intercept and send a RUM event with elementType W onPress { Button component, useAccessibilityLabel = false }', async () => {
|
|
81
|
+
// GIVEN
|
|
82
|
+
DdRumUserInteractionTracking.startTracking({
|
|
83
|
+
useAccessibilityLabel: false
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const { getByText } = render(
|
|
87
|
+
<View>
|
|
88
|
+
<Button title="Click me" onPress={event => {}} />
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
const testButton = getByText('Click me');
|
|
92
|
+
|
|
93
|
+
// WHEN
|
|
94
|
+
fireEvent(testButton, 'press', {
|
|
95
|
+
_targetInst: {
|
|
96
|
+
elementType: 'test_element_type',
|
|
97
|
+
memoizedProps: {
|
|
98
|
+
accessibilityLabel: 'click_me_button'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// THEN
|
|
104
|
+
expect(DdRum.addAction).toBeCalledWith(
|
|
105
|
+
'TAP',
|
|
106
|
+
'test_element_type',
|
|
107
|
+
expect.anything(),
|
|
108
|
+
expect.anything()
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
80
112
|
it('M intercept and send a RUM event W onPress { custom action name prop used }', async () => {
|
|
81
113
|
// GIVEN
|
|
82
114
|
DdRumUserInteractionTracking.startTracking({
|
package/src/index.tsx
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
|
+
/* eslint-disable arca/import-ordering */
|
|
6
7
|
|
|
8
|
+
import './polyfills';
|
|
7
9
|
import {
|
|
8
10
|
DatadogProviderConfiguration,
|
|
9
11
|
DdSdkReactNativeConfiguration,
|
|
@@ -32,6 +34,8 @@ import { DefaultTimeProvider } from './utils/time-provider/DefaultTimeProvider';
|
|
|
32
34
|
import { TimeProvider } from './utils/time-provider/TimeProvider';
|
|
33
35
|
import type { Timestamp } from './utils/time-provider/TimeProvider';
|
|
34
36
|
|
|
37
|
+
/* eslint-enable arca/import-ordering */
|
|
38
|
+
|
|
35
39
|
export {
|
|
36
40
|
DatadogProvider,
|
|
37
41
|
DatadogProviderConfiguration,
|