react-native-inapp-inspector 2.3.5 → 2.3.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/dist/commonjs/analytics.d.ts +0 -4
- package/dist/commonjs/analytics.js +0 -4
- package/dist/commonjs/bundle.d.ts +0 -4
- package/dist/commonjs/bundle.js +0 -4
- package/dist/commonjs/components/AnalyticsDetail.js +18 -27
- package/dist/commonjs/components/AnalyticsEventCard.js +9 -12
- package/dist/commonjs/components/AnalyticsGraph.js +10 -15
- package/dist/commonjs/components/AppHeaderLogo.js +0 -3
- package/dist/commonjs/components/BrandCircleIcon.js +15 -15
- package/dist/commonjs/components/BrandSquareIcon.js +20 -20
- package/dist/commonjs/components/CodeSnippet.js +6 -19
- package/dist/commonjs/components/ConsoleLogCard.js +0 -1
- package/dist/commonjs/components/CopyButton.js +0 -4
- package/dist/commonjs/components/DiffViewer.js +0 -2
- package/dist/commonjs/components/DomainHeader.js +0 -4
- package/dist/commonjs/components/EmptyState.js +0 -3
- package/dist/commonjs/components/ErrorBoundary.js +5 -10
- package/dist/commonjs/components/HeadersSection.js +0 -5
- package/dist/commonjs/components/HighlightText.js +1 -4
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/commonjs/components/Inspector/BundleTab.js +56 -84
- package/dist/commonjs/components/Inspector/ConsoleTab.js +7 -7
- package/dist/commonjs/components/Inspector/CrashDetail.js +18 -20
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +11 -20
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/commonjs/components/Inspector/FabLauncher.js +1 -1
- package/dist/commonjs/components/Inspector/InspectorContext.js +0 -2
- package/dist/commonjs/components/Inspector/InspectorHeader.js +7 -8
- package/dist/commonjs/components/Inspector/LogDetail.js +27 -29
- package/dist/commonjs/components/Inspector/MainScreen.js +9 -10
- package/dist/commonjs/components/Inspector/NetworkDetail.js +10 -11
- package/dist/commonjs/components/Inspector/NetworkTab.js +14 -14
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/commonjs/components/Inspector/PerformanceTab.js +30 -43
- package/dist/commonjs/components/Inspector/ReduxDetail.js +18 -34
- package/dist/commonjs/components/Inspector/ReduxTab.js +11 -20
- package/dist/commonjs/components/Inspector/SettingsPanel.js +32 -36
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Inspector/StorageTab.js +14 -26
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/commonjs/components/JsonViewer.js +3 -10
- package/dist/commonjs/components/LogCard.js +7 -7
- package/dist/commonjs/components/MetaAccordion.js +1 -7
- package/dist/commonjs/components/NetworkIcons.js +12 -16
- package/dist/commonjs/components/SectionHeader.js +0 -4
- package/dist/commonjs/components/SkeletonPlaceholder.js +6 -6
- package/dist/commonjs/components/Slider.js +6 -6
- package/dist/commonjs/components/SourcePageCard.js +0 -4
- package/dist/commonjs/components/TreeNode.js +0 -4
- package/dist/commonjs/console.d.ts +0 -4
- package/dist/commonjs/console.js +0 -4
- package/dist/commonjs/constants/index.js +6 -9
- package/dist/commonjs/constants/telemetryConfig.d.ts +3 -0
- package/dist/commonjs/constants/telemetryConfig.js +6 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -3
- package/dist/commonjs/crash.d.ts +0 -4
- package/dist/commonjs/crash.js +0 -4
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/commonjs/customHooks/analyticsLogger.js +3 -59
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/commonjs/customHooks/bundleAnalyzer.js +3 -86
- package/dist/commonjs/customHooks/consoleLogger.js +0 -16
- package/dist/commonjs/customHooks/crashHandler.d.ts +0 -28
- package/dist/commonjs/customHooks/crashHandler.js +0 -55
- package/dist/commonjs/customHooks/logFilters.d.ts +0 -4
- package/dist/commonjs/customHooks/logFilters.js +0 -11
- package/dist/commonjs/customHooks/networkLogger.js +2 -13
- package/dist/commonjs/customHooks/performanceTracker.d.ts +0 -27
- package/dist/commonjs/customHooks/performanceTracker.js +0 -31
- package/dist/commonjs/customHooks/reduxLogger.d.ts +0 -12
- package/dist/commonjs/customHooks/reduxLogger.js +0 -51
- package/dist/commonjs/customHooks/storageInspector.d.ts +0 -40
- package/dist/commonjs/customHooks/storageInspector.js +1 -56
- package/dist/commonjs/decorators/index.d.ts +0 -37
- package/dist/commonjs/decorators/index.js +0 -42
- package/dist/commonjs/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/commonjs/helpers/index.d.ts +0 -7
- package/dist/commonjs/helpers/index.js +1 -42
- package/dist/commonjs/helpers/memoryManager.d.ts +0 -11
- package/dist/commonjs/helpers/memoryManager.js +0 -13
- package/dist/commonjs/helpers/searchQueryParser.d.ts +0 -4
- package/dist/commonjs/helpers/searchQueryParser.js +0 -18
- package/dist/commonjs/helpers/settingsStore.js +0 -8
- package/dist/commonjs/helpers/telemetry.d.ts +2 -0
- package/dist/commonjs/helpers/telemetry.js +136 -0
- package/dist/commonjs/i18n/index.d.ts +0 -9
- package/dist/commonjs/i18n/index.js +0 -15
- package/dist/commonjs/index.js +15 -97
- package/dist/commonjs/native/NativeInspector.d.ts +0 -54
- package/dist/commonjs/native/NativeInspector.js +0 -56
- package/dist/commonjs/network.d.ts +0 -4
- package/dist/commonjs/network.js +0 -4
- package/dist/commonjs/performance.d.ts +0 -4
- package/dist/commonjs/performance.js +0 -4
- package/dist/commonjs/redux.d.ts +0 -4
- package/dist/commonjs/redux.js +0 -4
- package/dist/commonjs/storage.d.ts +0 -4
- package/dist/commonjs/storage.js +0 -4
- package/dist/commonjs/styles/AppColors.d.ts +0 -3
- package/dist/commonjs/styles/AppColors.js +15 -30
- package/dist/commonjs/styles/AppFonts.d.ts +0 -4
- package/dist/commonjs/styles/AppFonts.js +0 -4
- package/dist/commonjs/styles/common.js +0 -11
- package/dist/commonjs/styles/index.js +0 -8
- package/dist/commonjs/types/enums.js +0 -3
- package/dist/commonjs/types/interfaces.d.ts +3 -3
- package/dist/esm/analytics.d.ts +0 -4
- package/dist/esm/analytics.js +0 -4
- package/dist/esm/bundle.d.ts +0 -4
- package/dist/esm/bundle.js +0 -4
- package/dist/esm/components/AnalyticsDetail.js +18 -27
- package/dist/esm/components/AnalyticsEventCard.js +9 -12
- package/dist/esm/components/AnalyticsGraph.js +10 -15
- package/dist/esm/components/AppHeaderLogo.js +0 -3
- package/dist/esm/components/BrandCircleIcon.js +15 -15
- package/dist/esm/components/BrandSquareIcon.js +20 -20
- package/dist/esm/components/CodeSnippet.js +6 -19
- package/dist/esm/components/ConsoleLogCard.js +0 -1
- package/dist/esm/components/CopyButton.js +0 -4
- package/dist/esm/components/DiffViewer.js +0 -2
- package/dist/esm/components/DomainHeader.js +0 -4
- package/dist/esm/components/EmptyState.js +0 -3
- package/dist/esm/components/ErrorBoundary.js +5 -10
- package/dist/esm/components/HeadersSection.js +0 -5
- package/dist/esm/components/HighlightText.js +1 -4
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +11 -26
- package/dist/esm/components/Inspector/AnalyticsTab.js +34 -40
- package/dist/esm/components/Inspector/BundleTab.js +56 -84
- package/dist/esm/components/Inspector/ConsoleTab.js +7 -7
- package/dist/esm/components/Inspector/CrashDetail.js +18 -20
- package/dist/esm/components/Inspector/CrashFilterModal.js +0 -1
- package/dist/esm/components/Inspector/CrashTab.js +11 -20
- package/dist/esm/components/Inspector/DeviceInfoTab.js +12 -24
- package/dist/esm/components/Inspector/FabLauncher.js +1 -1
- package/dist/esm/components/Inspector/InspectorContext.js +0 -2
- package/dist/esm/components/Inspector/InspectorHeader.js +7 -8
- package/dist/esm/components/Inspector/LogDetail.js +27 -29
- package/dist/esm/components/Inspector/MainScreen.js +9 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +10 -11
- package/dist/esm/components/Inspector/NetworkTab.js +14 -14
- package/dist/esm/components/Inspector/NpmUpdateToast.js +6 -9
- package/dist/esm/components/Inspector/PerformanceTab.js +30 -43
- package/dist/esm/components/Inspector/ReduxDetail.js +18 -34
- package/dist/esm/components/Inspector/ReduxTab.js +11 -20
- package/dist/esm/components/Inspector/SettingsPanel.js +32 -36
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Inspector/StorageTab.js +14 -26
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +5 -6
- package/dist/esm/components/JsonViewer.js +3 -10
- package/dist/esm/components/LogCard.js +7 -7
- package/dist/esm/components/MetaAccordion.js +1 -7
- package/dist/esm/components/NetworkIcons.js +12 -16
- package/dist/esm/components/SectionHeader.js +0 -4
- package/dist/esm/components/SkeletonPlaceholder.js +6 -6
- package/dist/esm/components/Slider.js +6 -6
- package/dist/esm/components/SourcePageCard.js +0 -4
- package/dist/esm/components/TreeNode.js +0 -4
- package/dist/esm/console.d.ts +0 -4
- package/dist/esm/console.js +0 -4
- package/dist/esm/constants/index.js +6 -9
- package/dist/esm/constants/telemetryConfig.d.ts +3 -0
- package/dist/esm/constants/telemetryConfig.js +3 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -3
- package/dist/esm/crash.d.ts +0 -4
- package/dist/esm/crash.js +0 -4
- package/dist/esm/customHooks/analyticsLogger.d.ts +0 -7
- package/dist/esm/customHooks/analyticsLogger.js +3 -59
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +0 -9
- package/dist/esm/customHooks/bundleAnalyzer.js +3 -86
- package/dist/esm/customHooks/consoleLogger.js +0 -16
- package/dist/esm/customHooks/crashHandler.d.ts +0 -28
- package/dist/esm/customHooks/crashHandler.js +0 -55
- package/dist/esm/customHooks/logFilters.d.ts +0 -4
- package/dist/esm/customHooks/logFilters.js +0 -11
- package/dist/esm/customHooks/networkLogger.js +2 -13
- package/dist/esm/customHooks/performanceTracker.d.ts +0 -27
- package/dist/esm/customHooks/performanceTracker.js +0 -31
- package/dist/esm/customHooks/reduxLogger.d.ts +0 -12
- package/dist/esm/customHooks/reduxLogger.js +0 -51
- package/dist/esm/customHooks/storageInspector.d.ts +0 -40
- package/dist/esm/customHooks/storageInspector.js +1 -56
- package/dist/esm/decorators/index.d.ts +0 -37
- package/dist/esm/decorators/index.js +0 -42
- package/dist/esm/helpers/gaAnalyticsRegistry.d.ts +0 -10
- package/dist/esm/helpers/gaAnalyticsRegistry.js +0 -26
- package/dist/esm/helpers/index.d.ts +0 -7
- package/dist/esm/helpers/index.js +1 -42
- package/dist/esm/helpers/memoryManager.d.ts +0 -11
- package/dist/esm/helpers/memoryManager.js +0 -13
- package/dist/esm/helpers/searchQueryParser.d.ts +0 -4
- package/dist/esm/helpers/searchQueryParser.js +0 -18
- package/dist/esm/helpers/settingsStore.js +0 -8
- package/dist/esm/helpers/telemetry.d.ts +2 -0
- package/dist/esm/helpers/telemetry.js +132 -0
- package/dist/esm/i18n/index.d.ts +0 -9
- package/dist/esm/i18n/index.js +0 -15
- package/dist/esm/index.js +15 -97
- package/dist/esm/native/NativeInspector.d.ts +0 -54
- package/dist/esm/native/NativeInspector.js +0 -56
- package/dist/esm/network.d.ts +0 -4
- package/dist/esm/network.js +0 -4
- package/dist/esm/performance.d.ts +0 -4
- package/dist/esm/performance.js +0 -4
- package/dist/esm/redux.d.ts +0 -4
- package/dist/esm/redux.js +0 -4
- package/dist/esm/storage.d.ts +0 -4
- package/dist/esm/storage.js +0 -4
- package/dist/esm/styles/AppColors.d.ts +0 -3
- package/dist/esm/styles/AppColors.js +15 -30
- package/dist/esm/styles/AppFonts.d.ts +0 -4
- package/dist/esm/styles/AppFonts.js +0 -4
- package/dist/esm/styles/common.js +0 -11
- package/dist/esm/styles/index.js +0 -8
- package/dist/esm/types/enums.js +0 -3
- package/dist/esm/types/interfaces.d.ts +3 -3
- package/package.json +2 -2
- package/src/constants/telemetryConfig.ts +6 -0
- package/src/constants/version.ts +1 -1
- package/src/helpers/telemetry.ts +161 -0
- package/src/index.tsx +15 -1
- package/src/types/interfaces.ts +3 -0
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { ScrollView, View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
|
3
3
|
import { useTranslation } from '../i18n';
|
|
4
|
-
// Components
|
|
5
4
|
import TreeNode from './TreeNode';
|
|
6
5
|
import SegmentedTabs from './SegmentedTabs';
|
|
7
6
|
import HighlightText from './HighlightText';
|
|
8
7
|
import CopyButton from './CopyButton';
|
|
9
8
|
import { PrettyIcon, RawIcon, TableIcon } from './NetworkIcons';
|
|
10
|
-
// Styles
|
|
11
9
|
import { AppColors } from '../styles/AppColors';
|
|
12
10
|
import { AppFonts } from '../styles/AppFonts';
|
|
13
11
|
import styles from '../styles';
|
|
14
|
-
// ── Table Row Component with 3-Line Clamp & Show More/Less ───────────────────
|
|
15
12
|
const JsonTableRow = React.memo(({ itemKey, val, search, }) => {
|
|
16
13
|
const [expanded, setExpanded] = useState(false);
|
|
17
14
|
const isObject = val !== null && typeof val === 'object';
|
|
@@ -55,7 +52,6 @@ const JsonTableRow = React.memo(({ itemKey, val, search, }) => {
|
|
|
55
52
|
</View>
|
|
56
53
|
</View>);
|
|
57
54
|
});
|
|
58
|
-
// ── JsonViewer Component ─────────────────────────────────────────────────────
|
|
59
55
|
const JsonViewer = React.memo(({ data, search, forceOpen, defaultExpandDepth = 1, wrap, fullHeight = false, maxHeight, mode: externalMode, onModeChange, hideTabs = false, }) => {
|
|
60
56
|
const { t } = useTranslation();
|
|
61
57
|
const [internalMode, setInternalMode] = useState('raw');
|
|
@@ -103,12 +99,10 @@ const JsonViewer = React.memo(({ data, search, forceOpen, defaultExpandDepth = 1
|
|
|
103
99
|
localStyles.rawScroll,
|
|
104
100
|
!fullHeight && maxHeight != null && { maxHeight },
|
|
105
101
|
];
|
|
106
|
-
// Determine type and size details
|
|
107
102
|
const isObject = typeof data === 'object' && data !== null;
|
|
108
103
|
const isEmpty = data === null ||
|
|
109
104
|
data === undefined ||
|
|
110
105
|
(isObject && Object.keys(data).length === 0);
|
|
111
|
-
// Render Table view (Key-Value flat table for root keys)
|
|
112
106
|
const renderTableMode = () => {
|
|
113
107
|
if (!isObject) {
|
|
114
108
|
return (<View style={localStyles.tableRow}>
|
|
@@ -130,10 +124,9 @@ const JsonViewer = React.memo(({ data, search, forceOpen, defaultExpandDepth = 1
|
|
|
130
124
|
{keys.map((key) => (<JsonTableRow key={key} itemKey={key} val={data[key]} search={search}/>))}
|
|
131
125
|
</View>);
|
|
132
126
|
};
|
|
133
|
-
// Tree View Content
|
|
134
127
|
const tree = (<TreeNode data={data} search={search} forceOpen={forceOpen} defaultExpandDepth={defaultExpandDepth}/>);
|
|
135
128
|
return (<View style={[localStyles.container, fullHeight && { flex: 1 }]}>
|
|
136
|
-
|
|
129
|
+
|
|
137
130
|
{!hideTabs && (<View style={localStyles.toolbar}>
|
|
138
131
|
<SegmentedTabs tabs={[
|
|
139
132
|
{
|
|
@@ -155,7 +148,7 @@ const JsonViewer = React.memo(({ data, search, forceOpen, defaultExpandDepth = 1
|
|
|
155
148
|
<CopyButton value={data} label="JSON"/>
|
|
156
149
|
</View>)}
|
|
157
150
|
|
|
158
|
-
|
|
151
|
+
|
|
159
152
|
<View style={contentWrapperStyle}>
|
|
160
153
|
{mode === 'pretty' && (isEmpty ? (<View style={localStyles.emptyTable}>
|
|
161
154
|
<Text style={localStyles.emptyTableText}>
|
|
@@ -238,7 +231,7 @@ const localStyles = StyleSheet.create({
|
|
|
238
231
|
},
|
|
239
232
|
rawScroll: {
|
|
240
233
|
flex: 1,
|
|
241
|
-
backgroundColor: AppColors.paperBg,
|
|
234
|
+
backgroundColor: AppColors.paperBg,
|
|
242
235
|
},
|
|
243
236
|
rawContainer: {
|
|
244
237
|
padding: 12,
|
|
@@ -85,7 +85,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
85
85
|
},
|
|
86
86
|
]}>
|
|
87
87
|
<View style={styles.cardBody}>
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
<View style={styles.cardHeaderRow}>
|
|
90
90
|
<View style={styles.cardHeaderLeft}>
|
|
91
91
|
<Pressable onPress={() => onToggleSelect(item.id)} hitSlop={12} style={[
|
|
@@ -145,7 +145,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
145
145
|
</Text>
|
|
146
146
|
</View>)}
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
|
|
149
149
|
<View style={[
|
|
150
150
|
styles.chip,
|
|
151
151
|
{
|
|
@@ -174,7 +174,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
174
174
|
</Text>
|
|
175
175
|
</View>
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
{(item.url.toLowerCase().includes('graphql') ||
|
|
179
179
|
item.client === 'apollo' ||
|
|
180
180
|
item.client === 'graphql') && (<View style={[
|
|
@@ -199,7 +199,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
199
199
|
</Text>
|
|
200
200
|
</View>)}
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
{item.duration != null && !isFailed && (<View style={[
|
|
204
204
|
styles.chip,
|
|
205
205
|
{
|
|
@@ -261,7 +261,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
261
261
|
</View>
|
|
262
262
|
</View>
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
|
|
265
265
|
<View style={styles.cardSlugBox}>
|
|
266
266
|
<Pressable onPress={handleOpenUrl} style={styles.slugLeft} hitSlop={6}>
|
|
267
267
|
<View style={{
|
|
@@ -308,7 +308,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
308
308
|
</View>
|
|
309
309
|
</View>
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
|
|
312
312
|
<View style={styles.cardFooterRow}>
|
|
313
313
|
<View style={styles.cardDateRow}>
|
|
314
314
|
<CalendarIcon color={AppColors.grayTextWeak} size={10}/>
|
|
@@ -347,7 +347,7 @@ const LogCard = React.memo(function LogCard({ item, onPress, timelineMinStart, t
|
|
|
347
347
|
</View>
|
|
348
348
|
</View>
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
|
|
351
351
|
{typeof item.duration === 'number' && item.duration > 0 && !isFailed && (<View style={{ marginTop: 6, gap: 2 }}>
|
|
352
352
|
<View style={{
|
|
353
353
|
height: 2.5,
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { useTranslation } from '../i18n';
|
|
3
3
|
import { View, Pressable, Text, Animated } from 'react-native';
|
|
4
|
-
// Constants
|
|
5
4
|
import { DURATION_FAST_MS, DURATION_SLOW_MS } from '../constants';
|
|
6
|
-
// Custom Hooks
|
|
7
5
|
import useAccordion from '../customHooks/useAccordion';
|
|
8
|
-
// Helpers
|
|
9
6
|
import { getDurationColor, handleOpenExternalLink } from '../helpers';
|
|
10
|
-
// Assets
|
|
11
7
|
import { ChevronIcon, CalendarIcon, StatusIcon, ClockIcon, SizeIcon, TerminalIcon, GlobeIcon, } from './NetworkIcons';
|
|
12
|
-
// Components
|
|
13
8
|
import TouchableScale from './TouchableScale';
|
|
14
9
|
import CopyButton from './CopyButton';
|
|
15
|
-
// Stylesheet
|
|
16
10
|
import { AppColors } from '../styles/AppColors';
|
|
17
11
|
import { AppFonts } from '../styles/AppFonts';
|
|
18
12
|
import styles from '../styles';
|
|
@@ -183,7 +177,7 @@ const MetaAccordion = ({ status, statusColor, duration, size, triggeredAt, metho
|
|
|
183
177
|
</View>
|
|
184
178
|
</View>
|
|
185
179
|
|
|
186
|
-
|
|
180
|
+
|
|
187
181
|
{duration != null && !isFailed && (<View style={{ paddingVertical: 8, gap: 6 }}>
|
|
188
182
|
<View style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
|
|
189
183
|
<Text style={{ fontFamily: AppFonts.interBold, fontSize: 11, color: AppColors.primaryBlack }}>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Svg, { Circle, Ellipse, Line, Path, Rect } from 'react-native-svg';
|
|
3
|
-
// Stylesheet
|
|
4
3
|
import { AppColors } from '../styles/AppColors';
|
|
5
4
|
export const EmptyRadarIcon = ({ color = AppColors.purple, size = 32 }) => {
|
|
6
5
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
@@ -205,19 +204,19 @@ export const InsightsIcon = ({ color = AppColors.grayTextWeak, size = 14, }) =>
|
|
|
205
204
|
};
|
|
206
205
|
export const DebugIcon = ({ color = AppColors.white, size = 18 }) => {
|
|
207
206
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
|
|
208
|
+
|
|
210
209
|
<Path d="M6 18l8-8" stroke={color} strokeWidth="2.5" strokeLinecap="round"/>
|
|
211
|
-
|
|
210
|
+
|
|
212
211
|
<Path d="M13.5 10.5l2-2 1.5 1.5-2 2-1.5-1.5z" fill={color}/>
|
|
213
212
|
<Path d="M15.5 8.5L19 5c.5-.5 1.2-.5 1.7 0s.5 1.2 0 1.7L17.2 10.2" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
214
213
|
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
|
|
215
|
+
|
|
217
216
|
<Path d="M15 15l4 4" stroke={color} strokeWidth="3.5" strokeLinecap="round"/>
|
|
218
|
-
|
|
217
|
+
|
|
219
218
|
<Path d="M15 15L8.5 8.5" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
220
|
-
|
|
219
|
+
|
|
221
220
|
<Path d="M9 9L5 5M4.5 6.5l2-2" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
222
221
|
</Svg>);
|
|
223
222
|
};
|
|
@@ -267,20 +266,18 @@ export const FolderIcon = ({ color = AppColors.grayTextWeak, size = 14, }) => {
|
|
|
267
266
|
<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"/>
|
|
268
267
|
</Svg>);
|
|
269
268
|
};
|
|
270
|
-
// #3 — Broom/sweep "wipe" icon used by the header Clear-Everything button.
|
|
271
269
|
export const WipeIcon = ({ color = AppColors.white, size = 16 }) => {
|
|
272
270
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
273
|
-
|
|
271
|
+
|
|
274
272
|
<Path d="M19.5 3.5L12.7 10.3" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
275
|
-
|
|
273
|
+
|
|
276
274
|
<Path d="M13.5 9.5l1.5 1.5c.8.8.8 2 0 2.8L10 19l-5-5 5.2-5.5c.8-.8 2-.8 2.8 0z" stroke={color} strokeWidth="2" strokeLinejoin="round"/>
|
|
277
|
-
|
|
275
|
+
|
|
278
276
|
<Path d="M7.5 16.5L5.5 18.5M10 19l-1.5 1.5" stroke={color} strokeWidth="2" strokeLinecap="round"/>
|
|
279
|
-
|
|
277
|
+
|
|
280
278
|
<Path d="M3 11.5h.01M5.5 8.5h.01" stroke={color} strokeWidth="2.4" strokeLinecap="round"/>
|
|
281
279
|
</Svg>);
|
|
282
280
|
};
|
|
283
|
-
// #7 — Icons for the inner filter chips / sub tabs.
|
|
284
281
|
export const LayersIcon = ({ color = AppColors.grayTextWeak, size = 12, }) => {
|
|
285
282
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
286
283
|
<Path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" stroke={color} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
|
|
@@ -416,7 +413,6 @@ export const PerformanceIcon = ({ color = AppColors.purple, size = 14, }) => {
|
|
|
416
413
|
<Circle cx="12" cy="12" r="1.5" fill={color}/>
|
|
417
414
|
</Svg>);
|
|
418
415
|
};
|
|
419
|
-
// ─── App-wide Vector Icons (emoji-free, render on every device) ─────────────
|
|
420
416
|
export const BoltIcon = ({ color = AppColors.amber500, size = 14 }) => {
|
|
421
417
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
422
418
|
<Path d="M13 2 4.5 13.5 H10.5 L9 22 19.5 9.5 H13.5 Z" stroke={color} strokeWidth="1.8" strokeLinejoin="round"/>
|
|
@@ -570,7 +566,7 @@ export const UserCheckIcon = ({ color = AppColors.grayTextWeak, size = 14, }) =>
|
|
|
570
566
|
};
|
|
571
567
|
export const CrashIcon = ({ color = AppColors.errorColor, size = 14, }) => {
|
|
572
568
|
return (<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
573
|
-
|
|
569
|
+
|
|
574
570
|
<Path d="M12 2v3M4.93 4.93l2.12 2.12M19.07 4.93l-2.12 2.12M9 10h6M8 14h8M9 18h6" stroke={color} strokeWidth="1.8" strokeLinecap="round"/>
|
|
575
571
|
<Path d="M12 8a6 6 0 0 1 6 6v3a6 6 0 0 1-12 0v-3a6 6 0 0 1 6-6z" stroke={color} strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round"/>
|
|
576
572
|
<Path d="M3 13h3M18 13h3M4 19l2.5-1.5M20 19l-2.5-1.5M4 9l2.5 1.5M20 9l-2.5 1.5" stroke={color} strokeWidth="1.8" strokeLinecap="round"/>
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import React, { useRef, useEffect } from 'react';
|
|
2
2
|
import { Animated, View, Pressable, Text } from 'react-native';
|
|
3
|
-
// Stylesheet
|
|
4
3
|
import { AppColors } from '../styles/AppColors';
|
|
5
|
-
// Components
|
|
6
4
|
import CopyButton from './CopyButton';
|
|
7
5
|
import TouchableScale from './TouchableScale';
|
|
8
|
-
// Assets
|
|
9
6
|
import { RequestIcon, ResponseIcon, HeadersIcon, DiffIcon, ChevronIcon, SearchIcon, } from './NetworkIcons';
|
|
10
|
-
// Stylesheet
|
|
11
7
|
import styles from '../styles';
|
|
12
8
|
const SectionHeader = ({ title, value, expanded, onToggleExpand, showDiff, isDiffing, onToggleDiff, showSearch, isSearching, onToggleSearch, }) => {
|
|
13
9
|
const isOpen = expanded === undefined ? false : !!expanded;
|
|
@@ -20,7 +20,7 @@ export const SkeletonPlaceholder = React.memo(function SkeletonPlaceholder({ car
|
|
|
20
20
|
return () => animation.stop();
|
|
21
21
|
}, [shimmerAnim]);
|
|
22
22
|
return (<View style={skeletonStyles.container}>
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
<View style={skeletonStyles.toolbarSkeleton}>
|
|
25
25
|
<Animated.View style={[
|
|
26
26
|
skeletonStyles.searchBarSkeleton,
|
|
@@ -32,7 +32,7 @@ export const SkeletonPlaceholder = React.memo(function SkeletonPlaceholder({ car
|
|
|
32
32
|
</View>
|
|
33
33
|
</View>
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
<View style={skeletonStyles.chipStripSkeleton}>
|
|
37
37
|
<Animated.View style={[skeletonStyles.chipSkeleton, { width: 48, opacity: shimmerAnim }]}/>
|
|
38
38
|
<Animated.View style={[skeletonStyles.chipSkeleton, { width: 68, opacity: shimmerAnim }]}/>
|
|
@@ -40,9 +40,9 @@ export const SkeletonPlaceholder = React.memo(function SkeletonPlaceholder({ car
|
|
|
40
40
|
<Animated.View style={[skeletonStyles.chipSkeleton, { width: 58, opacity: shimmerAnim }]}/>
|
|
41
41
|
</View>
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
{Array.from({ length: cardCount }).map((_, i) => (<Animated.View key={`skeleton_card_${i}`} style={[skeletonStyles.cardSkeleton, { opacity: shimmerAnim }]}>
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
<View style={skeletonStyles.cardTopRow}>
|
|
47
47
|
<View style={skeletonStyles.badgeGroup}>
|
|
48
48
|
<View style={skeletonStyles.statusBadgeSkeleton}/>
|
|
@@ -51,11 +51,11 @@ export const SkeletonPlaceholder = React.memo(function SkeletonPlaceholder({ car
|
|
|
51
51
|
<View style={skeletonStyles.timeSkeleton}/>
|
|
52
52
|
</View>
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
<View style={skeletonStyles.urlLineLong}/>
|
|
56
56
|
<View style={skeletonStyles.urlLineShort}/>
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
<View style={skeletonStyles.cardBottomRow}>
|
|
60
60
|
<View style={skeletonStyles.metaPillSkeleton}/>
|
|
61
61
|
<View style={skeletonStyles.metaPillSkeleton}/>
|
|
@@ -56,7 +56,7 @@ export const Slider = React.memo(({ value, onValueChange, min = 50, max = 90, st
|
|
|
56
56
|
};
|
|
57
57
|
const thumbPosition = percentage * (trackWidth || 0);
|
|
58
58
|
return (<View style={styles.container}>
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
<View style={styles.valueRow}>
|
|
61
61
|
<Text style={styles.rangeText}>{min}%</Text>
|
|
62
62
|
<View style={[
|
|
@@ -68,18 +68,18 @@ export const Slider = React.memo(({ value, onValueChange, min = 50, max = 90, st
|
|
|
68
68
|
<Text style={styles.rangeText}>{max}%</Text>
|
|
69
69
|
</View>
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
<View ref={trackContainerRef} onLayout={handleLayout} {...panResponder.panHandlers} style={styles.touchArea}>
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
<View style={styles.rail}>
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
<View style={[
|
|
77
77
|
styles.fillBar,
|
|
78
78
|
{ width: `${Math.round(percentage * 100)}%` },
|
|
79
79
|
]}/>
|
|
80
80
|
</View>
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
<View style={[
|
|
84
84
|
styles.thumb,
|
|
85
85
|
{
|
|
@@ -91,7 +91,7 @@ export const Slider = React.memo(({ value, onValueChange, min = 50, max = 90, st
|
|
|
91
91
|
</View>
|
|
92
92
|
</View>
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
{quickPresets && quickPresets.length > 0 && (<View style={styles.presetRow}>
|
|
96
96
|
{quickPresets.map(preset => {
|
|
97
97
|
const isSelected = Math.round(clampedValue) === preset;
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { View, Pressable, Text, Animated } from 'react-native';
|
|
3
3
|
import Svg, { Rect, Path } from 'react-native-svg';
|
|
4
|
-
// Components
|
|
5
4
|
import CopyButton from './CopyButton';
|
|
6
|
-
// Custom Hooks
|
|
7
5
|
import useAccordion from '../customHooks/useAccordion';
|
|
8
|
-
// Assets
|
|
9
6
|
import { ChevronIcon } from './NetworkIcons';
|
|
10
|
-
// Stylesheet
|
|
11
7
|
import { AppColors } from '../styles/AppColors';
|
|
12
8
|
import styles from '../styles';
|
|
13
9
|
const SourcePageCard = ({ routeInfo }) => {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { Text, View, Image, Animated, Pressable } from 'react-native';
|
|
3
|
-
// Helpers
|
|
4
3
|
import { escapeRegex } from '../helpers';
|
|
5
|
-
// Assets
|
|
6
4
|
import { ChevronIcon, DocIcon } from './NetworkIcons';
|
|
7
|
-
// Stylesheet
|
|
8
5
|
import { AppColors } from '../styles/AppColors';
|
|
9
6
|
import styles from '../styles';
|
|
10
7
|
const TreeNode = React.memo(function TreeNode({ data, name, level = 0, search, forceOpen, defaultExpandDepth = 1, }) {
|
|
@@ -22,7 +19,6 @@ const TreeNode = React.memo(function TreeNode({ data, name, level = 0, search, f
|
|
|
22
19
|
}, [forceOpen]);
|
|
23
20
|
const isObject = typeof data === 'object' && data !== null;
|
|
24
21
|
const isArray = Array.isArray(data);
|
|
25
|
-
// Declare all hooks at the top unconditionally (prevents "Rendered fewer hooks than expected" error)
|
|
26
22
|
const treeChevronAnim = useRef(new Animated.Value(open ? 1 : 0)).current;
|
|
27
23
|
useEffect(() => {
|
|
28
24
|
Animated.timing(treeChevronAnim, {
|
package/dist/esm/console.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/console
|
|
3
|
-
* Clean tree-shaking & isolated console logger.
|
|
4
|
-
*/
|
|
5
1
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, getConsoleLogs, setConsoleModuleEnabled, getConsoleModuleEnabled, setMaxConsoleLogsLimit, getMaxConsoleLogsLimit, pruneConsoleLogs, } from './customHooks/consoleLogger';
|
|
6
2
|
export type { ConsoleLog, } from './types';
|
|
7
3
|
export { ConsoleLogType, LogFilter, } from './types';
|
package/dist/esm/console.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/console
|
|
3
|
-
* Clean tree-shaking & isolated console logger.
|
|
4
|
-
*/
|
|
5
1
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, getConsoleLogs, setConsoleModuleEnabled, getConsoleModuleEnabled, setMaxConsoleLogsLimit, getMaxConsoleLogsLimit, pruneConsoleLogs, } from './customHooks/consoleLogger';
|
|
6
2
|
export { ConsoleLogType, LogFilter, } from './types';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// Styles
|
|
2
1
|
import { AppColors } from '../styles/AppColors';
|
|
3
2
|
export const STATUS_FILTERS = [
|
|
4
3
|
'ALL',
|
|
@@ -13,16 +12,14 @@ export const STATUS_FILTERS = [
|
|
|
13
12
|
'Failed',
|
|
14
13
|
];
|
|
15
14
|
export const METHOD_COLORS = {
|
|
16
|
-
ALL: '#64748B',
|
|
17
|
-
GET: '#059669',
|
|
18
|
-
POST: '#2563EB',
|
|
19
|
-
PUT: '#D97706',
|
|
20
|
-
PATCH: '#7C3AED',
|
|
21
|
-
DELETE: '#DC2626',
|
|
15
|
+
ALL: '#64748B',
|
|
16
|
+
GET: '#059669',
|
|
17
|
+
POST: '#2563EB',
|
|
18
|
+
PUT: '#D97706',
|
|
19
|
+
PATCH: '#7C3AED',
|
|
20
|
+
DELETE: '#DC2626',
|
|
22
21
|
};
|
|
23
22
|
export const DOMAIN_COLORS = AppColors.domainColors;
|
|
24
23
|
export const DURATION_FAST_MS = 200;
|
|
25
24
|
export const DURATION_SLOW_MS = 800;
|
|
26
|
-
// Package version — auto-generated from package.json at build time.
|
|
27
|
-
// See scripts/gen-version.js (wired to the "prebuild" npm script).
|
|
28
25
|
export { LIB_VERSION } from './version';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "2.3.
|
|
1
|
+
export declare const LIB_VERSION = "2.3.7";
|
package/dist/esm/crash.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/crash
|
|
3
|
-
* Clean tree-shaking & isolated global crash handler and reporting.
|
|
4
|
-
*/
|
|
5
1
|
export { setupGlobalCrashHandler, subscribeCrashEvents, emitCrashEvent, getCrashRecords, clearCrashRecords, simulateTestCrash, exportCrashReport, parseCrashStackTrace, setMaxCrashLogsLimit, getMaxCrashLogsLimit, pruneCrashRecords, setCrashModuleEnabled, getCrashModuleEnabled, } from './customHooks/crashHandler';
|
|
6
2
|
export type { CrashRecord, CrashBreadcrumb, } from './types';
|
|
7
3
|
export { CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|
package/dist/esm/crash.js
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sub-module entry point: react-native-inapp-inspector/crash
|
|
3
|
-
* Clean tree-shaking & isolated global crash handler and reporting.
|
|
4
|
-
*/
|
|
5
1
|
export { setupGlobalCrashHandler, subscribeCrashEvents, emitCrashEvent, getCrashRecords, clearCrashRecords, simulateTestCrash, exportCrashReport, parseCrashStackTrace, setMaxCrashLogsLimit, getMaxCrashLogsLimit, pruneCrashRecords, setCrashModuleEnabled, getCrashModuleEnabled, } from './customHooks/crashHandler';
|
|
6
2
|
export { CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|
|
@@ -15,14 +15,7 @@ export declare const getDefaultEventParameters: () => {
|
|
|
15
15
|
[x: string]: any;
|
|
16
16
|
};
|
|
17
17
|
export declare const getCollectionEnabled: () => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Directly push an event into the inspector without going through Firebase.
|
|
20
|
-
* Useful for custom analytics wrappers or testing.
|
|
21
|
-
*/
|
|
22
18
|
export declare const logAnalyticsEvent: (name: string, params?: Record<string, any>, userProperties?: Record<string, any>) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Returns true if analytics logging is active (always ready for custom and Firebase events).
|
|
25
|
-
*/
|
|
26
19
|
export declare const isAnalyticsConnected: () => boolean;
|
|
27
20
|
export declare const isFirebaseAnalyticsPatched: () => boolean;
|
|
28
21
|
export declare const setupAnalyticsLogger: (analyticsInstance: any) => void;
|
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
// ─── Analytics Logger ─────────────────────────────────────────────────────────
|
|
2
|
-
//
|
|
3
|
-
// Captures @react-native-firebase/analytics events by monkey-patching the
|
|
4
|
-
// analytics instance returned by `analytics()`.
|
|
5
|
-
//
|
|
6
|
-
// Setup (call once at app startup, before any analytics calls):
|
|
7
|
-
//
|
|
8
|
-
// import analytics from '@react-native-firebase/analytics';
|
|
9
|
-
// import { setupAnalyticsLogger } from './network/analyticsLogger';
|
|
10
|
-
//
|
|
11
|
-
// setupAnalyticsLogger(analytics());
|
|
12
|
-
//
|
|
13
|
-
// That's it — every subsequent logEvent / logScreenView / setUserProperty call
|
|
14
|
-
// will be intercepted and shown in the Analytics tab of NetworkInspector.
|
|
15
|
-
//
|
|
16
|
-
// Patched methods:
|
|
17
|
-
// logEvent(name, params)
|
|
18
|
-
// logScreenView({ screen_name, screen_class })
|
|
19
|
-
// setUserProperty(name, value)
|
|
20
|
-
// setUserProperties(properties)
|
|
21
|
-
// setUserId(id)
|
|
22
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
// ─── Internal state ───────────────────────────────────────────────────────────
|
|
24
1
|
let events = [];
|
|
25
2
|
let listeners = [];
|
|
26
3
|
let counter = 0;
|
|
@@ -29,7 +6,6 @@ export const setAnalyticsModuleEnabled = (enabled) => {
|
|
|
29
6
|
isAnalyticsModuleEnabled = enabled;
|
|
30
7
|
};
|
|
31
8
|
export const getAnalyticsModuleEnabled = () => isAnalyticsModuleEnabled;
|
|
32
|
-
// Running snapshot of user properties set so far — attached to every event
|
|
33
9
|
let currentUserProperties = {};
|
|
34
10
|
let currentUserId;
|
|
35
11
|
let currentDefaultEventParameters = {};
|
|
@@ -52,7 +28,6 @@ export const pruneAnalyticsLogs = (targetCount) => {
|
|
|
52
28
|
}
|
|
53
29
|
return Math.max(0, pruned);
|
|
54
30
|
};
|
|
55
|
-
// ─── Core helpers ─────────────────────────────────────────────────────────────
|
|
56
31
|
const notify = () => {
|
|
57
32
|
const snapshot = [...events];
|
|
58
33
|
listeners.forEach(cb => cb(snapshot));
|
|
@@ -64,7 +39,6 @@ const addEvent = (event) => {
|
|
|
64
39
|
events = events.slice(0, maxAnalyticsLogsLimit);
|
|
65
40
|
notify();
|
|
66
41
|
};
|
|
67
|
-
// ─── Public subscribe / query API ────────────────────────────────────────────
|
|
68
42
|
export const subscribeAnalyticsEvents = (callback) => {
|
|
69
43
|
listeners.push(callback);
|
|
70
44
|
callback([...events]);
|
|
@@ -81,11 +55,6 @@ export const getCurrentUserProperties = () => ({ ...currentUserProperties });
|
|
|
81
55
|
export const getCurrentUserId = () => currentUserId;
|
|
82
56
|
export const getDefaultEventParameters = () => ({ ...currentDefaultEventParameters });
|
|
83
57
|
export const getCollectionEnabled = () => isCollectionEnabled;
|
|
84
|
-
// ─── Manual logging (escape hatch, rarely needed) ────────────────────────────
|
|
85
|
-
/**
|
|
86
|
-
* Directly push an event into the inspector without going through Firebase.
|
|
87
|
-
* Useful for custom analytics wrappers or testing.
|
|
88
|
-
*/
|
|
89
58
|
export const logAnalyticsEvent = (name, params = {}, userProperties = {}) => {
|
|
90
59
|
addEvent({
|
|
91
60
|
id: counter++,
|
|
@@ -99,22 +68,7 @@ export const logAnalyticsEvent = (name, params = {}, userProperties = {}) => {
|
|
|
99
68
|
screenClass: '',
|
|
100
69
|
});
|
|
101
70
|
};
|
|
102
|
-
// ─── Firebase Analytics instance patcher ─────────────────────────────────────
|
|
103
|
-
/**
|
|
104
|
-
* Monkey-patches a @react-native-firebase/analytics instance so all calls
|
|
105
|
-
* are intercepted and forwarded to the NetworkInspector analytics tab.
|
|
106
|
-
*
|
|
107
|
-
* Pass the result of `analytics()` (the default app instance or any named one).
|
|
108
|
-
* Safe to call multiple times with the same instance — won't double-patch.
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* import analytics from '@react-native-firebase/analytics';
|
|
112
|
-
* setupAnalyticsLogger(analytics());
|
|
113
|
-
*/
|
|
114
71
|
let isAnalyticsPatched = false;
|
|
115
|
-
/**
|
|
116
|
-
* Returns true if analytics logging is active (always ready for custom and Firebase events).
|
|
117
|
-
*/
|
|
118
72
|
export const isAnalyticsConnected = () => true;
|
|
119
73
|
export const isFirebaseAnalyticsPatched = () => isAnalyticsPatched;
|
|
120
74
|
export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
@@ -123,11 +77,9 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
123
77
|
return;
|
|
124
78
|
}
|
|
125
79
|
isAnalyticsPatched = true;
|
|
126
|
-
// Guard against double-patching the same instance
|
|
127
80
|
if (analyticsInstance.__INSPECTOR_PATCHED__)
|
|
128
81
|
return;
|
|
129
82
|
analyticsInstance.__INSPECTOR_PATCHED__ = true;
|
|
130
|
-
// ── logEvent ──────────────────────────────────────────────────────────────
|
|
131
83
|
const originalLogEvent = analyticsInstance.logEvent.bind(analyticsInstance);
|
|
132
84
|
analyticsInstance.logEvent = async (name, params) => {
|
|
133
85
|
try {
|
|
@@ -146,7 +98,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
146
98
|
catch { }
|
|
147
99
|
return originalLogEvent(name, params);
|
|
148
100
|
};
|
|
149
|
-
// ── logScreenView ─────────────────────────────────────────────────────────
|
|
150
101
|
const originalLogScreenView = analyticsInstance.logScreenView.bind(analyticsInstance);
|
|
151
102
|
analyticsInstance.logScreenView = async (params) => {
|
|
152
103
|
try {
|
|
@@ -165,7 +116,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
165
116
|
catch { }
|
|
166
117
|
return originalLogScreenView(params);
|
|
167
118
|
};
|
|
168
|
-
// ── setUserProperty ───────────────────────────────────────────────────────
|
|
169
119
|
const originalSetUserProperty = analyticsInstance.setUserProperty.bind(analyticsInstance);
|
|
170
120
|
analyticsInstance.setUserProperty = async (name, value) => {
|
|
171
121
|
try {
|
|
@@ -179,7 +129,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
179
129
|
catch { }
|
|
180
130
|
return originalSetUserProperty(name, value);
|
|
181
131
|
};
|
|
182
|
-
// ── setUserProperties ─────────────────────────────────────────────────────
|
|
183
132
|
const originalSetUserProperties = analyticsInstance.setUserProperties.bind(analyticsInstance);
|
|
184
133
|
analyticsInstance.setUserProperties = async (properties) => {
|
|
185
134
|
try {
|
|
@@ -195,7 +144,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
195
144
|
catch { }
|
|
196
145
|
return originalSetUserProperties(properties);
|
|
197
146
|
};
|
|
198
|
-
// ── setUserId ─────────────────────────────────────────────────────────────
|
|
199
147
|
const originalSetUserId = analyticsInstance.setUserId.bind(analyticsInstance);
|
|
200
148
|
analyticsInstance.setUserId = async (id) => {
|
|
201
149
|
try {
|
|
@@ -205,7 +153,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
205
153
|
catch { }
|
|
206
154
|
return originalSetUserId(id);
|
|
207
155
|
};
|
|
208
|
-
// ── setDefaultEventParameters ──────────────────────────────────────────────
|
|
209
156
|
if (typeof analyticsInstance.setDefaultEventParameters === 'function') {
|
|
210
157
|
const originalSetDefaultEventParameters = analyticsInstance.setDefaultEventParameters.bind(analyticsInstance);
|
|
211
158
|
analyticsInstance.setDefaultEventParameters = async (params) => {
|
|
@@ -217,7 +164,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
217
164
|
return originalSetDefaultEventParameters(params);
|
|
218
165
|
};
|
|
219
166
|
}
|
|
220
|
-
// ── setAnalyticsCollectionEnabled ───────────────────────────────────────────
|
|
221
167
|
if (typeof analyticsInstance.setAnalyticsCollectionEnabled === 'function') {
|
|
222
168
|
const originalSetAnalyticsCollectionEnabled = analyticsInstance.setAnalyticsCollectionEnabled.bind(analyticsInstance);
|
|
223
169
|
analyticsInstance.setAnalyticsCollectionEnabled = async (enabled) => {
|
|
@@ -229,7 +175,6 @@ export const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
229
175
|
return originalSetAnalyticsCollectionEnabled(enabled);
|
|
230
176
|
};
|
|
231
177
|
}
|
|
232
|
-
// ── resetAnalyticsData ──────────────────────────────────────────────────────
|
|
233
178
|
if (typeof analyticsInstance.resetAnalyticsData === 'function') {
|
|
234
179
|
const originalResetAnalyticsData = analyticsInstance.resetAnalyticsData.bind(analyticsInstance);
|
|
235
180
|
analyticsInstance.resetAnalyticsData = async () => {
|
|
@@ -250,10 +195,10 @@ export const autoSetupAnalyticsLogger = () => {
|
|
|
250
195
|
return true;
|
|
251
196
|
let mod;
|
|
252
197
|
try {
|
|
253
|
-
mod = require('@react-native-firebase/analytics');
|
|
198
|
+
mod = require('@react-native-firebase/analytics');
|
|
254
199
|
}
|
|
255
200
|
catch {
|
|
256
|
-
return false;
|
|
201
|
+
return false;
|
|
257
202
|
}
|
|
258
203
|
const accessor = mod?.default ?? mod;
|
|
259
204
|
if (typeof accessor !== 'function')
|
|
@@ -261,9 +206,8 @@ export const autoSetupAnalyticsLogger = () => {
|
|
|
261
206
|
try {
|
|
262
207
|
setupAnalyticsLogger(accessor());
|
|
263
208
|
}
|
|
264
|
-
catch { }
|
|
209
|
+
catch { }
|
|
265
210
|
if (!accessor.__INSPECTOR_WRAPPED__) {
|
|
266
|
-
// patch future/named instances
|
|
267
211
|
const wrapped = function (...args) {
|
|
268
212
|
const instance = accessor.apply(this, args);
|
|
269
213
|
try {
|