@datadog/mobile-react-native 1.6.0 → 1.7.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 (63) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +2 -1
  3. package/android/src/main/kotlin/com/datadog/reactnative/DdRum.kt +16 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +28 -0
  5. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +6 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +6 -0
  7. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +17 -0
  8. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +120 -28
  9. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +17 -1
  10. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +15 -0
  11. package/ios/Sources/DdRum.m +5 -0
  12. package/ios/Sources/DdRum.swift +10 -0
  13. package/ios/Sources/DdSdk.swift +38 -0
  14. package/ios/Sources/DdSdkConfiguration.swift +12 -0
  15. package/ios/Sources/RNDdSdkConfiguration.swift +6 -0
  16. package/lib/commonjs/DdSdkReactNative.js +1 -1
  17. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  18. package/lib/commonjs/DdSdkReactNativeConfiguration.js +45 -2
  19. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  20. package/lib/commonjs/index.js +12 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  23. package/lib/commonjs/rum/DdRum.js +8 -0
  24. package/lib/commonjs/rum/DdRum.js.map +1 -1
  25. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +4 -2
  26. package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  27. package/lib/commonjs/types.js +4 -1
  28. package/lib/commonjs/types.js.map +1 -1
  29. package/lib/commonjs/version.js +1 -1
  30. package/lib/commonjs/version.js.map +1 -1
  31. package/lib/module/DdSdkReactNative.js +1 -1
  32. package/lib/module/DdSdkReactNative.js.map +1 -1
  33. package/lib/module/DdSdkReactNativeConfiguration.js +42 -1
  34. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  35. package/lib/module/index.js +2 -2
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/nativeModulesTypes.js.map +1 -1
  38. package/lib/module/rum/DdRum.js +7 -0
  39. package/lib/module/rum/DdRum.js.map +1 -1
  40. package/lib/module/rum/instrumentation/DdRumErrorTracking.js +4 -2
  41. package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
  42. package/lib/module/types.js +4 -1
  43. package/lib/module/types.js.map +1 -1
  44. package/lib/module/version.js +1 -1
  45. package/lib/module/version.js.map +1 -1
  46. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +47 -0
  47. package/lib/typescript/index.d.ts +2 -2
  48. package/lib/typescript/nativeModulesTypes.d.ts +7 -0
  49. package/lib/typescript/rum/DdRum.d.ts +1 -0
  50. package/lib/typescript/types.d.ts +4 -1
  51. package/lib/typescript/version.d.ts +1 -1
  52. package/package.json +2 -2
  53. package/src/DdSdkReactNative.tsx +3 -0
  54. package/src/DdSdkReactNativeConfiguration.tsx +56 -1
  55. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +20 -3
  56. package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +47 -25
  57. package/src/index.tsx +6 -2
  58. package/src/nativeModulesTypes.ts +8 -0
  59. package/src/rum/DdRum.ts +12 -0
  60. package/src/rum/instrumentation/DdRumErrorTracking.tsx +5 -2
  61. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +3 -0
  62. package/src/types.tsx +3 -0
  63. package/src/version.ts +1 -1
package/src/index.tsx CHANGED
@@ -8,7 +8,9 @@ import {
8
8
  DatadogProviderConfiguration,
9
9
  DdSdkReactNativeConfiguration,
10
10
  InitializationMode,
11
- VitalsUpdateFrequency
11
+ VitalsUpdateFrequency,
12
+ UploadFrequency,
13
+ BatchSize
12
14
  } from './DdSdkReactNativeConfiguration';
13
15
  import { DdSdkReactNative } from './DdSdkReactNative';
14
16
  import { InternalLog } from './InternalLog';
@@ -38,5 +40,7 @@ export {
38
40
  TrackingConsent,
39
41
  SdkVerbosity,
40
42
  VitalsUpdateFrequency,
41
- PropagatorType
43
+ PropagatorType,
44
+ UploadFrequency,
45
+ BatchSize
42
46
  };
