noibu-react-native 0.2.24 → 0.2.25
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 +3 -0
- package/dist/constants.js +1 -1
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.d.ts +15 -0
- package/dist/sessionRecorder/nativeSessionRecorderSubscription.js +11 -7
- package/ios/IOSPocEmitter.swift +4 -21
- package/noibu-react-native.podspec +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
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.25
|
|
7
|
+
- **iOS: Remove extraneous JS bridge overheads**
|
|
8
|
+
|
|
6
9
|
## 0.2.24
|
|
7
10
|
- **ANDROID: Fix consuming bitmaps**
|
|
8
11
|
|
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.
|
|
27
|
+
return "1.0.104-rn-sdk-0.2.25" ;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Gets the max metro recon number
|
|
@@ -38,4 +38,19 @@ export interface SessionRecorderConfig {
|
|
|
38
38
|
export declare function initialize(): void;
|
|
39
39
|
export type RecorderEvent = import('./types').RecorderEvent;
|
|
40
40
|
export type UnsubscribeFn = import('./types').UnsubscribeFn;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribes to a native event emitted by the Noibu Session Recorder.
|
|
43
|
+
*
|
|
44
|
+
* This function listens for the `noibuRecordingEvent` emitted from the native layer (only on Android)
|
|
45
|
+
* and invokes the provided callback whenever the event occurs. If the platform is not Android,
|
|
46
|
+
* the function will do nothing and return a no-op unsubscribe function.
|
|
47
|
+
*
|
|
48
|
+
* @param {function(RecorderEvent): void} callback - Target callback function that will be invoked with
|
|
49
|
+
* the event data whenever the `noibuRecordingEvent` is emitted.
|
|
50
|
+
*
|
|
51
|
+
* @returns {UnsubscribeFn} Target function to unsubscribe from the event. On Android, this will remove
|
|
52
|
+
* the event listener. On other platforms, it will be a no-op.
|
|
53
|
+
*
|
|
54
|
+
* @throws {Error} If the Noibu Session Recorder is not initialized before calling this function.
|
|
55
|
+
*/
|
|
41
56
|
export declare function subscribeToNativeEvent(callback: (event: RecorderEvent) => void): UnsubscribeFn;
|
|
@@ -5,7 +5,6 @@ import { noibuLog } from '../utils/log.js';
|
|
|
5
5
|
import { transformToWeb } from '../mobileTransformer/mobile-replay/index.js';
|
|
6
6
|
|
|
7
7
|
const LINKING_ERROR = `The package 'noibu-session-replay' doesn't seem to be linked. Make sure: \n\n` +
|
|
8
|
-
// Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
|
|
9
8
|
'- You rebuilt the app after installing the package\n' +
|
|
10
9
|
'- You are not using Expo Go\n';
|
|
11
10
|
const { NativeSessionRecorder: LegacyNativeSessionRecorder, NoibuSessionRecorder } = NativeModules;
|
|
@@ -42,6 +41,7 @@ function initialize() {
|
|
|
42
41
|
}
|
|
43
42
|
NativeSessionRecorder.initialize();
|
|
44
43
|
}
|
|
44
|
+
let isIOSInitialized = false;
|
|
45
45
|
/**
|
|
46
46
|
* Subscribes to a native event emitted by the Noibu Session Recorder.
|
|
47
47
|
*
|
|
@@ -57,7 +57,6 @@ function initialize() {
|
|
|
57
57
|
*
|
|
58
58
|
* @throws {Error} If the Noibu Session Recorder is not initialized before calling this function.
|
|
59
59
|
*/
|
|
60
|
-
let isIOSInitialized = false;
|
|
61
60
|
function subscribeToNativeEvent(callback) {
|
|
62
61
|
if (Platform.OS === 'android') {
|
|
63
62
|
if (!nativeModuleEmitter) {
|
|
@@ -80,19 +79,24 @@ function subscribeToNativeEvent(callback) {
|
|
|
80
79
|
nativeModuleEmitter = new NativeEventEmitter(NoibuSessionRecorder);
|
|
81
80
|
noibuLog('nativeModuleEmitter', nativeModuleEmitter);
|
|
82
81
|
}
|
|
83
|
-
nativeModuleEmitter.addListener('
|
|
82
|
+
nativeModuleEmitter.addListener('iOSEvent', (event) => {
|
|
83
|
+
var _a;
|
|
84
84
|
try {
|
|
85
|
-
const
|
|
86
|
-
|
|
85
|
+
const mobileEvents = event.mobileEvents;
|
|
86
|
+
const webEvents = transformToWeb(mobileEvents);
|
|
87
|
+
for (const webEvent of webEvents) {
|
|
88
|
+
callback({ message: webEvent });
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
|
-
catch (
|
|
89
|
-
noibuLog(`[Error] transformToWeb failed: ${
|
|
91
|
+
catch (err) {
|
|
92
|
+
noibuLog(`[Error] iOS transformToWeb failed: ${(_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : err}`);
|
|
90
93
|
}
|
|
91
94
|
});
|
|
92
95
|
if (!isIOSInitialized) {
|
|
93
96
|
NoibuSessionRecorder.startIOS();
|
|
94
97
|
isIOSInitialized = true;
|
|
95
98
|
}
|
|
99
|
+
// return () => subscription.remove();
|
|
96
100
|
}
|
|
97
101
|
return () => { };
|
|
98
102
|
}
|
package/ios/IOSPocEmitter.swift
CHANGED
|
@@ -16,7 +16,7 @@ class NoibuSessionRecorder: RCTEventEmitter {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
override func supportedEvents() -> [String]! {
|
|
19
|
-
return ["
|
|
19
|
+
return ["iOSEvent"]
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
override func startObserving() {
|
|
@@ -34,27 +34,10 @@ class NoibuSessionRecorder: RCTEventEmitter {
|
|
|
34
34
|
let config = NoibuConfig(apiKey: NOIBU_API_KEY, host: NOIBU_HOST)
|
|
35
35
|
// config.debug = true // Enable debug logging to see emitted events
|
|
36
36
|
|
|
37
|
-
config.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
NSLog("❌ Failed to encode events JSON string as UTF-8")
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
do {
|
|
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
|
-
}
|
|
53
|
-
} catch {
|
|
54
|
-
NSLog("❌ Failed to parse events JSON: %@", error.localizedDescription)
|
|
55
|
-
}
|
|
37
|
+
config.onReactNativeCallback = { [weak self] mobileEvents in
|
|
38
|
+
guard let self = self, self.bridge != nil else { return }
|
|
39
|
+
self.sendEvent(withName: "iOSEvent", body: ["mobileEvents": mobileEvents])
|
|
56
40
|
}
|
|
57
|
-
|
|
58
41
|
NoibuSDKManager.shared.setup(config)
|
|
59
42
|
}
|
|
60
43
|
}
|
|
@@ -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.
|
|
29
|
+
s.dependency 'NoibuSDK', '0.0.8'
|
|
30
30
|
s.pod_target_xcconfig = {
|
|
31
31
|
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/noibu-react-native/ios/**\""
|
|
32
32
|
}
|
package/package.json
CHANGED