@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.
- 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 +2981 -0
- package/android/src/main/java/com/rejourney/capture/ANRHandler.kt +206 -0
- package/android/src/main/java/com/rejourney/capture/ActivityTracker.kt +98 -0
- package/android/src/main/java/com/rejourney/capture/CaptureEngine.kt +1553 -0
- package/android/src/main/java/com/rejourney/capture/CaptureHeuristics.kt +375 -0
- package/android/src/main/java/com/rejourney/capture/CrashHandler.kt +153 -0
- package/android/src/main/java/com/rejourney/capture/MotionEvent.kt +215 -0
- package/android/src/main/java/com/rejourney/capture/SegmentUploader.kt +512 -0
- package/android/src/main/java/com/rejourney/capture/VideoEncoder.kt +773 -0
- package/android/src/main/java/com/rejourney/capture/ViewHierarchyScanner.kt +633 -0
- package/android/src/main/java/com/rejourney/capture/ViewSerializer.kt +286 -0
- package/android/src/main/java/com/rejourney/core/Constants.kt +117 -0
- package/android/src/main/java/com/rejourney/core/Logger.kt +93 -0
- package/android/src/main/java/com/rejourney/core/Types.kt +124 -0
- package/android/src/main/java/com/rejourney/lifecycle/SessionLifecycleService.kt +162 -0
- package/android/src/main/java/com/rejourney/network/DeviceAuthManager.kt +747 -0
- package/android/src/main/java/com/rejourney/network/HttpClientProvider.kt +16 -0
- package/android/src/main/java/com/rejourney/network/NetworkMonitor.kt +272 -0
- package/android/src/main/java/com/rejourney/network/UploadManager.kt +1363 -0
- package/android/src/main/java/com/rejourney/network/UploadWorker.kt +492 -0
- package/android/src/main/java/com/rejourney/privacy/PrivacyMask.kt +645 -0
- package/android/src/main/java/com/rejourney/touch/GestureClassifier.kt +233 -0
- package/android/src/main/java/com/rejourney/touch/KeyboardTracker.kt +158 -0
- package/android/src/main/java/com/rejourney/touch/TextInputTracker.kt +181 -0
- package/android/src/main/java/com/rejourney/touch/TouchInterceptor.kt +591 -0
- package/android/src/main/java/com/rejourney/utils/EventBuffer.kt +284 -0
- package/android/src/main/java/com/rejourney/utils/OEMDetector.kt +154 -0
- package/android/src/main/java/com/rejourney/utils/PerfTiming.kt +235 -0
- package/android/src/main/java/com/rejourney/utils/Telemetry.kt +297 -0
- package/android/src/main/java/com/rejourney/utils/WindowUtils.kt +84 -0
- package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +187 -0
- package/android/src/newarch/java/com/rejourney/RejourneyPackage.kt +40 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +218 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyPackage.kt +23 -0
- package/ios/Capture/RJANRHandler.h +42 -0
- package/ios/Capture/RJANRHandler.m +328 -0
- package/ios/Capture/RJCaptureEngine.h +275 -0
- package/ios/Capture/RJCaptureEngine.m +2062 -0
- package/ios/Capture/RJCaptureHeuristics.h +80 -0
- package/ios/Capture/RJCaptureHeuristics.m +903 -0
- package/ios/Capture/RJCrashHandler.h +46 -0
- package/ios/Capture/RJCrashHandler.m +313 -0
- package/ios/Capture/RJMotionEvent.h +183 -0
- package/ios/Capture/RJMotionEvent.m +183 -0
- package/ios/Capture/RJPerformanceManager.h +100 -0
- package/ios/Capture/RJPerformanceManager.m +373 -0
- package/ios/Capture/RJPixelBufferDownscaler.h +42 -0
- package/ios/Capture/RJPixelBufferDownscaler.m +85 -0
- package/ios/Capture/RJSegmentUploader.h +146 -0
- package/ios/Capture/RJSegmentUploader.m +778 -0
- package/ios/Capture/RJVideoEncoder.h +247 -0
- package/ios/Capture/RJVideoEncoder.m +1036 -0
- package/ios/Capture/RJViewControllerTracker.h +73 -0
- package/ios/Capture/RJViewControllerTracker.m +508 -0
- package/ios/Capture/RJViewHierarchyScanner.h +215 -0
- package/ios/Capture/RJViewHierarchyScanner.m +1464 -0
- package/ios/Capture/RJViewSerializer.h +119 -0
- package/ios/Capture/RJViewSerializer.m +498 -0
- package/ios/Core/RJConstants.h +124 -0
- package/ios/Core/RJConstants.m +88 -0
- package/ios/Core/RJLifecycleManager.h +85 -0
- package/ios/Core/RJLifecycleManager.m +308 -0
- package/ios/Core/RJLogger.h +61 -0
- package/ios/Core/RJLogger.m +211 -0
- package/ios/Core/RJTypes.h +176 -0
- package/ios/Core/RJTypes.m +66 -0
- package/ios/Core/Rejourney.h +64 -0
- package/ios/Core/Rejourney.mm +2495 -0
- package/ios/Network/RJDeviceAuthManager.h +94 -0
- package/ios/Network/RJDeviceAuthManager.m +967 -0
- package/ios/Network/RJNetworkMonitor.h +68 -0
- package/ios/Network/RJNetworkMonitor.m +267 -0
- package/ios/Network/RJRetryManager.h +73 -0
- package/ios/Network/RJRetryManager.m +325 -0
- package/ios/Network/RJUploadManager.h +267 -0
- package/ios/Network/RJUploadManager.m +2296 -0
- package/ios/Privacy/RJPrivacyMask.h +163 -0
- package/ios/Privacy/RJPrivacyMask.m +922 -0
- package/ios/Rejourney.h +63 -0
- package/ios/Touch/RJGestureClassifier.h +130 -0
- package/ios/Touch/RJGestureClassifier.m +333 -0
- package/ios/Touch/RJTouchInterceptor.h +169 -0
- package/ios/Touch/RJTouchInterceptor.m +772 -0
- package/ios/Utils/RJEventBuffer.h +112 -0
- package/ios/Utils/RJEventBuffer.m +358 -0
- package/ios/Utils/RJGzipUtils.h +33 -0
- package/ios/Utils/RJGzipUtils.m +89 -0
- package/ios/Utils/RJKeychainManager.h +48 -0
- package/ios/Utils/RJKeychainManager.m +111 -0
- package/ios/Utils/RJPerfTiming.h +209 -0
- package/ios/Utils/RJPerfTiming.m +264 -0
- package/ios/Utils/RJTelemetry.h +92 -0
- package/ios/Utils/RJTelemetry.m +320 -0
- package/ios/Utils/RJWindowUtils.h +66 -0
- package/ios/Utils/RJWindowUtils.m +133 -0
- package/lib/commonjs/NativeRejourney.js +40 -0
- package/lib/commonjs/components/Mask.js +79 -0
- package/lib/commonjs/index.js +1381 -0
- package/lib/commonjs/sdk/autoTracking.js +1259 -0
- package/lib/commonjs/sdk/constants.js +151 -0
- package/lib/commonjs/sdk/errorTracking.js +199 -0
- package/lib/commonjs/sdk/index.js +50 -0
- package/lib/commonjs/sdk/metricsTracking.js +204 -0
- package/lib/commonjs/sdk/navigation.js +151 -0
- package/lib/commonjs/sdk/networkInterceptor.js +412 -0
- package/lib/commonjs/sdk/utils.js +363 -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 +72 -0
- package/lib/module/index.js +1284 -0
- package/lib/module/sdk/autoTracking.js +1233 -0
- package/lib/module/sdk/constants.js +145 -0
- package/lib/module/sdk/errorTracking.js +189 -0
- package/lib/module/sdk/index.js +12 -0
- package/lib/module/sdk/metricsTracking.js +187 -0
- package/lib/module/sdk/navigation.js +143 -0
- package/lib/module/sdk/networkInterceptor.js +401 -0
- package/lib/module/sdk/utils.js +342 -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 +147 -0
- package/lib/typescript/components/Mask.d.ts +39 -0
- package/lib/typescript/index.d.ts +117 -0
- package/lib/typescript/sdk/autoTracking.d.ts +204 -0
- package/lib/typescript/sdk/constants.d.ts +120 -0
- package/lib/typescript/sdk/errorTracking.d.ts +32 -0
- package/lib/typescript/sdk/index.d.ts +9 -0
- package/lib/typescript/sdk/metricsTracking.d.ts +58 -0
- package/lib/typescript/sdk/navigation.d.ts +33 -0
- package/lib/typescript/sdk/networkInterceptor.d.ts +47 -0
- package/lib/typescript/sdk/utils.d.ts +148 -0
- package/lib/typescript/types/index.d.ts +624 -0
- package/package.json +102 -0
- package/rejourney.podspec +21 -0
- package/src/NativeRejourney.ts +165 -0
- package/src/components/Mask.tsx +80 -0
- package/src/index.ts +1459 -0
- package/src/sdk/autoTracking.ts +1373 -0
- package/src/sdk/constants.ts +134 -0
- package/src/sdk/errorTracking.ts +231 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/metricsTracking.ts +232 -0
- package/src/sdk/navigation.ts +157 -0
- package/src/sdk/networkInterceptor.ts +440 -0
- package/src/sdk/utils.ts +369 -0
- package/src/types/expo-router.d.ts +7 -0
- package/src/types/index.ts +739 -0
|
@@ -0,0 +1,363 @@
|
|
|
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
|
+
* Rejourney Utility Functions
|
|
25
|
+
*
|
|
26
|
+
* IMPORTANT: This file uses lazy loading for react-native imports to avoid
|
|
27
|
+
* "PlatformConstants could not be found" errors on RN 0.81+.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
// Lazy-loaded Platform module
|
|
31
|
+
let _Platform = null;
|
|
32
|
+
function getPlatform() {
|
|
33
|
+
if (_Platform) return _Platform;
|
|
34
|
+
try {
|
|
35
|
+
const RN = require('react-native');
|
|
36
|
+
_Platform = RN.Platform;
|
|
37
|
+
return _Platform;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Generate a unique ID
|
|
45
|
+
*/
|
|
46
|
+
function generateId() {
|
|
47
|
+
const timestamp = Date.now().toString(36);
|
|
48
|
+
const randomPart = Math.random().toString(36).substring(2, 9);
|
|
49
|
+
return `${timestamp}-${randomPart}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Generate a session ID
|
|
54
|
+
*/
|
|
55
|
+
function generateSessionId() {
|
|
56
|
+
const date = new Date();
|
|
57
|
+
const dateStr = date.toISOString().split('T')[0]?.replace(/-/g, '') ?? '';
|
|
58
|
+
const timeStr = date.toTimeString().split(' ')[0]?.replace(/:/g, '') ?? '';
|
|
59
|
+
const random = Math.random().toString(36).substring(2, 6);
|
|
60
|
+
return `session_${dateStr}_${timeStr}_${random}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get current timestamp in milliseconds
|
|
65
|
+
*/
|
|
66
|
+
function now() {
|
|
67
|
+
return Date.now();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Check if running in development mode
|
|
72
|
+
*/
|
|
73
|
+
function isDevelopment() {
|
|
74
|
+
return __DEV__;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Check platform
|
|
79
|
+
*/
|
|
80
|
+
function isIOS() {
|
|
81
|
+
const platform = getPlatform();
|
|
82
|
+
return platform?.OS === 'ios';
|
|
83
|
+
}
|
|
84
|
+
function isAndroid() {
|
|
85
|
+
const platform = getPlatform();
|
|
86
|
+
return platform?.OS === 'android';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Calculate distance between two points
|
|
91
|
+
*/
|
|
92
|
+
function distance(p1, p2) {
|
|
93
|
+
const dx = p2.x - p1.x;
|
|
94
|
+
const dy = p2.y - p1.y;
|
|
95
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Calculate velocity between two points
|
|
100
|
+
*/
|
|
101
|
+
function velocity(p1, p2) {
|
|
102
|
+
const dt = p2.timestamp - p1.timestamp;
|
|
103
|
+
if (dt === 0) return {
|
|
104
|
+
x: 0,
|
|
105
|
+
y: 0
|
|
106
|
+
};
|
|
107
|
+
return {
|
|
108
|
+
x: (p2.x - p1.x) / dt,
|
|
109
|
+
y: (p2.y - p1.y) / dt
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Determine gesture type from touch points
|
|
115
|
+
*/
|
|
116
|
+
function classifyGesture(touches, duration) {
|
|
117
|
+
if (touches.length < 2) {
|
|
118
|
+
if (duration > 500) return 'long_press';
|
|
119
|
+
return 'tap';
|
|
120
|
+
}
|
|
121
|
+
const first = touches[0];
|
|
122
|
+
const last = touches[touches.length - 1];
|
|
123
|
+
if (!first || !last) return 'tap';
|
|
124
|
+
const dx = last.x - first.x;
|
|
125
|
+
const dy = last.y - first.y;
|
|
126
|
+
const dist = distance(first, last);
|
|
127
|
+
|
|
128
|
+
// If very little movement, it's a tap
|
|
129
|
+
if (dist < 10) {
|
|
130
|
+
if (duration > 500) return 'long_press';
|
|
131
|
+
return 'tap';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Determine swipe direction
|
|
135
|
+
const absX = Math.abs(dx);
|
|
136
|
+
const absY = Math.abs(dy);
|
|
137
|
+
if (absX > absY) {
|
|
138
|
+
return dx > 0 ? 'swipe_right' : 'swipe_left';
|
|
139
|
+
} else {
|
|
140
|
+
return dy > 0 ? 'swipe_down' : 'swipe_up';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Throttle function execution
|
|
146
|
+
*/
|
|
147
|
+
function throttle(fn, delay) {
|
|
148
|
+
let lastCall = 0;
|
|
149
|
+
return (...args) => {
|
|
150
|
+
const currentTime = now();
|
|
151
|
+
if (currentTime - lastCall >= delay) {
|
|
152
|
+
lastCall = currentTime;
|
|
153
|
+
fn(...args);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Debounce function execution
|
|
160
|
+
*/
|
|
161
|
+
function debounce(fn, delay) {
|
|
162
|
+
let timeoutId = null;
|
|
163
|
+
return (...args) => {
|
|
164
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
165
|
+
timeoutId = setTimeout(() => fn(...args), delay);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Format bytes to human readable string
|
|
171
|
+
*/
|
|
172
|
+
function formatBytes(bytes) {
|
|
173
|
+
if (bytes === 0) return '0 Bytes';
|
|
174
|
+
const k = 1024;
|
|
175
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
176
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
177
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Format duration to human readable string
|
|
182
|
+
*/
|
|
183
|
+
function formatDuration(ms) {
|
|
184
|
+
const seconds = Math.floor(ms / 1000);
|
|
185
|
+
const minutes = Math.floor(seconds / 60);
|
|
186
|
+
const hours = Math.floor(minutes / 60);
|
|
187
|
+
if (hours > 0) {
|
|
188
|
+
return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
|
|
189
|
+
}
|
|
190
|
+
if (minutes > 0) {
|
|
191
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
192
|
+
}
|
|
193
|
+
return `${seconds}s`;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Format timestamp to readable time
|
|
198
|
+
*/
|
|
199
|
+
function formatTime(ms) {
|
|
200
|
+
const totalSeconds = Math.floor(ms / 1000);
|
|
201
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
202
|
+
const seconds = totalSeconds % 60;
|
|
203
|
+
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create a simple hash of a string
|
|
208
|
+
*/
|
|
209
|
+
function simpleHash(str) {
|
|
210
|
+
let hash = 0;
|
|
211
|
+
for (let i = 0; i < str.length; i++) {
|
|
212
|
+
const char = str.charCodeAt(i);
|
|
213
|
+
hash = (hash << 5) - hash + char;
|
|
214
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
215
|
+
}
|
|
216
|
+
return Math.abs(hash).toString(36);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Log levels for controlling verbosity.
|
|
221
|
+
*
|
|
222
|
+
* Default behavior minimizes log pollution for integrators:
|
|
223
|
+
* - Release/Production: SILENT (no logs)
|
|
224
|
+
* - Development: ERROR (only critical issues)
|
|
225
|
+
*/
|
|
226
|
+
let LogLevel = exports.LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
227
|
+
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
228
|
+
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
229
|
+
LogLevel[LogLevel["WARNING"] = 2] = "WARNING";
|
|
230
|
+
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
231
|
+
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
232
|
+
return LogLevel;
|
|
233
|
+
}({});
|
|
234
|
+
/**
|
|
235
|
+
* Logger with production-aware log levels.
|
|
236
|
+
*
|
|
237
|
+
* Designed to minimize log pollution for integrators:
|
|
238
|
+
* - Production/Release: SILENT (completely silent, no logs)
|
|
239
|
+
* - Development/Debug: ERROR (only critical errors)
|
|
240
|
+
*
|
|
241
|
+
* Only essential lifecycle logs (init success, session start/end) bypass
|
|
242
|
+
* these levels via dedicated methods.
|
|
243
|
+
*/
|
|
244
|
+
class Logger {
|
|
245
|
+
prefix = '[Rejourney]';
|
|
246
|
+
debugMode = false;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Minimum log level to display.
|
|
250
|
+
*
|
|
251
|
+
* Defaults to SILENT to avoid polluting integrator's console.
|
|
252
|
+
* SDK developers can adjust this for internal debugging.
|
|
253
|
+
*
|
|
254
|
+
* Note: In production builds, this should remain SILENT.
|
|
255
|
+
* The native layers handle build-type detection automatically.
|
|
256
|
+
*/
|
|
257
|
+
minimumLogLevel = typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Set the minimum log level. Logs below this level will be suppressed.
|
|
261
|
+
* SDK developers can use this for internal debugging.
|
|
262
|
+
*/
|
|
263
|
+
setLogLevel(level) {
|
|
264
|
+
this.minimumLogLevel = level;
|
|
265
|
+
}
|
|
266
|
+
setDebugMode(enabled) {
|
|
267
|
+
this.debugMode = enabled;
|
|
268
|
+
this.minimumLogLevel = enabled ? LogLevel.DEBUG : typeof __DEV__ !== 'undefined' && __DEV__ ? LogLevel.ERROR : LogLevel.SILENT;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Log a debug message - SDK internal use only */
|
|
272
|
+
debug(...args) {
|
|
273
|
+
if (this.minimumLogLevel <= LogLevel.DEBUG) {
|
|
274
|
+
console.log(this.prefix, ...args);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Log an info message - SDK internal use only */
|
|
279
|
+
info(...args) {
|
|
280
|
+
if (this.minimumLogLevel <= LogLevel.INFO) {
|
|
281
|
+
console.info(this.prefix, ...args);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Log a warning message */
|
|
286
|
+
warn(...args) {
|
|
287
|
+
if (this.minimumLogLevel <= LogLevel.WARNING) {
|
|
288
|
+
console.warn(this.prefix, ...args);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** Log an error message */
|
|
293
|
+
error(...args) {
|
|
294
|
+
if (this.minimumLogLevel <= LogLevel.ERROR) {
|
|
295
|
+
console.error(this.prefix, ...args);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
notice(...args) {
|
|
299
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
300
|
+
console.info(this.prefix, ...args);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
305
|
+
// Lifecycle Logs - Industry standard minimal logging
|
|
306
|
+
// These are the only logs integrators will see in debug builds
|
|
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
|
+
if (this.debugMode) {
|
|
315
|
+
this.info(`✓ SDK initialized (v${version})`);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Log SDK initialization failure.
|
|
321
|
+
* Always shown - this is a critical error.
|
|
322
|
+
*/
|
|
323
|
+
logInitFailure(reason) {
|
|
324
|
+
console.error(this.prefix, `✗ Initialization failed: ${reason}`);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Log session start.
|
|
329
|
+
* Only shown in development builds.
|
|
330
|
+
*/
|
|
331
|
+
logSessionStart(sessionId) {
|
|
332
|
+
if (this.debugMode) {
|
|
333
|
+
this.info(`Session started: ${sessionId}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Log session end.
|
|
339
|
+
* Only shown in development builds.
|
|
340
|
+
*/
|
|
341
|
+
logSessionEnd(sessionId) {
|
|
342
|
+
if (this.debugMode) {
|
|
343
|
+
this.info(`Session ended: ${sessionId}`);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
logObservabilityStart() {
|
|
347
|
+
this.notice('Starting Rejourney observability');
|
|
348
|
+
}
|
|
349
|
+
logRecordingStart() {
|
|
350
|
+
this.notice('Starting recording');
|
|
351
|
+
}
|
|
352
|
+
logRecordingRemoteDisabled() {
|
|
353
|
+
this.notice('Recording disabled by remote toggle');
|
|
354
|
+
}
|
|
355
|
+
logInvalidProjectKey() {
|
|
356
|
+
this.notice('Invalid project API key');
|
|
357
|
+
}
|
|
358
|
+
logPackageMismatch() {
|
|
359
|
+
this.notice('Bundle ID / package name mismatch');
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const logger = exports.logger = new Logger();
|
|
363
|
+
//# sourceMappingURL=utils.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,72 @@
|
|
|
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
|
+
* Mask Component
|
|
4
|
+
*
|
|
5
|
+
* Wrapper component to mask sensitive content in session replays.
|
|
6
|
+
* All children wrapped in this component will be obscured in recordings.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: This file uses lazy loading to avoid "PlatformConstants could not be found"
|
|
9
|
+
* errors on React Native 0.81+ with New Architecture (Bridgeless).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { Mask } from 'rejourney';
|
|
14
|
+
*
|
|
15
|
+
* // Mask sensitive user ID
|
|
16
|
+
* <Mask>
|
|
17
|
+
* <Text>User ID: {user.id}</Text>
|
|
18
|
+
* </Mask>
|
|
19
|
+
*
|
|
20
|
+
* // Mask credit card info
|
|
21
|
+
* <Mask>
|
|
22
|
+
* <CreditCardDisplay card={card} />
|
|
23
|
+
* </Mask>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
import React from 'react';
|
|
27
|
+
// Lazy-loaded React Native modules
|
|
28
|
+
let _RN = null;
|
|
29
|
+
function getRN() {
|
|
30
|
+
if (_RN) return _RN;
|
|
31
|
+
try {
|
|
32
|
+
_RN = require('react-native');
|
|
33
|
+
return _RN;
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Wrapper component to mask sensitive content in session replays.
|
|
40
|
+
* All children will be obscured in recordings.
|
|
41
|
+
*
|
|
42
|
+
* Uses accessibilityHint to signal to the native capture engine
|
|
43
|
+
* that this view and its contents should be masked.
|
|
44
|
+
*/
|
|
45
|
+
export const Mask = ({
|
|
46
|
+
children,
|
|
47
|
+
style,
|
|
48
|
+
...props
|
|
49
|
+
}) => {
|
|
50
|
+
const RN = getRN();
|
|
51
|
+
|
|
52
|
+
// If RN isn't loaded yet (shouldn't happen in practice), render children directly
|
|
53
|
+
if (!RN) {
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
55
|
+
}
|
|
56
|
+
const {
|
|
57
|
+
View,
|
|
58
|
+
StyleSheet
|
|
59
|
+
} = RN;
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
container: {
|
|
62
|
+
// Minimal container style - doesn't affect layout
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return /*#__PURE__*/React.createElement(View, _extends({}, props, {
|
|
66
|
+
style: [styles.container, style],
|
|
67
|
+
accessibilityHint: "rejourney_occlude",
|
|
68
|
+
collapsable: false
|
|
69
|
+
}), children);
|
|
70
|
+
};
|
|
71
|
+
export default Mask;
|
|
72
|
+
//# sourceMappingURL=Mask.js.map
|