@@ -327,6 +327,14 @@ export type DdNativeRumType = {
327
327
  * Stops the current RUM Session.
328
328
  */
329
329
  stopSession(): Promise<void>;
330
+
331
+ /**
332
+ * Adds the result of evaluating a feature flag with a given name and value to the view.
333
+ * Feature flag evaluations are local to the active view and are cleared when the view is stopped.
334
+ * @param name: The name of the feature flag
335
+ * @param value: The value of the feature flag, encapsulated in an object to accept all types
336
+ */
337
+ addFeatureFlagEvaluation(name: string, value: object): Promise<void>;
330
338
  };
331
339
 
332
340
  type ActionType = 'TAP' | 'SCROLL' | 'SWIPE' | 'BACK' | 'CUSTOM';
package/src/rum/DdRum.ts CHANGED
@@ -331,6 +331,18 @@ class DdRumWrapper implements DdRumType {
331
331
  return bufferVoidNativeCall(() => this.nativeRum.stopSession());
332
332
  }
333
333
 
334
+ addFeatureFlagEvaluation(name: string, value: unknown): Promise<void> {
335
+ InternalLog.log(
336
+ `Adding feature flag evaluation for name: ${name} with value: ${JSON.stringify(
337
+ value
338
+ )}`,
339
+ SdkVerbosity.DEBUG
340
+ );
341
+ return bufferVoidNativeCall(() =>
342
+ this.nativeRum.addFeatureFlagEvaluation(name, { value })
343
+ );
344
+ }
345
+
334
346
  registerErrorEventMapper(errorEventMapper: ErrorEventMapper) {
335
347
  this.errorEventMapper = generateErrorEventMapper(errorEventMapper);
336
348
  }
@@ -133,11 +133,14 @@ export class DdRumErrorTracking {
133
133
  source: ErrorSource,
134
134
  stacktrace: string,
135
135
  errorName: string,
136
- context?: object
136
+ context: object = {}
137
137
  ): Promise<[void, void]> => {
138
138
  return Promise.all([
139
139
  DdRum.addError(message, source, stacktrace, context),
140
- DdLogs.error(message, errorName, message, stacktrace, context)
140
+ DdLogs.error(message, errorName, message, stacktrace, {
141
+ ...context,
142
+ '_dd.error_log.is_crash': true
143
+ })
141
144
  ]);
142
145
  };
143
146
  }
@@ -67,6 +67,7 @@ describe('DatadogProvider', () => {
67
67
  "_dd.source": "react-native",
68
68
  },
69
69
  "applicationId": "fakeApplicationId",
70
+ "batchSize": "MEDIUM",
70
71
  "clientToken": "fakeToken",
71
72
  "configurationForTelemetry": {
72
73
  "initializationType": "SYNC",
@@ -83,8 +84,10 @@ describe('DatadogProvider', () => {
83
84
  "sampleRate": 100,
84
85
  "site": "US1",
85
86
  "telemetrySampleRate": 20,
87
+ "trackBackgroundEvents": false,
86
88
  "trackFrustrations": true,
87
89
  "trackingConsent": "granted",
90
+ "uploadFrequency": "AVERAGE",
88
91
  "vitalsUpdateFrequency": "AVERAGE",
89
92
  }
90
93
  `);
package/src/types.tsx CHANGED
@@ -21,7 +21,10 @@ export class DdSdkConfiguration {
21
21
  readonly additionalConfig: object,
22
22
  readonly telemetrySampleRate: number,
23
23
  readonly vitalsUpdateFrequency: string,
24
+ readonly uploadFrequency: string,
25
+ readonly batchSize: string,
24
26
  readonly trackFrustrations: boolean,
27
+ readonly trackBackgroundEvents: boolean,
25
28
  readonly configurationForTelemetry: {
26
29
  initializationType: string;
27
30
  trackErrors: boolean;
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '1.6.0';
2
+ export const version = '1.7.0';