@coralogix/react-native-plugin 0.6.4 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 0.7.1 (2026-07-09)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - mask session replay views on the New Architecture (Fabric)
6
+
7
+ ## 0.7.0 (2026-07-06)
8
+
9
+ ### 🚀 Features
10
+
11
+ - bridge createNewSession() + bump native SDKs (iOS 2.10.0 / Android 2.17.1)
12
+
13
+ ## 0.6.5 (2026-06-30)
14
+
15
+ This was a version bump only for cx-plugin to align it with other projects, there were no code changes.
16
+
1
17
  ## 0.6.4 (2026-06-25)
2
18
 
3
19
  ### 🩹 Fixes
package/CxSdk.podspec CHANGED
@@ -16,9 +16,9 @@ Pod::Spec.new do |s|
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
- s.dependency 'Coralogix','2.9.2'
20
- s.dependency 'CoralogixInternal','2.9.2'
21
- s.dependency 'SessionReplay','2.9.2'
19
+ s.dependency 'Coralogix','2.10.0'
20
+ s.dependency 'CoralogixInternal','2.10.0'
21
+ s.dependency 'SessionReplay','2.10.0'
22
22
 
23
23
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
24
24
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
package/README.md CHANGED
@@ -118,6 +118,15 @@ Use the NavigationContainer onStateChange callback to track route changes and up
118
118
  </NavigationContainer>
119
119
  ```
120
120
 
121
+ ### Recreate Session
122
+
123
+ Recreate the RUM session on demand — for example, on user logout — so that
124
+ subsequent events belong to a fresh session with a new session id.
125
+
126
+ ```javascript
127
+ CoralogixRum.createNewSession();
128
+ ```
129
+
121
130
  ### Instrumentation's
122
131
 
123
132
  Turn on/off specific instrumentation; defaults to true for all.
@@ -458,7 +467,7 @@ import { SessionReplay } from '@coralogix/react-native-plugin';
458
467
  </View>
459
468
  ```
460
469
 
461
- The `SessionReplay.maskView` function accepts a `LayoutChangeEvent` and will mask the view in session replay recordings.
470
+ The `SessionReplay.maskView` function accepts a `LayoutChangeEvent` and will mask the view in session replay recordings. It works on both the legacy and the New Architecture (Fabric).
462
471
 
463
472
 
464
473
  ### Optional - Coralogix Gradle Plugin (Android)
@@ -84,7 +84,7 @@ dependencies {
84
84
  implementation "com.facebook.react:react-android"
85
85
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
86
86
 
87
- implementation "com.coralogix:android-sdk:2.16.2"
87
+ implementation "com.coralogix:android-sdk:2.17.1"
88
88
 
89
89
  testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
90
90
  testImplementation "org.mockito:mockito-core:5.12.0"
@@ -43,7 +43,8 @@ import com.facebook.react.bridge.WritableMap
43
43
  import com.facebook.react.modules.core.DeviceEventManagerModule
44
44
  import org.json.JSONArray
45
45
  import org.json.JSONObject
46
- import com.facebook.react.uimanager.UIManagerModule
46
+ import com.facebook.react.bridge.UiThreadUtil
47
+ import com.facebook.react.uimanager.UIManagerHelper
47
48
  import java.util.concurrent.ConcurrentHashMap
48
49
 
49
50
  class CxSdkModule(reactContext: ReactApplicationContext) :
@@ -223,6 +224,14 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
223
224
  }
224
225
  }
225
226
 
227
+ @ReactMethod
228
+ override fun createNewSession(promise: Promise) {
229
+ Handler(Looper.getMainLooper()).post {
230
+ CoralogixRum.createNewSession()
231
+ promise.resolve(true)
232
+ }
233
+ }
234
+
226
235
  @ReactMethod
