@datadog/mobile-react-native-code-push 2.14.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +18 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +19 -12
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/codepush/src/index.d.ts +2 -2
- package/lib/typescript/codepush/src/index.d.ts.map +1 -1
- package/lib/typescript/core/src/DdAttributes.d.ts.map +1 -0
- package/lib/typescript/core/src/DdSdkReactNative.d.ts +49 -12
- package/lib/typescript/core/src/DdSdkReactNative.d.ts.map +1 -1
- package/lib/typescript/core/src/InternalLog.d.ts +1 -1
- package/lib/typescript/core/src/InternalLog.d.ts.map +1 -1
- package/lib/typescript/core/src/config/DatadogProviderConfiguration.d.ts +12 -0
- package/lib/typescript/core/src/config/DatadogProviderConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/FileBasedConfiguration.d.ts +17 -0
- package/lib/typescript/core/src/config/FileBasedConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/FileBasedConfiguration.type.d.ts +52 -0
- package/lib/typescript/core/src/config/FileBasedConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/core/src/config/async/AutoInstrumentationConfiguration.d.ts +60 -0
- package/lib/typescript/core/src/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/async/PartialInitializationConfiguration.d.ts +47 -0
- package/lib/typescript/core/src/config/async/PartialInitializationConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/async/asyncInitializationHelper.d.ts +5 -0
- package/lib/typescript/core/src/config/async/asyncInitializationHelper.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/CoreConfiguration.d.ts +52 -0
- package/lib/typescript/core/src/config/features/CoreConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/CoreConfiguration.type.d.ts +90 -0
- package/lib/typescript/core/src/config/features/CoreConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/CoreConfigurationNative.d.ts +54 -0
- package/lib/typescript/core/src/config/features/CoreConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/LogsConfiguration.d.ts +17 -0
- package/lib/typescript/core/src/config/features/LogsConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/LogsConfiguration.type.d.ts +24 -0
- package/lib/typescript/core/src/config/features/LogsConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/LogsConfigurationNative.d.ts +6 -0
- package/lib/typescript/core/src/config/features/LogsConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/RumConfiguration.d.ts +66 -0
- package/lib/typescript/core/src/config/features/RumConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/RumConfiguration.type.d.ts +131 -0
- package/lib/typescript/core/src/config/features/RumConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/RumConfigurationNative.d.ts +25 -0
- package/lib/typescript/core/src/config/features/RumConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/TraceConfiguration.d.ts +10 -0
- package/lib/typescript/core/src/config/features/TraceConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/TraceConfiguration.type.d.ts +11 -0
- package/lib/typescript/core/src/config/features/TraceConfiguration.type.d.ts.map +1 -0
- package/lib/typescript/core/src/config/features/TraceConfigurationNative.d.ts +4 -0
- package/lib/typescript/core/src/config/features/TraceConfigurationNative.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/BatchProcessingLevel.d.ts +18 -0
- package/lib/typescript/core/src/config/types/BatchProcessingLevel.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/BatchSize.d.ts +19 -0
- package/lib/typescript/core/src/config/types/BatchSize.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/InitializationMode.d.ts +5 -0
- package/lib/typescript/core/src/config/types/InitializationMode.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/InitializationModeForTelemetry.d.ts +2 -0
- package/lib/typescript/core/src/config/types/InitializationModeForTelemetry.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/ProxyConfiguration.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/SdkVerbosity.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/TrackingConsent.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/UploadFrequency.d.ts +18 -0
- package/lib/typescript/core/src/config/types/UploadFrequency.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/VitalsUpdateFrequency.d.ts +7 -0
- package/lib/typescript/core/src/config/types/VitalsUpdateFrequency.d.ts.map +1 -0
- package/lib/typescript/core/src/config/types/index.d.ts +10 -0
- package/lib/typescript/core/src/config/types/index.d.ts.map +1 -0
- package/lib/typescript/core/src/index.d.ts +20 -9
- package/lib/typescript/core/src/index.d.ts.map +1 -1
- package/lib/typescript/core/src/logs/DdLogs.d.ts +2 -1
- package/lib/typescript/core/src/logs/DdLogs.d.ts.map +1 -1
- package/lib/typescript/core/src/logs/eventMapper.d.ts +3 -2
- package/lib/typescript/core/src/logs/eventMapper.d.ts.map +1 -1
- package/lib/typescript/core/src/logs/types.d.ts +1 -16
- package/lib/typescript/core/src/logs/types.d.ts.map +1 -1
- package/lib/typescript/core/src/nativeModulesTypes.d.ts +2 -15
- package/lib/typescript/core/src/nativeModulesTypes.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/DdRum.d.ts +10 -1
- package/lib/typescript/core/src/rum/DdRum.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/eventMappers/errorEventMapper.d.ts +1 -1
- package/lib/typescript/core/src/rum/eventMappers/errorEventMapper.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/helper.d.ts +10 -0
- package/lib/typescript/core/src/rum/helper.d.ts.map +1 -0
- package/lib/typescript/core/src/rum/instrumentation/DdRumErrorTracking.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts +6 -6
- package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdBabelInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +7 -0
- package/lib/typescript/core/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +12 -6
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts +1 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/DatadogTracingContext.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +8 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +5 -17
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts +20 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingAttributes.d.ts.map +1 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +3 -24
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts +12 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingSampling.d.ts.map +1 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts +24 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/distributedTracing/headers.d.ts.map +1 -0
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +2 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/baggageHeaderUtils.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/core/src/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts.map +1 -1
- package/lib/typescript/core/src/rum/types.d.ts +47 -7
- package/lib/typescript/core/src/rum/types.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts +15 -0
- package/lib/typescript/core/src/sdk/AccountInfoSingleton/AccountInfoSingleton.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AccountInfoSingleton/types.d.ts +6 -0
- package/lib/typescript/core/src/sdk/AccountInfoSingleton/types.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/attributesEncoding.d.ts +13 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/attributesEncoding.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/defaultEncoders.d.ts +33 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/defaultEncoders.d.ts.map +1 -0
- package/lib/typescript/core/src/{utils → sdk/AttributesEncoding}/errorUtils.d.ts +4 -4
- package/lib/typescript/core/src/sdk/AttributesEncoding/errorUtils.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/helpers.d.ts +17 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/helpers.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/types.d.ts +21 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/types.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/utils.d.ts +7 -0
- package/lib/typescript/core/src/sdk/AttributesEncoding/utils.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/AttributesSingleton/AttributesSingleton.d.ts +5 -1
- package/lib/typescript/core/src/sdk/AttributesSingleton/AttributesSingleton.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProvider.d.ts +4 -3
- package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProvider.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProviderState.d.ts +9 -0
- package/lib/typescript/core/src/sdk/DatadogProvider/DatadogProviderState.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/DdSdk.d.ts +2 -3
- package/lib/typescript/core/src/sdk/DdSdk.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/DdSdkInternal.d.ts +39 -0
- package/lib/typescript/core/src/sdk/DdSdkInternal.d.ts.map +1 -0
- package/lib/typescript/core/src/sdk/EventMappers/EventMapper.d.ts +3 -1
- package/lib/typescript/core/src/sdk/EventMappers/EventMapper.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/GlobalState/GlobalState.d.ts +3 -3
- package/lib/typescript/core/src/sdk/GlobalState/GlobalState.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/UserInfoSingleton/UserInfoSingleton.d.ts +2 -1
- package/lib/typescript/core/src/sdk/UserInfoSingleton/UserInfoSingleton.d.ts.map +1 -1
- package/lib/typescript/core/src/sdk/UserInfoSingleton/types.d.ts +1 -2
- package/lib/typescript/core/src/sdk/UserInfoSingleton/types.d.ts.map +1 -1
- package/lib/typescript/core/src/specs/NativeDdRum.d.ts +45 -0
- package/lib/typescript/core/src/specs/NativeDdRum.d.ts.map +1 -1
- package/lib/typescript/core/src/specs/NativeDdSdk.d.ts +34 -6
- package/lib/typescript/core/src/specs/NativeDdSdk.d.ts.map +1 -1
- package/lib/typescript/core/src/trace/DdTrace.d.ts +1 -2
- package/lib/typescript/core/src/trace/DdTrace.d.ts.map +1 -1
- package/lib/typescript/core/src/types.d.ts +74 -92
- package/lib/typescript/core/src/types.d.ts.map +1 -1
- package/lib/typescript/core/src/utils/longTasksUtils.d.ts +1 -1
- package/lib/typescript/core/src/utils/longTasksUtils.d.ts.map +1 -1
- package/lib/typescript/core/src/utils/singletonUtils.d.ts +2 -0
- package/lib/typescript/core/src/utils/singletonUtils.d.ts.map +1 -0
- package/lib/typescript/core/src/version.d.ts +1 -1
- package/lib/typescript/core/src/version.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/index.test.tsx +106 -75
- package/src/index.ts +35 -17
- package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts +0 -376
- package/lib/typescript/core/src/DdSdkReactNativeConfiguration.d.ts.map +0 -1
- package/lib/typescript/core/src/ProxyConfiguration.d.ts.map +0 -1
- package/lib/typescript/core/src/SdkVerbosity.d.ts.map +0 -1
- package/lib/typescript/core/src/TrackingConsent.d.ts.map +0 -1
- package/lib/typescript/core/src/rum/DdAttributes.d.ts.map +0 -1
- package/lib/typescript/core/src/rum/sessionId/sessionIdHelper.d.ts +0 -4
- package/lib/typescript/core/src/rum/sessionId/sessionIdHelper.d.ts.map +0 -1
- package/lib/typescript/core/src/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +0 -34
- package/lib/typescript/core/src/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts.map +0 -1
- package/lib/typescript/core/src/utils/argsUtils.d.ts +0 -8
- package/lib/typescript/core/src/utils/argsUtils.d.ts.map +0 -1
- package/lib/typescript/core/src/utils/errorUtils.d.ts.map +0 -1
- /package/lib/typescript/core/src/{rum/DdAttributes.d.ts → DdAttributes.d.ts} +0 -0
- /package/lib/typescript/core/src/{ProxyConfiguration.d.ts → config/types/ProxyConfiguration.d.ts} +0 -0
- /package/lib/typescript/core/src/{SdkVerbosity.d.ts → config/types/SdkVerbosity.d.ts} +0 -0
- /package/lib/typescript/core/src/{TrackingConsent.d.ts → config/types/TrackingConsent.d.ts} +0 -0
|
@@ -20,7 +20,7 @@ jest.mock('@datadog/mobile-react-native', () => {
|
|
|
20
20
|
const flushPromises = () =>
|
|
21
21
|
new Promise(jest.requireActual('timers').setImmediate);
|
|
22
22
|
|
|
23
|
-
const createCodepushPackageMock = label => ({
|
|
23
|
+
const createCodepushPackageMock = (label: string | null) => ({
|
|
24
24
|
label,
|
|
25
25
|
isMandatory: false,
|
|
26
26
|
install: jest.fn(),
|
|
@@ -37,6 +37,18 @@ const createCodepushPackageMock = label => ({
|
|
|
37
37
|
describe('AppCenter Codepush integration', () => {
|
|
38
38
|
beforeEach(() => {
|
|
39
39
|
jest.clearAllMocks();
|
|
40
|
+
const _globalThis = (globalThis as unknown) as Record<
|
|
41
|
+
PropertyKey,
|
|
42
|
+
unknown
|
|
43
|
+
>;
|
|
44
|
+
const providerState = _globalThis[
|
|
45
|
+
Symbol.for('com.datadog.reactnative.rum.datadog_provider_state')
|
|
46
|
+
] as
|
|
47
|
+
| {
|
|
48
|
+
_reset: () => void;
|
|
49
|
+
}
|
|
50
|
+
| undefined;
|
|
51
|
+
providerState?._reset();
|
|
40
52
|
});
|
|
41
53
|
|
|
42
54
|
describe('initialize', () => {
|
|
@@ -44,7 +56,8 @@ describe('AppCenter Codepush integration', () => {
|
|
|
44
56
|
const codePush = require('react-native-code-push');
|
|
45
57
|
const { DatadogCodepush } = require('..');
|
|
46
58
|
const {
|
|
47
|
-
|
|
59
|
+
CoreConfiguration,
|
|
60
|
+
RumConfiguration,
|
|
48
61
|
DdSdkReactNative
|
|
49
62
|
} = require('@datadog/mobile-react-native');
|
|
50
63
|
|
|
@@ -52,9 +65,8 @@ describe('AppCenter Codepush integration', () => {
|
|
|
52
65
|
typeof codePush.getUpdateMetadata
|
|
53
66
|
>).mockResolvedValueOnce(createCodepushPackageMock('v3'));
|
|
54
67
|
|
|
55
|
-
const configuration = new
|
|
56
|
-
|
|
57
|
-
'env',
|
|
68
|
+
const configuration = new CoreConfiguration('token', 'env');
|
|
69
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
58
70
|
'appId',
|
|
59
71
|
true,
|
|
60
72
|
true,
|
|
@@ -73,7 +85,8 @@ describe('AppCenter Codepush integration', () => {
|
|
|
73
85
|
const codePush = require('react-native-code-push');
|
|
74
86
|
const { DatadogCodepush } = require('..');
|
|
75
87
|
const {
|
|
76
|
-
|
|
88
|
+
CoreConfiguration,
|
|
89
|
+
RumConfiguration,
|
|
77
90
|
DdSdkReactNative
|
|
78
91
|
} = require('@datadog/mobile-react-native');
|
|
79
92
|
|
|
@@ -81,9 +94,8 @@ describe('AppCenter Codepush integration', () => {
|
|
|
81
94
|
typeof codePush.getUpdateMetadata
|
|
82
95
|
>).mockResolvedValueOnce(null);
|
|
83
96
|
|
|
84
|
-
const configuration = new
|
|
85
|
-
|
|
86
|
-
'env',
|
|
97
|
+
const configuration = new CoreConfiguration('token', 'env');
|
|
98
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
87
99
|
'appId',
|
|
88
100
|
true,
|
|
89
101
|
true,
|
|
@@ -114,6 +126,7 @@ describe('AppCenter Codepush integration', () => {
|
|
|
114
126
|
const { DatadogCodepushProvider } = require('..');
|
|
115
127
|
const {
|
|
116
128
|
DatadogProviderConfiguration,
|
|
129
|
+
RumConfiguration,
|
|
117
130
|
DdSdkReactNative
|
|
118
131
|
} = require('@datadog/mobile-react-native');
|
|
119
132
|
|
|
@@ -123,10 +136,12 @@ describe('AppCenter Codepush integration', () => {
|
|
|
123
136
|
|
|
124
137
|
const configuration = new DatadogProviderConfiguration(
|
|
125
138
|
'token',
|
|
126
|
-
'env'
|
|
139
|
+
'env'
|
|
140
|
+
);
|
|
141
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
127
142
|
'appId',
|
|
128
143
|
true,
|
|
129
|
-
|
|
144
|
+
true,
|
|
130
145
|
true
|
|
131
146
|
);
|
|
132
147
|
render(<DatadogCodepushProvider configuration={configuration} />);
|
|
@@ -185,6 +200,7 @@ describe('AppCenter Codepush integration', () => {
|
|
|
185
200
|
const { DatadogCodepushProvider } = require('..');
|
|
186
201
|
const {
|
|
187
202
|
DatadogProviderConfiguration,
|
|
203
|
+
RumConfiguration,
|
|
188
204
|
DdSdkReactNative
|
|
189
205
|
} = require('@datadog/mobile-react-native');
|
|
190
206
|
|
|
@@ -194,7 +210,10 @@ describe('AppCenter Codepush integration', () => {
|
|
|
194
210
|
|
|
195
211
|
const configuration = new DatadogProviderConfiguration(
|
|
196
212
|
'token',
|
|
197
|
-
'env'
|
|
213
|
+
'env'
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
configuration.rumConfiguration = new RumConfiguration(
|
|
198
217
|
'appId',
|
|
199
218
|
true,
|
|
200
219
|
true,
|
|
@@ -237,9 +256,11 @@ describe('AppCenter Codepush integration', () => {
|
|
|
237
256
|
).not.toHaveBeenCalled();
|
|
238
257
|
|
|
239
258
|
DatadogCodepushProvider.initialize({
|
|
240
|
-
applicationId: 'fake-application-id',
|
|
241
259
|
clientToken: 'fake-client-token',
|
|
242
|
-
env: 'fake-env'
|
|
260
|
+
env: 'fake-env',
|
|
261
|
+
rumConfiguration: {
|
|
262
|
+
applicationId: 'fake-application-id'
|
|
263
|
+
}
|
|
243
264
|
});
|
|
244
265
|
await flushPromises();
|
|
245
266
|
|
|
@@ -264,22 +285,32 @@ describe('AppCenter Codepush integration', () => {
|
|
|
264
285
|
} = require('@datadog/mobile-react-native');
|
|
265
286
|
|
|
266
287
|
const autoInstrumentationConfig = {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
288
|
+
clientToken: 'fake-client-token',
|
|
289
|
+
env: 'fake-env',
|
|
290
|
+
rumConfiguration: {
|
|
291
|
+
applicationId: 'fake-app-id',
|
|
292
|
+
useAccessibilityLabel: true,
|
|
293
|
+
actionNameAttribute: 'test-action-name-attr',
|
|
294
|
+
trackErrors: true,
|
|
295
|
+
trackResources: true,
|
|
296
|
+
trackInteractions: true,
|
|
297
|
+
resourceTraceSampleRate: 100,
|
|
298
|
+
nativeCrashReportEnabled: true,
|
|
299
|
+
nativeLongTaskThresholdMs: false,
|
|
300
|
+
nativeViewTracking: true,
|
|
301
|
+
firstPartyHosts: [
|
|
302
|
+
{
|
|
303
|
+
match: 'example.com',
|
|
304
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
logsConfiguration: {},
|
|
309
|
+
traceConfiguration: {}
|
|
279
310
|
};
|
|
280
311
|
|
|
281
312
|
const configuration = new FileBasedConfiguration({
|
|
282
|
-
configuration:
|
|
313
|
+
configuration: autoInstrumentationConfig
|
|
283
314
|
});
|
|
284
315
|
|
|
285
316
|
render(<DatadogCodepushProvider configuration={configuration} />);
|
|
@@ -293,22 +324,29 @@ describe('AppCenter Codepush integration', () => {
|
|
|
293
324
|
expect(
|
|
294
325
|
DdSdkReactNative._enableFeaturesFromDatadogProvider
|
|
295
326
|
).toHaveBeenCalledWith({
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
327
|
+
rumConfiguration: {
|
|
328
|
+
useAccessibilityLabel: true,
|
|
329
|
+
actionNameAttribute: 'test-action-name-attr',
|
|
330
|
+
actionEventMapper: null,
|
|
331
|
+
nativeCrashReportEnabled: true,
|
|
332
|
+
nativeLongTaskThresholdMs: false,
|
|
333
|
+
nativeViewTracking: true,
|
|
334
|
+
resourceEventMapper: null,
|
|
335
|
+
errorEventMapper: null,
|
|
336
|
+
trackErrors: true,
|
|
337
|
+
trackResources: true,
|
|
338
|
+
trackInteractions: true,
|
|
339
|
+
resourceTraceSampleRate: 100,
|
|
340
|
+
firstPartyHosts: [
|
|
341
|
+
{
|
|
342
|
+
match: 'example.com',
|
|
343
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
logsConfiguration: {
|
|
348
|
+
logEventMapper: null
|
|
349
|
+
}
|
|
312
350
|
});
|
|
313
351
|
|
|
314
352
|
expect(
|
|
@@ -326,27 +364,19 @@ describe('AppCenter Codepush integration', () => {
|
|
|
326
364
|
const { DatadogCodepushProvider } = require('..');
|
|
327
365
|
const {
|
|
328
366
|
DdSdkReactNative,
|
|
329
|
-
PropagatorType,
|
|
330
367
|
FileBasedConfiguration
|
|
331
368
|
} = require('@datadog/mobile-react-native');
|
|
332
369
|
|
|
333
370
|
const autoInstrumentationConfig = {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
match: 'example.com',
|
|
340
|
-
propagatorTypes: [PropagatorType.DATADOG]
|
|
341
|
-
}
|
|
342
|
-
],
|
|
343
|
-
// useAccessibilityLabel: true,
|
|
344
|
-
// actionNameAttribute: 'test-action-name-attr',
|
|
345
|
-
resourceTracingSamplingRate: 100
|
|
371
|
+
clientToken: 'fake-client-token',
|
|
372
|
+
env: 'fake-env',
|
|
373
|
+
rumConfiguration: {
|
|
374
|
+
applicationId: 'fake-app-id'
|
|
375
|
+
}
|
|
346
376
|
};
|
|
347
377
|
|
|
348
378
|
const configuration = new FileBasedConfiguration({
|
|
349
|
-
configuration:
|
|
379
|
+
configuration: autoInstrumentationConfig
|
|
350
380
|
});
|
|
351
381
|
|
|
352
382
|
render(<DatadogCodepushProvider configuration={configuration} />);
|
|
@@ -359,24 +389,25 @@ describe('AppCenter Codepush integration', () => {
|
|
|
359
389
|
});
|
|
360
390
|
expect(
|
|
361
391
|
DdSdkReactNative._enableFeaturesFromDatadogProvider
|
|
362
|
-
).toHaveBeenCalledWith(
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
392
|
+
).toHaveBeenCalledWith(
|
|
393
|
+
expect.objectContaining({
|
|
394
|
+
rumConfiguration: expect.objectContaining({
|
|
395
|
+
useAccessibilityLabel: true,
|
|
396
|
+
actionNameAttribute: undefined,
|
|
397
|
+
trackErrors: false,
|
|
398
|
+
trackResources: false,
|
|
399
|
+
trackInteractions: false,
|
|
400
|
+
actionEventMapper: null,
|
|
401
|
+
resourceEventMapper: null,
|
|
402
|
+
errorEventMapper: null,
|
|
403
|
+
resourceTraceSampleRate: 100,
|
|
404
|
+
firstPartyHosts: []
|
|
405
|
+
}),
|
|
406
|
+
logsConfiguration: expect.objectContaining({
|
|
407
|
+
logEventMapper: null
|
|
408
|
+
})
|
|
409
|
+
})
|
|
410
|
+
);
|
|
380
411
|
|
|
381
412
|
expect(
|
|
382
413
|
DdSdkReactNative._enableFeaturesFromDatadogProvider
|
package/src/index.ts
CHANGED
|
@@ -10,20 +10,18 @@ import {
|
|
|
10
10
|
} from '@datadog/mobile-react-native';
|
|
11
11
|
import type {
|
|
12
12
|
AutoInstrumentationConfiguration,
|
|
13
|
-
|
|
13
|
+
CoreConfiguration
|
|
14
14
|
} from '@datadog/mobile-react-native';
|
|
15
15
|
import codePush from 'react-native-code-push';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { removeDiscardProperties } from './utils';
|
|
18
18
|
import type { RequiredOrDiscard } from './utils';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Use this class instead of DdSdkReactNative to initialize the Datadog SDK when using AppCenter CodePush.
|
|
22
22
|
*/
|
|
23
23
|
export const DatadogCodepush = {
|
|
24
|
-
async initialize(
|
|
25
|
-
configuration: DdSdkReactNativeConfiguration
|
|
26
|
-
): Promise<void> {
|
|
24
|
+
async initialize(configuration: CoreConfiguration): Promise<void> {
|
|
27
25
|
const codePushUpdateMetadata = await codePush.getUpdateMetadata();
|
|
28
26
|
if (codePushUpdateMetadata) {
|
|
29
27
|
configuration.versionSuffix = `codepush.${codePushUpdateMetadata.label}`;
|
|
@@ -46,18 +44,38 @@ const buildPartialConfiguration = (
|
|
|
46
44
|
configuration: DatadogProviderConfiguration
|
|
47
45
|
): AutoInstrumentationConfiguration => {
|
|
48
46
|
const partialConfiguration: RequiredOrDiscard<AutoInstrumentationConfiguration> = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
rumConfiguration: {
|
|
48
|
+
firstPartyHosts: configuration.rumConfiguration?.firstPartyHosts,
|
|
49
|
+
useAccessibilityLabel:
|
|
50
|
+
configuration.rumConfiguration?.useAccessibilityLabel ?? true,
|
|
51
|
+
actionNameAttribute:
|
|
52
|
+
configuration.rumConfiguration?.actionNameAttribute,
|
|
53
|
+
trackErrors: configuration.rumConfiguration?.trackErrors ?? false,
|
|
54
|
+
trackResources:
|
|
55
|
+
configuration.rumConfiguration?.trackResources ?? false,
|
|
56
|
+
trackInteractions:
|
|
57
|
+
configuration.rumConfiguration?.trackInteractions ?? false,
|
|
58
|
+
resourceTraceSampleRate:
|
|
59
|
+
configuration.rumConfiguration?.resourceTraceSampleRate ?? 100,
|
|
60
|
+
nativeCrashReportEnabled:
|
|
61
|
+
configuration.rumConfiguration?.nativeCrashReportEnabled ??
|
|
62
|
+
false,
|
|
63
|
+
nativeLongTaskThresholdMs:
|
|
64
|
+
configuration.rumConfiguration?.nativeLongTaskThresholdMs ??
|
|
65
|
+
200,
|
|
66
|
+
nativeViewTracking:
|
|
67
|
+
configuration.rumConfiguration?.nativeViewTracking ?? false,
|
|
68
|
+
errorEventMapper:
|
|
69
|
+
configuration.rumConfiguration?.errorEventMapper ?? null,
|
|
70
|
+
resourceEventMapper:
|
|
71
|
+
configuration.rumConfiguration?.resourceEventMapper ?? null,
|
|
72
|
+
actionEventMapper:
|
|
73
|
+
configuration.rumConfiguration?.actionEventMapper ?? null
|
|
74
|
+
},
|
|
75
|
+
logsConfiguration: {
|
|
76
|
+
logEventMapper:
|
|
77
|
+
configuration.logsConfiguration?.logEventMapper ?? null
|
|
78
|
+
}
|
|
61
79
|
};
|
|
62
80
|
|
|
63
81
|
return removeDiscardProperties(
|