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,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;
|
|
@@ -6,6 +6,6 @@ export declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBo
|
|
|
6
6
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
7
7
|
private handleReset;
|
|
8
8
|
private handleCopyTrace;
|
|
9
|
-
render():
|
|
9
|
+
render(): React.ReactNode;
|
|
10
10
|
}
|
|
11
11
|
export default ErrorBoundary;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { StyleSheet
|
|
1
|
+
import { Component } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { AppColors } from '../styles/AppColors';
|
|
4
4
|
import { AppFonts } from '../styles/AppFonts';
|
|
5
5
|
import { copyToClipboard } from '../helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { handleInterceptedCrash } from '../customHooks/crashHandler';
|
|
7
|
+
import { CrashType } from '../types/enums';
|
|
7
8
|
function parseStackTrace(stack) {
|
|
8
9
|
if (!stack)
|
|
9
10
|
return null;
|
|
@@ -68,119 +69,15 @@ ${error.stack}`;
|
|
|
68
69
|
return { hasError: true, error };
|
|
69
70
|
}
|
|
70
71
|
componentDidCatch(error, errorInfo) {
|
|
71
|
-
|
|
72
|
+
try {
|
|
73
|
+
const stack = error?.stack || errorInfo?.componentStack;
|
|
74
|
+
handleInterceptedCrash(error, stack, false, CrashType.Render, errorInfo?.componentStack);
|
|
75
|
+
}
|
|
76
|
+
catch { }
|
|
72
77
|
}
|
|
73
78
|
render() {
|
|
74
79
|
if (this.state.hasError) {
|
|
75
|
-
|
|
76
|
-
if (isInline) {
|
|
77
|
-
return (<View style={styles.inlineContainer}>
|
|
78
|
-
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
|
79
|
-
<WarningTriangleIcon color={AppColors.redErrorText} size={14}/>
|
|
80
|
-
<Text style={styles.inlineTitle}>Inspector Crash</Text>
|
|
81
|
-
</View>
|
|
82
|
-
<TouchableOpacity style={styles.inlineResetBtn} onPress={this.handleReset}>
|
|
83
|
-
<Text style={styles.inlineResetText}>Reload</Text>
|
|
84
|
-
</TouchableOpacity>
|
|
85
|
-
</View>);
|
|
86
|
-
}
|
|
87
|
-
const error = this.state.error;
|
|
88
|
-
const isNativeCrash = error ? (error.message.includes('Native') || error.message.includes('native') || error.message.includes('Swift') || error.message.includes('Java')) : false;
|
|
89
|
-
const parsed = error && error.stack ? parseStackTrace(error.stack) : null;
|
|
90
|
-
return (<View style={styles.container}>
|
|
91
|
-
<View style={styles.card}>
|
|
92
|
-
<View style={{ marginBottom: 12, alignItems: 'center' }}>
|
|
93
|
-
<WarningTriangleIcon color={AppColors.amber500} size={44}/>
|
|
94
|
-
</View>
|
|
95
|
-
<Text style={styles.title}>Something went wrong</Text>
|
|
96
|
-
|
|
97
|
-
<View style={{
|
|
98
|
-
flexDirection: 'row',
|
|
99
|
-
alignItems: 'center',
|
|
100
|
-
backgroundColor: isNativeCrash ? `${AppColors.errorColor}1A` : `${AppColors.amber500}1A`,
|
|
101
|
-
paddingHorizontal: 10,
|
|
102
|
-
paddingVertical: 4,
|
|
103
|
-
borderRadius: 20,
|
|
104
|
-
marginBottom: 12,
|
|
105
|
-
gap: 4
|
|
106
|
-
}}>
|
|
107
|
-
<View style={{
|
|
108
|
-
width: 8,
|
|
109
|
-
height: 8,
|
|
110
|
-
borderRadius: 4,
|
|
111
|
-
backgroundColor: isNativeCrash ? AppColors.errorColor : AppColors.amber500,
|
|
112
|
-
}}/>
|
|
113
|
-
<Text style={{
|
|
114
|
-
fontSize: 10,
|
|
115
|
-
fontWeight: 'bold',
|
|
116
|
-
color: isNativeCrash ? AppColors.errorColor : AppColors.amber500,
|
|
117
|
-
fontFamily: AppFonts.interBold || 'System'
|
|
118
|
-
}}>
|
|
119
|
-
{isNativeCrash ? 'NATIVE CRASH' : 'JAVASCRIPT CRASH'}
|
|
120
|
-
</Text>
|
|
121
|
-
</View>
|
|
122
|
-
|
|
123
|
-
<Text style={styles.subtitle}>
|
|
124
|
-
The In-App Inspector or active view encountered an error. Traceback details are parsed below:
|
|
125
|
-
</Text>
|
|
126
|
-
|
|
127
|
-
{parsed && (<View style={{
|
|
128
|
-
backgroundColor: AppColors.slate100,
|
|
129
|
-
borderRadius: 8,
|
|
130
|
-
padding: 10,
|
|
131
|
-
width: '100%',
|
|
132
|
-
marginBottom: 10,
|
|
133
|
-
borderWidth: 1,
|
|
134
|
-
borderColor: AppColors.slate200,
|
|
135
|
-
gap: 4
|
|
136
|
-
}}>
|
|
137
|
-
<Text style={{ fontSize: 11, color: AppColors.slate600, fontFamily: AppFonts.interMedium }} numberOfLines={1}>
|
|
138
|
-
<Text style={{ fontWeight: 'bold' }}>Method:</Text> {parsed.method}
|
|
139
|
-
</Text>
|
|
140
|
-
<Text style={{ fontSize: 11, color: AppColors.slate600, fontFamily: AppFonts.interMedium }} numberOfLines={1}>
|
|
141
|
-
<Text style={{ fontWeight: 'bold' }}>File:</Text> {parsed.file}
|
|
142
|
-
</Text>
|
|
143
|
-
<Text style={{ fontSize: 11, color: AppColors.slate600, fontFamily: AppFonts.interMedium }}>
|
|
144
|
-
<Text style={{ fontWeight: 'bold' }}>Line:</Text> {parsed.line} <Text style={{ fontWeight: 'bold' }}>Col:</Text> {parsed.column}
|
|
145
|
-
</Text>
|
|
146
|
-
</View>)}
|
|
147
|
-
|
|
148
|
-
{error && (<ScrollView style={styles.scroll} contentContainerStyle={styles.scrollContent}>
|
|
149
|
-
<Text style={styles.code}>
|
|
150
|
-
{error.message}
|
|
151
|
-
{'\n\n'}
|
|
152
|
-
{error.stack}
|
|
153
|
-
</Text>
|
|
154
|
-
</ScrollView>)}
|
|
155
|
-
|
|
156
|
-
<View style={{ width: '100%', gap: 8, marginBottom: 12 }}>
|
|
157
|
-
<TouchableOpacity style={{
|
|
158
|
-
backgroundColor: AppColors.slate900,
|
|
159
|
-
height: 38,
|
|
160
|
-
borderRadius: 8,
|
|
161
|
-
justifyContent: 'center',
|
|
162
|
-
alignItems: 'center',
|
|
163
|
-
flexDirection: 'row',
|
|
164
|
-
gap: 6
|
|
165
|
-
}} onPress={this.handleCopyTrace}>
|
|
166
|
-
<CopyIcon color={AppColors.white} size={14}/>
|
|
167
|
-
<Text style={{ color: AppColors.white, fontSize: 12, fontWeight: 'bold', fontFamily: AppFonts.interBold || 'System' }}>
|
|
168
|
-
Copy Crash Traceback
|
|
169
|
-
</Text>
|
|
170
|
-
</TouchableOpacity>
|
|
171
|
-
</View>
|
|
172
|
-
|
|
173
|
-
<View style={styles.btnRow}>
|
|
174
|
-
<TouchableOpacity style={styles.resetBtn} onPress={this.handleReset}>
|
|
175
|
-
<Text style={styles.resetBtnText}>Retry / Reload</Text>
|
|
176
|
-
</TouchableOpacity>
|
|
177
|
-
|
|
178
|
-
{this.props.onClose && (<TouchableOpacity style={styles.closeBtn} onPress={this.props.onClose}>
|
|
179
|
-
<Text style={styles.closeBtnText}>Close Inspector</Text>
|
|
180
|
-
</TouchableOpacity>)}
|
|
181
|
-
</View>
|
|
182
|
-
</View>
|
|
183
|
-
</View>);
|
|
80
|
+
return null;
|
|
184
81
|
}
|
|
185
82
|
return this.props.children;
|
|
186
83
|
}
|