@datadog/mobile-react-native 1.0.0-rc3 → 1.0.0-rc6

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 (137) hide show
  1. package/DatadogSDKReactNative.podspec +1 -1
  2. package/README.md +47 -16
  3. package/android/build.gradle +2 -3
  4. package/android/gradle.properties +4 -4
  5. package/android/src/main/java/com/datadog/reactnative/DdRum.kt +25 -24
  6. package/android/src/main/java/com/datadog/reactnative/DdTrace.kt +6 -6
  7. package/ios/Sources/DdRum.m +10 -9
  8. package/ios/Sources/DdRum.swift +24 -24
  9. package/ios/Sources/DdTrace.m +2 -2
  10. package/ios/Sources/DdTrace.swift +6 -6
  11. package/lib/commonjs/DdSdkReactNative.js +42 -22
  12. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  13. package/lib/commonjs/DdSdkReactNativeConfiguration.js +17 -2
  14. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  15. package/lib/commonjs/InternalLog.js +51 -0
  16. package/lib/commonjs/InternalLog.js.map +1 -0
  17. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  18. package/lib/commonjs/SdkVerbosity.js +26 -0
  19. package/lib/commonjs/SdkVerbosity.js.map +1 -0
  20. package/lib/commonjs/TimeProvider.js +72 -0
  21. package/lib/commonjs/TimeProvider.js.map +1 -0
  22. package/lib/commonjs/Timer.js +10 -23
  23. package/lib/commonjs/Timer.js.map +1 -1
  24. package/lib/commonjs/TrackingConsent.js.map +1 -1
  25. package/lib/commonjs/foundation.js +62 -40
  26. package/lib/commonjs/foundation.js.map +1 -1
  27. package/lib/commonjs/index.js +26 -18
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/internal.js +14 -0
  30. package/lib/commonjs/internal.js.map +1 -0
  31. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js +14 -5
  32. package/lib/commonjs/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
  33. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +51 -20
  34. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  35. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js +141 -30
  36. package/lib/commonjs/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  37. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +46 -7
  38. package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
  39. package/lib/commonjs/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
  40. package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js +34 -0
  41. package/lib/commonjs/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
  42. package/lib/commonjs/rum/instrumentation/TraceIdentifier.js.map +1 -1
  43. package/lib/commonjs/types.js.map +1 -1
  44. package/lib/commonjs/version.js +10 -0
  45. package/lib/commonjs/version.js.map +1 -0
  46. package/lib/module/DdSdkReactNative.js +34 -22
  47. package/lib/module/DdSdkReactNative.js.map +1 -1
  48. package/lib/module/DdSdkReactNativeConfiguration.js +18 -3
  49. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  50. package/lib/module/InternalLog.js +46 -0
  51. package/lib/module/InternalLog.js.map +1 -0
  52. package/lib/module/ProxyConfiguration.js.map +1 -1
  53. package/lib/module/SdkVerbosity.js +18 -0
  54. package/lib/module/SdkVerbosity.js.map +1 -0
  55. package/lib/module/TimeProvider.js +63 -0
  56. package/lib/module/TimeProvider.js.map +1 -0
  57. package/lib/module/Timer.js +14 -23
  58. package/lib/module/Timer.js.map +1 -1
  59. package/lib/module/TrackingConsent.js.map +1 -1
  60. package/lib/module/foundation.js +42 -40
  61. package/lib/module/foundation.js.map +1 -1
  62. package/lib/module/index.js +3 -2
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/internal.js +2 -0
  65. package/lib/module/internal.js.map +1 -0
  66. package/lib/module/rum/instrumentation/DdEventsInterceptor.js +11 -5
  67. package/lib/module/rum/instrumentation/DdEventsInterceptor.js.map +1 -1
  68. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +46 -20
  69. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  70. package/lib/module/rum/instrumentation/DdRumResourceTracking.js +133 -29
  71. package/lib/module/rum/instrumentation/DdRumResourceTracking.js.map +1 -1
  72. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +41 -6
  73. package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
  74. package/lib/module/rum/instrumentation/NoOpEventsInterceptor.js.map +1 -1
  75. package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js +25 -0
  76. package/lib/module/rum/instrumentation/ShallowObjectEqualityChecker.js.map +1 -0
  77. package/lib/module/rum/instrumentation/TraceIdentifier.js.map +1 -1
  78. package/lib/module/types.js.map +1 -1
  79. package/lib/module/version.js +3 -0
  80. package/lib/module/version.js.map +1 -0
  81. package/lib/typescript/DdSdkReactNative.d.ts +7 -6
  82. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +15 -4
  83. package/lib/typescript/InternalLog.d.ts +6 -0
  84. package/lib/typescript/SdkVerbosity.d.ts +9 -0
  85. package/lib/typescript/TimeProvider.d.ts +20 -0
  86. package/lib/typescript/Timer.d.ts +3 -2
  87. package/lib/typescript/index.d.ts +3 -2
  88. package/lib/typescript/internal.d.ts +1 -0
  89. package/lib/typescript/rum/instrumentation/DdEventsInterceptor.d.ts +1 -0
  90. package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +3 -2
  91. package/lib/typescript/rum/instrumentation/DdRumResourceTracking.d.ts +13 -8
  92. package/lib/typescript/rum/instrumentation/DdRumUserInteractionTracking.d.ts +3 -3
  93. package/lib/typescript/rum/instrumentation/DdRumXhr.d.ts +13 -3
  94. package/lib/typescript/rum/instrumentation/ShallowObjectEqualityChecker.d.ts +4 -0
  95. package/lib/typescript/types.d.ts +12 -11
  96. package/lib/typescript/version.d.ts +1 -0
  97. package/package.json +7 -4
  98. package/src/DdSdkReactNative.tsx +112 -58
  99. package/src/DdSdkReactNativeConfiguration.tsx +22 -14
  100. package/src/InternalLog.tsx +45 -0
  101. package/src/ProxyConfiguration.tsx +5 -5
  102. package/src/{NativeSdkVerbosity.tsx → SdkVerbosity.tsx} +6 -6
  103. package/src/TimeProvider.tsx +64 -0
  104. package/src/Timer.ts +20 -35
  105. package/src/TrackingConsent.tsx +3 -3
  106. package/src/__mocks__/InternalLog.tsx +9 -0
  107. package/src/__tests__/DdRumWrapper.test.tsx +98 -0
  108. package/src/__tests__/DdSdkReactNative.test.tsx +699 -500
  109. package/src/__tests__/InternalLog.test.tsx +379 -0
  110. package/src/__tests__/TimeProvider.test.tsx +75 -0
  111. package/src/__tests__/Timer.test.ts +148 -57
  112. package/src/__tests__/rum/instrumentation/DdEventsInterceptor.test.tsx +151 -92
  113. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +243 -76
  114. package/src/__tests__/rum/instrumentation/DdRumResourceTracking.test.tsx +723 -403
  115. package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +239 -85
  116. package/src/__tests__/rum/instrumentation/ShallowObjectEqualityChecker.test.ts +31 -0
  117. package/src/__tests__/rum/instrumentation/TraceIdentifier.test.tsx +13 -15
  118. package/src/__tests__/rum/instrumentation/__utils__/XMLHttpRequestMock.ts +97 -0
  119. package/src/foundation.tsx +55 -42
  120. package/src/index.tsx +13 -3
  121. package/src/internal.tsx +1 -0
  122. package/src/rum/instrumentation/DdEventsInterceptor.tsx +51 -35
  123. package/src/rum/instrumentation/DdRumErrorTracking.tsx +75 -42
  124. package/src/rum/instrumentation/DdRumResourceTracking.tsx +312 -166
  125. package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +72 -25
  126. package/src/rum/instrumentation/DdRumXhr.tsx +21 -11
  127. package/src/rum/instrumentation/EventsInterceptor.tsx +3 -3
  128. package/src/rum/instrumentation/NoOpEventsInterceptor.tsx +2 -2
  129. package/src/rum/instrumentation/ShallowObjectEqualityChecker.ts +24 -0
  130. package/src/rum/instrumentation/TraceIdentifier.tsx +19 -19
  131. package/src/types.tsx +199 -157
  132. package/src/version.ts +2 -0
  133. package/lib/commonjs/NativeSdkVerbosity.js +0 -26
  134. package/lib/commonjs/NativeSdkVerbosity.js.map +0 -1
  135. package/lib/module/NativeSdkVerbosity.js +0 -18
  136. package/lib/module/NativeSdkVerbosity.js.map +0 -1
  137. package/lib/typescript/NativeSdkVerbosity.d.ts +0 -9
