@dreamhorizonorg/pulse-react-native 0.0.5 → 0.0.7

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 (33) hide show
  1. package/android/build.gradle +6 -2
  2. package/android/src/main/java/com/pulsereactnativeotel/Pulse.kt +37 -40
  3. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelLogger.kt +3 -3
  4. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelModule.kt +17 -10
  5. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelPackage.kt +4 -4
  6. package/android/src/main/java/com/pulsereactnativeotel/PulseReactNativeOtelTracer.kt +2 -2
  7. package/lib/module/NativePulseReactNativeOtel.js +13 -0
  8. package/lib/module/NativePulseReactNativeOtel.js.map +1 -1
  9. package/lib/module/config.js +10 -1
  10. package/lib/module/config.js.map +1 -1
  11. package/lib/module/index.js +3 -1
  12. package/lib/module/index.js.map +1 -1
  13. package/lib/typescript/plugin/src/types.d.ts +7 -1
  14. package/lib/typescript/plugin/src/types.d.ts.map +1 -1
  15. package/lib/typescript/plugin/src/utils.d.ts +3 -1
  16. package/lib/typescript/plugin/src/utils.d.ts.map +1 -1
  17. package/lib/typescript/plugin/src/withAndroidPulse.d.ts.map +1 -1
  18. package/lib/typescript/src/NativePulseReactNativeOtel.d.ts +18 -0
  19. package/lib/typescript/src/NativePulseReactNativeOtel.d.ts.map +1 -1
  20. package/lib/typescript/src/config.d.ts +6 -0
  21. package/lib/typescript/src/config.d.ts.map +1 -1
  22. package/lib/typescript/src/index.d.ts +3 -1
  23. package/lib/typescript/src/index.d.ts.map +1 -1
  24. package/package.json +1 -1
  25. package/plugin/build/types.d.ts +7 -1
  26. package/plugin/build/utils.d.ts +3 -1
  27. package/plugin/build/utils.js +9 -3
  28. package/plugin/build/withAndroidPulse.js +11 -2
  29. package/scripts/pulse-cli.js +8 -0
  30. package/scripts/uploadService.js +7 -0
  31. package/src/NativePulseReactNativeOtel.ts +20 -0
  32. package/src/config.ts +15 -1
  33. package/src/index.tsx +4 -1
@@ -77,11 +77,15 @@ repositories {
77
77
  google()
78
78
  }
79
79
 
