@datadog/mobile-react-native 3.9.0 → 3.10.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/android/src/main/kotlin/com/datadog/reactnative/DdFlagsImplementation.kt +6 -3
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +16 -8
- package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +11 -6
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdFlagsImplementationTest.kt +19 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +131 -0
- package/datadog-configuration.schema.json +11 -0
- package/ios/Sources/DdSdkConfiguration.swift +13 -0
- package/ios/Sources/DdSdkImplementation.swift +4 -3
- package/ios/Sources/DdSdkNativeInitialization.swift +26 -8
- package/ios/Sources/JSRefreshRateListener.swift +6 -2
- package/ios/Sources/RNDdSdkConfiguration.swift +9 -0
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +1 -1
- package/lib/commonjs/config/FileBasedConfiguration.js +3 -1
- package/lib/commonjs/config/FileBasedConfiguration.js.map +1 -1
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js +3 -0
- package/lib/commonjs/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/commonjs/config/features/RumConfiguration.js +8 -0
- package/lib/commonjs/config/features/RumConfiguration.js.map +1 -1
- package/lib/commonjs/flags/FlagsClient.js +81 -8
- package/lib/commonjs/flags/FlagsClient.js.map +1 -1
- package/lib/commonjs/flags/configuration/precomputed.js +2 -3
- package/lib/commonjs/flags/configuration/precomputed.js.map +1 -1
- package/lib/commonjs/flags/internal.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +1 -1
- package/lib/module/config/FileBasedConfiguration.js +3 -1
- package/lib/module/config/FileBasedConfiguration.js.map +1 -1
- package/lib/module/config/async/AutoInstrumentationConfiguration.js +3 -0
- package/lib/module/config/async/AutoInstrumentationConfiguration.js.map +1 -1
- package/lib/module/config/features/RumConfiguration.js +8 -0
- package/lib/module/config/features/RumConfiguration.js.map +1 -1
- package/lib/module/flags/FlagsClient.js +81 -8
- package/lib/module/flags/FlagsClient.js.map +1 -1
- package/lib/module/flags/configuration/precomputed.js +2 -3
- package/lib/module/flags/configuration/precomputed.js.map +1 -1
- package/lib/module/flags/internal.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts +2 -0
- package/lib/typescript/config/FileBasedConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts +4 -0
- package/lib/typescript/config/async/AutoInstrumentationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts +2 -0
- package/lib/typescript/config/async/PartialInitializationConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.d.ts +4 -0
- package/lib/typescript/config/features/RumConfiguration.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfiguration.type.d.ts +21 -0
- package/lib/typescript/config/features/RumConfiguration.type.d.ts.map +1 -1
- package/lib/typescript/config/features/RumConfigurationNative.d.ts +2 -0
- package/lib/typescript/config/features/RumConfigurationNative.d.ts.map +1 -1
- package/lib/typescript/flags/FlagsClient.d.ts +38 -1
- package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
- package/lib/typescript/flags/internal.d.ts +1 -0
- package/lib/typescript/flags/internal.d.ts.map +1 -1
- package/lib/typescript/flags/types.d.ts +1 -1
- package/lib/typescript/flags/types.d.ts.map +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/lib/typescript/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +1 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +133 -0
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +12 -0
- package/src/config/FileBasedConfiguration.ts +6 -1
- package/src/config/FileBasedConfiguration.type.ts +2 -0
- package/src/config/__tests__/FileBasedConfiguration.test.ts +79 -0
- package/src/config/__tests__/__fixtures__/configuration-all-fields.json +2 -0
- package/src/config/async/AutoInstrumentationConfiguration.ts +9 -0
- package/src/config/async/PartialInitializationConfiguration.ts +2 -0
- package/src/config/features/RumConfiguration.ts +10 -0
- package/src/config/features/RumConfiguration.type.ts +23 -0
- package/src/config/features/RumConfigurationNative.ts +2 -0
- package/src/flags/FlagsClient.ts +128 -19
- package/src/flags/__tests__/FlagsClient.test.ts +167 -0
- package/src/flags/configuration/precomputed.ts +2 -3
- package/src/flags/internal.ts +2 -0
- package/src/flags/types.ts +2 -0
- package/src/rum/instrumentation/interactionTracking/__tests__/DdBabelInteractionTracking.test.ts +104 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +165 -0
- package/src/version.ts +1 -1
|
@@ -96,6 +96,8 @@ describe('DatadogProvider', () => {
|
|
|
96
96
|
"longTaskThresholdMs": 0,
|
|
97
97
|
"nativeCrashReportEnabled": false,
|
|
98
98
|
"nativeInteractionTracking": false,
|
|
99
|
+
"nativeIosResourceTracking": undefined,
|
|
100
|
+
"nativeIosResourceTrackingDisallowList": undefined,
|
|
99
101
|
"nativeLongTaskThresholdMs": 200,
|
|
100
102
|
"nativeViewTracking": false,
|
|
101
103
|
"resourceEventMapper": null,
|
|
@@ -178,6 +180,169 @@ describe('DatadogProvider', () => {
|
|
|
178
180
|
});
|
|
179
181
|
});
|
|
180
182
|
|
|
183
|
+
describe('nativeIosResourceTracking', () => {
|
|
184
|
+
it('sends nativeIosResourceTracking undefined to native by default', async () => {
|
|
185
|
+
renderWithProvider();
|
|
186
|
+
await flushPromises();
|
|
187
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
188
|
+
const receivedConfiguration =
|
|
189
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
190
|
+
expect(receivedConfiguration.rumConfiguration).toBeDefined();
|
|
191
|
+
expect(
|
|
192
|
+
receivedConfiguration.rumConfiguration.nativeIosResourceTracking
|
|
193
|
+
).toBeUndefined();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it.each([true, false])(
|
|
197
|
+
'sends nativeIosResourceTracking %s to native when set',
|
|
198
|
+
async value => {
|
|
199
|
+
const configuration = getDefaultConfiguration();
|
|
200
|
+
const rumConfiguration = configuration.rumConfiguration;
|
|
201
|
+
if (rumConfiguration) {
|
|
202
|
+
rumConfiguration.nativeIosResourceTracking = value;
|
|
203
|
+
}
|
|
204
|
+
renderWithProvider({ configuration });
|
|
205
|
+
await flushPromises();
|
|
206
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
207
|
+
const receivedConfiguration =
|
|
208
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
209
|
+
expect(
|
|
210
|
+
receivedConfiguration.rumConfiguration
|
|
211
|
+
.nativeIosResourceTracking
|
|
212
|
+
).toBe(value);
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
it.each([
|
|
217
|
+
[undefined, undefined, undefined],
|
|
218
|
+
[true, undefined, true],
|
|
219
|
+
[false, undefined, false],
|
|
220
|
+
[undefined, true, true],
|
|
221
|
+
[undefined, false, false]
|
|
222
|
+
])(
|
|
223
|
+
'partial initialization: features %s, initialize %s => native %s',
|
|
224
|
+
async (featuresValue, initializeValue, expected) => {
|
|
225
|
+
renderWithProvider({
|
|
226
|
+
configuration: {
|
|
227
|
+
rumConfiguration: {
|
|
228
|
+
trackErrors: false,
|
|
229
|
+
trackResources: false,
|
|
230
|
+
trackInteractions: false,
|
|
231
|
+
...(featuresValue !== undefined && {
|
|
232
|
+
nativeIosResourceTracking: featuresValue
|
|
233
|
+
})
|
|
234
|
+
},
|
|
235
|
+
traceConfiguration: {},
|
|
236
|
+
logsConfiguration: {}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
await flushPromises();
|
|
240
|
+
expect(NativeModules.DdSdk.initialize).not.toHaveBeenCalled();
|
|
241
|
+
|
|
242
|
+
await DatadogProvider.initialize({
|
|
243
|
+
clientToken: 'fake-client-token',
|
|
244
|
+
env: 'fake-env',
|
|
245
|
+
rumConfiguration: {
|
|
246
|
+
applicationId: 'fake-application-id',
|
|
247
|
+
...(initializeValue !== undefined && {
|
|
248
|
+
nativeIosResourceTracking: initializeValue
|
|
249
|
+
})
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
await flushPromises();
|
|
253
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
254
|
+
const receivedConfiguration =
|
|
255
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
256
|
+
expect(
|
|
257
|
+
receivedConfiguration.rumConfiguration
|
|
258
|
+
.nativeIosResourceTracking
|
|
259
|
+
).toBe(expected);
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe('nativeIosResourceTrackingDisallowList', () => {
|
|
265
|
+
const disallowList = [
|
|
266
|
+
'https://3p.example.com/*',
|
|
267
|
+
'https://cdn.example.com/a'
|
|
268
|
+
];
|
|
269
|
+
|
|
270
|
+
it('sends nativeIosResourceTrackingDisallowList undefined to native by default', async () => {
|
|
271
|
+
renderWithProvider();
|
|
272
|
+
await flushPromises();
|
|
273
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
274
|
+
const receivedConfiguration =
|
|
275
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
276
|
+
expect(receivedConfiguration.rumConfiguration).toBeDefined();
|
|
277
|
+
expect(
|
|
278
|
+
receivedConfiguration.rumConfiguration
|
|
279
|
+
.nativeIosResourceTrackingDisallowList
|
|
280
|
+
).toBeUndefined();
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('sends nativeIosResourceTrackingDisallowList to native when set', async () => {
|
|
284
|
+
const configuration = getDefaultConfiguration();
|
|
285
|
+
const rumConfiguration = configuration.rumConfiguration;
|
|
286
|
+
if (rumConfiguration) {
|
|
287
|
+
rumConfiguration.nativeIosResourceTrackingDisallowList = disallowList;
|
|
288
|
+
}
|
|
289
|
+
renderWithProvider({ configuration });
|
|
290
|
+
await flushPromises();
|
|
291
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
292
|
+
const receivedConfiguration =
|
|
293
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
294
|
+
expect(
|
|
295
|
+
receivedConfiguration.rumConfiguration
|
|
296
|
+
.nativeIosResourceTrackingDisallowList
|
|
297
|
+
).toEqual(disallowList);
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
it.each([
|
|
301
|
+
['unset', 'unset', undefined],
|
|
302
|
+
['list', 'unset', disallowList],
|
|
303
|
+
['unset', 'list', disallowList]
|
|
304
|
+
])(
|
|
305
|
+
'partial initialization: features %s, initialize %s => native %p',
|
|
306
|
+
async (featuresValue, initializeValue, expected) => {
|
|
307
|
+
renderWithProvider({
|
|
308
|
+
configuration: {
|
|
309
|
+
rumConfiguration: {
|
|
310
|
+
trackErrors: false,
|
|
311
|
+
trackResources: false,
|
|
312
|
+
trackInteractions: false,
|
|
313
|
+
...(featuresValue === 'list' && {
|
|
314
|
+
nativeIosResourceTrackingDisallowList: disallowList
|
|
315
|
+
})
|
|
316
|
+
},
|
|
317
|
+
traceConfiguration: {},
|
|
318
|
+
logsConfiguration: {}
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
await flushPromises();
|
|
322
|
+
expect(NativeModules.DdSdk.initialize).not.toHaveBeenCalled();
|
|
323
|
+
|
|
324
|
+
await DatadogProvider.initialize({
|
|
325
|
+
clientToken: 'fake-client-token',
|
|
326
|
+
env: 'fake-env',
|
|
327
|
+
rumConfiguration: {
|
|
328
|
+
applicationId: 'fake-application-id',
|
|
329
|
+
...(initializeValue === 'list' && {
|
|
330
|
+
nativeIosResourceTrackingDisallowList: disallowList
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
await flushPromises();
|
|
335
|
+
expect(NativeModules.DdSdk.initialize).toHaveBeenCalledTimes(1);
|
|
336
|
+
const receivedConfiguration =
|
|
337
|
+
NativeModules.DdSdk.initialize.mock.calls[0][0];
|
|
338
|
+
expect(
|
|
339
|
+
receivedConfiguration.rumConfiguration
|
|
340
|
+
.nativeIosResourceTrackingDisallowList
|
|
341
|
+
).toEqual(expected);
|
|
342
|
+
}
|
|
343
|
+
);
|
|
344
|
+
});
|
|
345
|
+
|
|
181
346
|
describe('onInitialization callback', () => {
|
|
182
347
|
it('runs after initialization when SYNC initialization', async () => {
|
|
183
348
|
const onInitialization = jest.fn();
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '3.
|
|
2
|
+
export const version = '3.10.0';
|