@@ -3,7 +3,7 @@
3
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
-
6
+
7
7
  export default interface EventsInterceptor {
8
- interceptOnPress(...args: any[]): void
9
- }
8
+ interceptOnPress(...args: any[]): void;
9
+ }
@@ -4,11 +4,11 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import type EventsInterceptor from './EventsInterceptor'
7
+ import type EventsInterceptor from './EventsInterceptor';
8
8
 
9
9
  export default class NoOpEventsInterceptor implements EventsInterceptor {
10
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
11
  interceptOnPress(..._args: any[]): void {
12
12
  // NoOp
13
13
  }
14
- }
14
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
+ * Copyright 2016-Present Datadog, Inc.
5
+ */
6
+
7
+ /**
8
+ * Does a shallow comparison between 2 objects
9
+ */
10
+ export const areObjectShallowEqual = (
11
+ objectA: Record<string, unknown>,
12
+ objectB: Record<string, unknown>
13
+ ): boolean => {
14
+ const keys = Object.keys(objectA);
15
+ if (keys.length !== Object.keys(objectB).length) {
16
+ return false;
17
+ }
18
+ for (const key of keys) {
19
+ if (objectA[key] !== objectB[key]) {
20
+ return false;
21
+ }
22
+ }
23
+ return true;
24
+ };
@@ -9,26 +9,26 @@
9
9
  */
