react-native-inapp-inspector 2.2.2 → 2.2.3

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.
Files changed (97) hide show
  1. package/dist/commonjs/constants/version.d.ts +1 -1
  2. package/dist/commonjs/constants/version.js +1 -1
  3. package/dist/esm/constants/version.d.ts +1 -1
  4. package/dist/esm/constants/version.js +1 -1
  5. package/package.json +2 -1
  6. package/src/analytics.ts +35 -0
  7. package/src/bundle.ts +25 -0
  8. package/src/components/AnalyticsDetail.tsx +865 -0
  9. package/src/components/AnalyticsEventCard.tsx +441 -0
  10. package/src/components/AnalyticsGraph.tsx +583 -0
  11. package/src/components/AnimatedEntrance.tsx +64 -0
  12. package/src/components/AppHeaderLogo.tsx +109 -0
  13. package/src/components/BrandCircleIcon.tsx +144 -0
  14. package/src/components/BrandSquareIcon.tsx +144 -0
  15. package/src/components/CodeSnippet.tsx +725 -0
  16. package/src/components/ConsoleLogCard.tsx +628 -0
  17. package/src/components/CopyButton.tsx +87 -0
  18. package/src/components/DiffViewer.tsx +82 -0
  19. package/src/components/DomainHeader.tsx +237 -0
  20. package/src/components/EmptyState.tsx +73 -0
  21. package/src/components/EndOfListFooter.tsx +100 -0
  22. package/src/components/ErrorBoundary.tsx +688 -0
  23. package/src/components/HeadersSection.tsx +192 -0
  24. package/src/components/HighlightText.tsx +100 -0
  25. package/src/components/Inspector/AnalyticsFilterModal.tsx +1250 -0
  26. package/src/components/Inspector/AnalyticsTab.tsx +1336 -0
  27. package/src/components/Inspector/BundleTab.tsx +4731 -0
  28. package/src/components/Inspector/ConsoleTab.tsx +702 -0
  29. package/src/components/Inspector/CrashDetail.tsx +941 -0
  30. package/src/components/Inspector/CrashFilterModal.tsx +721 -0
  31. package/src/components/Inspector/CrashTab.tsx +871 -0
  32. package/src/components/Inspector/FabLauncher.tsx +80 -0
  33. package/src/components/Inspector/InspectorContext.tsx +28 -0
  34. package/src/components/Inspector/InspectorHeader.tsx +973 -0
  35. package/src/components/Inspector/LogDetail.tsx +1427 -0
  36. package/src/components/Inspector/MainScreen.tsx +258 -0
  37. package/src/components/Inspector/NavigationTracker.tsx +13 -0
  38. package/src/components/Inspector/NetworkDetail.tsx +794 -0
  39. package/src/components/Inspector/NetworkTab.tsx +1095 -0
  40. package/src/components/Inspector/NpmUpdateToast.tsx +392 -0
  41. package/src/components/Inspector/PerformanceTab.tsx +1894 -0
  42. package/src/components/Inspector/ReduxDetail.tsx +1651 -0
  43. package/src/components/Inspector/ReduxTab.tsx +954 -0
  44. package/src/components/Inspector/SettingsPanel.tsx +3181 -0
  45. package/src/components/Inspector/TabBar.tsx +187 -0
  46. package/src/components/Inspector/TelemetryConsentModal.tsx +392 -0
  47. package/src/components/Inspector/UpdateAvailableModal.tsx +545 -0
  48. package/src/components/JsonViewer.tsx +486 -0
  49. package/src/components/LogCard.tsx +491 -0
  50. package/src/components/LogSyntaxHighlighter.tsx +178 -0
  51. package/src/components/MetaAccordion.tsx +340 -0
  52. package/src/components/MiniBarChart.tsx +42 -0
  53. package/src/components/MiniLineChart.tsx +33 -0
  54. package/src/components/NetworkIcons.tsx +2118 -0
  55. package/src/components/SectionHeader.tsx +113 -0
  56. package/src/components/SegmentedTabs.tsx +83 -0
  57. package/src/components/Slider.tsx +300 -0
  58. package/src/components/SourcePageCard.tsx +148 -0
  59. package/src/components/Toast.tsx +131 -0
  60. package/src/components/TouchableScale.tsx +91 -0
  61. package/src/components/TreeNode.tsx +186 -0
  62. package/src/console.ts +24 -0
  63. package/src/constants/index.ts +38 -0
  64. package/src/constants/version.ts +3 -0
  65. package/src/crash.ts +32 -0
  66. package/src/customHooks/analyticsLogger.ts +336 -0
  67. package/src/customHooks/bundleAnalyzer.ts +1231 -0
  68. package/src/customHooks/consoleLogger.ts +497 -0
  69. package/src/customHooks/crashHandler.ts +944 -0
  70. package/src/customHooks/logFilters.ts +32 -0
  71. package/src/customHooks/networkLogger.ts +419 -0
  72. package/src/customHooks/performanceTracker.ts +1014 -0
  73. package/src/customHooks/reduxLogger.ts +406 -0
  74. package/src/customHooks/useAccordion.tsx +60 -0
  75. package/src/decorators/index.ts +184 -0
  76. package/src/helpers/gaAnalyticsRegistry.ts +204 -0
  77. package/src/helpers/index.ts +860 -0
  78. package/src/helpers/memoryManager.ts +138 -0
  79. package/src/helpers/searchQueryParser.ts +283 -0
  80. package/src/helpers/settingsStore.ts +171 -0
  81. package/src/helpers/telemetry.ts +505 -0
  82. package/src/helpers/toast.ts +17 -0
  83. package/src/i18n/index.ts +69 -0
  84. package/src/i18n/locales/en.json +1052 -0
  85. package/src/index.tsx +2336 -0
  86. package/src/native/NativeInspector.ts +397 -0
  87. package/src/native/NativeNetworkInspector.ts +24 -0
  88. package/src/network.ts +22 -0
  89. package/src/performance.ts +38 -0
  90. package/src/redux.ts +23 -0
  91. package/src/styles/AppColors.ts +408 -0
  92. package/src/styles/AppFonts.ts +8 -0
  93. package/src/styles/common.ts +209 -0
  94. package/src/styles/index.ts +1570 -0
  95. package/src/types/enums.ts +194 -0
  96. package/src/types/index.ts +34 -0
  97. package/src/types/interfaces.ts +515 -0
