@datadog/mobile-react-native 2.2.0 → 2.3.1

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 (102) hide show
  1. package/DatadogSDKReactNative.podspec +2 -1
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +2 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +11 -1
  5. package/android/src/main/kotlin/com/datadog/reactnative/DdLogsImplementation.kt +5 -0
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +64 -1
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +165 -5
  8. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkImplementation.kt +6 -354
  9. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt +351 -0
  10. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkReactNativePackage.kt +5 -3
  11. package/android/src/main/kotlin/com/datadog/reactnative/DdTraceImplementation.kt +10 -0
  12. package/android/src/main/kotlin/com/datadog/reactnative/JSONFileReader.kt +20 -0
  13. package/android/src/main/kotlin/com/datadog/reactnative/ProxyAuthenticator.kt +4 -1
  14. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +10 -0
  15. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
  16. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +5 -2
  17. package/android/src/oldarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
  18. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkConfigurationTest.kt +196 -0
  19. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkNativeInitializationTest.kt +181 -0
  20. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +12 -271
  21. package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +10 -0
  22. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +29 -2
  23. package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +24 -0
  24. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +9 -1
  25. package/android/src/test/resources/input/complete-configuration.json +48 -0
  26. package/android/src/test/resources/input/malformed-configuration.json +5 -0
  27. package/android/src/test/resources/input/minimal-configuration.json +8 -0
  28. package/datadog-configuration.gradle +57 -0
  29. package/datadog-configuration.schema.json +200 -0
  30. package/ios/Sources/DatadogSDKWrapper.swift +16 -13
  31. package/ios/Sources/DdLogsImplementation.swift +14 -0
  32. package/ios/Sources/DdSdk.h +2 -0
  33. package/ios/Sources/DdSdk.mm +6 -1
  34. package/ios/Sources/DdSdkConfiguration.swift +47 -56
  35. package/ios/Sources/DdSdkImplementation.swift +10 -279
  36. package/ios/Sources/DdSdkNativeInitialization.swift +218 -0
  37. package/ios/Sources/DdTraceImplementation.swift +3 -1
  38. package/ios/Sources/GlobalState.swift +1 -1
  39. package/ios/Sources/JSONFileReader.swift +28 -0
  40. package/ios/Sources/RNDdSdkConfiguration.swift +227 -9
  41. package/ios/Sources/SdkVersion.swift +10 -0
  42. package/lib/commonjs/DdSdkReactNative.js +24 -66
  43. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  44. package/lib/commonjs/DdSdkReactNativeConfiguration.js +24 -4
  45. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  46. package/lib/commonjs/ProxyConfiguration.js +15 -2
  47. package/lib/commonjs/ProxyConfiguration.js.map +1 -1
  48. package/lib/commonjs/index.js +8 -0
  49. package/lib/commonjs/index.js.map +1 -1
  50. package/lib/commonjs/nativeModulesTypes.js +2 -2
  51. package/lib/commonjs/nativeModulesTypes.js.map +1 -1
  52. package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  53. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js +214 -0
  54. package/lib/commonjs/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
  55. package/lib/commonjs/types.js +10 -2
  56. package/lib/commonjs/types.js.map +1 -1
  57. package/lib/commonjs/version.js +1 -1
  58. package/lib/commonjs/version.js.map +1 -1
  59. package/lib/module/DdSdkReactNative.js +23 -65
  60. package/lib/module/DdSdkReactNative.js.map +1 -1
  61. package/lib/module/DdSdkReactNativeConfiguration.js +22 -4
  62. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  63. package/lib/module/ProxyConfiguration.js +15 -2
  64. package/lib/module/ProxyConfiguration.js.map +1 -1
  65. package/lib/module/index.js +2 -1
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/nativeModulesTypes.js +2 -2
  68. package/lib/module/nativeModulesTypes.js.map +1 -1
  69. package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
  70. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js +197 -0
  71. package/lib/module/sdk/FileBasedConfiguration/FileBasedConfiguration.js.map +1 -0
  72. package/lib/module/types.js +10 -2
  73. package/lib/module/types.js.map +1 -1
  74. package/lib/module/version.js +1 -1
  75. package/lib/module/version.js.map +1 -1
  76. package/lib/typescript/DdSdkReactNative.d.ts +0 -9
  77. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +43 -3
  78. package/lib/typescript/ProxyConfiguration.d.ts +4 -12
  79. package/lib/typescript/index.d.ts +2 -1
  80. package/lib/typescript/nativeModulesTypes.d.ts +2 -2
  81. package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -1
  82. package/lib/typescript/sdk/FileBasedConfiguration/FileBasedConfiguration.d.ts +31 -0
  83. package/lib/typescript/types.d.ts +29 -3
  84. package/lib/typescript/version.d.ts +1 -1
  85. package/package.json +7 -4
  86. package/src/DdSdkReactNative.tsx +58 -101
  87. package/src/DdSdkReactNativeConfiguration.tsx +26 -7
  88. package/src/ProxyConfiguration.tsx +17 -3
  89. package/src/__tests__/DdSdkReactNative.test.tsx +134 -112
  90. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +19 -10
  91. package/src/__tests__/mock.test.ts +0 -9
  92. package/src/index.tsx +2 -0
  93. package/src/nativeModulesTypes.ts +1 -1
  94. package/src/sdk/DatadogProvider/DatadogProvider.tsx +3 -1
  95. package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +12 -5
  96. package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -2
  97. package/src/sdk/FileBasedConfiguration/FileBasedConfiguration.ts +235 -0
  98. package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +245 -0
  99. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/configuration-all-fields.json +22 -0
  100. package/src/sdk/FileBasedConfiguration/__tests__/__fixtures__/malformed-configuration.json +5 -0
  101. package/src/types.tsx +21 -2
  102. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["DatadogProvider.tsx"],"names":["React","DatadogProviderConfiguration","DdSdkReactNativeConfiguration","DdSdkReactNative","InternalLog","SdkVerbosity","isInitialized","isConfigurationPartial","configuration","console","warn","initializeDatadog","onInitialization","_initializeFromDatadogProvider","error","log","WARN","DatadogProvider","children","_enableFeaturesFromDatadogProvider","initialize","_initializeFromDatadogProviderWithConfigurationAsync","__internalResetIsInitializedForTesting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SACIC,4BADJ,EAEIC,6BAFJ,QAGO,qCAHP;AAQA,SAASC,gBAAT,QAAiC,wBAAjC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA,IAAIC,aAAa,GAAG,KAApB;;AAwBA,MAAMC,sBAAsB,GACxBC,aAD2B,IAIyB;AACpD,MAAIA,aAAa,YAAYP,4BAA7B,EAA2D;AACvD,WAAO,KAAP;AACH;;AACD,MAAIO,aAAa,YAAYN,6BAA7B,EA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B;AACH,CAFM","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 */\nimport React from 'react';\nimport type { PropsWithChildren } from 'react';\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport type {\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from '../../DdSdkReactNative';\nimport { InternalLog } from '../../InternalLog';\nimport { SdkVerbosity } from '../../SdkVerbosity';\n\nlet isInitialized = false;\n\ntype Props = PropsWithChildren<{\n /**\n * If a `DatadogProviderConfiguration` instance is passed, the SDK will start tracking errors, resources and actions and sending events.\n *\n * If a `AutoInstrumentationConfiguration` object is passed, the SDK will start tracking errors, resources and actions. To start sending events, call `DatadogProvider.initialize`.\n */\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration;\n /**\n * Callback to be run once the SDK starts sending events.\n */\n onInitialization?: () => void;\n}>;\n\ntype StaticProperties = {\n initialize: (\n configuration: PartialInitializationConfiguration\n ) => Promise<void>;\n onInitialization?: () => void;\n};\n\nconst isConfigurationPartial = (\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration\n): configuration is AutoInstrumentationConfiguration => {\n if (configuration instanceof DatadogProviderConfiguration) {\n return false;\n }\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n // Not using InternalLog here as it is not yet instantiated\n console.warn(\n 'A DdSdkReactNativeConfiguration was passed to DatadogProvider. Please use DatadogProviderConfiguration instead.'\n );\n return false;\n }\n return true;\n};\n\nconst initializeDatadog = async (\n configuration: DatadogProviderConfiguration,\n onInitialization?: () => void\n) => {\n await DdSdkReactNative._initializeFromDatadogProvider(configuration);\n if (onInitialization) {\n try {\n onInitialization();\n } catch (error) {\n InternalLog.log(\n `Error running onInitialization callback ${error}`,\n SdkVerbosity.WARN\n );\n }\n }\n};\n\n/**\n * Set up the Datadog React Native SDK.\n */\nexport const DatadogProvider: React.FC<Props> & StaticProperties = ({\n children,\n configuration,\n onInitialization\n}) => {\n if (!isInitialized) {\n // Here we cannot use a useEffect hook since it would be called after\n // the first render. Thus, we wouldn't enable auto-instrumentation on\n // the elements rendered in this first render and what happens during\n // the first render.\n if (isConfigurationPartial(configuration)) {\n DdSdkReactNative._enableFeaturesFromDatadogProvider(configuration);\n DatadogProvider.onInitialization = onInitialization;\n } else {\n initializeDatadog(configuration, onInitialization);\n }\n isInitialized = true;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Initialize the Datadog SDK to start sending RUM events, logs and traces,\n * then execute onInitialization callback if any was provided.\n */\nDatadogProvider.initialize = async (\n configuration: PartialInitializationConfiguration\n) => {\n await DdSdkReactNative._initializeFromDatadogProviderWithConfigurationAsync(\n configuration\n );\n if (DatadogProvider.onInitialization) {\n DatadogProvider.onInitialization();\n }\n};\n\nexport const __internalResetIsInitializedForTesting = () => {\n isInitialized = false;\n};\n"]}