10
10
 
11
11
  export function generateTraceId(): string {
12
- const radix = 10
13
- const MAX_32_BITS_NUMBER = 4294967295 // 2^32-1
14
- let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER)
15
- let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER)
16
- let str = ''
12
+ const radix = 10;
13
+ const MAX_32_BITS_NUMBER = 4294967295; // 2^32-1
14
+ let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);
15
+ let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);
16
+ let str = '';
17
17
 
18
- while (high > 0 && low > 0) {
19
- // Create an intermediate value with the same modulo as the combined high and low value
20
- // but requiring 36 bits max (32 for the low value + 4 for the high part)
21
- const modH = high % radix
22
- const temp = ((modH) << 32) + low
23
- const digit = temp % radix
18
+ while (high > 0 && low > 0) {
19
+ // Create an intermediate value with the same modulo as the combined high and low value
20
+ // but requiring 36 bits max (32 for the low value + 4 for the high part)
21
+ const modH = high % radix;
22
+ const temp = (modH << 32) + low;
23
+ const digit = temp % radix;
24
24
 
25
- // update the high value
26
- high = (high - modH) / radix // we reuse the modH to avoid the need of a floor op
27
- // the low value reuses the previous temp value to account for the "missing mod" in the high update
28
- low = (temp - digit) / radix // we reuse the digit to avoid the need of a floor op
25
+ // update the high value
26
+ high = (high - modH) / radix; // we reuse the modH to avoid the need of a floor op
27
+ // the low value reuses the previous temp value to account for the "missing mod" in the high update
28
+ low = (temp - digit) / radix; // we reuse the digit to avoid the need of a floor op
29
29
 
30
- // update the string from right to left
31
- str = digit.toString() + str
32
- }
33
- return str
30
+ // update the string from right to left
31
+ str = digit.toString() + str;
32
+ }
33
+ return str;
34
34
  }
