react-native-inapp-inspector 1.0.14 → 1.0.16

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.
@@ -1,18 +1,69 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
39
+ const react_1 = __importStar(require("react"));
7
40
  const react_native_1 = require("react-native");
8
41
  // Components
9
42
  const TouchableScale_1 = __importDefault(require("./TouchableScale"));
43
+ const AnimatedEntrance_1 = __importDefault(require("./AnimatedEntrance"));
10
44
  // Assets
11
45
  const NetworkIcons_1 = require("./NetworkIcons");
12
46
  // Stylesheet
13
47
  const AppColors_1 = require("../styles/AppColors");
14
48
  const styles_1 = __importDefault(require("../styles"));
15
49
  const EmptyState = ({ isSearch }) => {
50
+ const iconPulse = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
51
+ (0, react_1.useEffect)(() => {
52
+ const loop = react_native_1.Animated.loop(react_native_1.Animated.sequence([
53
+ react_native_1.Animated.timing(iconPulse, {
54
+ toValue: 1.06,
55
+ duration: 900,
56
+ useNativeDriver: true,
57
+ }),
58
+ react_native_1.Animated.timing(iconPulse, {
59
+ toValue: 1,
60
+ duration: 900,
61
+ useNativeDriver: true,
62
+ }),
63
+ ]));
64
+ loop.start();
65
+ return () => loop.stop();
66
+ }, [iconPulse]);
16
67
  const handleReload = () => {
17
68
  if (__DEV__ && react_native_1.DevSettings && react_native_1.DevSettings.reload) {
18
69
  react_native_1.DevSettings.reload();
@@ -20,10 +71,10 @@ const EmptyState = ({ isSearch }) => {
20
71
  }
21
72
  react_native_1.Alert.alert('Reload', 'App reload is typically only available in development mode.');
22
73
  };
23
- return (<react_native_1.View style={styles_1.default.emptyContainer}>
24
- <react_native_1.View style={styles_1.default.emptyIconWrap}>
74
+ return (<AnimatedEntrance_1.default style={styles_1.default.emptyContainer} distance={14}>
75
+ <react_native_1.Animated.View style={[styles_1.default.emptyIconWrap, { transform: [{ scale: iconPulse }] }]}>
25
76
  <NetworkIcons_1.EmptyRadarIcon color={AppColors_1.AppColors.purple} size={32}/>
26
- </react_native_1.View>
77
+ </react_native_1.Animated.View>
27
78
  <react_native_1.Text style={styles_1.default.emptyTitle}>
28
79
  {isSearch ? 'No matching APIs' : 'No network activity'}
29
80
  </react_native_1.Text>
@@ -35,6 +86,6 @@ const EmptyState = ({ isSearch }) => {
35
86
  {!isSearch && (<TouchableScale_1.default style={styles_1.default.reloadBtn} onPress={handleReload}>
36
87
  <react_native_1.Text style={styles_1.default.reloadBtnText}>Reload App</react_native_1.Text>
37
88
  </TouchableScale_1.default>)}
38
- </react_native_1.View>);
89
+ </AnimatedEntrance_1.default>);
39
90
  };
40
91
  exports.default = EmptyState;
@@ -32,6 +32,9 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
39
  exports.ReduxActionTimeline = exports.ReduxTreeView = void 0;
37
40
  const react_1 = __importStar(require("react"));
@@ -40,6 +43,7 @@ const AppColors_1 = require("../styles/AppColors");
40
43
  const AppFonts_1 = require("../styles/AppFonts");
41
44
  const NetworkIcons_1 = require("./NetworkIcons");
42
45
  const react_native_svg_1 = __importStar(require("react-native-svg"));
46
+ const AnimatedEntrance_1 = __importDefault(require("./AnimatedEntrance"));
43
47
  // Custom icons
44
48
  const DatabaseIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
45
49
  <react_native_svg_1.Path d="M12 2C6.5 2 2 4.2 2 7v10c0 2.8 4.5 5 10 5s10-2.2 10-5V7c0-2.8-4.5-5-10-5z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
@@ -52,6 +56,26 @@ const BoltIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) =>
52
56
  const FolderIcon = ({ color = AppColors_1.AppColors.grayTextWeak, size = 12 }) => (<react_native_svg_1.default width={size} height={size} viewBox="0 0 24 24" fill="none">
53
57
  <react_native_svg_1.Path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
54
58
  </react_native_svg_1.default>);
59
+ const animateTreeLayout = () => {
60
+ react_native_1.LayoutAnimation.configureNext(react_native_1.LayoutAnimation.Presets.easeInEaseOut);
61
+ };
62
+ const AnimatedChevron = ({ color, expanded, size, style, }) => {
63
+ const progress = (0, react_1.useRef)(new react_native_1.Animated.Value(expanded ? 1 : 0)).current;
64
+ (0, react_1.useEffect)(() => {
65
+ react_native_1.Animated.timing(progress, {
66
+ toValue: expanded ? 1 : 0,
67
+ duration: 180,
68
+ useNativeDriver: true,
69
+ }).start();
70
+ }, [expanded, progress]);
71
+ const rotate = progress.interpolate({
72
+ inputRange: [0, 1],
73
+ outputRange: ['0deg', '90deg'],
74
+ });
75
+ return (<react_native_1.Animated.View style={[style, { transform: [{ rotate }] }]}>
76
+ <NetworkIcons_1.ChevronIcon color={color} size={size}/>
77
+ </react_native_1.Animated.View>);
78
+ };
55
79
  const ReduxValueNode = ({ name, value, level, search }) => {
56
80
  const [expanded, setExpanded] = (0, react_1.useState)(level < 1);
57
81
  const isObject = typeof value === 'object' && value !== null;
@@ -75,7 +99,11 @@ const ReduxValueNode = ({ name, value, level, search }) => {
75
99
  return null;
76
100
  }
77
101
  if (!isObject) {
78
- const valStr = value === null ? 'null' : value === undefined ? 'undefined' : String(value);
102
+ const valStr = value === null
103
+ ? 'null'
104
+ : value === undefined
105
+ ? 'undefined'
106
+ : String(value);
79
107
  // Pick different colors for primitives
80
108
  let valColor = '#0D9488'; // String
81
109
  if (value === null || value === undefined) {
@@ -99,13 +127,16 @@ const ReduxValueNode = ({ name, value, level, search }) => {
99
127
  </react_native_1.View>);
100
128
  }
101
129
  const keys = Object.keys(value);
102
- const summaryText = isArray ? `Array [${keys.length}]` : `Object {${keys.length}}`;
130
+ const summaryText = isArray
131
+ ? `Array [${keys.length}]`
132
+ : `Object {${keys.length}}`;
103
133
  return (<react_native_1.View style={reduxValueStyles.treeNodeBlock}>
104
- <react_native_1.Pressable onPress={() => setExpanded(!expanded)} style={reduxValueStyles.treeRow}>
134
+ <react_native_1.Pressable onPress={() => {
135
+ animateTreeLayout();
136
+ setExpanded(!expanded);
137
+ }} style={reduxValueStyles.treeRow}>
105
138
  <react_native_1.View style={reduxValueStyles.treeLeafConnector}/>
106
- <react_native_1.View style={[reduxValueStyles.chevronWrap, { transform: [{ rotate: expanded ? '90deg' : '0deg' }] }]}>
107
- <NetworkIcons_1.ChevronIcon color={AppColors_1.AppColors.grayTextWeak} size={10}/>
108
- </react_native_1.View>
139
+ <AnimatedChevron color={AppColors_1.AppColors.grayTextWeak} expanded={expanded} size={10} style={reduxValueStyles.chevronWrap}/>
109
140
  <react_native_1.Text style={reduxValueStyles.keyText} selectable={true}>
110
141
  {nameStr}
111
142
  <react_native_1.Text style={reduxValueStyles.colonText}>: </react_native_1.Text>
@@ -120,13 +151,24 @@ const ReduxValueNode = ({ name, value, level, search }) => {
120
151
  const ReduxTreeView = ({ state, lastActionMap, search, }) => {
121
152
  const [storeExpanded, setStoreExpanded] = (0, react_1.useState)(true);
122
153
  const [reducerExpanded, setReducerExpanded] = (0, react_1.useState)({});
154
+ (0, react_1.useEffect)(() => {
155
+ if (react_native_1.Platform.OS === 'android') {
156
+ react_native_1.UIManager.setLayoutAnimationEnabledExperimental?.(true);
157
+ }
158
+ }, []);
123
159
  if (!state || typeof state !== 'object') {
124
- return (<react_native_1.Text style={{ fontFamily: AppFonts_1.AppFonts.interRegular, fontSize: 12, color: AppColors_1.AppColors.grayTextWeak, padding: 12 }}>
160
+ return (<react_native_1.Text style={{
161
+ fontFamily: AppFonts_1.AppFonts.interRegular,
162
+ fontSize: 12,
163
+ color: AppColors_1.AppColors.grayTextWeak,
164
+ padding: 12,
165
+ }}>
125
166
  No state object to display.
126
167
  </react_native_1.Text>);
127
168
  }
128
169
  const reducers = Object.keys(state);
129
170
  const toggleReducer = (key) => {
171
+ animateTreeLayout();
130
172
  setReducerExpanded(prev => ({
131
173
  ...prev,
132
174
  [key]: !prev[key],
@@ -134,10 +176,11 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
134
176
  };
135
177
  return (<react_native_1.View style={styles.container}>
136
178
  {/* Root Node: Store */}
137
- <react_native_1.Pressable onPress={() => setStoreExpanded(!storeExpanded)} style={styles.storeHeader}>
138
- <react_native_1.View style={[styles.chevronWrap, { transform: [{ rotate: storeExpanded ? '90deg' : '0deg' }] }]}>
139
- <NetworkIcons_1.ChevronIcon color="#FFFFFF" size={12}/>
140
- </react_native_1.View>
179
+ <react_native_1.Pressable onPress={() => {
180
+ animateTreeLayout();
181
+ setStoreExpanded(!storeExpanded);
182
+ }} style={styles.storeHeader}>
183
+ <AnimatedChevron color="#FFFFFF" expanded={storeExpanded} size={12} style={styles.chevronWrap}/>
141
184
  <react_native_1.Text style={styles.storeTitle}>🏪 Redux Store</react_native_1.Text>
142
185
  <react_native_1.View style={styles.badge}>
143
186
  <react_native_1.Text style={styles.badgeText}>{reducers.length} Reducers</react_native_1.Text>
@@ -152,14 +195,15 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
152
195
  const lastAction = lastActionMap[reducerKey];
153
196
  return (<react_native_1.View key={reducerKey} style={styles.reducerContainer}>
154
197
  {/* Visual Branch Line for Reducer */}
155
- <react_native_1.View style={[styles.reducerVerticalLine, isLastReducer && { bottom: '50%' }]}/>
198
+ <react_native_1.View style={[
199
+ styles.reducerVerticalLine,
200
+ isLastReducer && { bottom: '50%' },
201
+ ]}/>
156
202
 
157
203
  {/* Reducer Header */}
158
204
  <react_native_1.Pressable onPress={() => toggleReducer(reducerKey)} style={styles.reducerHeader}>
159
205
  <react_native_1.View style={styles.reducerHorizontalLine}/>
160
- <react_native_1.View style={[styles.chevronWrap, { transform: [{ rotate: isExpanded ? '90deg' : '0deg' }] }]}>
161
- <NetworkIcons_1.ChevronIcon color={AppColors_1.AppColors.purple} size={10}/>
162
- </react_native_1.View>
206
+ <AnimatedChevron color={AppColors_1.AppColors.purple} expanded={isExpanded} size={10} style={styles.chevronWrap}/>
163
207
  <react_native_1.View style={styles.iconWrap}>
164
208
  <FolderIcon color={AppColors_1.AppColors.purple} size={11}/>
165
209
  </react_native_1.View>
@@ -177,13 +221,24 @@ const ReduxTreeView = ({ state, lastActionMap, search, }) => {
177
221
  <BoltIcon color="#DB2777" size={11}/>
178
222
  </react_native_1.View>
179
223
  <react_native_1.View style={{ flex: 1 }}>
180
- <react_native_1.View style={{ flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', gap: 6 }}>
224
+ <react_native_1.View style={{
225
+ flexDirection: 'row',
226
+ alignItems: 'center',
227
+ flexWrap: 'wrap',
228
+ gap: 6,
229
+ }}>
181
230
  <react_native_1.Text style={styles.childLabel}>Last Action:</react_native_1.Text>
182
231
  {lastAction ? (<react_native_1.View style={styles.actionTypeBadge}>
183
- <react_native_1.Text style={styles.actionTypeText}>{lastAction.type}</react_native_1.Text>
184
- </react_native_1.View>) : (<react_native_1.Text style={styles.noActionText}>None dispatched</react_native_1.Text>)}
232
+ <react_native_1.Text style={styles.actionTypeText}>
233
+ {lastAction.type}
234
+ </react_native_1.Text>
235
+ </react_native_1.View>) : (<react_native_1.Text style={styles.noActionText}>
236
+ None dispatched
237
+ </react_native_1.Text>)}
185
238
  </react_native_1.View>
186
- {lastAction && (<react_native_1.Text style={styles.timestampText}>Dispatched: {lastAction.timestamp}</react_native_1.Text>)}
239
+ {lastAction && (<react_native_1.Text style={styles.timestampText}>
240
+ Dispatched: {lastAction.timestamp}
241
+ </react_native_1.Text>)}
187
242
  {lastAction && lastAction.payload !== null && (<react_native_1.View style={{ marginTop: 6 }}>
188
243
  <ReduxValueNode name="payload" value={lastAction.payload} level={0} search={search}/>
189
244
  </react_native_1.View>)}
@@ -213,6 +268,7 @@ exports.ReduxTreeView = ReduxTreeView;
213
268
  const ReduxActionTimeline = ({ history, onClear, search, }) => {
214
269
  const [expandedActionId, setExpandedActionId] = (0, react_1.useState)(null);
215
270
  const toggleExpand = (id) => {
271
+ animateTreeLayout();
216
272
  setExpandedActionId(prev => (prev === id ? null : id));
217
273
  };
218
274
  const filteredHistory = history.filter(action => {
@@ -230,7 +286,9 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
230
286
  });
231
287
  return (<react_native_1.View style={timelineStyles.container}>
232
288
  <react_native_1.View style={timelineStyles.headerRow}>
233
- <react_native_1.Text style={timelineStyles.headerTitle}>⚡ Dispatched Actions ({filteredHistory.length})</react_native_1.Text>
289
+ <react_native_1.Text style={timelineStyles.headerTitle}>
290
+ ⚡ Dispatched Actions ({filteredHistory.length})
291
+ </react_native_1.Text>
234
292
  {history.length > 0 && (<react_native_1.Pressable onPress={onClear} style={timelineStyles.clearBtn}>
235
293
  <react_native_1.Text style={timelineStyles.clearBtnText}>Clear Log</react_native_1.Text>
236
294
  </react_native_1.Pressable>)}
@@ -246,9 +304,12 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
246
304
  {filteredHistory.map((item, index) => {
247
305
  const isLast = index === filteredHistory.length - 1;
248
306
  const isExpanded = expandedActionId === item.id;
249
- return (<react_native_1.View key={item.id} style={timelineStyles.timelineItem}>
307
+ return (<AnimatedEntrance_1.default key={item.id} index={index} distance={8} style={timelineStyles.timelineItem}>
250
308
  {/* Visual Line */}
251
- <react_native_1.View style={[timelineStyles.verticalLine, isLast && { bottom: '50%' }]}/>
309
+ <react_native_1.View style={[
310
+ timelineStyles.verticalLine,
311
+ isLast && { bottom: '50%' },
312
+ ]}/>
252
313
  <react_native_1.View style={timelineStyles.circleIndicator}>
253
314
  <react_native_1.View style={timelineStyles.circleInner}/>
254
315
  </react_native_1.View>
@@ -256,13 +317,18 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
256
317
  {/* Card */}
257
318
  <react_native_1.Pressable onPress={() => toggleExpand(item.id)} style={[
258
319
  timelineStyles.card,
259
- isExpanded && { borderColor: AppColors_1.AppColors.purple, backgroundColor: AppColors_1.AppColors.purpleShade50 },
320
+ isExpanded && {
321
+ borderColor: AppColors_1.AppColors.purple,
322
+ backgroundColor: AppColors_1.AppColors.purpleShade50,
323
+ },
260
324
  ]}>
261
325
  <react_native_1.View style={timelineStyles.cardHeader}>
262
326
  <react_native_1.View style={timelineStyles.typeBadge}>
263
327
  <react_native_1.Text style={timelineStyles.typeText}>{item.type}</react_native_1.Text>
264
328
  </react_native_1.View>
265
- <react_native_1.Text style={timelineStyles.timestamp}>{item.timestamp}</react_native_1.Text>
329
+ <react_native_1.Text style={timelineStyles.timestamp}>
330
+ {item.timestamp}
331
+ </react_native_1.Text>
266
332
  </react_native_1.View>
267
333
 
268
334
  {item.affectedSlices.length > 0 && (<react_native_1.View style={timelineStyles.slicesRow}>
@@ -274,12 +340,15 @@ const ReduxActionTimeline = ({ history, onClear, search, }) => {
274
340
 
275
341
  {isExpanded && (<react_native_1.View style={timelineStyles.payloadContainer}>
276
342
  <react_native_1.Text style={timelineStyles.payloadTitle}>Payload</react_native_1.Text>
277
- {item.payload !== null && typeof item.payload === 'object' ? (<ReduxValueNode name="action.payload" value={item.payload} level={0} search={search}/>) : (<react_native_1.Text style={timelineStyles.primitivePayload}>
278
- {item.payload === null ? 'null' : String(item.payload)}
343
+ {item.payload !== null &&
344
+ typeof item.payload === 'object' ? (<ReduxValueNode name="action.payload" value={item.payload} level={0} search={search}/>) : (<react_native_1.Text style={timelineStyles.primitivePayload}>
345
+ {item.payload === null
346
+ ? 'null'
347
+ : String(item.payload)}
279
348
  </react_native_1.Text>)}
280
349
  </react_native_1.View>)}
281
350
  </react_native_1.Pressable>
282
- </react_native_1.View>);
351
+ </AnimatedEntrance_1.default>);
283
352
  })}
284
353
  </react_native_1.View>)}
285
354
  </react_native_1.View>);
@@ -37,6 +37,22 @@ const react_1 = __importStar(require("react"));
37
37
  const react_native_1 = require("react-native");
38
38
  const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
39
39
  const scale = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
40
+ const opacity = (0, react_1.useRef)(new react_native_1.Animated.Value(1)).current;
41
+ const animatePress = (pressed) => {
42
+ react_native_1.Animated.parallel([
43
+ react_native_1.Animated.spring(scale, {
44
+ toValue: pressed ? 0.94 : 1,
45
+ friction: 6,
46
+ tension: 120,
47
+ useNativeDriver: true,
48
+ }),
49
+ react_native_1.Animated.timing(opacity, {
50
+ toValue: pressed ? 0.86 : 1,
51
+ duration: pressed ? 90 : 140,
52
+ useNativeDriver: true,
53
+ }),
54
+ ]).start();
55
+ };
40
56
  const flattenedStyle = react_native_1.StyleSheet.flatten(style) || {};
41
57
  const layoutStyle = {
42
58
  flex: flattenedStyle.flex,
@@ -49,8 +65,8 @@ const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
49
65
  flexShrink: flattenedStyle.flexShrink,
50
66
  gap: flattenedStyle.gap,
51
67
  };
52
- return (<react_native_1.Pressable disabled={disabled} style={style} onPressIn={() => react_native_1.Animated.spring(scale, { toValue: 0.94, useNativeDriver: true }).start()} onPressOut={() => react_native_1.Animated.spring(scale, { toValue: 1, useNativeDriver: true }).start()} onPress={onPress} hitSlop={hitSlop}>
53
- <react_native_1.Animated.View style={[{ transform: [{ scale }] }, layoutStyle]}>
68
+ return (<react_native_1.Pressable disabled={disabled} style={style} onPressIn={() => animatePress(true)} onPressOut={() => animatePress(false)} onPress={onPress} hitSlop={hitSlop}>
69
+ <react_native_1.Animated.View style={[{ opacity, transform: [{ scale }] }, layoutStyle]}>
54
70
  {children}
55
71
  </react_native_1.Animated.View>
56
72
  </react_native_1.Pressable>);
@@ -19,3 +19,4 @@ export declare const logAnalyticsEvent: (name: string, params?: Record<string, a
19
19
  * setupAnalyticsLogger(analytics());
20
20
  */
21
21
  export declare const setupAnalyticsLogger: (analyticsInstance: any) => void;
22
+ export declare const autoSetupAnalyticsLogger: () => boolean;
@@ -22,7 +22,7 @@
22
22
  // setUserId(id)
23
23
  // ─────────────────────────────────────────────────────────────────────────────
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
25
+ exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
26
26
  // ─── Internal state ───────────────────────────────────────────────────────────
27
27
  let events = [];
28
28
  let listeners = [];
@@ -33,7 +33,7 @@ let currentUserId;
33
33
  // ─── Core helpers ─────────────────────────────────────────────────────────────
34
34
  const notify = () => {
35
35
  const snapshot = [...events];
36
- listeners.forEach((cb) => cb(snapshot));
36
+ listeners.forEach(cb => cb(snapshot));
37
37
  };
38
38
  const addEvent = (event) => {
39
39
  events.unshift(event);
@@ -45,7 +45,7 @@ const subscribeAnalyticsEvents = (callback) => {
45
45
  listeners.push(callback);
46
46
  callback([...events]);
47
47
  return () => {
48
- listeners = listeners.filter((l) => l !== callback);
48
+ listeners = listeners.filter(l => l !== callback);
49
49
  };
50
50
  };
51
51
  exports.subscribeAnalyticsEvents = subscribeAnalyticsEvents;
@@ -68,10 +68,10 @@ const logAnalyticsEvent = (name, params = {}, userProperties = {}) => {
68
68
  params,
69
69
  userProperties: { ...currentUserProperties, ...userProperties },
70
70
  timestamp: Date.now(),
71
- source: "manual",
72
- userId: currentUserId ?? "",
73
- screenName: "",
74
- screenClass: "",
71
+ source: 'manual',
72
+ userId: currentUserId ?? '',
73
+ screenName: '',
74
+ screenClass: '',
75
75
  });
76
76
  };
77
77
  exports.logAnalyticsEvent = logAnalyticsEvent;
@@ -89,7 +89,7 @@ exports.logAnalyticsEvent = logAnalyticsEvent;
89
89
  */
90
90
  const setupAnalyticsLogger = (analyticsInstance) => {
91
91
  if (!analyticsInstance) {
92
- console.warn("[AnalyticsLogger] No analytics instance provided — skipping setup.");
92
+ console.warn('[AnalyticsLogger] No analytics instance provided — skipping setup.');
93
93
  return;
94
94
  }
95
95
  // Guard against double-patching the same instance
@@ -105,10 +105,10 @@ const setupAnalyticsLogger = (analyticsInstance) => {
105
105
  params: params ?? {},
106
106
  userProperties: { ...currentUserProperties },
107
107
  timestamp: Date.now(),
108
- source: "firebase",
109
- userId: currentUserId ?? "",
110
- screenName: "",
111
- screenClass: "",
108
+ source: 'firebase',
109
+ userId: currentUserId ?? '',
110
+ screenName: '',
111
+ screenClass: '',
112
112
  });
113
113
  return originalLogEvent(name, params);
114
114
  };
@@ -117,14 +117,14 @@ const setupAnalyticsLogger = (analyticsInstance) => {
117
117
  analyticsInstance.logScreenView = async (params) => {
118
118
  addEvent({
119
119
  id: counter++,
120
- name: "screen_view",
120
+ name: 'screen_view',
121
121
  params: params ?? {},
122
122
  userProperties: { ...currentUserProperties },
123
123
  timestamp: Date.now(),
124
- source: "firebase",
125
- screenName: params?.screen_name ?? "",
126
- screenClass: params?.screen_class ?? "",
127
- userId: currentUserId ?? "",
124
+ source: 'firebase',
125
+ screenName: params?.screen_name ?? '',
126
+ screenClass: params?.screen_class ?? '',
127
+ userId: currentUserId ?? '',
128
128
  });
129
129
  return originalLogScreenView(params);
130
130
  };
@@ -158,3 +158,43 @@ const setupAnalyticsLogger = (analyticsInstance) => {
158
158
  };
159
159
  };
160
160
  exports.setupAnalyticsLogger = setupAnalyticsLogger;
161
+ const autoSetupAnalyticsLogger = () => {
162
+ if (globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__)
163
+ return true;
164
+ let mod;
165
+ try {
166
+ mod = require('@react-native-firebase/analytics'); // optional dep
167
+ }
168
+ catch {
169
+ return false; // GA not installed — silent no-op
170
+ }
171
+ const accessor = mod?.default ?? mod;
172
+ if (typeof accessor !== 'function')
173
+ return false;
174
+ try {
175
+ (0, exports.setupAnalyticsLogger)(accessor());
176
+ }
177
+ catch { } // patch default-app instance
178
+ if (!accessor.__INSPECTOR_WRAPPED__) {
179
+ // patch future/named instances
180
+ const wrapped = function (...args) {
181
+ const instance = accessor.apply(this, args);
182
+ try {
183
+ (0, exports.setupAnalyticsLogger)(instance);
184
+ }
185
+ catch { }
186
+ return instance;
187
+ };
188
+ Object.setPrototypeOf(wrapped, accessor);
189
+ Object.assign(wrapped, accessor);
190
+ wrapped.__INSPECTOR_WRAPPED__ = true;
191
+ try {
192
+ if (mod.default !== undefined)
193
+ mod.default = wrapped;
194
+ }
195
+ catch { }
196
+ }
197
+ globalThis.__INSPECTOR_ANALYTICS_AUTOSETUP__ = true;
198
+ return true;
199
+ };
200
+ exports.autoSetupAnalyticsLogger = autoSetupAnalyticsLogger;
@@ -1,4 +1,4 @@
1
- import './webViewLogger';
1
+ import "./webViewLogger";
2
2
  type NetworkLog = {
3
3
  id: number;
4
4
  url: string;