@datadog/mobile-react-native-code-push 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts +16 -3
  2. package/lib/typescript/core/src/index.d.ts +3 -3
  3. package/lib/typescript/core/src/nativeModulesTypes.d.ts +5 -0
  4. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +2 -1
  5. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +45 -0
  6. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +21 -0
  7. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +8 -0
  8. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.d.ts +1 -1
  9. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -1
  10. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.d.ts +1 -1
  11. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.d.ts +2 -7
  12. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +6 -1
  13. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
  14. package/lib/typescript/core/src/rum/types.d.ts +17 -0
  15. package/lib/typescript/core/src/types.d.ts +2 -1
  16. package/lib/typescript/core/src/version.d.ts +1 -1
  17. package/package.json +3 -3
  18. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +0 -19
  19. package/lib/typescript/core/src/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +0 -6
  20. /package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.d.ts +0 -0
  21. /package/lib/typescript/core/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.d.ts +0 -0
@@ -5,12 +5,20 @@ import type { LogEventMapper } from './logs/types';
5
5
  import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';
6
6
  import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';
7
7
  import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';
8
+ import type { FirstPartyHost } from './rum/types';
8
9
  export declare enum VitalsUpdateFrequency {
9
10
  FREQUENT = "FREQUENT",
10
11
  AVERAGE = "AVERAGE",
11
12
  RARE = "RARE",
12
13
  NEVER = "NEVER"
13
14
  }
15
+ export declare type FirstPartyHostsConfiguration = (FirstPartyHost | LegacyFirstPartyHost)[];
16
+ export declare type LegacyFirstPartyHost = string;
17
+ /**
18
+ * Defaults legacy first party hosts format to Datadog first party hosts to keep
19
+ * retro-compatibility before OTel support was introduced.
20
+ */
21
+ export declare const formatFirstPartyHosts: (firstPartyHosts: FirstPartyHostsConfiguration) => FirstPartyHost[];
14
22
  /**
15
23
  * The SDK configuration class.
16
24
  * It will be used to configure the SDK functionality at initialization.
@@ -63,7 +71,7 @@ export declare class DdSdkReactNativeConfiguration {
63
71
  *
64
72
  * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
65
73
  */
66
- firstPartyHosts: string[];
74
+ firstPartyHosts: FirstPartyHostsConfiguration;
67
75
  /**
68
76
  * Overrides the reported version of the app.
69
77
  * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
@@ -118,6 +126,10 @@ export declare class DdSdkReactNativeConfiguration {
118
126
  * Sets the preferred frequency for collecting mobile vitals.
119
127
  */
120
128
  vitalsUpdateFrequency: VitalsUpdateFrequency;
129
+ /**
130
+ * Enables tracking of frustration signals (error taps). Defaults to `true`.
131
+ */
132
+ trackFrustrations: boolean;
121
133
  logEventMapper: LogEventMapper | null;
122
134
  errorEventMapper: ErrorEventMapper | null;
123
135
  resourceEventMapper: ResourceEventMapper | null;
