@rejourneyco/react-native 1.0.7
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/README.md +29 -0
- package/android/build.gradle.kts +135 -0
- package/android/consumer-rules.pro +10 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +860 -0
- package/android/src/main/java/com/rejourney/engine/DeviceRegistrar.kt +290 -0
- package/android/src/main/java/com/rejourney/engine/DiagnosticLog.kt +385 -0
- package/android/src/main/java/com/rejourney/engine/RejourneyImpl.kt +512 -0
- package/android/src/main/java/com/rejourney/platform/OEMDetector.kt +173 -0
- package/android/src/main/java/com/rejourney/platform/PerfTiming.kt +384 -0
- package/android/src/main/java/com/rejourney/platform/SessionLifecycleService.kt +160 -0
- package/android/src/main/java/com/rejourney/platform/Telemetry.kt +301 -0
- package/android/src/main/java/com/rejourney/platform/WindowUtils.kt +100 -0
- package/android/src/main/java/com/rejourney/recording/AnrSentinel.kt +129 -0
- package/android/src/main/java/com/rejourney/recording/EventBuffer.kt +330 -0
- package/android/src/main/java/com/rejourney/recording/InteractionRecorder.kt +519 -0
- package/android/src/main/java/com/rejourney/recording/ReplayOrchestrator.kt +740 -0
- package/android/src/main/java/com/rejourney/recording/SegmentDispatcher.kt +559 -0
- package/android/src/main/java/com/rejourney/recording/StabilityMonitor.kt +238 -0
- package/android/src/main/java/com/rejourney/recording/TelemetryPipeline.kt +633 -0
- package/android/src/main/java/com/rejourney/recording/ViewHierarchyScanner.kt +232 -0
- package/android/src/main/java/com/rejourney/recording/VisualCapture.kt +474 -0
- package/android/src/main/java/com/rejourney/utility/DataCompression.kt +63 -0
- package/android/src/main/java/com/rejourney/utility/ImageBlur.kt +412 -0
- package/android/src/main/java/com/rejourney/utility/ViewIdentifier.kt +169 -0
- package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +232 -0
- package/android/src/newarch/java/com/rejourney/RejourneyPackage.kt +40 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +268 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyPackage.kt +23 -0
- package/ios/Engine/DeviceRegistrar.swift +288 -0
- package/ios/Engine/DiagnosticLog.swift +387 -0
- package/ios/Engine/RejourneyImpl.swift +719 -0
- package/ios/Recording/AnrSentinel.swift +142 -0
- package/ios/Recording/EventBuffer.swift +326 -0
- package/ios/Recording/InteractionRecorder.swift +428 -0
- package/ios/Recording/ReplayOrchestrator.swift +624 -0
- package/ios/Recording/SegmentDispatcher.swift +492 -0
- package/ios/Recording/StabilityMonitor.swift +223 -0
- package/ios/Recording/TelemetryPipeline.swift +547 -0
- package/ios/Recording/ViewHierarchyScanner.swift +156 -0
- package/ios/Recording/VisualCapture.swift +675 -0
- package/ios/Rejourney.h +38 -0
- package/ios/Rejourney.mm +375 -0
- package/ios/Utility/DataCompression.swift +55 -0
- package/ios/Utility/ImageBlur.swift +89 -0
- package/ios/Utility/RuntimeMethodSwap.swift +41 -0
- package/ios/Utility/ViewIdentifier.swift +37 -0
- package/lib/commonjs/NativeRejourney.js +40 -0
- package/lib/commonjs/components/Mask.js +88 -0
- package/lib/commonjs/index.js +1443 -0
- package/lib/commonjs/sdk/autoTracking.js +1087 -0
- package/lib/commonjs/sdk/constants.js +166 -0
- package/lib/commonjs/sdk/errorTracking.js +187 -0
- package/lib/commonjs/sdk/index.js +50 -0
- package/lib/commonjs/sdk/metricsTracking.js +205 -0
- package/lib/commonjs/sdk/navigation.js +128 -0
- package/lib/commonjs/sdk/networkInterceptor.js +375 -0
- package/lib/commonjs/sdk/utils.js +433 -0
- package/lib/commonjs/sdk/version.js +13 -0
- package/lib/commonjs/types/expo-router.d.js +2 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/module/NativeRejourney.js +38 -0
- package/lib/module/components/Mask.js +83 -0
- package/lib/module/index.js +1341 -0
- package/lib/module/sdk/autoTracking.js +1059 -0
- package/lib/module/sdk/constants.js +154 -0
- package/lib/module/sdk/errorTracking.js +177 -0
- package/lib/module/sdk/index.js +26 -0
- package/lib/module/sdk/metricsTracking.js +187 -0
- package/lib/module/sdk/navigation.js +120 -0
- package/lib/module/sdk/networkInterceptor.js +364 -0
- package/lib/module/sdk/utils.js +412 -0
- package/lib/module/sdk/version.js +7 -0
- package/lib/module/types/expo-router.d.js +2 -0
- package/lib/module/types/index.js +2 -0
- package/lib/typescript/NativeRejourney.d.ts +160 -0
- package/lib/typescript/components/Mask.d.ts +54 -0
- package/lib/typescript/index.d.ts +117 -0
- package/lib/typescript/sdk/autoTracking.d.ts +226 -0
- package/lib/typescript/sdk/constants.d.ts +138 -0
- package/lib/typescript/sdk/errorTracking.d.ts +47 -0
- package/lib/typescript/sdk/index.d.ts +24 -0
- package/lib/typescript/sdk/metricsTracking.d.ts +75 -0
- package/lib/typescript/sdk/navigation.d.ts +48 -0
- package/lib/typescript/sdk/networkInterceptor.d.ts +62 -0
- package/lib/typescript/sdk/utils.d.ts +193 -0
- package/lib/typescript/sdk/version.d.ts +6 -0
- package/lib/typescript/types/index.d.ts +618 -0
- package/package.json +122 -0
- package/rejourney.podspec +23 -0
- package/src/NativeRejourney.ts +185 -0
- package/src/components/Mask.tsx +93 -0
- package/src/index.ts +1555 -0
- package/src/sdk/autoTracking.ts +1245 -0
- package/src/sdk/constants.ts +155 -0
- package/src/sdk/errorTracking.ts +231 -0
- package/src/sdk/index.ts +25 -0
- package/src/sdk/metricsTracking.ts +227 -0
- package/src/sdk/navigation.ts +152 -0
- package/src/sdk/networkInterceptor.ts +423 -0
- package/src/sdk/utils.ts +442 -0
- package/src/sdk/version.ts +6 -0
- package/src/types/expo-router.d.ts +7 -0
- package/src/types/index.ts +709 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Rejourney
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Rejourney Utility Functions
|
|
19
|
+
*
|
|
20
|
+
* IMPORTANT: This file uses lazy loading for react-native imports to avoid
|
|
21
|
+
* "PlatformConstants could not be found" errors on RN 0.81+.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Lazy-loaded Platform module
|
|
25
|
+
let _Platform = null;
|
|
26
|
+
function getPlatform() {
|
|
27
|
+
if (_Platform) return _Platform;
|
|
28
|
+
try {
|
|
29
|
+
const RN = require('react-native');
|
|
30
|
+
_Platform = RN.Platform;
|
|
31
|
+
return _Platform;
|
|
32
|
+
} catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generate a unique ID
|
|
39
|
+
*/
|
|
40
|
+
export function generateId() {
|
|
41
|
+
const timestamp = Date.now().toString(36);
|
|
42
|
+
const randomPart = Math.random().toString(36).substring(2, 9);
|
|
43
|
+
return `${timestamp}-${randomPart}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Generate a session ID
|
|
48
|
+
*/
|
|
49
|
+
export function generateSessionId() {
|
|
50
|
+
const date = new Date();
|
|
51
|
+
const dateStr = date.toISOString().split('T')[0]?.replace(/-/g, '') ?? '';
|
|
52
|
+
const timeStr = date.toTimeString().split(' ')[0]?.replace(/:/g, '') ?? '';
|
|
53
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
54
|
+
return `session_${dateStr}_${timeStr}_${random}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Get current timestamp in milliseconds
|
|
59
|
+
*/
|
|
60
|
+
export function now() {
|
|
61
|
+
return Date.now();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Check if running in development mode
|
|
66
|
+
*/
|
|
67
|
+
export function isDevelopment() {
|
|
68
|
+
return __DEV__;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Check platform
|
|
73
|
+
*/
|
|
74
|
+
export function isIOS() {
|
|
75
|
+
const platform = getPlatform();
|
|
76
|
+
return platform?.OS === 'ios';
|
|
77
|
+
}
|
|
78
|
+
export function isAndroid() {
|
|
79
|
+
const platform = getPlatform();
|
|
80
|
+
return platform?.OS === 'android';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Calculate distance between two points
|
|
85
|
+
*/
|
|
86
|
+
export function distance(p1, p2) {
|
|
87
|
+
const dx = p2.x - p1.x;
|
|
88
|
+
const dy = p2.y - p1.y;
|
|
89
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Calculate velocity between two points
|
|
94
|
+
*/
|
|
95
|
+
export function velocity(p1, p2) {
|
|
96
|
+
const dt = p2.timestamp - p1.timestamp;
|
|
97
|
+
if (dt === 0) return {
|
|
98
|
+
x: 0,
|
|
99
|
+
y: 0
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
x: (p2.x - p1.x) / dt,
|
|
103
|
+
y: (p2.y - p1.y) / dt
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Determine gesture type from touch points
|
|
109
|
+
*/
|
|
110
|
+
export function classifyGesture(touches, duration) {
|
|
111
|
+
if (touches.length < 2) {
|
|
112
|
+
if (duration > 500) return 'long_press';
|
|
113
|
+
return 'tap';
|
|
114
|
+
}
|
|
115
|
+
const first = touches[0];
|
|
116
|
+
const last = touches[touches.length - 1];
|
|
117
|
+
if (!first || !last) return 'tap';
|
|
118
|
+
const dx = last.x - first.x;
|
|
119
|
+
const dy = last.y - first.y;
|
|
120
|
+
const dist = distance(first, last);
|
|
121
|
+
|
|
122
|
+
// If very little movement, it's a tap
|
|
123
|
+
if (dist < 10) {
|
|
124
|
+
if (duration > 500) return 'long_press';
|
|
125
|
+
return 'tap';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Determine swipe direction
|
|
129
|
+
const absX = Math.abs(dx);
|
|
130
|
+
const absY = Math.abs(dy);
|
|
131
|
+
if (absX > absY) {
|
|
132
|
+
return dx > 0 ? 'swipe_right' : 'swipe_left';
|
|
133
|
+
} else {
|
|
134
|
+
return dy > 0 ? 'swipe_down' : 'swipe_up';
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Throttle function execution
|
|
140
|
+
*/
|
|
141
|
+
export function throttle(fn, delay) {
|
|
142
|
+
let lastCall = 0;
|
|
143
|
+
return (...args) => {
|
|
144
|
+
const currentTime = now();
|
|
145
|
+
if (currentTime - lastCall >= delay) {
|
|
146
|
+
lastCall = currentTime;
|
|
147
|
+
fn(...args);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Debounce function execution
|
|
154
|
+
*/
|
|
155
|
+
export function debounce(fn, delay) {
|
|
156
|
+
let timeoutId = null;
|
|
157
|
+
return (...args) => {
|
|
158
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
159
|
+
timeoutId = setTimeout(() => fn(...args), delay);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Format bytes to human readable string
|
|
165
|
+
*/
|
|
166
|
+
export function formatBytes(bytes) {
|
|
167
|
+
if (bytes === 0) return '0 Bytes';
|
|
168
|
+
const k = 1024;
|
|
169
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
170
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
171
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Format duration to human readable string
|
|
176
|
+
*/
|
|
177
|
+
export function formatDuration(ms) {
|
|
178
|
+
const seconds = Math.floor(ms / 1000);
|
|
179
|
+
const minutes = Math.floor(seconds / 60);
|
|
180
|
+
const hours = Math.floor(minutes / 60);
|
|
181
|
+
if (hours > 0) {
|
|
182
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
183
|
+
}
|
|
184
|
+
if (minutes > 0) {
|
|
185
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
186
|
+
}
|
|
187
|
+
return `${seconds}s`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Format timestamp to readable time
|
|
192
|
+
*/
|
|
193
|
+
export function formatTime(ms) {
|
|
194
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
195
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
196
|
+
const seconds = totalSeconds % 60;
|
|
197
|
+
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Create a simple hash of a string
|
|
202
|
+
*/
|
|
203
|
+
export function simpleHash(str) {
|
|
204
|
+
let hash = 0;
|
|
205
|
+
for (let i = 0; i < str.length; i++) {
|
|
206
|
+
const char = str.charCodeAt(i);
|
|
207
|
+
hash = (hash << 5) - hash + char;
|
|
208
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
209
|
+
}
|
|
210
|
+
return Math.abs(hash).toString(36);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Log levels for controlling verbosity.
|
|
215
|
+
*
|
|
216
|
+
* Default behavior minimizes log pollution for integrators:
|
|
217
|
+
* - Release/Production: SILENT (no logs)
|
|
218
|
+
* - Development: ERROR (only critical issues)
|
|
219
|
+
*/
|
|
220
|
+
export let LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
221
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
222
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
223
|
+
LogLevel[LogLevel["WARNING"] = 2] = "WARNING";
|
|
224
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
225
|
+
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
226
|
+
return LogLevel;
|
|
227
|
+
}({});
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Logger with production-aware log levels.
|
|
231
|
+
*
|
|
232
|
+
* Designed to minimize log pollution for integrators:
|
|
233
|
+
* - Production/Release: SILENT (completely silent, no logs)
|
|
234
|
+
* - Development/Debug: ERROR (only critical errors)
|
|
235
|
+
*
|
|
236
|
+
* Only essential lifecycle logs (init success, session start/end) bypass
|
|
237
|
+
* these levels via dedicated methods.
|
|
238
|
+
*/
|
|
239
|
+
class Logger {
|
|
240
|
+
prefix = '[Rejourney]';
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Minimum log level to display.
|
|
244
|
+
*
|
|
245
|
+
* Defaults to SILENT to avoid polluting integrator's console.
|
|
246
|
+
* SDK developers can adjust this for internal debugging.
|
|
247
|
+
*
|
|
248
|
+
* Note: In production builds, this should remain SILENT.
|
|
249
|
+
* The native layers handle build-type detection automatically.
|
|
250
|
+
*/
|
|
251
|
+
minimumLogLevel = typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Set the minimum log level. Logs below this level will be suppressed.
|
|
255
|
+
* SDK developers can use this for internal debugging.
|
|
256
|
+
*/
|
|
257
|
+
setLogLevel(level) {
|
|
258
|
+
this.minimumLogLevel = level;
|
|
259
|
+
}
|
|
260
|
+
setDebugMode(enabled) {
|
|
261
|
+
this.minimumLogLevel = enabled ? LogLevel.DEBUG : typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** Log a debug message - SDK internal use only */
|
|
265
|
+
debug(...args) {
|
|
266
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
267
|
+
console.log(this.prefix, ...args);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Log an info message - SDK internal use only */
|
|
272
|
+
info(...args) {
|
|
273
|
+
if (this.minimumLogLevel <= LogLevel.INFO) {
|
|
274
|
+
console.info(this.prefix, ...args);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Log a warning message */
|
|
279
|
+
warn(...args) {
|
|
280
|
+
if (this.minimumLogLevel <= LogLevel.WARNING) {
|
|
281
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
282
|
+
// Explicit Debug Mode: Show YellowBox
|
|
283
|
+
console.warn(this.prefix, ...args);
|
|
284
|
+
} else {
|
|
285
|
+
// Default Dev Mode: Log to console only, avoid YellowBox
|
|
286
|
+
console.log(this.prefix, '[WARN]', ...args);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Log an error message */
|
|
292
|
+
error(...args) {
|
|
293
|
+
if (this.minimumLogLevel <= LogLevel.ERROR) {
|
|
294
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
295
|
+
// Explicit Debug Mode: Show RedBox
|
|
296
|
+
console.error(this.prefix, ...args);
|
|
297
|
+
} else {
|
|
298
|
+
// Default Dev Mode: Log to console only, avoid RedBox
|
|
299
|
+
console.log(this.prefix, '[ERROR]', ...args);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
notice(...args) {
|
|
304
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
305
|
+
console.info(this.prefix, ...args);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Log SDK initialization success.
|
|
311
|
+
* Only shown in development builds - this is the minimal "SDK started" log.
|
|
312
|
+
*/
|
|
313
|
+
logInitSuccess(version) {
|
|
314
|
+
this.notice(`✓ SDK initialized (v${version})`);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Log SDK initialization failure.
|
|
319
|
+
* Always shown - this is a critical error.
|
|
320
|
+
*/
|
|
321
|
+
logInitFailure(reason) {
|
|
322
|
+
console.error(this.prefix, `✗ Initialization failed: ${reason}`);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Log session start.
|
|
327
|
+
* Only shown in development builds.
|
|
328
|
+
*/
|
|
329
|
+
logSessionStart(sessionId) {
|
|
330
|
+
this.notice(`Session started: ${sessionId}`);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Log session end.
|
|
335
|
+
* Only shown in development builds.
|
|
336
|
+
*/
|
|
337
|
+
logSessionEnd(sessionId) {
|
|
338
|
+
this.notice(`Session ended: ${sessionId}`);
|
|
339
|
+
}
|
|
340
|
+
logObservabilityStart() {
|
|
341
|
+
this.notice('💧 Starting Rejourney observability');
|
|
342
|
+
}
|
|
343
|
+
logRecordingStart() {
|
|
344
|
+
this.notice('Starting recording');
|
|
345
|
+
}
|
|
346
|
+
logRecordingRemoteDisabled() {
|
|
347
|
+
this.notice('Recording disabled by remote toggle');
|
|
348
|
+
}
|
|
349
|
+
logInvalidProjectKey() {
|
|
350
|
+
this.notice('Invalid project API key');
|
|
351
|
+
}
|
|
352
|
+
logPackageMismatch() {
|
|
353
|
+
this.notice('Bundle ID / package name mismatch');
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Log network request details
|
|
358
|
+
*/
|
|
359
|
+
logNetworkRequest(request) {
|
|
360
|
+
const statusIcon = request.error || request.statusCode && request.statusCode >= 400 ? '🔴' : '🟢';
|
|
361
|
+
const method = request.method || 'GET';
|
|
362
|
+
// Shorten URL to just path if possible
|
|
363
|
+
let url = request.url || '';
|
|
364
|
+
try {
|
|
365
|
+
if (url.startsWith('http')) {
|
|
366
|
+
const urlObj = new URL(url);
|
|
367
|
+
url = urlObj.pathname;
|
|
368
|
+
}
|
|
369
|
+
} catch {
|
|
370
|
+
// Keep full URL if parsing fails
|
|
371
|
+
}
|
|
372
|
+
const duration = request.duration ? `(${Math.round(request.duration)}ms)` : '';
|
|
373
|
+
const status = request.statusCode ? `${request.statusCode}` : 'ERR';
|
|
374
|
+
this.notice(`${statusIcon} [NET] ${status} ${method} ${url} ${duration} ${request.error ? `Error: ${request.error}` : ''}`);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Log frustration event (rage taps, etc)
|
|
379
|
+
*/
|
|
380
|
+
logFrustration(kind) {
|
|
381
|
+
this.notice(`🤬 Frustration detected: ${kind}`);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Log error captured by SDK
|
|
386
|
+
*/
|
|
387
|
+
logError(message) {
|
|
388
|
+
this.notice(`X Error captured: ${message}`);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Log lifecycle event (Background/Foreground)
|
|
393
|
+
* Visible in development builds.
|
|
394
|
+
*/
|
|
395
|
+
logLifecycleEvent(event) {
|
|
396
|
+
this.notice(`🔄 Lifecycle: ${event}`);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Log upload statistics
|
|
401
|
+
*/
|
|
402
|
+
logUploadStats(metrics) {
|
|
403
|
+
const success = metrics.uploadSuccessCount;
|
|
404
|
+
const failed = metrics.uploadFailureCount;
|
|
405
|
+
const bytes = formatBytes(metrics.totalBytesUploaded);
|
|
406
|
+
|
|
407
|
+
// Always show in dev mode for reassurance, even if 0
|
|
408
|
+
this.notice(`📡 Upload Stats: ${success} success, ${failed} failed (${bytes} uploaded)`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
export const logger = new Logger();
|
|
412
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,160 @@
|
|
|
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
|
+
getUserIdentity(): Promise<string | null>;
|
|
133
|
+
setDebugMode(enabled: boolean): Promise<{
|
|
134
|
+
success: boolean;
|
|
135
|
+
}>;
|
|
136
|
+
/**
|
|
137
|
+
* Set SDK version from JS (called during init with version from package.json)
|
|
138
|
+
*/
|
|
139
|
+
setSDKVersion(version: string): void;
|
|
140
|
+
/**
|
|
141
|
+
* Set remote configuration from backend
|
|
142
|
+
* Called before startSession to apply server-side settings
|
|
143
|
+
*/
|
|
144
|
+
setRemoteConfig(rejourneyEnabled: boolean, recordingEnabled: boolean, sampleRate: number, maxRecordingMinutes: number): Promise<{
|
|
145
|
+
success: boolean;
|
|
146
|
+
}>;
|
|
147
|
+
getDeviceInfo(): Promise<Object>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Default export for Codegen.
|
|
151
|
+
*
|
|
152
|
+
* CRITICAL: This MUST be a direct TurboModuleRegistry.get() call.
|
|
153
|
+
* Codegen parses this file statically and requires this exact pattern.
|
|
154
|
+
*
|
|
155
|
+
* Using getEnforcing() would throw if module not found.
|
|
156
|
+
* Using get() returns null, which is safer during development/testing.
|
|
157
|
+
*/
|
|
158
|
+
declare const _default: Spec | null;
|
|
159
|
+
export default _default;
|
|
160
|
+
//# sourceMappingURL=NativeRejourney.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Rejourney
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Mask Component
|
|
18
|
+
*
|
|
19
|
+
* Wrapper component to mask sensitive content in session replays.
|
|
20
|
+
* All children wrapped in this component will be obscured in recordings.
|
|
21
|
+
*
|
|
22
|
+
* IMPORTANT: This file uses lazy loading to avoid "PlatformConstants could not be found"
|
|
23
|
+
* errors on React Native 0.81+ with New Architecture (Bridgeless).
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { Mask } from 'rejourney';
|
|
28
|
+
*
|
|
29
|
+
* // Mask sensitive user ID
|
|
30
|
+
* <Mask>
|
|
31
|
+
* <Text>User ID: {user.id}</Text>
|
|
32
|
+
* </Mask>
|
|
33
|
+
*
|
|
34
|
+
* // Mask credit card info
|
|
35
|
+
* <Mask>
|
|
36
|
+
* <CreditCardDisplay card={card} />
|
|
37
|
+
* </Mask>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import type { ViewProps } from 'react-native';
|
|
42
|
+
export interface MaskProps extends ViewProps {
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Wrapper component to mask sensitive content in session replays.
|
|
47
|
+
* All children will be obscured in recordings.
|
|
48
|
+
*
|
|
49
|
+
* Uses accessibilityHint to signal to the native capture engine
|
|
50
|
+
* that this view and its contents should be masked.
|
|
51
|
+
*/
|
|
52
|
+
export declare const Mask: React.FC<MaskProps>;
|
|
53
|
+
export default Mask;
|
|
54
|
+
//# sourceMappingURL=Mask.d.ts.map
|