@rejourneyco/react-native 1.0.0

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 (152) hide show
  1. package/android/build.gradle.kts +135 -0
  2. package/android/consumer-rules.pro +10 -0
  3. package/android/proguard-rules.pro +1 -0
  4. package/android/src/main/AndroidManifest.xml +15 -0
  5. package/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +2981 -0
  6. package/android/src/main/java/com/rejourney/capture/ANRHandler.kt +206 -0
  7. package/android/src/main/java/com/rejourney/capture/ActivityTracker.kt +98 -0
  8. package/android/src/main/java/com/rejourney/capture/CaptureEngine.kt +1553 -0
  9. package/android/src/main/java/com/rejourney/capture/CaptureHeuristics.kt +375 -0
  10. package/android/src/main/java/com/rejourney/capture/CrashHandler.kt +153 -0
  11. package/android/src/main/java/com/rejourney/capture/MotionEvent.kt +215 -0
  12. package/android/src/main/java/com/rejourney/capture/SegmentUploader.kt +512 -0
  13. package/android/src/main/java/com/rejourney/capture/VideoEncoder.kt +773 -0
  14. package/android/src/main/java/com/rejourney/capture/ViewHierarchyScanner.kt +633 -0
  15. package/android/src/main/java/com/rejourney/capture/ViewSerializer.kt +286 -0
  16. package/android/src/main/java/com/rejourney/core/Constants.kt +117 -0
  17. package/android/src/main/java/com/rejourney/core/Logger.kt +93 -0
  18. package/android/src/main/java/com/rejourney/core/Types.kt +124 -0
  19. package/android/src/main/java/com/rejourney/lifecycle/SessionLifecycleService.kt +162 -0
  20. package/android/src/main/java/com/rejourney/network/DeviceAuthManager.kt +747 -0
  21. package/android/src/main/java/com/rejourney/network/HttpClientProvider.kt +16 -0
  22. package/android/src/main/java/com/rejourney/network/NetworkMonitor.kt +272 -0
  23. package/android/src/main/java/com/rejourney/network/UploadManager.kt +1363 -0
  24. package/android/src/main/java/com/rejourney/network/UploadWorker.kt +492 -0
  25. package/android/src/main/java/com/rejourney/privacy/PrivacyMask.kt +645 -0
  26. package/android/src/main/java/com/rejourney/touch/GestureClassifier.kt +233 -0
  27. package/android/src/main/java/com/rejourney/touch/KeyboardTracker.kt +158 -0
  28. package/android/src/main/java/com/rejourney/touch/TextInputTracker.kt +181 -0
  29. package/android/src/main/java/com/rejourney/touch/TouchInterceptor.kt +591 -0
  30. package/android/src/main/java/com/rejourney/utils/EventBuffer.kt +284 -0
  31. package/android/src/main/java/com/rejourney/utils/OEMDetector.kt +154 -0
  32. package/android/src/main/java/com/rejourney/utils/PerfTiming.kt +235 -0
  33. package/android/src/main/java/com/rejourney/utils/Telemetry.kt +297 -0
  34. package/android/src/main/java/com/rejourney/utils/WindowUtils.kt +84 -0
  35. package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +187 -0
  36. package/android/src/newarch/java/com/rejourney/RejourneyPackage.kt +40 -0
  37. package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +218 -0
  38. package/android/src/oldarch/java/com/rejourney/RejourneyPackage.kt +23 -0
  39. package/ios/Capture/RJANRHandler.h +42 -0
  40. package/ios/Capture/RJANRHandler.m +328 -0
  41. package/ios/Capture/RJCaptureEngine.h +275 -0
  42. package/ios/Capture/RJCaptureEngine.m +2062 -0
  43. package/ios/Capture/RJCaptureHeuristics.h +80 -0
  44. package/ios/Capture/RJCaptureHeuristics.m +903 -0
  45. package/ios/Capture/RJCrashHandler.h +46 -0
  46. package/ios/Capture/RJCrashHandler.m +313 -0
  47. package/ios/Capture/RJMotionEvent.h +183 -0
  48. package/ios/Capture/RJMotionEvent.m +183 -0
  49. package/ios/Capture/RJPerformanceManager.h +100 -0
  50. package/ios/Capture/RJPerformanceManager.m +373 -0
  51. package/ios/Capture/RJPixelBufferDownscaler.h +42 -0
  52. package/ios/Capture/RJPixelBufferDownscaler.m +85 -0
  53. package/ios/Capture/RJSegmentUploader.h +146 -0
  54. package/ios/Capture/RJSegmentUploader.m +778 -0
  55. package/ios/Capture/RJVideoEncoder.h +247 -0
  56. package/ios/Capture/RJVideoEncoder.m +1036 -0
  57. package/ios/Capture/RJViewControllerTracker.h +73 -0
  58. package/ios/Capture/RJViewControllerTracker.m +508 -0
  59. package/ios/Capture/RJViewHierarchyScanner.h +215 -0
  60. package/ios/Capture/RJViewHierarchyScanner.m +1464 -0
  61. package/ios/Capture/RJViewSerializer.h +119 -0
  62. package/ios/Capture/RJViewSerializer.m +498 -0
  63. package/ios/Core/RJConstants.h +124 -0
  64. package/ios/Core/RJConstants.m +88 -0
  65. package/ios/Core/RJLifecycleManager.h +85 -0
  66. package/ios/Core/RJLifecycleManager.m +308 -0
  67. package/ios/Core/RJLogger.h +61 -0
  68. package/ios/Core/RJLogger.m +211 -0
  69. package/ios/Core/RJTypes.h +176 -0
  70. package/ios/Core/RJTypes.m +66 -0
  71. package/ios/Core/Rejourney.h +64 -0
  72. package/ios/Core/Rejourney.mm +2495 -0
  73. package/ios/Network/RJDeviceAuthManager.h +94 -0
  74. package/ios/Network/RJDeviceAuthManager.m +967 -0
  75. package/ios/Network/RJNetworkMonitor.h +68 -0
  76. package/ios/Network/RJNetworkMonitor.m +267 -0
  77. package/ios/Network/RJRetryManager.h +73 -0
  78. package/ios/Network/RJRetryManager.m +325 -0
  79. package/ios/Network/RJUploadManager.h +267 -0
  80. package/ios/Network/RJUploadManager.m +2296 -0
  81. package/ios/Privacy/RJPrivacyMask.h +163 -0
  82. package/ios/Privacy/RJPrivacyMask.m +922 -0
  83. package/ios/Rejourney.h +63 -0
  84. package/ios/Touch/RJGestureClassifier.h +130 -0
  85. package/ios/Touch/RJGestureClassifier.m +333 -0
  86. package/ios/Touch/RJTouchInterceptor.h +169 -0
  87. package/ios/Touch/RJTouchInterceptor.m +772 -0
  88. package/ios/Utils/RJEventBuffer.h +112 -0
  89. package/ios/Utils/RJEventBuffer.m +358 -0
  90. package/ios/Utils/RJGzipUtils.h +33 -0
  91. package/ios/Utils/RJGzipUtils.m +89 -0
  92. package/ios/Utils/RJKeychainManager.h +48 -0
  93. package/ios/Utils/RJKeychainManager.m +111 -0
  94. package/ios/Utils/RJPerfTiming.h +209 -0
  95. package/ios/Utils/RJPerfTiming.m +264 -0
  96. package/ios/Utils/RJTelemetry.h +92 -0
  97. package/ios/Utils/RJTelemetry.m +320 -0
  98. package/ios/Utils/RJWindowUtils.h +66 -0
  99. package/ios/Utils/RJWindowUtils.m +133 -0
  100. package/lib/commonjs/NativeRejourney.js +40 -0
  101. package/lib/commonjs/components/Mask.js +79 -0
  102. package/lib/commonjs/index.js +1381 -0
  103. package/lib/commonjs/sdk/autoTracking.js +1259 -0
  104. package/lib/commonjs/sdk/constants.js +151 -0
  105. package/lib/commonjs/sdk/errorTracking.js +199 -0
  106. package/lib/commonjs/sdk/index.js +50 -0
  107. package/lib/commonjs/sdk/metricsTracking.js +204 -0
  108. package/lib/commonjs/sdk/navigation.js +151 -0
  109. package/lib/commonjs/sdk/networkInterceptor.js +412 -0
  110. package/lib/commonjs/sdk/utils.js +363 -0
  111. package/lib/commonjs/types/expo-router.d.js +2 -0
  112. package/lib/commonjs/types/index.js +2 -0
  113. package/lib/module/NativeRejourney.js +38 -0
  114. package/lib/module/components/Mask.js +72 -0
  115. package/lib/module/index.js +1284 -0
  116. package/lib/module/sdk/autoTracking.js +1233 -0
  117. package/lib/module/sdk/constants.js +145 -0
  118. package/lib/module/sdk/errorTracking.js +189 -0
  119. package/lib/module/sdk/index.js +12 -0
  120. package/lib/module/sdk/metricsTracking.js +187 -0
  121. package/lib/module/sdk/navigation.js +143 -0
  122. package/lib/module/sdk/networkInterceptor.js +401 -0
  123. package/lib/module/sdk/utils.js +342 -0
  124. package/lib/module/types/expo-router.d.js +2 -0
  125. package/lib/module/types/index.js +2 -0
  126. package/lib/typescript/NativeRejourney.d.ts +147 -0
  127. package/lib/typescript/components/Mask.d.ts +39 -0
  128. package/lib/typescript/index.d.ts +117 -0
  129. package/lib/typescript/sdk/autoTracking.d.ts +204 -0
  130. package/lib/typescript/sdk/constants.d.ts +120 -0
  131. package/lib/typescript/sdk/errorTracking.d.ts +32 -0
  132. package/lib/typescript/sdk/index.d.ts +9 -0
  133. package/lib/typescript/sdk/metricsTracking.d.ts +58 -0
  134. package/lib/typescript/sdk/navigation.d.ts +33 -0
  135. package/lib/typescript/sdk/networkInterceptor.d.ts +47 -0
  136. package/lib/typescript/sdk/utils.d.ts +148 -0
  137. package/lib/typescript/types/index.d.ts +624 -0
  138. package/package.json +102 -0
  139. package/rejourney.podspec +21 -0
  140. package/src/NativeRejourney.ts +165 -0
  141. package/src/components/Mask.tsx +80 -0
  142. package/src/index.ts +1459 -0
  143. package/src/sdk/autoTracking.ts +1373 -0
  144. package/src/sdk/constants.ts +134 -0
  145. package/src/sdk/errorTracking.ts +231 -0
  146. package/src/sdk/index.ts +11 -0
  147. package/src/sdk/metricsTracking.ts +232 -0
  148. package/src/sdk/navigation.ts +157 -0
  149. package/src/sdk/networkInterceptor.ts +440 -0
  150. package/src/sdk/utils.ts +369 -0
  151. package/src/types/expo-router.d.ts +7 -0
  152. package/src/types/index.ts +739 -0
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Rejourney Auto Tracking Module
3
+ *
4
+ * Automatic tracking features that work with just init() - no additional code needed.
5
+ * This module handles:
6
+ * - Rage tap detection
7
+ * - Error tracking (JS + React Native)
8
+ * - Session metrics aggregation
9
+ * - Device info collection
10
+ * - Anonymous ID generation
11
+ * - Funnel/screen tracking
12
+ * - Score calculations
13
+ *
14
+ * IMPORTANT: This file uses lazy loading for react-native imports to avoid
15
+ * "PlatformConstants could not be found" errors on RN 0.81+.
16
+ */
17
+ import type { DeviceInfo, ErrorEvent } from '../types';
18
+ export interface TapEvent {
19
+ x: number;
20
+ y: number;
21
+ timestamp: number;
22
+ targetId?: string;
23
+ }
24
+ export interface SessionMetrics {
25
+ totalEvents: number;
26
+ touchCount: number;
27
+ scrollCount: number;
28
+ gestureCount: number;
29
+ inputCount: number;
30
+ navigationCount: number;
31
+ errorCount: number;
32
+ rageTapCount: number;
33
+ apiSuccessCount: number;
34
+ apiErrorCount: number;
35
+ apiTotalCount: number;
36
+ netTotalDurationMs: number;
37
+ netTotalBytes: number;
38
+ screensVisited: string[];
39
+ uniqueScreensCount: number;
40
+ interactionScore: number;
41
+ explorationScore: number;
42
+ uxScore: number;
43
+ }
44
+ export interface AutoTrackingConfig {
45
+ rageTapThreshold?: number;
46
+ rageTapTimeWindow?: number;
47
+ rageTapRadius?: number;
48
+ trackJSErrors?: boolean;
49
+ trackPromiseRejections?: boolean;
50
+ trackReactNativeErrors?: boolean;
51
+ collectDeviceInfo?: boolean;
52
+ maxSessionDurationMs?: number;
53
+ }
54
+ /**
55
+ * Initialize auto tracking features
56
+ * Called automatically by Rejourney.init() - no user action needed
57
+ */
58
+ export declare function initAutoTracking(trackingConfig: AutoTrackingConfig, callbacks?: {
59
+ onRageTap?: (count: number, x: number, y: number) => void;
60
+ onError?: (error: ErrorEvent) => void;
61
+ onScreen?: (screenName: string, previousScreen?: string) => void;
62
+ }): void;
63
+ /**
64
+ * Cleanup auto tracking features
65
+ */
66
+ export declare function cleanupAutoTracking(): void;
67
+ /**
68
+ * Track a tap event for rage tap detection
69
+ * Called automatically from touch interceptor
70
+ */
71
+ export declare function trackTap(tap: TapEvent): void;
72
+ /**
73
+ * Notify that a state change occurred (navigation, modal, etc.)
74
+ * Kept for API compatibility
75
+ */
76
+ export declare function notifyStateChange(): void;
77
+ /**
78
+ * Manually track an error (for API errors, etc.)
79
+ */
80
+ export declare function captureError(message: string, stack?: string, name?: string): void;
81
+ /**
82
+ * Track a navigation state change from React Navigation.
83
+ *
84
+ * For bare React Native apps using @react-navigation/native.
85
+ * Just add this to your NavigationContainer's onStateChange prop.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * import { trackNavigationState } from 'rejourney';
90
+ *
91
+ * <NavigationContainer onStateChange={trackNavigationState}>
92
+ * ...
93
+ * </NavigationContainer>
94
+ * ```
95
+ */
96
+ export declare function trackNavigationState(state: any): void;
97
+ /**
98
+ * React hook for navigation tracking.
99
+ *
100
+ * Returns props to spread on NavigationContainer that will:
101
+ * 1. Track the initial screen on mount (via onReady)
102
+ * 2. Track all subsequent navigations (via onStateChange)
103
+ *
104
+ * This is the RECOMMENDED approach for bare React Native apps.
105
+ *
106
+ * @example
107
+ * ```tsx
108
+ * import { useNavigationTracking } from 'rejourney';
109
+ * import { NavigationContainer } from '@react-navigation/native';
110
+ *
111
+ * function App() {
112
+ * const navigationTracking = useNavigationTracking();
113
+ *
114
+ * return (
115
+ * <NavigationContainer {...navigationTracking}>
116
+ * <RootNavigator />
117
+ * </NavigationContainer>
118
+ * );
119
+ * }
120
+ * ```
121
+ */
122
+ export declare function useNavigationTracking(): {
123
+ ref: any;
124
+ onReady: any;
125
+ onStateChange: typeof trackNavigationState;
126
+ };
127
+ /**
128
+ * Track a screen view
129
+ * This updates JS metrics AND notifies the native module to send to backend
130
+ */
131
+ export declare function trackScreen(screenName: string): void;
132
+ /**
133
+ * Track an API request with timing data
134
+ */
135
+ export declare function trackAPIRequest(success: boolean, _statusCode: number, durationMs?: number, responseBytes?: number): void;
136
+ /**
137
+ * Track a scroll event
138
+ */
139
+ export declare function trackScroll(): void;
140
+ /**
141
+ * Track a gesture event
142
+ */
143
+ export declare function trackGesture(): void;
144
+ /**
145
+ * Track an input event (keyboard)
146
+ */
147
+ export declare function trackInput(): void;
148
+ /**
149
+ * Get current session metrics
150
+ */
151
+ export declare function getSessionMetrics(): SessionMetrics & {
152
+ netAvgDurationMs: number;
153
+ };
154
+ /**
155
+ * Reset metrics for new session
156
+ */
157
+ export declare function resetMetrics(): void;
158
+ /** Clamp and set max session duration in minutes (1–10). Defaults to 10. */
159
+ export declare function setMaxSessionDurationMinutes(minutes?: number): void;
160
+ /** Returns true if the current session exceeded the configured max duration. */
161
+ export declare function hasExceededMaxSessionDuration(): boolean;
162
+ /** Returns remaining milliseconds until the session should stop. */
163
+ export declare function getRemainingSessionDurationMs(): number;
164
+ /**
165
+ * Collect device information
166
+ */
167
+ export declare function collectDeviceInfo(): DeviceInfo;
168
+ /**
169
+ * Get the anonymous ID (synchronous - returns generated ID immediately)
170
+ * For persistent ID, call initAnonymousId() first
171
+ */
172
+ export declare function getAnonymousId(): string;
173
+ /**
174
+ * Ensure a stable, persisted anonymous/device ID is available.
175
+ * Returns the stored ID if present, otherwise generates and persists one.
176
+ */
177
+ export declare function ensurePersistentAnonymousId(): Promise<string>;
178
+ /**
179
+ * Load anonymous ID from persistent storage
180
+ * Call this at app startup for best results
181
+ */
182
+ export declare function loadAnonymousId(): Promise<string>;
183
+ /**
184
+ * Set a custom anonymous ID (e.g., from persistent storage)
185
+ */
186
+ export declare function setAnonymousId(id: string): void;
187
+ declare const _default: {
188
+ init: typeof initAutoTracking;
189
+ cleanup: typeof cleanupAutoTracking;
190
+ trackTap: typeof trackTap;
191
+ trackScroll: typeof trackScroll;
192
+ trackGesture: typeof trackGesture;
193
+ trackInput: typeof trackInput;
194
+ trackScreen: typeof trackScreen;
195
+ trackAPIRequest: typeof trackAPIRequest;
196
+ captureError: typeof captureError;
197
+ getMetrics: typeof getSessionMetrics;
198
+ resetMetrics: typeof resetMetrics;
199
+ collectDeviceInfo: typeof collectDeviceInfo;
200
+ getAnonymousId: typeof getAnonymousId;
201
+ setAnonymousId: typeof setAnonymousId;
202
+ };
203
+ export default _default;
204
+ //# sourceMappingURL=autoTracking.d.ts.map
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Rejourney SDK Constants
3
+ */
4
+ export declare const SDK_VERSION = "1.0.0";
5
+ /** Default configuration values */
6
+ export declare const DEFAULT_CONFIG: {
7
+ readonly enabled: true;
8
+ readonly captureFPS: 0.5;
9
+ readonly captureOnEvents: true;
10
+ readonly maxSessionDuration: number;
11
+ readonly maxStorageSize: number;
12
+ readonly autoScreenTracking: true;
13
+ readonly autoGestureTracking: true;
14
+ readonly privacyOcclusion: true;
15
+ readonly enableCompression: true;
16
+ readonly inactivityThreshold: 5000;
17
+ readonly disableInDev: false;
18
+ readonly detectRageTaps: true;
19
+ readonly rageTapThreshold: 3;
20
+ readonly rageTapTimeWindow: 1000;
21
+ readonly debug: false;
22
+ readonly autoStartRecording: true;
23
+ readonly collectDeviceInfo: true;
24
+ readonly collectGeoLocation: true;
25
+ readonly postNavigationDelay: 300;
26
+ readonly postGestureDelay: 200;
27
+ readonly postModalDelay: 400;
28
+ };
29
+ /** Event type constants */
30
+ export declare const EVENT_TYPES: {
31
+ readonly GESTURE: "gesture";
32
+ readonly SCREEN_CHANGE: "screen_change";
33
+ readonly CUSTOM: "custom";
34
+ readonly APP_STATE: "app_state";
35
+ readonly FRUSTRATION: "frustration";
36
+ readonly ERROR: "error";
37
+ };
38
+ /** Gesture type constants */
39
+ export declare const GESTURE_TYPES: {
40
+ readonly TAP: "tap";
41
+ readonly DOUBLE_TAP: "double_tap";
42
+ readonly LONG_PRESS: "long_press";
43
+ readonly SWIPE_LEFT: "swipe_left";
44
+ readonly SWIPE_RIGHT: "swipe_right";
45
+ readonly SWIPE_UP: "swipe_up";
46
+ readonly SWIPE_DOWN: "swipe_down";
47
+ readonly PINCH: "pinch";
48
+ readonly SCROLL: "scroll";
49
+ readonly RAGE_TAP: "rage_tap";
50
+ };
51
+ /** Playback speeds */
52
+ export declare const PLAYBACK_SPEEDS: readonly [0.5, 1, 2, 4];
53
+ /** Capture settings */
54
+ export declare const CAPTURE_SETTINGS: {
55
+ readonly DEFAULT_FPS: 0.5;
56
+ readonly MIN_FPS: 0.1;
57
+ readonly MAX_FPS: 2;
58
+ readonly CAPTURE_SCALE: 0.25;
59
+ readonly MIN_CAPTURE_DELTA_TIME: 0.5;
60
+ };
61
+ /** Memory management settings */
62
+ export declare const MEMORY_SETTINGS: {
63
+ /** Maximum events to keep in memory before flushing */
64
+ readonly MAX_EVENTS_IN_MEMORY: 100;
65
+ /** Memory warning threshold in MB (flush when exceeded) */
66
+ readonly MEMORY_WARNING_THRESHOLD_MB: 100;
67
+ /** Enable aggressive memory cleanup during low memory */
68
+ readonly AGGRESSIVE_CLEANUP_ENABLED: true;
69
+ /** Bitmap pool size for reusing bitmaps (Android) */
70
+ readonly BITMAP_POOL_SIZE: 3;
71
+ };
72
+ /** CPU throttling settings */
73
+ export declare const CPU_SETTINGS: {
74
+ /** Throttle captures when CPU usage exceeds this percentage */
75
+ readonly CPU_THROTTLE_THRESHOLD: 80;
76
+ /** Minimum interval between captures when throttled (seconds) */
77
+ readonly THROTTLED_MIN_INTERVAL: 2;
78
+ /** Skip captures when battery is below this level (0-100) */
79
+ readonly LOW_BATTERY_THRESHOLD: 15;
80
+ /** Skip captures when device is thermally throttled */
81
+ readonly THERMAL_THROTTLE_ENABLED: true;
82
+ /** Maximum consecutive captures before forced cooldown */
83
+ readonly MAX_CONSECUTIVE_CAPTURES: 10;
84
+ /** Cooldown period after max consecutive captures (ms) */
85
+ readonly CAPTURE_COOLDOWN_MS: 1000;
86
+ };
87
+ /** Storage management settings */
88
+ export declare const STORAGE_SETTINGS: {
89
+ /** Maximum total storage for session data (bytes) */
90
+ readonly MAX_STORAGE_SIZE: number;
91
+ /** Storage warning threshold - start cleanup at this level */
92
+ readonly STORAGE_WARNING_THRESHOLD: 0.8;
93
+ /** Number of old sessions to keep */
94
+ readonly MAX_SESSIONS_TO_KEEP: 5;
95
+ /** Auto-delete sessions older than this (hours) */
96
+ readonly SESSION_EXPIRY_HOURS: 24;
97
+ /** Use efficient binary storage format */
98
+ readonly USE_BINARY_FORMAT: true;
99
+ };
100
+ /** Network/Upload settings */
101
+ export declare const UPLOAD_SETTINGS: {
102
+ /** Batch upload interval (ms) */
103
+ readonly BATCH_INTERVAL_MS: 30000;
104
+ /** Max retry attempts for failed uploads */
105
+ readonly MAX_RETRY_ATTEMPTS: 3;
106
+ /** Retry delay multiplier (exponential backoff) */
107
+ readonly RETRY_DELAY_MULTIPLIER: 2;
108
+ /** Initial retry delay (ms) */
109
+ readonly INITIAL_RETRY_DELAY_MS: 1000;
110
+ /** Max events per upload batch */
111
+ readonly MAX_EVENTS_PER_BATCH: 50;
112
+ /** Skip uploads when on cellular and battery is low */
113
+ readonly CELLULAR_BATTERY_AWARE: true;
114
+ };
115
+ /** Privacy constants */
116
+ export declare const PRIVACY: {
117
+ readonly OCCLUSION_COLOR: "#808080";
118
+ readonly SENSITIVE_COMPONENT_TYPES: readonly ["TextInput", "SecureTextEntry", "PasswordField"];
119
+ };
120
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Error Tracking Module for Rejourney SDK
3
+ *
4
+ * Handles JS error capture, React Native ErrorUtils, and unhandled promise rejections.
5
+ * Split from autoTracking.ts for better code organization.
6
+ */
7
+ import type { ErrorEvent } from '../types';
8
+ /**
9
+ * Setup error tracking with the given callback
10
+ */
11
+ export declare function setupErrorTracking(config: {
12
+ trackJSErrors?: boolean;
13
+ trackPromiseRejections?: boolean;
14
+ trackReactNativeErrors?: boolean;
15
+ }, onError: (error: ErrorEvent) => void): void;
16
+ /**
17
+ * Cleanup error tracking and restore original handlers
18
+ */
19
+ export declare function cleanupErrorTracking(): void;
20
+ /**
21
+ * Get current error count
22
+ */
23
+ export declare function getErrorCount(): number;
24
+ /**
25
+ * Reset error count
26
+ */
27
+ export declare function resetErrorCount(): void;
28
+ /**
29
+ * Manually capture an error
30
+ */
31
+ export declare function captureError(message: string, stack?: string, name?: string): void;
32
+ //# sourceMappingURL=errorTracking.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rejourney SDK
3
+ * Session recording and replay for React Native
4
+ */
5
+ export * from './constants';
6
+ export * from './utils';
7
+ export * from './autoTracking';
8
+ export * from './networkInterceptor';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Session Metrics Module for Rejourney SDK
3
+ *
4
+ * Tracks and calculates session metrics including interaction scores,
5
+ * API performance, and user engagement metrics.
6
+ * Split from autoTracking.ts for better code organization.
7
+ */
8
+ /**
9
+ * Session metrics structure
10
+ */
11
+ export interface SessionMetrics {
12
+ totalEvents: number;
13
+ touchCount: number;
14
+ scrollCount: number;
15
+ gestureCount: number;
16
+ inputCount: number;
17
+ navigationCount: number;
18
+ errorCount: number;
19
+ rageTapCount: number;
20
+ apiSuccessCount: number;
21
+ apiErrorCount: number;
22
+ apiTotalCount: number;
23
+ netTotalDurationMs: number;
24
+ netTotalBytes: number;
25
+ screensVisited: string[];
26
+ uniqueScreensCount: number;
27
+ interactionScore: number;
28
+ explorationScore: number;
29
+ uxScore: number;
30
+ }
31
+ /**
32
+ * Create empty metrics object
33
+ */
34
+ export declare function createEmptyMetrics(): SessionMetrics;
35
+ /**
36
+ * Reset all metrics
37
+ */
38
+ export declare function resetMetrics(): void;
39
+ /**
40
+ * Initialize metrics for new session
41
+ */
42
+ export declare function initMetrics(): void;
43
+ /**
44
+ * Get current session metrics with calculated scores
45
+ */
46
+ export declare function getSessionMetrics(): SessionMetrics;
47
+ /**
48
+ * Set max session duration (in minutes)
49
+ */
50
+ export declare function setMaxSessionDurationMinutes(minutes?: number): void;
51
+ export declare function incrementTouchCount(): void;
52
+ export declare function incrementScrollCount(): void;
53
+ export declare function incrementNavigationCount(): void;
54
+ export declare function incrementRageTapCount(): void;
55
+ export declare function incrementErrorCount(): void;
56
+ export declare function addScreenVisited(screenName: string): void;
57
+ export declare function trackAPIMetrics(success: boolean, durationMs?: number, responseBytes?: number): void;
58
+ //# sourceMappingURL=metricsTracking.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Rejourney Navigation Utilities
3
+ *
4
+ * Helper functions for extracting human-readable screen names from
5
+ * React Navigation / Expo Router state.
6
+ *
7
+ * These functions are used internally by the SDK's automatic navigation
8
+ * detection. You don't need to import or use these directly.
9
+ */
10
+ /**
11
+ * Normalize a screen name to be human-readable
12
+ * Handles common patterns from React Native / Expo Router
13
+ *
14
+ * @param raw - Raw screen name to normalize
15
+ * @returns Cleaned, human-readable screen name
16
+ */
17
+ export declare function normalizeScreenName(raw: string): string;
18
+ /**
19
+ * Get a human-readable screen name from Expo Router path and segments
20
+ *
21
+ * @param pathname - The current route pathname
22
+ * @param segments - Route segments from useSegments()
23
+ * @returns Human-readable screen name
24
+ */
25
+ export declare function getScreenNameFromPath(pathname: string, segments: string[]): string;
26
+ /**
27
+ * Get the current route name from a navigation state object
28
+ *
29
+ * @param state - React Navigation state object
30
+ * @returns Current route name or null
31
+ */
32
+ export declare function getCurrentRouteFromState(state: any): string | null;
33
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Network Interceptor for Rejourney - Optimized Version
3
+ *
4
+ * Automatically intercepts fetch() and XMLHttpRequest to log API calls.
5
+ *
6
+ * PERFORMANCE OPTIMIZATIONS:
7
+ * - Minimal synchronous overhead (just captures timing, no processing)
8
+ * - Batched async logging (doesn't block requests)
9
+ * - Circular buffer with max size limit
10
+ * - Sampling for high-frequency endpoints
11
+ * - No string allocations in hot path
12
+ * - Lazy URL parsing
13
+ * - PII Scrubbing for query parameters
14
+ */
15
+ import type { NetworkRequestParams } from '../types';
16
+ /**
17
+ * Initialize network interception
18
+ */
19
+ export declare function initNetworkInterceptor(callback: (request: NetworkRequestParams) => void, options?: {
20
+ ignoreUrls?: (string | RegExp)[];
21
+ captureSizes?: boolean;
22
+ }): void;
23
+ /**
24
+ * Disable network interception
25
+ */
26
+ export declare function disableNetworkInterceptor(): void;
27
+ /**
28
+ * Re-enable network interception
29
+ */
30
+ export declare function enableNetworkInterceptor(): void;
31
+ /**
32
+ * Force flush pending requests (call before app termination)
33
+ */
34
+ export declare function flushNetworkRequests(): void;
35
+ /**
36
+ * Restore original fetch and XHR
37
+ */
38
+ export declare function restoreNetworkInterceptor(): void;
39
+ /**
40
+ * Get stats for debugging
41
+ */
42
+ export declare function getNetworkInterceptorStats(): {
43
+ pendingCount: number;
44
+ endpointCount: number;
45
+ enabled: boolean;
46
+ };
47
+ //# sourceMappingURL=networkInterceptor.d.ts.map
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Rejourney Utility Functions
3
+ *
4
+ * IMPORTANT: This file uses lazy loading for react-native imports to avoid
5
+ * "PlatformConstants could not be found" errors on RN 0.81+.
6
+ */
7
+ import type { TouchPoint, GestureType } from '../types';
8
+ /**
9
+ * Generate a unique ID
10
+ */
11
+ export declare function generateId(): string;
12
+ /**
13
+ * Generate a session ID
14
+ */
15
+ export declare function generateSessionId(): string;
16
+ /**
17
+ * Get current timestamp in milliseconds
18
+ */
19
+ export declare function now(): number;
20
+ /**
21
+ * Check if running in development mode
22
+ */
23
+ export declare function isDevelopment(): boolean;
24
+ /**
25
+ * Check platform
26
+ */
27
+ export declare function isIOS(): boolean;
28
+ export declare function isAndroid(): boolean;
29
+ /**
30
+ * Calculate distance between two points
31
+ */
32
+ export declare function distance(p1: TouchPoint, p2: TouchPoint): number;
33
+ /**
34
+ * Calculate velocity between two points
35
+ */
36
+ export declare function velocity(p1: TouchPoint, p2: TouchPoint): {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ /**
41
+ * Determine gesture type from touch points
42
+ */
43
+ export declare function classifyGesture(touches: TouchPoint[], duration: number): GestureType;
44
+ /**
45
+ * Throttle function execution
46
+ */
47
+ export declare function throttle<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
48
+ /**
49
+ * Debounce function execution
50
+ */
51
+ export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay: number): (...args: Parameters<T>) => void;
52
+ /**
53
+ * Format bytes to human readable string
54
+ */
55
+ export declare function formatBytes(bytes: number): string;
56
+ /**
57
+ * Format duration to human readable string
58
+ */
59
+ export declare function formatDuration(ms: number): string;
60
+ /**
61
+ * Format timestamp to readable time
62
+ */
63
+ export declare function formatTime(ms: number): string;
64
+ /**
65
+ * Create a simple hash of a string
66
+ */
67
+ export declare function simpleHash(str: string): string;
68
+ /**
69
+ * Log levels for controlling verbosity.
70
+ *
71
+ * Default behavior minimizes log pollution for integrators:
72
+ * - Release/Production: SILENT (no logs)
73
+ * - Development: ERROR (only critical issues)
74
+ */
75
+ export declare enum LogLevel {
76
+ DEBUG = 0,
77
+ INFO = 1,
78
+ WARNING = 2,
79
+ ERROR = 3,
80
+ SILENT = 4
81
+ }
82
+ /**
83
+ * Logger with production-aware log levels.
84
+ *
85
+ * Designed to minimize log pollution for integrators:
86
+ * - Production/Release: SILENT (completely silent, no logs)
87
+ * - Development/Debug: ERROR (only critical errors)
88
+ *
89
+ * Only essential lifecycle logs (init success, session start/end) bypass
90
+ * these levels via dedicated methods.
91
+ */
92
+ declare class Logger {
93
+ private prefix;
94
+ private debugMode;
95
+ /**
96
+ * Minimum log level to display.
97
+ *
98
+ * Defaults to SILENT to avoid polluting integrator's console.
99
+ * SDK developers can adjust this for internal debugging.
100
+ *
101
+ * Note: In production builds, this should remain SILENT.
102
+ * The native layers handle build-type detection automatically.
103
+ */
104
+ private minimumLogLevel;
105
+ /**
106
+ * Set the minimum log level. Logs below this level will be suppressed.
107
+ * SDK developers can use this for internal debugging.
108
+ */
109
+ setLogLevel(level: LogLevel): void;
110
+ setDebugMode(enabled: boolean): void;
111
+ /** Log a debug message - SDK internal use only */
112
+ debug(...args: any[]): void;
113
+ /** Log an info message - SDK internal use only */
114
+ info(...args: any[]): void;
115
+ /** Log a warning message */
116
+ warn(...args: any[]): void;
117
+ /** Log an error message */
118
+ error(...args: any[]): void;
119
+ notice(...args: any[]): void;
120
+ /**
121
+ * Log SDK initialization success.
122
+ * Only shown in development builds - this is the minimal "SDK started" log.
123
+ */
124
+ logInitSuccess(version: string): void;
125
+ /**
126
+ * Log SDK initialization failure.
127
+ * Always shown - this is a critical error.
128
+ */
129
+ logInitFailure(reason: string): void;
130
+ /**
131
+ * Log session start.
132
+ * Only shown in development builds.
133
+ */
134
+ logSessionStart(sessionId: string): void;
135
+ /**
136
+ * Log session end.
137
+ * Only shown in development builds.
138
+ */
139
+ logSessionEnd(sessionId: string): void;
140
+ logObservabilityStart(): void;
141
+ logRecordingStart(): void;
142
+ logRecordingRemoteDisabled(): void;
143
+ logInvalidProjectKey(): void;
144
+ logPackageMismatch(): void;
145
+ }
146
+ export declare const logger: Logger;
147
+ export {};
148
+ //# sourceMappingURL=utils.d.ts.map