@@ -134,7 +146,7 @@ export declare class DdSdkReactNativeConfiguration {
134
146
  export declare type AutoInstrumentationConfiguration = {
135
147
  readonly trackInteractions: boolean;
136
148
  readonly trackResources: boolean;
137
- readonly firstPartyHosts?: string[];
149
+ readonly firstPartyHosts?: FirstPartyHostsConfiguration;
138
150
  readonly resourceTracingSamplingRate?: number;
139
151
  readonly trackErrors: boolean;
140
152
  readonly logEventMapper?: LogEventMapper | null;
@@ -148,7 +160,7 @@ export declare type AutoInstrumentationConfiguration = {
148
160
  export declare type AutoInstrumentationParameters = {
149
161
  readonly trackInteractions: boolean;
150
162
  readonly trackResources: boolean;
151
- readonly firstPartyHosts: string[];
163
+ readonly firstPartyHosts: FirstPartyHostsConfiguration;
152
164
  readonly resourceTracingSamplingRate: number;
153
165
  readonly trackErrors: boolean;
154
166
  readonly logEventMapper: LogEventMapper | null;
@@ -183,6 +195,7 @@ export declare type PartialInitializationConfiguration = {
183
195
  readonly nativeCrashReportEnabled?: boolean;
184
196
  readonly telemetrySampleRate?: number;
185
197
  readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
198
+ readonly trackFrustrations?: boolean;
186
199
  };
187
200
  export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
188
201
  export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
@@ -1,4 +1,4 @@
1
- import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode } from './DdSdkReactNativeConfiguration';
1
+ import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode, VitalsUpdateFrequency } from './DdSdkReactNativeConfiguration';
2
2
  import { DdSdkReactNative } from './DdSdkReactNative';
3
3
  import { InternalLog } from './InternalLog';
4
4
  import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
@@ -7,6 +7,6 @@ import { TrackingConsent } from './TrackingConsent';
7
7
  import { DdTrace } from './foundation';
8
8
  import { DdLogs } from './logs/DdLogs';
9
9
  import { DdRum } from './rum/DdRum';
10
- import { RumActionType, ErrorSource } from './rum/types';
10
+ import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
11
11
  import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
12
- export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };
12
+ export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType };
@@ -48,6 +48,11 @@ export declare type DdNativeSdkType = {
48
48
  * @param kind error kind
49
49
  */
50
50
  telemetryError(message: string, stack: string, kind: string): Promise<void>;
51
+ /**
52
+ * Send webview telemetry logs
53
+ * @param message event description
54
+ */
55
+ consumeWebviewEvent(message: string): Promise<void>;
51
56
  };
52
57
  /**
53
58
  * The entry point to use Datadog's Logs feature.
@@ -1,3 +1,4 @@
1
+ import type { FirstPartyHost } from '../../types';
1
2
  /**
2
3
  * Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
3
4
  */
@@ -9,7 +10,7 @@ export declare class DdRumResourceTracking {
9
10
  */
10
11
  static startTracking({ tracingSamplingRate, firstPartyHosts }: {
11
12
  tracingSamplingRate: number;
12
- firstPartyHosts: string[];
13
+ firstPartyHosts: FirstPartyHost[];
13
14
  }): void;
14
15
  static stopTracking(): void;
15
16
  }
