react-native-inapp-inspector 1.1.35 → 2.0.0
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/README.md +123 -101
- package/android/build.gradle +13 -1
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +904 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.kt +17 -0
- package/dist/commonjs/components/CopyButton.js +3 -0
- package/dist/commonjs/components/ErrorBoundary.js +3 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +7 -3
- package/dist/commonjs/components/Inspector/BundleTab.js +1 -1
- package/dist/commonjs/components/Inspector/ConsoleTab.js +1 -1
- package/dist/commonjs/components/Inspector/CrashTab.js +97 -90
- package/dist/commonjs/components/Inspector/InspectorHeader.js +12 -8
- package/dist/commonjs/components/Inspector/MainScreen.js +14 -101
- package/dist/commonjs/components/Inspector/NetworkTab.js +47 -10
- package/dist/commonjs/components/Inspector/PerformanceTab.js +96 -3
- package/dist/commonjs/components/Inspector/ReduxTab.js +18 -10
- package/dist/commonjs/components/Inspector/SettingsPanel.js +342 -88
- package/dist/commonjs/components/Inspector/TabBar.js +6 -3
- package/dist/commonjs/components/NetworkIcons.d.ts +1 -0
- package/dist/commonjs/components/NetworkIcons.js +6 -1
- package/dist/commonjs/components/TouchableScale.d.ts +1 -0
- package/dist/commonjs/components/TouchableScale.js +30 -32
- package/dist/commonjs/constants/index.d.ts +1 -2
- package/dist/commonjs/constants/index.js +4 -0
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.d.ts +4 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +7 -5
- package/dist/commonjs/customHooks/crashHandler.js +7 -0
- package/dist/commonjs/helpers/index.js +10 -1
- package/dist/commonjs/helpers/settingsStore.d.ts +9 -0
- package/dist/commonjs/helpers/settingsStore.js +59 -3
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.js +229 -39
- package/dist/commonjs/native/NativeInspector.d.ts +125 -0
- package/dist/commonjs/native/NativeInspector.js +313 -0
- package/dist/commonjs/native/NativeNetworkInspector.d.ts +22 -0
- package/dist/commonjs/native/NativeNetworkInspector.js +4 -0
- package/dist/commonjs/styles/index.js +6 -6
- package/dist/commonjs/types/enums.d.ts +1 -1
- package/dist/commonjs/types/interfaces.d.ts +9 -0
- package/dist/esm/components/CopyButton.js +3 -0
- package/dist/esm/components/ErrorBoundary.js +3 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +7 -3
- package/dist/esm/components/Inspector/BundleTab.js +1 -1
- package/dist/esm/components/Inspector/ConsoleTab.js +1 -1
- package/dist/esm/components/Inspector/CrashTab.js +97 -90
- package/dist/esm/components/Inspector/InspectorHeader.js +13 -9
- package/dist/esm/components/Inspector/MainScreen.js +15 -69
- package/dist/esm/components/Inspector/NetworkTab.js +47 -10
- package/dist/esm/components/Inspector/PerformanceTab.js +96 -3
- package/dist/esm/components/Inspector/ReduxTab.js +18 -10
- package/dist/esm/components/Inspector/SettingsPanel.js +344 -90
- package/dist/esm/components/Inspector/TabBar.js +7 -4
- package/dist/esm/components/NetworkIcons.d.ts +1 -0
- package/dist/esm/components/NetworkIcons.js +4 -0
- package/dist/esm/components/TouchableScale.d.ts +1 -0
- package/dist/esm/components/TouchableScale.js +31 -33
- package/dist/esm/constants/index.d.ts +1 -2
- package/dist/esm/constants/index.js +4 -0
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.d.ts +4 -0
- package/dist/esm/customHooks/analyticsLogger.js +5 -4
- package/dist/esm/customHooks/crashHandler.js +7 -0
- package/dist/esm/helpers/index.js +10 -1
- package/dist/esm/helpers/settingsStore.d.ts +9 -0
- package/dist/esm/helpers/settingsStore.js +58 -3
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +215 -39
- package/dist/esm/native/NativeInspector.d.ts +125 -0
- package/dist/esm/native/NativeInspector.js +289 -0
- package/dist/esm/native/NativeNetworkInspector.d.ts +22 -0
- package/dist/esm/native/NativeNetworkInspector.js +2 -0
- package/dist/esm/styles/index.js +6 -6
- package/dist/esm/types/enums.d.ts +1 -1
- package/dist/esm/types/interfaces.d.ts +9 -0
- package/ios/NetworkInspectorModule.h +6 -0
- package/ios/NetworkInspectorModule.m +720 -5
- package/package.json +13 -2
- package/react-native-inapp-inspector.podspec +7 -2
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +0 -97
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +0 -28
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "
|
|
1
|
+
export declare const LIB_VERSION = "2.0.0";
|
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LIB_VERSION = void 0;
|
|
4
4
|
// AUTO-GENERATED FILE — do not edit by hand.
|
|
5
5
|
// Regenerated from package.json on every build by scripts/gen-version.js.
|
|
6
|
-
exports.LIB_VERSION = '
|
|
6
|
+
exports.LIB_VERSION = '2.0.0';
|
|
@@ -17,6 +17,10 @@ export declare const getCollectionEnabled: () => boolean;
|
|
|
17
17
|
* Useful for custom analytics wrappers or testing.
|
|
18
18
|
*/
|
|
19
19
|
export declare const logAnalyticsEvent: (name: string, params?: Record<string, any>, userProperties?: Record<string, any>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Returns true if analytics logging is active (always ready for custom and Firebase events).
|
|
22
|
+
*/
|
|
20
23
|
export declare const isAnalyticsConnected: () => boolean;
|
|
24
|
+
export declare const isFirebaseAnalyticsPatched: () => boolean;
|
|
21
25
|
export declare const setupAnalyticsLogger: (analyticsInstance: any) => void;
|
|
22
26
|
export declare const autoSetupAnalyticsLogger: () => boolean;
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// setUserId(id)
|
|
23
23
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.isAnalyticsConnected = exports.logAnalyticsEvent = exports.getCollectionEnabled = exports.getDefaultEventParameters = exports.getCurrentUserId = exports.getCurrentUserProperties = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = exports.getAnalyticsModuleEnabled = exports.setAnalyticsModuleEnabled = void 0;
|
|
25
|
+
exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.isFirebaseAnalyticsPatched = exports.isAnalyticsConnected = exports.logAnalyticsEvent = exports.getCollectionEnabled = exports.getDefaultEventParameters = exports.getCurrentUserId = exports.getCurrentUserProperties = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = exports.getAnalyticsModuleEnabled = exports.setAnalyticsModuleEnabled = void 0;
|
|
26
26
|
// ─── Internal state ───────────────────────────────────────────────────────────
|
|
27
27
|
let events = [];
|
|
28
28
|
let listeners = [];
|
|
@@ -107,11 +107,13 @@ exports.logAnalyticsEvent = logAnalyticsEvent;
|
|
|
107
107
|
* setupAnalyticsLogger(analytics());
|
|
108
108
|
*/
|
|
109
109
|
let isAnalyticsPatched = false;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
/**
|
|
111
|
+
* Returns true if analytics logging is active (always ready for custom and Firebase events).
|
|
112
|
+
*/
|
|
113
|
+
const isAnalyticsConnected = () => true;
|
|
114
114
|
exports.isAnalyticsConnected = isAnalyticsConnected;
|
|
115
|
+
const isFirebaseAnalyticsPatched = () => isAnalyticsPatched;
|
|
116
|
+
exports.isFirebaseAnalyticsPatched = isFirebaseAnalyticsPatched;
|
|
115
117
|
const setupAnalyticsLogger = (analyticsInstance) => {
|
|
116
118
|
if (!analyticsInstance) {
|
|
117
119
|
console.warn('[AnalyticsLogger] No analytics instance provided — skipping setup.');
|
|
@@ -5,6 +5,7 @@ const react_native_1 = require("react-native");
|
|
|
5
5
|
const enums_1 = require("../types/enums");
|
|
6
6
|
Object.defineProperty(exports, "CrashExportFormat", { enumerable: true, get: function () { return enums_1.CrashExportFormat; } });
|
|
7
7
|
const consoleLogger_1 = require("./consoleLogger");
|
|
8
|
+
const NativeInspector_1 = require("../native/NativeInspector");
|
|
8
9
|
const i18n_1 = require("../i18n");
|
|
9
10
|
let crashListeners = [];
|
|
10
11
|
let isCrashHandlerInitialized = false;
|
|
@@ -384,6 +385,12 @@ const handleInterceptedCrash = (errorOrTitle, rawStack, isFatal = false, customT
|
|
|
384
385
|
logId: log?.id,
|
|
385
386
|
crashRecord,
|
|
386
387
|
});
|
|
388
|
+
// Ensure native floating icon is visible & badged even if React UI is broken
|
|
389
|
+
try {
|
|
390
|
+
(0, NativeInspector_1.showNativeFloatingButton)();
|
|
391
|
+
(0, NativeInspector_1.setNativeFloatingButtonBadge)(true);
|
|
392
|
+
}
|
|
393
|
+
catch { }
|
|
387
394
|
return crashRecord;
|
|
388
395
|
}
|
|
389
396
|
catch (err) {
|
|
@@ -173,9 +173,18 @@ exports.getFetchCommand = getFetchCommand;
|
|
|
173
173
|
const deduplicateLogs = (raw) => {
|
|
174
174
|
const map = new Map();
|
|
175
175
|
raw.forEach(entry => {
|
|
176
|
-
if (!map.has(entry.id)
|
|
176
|
+
if (!map.has(entry.id)) {
|
|
177
177
|
map.set(entry.id, entry);
|
|
178
178
|
}
|
|
179
|
+
else {
|
|
180
|
+
const existing = map.get(entry.id);
|
|
181
|
+
if (existing.status == null && entry.status != null) {
|
|
182
|
+
map.set(entry.id, entry);
|
|
183
|
+
}
|
|
184
|
+
else if ((entry.startTime ?? 0) >= (existing.startTime ?? 0)) {
|
|
185
|
+
map.set(entry.id, entry);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
179
188
|
});
|
|
180
189
|
return Array.from(map.values()).sort((a, b) => b.id - a.id);
|
|
181
190
|
};
|
|
@@ -6,3 +6,12 @@ export declare function saveSettings(settings: PersistedSettings): void;
|
|
|
6
6
|
export declare function clearPersistedSettings(): Promise<void>;
|
|
7
7
|
export declare const isPersistentStorageAvailable: () => boolean;
|
|
8
8
|
export declare function getCustomStorage(): InspectorStorage | null;
|
|
9
|
+
export interface RamLimitsProfile {
|
|
10
|
+
maxNetworkLogs: number;
|
|
11
|
+
maxConsoleLogs: number;
|
|
12
|
+
maxAnalyticsEvents: number;
|
|
13
|
+
maxCrashRecords: number;
|
|
14
|
+
profileName: 'High-End' | 'Standard' | 'Compact' | 'Ultra-Light';
|
|
15
|
+
freeRamMb: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function calculateRamBasedLimits(freeRamMb: number): RamLimitsProfile;
|
|
@@ -10,7 +10,9 @@ exports.loadSettings = loadSettings;
|
|
|
10
10
|
exports.saveSettings = saveSettings;
|
|
11
11
|
exports.clearPersistedSettings = clearPersistedSettings;
|
|
12
12
|
exports.getCustomStorage = getCustomStorage;
|
|
13
|
+
exports.calculateRamBasedLimits = calculateRamBasedLimits;
|
|
13
14
|
const react_native_1 = require("react-native");
|
|
15
|
+
const NativeInspector_1 = require("../native/NativeInspector");
|
|
14
16
|
// In-memory fallback (settings survive for the app session only).
|
|
15
17
|
const memory = new Map();
|
|
16
18
|
let customStorage = null;
|
|
@@ -27,6 +29,13 @@ async function loadSettings() {
|
|
|
27
29
|
const parsed = JSON.parse(raw);
|
|
28
30
|
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
29
31
|
}
|
|
32
|
+
if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
|
|
33
|
+
const raw = await (0, NativeInspector_1.getNativeStorageItem)(SETTINGS_KEY);
|
|
34
|
+
if (raw) {
|
|
35
|
+
const parsed = JSON.parse(raw);
|
|
36
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
30
39
|
if (react_native_1.Platform.OS === 'ios') {
|
|
31
40
|
const raw = react_native_1.Settings.get(SETTINGS_KEY);
|
|
32
41
|
if (!raw)
|
|
@@ -37,7 +46,7 @@ async function loadSettings() {
|
|
|
37
46
|
}
|
|
38
47
|
return raw && typeof raw === 'object' ? raw : {};
|
|
39
48
|
}
|
|
40
|
-
//
|
|
49
|
+
// In-memory fallback
|
|
41
50
|
const raw = memory.get(SETTINGS_KEY);
|
|
42
51
|
if (!raw)
|
|
43
52
|
return {};
|
|
@@ -55,11 +64,13 @@ function saveSettings(settings) {
|
|
|
55
64
|
customStorage.setItem(SETTINGS_KEY, raw);
|
|
56
65
|
return;
|
|
57
66
|
}
|
|
67
|
+
if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
|
|
68
|
+
(0, NativeInspector_1.setNativeStorageItem)(SETTINGS_KEY, raw);
|
|
69
|
+
}
|
|
58
70
|
if (react_native_1.Platform.OS === 'ios') {
|
|
59
71
|
react_native_1.Settings.set({ [SETTINGS_KEY]: raw });
|
|
60
72
|
return;
|
|
61
73
|
}
|
|
62
|
-
// Android/fallback: memory
|
|
63
74
|
memory.set(SETTINGS_KEY, raw);
|
|
64
75
|
}
|
|
65
76
|
catch {
|
|
@@ -77,6 +88,9 @@ async function clearPersistedSettings() {
|
|
|
77
88
|
}
|
|
78
89
|
return;
|
|
79
90
|
}
|
|
91
|
+
if ((0, NativeInspector_1.isNativeModuleAvailable)()) {
|
|
92
|
+
await (0, NativeInspector_1.setNativeStorageItem)(SETTINGS_KEY, null);
|
|
93
|
+
}
|
|
80
94
|
if (react_native_1.Platform.OS === 'ios') {
|
|
81
95
|
react_native_1.Settings.set({ [SETTINGS_KEY]: null });
|
|
82
96
|
return;
|
|
@@ -88,9 +102,51 @@ async function clearPersistedSettings() {
|
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
104
|
const isPersistentStorageAvailable = () => {
|
|
91
|
-
return customStorage !== null || react_native_1.Platform.OS === 'ios';
|
|
105
|
+
return customStorage !== null || (0, NativeInspector_1.isNativeModuleAvailable)() || react_native_1.Platform.OS === 'ios';
|
|
92
106
|
};
|
|
93
107
|
exports.isPersistentStorageAvailable = isPersistentStorageAvailable;
|
|
94
108
|
function getCustomStorage() {
|
|
95
109
|
return customStorage;
|
|
96
110
|
}
|
|
111
|
+
function calculateRamBasedLimits(freeRamMb) {
|
|
112
|
+
if (freeRamMb >= 3000) {
|
|
113
|
+
return {
|
|
114
|
+
maxNetworkLogs: 1000,
|
|
115
|
+
maxConsoleLogs: 1500,
|
|
116
|
+
maxAnalyticsEvents: 500,
|
|
117
|
+
maxCrashRecords: 100,
|
|
118
|
+
profileName: 'High-End',
|
|
119
|
+
freeRamMb,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
else if (freeRamMb >= 1500) {
|
|
123
|
+
return {
|
|
124
|
+
maxNetworkLogs: 500,
|
|
125
|
+
maxConsoleLogs: 750,
|
|
126
|
+
maxAnalyticsEvents: 250,
|
|
127
|
+
maxCrashRecords: 50,
|
|
128
|
+
profileName: 'Standard',
|
|
129
|
+
freeRamMb,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
else if (freeRamMb >= 600) {
|
|
133
|
+
return {
|
|
134
|
+
maxNetworkLogs: 200,
|
|
135
|
+
maxConsoleLogs: 300,
|
|
136
|
+
maxAnalyticsEvents: 100,
|
|
137
|
+
maxCrashRecords: 25,
|
|
138
|
+
profileName: 'Compact',
|
|
139
|
+
freeRamMb,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return {
|
|
144
|
+
maxNetworkLogs: 100,
|
|
145
|
+
maxConsoleLogs: 150,
|
|
146
|
+
maxAnalyticsEvents: 50,
|
|
147
|
+
maxCrashRecords: 15,
|
|
148
|
+
profileName: 'Ultra-Light',
|
|
149
|
+
freeRamMb,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export { connectReduxStore, inspectorReduxMiddleware, getReduxState, subscribeRe
|
|
|
12
12
|
export { getEventCategory, registerGAPlugin, type GAPlugin, } from './helpers/gaAnalyticsRegistry';
|
|
13
13
|
export { usePerformanceTracker, useComponentProfiler, useNavigationProfiler, trackComponentRender, trackNavigationTransition, trackHeavyTask, measureAsync, getHermesMemoryStats, registerComponentProfile, subscribeRenderProfiles, getRenderProfiles, logPerformanceEvent, clearPerformanceEvents, subscribePerformanceEvents, getPerformanceEvents, getInitialRenderProfiles, getInitialPerformanceEvents, generateFixSnippet, } from './customHooks/performanceTracker';
|
|
14
14
|
export { InspectLog, InspectTrackTime, InspectCatch, type InspectLogOptions, } from './decorators';
|
|
15
|
+
export { getNativeDeviceMetrics, enableNativeCrashProtection, subscribeNativeCrashes, showNativeFloatingButton, hideNativeFloatingButton, setNativeFloatingButtonBadge, subscribeNativeFloatingButtonPress, subscribeNativeDeviceShake, startNativeFpsMonitoring, stopNativeFpsMonitoring, getNativeFpsMetrics, getNativeStorageItem, setNativeStorageItem, isNativeModuleAvailable, type NativeDeviceMetrics, type NativeCrashEvent, type FloatingButtonOptions, type NativeFpsMetrics, } from './native/NativeInspector';
|
|
15
16
|
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|