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