react-native-inapp-inspector 1.1.21 → 1.1.22
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 +85 -96
- package/dist/commonjs/components/Inspector/BundleTab.js +486 -651
- package/dist/commonjs/components/Inspector/PerformanceTab.js +185 -244
- package/dist/commonjs/components/Inspector/ReduxDetail.js +2 -2
- package/dist/commonjs/components/Inspector/ReduxTab.js +3 -3
- 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 +85 -95
- package/dist/esm/components/Inspector/BundleTab.js +489 -654
- package/dist/esm/components/Inspector/PerformanceTab.js +185 -244
- package/dist/esm/components/Inspector/ReduxDetail.js +2 -2
- package/dist/esm/components/Inspector/ReduxTab.js +3 -3
- 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
|
@@ -47,7 +47,9 @@ const AppFonts_1 = require("../styles/AppFonts");
|
|
|
47
47
|
const helpers_1 = require("../helpers");
|
|
48
48
|
// Stylesheet
|
|
49
49
|
const AppColors_1 = require("../styles/AppColors");
|
|
50
|
+
const i18n_1 = require("../i18n");
|
|
50
51
|
const AnalyticsDetail = ({ event, }) => {
|
|
52
|
+
const { t } = (0, i18n_1.useTranslation)();
|
|
51
53
|
const [expandDepth, setExpandDepth] = (0, react_1.useState)(1);
|
|
52
54
|
const [treeKey, setTreeKey] = (0, react_1.useState)(0);
|
|
53
55
|
const params = event.params ?? {};
|
|
@@ -67,7 +69,7 @@ const AnalyticsDetail = ({ event, }) => {
|
|
|
67
69
|
}
|
|
68
70
|
else if (isArray) {
|
|
69
71
|
typeLabel = 'array';
|
|
70
|
-
countLabel = `${jsonData.length} items`;
|
|
72
|
+
countLabel = `${jsonData.length} ${t('analytics.items')}`;
|
|
71
73
|
}
|
|
72
74
|
else if (isObject) {
|
|
73
75
|
typeLabel = 'object';
|
|
@@ -107,7 +109,7 @@ const AnalyticsDetail = ({ event, }) => {
|
|
|
107
109
|
fontSize: 12,
|
|
108
110
|
color: AppColors_1.AppColors.purple,
|
|
109
111
|
}}>
|
|
110
|
-
{expandDepth === 99 ? '
|
|
112
|
+
{expandDepth === 99 ? t('common.collapseAll') : t('common.expandAll')}
|
|
111
113
|
</react_native_1.Text>
|
|
112
114
|
</TouchableScale_1.default>
|
|
113
115
|
<react_native_1.View style={{
|
|
@@ -144,7 +146,7 @@ const AnalyticsDetail = ({ event, }) => {
|
|
|
144
146
|
</react_native_1.View>
|
|
145
147
|
</react_native_1.View>
|
|
146
148
|
|
|
147
|
-
<CopyButton_1.default value={JSON.stringify(jsonData, null, 2)} label=
|
|
149
|
+
<CopyButton_1.default value={JSON.stringify(jsonData, null, 2)} label={t('common.copyJson')}/>
|
|
148
150
|
</react_native_1.View>
|
|
149
151
|
|
|
150
152
|
{/* Direct JSON Viewer View */}
|
|
@@ -36,94 +36,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getEventColor = getEventColor;
|
|
40
39
|
const react_1 = __importStar(require("react"));
|
|
41
40
|
const react_native_1 = require("react-native");
|
|
42
41
|
const AppColors_1 = require("../styles/AppColors");
|
|
43
42
|
const AppFonts_1 = require("../styles/AppFonts");
|
|
44
43
|
const helpers_1 = require("../helpers");
|
|
44
|
+
const i18n_1 = require("../i18n");
|
|
45
45
|
const HighlightText_1 = __importDefault(require("./HighlightText"));
|
|
46
46
|
const TouchableScale_1 = __importDefault(require("./TouchableScale"));
|
|
47
|
-
// ─── Palette (Google Analytics colours) ───────────────────────────────────────
|
|
48
|
-
const EVENT_PALETTE = [
|
|
49
|
-
AppColors_1.AppColors.googleBlue, // blue
|
|
50
|
-
AppColors_1.AppColors.googleGreen, // green
|
|
51
|
-
AppColors_1.AppColors.googlePurple, // purple
|
|
52
|
-
AppColors_1.AppColors.googleTeal, // teal
|
|
53
|
-
AppColors_1.AppColors.googleRed, // red
|
|
54
|
-
AppColors_1.AppColors.googleOrange, // orange
|
|
55
|
-
AppColors_1.AppColors.blue700, // dark blue
|
|
56
|
-
AppColors_1.AppColors.materialGreen, // dark green
|
|
57
|
-
];
|
|
58
|
-
function getEventColor(name) {
|
|
59
|
-
const safeName = typeof name === 'string' ? name : String(name || '');
|
|
60
|
-
let hash = 0;
|
|
61
|
-
for (let i = 0; i < safeName.length; i++) {
|
|
62
|
-
hash = (hash * 31 + safeName.charCodeAt(i)) | 0;
|
|
63
|
-
}
|
|
64
|
-
return EVENT_PALETTE[Math.abs(hash) % EVENT_PALETTE.length];
|
|
65
|
-
}
|
|
66
|
-
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
67
|
-
function getEventCategory(name) {
|
|
68
|
-
if (!name)
|
|
69
|
-
return 'Custom';
|
|
70
|
-
const lowercaseName = name.toLowerCase();
|
|
71
|
-
if (lowercaseName === 'screen_view' || lowercaseName === 'page_view') {
|
|
72
|
-
return 'Page View';
|
|
73
|
-
}
|
|
74
|
-
// Ecommerce events
|
|
75
|
-
const ecommerceEvents = [
|
|
76
|
-
'purchase', 'add_to_cart', 'begin_checkout', 'view_item',
|
|
77
|
-
'select_item', 'remove_from_cart', 'view_cart',
|
|
78
|
-
'add_shipping_info', 'add_payment_info', 'refund',
|
|
79
|
-
'view_item_list', 'select_promotion', 'view_promotion'
|
|
80
|
-
];
|
|
81
|
-
if (ecommerceEvents.includes(lowercaseName)) {
|
|
82
|
-
return 'Ecommerce';
|
|
83
|
-
}
|
|
84
|
-
// Firebase System Auto-events
|
|
85
|
-
const systemEvents = [
|
|
86
|
-
'first_open', 'session_start', 'user_engagement',
|
|
87
|
-
'app_clear_data', 'app_exception', 'app_update', 'os_update',
|
|
88
|
-
'notification_receive', 'notification_open', 'notification_dismiss',
|
|
89
|
-
'screen_active', 'screen_inactive'
|
|
90
|
-
];
|
|
91
|
-
if (systemEvents.includes(lowercaseName) || lowercaseName.startsWith('firebase_') || lowercaseName.startsWith('_')) {
|
|
92
|
-
return 'System';
|
|
93
|
-
}
|
|
94
|
-
return 'Custom';
|
|
95
|
-
}
|
|
96
|
-
function getCategoryColors(category) {
|
|
97
|
-
switch (category) {
|
|
98
|
-
case 'Page View':
|
|
99
|
-
return {
|
|
100
|
-
bg: AppColors_1.AppColors.blueBg,
|
|
101
|
-
border: AppColors_1.AppColors.blueBorder,
|
|
102
|
-
text: AppColors_1.AppColors.blue800,
|
|
103
|
-
};
|
|
104
|
-
case 'Ecommerce':
|
|
105
|
-
return {
|
|
106
|
-
bg: AppColors_1.AppColors.greenBg,
|
|
107
|
-
border: AppColors_1.AppColors.greenBorder,
|
|
108
|
-
text: AppColors_1.AppColors.materialGreen,
|
|
109
|
-
};
|
|
110
|
-
case 'System':
|
|
111
|
-
return {
|
|
112
|
-
bg: AppColors_1.AppColors.greyBg,
|
|
113
|
-
border: AppColors_1.AppColors.greyBorder,
|
|
114
|
-
text: AppColors_1.AppColors.grey600,
|
|
115
|
-
};
|
|
116
|
-
default:
|
|
117
|
-
return {
|
|
118
|
-
bg: AppColors_1.AppColors.purpleBg,
|
|
119
|
-
border: AppColors_1.AppColors.purpleBorder,
|
|
120
|
-
text: AppColors_1.AppColors.purpleText,
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
47
|
// ─── Component ────────────────────────────────────────────────────────────────
|
|
125
48
|
const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ event, onPress, isNew = false, searchStr = '', msSincePrev, computedScreenName, }) {
|
|
126
|
-
const
|
|
49
|
+
const { t } = (0, i18n_1.useTranslation)();
|
|
50
|
+
const color = (0, helpers_1.getEventColor)(event.name);
|
|
127
51
|
const paramCount = event.params ? Object.keys(event.params).length : 0;
|
|
128
52
|
const userPropCount = event.userProperties
|
|
129
53
|
? Object.keys(event.userProperties).length
|
|
@@ -143,11 +67,19 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
143
67
|
return (<react_native_1.View style={cardStyles.container}>
|
|
144
68
|
{/* ── Gap Indicator ─────────────────────────────────────────────────── */}
|
|
145
69
|
{showGap && (<react_native_1.View style={cardStyles.gapContainer}>
|
|
146
|
-
<react_native_1.Text style={[cardStyles.gapText, { color: AppColors_1.AppColors.grayTextWeak }]}>
|
|
70
|
+
<react_native_1.Text style={[cardStyles.gapText, { color: AppColors_1.AppColors.grayTextWeak }]}>
|
|
71
|
+
{(0, helpers_1.formatGap)(msSincePrev)}
|
|
72
|
+
</react_native_1.Text>
|
|
147
73
|
</react_native_1.View>)}
|
|
148
74
|
|
|
149
75
|
{/* ── Main Card ─────────────────────────────────────────────────────── */}
|
|
150
|
-
<TouchableScale_1.default onPress={onPress} style={[
|
|
76
|
+
<TouchableScale_1.default onPress={onPress} style={[
|
|
77
|
+
cardStyles.modernCard,
|
|
78
|
+
{
|
|
79
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
80
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
81
|
+
},
|
|
82
|
+
]}>
|
|
151
83
|
<react_native_1.Animated.View style={[
|
|
152
84
|
react_native_1.StyleSheet.absoluteFill,
|
|
153
85
|
{
|
|
@@ -170,14 +102,21 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
170
102
|
</react_native_1.View>
|
|
171
103
|
|
|
172
104
|
{(() => {
|
|
173
|
-
const
|
|
174
|
-
const tagColors = getCategoryColors(
|
|
105
|
+
const catKey = (0, helpers_1.getEventCategory)(event.name);
|
|
106
|
+
const tagColors = (0, helpers_1.getCategoryColors)(catKey);
|
|
107
|
+
const categoryLabel = catKey === 'page_view'
|
|
108
|
+
? t('analytics.pageViewCategory')
|
|
109
|
+
: catKey === 'ecommerce'
|
|
110
|
+
? t('analytics.ecommerceCategory')
|
|
111
|
+
: catKey === 'system'
|
|
112
|
+
? t('analytics.systemCategory')
|
|
113
|
+
: t('analytics.customCategory');
|
|
175
114
|
return (<react_native_1.View style={[
|
|
176
115
|
cardStyles.categoryBadge,
|
|
177
116
|
{ backgroundColor: tagColors.bg, borderColor: tagColors.border },
|
|
178
117
|
]}>
|
|
179
118
|
<react_native_1.Text style={[cardStyles.categoryText, { color: tagColors.text }]}>
|
|
180
|
-
{
|
|
119
|
+
{categoryLabel}
|
|
181
120
|
</react_native_1.Text>
|
|
182
121
|
</react_native_1.View>);
|
|
183
122
|
})()}
|
|
@@ -193,7 +132,8 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
193
132
|
cardStyles.duplicateText,
|
|
194
133
|
event.count === 1 && { color: AppColors_1.AppColors.grayTextStrong },
|
|
195
134
|
]}>
|
|
196
|
-
{event.count}×
|
|
135
|
+
{event.count}×
|
|
136
|
+
{event.count > 1 ? ` ${t('analytics.duplicate')}` : ''}
|
|
197
137
|
</react_native_1.Text>
|
|
198
138
|
</react_native_1.View>) : null}
|
|
199
139
|
</react_native_1.View>
|
|
@@ -216,7 +156,13 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
216
156
|
const screenNameStr = typeof rawScreenName === 'object'
|
|
217
157
|
? JSON.stringify(rawScreenName)
|
|
218
158
|
: String(rawScreenName);
|
|
219
|
-
return (<react_native_1.View style={[
|
|
159
|
+
return (<react_native_1.View style={[
|
|
160
|
+
cardStyles.chip,
|
|
161
|
+
{
|
|
162
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
163
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
164
|
+
},
|
|
165
|
+
]}>
|
|
220
166
|
<react_native_1.View style={[cardStyles.screenDot, { backgroundColor: color }]}/>
|
|
221
167
|
<react_native_1.Text style={[cardStyles.chipText, { color: AppColors_1.AppColors.grayText }]} numberOfLines={1}>
|
|
222
168
|
{screenNameStr}
|
|
@@ -224,22 +170,51 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
224
170
|
</react_native_1.View>);
|
|
225
171
|
})()}
|
|
226
172
|
|
|
227
|
-
<react_native_1.View style={[
|
|
173
|
+
<react_native_1.View style={[
|
|
174
|
+
cardStyles.chip,
|
|
175
|
+
{
|
|
176
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
177
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
178
|
+
},
|
|
179
|
+
]}>
|
|
228
180
|
<react_native_1.Text style={[cardStyles.chipText, { color: AppColors_1.AppColors.grayText }]}>
|
|
229
|
-
{'{} '} {paramCount} params
|
|
181
|
+
{'{} '} {paramCount} {t('analytics.params')}
|
|
230
182
|
</react_native_1.Text>
|
|
231
183
|
</react_native_1.View>
|
|
232
184
|
|
|
233
|
-
{userPropCount > 0 && (<react_native_1.View style={[
|
|
234
|
-
|
|
185
|
+
{userPropCount > 0 && (<react_native_1.View style={[
|
|
186
|
+
cardStyles.chip,
|
|
187
|
+
{
|
|
188
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
189
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
190
|
+
},
|
|
191
|
+
]}>
|
|
192
|
+
<react_native_1.Text style={[cardStyles.chipText, { color: AppColors_1.AppColors.grayText }]}>
|
|
193
|
+
★ {userPropCount} {t('analytics.props')}
|
|
194
|
+
</react_native_1.Text>
|
|
235
195
|
</react_native_1.View>)}
|
|
236
196
|
|
|
237
197
|
{(() => {
|
|
238
198
|
const items = event.params?.items;
|
|
239
199
|
if (Array.isArray(items) && items.length > 0) {
|
|
240
|
-
return (<react_native_1.View style={[
|
|
241
|
-
|
|
242
|
-
|
|
200
|
+
return (<react_native_1.View style={[
|
|
201
|
+
cardStyles.chip,
|
|
202
|
+
{
|
|
203
|
+
backgroundColor: AppColors_1.AppColors.amberBg,
|
|
204
|
+
borderColor: AppColors_1.AppColors.amberBorder,
|
|
205
|
+
},
|
|
206
|
+
]}>
|
|
207
|
+
<react_native_1.Text style={[
|
|
208
|
+
cardStyles.chipText,
|
|
209
|
+
{
|
|
210
|
+
color: AppColors_1.AppColors.amber700,
|
|
211
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
212
|
+
},
|
|
213
|
+
]}>
|
|
214
|
+
🛒 {items.length}{' '}
|
|
215
|
+
{items.length === 1
|
|
216
|
+
? t('analytics.item')
|
|
217
|
+
: t('analytics.items')}
|
|
243
218
|
</react_native_1.Text>
|
|
244
219
|
</react_native_1.View>);
|
|
245
220
|
}
|
|
@@ -251,9 +226,23 @@ const AnalyticsEventCard = react_1.default.memo(function AnalyticsEventCard({ ev
|
|
|
251
226
|
const currency = event.params?.currency ?? '';
|
|
252
227
|
const isPrimitive = typeof val === 'string' || typeof val === 'number';
|
|
253
228
|
if (isPrimitive) {
|
|
254
|
-
const currencyStr = typeof currency === 'string' || typeof currency === 'number'
|
|
255
|
-
|
|
256
|
-
|
|
229
|
+
const currencyStr = typeof currency === 'string' || typeof currency === 'number'
|
|
230
|
+
? String(currency)
|
|
231
|
+
: '';
|
|
232
|
+
return (<react_native_1.View style={[
|
|
233
|
+
cardStyles.chip,
|
|
234
|
+
{
|
|
235
|
+
backgroundColor: AppColors_1.AppColors.emeraldBg,
|
|
236
|
+
borderColor: AppColors_1.AppColors.emeraldBorder,
|
|
237
|
+
},
|
|
238
|
+
]}>
|
|
239
|
+
<react_native_1.Text style={[
|
|
240
|
+
cardStyles.chipText,
|
|
241
|
+
{
|
|
242
|
+
color: AppColors_1.AppColors.emerald600,
|
|
243
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
244
|
+
},
|
|
245
|
+
]}>
|
|
257
246
|
💰 {String(val)} {currencyStr}
|
|
258
247
|
</react_native_1.Text>
|
|
259
248
|
</react_native_1.View>);
|