react-native-inapp-inspector 1.1.21 → 1.1.23
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/components/AnalyticsDetail.js +5 -3
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +0 -1
- package/dist/commonjs/components/AnalyticsEventCard.js +89 -97
- package/dist/commonjs/components/ErrorBoundary.js +17 -8
- package/dist/commonjs/components/Inspector/BundleTab.d.ts +1 -0
- package/dist/commonjs/components/Inspector/BundleTab.js +607 -685
- package/dist/commonjs/components/Inspector/LogDetail.js +12 -6
- package/dist/commonjs/components/Inspector/PerformanceTab.js +195 -254
- package/dist/commonjs/components/Inspector/ReduxDetail.js +2 -2
- package/dist/commonjs/components/Inspector/ReduxTab.js +9 -6
- package/dist/commonjs/components/NetworkIcons.d.ts +12 -0
- package/dist/commonjs/components/NetworkIcons.js +92 -1
- package/dist/commonjs/components/TreeNode.js +1 -1
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/bundleAnalyzer.d.ts +115 -0
- package/dist/commonjs/customHooks/bundleAnalyzer.js +561 -0
- package/dist/commonjs/customHooks/performanceTracker.d.ts +84 -0
- package/dist/commonjs/customHooks/performanceTracker.js +541 -0
- package/dist/commonjs/helpers/index.d.ts +15 -0
- package/dist/commonjs/helpers/index.js +112 -1
- package/dist/commonjs/i18n/locales/en.json +225 -2
- package/dist/commonjs/styles/AppColors.d.ts +110 -0
- package/dist/commonjs/styles/AppColors.js +114 -0
- package/dist/esm/components/AnalyticsDetail.js +5 -3
- package/dist/esm/components/AnalyticsEventCard.d.ts +0 -1
- package/dist/esm/components/AnalyticsEventCard.js +89 -96
- package/dist/esm/components/ErrorBoundary.js +17 -8
- package/dist/esm/components/Inspector/BundleTab.d.ts +1 -0
- package/dist/esm/components/Inspector/BundleTab.js +612 -690
- package/dist/esm/components/Inspector/LogDetail.js +13 -7
- package/dist/esm/components/Inspector/PerformanceTab.js +196 -255
- package/dist/esm/components/Inspector/ReduxDetail.js +2 -2
- package/dist/esm/components/Inspector/ReduxTab.js +10 -7
- package/dist/esm/components/NetworkIcons.d.ts +12 -0
- package/dist/esm/components/NetworkIcons.js +79 -0
- package/dist/esm/components/TreeNode.js +2 -2
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/bundleAnalyzer.d.ts +115 -0
- package/dist/esm/customHooks/bundleAnalyzer.js +554 -0
- package/dist/esm/customHooks/performanceTracker.d.ts +84 -0
- package/dist/esm/customHooks/performanceTracker.js +537 -0
- package/dist/esm/helpers/index.d.ts +15 -0
- package/dist/esm/helpers/index.js +107 -0
- package/dist/esm/i18n/locales/en.json +225 -2
- package/dist/esm/styles/AppColors.d.ts +110 -0
- package/dist/esm/styles/AppColors.js +114 -0
- package/package.json +1 -1
|
@@ -2,88 +2,14 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
import { AppColors } from '../styles/AppColors';
|
|
4
4
|
import { AppFonts } from '../styles/AppFonts';
|
|
5
|
-
import { formatGap, formatTime } from '../helpers';
|
|
5
|
+
import { formatGap, formatTime, getEventColor, getEventCategory, getCategoryColors, } from '../helpers';
|
|
6
|
+
import { useTranslation } from '../i18n';
|
|
6
7
|
import HighlightText from './HighlightText';
|
|
7
8
|
import TouchableScale from './TouchableScale';
|
|
8
|
-
|
|
9
|
-
const EVENT_PALETTE = [
|
|
10
|
-
AppColors.googleBlue, // blue
|
|
11
|
-
AppColors.googleGreen, // green
|
|
12
|
-
AppColors.googlePurple, // purple
|
|
13
|
-
AppColors.googleTeal, // teal
|
|
14
|
-
AppColors.googleRed, // red
|
|
15
|
-
AppColors.googleOrange, // orange
|
|
16
|
-
AppColors.blue700, // dark blue
|
|
17
|
-
AppColors.materialGreen, // dark green
|
|
18
|
-
];
|
|
19
|
-
export function getEventColor(name) {
|
|
20
|
-
const safeName = typeof name === 'string' ? name : String(name || '');
|
|
21
|
-
let hash = 0;
|
|
22
|
-
for (let i = 0; i < safeName.length; i++) {
|
|
23
|
-
hash = (hash * 31 + safeName.charCodeAt(i)) | 0;
|
|
24
|
-
}
|
|
25
|
-
return EVENT_PALETTE[Math.abs(hash) % EVENT_PALETTE.length];
|
|
26
|
-
}
|
|
27
|
-
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
28
|
-
function getEventCategory(name) {
|
|
29
|
-
if (!name)
|
|
30
|
-
return 'Custom';
|
|
31
|
-
const lowercaseName = name.toLowerCase();
|
|
32
|
-
if (lowercaseName === 'screen_view' || lowercaseName === 'page_view') {
|
|
33
|
-
return 'Page View';
|
|
34
|
-
}
|
|
35
|
-
// Ecommerce events
|
|
36
|
-
const ecommerceEvents = [
|
|
37
|
-
'purchase', 'add_to_cart', 'begin_checkout', 'view_item',
|
|
38
|
-
'select_item', 'remove_from_cart', 'view_cart',
|
|
39
|
-
'add_shipping_info', 'add_payment_info', 'refund',
|
|
40
|
-
'view_item_list', 'select_promotion', 'view_promotion'
|
|
41
|
-
];
|
|
42
|
-
if (ecommerceEvents.includes(lowercaseName)) {
|
|
43
|
-
return 'Ecommerce';
|
|
44
|
-
}
|
|
45
|
-
// Firebase System Auto-events
|
|
46
|
-
const systemEvents = [
|
|
47
|
-
'first_open', 'session_start', 'user_engagement',
|
|
48
|
-
'app_clear_data', 'app_exception', 'app_update', 'os_update',
|
|
49
|
-
'notification_receive', 'notification_open', 'notification_dismiss',
|
|
50
|
-
'screen_active', 'screen_inactive'
|
|
51
|
-
];
|
|
52
|
-
if (systemEvents.includes(lowercaseName) || lowercaseName.startsWith('firebase_') || lowercaseName.startsWith('_')) {
|
|
53
|
-
return 'System';
|
|
54
|
-
}
|
|
55
|
-
return 'Custom';
|
|
56
|
-
}
|
|
57
|
-
function getCategoryColors(category) {
|
|
58
|
-
switch (category) {
|
|
59
|
-
case 'Page View':
|
|
60
|
-
return {
|
|
61
|
-
bg: AppColors.blueBg,
|
|
62
|
-
border: AppColors.blueBorder,
|
|
63
|
-
text: AppColors.blue800,
|
|
64
|
-
};
|
|
65
|
-
case 'Ecommerce':
|
|
66
|
-
return {
|
|
67
|
-
bg: AppColors.greenBg,
|
|
68
|
-
border: AppColors.greenBorder,
|
|
69
|
-
text: AppColors.materialGreen,
|
|
70
|
-
};
|
|
71
|
-
case 'System':
|
|
72
|
-
return {
|
|
73
|
-
bg: AppColors.greyBg,
|
|
74
|
-
border: AppColors.greyBorder,
|
|
75
|
-
text: AppColors.grey600,
|
|
76
|
-
};
|
|
77
|
-
default:
|
|
78
|
-
return {
|
|
79
|
-
bg: AppColors.purpleBg,
|
|
80
|
-
border: AppColors.purpleBorder,
|
|
81
|
-
text: AppColors.purpleText,
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}
|
|
9
|
+
import { CartIcon, MoneyIcon } from './NetworkIcons';
|
|
85
10
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
86
11
|
const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPress, isNew = false, searchStr = '', msSincePrev, computedScreenName, }) {
|
|
12
|
+
const { t } = useTranslation();
|
|
87
13
|
const color = getEventColor(event.name);
|
|
88
14
|
const paramCount = event.params ? Object.keys(event.params).length : 0;
|
|
89
15
|
const userPropCount = event.userProperties
|
|
@@ -104,11 +30,19 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
104
30
|
return (<View style={cardStyles.container}>
|
|
105
31
|
{/* ── Gap Indicator ─────────────────────────────────────────────────── */}
|
|
106
32
|
{showGap && (<View style={cardStyles.gapContainer}>
|
|
107
|
-
<Text style={[cardStyles.gapText, { color: AppColors.grayTextWeak }]}>
|
|
33
|
+
<Text style={[cardStyles.gapText, { color: AppColors.grayTextWeak }]}>
|
|
34
|
+
{formatGap(msSincePrev)}
|
|
35
|
+
</Text>
|
|
108
36
|
</View>)}
|
|
109
37
|
|
|
110
38
|
{/* ── Main Card ─────────────────────────────────────────────────────── */}
|
|
111
|
-
<TouchableScale onPress={onPress} style={[
|
|
39
|
+
<TouchableScale onPress={onPress} style={[
|
|
40
|
+
cardStyles.modernCard,
|
|
41
|
+
{
|
|
42
|
+
backgroundColor: AppColors.primaryLight,
|
|
43
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
44
|
+
},
|
|
45
|
+
]}>
|
|
112
46
|
<Animated.View style={[
|
|
113
47
|
StyleSheet.absoluteFill,
|
|
114
48
|
{
|
|
@@ -131,14 +65,21 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
131
65
|
</View>
|
|
132
66
|
|
|
133
67
|
{(() => {
|
|
134
|
-
const
|
|
135
|
-
const tagColors = getCategoryColors(
|
|
68
|
+
const catKey = getEventCategory(event.name);
|
|
69
|
+
const tagColors = getCategoryColors(catKey);
|
|
70
|
+
const categoryLabel = catKey === 'page_view'
|
|
71
|
+
? t('analytics.pageViewCategory')
|
|
72
|
+
: catKey === 'ecommerce'
|
|
73
|
+
? t('analytics.ecommerceCategory')
|
|
74
|
+
: catKey === 'system'
|
|
75
|
+
? t('analytics.systemCategory')
|
|
76
|
+
: t('analytics.customCategory');
|
|
136
77
|
return (<View style={[
|
|
137
78
|
cardStyles.categoryBadge,
|
|
138
79
|
{ backgroundColor: tagColors.bg, borderColor: tagColors.border },
|
|
139
80
|
]}>
|
|
140
81
|
<Text style={[cardStyles.categoryText, { color: tagColors.text }]}>
|
|
141
|
-
{
|
|
82
|
+
{categoryLabel}
|
|
142
83
|
</Text>
|
|
143
84
|
</View>);
|
|
144
85
|
})()}
|
|
@@ -154,7 +95,8 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
154
95
|
cardStyles.duplicateText,
|
|
155
96
|
event.count === 1 && { color: AppColors.grayTextStrong },
|
|
156
97
|
]}>
|
|
157
|
-
{event.count}×
|
|
98
|
+
{event.count}×
|
|
99
|
+
{event.count > 1 ? ` ${t('analytics.duplicate')}` : ''}
|
|
158
100
|
</Text>
|
|
159
101
|
</View>) : null}
|
|
160
102
|
</View>
|
|
@@ -177,7 +119,13 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
177
119
|
const screenNameStr = typeof rawScreenName === 'object'
|
|
178
120
|
? JSON.stringify(rawScreenName)
|
|
179
121
|
: String(rawScreenName);
|
|
180
|
-
return (<View style={[
|
|
122
|
+
return (<View style={[
|
|
123
|
+
cardStyles.chip,
|
|
124
|
+
{
|
|
125
|
+
backgroundColor: AppColors.grayBackground,
|
|
126
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
127
|
+
},
|
|
128
|
+
]}>
|
|
181
129
|
<View style={[cardStyles.screenDot, { backgroundColor: color }]}/>
|
|
182
130
|
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]} numberOfLines={1}>
|
|
183
131
|
{screenNameStr}
|
|
@@ -185,22 +133,52 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
185
133
|
</View>);
|
|
186
134
|
})()}
|
|
187
135
|
|
|
188
|
-
<View style={[
|
|
136
|
+
<View style={[
|
|
137
|
+
cardStyles.chip,
|
|
138
|
+
{
|
|
139
|
+
backgroundColor: AppColors.grayBackground,
|
|
140
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
141
|
+
},
|
|
142
|
+
]}>
|
|
189
143
|
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]}>
|
|
190
|
-
{'{} '} {paramCount} params
|
|
144
|
+
{'{} '} {paramCount} {t('analytics.params')}
|
|
191
145
|
</Text>
|
|
192
146
|
</View>
|
|
193
147
|
|
|
194
|
-
{userPropCount > 0 && (<View style={[
|
|
195
|
-
|
|
148
|
+
{userPropCount > 0 && (<View style={[
|
|
149
|
+
cardStyles.chip,
|
|
150
|
+
{
|
|
151
|
+
backgroundColor: AppColors.grayBackground,
|
|
152
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
153
|
+
},
|
|
154
|
+
]}>
|
|
155
|
+
<Text style={[cardStyles.chipText, { color: AppColors.grayText }]}>
|
|
156
|
+
★ {userPropCount} {t('analytics.props')}
|
|
157
|
+
</Text>
|
|
196
158
|
</View>)}
|
|
197
159
|
|
|
198
160
|
{(() => {
|
|
199
161
|
const items = event.params?.items;
|
|
200
162
|
if (Array.isArray(items) && items.length > 0) {
|
|
201
|
-
return (<View style={[
|
|
202
|
-
|
|
203
|
-
|
|
163
|
+
return (<View style={[
|
|
164
|
+
cardStyles.chip,
|
|
165
|
+
{
|
|
166
|
+
backgroundColor: AppColors.amberBg,
|
|
167
|
+
borderColor: AppColors.amberBorder,
|
|
168
|
+
},
|
|
169
|
+
]}>
|
|
170
|
+
<CartIcon color={AppColors.amber700} size={12}/>
|
|
171
|
+
<Text style={[
|
|
172
|
+
cardStyles.chipText,
|
|
173
|
+
{
|
|
174
|
+
color: AppColors.amber700,
|
|
175
|
+
fontFamily: AppFonts.interBold,
|
|
176
|
+
},
|
|
177
|
+
]}>
|
|
178
|
+
{items.length}{' '}
|
|
179
|
+
{items.length === 1
|
|
180
|
+
? t('analytics.item')
|
|
181
|
+
: t('analytics.items')}
|
|
204
182
|
</Text>
|
|
205
183
|
</View>);
|
|
206
184
|
}
|
|
@@ -212,10 +190,25 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
212
190
|
const currency = event.params?.currency ?? '';
|
|
213
191
|
const isPrimitive = typeof val === 'string' || typeof val === 'number';
|
|
214
192
|
if (isPrimitive) {
|
|
215
|
-
const currencyStr = typeof currency === 'string' || typeof currency === 'number'
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
const currencyStr = typeof currency === 'string' || typeof currency === 'number'
|
|
194
|
+
? String(currency)
|
|
195
|
+
: '';
|
|
196
|
+
return (<View style={[
|
|
197
|
+
cardStyles.chip,
|
|
198
|
+
{
|
|
199
|
+
backgroundColor: AppColors.emeraldBg,
|
|
200
|
+
borderColor: AppColors.emeraldBorder,
|
|
201
|
+
},
|
|
202
|
+
]}>
|
|
203
|
+
<MoneyIcon color={AppColors.emerald600} size={12}/>
|
|
204
|
+
<Text style={[
|
|
205
|
+
cardStyles.chipText,
|
|
206
|
+
{
|
|
207
|
+
color: AppColors.emerald600,
|
|
208
|
+
fontFamily: AppFonts.interBold,
|
|
209
|
+
},
|
|
210
|
+
]}>
|
|
211
|
+
{String(val)} {currencyStr}
|
|
219
212
|
</Text>
|
|
220
213
|
</View>);
|
|
221
214
|
}
|
|
@@ -3,6 +3,7 @@ import { StyleSheet, Text, View, ScrollView, TouchableOpacity } from 'react-nati
|
|
|
3
3
|
import { AppColors } from '../styles/AppColors';
|
|
4
4
|
import { AppFonts } from '../styles/AppFonts';
|
|
5
5
|
import { copyToClipboard } from '../helpers';
|
|
6
|
+
import { WarningTriangleIcon, CopyIcon } from './NetworkIcons';
|
|
6
7
|
function parseStackTrace(stack) {
|
|
7
8
|
if (!stack)
|
|
8
9
|
return null;
|
|
@@ -74,7 +75,10 @@ ${error.stack}`;
|
|
|
74
75
|
const isInline = this.props.fallbackType === 'inline';
|
|
75
76
|
if (isInline) {
|
|
76
77
|
return (<View style={styles.inlineContainer}>
|
|
77
|
-
<
|
|
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>
|
|
78
82
|
<TouchableOpacity style={styles.inlineResetBtn} onPress={this.handleReset}>
|
|
79
83
|
<Text style={styles.inlineResetText}>Reload</Text>
|
|
80
84
|
</TouchableOpacity>
|
|
@@ -85,7 +89,9 @@ ${error.stack}`;
|
|
|
85
89
|
const parsed = error && error.stack ? parseStackTrace(error.stack) : null;
|
|
86
90
|
return (<View style={styles.container}>
|
|
87
91
|
<View style={styles.card}>
|
|
88
|
-
<
|
|
92
|
+
<View style={{ marginBottom: 12, alignItems: 'center' }}>
|
|
93
|
+
<WarningTriangleIcon color={AppColors.amber500} size={44}/>
|
|
94
|
+
</View>
|
|
89
95
|
<Text style={styles.title}>Something went wrong</Text>
|
|
90
96
|
|
|
91
97
|
<View style={{
|
|
@@ -98,13 +104,19 @@ ${error.stack}`;
|
|
|
98
104
|
marginBottom: 12,
|
|
99
105
|
gap: 4
|
|
100
106
|
}}>
|
|
107
|
+
<View style={{
|
|
108
|
+
width: 8,
|
|
109
|
+
height: 8,
|
|
110
|
+
borderRadius: 4,
|
|
111
|
+
backgroundColor: isNativeCrash ? AppColors.errorColor : AppColors.amber500,
|
|
112
|
+
}}/>
|
|
101
113
|
<Text style={{
|
|
102
114
|
fontSize: 10,
|
|
103
115
|
fontWeight: 'bold',
|
|
104
116
|
color: isNativeCrash ? AppColors.errorColor : AppColors.amber500,
|
|
105
117
|
fontFamily: AppFonts.interBold || 'System'
|
|
106
118
|
}}>
|
|
107
|
-
{isNativeCrash ? '
|
|
119
|
+
{isNativeCrash ? 'NATIVE CRASH' : 'JAVASCRIPT CRASH'}
|
|
108
120
|
</Text>
|
|
109
121
|
</View>
|
|
110
122
|
|
|
@@ -151,8 +163,9 @@ ${error.stack}`;
|
|
|
151
163
|
flexDirection: 'row',
|
|
152
164
|
gap: 6
|
|
153
165
|
}} onPress={this.handleCopyTrace}>
|
|
166
|
+
<CopyIcon color={AppColors.white} size={14}/>
|
|
154
167
|
<Text style={{ color: AppColors.white, fontSize: 12, fontWeight: 'bold', fontFamily: AppFonts.interBold || 'System' }}>
|
|
155
|
-
|
|
168
|
+
Copy Crash Traceback
|
|
156
169
|
</Text>
|
|
157
170
|
</TouchableOpacity>
|
|
158
171
|
</View>
|
|
@@ -194,10 +207,6 @@ const styles = StyleSheet.create({
|
|
|
194
207
|
shadowRadius: 12,
|
|
195
208
|
elevation: 8,
|
|
196
209
|
},
|
|
197
|
-
emoji: {
|
|
198
|
-
fontSize: 40,
|
|
199
|
-
marginBottom: 12,
|
|
200
|
-
},
|
|
201
210
|
title: {
|
|
202
211
|
fontFamily: AppFonts.interBold || 'System',
|
|
203
212
|
fontSize: 18,
|
|
@@ -32,6 +32,7 @@ export interface BundlePackageItem {
|
|
|
32
32
|
lastActive?: string;
|
|
33
33
|
npmUrl?: string;
|
|
34
34
|
}
|
|
35
|
+
export type BundleIconType = 'source' | 'deps' | 'media' | 'overhead' | 'image' | 'typescript' | 'javascript' | 'font' | 'json' | 'folder' | 'ban' | 'bolt';
|
|
35
36
|
export interface TreeNode {
|
|
36
37
|
id: string;
|
|
37
38
|
name: string;
|