noibu-react-native 0.2.34-rc.3 → 0.2.34-rc.4

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/dist/constants.js CHANGED
@@ -24,7 +24,7 @@ const CONTENT_TYPE = 'content-type';
24
24
  * Gets the script id from the cookie object, returns default if cannot be found
25
25
  */
26
26
  function GET_SCRIPT_ID() {
27
- return "1.0.104-rn-sdk-0.2.34-rc.3" ;
27
+ return "1.0.104-rn-sdk-0.2.34-rc.4" ;
28
28
  }
29
29
  /**
30
30
  * Gets the max metro recon number
@@ -34,6 +34,7 @@ export interface SessionRecorderConfig {
34
34
  }
35
35
  /**
36
36
  * Initializes the Noibu - Session recording SDK if the API level is supported.
37
+ * Supports both legacy (bridge) and new architecture (TurboModule) on iOS and Android.
37
38
  */
38
39
  export declare function initialize(): void;
39
40
  export type RecorderEvent = import('./types').RecorderEvent;
@@ -12,7 +12,6 @@ const RNModule = (_a = NativeModules.NoibuSessionRecorder) !== null && _a !== vo
12
12
  const NativeSessionRecorder = TurboNativeSessionRecorder !== null && TurboNativeSessionRecorder !== void 0 ? TurboNativeSessionRecorder : RNModule;
13
13
  // Consider new-arch if the resolved module exposes the polling method
14
14
  const isNewArch = typeof (NativeSessionRecorder === null || NativeSessionRecorder === void 0 ? void 0 : NativeSessionRecorder.consumeEvents) === 'function';
15
- const isNewArchAndroid = Platform.OS === 'android' && isNewArch;
16
15
  const isNewArchIOS = Platform.OS === 'ios' && isNewArch;
17
16
  let nativeModuleEmitter;
18
17
  const SupportedPlatforms = ['android', 'ios'];
@@ -29,14 +28,12 @@ var LogLevel;
29
28
  })(LogLevel || (LogLevel = {}));
30
29
  /**
31
30
  * Initializes the Noibu - Session recording SDK if the API level is supported.
31
+ * Supports both legacy (bridge) and new architecture (TurboModule) on iOS and Android.
32
32
  */
33
33
  function initialize() {
34
- if (Platform.OS === 'ios') {
35
- // In new architecture, initialize native module to start capturing
36
- if (isNewArchIOS) {
37
- NativeSessionRecorder.initialize();
38
- }
39
- return;
34
+ if (Platform.OS === 'ios' && isNewArchIOS) {
35
+ // New architecture iOS: initialize native module to start capturing
36
+ NativeSessionRecorder.initialize();
40
37
  }
41
38
  if (!SupportedPlatforms.includes(Platform.OS)) {
42
39
  noibuLog(`Noibu - Session recording supports ${SupportedPlatforms.join(', ')} only for now.`);
@@ -46,16 +43,20 @@ function initialize() {
46
43
  noibuLog('Noibu - Session recording did not initialize properly.', LINKING_ERROR);
47
44
  return;
48
45
  }
49
- // For legacy Android, set up the event emitter; for new-arch Android, we poll via TurboModule
50
- if (!isNewArchAndroid) {
46
+ // For legacy (iOS or Android), set up the event emitter; for new-arch we poll via TurboModule
47
+ const isLegacy = !isNewArch;
48
+ if (isLegacy) {
51
49
  const moduleForEmitter = RNModule !== null && RNModule !== void 0 ? RNModule : NativeSessionRecorder;
52
50
  if (!moduleForEmitter) {
53
- noibuLog('NativeSessionRecorder module missing for legacy Android.');
51
+ noibuLog('NativeSessionRecorder module missing for legacy.');
54
52
  return;
55
53
  }
56
54
  nativeModuleEmitter = new NativeEventEmitter(moduleForEmitter);
57
55
  }
58
- NativeSessionRecorder.initialize();
56
+ // Call native initialize only when the method is exposed (new-arch and legacy Android; legacy iOS bridge does not export it)
57
+ if (typeof NativeSessionRecorder.initialize === 'function') {
58
+ NativeSessionRecorder.initialize();
59
+ }
59
60
  noibuLog("Session recorder initialized.");
60
61
  }
61
62
  let isIOSInitialized = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noibu-react-native",
3
- "version": "0.2.34-rc.3",
3
+ "version": "0.2.34-rc.4",
4
4
  "targetNjsVersion": "1.0.104",
5
5
  "description": "React-Native SDK for NoibuJS to collect errors in React-Native applications",
6
6
  "main": "dist/entry/index.js",