react-native-inapp-inspector 1.1.13 → 1.1.15
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 +9 -34
- 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 +120 -50
- 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/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 +90 -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 +232 -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 +281 -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 +4 -1
- package/dist/commonjs/components/JsonViewer.js +110 -171
- 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.js +241 -200
- 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/analyticsLogger.d.ts +8 -0
- package/dist/commonjs/customHooks/analyticsLogger.js +42 -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 +2 -3
- package/dist/commonjs/index.js +207 -4927
- 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 +219 -435
- package/dist/commonjs/styles/index.js +312 -488
- 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 +118 -48
- 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/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 +194 -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 +243 -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 +4 -1
- package/dist/esm/components/JsonViewer.js +111 -172
- 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.js +243 -202
- 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/analyticsLogger.d.ts +8 -0
- package/dist/esm/customHooks/analyticsLogger.js +37 -0
- 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 +2 -3
- package/dist/esm/index.js +207 -4923
- 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 +219 -435
- package/dist/esm/styles/index.js +312 -488
- 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 +88 -1
- package/example/android/app/build.gradle +29 -1
- package/example/android/app/src/main/java/com/example/MainApplication.kt +25 -0
- package/example/android/build.gradle +31 -4
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/gradle.properties +1 -0
- package/example/android/settings.gradle +20 -1
- package/example/package-lock.json +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SettingsView = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const react_native_linear_gradient_1 = __importDefault(require("react-native-linear-gradient"));
|
|
10
|
+
const react_i18next_1 = require("react-i18next");
|
|
11
|
+
const TouchableScale_1 = __importDefault(require("./TouchableScale"));
|
|
12
|
+
const NetworkIcons_1 = require("./NetworkIcons");
|
|
13
|
+
const AppColors_1 = require("../styles/AppColors");
|
|
14
|
+
const AppFonts_1 = require("../styles/AppFonts");
|
|
15
|
+
const styles_1 = require("../styles");
|
|
16
|
+
const settingsStore_1 = require("../helpers/settingsStore");
|
|
17
|
+
const SettingsView = ({ headerTopPadding, defaultTab, tabVisibility, onCloseSettings, onUpdateTabVisibility, onSetDefaultTab, }) => {
|
|
18
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
|
+
const [themeMode, setThemeMode] = react_1.default.useState(AppColors_1.AppColors.primaryLight === AppColors_1.AppColors.white ? 'light' : 'dark');
|
|
20
|
+
const handleToggleTheme = () => {
|
|
21
|
+
const nextIsDark = themeMode !== 'dark';
|
|
22
|
+
(0, styles_1.toggleGlobalTheme)(nextIsDark);
|
|
23
|
+
const newTheme = nextIsDark ? 'dark' : 'light';
|
|
24
|
+
setThemeMode(newTheme);
|
|
25
|
+
(0, settingsStore_1.saveSettings)({ isDark: nextIsDark, theme: newTheme });
|
|
26
|
+
};
|
|
27
|
+
const renderSettingRow = (opts) => {
|
|
28
|
+
return (<react_native_1.Pressable onPress={opts.onPress} disabled={!opts.onPress} style={{
|
|
29
|
+
flexDirection: 'row',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
paddingVertical: 12,
|
|
33
|
+
paddingHorizontal: 16,
|
|
34
|
+
borderBottomWidth: 1,
|
|
35
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
36
|
+
}}>
|
|
37
|
+
<react_native_1.View style={{
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
gap: 12,
|
|
41
|
+
flex: 1,
|
|
42
|
+
marginRight: 8,
|
|
43
|
+
}}>
|
|
44
|
+
<react_native_1.View style={{
|
|
45
|
+
width: 32,
|
|
46
|
+
height: 32,
|
|
47
|
+
borderRadius: 8,
|
|
48
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'center',
|
|
51
|
+
}}>
|
|
52
|
+
{opts.icon}
|
|
53
|
+
</react_native_1.View>
|
|
54
|
+
<react_native_1.View style={{ flex: 1 }}>
|
|
55
|
+
<react_native_1.Text style={{
|
|
56
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
57
|
+
fontSize: 13,
|
|
58
|
+
color: AppColors_1.AppColors.primaryBlack,
|
|
59
|
+
}}>
|
|
60
|
+
{opts.title}
|
|
61
|
+
</react_native_1.Text>
|
|
62
|
+
{opts.description ? (<react_native_1.Text style={{
|
|
63
|
+
fontFamily: AppFonts_1.AppFonts.interRegular,
|
|
64
|
+
fontSize: 11,
|
|
65
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
66
|
+
marginTop: 2,
|
|
67
|
+
}}>
|
|
68
|
+
{opts.description}
|
|
69
|
+
</react_native_1.Text>) : null}
|
|
70
|
+
</react_native_1.View>
|
|
71
|
+
</react_native_1.View>
|
|
72
|
+
{opts.rightComponent}
|
|
73
|
+
</react_native_1.Pressable>);
|
|
74
|
+
};
|
|
75
|
+
return (<react_native_1.View style={{ flex: 1, backgroundColor: AppColors_1.AppColors.grayBackground }}>
|
|
76
|
+
<react_native_linear_gradient_1.default colors={[AppColors_1.AppColors.purple, '#6B4EFF']} style={{ paddingTop: headerTopPadding, paddingBottom: 16 }}>
|
|
77
|
+
<react_native_1.View style={{
|
|
78
|
+
flexDirection: 'row',
|
|
79
|
+
alignItems: 'center',
|
|
80
|
+
paddingHorizontal: 16,
|
|
81
|
+
gap: 12,
|
|
82
|
+
}}>
|
|
83
|
+
<TouchableScale_1.default onPress={onCloseSettings} hitSlop={15} style={{
|
|
84
|
+
width: 36,
|
|
85
|
+
height: 36,
|
|
86
|
+
borderRadius: 18,
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
backgroundColor: 'rgba(255,255,255,0.18)',
|
|
90
|
+
}}>
|
|
91
|
+
<NetworkIcons_1.WhiteBackNavigation />
|
|
92
|
+
</TouchableScale_1.default>
|
|
93
|
+
<react_native_1.Text style={{
|
|
94
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
95
|
+
fontSize: 18,
|
|
96
|
+
color: AppColors_1.AppColors.white,
|
|
97
|
+
}}>
|
|
98
|
+
{t('settings.title')}
|
|
99
|
+
</react_native_1.Text>
|
|
100
|
+
</react_native_1.View>
|
|
101
|
+
</react_native_linear_gradient_1.default>
|
|
102
|
+
|
|
103
|
+
<react_native_1.ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 32, gap: 16, paddingTop: 16 }}>
|
|
104
|
+
{/* Theme Settings */}
|
|
105
|
+
<react_native_1.View style={{
|
|
106
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
107
|
+
marginHorizontal: 16,
|
|
108
|
+
borderRadius: 12,
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
111
|
+
overflow: 'hidden',
|
|
112
|
+
}}>
|
|
113
|
+
<react_native_1.View style={{
|
|
114
|
+
paddingHorizontal: 16,
|
|
115
|
+
paddingVertical: 10,
|
|
116
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
117
|
+
borderBottomWidth: 1,
|
|
118
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
119
|
+
}}>
|
|
120
|
+
<react_native_1.Text style={{
|
|
121
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
122
|
+
fontSize: 11,
|
|
123
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
124
|
+
letterSpacing: 0.5,
|
|
125
|
+
}}>
|
|
126
|
+
{t('settings.appearance')}
|
|
127
|
+
</react_native_1.Text>
|
|
128
|
+
</react_native_1.View>
|
|
129
|
+
{renderSettingRow({
|
|
130
|
+
icon: themeMode === 'dark' ? (<NetworkIcons_1.MoonIcon color={AppColors_1.AppColors.purple} size={16}/>) : (<NetworkIcons_1.SunIcon color={AppColors_1.AppColors.lightOrange} size={16}/>),
|
|
131
|
+
title: t('settings.dark_mode'),
|
|
132
|
+
description: t('settings.dark_mode_desc'),
|
|
133
|
+
rightComponent: (<react_native_1.Switch value={themeMode === 'dark'} onValueChange={handleToggleTheme} trackColor={{
|
|
134
|
+
false: AppColors_1.AppColors.grayBorderSecondary,
|
|
135
|
+
true: AppColors_1.AppColors.purple,
|
|
136
|
+
}}/>),
|
|
137
|
+
})}
|
|
138
|
+
</react_native_1.View>
|
|
139
|
+
|
|
140
|
+
{/* Module Visibility Settings */}
|
|
141
|
+
<react_native_1.View style={{
|
|
142
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
143
|
+
marginHorizontal: 16,
|
|
144
|
+
borderRadius: 12,
|
|
145
|
+
borderWidth: 1,
|
|
146
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
147
|
+
overflow: 'hidden',
|
|
148
|
+
}}>
|
|
149
|
+
<react_native_1.View style={{
|
|
150
|
+
paddingHorizontal: 16,
|
|
151
|
+
paddingVertical: 10,
|
|
152
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
153
|
+
borderBottomWidth: 1,
|
|
154
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
155
|
+
}}>
|
|
156
|
+
<react_native_1.Text style={{
|
|
157
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
158
|
+
fontSize: 11,
|
|
159
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
160
|
+
letterSpacing: 0.5,
|
|
161
|
+
}}>
|
|
162
|
+
{t('settings.module_visibility')}
|
|
163
|
+
</react_native_1.Text>
|
|
164
|
+
</react_native_1.View>
|
|
165
|
+
|
|
166
|
+
{renderSettingRow({
|
|
167
|
+
icon: <NetworkIcons_1.SignalIcon color={AppColors_1.AppColors.purple} size={16}/>,
|
|
168
|
+
title: t('settings.apis_tab'),
|
|
169
|
+
description: t('settings.apis_tab_desc'),
|
|
170
|
+
rightComponent: (<react_native_1.Switch value={tabVisibility.apis !== false} onValueChange={val => onUpdateTabVisibility('apis', val)} trackColor={{
|
|
171
|
+
false: AppColors_1.AppColors.grayBorderSecondary,
|
|
172
|
+
true: AppColors_1.AppColors.purple,
|
|
173
|
+
}}/>),
|
|
174
|
+
})}
|
|
175
|
+
|
|
176
|
+
{renderSettingRow({
|
|
177
|
+
icon: <NetworkIcons_1.TerminalIcon color={AppColors_1.AppColors.purple} size={16}/>,
|
|
178
|
+
title: t('settings.logs_tab'),
|
|
179
|
+
description: t('settings.logs_tab_desc'),
|
|
180
|
+
rightComponent: (<react_native_1.Switch value={tabVisibility.logs !== false} onValueChange={val => onUpdateTabVisibility('logs', val)} trackColor={{
|
|
181
|
+
false: AppColors_1.AppColors.grayBorderSecondary,
|
|
182
|
+
true: AppColors_1.AppColors.purple,
|
|
183
|
+
}}/>),
|
|
184
|
+
})}
|
|
185
|
+
|
|
186
|
+
{renderSettingRow({
|
|
187
|
+
icon: <NetworkIcons_1.AnalyticsIcon color={AppColors_1.AppColors.purple} size={16}/>,
|
|
188
|
+
title: t('settings.analytics_tab'),
|
|
189
|
+
description: t('settings.analytics_tab_desc'),
|
|
190
|
+
rightComponent: (<react_native_1.Switch value={tabVisibility.analytics !== false} onValueChange={val => onUpdateTabVisibility('analytics', val)} trackColor={{
|
|
191
|
+
false: AppColors_1.AppColors.grayBorderSecondary,
|
|
192
|
+
true: AppColors_1.AppColors.purple,
|
|
193
|
+
}}/>),
|
|
194
|
+
})}
|
|
195
|
+
|
|
196
|
+
{renderSettingRow({
|
|
197
|
+
icon: <NetworkIcons_1.TerminalIcon color={AppColors_1.AppColors.purple} size={16}/>,
|
|
198
|
+
title: t('settings.redux_tab'),
|
|
199
|
+
description: t('settings.redux_tab_desc'),
|
|
200
|
+
rightComponent: (<react_native_1.Switch value={tabVisibility.redux !== false} onValueChange={val => onUpdateTabVisibility('redux', val)} trackColor={{
|
|
201
|
+
false: AppColors_1.AppColors.grayBorderSecondary,
|
|
202
|
+
true: AppColors_1.AppColors.purple,
|
|
203
|
+
}}/>),
|
|
204
|
+
})}
|
|
205
|
+
</react_native_1.View>
|
|
206
|
+
|
|
207
|
+
{/* Landing Tab Preference */}
|
|
208
|
+
<react_native_1.View style={{
|
|
209
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
210
|
+
marginHorizontal: 16,
|
|
211
|
+
borderRadius: 12,
|
|
212
|
+
borderWidth: 1,
|
|
213
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
214
|
+
overflow: 'hidden',
|
|
215
|
+
}}>
|
|
216
|
+
<react_native_1.View style={{
|
|
217
|
+
paddingHorizontal: 16,
|
|
218
|
+
paddingVertical: 10,
|
|
219
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
220
|
+
borderBottomWidth: 1,
|
|
221
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
222
|
+
}}>
|
|
223
|
+
<react_native_1.Text style={{
|
|
224
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
225
|
+
fontSize: 11,
|
|
226
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
227
|
+
letterSpacing: 0.5,
|
|
228
|
+
}}>
|
|
229
|
+
{t('settings.default_landing_tab')}
|
|
230
|
+
</react_native_1.Text>
|
|
231
|
+
</react_native_1.View>
|
|
232
|
+
{['apis', 'logs', 'analytics', 'redux'].map(tabKey => {
|
|
233
|
+
if (!tabVisibility[tabKey])
|
|
234
|
+
return null;
|
|
235
|
+
const isSelected = defaultTab === tabKey;
|
|
236
|
+
return (<TouchableScale_1.default key={tabKey} onPress={() => onSetDefaultTab(tabKey)} style={{
|
|
237
|
+
flexDirection: 'row',
|
|
238
|
+
alignItems: 'center',
|
|
239
|
+
justifyContent: 'space-between',
|
|
240
|
+
paddingVertical: 12,
|
|
241
|
+
paddingHorizontal: 16,
|
|
242
|
+
borderBottomWidth: 1,
|
|
243
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
244
|
+
backgroundColor: isSelected
|
|
245
|
+
? 'rgba(107, 78, 255, 0.05)'
|
|
246
|
+
: AppColors_1.AppColors.primaryLight,
|
|
247
|
+
}}>
|
|
248
|
+
<react_native_1.Text style={{
|
|
249
|
+
fontFamily: isSelected
|
|
250
|
+
? AppFonts_1.AppFonts.interBold
|
|
251
|
+
: AppFonts_1.AppFonts.interMedium,
|
|
252
|
+
fontSize: 13,
|
|
253
|
+
color: isSelected
|
|
254
|
+
? AppColors_1.AppColors.purple
|
|
255
|
+
: AppColors_1.AppColors.primaryBlack,
|
|
256
|
+
}}>
|
|
257
|
+
{tabKey.toUpperCase()} Tab
|
|
258
|
+
</react_native_1.Text>
|
|
259
|
+
<react_native_1.View style={{
|
|
260
|
+
width: 18,
|
|
261
|
+
height: 18,
|
|
262
|
+
borderRadius: 9,
|
|
263
|
+
borderWidth: isSelected ? 5 : 2,
|
|
264
|
+
borderColor: isSelected
|
|
265
|
+
? AppColors_1.AppColors.purple
|
|
266
|
+
: AppColors_1.AppColors.grayBorderSecondary,
|
|
267
|
+
}}/>
|
|
268
|
+
</TouchableScale_1.default>);
|
|
269
|
+
})}
|
|
270
|
+
</react_native_1.View>
|
|
271
|
+
|
|
272
|
+
{/* Storage & Persistence Settings */}
|
|
273
|
+
<react_native_1.View style={{
|
|
274
|
+
backgroundColor: AppColors_1.AppColors.primaryLight,
|
|
275
|
+
marginHorizontal: 16,
|
|
276
|
+
borderRadius: 12,
|
|
277
|
+
borderWidth: 1,
|
|
278
|
+
borderColor: AppColors_1.AppColors.grayBorderSecondary,
|
|
279
|
+
overflow: 'hidden',
|
|
280
|
+
}}>
|
|
281
|
+
<react_native_1.View style={{
|
|
282
|
+
paddingHorizontal: 16,
|
|
283
|
+
paddingVertical: 10,
|
|
284
|
+
backgroundColor: AppColors_1.AppColors.grayBackground,
|
|
285
|
+
borderBottomWidth: 1,
|
|
286
|
+
borderBottomColor: AppColors_1.AppColors.dividerColor,
|
|
287
|
+
}}>
|
|
288
|
+
<react_native_1.Text style={{
|
|
289
|
+
fontFamily: AppFonts_1.AppFonts.interBold,
|
|
290
|
+
fontSize: 11,
|
|
291
|
+
color: AppColors_1.AppColors.grayTextWeak,
|
|
292
|
+
letterSpacing: 0.5,
|
|
293
|
+
}}>
|
|
294
|
+
{t('settings.storage_persistence')}
|
|
295
|
+
</react_native_1.Text>
|
|
296
|
+
</react_native_1.View>
|
|
297
|
+
{renderSettingRow({
|
|
298
|
+
icon: <NetworkIcons_1.GlobeIcon color={AppColors_1.AppColors.purple} size={16}/>,
|
|
299
|
+
title: t('settings.custom_storage'),
|
|
300
|
+
description: (0, settingsStore_1.isPersistentStorageAvailable)()
|
|
301
|
+
? t('settings.custom_storage_active')
|
|
302
|
+
: t('settings.custom_storage_memory'),
|
|
303
|
+
})}
|
|
304
|
+
|
|
305
|
+
{renderSettingRow({
|
|
306
|
+
icon: <NetworkIcons_1.TrashIcon color={AppColors_1.AppColors.errorColor} size={16}/>,
|
|
307
|
+
title: t('settings.reset_settings'),
|
|
308
|
+
description: t('settings.reset_settings_desc'),
|
|
309
|
+
onPress: () => {
|
|
310
|
+
react_native_1.Alert.alert(t('settings.reset_confirm_title'), t('settings.reset_confirm_msg'), [
|
|
311
|
+
{ text: t('header.cancel'), style: 'cancel' },
|
|
312
|
+
{
|
|
313
|
+
text: t('settings.reset'),
|
|
314
|
+
style: 'destructive',
|
|
315
|
+
onPress: () => {
|
|
316
|
+
(0, settingsStore_1.clearPersistedSettings)();
|
|
317
|
+
react_native_1.Alert.alert(t('settings.reset'), t('settings.reset_done'));
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
]);
|
|
321
|
+
},
|
|
322
|
+
})}
|
|
323
|
+
</react_native_1.View>
|
|
324
|
+
</react_native_1.ScrollView>
|
|
325
|
+
</react_native_1.View>);
|
|
326
|
+
};
|
|
327
|
+
exports.SettingsView = SettingsView;
|
|
328
|
+
exports.default = exports.SettingsView;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const TouchableScale:
|
|
2
|
+
declare const TouchableScale: React.NamedExoticComponent<{
|
|
3
3
|
onPress?: () => void;
|
|
4
4
|
style?: any;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
hitSlop?: any;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
}
|
|
8
|
+
}>;
|
|
9
9
|
export default TouchableScale;
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const react_1 = __importStar(require("react"));
|
|
37
37
|
const react_native_1 = require("react-native");
|
|
38
|
-
const TouchableScale = ({ onPress, style, children, hitSlop, disabled, })
|
|
38
|
+
const TouchableScale = react_1.default.memo(function TouchableScale({ onPress, style, children, hitSlop, disabled, }) {
|
|
39
39
|
if (react_native_1.Platform.OS === 'android') {
|
|
40
40
|
return (<react_native_1.Pressable disabled={disabled} onPress={onPress} hitSlop={hitSlop} style={({ pressed }) => [
|
|
41
41
|
style,
|
|
@@ -78,5 +78,5 @@ const TouchableScale = ({ onPress, style, children, hitSlop, disabled, }) => {
|
|
|
78
78
|
{children}
|
|
79
79
|
</react_native_1.Animated.View>
|
|
80
80
|
</react_native_1.Pressable>);
|
|
81
|
-
};
|
|
81
|
+
});
|
|
82
82
|
exports.default = TouchableScale;
|
|
@@ -46,8 +46,8 @@ const NetworkIcons_1 = require("./NetworkIcons");
|
|
|
46
46
|
const AppColors_1 = require("../styles/AppColors");
|
|
47
47
|
const styles_1 = __importDefault(require("../styles"));
|
|
48
48
|
const TreeNode = react_1.default.memo(function TreeNode({ data, name, level = 0, search, forceOpen, defaultExpandDepth, }) {
|
|
49
|
-
const [localOpen, setLocalOpen] = (0, react_1.useState)(level < (defaultExpandDepth ?? 1));
|
|
50
|
-
const open =
|
|
49
|
+
const [localOpen, setLocalOpen] = (0, react_1.useState)(forceOpen || level < (defaultExpandDepth ?? 1));
|
|
50
|
+
const open = localOpen;
|
|
51
51
|
const isObject = typeof data === 'object' && data !== null;
|
|
52
52
|
const isArray = Array.isArray(data);
|
|
53
53
|
function renderHighlighted(text) {
|
|
@@ -19,18 +19,7 @@ exports.METHOD_COLORS = {
|
|
|
19
19
|
PATCH: AppColors_1.AppColors.offerPurple,
|
|
20
20
|
DELETE: AppColors_1.AppColors.errorColor,
|
|
21
21
|
};
|
|
22
|
-
exports.DOMAIN_COLORS =
|
|
23
|
-
'#1a5276',
|
|
24
|
-
'#8e44ad',
|
|
25
|
-
'#1e8449',
|
|
26
|
-
'#c0392b',
|
|
27
|
-
'#d35400',
|
|
28
|
-
'#d68910',
|
|
29
|
-
'#16a085',
|
|
30
|
-
'#27ae60',
|
|
31
|
-
'#2c3e50',
|
|
32
|
-
'#c2185b',
|
|
33
|
-
];
|
|
22
|
+
exports.DOMAIN_COLORS = AppColors_1.AppColors.domainColors;
|
|
34
23
|
exports.DURATION_FAST_MS = 200;
|
|
35
24
|
exports.DURATION_SLOW_MS = 800;
|
|
36
25
|
// Package version — auto-generated from package.json at build time.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.1.
|
|
1
|
+
export declare const LIB_VERSION = "1.1.15";
|
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LIB_VERSION = void 0;
|
|
4
4
|
// AUTO-GENERATED FILE — do not edit by hand.
|
|
5
5
|
// Regenerated from package.json on every build by scripts/gen-version.js.
|
|
6
|
-
exports.LIB_VERSION = '1.1.
|
|
6
|
+
exports.LIB_VERSION = '1.1.15';
|
|
@@ -2,6 +2,14 @@ import { AnalyticsEvent } from '../types';
|
|
|
2
2
|
export declare const subscribeAnalyticsEvents: (callback: (events: AnalyticsEvent[]) => void) => () => void;
|
|
3
3
|
export declare const clearAnalyticsEvents: () => void;
|
|
4
4
|
export declare const getAnalyticsEvents: () => AnalyticsEvent[];
|
|
5
|
+
export declare const getCurrentUserProperties: () => {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
};
|
|
8
|
+
export declare const getCurrentUserId: () => string;
|
|
9
|
+
export declare const getDefaultEventParameters: () => {
|
|
10
|
+
[x: string]: any;
|
|
11
|
+
};
|
|
12
|
+
export declare const getCollectionEnabled: () => boolean;
|
|
5
13
|
/**
|
|
6
14
|
* Directly push an event into the inspector without going through Firebase.
|
|
7
15
|
* Useful for custom analytics wrappers or testing.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// setUserId(id)
|
|
23
23
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
|
|
25
|
+
exports.autoSetupAnalyticsLogger = exports.setupAnalyticsLogger = exports.logAnalyticsEvent = exports.getCollectionEnabled = exports.getDefaultEventParameters = exports.getCurrentUserId = exports.getCurrentUserProperties = exports.getAnalyticsEvents = exports.clearAnalyticsEvents = exports.subscribeAnalyticsEvents = void 0;
|
|
26
26
|
// ─── Internal state ───────────────────────────────────────────────────────────
|
|
27
27
|
let events = [];
|
|
28
28
|
let listeners = [];
|
|
@@ -30,6 +30,8 @@ let counter = 0;
|
|
|
30
30
|
// Running snapshot of user properties set so far — attached to every event
|
|
31
31
|
let currentUserProperties = {};
|
|
32
32
|
let currentUserId;
|
|
33
|
+
let currentDefaultEventParameters = {};
|
|
34
|
+
let isCollectionEnabled = true;
|
|
33
35
|
// ─── Core helpers ─────────────────────────────────────────────────────────────
|
|
34
36
|
const notify = () => {
|
|
35
37
|
const snapshot = [...events];
|
|
@@ -56,6 +58,14 @@ const clearAnalyticsEvents = () => {
|
|
|
56
58
|
exports.clearAnalyticsEvents = clearAnalyticsEvents;
|
|
57
59
|
const getAnalyticsEvents = () => [...events];
|
|
58
60
|
exports.getAnalyticsEvents = getAnalyticsEvents;
|
|
61
|
+
const getCurrentUserProperties = () => ({ ...currentUserProperties });
|
|
62
|
+
exports.getCurrentUserProperties = getCurrentUserProperties;
|
|
63
|
+
const getCurrentUserId = () => currentUserId;
|
|
64
|
+
exports.getCurrentUserId = getCurrentUserId;
|
|
65
|
+
const getDefaultEventParameters = () => ({ ...currentDefaultEventParameters });
|
|
66
|
+
exports.getDefaultEventParameters = getDefaultEventParameters;
|
|
67
|
+
const getCollectionEnabled = () => isCollectionEnabled;
|
|
68
|
+
exports.getCollectionEnabled = getCollectionEnabled;
|
|
59
69
|
// ─── Manual logging (escape hatch, rarely needed) ────────────────────────────
|
|
60
70
|
/**
|
|
61
71
|
* Directly push an event into the inspector without going through Firebase.
|
|
@@ -154,8 +164,39 @@ const setupAnalyticsLogger = (analyticsInstance) => {
|
|
|
154
164
|
const originalSetUserId = analyticsInstance.setUserId.bind(analyticsInstance);
|
|
155
165
|
analyticsInstance.setUserId = async (id) => {
|
|
156
166
|
currentUserId = id ?? undefined;
|
|
167
|
+
notify();
|
|
157
168
|
return originalSetUserId(id);
|
|
158
169
|
};
|
|
170
|
+
// ── setDefaultEventParameters ──────────────────────────────────────────────
|
|
171
|
+
if (typeof analyticsInstance.setDefaultEventParameters === 'function') {
|
|
172
|
+
const originalSetDefaultEventParameters = analyticsInstance.setDefaultEventParameters.bind(analyticsInstance);
|
|
173
|
+
analyticsInstance.setDefaultEventParameters = async (params) => {
|
|
174
|
+
currentDefaultEventParameters = params ?? {};
|
|
175
|
+
notify();
|
|
176
|
+
return originalSetDefaultEventParameters(params);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// ── setAnalyticsCollectionEnabled ───────────────────────────────────────────
|
|
180
|
+
if (typeof analyticsInstance.setAnalyticsCollectionEnabled === 'function') {
|
|
181
|
+
const originalSetAnalyticsCollectionEnabled = analyticsInstance.setAnalyticsCollectionEnabled.bind(analyticsInstance);
|
|
182
|
+
analyticsInstance.setAnalyticsCollectionEnabled = async (enabled) => {
|
|
183
|
+
isCollectionEnabled = enabled;
|
|
184
|
+
notify();
|
|
185
|
+
return originalSetAnalyticsCollectionEnabled(enabled);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// ── resetAnalyticsData ──────────────────────────────────────────────────────
|
|
189
|
+
if (typeof analyticsInstance.resetAnalyticsData === 'function') {
|
|
190
|
+
const originalResetAnalyticsData = analyticsInstance.resetAnalyticsData.bind(analyticsInstance);
|
|
191
|
+
analyticsInstance.resetAnalyticsData = async () => {
|
|
192
|
+
(0, exports.clearAnalyticsEvents)();
|
|
193
|
+
currentUserProperties = {};
|
|
194
|
+
currentUserId = undefined;
|
|
195
|
+
currentDefaultEventParameters = {};
|
|
196
|
+
notify();
|
|
197
|
+
return originalResetAnalyticsData();
|
|
198
|
+
};
|
|
199
|
+
}
|
|
159
200
|
};
|
|
160
201
|
exports.setupAnalyticsLogger = setupAnalyticsLogger;
|
|
161
202
|
const autoSetupAnalyticsLogger = () => {
|
|
@@ -27,26 +27,102 @@ const formatArgs = (args) => {
|
|
|
27
27
|
})
|
|
28
28
|
.join(' ');
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
// ─── Symbolication Helper for React Native Metro ────────────────────────────
|
|
31
|
+
const symbolicateStack = async (stackString) => {
|
|
32
|
+
if (typeof __DEV__ === 'undefined' || !__DEV__)
|
|
33
|
+
return null;
|
|
31
34
|
try {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
// 1. Try React Native's built-in symbolicateStackTrace if available
|
|
36
|
+
let symModule = null;
|
|
37
|
+
try {
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
symModule = require('react-native/Libraries/Core/Devtools/symbolicateStackTrace');
|
|
40
|
+
}
|
|
41
|
+
catch { }
|
|
42
|
+
const symFn = symModule?.default || symModule;
|
|
43
|
+
if (typeof symFn === 'function') {
|
|
44
|
+
const res = await symFn(stackString);
|
|
45
|
+
if (res && Array.isArray(res.stack)) {
|
|
46
|
+
return res.stack;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch { }
|
|
51
|
+
try {
|
|
52
|
+
// 2. Direct HTTP symbolication to Metro packager endpoint
|
|
53
|
+
const metroUrl = 'http://localhost:8081/symbolicate';
|
|
54
|
+
const response = await fetch(metroUrl, {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { 'Content-Type': 'application/json' },
|
|
57
|
+
body: JSON.stringify({ stack: stackString }),
|
|
58
|
+
});
|
|
59
|
+
if (response.ok) {
|
|
60
|
+
const json = await response.json();
|
|
61
|
+
if (json && Array.isArray(json.stack)) {
|
|
62
|
+
return json.stack;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
const getStackDetails = (args) => {
|
|
70
|
+
try {
|
|
71
|
+
let errorStack;
|
|
72
|
+
if (args && args.length > 0) {
|
|
73
|
+
for (const arg of args) {
|
|
74
|
+
if (arg instanceof Error && arg.stack) {
|
|
75
|
+
errorStack = arg.stack;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
else if (arg &&
|
|
79
|
+
typeof arg === 'object' &&
|
|
80
|
+
typeof arg.stack === 'string') {
|
|
81
|
+
errorStack = arg.stack;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const rawStack = new Error().stack;
|
|
87
|
+
const stackToUse = errorStack || rawStack;
|
|
88
|
+
if (!stackToUse)
|
|
89
|
+
return { caller: 'Unknown', errorStack };
|
|
90
|
+
const lines = stackToUse.split('\n');
|
|
91
|
+
let userCaller;
|
|
92
|
+
let fallbackCaller;
|
|
36
93
|
for (let i = 0; i < lines.length; i++) {
|
|
37
94
|
const line = lines[i];
|
|
38
|
-
|
|
39
|
-
|
|
95
|
+
if (!line ||
|
|
96
|
+
line.includes('consoleLogger') ||
|
|
40
97
|
line.includes('setupConsoleLogger') ||
|
|
41
|
-
line.includes('
|
|
42
|
-
line.
|
|
98
|
+
line.includes('react-native-inapp-inspector') ||
|
|
99
|
+
line.trim() === 'Error') {
|
|
43
100
|
continue;
|
|
44
101
|
}
|
|
45
|
-
|
|
102
|
+
const isInternal = line.includes('react-native/Libraries') ||
|
|
103
|
+
line.includes('setUpConsole') ||
|
|
104
|
+
line.includes('ExceptionsManager') ||
|
|
105
|
+
line.includes('MessageQueue') ||
|
|
106
|
+
line.includes('metro-runtime') ||
|
|
107
|
+
line.includes('regenerator-runtime');
|
|
108
|
+
if (!fallbackCaller && !line.includes('setUpConsole')) {
|
|
109
|
+
fallbackCaller = line.trim().replace(/^at /, '');
|
|
110
|
+
}
|
|
111
|
+
if (!isInternal) {
|
|
112
|
+
userCaller = line.trim().replace(/^at /, '');
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
46
115
|
}
|
|
116
|
+
const cleanedStack = lines
|
|
117
|
+
.filter(l => !l.includes('consoleLogger') &&
|
|
118
|
+
!l.includes('setupConsoleLogger'))
|
|
119
|
+
.join('\n');
|
|
120
|
+
const caller = userCaller || fallbackCaller || 'Unknown';
|
|
121
|
+
return { caller, stack: cleanedStack || stackToUse, errorStack, stackToUse };
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
return { caller: 'Unknown' };
|
|
47
125
|
}
|
|
48
|
-
catch (e) { }
|
|
49
|
-
return 'Unknown';
|
|
50
126
|
};
|
|
51
127
|
const notify = () => {
|
|
52
128
|
const snapshot = [...logs];
|
|
@@ -71,18 +147,66 @@ const addLog = (type, args, sourceMethod) => {
|
|
|
71
147
|
message.toLowerCase().trim().includes(prefix.toLowerCase().trim()))) {
|
|
72
148
|
return;
|
|
73
149
|
}
|
|
74
|
-
const caller =
|
|
150
|
+
const { caller, stack, errorStack, stackToUse } = getStackDetails(args);
|
|
75
151
|
const newLog = {
|
|
76
152
|
id: counter++,
|
|
77
153
|
type,
|
|
78
154
|
message,
|
|
79
155
|
timestamp: Date.now(),
|
|
80
156
|
caller,
|
|
157
|
+
stack,
|
|
158
|
+
errorStack,
|
|
159
|
+
rawArgs: args,
|
|
81
160
|
sourceMethod,
|
|
82
161
|
};
|
|
83
162
|
logs.unshift(newLog);
|
|
84
163
|
logs = logs.slice(0, MAX_LOGS);
|
|
85
164
|
notify();
|
|
165
|
+
// Asynchronously symbolicate stack trace using Metro in DEV mode
|
|
166
|
+
if (stackToUse && typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
167
|
+
const currentLogId = newLog.id;
|
|
168
|
+
symbolicateStack(stackToUse)
|
|
169
|
+
.then(symFrames => {
|
|
170
|
+
if (symFrames && Array.isArray(symFrames) && symFrames.length > 0) {
|
|
171
|
+
const symLines = [];
|
|
172
|
+
let symUserCaller;
|
|
173
|
+
for (const frame of symFrames) {
|
|
174
|
+
const file = (frame.file || '').replace(/^webpack:\/\/\/?/, '');
|
|
175
|
+
const method = frame.methodName || '<anonymous>';
|
|
176
|
+
const line = frame.lineNumber != null ? `:${frame.lineNumber}` : '';
|
|
177
|
+
const col = frame.column != null ? `:${frame.column}` : '';
|
|
178
|
+
const lineStr = `at ${method} (${file}${line}${col})`;
|
|
179
|
+
symLines.push(lineStr);
|
|
180
|
+
const isUserFile = file &&
|
|
181
|
+
!file.includes('node_modules') &&
|
|
182
|
+
!file.includes('react-native/') &&
|
|
183
|
+
!file.includes('consoleLogger') &&
|
|
184
|
+
!file.includes('setupConsoleLogger') &&
|
|
185
|
+
(file.endsWith('.tsx') ||
|
|
186
|
+
file.endsWith('.jsx') ||
|
|
187
|
+
file.endsWith('.ts') ||
|
|
188
|
+
file.endsWith('.js'));
|
|
189
|
+
if (!symUserCaller && isUserFile) {
|
|
190
|
+
symUserCaller = `${method} (${file}${line}${col})`;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const targetLog = logs.find(l => l.id === currentLogId);
|
|
194
|
+
if (targetLog) {
|
|
195
|
+
if (symUserCaller) {
|
|
196
|
+
targetLog.caller = symUserCaller;
|
|
197
|
+
}
|
|
198
|
+
else if (symLines.length > 0) {
|
|
199
|
+
targetLog.caller = symLines[0].replace(/^at /, '');
|
|
200
|
+
}
|
|
201
|
+
if (symLines.length > 0) {
|
|
202
|
+
targetLog.stack = symLines.join('\n');
|
|
203
|
+
}
|
|
204
|
+
notify();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
.catch(() => { });
|
|
209
|
+
}
|
|
86
210
|
}
|
|
87
211
|
catch (e) {
|
|
88
212
|
// Fail-safe to prevent crash during logging
|