noibu-react-native 0.2.20 → 0.2.22

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
@@ -3,6 +3,12 @@
3
3
  All notable changes of the noibu-react-native SDK release series are documented in this file using
4
4
  the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
5
5
 
6
+ ## 0.2.22
7
+ - ** Adds support for new architecture
8
+
9
+ ## 0.2.21
10
+ - ** ANDROID: Add mapper for expo vector icons
11
+
6
12
  ## 0.2.20
7
13
 
8
14
  ### Added
@@ -1,18 +1,4 @@
1
- buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["Noibu_kotlinVersion"]
4
-
5
- repositories {
6
- google()
7
- mavenCentral()
8
- }
9
-
10
- dependencies {
11
- classpath "com.android.tools.build:gradle:8.5.1"
12
- // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
- }
15
- }
1
+ // Rely on the consuming app's Android Gradle Plugin and Kotlin plugin versions
16
2
 
17
3
  def isNewArchitectureEnabled() {
18
4
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
@@ -36,6 +22,8 @@ def getExtOrIntegerDefault(name) {
36
22
  android {
37
23
  compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
38
24
 
25
+ namespace "com.noibu.sessionreplay.reactnative"
26
+
39
27
  defaultConfig {
40
28
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
41
29
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
@@ -55,6 +43,17 @@ android {
55
43
  sourceCompatibility JavaVersion.VERSION_1_8
56
44
  targetCompatibility JavaVersion.VERSION_1_8
57
45
  }
46
+
47
+ sourceSets {
48
+ main {
49
+ java.srcDirs = ["src/main/java"]
50
+ if (isNewArchitectureEnabled()) {
51
+ java.srcDirs += ["src/newarch/java"]
52
+ } else {
53
+ java.srcDirs += ["src/legacy/java"]
54
+ }
55
+ }
56
+ }
58
57
  }
59
58
 
60
59
  repositories {
@@ -67,13 +66,13 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
67
66
  dependencies {
68
67
  implementation "com.facebook.react:react-native:+"
69
68
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
70
- implementation "com.noibu:sessionreplay-recorder:1.0.1"
69
+ implementation "com.noibu:sessionreplay-recorder:1.0.2"
71
70
  }
72
71
 
73
72
  if (isNewArchitectureEnabled()) {
74
73
  react {
75
74
  jsRootDir = file("../src/")
76
- libraryName = "noibusessionreplay"
75
+ libraryName = "NoibuSessionRecorder"
77
76
  codegenJavaPackageName = "com.noibu.sessionreplay.reactnative"
78
77
  }
79
78
  }
@@ -5,6 +5,7 @@ import android.os.Looper
5
5
  import android.util.Log
6
6
  import com.facebook.react.bridge.*
7
7
  import com.facebook.react.modules.core.DeviceEventManagerModule
8
+ import com.facebook.react.bridge.ReactMethod
8
9
 
9
10
  // Update the import statements to point to the KMP shared module's package
10
11
  import com.noibu.mobile.android.sessionreplay.Noibu
@@ -52,7 +53,7 @@ class NoibuSessionReplayModule(reactContext: ReactApplicationContext) :
52
53
  }
53
54
 
54
55
  companion object {
55
- const val NAME = "NativeSessionRecorder"
56
+ const val NAME = "NoibuSessionRecorder"
56
57
  private var reactContext: ReactApplicationContext? = null
57
58
  }
58
59
  }
@@ -0,0 +1,16 @@
1
+ package com.noibu.sessionreplay.reactnative
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+ class NoibuSessionReplayPackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
+ return listOf(NoibuSessionReplayModule(reactContext))
11
+ }
12
+
13
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
14
+ return emptyList()
15
+ }
16
+ }
@@ -1,17 +1 @@
1
- package com.noibu.sessionreplay.reactnative
2
-
3
- import com.facebook.react.ReactPackage
4
- import com.facebook.react.bridge.JavaScriptModule
5
- import com.facebook.react.bridge.NativeModule
6
- import com.facebook.react.bridge.ReactApplicationContext
7
- import com.facebook.react.uimanager.ViewManager
8
-
9
- class NoibuSessionReplayPackage : ReactPackage {
10
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11
- return listOf(NoibuSessionReplayModule(reactContext))
12
- }
13
-
14
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
15
- return emptyList()
16
- }
17
- }
1
+ // This main source directory is intentionally left empty. Actual sources live in src/legacy/java or src/newarch/java.
@@ -0,0 +1,47 @@
1
+ package com.noibu.sessionreplay.reactnative
2
+
3
+ import android.util.Log
4
+ import com.facebook.react.bridge.Arguments
5
+ import com.facebook.react.bridge.Promise
6
+ import com.facebook.react.bridge.ReactApplicationContext
7
+ import com.facebook.react.bridge.ReactMethod
8
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule
9
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
10
+ import com.facebook.react.modules.core.DeviceEventManagerModule
11
+ import com.noibu.mobile.android.sessionreplay.Noibu
12
+ import com.noibu.mobile.android.sessionreplay.NoibuConfig
13
+
14
+ class NoibuSessionRecorderModule(val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), TurboModule {
15
+ companion object {
16
+ private const val TAG = "NoibuSessionRecorder"
17
+ }
18
+
19
+ init {
20
+ Log.i(TAG, "[new-arch] Module constructed")
21
+ }
22
+
23
+ override fun getName(): String = "NoibuSessionRecorder"
24
+
25
+ @ReactMethod
26
+ fun initialize(promise: Promise) {
27
+ Log.i(TAG, "[new-arch] initialize() called")
28
+ try {
29
+ val context = currentActivity?.applicationContext ?: reactApplicationContext.applicationContext
30
+ val config = NoibuConfig(
31
+ sessionReplayEnabled = true,
32
+ maskAllTextInputs = false,
33
+ )
34
+ Noibu.setup(context, config) { param ->
35
+ val map = Arguments.createMap()
36
+ map.putString("message", param)
37
+ reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
38
+ .emit("noibuRecordingEvent", map)
39
+ true
40
+ }
41
+ promise.resolve(true)
42
+ } catch (t: Throwable) {
43
+ Log.e(TAG, "initialize() failed", t)
44
+ promise.reject("E_INIT", t)
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,29 @@
1
+ package com.noibu.sessionreplay.reactnative
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+
9
+ class NoibuSessionReplayPackage : TurboReactPackage() {
10
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
11
+ return if (name == "NoibuSessionRecorder") {
12
+ NoibuSessionRecorderModule(reactContext)
13
+ } else null
14
+ }
15
+
16
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
17
+ mapOf(
18
+ "NoibuSessionRecorder" to ReactModuleInfo(
19
+ /* name */ "NoibuSessionRecorder",
20
+ /* className */ "com.noibu.sessionreplay.reactnative.NoibuSessionRecorderModule",
21
+ /* canOverrideExistingModule */ false,
22
+ /* needsEagerInit */ false,
23
+ /* hasConstants */ false,
24
+ /* isCxxModule */ false,
25
+ /* isTurboModule */ true
26
+ )
27
+ )
28
+ }
29
+ }
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.20" ;
27
+ return "1.0.104-rn-sdk-0.2.22" ;
28
28
  }
