@rejourneyco/react-native 1.0.1 → 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.
Files changed (65) hide show
  1. package/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +72 -391
  2. package/android/src/main/java/com/rejourney/capture/CaptureEngine.kt +11 -113
  3. package/android/src/main/java/com/rejourney/capture/SegmentUploader.kt +1 -15
  4. package/android/src/main/java/com/rejourney/capture/VideoEncoder.kt +1 -61
  5. package/android/src/main/java/com/rejourney/capture/ViewHierarchyScanner.kt +3 -1
  6. package/android/src/main/java/com/rejourney/lifecycle/SessionLifecycleService.kt +1 -22
  7. package/android/src/main/java/com/rejourney/network/DeviceAuthManager.kt +3 -26
  8. package/android/src/main/java/com/rejourney/network/NetworkMonitor.kt +0 -2
  9. package/android/src/main/java/com/rejourney/network/UploadManager.kt +7 -93
  10. package/android/src/main/java/com/rejourney/network/UploadWorker.kt +5 -41
  11. package/android/src/main/java/com/rejourney/privacy/PrivacyMask.kt +2 -58
  12. package/android/src/main/java/com/rejourney/touch/TouchInterceptor.kt +4 -4
  13. package/android/src/main/java/com/rejourney/utils/EventBuffer.kt +36 -7
  14. package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +7 -0
  15. package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +9 -0
  16. package/ios/Capture/RJCaptureEngine.m +3 -34
  17. package/ios/Capture/RJVideoEncoder.m +0 -26
  18. package/ios/Capture/RJViewHierarchyScanner.m +68 -51
  19. package/ios/Core/RJLifecycleManager.m +0 -14
  20. package/ios/Core/Rejourney.mm +53 -129
  21. package/ios/Network/RJDeviceAuthManager.m +0 -2
  22. package/ios/Network/RJUploadManager.h +8 -0
  23. package/ios/Network/RJUploadManager.m +45 -0
  24. package/ios/Privacy/RJPrivacyMask.m +5 -31
  25. package/ios/Rejourney.h +0 -14
  26. package/ios/Touch/RJTouchInterceptor.m +21 -15
  27. package/ios/Utils/RJEventBuffer.m +57 -69
  28. package/ios/Utils/RJPerfTiming.m +0 -5
  29. package/ios/Utils/RJWindowUtils.m +87 -87
  30. package/lib/commonjs/components/Mask.js +1 -6
  31. package/lib/commonjs/index.js +46 -117
  32. package/lib/commonjs/sdk/autoTracking.js +39 -313
  33. package/lib/commonjs/sdk/constants.js +2 -13
  34. package/lib/commonjs/sdk/errorTracking.js +1 -29
  35. package/lib/commonjs/sdk/metricsTracking.js +3 -24
  36. package/lib/commonjs/sdk/navigation.js +3 -42
  37. package/lib/commonjs/sdk/networkInterceptor.js +7 -60
  38. package/lib/commonjs/sdk/utils.js +73 -19
  39. package/lib/module/components/Mask.js +1 -6
  40. package/lib/module/index.js +45 -121
  41. package/lib/module/sdk/autoTracking.js +39 -314
  42. package/lib/module/sdk/constants.js +2 -13
  43. package/lib/module/sdk/errorTracking.js +1 -29
  44. package/lib/module/sdk/index.js +0 -2
  45. package/lib/module/sdk/metricsTracking.js +3 -24
  46. package/lib/module/sdk/navigation.js +3 -42
  47. package/lib/module/sdk/networkInterceptor.js +7 -60
  48. package/lib/module/sdk/utils.js +73 -19
  49. package/lib/typescript/NativeRejourney.d.ts +1 -0
  50. package/lib/typescript/sdk/autoTracking.d.ts +4 -4
  51. package/lib/typescript/sdk/utils.d.ts +31 -1
  52. package/lib/typescript/types/index.d.ts +0 -1
  53. package/package.json +17 -11
  54. package/src/NativeRejourney.ts +2 -0
  55. package/src/components/Mask.tsx +0 -3
  56. package/src/index.ts +43 -92
  57. package/src/sdk/autoTracking.ts +51 -284
  58. package/src/sdk/constants.ts +13 -13
  59. package/src/sdk/errorTracking.ts +1 -17
  60. package/src/sdk/index.ts +0 -2
  61. package/src/sdk/metricsTracking.ts +5 -33
  62. package/src/sdk/navigation.ts +8 -29
  63. package/src/sdk/networkInterceptor.ts +9 -42
  64. package/src/sdk/utils.ts +76 -19
  65. package/src/types/index.ts +0 -29
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
- private debugMode = false;
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
- console.warn(this.prefix, ...args);
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
- console.error(this.prefix, ...args);
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
 
