@rejourneyco/react-native 1.0.2 → 1.0.3
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/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +38 -363
- package/android/src/main/java/com/rejourney/capture/CaptureEngine.kt +11 -113
- package/android/src/main/java/com/rejourney/capture/SegmentUploader.kt +1 -15
- package/android/src/main/java/com/rejourney/capture/VideoEncoder.kt +1 -61
- package/android/src/main/java/com/rejourney/capture/ViewHierarchyScanner.kt +3 -1
- package/android/src/main/java/com/rejourney/lifecycle/SessionLifecycleService.kt +1 -22
- package/android/src/main/java/com/rejourney/network/DeviceAuthManager.kt +3 -26
- package/android/src/main/java/com/rejourney/network/NetworkMonitor.kt +0 -2
- package/android/src/main/java/com/rejourney/network/UploadManager.kt +7 -93
- package/android/src/main/java/com/rejourney/network/UploadWorker.kt +5 -41
- package/android/src/main/java/com/rejourney/privacy/PrivacyMask.kt +2 -58
- package/android/src/main/java/com/rejourney/touch/TouchInterceptor.kt +4 -4
- package/android/src/main/java/com/rejourney/utils/EventBuffer.kt +36 -7
- package/ios/Capture/RJViewHierarchyScanner.m +68 -51
- package/ios/Core/RJLifecycleManager.m +0 -14
- package/ios/Core/Rejourney.mm +24 -37
- package/ios/Network/RJDeviceAuthManager.m +0 -2
- package/ios/Network/RJUploadManager.h +8 -0
- package/ios/Network/RJUploadManager.m +45 -0
- package/ios/Privacy/RJPrivacyMask.m +5 -31
- package/ios/Rejourney.h +0 -14
- package/ios/Touch/RJTouchInterceptor.m +21 -15
- package/ios/Utils/RJEventBuffer.m +57 -69
- package/ios/Utils/RJWindowUtils.m +87 -86
- package/lib/commonjs/index.js +42 -30
- package/lib/commonjs/sdk/autoTracking.js +0 -3
- package/lib/commonjs/sdk/networkInterceptor.js +0 -11
- package/lib/commonjs/sdk/utils.js +73 -14
- package/lib/module/index.js +42 -30
- package/lib/module/sdk/autoTracking.js +0 -3
- package/lib/module/sdk/networkInterceptor.js +0 -11
- package/lib/module/sdk/utils.js +73 -14
- package/lib/typescript/sdk/utils.d.ts +31 -1
- package/package.json +16 -4
- package/src/index.ts +40 -19
- package/src/sdk/autoTracking.ts +0 -2
- package/src/sdk/constants.ts +13 -13
- package/src/sdk/networkInterceptor.ts +0 -9
- package/src/sdk/utils.ts +76 -14
|
@@ -129,8 +129,6 @@ function flushPendingRequests(): void {
|
|
|
129
129
|
flushTimer = null;
|
|
130
130
|
|
|
131
131
|
if (!logCallback || pendingCount === 0) return;
|
|
132
|
-
|
|
133
|
-
// Process all pending requests
|
|
134
132
|
while (pendingCount > 0) {
|
|
135
133
|
const request = pendingRequests[pendingHead];
|
|
136
134
|
pendingRequests[pendingHead] = null; // Allow GC
|
|
@@ -209,14 +207,10 @@ function interceptFetch(): void {
|
|
|
209
207
|
return originalFetch!(input, init);
|
|
210
208
|
}
|
|
211
209
|
|
|
212
|
-
// Capture start time (only synchronous work)
|
|
213
210
|
const startTime = Date.now();
|
|
214
211
|
const method = ((init?.method || 'GET').toUpperCase()) as NetworkRequestParams['method'];
|
|
215
|
-
|
|
216
|
-
// Call original fetch
|
|
217
212
|
return originalFetch!(input, init).then(
|
|
218
213
|
(response) => {
|
|
219
|
-
// Success - queue the log asynchronously
|
|
220
214
|
queueRequest({
|
|
221
215
|
requestId: `f${startTime}`,
|
|
222
216
|
method,
|
|
@@ -281,8 +275,6 @@ function interceptXHR(): void {
|
|
|
281
275
|
if (!config.enabled || !logCallback || !data || shouldIgnoreUrl(data.u)) {
|
|
282
276
|
return originalXHRSend!.call(this, body);
|
|
283
277
|
}
|
|
284
|
-
|
|
285
|
-
// Check sampling
|
|
286
278
|
const { path } = parseUrlFast(data.u);
|
|
287
279
|
if (!shouldSampleRequest(path)) {
|
|
288
280
|
return originalXHRSend!.call(this, body);
|
|
@@ -344,7 +336,6 @@ export function initNetworkInterceptor(
|
|
|
344
336
|
export function disableNetworkInterceptor(): void {
|
|
345
337
|
config.enabled = false;
|
|
346
338
|
|
|
347
|
-
// Flush any pending requests
|
|
348
339
|
if (flushTimer) {
|
|
349
340
|
clearTimeout(flushTimer);
|
|
350
341
|
flushTimer = null;
|
package/src/sdk/utils.ts
CHANGED
|
@@ -236,7 +236,7 @@ export enum LogLevel {
|
|
|
236
236
|
*/
|
|
237
237
|
class Logger {
|
|
238
238
|
private prefix = '[Rejourney]';
|
|
239
|
-
|
|
239
|
+
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Minimum log level to display.
|
|
@@ -260,7 +260,6 @@ class Logger {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
setDebugMode(enabled: boolean): void {
|
|
263
|
-
this.debugMode = enabled;
|
|
264
263
|
this.minimumLogLevel = enabled
|
|
265
264
|
? LogLevel.DEBUG
|
|
266
265
|
: typeof __DEV__ !== 'undefined' && __DEV__
|
|
@@ -285,14 +284,26 @@ class Logger {
|
|
|
285
284
|
/** Log a warning message */
|
|
286
285
|
warn(...args: any[]): void {
|
|
287
286
|
if (this.minimumLogLevel <= LogLevel.WARNING) {
|
|
288
|
-
|
|
287
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
288
|
+
// Explicit Debug Mode: Show YellowBox
|
|
289
|
+
console.warn(this.prefix, ...args);
|
|
290
|
+
} else {
|
|
291
|
+
// Default Dev Mode: Log to console only, avoid YellowBox
|
|
292
|
+
console.log(this.prefix, '[WARN]', ...args);
|
|
293
|
+
}
|
|
289
294
|
}
|
|
290
295
|
}
|
|
291
296
|
|
|
292
297
|
/** Log an error message */
|
|
293
298
|
error(...args: any[]): void {
|
|
294
299
|
if (this.minimumLogLevel <= LogLevel.ERROR) {
|
|
295
|
-
|
|
300
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
301
|
+
// Explicit Debug Mode: Show RedBox
|
|
302
|
+
console.error(this.prefix, ...args);
|
|
303
|
+
} else {
|
|
304
|
+
// Default Dev Mode: Log to console only, avoid RedBox
|
|
305
|
+
console.log(this.prefix, '[ERROR]', ...args);
|
|
306
|
+
}
|
|
296
307
|
}
|
|
297
308
|
}
|
|
298
309
|
|
|
@@ -307,9 +318,7 @@ class Logger {
|
|
|
307
318
|
* Only shown in development builds - this is the minimal "SDK started" log.
|
|
308
319
|
*/
|
|
309
320
|
logInitSuccess(version: string): void {
|
|
310
|
-
|
|
311
|
-
this.info(`✓ SDK initialized (v${version})`);
|
|
312
|
-
}
|
|
321
|
+
this.notice(`✓ SDK initialized (v${version})`);
|
|
313
322
|
}
|
|
314
323
|
|
|
315
324
|
/**
|
|
@@ -325,9 +334,7 @@ class Logger {
|
|
|
325
334
|
* Only shown in development builds.
|
|
326
335
|
*/
|
|
327
336
|
logSessionStart(sessionId: string): void {
|
|
328
|
-
|
|
329
|
-
this.info(`Session started: ${sessionId}`);
|
|
330
|
-
}
|
|
337
|
+
this.notice(`Session started: ${sessionId}`);
|
|
331
338
|
}
|
|
332
339
|
|
|
333
340
|
/**
|
|
@@ -335,13 +342,11 @@ class Logger {
|
|
|
335
342
|
* Only shown in development builds.
|
|
336
343
|
*/
|
|
337
344
|
logSessionEnd(sessionId: string): void {
|
|
338
|
-
|
|
339
|
-
this.info(`Session ended: ${sessionId}`);
|
|
340
|
-
}
|
|
345
|
+
this.notice(`Session ended: ${sessionId}`);
|
|
341
346
|
}
|
|
342
347
|
|
|
343
348
|
logObservabilityStart(): void {
|
|
344
|
-
this.notice('Starting Rejourney observability');
|
|
349
|
+
this.notice('💧 Starting Rejourney observability');
|
|
345
350
|
}
|
|
346
351
|
|
|
347
352
|
logRecordingStart(): void {
|
|
@@ -359,6 +364,63 @@ class Logger {
|
|
|
359
364
|
logPackageMismatch(): void {
|
|
360
365
|
this.notice('Bundle ID / package name mismatch');
|
|
361
366
|
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Log network request details
|
|
370
|
+
*/
|
|
371
|
+
logNetworkRequest(request: { method?: string; url?: string; statusCode?: number; duration?: number; error?: string }): void {
|
|
372
|
+
const statusIcon = request.error || (request.statusCode && request.statusCode >= 400) ? '🔴' : '🟢';
|
|
373
|
+
const method = request.method || 'GET';
|
|
374
|
+
// Shorten URL to just path if possible
|
|
375
|
+
let url = request.url || '';
|
|
376
|
+
try {
|
|
377
|
+
if (url.startsWith('http')) {
|
|
378
|
+
const urlObj = new URL(url);
|
|
379
|
+
url = urlObj.pathname;
|
|
380
|
+
}
|
|
381
|
+
} catch {
|
|
382
|
+
// Keep full URL if parsing fails
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
const duration = request.duration ? `(${Math.round(request.duration)}ms)` : '';
|
|
386
|
+
const status = request.statusCode ? `${request.statusCode}` : 'ERR';
|
|
387
|
+
|
|
388
|
+
this.notice(`${statusIcon} [NET] ${status} ${method} ${url} ${duration} ${request.error ? `Error: ${request.error}` : ''}`);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Log frustration event (rage taps, etc)
|
|
393
|
+
*/
|
|
394
|
+
logFrustration(kind: string): void {
|
|
395
|
+
this.notice(`🤬 Frustration detected: ${kind}`);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Log error captured by SDK
|
|
400
|
+
*/
|
|
401
|
+
logError(message: string): void {
|
|
402
|
+
this.notice(`X Error captured: ${message}`);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Log lifecycle event (Background/Foreground)
|
|
407
|
+
* Visible in development builds.
|
|
408
|
+
*/
|
|
409
|
+
logLifecycleEvent(event: string): void {
|
|
410
|
+
this.notice(`🔄 Lifecycle: ${event}`);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Log upload statistics
|
|
415
|
+
*/
|
|
416
|
+
logUploadStats(metrics: { uploadSuccessCount: number; uploadFailureCount: number; totalBytesUploaded: number }): void {
|
|
417
|
+
const success = metrics.uploadSuccessCount;
|
|
418
|
+
const failed = metrics.uploadFailureCount;
|
|
419
|
+
const bytes = formatBytes(metrics.totalBytesUploaded);
|
|
420
|
+
|
|
421
|
+
// Always show in dev mode for reassurance, even if 0
|
|
422
|
+
this.notice(`📡 Upload Stats: ${success} success, ${failed} failed (${bytes} uploaded)`);
|
|
423
|
+
}
|
|
362
424
|
}
|
|
363
425
|
|
|
364
426
|
export const logger = new Logger();
|