package/src/types.tsx CHANGED
@@ -8,185 +8,227 @@
8
8
  * A configuration object to initialize Datadog's features.
9
9
  */
10
10
  export class DdSdkConfiguration {
11
- constructor(
12
- readonly clientToken: string,
13
- readonly env: string,
14
- readonly applicationId: string,
15
- readonly nativeCrashReportEnabled: boolean,
16
- readonly sampleRate: number,
17
- readonly site: string,
18
- readonly trackingConsent: string,
19
- readonly additionalConfig: object
20
- ) {}
11
+ constructor(
12
+ readonly clientToken: string,
13
+ readonly env: string,
14
+ readonly applicationId: string,
15
+ readonly nativeCrashReportEnabled: boolean,
16
+ readonly sampleRate: number,
17
+ readonly site: string,
18
+ readonly trackingConsent: string,
19
+ readonly additionalConfig: object
20
+ ) {}
21
21
  }
22
22
 
23
23
  /**
24
24
  * The entry point to initialize Datadog's features.
25
25
  */
26
26
  export type DdSdkType = {
27
- /**
28
- * Initializes Datadog's features.
29
- * @param configuration: The configuration to use.
30
- */
31
- initialize(configuration: DdSdkConfiguration): Promise<void>;
32
-
33
- /**
34
- * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
35
- * @param attributes: The global context attributes.
36
- */
37
- setAttributes(attributes: object): Promise<void>;
38
-
39
- /**
40
- * Set the user information.
41
- * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
42
- */
43
- setUser(user: object): Promise<void>;
44
-
45
- /**
46
- * Set the tracking consent regarding the data collection.
47
- * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
48
- */
49
- setTrackingConsent(trackingConsent: string): Promise<void>;
50
-
27
+ /**
28
+ * Initializes Datadog's features.
29
+ * @param configuration: The configuration to use.
30
+ */
31
+ initialize(configuration: DdSdkConfiguration): Promise<void>;
32
+
33
+ /**
34
+ * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.
35
+ * @param attributes: The global context attributes.
36
+ */
37
+ setAttributes(attributes: object): Promise<void>;
38
+
39
+ /**
40
+ * Set the user information.
41
+ * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).
42
+ */
43
+ setUser(user: object): Promise<void>;
44
+
45
+ /**
46
+ * Set the tracking consent regarding the data collection.
47
+ * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
48
+ */
49
+ setTrackingConsent(trackingConsent: string): Promise<void>;
51
50
  };
52
51
 
53
52
  /**
54
53
  * The entry point to use Datadog's Logs feature.
55
54
  */
56
55
  export type DdLogsType = {
57
- /**
58
- * Send a log with level debug.
59
- * @param message: The message to send.
60
- * @param context: The additional context to send.
61
- */
62
- debug(message: string, context?: object): Promise<void>;
63
-
64
- /**
65
- * Send a log with level info.
66
- * @param message: The message to send.
67
- * @param context: The additional context to send.
68
- */
69
- info(message: string, context?: object): Promise<void>;
70
-
71
- /**
72
- * Send a log with level warn.
73
- * @param message: The message to send.
74
- * @param context: The additional context to send.
75
- */
76
- warn(message: string, context?: object): Promise<void>;
77
-
78
- /**
79
- * Send a log with level error.
80
- * @param message: The message to send.
81
- * @param context: The additional context to send.
82
- */
83
- error(message: string, context?: object): Promise<void>;
84
-
56
+ /**
57
+ * Send a log with level debug.
58
+ * @param message: The message to send.
59
+ * @param context: The additional context to send.
60
+ */
61
+ debug(message: string, context?: object): Promise<void>;
62
+
63
+ /**
64
+ * Send a log with level info.
65
+ * @param message: The message to send.
66
+ * @param context: The additional context to send.
67
+ */
68
+ info(message: string, context?: object): Promise<void>;
69
+
70
+ /**
71
+ * Send a log with level warn.
72
+ * @param message: The message to send.
73
+ * @param context: The additional context to send.
74
+ */
75
+ warn(message: string, context?: object): Promise<void>;
76
+
77
+ /**
78
+ * Send a log with level error.
79
+ * @param message: The message to send.
80
+ * @param context: The additional context to send.
81
+ */
82
+ error(message: string, context?: object): Promise<void>;
85
83
  };