29
29
  /**
30
30
  * Gets the max metro recon number
@@ -0,0 +1,6 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ initialize(): Promise<boolean>;
4
+ }
5
+ declare const _default: Spec;
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
2
+ const { TurboModuleRegistry: TurboModuleRegistryUntyped } = require('react-native');
3
+ const TurboModuleRegistry = TurboModuleRegistryUntyped;
4
+ var TurboNativeSessionRecorder = TurboModuleRegistry.getEnforcing('NoibuSessionRecorder');
5
+
6
+ export { TurboNativeSessionRecorder as default };
@@ -1,5 +1,6 @@
1
1
  import { __rest } from 'tslib';
2
2
  import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
3
+ import TurboNativeSessionRecorder from '../native/NativeNoibuSessionRecorder.js';
3
4
  import { noibuLog } from '../utils/log.js';
4
5
  import { transformToWeb } from '../mobileTransformer/mobile-replay/index.js';
5
6
 
@@ -7,7 +8,8 @@ const LINKING_ERROR = `The package 'noibu-session-replay' doesn't seem to be lin
7
8
  // Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
8
9
  '- You rebuilt the app after installing the package\n' +
9
10
  '- You are not using Expo Go\n';
10
- const { NativeSessionRecorder, IOSPocEmitter } = NativeModules;
11
+ const { NativeSessionRecorder: LegacyNativeSessionRecorder, IOSPocEmitter } = NativeModules;
12
+ const NativeSessionRecorder = TurboNativeSessionRecorder !== null && TurboNativeSessionRecorder !== void 0 ? TurboNativeSessionRecorder : LegacyNativeSessionRecorder;
11
13
  let nativeModuleEmitter;
12
14
  const SupportedPlatforms = ['android', 'ios'];
13
15
  /** The level of logging to show in the device logcat stream. */
