@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,342 @@
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
+
8
+ // Lazy-loaded Platform module
9
+ let _Platform = null;
10
+ function getPlatform() {
11
+ if (_Platform) return _Platform;
12
+ try {
13
+ const RN = require('react-native');
14
+ _Platform = RN.Platform;
15
+ return _Platform;
16
+ } catch {
17
+ return null;
18
+ }
19
+ }
20
+
21
+ /**
22
+ * Generate a unique ID
23
+ */
24
+ export function generateId() {
25
+ const timestamp = Date.now().toString(36);
26
+ const randomPart = Math.random().toString(36).substring(2, 9);
27
+ return `${timestamp}-${randomPart}`;
28
+ }
29
+
30
+ /**
31
+ * Generate a session ID
32
+ */
33
+ export function generateSessionId() {
34
+ const date = new Date();
35
+ const dateStr = date.toISOString().split('T')[0]?.replace(/-/g, '') ?? '';
36
+ const timeStr = date.toTimeString().split(' ')[0]?.replace(/:/g, '') ?? '';
37
+ const random = Math.random().toString(36).substring(2, 6);
38
+ return `session_${dateStr}_${timeStr}_${random}`;
39
+ }
40
+
41
+ /**
42
+ * Get current timestamp in milliseconds
43
+ */
44
+ export function now() {
45
+ return Date.now();
46
+ }
47
+
48
+ /**
49
+ * Check if running in development mode
50
+ */
51
+ export function isDevelopment() {
52
+ return __DEV__;
53
+ }
54
+
55
+ /**
56
+ * Check platform
57
+ */
58
+ export function isIOS() {
59
+ const platform = getPlatform();
60
+ return platform?.OS === 'ios';
61
+ }
62
+ export function isAndroid() {
63
+ const platform = getPlatform();
64
+ return platform?.OS === 'android';
65
+ }
66
+
67
+ /**
68
+ * Calculate distance between two points
69
+ */
70
+ export function distance(p1, p2) {
71
+ const dx = p2.x - p1.x;
72
+ const dy = p2.y - p1.y;
73
+ return Math.sqrt(dx * dx + dy * dy);
74
+ }
75
+
76
+ /**
77
+ * Calculate velocity between two points
78
+ */
79
+ export function velocity(p1, p2) {
80
+ const dt = p2.timestamp - p1.timestamp;
81
+ if (dt === 0) return {
82
+ x: 0,
83
+ y: 0
84
+ };
85
+ return {
86
+ x: (p2.x - p1.x) / dt,
87
+ y: (p2.y - p1.y) / dt
88
+ };
89
+ }
90
+
91
+ /**
92
+ * Determine gesture type from touch points
93
+ */
94
+ export function classifyGesture(touches, duration) {
95
+ if (touches.length < 2) {
96
+ if (duration > 500) return 'long_press';
97
+ return 'tap';
98
+ }
99
+ const first = touches[0];
100
+ const last = touches[touches.length - 1];
101
+ if (!first || !last) return 'tap';
102
+ const dx = last.x - first.x;
103
+ const dy = last.y - first.y;
104
+ const dist = distance(first, last);
105
+
106
+ // If very little movement, it's a tap
107
+ if (dist < 10) {
108
+ if (duration > 500) return 'long_press';
109
+ return 'tap';
110
+ }
111
+
112
+ // Determine swipe direction
113
+ const absX = Math.abs(dx);
114
+ const absY = Math.abs(dy);
115
+ if (absX > absY) {
116
+ return dx > 0 ? 'swipe_right' : 'swipe_left';
117
+ } else {
118
+ return dy > 0 ? 'swipe_down' : 'swipe_up';
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Throttle function execution
124
+ */
125
+ export function throttle(fn, delay) {
126
+ let lastCall = 0;
127
+ return (...args) => {
128
+ const currentTime = now();
129
+ if (currentTime - lastCall >= delay) {
130
+ lastCall = currentTime;
131
+ fn(...args);
132
+ }
133
+ };
134
+ }
135
+
136
+ /**
137
+ * Debounce function execution
138
+ */
139
+ export function debounce(fn, delay) {
140
+ let timeoutId = null;
141
+ return (...args) => {
142
+ if (timeoutId) clearTimeout(timeoutId);
143
+ timeoutId = setTimeout(() => fn(...args), delay);
144
+ };
145
+ }
146
+
147
+ /**
148
+ * Format bytes to human readable string
149
+ */
150
+ export function formatBytes(bytes) {
151
+ if (bytes === 0) return '0 Bytes';
152
+ const k = 1024;
153
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
154
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
155
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
156
+ }
157
+
158
+ /**
159
+ * Format duration to human readable string
160
+ */
161
+ export function formatDuration(ms) {
162
+ const seconds = Math.floor(ms / 1000);
163
+ const minutes = Math.floor(seconds / 60);
164
+ const hours = Math.floor(minutes / 60);
165
+ if (hours > 0) {
166
+ return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
167
+ }
168
+ if (minutes > 0) {
169
+ return `${minutes}m ${seconds % 60}s`;
170
+ }
171
+ return `${seconds}s`;
172
+ }
173
+
174
+ /**
175
+ * Format timestamp to readable time
176
+ */
177
+ export function formatTime(ms) {
178
+ const totalSeconds = Math.floor(ms / 1000);
179
+ const minutes = Math.floor(totalSeconds / 60);
180
+ const seconds = totalSeconds % 60;
181
+ return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
182
+ }
183
+
184
+ /**
185
+ * Create a simple hash of a string
186
+ */
187
+ export function simpleHash(str) {
188
+ let hash = 0;
189
+ for (let i = 0; i < str.length; i++) {
190
+ const char = str.charCodeAt(i);
191
+ hash = (hash << 5) - hash + char;
192
+ hash = hash & hash; // Convert to 32bit integer
193
+ }
194
+ return Math.abs(hash).toString(36);
195
+ }
196
+
197
+ /**
198
+ * Log levels for controlling verbosity.
199
+ *
200
+ * Default behavior minimizes log pollution for integrators:
201
+ * - Release/Production: SILENT (no logs)
202
+ * - Development: ERROR (only critical issues)
203
+ */
204
+ export let LogLevel = /*#__PURE__*/function (LogLevel) {
205
+ LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
206
+ LogLevel[LogLevel["INFO"] = 1] = "INFO";
207
+ LogLevel[LogLevel["WARNING"] = 2] = "WARNING";
208
+ LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
209
+ LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
210
+ return LogLevel;
211
+ }({});
212
+
213
+ /**
214
+ * Logger with production-aware log levels.
215
+ *
216
+ * Designed to minimize log pollution for integrators:
217
+ * - Production/Release: SILENT (completely silent, no logs)
218
+ * - Development/Debug: ERROR (only critical errors)
219
+ *
220
+ * Only essential lifecycle logs (init success, session start/end) bypass
221
+ * these levels via dedicated methods.
222
+ */
223
+ class Logger {
224
+ prefix = '[Rejourney]';
225
+ debugMode = false;
226
+
227
+ /**
228
+ * Minimum log level to display.
229
+ *
230
+ * Defaults to SILENT to avoid polluting integrator's console.
231
+ * SDK developers can adjust this for internal debugging.
232
+ *
233
+ * Note: In production builds, this should remain SILENT.
234
+ * The native layers handle build-type detection automatically.
235
+ */
236
+ minimumLogLevel = typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
237
+
238
+ /**
239
+ * Set the minimum log level. Logs below this level will be suppressed.
240
+ * SDK developers can use this for internal debugging.
241
+ */
242
+ setLogLevel(level) {
243
+ this.minimumLogLevel = level;
244
+ }
245
+ setDebugMode(enabled) {
246
+ this.debugMode = enabled;
247
+ this.minimumLogLevel = enabled ? LogLevel.DEBUG : typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
248
+ }
249
+
250
+ /** Log a debug message - SDK internal use only */
251
+ debug(...args) {
252
+ if (this.minimumLogLevel <= LogLevel.DEBUG) {
253
+ console.log(this.prefix, ...args);
254
+ }
255
+ }
256
+
257
+ /** Log an info message - SDK internal use only */
258
+ info(...args) {
259
+ if (this.minimumLogLevel <= LogLevel.INFO) {
260
+ console.info(this.prefix, ...args);
261
+ }
262
+ }
263
+
264
+ /** Log a warning message */
265
+ warn(...args) {
266
+ if (this.minimumLogLevel <= LogLevel.WARNING) {
267
+ console.warn(this.prefix, ...args);
268
+ }
269
+ }
270
+
271
+ /** Log an error message */
272
+ error(...args) {
273
+ if (this.minimumLogLevel <= LogLevel.ERROR) {
274
+ console.error(this.prefix, ...args);
275
+ }
276
+ }
277
+ notice(...args) {
278
+ if (typeof __DEV__ !== 'undefined' && __DEV__) {
279
+ console.info(this.prefix, ...args);
280
+ }
281
+ }
282
+
283
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
284
+ // Lifecycle Logs - Industry standard minimal logging
285
+ // These are the only logs integrators will see in debug builds
286
+ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
287
+
288
+ /**
289
+ * Log SDK initialization success.
290
+ * Only shown in development builds - this is the minimal "SDK started" log.
291
+ */
292
+ logInitSuccess(version) {
293
+ if (this.debugMode) {
294
+ this.info(`✓ SDK initialized (v${version})`);
295
+ }
296
+ }
297
+
298
+ /**
299
+ * Log SDK initialization failure.
300
+ * Always shown - this is a critical error.
301
+ */
302
+ logInitFailure(reason) {
303
+ console.error(this.prefix, `✗ Initialization failed: ${reason}`);
304
+ }
305
+
306
+ /**
307
+ * Log session start.
308
+ * Only shown in development builds.
309
+ */
310
+ logSessionStart(sessionId) {
311
+ if (this.debugMode) {
312
+ this.info(`Session started: ${sessionId}`);
313
+ }
314
+ }
315
+
316
+ /**
317
+ * Log session end.
318
+ * Only shown in development builds.
319
+ */
320
+ logSessionEnd(sessionId) {
321
+ if (this.debugMode) {
322
+ this.info(`Session ended: ${sessionId}`);
323
+ }
324
+ }
325
+ logObservabilityStart() {
326
+ this.notice('Starting Rejourney observability');
327
+ }
328
+ logRecordingStart() {
329
+ this.notice('Starting recording');
330
+ }
331
+ logRecordingRemoteDisabled() {
332
+ this.notice('Recording disabled by remote toggle');
333
+ }
334
+ logInvalidProjectKey() {
335
+ this.notice('Invalid project API key');
336
+ }
337
+ logPackageMismatch() {
338
+ this.notice('Bundle ID / package name mismatch');
339
+ }
340
+ }
341
+ export const logger = new Logger();
342
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=expo-router.d.js.map
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,147 @@
1
+ /**
2
+ * TurboModule spec for Rejourney SDK
3
+ *
4
+ * This file defines the native module interface for React Native's New Architecture.
5
+ * It follows the official React Native TurboModules pattern for Codegen compatibility.
6
+ *
7
+ * IMPORTANT: This spec file is used by Codegen to generate native bindings.
8
+ * The default export MUST be a direct TurboModuleRegistry.get() call.
9
+ *
10
+ * @see https://reactnative.dev/docs/turbo-native-modules-introduction
11
+ */
12
+ import type { TurboModule } from 'react-native';
13
+ /**
14
+ * SDK telemetry metrics for observability
15
+ */
16
+ export interface SDKMetrics {
17
+ uploadSuccessCount: number;
18
+ uploadFailureCount: number;
19
+ retryAttemptCount: number;
20
+ circuitBreakerOpenCount: number;
21
+ memoryEvictionCount: number;
22
+ offlinePersistCount: number;
23
+ sessionStartCount: number;
24
+ crashCount: number;
25
+ uploadSuccessRate: number;
26
+ avgUploadDurationMs: number;
27
+ currentQueueDepth: number;
28
+ lastUploadTime: number | null;
29
+ lastRetryTime: number | null;
30
+ totalBytesUploaded: number;
31
+ totalBytesEvicted: number;
32
+ }
33
+ /**
34
+ * Native Rejourney module specification for TurboModules (New Architecture)
35
+ *
36
+ * This interface defines all methods exposed by the native module.
37
+ * Codegen uses this to generate:
38
+ * - iOS: RejourneySpec.h (protocol) and RejourneySpec-generated.mm (JSI bindings)
39
+ * - Android: NativeRejourneySpec.java (interface)
40
+ */
41
+ export interface Spec extends TurboModule {
42
+ /**
43
+ * Start a recording session
44
+ */
45
+ startSession(userId: string, apiUrl: string, publicKey: string): Promise<{
46
+ success: boolean;
47
+ sessionId: string;
48
+ error?: string;
49
+ }>;
50
+ /**
51
+ * Stop the current recording session
52
+ */
53
+ stopSession(): Promise<{
54
+ success: boolean;
55
+ sessionId: string;
56
+ uploadSuccess?: boolean;
57
+ warning?: string;
58
+ error?: string;
59
+ }>;
60
+ /**
61
+ * Log a custom event
62
+ */
63
+ logEvent(eventType: string, details: Object): Promise<{
64
+ success: boolean;
65
+ }>;
66
+ /**
67
+ * Notify of a screen change
68
+ */
69
+ screenChanged(screenName: string): Promise<{
70
+ success: boolean;
71
+ }>;
72
+ /**
73
+ * Report scroll offset for timeline correlation
74
+ */
75
+ onScroll(offsetY: number): Promise<{
76
+ success: boolean;
77
+ }>;
78
+ /**
79
+ * Mark a visual change that should be captured
80
+ */
81
+ markVisualChange(reason: string, importance: string): Promise<boolean>;
82
+ /**
83
+ * Notify that an external URL is being opened
84
+ */
85
+ onExternalURLOpened(urlScheme: string): Promise<{
86
+ success: boolean;
87
+ }>;
88
+ /**
89
+ * Notify that an OAuth flow is starting
90
+ */
91
+ onOAuthStarted(provider: string): Promise<{
92
+ success: boolean;
93
+ }>;
94
+ /**
95
+ * Notify that an OAuth flow has completed
96
+ */
97
+ onOAuthCompleted(provider: string, success: boolean): Promise<{
98
+ success: boolean;
99
+ }>;
100
+ /**
101
+ * Get SDK telemetry metrics for observability
102
+ */
103
+ getSDKMetrics(): Promise<SDKMetrics>;
104
+ /**
105
+ * Trigger a debug crash (Dev only)
106
+ */
107
+ debugCrash(): void;
108
+ /**
109
+ * Trigger a debug ANR (Dev only)
110
+ * Blocks the main thread for the specified duration
111
+ */
112
+ debugTriggerANR(durationMs: number): void;
113
+ /**
114
+ * Get the current session ID
115
+ */
116
+ getSessionId(): Promise<string | null>;
117
+ /**
118
+ * Mask a view by its nativeID prop (will be occluded in recordings)
119
+ */
120
+ maskViewByNativeID(nativeID: string): Promise<{
121
+ success: boolean;
122
+ }>;
123
+ /**
124
+ * Unmask a view by its nativeID prop
125
+ */
126
+ unmaskViewByNativeID(nativeID: string): Promise<{
127
+ success: boolean;
128
+ }>;
129
+ setUserIdentity(userId: string): Promise<{
130
+ success: boolean;
131
+ }>;
132
+ setDebugMode(enabled: boolean): Promise<{
133
+ success: boolean;
134
+ }>;
135
+ }
136
+ /**
137
+ * Default export for Codegen.
138
+ *
139
+ * CRITICAL: This MUST be a direct TurboModuleRegistry.get() call.
140
+ * Codegen parses this file statically and requires this exact pattern.
141
+ *
142
+ * Using getEnforcing() would throw if module not found.
143
+ * Using get() returns null, which is safer during development/testing.
144
+ */
145
+ declare const _default: Spec | null;
146
+ export default _default;
147
+ //# sourceMappingURL=NativeRejourney.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Mask Component
3
+ *
4
+ * Wrapper component to mask sensitive content in session replays.
5
+ * All children wrapped in this component will be obscured in recordings.
6
+ *
7
+ * IMPORTANT: This file uses lazy loading to avoid "PlatformConstants could not be found"
8
+ * errors on React Native 0.81+ with New Architecture (Bridgeless).
9
+ *
10
+ * @example
11
+ * ```tsx
12
+ * import { Mask } from 'rejourney';
13
+ *
14
+ * // Mask sensitive user ID
15
+ * <Mask>
16
+ * <Text>User ID: {user.id}</Text>
17
+ * </Mask>
18
+ *
19
+ * // Mask credit card info
20
+ * <Mask>
21
+ * <CreditCardDisplay card={card} />
22
+ * </Mask>
23
+ * ```
24
+ */
25
+ import React from 'react';
26
+ import type { ViewProps } from 'react-native';
27
+ export interface MaskProps extends ViewProps {
28
+ children: React.ReactNode;
29
+ }
30
+ /**
31
+ * Wrapper component to mask sensitive content in session replays.
32
+ * All children will be obscured in recordings.
33
+ *
34
+ * Uses accessibilityHint to signal to the native capture engine
35
+ * that this view and its contents should be masked.
36
+ */
37
+ export declare const Mask: React.FC<MaskProps>;
38
+ export default Mask;
39
+ //# sourceMappingURL=Mask.d.ts.map
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Rejourney - Session Recording and Replay SDK for React Native
3
+ *
4
+ * Captures user interactions, gestures, and screen states for replay and analysis.
5
+ *
6
+ * Just call initRejourney() - everything else is automatic!
7
+ *
8
+ * Copyright (c) 2026 Rejourney
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * See LICENSE-APACHE for full terms.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { initRejourney } from 'rejourney';
17
+ *
18
+ * // Initialize the SDK with your public key - that's it!
19
+ * initRejourney('pk_live_xxxxxxxxxxxx');
20
+ *
21
+ * // Or with options:
22
+ * initRejourney('pk_live_xxxxxxxxxxxx', { debug: true });
23
+ * ```
24
+ */
25
+ import type { RejourneyConfig, RejourneyAPI } from './types';
26
+ /**
27
+ * Main Rejourney API (Internal)
28
+ */
29
+ declare const Rejourney: RejourneyAPI;
30
+ /**
31
+ * Initialize Rejourney SDK - STEP 1 of 3
32
+ *
33
+ * This sets up the SDK, handles attestation, and prepares for recording,
34
+ * but does NOT start recording automatically. Call startRejourney() after
35
+ * obtaining user consent to begin recording.
36
+ *
37
+ * @param publicRouteKey - Your public route key from the Rejourney dashboard
38
+ * @param options - Optional configuration options
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * import { initRejourney, startRejourney } from 'rejourney';
43
+ *
44
+ * // Step 1: Initialize SDK (safe to call on app start)
45
+ * initRejourney('pk_live_xxxxxxxxxxxx');
46
+ *
47
+ * // Step 2: After obtaining user consent
48
+ * startRejourney();
49
+ *
50
+ * // With options
51
+ * initRejourney('pk_live_xxxxxxxxxxxx', {
52
+ * debug: true,
53
+ * apiUrl: 'https://api.yourdomain.com',
54
+ * projectId: 'your-project-id',
55
+ * });
56
+ * ```
57
+ */
58
+ export declare function initRejourney(publicRouteKey: string, options?: Omit<RejourneyConfig, 'publicRouteKey'>): void;
59
+ /**
60
+ * Start recording - STEP 2 of 3 (call after user consent)
61
+ *
62
+ * Begins session recording. Call this after obtaining user consent for recording.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * import { initRejourney, startRejourney } from 'rejourney';
67
+ *
68
+ * initRejourney('pk_live_xxxxxxxxxxxx');
69
+ *
70
+ * // After user accepts consent dialog
71
+ * startRejourney();
72
+ * ```
73
+ */
74
+ export declare function startRejourney(): void;
75
+ /**
76
+ * Stop recording and cleanup all resources.
77
+ *
78
+ * Note: This is usually not needed as the SDK handles cleanup automatically.
79
+ * Only call this if you want to explicitly stop recording.
80
+ */
81
+ export declare function stopRejourney(): void;
82
+ export default Rejourney;
83
+ export * from './types';
84
+ export { trackTap, trackScroll, trackGesture, trackInput, trackScreen, captureError, getSessionMetrics, } from './sdk/autoTracking';
85
+ export { trackNavigationState, useNavigationTracking } from './sdk/autoTracking';
86
+ export { LogLevel } from './sdk/utils';
87
+ /**
88
+ * Configure SDK log verbosity.
89
+ *
90
+ * By default, the SDK logs minimally to avoid polluting your app's console:
91
+ * - Production/Release: SILENT (no logs at all)
92
+ * - Development/Debug: Only critical errors shown
93
+ *
94
+ * Essential lifecycle events (init success, session start/end) are automatically
95
+ * logged in debug builds only - you don't need to configure anything.
96
+ *
97
+ * Use this function only if you need to troubleshoot SDK behavior.
98
+ *
99
+ * @param level - Minimum log level to display
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * import { setLogLevel, LogLevel } from 'rejourney';
104
+ *
105
+ * // Enable verbose logging for SDK debugging (not recommended for regular use)
106
+ * setLogLevel(LogLevel.DEBUG);
107
+ *
108
+ * // Show warnings and errors (for troubleshooting)
109
+ * setLogLevel(LogLevel.WARNING);
110
+ *
111
+ * // Silence all logs (default behavior in production)
112
+ * setLogLevel(LogLevel.SILENT);
113
+ * ```
114
+ */
115
+ export declare function setLogLevel(level: number): void;
116
+ export { Mask } from './components/Mask';
117
+ //# sourceMappingURL=index.d.ts.map