86
84
 
87
85
  /**
88
86
  * The entry point to use Datadog's Trace feature.
89
87
  */
90
88
  export type DdTraceType = {
91
- /**
92
- * Start a span, and returns a unique identifier for the span.
93
- * @param operation: The operation name of the span.
94
- * @param context: The additional context to send.
95
- * @param timestampMs: The timestamp when the operation started (in milliseconds).
96
- */
97
- startSpan(operation: string, context?: object, timestampMs?: number): Promise<string>;
98
-
99
- /**
100
- * Finish a started span.
101
- * @param spanId: The unique identifier of the span.
102
- * @param context: The additional context to send.
103
- * @param timestampMs: The timestamp when the operation stopped (in milliseconds).
104
- */
105
- finishSpan(spanId: string, context?: object, timestampMs?: number): Promise<void>;
106
-
89
+ /**
90
+ * Start a span, and returns a unique identifier for the span.
91
+ * @param operation: The operation name of the span.
92
+ * @param context: The additional context to send.
93
+ * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.
94
+ */
95
+ startSpan(
96
+ operation: string,
97
+ context?: object,
98
+ timestampMs?: number
99
+ ): Promise<string>;
100
+
101
+ /**
102
+ * Finish a started span.
103
+ * @param spanId: The unique identifier of the span.
104
+ * @param context: The additional context to send.
105
+ * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.
106
+ */
107
+ finishSpan(
108
+ spanId: string,
109
+ context?: object,
110
+ timestampMs?: number
111
+ ): Promise<void>;
107
112
  };
108
113
 
109
114
  /**
110
115
  * The entry point to use Datadog's RUM feature.
111
116
  */