@@ -302,19 +313,12 @@ class Logger {
302
313
  }
303
314
  }
304
315
 
305
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
306
- // Lifecycle Logs - Industry standard minimal logging
307
- // These are the only logs integrators will see in debug builds
308
- // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
309
-
310
316
  /**
311
317
  * Log SDK initialization success.
312
318
  * Only shown in development builds - this is the minimal "SDK started" log.
313
319
  */
314
320
  logInitSuccess(version: string): void {
315
- if (this.debugMode) {
316
- this.info(`✓ SDK initialized (v${version})`);
317
- }
321
+ this.notice(`✓ SDK initialized (v${version})`);
318
322
  }
319
323
 
320
324
  /**
@@ -330,9 +334,7 @@ class Logger {
330
334
  * Only shown in development builds.
331
335
  */
332
336
  logSessionStart(sessionId: string): void {
333
- if (this.debugMode) {
334
- this.info(`Session started: ${sessionId}`);
335
- }
337
+ this.notice(`Session started: ${sessionId}`);
336
338
  }
337
339
 
338
340
  /**
@@ -340,13 +342,11 @@ class Logger {
340
342
  * Only shown in development builds.
341
343
  */
342
344
  logSessionEnd(sessionId: string): void {
343
- if (this.debugMode) {
344
- this.info(`Session ended: ${sessionId}`);
345
- }
345
+ this.notice(`Session ended: ${sessionId}`);
346
346
  }
347
347
 
348
348
  logObservabilityStart(): void {
349
- this.notice('Starting Rejourney observability');
349
+ this.notice('💧 Starting Rejourney observability');
350
350
  }
351
351
 
352
352
  logRecordingStart(): void {
@@ -364,6 +364,63 @@ class Logger {
364
364
  logPackageMismatch(): void {
365
365
  this.notice('Bundle ID / package name mismatch');
366
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
+ }
367
424
  }
368
425
 
369
426
  export const logger = new Logger();
@@ -104,10 +104,6 @@ export interface RejourneyConfig {
104
104
  networkCaptureSizes?: boolean;
105
105
  }
106
106
 
107
- // ============================================================================
108
- // Event Types
109
- // ============================================================================
110
-
111
107
  export type GestureType =
112
108
  | 'tap'
113
109
  | 'double_tap'
@@ -293,10 +289,6 @@ export interface ErrorEvent {
293
289
  name?: string;
294
290
  }
295
291
 
296
- // ============================================================================
297
- // Network Request Types (API Call Tracking)
298
- // ============================================================================
299
-
300
292
  export interface NetworkRequestEvent {
301
293
  type: 'network_request';
302
294
  /** Unique request ID for correlating request/response */
@@ -355,10 +347,6 @@ export type SessionEvent =
355
347
  | ErrorEvent
356
348
  | NetworkRequestEvent;
357
349
 
358
- // ============================================================================
359
- // Session Types
360
- // ============================================================================
361
-
362
350
  export interface GeoLocation {
363
351
  /** IP address */
364
352
  ip: string;
@@ -451,14 +439,9 @@ export interface SessionSummary {
451
439
  videoSegmentCount?: number;
452
440
  storageSize: number;
453
441
  isComplete: boolean;
454
- /** Path to session data file */
455
442
  filePath: string;
456
443
  }
457
444
 
458
- // ============================================================================
459
- // Replay Types
460
- // ============================================================================
461
-
462
445
  export interface ReplayState {
463
446
  /** Current playback position in ms from session start */
464
447
  currentTime: number;
@@ -507,10 +490,6 @@ export interface ReplayProps {
507
490
  style?: object;
508
491
  }
509
492
 
510
- // ============================================================================
511
- // Native Module Types
512
- // ============================================================================
513
-
514
493
  export interface RejourneyNativeModule {
515
494
  /** Initialize the native SDK */
516
495
  initialize(config: RejourneyConfig): Promise<void>;
@@ -540,10 +519,6 @@ export interface RejourneyNativeModule {
540
519
  getStorageUsage(): Promise<{ used: number; max: number }>;
541
520
  }
542
521
 
543
- // ============================================================================
544
- // API Types
545
- // ============================================================================
546
-
547
522
  export interface RejourneyAPI {
548
523
  /** SDK version */
549
524
  readonly version: string;
@@ -704,10 +679,6 @@ export interface NetworkRequestParams {
704
679
  success?: boolean;
705
680
  }
706
681
 
707
- // ============================================================================
708
- // Hook Types
709
- // ============================================================================
710
-
711
682
  export interface UseRejourneyResult {
712
683
  /** Whether SDK is initialized */
713
684
  isInitialized: boolean;