@@ -0,0 +1,45 @@
1
+ import type { PropagatorType } from '../../../types';
2
+ import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
3
+ import type { Hostname } from './firstPartyHosts';
4
+ export declare type DdRumResourceTracingAttributes = {
5
+ tracingStrategy: 'KEEP';
6
+ traceId: TraceId;
7
+ spanId: SpanId;
8
+ samplingPriorityHeader: '1' | '0';
9
+ rulePsr: number;
10
+ propagatorTypes: PropagatorType[];
11
+ } | {
12
+ tracingStrategy: 'DISCARD';
13
+ traceId?: void;
14
+ spanId?: void;
15
+ samplingPriorityHeader: '0';
16
+ };
17
+ export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegexMap, tracingSamplingRate }: {
18
+ hostname: Hostname | null;
19
+ firstPartyHostsRegexMap: RegexMap;
20
+ tracingSamplingRate: number;
21
+ }) => DdRumResourceTracingAttributes;
22
+ /**
23
+ * Using branded types will ensure we don't accidentally use
24
+ * traceId for spanId when generating headers.
25
+ */
26
+ export declare type TraceId = TraceIdentifier & {
27
+ _brand: 'traceId';
28
+ };
29
+ export declare 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
+ }
@@ -0,0 +1,21 @@
1
+ import type { DdRumResourceTracingAttributes } from './distributedTracing';
2
+ export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
3
+ /**
4
+ * Datadog headers
5
+ */
6
+ export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
7
+ export declare const ORIGIN_RUM = "rum";
8
+ export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
9
+ export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
10
+ /**
11
+ * OTel headers
12
+ */
13
+ export declare const TRACECONTEXT_HEADER_KEY = "traceparent";
14
+ export declare const B3_HEADER_KEY = "b3";
15
+ export declare const B3_MULTI_TRACE_ID_HEADER_KEY = "X-B3-TraceId";
16
+ export declare const B3_MULTI_SPAN_ID_HEADER_KEY = "X-B3-SpanId";
17
+ export declare const B3_MULTI_SAMPLED_HEADER_KEY = "X-B3-Sampled";
18
+ export declare const getTracingHeaders: (tracingAttributes: DdRumResourceTracingAttributes) => {
19
+ header: string;
20
+ value: string;
21
+ }[];
@@ -0,0 +1,8 @@
1
+ import type { FirstPartyHost, PropagatorType } from '../../../types';
2
+ import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
3
+ export declare type Hostname = {
4
+ _type: 'Hostname';
5
+ } & string;
6
+ export declare const NO_MATCH_REGEX: RegExp;
7
+ export declare const firstPartyHostsRegexMapBuilder: (firstPartyHosts: FirstPartyHost[]) => RegexMap;
8
+ export declare const getPropagatorsForHost: (hostname: Hostname, firstPartyHostsRegexMap: RegexMap) => PropagatorType[] | null;
@@ -1,4 +1,4 @@
1
- import type { RUMResource } from '../../domain/interfaces/RumResource';
1
+ import type { RUMResource } from '../../interfaces/RumResource';
2
2
  declare type ResourceMapper = (resource: RUMResource) => RUMResource | null;