112
117
  export type DdRumType = {
113
- /**
114
- * Start tracking a RUM View.
115
- * @param key: The view unique key identifier.
116
- * @param name: The view name.
117
- * @param context: The additional context to send.
118
- * @param timestampMs: The timestamp when the view started (in milliseconds).
119
- */
120
- startView(key: string, name: string, context?: object, timestampMs?: number): Promise<void>;
121
-
122
- /**
123
- * Stop tracking a RUM View.
124
- * @param key: The view unique key identifier.
125
- * @param context: The additional context to send.
126
- * @param timestampMs: The timestamp when the view stopped (in milliseconds).
127
- */
128
- stopView(key: string, context?: object, timestampMs?: number): Promise<void>;
129
-
130
- /**
131
- * Start tracking a RUM Action.
132
- * @param type: The action type (tap, scroll, swipe, click, custom).
133
- * @param name: The action name.
134
- * @param context: The additional context to send.
135
- * @param timestampMs: The timestamp when the action started (in milliseconds).
136
- */
137
- startAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
138
-
139
- /**
140
- * Stop tracking the ongoing RUM Action.
141
- * @param context: The additional context to send.
142
- * @param timestampMs: The timestamp when the action stopped (in milliseconds).
143
- */
144
- stopAction(context?: object, timestampMs?: number): Promise<void>;
145
-
146
- /**
147
- * Add a RUM Action.
148
- * @param type: The action type (tap, scroll, swipe, click, custom).
149
- * @param name: The action name.
150
- * @param context: The additional context to send.
151
- * @param timestampMs: The timestamp when the action occurred (in milliseconds).
152
- */
153
- addAction(type: string, name: string, context?: object, timestampMs?: number): Promise<void>;
154
-
155
- /**
156
- * Start tracking a RUM Resource.
157
- * @param key: The resource unique key identifier.
158
- * @param method: The resource method (GET, POST, …).
159
- * @param url: The resource url.
160
- * @param context: The additional context to send.
161
- * @param timestampMs: The timestamp when the resource started (in milliseconds).
162
- */
163
- startResource(key: string, method: string, url: string, context?: object, timestampMs?: number): Promise<void>;
164
-
165
- /**
166
- * Stop tracking a RUM Resource.
167
- * @param key: The resource unique key identifier.
168
- * @param statusCode: The resource status code.
169
- * @param kind: The resource's kind (xhr, document, image, css, font, …).
170
- * @param context: The additional context to send.
171
- * @param timestampMs: The timestamp when the resource stopped (in milliseconds).
172
- */
173
- stopResource(key: string, statusCode: number, kind: string, context?: object, timestampMs?: number): Promise<void>;
174
-
175
- /**
176
- * Add a RUM Error.
177
- * @param message: The error message.
178
- * @param source: The error source (network, source, console, logger, …).
179
- * @param stacktrace: The error stacktrace.
180
- * @param context: The additional context to send.
181
- * @param timestampMs: The timestamp when the error occurred (in milliseconds).
182
- */
183
- addError(message: string, source: string, stacktrace: string, context?: object, timestampMs?: number): Promise<void>;
184
-
185
- /**
186
- * 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.
187
- * @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.
188
- */
189
- addTiming(name: string): Promise<void>;
190
-
118
+ /**
119
+ * Start tracking a RUM View.
120
+ * @param key: The view unique key identifier.
121
+ * @param name: The view name.
122
+ * @param context: The additional context to send.
123
+ * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.
124
+ */
125
+ startView(
126
+ key: string,
127
+ name: string,
128
+ context?: object,
129
+ timestampMs?: number
130
+ ): Promise<void>;
131
+
132
+ /**
133
+ * Stop tracking a RUM View.
134
+ * @param key: The view unique key identifier.
135
+ * @param context: The additional context to send.
136
+ * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.
137
+ */
138
+ stopView(
139
+ key: string,
140
+ context?: object,
141
+ timestampMs?: number
142
+ ): Promise<void>;
143
+
144
+ /**
145
+ * Start tracking a RUM Action.
146
+ * @param type: The action type (tap, scroll, swipe, click, custom).
147
+ * @param name: The action name.
148
+ * @param context: The additional context to send.
149
+ * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.
150
+ */
151
+ startAction(
152
+ type: string,
153
+ name: string,
154
+ context?: object,
155
+ timestampMs?: number
156
+ ): Promise<void>;
157
+
158
+ /**
159
+ * Stop tracking the ongoing RUM Action.
160
+ * @param context: The additional context to send.
161
+ * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.
162
+ */
163
+ stopAction(context?: object, timestampMs?: number): Promise<void>;
164
+
165
+ /**
166
+ * Add a RUM Action.
167
+ * @param type: The action type (tap, scroll, swipe, click, custom).
168
+ * @param name: The action name.
169
+ * @param context: The additional context to send.
170
+ * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.
171
+ */
172
+ addAction(
173
+ type: string,
174
+ name: string,
175
+ context?: object,
176
+ timestampMs?: number
177
+ ): Promise<void>;
178
+
179
+ /**
180
+ * Start tracking a RUM Resource.
181
+ * @param key: The resource unique key identifier.
182
+ * @param method: The resource method (GET, POST, …).
183
+ * @param url: The resource url.
184
+ * @param context: The additional context to send.
185
+ * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.
186
+ */
187
+ startResource(
188
+ key: string,
189
+ method: string,
190
+ url: string,
191
+ context?: object,
192
+ timestampMs?: number
193
+ ): Promise<void>;
194
+
195
+ /**
196
+ * Stop tracking a RUM Resource.
197
+ * @param key: The resource unique key identifier.
198
+ * @param statusCode: The resource status code.
199
+ * @param kind: The resource's kind (xhr, document, image, css, font, …).
200
+ * @param size: The resource size in bytes. If size is unknown, use -1.
201
+ * @param context: The additional context to send.
202
+ * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.
203
+ */
204
+ stopResource(
205
+ key: string,
206
+ statusCode: number,
207
+ kind: string,
208
+ size?: number,
209
+ context?: object,
210
+ timestampMs?: number
211
+ ): Promise<void>;
212
+
213
+ /**
214
+ * Add a RUM Error.
215
+ * @param message: The error message.
216
+ * @param source: The error source (network, source, console, logger, …).
217
+ * @param stacktrace: The error stacktrace.
218
+ * @param context: The additional context to send.
219
+ * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
220
+ */
221
+ addError(
222
+ message: string,
223
+ source: string,
224
+ stacktrace: string,
225
+ context?: object,
226
+ timestampMs?: number
227
+ ): Promise<void>;
228
+
229
+ /**
230
+ * 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.
231
+ * @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.
232
+ */
233
+ addTiming(name: string): Promise<void>;
191
234
  };
