@repliqo/sdk-react-native 0.1.0 → 0.1.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.
@@ -20,7 +20,7 @@ class AppAnalytics {
20
20
  this.appStateSubscription = null;
21
21
  this.config = (0, config_1.resolveConfig)(config);
22
22
  this.logger = new logger_1.Logger(this.config.debug);
23
- this.apiClient = new api_client_1.ApiClient(this.config.baseUrl, this.config.apiKey, this.logger);
23
+ this.apiClient = new api_client_1.ApiClient(config_1.REPLIQO_API_URL, this.config.apiKey, this.logger);
24
24
  this.eventQueue = new batch_queue_1.BatchQueue(this.config.batchSize, this.config.flushInterval, async (events) => {
25
25
  if (!this.sessionId) {
26
26
  this.logger.warn('Cannot flush events: no active session');
@@ -58,7 +58,7 @@ class AppAnalytics {
58
58
  }
59
59
  this.setupAppStateListener();
60
60
  this.logger.log('SDK initialized with config:', {
61
- baseUrl: this.config.baseUrl,
61
+ apiUrl: config_1.REPLIQO_API_URL,
62
62
  appId: this.config.appId,
63
63
  batchSize: this.config.batchSize,
64
64
  flushInterval: this.config.flushInterval,
@@ -1,4 +1,5 @@
1
1
  import { SDKConfig } from '../types/events';
2
- export declare const DEFAULT_CONFIG: Required<Omit<SDKConfig, 'apiKey' | 'appId' | 'baseUrl'>>;
2
+ export declare const REPLIQO_API_URL = "https://api-repliqo.odmservice.site";
3
+ export declare const DEFAULT_CONFIG: Required<Omit<SDKConfig, 'apiKey' | 'appId'>>;
3
4
  export type ResolvedConfig = SDKConfig & typeof DEFAULT_CONFIG;
4
5
  export declare function resolveConfig(config: SDKConfig): ResolvedConfig;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_CONFIG = void 0;
3
+ exports.DEFAULT_CONFIG = exports.REPLIQO_API_URL = void 0;
4
4
  exports.resolveConfig = resolveConfig;
5
+ exports.REPLIQO_API_URL = 'https://api-repliqo.odmservice.site';
5
6
  exports.DEFAULT_CONFIG = {
6
7
  batchSize: 20,
7
8
  flushInterval: 30000,
@@ -4,5 +4,21 @@ interface TouchTrackerProps {
4
4
  screenName?: string;
5
5
  enabled?: boolean;
6
6
  }
7
+ /**
8
+ * Transparent wrapper that captures touch coordinates for heatmaps
9
+ * WITHOUT interfering with the app's gesture/button handling.
10
+ *
11
+ * Uses `onTouchStart` (a passive event) instead of the Gesture
12
+ * Responder System (`onStartShouldSetResponderCapture`). This means:
13
+ * - Buttons, TouchableOpacity, Pressable all work normally
14
+ * - Navigation gestures (swipe back) are unaffected
15
+ * - ScrollViews scroll as expected
16
+ * - No responder conflicts with modals or bottom sheets
17
+ *
18
+ * Usage:
19
+ * <TouchTracker>
20
+ * <App />
21
+ * </TouchTracker>
22
+ */
7
23
  export declare const TouchTracker: React.FC<TouchTrackerProps>;
8
24
  export {};
@@ -7,11 +7,26 @@ exports.TouchTracker = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const react_native_1 = require("react-native");
9
9
  const client_1 = require("../core/client");
10
+ /**
11
+ * Transparent wrapper that captures touch coordinates for heatmaps
12
+ * WITHOUT interfering with the app's gesture/button handling.
13
+ *
14
+ * Uses `onTouchStart` (a passive event) instead of the Gesture
15
+ * Responder System (`onStartShouldSetResponderCapture`). This means:
16
+ * - Buttons, TouchableOpacity, Pressable all work normally
17
+ * - Navigation gestures (swipe back) are unaffected
18
+ * - ScrollViews scroll as expected
19
+ * - No responder conflicts with modals or bottom sheets
20
+ *
21
+ * Usage:
22
+ * <TouchTracker>
23
+ * <App />
24
+ * </TouchTracker>
25
+ */
10
26
  const TouchTracker = ({ children, screenName, enabled = true, }) => {
11
- const handleTouchCapture = react_1.default.useCallback((event) => {
12
- if (!enabled) {
13
- return false;
14
- }
27
+ const handleTouch = react_1.default.useCallback((event) => {
28
+ if (!enabled)
29
+ return;
15
30
  try {
16
31
  const analytics = client_1.AppAnalytics.getInstance();
17
32
  const { pageX, pageY } = event.nativeEvent;
@@ -20,10 +35,8 @@ const TouchTracker = ({ children, screenName, enabled = true, }) => {
20
35
  catch {
21
36
  // AppAnalytics not initialized, silently ignore
22
37
  }
23
- // Return false so touches pass through to children
24
- return false;
25
38
  }, [enabled, screenName]);
26
- return (<react_native_1.View style={{ flex: 1 }} onStartShouldSetResponderCapture={handleTouchCapture}>
39
+ return (<react_native_1.View style={{ flex: 1 }} onTouchStart={handleTouch} pointerEvents="box-none">
27
40
  {children}
28
41
  </react_native_1.View>);
29
42
  };
@@ -34,7 +34,6 @@ export interface DeviceInfo {
34
34
  export interface SDKConfig {
35
35
  apiKey: string;
36
36
  appId: string;
37
- baseUrl: string;
38
37
  batchSize?: number;
39
38
  flushInterval?: number;
40
39
  enableTouchTracking?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repliqo/sdk-react-native",
3
- "version": "0.1.0",
3
+ "version": "0.1.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",
@@ -7,7 +7,7 @@ import {
7
7
  } from '../types/events';
8
8
  import { SnapshotPayload } from '../types/snapshot';
9
9
  import { SnapshotCapture } from '../snapshot/capture';
10
- import { ResolvedConfig, resolveConfig } from './config';
10
+ import { ResolvedConfig, resolveConfig, REPLIQO_API_URL } from './config';
11
11
  import { Logger } from './logger';
12
12
  import { ApiClient } from '../transport/api.client';
13
13
  import { BatchQueue } from '../transport/batch-queue';
@@ -35,7 +35,7 @@ export class AppAnalytics {
35
35
  this.config = resolveConfig(config);
36
36
  this.logger = new Logger(this.config.debug);
37
37
  this.apiClient = new ApiClient(
38
- this.config.baseUrl,
38
+ REPLIQO_API_URL,
39
39
  this.config.apiKey,
40
40
  this.logger,
41
41
  );
@@ -104,7 +104,7 @@ export class AppAnalytics {
104
104
  this.setupAppStateListener();
105
105
 
106
106
  this.logger.log('SDK initialized with config:', {
107
- baseUrl: this.config.baseUrl,
107
+ apiUrl: REPLIQO_API_URL,
108
108
  appId: this.config.appId,
109
109
  batchSize: this.config.batchSize,
110
110
  flushInterval: this.config.flushInterval,
@@ -1,6 +1,8 @@
1
1
  import { SDKConfig } from '../types/events';
2
2
 
3
- export const DEFAULT_CONFIG: Required<Omit<SDKConfig, 'apiKey' | 'appId' | 'baseUrl'>> = {
3
+ export const REPLIQO_API_URL = 'https://api-repliqo.odmservice.site';
4
+
5
+ export const DEFAULT_CONFIG: Required<Omit<SDKConfig, 'apiKey' | 'appId'>> = {
4
6
  batchSize: 20,
5
7
  flushInterval: 30000,
6
8
  enableTouchTracking: true,
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View, GestureResponderEvent } from 'react-native';
2
+ import { View, type GestureResponderEvent } from 'react-native';
3
3
  import { AppAnalytics } from '../core/client';
4
4
 
5
5
  interface TouchTrackerProps {
@@ -8,16 +8,30 @@ interface TouchTrackerProps {
8
8
  enabled?: boolean;
9
9
  }
10
10
 
11
+ /**
12
+ * Transparent wrapper that captures touch coordinates for heatmaps
13
+ * WITHOUT interfering with the app's gesture/button handling.
14
+ *
15
+ * Uses `onTouchStart` (a passive event) instead of the Gesture
16
+ * Responder System (`onStartShouldSetResponderCapture`). This means:
17
+ * - Buttons, TouchableOpacity, Pressable all work normally
18
+ * - Navigation gestures (swipe back) are unaffected
19
+ * - ScrollViews scroll as expected
20
+ * - No responder conflicts with modals or bottom sheets
21
+ *
22
+ * Usage:
23
+ * <TouchTracker>
24
+ * <App />
25
+ * </TouchTracker>
26
+ */
11
27
  export const TouchTracker: React.FC<TouchTrackerProps> = ({
12
28
  children,
13
29
  screenName,
14
30
  enabled = true,
15
31
  }) => {
16
- const handleTouchCapture = React.useCallback(
17
- (event: GestureResponderEvent): boolean => {
18
- if (!enabled) {
19
- return false;
20
- }
32
+ const handleTouch = React.useCallback(
33
+ (event: GestureResponderEvent) => {
34
+ if (!enabled) return;
21
35
 
22
36
  try {
23
37
  const analytics = AppAnalytics.getInstance();
@@ -26,9 +40,6 @@ export const TouchTracker: React.FC<TouchTrackerProps> = ({
26
40
  } catch {
27
41
  // AppAnalytics not initialized, silently ignore
28
42
  }
29
-
30
- // Return false so touches pass through to children
31
- return false;
32
43
  },
33
44
  [enabled, screenName],
34
45
  );
@@ -36,7 +47,8 @@ export const TouchTracker: React.FC<TouchTrackerProps> = ({
36
47
  return (
37
48
  <View
38
49
  style={{ flex: 1 }}
39
- onStartShouldSetResponderCapture={handleTouchCapture}
50
+ onTouchStart={handleTouch}
51
+ pointerEvents="box-none"
40
52
  >
41
53
  {children}
42
54
  </View>
@@ -40,7 +40,6 @@ export interface DeviceInfo {
40
40
  export interface SDKConfig {
41
41
  apiKey: string;
42
42
  appId: string;
43
- baseUrl: string;
44
43
  batchSize?: number;
45
44
  flushInterval?: number;
46
45
  enableTouchTracking?: boolean;