react-native-inapp-inspector 1.1.14 → 1.1.16
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/README.md +133 -151
- package/dist/commonjs/assets/svgAssets.d.ts +3 -0
- package/dist/commonjs/assets/svgAssets.js +17 -0
- package/dist/commonjs/components/AnalyticsEventCard.d.ts +1 -14
- package/dist/commonjs/components/AnalyticsEventCard.js +34 -51
- package/dist/commonjs/components/AnalyticsGraph.d.ts +2 -6
- package/dist/commonjs/components/AnalyticsGraph.js +8 -8
- package/dist/commonjs/components/AnalyticsTabView.d.ts +15 -0
- package/dist/commonjs/components/AnalyticsTabView.js +157 -0
- package/dist/commonjs/components/AnimatedEntrance.d.ts +1 -1
- package/dist/commonjs/components/AnimatedEntrance.js +2 -2
- package/dist/commonjs/components/ApiDetailView.d.ts +22 -0
- package/dist/commonjs/components/ApiDetailView.js +304 -0
- package/dist/commonjs/components/ApisTabView.d.ts +33 -0
- package/dist/commonjs/components/ApisTabView.js +235 -0
- package/dist/commonjs/components/CodeSnippet.d.ts +1 -5
- package/dist/commonjs/components/CodeSnippet.js +34 -34
- package/dist/commonjs/components/ConsoleLogCard.d.ts +1 -8
- package/dist/commonjs/components/ConsoleLogCard.js +262 -442
- package/dist/commonjs/components/ConsoleLogDetailView.d.ts +9 -0
- package/dist/commonjs/components/ConsoleLogDetailView.js +278 -0
- package/dist/commonjs/components/ConsoleLogsTabView.d.ts +24 -0
- package/dist/commonjs/components/ConsoleLogsTabView.js +354 -0
- package/dist/commonjs/components/CopyButton.d.ts +1 -1
- package/dist/commonjs/components/CopyButton.js +4 -4
- package/dist/commonjs/components/DiffViewer.js +4 -2
- package/dist/commonjs/components/DomainHeader.js +66 -41
- package/dist/commonjs/components/EmptyState.d.ts +2 -2
- package/dist/commonjs/components/EmptyState.js +2 -2
- package/dist/commonjs/components/EndOfListFooter.d.ts +8 -0
- package/dist/commonjs/components/EndOfListFooter.js +89 -0
- package/dist/commonjs/components/ErrorBoundary.d.ts +5 -14
- package/dist/commonjs/components/ErrorBoundary.js +28 -28
- package/dist/commonjs/components/FloatingBubble.d.ts +14 -0
- package/dist/commonjs/components/FloatingBubble.js +75 -0
- package/dist/commonjs/components/HeadersSection.js +5 -3
- package/dist/commonjs/components/HighlightText.d.ts +1 -1
- package/dist/commonjs/components/HighlightText.js +5 -7
- package/dist/commonjs/components/Inspector/AnalyticsTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +231 -0
- package/dist/commonjs/components/Inspector/ConsoleTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/ConsoleTab.js +410 -0
- package/dist/commonjs/components/Inspector/FabLauncher.d.ts +3 -0
- package/dist/commonjs/components/Inspector/FabLauncher.js +54 -0
- package/dist/commonjs/components/Inspector/InsightsDashboard.d.ts +3 -0
- package/dist/commonjs/components/Inspector/InsightsDashboard.js +619 -0
- package/dist/commonjs/components/Inspector/InspectorContext.d.ts +5 -0
- package/dist/commonjs/components/Inspector/InspectorContext.js +18 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.d.ts +3 -0
- package/dist/commonjs/components/Inspector/InspectorHeader.js +452 -0
- package/dist/commonjs/components/Inspector/LogDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/LogDetail.js +963 -0
- package/dist/commonjs/components/Inspector/MainScreen.d.ts +3 -0
- package/dist/commonjs/components/Inspector/MainScreen.js +68 -0
- package/dist/commonjs/components/Inspector/NavigationTracker.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NavigationTracker.js +12 -0
- package/dist/commonjs/components/Inspector/NetworkDetail.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NetworkDetail.js +405 -0
- package/dist/commonjs/components/Inspector/NetworkTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/NetworkTab.js +282 -0
- package/dist/commonjs/components/Inspector/ReduxTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/ReduxTab.js +75 -0
- package/dist/commonjs/components/Inspector/SettingsPanel.d.ts +3 -0
- package/dist/commonjs/components/Inspector/SettingsPanel.js +1476 -0
- package/dist/commonjs/components/Inspector/TabBar.d.ts +3 -0
- package/dist/commonjs/components/Inspector/TabBar.js +95 -0
- package/dist/commonjs/components/Inspector/WebViewTab.d.ts +3 -0
- package/dist/commonjs/components/Inspector/WebViewTab.js +757 -0
- package/dist/commonjs/components/InspectorHeader.d.ts +19 -0
- package/dist/commonjs/components/InspectorHeader.js +329 -0
- package/dist/commonjs/components/InspectorTabBar.d.ts +16 -0
- package/dist/commonjs/components/InspectorTabBar.js +90 -0
- package/dist/commonjs/components/JsonViewer.d.ts +5 -2
- package/dist/commonjs/components/JsonViewer.js +111 -172
- package/dist/commonjs/components/LogCard.js +109 -86
- package/dist/commonjs/components/MetaAccordion.d.ts +1 -10
- package/dist/commonjs/components/MetaAccordion.js +23 -21
- package/dist/commonjs/components/NavigationTracker.d.ts +7 -0
- package/dist/commonjs/components/NavigationTracker.js +76 -0
- package/dist/commonjs/components/NetworkIcons.d.ts +6 -0
- package/dist/commonjs/components/NetworkIcons.js +54 -8
- package/dist/commonjs/components/ReduxTabView.d.ts +9 -0
- package/dist/commonjs/components/ReduxTabView.js +56 -0
- package/dist/commonjs/components/ReduxTreeView.d.ts +2 -2
- package/dist/commonjs/components/ReduxTreeView.js +243 -203
- package/dist/commonjs/components/SegmentedTabs.d.ts +15 -0
- package/dist/commonjs/components/SegmentedTabs.js +52 -0
- package/dist/commonjs/components/SettingsView.d.ts +13 -0
- package/dist/commonjs/components/SettingsView.js +328 -0
- package/dist/commonjs/components/TouchableScale.d.ts +2 -2
- package/dist/commonjs/components/TouchableScale.js +2 -2
- package/dist/commonjs/components/TreeNode.js +2 -2
- package/dist/commonjs/constants/index.js +1 -12
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/customHooks/consoleLogger.js +137 -13
- package/dist/commonjs/customHooks/networkLogger.d.ts +0 -1
- package/dist/commonjs/customHooks/networkLogger.js +0 -1
- package/dist/commonjs/customHooks/reduxLogger.d.ts +2 -9
- package/dist/commonjs/enums/index.d.ts +39 -0
- package/dist/commonjs/enums/index.js +50 -0
- package/dist/commonjs/helpers/index.d.ts +27 -1
- package/dist/commonjs/helpers/index.js +187 -12
- package/dist/commonjs/helpers/settingsStore.d.ts +2 -24
- package/dist/commonjs/i18n/en.json +144 -0
- package/dist/commonjs/i18n/index.d.ts +2 -0
- package/dist/commonjs/i18n/index.js +27 -0
- package/dist/commonjs/i18n/locales/en.json +314 -0
- package/dist/commonjs/index.d.ts +1 -2
- package/dist/commonjs/index.js +196 -4800
- package/dist/commonjs/styles/AppColors.d.ts +148 -0
- package/dist/commonjs/styles/AppColors.js +176 -0
- package/dist/commonjs/styles/common.d.ts +3 -0
- package/dist/commonjs/styles/common.js +201 -0
- package/dist/commonjs/styles/index.d.ts +167 -442
- package/dist/commonjs/styles/index.js +239 -471
- package/dist/commonjs/types/enums.d.ts +9 -0
- package/dist/commonjs/types/enums.js +4 -0
- package/dist/commonjs/types/index.d.ts +4 -111
- package/dist/commonjs/types/index.js +16 -0
- package/dist/commonjs/types/interfaces.d.ts +337 -0
- package/dist/commonjs/types/interfaces.js +2 -0
- package/dist/esm/assets/svgAssets.d.ts +3 -0
- package/dist/esm/assets/svgAssets.js +14 -0
- package/dist/esm/components/AnalyticsEventCard.d.ts +1 -14
- package/dist/esm/components/AnalyticsEventCard.js +32 -49
- package/dist/esm/components/AnalyticsGraph.d.ts +2 -6
- package/dist/esm/components/AnalyticsGraph.js +8 -8
- package/dist/esm/components/AnalyticsTabView.d.ts +15 -0
- package/dist/esm/components/AnalyticsTabView.js +151 -0
- package/dist/esm/components/AnimatedEntrance.d.ts +1 -1
- package/dist/esm/components/AnimatedEntrance.js +2 -2
- package/dist/esm/components/ApiDetailView.d.ts +22 -0
- package/dist/esm/components/ApiDetailView.js +264 -0
- package/dist/esm/components/ApisTabView.d.ts +33 -0
- package/dist/esm/components/ApisTabView.js +196 -0
- package/dist/esm/components/CodeSnippet.d.ts +1 -5
- package/dist/esm/components/CodeSnippet.js +34 -34
- package/dist/esm/components/ConsoleLogCard.d.ts +1 -8
- package/dist/esm/components/ConsoleLogCard.js +262 -409
- package/dist/esm/components/ConsoleLogDetailView.d.ts +9 -0
- package/dist/esm/components/ConsoleLogDetailView.js +271 -0
- package/dist/esm/components/ConsoleLogsTabView.d.ts +24 -0
- package/dist/esm/components/ConsoleLogsTabView.js +348 -0
- package/dist/esm/components/CopyButton.d.ts +1 -1
- package/dist/esm/components/CopyButton.js +5 -5
- package/dist/esm/components/DiffViewer.js +4 -2
- package/dist/esm/components/DomainHeader.js +66 -41
- package/dist/esm/components/EmptyState.d.ts +2 -2
- package/dist/esm/components/EmptyState.js +2 -2
- package/dist/esm/components/EndOfListFooter.d.ts +8 -0
- package/dist/esm/components/EndOfListFooter.js +83 -0
- package/dist/esm/components/ErrorBoundary.d.ts +5 -14
- package/dist/esm/components/ErrorBoundary.js +29 -29
- package/dist/esm/components/FloatingBubble.d.ts +14 -0
- package/dist/esm/components/FloatingBubble.js +68 -0
- package/dist/esm/components/HeadersSection.js +5 -3
- package/dist/esm/components/HighlightText.d.ts +1 -1
- package/dist/esm/components/HighlightText.js +5 -7
- package/dist/esm/components/Inspector/AnalyticsTab.d.ts +3 -0
- package/dist/esm/components/Inspector/AnalyticsTab.js +193 -0
- package/dist/esm/components/Inspector/ConsoleTab.d.ts +3 -0
- package/dist/esm/components/Inspector/ConsoleTab.js +372 -0
- package/dist/esm/components/Inspector/FabLauncher.d.ts +3 -0
- package/dist/esm/components/Inspector/FabLauncher.js +49 -0
- package/dist/esm/components/Inspector/InsightsDashboard.d.ts +3 -0
- package/dist/esm/components/Inspector/InsightsDashboard.js +614 -0
- package/dist/esm/components/Inspector/InspectorContext.d.ts +5 -0
- package/dist/esm/components/Inspector/InspectorContext.js +13 -0
- package/dist/esm/components/Inspector/InspectorHeader.d.ts +3 -0
- package/dist/esm/components/Inspector/InspectorHeader.js +447 -0
- package/dist/esm/components/Inspector/LogDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/LogDetail.js +925 -0
- package/dist/esm/components/Inspector/MainScreen.d.ts +3 -0
- package/dist/esm/components/Inspector/MainScreen.js +63 -0
- package/dist/esm/components/Inspector/NavigationTracker.d.ts +3 -0
- package/dist/esm/components/Inspector/NavigationTracker.js +10 -0
- package/dist/esm/components/Inspector/NetworkDetail.d.ts +3 -0
- package/dist/esm/components/Inspector/NetworkDetail.js +367 -0
- package/dist/esm/components/Inspector/NetworkTab.d.ts +3 -0
- package/dist/esm/components/Inspector/NetworkTab.js +244 -0
- package/dist/esm/components/Inspector/ReduxTab.d.ts +3 -0
- package/dist/esm/components/Inspector/ReduxTab.js +70 -0
- package/dist/esm/components/Inspector/SettingsPanel.d.ts +3 -0
- package/dist/esm/components/Inspector/SettingsPanel.js +1438 -0
- package/dist/esm/components/Inspector/TabBar.d.ts +3 -0
- package/dist/esm/components/Inspector/TabBar.js +90 -0
- package/dist/esm/components/Inspector/WebViewTab.d.ts +3 -0
- package/dist/esm/components/Inspector/WebViewTab.js +752 -0
- package/dist/esm/components/InspectorHeader.d.ts +19 -0
- package/dist/esm/components/InspectorHeader.js +323 -0
- package/dist/esm/components/InspectorTabBar.d.ts +16 -0
- package/dist/esm/components/InspectorTabBar.js +84 -0
- package/dist/esm/components/JsonViewer.d.ts +5 -2
- package/dist/esm/components/JsonViewer.js +112 -173
- package/dist/esm/components/LogCard.js +111 -88
- package/dist/esm/components/MetaAccordion.d.ts +1 -10
- package/dist/esm/components/MetaAccordion.js +23 -21
- package/dist/esm/components/NavigationTracker.d.ts +7 -0
- package/dist/esm/components/NavigationTracker.js +39 -0
- package/dist/esm/components/NetworkIcons.d.ts +6 -0
- package/dist/esm/components/NetworkIcons.js +46 -6
- package/dist/esm/components/ReduxTabView.d.ts +9 -0
- package/dist/esm/components/ReduxTabView.js +50 -0
- package/dist/esm/components/ReduxTreeView.d.ts +2 -2
- package/dist/esm/components/ReduxTreeView.js +245 -204
- package/dist/esm/components/SegmentedTabs.d.ts +15 -0
- package/dist/esm/components/SegmentedTabs.js +47 -0
- package/dist/esm/components/SettingsView.d.ts +13 -0
- package/dist/esm/components/SettingsView.js +321 -0
- package/dist/esm/components/TouchableScale.d.ts +2 -2
- package/dist/esm/components/TouchableScale.js +2 -2
- package/dist/esm/components/TreeNode.js +2 -2
- package/dist/esm/constants/index.js +1 -12
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/customHooks/consoleLogger.js +137 -13
- package/dist/esm/customHooks/networkLogger.d.ts +0 -1
- package/dist/esm/customHooks/networkLogger.js +0 -1
- package/dist/esm/customHooks/reduxLogger.d.ts +2 -9
- package/dist/esm/enums/index.d.ts +39 -0
- package/dist/esm/enums/index.js +47 -0
- package/dist/esm/helpers/index.d.ts +27 -1
- package/dist/esm/helpers/index.js +180 -11
- package/dist/esm/helpers/settingsStore.d.ts +2 -24
- package/dist/esm/i18n/en.json +144 -0
- package/dist/esm/i18n/index.d.ts +2 -0
- package/dist/esm/i18n/index.js +22 -0
- package/dist/esm/i18n/locales/en.json +314 -0
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +200 -4796
- package/dist/esm/styles/AppColors.d.ts +148 -0
- package/dist/esm/styles/AppColors.js +176 -0
- package/dist/esm/styles/common.d.ts +3 -0
- package/dist/esm/styles/common.js +197 -0
- package/dist/esm/styles/index.d.ts +167 -442
- package/dist/esm/styles/index.js +239 -471
- package/dist/esm/types/enums.d.ts +9 -0
- package/dist/esm/types/enums.js +3 -0
- package/dist/esm/types/index.d.ts +4 -111
- package/dist/esm/types/index.js +2 -1
- package/dist/esm/types/interfaces.d.ts +337 -0
- package/dist/esm/types/interfaces.js +1 -0
- package/example/App.tsx +145 -2
- package/example/README.md +33 -77
- package/package.json +3 -1
|
@@ -2,18 +2,19 @@ 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
6
|
import HighlightText from './HighlightText';
|
|
6
7
|
import TouchableScale from './TouchableScale';
|
|
7
8
|
// ─── Palette (Google Analytics colours) ───────────────────────────────────────
|
|
8
9
|
const EVENT_PALETTE = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
17
18
|
];
|
|
18
19
|
export function getEventColor(name) {
|
|
19
20
|
const safeName = typeof name === 'string' ? name : String(name || '');
|
|
@@ -24,24 +25,6 @@ export function getEventColor(name) {
|
|
|
24
25
|
return EVENT_PALETTE[Math.abs(hash) % EVENT_PALETTE.length];
|
|
25
26
|
}
|
|
26
27
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
27
|
-
function formatTime(ts) {
|
|
28
|
-
const d = new Date(ts);
|
|
29
|
-
const hh = String(d.getHours()).padStart(2, '0');
|
|
30
|
-
const mm = String(d.getMinutes()).padStart(2, '0');
|
|
31
|
-
const ss = String(d.getSeconds()).padStart(2, '0');
|
|
32
|
-
const ms = String(d.getMilliseconds()).padStart(3, '0');
|
|
33
|
-
return `${hh}:${mm}:${ss}.${ms}`;
|
|
34
|
-
}
|
|
35
|
-
function formatGap(ms) {
|
|
36
|
-
if (ms < 1000)
|
|
37
|
-
return `+${ms}ms`;
|
|
38
|
-
const s = Math.round(ms / 1000);
|
|
39
|
-
if (s < 60)
|
|
40
|
-
return `+${s}s`;
|
|
41
|
-
const m = Math.floor(s / 60);
|
|
42
|
-
const rem = s % 60;
|
|
43
|
-
return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
|
|
44
|
-
}
|
|
45
28
|
function getEventCategory(name) {
|
|
46
29
|
if (!name)
|
|
47
30
|
return 'Custom';
|
|
@@ -75,27 +58,27 @@ function getCategoryColors(category) {
|
|
|
75
58
|
switch (category) {
|
|
76
59
|
case 'Page View':
|
|
77
60
|
return {
|
|
78
|
-
bg:
|
|
79
|
-
border:
|
|
80
|
-
text:
|
|
61
|
+
bg: AppColors.blueBg,
|
|
62
|
+
border: AppColors.blueBorder,
|
|
63
|
+
text: AppColors.blue800,
|
|
81
64
|
};
|
|
82
65
|
case 'Ecommerce':
|
|
83
66
|
return {
|
|
84
|
-
bg:
|
|
85
|
-
border:
|
|
86
|
-
text:
|
|
67
|
+
bg: AppColors.greenBg,
|
|
68
|
+
border: AppColors.greenBorder,
|
|
69
|
+
text: AppColors.materialGreen,
|
|
87
70
|
};
|
|
88
71
|
case 'System':
|
|
89
72
|
return {
|
|
90
|
-
bg:
|
|
91
|
-
border:
|
|
92
|
-
text:
|
|
73
|
+
bg: AppColors.greyBg,
|
|
74
|
+
border: AppColors.greyBorder,
|
|
75
|
+
text: AppColors.grey600,
|
|
93
76
|
};
|
|
94
77
|
default:
|
|
95
78
|
return {
|
|
96
|
-
bg:
|
|
97
|
-
border:
|
|
98
|
-
text:
|
|
79
|
+
bg: AppColors.purpleBg,
|
|
80
|
+
border: AppColors.purpleBorder,
|
|
81
|
+
text: AppColors.purpleText,
|
|
99
82
|
};
|
|
100
83
|
}
|
|
101
84
|
}
|
|
@@ -215,8 +198,8 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
215
198
|
{(() => {
|
|
216
199
|
const items = event.params?.items;
|
|
217
200
|
if (Array.isArray(items) && items.length > 0) {
|
|
218
|
-
return (<View style={[cardStyles.chip, { backgroundColor:
|
|
219
|
-
<Text style={[cardStyles.chipText, { color:
|
|
201
|
+
return (<View style={[cardStyles.chip, { backgroundColor: AppColors.amberBg, borderColor: AppColors.amberBorder }]}>
|
|
202
|
+
<Text style={[cardStyles.chipText, { color: AppColors.amber700, fontFamily: AppFonts.interBold }]}>
|
|
220
203
|
🛒 {items.length} {items.length === 1 ? 'item' : 'items'}
|
|
221
204
|
</Text>
|
|
222
205
|
</View>);
|
|
@@ -230,8 +213,8 @@ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPre
|
|
|
230
213
|
const isPrimitive = typeof val === 'string' || typeof val === 'number';
|
|
231
214
|
if (isPrimitive) {
|
|
232
215
|
const currencyStr = typeof currency === 'string' || typeof currency === 'number' ? String(currency) : '';
|
|
233
|
-
return (<View style={[cardStyles.chip, { backgroundColor:
|
|
234
|
-
<Text style={[cardStyles.chipText, { color:
|
|
216
|
+
return (<View style={[cardStyles.chip, { backgroundColor: AppColors.emeraldBg, borderColor: AppColors.emeraldBorder }]}>
|
|
217
|
+
<Text style={[cardStyles.chipText, { color: AppColors.emerald600, fontFamily: AppFonts.interBold }]}>
|
|
235
218
|
💰 {String(val)} {currencyStr}
|
|
236
219
|
</Text>
|
|
237
220
|
</View>);
|
|
@@ -260,12 +243,12 @@ const cardStyles = StyleSheet.create({
|
|
|
260
243
|
letterSpacing: 0.5,
|
|
261
244
|
},
|
|
262
245
|
modernCard: {
|
|
263
|
-
backgroundColor:
|
|
246
|
+
backgroundColor: AppColors.white,
|
|
264
247
|
borderRadius: 8,
|
|
265
248
|
borderWidth: 1,
|
|
266
|
-
borderColor:
|
|
249
|
+
borderColor: AppColors.dividerColor,
|
|
267
250
|
padding: 8,
|
|
268
|
-
shadowColor:
|
|
251
|
+
shadowColor: AppColors.black,
|
|
269
252
|
shadowOpacity: 0.03,
|
|
270
253
|
shadowRadius: 3,
|
|
271
254
|
shadowOffset: { width: 0, height: 1 },
|
|
@@ -295,7 +278,7 @@ const cardStyles = StyleSheet.create({
|
|
|
295
278
|
color: AppColors.grayTextWeak,
|
|
296
279
|
},
|
|
297
280
|
highlight: {
|
|
298
|
-
backgroundColor:
|
|
281
|
+
backgroundColor: AppColors.yellowHighlight,
|
|
299
282
|
color: AppColors.primaryBlack,
|
|
300
283
|
borderRadius: 2,
|
|
301
284
|
},
|
|
@@ -333,8 +316,8 @@ const cardStyles = StyleSheet.create({
|
|
|
333
316
|
marginRight: 4,
|
|
334
317
|
},
|
|
335
318
|
duplicateBadge: {
|
|
336
|
-
backgroundColor:
|
|
337
|
-
borderColor:
|
|
319
|
+
backgroundColor: AppColors.roseBg,
|
|
320
|
+
borderColor: AppColors.roseBorder,
|
|
338
321
|
borderWidth: 1,
|
|
339
322
|
paddingHorizontal: 5,
|
|
340
323
|
paddingVertical: 2,
|
|
@@ -343,7 +326,7 @@ const cardStyles = StyleSheet.create({
|
|
|
343
326
|
duplicateText: {
|
|
344
327
|
fontFamily: AppFonts.interBold,
|
|
345
328
|
fontSize: 9,
|
|
346
|
-
color:
|
|
329
|
+
color: AppColors.rose600,
|
|
347
330
|
textTransform: 'uppercase',
|
|
348
331
|
letterSpacing: 0.5,
|
|
349
332
|
},
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
event: AnalyticsEvent;
|
|
5
|
-
accentColor: string;
|
|
6
|
-
}
|
|
7
|
-
declare const AnalyticsGraph: ({ event, accentColor }: Props) => React.JSX.Element;
|
|
2
|
+
import { AnalyticsGraphProps } from '../types';
|
|
3
|
+
declare const AnalyticsGraph: ({ event, accentColor }: AnalyticsGraphProps) => React.JSX.Element;
|
|
8
4
|
export default AnalyticsGraph;
|
|
@@ -53,7 +53,7 @@ const AnalyticsGraph = ({ event, accentColor }) => {
|
|
|
53
53
|
const typeData = [
|
|
54
54
|
{ label: 'Strings', value: paramTypes.string, color: AppColors.purple },
|
|
55
55
|
{ label: 'Numbers', value: paramTypes.number, color: AppColors.skyBlue },
|
|
56
|
-
{ label: 'Booleans', value: paramTypes.boolean, color:
|
|
56
|
+
{ label: 'Booleans', value: paramTypes.boolean, color: AppColors.amber500 }, // Amber
|
|
57
57
|
{ label: 'Objects', value: paramTypes.object, color: AppColors.greenColor },
|
|
58
58
|
].filter(d => d.value > 0);
|
|
59
59
|
strings.sort((a, b) => b.value - a.value);
|
|
@@ -94,7 +94,7 @@ const AnalyticsGraph = ({ event, accentColor }) => {
|
|
|
94
94
|
<BarChart data={filteredItems.map((item, i) => ({
|
|
95
95
|
label: item.item_name || item.item_id || `Item ${i + 1}`,
|
|
96
96
|
value: item.price,
|
|
97
|
-
}))} accentColor={AppColors.successGreen
|
|
97
|
+
}))} accentColor={AppColors.successGreen} maxBarWidth={maxBarWidth} isGradient={false}/>
|
|
98
98
|
</View>)}
|
|
99
99
|
</View>);
|
|
100
100
|
};
|
|
@@ -181,12 +181,12 @@ const GaugeChart = ({ data, accentColor, }) => {
|
|
|
181
181
|
paddingTop: 6,
|
|
182
182
|
paddingBottom: 6,
|
|
183
183
|
}}>
|
|
184
|
-
{data.map(
|
|
184
|
+
{data.map(d => {
|
|
185
185
|
const fillPct = Math.min(Math.abs(d.value) / maxVal, 1);
|
|
186
186
|
const strokeDashoffset = Math.max(circumference - fillPct * circumference, 0.001); // avoid exact 0
|
|
187
187
|
return (<View key={d.label} style={{ alignItems: 'center', width: 70 }}>
|
|
188
188
|
<Svg width="60" height="60" viewBox="0 0 60 60">
|
|
189
|
-
<Circle cx="30" cy="30" r={radius} stroke=
|
|
189
|
+
<Circle cx="30" cy="30" r={radius} stroke={AppColors.grayBorderSecondary} strokeWidth={stroke} fill="none"/>
|
|
190
190
|
<Circle cx="30" cy="30" r={radius} stroke={accentColor} strokeWidth={stroke} fill="none" strokeLinecap="round" strokeDasharray={circumference} strokeDashoffset={strokeDashoffset} rotation="-90" origin="30, 30"/>
|
|
191
191
|
</Svg>
|
|
192
192
|
<View style={{
|
|
@@ -248,12 +248,12 @@ const CalendarChart = ({ data, accentColor, }) => {
|
|
|
248
248
|
<View style={{
|
|
249
249
|
width: 58,
|
|
250
250
|
height: 62,
|
|
251
|
-
backgroundColor:
|
|
251
|
+
backgroundColor: AppColors.white,
|
|
252
252
|
borderRadius: 8,
|
|
253
253
|
borderWidth: 1,
|
|
254
254
|
borderColor: AppColors.grayBorderSecondary,
|
|
255
255
|
overflow: 'hidden',
|
|
256
|
-
shadowColor:
|
|
256
|
+
shadowColor: AppColors.black,
|
|
257
257
|
shadowOpacity: 0.05,
|
|
258
258
|
shadowRadius: 4,
|
|
259
259
|
shadowOffset: { width: 0, height: 2 },
|
|
@@ -269,7 +269,7 @@ const CalendarChart = ({ data, accentColor, }) => {
|
|
|
269
269
|
<Text style={{
|
|
270
270
|
fontFamily: AppFonts.interBold,
|
|
271
271
|
fontSize: 9,
|
|
272
|
-
color:
|
|
272
|
+
color: AppColors.white,
|
|
273
273
|
textTransform: 'uppercase',
|
|
274
274
|
letterSpacing: 0.5,
|
|
275
275
|
}}>
|
|
@@ -281,7 +281,7 @@ const CalendarChart = ({ data, accentColor, }) => {
|
|
|
281
281
|
flex: 1,
|
|
282
282
|
justifyContent: 'center',
|
|
283
283
|
alignItems: 'center',
|
|
284
|
-
backgroundColor:
|
|
284
|
+
backgroundColor: AppColors.grayBackground,
|
|
285
285
|
}}>
|
|
286
286
|
<Text style={{
|
|
287
287
|
fontFamily: AppFonts.interBold,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnalyticsEvent } from '../types';
|
|
3
|
+
interface AnalyticsTabViewProps {
|
|
4
|
+
analyticsSearch: string;
|
|
5
|
+
onSetAnalyticsSearch: (val: string) => void;
|
|
6
|
+
onDeleteEvents: () => void;
|
|
7
|
+
selectedEvent: AnalyticsEvent | null;
|
|
8
|
+
onSelectEvent: (event: AnalyticsEvent | null) => void;
|
|
9
|
+
filteredAnalyticsEvents: AnalyticsEvent[];
|
|
10
|
+
visibleAnalyticsEvents: AnalyticsEvent[];
|
|
11
|
+
currentUserProperties: Record<string, any>;
|
|
12
|
+
currentUserId: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const AnalyticsTabView: React.FC<AnalyticsTabViewProps>;
|
|
15
|
+
export default AnalyticsTabView;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatList, Pressable, Text, TextInput, View, } from 'react-native';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import TouchableScale from './TouchableScale';
|
|
5
|
+
import AnalyticsEventCard from './AnalyticsEventCard';
|
|
6
|
+
import AnalyticsDetail from './AnalyticsDetail';
|
|
7
|
+
import EmptyState from './EmptyState';
|
|
8
|
+
import AnimatedEntrance from './AnimatedEntrance';
|
|
9
|
+
import { SearchIcon, ClearIcon, WipeIcon, UserIcon, } from './NetworkIcons';
|
|
10
|
+
import { AppColors } from '../styles/AppColors';
|
|
11
|
+
import { AppFonts } from '../styles/AppFonts';
|
|
12
|
+
import styles from '../styles';
|
|
13
|
+
export const AnalyticsTabView = React.memo(({ analyticsSearch, onSetAnalyticsSearch, onDeleteEvents, selectedEvent, onSelectEvent, filteredAnalyticsEvents, visibleAnalyticsEvents, currentUserProperties, currentUserId, }) => {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const [userPropsExpanded, setUserPropsExpanded] = React.useState(false);
|
|
16
|
+
const renderItem = React.useCallback(({ item, index }) => (<AnimatedEntrance index={index} distance={8}>
|
|
17
|
+
<AnalyticsEventCard event={item} searchStr={analyticsSearch} onPress={() => onSelectEvent(item)}/>
|
|
18
|
+
</AnimatedEntrance>), [analyticsSearch, onSelectEvent]);
|
|
19
|
+
const keyExtractor = React.useCallback((item, index) => item.id != null ? item.id.toString() : index.toString(), []);
|
|
20
|
+
const renderAnalyticsHeader = () => {
|
|
21
|
+
const hasProps = Object.keys(currentUserProperties ?? {}).length > 0;
|
|
22
|
+
const total = visibleAnalyticsEvents.length;
|
|
23
|
+
const filtered = filteredAnalyticsEvents.length;
|
|
24
|
+
return (<View style={{ paddingHorizontal: 16, paddingTop: 8, paddingBottom: 4 }}>
|
|
25
|
+
{(hasProps || currentUserId) && (<View style={{
|
|
26
|
+
backgroundColor: AppColors.primaryLight,
|
|
27
|
+
borderRadius: 10,
|
|
28
|
+
borderWidth: 1,
|
|
29
|
+
borderColor: AppColors.grayBorderSecondary,
|
|
30
|
+
marginBottom: 10,
|
|
31
|
+
overflow: 'hidden',
|
|
32
|
+
}}>
|
|
33
|
+
<Pressable onPress={() => setUserPropsExpanded(v => !v)} style={{
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'space-between',
|
|
37
|
+
padding: 10,
|
|
38
|
+
backgroundColor: AppColors.grayBackground,
|
|
39
|
+
}}>
|
|
40
|
+
<View style={{
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
alignItems: 'center',
|
|
43
|
+
gap: 6,
|
|
44
|
+
}}>
|
|
45
|
+
<UserIcon color={AppColors.purple} size={14}/>
|
|
46
|
+
<Text style={{
|
|
47
|
+
fontFamily: AppFonts.interBold,
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
color: AppColors.primaryBlack,
|
|
50
|
+
}}>
|
|
51
|
+
{t('analytics.user_context')}
|
|
52
|
+
</Text>
|
|
53
|
+
{currentUserId && (<View style={{
|
|
54
|
+
backgroundColor: 'rgba(104,75,155,0.1)',
|
|
55
|
+
paddingHorizontal: 6,
|
|
56
|
+
paddingVertical: 1,
|
|
57
|
+
borderRadius: 4,
|
|
58
|
+
}}>
|
|
59
|
+
<Text style={{
|
|
60
|
+
fontFamily: AppFonts.interBold,
|
|
61
|
+
fontSize: 9,
|
|
62
|
+
color: AppColors.purple,
|
|
63
|
+
}}>
|
|
64
|
+
{t('analytics.id')}: {currentUserId}
|
|
65
|
+
</Text>
|
|
66
|
+
</View>)}
|
|
67
|
+
</View>
|
|
68
|
+
<Text style={{
|
|
69
|
+
fontFamily: AppFonts.interMedium,
|
|
70
|
+
fontSize: 11,
|
|
71
|
+
color: AppColors.purple,
|
|
72
|
+
}}>
|
|
73
|
+
{userPropsExpanded ? t('analytics.hide_props') : t('analytics.show_props')}
|
|
74
|
+
</Text>
|
|
75
|
+
</Pressable>
|
|
76
|
+
|
|
77
|
+
{userPropsExpanded && hasProps && (<View style={{
|
|
78
|
+
padding: 10,
|
|
79
|
+
borderTopWidth: 1,
|
|
80
|
+
borderTopColor: AppColors.dividerColor,
|
|
81
|
+
gap: 4,
|
|
82
|
+
}}>
|
|
83
|
+
{Object.entries(currentUserProperties ?? {}).map(([k, v]) => (<View key={k} style={{
|
|
84
|
+
flexDirection: 'row',
|
|
85
|
+
justifyContent: 'space-between',
|
|
86
|
+
}}>
|
|
87
|
+
<Text style={{
|
|
88
|
+
fontFamily: AppFonts.interMedium,
|
|
89
|
+
fontSize: 11,
|
|
90
|
+
color: AppColors.grayTextWeak,
|
|
91
|
+
}}>
|
|
92
|
+
{k}
|
|
93
|
+
</Text>
|
|
94
|
+
<Text style={{
|
|
95
|
+
fontFamily: AppFonts.interBold,
|
|
96
|
+
fontSize: 11,
|
|
97
|
+
color: AppColors.primaryBlack,
|
|
98
|
+
}}>
|
|
99
|
+
{String(v)}
|
|
100
|
+
</Text>
|
|
101
|
+
</View>))}
|
|
102
|
+
</View>)}
|
|
103
|
+
</View>)}
|
|
104
|
+
|
|
105
|
+
<Text style={[styles.resultCount, { marginBottom: 4 }]}>
|
|
106
|
+
{t('filters.showing_analytics', { filtered, total })}
|
|
107
|
+
</Text>
|
|
108
|
+
</View>);
|
|
109
|
+
};
|
|
110
|
+
return (<View style={{ flex: 1 }}>
|
|
111
|
+
{selectedEvent != null ? (<AnalyticsDetail event={selectedEvent} onClose={() => onSelectEvent(null)}/>) : (<View style={{ flex: 1 }}>
|
|
112
|
+
<View style={{
|
|
113
|
+
backgroundColor: AppColors.white,
|
|
114
|
+
borderBottomWidth: 1,
|
|
115
|
+
borderBottomColor: AppColors.dividerColor,
|
|
116
|
+
paddingBottom: 6,
|
|
117
|
+
}}>
|
|
118
|
+
<View style={[
|
|
119
|
+
styles.toolbarRow,
|
|
120
|
+
{ marginTop: 12, marginBottom: 8 },
|
|
121
|
+
]}>
|
|
122
|
+
<View style={styles.searchContainer}>
|
|
123
|
+
<SearchIcon color={AppColors.grayTextWeak} size={16}/>
|
|
124
|
+
<TextInput placeholder={t('search.analytics_placeholder')} placeholderTextColor={AppColors.grayTextWeak} value={analyticsSearch} onChangeText={onSetAnalyticsSearch} style={styles.searchInput} autoCorrect={false} autoCapitalize="none"/>
|
|
125
|
+
{analyticsSearch.length > 0 && (<Pressable onPress={() => onSetAnalyticsSearch('')} hitSlop={10} style={styles.clearBtn}>
|
|
126
|
+
<ClearIcon color={AppColors.grayTextWeak} size={14}/>
|
|
127
|
+
</Pressable>)}
|
|
128
|
+
</View>
|
|
129
|
+
|
|
130
|
+
<View style={styles.toolbarRight}>
|
|
131
|
+
<TouchableScale style={[
|
|
132
|
+
styles.toolbarBtn,
|
|
133
|
+
{
|
|
134
|
+
borderColor: 'rgba(255,46,87,0.22)',
|
|
135
|
+
backgroundColor: 'rgba(255,46,87,0.06)',
|
|
136
|
+
},
|
|
137
|
+
]} onPress={onDeleteEvents} hitSlop={6}>
|
|
138
|
+
<WipeIcon color={AppColors.errorColor} size={15}/>
|
|
139
|
+
</TouchableScale>
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
</View>
|
|
143
|
+
|
|
144
|
+
<FlatList data={filteredAnalyticsEvents} keyExtractor={keyExtractor} ListHeaderComponent={renderAnalyticsHeader} renderItem={renderItem} initialNumToRender={15} maxToRenderPerBatch={15} windowSize={7} removeClippedSubviews={true} ListEmptyComponent={<EmptyState isSearch={analyticsSearch.length > 0}/>} contentContainerStyle={[
|
|
145
|
+
styles.listContent,
|
|
146
|
+
filteredAnalyticsEvents.length === 0 && { flexGrow: 1 },
|
|
147
|
+
]} keyboardShouldPersistTaps="handled"/>
|
|
148
|
+
</View>)}
|
|
149
|
+
</View>);
|
|
150
|
+
});
|
|
151
|
+
export default AnalyticsTabView;
|
|
@@ -8,5 +8,5 @@ interface AnimatedEntranceProps {
|
|
|
8
8
|
index?: number;
|
|
9
9
|
style?: ViewStyle | ViewStyle[];
|
|
10
10
|
}
|
|
11
|
-
declare const AnimatedEntrance:
|
|
11
|
+
declare const AnimatedEntrance: React.NamedExoticComponent<AnimatedEntranceProps>;
|
|
12
12
|
export default AnimatedEntrance;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
|
-
const AnimatedEntrance = ({ children, delay = 0, distance = 10, duration = 220, index = 0, style, })
|
|
3
|
+
const AnimatedEntrance = React.memo(function AnimatedEntrance({ children, delay = 0, distance = 10, duration = 220, index = 0, style, }) {
|
|
4
4
|
const progress = useRef(new Animated.Value(0)).current;
|
|
5
5
|
useEffect(() => {
|
|
6
6
|
progress.setValue(0);
|
|
@@ -33,5 +33,5 @@ const AnimatedEntrance = ({ children, delay = 0, distance = 10, duration = 220,
|
|
|
33
33
|
]}>
|
|
34
34
|
{children}
|
|
35
35
|
</Animated.View>);
|
|
36
|
-
};
|
|
36
|
+
});
|
|
37
37
|
export default AnimatedEntrance;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NetworkLog } from '../types';
|
|
3
|
+
import { ApiDetailTab } from '../enums';
|
|
4
|
+
interface ApiDetailViewProps {
|
|
5
|
+
selected: NetworkLog;
|
|
6
|
+
apiDetailActiveTab: ApiDetailTab | 'metadata' | 'headers' | 'request' | 'response';
|
|
7
|
+
onSetApiDetailActiveTab: (tab: ApiDetailTab | 'metadata' | 'headers' | 'request' | 'response') => void;
|
|
8
|
+
detailSearch: string;
|
|
9
|
+
onSetDetailSearch: (val: string) => void;
|
|
10
|
+
reqExpanded: boolean;
|
|
11
|
+
onToggleReqExpanded: () => void;
|
|
12
|
+
resExpanded: boolean;
|
|
13
|
+
onToggleResExpanded: () => void;
|
|
14
|
+
showReqDiff: boolean;
|
|
15
|
+
onToggleShowReqDiff: () => void;
|
|
16
|
+
showResDiff: boolean;
|
|
17
|
+
onToggleShowResDiff: () => void;
|
|
18
|
+
prevRequestData: any;
|
|
19
|
+
prevResponseData: any;
|
|
20
|
+
}
|
|
21
|
+
export declare const ApiDetailView: React.FC<ApiDetailViewProps>;
|
|
22
|
+
export default ApiDetailView;
|