@datadog/mobile-react-native 1.2.0-beta1 → 1.2.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 (87) hide show
  1. package/DatadogSDKReactNative.podspec +2 -2
  2. package/android/build.gradle +28 -3
  3. package/android/detekt.yml +572 -0
  4. package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
  5. package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +7 -2
  6. package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +118 -8
  7. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +23 -1
  8. package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +29 -1
  9. package/android/src/main/kotlin/com/datadog/reactnative/VitalFrameCallback.kt +41 -0
  10. package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +7 -2
  11. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +377 -27
  12. package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +5 -1
  13. package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +33 -1
  14. package/android/src/test/kotlin/com/datadog/tools/unit/GenericAssert.kt +21 -1
  15. package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +1 -1
  16. package/android/src/test/kotlin/com/datadog/tools/unit/forge/BaseConfigurator.kt +1 -0
  17. package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +21 -2
  18. package/android/src/test/kotlin/com/datadog/tools/unit/forge/PackageInfoForgeryFactory.kt +2 -3
  19. package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +94 -0
  20. package/datadog-sourcemaps.gradle +85 -28
  21. package/ios/Sources/Attributes.swift +0 -4
  22. package/ios/Sources/DdSdk.swift +99 -13
  23. package/ios/Sources/DdSdkConfiguration.swift +34 -1
  24. package/ios/Sources/JSRefreshRateListener.swift +86 -0
  25. package/ios/Sources/QueueHolder.swift +7 -0
  26. package/ios/Sources/RNDdSdkConfiguration.swift +23 -1
  27. package/lib/commonjs/DdSdkReactNative.js +24 -25
  28. package/lib/commonjs/DdSdkReactNative.js.map +1 -1
  29. package/lib/commonjs/DdSdkReactNativeConfiguration.js +66 -2
  30. package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
  31. package/lib/commonjs/errorUtils.js +12 -3
  32. package/lib/commonjs/errorUtils.js.map +1 -1
  33. package/lib/commonjs/longTasksUtils.js +40 -0
  34. package/lib/commonjs/longTasksUtils.js.map +1 -0
  35. package/lib/commonjs/rum/instrumentation/getJsxRuntime.js +11 -8
  36. package/lib/commonjs/rum/instrumentation/getJsxRuntime.js.map +1 -1
  37. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +2 -1
  38. package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
  39. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -1
  40. package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  41. package/lib/commonjs/types.js +5 -1
  42. package/lib/commonjs/types.js.map +1 -1
  43. package/lib/commonjs/version.js +1 -1
  44. package/lib/commonjs/version.js.map +1 -1
  45. package/lib/module/DdSdkReactNative.js +23 -24
  46. package/lib/module/DdSdkReactNative.js.map +1 -1
  47. package/lib/module/DdSdkReactNativeConfiguration.js +64 -1
  48. package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
  49. package/lib/module/errorUtils.js +12 -3
  50. package/lib/module/errorUtils.js.map +1 -1
  51. package/lib/module/longTasksUtils.js +31 -0
  52. package/lib/module/longTasksUtils.js.map +1 -0
  53. package/lib/module/rum/instrumentation/getJsxRuntime.js +11 -8
  54. package/lib/module/rum/instrumentation/getJsxRuntime.js.map +1 -1
  55. package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js +2 -1
  56. package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
  57. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +2 -1
  58. package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
  59. package/lib/module/types.js +5 -1
  60. package/lib/module/types.js.map +1 -1
  61. package/lib/module/version.js +1 -1
  62. package/lib/module/version.js.map +1 -1
  63. package/lib/typescript/DdSdkReactNative.d.ts +0 -7
  64. package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +51 -0
  65. package/lib/typescript/errorUtils.d.ts +8 -0
  66. package/lib/typescript/longTasksUtils.d.ts +6 -0
  67. package/lib/typescript/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +1 -0
  68. package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +1 -1
  69. package/lib/typescript/types.d.ts +15 -1
  70. package/lib/typescript/version.d.ts +1 -1
  71. package/package.json +6 -3
  72. package/scripts/replace-react-require.js +78 -0
  73. package/src/DatadogProvider/__tests__/initialization.test.tsx +9 -1
  74. package/src/DdSdkReactNative.tsx +31 -34
  75. package/src/DdSdkReactNativeConfiguration.tsx +66 -1
  76. package/src/__tests__/DdSdkReactNative.test.tsx +56 -13
  77. package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +15 -2
  78. package/src/__tests__/longTasksUtils.ts +23 -0
  79. package/src/errorUtils.ts +11 -3
  80. package/src/longTasksUtils.ts +30 -0
  81. package/src/rum/instrumentation/getJsxRuntime.ts +11 -11
  82. package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +3 -1
  83. package/src/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.ts +1 -1
  84. package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +2 -1
  85. package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +9 -47
  86. package/src/types.tsx +10 -1
  87. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","nativeViewTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAEA,MAAMC,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,kBAAkB,EAAE,KALP;AAMbC,EAAAA,kBAAkB,EAAE,MAAM,EANb;AAObC,EAAAA,mBAAmB,EAAE,OAAO,EAAP,CAPR;AAQbC,EAAAA,eAAe,EAAET,eAAe,CAACU,OARpB;AASbC,EAAAA,mBAAmB,EAAE;AATR,CAAjB;AAYA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,6BAAN,CAAoC;AAGvC;AACJ;AACA;;AAEI;AACJ;AACA;;AAEI;AACJ;AACA;;AASI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOIC,EAAAA,WAAW,CACEC,WADF,EAEEC,GAFF,EAGEC,aAHF,EAIEC,iBAA0B,G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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 { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n nativeViewTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n public verbosity: SdkVerbosity | undefined = undefined;\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n"]}
1
+ {"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["TrackingConsent","VitalsUpdateFrequency","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","firstPartyHosts","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAIA,SAASA,eAAT,QAAgC,mBAAhC;AAEA,WAAYC,qBAAZ;;WAAYA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,KAAAA,qB;;AAOZ,MAAMC,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;AAEbC,EAAAA,mBAAmB,EAAE,KAFR;AAGbC,EAAAA,2BAA2B,EAAE,IAHhB;AAIbC,EAAAA,IAAI,EAAE,KAJO;AAKbC,EAAAA,mBAAmB,EAAE,CALR;AAMbC,EAAAA,yBAAyB,EAAE,GANd;AAObC,EAAAA,kBAAkB,EAAE,KAPP;AAQbC,EAAAA,kBAAkB,EAAE,MAAM,EARb;AASbC,EAAAA,mBAAmB,EAAE,OAAO,EAAP,CATR;AAUbC,EAAAA,eAAe,EAAEZ,eAAe,CAACa,OAVpB;AAWbC,EAAAA,mBAAmB,EAAE,IAXR;AAYbC,EAAAA,qBAAqB,EAAEd,qBAAqB,CAACe;AAZhC,CAAjB;AAeA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,6BAAN,CAAoC;AACvC;AACJ;AACA;;AAGI;AACJ;AACA;;AAEI;AACJ;AACA;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;AASAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,6BADV;AAEID,IAAAA,KAAK,EAAEL,QAAQ,CAACtB;AAFpB,GADqB,EAKrB+B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEL,QAAQ,CAACC;AAA3C,GADqB,EAErBQ,gBAFqB,CAAzB;AAKA,SAAOA,gBAAP;AACH,CA1CM;AA4CP,OAAO,MAAMI,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;AAIhF,WAAYD,kBAAZ;;WAAYA,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\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: string[] = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: string[];\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: string[];\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate ||\n DEFAULTS.resourceTracingSamplingRate\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
@@ -18,6 +18,15 @@ export const getErrorMessage = error => {
18
18
 
19
19
  return message;
20
20
  };
21
+ /**
22
+ * Will extract the stack from the error, taking the first key found among:
23
+ * `stacktrace`, `stack`, `componentStack` (component tree for component errors,
24
+ * which contains only native components names in production).
25
+ *
26
+ * In last resort and if `sourceURL`, `line` and `column` are present, it will
27
+ * generate a stack from this information.
28
+ */
29
+
21
30
  export const getErrorStackTrace = error => {
22
31
  let stack = EMPTY_STACK_TRACE;
23
32
 
@@ -27,12 +36,12 @@ export const getErrorStackTrace = error => {
27
36
  } else if (typeof error === 'string') {
28
37
  stack = EMPTY_STACK_TRACE;
29
38
  } else if (typeof error === 'object') {
30
- if ('componentStack' in error) {
31
- stack = String(error.componentStack);
32
- } else if ('stacktrace' in error) {
39
+ if ('stacktrace' in error) {
33
40
  stack = String(error.stacktrace);
34
41
  } else if ('stack' in error) {
35
42
  stack = String(error.stack);
43
+ } else if ('componentStack' in error) {
44
+ stack = String(error.componentStack);
36
45
  } else if ('sourceURL' in error && 'line' in error && 'column' in error) {
37
46
  stack = `at ${error.sourceURL}:${error.line}:${error.column}`;
38
47
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["errorUtils.ts"],"names":["EMPTY_MESSAGE","EMPTY_STACK_TRACE","getErrorMessage","error","message","undefined","String","getErrorStackTrace","stack","componentStack","stacktrace","sourceURL","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H,eAAeL,KAAf,IACA,UAAUA,KADV,IAEA,YAAYA,KAHT,EAIL;AACEK,QAAAA,KAAK,GAAI,MAAKL,KAAK,CAACQ,SAAU,IAAGR,KAAK,CAACS,IAAK,IAAGT,KAAK,CAACU,MAAO,EAA5D;AACH;AACJ;AACJ,GApBD,CAoBE,OAAOC,CAAP,EAAU,CACR;AACH;;AACD,SAAON,KAAP;AACH,CA3BM","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\nexport const EMPTY_MESSAGE = 'Unknown Error';\nexport const EMPTY_STACK_TRACE = '';\n\nexport const getErrorMessage = (error: any | undefined): string => {\n let message = EMPTY_MESSAGE;\n if (error === undefined || error === null) {\n message = EMPTY_MESSAGE;\n } else if (typeof error === 'object' && 'message' in error) {\n message = String(error.message);\n } else {\n message = String(error);\n }\n\n return message;\n};\n\nexport const getErrorStackTrace = (error: any | undefined): string => {\n let stack = EMPTY_STACK_TRACE;\n\n try {\n if (error === undefined || error === null) {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'string') {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'object') {\n if ('componentStack' in error) {\n stack = String(error.componentStack);\n } else if ('stacktrace' in error) {\n stack = String(error.stacktrace);\n } else if ('stack' in error) {\n stack = String(error.stack);\n } else if (\n 'sourceURL' in error &&\n 'line' in error &&\n 'column' in error\n ) {\n stack = `at ${error.sourceURL}:${error.line}:${error.column}`;\n }\n }\n } catch (e) {\n // Do nothing\n }\n return stack;\n};\n"]}
1
+ {"version":3,"sources":["errorUtils.ts"],"names":["EMPTY_MESSAGE","EMPTY_STACK_TRACE","getErrorMessage","error","message","undefined","String","getErrorStackTrace","stack","stacktrace","componentStack","sourceURL","line","column","e"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMA,aAAa,GAAG,eAAtB;AACP,O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HT,EAIL;AACEK,QAAAA,KAAK,GAAI,MAAKL,KAAK,CAACQ,SAAU,IAAGR,KAAK,CAACS,IAAK,IAAGT,KAAK,CAACU,MAAO,EAA5D;AACH;AACJ;AACJ,GApBD,CAoBE,OAAOC,CAAP,EAAU,CACR;AACH;;AACD,SAAON,KAAP;AACH,CA3BM","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\nexport const EMPTY_MESSAGE = 'Unknown Error';\nexport const EMPTY_STACK_TRACE = '';\n\nexport const getErrorMessage = (error: any | undefined): string => {\n let message = EMPTY_MESSAGE;\n if (error === undefined || error === null) {\n message = EMPTY_MESSAGE;\n } else if (typeof error === 'object' && 'message' in error) {\n message = String(error.message);\n } else {\n message = String(error);\n }\n\n return message;\n};\n\n/**\n * Will extract the stack from the error, taking the first key found among:\n * `stacktrace`, `stack`, `componentStack` (component tree for component errors,\n * which contains only native components names in production).\n *\n * In last resort and if `sourceURL`, `line` and `column` are present, it will\n * generate a stack from this information.\n */\nexport const getErrorStackTrace = (error: any | undefined): string => {\n let stack = EMPTY_STACK_TRACE;\n\n try {\n if (error === undefined || error === null) {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'string') {\n stack = EMPTY_STACK_TRACE;\n } else if (typeof error === 'object') {\n if ('stacktrace' in error) {\n stack = String(error.stacktrace);\n } else if ('stack' in error) {\n stack = String(error.stack);\n } else if ('componentStack' in error) {\n stack = String(error.componentStack);\n } else if (\n 'sourceURL' in error &&\n 'line' in error &&\n 'column' in error\n ) {\n stack = `at ${error.sourceURL}:${error.line}:${error.column}`;\n }\n }\n } catch (e) {\n // Do nothing\n }\n return stack;\n};\n"]}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 100ms is the lower bound for a noticeable long task event.
3
+ */
4
+ const MIN_LONG_TASK_THRESHOLD_MS = 100;
5
+ /**
6
+ * 5000ms is considered an Application Not Responding (ANR) event.
7
+ */
8
+
9
+ const MAX_LONG_TASK_THRESHOLD_MS = 5000;
10
+ /**
11
+ * Makes sure the long task threshold value is above 100 and below 5000.
12
+ * Also makes sure it is a number, passing `0` if it is `false`, as the React Native
13
+ * bridge cannot handle values with dual types.
14
+ */
15
+
16
+ export const adaptLongTaskThreshold = longTaskThreshold => {
17
+ if (!longTaskThreshold) {
18
+ return 0;
19
+ }
20
+
21
+ if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) {
22
+ return MIN_LONG_TASK_THRESHOLD_MS;
23
+ }
24
+
25
+ if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) {
26
+ return MAX_LONG_TASK_THRESHOLD_MS;
27
+ }
28
+
29
+ return longTaskThreshold;
30
+ };
31
+ //# sourceMappingURL=longTasksUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["longTasksUtils.ts"],"names":["MIN_LONG_TASK_THRESHOLD_MS","MAX_LONG_TASK_THRESHOLD_MS","adaptLongTaskThreshold","longTaskThreshold"],"mappings":"AAAA;AACA;AACA;AACA,MAAMA,0BAA0B,GAAG,GAAnC;AAEA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,IAAnC;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,sBAAsB,GAC/BC,iBADkC,IAEzB;AACT,MAAI,CAACA,iBAAL,EAAwB;AACpB,WAAO,CAAP;AACH;;AACD,MAAIA,iBAAiB,GAAGH,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AACD,MAAIG,iBAAiB,GAAGF,0BAAxB,EAAoD;AAChD,WAAOA,0BAAP;AACH;;AAED,SAAOE,iBAAP;AACH,CAdM","sourcesContent":["/**\n * 100ms is the lower bound for a noticeable long task event.\n */\nconst MIN_LONG_TASK_THRESHOLD_MS = 100;\n\n/**\n * 5000ms is considered an Application Not Responding (ANR) event.\n */\nconst MAX_LONG_TASK_THRESHOLD_MS = 5000;\n\n/**\n * Makes sure the long task threshold value is above 100 and below 5000.\n * Also makes sure it is a number, passing `0` if it is `false`, as the React Native\n * bridge cannot handle values with dual types.\n */\nexport const adaptLongTaskThreshold = (\n longTaskThreshold: number | false\n): number => {\n if (!longTaskThreshold) {\n return 0;\n }\n if (longTaskThreshold < MIN_LONG_TASK_THRESHOLD_MS) {\n return MIN_LONG_TASK_THRESHOLD_MS;\n }\n if (longTaskThreshold > MAX_LONG_TASK_THRESHOLD_MS) {\n return MAX_LONG_TASK_THRESHOLD_MS;\n }\n\n return longTaskThreshold;\n};\n"]}
@@ -5,27 +5,30 @@
5
5
  */
6
6
  export const getJsxRuntime = () => {
7
7
  // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
8
- const [major, minor] = require('react/package.json').version.split('.'); // We need to check on the version of React before calling require('react/jsx-runtime') as
8
+ const [major, minor] = require('react/package.json').version.split('.'); // We need to check on the version of React before requiring 'react/jsx-runtime') as
9
9
  // it might crash other exports if the export does not exist (even if there is a try/catch).
10
10
  // See: https://github.com/facebook/metro/issues/836
11
11
 
12
12
 
13
13
  if (!isJsxExportedInReactVersion(major, minor)) {
14
14
  throw new Error('React version does not support new jsx transform');
15
- } // React Native does some premature optimizations if the require target is a static string, by making
16
- // it dynamic we prevent RN from trying to resolve react/jsx-runtime before the function is called
17
-
15
+ } // /!\/!\/!\/!\/!\/!\
16
+ // We have to use inline require here because older React versions (below 16.14) don't have jsx-runtime.
17
+ // metro does not support dynamic require, so 'react/jsx-runtime' is replaced by 'react' on postinstall
18
+ // when react is equal or above 16.14 to avoid this require call to fail during the import phase and then
19
+ // disable all further imports.
20
+ // /!\/!\/!\/!\/!\/!\
21
+ //
22
+ // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
18
23
 
19
- const jsxRuntimePackage = isJsxExportedInReactVersion(major, minor) ? 'react/jsx-runtime' : 'react'; // We have to use inline require here because older React versions (below 17) don't have jsx-runtime
20
- // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/no-dynamic-require
21
24
 
22
- const jsxRuntime = require(jsxRuntimePackage);
25
+ const jsxRuntime = require('react/jsx-runtime');
23
26
 
24
27
  if (!jsxRuntime.jsx) {
25
28
  throw new Error('React jsx runtime does not export new jsx transform');
26
29
  }
27
30
 
28
- return jsxRuntime.jsx;
31
+ return jsxRuntime;
29
32
  };
30
33
  /**
31
34
  * JSX Transform is available for React 16.14.0 (last React 16 version) and above
@@ -1 +1 @@
1
- {"version":3,"sources":["getJsxRuntime.ts"],"names":["getJsxRuntime","major","minor","require","version","split","isJsxExportedInReactVersion","Error","jsxRuntimePackage","jsxRuntime","jsx","Number"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMA,aAAa,GAAG,MAAM;AAC/B;AACA,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBC,OAAO,CAAC,oBAAD,CAAP,CAA8BC,OAA9B,CAAsCC,KAAtC,CAA4C,GAA5C,CAAvB,CAF+B,CAG/B;AACA;AACA;;;AACA,MAAI,CAACC,2BAA2B,CAACL,KAAD,EAAQC,KAAR,CAAhC,EAAgD;AAC5C,UAAM,IAAIK,KAAJ,CAAU,kDAAV,CAAN;AACH,GAR8B,CAU/B;AACA;;;AACA,QAAMC,iBAAiB,GAAGF,2BAA2B,CAACL,KAAD,EAAQC,KAAR,CAA3B,GACpB,mBADoB,GAEpB,OAFN,CAZ+B,CAgB/B;AACA;;AACA,QAAMO,UAAU,GAAGN,OAAO,CAACK,iBAAD,CAA1B;;AACA,MAAI,CAACC,UAAU,CAACC,GAAhB,EAAqB;AACjB,UAAM,IAAIH,KAAJ,CAAU,qDAAV,CAAN;AACH;;AACD,SAAOE,UAAU,CAACC,GAAlB;AACH,CAvBM;AAyBP;AACA;AACA;;AACA,MAAMJ,2BAA2B,GAAG,CAACL,KAAD,EAAgBC,KAAhB,KAA2C;AAC3E,MAAIS,MAAM,CAACV,KAAD,CAAN,GAAgB,EAApB,EAAwB;AACpB,WAAO,IAAP;AACH;;AACD,MAAIU,MAAM,CAACV,KAAD,CAAN,KAAkB,EAAlB,IAAwBU,MAAM,CAACT,KAAD,CAAN,GAAgB,EAA5C,EAAgD;AAC5C,WAAO,IAAP;AACH;;AACD,SAAO,KAAP;AACH,CARD","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\nexport const getJsxRuntime = () => {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const [major, minor] = require('react/package.json').version.split('.');\n // We need to check on the version of React before calling require('react/jsx-runtime') as\n // it might crash other exports if the export does not exist (even if there is a try/catch).\n // See: https://github.com/facebook/metro/issues/836\n if (!isJsxExportedInReactVersion(major, minor)) {\n throw new Error('React version does not support new jsx transform');\n }\n\n // React Native does some premature optimizations if the require target is a static string, by making\n // it dynamic we prevent RN from trying to resolve react/jsx-runtime before the function is called\n const jsxRuntimePackage = isJsxExportedInReactVersion(major, minor)\n ? 'react/jsx-runtime'\n : 'react';\n\n // We have to use inline require here because older React versions (below 17) don't have jsx-runtime\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/no-dynamic-require\n const jsxRuntime = require(jsxRuntimePackage);\n if (!jsxRuntime.jsx) {\n throw new Error('React jsx runtime does not export new jsx transform');\n }\n return jsxRuntime.jsx;\n};\n\n/**\n * JSX Transform is available for React 16.14.0 (last React 16 version) and above\n */\nconst isJsxExportedInReactVersion = (major: string, minor: string): boolean => {\n if (Number(major) > 16) {\n return true;\n }\n if (Number(major) === 16 && Number(minor) > 13) {\n return true;\n }\n return false;\n};\n"]}
1
+ {"version":3,"sources":["getJsxRuntime.ts"],"names":["getJsxRuntime","major","minor","require","version","split","isJsxExportedInReactVersion","Error","jsxRuntime","jsx","Number"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAEA,OAAO,MAAMA,aAAa,GAAG,MAAM;AAC/B;AACA,QAAM,CAACC,KAAD,EAAQC,KAAR,IAAiBC,OAAO,CAAC,oBAAD,CAAP,CAA8BC,OAA9B,CAAsCC,KAAtC,CAA4C,GAA5C,CAAvB,CAF+B,CAG/B;AACA;AACA;;;AACA,MAAI,CAACC,2BAA2B,CAACL,KAAD,EAAQC,KAAR,CAAhC,EAAgD;AAC5C,UAAM,IAAIK,KAAJ,CAAU,kDAAV,CAAN;AACH,GAR8B,CAU/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,QAAMC,UAAU,GAAGL,OAAO,CAAC,mBAAD,CAA1B;;AACA,MAAI,CAACK,UAAU,CAACC,GAAhB,EAAqB;AACjB,UAAM,IAAIF,KAAJ,CAAU,qDAAV,CAAN;AACH;;AACD,SAAOC,UAAP;AACH,CAvBM;AAyBP;AACA;AACA;;AACA,MAAMF,2BAA2B,GAAG,CAACL,KAAD,EAAgBC,KAAhB,KAA2C;AAC3E,MAAIQ,MAAM,CAACT,KAAD,CAAN,GAAgB,EAApB,EAAwB;AACpB,WAAO,IAAP;AACH;;AACD,MAAIS,MAAM,CAACT,KAAD,CAAN,KAAkB,EAAlB,IAAwBS,MAAM,CAACR,KAAD,CAAN,GAAgB,EAA5C,EAAgD;AAC5C,WAAO,IAAP;AACH;;AACD,SAAO,KAAP;AACH,CARD","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\nexport const getJsxRuntime = () => {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const [major, minor] = require('react/package.json').version.split('.');\n // We need to check on the version of React before requiring 'react/jsx-runtime') as\n // it might crash other exports if the export does not exist (even if there is a try/catch).\n // See: https://github.com/facebook/metro/issues/836\n if (!isJsxExportedInReactVersion(major, minor)) {\n throw new Error('React version does not support new jsx transform');\n }\n\n // /!\\/!\\/!\\/!\\/!\\/!\\\n // We have to use inline require here because older React versions (below 16.14) don't have jsx-runtime.\n // metro does not support dynamic require, so 'react/jsx-runtime' is replaced by 'react' on postinstall\n // when react is equal or above 16.14 to avoid this require call to fail during the import phase and then\n // disable all further imports.\n // /!\\/!\\/!\\/!\\/!\\/!\\\n //\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n const jsxRuntime = require('react/jsx-runtime');\n if (!jsxRuntime.jsx) {\n throw new Error('React jsx runtime does not export new jsx transform');\n }\n return jsxRuntime;\n};\n\n/**\n * JSX Transform is available for React 16.14.0 (last React 16 version) and above\n */\nconst isJsxExportedInReactVersion = (major: string, minor: string): boolean => {\n if (Number(major) > 16) {\n return true;\n }\n if (Number(major) === 16 && Number(minor) > 13) {\n return true;\n }\n return false;\n};\n"]}
@@ -30,7 +30,8 @@ const generateTracingAttributesWithSampling = tracingSamplingRate => {
30
30
  traceId: generateTraceId(),
31
31
  spanId: generateTraceId(),
32
32
  samplingPriorityHeader: '1',
33
- tracingStrategy: 'KEEP'
33
+ tracingStrategy: 'KEEP',
34
+ rulePsr: tracingSamplingRate / 100
34
35
  };
35
36
  }
36
37
 
@@ -1 +1 @@
1
- {"version":3,"sources":["distributedTracing.tsx"],"names":["isHostFirstParty","DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegex","tracingSamplingRate","generateTracingAttributesWithSampling","Math","random","traceId","generateTraceId","spanId","radix","MAX_32_BITS_NUMBER","low","floor","high","str","modH","temp","digit","toString"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAGA,SAASA,gBAAT,QAAiC,mBAAjC;AAgBA,MAAMC,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;AAKA,OAAO,MAAMC,oBAAoB,GAAG,CAAC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,oBAFiC;AAGjCC,EAAAA;AAHiC,CAAD,KAQE;AAClC,MAAIF,QAAQ,KAAK,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KAAvB,CAVwB,CAUM;AAE9B;;AACAK,IAAAA,GAAG,GAAGG,KAAK,CAACC,QAAN,KAAmBJ,GAAzB;AACH;;AACD,SAAOA,GAAP;AACH","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 { Hostname } from './firstPartyHosts';\nimport { isHostFirstParty } from './firstPartyHosts';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: string;\n spanId: string;\n samplingPriorityHeader: '1';\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegex,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegex: RegExp;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n if (isHostFirstParty(hostname, firstPartyHostsRegex)) {\n return generateTracingAttributesWithSampling(tracingSamplingRate);\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number\n): DdRumResourceTracingAttributes => {\n if (Math.random() * 100 <= tracingSamplingRate) {\n return {\n traceId: generateTraceId(),\n spanId: generateTraceId(),\n samplingPriorityHeader: '1',\n tracingStrategy: 'KEEP'\n };\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/master/packages/rum-core/src/domain/tracing/tracer.ts#L107)\n */\nexport function generateTraceId(): string {\n const radix = 10;\n const MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\n let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let str = '';\n\n while (high > 0 && low > 0) {\n // Create an intermediate value with the same modulo as the combined high and low value\n // but requiring 36 bits max (32 for the low value + 4 for the high part)\n const modH = high % radix;\n const temp = (modH << 32) + low;\n const digit = temp % radix;\n\n // update the high value\n high = (high - modH) / radix; // we reuse the modH to avoid the need of a floor op\n // the low value reuses the previous temp value to account for the \"missing mod\" in the high update\n low = (temp - digit) / radix; // we reuse the digit to avoid the need of a floor op\n\n // update the string from right to left\n str = digit.toString() + str;\n }\n return str;\n}\n"]}
1
+ {"version":3,"sources":["distributedTracing.tsx"],"names":["isHostFirstParty","DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegex","tracingSamplingRate","generateTracingAttributesWithSampling","Math","random","traceId","generateTraceId","spanId","rulePsr","radix","MAX_32_BITS_NUMBER","low","floor","high","str","modH","temp","digit","toString"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AAGA,SAASA,gBAAT,QAAiC,mBAAjC;AAiBA,MAAMC,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;AAKA,OAAO,MAAMC,oBAAoB,GAAG,CAAC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,oBAFiC;AAGjCC,EAAAA;AAHiC,CAAD,KAQE;AAClC,MAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACnB,WAAOJ,0BAAP;AACH;;AACD,MAAID,gBAAgB,CAACK,QAAD,EAAWC,oBAAX,CAApB,EAAsD;AAClD,WAAOE,qCAAqC,CAACD,mBAAD,CAA5C;AACH;;AACD,SAAON,0BAAP;AACH,CAhBM;;AAkBP,MAAMO,qCAAqC,GACvCD,mBAD0C,IAET;AACjC,MAAIE,IAAI,CAACC,MAAL,KAAgB,GAAhB,IAAuBH,mBAA3B,EAAgD;AAC5C,WAAO;AACHI,MAAAA,OAAO,EAAEC,eAAe,EADrB;AAEHC,MAAAA,MAAM,EAAED,eAAe,EAFpB;AAGHV,MAAAA,sBAAsB,EAAE,GAHrB;AAIHC,MAAAA,eAAe,EAAE,MAJd;AAKHW,MAAAA,OAAO,EAAEP,mBAAmB,GAAG;AAL5B,KAAP;AAOH;;AACD,SAAON,0BAAP;AACH,CAbD;AAeA;AACA;AACA;;;AACA,OAAO,SAASW,eAAT,GAAmC;AACtC,QAAMG,KAAK,GAAG,EAAd;AACA,QAAMC,kBAAkB,GAAG,UAA3B,CAFsC,CAEC;;AACvC,MAAIC,GAAW,GAAGR,IAAI,CAACS,KAAL,CAAWT,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAlB;AACA,MAAIG,IAAY,GAAGV,IAAI,CAACS,KAAL,CAAWT,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAnB;AACA,MAAII,GAAG,GAAG,EAAV;;AAEA,SAAOD,IAAI,GAAG,CAAP,IAAYF,GAAG,GAAG,CAAzB,EAA4B;AACxB;AACA;AACA,UAAMI,IAAI,GAAGF,IAAI,GAAGJ,KAApB;AACA,UAAMO,IAAI,GAAG,CAACD,IAAI,IAAI,EAAT,IAAeJ,GAA5B;AACA,UAAMM,KAAK,GAAGD,IAAI,GAAGP,KAArB,CALwB,CAOxB;;AACAI,IAAAA,IAAI,GAAG,CAACA,IAAI,GAAGE,IAAR,IAAgBN,KAAvB,CARwB,CAQM;AAC9B;;AACAE,IAAAA,GAAG,GAAG,CAACK,IAAI,GAAGC,KAAR,IAAiBR,KAAvB,CAVwB,CAUM;AAE9B;;AACAK,IAAAA,GAAG,GAAGG,KAAK,CAACC,QAAN,KAAmBJ,GAAzB;AACH;;AACD,SAAOA,GAAP;AACH","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 { Hostname } from './firstPartyHosts';\nimport { isHostFirstParty } from './firstPartyHosts';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: string;\n spanId: string;\n samplingPriorityHeader: '1';\n rulePsr: number;\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegex,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegex: RegExp;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n if (isHostFirstParty(hostname, firstPartyHostsRegex)) {\n return generateTracingAttributesWithSampling(tracingSamplingRate);\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number\n): DdRumResourceTracingAttributes => {\n if (Math.random() * 100 <= tracingSamplingRate) {\n return {\n traceId: generateTraceId(),\n spanId: generateTraceId(),\n samplingPriorityHeader: '1',\n tracingStrategy: 'KEEP',\n rulePsr: tracingSamplingRate / 100\n };\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/master/packages/rum-core/src/domain/tracing/tracer.ts#L107)\n */\nexport function generateTraceId(): string {\n const radix = 10;\n const MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\n let low: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let high: number = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n let str = '';\n\n while (high > 0 && low > 0) {\n // Create an intermediate value with the same modulo as the combined high and low value\n // but requiring 36 bits max (32 for the low value + 4 for the high part)\n const modH = high % radix;\n const temp = (modH << 32) + low;\n const digit = temp % radix;\n\n // update the high value\n high = (high - modH) / radix; // we reuse the modH to avoid the need of a floor op\n // the low value reuses the previous temp value to account for the \"missing mod\" in the high update\n low = (temp - digit) / radix; // we reuse the digit to avoid the need of a floor op\n\n // update the string from right to left\n str = digit.toString() + str;\n }\n return str;\n}\n"]}
@@ -33,7 +33,8 @@ export class ResourceReporter {
33
33
  const formatResourceStartContext = tracingAttributes => {
34
34
  return tracingAttributes.tracingStrategy === 'DISCARD' ? undefined : {
35
35
  '_dd.span_id': tracingAttributes.spanId,
36
- '_dd.trace_id': tracingAttributes.traceId
36
+ '_dd.trace_id': tracingAttributes.traceId,
37
+ '_dd.rule_psr': tracingAttributes.rulePsr
37
38
  };
38
39
  };
39
40
 
@@ -1 +1 @@
1
- {"version":3,"sources":["ResourceReporter.ts"],"names":["DdRum","createTimings","ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","tracingStrategy","undefined","spanId","traceId","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","startResource","key","request","method","url","stopResource","response","statusCode","kind","size"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,KAAT,QAAsB,2BAAtB;AAGA,SAASC,aAAT,QAA8B,kBAA9B;AAIA,OAAO,MAAMC,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAoC;AAAA;;AAAA,4CAI7BC,QAAD,IAA2B;AACxC,UAAIC,gBAAoC,GAAGD,QAA3C;;AAEA,WAAK,MAAME,MAAX,IAAqB,KAAKC,OAA1B,EAAmC;AAC/BF,QAAAA,gBAAgB,GAAGC,MAAM,CAACF,QAAD,CAAzB;;AACA,YAAIC,gBAAgB,KAAK,IAAzB,EAA+B;AAC3B;AACH;AACJ;;AAEDG,MAAAA,cAAc,CAACH,gBAAD,CAAd;AACH,KAf8C;;AAC3C,SAAKE,OAAL,GAAeJ,eAAf;AACH;;AALyB;;AAqB9B,MAAMM,0BAA0B,GAC5BC,iBAD+B,IAEO;AACtC,SAAOA,iBAAiB,CAACC,eAAlB,KAAsC,SAAtC,GACDC,SADC,GAED;AACI,mBAAeF,iBAAiB,CAACG,MADrC;AAEI,oBAAgBH,iBAAiB,CAACI;AAFtC,GAFN;AAMH,CATD;;AAWA,MAAMC,yBAAyB,GAC3BC,OAD8B,IAEJ;AAC1B,SAAO;AACH,4BACIA,OAAO,CAACC,iBAAR,KAA8BL,SAA9B,GACMZ,aAAa,CACTgB,OAAO,CAACE,SADC,EAETF,OAAO,CAACC,iBAFC,EAGTD,OAAO,CAACG,QAHC,CADnB,GAMM;AARP,GAAP;AAUH,CAbD;;AAeA,MAAMX,cAAc,GAAG,MAAOJ,QAAP,IAAiC;AACpD,QAAML,KAAK,CAACqB,aAAN,CACFhB,QAAQ,CAACiB,GADP,EAEFjB,QAAQ,CAACkB,OAAT,CAAiBC,MAFf,EAGFnB,QAAQ,CAACkB,OAAT,CAAiBE,GAHf,EAIFf,0BAA0B,CAACL,QAAQ,CAACM,iBAAV,CAJxB,EAKFN,QAAQ,CAACY,OAAT,CAAiBE,SALf,CAAN;AAQAnB,EAAAA,KAAK,CAAC0B,YAAN,CACIrB,QAAQ,CAACiB,GADb,EAEIjB,QAAQ,CAACsB,QAAT,CAAkBC,UAFtB,EAGIvB,QAAQ,CAACkB,OAAT,CAAiBM,IAHrB,EAIIxB,QAAQ,CAACsB,QAAT,CAAkBG,IAJtB,EAKId,yBAAyB,CAACX,QAAQ,CAACY,OAAV,CAL7B,EAMIZ,QAAQ,CAACY,OAAT,CAAiBG,QANrB;AAQH,CAjBD","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 { DdRum } from '../../../../../foundation';\nimport type { RUMResource } from '../../domain/interfaces/RumResource';\n\nimport { createTimings } from './resourceTiming';\n\ntype ResourceMapper = (resource: RUMResource) => RUMResource | null;\n\nexport class ResourceReporter {\n private mappers: ResourceMapper[];\n\n constructor(resourceMappers: ResourceMapper[]) {\n this.mappers = resourceMappers;\n }\n\n reportResource = (resource: RUMResource) => {\n let modifiedResource: RUMResource | null = resource;\n\n for (const mapper of this.mappers) {\n modifiedResource = mapper(resource);\n if (modifiedResource === null) {\n return;\n }\n }\n\n reportResource(modifiedResource);\n };\n}\n\nconst formatResourceStartContext = (\n tracingAttributes: RUMResource['tracingAttributes']\n): Record<string, unknown> | undefined => {\n return tracingAttributes.tracingStrategy === 'DISCARD'\n ? undefined\n : {\n '_dd.span_id': tracingAttributes.spanId,\n '_dd.trace_id': tracingAttributes.traceId\n };\n};\n\nconst formatResourceStopContext = (\n timings: RUMResource['timings']\n): Record<string, unknown> => {\n return {\n '_dd.resource_timings':\n timings.responseStartTime !== undefined\n ? createTimings(\n timings.startTime,\n timings.responseStartTime,\n timings.stopTime\n )\n : null\n };\n};\n\nconst reportResource = async (resource: RUMResource) => {\n await DdRum.startResource(\n resource.key,\n resource.request.method,\n resource.request.url,\n formatResourceStartContext(resource.tracingAttributes),\n resource.timings.startTime\n );\n\n DdRum.stopResource(\n resource.key,\n resource.response.statusCode,\n resource.request.kind,\n resource.response.size,\n formatResourceStopContext(resource.timings),\n resource.timings.stopTime\n );\n};\n"]}
1
+ {"version":3,"sources":["ResourceReporter.ts"],"names":["DdRum","createTimings","ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","tracingStrategy","undefined","spanId","traceId","rulePsr","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","startResource","key","request","method","url","stopResource","response","statusCode","kind","size"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,KAAT,QAAsB,2BAAtB;AAGA,SAASC,aAAT,QAA8B,kBAA9B;AAIA,OAAO,MAAMC,gBAAN,CAAuB;AAG1BC,EAAAA,WAA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GIxB,QAAQ,CAACmB,OAAT,CAAiBM,IAHrB,EAIIzB,QAAQ,CAACuB,QAAT,CAAkBG,IAJtB,EAKId,yBAAyB,CAACZ,QAAQ,CAACa,OAAV,CAL7B,EAMIb,QAAQ,CAACa,OAAT,CAAiBG,QANrB;AAQH,CAjBD","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 { DdRum } from '../../../../../foundation';\nimport type { RUMResource } from '../../domain/interfaces/RumResource';\n\nimport { createTimings } from './resourceTiming';\n\ntype ResourceMapper = (resource: RUMResource) => RUMResource | null;\n\nexport class ResourceReporter {\n private mappers: ResourceMapper[];\n\n constructor(resourceMappers: ResourceMapper[]) {\n this.mappers = resourceMappers;\n }\n\n reportResource = (resource: RUMResource) => {\n let modifiedResource: RUMResource | null = resource;\n\n for (const mapper of this.mappers) {\n modifiedResource = mapper(resource);\n if (modifiedResource === null) {\n return;\n }\n }\n\n reportResource(modifiedResource);\n };\n}\n\nconst formatResourceStartContext = (\n tracingAttributes: RUMResource['tracingAttributes']\n): Record<string, unknown> | undefined => {\n return tracingAttributes.tracingStrategy === 'DISCARD'\n ? undefined\n : {\n '_dd.span_id': tracingAttributes.spanId,\n '_dd.trace_id': tracingAttributes.traceId,\n '_dd.rule_psr': tracingAttributes.rulePsr\n };\n};\n\nconst formatResourceStopContext = (\n timings: RUMResource['timings']\n): Record<string, unknown> => {\n return {\n '_dd.resource_timings':\n timings.responseStartTime !== undefined\n ? createTimings(\n timings.startTime,\n timings.responseStartTime,\n timings.stopTime\n )\n : null\n };\n};\n\nconst reportResource = async (resource: RUMResource) => {\n await DdRum.startResource(\n resource.key,\n resource.request.method,\n resource.request.url,\n formatResourceStartContext(resource.tracingAttributes),\n resource.timings.startTime\n );\n\n DdRum.stopResource(\n resource.key,\n resource.response.statusCode,\n resource.request.kind,\n resource.response.size,\n formatResourceStopContext(resource.timings),\n resource.timings.stopTime\n );\n};\n"]}
@@ -8,16 +8,20 @@
8
8
  * A configuration object to initialize Datadog's features.
9
9
  */
10
10
  export class DdSdkConfiguration {
11
- constructor(clientToken, env, applicationId, nativeCrashReportEnabled, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate) {
11
+ constructor(clientToken, env, applicationId, nativeCrashReportEnabled, nativeLongTaskThresholdMs, longTaskThresholdMs, sampleRate, site, trackingConsent, additionalConfig, telemetrySampleRate, vitalsUpdateFrequency, configurationForTelemetry) {
12
12
  this.clientToken = clientToken;
13
13
  this.env = env;
14
14
  this.applicationId = applicationId;
15
15
  this.nativeCrashReportEnabled = nativeCrashReportEnabled;
16
+ this.nativeLongTaskThresholdMs = nativeLongTaskThresholdMs;
17
+ this.longTaskThresholdMs = longTaskThresholdMs;
16
18
  this.sampleRate = sampleRate;
17
19
  this.site = site;
18
20
  this.trackingConsent = trackingConsent;
19
21
  this.additionalConfig = additionalConfig;
20
22
  this.telemetrySampleRate = telemetrySampleRate;
23
+ this.vitalsUpdateFrequency = vitalsUpdateFrequency;
24
+ this.configurationForTelemetry = configurationForTelemetry;
21
25
  }
22
26
 
23
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","RumActionType","ErrorSource"],"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,UALF,EAMEC,IANF,EAOEC,eAPF,EAQEC,gBARF,EASEC,mBATF,EAUT;AAAA,SATWR,WASX,GATWA,WASX;AAAA,SARWC,GAQX,GARWA,GAQX;AAAA,SAPWC,aAOX,GAPWA,aAOX;AAAA,SANWC,wBAMX,GANWA,wBAMX;AAAA,SALWC,UAKX,GALWA,UAKX;AAAA,SAJWC,IAIX,GAJWA,IAIX;AAAA,SAHWC,eAGX,GAHWA,eAGX;AAAA,SAFWC,gBAEX,GAFWA,gBAEX;AAAA,SADWC,mBACX,GADWA,mBACX;AAAE;;AAXwB;AAchC;AACA;AACA;;AAqOA;AACA;AACA;AACA,WAAYC,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a;;AA0BZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W","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 sampleRate: number,\n readonly site: string,\n readonly trackingConsent: string,\n readonly additionalConfig: object,\n readonly telemetrySampleRate: number\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 Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): 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\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * 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.\n * @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.\n */\n addTiming(name: string): Promise<void>;\n};\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
1
+ {"version":3,"sources":["types.tsx"],"names":["DdSdkConfiguration","constructor","clientToken","env","applicationId","nativeCrashReportEnabled","nativeLongTaskThresholdMs","longTaskThresholdMs","sampleRate","site","trackingConsent","additionalConfig","telemetrySampleRate","vitalsUpdateFrequency","configurationForTelemetry","RumActionType","ErrorSource"],"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,yBAbF,EAmBT;AAAA,SAlBWZ,WAkBX,GAlBWA,WAkBX;AAAA,SAjBWC,GAiBX,GAjBWA,GAiBX;AAAA,SAhBWC,aAgBX,GAhBWA,aAgBX;AAAA,SAfWC,wBAeX,GAfWA,wBAeX;AAAA,SAdWC,yBAcX,GAdWA,yBAcX;AAAA,SAbWC,mBAaX,GAbWA,mBAaX;AAAA,SAZWC,UAYX,GAZWA,UAYX;AAAA,SAXWC,IAWX,GAXWA,IAWX;AAAA,SAVWC,eAUX,GAVWA,eAUX;AAAA,SATWC,gBASX,GATWA,gBASX;AAAA,SARWC,mBAQX,GARWA,mBAQX;AAAA,SAPWC,qBAOX,GAPWA,qBAOX;AAAA,SANWC,yBAMX,GANWA,yBAMX;AAAE;;AApBwB;AAuBhC;AACA;AACA;;AAqOA;AACA;AACA;AACA,WAAYC,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a;;AA0BZ,WAAYC,WAAZ;;WAAYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,KAAAA,W","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 configurationForTelemetry: {\n initializationType: string;\n trackErrors: boolean;\n trackInteractions: boolean;\n trackNetworkRequests: boolean;\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 Logs feature.\n */\nexport type DdLogsType = {\n /**\n * Send a log with level debug.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n debug(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level info.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n info(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level warn.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n warn(message: string, context?: object): Promise<void>;\n\n /**\n * Send a log with level error.\n * @param message: The message to send.\n * @param context: The additional context to send.\n */\n error(message: string, context?: object): 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\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * 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.\n * @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.\n */\n addTiming(name: string): Promise<void>;\n};\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '1.2.0-beta1';
2
+ export const version = '1.2.0';
3
3
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,aAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.2.0-beta1';\n"]}
1
+ {"version":3,"sources":["version.ts"],"names":["version"],"mappings":"AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.2.0';\n"]}
@@ -17,11 +17,8 @@ export declare class DdSdkReactNative {
17
17
  private static readonly DD_PROXY_PORT_KEY;
18
18
  private static readonly DD_PROXY_USERNAME_KEY;
19
19
  private static readonly DD_PROXY_PASSWORD_KEY;
20
- private static readonly DD_NATIVE_LONG_TASK_THRESHOLD_KEY;
21
- private static readonly NATIVE_LONG_TASK_THRESHOLD_MS;
22
20
  private static wasInitialized;
23
21
  private static wasAutoInstrumented;
24
- private static configuration?;
25
22
  private static features?;
26
23
  /**
27
24
  * Initializes the Datadog SDK.
@@ -38,10 +35,6 @@ export declare class DdSdkReactNative {
38
35
  * FOR INTERNAL USE ONLY.
39
36
  */
40
37
  static _enableFeaturesFromDatadogProvider(features: AutoInstrumentationConfiguration): Promise<void>;
41
- /**
42
- * FOR INTERNAL USE ONLY.
43
- */
44
- static _initializeFromDatadogProviderAsync: () => Promise<void>;
45
38
  /**
46
39
  * FOR INTERNAL USE ONLY.
47
40
  */
@@ -1,6 +1,12 @@
1
1
  import type { ProxyConfiguration } from './ProxyConfiguration';
2
2
  import type { SdkVerbosity } from './SdkVerbosity';
3
3
  import { TrackingConsent } from './TrackingConsent';
4
+ export declare enum VitalsUpdateFrequency {
5
+ FREQUENT = "FREQUENT",
6
+ AVERAGE = "AVERAGE",
7
+ RARE = "RARE",
8
+ NEVER = "NEVER"
9
+ }
4
10
  /**
5
11
  * The SDK configuration class.
6
12
  * It will be used to configure the SDK functionality at initialization.
@@ -13,6 +19,9 @@ export declare class DdSdkReactNativeConfiguration {
13
19
  readonly trackResources: boolean;
14
20
  readonly trackErrors: boolean;
15
21
  readonly trackingConsent: TrackingConsent;
22
+ /**
23
+ * Enables crash reporting for native plaforms (iOS, Android). Default `false`.
24
+ */
16
25
  nativeCrashReportEnabled: boolean;
17
26
  /**
18
27
  * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.
@@ -27,10 +36,24 @@ export declare class DdSdkReactNativeConfiguration {
27
36
  */
28
37
  resourceTracingSamplingRate: number;
29
38
  site: string;
39
+ /**
40
+ * Verbosity for internal SDK logging.
41
+ * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.
42
+ */
30
43
  verbosity: SdkVerbosity | undefined;
44
+ /**
45
+ * Enables native views tracking.
46
+ * Set to `true` if you use a custom navigation system relying on native views.
47
+ */
31
48
  nativeViewTracking: boolean;
32
49
  proxyConfig?: ProxyConfiguration;
33
50
  serviceName?: string;
51
+ /**
52
+ * List of your backends hosts to enable tracing with.
53
+ * Regular expressions are NOT supported.
54
+ *
55
+ * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
56
+ */
34
57
  firstPartyHosts: string[];
35
58
  /**
36
59
  * Overrides the reported version of the app.
@@ -62,6 +85,30 @@ export declare class DdSdkReactNativeConfiguration {
62
85
  * Android SDK is used, which is 20.
63
86
  */
64
87
  telemetrySampleRate: number;
88
+ /**
89
+ * The threshold for native long tasks reporting in milliseconds.
90
+ *
91
+ * - Setting it to `0` or `false` disables native long task reporting.
92
+ * - Values below `100` will be raised to `100`.
93
+ * - Values above `5000` will be lowered to `5000`.
94
+ *
95
+ * Default value is `200`.
96
+ */
97
+ nativeLongTaskThresholdMs: number | false;
98
+ /**
99
+ * The threshold for javascript long tasks reporting in milliseconds.
100
+ *
101
+ * - Setting it to `0` or `false` disables javascript long task reporting.
102
+ * - Values below `100` will be raised to `100`.
103
+ * - Values above `5000` will be lowered to `5000`.
104
+ *
105
+ * Default value is `0`
106
+ */
107
+ longTaskThresholdMs: number | false;
108
+ /**
109
+ * Sets the preferred frequency for collecting mobile vitals.
110
+ */
111
+ vitalsUpdateFrequency: VitalsUpdateFrequency;
65
112
  additionalConfig: {
66
113
  [k: string]: any;
67
114
  };
@@ -109,8 +156,11 @@ export declare type PartialInitializationConfiguration = {
109
156
  [k: string]: any;
110
157
  };
111
158
  readonly trackingConsent?: TrackingConsent;
159
+ readonly longTaskThresholdMs?: number | false;
160
+ readonly nativeLongTaskThresholdMs?: number | false;
112
161
  readonly nativeCrashReportEnabled?: boolean;
113
162
  readonly telemetrySampleRate?: number;
163
+ readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
114
164
  };
115
165
  export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
116
166
  export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
@@ -120,3 +170,4 @@ export declare enum InitializationMode {
120
170
  SYNC = "SYNC",
121
171
  ASYNC = "ASYNC"
122
172
  }
173
+ export declare type InitializationModeForTelemetry = 'LEGACY' | 'SYNC' | 'ASYNC' | 'PARTIAL';
@@ -1,4 +1,12 @@
1
1
  export declare const EMPTY_MESSAGE = "Unknown Error";
2
2
  export declare const EMPTY_STACK_TRACE = "";
3
3
  export declare const getErrorMessage: (error: any | undefined) => string;
4
+ /**
5
+ * Will extract the stack from the error, taking the first key found among:
6
+ * `stacktrace`, `stack`, `componentStack` (component tree for component errors,
7
+ * which contains only native components names in production).
8
+ *
9
+ * In last resort and if `sourceURL`, `line` and `column` are present, it will
10
+ * generate a stack from this information.
11
+ */
4
12
  export declare const getErrorStackTrace: (error: any | undefined) => string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Makes sure the long task threshold value is above 100 and below 5000.
3
+ * Also makes sure it is a number, passing `0` if it is `false`, as the React Native
4
+ * bridge cannot handle values with dual types.
5
+ */
6
+ export declare const adaptLongTaskThreshold: (longTaskThreshold: number | false) => number;
@@ -4,6 +4,7 @@ export declare type DdRumResourceTracingAttributes = {
4
4
  traceId: string;
5
5
  spanId: string;
6
6
  samplingPriorityHeader: '1';
7
+ rulePsr: number;
7
8
  } | {
8
9
  tracingStrategy: 'DISCARD';
9
10
  traceId?: void;
@@ -1,4 +1,4 @@
1
- import type { ResourceKind } from '../../../../../../../core/src/types';
1
+ import type { ResourceKind } from '../../../../../../src/types';
2
2
  import type { DdRumResourceTracingAttributes } from '../distributedTracing';
3
3
  export interface RUMResource {
4
4
  key: string;
@@ -6,12 +6,26 @@ export declare class DdSdkConfiguration {
6
6
  readonly env: string;
7
7
  readonly applicationId: string;
8
8
  readonly nativeCrashReportEnabled: boolean;
9
+ readonly nativeLongTaskThresholdMs: number;
10
+ readonly longTaskThresholdMs: number;
9
11
  readonly sampleRate: number;
10
12
  readonly site: string;
11
13
  readonly trackingConsent: string;
12
14
  readonly additionalConfig: object;
13
15
  readonly telemetrySampleRate: number;
14
- constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number);
16
+ readonly vitalsUpdateFrequency: string;
17
+ readonly configurationForTelemetry: {
18
+ initializationType: string;
19
+ trackErrors: boolean;
20
+ trackInteractions: boolean;
21
+ trackNetworkRequests: boolean;
22
+ };
23
+ 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, configurationForTelemetry: {
24
+ initializationType: string;
25
+ trackErrors: boolean;
26
+ trackInteractions: boolean;
27
+ trackNetworkRequests: boolean;
28
+ });
15
29
  }
16
30
  /**
17
31
  * The entry point to initialize Datadog's features.
@@ -1 +1 @@
1
- export declare const version = "1.2.0-beta1";
1
+ export declare const version = "1.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "1.2.0-beta1",
3
+ "version": "1.2.0",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -19,7 +19,9 @@
19
19
  "files": [
20
20
  "src",
21
21
  "lib",
22
+ "scripts",
22
23
  "android/build.gradle",
24
+ "android/detekt.yml",
23
25
  "android/gradle.properties",
24
26
  "android/src",
25
27
  "ios/Sources",
@@ -39,7 +41,8 @@
39
41
  "scripts": {
40
42
  "test": "jest",
41
43
  "lint": "eslint .",
42
- "prepare": "rm -rf lib && yarn bob build"
44
+ "prepare": "rm -rf lib && yarn bob build",
45
+ "postinstall": "node scripts/replace-react-require.js # Use node to execute the script for Windows, see https://github.com/DataDog/dd-sdk-reactnative/issues/358"
43
46
  },
44
47
  "peerDependencies": {
45
48
  "react": ">=16.13.1",
@@ -73,5 +76,5 @@
73
76
  ]
74
77
  ]
75
78
  },
76
- "gitHead": "c367071a477296075f9140771e4c01f19dd40377"
79
+ "gitHead": "9208125e28748ba9781e5d22ed49551ee9743285"
77
80
  }