noibu-react-native 0.2.22 → 0.2.23

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,16 +3,19 @@
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.23
7
+ - **iOS: WebView replay support**
8
+
6
9
  ## 0.2.22
7
- - ** Adds support for new architecture
10
+ - **Adds support for new architecture**
8
11
 
9
12
  ## 0.2.21
10
- - ** ANDROID: Add mapper for expo vector icons
13
+ - **ANDROID: Add mapper for expo vector icons**
11
14
 
12
15
  ## 0.2.20
13
16
 
14
17
  ### Added
15
- - ** ANDROID: WebView replay support (mobile transformer)**
18
+ - **ANDROID: WebView replay support (mobile transformer)**
16
19
  - Integrates a WebView-specific transformer to convert rrweb full/incremental snapshots from WebViews into web events.
17
20
  - Snapshots generated during transformation are now included at the top level of the transformed output, emitted immediately after the event that produced them.
18
21
  - **Live subscription emits multiple events when applicable**
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.22" ;
27
+ return "1.0.104-rn-sdk-0.2.23" ;
28
28
  }
29
29
  /**
30
30
  * Gets the max metro recon number
@@ -8,7 +8,7 @@ const LINKING_ERROR = `The package 'noibu-session-replay' doesn't seem to be lin
8
8
  // Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
9
9
  '- You rebuilt the app after installing the package\n' +
10
10
  '- You are not using Expo Go\n';
11
- const { NativeSessionRecorder: LegacyNativeSessionRecorder, IOSPocEmitter } = NativeModules;
11
+ const { NativeSessionRecorder: LegacyNativeSessionRecorder, NoibuSessionRecorder } = NativeModules;
12
12
  const NativeSessionRecorder = TurboNativeSessionRecorder !== null && TurboNativeSessionRecorder !== void 0 ? TurboNativeSessionRecorder : LegacyNativeSessionRecorder;
13
13
  let nativeModuleEmitter;
14
14
  const SupportedPlatforms = ['android', 'ios'];
@@ -77,7 +77,7 @@ function subscribeToNativeEvent(callback) {
77
77
  }
78
78
  if (Platform.OS === 'ios') {
79
79
  if (!nativeModuleEmitter) {
80
- nativeModuleEmitter = new NativeEventEmitter(IOSPocEmitter);
80
+ nativeModuleEmitter = new NativeEventEmitter(NoibuSessionRecorder);
81
81
  noibuLog('nativeModuleEmitter', nativeModuleEmitter);
82
82
  }
83
83
  nativeModuleEmitter.addListener('iosPOCRecordingEvent', event => {
@@ -90,7 +90,7 @@ function subscribeToNativeEvent(callback) {
90
90
  }
91
91
  });
92
92
  if (!isIOSInitialized) {
93
- IOSPocEmitter.startIOS();
93
+ NoibuSessionRecorder.startIOS();
94
94
  isIOSInitialized = true;
95
95
  }
96
96
  }
@@ -1,6 +1,6 @@
1
1
  #import <React/RCTBridgeModule.h>
2
2
  #import <React/RCTEventEmitter.h>
3
3
 
4
- @interface RCT_EXTERN_MODULE(IOSPocEmitter, RCTEventEmitter)
4
+ @interface RCT_EXTERN_MODULE(NoibuSessionRecorder, RCTEventEmitter)
5
5
  RCT_EXTERN_METHOD(startIOS)
6
6
  @end
@@ -2,8 +2,8 @@ import Foundation
2
2
  import React
3
3
  import NoibuSDK
4
4
 
5
- @objc(IOSPocEmitter)
6
- class IOSPocEmitter: RCTEventEmitter {
5
+ @objc(NoibuSessionRecorder)
6
+ class NoibuSessionRecorder: RCTEventEmitter {
7
7
 
8
8
  private var hasListeners = false
9
9
 
@@ -32,27 +32,26 @@ class IOSPocEmitter: RCTEventEmitter {
32
32
  let NOIBU_HOST = "https://noibu.com/"
33
33
 
34
34
  let config = NoibuConfig(apiKey: NOIBU_API_KEY, host: NOIBU_HOST)
35
- // config.debug = true // Enable debug logging to see transformed events
35
+ // config.debug = true // Enable debug logging to see emitted events
36
36
 
37
- config.onMobileEventTransformed = { [weak self] transformedData in
37
+ config.onMobileEventTransformed = { [weak self] eventsJsonString in
38
38
  guard let self = self, self.bridge != nil else { return }
39
-
40
- let start = CFAbsoluteTimeGetCurrent()
41
-
42
- guard let jsonData = transformedData.data(using: .utf8) else {
43
- NSLog("❌ Failed to encode transformedData as UTF-8")
39
+ guard let eventsData = eventsJsonString.data(using: .utf8) else {
40
+ NSLog("❌ Failed to encode events JSON string as UTF-8")
44
41
  return
45
42
  }
46
43
 
47
44
  do {
48
- let jsonObject = try JSONSerialization.jsonObject(with: jsonData, options: [])
49
- var finalMessage = jsonObject
50
- if let array = jsonObject as? [Any], let first = array.first {
51
- finalMessage = first
45
+ let decodedJSON = try JSONSerialization.jsonObject(with: eventsData, options: [])
46
+ if let events = decodedJSON as? [Any] {
47
+ for event in events {
48
+ self.sendEvent(withName: "iosPOCRecordingEvent", body: ["message": event])
49
+ }
50
+ } else {
51
+ self.sendEvent(withName: "iosPOCRecordingEvent", body: ["message": decodedJSON])
52
52
  }
53
- self.sendEvent(withName: "iosPOCRecordingEvent", body: ["message": finalMessage])
54
53
  } catch {
55
- NSLog("❌ Failed to parse transformedData JSON: %@", error.localizedDescription)
54
+ NSLog("❌ Failed to parse events JSON: %@", error.localizedDescription)
56
55
  }
57
56
  }
58
57
 
@@ -26,7 +26,7 @@ Pod::Spec.new do |s|
26
26
  #s.vendored_frameworks = "ios/SessionRecorder.xcframework"
27
27
  #s.vendored_frameworks = "ios/Noibu.xcframework"
28
28
 
29
- s.dependency 'NoibuSDK', '0.0.6'
29
+ s.dependency 'NoibuSDK', '0.0.7'
30
30
  s.pod_target_xcconfig = {
31
31
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/noibu-react-native/ios/**\""
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noibu-react-native",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
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",