react-native-inapp-inspector 1.1.25 → 1.1.26
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/android/build.gradle +36 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.java +114 -0
- package/android/src/main/java/com/inappinspector/NetworkInspectorPackage.java +28 -0
- package/dist/commonjs/components/ErrorBoundary.d.ts +1 -1
- package/dist/commonjs/components/ErrorBoundary.js +9 -145
- package/dist/commonjs/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashDetail.js +796 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +597 -0
- package/dist/commonjs/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/CrashTab.js +727 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +52 -23
- package/dist/commonjs/components/Inspector/LogDetail.js +4 -3
- package/dist/commonjs/components/Inspector/MainScreen.js +12 -3
- package/dist/commonjs/components/Inspector/SettingsPanel.js +90 -1
- package/dist/commonjs/components/Inspector/TabBar.js +15 -3
- package/dist/commonjs/components/NetworkIcons.d.ts +11 -0
- package/dist/commonjs/components/NetworkIcons.js +96 -1
- package/dist/commonjs/components/SegmentedTabs.js +2 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/analyticsLogger.js +70 -44
- package/dist/commonjs/customHooks/consoleLogger.d.ts +1 -0
- package/dist/commonjs/customHooks/consoleLogger.js +70 -6
- package/dist/commonjs/customHooks/crashHandler.d.ts +64 -0
- package/dist/commonjs/customHooks/crashHandler.js +681 -0
- package/dist/commonjs/customHooks/networkLogger.js +64 -48
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -1
- package/dist/commonjs/i18n/locales/en.json +131 -0
- package/dist/commonjs/index.d.ts +3 -1
- package/dist/commonjs/index.js +95 -1
- package/dist/commonjs/types/enums.d.ts +41 -0
- package/dist/commonjs/types/enums.js +37 -1
- package/dist/commonjs/types/interfaces.d.ts +51 -1
- package/dist/esm/components/ErrorBoundary.d.ts +1 -1
- package/dist/esm/components/ErrorBoundary.js +10 -113
- package/dist/esm/components/Inspector/CrashDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashDetail.js +758 -0
- package/dist/esm/components/Inspector/CrashFilterModal.d.ts +20 -0
- package/dist/esm/components/Inspector/CrashFilterModal.js +557 -0
- package/dist/esm/components/Inspector/CrashTab.d.ts +3 -0
- package/dist/esm/components/Inspector/CrashTab.js +689 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +52 -23
- package/dist/esm/components/Inspector/LogDetail.js +4 -3
- package/dist/esm/components/Inspector/MainScreen.js +12 -3
- package/dist/esm/components/Inspector/SettingsPanel.js +91 -2
- package/dist/esm/components/Inspector/TabBar.js +16 -4
- package/dist/esm/components/NetworkIcons.d.ts +11 -0
- package/dist/esm/components/NetworkIcons.js +83 -0
- package/dist/esm/components/SegmentedTabs.js +2 -1
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/analyticsLogger.js +70 -44
- package/dist/esm/customHooks/consoleLogger.d.ts +1 -0
- package/dist/esm/customHooks/consoleLogger.js +68 -5
- package/dist/esm/customHooks/crashHandler.d.ts +64 -0
- package/dist/esm/customHooks/crashHandler.js +659 -0
- package/dist/esm/customHooks/networkLogger.js +64 -48
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -1
- package/dist/esm/i18n/locales/en.json +131 -0
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +73 -1
- package/dist/esm/types/enums.d.ts +41 -0
- package/dist/esm/types/enums.js +36 -0
- package/dist/esm/types/interfaces.d.ts +51 -1
- package/ios/NetworkInspectorModule.h +6 -0
- package/ios/NetworkInspectorModule.m +125 -0
- package/package.json +5 -2
- package/react-native-inapp-inspector.podspec +18 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { setupGlobalCrashHandler } from "./crashHandler";
|
|
2
3
|
let logs = [];
|
|
3
4
|
let listeners = [];
|
|
4
5
|
let counter = 0;
|
|
@@ -142,65 +143,76 @@ export const setupNetworkLogger = () => {
|
|
|
142
143
|
const finalUrl = typeof url === "string" ? url : url?.url;
|
|
143
144
|
if (shouldIgnoreUrl(finalUrl))
|
|
144
145
|
return originalFetch(url, options);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
addOrUpdateLog({
|
|
148
|
-
id,
|
|
149
|
-
url: finalUrl,
|
|
150
|
-
method,
|
|
151
|
-
startTime: start,
|
|
152
|
-
caller,
|
|
153
|
-
request: method === "GET" ? undefined : parseRequestData(options?.body),
|
|
154
|
-
requestHeaders,
|
|
155
|
-
});
|
|
146
|
+
let caller = "Unknown";
|
|
147
|
+
let requestHeaders;
|
|
156
148
|
try {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const responseHeaders = normaliseHeaders(response.headers);
|
|
160
|
-
let data = null;
|
|
161
|
-
const contentType = responseHeaders?.["content-type"] ||
|
|
162
|
-
responseHeaders?.["Content-Type"] ||
|
|
163
|
-
"";
|
|
164
|
-
if (contentType.includes("image/")) {
|
|
165
|
-
data = "[Image Data]";
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
try {
|
|
169
|
-
const clone = response.clone();
|
|
170
|
-
const text = await clone.text();
|
|
171
|
-
try {
|
|
172
|
-
data = JSON.parse(text);
|
|
173
|
-
}
|
|
174
|
-
catch {
|
|
175
|
-
data = text;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
catch { }
|
|
179
|
-
}
|
|
149
|
+
requestHeaders = normaliseHeaders(options?.headers);
|
|
150
|
+
caller = getCallerFromStack(); // ✅ Capture call line
|
|
180
151
|
addOrUpdateLog({
|
|
181
152
|
id,
|
|
182
153
|
url: finalUrl,
|
|
183
154
|
method,
|
|
184
|
-
status: response.status,
|
|
185
|
-
response: data,
|
|
186
|
-
duration,
|
|
187
155
|
startTime: start,
|
|
188
156
|
caller,
|
|
189
|
-
|
|
157
|
+
request: method === "GET" ? undefined : parseRequestData(options?.body),
|
|
158
|
+
requestHeaders,
|
|
190
159
|
});
|
|
160
|
+
}
|
|
161
|
+
catch { }
|
|
162
|
+
try {
|
|
163
|
+
const response = await originalFetch(url, options);
|
|
164
|
+
const duration = Date.now() - start;
|
|
165
|
+
try {
|
|
166
|
+
const responseHeaders = normaliseHeaders(response.headers);
|
|
167
|
+
let data = null;
|
|
168
|
+
const contentType = responseHeaders?.["content-type"] ||
|
|
169
|
+
responseHeaders?.["Content-Type"] ||
|
|
170
|
+
"";
|
|
171
|
+
if (contentType.includes("image/")) {
|
|
172
|
+
data = "[Image Data]";
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
try {
|
|
176
|
+
const clone = response.clone();
|
|
177
|
+
const text = await clone.text();
|
|
178
|
+
try {
|
|
179
|
+
data = JSON.parse(text);
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
data = text;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch { }
|
|
186
|
+
}
|
|
187
|
+
addOrUpdateLog({
|
|
188
|
+
id,
|
|
189
|
+
url: finalUrl,
|
|
190
|
+
method,
|
|
191
|
+
status: response.status,
|
|
192
|
+
response: data,
|
|
193
|
+
duration,
|
|
194
|
+
startTime: start,
|
|
195
|
+
caller,
|
|
196
|
+
responseHeaders,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
catch { }
|
|
191
200
|
return response;
|
|
192
201
|
}
|
|
193
202
|
catch (error) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
try {
|
|
204
|
+
addOrUpdateLog({
|
|
205
|
+
id,
|
|
206
|
+
url: finalUrl,
|
|
207
|
+
method,
|
|
208
|
+
status: 0,
|
|
209
|
+
startTime: start,
|
|
210
|
+
response: error,
|
|
211
|
+
caller,
|
|
212
|
+
duration: Date.now() - start,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
catch { }
|
|
204
216
|
throw error;
|
|
205
217
|
}
|
|
206
218
|
};
|
|
@@ -222,6 +234,10 @@ export const setupNetworkLogger = () => {
|
|
|
222
234
|
catch (_e) {
|
|
223
235
|
// Axios not available — fetch-only mode
|
|
224
236
|
}
|
|
237
|
+
try {
|
|
238
|
+
setupGlobalCrashHandler();
|
|
239
|
+
}
|
|
240
|
+
catch { }
|
|
225
241
|
globalThis.__NETWORK_LOGGER_INITIALIZED__ = true;
|
|
226
242
|
};
|
|
227
243
|
// ─── Axios interceptor helper ─────────────────────────────────────────────────
|
|
@@ -118,7 +118,7 @@ tryInspectRuntimeFirebaseAnalytics();
|
|
|
118
118
|
* 4. Semantic pattern & prefix analysis
|
|
119
119
|
*/
|
|
120
120
|
export const getEventCategory = (name, params) => {
|
|
121
|
-
if (!name)
|
|
121
|
+
if (!name || typeof name !== 'string')
|
|
122
122
|
return 'custom';
|
|
123
123
|
const cleanName = name.trim().toLowerCase();
|
|
124
124
|
// 1. Run through registered dynamic plugins
|
|
@@ -582,5 +582,136 @@
|
|
|
582
582
|
"retry": "Try Again",
|
|
583
583
|
"reset": "Reset",
|
|
584
584
|
"close": "Close"
|
|
585
|
+
},
|
|
586
|
+
"crash": {
|
|
587
|
+
"title": "Crash",
|
|
588
|
+
"searchPlaceholder": "Search error, message, stack...",
|
|
589
|
+
"searchDetailPlaceholder": "Search in trace or JSON...",
|
|
590
|
+
"statCrashes": "Crashes",
|
|
591
|
+
"statFatal": "Fatal",
|
|
592
|
+
"statJsErrors": "JS Errors",
|
|
593
|
+
"statPromises": "Promises",
|
|
594
|
+
"statRender": "Render",
|
|
595
|
+
"statNative": "Native",
|
|
596
|
+
"filterAll": "All",
|
|
597
|
+
"filterFatal": "Fatal",
|
|
598
|
+
"filterJsError": "JS Error",
|
|
599
|
+
"filterPromise": "Promise",
|
|
600
|
+
"filterRender": "Render",
|
|
601
|
+
"filterNative": "Native",
|
|
602
|
+
"fatalBadge": "FATAL",
|
|
603
|
+
"handledBadge": "HANDLED",
|
|
604
|
+
"fatalCrash": "FATAL CRASH",
|
|
605
|
+
"handledException": "HANDLED EXCEPTION",
|
|
606
|
+
"unknownException": "Unknown Exception",
|
|
607
|
+
"report": "Report",
|
|
608
|
+
"inspect": "Inspect",
|
|
609
|
+
"copyReport": "Copy Report",
|
|
610
|
+
"copied": "Copied",
|
|
611
|
+
"clearTitle": "Clear Crash History",
|
|
612
|
+
"clearMessage": "Are you sure you want to clear all intercepted crash records?",
|
|
613
|
+
"clearCancel": "Cancel",
|
|
614
|
+
"clearConfirm": "Clear All",
|
|
615
|
+
"emptyTitle": "Zero Crashes Detected",
|
|
616
|
+
"emptySubtitle": "Global crash guard is active. All native and JavaScript exceptions are intercepted and protected.",
|
|
617
|
+
"emptySearchSubtitle": "No crash entries matched your search query.",
|
|
618
|
+
"tabStack": "Stack ({{count}})",
|
|
619
|
+
"tabDiagnostics": "Diagnostics",
|
|
620
|
+
"tabTrail": "Trail ({{count}})",
|
|
621
|
+
"tabRawJson": "Raw JSON",
|
|
622
|
+
"appFrames": "App Frames ({{count}})",
|
|
623
|
+
"allFrames": "All Frames ({{count}})",
|
|
624
|
+
"frameApp": "APP",
|
|
625
|
+
"frameLib": "LIB",
|
|
626
|
+
"anonymous": "<anonymous>",
|
|
627
|
+
"noStackTrace": "No stack trace captured for this event.",
|
|
628
|
+
"deviceEnvironment": "Device & Environment",
|
|
629
|
+
"platform": "Platform",
|
|
630
|
+
"osVersion": "OS Version",
|
|
631
|
+
"reactNative": "React Native",
|
|
632
|
+
"jsEngine": "JS Engine",
|
|
633
|
+
"hermesEngine": "Hermes Engine",
|
|
634
|
+
"jsc": "JSC",
|
|
635
|
+
"architecture": "Architecture",
|
|
636
|
+
"fabricNewArch": "Fabric (New Arch)",
|
|
637
|
+
"paperLegacy": "Paper (Legacy)",
|
|
638
|
+
"appState": "App State",
|
|
639
|
+
"jsHeapMemory": "JS Heap Memory",
|
|
640
|
+
"usedHeap": "Used Heap",
|
|
641
|
+
"totalHeap": "Total Heap",
|
|
642
|
+
"noBreadcrumbs": "No breadcrumb events recorded prior to this crash.",
|
|
643
|
+
"simNativeMessage": "Simulated native fatal exception",
|
|
644
|
+
"simPromiseMessage": "Simulated unhandled promise rejection",
|
|
645
|
+
"simRenderMessage": "Simulated React component render error",
|
|
646
|
+
"simJsMessage": "Simulated JavaScript exception",
|
|
647
|
+
"reportTitle": "CRASH DIAGNOSTIC REPORT",
|
|
648
|
+
"reportErrorName": "Error Name:",
|
|
649
|
+
"reportMessage": "Message:",
|
|
650
|
+
"reportType": "Type:",
|
|
651
|
+
"reportFatalYes": "YES (Fatal)",
|
|
652
|
+
"reportFatalNo": "NO (Caught/Handled)",
|
|
653
|
+
"reportFatal": "Fatal:",
|
|
654
|
+
"reportTimestamp": "Timestamp:",
|
|
655
|
+
"reportUptime": "App Uptime:",
|
|
656
|
+
"reportUptimeValue": "{{seconds}} seconds",
|
|
657
|
+
"reportPlatform": "Platform:",
|
|
658
|
+
"reportReactNative": "React Native:",
|
|
659
|
+
"reportHermes": "Hermes:",
|
|
660
|
+
"reportEnabled": "Enabled",
|
|
661
|
+
"reportDisabled": "Disabled",
|
|
662
|
+
"reportArchitecture": "Architecture:",
|
|
663
|
+
"reportFabricNew": "Fabric (New)",
|
|
664
|
+
"reportPaperLegacy": "Paper (Legacy)",
|
|
665
|
+
"reportScreenSize": "Screen Size:",
|
|
666
|
+
"reportAppState": "App State:",
|
|
667
|
+
"reportJsMemory": "JS Memory:",
|
|
668
|
+
"reportStackTrace": "STACK TRACE:",
|
|
669
|
+
"reportNoStackTrace": "No stack trace available",
|
|
670
|
+
"reportComponentHierarchy": "COMPONENT HIERARCHY:",
|
|
671
|
+
"reportRecentBreadcrumbs": "RECENT BREADCRUMBS:",
|
|
672
|
+
"mdReportTitle": "🚨 Crash Report: {{name}}",
|
|
673
|
+
"mdStackTrace": "📦 Stack Trace",
|
|
674
|
+
"mdComponentHierarchy": "🌲 Component Hierarchy",
|
|
675
|
+
"mdRecentBreadcrumbs": "👣 Recent Breadcrumbs",
|
|
676
|
+
"mdSeverityFatal": "FATAL",
|
|
677
|
+
"mdSeverityHandled": "HANDLED",
|
|
678
|
+
"breadcrumbNavigation": "Navigated from \"{{from}}\" to \"{{to}}\"",
|
|
679
|
+
"breadcrumbAction": "Action: {{actionType}}",
|
|
680
|
+
"unknown": "Unknown",
|
|
681
|
+
"runtimeException": "Runtime Exception",
|
|
682
|
+
"logFatalCrash": "Fatal Crash",
|
|
683
|
+
"logUnhandledError": "Unhandled Error",
|
|
684
|
+
"errorNameFatal": "FatalError",
|
|
685
|
+
"errorNameUnhandled": "UnhandledException",
|
|
686
|
+
"nativeCrashTitle": "Native Crash",
|
|
687
|
+
"nativeUncaughtException": "Native Uncaught Exception",
|
|
688
|
+
"nativeException": "Native Exception",
|
|
689
|
+
"unhandledPromiseRejection": "Unhandled Promise Rejection",
|
|
690
|
+
"filterTitle": "Crash Filters",
|
|
691
|
+
"filterSubtitle": "Diagnostics & Reports",
|
|
692
|
+
"filterReset": "Reset All",
|
|
693
|
+
"filterTypeSection": "CRASH TYPE",
|
|
694
|
+
"filterTypeAll": "All Types",
|
|
695
|
+
"filterTimeSection": "TIME HORIZON",
|
|
696
|
+
"filterTimeAll": "All Time",
|
|
697
|
+
"filterTime15m": "Last 15 mins",
|
|
698
|
+
"filterTime1h": "Last 1 hour",
|
|
699
|
+
"filterTime24h": "Last 24 hours",
|
|
700
|
+
"filterTime7d": "Last 7 days",
|
|
701
|
+
"filterPlatformSection": "PLATFORM",
|
|
702
|
+
"filterPlatformAll": "All Platforms",
|
|
703
|
+
"filterPlatformIos": "iOS",
|
|
704
|
+
"filterPlatformAndroid": "Android",
|
|
705
|
+
"filterEngineSection": "JS ENGINE",
|
|
706
|
+
"filterEngineAll": "All Engines",
|
|
707
|
+
"filterEngineHermes": "Hermes",
|
|
708
|
+
"filterSortSection": "SORT ORDER",
|
|
709
|
+
"filterSortNewest": "Newest First (Default)",
|
|
710
|
+
"filterSortOldest": "Oldest First",
|
|
711
|
+
"filterDiscard": "Discard",
|
|
712
|
+
"filterApply": "Apply ({{count}} Crashes)",
|
|
713
|
+
"frameCopy": "Copy",
|
|
714
|
+
"frameCopied": "Copied",
|
|
715
|
+
"componentHierarchy": "Component Hierarchy"
|
|
585
716
|
}
|
|
586
717
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export default NetworkInspectorWrapper;
|
|
|
5
5
|
export { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, addAxiosInterceptors, } from './customHooks/networkLogger';
|
|
6
6
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, } from './customHooks/consoleLogger';
|
|
7
7
|
export { setupAnalyticsLogger, logAnalyticsEvent, subscribeAnalyticsEvents, clearAnalyticsEvents, getCurrentUserProperties, getCurrentUserId, getDefaultEventParameters, getCollectionEnabled, } from './customHooks/analyticsLogger';
|
|
8
|
+
export { setupGlobalCrashHandler, subscribeCrashEvents, emitCrashEvent, getCrashRecords, clearCrashRecords, simulateTestCrash, exportCrashReport, parseCrashStackTrace, recordCustomCrash, addCrashBreadcrumb, recordNavigationBreadcrumb, recordNetworkBreadcrumb, recordReduxBreadcrumb, recordUserActionBreadcrumb, computeCrashFingerprint, type CrashEventPayload, } from './customHooks/crashHandler';
|
|
9
|
+
export { default as CrashTab } from './components/Inspector/CrashTab';
|
|
8
10
|
export { default as ErrorBoundary } from './components/ErrorBoundary';
|
|
9
11
|
export { connectReduxStore, inspectorReduxMiddleware, getReduxState, subscribeReduxState, getActionHistory, clearActionHistory, getLastActionForReducer, } from './customHooks/reduxLogger';
|
|
10
12
|
export { getEventCategory, registerGAPlugin, type GAPlugin, } from './helpers/gaAnalyticsRegistry';
|
|
11
13
|
export { usePerformanceTracker, logPerformanceEvent, clearPerformanceEvents, subscribePerformanceEvents, getPerformanceEvents, } from './customHooks/performanceTracker';
|
|
12
14
|
export { InspectLog, InspectTrackTime, InspectCatch, type InspectLogOptions, } from './decorators';
|
|
13
|
-
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, } from './types';
|
|
15
|
+
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|
package/dist/esm/index.js
CHANGED
|
@@ -16,6 +16,8 @@ import { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, } from './c
|
|
|
16
16
|
// Console
|
|
17
17
|
import { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, } from './customHooks/consoleLogger';
|
|
18
18
|
import { IGNORED_LOG_PREFIXES } from './customHooks/logFilters';
|
|
19
|
+
// Crash Protection
|
|
20
|
+
import { setupGlobalCrashHandler, subscribeCrashEvents, getCrashRecords, clearCrashRecords, setMaxCrashLogsLimit, } from './customHooks/crashHandler';
|
|
19
21
|
import { subscribeAnalyticsEvents, clearAnalyticsEvents, autoSetupAnalyticsLogger, } from './customHooks/analyticsLogger';
|
|
20
22
|
import { getReduxState, subscribeReduxState, setReduxAutoRefresh, getLastActionForReducer, clearActionHistory, } from './customHooks/reduxLogger';
|
|
21
23
|
import { LIB_VERSION } from './constants';
|
|
@@ -89,6 +91,14 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
89
91
|
const latestAnalyticsEventsRef = useRef([]);
|
|
90
92
|
const [lastReadLogsCount, setLastReadLogsCount] = useState(0);
|
|
91
93
|
const [lastReadApisCount, setLastReadApisCount] = useState(0);
|
|
94
|
+
const [lastReadCrashesCount, setLastReadCrashesCount] = useState(0);
|
|
95
|
+
// ─── Crash state ───────────────────────────────────────────────────────────
|
|
96
|
+
const [crashRecords, setCrashRecords] = useState(() => getCrashRecords());
|
|
97
|
+
const [selectedCrash, setSelectedCrash] = useState(null);
|
|
98
|
+
const [maxCrashLogs, setMaxCrashLogs] = useState(100);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
setMaxCrashLogsLimit(maxCrashLogs);
|
|
101
|
+
}, [maxCrashLogs]);
|
|
92
102
|
useEffect(() => {
|
|
93
103
|
if (visible) {
|
|
94
104
|
if (activeTab === 'apis') {
|
|
@@ -97,6 +107,9 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
97
107
|
if (activeTab === 'logs') {
|
|
98
108
|
setLastReadLogsCount(consoleLogs.length);
|
|
99
109
|
}
|
|
110
|
+
if (activeTab === 'crash') {
|
|
111
|
+
setLastReadCrashesCount(crashRecords.length);
|
|
112
|
+
}
|
|
100
113
|
}
|
|
101
114
|
}, [visible]);
|
|
102
115
|
useEffect(() => {
|
|
@@ -109,6 +122,11 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
109
122
|
setLastReadLogsCount(consoleLogs.length);
|
|
110
123
|
}
|
|
111
124
|
}, [activeTab, consoleLogs.length]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (activeTab === 'crash') {
|
|
127
|
+
setLastReadCrashesCount(crashRecords.length);
|
|
128
|
+
}
|
|
129
|
+
}, [activeTab, crashRecords.length]);
|
|
112
130
|
const [maxConsoleLogs, setMaxConsoleLogs] = useState(200);
|
|
113
131
|
const [showConsoleLevels, setShowConsoleLevels] = useState({
|
|
114
132
|
info: true,
|
|
@@ -151,6 +169,7 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
151
169
|
redux: false,
|
|
152
170
|
bundle: false,
|
|
153
171
|
performance: false,
|
|
172
|
+
crash: true,
|
|
154
173
|
});
|
|
155
174
|
const [maxNetworkLogs, setMaxNetworkLogs] = useState(100);
|
|
156
175
|
const [reduxAutoRefresh, setReduxAutoRefreshState] = useState(true);
|
|
@@ -171,8 +190,10 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
171
190
|
redux: false,
|
|
172
191
|
bundle: false,
|
|
173
192
|
performance: false,
|
|
193
|
+
crash: true,
|
|
174
194
|
});
|
|
175
195
|
setDefaultTab('apis');
|
|
196
|
+
setMaxCrashLogs(100);
|
|
176
197
|
setMaxNetworkLogs(100);
|
|
177
198
|
setMaxConsoleLogs(200);
|
|
178
199
|
setShowConsoleLevels({
|
|
@@ -205,6 +226,9 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
205
226
|
...prev,
|
|
206
227
|
...saved.tabVisibility,
|
|
207
228
|
apis: true, // APIs is always required
|
|
229
|
+
crash: saved.tabVisibility.crash !== undefined
|
|
230
|
+
? saved.tabVisibility.crash
|
|
231
|
+
: true,
|
|
208
232
|
}));
|
|
209
233
|
if (saved.defaultTab)
|
|
210
234
|
setDefaultTab(saved.defaultTab);
|
|
@@ -230,6 +254,7 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
230
254
|
redux: false,
|
|
231
255
|
bundle: false,
|
|
232
256
|
performance: false,
|
|
257
|
+
crash: true,
|
|
233
258
|
},
|
|
234
259
|
...(saved.tabVisibility || {}),
|
|
235
260
|
apis: true,
|
|
@@ -610,6 +635,22 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
610
635
|
clearNetworkLogs();
|
|
611
636
|
setupConsoleLogger();
|
|
612
637
|
autoSetupAnalyticsLogger();
|
|
638
|
+
setupGlobalCrashHandler();
|
|
639
|
+
const unsubscribeCrash = subscribeCrashEvents(crashInfo => {
|
|
640
|
+
if (crashInfo.message === '__CLEARED__') {
|
|
641
|
+
setCrashRecords([]);
|
|
642
|
+
setSelectedCrash(null);
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
const updated = getCrashRecords();
|
|
646
|
+
setCrashRecords(updated);
|
|
647
|
+
});
|
|
648
|
+
// Sync crashes recorded before this subscription ran (e.g. a render crash
|
|
649
|
+
// during the very first commit, which fires before effects are mounted).
|
|
650
|
+
const pendingCrashes = getCrashRecords();
|
|
651
|
+
if (pendingCrashes.length > 0) {
|
|
652
|
+
setCrashRecords(pendingCrashes);
|
|
653
|
+
}
|
|
613
654
|
let timeoutId;
|
|
614
655
|
let isFirstNetworkCall = true;
|
|
615
656
|
const unsubscribe = subscribeNetworkLogs((raw) => {
|
|
@@ -721,6 +762,7 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
721
762
|
unsubscribeConsole();
|
|
722
763
|
clearTimeout(consoleTimeoutId);
|
|
723
764
|
unsubscribeRedux();
|
|
765
|
+
unsubscribeCrash();
|
|
724
766
|
};
|
|
725
767
|
}, []);
|
|
726
768
|
useEffect(() => {
|
|
@@ -1210,6 +1252,21 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
1210
1252
|
]);
|
|
1211
1253
|
return;
|
|
1212
1254
|
}
|
|
1255
|
+
if (activeTab === 'crash') {
|
|
1256
|
+
Alert.alert('Clear Crash History', 'Are you sure you want to clear all intercepted crash records?', [
|
|
1257
|
+
{ text: 'Cancel', style: 'cancel' },
|
|
1258
|
+
{
|
|
1259
|
+
text: 'Clear All',
|
|
1260
|
+
onPress: () => {
|
|
1261
|
+
clearCrashRecords();
|
|
1262
|
+
setCrashRecords([]);
|
|
1263
|
+
setSelectedCrash(null);
|
|
1264
|
+
},
|
|
1265
|
+
style: 'destructive',
|
|
1266
|
+
},
|
|
1267
|
+
]);
|
|
1268
|
+
return;
|
|
1269
|
+
}
|
|
1213
1270
|
// Default: APIs tab. Only clears NETWORK logs — never touches the other tabs.
|
|
1214
1271
|
if (selectedLogs.size > 0) {
|
|
1215
1272
|
setLogs(prev => prev.filter(l => !selectedLogs.has(l.id)));
|
|
@@ -1391,6 +1448,19 @@ const NetworkInspector = ({ enabled = true, isEnabled = true, storage, navigatio
|
|
|
1391
1448
|
setSelectedReduxAction,
|
|
1392
1449
|
reduxActiveSubTab,
|
|
1393
1450
|
setReduxActiveSubTab,
|
|
1451
|
+
// ─── Crash ───────────────────────────────────────────────────────────
|
|
1452
|
+
crashRecords,
|
|
1453
|
+
setCrashRecords,
|
|
1454
|
+
selectedCrash,
|
|
1455
|
+
setSelectedCrash,
|
|
1456
|
+
lastReadCrashesCount,
|
|
1457
|
+
maxCrashLogs,
|
|
1458
|
+
setMaxCrashLogs,
|
|
1459
|
+
clearAllCrashes: () => {
|
|
1460
|
+
clearCrashRecords();
|
|
1461
|
+
setCrashRecords([]);
|
|
1462
|
+
setSelectedCrash(null);
|
|
1463
|
+
},
|
|
1394
1464
|
// ─── Settings ───────────────────────────────────────────────────────
|
|
1395
1465
|
settingsActiveSubTab,
|
|
1396
1466
|
setSettingsActiveSubTab,
|
|
@@ -1434,9 +1504,11 @@ export default NetworkInspectorWrapper;
|
|
|
1434
1504
|
export { setupNetworkLogger, clearNetworkLogs, subscribeNetworkLogs, addAxiosInterceptors, } from './customHooks/networkLogger';
|
|
1435
1505
|
export { setupConsoleLogger, clearConsoleLogs, subscribeConsoleLogs, } from './customHooks/consoleLogger';
|
|
1436
1506
|
export { setupAnalyticsLogger, logAnalyticsEvent, subscribeAnalyticsEvents, clearAnalyticsEvents, getCurrentUserProperties, getCurrentUserId, getDefaultEventParameters, getCollectionEnabled, } from './customHooks/analyticsLogger';
|
|
1507
|
+
export { setupGlobalCrashHandler, subscribeCrashEvents, emitCrashEvent, getCrashRecords, clearCrashRecords, simulateTestCrash, exportCrashReport, parseCrashStackTrace, recordCustomCrash, addCrashBreadcrumb, recordNavigationBreadcrumb, recordNetworkBreadcrumb, recordReduxBreadcrumb, recordUserActionBreadcrumb, computeCrashFingerprint, } from './customHooks/crashHandler';
|
|
1508
|
+
export { default as CrashTab } from './components/Inspector/CrashTab';
|
|
1437
1509
|
export { default as ErrorBoundary } from './components/ErrorBoundary';
|
|
1438
1510
|
export { connectReduxStore, inspectorReduxMiddleware, getReduxState, subscribeReduxState, getActionHistory, clearActionHistory, getLastActionForReducer, } from './customHooks/reduxLogger';
|
|
1439
1511
|
export { getEventCategory, registerGAPlugin, } from './helpers/gaAnalyticsRegistry';
|
|
1440
1512
|
export { usePerformanceTracker, logPerformanceEvent, clearPerformanceEvents, subscribePerformanceEvents, getPerformanceEvents, } from './customHooks/performanceTracker';
|
|
1441
1513
|
export { InspectLog, InspectTrackTime, InspectCatch, } from './decorators';
|
|
1442
|
-
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, } from './types';
|
|
1514
|
+
export { ActiveTab, Method, StatusFilter, SortOrder, LocalFilter, ModalAnimationType, SettingsPage, SettingsSubTab, LogFilter, ConsoleLogType, AnalyticsEventSource, GAEventCategory, StackFrameType, DiffResultType, BundleSubTab, PerformanceSubTab, CrashType, CrashExportFormat, CrashDetailSubTab, CrashFilterType, BreadcrumbType, } from './types';
|
|
@@ -5,6 +5,7 @@ export declare const ActiveTab: {
|
|
|
5
5
|
readonly Redux: "redux";
|
|
6
6
|
readonly Bundle: "bundle";
|
|
7
7
|
readonly Performance: "performance";
|
|
8
|
+
readonly Crash: "crash";
|
|
8
9
|
};
|
|
9
10
|
export type ActiveTab = (typeof ActiveTab)[keyof typeof ActiveTab];
|
|
10
11
|
export declare const Method: {
|
|
@@ -50,6 +51,7 @@ export declare const SettingsPage: {
|
|
|
50
51
|
readonly Redux: "redux";
|
|
51
52
|
readonly Bundle: "bundle";
|
|
52
53
|
readonly Performance: "performance";
|
|
54
|
+
readonly Crash: "crash";
|
|
53
55
|
};
|
|
54
56
|
export type SettingsPage = (typeof SettingsPage)[keyof typeof SettingsPage] | null;
|
|
55
57
|
export declare const SettingsSubTab: {
|
|
@@ -113,3 +115,42 @@ export declare const PerformanceSubTab: {
|
|
|
113
115
|
readonly Memory: "memory";
|
|
114
116
|
};
|
|
115
117
|
export type PerformanceSubTab = (typeof PerformanceSubTab)[keyof typeof PerformanceSubTab];
|
|
118
|
+
export declare const CrashType: {
|
|
119
|
+
readonly Native: "native";
|
|
120
|
+
readonly Js: "js";
|
|
121
|
+
readonly Promise: "promise";
|
|
122
|
+
readonly Render: "render";
|
|
123
|
+
readonly Custom: "custom";
|
|
124
|
+
};
|
|
125
|
+
export type CrashType = (typeof CrashType)[keyof typeof CrashType];
|
|
126
|
+
export declare const CrashExportFormat: {
|
|
127
|
+
readonly Text: "text";
|
|
128
|
+
readonly Markdown: "markdown";
|
|
129
|
+
readonly Json: "json";
|
|
130
|
+
};
|
|
131
|
+
export type CrashExportFormat = (typeof CrashExportFormat)[keyof typeof CrashExportFormat];
|
|
132
|
+
export declare const CrashDetailSubTab: {
|
|
133
|
+
readonly Stack: "stack";
|
|
134
|
+
readonly Diagnostics: "diagnostics";
|
|
135
|
+
readonly Breadcrumbs: "breadcrumbs";
|
|
136
|
+
readonly Raw: "raw";
|
|
137
|
+
};
|
|
138
|
+
export type CrashDetailSubTab = (typeof CrashDetailSubTab)[keyof typeof CrashDetailSubTab];
|
|
139
|
+
export declare const CrashFilterType: {
|
|
140
|
+
readonly All: "all";
|
|
141
|
+
readonly Fatal: "fatal";
|
|
142
|
+
readonly Js: "js";
|
|
143
|
+
readonly Promise: "promise";
|
|
144
|
+
readonly Render: "render";
|
|
145
|
+
readonly Native: "native";
|
|
146
|
+
};
|
|
147
|
+
export type CrashFilterType = (typeof CrashFilterType)[keyof typeof CrashFilterType];
|
|
148
|
+
export declare const BreadcrumbType: {
|
|
149
|
+
readonly Navigation: "navigation";
|
|
150
|
+
readonly Network: "network";
|
|
151
|
+
readonly Redux: "redux";
|
|
152
|
+
readonly Console: "console";
|
|
153
|
+
readonly User: "user";
|
|
154
|
+
readonly System: "system";
|
|
155
|
+
};
|
|
156
|
+
export type BreadcrumbType = (typeof BreadcrumbType)[keyof typeof BreadcrumbType];
|
package/dist/esm/types/enums.js
CHANGED
|
@@ -8,6 +8,7 @@ export const ActiveTab = {
|
|
|
8
8
|
Redux: 'redux',
|
|
9
9
|
Bundle: 'bundle',
|
|
10
10
|
Performance: 'performance',
|
|
11
|
+
Crash: 'crash',
|
|
11
12
|
};
|
|
12
13
|
export const Method = {
|
|
13
14
|
All: 'ALL',
|
|
@@ -47,6 +48,7 @@ export const SettingsPage = {
|
|
|
47
48
|
Redux: 'redux',
|
|
48
49
|
Bundle: 'bundle',
|
|
49
50
|
Performance: 'performance',
|
|
51
|
+
Crash: 'crash',
|
|
50
52
|
};
|
|
51
53
|
export const SettingsSubTab = {
|
|
52
54
|
Module: 'module',
|
|
@@ -100,3 +102,37 @@ export const PerformanceSubTab = {
|
|
|
100
102
|
Interactions: 'interactions',
|
|
101
103
|
Memory: 'memory',
|
|
102
104
|
};
|
|
105
|
+
export const CrashType = {
|
|
106
|
+
Native: 'native',
|
|
107
|
+
Js: 'js',
|
|
108
|
+
Promise: 'promise',
|
|
109
|
+
Render: 'render',
|
|
110
|
+
Custom: 'custom',
|
|
111
|
+
};
|
|
112
|
+
export const CrashExportFormat = {
|
|
113
|
+
Text: 'text',
|
|
114
|
+
Markdown: 'markdown',
|
|
115
|
+
Json: 'json',
|
|
116
|
+
};
|
|
117
|
+
export const CrashDetailSubTab = {
|
|
118
|
+
Stack: 'stack',
|
|
119
|
+
Diagnostics: 'diagnostics',
|
|
120
|
+
Breadcrumbs: 'breadcrumbs',
|
|
121
|
+
Raw: 'raw',
|
|
122
|
+
};
|
|
123
|
+
export const CrashFilterType = {
|
|
124
|
+
All: 'all',
|
|
125
|
+
Fatal: 'fatal',
|
|
126
|
+
Js: 'js',
|
|
127
|
+
Promise: 'promise',
|
|
128
|
+
Render: 'render',
|
|
129
|
+
Native: 'native',
|
|
130
|
+
};
|
|
131
|
+
export const BreadcrumbType = {
|
|
132
|
+
Navigation: 'navigation',
|
|
133
|
+
Network: 'network',
|
|
134
|
+
Redux: 'redux',
|
|
135
|
+
Console: 'console',
|
|
136
|
+
User: 'user',
|
|
137
|
+
System: 'system',
|
|
138
|
+
};
|
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { Animated, PanResponderInstance } from 'react-native';
|
|
4
|
-
import type { ActiveTab, GroupedListItem, LocalFilter, LogFilter, Method, SettingsPage, SettingsSubTab, SortOrder, StatusFilter } from './index';
|
|
4
|
+
import type { ActiveTab, BreadcrumbType, CrashType, GroupedListItem, LocalFilter, LogFilter, Method, SettingsPage, SettingsSubTab, SortOrder, StatusFilter } from './index';
|
|
5
|
+
export interface ParsedStackFrame {
|
|
6
|
+
method: string;
|
|
7
|
+
file: string;
|
|
8
|
+
lineNumber: number;
|
|
9
|
+
column: number;
|
|
10
|
+
raw?: string;
|
|
11
|
+
isAppCode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CrashBreadcrumb {
|
|
14
|
+
type: BreadcrumbType;
|
|
15
|
+
message: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
data?: any;
|
|
18
|
+
}
|
|
19
|
+
export interface CrashRecord {
|
|
20
|
+
id: string;
|
|
21
|
+
error?: Error | any;
|
|
22
|
+
isFatal: boolean;
|
|
23
|
+
type: CrashType;
|
|
24
|
+
message: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
stack?: string;
|
|
27
|
+
parsedStack?: ParsedStackFrame[];
|
|
28
|
+
componentStack?: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
dateStr: string;
|
|
31
|
+
timeStr: string;
|
|
32
|
+
deviceInfo?: {
|
|
33
|
+
platform: string;
|
|
34
|
+
osVersion?: string;
|
|
35
|
+
rnVersion?: string;
|
|
36
|
+
isHermes?: boolean;
|
|
37
|
+
isFabric?: boolean;
|
|
38
|
+
appState?: string;
|
|
39
|
+
};
|
|
40
|
+
memoryInfo?: {
|
|
41
|
+
usedJSHeapSize?: number;
|
|
42
|
+
totalJSHeapSize?: number;
|
|
43
|
+
};
|
|
44
|
+
breadcrumbs?: CrashBreadcrumb[];
|
|
45
|
+
logId?: number;
|
|
46
|
+
}
|
|
5
47
|
export interface ConsoleLog {
|
|
6
48
|
id: number;
|
|
7
49
|
type: 'info' | 'warn' | 'error';
|
|
@@ -229,6 +271,14 @@ export interface InspectorContextValue {
|
|
|
229
271
|
setSelectedReduxAction: React.Dispatch<React.SetStateAction<any | null>>;
|
|
230
272
|
reduxActiveSubTab: 'state' | 'timeline';
|
|
231
273
|
setReduxActiveSubTab: React.Dispatch<React.SetStateAction<'state' | 'timeline'>>;
|
|
274
|
+
crashRecords: CrashRecord[];
|
|
275
|
+
setCrashRecords: React.Dispatch<React.SetStateAction<CrashRecord[]>>;
|
|
276
|
+
selectedCrash: CrashRecord | null;
|
|
277
|
+
setSelectedCrash: React.Dispatch<React.SetStateAction<CrashRecord | null>>;
|
|
278
|
+
lastReadCrashesCount: number;
|
|
279
|
+
maxCrashLogs: number;
|
|
280
|
+
setMaxCrashLogs: React.Dispatch<React.SetStateAction<number>>;
|
|
281
|
+
clearAllCrashes: () => void;
|
|
232
282
|
settingsActiveSubTab: SettingsSubTab;
|
|
233
283
|
setSettingsActiveSubTab: React.Dispatch<React.SetStateAction<SettingsSubTab>>;
|
|
234
284
|
defaultTab: ActiveTab;
|