noibu-react-native 0.2.26 → 0.2.27

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.
@@ -66,7 +66,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
66
66
  dependencies {
67
67
  implementation "com.facebook.react:react-native:+"
68
68
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
69
- implementation "com.noibu:sessionreplay-recorder:1.0.3"
69
+ implementation "com.noibu:sessionreplay-recorder:1.0.4"
70
70
  }
71
71
 
72
72
  if (isNewArchitectureEnabled()) {
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.26" ;
27
+ return "1.0.104-rn-sdk-0.2.27" ;
28
28
  }
29
29
  /**
30
30
  * Gets the max metro recon number
@@ -2,7 +2,6 @@ import { __awaiter } from 'tslib';
2
2
  import { initialize, subscribeToNativeEvent } from './nativeSessionRecorderSubscription.js';
3
3
  import StoredMetrics from '../api/StoredMetrics.js';
4
4
  import ClientConfig from '../api/ClientConfig.js';
5
- import { stringifyJSON } from '../utils/function.js';
6
5
  import { MAX_TIME_FOR_UNSENT_DATA_MILLIS } from '../constants.js';
7
6
  import MetroplexSocket from '../api/MetroplexSocket.js';
8
7
  import { addSafeEventListener } from '../utils/eventlistener.js';
@@ -144,7 +143,8 @@ class SessionRecorder extends Singleton {
144
143
  }
145
144
  //
146
145
  // Buffer the event for sending to metroplex
147
- this.eventBuffer.push(recorderEvent.message);
146
+ // Ensure buffer holds strings to avoid repeated object allocations
147
+ this.eventBuffer.push(String(recorderEvent.message));
148
148
  // Check if the event was a click or a double click. This is true if the root type is
149
149
  // incremental snapshot (3) and the data source is mouse interaction data (2).
150
150
  // Finally, we capture a click (2) or double click (4) event.
@@ -203,8 +203,8 @@ class SessionRecorder extends Singleton {
203
203
  // single string for the video content. This gets converted to bytes
204
204
  // when being sent to metroplex which we will then unmarshall into
205
205
  // a struct to parse it's inner urls
206
- // If stringifying this event buffer takes too long consider using a service worker
207
- vid: stringifyJSON(this.eventBuffer),
206
+ // Buffer already contains JSON strings; join without re-stringifying to reduce allocations
207
+ vid: `[${this.eventBuffer.join(',')}]`,
208
208
  // Send the sequence number but don't send the expected length since that is sent as
209
209
  // part of the last stored metrics data
210
210
  seq: this.vfCounter,
@@ -70,7 +70,8 @@ function subscribeToNativeEvent(callback) {
70
70
  noibuLog('New noibu recording event', rest);
71
71
  const transformedEvents = transformToWeb([Object.assign(Object.assign({}, rest), { data })]);
72
72
  noibuLog('after transformation: ', transformedEvents);
73
- transformedEvents.forEach((e) => callback({ message: e }));
73
+ // Emit pre-serialized JSON strings to minimize JS heap during batching
74
+ transformedEvents.forEach((e) => callback({ message: JSON.stringify(e) }));
74
75
  });
75
76
  // return () => subscription.remove();
76
77
  }
@@ -84,8 +85,9 @@ function subscribeToNativeEvent(callback) {
84
85
  try {
85
86
  const mobileEvents = event.mobileEvents;
86
87
  const webEvents = transformToWeb(mobileEvents);
88
+ // Emit pre-serialized JSON strings to minimize JS heap during batching
87
89
  for (const webEvent of webEvents) {
88
- callback({ message: webEvent });
90
+ callback({ message: JSON.stringify(webEvent) });
89
91
  }
90
92
  }
91
93
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noibu-react-native",
3
- "version": "0.2.26",
3
+ "version": "0.2.27",
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",