192
-
package/src/version.ts ADDED
@@ -0,0 +1,2 @@
1
+ // generated by genversion
2
+ export const version = '1.0.0-rc6';
@@ -1,26 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.NativeSdkVerbosity = void 0;
7
-
8
- /*
9
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
10
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
11
- * Copyright 2016-Present Datadog, Inc.
12
- */
13
-
14
- /**
15
- * Enum specifying possible consent options for DD SDK.
16
- */
17
- let NativeSdkVerbosity;
18
- exports.NativeSdkVerbosity = NativeSdkVerbosity;
19
-
20
- (function (NativeSdkVerbosity) {
21
- NativeSdkVerbosity["DEBUG"] = "debug";
22
- NativeSdkVerbosity["INFO"] = "info";
23
- NativeSdkVerbosity["WARN"] = "warn";
24
- NativeSdkVerbosity["ERROR"] = "error";
25
- })(NativeSdkVerbosity || (exports.NativeSdkVerbosity = NativeSdkVerbosity = {}));
26
- //# sourceMappingURL=NativeSdkVerbosity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["NativeSdkVerbosity.tsx"],"names":["NativeSdkVerbosity"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;IACYA,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","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/**\n * Enum specifying possible consent options for DD SDK.\n */\nexport enum NativeSdkVerbosity {\n DEBUG = \"debug\",\n INFO = \"info\",\n WARN = \"warn\",\n ERROR = \"error\"\n}\n"]}
@@ -1,18 +0,0 @@
1
- /*
2
- * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
3
- * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
- * Copyright 2016-Present Datadog, Inc.
5
- */
6
-
7
- /**
8
- * Enum specifying possible consent options for DD SDK.
9
- */
10
- export let NativeSdkVerbosity;
11
-
12
- (function (NativeSdkVerbosity) {
13
- NativeSdkVerbosity["DEBUG"] = "debug";
14
- NativeSdkVerbosity["INFO"] = "info";
15
- NativeSdkVerbosity["WARN"] = "warn";
16
- NativeSdkVerbosity["ERROR"] = "error";
17
- })(NativeSdkVerbosity || (NativeSdkVerbosity = {}));
18
- //# sourceMappingURL=NativeSdkVerbosity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["NativeSdkVerbosity.tsx"],"names":["NativeSdkVerbosity"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAYA,kBAAZ;;WAAYA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,KAAAA,kB","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/**\n * Enum specifying possible consent options for DD SDK.\n */\nexport enum NativeSdkVerbosity {\n DEBUG = \"debug\",\n INFO = \"info\",\n WARN = \"warn\",\n ERROR = \"error\"\n}\n"]}
@@ -1,9 +0,0 @@
1
- /**
2
- * Enum specifying possible consent options for DD SDK.
3
- */
4
- export declare enum NativeSdkVerbosity {
5
- DEBUG = "debug",
6
- INFO = "info",
7
- WARN = "warn",
8
- ERROR = "error"
9
- }