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
package/dist/esm/i18n/index.js
CHANGED
|
@@ -4,9 +4,6 @@ const localeRegistry = {
|
|
|
4
4
|
en: enLocale,
|
|
5
5
|
};
|
|
6
6
|
let currentLanguage = 'en';
|
|
7
|
-
/**
|
|
8
|
-
* Lightweight nested lookup for translation keys (e.g. "network.headers")
|
|
9
|
-
*/
|
|
10
7
|
function lookupKey(obj, path) {
|
|
11
8
|
if (!obj || !path)
|
|
12
9
|
return undefined;
|
|
@@ -19,9 +16,6 @@ function lookupKey(obj, path) {
|
|
|
19
16
|
}
|
|
20
17
|
return current;
|
|
21
18
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Interpolates {{key}} placeholders in string templates
|
|
24
|
-
*/
|
|
25
19
|
function interpolate(template, params) {
|
|
26
20
|
if (!params || typeof template !== 'string')
|
|
27
21
|
return template;
|
|
@@ -29,9 +23,6 @@ function interpolate(template, params) {
|
|
|
29
23
|
return params[key] !== undefined ? String(params[key]) : `{{${key}}}`;
|
|
30
24
|
});
|
|
31
25
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Standalone zero-dependency translation function
|
|
34
|
-
*/
|
|
35
26
|
export function t(key, optionsOrFallback) {
|
|
36
27
|
const activeBundle = localeRegistry[currentLanguage] || localeRegistry.en;
|
|
37
28
|
let raw = lookupKey(activeBundle, key);
|
|
@@ -75,18 +66,12 @@ export const i18n = {
|
|
|
75
66
|
addTranslations,
|
|
76
67
|
setTranslations,
|
|
77
68
|
};
|
|
78
|
-
/**
|
|
79
|
-
* React hook compatible with react-i18next useTranslation()
|
|
80
|
-
*/
|
|
81
69
|
export function useTranslation() {
|
|
82
70
|
return {
|
|
83
71
|
t,
|
|
84
72
|
i18n,
|
|
85
73
|
};
|
|
86
74
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Backward-compatible I18nextProvider component
|
|
89
|
-
*/
|
|
90
75
|
export const I18nextProvider = ({ children }) => {
|
|
91
76
|
return React.createElement(React.Fragment, null, children);
|
|
92
77
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,41 +1,30 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
2
2
|
import { Alert, Animated, PanResponder, Platform, UIManager, LogBox, } from 'react-native';
|
|
3
3
|
import { NavigationContext } from '@react-navigation/native';
|
|
4
|
-
// i18n
|
|
5
4
|
import { I18nextProvider, i18n } from './i18n';
|
|
6
|
-
// Components
|
|
7
5
|
import ErrorBoundary from './components/ErrorBoundary';
|
|
8
6
|
import MainScreen from './components/Inspector/MainScreen';
|
|
9
7
|
import { InspectorContext, animateNextLayout, } from './components/Inspector/InspectorContext';
|
|
10
|
-
// Helpers
|
|
11
8
|
import { formatDisplayUrl, getNavigationInfo, getLogPageName, deduplicateLogs, getDomainColor, getEventCategory, matchNetworkLogQuery, setupMemoryWarningHandler, } from './helpers';
|
|
12
|
-
// #5 — settings persistence
|
|
13
9
|
import { loadSettings, saveSettings, setCustomStorage, clearPersistedSettings, calculateRamBasedLimits, } from './helpers/settingsStore';
|
|
14
10
|
import { getNativeSystemMetrics, pushNativeLogRecord, fetchNativeCachedPage, } from './native/NativeInspector';
|
|
15
|
-
// Network
|
|
16
11
|
import { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, setNetworkModuleEnabled, setMaxNetworkLogsLimit, setRouteInfoProvider, } from './customHooks/networkLogger';
|
|
17
|
-
// Console
|
|
18
12
|
import { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, setConsoleModuleEnabled, } from './customHooks/consoleLogger';
|
|
19
13
|
import { IGNORED_LOG_PREFIXES } from './customHooks/logFilters';
|
|
20
|
-
// Crash Protection
|
|
21
14
|
import { setupGlobalCrashHandler, subscribeCrashEvents, getCrashRecords, clearCrashRecords, setMaxCrashLogsLimit, setCrashModuleEnabled, } from './customHooks/crashHandler';
|
|
15
|
+
import { trackActiveTelemetryHeartbeat, setTelemetryEnabled, } from './helpers/telemetry';
|
|
22
16
|
import { subscribeAnalyticsEvents, clearAnalyticsEvents, autoSetupAnalyticsLogger, isAnalyticsConnected, setAnalyticsModuleEnabled, } from './customHooks/analyticsLogger';
|
|
23
17
|
import { getReduxState, subscribeReduxState, setReduxAutoRefresh, getLastActionForReducer, clearActionHistory, isReduxConnected, setReduxModuleEnabled, } from './customHooks/reduxLogger';
|
|
24
18
|
import { setPerformanceModuleEnabled } from './customHooks/performanceTracker';
|
|
25
19
|
import { setBundleModuleEnabled } from './customHooks/bundleAnalyzer';
|
|
26
20
|
import { showNativeFloatingButton, hideNativeFloatingButton, setNativeFloatingButtonBadge, subscribeNativeFloatingButtonPress, subscribeNativeDeviceShake, isNativeModuleAvailable, } from './native/NativeInspector';
|
|
27
21
|
import { LIB_VERSION } from './constants';
|
|
28
|
-
// Stylesheet
|
|
29
22
|
import { toggleGlobalTheme } from './styles';
|
|
30
23
|
const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, environment, initialVisible = false, visible: controlledVisible, }) => {
|
|
31
|
-
// Set custom storage synchronously during render phase
|
|
32
24
|
setCustomStorage(storage || null);
|
|
33
25
|
const [isDark, setIsDark] = useState(false);
|
|
34
26
|
const [reduxState, setReduxState] = useState(null);
|
|
35
|
-
// Per-reducer last action is kept in component state so the
|
|
36
|
-
// Redux tab re-renders live on every dispatch, independent of the state tree ref.
|
|
37
27
|
const [reduxLastActionMap, setReduxLastActionMap] = useState({});
|
|
38
|
-
// Inspector panel height as a percentage of the screen (configurable in Settings).
|
|
39
28
|
const [modalHeightPercent, setModalHeightPercent] = useState(90);
|
|
40
29
|
const [modalAnimationType, setModalAnimationType] = useState('slide');
|
|
41
30
|
const [logs, setLogs] = useState([]);
|
|
@@ -77,19 +66,15 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
77
66
|
const [collapsedSections, setCollapsedSections] = useState(new Set());
|
|
78
67
|
const [showHeaderInfo, setShowHeaderInfo] = useState(true);
|
|
79
68
|
const [sortOrder, setSortOrder] = useState('newest');
|
|
80
|
-
// #7 — sort order for the Logs (console) tab
|
|
81
69
|
const [logSortOrder, setLogSortOrder] = useState('newest');
|
|
82
70
|
const [reqExpanded, setReqExpanded] = useState(true);
|
|
83
71
|
const [resExpanded, setResExpanded] = useState(true);
|
|
84
72
|
const [showReqDiff, setShowReqDiff] = useState(false);
|
|
85
73
|
const [showResDiff, setShowResDiff] = useState(false);
|
|
86
|
-
// ─── Analytics state ───────────────────────────────────────────────────────
|
|
87
74
|
const [activeTab, setActiveTab] = useState('apis');
|
|
88
75
|
const [analyticsEvents, setAnalyticsEvents] = useState([]);
|
|
89
|
-
// ─── Logs state ────────────────────────────────────────────────────────────
|
|
90
76
|
const [consoleLogs, setConsoleLogs] = useState([]);
|
|
91
77
|
const [selectedLog, setSelectedLog] = useState(null);
|
|
92
|
-
// ─── Pause states ─────────────────────────────────────────────────────────
|
|
93
78
|
const [isNetworkPaused, setIsNetworkPaused] = useState(false);
|
|
94
79
|
const isNetworkPausedRef = useRef(isNetworkPaused);
|
|
95
80
|
isNetworkPausedRef.current = isNetworkPaused;
|
|
@@ -105,7 +90,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
105
90
|
const [lastReadLogsCount, setLastReadLogsCount] = useState(0);
|
|
106
91
|
const [lastReadApisCount, setLastReadApisCount] = useState(0);
|
|
107
92
|
const [lastReadCrashesCount, setLastReadCrashesCount] = useState(0);
|
|
108
|
-
// ─── Crash state ───────────────────────────────────────────────────────────
|
|
109
93
|
const [crashRecords, setCrashRecords] = useState(() => getCrashRecords());
|
|
110
94
|
const [selectedCrash, setSelectedCrash] = useState(null);
|
|
111
95
|
const [maxCrashLogs, setMaxCrashLogs] = useState(50);
|
|
@@ -172,7 +156,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
172
156
|
}, [consoleLogs, showConsoleLevels, maxConsoleLogs]);
|
|
173
157
|
const [logSearch, setLogSearch] = useState('');
|
|
174
158
|
const [logFilters, setLogFilters] = useState(new Set(['user-log']));
|
|
175
|
-
// ─── Settings state ──────────────────────────────────────────────────────────
|
|
176
159
|
const [settingsPage, setSettingsPage] = useState(null);
|
|
177
160
|
const [settingsActiveSubTab, setSettingsActiveSubTab] = useState('module');
|
|
178
161
|
const [tabVisibility, setTabVisibility] = useState({
|
|
@@ -192,11 +175,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
192
175
|
const [deviceFreeRamMb, setDeviceFreeRamMb] = useState(1800);
|
|
193
176
|
const [reduxAutoRefresh, setReduxAutoRefreshState] = useState(true);
|
|
194
177
|
const [reduxExpandDepth, setReduxExpandDepth] = useState(1);
|
|
195
|
-
// #6 — tab the inspector opens on. Shown with a DEFAULT badge in Settings.
|
|
196
178
|
const [defaultTab, setDefaultTab] = useState('apis');
|
|
197
179
|
const [showDuplicateLogs, setShowDuplicateLogs] = useState(false);
|
|
198
180
|
const [showUpdateToast, setShowUpdateToast] = useState(true);
|
|
199
|
-
// Synchronize runtime background listeners with active settings
|
|
200
181
|
useEffect(() => {
|
|
201
182
|
setNetworkModuleEnabled(!!tabVisibility.apis);
|
|
202
183
|
setConsoleModuleEnabled(!!tabVisibility.logs);
|
|
@@ -206,7 +187,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
206
187
|
setCrashModuleEnabled(!!tabVisibility.crash);
|
|
207
188
|
setBundleModuleEnabled(!!tabVisibility.bundle);
|
|
208
189
|
}, [tabVisibility]);
|
|
209
|
-
// Query native hardware RAM and auto-tune limits if auto-RAM is active
|
|
210
190
|
useEffect(() => {
|
|
211
191
|
getNativeSystemMetrics()
|
|
212
192
|
.then(metrics => {
|
|
@@ -260,7 +240,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
260
240
|
setShowUpdateToast(true);
|
|
261
241
|
Alert.alert('Settings Reset', 'All settings have been reset to default values.');
|
|
262
242
|
};
|
|
263
|
-
// #5 — hydrate persisted settings once, then auto-save on any change.
|
|
264
243
|
const settingsHydratedRef = useRef(false);
|
|
265
244
|
useEffect(() => {
|
|
266
245
|
let cancelled = false;
|
|
@@ -279,7 +258,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
279
258
|
setTabVisibility(prev => ({
|
|
280
259
|
...prev,
|
|
281
260
|
...saved.tabVisibility,
|
|
282
|
-
apis: true,
|
|
261
|
+
apis: true,
|
|
283
262
|
}));
|
|
284
263
|
if (saved.defaultTab)
|
|
285
264
|
setDefaultTab(saved.defaultTab);
|
|
@@ -364,8 +343,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
364
343
|
reduxExpandDepth,
|
|
365
344
|
showDuplicateLogs,
|
|
366
345
|
]);
|
|
367
|
-
// #1 — check NPM for a newer published version; surfaces an animated dot
|
|
368
|
-
// in the header next to the npm chip when an update is available.
|
|
369
346
|
const [latestNpmVersion, setLatestNpmVersion] = useState(null);
|
|
370
347
|
const updateAvailable = useMemo(() => {
|
|
371
348
|
if (!latestNpmVersion)
|
|
@@ -394,7 +371,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
394
371
|
}
|
|
395
372
|
})
|
|
396
373
|
.catch(() => {
|
|
397
|
-
// Offline / blocked — silently skip the update check.
|
|
398
374
|
});
|
|
399
375
|
return () => {
|
|
400
376
|
cancelled = true;
|
|
@@ -403,7 +379,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
403
379
|
useEffect(() => {
|
|
404
380
|
setReduxAutoRefresh(reduxAutoRefresh);
|
|
405
381
|
}, [reduxAutoRefresh]);
|
|
406
|
-
// Auto-unselect Redux or Analytics tab if module is not connected / available
|
|
407
382
|
useEffect(() => {
|
|
408
383
|
if (activeTab === 'redux' && !isReduxConnected()) {
|
|
409
384
|
setActiveTab('apis');
|
|
@@ -426,7 +401,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
426
401
|
animateNextLayout();
|
|
427
402
|
setActiveTab('apis');
|
|
428
403
|
}
|
|
429
|
-
// #6 — a hidden module can't be the default landing tab.
|
|
430
404
|
if (!nextVal && defaultTab === key) {
|
|
431
405
|
setDefaultTab('apis');
|
|
432
406
|
}
|
|
@@ -584,12 +558,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
584
558
|
}
|
|
585
559
|
}
|
|
586
560
|
catch (err) {
|
|
587
|
-
// Safe check
|
|
588
561
|
}
|
|
589
562
|
};
|
|
590
|
-
// Initialize state
|
|
591
563
|
updateState();
|
|
592
|
-
// Listen to changes
|
|
593
564
|
const unsubscribe = typeof navigationRef.addListener === 'function'
|
|
594
565
|
? navigationRef.addListener('state', () => {
|
|
595
566
|
updateState();
|
|
@@ -607,11 +578,8 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
607
578
|
const pulseAnim = useRef(new Animated.Value(1)).current;
|
|
608
579
|
const activePulseAnim = useRef(new Animated.Value(0.4)).current;
|
|
609
580
|
const unreadPulseAnim = useRef(new Animated.Value(1)).current;
|
|
610
|
-
// #4 — diagonal light streak sweeping across the floating launcher
|
|
611
581
|
const fabShineAnim = useRef(new Animated.Value(0)).current;
|
|
612
|
-
// #11 — header "clear all" icon spin/scale animation
|
|
613
582
|
const clearAnim = useRef(new Animated.Value(0)).current;
|
|
614
|
-
// #4 — draggable floating launcher (drag anywhere on screen)
|
|
615
583
|
const fabPan = useRef(new Animated.ValueXY({ x: 0, y: 0 })).current;
|
|
616
584
|
const fabPanRef = useRef({ x: 0, y: 0 });
|
|
617
585
|
useEffect(() => {
|
|
@@ -624,8 +592,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
624
592
|
}, [fabPan]);
|
|
625
593
|
const fabDraggedRef = useRef(false);
|
|
626
594
|
const fabPanResponder = useRef(PanResponder.create({
|
|
627
|
-
// Let taps fall through to the launcher; only hijack once the
|
|
628
|
-
// finger actually moves, so onPress still fires on a tap.
|
|
629
595
|
onStartShouldSetPanResponder: () => false,
|
|
630
596
|
onMoveShouldSetPanResponder: (_e, g) => Math.abs(g.dx) > 4 || Math.abs(g.dy) > 4,
|
|
631
597
|
onPanResponderGrant: () => {
|
|
@@ -641,7 +607,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
641
607
|
}),
|
|
642
608
|
onPanResponderRelease: () => {
|
|
643
609
|
fabPan.flattenOffset();
|
|
644
|
-
// small delay so the trailing tap (if any) is ignored
|
|
645
610
|
setTimeout(() => {
|
|
646
611
|
fabDraggedRef.current = false;
|
|
647
612
|
}, 50);
|
|
@@ -651,8 +616,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
651
616
|
fabDraggedRef.current = false;
|
|
652
617
|
},
|
|
653
618
|
})).current;
|
|
654
|
-
// #2 — scroll-to-top button for the main APIs list, always visible at the
|
|
655
|
-
// bottom right of the list.
|
|
656
619
|
const runClearAllWithAnimation = useCallback(() => {
|
|
657
620
|
Animated.sequence([
|
|
658
621
|
Animated.timing(clearAnim, {
|
|
@@ -689,7 +652,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
689
652
|
loop.start();
|
|
690
653
|
return () => loop.stop();
|
|
691
654
|
}, [pulseAnim]);
|
|
692
|
-
// #4 — sweep the shine streak across the launcher, pause, repeat.
|
|
693
655
|
useEffect(() => {
|
|
694
656
|
const loop = Animated.loop(Animated.sequence([
|
|
695
657
|
Animated.timing(fabShineAnim, {
|
|
@@ -741,7 +703,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
741
703
|
}, [unreadPulseAnim]);
|
|
742
704
|
const isNativeModule = useMemo(() => isNativeModuleAvailable(), []);
|
|
743
705
|
const useNativeFab = (Platform.OS === 'ios' || Platform.OS === 'android') && isNativeModule;
|
|
744
|
-
// 100% Native Main-Thread Floating Button Lifecycle
|
|
745
706
|
useEffect(() => {
|
|
746
707
|
if (!useNativeFab || !enabled) {
|
|
747
708
|
if (useNativeFab) {
|
|
@@ -768,7 +729,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
768
729
|
logs.length,
|
|
769
730
|
analyticsEvents.length,
|
|
770
731
|
]);
|
|
771
|
-
// Subscribe to native UI-thread floating button tap events
|
|
772
732
|
useEffect(() => {
|
|
773
733
|
if (!useNativeFab)
|
|
774
734
|
return;
|
|
@@ -779,7 +739,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
779
739
|
unsubscribe();
|
|
780
740
|
};
|
|
781
741
|
}, [useNativeFab]);
|
|
782
|
-
// Subscribe to physical hardware shake events (or Cmd+Ctrl+Z on iOS simulator)
|
|
783
742
|
useEffect(() => {
|
|
784
743
|
if (!useNativeFab)
|
|
785
744
|
return;
|
|
@@ -791,7 +750,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
791
750
|
};
|
|
792
751
|
}, [useNativeFab]);
|
|
793
752
|
const isVisibleRefObj = useRef(visible);
|
|
794
|
-
// #6 — every time the inspector is opened, land on chosen default tab & sync latest logs
|
|
795
753
|
useEffect(() => {
|
|
796
754
|
isVisibleRefObj.current = visible;
|
|
797
755
|
if (visible) {
|
|
@@ -799,7 +757,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
799
757
|
? defaultTab
|
|
800
758
|
: 'apis';
|
|
801
759
|
setActiveTab(target);
|
|
802
|
-
// Instant synchronization of data collected while modal was closed
|
|
803
760
|
if (latestNetworkLogsRef.current.length > 0) {
|
|
804
761
|
const deduped = deduplicateLogs(latestNetworkLogsRef.current);
|
|
805
762
|
const incoming = new Set(deduped.map(l => l.id));
|
|
@@ -855,8 +812,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
855
812
|
setCrashRecords(updated);
|
|
856
813
|
}
|
|
857
814
|
});
|
|
858
|
-
// Sync crashes recorded before this subscription ran (e.g. a render crash
|
|
859
|
-
// during the very first commit, which fires before effects are mounted).
|
|
860
815
|
const pendingCrashes = getCrashRecords();
|
|
861
816
|
if (pendingCrashes.length > 0) {
|
|
862
817
|
pendingCrashes.forEach(c => pushNativeLogRecord('crash', JSON.stringify(c)));
|
|
@@ -872,7 +827,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
872
827
|
if (isNetworkPausedRef.current)
|
|
873
828
|
return;
|
|
874
829
|
if (!isVisibleRef.current)
|
|
875
|
-
return;
|
|
830
|
+
return;
|
|
876
831
|
clearTimeout(timeoutId);
|
|
877
832
|
const updateNetworkState = () => {
|
|
878
833
|
const deduped = deduplicateLogs(raw);
|
|
@@ -913,7 +868,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
913
868
|
timeoutId = setTimeout(updateNetworkState, 250);
|
|
914
869
|
}
|
|
915
870
|
});
|
|
916
|
-
// ─── Analytics subscription ──────────────────────────────────────────────
|
|
917
871
|
let analyticsTimeoutId;
|
|
918
872
|
let isFirstAnalyticsCall = true;
|
|
919
873
|
const unsubscribeAnalytics = subscribeAnalyticsEvents((raw) => {
|
|
@@ -924,7 +878,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
924
878
|
if (isAnalyticsPausedRef.current)
|
|
925
879
|
return;
|
|
926
880
|
if (!isVisibleRef.current)
|
|
927
|
-
return;
|
|
881
|
+
return;
|
|
928
882
|
clearTimeout(analyticsTimeoutId);
|
|
929
883
|
const updateAnalyticsState = () => {
|
|
930
884
|
const incoming = new Set(raw.map(e => e.id));
|
|
@@ -955,7 +909,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
955
909
|
analyticsTimeoutId = setTimeout(updateAnalyticsState, 200);
|
|
956
910
|
}
|
|
957
911
|
});
|
|
958
|
-
// ─── Console subscription ────────────────────────────────────────────────
|
|
959
912
|
let consoleTimeoutId;
|
|
960
913
|
let isFirstConsoleCall = true;
|
|
961
914
|
const unsubscribeConsole = subscribeConsoleLogs((raw) => {
|
|
@@ -966,7 +919,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
966
919
|
if (isConsolePausedRef.current)
|
|
967
920
|
return;
|
|
968
921
|
if (!isVisibleRef.current)
|
|
969
|
-
return;
|
|
922
|
+
return;
|
|
970
923
|
clearTimeout(consoleTimeoutId);
|
|
971
924
|
if (isFirstConsoleCall) {
|
|
972
925
|
isFirstConsoleCall = false;
|
|
@@ -985,7 +938,7 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
985
938
|
}
|
|
986
939
|
const unsubscribeRedux = subscribeReduxState(() => {
|
|
987
940
|
if (!isVisibleRef.current)
|
|
988
|
-
return;
|
|
941
|
+
return;
|
|
989
942
|
const freshState = getReduxState();
|
|
990
943
|
setReduxState(freshState && typeof freshState === 'object' ? { ...freshState } : freshState);
|
|
991
944
|
setReduxLastActionMap({ ...getLastActionForReducer() });
|
|
@@ -1033,7 +986,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1033
986
|
}, [selected]);
|
|
1034
987
|
const filteredLogs = useMemo(() => {
|
|
1035
988
|
let result = logs.filter(log => {
|
|
1036
|
-
// 1. Quick Filter Check (All, Errors, Success, Slow, GET, POST, GraphQL)
|
|
1037
989
|
if (quickFilter && quickFilter !== 'all') {
|
|
1038
990
|
if (quickFilter === 'errors') {
|
|
1039
991
|
const isErr = log.status === 0 ||
|
|
@@ -1066,7 +1018,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1066
1018
|
}
|
|
1067
1019
|
}
|
|
1068
1020
|
}
|
|
1069
|
-
// 2. Status Filter Check (from filters accordion dropdown)
|
|
1070
1021
|
if (statusFilters.size > 0) {
|
|
1071
1022
|
const matched = [...statusFilters].some(f => {
|
|
1072
1023
|
if (f === 'ALL')
|
|
@@ -1082,7 +1033,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1082
1033
|
if (!matched)
|
|
1083
1034
|
return false;
|
|
1084
1035
|
}
|
|
1085
|
-
// 3. Method Filter Check (from filters accordion dropdown)
|
|
1086
1036
|
if (methodFilters.size > 0) {
|
|
1087
1037
|
const matchedMethod = [...methodFilters].some(m => {
|
|
1088
1038
|
if (m === 'ALL')
|
|
@@ -1092,7 +1042,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1092
1042
|
if (!matchedMethod)
|
|
1093
1043
|
return false;
|
|
1094
1044
|
}
|
|
1095
|
-
// 4. Advanced Search Query Engine Check with Scope, Regex and Case-Sensitivity
|
|
1096
1045
|
if (search && search.trim().length > 0) {
|
|
1097
1046
|
const routePath = logRouteMapRef.current.get(log.id)?.path || '';
|
|
1098
1047
|
const isMatch = matchNetworkLogQuery(log, search, routePath, {
|
|
@@ -1108,7 +1057,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1108
1057
|
if (sortOrder === 'oldest') {
|
|
1109
1058
|
result = [...result].reverse();
|
|
1110
1059
|
}
|
|
1111
|
-
// #9 — collapse consecutive identical requests
|
|
1112
1060
|
if (!showDuplicateLogs) {
|
|
1113
1061
|
const collapsed = [];
|
|
1114
1062
|
for (const log of result) {
|
|
@@ -1258,7 +1206,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1258
1206
|
const prevResponseData = prevSameRequest ? prevSameRequest.response : null;
|
|
1259
1207
|
const filteredAnalyticsEvents = useMemo(() => {
|
|
1260
1208
|
let events = analyticsEvents;
|
|
1261
|
-
// Search query filter
|
|
1262
1209
|
if (analyticsSearch && analyticsSearch.trim().length > 0) {
|
|
1263
1210
|
const queryTokens = analyticsSearch.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
1264
1211
|
events = events.filter(e => {
|
|
@@ -1274,14 +1221,12 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1274
1221
|
return queryTokens.every(token => searchTarget.includes(token));
|
|
1275
1222
|
});
|
|
1276
1223
|
}
|
|
1277
|
-
// Category filter
|
|
1278
1224
|
if (analyticsFilters.categories.size > 0 && !analyticsFilters.categories.has('all')) {
|
|
1279
1225
|
events = events.filter(e => {
|
|
1280
1226
|
const cat = getEventCategory(e.name);
|
|
1281
1227
|
return analyticsFilters.categories.has(cat);
|
|
1282
1228
|
});
|
|
1283
1229
|
}
|
|
1284
|
-
// Time window filter
|
|
1285
1230
|
if (analyticsFilters.timeWindow !== 'all') {
|
|
1286
1231
|
const now = Date.now();
|
|
1287
1232
|
const cutoff = analyticsFilters.timeWindow === '1m'
|
|
@@ -1293,11 +1238,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1293
1238
|
: now - 60 * 60 * 1000;
|
|
1294
1239
|
events = events.filter(e => e.timestamp >= cutoff);
|
|
1295
1240
|
}
|
|
1296
|
-
// Source filter
|
|
1297
1241
|
if (analyticsFilters.sources.size > 0 && !analyticsFilters.sources.has('all')) {
|
|
1298
1242
|
events = events.filter(e => analyticsFilters.sources.has(e.source || 'manual'));
|
|
1299
1243
|
}
|
|
1300
|
-
// User identification filter
|
|
1301
1244
|
if (analyticsFilters.userTypes.size > 0 && !analyticsFilters.userTypes.has('all')) {
|
|
1302
1245
|
events = events.filter(e => {
|
|
1303
1246
|
const isIdentified = Boolean(e.userId && e.userId.trim() !== '');
|
|
@@ -1308,7 +1251,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1308
1251
|
return false;
|
|
1309
1252
|
});
|
|
1310
1253
|
}
|
|
1311
|
-
// Payload complexity filter
|
|
1312
1254
|
if (analyticsFilters.payloadComplexity !== 'all') {
|
|
1313
1255
|
if (analyticsFilters.payloadComplexity === 'none') {
|
|
1314
1256
|
events = events.filter(e => !e.params || Object.keys(e.params).length === 0);
|
|
@@ -1320,7 +1262,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1320
1262
|
events = events.filter(e => e.params && Object.keys(e.params).length > 3);
|
|
1321
1263
|
}
|
|
1322
1264
|
}
|
|
1323
|
-
// Conversion / Goal events filter
|
|
1324
1265
|
if (analyticsFilters.onlyConversions) {
|
|
1325
1266
|
const CONVERSION_PATTERNS = [
|
|
1326
1267
|
'purchase',
|
|
@@ -1337,7 +1278,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1337
1278
|
];
|
|
1338
1279
|
events = events.filter(e => CONVERSION_PATTERNS.some(pat => e.name.toLowerCase().includes(pat)));
|
|
1339
1280
|
}
|
|
1340
|
-
// Screen filter
|
|
1341
1281
|
if (analyticsFilters.screens.size > 0) {
|
|
1342
1282
|
events = events.filter(e => {
|
|
1343
1283
|
const scr = e.screenName ||
|
|
@@ -1349,24 +1289,19 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1349
1289
|
return analyticsFilters.screens.has(scr);
|
|
1350
1290
|
});
|
|
1351
1291
|
}
|
|
1352
|
-
// Has Revenue filter
|
|
1353
1292
|
if (analyticsFilters.hasRevenue) {
|
|
1354
1293
|
events = events.filter(e => (e.params?.value != null && !isNaN(Number(e.params.value))) ||
|
|
1355
1294
|
(e.params?.price != null && !isNaN(Number(e.params.price))));
|
|
1356
1295
|
}
|
|
1357
|
-
// Has Items filter
|
|
1358
1296
|
if (analyticsFilters.hasItems) {
|
|
1359
1297
|
events = events.filter(e => Array.isArray(e.params?.items) && e.params.items.length > 0);
|
|
1360
1298
|
}
|
|
1361
|
-
// Has User Props filter
|
|
1362
1299
|
if (analyticsFilters.hasUserProps) {
|
|
1363
1300
|
events = events.filter(e => e.userProperties && Object.keys(e.userProperties).length > 0);
|
|
1364
1301
|
}
|
|
1365
|
-
// Has Params filter
|
|
1366
1302
|
if (analyticsFilters.hasParams) {
|
|
1367
1303
|
events = events.filter(e => e.params && Object.keys(e.params).length > 0);
|
|
1368
1304
|
}
|
|
1369
|
-
// Deduplication
|
|
1370
1305
|
const deduplicatedEvents = [];
|
|
1371
1306
|
for (const e of events) {
|
|
1372
1307
|
if (deduplicatedEvents.length === 0) {
|
|
@@ -1378,7 +1313,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1378
1313
|
JSON.stringify(last.params) === JSON.stringify(e.params) &&
|
|
1379
1314
|
JSON.stringify(last.userProperties) === JSON.stringify(e.userProperties)) {
|
|
1380
1315
|
last.count = (last.count || 1) + 1;
|
|
1381
|
-
// Point to the newest timestamp and id
|
|
1382
1316
|
last.timestamp = e.timestamp;
|
|
1383
1317
|
last.id = e.id;
|
|
1384
1318
|
}
|
|
@@ -1387,11 +1321,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1387
1321
|
}
|
|
1388
1322
|
}
|
|
1389
1323
|
let result = deduplicatedEvents;
|
|
1390
|
-
// Only duplicates filter
|
|
1391
1324
|
if (analyticsFilters.onlyDuplicates) {
|
|
1392
1325
|
result = result.filter(e => (e.count || 1) > 1);
|
|
1393
1326
|
}
|
|
1394
|
-
// Sorting
|
|
1395
1327
|
if (analyticsFilters.sortBy === 'time_asc') {
|
|
1396
1328
|
result = [...result].sort((a, b) => a.timestamp - b.timestamp);
|
|
1397
1329
|
}
|
|
@@ -1409,7 +1341,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1409
1341
|
}, [analyticsEvents, analyticsSearch, analyticsFilters, maxAnalyticsEventsLimit]);
|
|
1410
1342
|
const filteredConsoleLogs = useMemo(() => {
|
|
1411
1343
|
let result = visibleConsoleLogs;
|
|
1412
|
-
// Filters check
|
|
1413
1344
|
if (logFilters.size > 0 && !logFilters.has('all')) {
|
|
1414
1345
|
result = result.filter(log => {
|
|
1415
1346
|
if (logFilters.has(log.type))
|
|
@@ -1422,7 +1353,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1422
1353
|
return false;
|
|
1423
1354
|
});
|
|
1424
1355
|
}
|
|
1425
|
-
// Comprehensive Search bar check
|
|
1426
1356
|
if (logSearch && logSearch.trim().length > 0) {
|
|
1427
1357
|
const queryTokens = logSearch.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
1428
1358
|
result = result.filter(log => {
|
|
@@ -1456,12 +1386,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1456
1386
|
});
|
|
1457
1387
|
});
|
|
1458
1388
|
}
|
|
1459
|
-
// #7 — apply sort order (newest/oldest first)
|
|
1460
1389
|
result = [...result].sort((a, b) => logSortOrder === 'newest'
|
|
1461
1390
|
? b.timestamp - a.timestamp
|
|
1462
1391
|
: a.timestamp - b.timestamp);
|
|
1463
|
-
// #9 — collapse consecutive identical messages into one row with a ×N
|
|
1464
|
-
// counter unless duplicates are explicitly enabled in Settings.
|
|
1465
1392
|
if (!showDuplicateLogs) {
|
|
1466
1393
|
const collapsed = [];
|
|
1467
1394
|
for (const log of result) {
|
|
@@ -1533,11 +1460,9 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1533
1460
|
setMethodFilters(new Set());
|
|
1534
1461
|
prevLogIdsRef.current = new Set();
|
|
1535
1462
|
logRouteMapRef.current = new Map();
|
|
1536
|
-
// Also clear analytics
|
|
1537
1463
|
clearAnalyticsEvents();
|
|
1538
1464
|
setAnalyticsEvents([]);
|
|
1539
1465
|
prevEventIdsRef.current = new Set();
|
|
1540
|
-
// Also clear console logs
|
|
1541
1466
|
clearConsoleLogs();
|
|
1542
1467
|
setConsoleLogs([]);
|
|
1543
1468
|
}
|
|
@@ -1601,7 +1526,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1601
1526
|
]);
|
|
1602
1527
|
return;
|
|
1603
1528
|
}
|
|
1604
|
-
// Default: APIs tab. Only clears NETWORK logs — never touches the other tabs.
|
|
1605
1529
|
if (selectedLogs.size > 0) {
|
|
1606
1530
|
setLogs(prev => prev.filter(l => !selectedLogs.has(l.id)));
|
|
1607
1531
|
setSelectedLogs(new Set());
|
|
@@ -1617,7 +1541,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1617
1541
|
]);
|
|
1618
1542
|
}
|
|
1619
1543
|
}
|
|
1620
|
-
// Clears ONLY network logs + their derived selection/filter state.
|
|
1621
1544
|
function clearNetworkOnly() {
|
|
1622
1545
|
clearNetworkLogs();
|
|
1623
1546
|
setLogs([]);
|
|
@@ -1656,7 +1579,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1656
1579
|
});
|
|
1657
1580
|
}, []);
|
|
1658
1581
|
const contextValue = {
|
|
1659
|
-
// ─── Modal / launcher ───────────────────────────────────────────────
|
|
1660
1582
|
visible,
|
|
1661
1583
|
setVisible,
|
|
1662
1584
|
closeModal,
|
|
@@ -1671,14 +1593,12 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1671
1593
|
setModalAnimationType,
|
|
1672
1594
|
hasNavigationContext,
|
|
1673
1595
|
setNavState,
|
|
1674
|
-
// ─── Tabs ───────────────────────────────────────────────────────────
|
|
1675
1596
|
activeTab,
|
|
1676
1597
|
switchActiveTab,
|
|
1677
1598
|
tabVisibility,
|
|
1678
1599
|
toggleTabVisibility,
|
|
1679
1600
|
lastReadApisCount,
|
|
1680
1601
|
lastReadLogsCount,
|
|
1681
|
-
// ─── Selection / header state ───────────────────────────────────────
|
|
1682
1602
|
selected,
|
|
1683
1603
|
setSelected,
|
|
1684
1604
|
selectedEvent,
|
|
@@ -1695,14 +1615,12 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1695
1615
|
activePulseAnim,
|
|
1696
1616
|
unreadPulseAnim,
|
|
1697
1617
|
runClearAllWithAnimation,
|
|
1698
|
-
// ─── FAB / launcher ─────────────────────────────────────────────────
|
|
1699
1618
|
useNativeFab,
|
|
1700
1619
|
fabPan,
|
|
1701
1620
|
fabPanResponder,
|
|
1702
1621
|
fabDraggedRef,
|
|
1703
1622
|
pulseAnim,
|
|
1704
1623
|
fabShineAnim,
|
|
1705
|
-
// ─── Network (APIs) ─────────────────────────────────────────────────
|
|
1706
1624
|
logs,
|
|
1707
1625
|
filteredLogs,
|
|
1708
1626
|
groupedData,
|
|
@@ -1733,7 +1651,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1733
1651
|
handleDelete,
|
|
1734
1652
|
isNetworkPaused,
|
|
1735
1653
|
setIsNetworkPaused,
|
|
1736
|
-
// ─── Network detail ─────────────────────────────────────────────────
|
|
1737
1654
|
detailTitle,
|
|
1738
1655
|
detailDisplayUrl,
|
|
1739
1656
|
apiDetailActiveTab,
|
|
@@ -1751,7 +1668,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1751
1668
|
prevRequestData,
|
|
1752
1669
|
prevResponseData,
|
|
1753
1670
|
logRouteMapRef,
|
|
1754
|
-
// ─── Console (Logs) ─────────────────────────────────────────────────
|
|
1755
1671
|
consoleLogs,
|
|
1756
1672
|
visibleConsoleLogs,
|
|
1757
1673
|
filteredConsoleLogs,
|
|
@@ -1764,7 +1680,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1764
1680
|
setLogSortOrder,
|
|
1765
1681
|
isConsolePaused,
|
|
1766
1682
|
setIsConsolePaused,
|
|
1767
|
-
// ─── Analytics ──────────────────────────────────────────────────────
|
|
1768
1683
|
analyticsEvents,
|
|
1769
1684
|
filteredAnalyticsEvents,
|
|
1770
1685
|
analyticsSearch,
|
|
@@ -1780,7 +1695,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1780
1695
|
setAnalyticsHeaderExpanded,
|
|
1781
1696
|
isAnalyticsPaused,
|
|
1782
1697
|
setIsAnalyticsPaused,
|
|
1783
|
-
// ─── Redux ──────────────────────────────────────────────────────────
|
|
1784
1698
|
reduxState,
|
|
1785
1699
|
setReduxState,
|
|
1786
1700
|
reduxLastActionMap,
|
|
@@ -1792,7 +1706,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1792
1706
|
setSelectedReduxAction,
|
|
1793
1707
|
reduxActiveSubTab,
|
|
1794
1708
|
setReduxActiveSubTab,
|
|
1795
|
-
// ─── Crash ───────────────────────────────────────────────────────────
|
|
1796
1709
|
crashRecords,
|
|
1797
1710
|
setCrashRecords,
|
|
1798
1711
|
selectedCrash,
|
|
@@ -1805,7 +1718,6 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1805
1718
|
setCrashRecords([]);
|
|
1806
1719
|
setSelectedCrash(null);
|
|
1807
1720
|
},
|
|
1808
|
-
// ─── Settings ───────────────────────────────────────────────────────
|
|
1809
1721
|
settingsActiveSubTab,
|
|
1810
1722
|
setSettingsActiveSubTab,
|
|
1811
1723
|
defaultTab,
|
|
@@ -1840,15 +1752,22 @@ const NetworkInspector = ({ enabled = true, storage, navigationRef, appIcon, env
|
|
|
1840
1752
|
};
|
|
1841
1753
|
const NetworkInspectorWrapper = (props) => {
|
|
1842
1754
|
const enabled = props?.enabled ?? true;
|
|
1755
|
+
const telemetry = props?.telemetry ?? true;
|
|
1843
1756
|
useEffect(() => {
|
|
1844
1757
|
if (!enabled) {
|
|
1845
1758
|
hideNativeFloatingButton().catch(() => { });
|
|
1759
|
+
setTelemetryEnabled(false);
|
|
1760
|
+
}
|
|
1761
|
+
else if (telemetry) {
|
|
1762
|
+
trackActiveTelemetryHeartbeat(true, props?.environment);
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
setTelemetryEnabled(false);
|
|
1846
1766
|
}
|
|
1847
1767
|
return () => {
|
|
1848
1768
|
hideNativeFloatingButton().catch(() => { });
|
|
1849
1769
|
};
|
|
1850
|
-
}, [enabled]);
|
|
1851
|
-
// If enabled is false, return null immediately with 0 overhead
|
|
1770
|
+
}, [enabled, telemetry, props?.environment]);
|
|
1852
1771
|
if (!enabled) {
|
|
1853
1772
|
return null;
|
|
1854
1773
|
}
|
|
@@ -1859,7 +1778,6 @@ const NetworkInspectorWrapper = (props) => {
|
|
|
1859
1778
|
</I18nextProvider>);
|
|
1860
1779
|
};
|
|
1861
1780
|
export default NetworkInspectorWrapper;
|
|
1862
|
-
// Re-export public APIs
|
|
1863
1781
|
export { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, addAxiosInterceptors, } from './customHooks/networkLogger';
|
|
1864
1782
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, } from './customHooks/consoleLogger';
|
|
1865
1783
|
export { setupAnalyticsLogger, logAnalyticsEvent, subscribeAnalyticsEvents, clearAnalyticsEvents, getCurrentUserProperties, getCurrentUserId, getDefaultEventParameters, getCollectionEnabled, } from './customHooks/analyticsLogger';
|