80
- def pulse_version = "0.0.5-alpha"
80
+ def pulse_version = "0.0.7-alpha"
81
81
  dependencies {
82
82
  implementation("com.facebook.react:react-android")
83
83
 
84
- api("org.dreamhorizon:pulse-android-sdk:$pulse_version") {
84
+ api("org.dreamhorizon:pulse-android-api:$pulse_version")
85
+ api("org.dreamhorizon:android-agent:$pulse_version") {
86
+ exclude group: "com.squareup.okhttp3", module: "okhttp-jvm"
87
+ }
88
+ api("org.dreamhorizon:pulse-android-sdk-internal:$pulse_version") {
85
89
  exclude group: "com.squareup.okhttp3", module: "okhttp-jvm"
86
90
  }
87
91
  implementation("org.dreamhorizon:pulse-semconv:$pulse_version")
@@ -3,9 +3,12 @@
3
3
  package com.pulsereactnativeotel
4
4
 
5
5
  import android.app.Application
6
- import com.pulse.android.sdk.PulseSDK
6
+ import com.pulse.android.api.otel.PulseBeforeSendData
7
+ import com.pulse.android.api.otel.PulseDataCollectionConsent
8
+ import com.pulse.android.sdk.internal.PulseSDKInternal
7
9
  import com.pulse.semconv.PulseAttributes
8
10
  import io.opentelemetry.android.agent.connectivity.EndpointConnectivity
11
+ import io.opentelemetry.android.agent.connectivity.HttpEndpointConnectivity
9
12
  import io.opentelemetry.android.agent.dsl.DiskBufferingConfigurationSpec
10
13
  import io.opentelemetry.android.agent.dsl.instrumentation.InstrumentationConfiguration
11
14
  import io.opentelemetry.android.agent.session.SessionConfig
@@ -19,24 +22,27 @@ import java.util.function.BiFunction
19
22
  * React Native wrapper for PulseSDK that automatically adds React Native screen name processors.
20
23
  * This ensures React Native screen names override Android Activity/Fragment names in telemetry.
21
24
  */
22
- public object Pulse : PulseSDK by PulseSDK.INSTANCE {
23
- public override fun initialize(
25
+ public object Pulse {
26
+ internal val sdkInternal by lazy { PulseSDKInternal() }
27
+
28
+ @JvmStatic
29
+ public fun initialize(
24
30
  application: Application,
25
31
  endpointBaseUrl: String,
26
- tenantId: String,
27
- endpointHeaders: Map<String, String>,
28
- spanEndpointConnectivity: EndpointConnectivity,
29
- logEndpointConnectivity: EndpointConnectivity,
30
- metricEndpointConnectivity: EndpointConnectivity,
31
- customEventConnectivity: EndpointConnectivity,
32
- configEndpointUrl: String?,
33
- resource: (ResourceBuilder.() -> Unit)?,
34
- sessionConfig: SessionConfig,
35
- globalAttributes: (() -> Attributes)?,
36
- diskBuffering: (DiskBufferingConfigurationSpec.() -> Unit)?,
37
- tracerProviderCustomizer: BiFunction<SdkTracerProviderBuilder, Application, SdkTracerProviderBuilder>?,
38
- loggerProviderCustomizer: BiFunction<SdkLoggerProviderBuilder, Application, SdkLoggerProviderBuilder>?,
39
- instrumentations: (InstrumentationConfiguration.() -> Unit)?,
32
+ projectId: String,
33
+ dataCollectionState: PulseDataCollectionConsent,
34
+ endpointHeaders: Map<String, String> = emptyMap(),
35
+ spanEndpointConnectivity: EndpointConnectivity = HttpEndpointConnectivity.forTraces(endpointBaseUrl, endpointHeaders),
36
+ logEndpointConnectivity: EndpointConnectivity = HttpEndpointConnectivity.forLogs(endpointBaseUrl, endpointHeaders),
37
+ metricEndpointConnectivity: EndpointConnectivity = HttpEndpointConnectivity.forMetrics(endpointBaseUrl, endpointHeaders),
38
+ customEventConnectivity: EndpointConnectivity = logEndpointConnectivity,
39
+ configEndpointUrl: String? = null,
40
+ resource: (ResourceBuilder.() -> Unit)? = null,
41
+ sessionConfig: SessionConfig = SessionConfig.withDefaults(),
42
+ globalAttributes: (() -> Attributes)? = null,
43
+ beforeSendData: PulseBeforeSendData? = null,
44
+ diskBuffering: (DiskBufferingConfigurationSpec.() -> Unit)? = null,
45
+ instrumentations: (InstrumentationConfiguration.() -> Unit)? = null,
40
46
  ) {
41
47
  val rnTracerProviderCustomizer = BiFunction<SdkTracerProviderBuilder, Application, SdkTracerProviderBuilder> { tracerProviderBuilder, _ ->
42
48
  tracerProviderBuilder.addSpanProcessor(ReactNativeScreenAttributesSpanProcessor())
@@ -46,34 +52,17 @@ public object Pulse : PulseSDK by PulseSDK.INSTANCE {
46
52
  loggerProviderBuilder.addLogRecordProcessor(ReactNativeScreenAttributesLogRecordProcessor())
47
53
  }
48
54
 
49
- val mergedTracerProviderCustomizer = if (tracerProviderCustomizer != null) {
50
- BiFunction<SdkTracerProviderBuilder, Application, SdkTracerProviderBuilder> { tracerProviderBuilder, application ->
51
- val builderWithRn = rnTracerProviderCustomizer.apply(tracerProviderBuilder, application)
52
- tracerProviderCustomizer.apply(builderWithRn, application)
53
- }
54
- } else {
55
- rnTracerProviderCustomizer
56
- }
57
-
58
- val mergedLoggerProviderCustomizer = if (loggerProviderCustomizer != null) {
59
- BiFunction<SdkLoggerProviderBuilder, Application, SdkLoggerProviderBuilder> { loggerProviderBuilder, application ->
60
- val builderWithRn = rnLoggerProviderCustomizer.apply(loggerProviderBuilder, application)
61
- loggerProviderCustomizer.apply(builderWithRn, application)
62
- }
63
- } else {
64
- rnLoggerProviderCustomizer
65
- }
66
-
67
55
  // Set telemetry.sdk.name for React Native SDK (read in OpenTelemetryRumInitializer for sampling)
68
56
  val rnResource: (ResourceBuilder.() -> Unit) = {
69
57
  put(PulseAttributes.TELEMETRY_SDK_NAME_KEY, PulseAttributes.PulseSdkNames.ANDROID_RN)
70
58
  resource?.invoke(this)
71
59
  }
72
60
 
73
- PulseSDK.INSTANCE.initialize(
61
+ sdkInternal.initialize(
74
62
  application = application,
75
63
  endpointBaseUrl = endpointBaseUrl,
76
- tenantId = tenantId,
64
+ projectId = projectId,
65
+ dataCollectionState = dataCollectionState,
77
66
  endpointHeaders = endpointHeaders,
78
67
  spanEndpointConnectivity = spanEndpointConnectivity,
79
68
  logEndpointConnectivity = logEndpointConnectivity,
@@ -84,10 +73,18 @@ public object Pulse : PulseSDK by PulseSDK.INSTANCE {
84
73
  sessionConfig = sessionConfig,
85
74
  globalAttributes = globalAttributes,
86
75
  diskBuffering = diskBuffering,
87
- tracerProviderCustomizer = mergedTracerProviderCustomizer,
88
- loggerProviderCustomizer = mergedLoggerProviderCustomizer,
76
+ tracerProviderCustomizer = rnTracerProviderCustomizer,
77
+ loggerProviderCustomizer = rnLoggerProviderCustomizer,
89
78
  instrumentations = instrumentations,
79
+ beforeSendData = beforeSendData,
90
80
  )
91
81
  }
92
- }
93
82
 
83
+ /**
84
+ * Updates the data collection consent state. See [PulseDataCollectionConsent] for all the allowed values
85
+ */
86
+ @JvmStatic
87
+ public fun setDataCollectionState(newState: PulseDataCollectionConsent) {
88
+ sdkInternal.setDataCollectionState(newState)
89
+ }
90
+ }
@@ -3,7 +3,7 @@ package com.pulsereactnativeotel
3
3
  import com.facebook.react.bridge.ReadableArray
4
4
  import com.facebook.react.bridge.ReadableMap
5
5
  import com.facebook.react.bridge.ReadableType
6
- import com.pulse.android.sdk.PulseSDK
6
+ import com.pulse.android.sdk.internal.PulseSDKInternal
7
7
  import com.pulse.semconv.PulseAttributes
8
8
 
9
9
  internal object PulseReactNativeOtelLogger {
@@ -17,7 +17,7 @@ internal object PulseReactNativeOtelLogger {
17
17
  properties?.let { putAll(it.toMap()) }
18
18
  }
19
19
 
20
- PulseSDK.INSTANCE.trackEvent(event, observedTimeMs, params)
20
+ Pulse.sdkInternal.trackEvent(event, observedTimeMs, params)
21
21
  }
22
22
 
23
23
  fun reportException(
@@ -40,7 +40,7 @@ internal object PulseReactNativeOtelLogger {
40
40
  attributes?.let { putAll(it.toMap()) }
41
41
  }
42
42
 
43
- PulseSDK.INSTANCE.trackNonFatal(errorMessage, observedTimeMs, params)
43
+ Pulse.sdkInternal.trackNonFatal(errorMessage, observedTimeMs, params)
44
44
  }
45
45
 
46
46
  private fun getCurrentThreadId(): String {
@@ -5,7 +5,8 @@ import com.facebook.react.bridge.ReactApplicationContext
5
5
  import com.facebook.react.bridge.ReadableMap
6
6
  import com.facebook.react.bridge.WritableMap
7
7
  import com.facebook.react.module.annotations.ReactModule
8
- import com.pulse.android.sdk.PulseSDK
8
+ import com.pulse.android.api.otel.PulseDataCollectionConsent
9
+ import com.pulse.android.sdk.internal.PulseSDKInternal
9
10
  import android.content.Context
10
11
  import android.os.Looper
11
12
  import android.util.Log
@@ -24,7 +25,7 @@ internal class PulseReactNativeOtelModule(reactContext: ReactApplicationContext)
24
25
  }
25
26
 
26
27
  override fun isInitialized(): Boolean {
27
- return PulseSDK.INSTANCE.isInitialized()
28
+ return Pulse.sdkInternal.isInitialized()
28
29
  }
29
30
 
30
31
  override fun setCurrentScreenName(screenName: String): Boolean {
@@ -72,16 +73,16 @@ internal class PulseReactNativeOtelModule(reactContext: ReactApplicationContext)
72
73
  }
73
74
 
74
75
  override fun setUserId(id: String?) {
75
- PulseSDK.INSTANCE.setUserId(id)
76
+ Pulse.sdkInternal.setUserId(id)
76
77
  }
77
78
 
78
79
  override fun setUserProperty(name: String, value: String?) {
79
- PulseSDK.INSTANCE.setUserProperty(name, value)
80
+ Pulse.sdkInternal.setUserProperty(name, value)
80
81
  }
81
82
 
82
83
  override fun setUserProperties(properties: ReadableMap?) {
83
84
  properties?.let { props ->
84
- PulseSDK.INSTANCE.setUserProperties {
85
+ Pulse.sdkInternal.setUserProperties {
85
86
  props.entryIterator.forEach { (key, value) ->
86
87
  put(key, value)
87
88
  }
@@ -89,8 +90,17 @@ internal class PulseReactNativeOtelModule(reactContext: ReactApplicationContext)
89
90
  }
90
91
  }
91
92
 
93
+ override fun setDataCollectionState(state: String) {
94
+ val consent = when (state.uppercase()) {
95
+ "ALLOWED" -> PulseDataCollectionConsent.ALLOWED
96
+ "DENIED" -> PulseDataCollectionConsent.DENIED
97
+ else -> PulseDataCollectionConsent.PENDING
98
+ }
99
+ Pulse.setDataCollectionState(consent)
100
+ }
101
+
92
102
  override fun shutdown(): Boolean {
93
- PulseSDK.INSTANCE.shutdown()
103
+ Pulse.sdkInternal.shutdown()
94
104
  return true
95
105
  }
96
106
 
@@ -108,10 +118,7 @@ internal class PulseReactNativeOtelModule(reactContext: ReactApplicationContext)
108
118
  Context.MODE_PRIVATE
109
119
  )
110
120
 
111
- val configJson = sharedPrefs.getString("sdk_config", null)
112
- if (configJson == null) {
113
- return null
114
- }
121
+ val configJson = sharedPrefs.getString("sdk_config", null) ?: return null
115
122
 
116
123
  val json = Json {
117
124
  ignoreUnknownKeys = true
@@ -22,10 +22,10 @@ internal class PulseReactNativeOtelPackage : BaseReactPackage() {
22
22
  moduleInfos[PulseReactNativeOtelModule.NAME] = ReactModuleInfo(
23
23
  PulseReactNativeOtelModule.NAME,
24
24
  PulseReactNativeOtelModule.NAME,
25
- false, // canOverrideExistingModule
26
- false, // needsEagerInit
27
- false, // isCxxModule
28
- true // isTurboModule
25
+ canOverrideExistingModule = false,
26
+ needsEagerInit = false,
27
+ isCxxModule = false,
28
+ isTurboModule = true,
29
29
  )
30
30
  moduleInfos
31
31
  }
@@ -3,7 +3,7 @@ package com.pulsereactnativeotel
3
3
  import com.facebook.react.bridge.ReadableMap
4
4
  import com.facebook.react.bridge.ReadableArray
5
5
  import com.facebook.react.bridge.ReadableType
6
- import com.pulse.android.sdk.PulseSDK
6
+ import com.pulse.android.sdk.internal.PulseSDKInternal
7
7
  import io.opentelemetry.api.common.AttributeKey
8
8
  import io.opentelemetry.api.trace.Span
9
9
  import io.opentelemetry.api.trace.SpanKind
@@ -16,7 +16,7 @@ import java.util.concurrent.ConcurrentHashMap
16
16
  internal object PulseReactNativeOtelTracer {
17
17
 
18
18
  private val tracer: Tracer by lazy {
19
- PulseSDK.INSTANCE.getOtelOrThrow()
19
+ Pulse.sdkInternal.getOtelOrThrow()
20
20
  .getOpenTelemetry()
21
21
  .tracerProvider
22
22
  .tracerBuilder(PulseOtelConstants.INSTRUMENTATION_SCOPE)
@@ -1,5 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  import { TurboModuleRegistry } from 'react-native';
4
+
5
+ /**
6
+ * Data collection consent state for the Pulse SDK.
7
+ * - PENDING: Telemetry is buffered in memory until consent is granted or denied.
8
+ * - ALLOWED: Buffered signals are flushed and subsequent signals are exported normally.
9
+ * - DENIED: Buffered data is cleared and the SDK is shut down.
10
+ */
11
+ export let PulseDataCollectionConsent = /*#__PURE__*/function (PulseDataCollectionConsent) {
12
+ PulseDataCollectionConsent["PENDING"] = "PENDING";
13
+ PulseDataCollectionConsent["ALLOWED"] = "ALLOWED";
14
+ PulseDataCollectionConsent["DENIED"] = "DENIED";
15
+ return PulseDataCollectionConsent;
16
+ }({});
4
17
  export default TurboModuleRegistry.getEnforcing('PulseReactNativeOtel');
5
18
  //# sourceMappingURL=NativePulseReactNativeOtel.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativePulseReactNativeOtel.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;AA2EpE,eAAeA,mBAAmB,CAACC,YAAY,CAAO,sBAAsB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","PulseDataCollectionConsent","getEnforcing"],"sourceRoot":"../../src","sources":["NativePulseReactNativeOtel.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAA0B,cAAc;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,WAAYC,0BAA0B,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAuFtC,eAAeD,mBAAmB,CAACE,YAAY,CAAO,sBAAsB,CAAC","ignoreList":[]}
@@ -4,8 +4,9 @@ import { setupErrorHandler, uninstallErrorHandler } from "./errorHandler.js";
4
4
  import { isSupportedPlatform } from "./initialization.js";
5
5
  import { createReactNavigationIntegration, uninstallNavigationIntegration } from "./navigation/index.js";
6
6
  import { initializeNetworkInterceptor, uninstallNetworkInterceptor } from "./network-interceptor/initialization.js";
7
- import PulseReactNativeOtel from "./NativePulseReactNativeOtel.js";
7
+ import PulseReactNativeOtel, { PulseDataCollectionConsent } from "./NativePulseReactNativeOtel.js";
8
8
  import { PULSE_FEATURE_NAMES } from "./pulse.constants.js";
9
+ export { PulseDataCollectionConsent };
9
10
  const defaultConfig = {
10
11
  autoDetectExceptions: true,
11
12
  autoDetectNavigation: true,
@@ -105,6 +106,14 @@ export function shutdown() {
105
106
  PulseReactNativeOtel.shutdown();
106
107
  isShutdown = true;
107
108
  }
109
+
110
+ /**
111
+ * Updates the data collection consent state.
112
+ */
113
+ export function setDataCollectionState(state) {
114
+ if (!isSupportedPlatform()) return;
115
+ PulseReactNativeOtel.setDataCollectionState(state);
116
+ }
108
117
  export function createNavigationIntegrationWithConfig(options) {
109
118
  if (!isSupportedPlatform()) {
110
119
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["setupErrorHandler","uninstallErrorHandler","isSupportedPlatform","createReactNavigationIntegration","uninstallNavigationIntegration","initializeNetworkInterceptor","uninstallNetworkInterceptor","PulseReactNativeOtel","PULSE_FEATURE_NAMES","defaultConfig","autoDetectExceptions","autoDetectNavigation","autoDetectNetwork","networkHeaders","requestHeaders","responseHeaders","currentConfig","isShutdown","isStarted","cachedFeatures","getIsShutdown","getIsStarted","getFeaturesFromRemoteConfig","undefined","getAllFeatures","configure","config","resolveFeatureState","features","featureName","optionValue","resolveNavigationState","hasAny","SCREEN_SESSION","RN_SCREEN_LOAD","RN_SCREEN_INTERACTIVE","start","options","console","log","JS_CRASH","NETWORK_INSTRUMENTATION","shutdown","warn","createNavigationIntegrationWithConfig","registerNavigationContainer","_","markContentReady","noop"],"sourceRoot":"../../src","sources":["config.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,qBAAqB,QAAQ,mBAAgB;AACzE,SAASC,mBAAmB,QAAQ,qBAAkB;AACtD,SACEC,gCAAgC,EAChCC,8BAA8B,QAGzB,uBAAc;AACrB,SACEC,4BAA4B,EAC5BC,2BAA2B,QACtB,yCAAsC;AAC7C,OAAOC,oBAAoB,MAAM,iCAA8B;AAE/D,SAASC,mBAAmB,QAAQ,sBAAmB;AAcvD,M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edPlatform","createReactNavigationIntegration","uninstallNavigationIntegration","initializeNetworkInterceptor","uninstallNetworkInterceptor","PulseReactNativeOtel","PulseDataCollectionConsent","PULSE_FEATURE_NAMES","defaultConfig","autoDetectExceptions","autoDetectNavigation","autoDetectNetwork","networkHeaders","requestHeaders","responseHeaders","currentConfig","isShutdown","isStarted","cachedFeatures","getIsShutdown","getIsStarted","getFeaturesFromRemoteConfig","undefined","getAllFeatures","configure","config","resolveFeatureState","features","featureName","optionValue","resolveNavigationState","hasAny","SCREEN_SESSION","RN_SCREEN_LOAD","RN_SCREEN_INTERACTIVE","start","options","console","log","JS_CRASH","NETWORK_INSTRUMENTATION","shutdown","warn","setDataCollectionState","state","createNavigationIntegrationWithConfig","registerNavigationContainer","_","markContentReady","noop"],"sourceRoot":"../../src","sources":["config.ts"],"mappings":";;AAAA,SAASA,iBAAiB,EAAEC,qBAAqB,QAAQ,mBAAgB;AACzE,SAASC,mBAAmB,QAAQ,qBAAkB;AACtD,SACEC,gCAAgC,EAChCC,8BAA8B,QAGzB,uBAAc;AACrB,SACEC,4BAA4B,EAC5BC,2BAA2B,QACtB,yCAAsC;AAC7C,OAAOC,oBAAoB,IACzBC,0BAA0B,QACrB,iCAA8B;AAErC,SAASC,mBAAmB,QAAQ,sBAAmB;AAEvD,SAASD,0BAA0B;AAcnC,MAAME,aAAoC,GAAG;EAC3CC,oBAAoB,EAAE,IAAI;EAC1BC,oBAAoB,EAAE,IAAI;EAC1BC,iBAAiB,EAAE,IAAI;EACvBC,cAAc,EAAE;IACdC,cAAc,EAAE,EAAE;IAClBC,eAAe,EAAE;EACnB;AACF,CAAC;AAED,IAAIC,aAA0B,GAAG;EAAE,GAAGP;AAAc,CAAC;;AAErD;AACA,IAAIQ,UAAU,GAAG,KAAK;;AAEtB;AACA,IAAIC,SAAS,GAAG,KAAK;;AAErB;AACA,IAAIC,cAAkC;AAEtC,OAAO,SAASC,aAAaA,CAAA,EAAY;EACvC,OAAOH,UAAU;AACnB;;AAEA;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AmB,CAAC,CAAC,EAAE;EAC5BK,oBAAoB,CAACsC,sBAAsB,CAACC,KAAK,CAAC;AACpD;AAEA,OAAO,SAASC,qCAAqCA,CACnDT,OAAsC,EACV;EAC5B,IAAI,CAACpC,mBAAmB,CAAC,CAAC,EAAE;IAC1B,OAAO;MACL8C,2BAA2B,EAAGC,CAAU,IAAK,MAAM,CAAC,CAAC;MACrDC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;IAC3B,CAAC;EACH;EACA,IAAI,CAAC/B,SAAS,EAAE;IACd,OAAO;MACL6B,2BAA2B,EAAGC,CAAU,IAAK,MAAM,CAAC,CAAC;MACrDC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;IAC3B,CAAC;EACH;EACA,IAAIhC,UAAU,EAAE;IACd,OAAO;MACL8B,2BAA2B,EAAGC,CAAU,IAAK,MAAM,CAAC,CAAC;MACrDC,gBAAgB,EAAEA,CAAA,KAAM,CAAC;IAC3B,CAAC;EACH;EACA,IAAI,CAACjC,aAAa,CAACL,oBAAoB,EAAE;IACvC2B,OAAO,CAACK,IAAI,CACV,4GACF,CAAC;IACD,MAAMO,IAAgC,GAAG;MACvCH,2BAA2B,EAAGC,CAAU,IAAK,MAAM;QACjDV,OAAO,CAACK,IAAI,CACV,4GACF,CAAC;MACH,CAAC;MACDM,gBAAgB,EAAEA,CAAA,KAAM,CAAC;IAC3B,CAAC;IACD,OAAOC,IAAI;EACb;EACA,OAAOhD,gCAAgC,CAACmC,OAAO,CAAC;AAClD","ignoreList":[]}
@@ -3,17 +3,19 @@
3
3
  import { startSpan, trackSpan } from "./trace.js";
4
4
  import { reportException } from "./errorHandler.js";
5
5
  import { trackEvent } from "./events.js";
6
- import { start, shutdown } from "./config.js";
6
+ import { start, shutdown, setDataCollectionState } from "./config.js";
7
7
  import { isInitialized } from "./initialization.js";
8
8
  import { setGlobalAttribute } from "./globalAttributes.js";
9
9
  import { setUserId, setUserProperty, setUserProperties } from "./user.js";
10
10
  import { ErrorBoundary, withErrorBoundary } from "./errorBoundary.js";
11
11
  import { useNavigationTracking, markContentReady } from "./navigation/index.js";
12
12
  export { SpanStatusCode } from "./trace.js";
13
+ export { PulseDataCollectionConsent } from "./NativePulseReactNativeOtel.js";
13
14
  export const Pulse = {
14
15
  start,
15
16
  shutdown,
16
17
  isInitialized,
18
+ setDataCollectionState,
17
19
  useNavigationTracking,
18
20
  markContentReady,
19
21
  trackEvent,
@@ -1 +1 @@
1
- {"version":3,"names":["startSpan","trackSpan","reportException","trackEvent","start","shutdown","isInitialized","setGlobalAttribute","setUserId","setUserProperty","setUserProperties","ErrorBoundary","withErrorBoundary","useNavigationTracking","markContentReady","SpanStatusCode","Pulse"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,SAAS,QAAQ,YAAS;AAC9C,SAASC,eAAe,QAAQ,mBAAgB;AAChD,SAASC,UAAU,QAAQ,aAAU;AACrC,SAASC,KAAK,EAAEC,QAAQ,QAAQ,aAAU;AAC1C,SAASC,aAAa,QAAQ,qBAAkB;AAChD,SAASC,kBAAkB,QAAQ,uBAAoB;AACvD,SAASC,SAAS,EAAEC,eAAe,EAAEC,iBAAiB,QAAQ,WAAQ;AACtE,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,oBAAiB;AAClE,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAc;AActE,SAASC,cAAc,QAAQ,YAAS;AACxC,OAAO,MAAMC,KAAK,GAAG;EACnBZ,KAAK;EACLC,QAAQ;EACRC,aAAa;EACbO,qBAAqB;EACrBC,gBAAgB;EAChBX,UAAU;EACVD,eAAe;EACfD,SAAS;EACTD,SAAS;EACTO,kBAAkB;EAClBC,SAAS;EACTC,eAAe;EACfC,iBAAiB;EACjBC,aAAa;EACbC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["startSpan","trackSpan","reportException","trackEvent","start","shutdown","setDataCollectionState","isInitialized","setGlobalAttribute","setUserId","setUserProperty","setUserProperties","ErrorBoundary","withErrorBoundary","useNavigationTracking","markContentReady","SpanStatusCode","PulseDataCollectionConsent","Pulse"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,SAAS,QAAQ,YAAS;AAC9C,SAASC,eAAe,QAAQ,mBAAgB;AAChD,SAASC,UAAU,QAAQ,aAAU;AACrC,SAASC,KAAK,EAAEC,QAAQ,EAAEC,sBAAsB,QAAQ,aAAU;AAClE,SAASC,aAAa,QAAQ,qBAAkB;AAChD,SAASC,kBAAkB,QAAQ,uBAAoB;AACvD,SAASC,SAAS,EAAEC,eAAe,EAAEC,iBAAiB,QAAQ,WAAQ;AACtE,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,oBAAiB;AAClE,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,uBAAc;AActE,SAASC,cAAc,QAAQ,YAAS;AACxC,SAASC,0BAA0B,QAAQ,iCAA8B;AAEzE,OAAO,MAAMC,KAAK,GAAG;EACnBd,KAAK;EACLC,QAAQ;EACRE,aAAa;EACbD,sBAAsB;EACtBQ,qBAAqB;EACrBC,gBAAgB;EAChBZ,UAAU;EACVD,eAAe;EACfD,SAAS;EACTD,SAAS;EACTQ,kBAAkB;EAClBC,SAAS;EACTC,eAAe;EACfC,iBAAiB;EACjBC,aAAa;EACbC;AACF,CAAC","ignoreList":[]}
@@ -11,7 +11,13 @@ interface IInteractionConfig {
11
11
  }
12
12
  export interface PulsePluginProps {
13
13
  endpointBaseUrl: string;
14
- tenantId: string;
14
+ projectId: string;
15
+ /**
16
+ * Initial data collection consent state.
17
+ * Defaults to PENDING (buffers all telemetry until setDataCollectionState is called).
18
+ * Use ALLOWED to skip buffering and export immediately.
19
+ */
20
+ dataCollectionState?: 'PENDING' | 'ALLOWED' | 'DENIED';
15
21
  endpointHeaders?: Record<string, string>;
16
22
  /**
17
23
  * Optional custom URL for fetching SDK configuration.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../plugin/src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,EAAE,GACR,MAAM,EAAE,GACR,OAAO,EAAE,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,mBAAmB,GAAG,SAAS,GAAG,IAAI,CACvC,CAAC;AAEF,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,kBAAkB,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../plugin/src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,EAAE,GACR,MAAM,EAAE,GACR,OAAO,EAAE,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG,MAAM,CAClC,MAAM,EACN,mBAAmB,GAAG,SAAS,GAAG,IAAI,CACvC,CAAC;AAEF,UAAU,kBAAkB;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACvD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,eAAe,CAAC,EAAE;QAChB,WAAW,CAAC,EAAE,kBAAkB,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC;CACH"}
@@ -1,9 +1,11 @@
1
1
  export declare const PULSE_IMPORT = "import com.pulsereactnativeotel.Pulse\n";
2
+ export declare const PULSE_DATA_COLLECTION_CONSENT_IMPORT = "import com.pulse.android.api.otel.PulseDataCollectionConsent\n";
2
3
  export declare const ATTRIBUTES_IMPORT = "import io.opentelemetry.api.common.Attributes\nimport io.opentelemetry.api.common.AttributeKey\n";
3
4
  import type { PulsePluginProps } from './types';
4
5
  export declare function buildPulseInitializationCode(options: {
5
6
  endpointBaseUrl: string;
6
- tenantId: string;
7
+ projectId: string;
8
+ dataCollectionState?: PulsePluginProps['dataCollectionState'];
7
9
  endpointHeaders?: Record<string, string>;
8
10
  configEndpointUrl?: string;
9
11
  globalAttributes?: PulsePluginProps['globalAttributes'];
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../plugin/src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,4CAA4C,CAAC;AAEtE,eAAO,MAAM,iBAAiB,qGACsE,CAAC;AAErG,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AA6DjE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CACvD,GAAG,MAAM,CAmET"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../plugin/src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,4CAA4C,CAAC;AACtE,eAAO,MAAM,oCAAoC,mEACiB,CAAC;AAEnE,eAAO,MAAM,iBAAiB,qGACsE,CAAC;AAErG,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AA6DjE,wBAAgB,4BAA4B,CAAC,OAAO,EAAE;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACxD,eAAe,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;CACvD,GAAG,MAAM,CA6ET"}
@@ -1 +1 @@
1
- {"version":3,"file":"withAndroidPulse.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withAndroidPulse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AASzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CA6D3D,CAAC"}
1
+ {"version":3,"file":"withAndroidPulse.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withAndroidPulse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAUzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,CAwE3D,CAAC"}
@@ -1,4 +1,15 @@
1
1
  import { type TurboModule } from 'react-native';
2
+ /**
3
+ * Data collection consent state for the Pulse SDK.
4
+ * - PENDING: Telemetry is buffered in memory until consent is granted or denied.
5
+ * - ALLOWED: Buffered signals are flushed and subsequent signals are exported normally.
6
+ * - DENIED: Buffered data is cleared and the SDK is shut down.
7
+ */
8
+ export declare enum PulseDataCollectionConsent {
9
+ PENDING = "PENDING",
10
+ ALLOWED = "ALLOWED",
11
+ DENIED = "DENIED"
12
+ }
2
13
  export interface Spec extends TurboModule {
3
14
  /** Check if native SDK is initialized */
4
15
  isInitialized(): boolean;
@@ -38,6 +49,13 @@ export interface Spec extends TurboModule {
38
49
  custom_events: boolean;
39
50
  js_crash: boolean;
40
51
  } | null;
52
+ /**
53
+ * Update the data collection consent state.
54
+ * - ALLOWED: flushes buffered signals and resumes normal export.
55
+ * - DENIED: clears buffered data and shuts down the SDK.
56
+ * - PENDING: no-op once the SDK is initialized.
57
+ */
58
+ setDataCollectionState(state: PulseDataCollectionConsent): void;
41
59
  /** Shut down the Pulse SDK. After this, re-init is not supported. */
42
60
  shutdown(): boolean;
43
61
  }
@@ -1 +1 @@
1
- {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OAAO,CAAC;QAC/B,uBAAuB,EAAE,OAAO,CAAC;QACjC,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,IAAI,CAAC;IAET;;;;;OAKG;IACH,sBAAsB,CAAC,KAAK,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAEhE,qEAAqE;IACrE,QAAQ,IAAI,OAAO,CAAC;CACrB;;AAED,wBAA8E"}
@@ -1,5 +1,7 @@
1
1
  import { type ReactNavigationIntegration, type NavigationIntegrationOptions } from './navigation';
2
+ import { PulseDataCollectionConsent } from './NativePulseReactNativeOtel';
2
3
  import type { PulseFeatureConfig } from './pulse.interface';
4
+ export { PulseDataCollectionConsent };
3
5
  export type NetworkHeaderConfig = {
4
6
  requestHeaders?: string[];
5
7
  responseHeaders?: string[];
@@ -20,5 +22,9 @@ export declare function getIsStarted(): boolean;
20
22
  export declare function getFeaturesFromRemoteConfig(): PulseFeatureConfig;
21
23
  export declare function start(options?: PulseConfig): void;
22
24
  export declare function shutdown(): void;
25
+ /**
26
+ * Updates the data collection consent state.
27
+ */
28
+ export declare function setDataCollectionState(state: PulseDataCollectionConsent): void;
23
29
  export declare function createNavigationIntegrationWithConfig(options?: NavigationIntegrationOptions): ReactNavigationIntegration;
24
30
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAClC,MAAM,cAAc,CAAC;AAMtB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,oBAAoB,CAAC,EAAE,OAA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AAgB,2BAA2B,IAAI,kBAAkB,CAOhE;AA2CD,wBAAgB,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAqCjD;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAU/B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,0BAA0B,GAChC,IAAI,CAGN;AAED,wBAAgB,qCAAqC,CACnD,OAAO,CAAC,EAAE,4BAA4B,GACrC,0BAA0B,CAkC5B"}
@@ -1,7 +1,7 @@
1
1
  import { startSpan, trackSpan } from './trace';
2
2
  import { reportException } from './errorHandler';
3
3
  import { trackEvent } from './events';
4
- import { start, shutdown } from './config';
4
+ import { start, shutdown, setDataCollectionState } from './config';
5
5
  import { isInitialized } from './initialization';
6
6
  import { setGlobalAttribute } from './globalAttributes';
7
7
  import { setUserId, setUserProperty, setUserProperties } from './user';
@@ -14,10 +14,12 @@ export type { PulseAttributes, PulseAttributeValue } from './pulse.interface';
14
14
  export type { ReactNavigationIntegration, NavigationRoute, NavigationIntegrationOptions, } from './navigation';
15
15
  export type { ErrorBoundaryProps, FallbackRender } from './errorBoundary';
16
16
  export { SpanStatusCode } from './trace';
17
+ export { PulseDataCollectionConsent } from './NativePulseReactNativeOtel';
17
18
  export declare const Pulse: {
18
19
  start: typeof start;
19
20
  shutdown: typeof shutdown;
20
21
  isInitialized: typeof isInitialized;
22
+ setDataCollectionState: typeof setDataCollectionState;
21
23
  useNavigationTracking: typeof useNavigationTracking;
22
24
  markContentReady: typeof markContentReady;
23
25
  trackEvent: typeof trackEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE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xD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEvE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,YAAY,EACV,0BAA0B,EAC1B,eAAe,EACf,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;CAiBjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamhorizonorg/pulse-react-native",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Production-grade observability SDK for React Native applications with OpenTelemetry support. Real-time monitoring, error tracking, performance insights, and distributed tracing.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -11,7 +11,13 @@ interface IInteractionConfig {
11
11
  }
12
12
  export interface PulsePluginProps {
13
13
  endpointBaseUrl: string;
14
- tenantId: string;
14
+ projectId: string;
15
+ /**
16
+ * Initial data collection consent state.
17
+ * Defaults to PENDING (buffers all telemetry until setDataCollectionState is called).
18
+ * Use ALLOWED to skip buffering and export immediately.
19
+ */
20
+ dataCollectionState?: 'PENDING' | 'ALLOWED' | 'DENIED';
15
21
  endpointHeaders?: Record<string, string>;
16
22
  /**
17
23
  * Optional custom URL for fetching SDK configuration.
@@ -1,9 +1,11 @@
1
1
  export declare const PULSE_IMPORT = "import com.pulsereactnativeotel.Pulse\n";
2
+ export declare const PULSE_DATA_COLLECTION_CONSENT_IMPORT = "import com.pulse.android.api.otel.PulseDataCollectionConsent\n";
2
3
  export declare const ATTRIBUTES_IMPORT = "import io.opentelemetry.api.common.Attributes\nimport io.opentelemetry.api.common.AttributeKey\n";
3
4
  import type { PulsePluginProps } from './types';
4
5
  export declare function buildPulseInitializationCode(options: {
5
6
  endpointBaseUrl: string;
6
- tenantId: string;
7
+ projectId: string;
8
+ dataCollectionState?: PulsePluginProps['dataCollectionState'];
7
9
  endpointHeaders?: Record<string, string>;
8
10
  configEndpointUrl?: string;
9
11
  globalAttributes?: PulsePluginProps['globalAttributes'];
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ATTRIBUTES_IMPORT = exports.PULSE_IMPORT = void 0;
3
+ exports.ATTRIBUTES_IMPORT = exports.PULSE_DATA_COLLECTION_CONSENT_IMPORT = exports.PULSE_IMPORT = void 0;
4
4
  exports.buildPulseInitializationCode = buildPulseInitializationCode;
5
5
  exports.PULSE_IMPORT = 'import com.pulsereactnativeotel.Pulse\n';
6
+ exports.PULSE_DATA_COLLECTION_CONSENT_IMPORT = 'import com.pulse.android.api.otel.PulseDataCollectionConsent\n';
6
7
  exports.ATTRIBUTES_IMPORT = 'import io.opentelemetry.api.common.Attributes\nimport io.opentelemetry.api.common.AttributeKey\n';
7
8
  function buildEndpointHeadersMap(headers) {
8
9
  const entries = Object.entries(headers).map(([k, v]) => {
@@ -59,9 +60,10 @@ function buildGlobalAttributesLambda(attributes) {
59
60
  return `{\n Attributes.builder().apply {\n${formatted}\n }.build()\n }`;
60
61
  }
61
62
  function buildPulseInitializationCode(options) {
62
- const { endpointBaseUrl, tenantId, endpointHeaders, configEndpointUrl, globalAttributes, instrumentation, } = options;
63
+ const { endpointBaseUrl, projectId, dataCollectionState, endpointHeaders, configEndpointUrl, globalAttributes, instrumentation, } = options;
63
64
  const params = [];
64
- params.push(`tenantId = "${tenantId}"`);
65
+ params.push(`projectId = "${projectId}"`);
66
+ params.push(`dataCollectionState = PulseDataCollectionConsent.${dataCollectionState ?? 'PENDING'}`);
65
67
  if (endpointHeaders && Object.keys(endpointHeaders).length > 0) {
66
68
  params.push(`endpointHeaders = ${buildEndpointHeadersMap(endpointHeaders)}`);
67
69
  }
@@ -74,6 +76,10 @@ function buildPulseInitializationCode(options) {
74
76
  if (attributesLambda && attributesLambda !== 'null') {
75
77
  params.push(`globalAttributes = ${attributesLambda}`);
76
78
  }
79
+ // TODO: beforeSendData requires a Kotlin subclass of PulseBeforeSendData which cannot
80
+ // be expressed in a static app.json config. Expo users should configure it directly
81
+ // in their native MainApplication.kt instead of through this plugin.
82
+ params.push('beforeSendData = null');
77
83
  let code = `\n Pulse.initialize(\n this,\n "${endpointBaseUrl}",\n ${params.join(',\n ')}\n ) {\n`;
78
84
  if (instrumentation?.interaction !== undefined) {
79
85
  if (instrumentation.interaction.url) {
@@ -7,7 +7,7 @@ const utils_1 = require("./utils");
7
7
  const withAndroidPulse = (config, props) => {
8
8
  return (0, config_plugins_1.withMainApplication)(config, (modConfig) => {
9
9
  try {
10
- const { endpointBaseUrl, tenantId, endpointHeaders, configEndpointUrl, globalAttributes, instrumentation, } = props;
10
+ const { endpointBaseUrl, projectId, dataCollectionState, endpointHeaders, configEndpointUrl, globalAttributes, instrumentation, } = props;
11
11
  // 1. Add import statements
12
12
  modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
13
13
  src: modConfig.modResults.contents,
@@ -17,6 +17,14 @@ const withAndroidPulse = (config, props) => {
17
17
  anchor: /import\s+com\.facebook\.react\.ReactApplication/,
18
18
  offset: 1,
19
19
  }).contents;
20
+ modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
21
+ src: modConfig.modResults.contents,
22
+ newSrc: utils_1.PULSE_DATA_COLLECTION_CONSENT_IMPORT,
23
+ tag: 'pulse-data-collection-consent-import',
24
+ comment: '//',
25
+ anchor: /import\s+com\.pulsereactnativeotel\.Pulse/,
26
+ offset: 1,
27
+ }).contents;
20
28
  if (globalAttributes && Object.keys(globalAttributes).length > 0) {
21
29
  modConfig.modResults.contents = (0, generateCode_1.mergeContents)({
22
30
  src: modConfig.modResults.contents,
@@ -29,7 +37,8 @@ const withAndroidPulse = (config, props) => {
29
37
  }
30
38
  const initCode = (0, utils_1.buildPulseInitializationCode)({
31
39
  endpointBaseUrl,
32
- tenantId,
40
+ projectId,
41
+ dataCollectionState,
33
42
  endpointHeaders,
34
43
  configEndpointUrl,
35
44
  globalAttributes,
@@ -28,6 +28,10 @@ uploadCommand
28
28
  '-u, --api-url <url>',
29
29
  'URL for uploading source maps and related build artifacts.'
30
30
  )
31
+ .requiredOption(
32
+ '-k, --api-key <key>',
33
+ 'API key for authenticating API requests (sent as X-API-KEY header)'
34
+ )
31
35
  .requiredOption(
32
36
  '-v, --app-version <version>',
33
37
  'App version of the application (e.g., 1.0.0)'
@@ -57,6 +61,10 @@ uploadCommand
57
61
  '-u, --api-url <url>',
58
62
  'URL for uploading source maps and related build artifacts.'
59
63
  )
64
+ .requiredOption(
65
+ '-k, --api-key <key>',
66
+ 'API key for authenticating API requests (sent as X-API-KEY header)'
67
+ )
60
68
  .requiredOption(
61
69
  '-v, --bundle-version <version>',
62
70
  'Bundle version from Info.plist CFBundleShortVersionString (e.g., 1.0.0)'
@@ -19,6 +19,10 @@ function buildMetadata(files, appVersion, versionCode, platform, bundleId) {
19
19
  }
20
20
 
21
21
  async function uploadFiles(commandName, options) {
22
+ if (!options.apiKey) {
23
+ throw new Error('API key is required. Use --api-key=<key>');
24
+ }
25
+
22
26
  const platform = getPlatform(commandName);
23
27
  const files = validateFiles(options);
24
28
  const version =
@@ -82,6 +86,9 @@ async function uploadFiles(commandName, options) {
82
86
 
83
87
  const response = await fetch(options.apiUrl, {
84
88
  method: 'POST',
89
+ headers: {
90
+ 'X-API-KEY': options.apiKey,
91
+ },
85
92
  body: formData,
86
93
  });
87
94
 
@@ -1,5 +1,17 @@
1
1
  import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
2
 
3
+ /**
4
+ * Data collection consent state for the Pulse SDK.
5
+ * - PENDING: Telemetry is buffered in memory until consent is granted or denied.
6
+ * - ALLOWED: Buffered signals are flushed and subsequent signals are exported normally.
7
+ * - DENIED: Buffered data is cleared and the SDK is shut down.
8
+ */
9
+ export enum PulseDataCollectionConsent {
10
+ PENDING = 'PENDING',
11
+ ALLOWED = 'ALLOWED',
12
+ DENIED = 'DENIED',
13
+ }
14
+
3
15
  export interface Spec extends TurboModule {
4
16
  /** Check if native SDK is initialized */
5
17
  isInitialized(): boolean;
@@ -69,6 +81,14 @@ export interface Spec extends TurboModule {
69
81
  js_crash: boolean;
70
82
  } | null;
71
83
 
84
+ /**
85
+ * Update the data collection consent state.
86
+ * - ALLOWED: flushes buffered signals and resumes normal export.
87
+ * - DENIED: clears buffered data and shuts down the SDK.
88
+ * - PENDING: no-op once the SDK is initialized.
89
+ */
90
+ setDataCollectionState(state: PulseDataCollectionConsent): void;
91
+
72
92
  /** Shut down the Pulse SDK. After this, re-init is not supported. */
73
93
  shutdown(): boolean;
74
94
  }
package/src/config.ts CHANGED
@@ -10,10 +10,14 @@ import {
10
10
  initializeNetworkInterceptor,
11
11
  uninstallNetworkInterceptor,
12
12
  } from './network-interceptor/initialization';
13
- import PulseReactNativeOtel from './NativePulseReactNativeOtel';
13
+ import PulseReactNativeOtel, {
14
+ PulseDataCollectionConsent,
15
+ } from './NativePulseReactNativeOtel';
14
16
  import type { PulseFeatureConfig } from './pulse.interface';
15
17
  import { PULSE_FEATURE_NAMES } from './pulse.constants';
16
18
 
19
+ export { PulseDataCollectionConsent };
20
+
17
21
  export type NetworkHeaderConfig = {
18
22
  requestHeaders?: string[];
19
23
  responseHeaders?: string[];
@@ -161,6 +165,16 @@ export function shutdown(): void {
161
165
  isShutdown = true;
162
166
  }
163
167
 
168
+ /**
169
+ * Updates the data collection consent state.
170
+ */
171
+ export function setDataCollectionState(
172
+ state: PulseDataCollectionConsent
173
+ ): void {
174
+ if (!isSupportedPlatform()) return;
175
+ PulseReactNativeOtel.setDataCollectionState(state);
176
+ }
177
+
164
178
  export function createNavigationIntegrationWithConfig(
165
179
  options?: NavigationIntegrationOptions
166
180
  ): ReactNavigationIntegration {
package/src/index.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { startSpan, trackSpan } from './trace';
2
2
  import { reportException } from './errorHandler';
3
3
  import { trackEvent } from './events';
4
- import { start, shutdown } from './config';
4
+ import { start, shutdown, setDataCollectionState } from './config';
5
5
  import { isInitialized } from './initialization';
6
6
  import { setGlobalAttribute } from './globalAttributes';
7
7
  import { setUserId, setUserProperty, setUserProperties } from './user';
@@ -21,10 +21,13 @@ export type {
21
21
  export type { ErrorBoundaryProps, FallbackRender } from './errorBoundary';
22
22
 
23
23
  export { SpanStatusCode } from './trace';
24
+ export { PulseDataCollectionConsent } from './NativePulseReactNativeOtel';
25
+
24
26
  export const Pulse = {
25
27
  start,
26
28
  shutdown,
27
29
  isInitialized,
30
+ setDataCollectionState,
28
31
  useNavigationTracking,
29
32
  markContentReady,
30
33
  trackEvent,