@datadog/mobile-react-native 1.0.0-rc4 → 1.0.0-rc7
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 +1 -1
- package/README.md +47 -16
- package/android/build.gradle +1 -1
- package/android/gradle.properties +4 -4
- package/lib/commonjs/DdSdkReactNative.js +38 -23
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +17 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/InternalLog.js +56 -0
- package/lib/commonjs/InternalLog.js.map +1 -0
- package/lib/commonjs/ProxyConfiguration.js.map +1 -1
- package/lib/commonjs/SdkVerbosity.js +26 -0
- package/lib/commonjs/SdkVerbosity.js.map +1 -0
- package/lib/commonjs/TimeProvider.js +72 -0
- package/lib/commonjs/TimeProvider.js.map +1 -0
- package/lib/commonjs/Timer.js +10 -23
- package/lib/commonjs/Timer.js.map +1 -1
- package/lib/commonjs/TrackingConsent.js.map +1 -1
- package/lib/commonjs/foundation.js +51 -11
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +34 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +14 -5
- package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +34 -23
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +62 -36
- package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +46 -7
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js +34 -0
- package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/TraceIdentifier.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +31 -23
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +18 -3
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/InternalLog.js +52 -0
- package/lib/module/InternalLog.js.map +1 -0
- package/lib/module/ProxyConfiguration.js.map +1 -1
- package/lib/module/SdkVerbosity.js +18 -0
- package/lib/module/SdkVerbosity.js.map +1 -0
- package/lib/module/TimeProvider.js +63 -0
- package/lib/module/TimeProvider.js.map +1 -0
- package/lib/module/Timer.js +14 -23
- package/lib/module/Timer.js.map +1 -1
- package/lib/module/TrackingConsent.js.map +1 -1
- package/lib/module/foundation.js +31 -11
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js +11 -5
- package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +30 -23
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js +57 -34
- package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +41 -6
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js +25 -0
- package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
- package/lib/module/rum/instrumentation/TraceIdentifier.js.map +1 -1
- package/lib/module/types.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 +6 -6
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +15 -4
- package/lib/typescript/InternalLog.d.ts +11 -0
- package/lib/typescript/SdkVerbosity.d.ts +9 -0
- package/lib/typescript/TimeProvider.d.ts +20 -0
- package/lib/typescript/Timer.d.ts +3 -2
- package/lib/typescript/index.d.ts +4 -2
- package/lib/typescript/rum/instrumentation/DdEventsInterceptor.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +2 -2
- package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +10 -9
- package/lib/typescript/rum/instrumentation/DdRumUserInteractionTracking.d.ts +3 -3
- package/lib/typescript/rum/instrumentation/DdRumXhr.d.ts +13 -3
- package/lib/typescript/rum/instrumentation/ShallowObjectEqualityChecker.d.ts +4 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +6 -3
- package/src/DdSdkReactNative.tsx +112 -62
- package/src/DdSdkReactNativeConfiguration.tsx +22 -14
- package/src/InternalLog.tsx +50 -0
- package/src/ProxyConfiguration.tsx +5 -5
- package/src/{NativeSdkVerbosity.tsx → SdkVerbosity.tsx} +6 -6
- package/src/TimeProvider.tsx +64 -0
- package/src/Timer.ts +20 -35
- package/src/TrackingConsent.tsx +3 -3
- package/src/__mocks__/InternalLog.tsx +9 -0
- package/src/__tests__/DdRumWrapper.test.tsx +40 -33
- package/src/__tests__/DdSdkReactNative.test.tsx +697 -513
- package/src/__tests__/InternalLog.test.tsx +379 -0
- package/src/__tests__/TimeProvider.test.tsx +75 -0
- package/src/__tests__/Timer.test.ts +148 -57
- package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +151 -92
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +179 -106
- package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +714 -644
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +239 -85
- package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +31 -0
- package/src/__tests__/rum/instrumentation/TraceIdentifier.test.tsx +13 -15
- package/src/__tests__/rum/instrumentation/__utils__/XMLHttpRequestMock.ts +97 -0
- package/src/foundation.tsx +80 -61
- package/src/index.tsx +15 -3
- package/src/rum/instrumentation/DdEventsInterceptor.tsx +51 -35
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +61 -49
- package/src/rum/instrumentation/DdRumResourceTracking.tsx +307 -233
- package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +72 -25
- package/src/rum/instrumentation/DdRumXhr.tsx +21 -11
- package/src/rum/instrumentation/EventsInterceptor.tsx +3 -3
- package/src/rum/instrumentation/NoOpEventsInterceptor.tsx +2 -2
- package/src/rum/instrumentation/ShallowObjectEqualityChecker.ts +24 -0
- package/src/rum/instrumentation/TraceIdentifier.tsx +19 -19
- package/src/types.tsx +199 -158
- package/src/version.ts +1 -1
- package/lib/commonjs/NativeSdkVerbosity.js +0 -26
- package/lib/commonjs/NativeSdkVerbosity.js.map +0 -1
- package/lib/module/NativeSdkVerbosity.js +0 -18
- package/lib/module/NativeSdkVerbosity.js.map +0 -1
- package/lib/typescript/NativeSdkVerbosity.d.ts +0 -9
|
@@ -4,22 +4,23 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { NativeModules } from 'react-native'
|
|
8
|
-
|
|
7
|
+
import { NativeModules } from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { DdRum } from '../foundation';
|
|
9
10
|
|
|
10
11
|
jest.mock('react-native', () => {
|
|
11
12
|
return {
|
|
12
13
|
NativeModules: {
|
|
13
14
|
DdRum: {
|
|
14
|
-
startView: jest.fn().mockImplementation(() => {
|
|
15
|
-
stopView: jest.fn().mockImplementation(() => {
|
|
16
|
-
startAction: jest.fn().mockImplementation(() => {
|
|
17
|
-
stopAction: jest.fn().mockImplementation(() => {
|
|
18
|
-
addAction: jest.fn().mockImplementation(() => {
|
|
19
|
-
startResource: jest.fn().mockImplementation(() => {
|
|
20
|
-
stopResource: jest.fn().mockImplementation(() => {
|
|
21
|
-
addError: jest.fn().mockImplementation(() => {
|
|
22
|
-
addTiming: jest.fn().mockImplementation(() => {
|
|
15
|
+
startView: jest.fn().mockImplementation(() => {}),
|
|
16
|
+
stopView: jest.fn().mockImplementation(() => {}),
|
|
17
|
+
startAction: jest.fn().mockImplementation(() => {}),
|
|
18
|
+
stopAction: jest.fn().mockImplementation(() => {}),
|
|
19
|
+
addAction: jest.fn().mockImplementation(() => {}),
|
|
20
|
+
startResource: jest.fn().mockImplementation(() => {}),
|
|
21
|
+
stopResource: jest.fn().mockImplementation(() => {}),
|
|
22
|
+
addError: jest.fn().mockImplementation(() => {}),
|
|
23
|
+
addTiming: jest.fn().mockImplementation(() => {})
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
};
|
|
@@ -35,14 +36,13 @@ beforeEach(async () => {
|
|
|
35
36
|
NativeModules.DdRum.stopResource.mockClear();
|
|
36
37
|
NativeModules.DdRum.addError.mockClear();
|
|
37
38
|
NativeModules.DdRum.addTiming.mockClear();
|
|
38
|
-
})
|
|
39
|
-
|
|
39
|
+
});
|
|
40
40
|
|
|
41
41
|
it('M add error source type W addError()', async () => {
|
|
42
42
|
// Given
|
|
43
|
-
const message =
|
|
44
|
-
const source =
|
|
45
|
-
const stacktrace =
|
|
43
|
+
const message = 'Oops I did it again!';
|
|
44
|
+
const source = 'SOURCE';
|
|
45
|
+
const stacktrace = 'doSomething() at ./path/to/file.js:67:3';
|
|
46
46
|
const before = Date.now();
|
|
47
47
|
|
|
48
48
|
// When
|
|
@@ -54,23 +54,26 @@ it('M add error source type W addError()', async () => {
|
|
|
54
54
|
expect(NativeModules.DdRum.addError.mock.calls[0][0]).toBe(message);
|
|
55
55
|
expect(NativeModules.DdRum.addError.mock.calls[0][1]).toBe(source);
|
|
56
56
|
expect(NativeModules.DdRum.addError.mock.calls[0][2]).toBe(stacktrace);
|
|
57
|
-
expect(
|
|
58
|
-
|
|
57
|
+
expect(
|
|
58
|
+
NativeModules.DdRum.addError.mock.calls[0][4]
|
|
59
|
+
).toBeGreaterThanOrEqual(before);
|
|
60
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][4]).toBeLessThanOrEqual(
|
|
61
|
+
after
|
|
62
|
+
);
|
|
59
63
|
const context = NativeModules.DdRum.addError.mock.calls[0][3];
|
|
60
|
-
expect(context[
|
|
61
|
-
})
|
|
62
|
-
|
|
64
|
+
expect(context['_dd.error.source_type']).toStrictEqual('react-native');
|
|
65
|
+
});
|
|
63
66
|
|
|
64
67
|
it('M add error source type W addError() {with custom attributes}', async () => {
|
|
65
68
|
// Given
|
|
66
|
-
const message =
|
|
67
|
-
const source =
|
|
68
|
-
const stacktrace =
|
|
69
|
+
const message = 'Oops I did it again!';
|
|
70
|
+
const source = 'SOURCE';
|
|
71
|
+
const stacktrace = 'doSomething() at ./path/to/file.js:67:3';
|
|
69
72
|
const random = Math.random();
|
|
70
73
|
const attributes = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
+
foo: 'bar',
|
|
75
|
+
spam: random
|
|
76
|
+
};
|
|
74
77
|
const before = Date.now();
|
|
75
78
|
|
|
76
79
|
// When
|
|
@@ -82,10 +85,14 @@ it('M add error source type W addError() {with custom attributes}', async () =>
|
|
|
82
85
|
expect(NativeModules.DdRum.addError.mock.calls[0][0]).toBe(message);
|
|
83
86
|
expect(NativeModules.DdRum.addError.mock.calls[0][1]).toBe(source);
|
|
84
87
|
expect(NativeModules.DdRum.addError.mock.calls[0][2]).toBe(stacktrace);
|
|
85
|
-
expect(
|
|
86
|
-
|
|
88
|
+
expect(
|
|
89
|
+
NativeModules.DdRum.addError.mock.calls[0][4]
|
|
90
|
+
).toBeGreaterThanOrEqual(before);
|
|
91
|
+
expect(NativeModules.DdRum.addError.mock.calls[0][4]).toBeLessThanOrEqual(
|
|
92
|
+
after
|
|
93
|
+
);
|
|
87
94
|
const context = NativeModules.DdRum.addError.mock.calls[0][3];
|
|
88
|
-
expect(context[
|
|
89
|
-
expect(context[
|
|
90
|
-
expect(context[
|
|
91
|
-
})
|
|
95
|
+
expect(context['_dd.error.source_type']).toStrictEqual('react-native');
|
|
96
|
+
expect(context['foo']).toStrictEqual('bar');
|
|
97
|
+
expect(context['spam']).toStrictEqual(random);
|
|
98
|
+
});
|