@@ -0,0 +1,441 @@
1
+ import React, {useEffect, useRef} from 'react';
2
+ import {Animated, StyleSheet, Text, View} from 'react-native';
3
+ import {AppColors} from '../styles/AppColors';
4
+ import {AppFonts} from '../styles/AppFonts';
5
+ import {AnalyticsEventCardProps} from '../types';
6
+ import {
7
+ formatGap,
8
+ formatTime,
9
+ getEventColor,
10
+ getEventCategory,
11
+ getCategoryColors,
12
+ } from '../helpers';
13
+ import {useTranslation} from '../i18n';
14
+ import HighlightText from './HighlightText';
15
+ import TouchableScale from './TouchableScale';
16
+ import {
17
+ CartIcon,
18
+ MoneyIcon,
19
+ GlobeIcon,
20
+ BoltIcon,
21
+ SparkleIcon,
22
+ ClockIcon,
23
+ } from './NetworkIcons';
24
+
25
+ // ─── Component ────────────────────────────────────────────────────────────────
26
+
27
+ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({
28
+ event,
29
+ onPress,
30
+ isNew = false,
31
+ searchStr = '',
32
+ msSincePrev,
33
+ computedScreenName,
34
+ }: AnalyticsEventCardProps) {
35
+ const {t} = useTranslation();
36
+ const color = getEventColor(event.name);
37
+ const paramCount = event.params ? Object.keys(event.params).length : 0;
38
+ const userPropCount = event.userProperties
39
+ ? Object.keys(event.userProperties).length
40
+ : 0;
41
+
42
+ const catKey = getEventCategory(event.name);
43
+ const tagColors = getCategoryColors(catKey);
44
+
45
+ // Flash animation for newly logged events
46
+ const flashOpacity = useRef(new Animated.Value(isNew ? 1 : 0)).current;
47
+ useEffect(() => {
48
+ if (isNew) {
49
+ Animated.timing(flashOpacity, {
50
+ toValue: 0,
51
+ duration: 1200,
52
+ useNativeDriver: true,
53
+ }).start();
54
+ }
55
+ }, [isNew]);
56
+
57
+ const showGap = msSincePrev != null && msSincePrev >= 2000;
58
+
59
+ const categoryLabel =
60
+ catKey === 'page_view'
61
+ ? t('analytics.pageViewCategory')
62
+ : catKey === 'ecommerce'
63
+ ? t('analytics.ecommerceCategory')
64
+ : catKey === 'system'
65
+ ? t('analytics.systemCategory')
66
+ : t('analytics.customCategory');
67
+
68
+ return (
69
+ <View style={cardStyles.container}>
70
+ {/* ── Gap Indicator ─────────────────────────────────────────────────── */}
71
+ {showGap && (
72
+ <View style={cardStyles.gapContainer}>
73
+ <View style={cardStyles.gapLine} />
74
+ <Text style={[cardStyles.gapText, {color: AppColors.grayTextWeak}]}>
75
+ +{formatGap(msSincePrev)}
76
+ </Text>
77
+ <View style={cardStyles.gapLine} />
78
+ </View>
79
+ )}
80
+
81
+ {/* ── Main Card ─────────────────────────────────────────────────────── */}
82
+ <TouchableScale
83
+ onPress={onPress}
84
+ style={[
85
+ cardStyles.modernCard,
86
+ {
87
+ borderLeftWidth: 3.5,
88
+ borderLeftColor: tagColors.text,
89
+ },
90
+ ]}>
91
+ <Animated.View
92
+ style={[
93
+ StyleSheet.absoluteFill,
94
+ {
95
+ backgroundColor: color,
96
+ opacity: flashOpacity.interpolate({
97
+ inputRange: [0, 1],
98
+ outputRange: [0, 0.08],
99
+ }),
100
+ },
101
+ ]}
102
+ />
103
+
104
+ {/* Top Row: Icon Badge, Event Name, Category Badge & Timestamp */}
105
+ <View style={cardStyles.cardHeader}>
106
+ <View style={{flexDirection: 'row', alignItems: 'center', gap: 7, flex: 1}}>
107
+ {/* Category Icon Badge */}
108
+ <View
109
+ style={[
110
+ cardStyles.iconBadge,
111
+ {backgroundColor: tagColors.bg, borderColor: tagColors.border},
112
+ ]}>
113
+ {catKey === 'ecommerce' ? (
114
+ <CartIcon color={tagColors.text} size={12} />
115
+ ) : catKey === 'page_view' ? (
116
+ <GlobeIcon color={tagColors.text} size={12} />
117
+ ) : catKey === 'system' ? (
118
+ <BoltIcon color={tagColors.text} size={12} />
119
+ ) : (
120
+ <SparkleIcon color={tagColors.text} size={12} />
121
+ )}
122
+ </View>
123
+
124
+ {/* Event Name */}
125
+ <HighlightText
126
+ text={event.name}
127
+ search={searchStr}
128
+ style={[cardStyles.eventName, {color: AppColors.primaryBlack}]}
129
+ highlightStyle={cardStyles.highlight}
130
+ numberOfLines={1}
131
+ />
132
+
133
+ {/* Category Pill Tag */}
134
+ <View
135
+ style={[
136
+ cardStyles.categoryBadge,
137
+ {backgroundColor: tagColors.bg, borderColor: tagColors.border},
138
+ ]}>
139
+ <Text
140
+ style={[cardStyles.categoryText, {color: tagColors.text}]}>
141
+ {categoryLabel}
142
+ </Text>
143
+ </View>
144
+
145
+ {/* Duplicate Multiplier */}
146
+ {event.count !== undefined && event.count > 0 ? (
147
+ <View
148
+ style={[
149
+ cardStyles.duplicateBadge,
150
+ event.count === 1 && {
151
+ backgroundColor: AppColors.grayBackground,
152
+ borderColor: AppColors.grayBorderSecondary,
153
+ },
154
+ ]}>
155
+ <Text
156
+ style={[
157
+ cardStyles.duplicateText,
158
+ event.count === 1 && {color: AppColors.grayTextStrong},
159
+ ]}>
160
+ {event.count}×
161
+ </Text>
162
+ </View>
163
+ ) : null}
164
+ </View>
165
+
166
+ {/* Timestamp */}
167
+ <View style={{flexDirection: 'row', alignItems: 'center', gap: 3}}>
168
+ <ClockIcon color={AppColors.grayTextWeak} size={10} />
169
+ <Text style={[cardStyles.timestamp, {color: AppColors.grayTextWeak}]}>
170
+ {formatTime(event.timestamp)}
171
+ </Text>
172
+ </View>
173
+ </View>
174
+
175
+ {/* Bottom Row: Metadata Chips (Screen, Params, Value) */}
176
+ <View style={cardStyles.cardBody}>
177
+ <View style={cardStyles.chipsRow}>
178
+ {(() => {
179
+ const rawScreenName =
180
+ computedScreenName ||
181
+ event.screenName ||
182
+ event.params?.firebase_screen ||
183
+ event.params?.screen_name ||
184
+ event.params?.firebase_screen_class;
185
+ if (!rawScreenName) return null;
186
+ const screenNameStr =
187
+ typeof rawScreenName === 'object'
188
+ ? JSON.stringify(rawScreenName)
189
+ : String(rawScreenName);
190
+ return (
191
+ <View
192
+ style={[
193
+ cardStyles.chip,
194
+ {
195
+ backgroundColor: `${AppColors.amber500}12`,
196
+ borderColor: `${AppColors.amber500}2E`,
197
+ },
198
+ ]}>
199
+ <View
200
+ style={[cardStyles.screenDot, {backgroundColor: AppColors.amber500}]}
201
+ />
202
+ <Text
203
+ style={[cardStyles.chipText, {color: AppColors.amber700, fontFamily: AppFonts.interBold}]}
204
+ numberOfLines={1}>
205
+ {screenNameStr}
206
+ </Text>
207
+ </View>
208
+ );
209
+ })()}
210
+
211
+ <View
212
+ style={[
213
+ cardStyles.chip,
214
+ {
215
+ backgroundColor: AppColors.grayBackground,
216
+ borderColor: AppColors.grayBorderSecondary,
217
+ },
218
+ ]}>
219
+ <Text style={[cardStyles.chipText, {color: AppColors.grayText}]}>
220
+ {'{} '} {paramCount} {t('analytics.params')}
221
+ </Text>
222
+ </View>
223
+
224
+ {userPropCount > 0 && (
225
+ <View
226
+ style={[
227
+ cardStyles.chip,
228
+ {
229
+ backgroundColor: `${AppColors.brandPurple}10`,
230
+ borderColor: `${AppColors.brandPurple}25`,
231
+ },
232
+ ]}>
233
+ <Text
234
+ style={[cardStyles.chipText, {color: AppColors.brandPurple, fontFamily: AppFonts.interBold}]}>
235
+ ★ {userPropCount} {t('analytics.props')}
236
+ </Text>
237
+ </View>
238
+ )}
239
+
240
+ {(() => {
241
+ const items = event.params?.items;
242
+ if (Array.isArray(items) && items.length > 0) {
243
+ return (
244
+ <View
245
+ style={[
246
+ cardStyles.chip,
247
+ {
248
+ backgroundColor: AppColors.amberBg,
249
+ borderColor: AppColors.amberBorder,
250
+ },
251
+ ]}>
252
+ <CartIcon color={AppColors.amber700} size={11} />
253
+ <Text
254
+ style={[
255
+ cardStyles.chipText,
256
+ {
257
+ color: AppColors.amber700,
258
+ fontFamily: AppFonts.interBold,
259
+ },
260
+ ]}>
261
+ {items.length}{' '}
262
+ {items.length === 1
263
+ ? t('analytics.item')
264
+ : t('analytics.items')}
265
+ </Text>
266
+ </View>
267
+ );
268
+ }
269
+ return null;
270
+ })()}
271
+
272
+ {(() => {
273
+ const val = event.params?.value ?? event.params?.price;
274
+ const currency = event.params?.currency ?? '';
275
+ const isPrimitive =
276
+ typeof val === 'string' || typeof val === 'number';
277
+ if (val != null && isPrimitive && String(val).trim() !== '') {
278
+ const currencyStr =
279
+ typeof currency === 'string' && currency.trim() !== ''
280
+ ? currency.toUpperCase()
281
+ : '';
282
+ return (
283
+ <View
284
+ style={[
285
+ cardStyles.chip,
286
+ {
287
+ backgroundColor: `${AppColors.emerald500}15`,
288
+ borderColor: `${AppColors.emerald500}35`,
289
+ },
290
+ ]}>
291
+ <MoneyIcon color={AppColors.emerald600} size={11} />
292
+ <Text
293
+ style={[
294
+ cardStyles.chipText,
295
+ {
296
+ color: AppColors.emerald600,
297
+ fontFamily: AppFonts.interBold,
298
+ },
299
+ ]}>
300
+ {String(val)} {currencyStr}
301
+ </Text>
302
+ </View>
303
+ );
304
+ }
305
+ return null;
306
+ })()}
307
+ </View>
308
+ </View>
309
+ </TouchableScale>
310
+ </View>
311
+ );
312
+ });
313
+
314
+ // ─── Styles ───────────────────────────────────────────────────────────────────
315
+
316
+ const cardStyles = StyleSheet.create({
317
+ container: {
318
+ paddingHorizontal: 10,
319
+ paddingVertical: 3,
320
+ },
321
+ gapContainer: {
322
+ flexDirection: 'row',
323
+ alignItems: 'center',
324
+ justifyContent: 'center',
325
+ marginVertical: 6,
326
+ gap: 8,
327
+ },
328
+ gapLine: {
329
+ flex: 1,
330
+ height: 1,
331
+ backgroundColor: `${AppColors.dividerColor}`,
332
+ },
333
+ gapText: {
334
+ fontFamily: AppFonts.interBold,
335
+ fontSize: 9.5,
336
+ color: AppColors.grayTextWeak,
337
+ letterSpacing: 0.5,
338
+ },
339
+ modernCard: {
340
+ backgroundColor: AppColors.white,
341
+ borderRadius: 10,
342
+ borderWidth: 1,
343
+ borderColor: AppColors.dividerColor,
344
+ padding: 10,
345
+ shadowColor: AppColors.black,
346
+ shadowOpacity: 0.03,
347
+ shadowRadius: 3,
348
+ shadowOffset: {width: 0, height: 1},
349
+ elevation: 1,
350
+ overflow: 'hidden',
351
+ gap: 8,
352
+ },
353
+ cardHeader: {
354
+ flexDirection: 'row',
355
+ justifyContent: 'space-between',
356
+ alignItems: 'center',
357
+ },
358
+ iconBadge: {
359
+ width: 22,
360
+ height: 22,
361
+ borderRadius: 6,
362
+ borderWidth: 1,
363
+ alignItems: 'center',
364
+ justifyContent: 'center',
365
+ },
366
+ eventName: {
367
+ fontFamily: AppFonts.interBold,
368
+ fontSize: 13,
369
+ letterSpacing: 0.1,
370
+ color: AppColors.primaryBlack,
371
+ },
372
+ timestamp: {
373
+ fontFamily: AppFonts.interMedium,
374
+ fontSize: 10,
375
+ color: AppColors.grayTextWeak,
376
+ },
377
+ highlight: {
378
+ backgroundColor: AppColors.yellowHighlight,
379
+ color: AppColors.primaryBlack,
380
+ borderRadius: 2,
381
+ },
382
+ cardBody: {
383
+ flexDirection: 'row',
384
+ alignItems: 'center',
385
+ justifyContent: 'space-between',
386
+ },
387
+ chipsRow: {
388
+ flexDirection: 'row',
389
+ alignItems: 'center',
390
+ flexWrap: 'wrap',
391
+ gap: 6,
392
+ flex: 1,
393
+ },
394
+ chip: {
395
+ flexDirection: 'row',
396
+ alignItems: 'center',
397
+ paddingHorizontal: 6,
398
+ paddingVertical: 2.5,
399
+ borderRadius: 5,
400
+ borderWidth: 1,
401
+ gap: 3.5,
402
+ },
403
+ chipText: {
404
+ fontFamily: AppFonts.interMedium,
405
+ fontSize: 10,
406
+ color: AppColors.grayText,
407
+ },
408
+ screenDot: {
409
+ width: 5,
410
+ height: 5,
411
+ borderRadius: 2.5,
412
+ },
413
+ duplicateBadge: {
414
+ backgroundColor: AppColors.roseBg,
415
+ borderColor: AppColors.roseBorder,
416
+ borderWidth: 1,
417
+ paddingHorizontal: 5,
418
+ paddingVertical: 1.5,
419
+ borderRadius: 4,
420
+ },
421
+ duplicateText: {
422
+ fontFamily: AppFonts.interBold,
423
+ fontSize: 9,
424
+ color: AppColors.rose600,
425
+ textTransform: 'uppercase',
426
+ },
427
+ categoryBadge: {
428
+ borderWidth: 1,
429
+ paddingHorizontal: 5,
430
+ paddingVertical: 1.5,
431
+ borderRadius: 4,
432
+ },
433
+ categoryText: {
434
+ fontFamily: AppFonts.interBold,
435
+ fontSize: 8.5,
436
+ textTransform: 'uppercase',
437
+ letterSpacing: 0.4,
438
+ },
439
+ });
440
+
441
+ export default AnalyticsEventCard;