@@ -25,10 +27,11 @@ var LogLevel;
25
27
  * Initializes the Noibu - Session recording SDK if the API level is supported.
26
28
  */
27
29
  function initialize() {
30
+ var _a;
28
31
  if (Platform.OS === 'ios') {
29
32
  return;
30
33
  }
31
- nativeModuleEmitter = new NativeEventEmitter(NativeSessionRecorder);
34
+ nativeModuleEmitter = new NativeEventEmitter((_a = NativeModules.NativeSessionRecorder) !== null && _a !== void 0 ? _a : NativeSessionRecorder);
32
35
  if (!SupportedPlatforms.includes(Platform.OS)) {
33
36
  noibuLog(`Noibu - Session recording supports ${SupportedPlatforms.join(', ')} only for now.`);
34
37
  return;
@@ -1,5 +1,6 @@
1
1
  #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
2
3
 
3
- @interface RCT_EXTERN_MODULE(IOSPocEmitter, NSObject)
4
+ @interface RCT_EXTERN_MODULE(IOSPocEmitter, RCTEventEmitter)
4
5
  RCT_EXTERN_METHOD(startIOS)
5
6
  @end
@@ -20,6 +20,9 @@ Pod::Spec.new do |s|
20
20
  s.source_files = "ios/**/*.{h,m,mm,swift}"
21
21
  s.swift_version = '5.0'
22
22
 
23
+ # Build as static framework to avoid new-arch linking issues
24
+ s.static_framework = true
25
+
23
26
  #s.vendored_frameworks = "ios/SessionRecorder.xcframework"
24
27
  #s.vendored_frameworks = "ios/Noibu.xcframework"
25
28
 
package/package.json CHANGED
@@ -1,14 +1,23 @@
1
1
  {
2
2
  "name": "noibu-react-native",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
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",
7
7
  "types": "dist/entry/index.d.ts",
8
+ "codegenConfig": {
9
+ "name": "NoibuSessionRecorder",
10
+ "type": "modules",
11
+ "jsSrcsDir": "src",
12
+ "android": {
13
+ "javaPackageName": "com.noibu.sessionreplay.reactnative"
14
+ }
15
+ },
8
16
  "files": [
9
17
  "android",
10
18
  "android/settings.gradle",
11
19
  "dist/*",
20
+ "src/native/NativeNoibuSessionRecorder.ts",
12
21
  "README.md",
13
22
  "CHANGELOG.md",
14
23
  "ios",
@@ -0,0 +1,20 @@
1
+ // @ts-ignore - Using type from newer React Native versions when building locally
2
+ import type { TurboModule } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ initialize(): Promise<boolean>;
6
+ }
7
+
8
+ // Create a typed facade for TurboModuleRegistry so we can use generics
9
+ type TurboModuleRegistryType = {
10
+ getEnforcing<T>(name: string): T;
11
+ };
12
+
13
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
14
+ const { TurboModuleRegistry: TurboModuleRegistryUntyped } = require('react-native') as {
15
+ TurboModuleRegistry: TurboModuleRegistryType;
16
+ };
17
+
18
+ const TurboModuleRegistry: TurboModuleRegistryType = TurboModuleRegistryUntyped;
19
+
20
+ export default TurboModuleRegistry.getEnforcing<Spec>('NoibuSessionRecorder');