1
+ {"version":3,"sources":["DatadogProvider.tsx"],"names":["React","DatadogProviderConfiguration","DdSdkReactNativeConfiguration","DdSdkReactNative","InternalLog","SdkVerbosity","isInitialized","isConfigurationPartial","configuration","console","warn","initializeDatadog","onInitialization","_initializeFromDatadogProvider","error","log","WARN","DatadogProvider","children","_enableFeaturesFromDatadogProvider","initialize","_initializeFromDatadogProviderWithConfigurationAsync","__internalResetIsInitializedForTesting"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AAGA,SACIC,4BADJ,EAEIC,6BAFJ,QAGO,qCAHP;AAQA,SAASC,gBAAT,QAAiC,wBAAjC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAGA,IAAIC,aAAa,GAAG,KAApB;;AAyBA,MAAMC,sBAAsB,GACxBC,aAD2B,IAIyB;A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ACL,gBAAhB;AACH;AACJ,CATD;;AAWA,OAAO,MAAMU,sCAAsC,GAAG,MAAM;AACxDhB,EAAAA,aAAa,GAAG,KAAhB;AACH,CAFM","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 */\nimport React from 'react';\nimport type { PropsWithChildren } from 'react';\n\nimport {\n DatadogProviderConfiguration,\n DdSdkReactNativeConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport type {\n PartialInitializationConfiguration,\n AutoInstrumentationConfiguration\n} from '../../DdSdkReactNativeConfiguration';\nimport { DdSdkReactNative } from '../../DdSdkReactNative';\nimport { InternalLog } from '../../InternalLog';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport type { FileBasedConfiguration } from '../FileBasedConfiguration/FileBasedConfiguration';\n\nlet isInitialized = false;\n\ntype Props = PropsWithChildren<{\n /**\n * If a `DatadogProviderConfiguration` instance is passed, the SDK will start tracking errors, resources and actions and sending events.\n *\n * If a `AutoInstrumentationConfiguration` object is passed, the SDK will start tracking errors, resources and actions. To start sending events, call `DatadogProvider.initialize`.\n */\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration\n | FileBasedConfiguration;\n /**\n * Callback to be run once the SDK starts sending events.\n */\n onInitialization?: () => void;\n}>;\n\ntype StaticProperties = {\n initialize: (\n configuration: PartialInitializationConfiguration\n ) => Promise<void>;\n onInitialization?: () => void;\n};\n\nconst isConfigurationPartial = (\n configuration:\n | DatadogProviderConfiguration\n | AutoInstrumentationConfiguration\n): configuration is AutoInstrumentationConfiguration => {\n if (configuration instanceof DatadogProviderConfiguration) {\n return false;\n }\n if (configuration instanceof DdSdkReactNativeConfiguration) {\n // Not using InternalLog here as it is not yet instantiated\n console.warn(\n 'A DdSdkReactNativeConfiguration was passed to DatadogProvider. Please use DatadogProviderConfiguration instead.'\n );\n return false;\n }\n return true;\n};\n\nconst initializeDatadog = async (\n configuration: DatadogProviderConfiguration,\n onInitialization?: () => void\n) => {\n await DdSdkReactNative._initializeFromDatadogProvider(configuration);\n if (onInitialization) {\n try {\n onInitialization();\n } catch (error) {\n InternalLog.log(\n `Error running onInitialization callback ${error}`,\n SdkVerbosity.WARN\n );\n }\n }\n};\n\n/**\n * Set up the Datadog React Native SDK.\n */\nexport const DatadogProvider: React.FC<Props> & StaticProperties = ({\n children,\n configuration,\n onInitialization\n}) => {\n if (!isInitialized) {\n // Here we cannot use a useEffect hook since it would be called after\n // the first render. Thus, we wouldn't enable auto-instrumentation on\n // the elements rendered in this first render and what happens during\n // the first render.\n if (isConfigurationPartial(configuration)) {\n DdSdkReactNative._enableFeaturesFromDatadogProvider(configuration);\n DatadogProvider.onInitialization = onInitialization;\n } else {\n initializeDatadog(configuration, onInitialization);\n }\n isInitialized = true;\n }\n\n return <>{children}</>;\n};\n\n/**\n * Initialize the Datadog SDK to start sending RUM events, logs and traces,\n * then execute onInitialization callback if any was provided.\n */\nDatadogProvider.initialize = async (\n configuration: PartialInitializationConfiguration\n) => {\n await DdSdkReactNative._initializeFromDatadogProviderWithConfigurationAsync(\n configuration\n );\n if (DatadogProvider.onInitialization) {\n DatadogProvider.onInitialization();\n }\n};\n\nexport const __internalResetIsInitializedForTesting = () => {\n isInitialized = false;\n};\n"]}
@@ -0,0 +1,197 @@
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
+ import { DatadogProviderConfiguration, DEFAULTS } from '../../DdSdkReactNativeConfiguration';
7
+ import { SdkVerbosity } from '../../SdkVerbosity';
8
+ import { TrackingConsent } from '../../TrackingConsent';
9
+ import { PropagatorType } from '../../rum/types';
10
+ export class FileBasedConfiguration extends DatadogProviderConfiguration {
11
+ constructor(params) {
12
+ const configuration = getJSONConfiguration(params === null || params === void 0 ? void 0 : params.configuration);
13
+ super(configuration.clientToken, configuration.env, configuration.applicationId, configuration.trackInteractions, configuration.trackResources, configuration.trackErrors, configuration.trackingConsent);
14
+ this.longTaskThresholdMs = configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;
15
+ this.verbosity = configuration.verbosity;
16
+ this.actionNameAttribute = configuration.actionNameAttribute;
17
+ this.resourceTracingSamplingRate = configuration.resourceTracingSamplingRate || DEFAULTS.resourceTracingSamplingRate;
18
+ this.firstPartyHosts = configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();
19
+ this.errorEventMapper = (params === null || params === void 0 ? void 0 : params.errorEventMapper) || DEFAULTS.errorEventMapper;
20
+ this.resourceEventMapper = (params === null || params === void 0 ? void 0 : params.resourceEventMapper) || DEFAULTS.resourceEventMapper;
21
+ this.actionEventMapper = (params === null || params === void 0 ? void 0 : params.actionEventMapper) || DEFAULTS.actionEventMapper;
22
+ }
23
+
24
+ }
25
+
26
+ const resolveJSONConfiguration = userSpecifiedConfiguration => {
27
+ if (userSpecifiedConfiguration === undefined || userSpecifiedConfiguration === null) {
28
+ try {
29
+ // This corresponds to a file located at the root of a RN project.
30
+ // /!\ We have to write the require this way as dynamic requires are not supported by Hermes.
31
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
32
+ const jsonContent = require('../../../../../../datadog-configuration.json');
33
+
34
+ if (typeof jsonContent !== 'object' || !jsonContent['configuration']) {
35
+ console.error(`Failed to parse the Datadog configuration file located at the root of the project.
36
+ Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
37
+ You can use VSCode to check your configuration by adding the following line to your JSON file:
38
+ {
39
+ "$schema": "./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json",
40
+ }`);
41
+ return {};
42
+ }
43
+
44
+ return jsonContent.configuration;
45
+ } catch (error) {
46
+ console.error(`Failed to read Datadog configuration file at the root of the project.
47
+ If you don't have a datadog-configuration.json file at the same level as your node_modules directory,\
48
+ please use the following syntax:\n
49
+ new FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})
50
+ `);
51
+ return {};
52
+ }
53
+ }
54
+
55
+ if (typeof userSpecifiedConfiguration !== 'object' || !userSpecifiedConfiguration['configuration']) {
56
+ console.error(`Failed to parse the Datadog configuration file you provided.
57
+ Your configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.
58
+ You can use VSCode to check your configuration by adding the following line to your JSON file:
59
+ {
60
+ "$schema": "./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json",
61
+ }`);
62
+ return {};
63
+ }
64
+
65
+ return userSpecifiedConfiguration['configuration'];
66
+ };
67
+
68
+ export const getJSONConfiguration = userSpecifiedConfiguration => {
69
+ const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);
70
+ return {
71
+ clientToken: configuration.clientToken,
72
+ env: configuration.env,
73
+ applicationId: configuration.applicationId,
74
+ trackInteractions: configuration.trackInteractions,
75
+ trackResources: configuration.trackResources,
76
+ trackErrors: configuration.trackErrors,
77
+ trackingConsent: buildTrackingConsent(configuration.trackingConsent),
78
+ longTaskThresholdMs: configuration.longTaskThresholdMs,
79
+ verbosity: buildSdkVerbosity(configuration.verbosity),
80
+ actionNameAttribute: configuration.actionNameAttribute,
81
+ resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,
82
+ firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)
83
+ };
84
+ };
85
+
86
+ const buildFirstPartyHosts = firstPartyHosts => {
87
+ if (!firstPartyHosts) {
88
+ return undefined;
89
+ }
90
+
91
+ try {
92
+ return firstPartyHosts.map(({
93
+ match,
94
+ propagatorTypes
95
+ }) => ({
96
+ match,
97
+ propagatorTypes: propagatorTypes.map(formatPropagatorType)
98
+ }));
99
+ } catch (error) {
100
+ console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:
101
+ ${error.message}
102
+ The first party hosts will not be set for this session.
103
+ `);
104
+ return undefined;
105
+ }
106
+ };
107
+
108
+ export const formatPropagatorType = propagatorType => {
109
+ switch (propagatorType.toLowerCase()) {
110
+ case 'b3':
111
+ {
112
+ return PropagatorType.B3;
113
+ }
114
+
115
+ case 'b3multi':
116
+ {
117
+ return PropagatorType.B3MULTI;
118
+ }
119
+
120
+ case 'datadog':
121
+ {
122
+ return PropagatorType.DATADOG;
123
+ }
124
+
125
+ case 'tracecontext':
126
+ {
127
+ return PropagatorType.TRACECONTEXT;
128
+ }
129
+
130
+ default:
131
+ {
132
+ throw new Error(`Failed to parse propagator type ${propagatorType}.`);
133
+ }
134
+ }
135
+ };
136
+
137
+ const buildTrackingConsent = trackingConsent => {
138
+ if (trackingConsent === undefined) {
139
+ return undefined;
140
+ }
141
+
142
+ switch (trackingConsent.toLowerCase()) {
143
+ case 'granted':
144
+ {
145
+ return TrackingConsent.GRANTED;
146
+ }
147
+
148
+ case 'pending':
149
+ {
150
+ return TrackingConsent.PENDING;
151
+ }
152
+
153
+ case 'not_granted':
154
+ {
155
+ return TrackingConsent.NOT_GRANTED;
156
+ }
157
+
158
+ default:
159
+ {
160
+ return DEFAULTS.trackingConsent;
161
+ }
162
+ }
163
+ };
164
+
165
+ const buildSdkVerbosity = verbosity => {
166
+ if (verbosity === undefined) {
167
+ return undefined;
168
+ }
169
+
170
+ switch (verbosity.toLowerCase()) {
171
+ case 'debug':
172
+ {
173
+ return SdkVerbosity.DEBUG;
174
+ }
175
+
176
+ case 'info':
177
+ {
178
+ return SdkVerbosity.INFO;
179
+ }
180
+
181
+ case 'warn':
182
+ {
183
+ return SdkVerbosity.WARN;
184
+ }
185
+
186
+ case 'error':
187
+ {
188
+ return SdkVerbosity.ERROR;
189
+ }
190
+
191
+ default:
192
+ {
193
+ return undefined;
194
+ }
195
+ }
196
+ };
197
+ //# sourceMappingURL=FileBasedConfiguration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["FileBasedConfiguration.ts"],"names":["DatadogProviderConfiguration","DEFAULTS","SdkVerbosity","TrackingConsent","PropagatorType","FileBasedConfiguration","constructor","params","configuration","getJSONConfiguration","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","trackingConsent","longTaskThresholdMs","verbosity","actionNameAttribute","resourceTracingSamplingRate","firstPartyHosts","getFirstPartyHosts","errorEventMapper","resourceEventMapper","actionEventMapper","resolveJSONConfiguration","userSpecifiedConfiguration","undefined","jsonContent","require","console","error","buildTrackingConsent","buildSdkVerbosity","buildFirstPartyHosts","map","match","propagatorTypes","formatPropagatorType","message","propagatorType","toLowerCase","B3","B3MULTI","DATADOG","TRACECONTEXT","Error","GRANTED","PENDING","NOT_GRANTED","DEBUG","INFO","WARN","ERROR"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAGA,SACIA,4BADJ,EAEIC,QAFJ,QAGO,qCAHP;AAIA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,eAAT,QAAgC,uBAAhC;AAIA,SAASC,cAAT,QAA+B,iBAA/B;AAEA,OAAO,MAAMC,sBAAN,SAAqCL,4BAArC,CAAkE;AACrEM,EAAAA,WAAW,CAACC,MAAD,EAKR;AACC,UAAMC,aAAa,GAAGC,oBAAoB,CAACF,MAAD,aAACA,MAAD,uBAACA,MAAM,CAAEC,aAAT,CAA1C;AACA,UACIA,aAAa,CAACE,WADlB,EAEIF,aAAa,CAACG,GAFlB,EAGIH,aAAa,CAACI,aAHlB,EAIIJ,aAAa,CAACK,iBAJlB,EAKIL,aAAa,CAACM,cALlB,EAMIN,aAAa,CAACO,WANlB,EAOIP,aAAa,CAACQ,eAPlB;AASA,SAAKC,mBAAL,GACIT,aAAa,CAACS,mBAAd,IAAqChB,QAAQ,CAACgB,mBADlD;AAEA,SAAKC,SAAL,GAAiBV,aAAa,CAACU,SAA/B;AACA,SAAKC,mBAAL,GAA2BX,aAAa,CAACW,mBAAzC;AACA,SAAKC,2BAAL,GACIZ,aAAa,CAACY,2BAAd,IACAnB,QAAQ,CAACmB,2BAFb;AAGA,SAAKC,eAAL,GACIb,aAAa,CAACa,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eAAOnD,YAAY,CAACoD,KAApB;AACH;;AACD;AAAS;AACL,eAAO1B,SAAP;AACH;AAfL;AAiBH,CAvBD","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\nimport type { FirstPartyHostsConfiguration } from '../../DdSdkReactNativeConfiguration';\nimport {\n DatadogProviderConfiguration,\n DEFAULTS\n} from '../../DdSdkReactNativeConfiguration';\nimport { SdkVerbosity } from '../../SdkVerbosity';\nimport { TrackingConsent } from '../../TrackingConsent';\nimport type { ActionEventMapper } from '../../rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from '../../rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMapper';\nimport { PropagatorType } from '../../rum/types';\n\nexport class FileBasedConfiguration extends DatadogProviderConfiguration {\n constructor(params?: {\n configuration?: unknown;\n errorEventMapper?: ErrorEventMapper;\n resourceEventMapper?: ResourceEventMapper;\n actionEventMapper?: ActionEventMapper;\n }) {\n const configuration = getJSONConfiguration(params?.configuration);\n super(\n configuration.clientToken,\n configuration.env,\n configuration.applicationId,\n configuration.trackInteractions,\n configuration.trackResources,\n configuration.trackErrors,\n configuration.trackingConsent\n );\n this.longTaskThresholdMs =\n configuration.longTaskThresholdMs || DEFAULTS.longTaskThresholdMs;\n this.verbosity = configuration.verbosity;\n this.actionNameAttribute = configuration.actionNameAttribute;\n this.resourceTracingSamplingRate =\n configuration.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate;\n this.firstPartyHosts =\n configuration.firstPartyHosts || DEFAULTS.getFirstPartyHosts();\n this.errorEventMapper =\n params?.errorEventMapper || DEFAULTS.errorEventMapper;\n this.resourceEventMapper =\n params?.resourceEventMapper || DEFAULTS.resourceEventMapper;\n this.actionEventMapper =\n params?.actionEventMapper || DEFAULTS.actionEventMapper;\n }\n}\n\nconst resolveJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): Record<string, any> => {\n if (\n userSpecifiedConfiguration === undefined ||\n userSpecifiedConfiguration === null\n ) {\n try {\n // This corresponds to a file located at the root of a RN project.\n // /!\\ We have to write the require this way as dynamic requires are not supported by Hermes.\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsonContent = require('../../../../../../datadog-configuration.json');\n\n if (\n typeof jsonContent !== 'object' ||\n !jsonContent['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file located at the root of the project.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return jsonContent.configuration as Record<string, any>;\n } catch (error) {\n console.error(`Failed to read Datadog configuration file at the root of the project.\nIf you don't have a datadog-configuration.json file at the same level as your node_modules directory,\\\nplease use the following syntax:\\n\nnew FileBasedConfiguration({configuration: require('./file/to/configuration-file.json')})\n`);\n return {};\n }\n }\n if (\n typeof userSpecifiedConfiguration !== 'object' ||\n !(userSpecifiedConfiguration as any)['configuration']\n ) {\n console.error(`Failed to parse the Datadog configuration file you provided.\nYour configuration must validate the node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json JSON schema.\nYou can use VSCode to check your configuration by adding the following line to your JSON file:\n{\n \"$schema\": \"./node_modules/@datadog/mobile-react-native/datadog-configuration.schema.json\",\n}`);\n\n return {};\n }\n\n return (userSpecifiedConfiguration as any)['configuration'] as Record<\n string,\n any\n >;\n};\n\nexport const getJSONConfiguration = (\n userSpecifiedConfiguration: unknown\n): {\n clientToken: string;\n env: string;\n applicationId: string;\n trackInteractions: boolean | undefined;\n trackResources: boolean | undefined;\n trackErrors: boolean | undefined;\n trackingConsent: TrackingConsent | undefined;\n longTaskThresholdMs: number | undefined;\n verbosity: SdkVerbosity | undefined;\n actionNameAttribute: string | undefined;\n resourceTracingSamplingRate: number | undefined;\n firstPartyHosts: FirstPartyHostsConfiguration | undefined;\n} => {\n const configuration = resolveJSONConfiguration(userSpecifiedConfiguration);\n\n return {\n clientToken: configuration.clientToken,\n env: configuration.env,\n applicationId: configuration.applicationId,\n trackInteractions: configuration.trackInteractions,\n trackResources: configuration.trackResources,\n trackErrors: configuration.trackErrors,\n trackingConsent: buildTrackingConsent(configuration.trackingConsent),\n longTaskThresholdMs: configuration.longTaskThresholdMs,\n verbosity: buildSdkVerbosity(configuration.verbosity),\n actionNameAttribute: configuration.actionNameAttribute,\n resourceTracingSamplingRate: configuration.resourceTracingSamplingRate,\n firstPartyHosts: buildFirstPartyHosts(configuration.firstPartyHosts)\n };\n};\n\nconst buildFirstPartyHosts = (\n firstPartyHosts: { match: string; propagatorTypes: string[] }[] | undefined\n): FirstPartyHostsConfiguration | undefined => {\n if (!firstPartyHosts) {\n return undefined;\n }\n\n try {\n return firstPartyHosts.map(({ match, propagatorTypes }) => ({\n match,\n propagatorTypes: propagatorTypes.map(formatPropagatorType)\n }));\n } catch (error) {\n console.error(`Failed to parse the first party hosts from the Datadog configuration file you provided:\n${(error as any).message}\nThe first party hosts will not be set for this session.\n`);\n return undefined;\n }\n};\n\nexport const formatPropagatorType = (\n propagatorType: string\n): PropagatorType => {\n switch (propagatorType.toLowerCase()) {\n case 'b3': {\n return PropagatorType.B3;\n }\n case 'b3multi': {\n return PropagatorType.B3MULTI;\n }\n case 'datadog': {\n return PropagatorType.DATADOG;\n }\n case 'tracecontext': {\n return PropagatorType.TRACECONTEXT;\n }\n default: {\n throw new Error(\n `Failed to parse propagator type ${propagatorType}.`\n );\n }\n }\n};\n\nconst buildTrackingConsent = (\n trackingConsent: string | undefined\n): TrackingConsent | undefined => {\n if (trackingConsent === undefined) {\n return undefined;\n }\n switch (trackingConsent.toLowerCase()) {\n case 'granted': {\n return TrackingConsent.GRANTED;\n }\n case 'pending': {\n return TrackingConsent.PENDING;\n }\n case 'not_granted': {\n return TrackingConsent.NOT_GRANTED;\n }\n default: {\n return DEFAULTS.trackingConsent;\n }\n }\n};\n\nconst buildSdkVerbosity = (\n verbosity: string | undefined\n): SdkVerbosity | undefined => {\n if (verbosity === undefined) {\n return undefined;\n }\n switch (verbosity.toLowerCase()) {\n case 'debug': {\n return SdkVerbosity.DEBUG;\n }\n case 'info': {\n return SdkVerbosity.INFO;\n }\n case 'warn': {\n return SdkVerbosity.WARN;\n }\n case 'error': {\n return SdkVerbosity.ERROR;\n }\n default: {\n return undefined;\n }\n }\n};\n"]}
@@ -8,7 +8,7 @@
8
8
  * A configuration object to initialize Datadog's features.
9
9
  */
10
10
  export class DdSdkConfiguration {
11
- constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate, vitalsUpdateFrequency, uploadFrequency, batchSize, trackFrustrations, trackBackgroundEvents, customEndpoints, configurationForTelemetry) {
11
+ constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfiguration, telemetrySampleRate, vitalsUpdateFrequency, uploadFrequency, batchSize, trackFrustrations, trackBackgroundEvents, customEndpoints, configurationForTelemetry, nativeViewTracking, nativeInteractionTracking, verbosity, proxyConfig, serviceName, firstPartyHosts, bundleLogsWithRum, bundleLogsWithTraces) {
12
12
  this.clientToken = clientToken;
13
13
  this.env = env;
14
14
  this.applicationId = applicationId;
@@ -18,7 +18,7 @@ export class DdSdkConfiguration {
18
18
  this.sampleRate = sampleRate;
19
19
  this.site = site;
20
20
  this.trackingConsent = trackingConsent;
21
- this.additionalConfig = additionalConfig;
21
+ this.additionalConfiguration = additionalConfiguration;
22
22
  this.telemetrySampleRate = telemetrySampleRate;
23
23
  this.vitalsUpdateFrequency = vitalsUpdateFrequency;
24
24
  this.uploadFrequency = uploadFrequency;
@@ -27,6 +27,14 @@ export class DdSdkConfiguration {
27
27
  this.trackBackgroundEvents = trackBackgroundEvents;
28
28
  this.customEndpoints = customEndpoints;
29
29
  this.configurationForTelemetry = configurationForTelemetry;
30
+ this.nativeViewTracking = nativeViewTracking;
31
+ this.nativeInteractionTracking = nativeInteractionTracking;
32
+ this.verbosity = verbosity;
33
+ this.proxyConfig = proxyConfig;
34
+ this.serviceName = serviceName;
35
+ this.firstPartyHosts = firstPartyHosts;
36
+ this.bundleLogsWithRum = bundleLogsWithRum;
37
+ this.bundleLogsWithTraces = bundleLogsWithTraces;
30
38
  }
31
39
 
32
40
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,gBAVF,EAWEC,mBAXF,EAYEC,qBAZF,EAaEC,eAbF,EAcEC,SAdF,EAeEC,iBAfF,EAgBEC,qBAhBF,EAiBEC,eAjBF,EAsBEC,yBAtBF,EA8BT;AAAA,SA7BWjB,WA6BX,GA7BWA,WA6BX;AAAA,SA5BWC,GA4BX,GA5BWA,GA4BX;AAAA,SA3BWC,aA2BX,GA3BWA,aA2BX;AAAA,SA1BWC,wBA0BX,GA1BWA,wBA0BX;AAAA,SAzBWC,yBAyBX,GAzBWA,yBAyBX;AAAA,SAxBWC,mBAwBX,GAxBWA,mBAwBX;AAAA,SAvBWC,UAuBX,GAvBWA,UAuBX;AAAA,SAtBWC,IAsBX,GAtBWA,IAsBX;AAAA,SArBWC,eAqBX,GArBWA,eAqBX;AAAA,SApBWC,gBAoBX,GApBWA,gBAoBX;AAAA,SAnBWC,mBAmBX,GAnBWA,mBAmBX;AAAA,SAlBWC,qBAkBX,GAlBWA,qBAkBX;AAAA,SAjBWC,eAiBX,GAjBWA,eAiBX;AAAA,SAhBWC,SAgBX,GAhBWA,SAgBX;AAAA,SAfWC,iBAeX,GAfWA,iBAeX;AAAA,SAdWC,qBAcX,GAdWA,qBAcX;AAAA,SAbWC,eAaX,GAbWA,eAaX;AAAA,SARWC,yBAQX,GARWA,yBAQX;AAAE;;AA/BwB;AAkChC;AACA;AACA","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 * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly uploadFrequency: string,\n readonly batchSize: string,\n readonly trackFrustrations: boolean,\n readonly trackBackgroundEvents: boolean,\n readonly customEndpoints: {\n rum?: string;\n trace?: string;\n logs?: string;\n },\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n reactVersion: string;\n reactNativeVersion: string;\n }\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
1
+ {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfiguration","telemetrySampleRate","vitalsUpdateFrequency","uploadFrequency","batchSize","trackFrustrations","trackBackgroundEvents","customEndpoints","configurationForTelemetry","nativeViewTracking","nativeInteractionTracking","verbosity","proxyConfig","serviceName","firstPartyHosts","bundleLogsWithRum","bundleLogsWithTraces"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO,MAAMA,kBAAN,CAAyB;AAC5BC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,yBALF,EAMEC,mBANF,EAOEC,UAPF,EAQEC,IARF,EASEC,eATF,EAUEC,uBAVF,EAWEC,mBAX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AqDhC;AACA;AACA","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 * A configuration object to initialize Datadog's features.\n */\nexport class DdSdkConfiguration {\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly nativeCrashReportEnabled: boolean,\n readonly nativeLongTaskThresholdMs: number,\n readonly longTaskThresholdMs: number,\n readonly sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfiguration: object,\n readonly telemetrySampleRate: number,\n readonly vitalsUpdateFrequency: string,\n readonly uploadFrequency: string,\n readonly batchSize: string,\n readonly trackFrustrations: boolean,\n readonly trackBackgroundEvents: boolean,\n readonly customEndpoints: {\n rum?: string;\n trace?: string;\n logs?: string;\n },\n readonly configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\n reactVersion: string;\n reactNativeVersion: string;\n },\n readonly nativeViewTracking: boolean,\n readonly nativeInteractionTracking: boolean,\n readonly verbosity: string | undefined,\n readonly proxyConfig:\n | {\n type: string;\n address: string;\n port: number;\n username?: string;\n password?: string;\n }\n | undefined,\n readonly serviceName: string | undefined,\n readonly firstPartyHosts: {\n match: string;\n propagatorTypes: string[];\n }[],\n readonly bundleLogsWithRum: boolean,\n readonly bundleLogsWithTraces: boolean\n ) {}\n}\n\n/**\n * The entry point to initialize Datadog's features.\n */\nexport type DdSdkType = {\n /**\n * Initializes Datadog's features.\n * @param configuration: The configuration to use.\n */\n initialize(configuration: DdSdkConfiguration): Promise<void>;\n\n /**\n * Sets the global context (set of attributes) attached with all future Logs, Spans and RUM events.\n * @param attributes: The global context attributes.\n */\n setAttributes(attributes: object): Promise<void>;\n\n /**\n * Set the user information.\n * @param user: The user object (use builtin attributes: 'id', 'email', 'name', and/or any custom attribute).\n */\n setUser(user: object): Promise<void>;\n\n /**\n * Set the tracking consent regarding the data collection.\n * @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.\n */\n setTrackingConsent(trackingConsent: string): Promise<void>;\n};\n\n/**\n * The entry point to use Datadog's Trace feature.\n */\nexport type DdTraceType = {\n /**\n * Start a span, and returns a unique identifier for the span.\n * @param operation: The operation name of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation started (in milliseconds). If not provided, current timestamp will be used.\n */\n startSpan(\n operation: string,\n context?: object,\n timestampMs?: number\n ): Promise<string>;\n\n /**\n * Finish a started span.\n * @param spanId: The unique identifier of the span.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the operation stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n finishSpan(\n spanId: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n};\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '2.2.0';
2
+ export const version = '2.3.1';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.2.0';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '2.3.1';\n"]}
@@ -9,17 +9,8 @@ import type { UserInfo } from './sdk/UserInfoSingleton/types';
9
9
  export declare class DdSdkReactNative {
10
10
  private static readonly DD_SOURCE_KEY;
11
11
  private static readonly DD_SDK_VERSION;
12
- private static readonly DD_SERVICE_NAME;
13
- private static readonly DD_SDK_VERBOSITY_KEY;
14
- private static readonly DD_NATIVE_VIEW_TRACKING_KEY;
15
- private static readonly DD_NATIVE_INTERACTION_TRACKING_KEY;
16
12
  private static readonly DD_VERSION;
17
13
  private static readonly DD_VERSION_SUFFIX;
18
- private static readonly DD_PROXY_TYPE_KEY;
19
- private static readonly DD_PROXY_ADDRESS_KEY;
20
- private static readonly DD_PROXY_PORT_KEY;
21
- private static readonly DD_PROXY_USERNAME_KEY;
22
- private static readonly DD_PROXY_PASSWORD_KEY;
23
14
  private static wasInitialized;
24
15
  private static wasAutoInstrumented;
25
16
  private static features?;
@@ -52,6 +52,32 @@ export declare type CustomEndpoints = {
52
52
  * retro-compatibility before OTel support was introduced.
53
53
  */
54
54
  export declare const formatFirstPartyHosts: (firstPartyHosts: FirstPartyHostsConfiguration) => FirstPartyHost[];
55
+ export declare const DEFAULTS: {
56
+ nativeCrashReportEnabled: boolean;
57
+ sessionSamplingRate: number;
58
+ resourceTracingSamplingRate: number;
59
+ site: string;
60
+ longTaskThresholdMs: number;
61
+ nativeLongTaskThresholdMs: number;
62
+ nativeViewTracking: boolean;
63
+ nativeInteractionTracking: boolean;
64
+ getFirstPartyHosts: () => never[];
65
+ getAdditionalConfiguration: () => {};
66
+ trackingConsent: TrackingConsent;
67
+ telemetrySampleRate: number;
68
+ vitalsUpdateFrequency: VitalsUpdateFrequency;
69
+ logEventMapper: null;
70
+ errorEventMapper: null;
71
+ resourceEventMapper: null;
72
+ actionEventMapper: null;
73
+ trackFrustrations: boolean;
74
+ uploadFrequency: UploadFrequency;
75
+ batchSize: BatchSize;
76
+ trackBackgroundEvents: boolean;
77
+ getCustomEndpoints: () => {};
78
+ bundleLogsWithRum: boolean;
79
+ bundleLogsWithTraces: boolean;
80
+ };
55
81
  /**
56
82
  * The SDK configuration class.
57
83
  * It will be used to configure the SDK functionality at initialization.
@@ -179,6 +205,18 @@ export declare class DdSdkReactNativeConfiguration {
179
205
  * number of sessions tracked and impact your billing.
180
206
  */
181
207
  trackBackgroundEvents: boolean;
208
+ /**
209
+ * Enables RUM correlation with logs.
210
+ *
211
+ * By default, RUM is enabled for logs.
212
+ */
213
+ bundleLogsWithRum: boolean;
214
+ /**
215
+ * Enables Traces correlation with logs.
216
+ *
217
+ * By default, Traces is enabled for logs.
218
+ */
219
+ bundleLogsWithTraces: boolean;
182
220
  /**
183
221
  * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.
184
222
  *
@@ -195,7 +233,7 @@ export declare class DdSdkReactNativeConfiguration {
195
233
  errorEventMapper: ErrorEventMapper | null;
196
234
  resourceEventMapper: ResourceEventMapper | null;
197
235
  actionEventMapper: ActionEventMapper | null;
198
- additionalConfig: {
236
+ additionalConfiguration: {
199
237
  [k: string]: any;
200
238
  };
201
239
  customEndpoints: CustomEndpoints;
@@ -250,7 +288,7 @@ export declare type PartialInitializationConfiguration = {
250
288
  readonly serviceName?: string;
251
289
  readonly version?: string;
252
290
  versionSuffix?: string;
253
- readonly additionalConfig?: {
291
+ readonly additionalConfiguration?: {
254
292
  [k: string]: any;
255
293
  };
256
294
  readonly trackingConsent?: TrackingConsent;
@@ -264,6 +302,8 @@ export declare type PartialInitializationConfiguration = {
264
302
  readonly batchSize?: BatchSize;
265
303
  readonly trackBackgroundEvents?: boolean;
266
304
  readonly customEndpoints?: CustomEndpoints;
305
+ readonly bundleLogsWithRum?: boolean;
306
+ readonly bundleLogsWithTraces?: boolean;
267
307
  };
268
308
  export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
269
309
  export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
@@ -273,4 +313,4 @@ export declare enum InitializationMode {
273
313
  SYNC = "SYNC",
274
314
  ASYNC = "ASYNC"
275
315
  }
276
- export declare type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL';
316
+ export declare type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL' | 'FILE';
@@ -14,16 +14,8 @@ declare class ProxyConfiguration {
14
14
  * Proxy port.
15
15
  */
16
16
  readonly port: number;
17
- /**
18
- * Username for Basic authentication scheme.
19
- *
20
- * Note: "SOCKS + authentication" scheme is not supported.
21
- */
22
- readonly username?: string | undefined;
23
- /**
24
- * Password for Basic authentication scheme.
25
- */
26
- readonly password?: string | undefined;
17
+ username?: string;
18
+ password?: string;
27
19
  constructor(
28
20
  /**
29
21
  * Proxy type.
@@ -42,11 +34,11 @@ declare class ProxyConfiguration {
42
34
  *
43
35
  * Note: "SOCKS + authentication" scheme is not supported.
44
36
  */
45
- username?: string | undefined,
37
+ username?: string,
46
38
  /**
47
39
  * Password for Basic authentication scheme.
48
40
  */
49
- password?: string | undefined);
41
+ password?: string);
50
42
  }
51
43
  declare enum ProxyType {
52
44
  HTTP = "http",
@@ -9,5 +9,6 @@ import { DdRum } from './rum/DdRum';
9
9
  import { DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER } from './rum/instrumentation/resourceTracking/graphql/graphqlHeaders';
10
10
  import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
11
11
  import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
12
+ import { FileBasedConfiguration } from './sdk/FileBasedConfiguration/FileBasedConfiguration';
12
13
  import { DdTrace } from './trace/DdTrace';
13
- export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType, UploadFrequency, BatchSize, DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER };
14
+ export { DatadogProvider, DatadogProviderConfiguration, FileBasedConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType, UploadFrequency, BatchSize, DATADOG_GRAPH_QL_OPERATION_TYPE_HEADER, DATADOG_GRAPH_QL_OPERATION_NAME_HEADER, DATADOG_GRAPH_QL_VARIABLES_HEADER };
@@ -25,8 +25,8 @@ export declare class DdNativeSdkConfiguration {
25
25
  readonly sampleRate: number;
26
26
  readonly site: string;
27
27
  readonly trackingConsent: string;
28
- readonly additionalConfig: object;
29
- constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object);
28
+ readonly additionalConfiguration: object;
29
+ constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, sampleRate: number, site: string, trackingConsent: string, additionalConfiguration: object);
30
30
  }
31
31
  /**
32
32
  * The entry point to initialize Datadog's features.
@@ -2,13 +2,14 @@ import React from 'react';
2
2
  import type { PropsWithChildren } from 'react';
3
3
  import { DatadogProviderConfiguration } from '../../DdSdkReactNativeConfiguration';
4
4
  import type { PartialInitializationConfiguration, AutoInstrumentationConfiguration } from '../../DdSdkReactNativeConfiguration';
5
+ import type { FileBasedConfiguration } from '../FileBasedConfiguration/FileBasedConfiguration';
5
6
  declare type Props = PropsWithChildren<{
6
7
  /**
7
8
  * If a `DatadogProviderConfiguration` instance is passed, the SDK will start tracking errors, resources and actions and sending events.
8
9
  *
9
10
  * If a `AutoInstrumentationConfiguration` object is passed, the SDK will start tracking errors, resources and actions. To start sending events, call `DatadogProvider.initialize`.
10
11
  */
11
- configuration: DatadogProviderConfiguration | AutoInstrumentationConfiguration;
12
+ configuration: DatadogProviderConfiguration | AutoInstrumentationConfiguration | FileBasedConfiguration;
12
13
  /**
13
14
  * Callback to be run once the SDK starts sending events.
14
15
  */
@@ -0,0 +1,31 @@
1
+ import type { FirstPartyHostsConfiguration } from '../../DdSdkReactNativeConfiguration';
2
+ import { DatadogProviderConfiguration } from '../../DdSdkReactNativeConfiguration';
3
+ import { SdkVerbosity } from '../../SdkVerbosity';
4
+ import { TrackingConsent } from '../../TrackingConsent';
5
+ import type { ActionEventMapper } from '../../rum/eventMappers/actionEventMapper';
6
+ import type { ErrorEventMapper } from '../../rum/eventMappers/errorEventMapper';
7
+ import type { ResourceEventMapper } from '../../rum/eventMappers/resourceEventMapper';
8
+ import { PropagatorType } from '../../rum/types';
9
+ export declare class FileBasedConfiguration extends DatadogProviderConfiguration {
10
+ constructor(params?: {
11
+ configuration?: unknown;
12
+ errorEventMapper?: ErrorEventMapper;
13
+ resourceEventMapper?: ResourceEventMapper;
14
+ actionEventMapper?: ActionEventMapper;
15
+ });
16
+ }
17
+ export declare const getJSONConfiguration: (userSpecifiedConfiguration: unknown) => {
18
+ clientToken: string;
19
+ env: string;
20
+ applicationId: string;
21
+ trackInteractions: boolean | undefined;
22
+ trackResources: boolean | undefined;
23
+ trackErrors: boolean | undefined;
24
+ trackingConsent: TrackingConsent | undefined;
25
+ longTaskThresholdMs: number | undefined;
26
+ verbosity: SdkVerbosity | undefined;
27
+ actionNameAttribute: string | undefined;
28
+ resourceTracingSamplingRate: number | undefined;
29
+ firstPartyHosts: FirstPartyHostsConfiguration | undefined;
30
+ };
31
+ export declare const formatPropagatorType: (propagatorType: string) => PropagatorType;
@@ -11,7 +11,7 @@ export declare class DdSdkConfiguration {
11
11
  readonly sampleRate: number;
12
12
  readonly site: string;
13
13
  readonly trackingConsent: string;
14
- readonly additionalConfig: object;
14
+ readonly additionalConfiguration: object;
15
15
  readonly telemetrySampleRate: number;
16
16
  readonly vitalsUpdateFrequency: string;
17
17
  readonly uploadFrequency: string;
@@ -31,7 +31,24 @@ export declare class DdSdkConfiguration {
31
31
  reactVersion: string;
32
32
  reactNativeVersion: string;
33
33
  };
34
- constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, uploadFrequency: string, batchSize: string, trackFrustrations: boolean, trackBackgroundEvents: boolean, customEndpoints: {
34
+ readonly nativeViewTracking: boolean;
35
+ readonly nativeInteractionTracking: boolean;
36
+ readonly verbosity: string | undefined;
37
+ readonly proxyConfig: {
38
+ type: string;
39
+ address: string;
40
+ port: number;
41
+ username?: string;
42
+ password?: string;
43
+ } | undefined;
44
+ readonly serviceName: string | undefined;
45
+ readonly firstPartyHosts: {
46
+ match: string;
47
+ propagatorTypes: string[];
48
+ }[];
49
+ readonly bundleLogsWithRum: boolean;
50
+ readonly bundleLogsWithTraces: boolean;
51
+ constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfiguration: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, uploadFrequency: string, batchSize: string, trackFrustrations: boolean, trackBackgroundEvents: boolean, customEndpoints: {
35
52
  rum?: string;
36
53
  trace?: string;
37
54
  logs?: string;
@@ -42,7 +59,16 @@ export declare class DdSdkConfiguration {
42
59
  trackNetworkRequests: boolean;
43
60
  reactVersion: string;
44
61
  reactNativeVersion: string;
45
- });
62
+ }, nativeViewTracking: boolean, nativeInteractionTracking: boolean, verbosity: string | undefined, proxyConfig: {
63
+ type: string;
64
+ address: string;
65
+ port: number;
66
+ username?: string;
67
+ password?: string;
68
+ } | undefined, serviceName: string | undefined, firstPartyHosts: {
69
+ match: string;
70
+ propagatorTypes: string[];
71
+ }[], bundleLogsWithRum: boolean, bundleLogsWithTraces: boolean);
46
72
  }
47
73
  /**
48
74
  * The entry point to initialize Datadog's features.
@@ -1 +1 @@
1
- export declare const version = "2.2.0";
1
+ export declare const version = "2.3.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -30,7 +30,9 @@
30
30
  "ios/DdSdkReactNative.xcodeproj/*.pbxproj",
31
31
  "jest",
32
32
  "DatadogSDKReactNative.podspec",
33
- "datadog-sourcemaps.gradle"
33
+ "datadog-sourcemaps.gradle",
34
+ "datadog-configuration.gradle",
35
+ "datadog-configuration.schema.json"
34
36
  ],
35
37
  "types": "lib/typescript/index.d.ts",
36
38
  "react-native": "src/index",
@@ -62,7 +64,8 @@
62
64
  "<rootDir>/lib/"
63
65
  ],
64
66
  "testPathIgnorePatterns": [
65
- "/__utils__/"
67
+ "/__utils__/",
68
+ "/__fixtures__/"
66
69
  ],
67
70
  "setupFiles": [
68
71
  "./../../node_modules/react-native-gesture-handler/jestSetup.js",
@@ -94,5 +97,5 @@
94
97
  "javaPackageName": "com.datadog.reactnative"
95
98
  }
96
99
  },
97
- "gitHead": "dc9dbeeb115e67456bc6ab9a1dcc682c406e0a05"
100
+ "gitHead": "5908b74a76a4046ed2e6993560eb616a6500cdf7"
98
101
  }