3
3
  export declare class ResourceReporter {
4
4
  private mappers;
@@ -1,4 +1,4 @@
1
- import type { RUMResource } from '../../domain/interfaces/RumResource';
1
+ import type { RUMResource } from '../../interfaces/RumResource';
2
2
  /**
3
3
  * Filters RN symbolicate calls and Expo logs calls that happen only in dev.
4
4
  * @param resource RUMResource
@@ -1,4 +1,4 @@
1
- import type { Hostname } from '../domain/firstPartyHosts';
1
+ import type { Hostname } from '../../distributedTracing/firstPartyHosts';
2
2
  /**
3
3
  * Returns the host from an URL.
4
4
  * @returns the host (without the port) or null if could not cast the URL as host
@@ -1,11 +1,6 @@
1
- import type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';
2
- import { RequestProxy } from '../domain/interfaces/RequestProxy';
1
+ import type { RequestProxyOptions } from '../interfaces/RequestProxy';
2
+ import { RequestProxy } from '../interfaces/RequestProxy';
3
3
  import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
4
- export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
5
- export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
6
- export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
7
- export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
8
- export declare const ORIGIN_RUM = "rum";
9
4
  interface XHRProxyProviders {
10
5
  xhrType: typeof XMLHttpRequest;
11
6
  resourceReporter: ResourceReporter;
@@ -1,7 +1,12 @@
1
+ import type { PropagatorType } from '../../../../types';
1
2
  export interface RequestProxyOptions {
2
3
  tracingSamplingRate: number;
3
- firstPartyHostsRegex: RegExp;
4
+ firstPartyHostsRegexMap: RegexMap;
4
5
  }
6
+ export declare type RegexMap = {
7
+ regex: RegExp;
8
+ propagatorType: PropagatorType;
9
+ }[];
5
10
  export declare abstract class RequestProxy {
6
11
  abstract onTrackingStart: (context: RequestProxyOptions) => void;
7
12
  abstract onTrackingStop: () => void;
@@ -1,5 +1,5 @@
1
1
  import type { ResourceKind } from '../../../../types';
2
- import type { DdRumResourceTracingAttributes } from '../distributedTracing';
2
+ import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
3
3
  export interface RUMResource {
4
4
  key: string;
5
5
  request: {
@@ -108,3 +108,20 @@ export declare enum ErrorSource {
108
108
  WEBVIEW = "WEBVIEW",
109
109
  CUSTOM = "CUSTOM"
110
110
  }
111
+ /**
112
+ * Type of instrumentation on the host.
113
+ * - DATADOG: Datadog’s propagator (`x-datadog-*`)
114
+ * - TRACECONTEXT: W3C Trace Context (`traceparent`)
115
+ * - B3: B3 single header (`b3`)
116
+ * - B3MULTI: B3 multiple headers (`X-B3-*`)
117
+ */
118
+ export declare enum PropagatorType {
119
+ DATADOG = "datadog",
120
+ TRACECONTEXT = "tracecontext",
121
+ B3 = "b3",
122
+ B3MULTI = "b3multi"
123
+ }
124
+ export declare type FirstPartyHost = {
125
+ match: string;
126
+ propagatorTypes: PropagatorType[];
127
+ };
@@ -14,13 +14,14 @@ export declare class DdSdkConfiguration {
14
14
  readonly additionalConfig: object;
15
15
  readonly telemetrySampleRate: number;
16
16
  readonly vitalsUpdateFrequency: string;
17
+ readonly trackFrustrations: boolean;
17
18
  readonly configurationForTelemetry: {
18
19
  initializationType: string;
19
20
  trackErrors: boolean;
20
21
  trackInteractions: boolean;
21
22
  trackNetworkRequests: boolean;
22
23
  };
23
- constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, configurationForTelemetry: {
24
+ constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, trackFrustrations: boolean, configurationForTelemetry: {
24
25
  initializationType: string;
25
26
  trackErrors: boolean;
26
27
  trackInteractions: boolean;
@@ -1 +1 @@
1
- export declare const version = "1.3.1";
1
+ export declare const version = "1.5.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native-code-push",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "description": "A client-side React Native module to interact with Appcenter Codepush and Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -38,7 +38,7 @@
38
38
  "prepare": "rm -rf lib && yarn bob build"
39
39
  },
40
40
  "devDependencies": {
41
- "@datadog/mobile-react-native": "^1.3.1",
41
+ "@datadog/mobile-react-native": "^1.5.0",
42
42
  "@testing-library/react-native": "7.0.2",
43
43
  "react-native-code-push": "7.0.5"
44
44
  },
@@ -72,5 +72,5 @@
72
72
  ]
73
73
  ]
74
74
  },
75
- "gitHead": "c70d62caff28da6111c8e526de4dfbb82bb9bf2d"
75
+ "gitHead": "04d48f34c3fe6f2d793cf4157eff5314253afd87"
76
76
  }
@@ -1,19 +0,0 @@
1
- import type { Hostname } from './firstPartyHosts';
2
- export declare type DdRumResourceTracingAttributes = {
3
- tracingStrategy: 'KEEP';
4
- traceId: string;
5
- spanId: string;
6
- samplingPriorityHeader: '1';
7
- rulePsr: number;
8
- } | {
9
- tracingStrategy: 'DISCARD';
10
- traceId?: void;
11
- spanId?: void;
12
- samplingPriorityHeader: '0';
13
- };
14
- export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegex, tracingSamplingRate }: {
15
- hostname: Hostname | null;
16
- firstPartyHostsRegex: RegExp;
17
- tracingSamplingRate: number;
18
- }) => DdRumResourceTracingAttributes;
19
- export declare function generateTraceId(): string;
@@ -1,6 +0,0 @@
1
- export declare type Hostname = {
2
- _type: 'Hostname';
3
- } & string;
4
- export declare const NO_MATCH_REGEX: RegExp;
5
- export declare const firstPartyHostsRegexBuilder: (firstPartyHosts: string[]) => RegExp;
6
- export declare const isHostFirstParty: (hostname: Hostname, firstPartyHostsRegex: RegExp) => boolean;