@repliqo/sdk-react-native 0.3.0 → 0.3.2
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.
|
@@ -12,6 +12,7 @@ import com.facebook.react.bridge.Promise;
|
|
|
12
12
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
13
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
14
|
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
+
import com.facebook.react.bridge.WritableArray;
|
|
15
16
|
import com.facebook.react.bridge.WritableMap;
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -38,11 +38,11 @@ const react_1 = __importStar(require("react"));
|
|
|
38
38
|
const react_native_1 = require("react-native");
|
|
39
39
|
const client_1 = require("../core/client");
|
|
40
40
|
/** Minimum scroll delta (px) to trigger a new tile capture. */
|
|
41
|
-
const MIN_DELTA_PX =
|
|
41
|
+
const MIN_DELTA_PX = 20;
|
|
42
42
|
/** Debounce: wait this long after scroll stops before capturing. */
|
|
43
|
-
const DEBOUNCE_MS =
|
|
43
|
+
const DEBOUNCE_MS = 300;
|
|
44
44
|
/** Throttle: minimum time between tile captures. */
|
|
45
|
-
const THROTTLE_MS =
|
|
45
|
+
const THROTTLE_MS = 500;
|
|
46
46
|
/**
|
|
47
47
|
* Drop-in replacement for React Native's ScrollView that:
|
|
48
48
|
*
|
|
@@ -51,7 +51,7 @@ const THROTTLE_MS = 3000;
|
|
|
51
51
|
* screen building — the backend composites these into a
|
|
52
52
|
* full-content image over time from multiple user sessions
|
|
53
53
|
*/
|
|
54
|
-
exports.RepliqoScrollView = react_1.default.forwardRef(({ onScroll, onMomentumScrollEnd, onLayout, ...props }, ref) => {
|
|
54
|
+
exports.RepliqoScrollView = react_1.default.forwardRef(({ onScroll, onMomentumScrollEnd, onScrollEndDrag, onLayout, ...props }, ref) => {
|
|
55
55
|
const debounceTimer = (0, react_1.useRef)(null);
|
|
56
56
|
const lastCaptureTime = (0, react_1.useRef)(0);
|
|
57
57
|
const lastCaptureY = (0, react_1.useRef)(-999);
|
|
@@ -109,12 +109,17 @@ exports.RepliqoScrollView = react_1.default.forwardRef(({ onScroll, onMomentumSc
|
|
|
109
109
|
}
|
|
110
110
|
onScroll?.(event);
|
|
111
111
|
}, [onScroll]);
|
|
112
|
+
const handleScrollEndDrag = (0, react_1.useCallback)((event) => {
|
|
113
|
+
// User lifted finger — capture immediately
|
|
114
|
+
doCapture();
|
|
115
|
+
onScrollEndDrag?.(event);
|
|
116
|
+
}, [onScrollEndDrag]);
|
|
112
117
|
const handleMomentumEnd = (0, react_1.useCallback)((event) => {
|
|
113
118
|
if (debounceTimer.current) {
|
|
114
119
|
clearTimeout(debounceTimer.current);
|
|
115
120
|
debounceTimer.current = null;
|
|
116
121
|
}
|
|
117
|
-
|
|
122
|
+
doCapture();
|
|
118
123
|
onMomentumScrollEnd?.(event);
|
|
119
124
|
}, [onMomentumScrollEnd]);
|
|
120
125
|
const handleLayout = (0, react_1.useCallback)((event) => {
|
|
@@ -130,6 +135,6 @@ exports.RepliqoScrollView = react_1.default.forwardRef(({ onScroll, onMomentumSc
|
|
|
130
135
|
}
|
|
131
136
|
onLayout?.(event);
|
|
132
137
|
}, [onLayout]);
|
|
133
|
-
return (<react_native_1.ScrollView ref={ref} {...props} onScroll={handleScroll} onMomentumScrollEnd={handleMomentumEnd} onLayout={handleLayout} scrollEventThrottle={props.scrollEventThrottle ?? 16}/>);
|
|
138
|
+
return (<react_native_1.ScrollView ref={ref} {...props} onScroll={handleScroll} onScrollEndDrag={handleScrollEndDrag} onMomentumScrollEnd={handleMomentumEnd} onLayout={handleLayout} scrollEventThrottle={props.scrollEventThrottle ?? 16}/>);
|
|
134
139
|
});
|
|
135
140
|
exports.RepliqoScrollView.displayName = 'RepliqoScrollView';
|
package/dist/core/client.js
CHANGED
|
@@ -284,15 +284,8 @@ class AppAnalytics {
|
|
|
284
284
|
this.scrollOffsetY = 0;
|
|
285
285
|
this.errorTracker?.setCurrentScreen(screenName);
|
|
286
286
|
this.snapshotCapture?.setCurrentScreen(screenName);
|
|
287
|
-
//
|
|
288
|
-
//
|
|
289
|
-
if (this.config.enableHeatmapCapture) {
|
|
290
|
-
setTimeout(() => {
|
|
291
|
-
if (this.currentScreen !== screenName || !this.sessionId)
|
|
292
|
-
return;
|
|
293
|
-
this.autoScanScreen(screenName);
|
|
294
|
-
}, 1500); // Wait for screen to fully render
|
|
295
|
-
}
|
|
287
|
+
// Tile capture is handled by RepliqoScrollView (on scroll stops,
|
|
288
|
+
// finger lift, momentum end, and initial layout).
|
|
296
289
|
this.logger.log('Screen entered:', screenName);
|
|
297
290
|
}
|
|
298
291
|
onScreenExit(screenName) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@repliqo/sdk-react-native",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Session replay & analytics SDK for React Native. Captures screenshots (including modals/alerts), navigation, screen visits, and custom events.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
import { AppAnalytics } from '../core/client';
|
|
10
10
|
|
|
11
11
|
/** Minimum scroll delta (px) to trigger a new tile capture. */
|
|
12
|
-
const MIN_DELTA_PX =
|
|
12
|
+
const MIN_DELTA_PX = 20;
|
|
13
13
|
/** Debounce: wait this long after scroll stops before capturing. */
|
|
14
|
-
const DEBOUNCE_MS =
|
|
14
|
+
const DEBOUNCE_MS = 300;
|
|
15
15
|
/** Throttle: minimum time between tile captures. */
|
|
16
|
-
const THROTTLE_MS =
|
|
16
|
+
const THROTTLE_MS = 500;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Drop-in replacement for React Native's ScrollView that:
|
|
@@ -24,7 +24,7 @@ const THROTTLE_MS = 3000;
|
|
|
24
24
|
* full-content image over time from multiple user sessions
|
|
25
25
|
*/
|
|
26
26
|
export const RepliqoScrollView = React.forwardRef<ScrollView, ScrollViewProps>(
|
|
27
|
-
({ onScroll, onMomentumScrollEnd, onLayout, ...props }, ref) => {
|
|
27
|
+
({ onScroll, onMomentumScrollEnd, onScrollEndDrag, onLayout, ...props }, ref) => {
|
|
28
28
|
const debounceTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
29
29
|
const lastCaptureTime = useRef(0);
|
|
30
30
|
const lastCaptureY = useRef(-999);
|
|
@@ -99,13 +99,22 @@ export const RepliqoScrollView = React.forwardRef<ScrollView, ScrollViewProps>(
|
|
|
99
99
|
[onScroll],
|
|
100
100
|
);
|
|
101
101
|
|
|
102
|
+
const handleScrollEndDrag = useCallback(
|
|
103
|
+
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
104
|
+
// User lifted finger — capture immediately
|
|
105
|
+
doCapture();
|
|
106
|
+
onScrollEndDrag?.(event);
|
|
107
|
+
},
|
|
108
|
+
[onScrollEndDrag],
|
|
109
|
+
);
|
|
110
|
+
|
|
102
111
|
const handleMomentumEnd = useCallback(
|
|
103
112
|
(event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
104
113
|
if (debounceTimer.current) {
|
|
105
114
|
clearTimeout(debounceTimer.current);
|
|
106
115
|
debounceTimer.current = null;
|
|
107
116
|
}
|
|
108
|
-
|
|
117
|
+
doCapture();
|
|
109
118
|
onMomentumScrollEnd?.(event);
|
|
110
119
|
},
|
|
111
120
|
[onMomentumScrollEnd],
|
|
@@ -133,6 +142,7 @@ export const RepliqoScrollView = React.forwardRef<ScrollView, ScrollViewProps>(
|
|
|
133
142
|
ref={ref}
|
|
134
143
|
{...props}
|
|
135
144
|
onScroll={handleScroll}
|
|
145
|
+
onScrollEndDrag={handleScrollEndDrag}
|
|
136
146
|
onMomentumScrollEnd={handleMomentumEnd}
|
|
137
147
|
onLayout={handleLayout}
|
|
138
148
|
scrollEventThrottle={props.scrollEventThrottle ?? 16}
|
package/src/core/client.ts
CHANGED
|
@@ -416,14 +416,8 @@ export class AppAnalytics {
|
|
|
416
416
|
this.scrollOffsetY = 0;
|
|
417
417
|
this.errorTracker?.setCurrentScreen(screenName);
|
|
418
418
|
this.snapshotCapture?.setCurrentScreen(screenName);
|
|
419
|
-
//
|
|
420
|
-
//
|
|
421
|
-
if (this.config.enableHeatmapCapture) {
|
|
422
|
-
setTimeout(() => {
|
|
423
|
-
if (this.currentScreen !== screenName || !this.sessionId) return;
|
|
424
|
-
this.autoScanScreen(screenName);
|
|
425
|
-
}, 1500); // Wait for screen to fully render
|
|
426
|
-
}
|
|
419
|
+
// Tile capture is handled by RepliqoScrollView (on scroll stops,
|
|
420
|
+
// finger lift, momentum end, and initial layout).
|
|
427
421
|
|
|
428
422
|
this.logger.log('Screen entered:', screenName);
|
|
429
423
|
}
|