227
236
  fun reportUserInteraction(interaction: ReadableMap) {
228
237
  val attributesMap = if (interaction.hasKey("attributes") && !interaction.isNull("attributes"))
@@ -303,11 +312,18 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
303
312
 
304
313
  @ReactMethod
305
314
  override fun maskViewByTag(viewTag: Int) {
306
- val uiManager = reactApplicationContext.getNativeModule(UIManagerModule::class.java)
307
-
308
- uiManager?.addUIBlock { nativeViewHierarchyManager ->
315
+ // Resolve the view through the architecture-agnostic UIManagerHelper so this
316
+ // works on both the legacy (Paper) and New (Fabric) architectures.
317
+ // getNativeModule(UIManagerModule) only exists on Paper; under Fabric it
318
+ // returns null and masking silently no-ops. UIManagerHelper routes by tag:
319
+ // legacy tags -> UIManagerModule, Fabric tags -> FabricUIManager, both
320
+ // exposing UIManager.resolveView(tag).
321
+ val context = reactApplicationContext
322
+ // FabricUIManager.resolveView must be called on the UI thread.
323
+ UiThreadUtil.runOnUiThread {
309
324
  try {
310
- val view = nativeViewHierarchyManager.resolveView(viewTag)
325
+ val uiManager = UIManagerHelper.getUIManagerForReactTag(context, viewTag)
326
+ val view = uiManager?.resolveView(viewTag)
311
327
  view?.maskView()
312
328
  } catch (t: Throwable) {
313
329
  t.printStackTrace()
@@ -24,6 +24,7 @@ interface RUMClient {
24
24
  fun reportMobileVitalsMeasurementSet(type: String, metrics: ReadableArray)
25
25
  fun isCoralogixGradlePluginApplied(promise: Promise)
26
26
  fun shutdown(promise: Promise)
27
+ fun createNewSession(promise: Promise)
27
28
 
28
29
  // custom spans
29
30
  fun startGlobalSpan(name: String, labels: ReadableMap?, ignoredInstruments: ReadableArray?, promise: Promise)
package/index.cjs.js CHANGED
@@ -537,7 +537,7 @@ function stopJsRefreshRateSampler() {
537
537
  appStateSub = null;
538
538
  }
539
539
 
540
- var version = "0.6.4";
540
+ var version = "0.7.1";
541
541
  var pkg = {
542
542
  version: version};
543
543
 
@@ -1081,6 +1081,13 @@ const CoralogixRum = {
1081
1081
  _deregisterInstrumentations = undefined;
1082
1082
  cleanupResources();
1083
1083
  },
1084
+ createNewSession: () => {
1085
+ if (!isInited) {
1086
+ logger.debug('CoralogixRum must be initiated before creating a new session');
1087
+ return;
1088
+ }
1089
+ CxSdk.createNewSession();
1090
+ },
1084
1091
  setApplicationContext: applicationContext => {
1085
1092
  if (!isInited) {
1086
1093
  logger.debug('CoralogixRum must be initiated before setting application context');
package/index.esm.js CHANGED
@@ -535,7 +535,7 @@ function stopJsRefreshRateSampler() {
535
535
  appStateSub = null;
536
536
  }
537
537
 
538
- var version = "0.6.4";
538
+ var version = "0.7.1";
539
539
  var pkg = {
540
540
  version: version};
541
541
 
@@ -1079,6 +1079,13 @@ const CoralogixRum = {
1079
1079
  _deregisterInstrumentations = undefined;
1080
1080
  cleanupResources();
1081
1081
  },
1082
+ createNewSession: () => {
1083
+ if (!isInited) {
1084
+ logger.debug('CoralogixRum must be initiated before creating a new session');
1085
+ return;
1086
+ }
1087
+ CxSdk.createNewSession();
1088
+ },
1082
1089
  setApplicationContext: applicationContext => {
1083
1090
  if (!isInited) {
1084
1091
  logger.debug('CoralogixRum must be initiated before setting application context');
package/ios/CxSdk.mm CHANGED
@@ -46,6 +46,9 @@ RCT_EXTERN_METHOD(reportUserInteraction:(NSDictionary *)interaction)
46
46
  RCT_EXTERN_METHOD(shutdown:(RCTPromiseResolveBlock)resolve
47
47
  withRejecter:(RCTPromiseRejectBlock)reject)
48
48
 
49
+ RCT_EXTERN_METHOD(createNewSession:(RCTPromiseResolveBlock)resolve
50
+ withRejecter:(RCTPromiseRejectBlock)reject)
51
+
49
52
  RCT_EXTERN_METHOD(reportError:(NSDictionary *)errorDictionary
50
53
  withResolver:(RCTPromiseResolveBlock)resolve
51
54
  withRejecter:(RCTPromiseRejectBlock)reject)
package/ios/CxSdk.swift CHANGED
@@ -214,6 +214,17 @@ class CxSdk: RCTEventEmitter {
214
214
  resolve("shutdown success")
215
215
  }
216
216
 
217
+ @objc(createNewSession:withRejecter:)
218
+ func createNewSession(resolve:RCTPromiseResolveBlock,
219
+ reject:RCTPromiseRejectBlock) -> Void {
220
+ guard let coralogixRum = coralogixRum else {
221
+ reject("CX_SDK_ERROR", "CoralogixRum must be initialized before createNewSession. Call CoralogixRum.init() first.", nil)
222
+ return
223
+ }
224
+ coralogixRum.createNewSession()
225
+ resolve(true)
226
+ }
227
+
217
228
  @objc(reportError:withResolver:withRejecter:)
218
229
  func reportError(errorDictionary:NSDictionary,
219
230
  resolve:@escaping RCTPromiseResolveBlock,
@@ -340,25 +351,34 @@ class CxSdk: RCTEventEmitter {
340
351
  func maskViewByTag(viewTag: NSNumber,
341
352
  resolve:@escaping RCTPromiseResolveBlock,
342
353
  reject:@escaping RCTPromiseRejectBlock) -> Void {
343
- guard
344
- let bridge = RCTBridge.current(),
345
- let uiManager = bridge.uiManager
346
- else {
347
- reject("MASK_VIEW_ERROR", "no ui manager found, aborting maskViewByTag", nil)
354
+ guard let bridge = RCTBridge.current() else {
355
+ reject("MASK_VIEW_ERROR", "no bridge found, aborting maskViewByTag", nil)
348
356
  return
349
357
  }
350
358
 
351
- RCTExecuteOnUIManagerQueue {
352
- uiManager.addUIBlock { (_, viewRegistry) in
353
- if let view = viewRegistry?[viewTag] as? UIView {
354
- DispatchQueue.main.async {
355
- view.cxMask = true
356
- resolve("view with tag \(viewTag) marked for masking")
357
- }
358
- } else {
359
- reject("MASK_VIEW_ERROR", "view with tag \(viewTag) not found, aborting maskViewByTag", nil)
360
- }
359
+ // View resolution and the cxMask mutation must happen on the main thread.
360
+ DispatchQueue.main.async {
361
+ // New Architecture (Fabric): mounted views live in the component-view
362
+ // registry, not the legacy RCTUIManager registry. Resolve them via the
363
+ // surface presenter; without this, masking silently no-ops on Fabric.
364
+ // The presenter is typed non-null but is absent on the legacy
365
+ // architecture, so bind it through an optional before use.
366
+ let surfacePresenter: (any RCTSurfacePresenterStub)? = bridge.surfacePresenter()
367
+ if let surfacePresenter = surfacePresenter,
368
+ let view = surfacePresenter.findComponentView(withTag_DO_NOT_USE_DEPRECATED: viewTag.intValue) {
369
+ view.cxMask = true
370
+ resolve("view with tag \(viewTag) marked for masking")
371
+ return
361
372
  }
373
+
374
+ // Legacy (Paper) architecture.
375
+ if let view = bridge.uiManager?.view(forReactTag: viewTag) {
376
+ view.cxMask = true
377
+ resolve("view with tag \(viewTag) marked for masking")
378
+ return
379
+ }
380
+
381
+ reject("MASK_VIEW_ERROR", "view with tag \(viewTag) not found, aborting maskViewByTag", nil)
362
382
  }
363
383
  }
364
384
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coralogix/react-native-plugin",
3
- "version": "0.6.4",
3
+ "version": "0.7.1",
4
4
  "description": "Official Coralogix React Native plugin",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Coralogix",
package/src/index.d.ts CHANGED
@@ -26,6 +26,7 @@ interface CxSdkClient {
26
26
  reportError(details: Record<string, unknown>): void;
27
27
  reportNetworkRequest(details: NetworkRequestDetails): void;
28
28
  shutdown(): Promise<boolean>;
29
+ createNewSession(): Promise<boolean>;
29
30
  sendCxSpanData(results: CxSpan[]): void;
30
31
  reportMobileVitalsMeasurement(type: string, value: number, units: string): void;
31
32
  reportMobileVitalsMeasurementSet(type: string, metrics: HybridMetric[]): void;
@@ -17,6 +17,11 @@ export interface CoralogixOtelWebType extends SendLog {
17
17
  * Turn CoralogixRum off.
18
18
  */
19
19
  shutdown: () => void;
20
+ /**
21
+ * Recreate the RUM session on demand (e.g. on user logout) so subsequent
22
+ * events belong to a fresh session.
23
+ */
24
+ createNewSession: () => void;
20
25
  /** Sets labels to be added to every log after CoralogixRum initialization. */
21
26
  setLabels: (labels: CoralogixRumLabels) => void;
22
27
  /**