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.
Files changed (250) hide show
  1. package/README.md +9 -34
  2. package/dist/commonjs/assets/svgAssets.d.ts +3 -0
  3. package/dist/commonjs/assets/svgAssets.js +17 -0
  4. package/dist/commonjs/components/AnalyticsEventCard.d.ts +1 -14
  5. package/dist/commonjs/components/AnalyticsEventCard.js +120 -50
  6. package/dist/commonjs/components/AnalyticsGraph.d.ts +2 -6
  7. package/dist/commonjs/components/AnalyticsGraph.js +8 -8
  8. package/dist/commonjs/components/AnalyticsTabView.d.ts +15 -0
  9. package/dist/commonjs/components/AnalyticsTabView.js +157 -0
  10. package/dist/commonjs/components/AnimatedEntrance.d.ts +1 -1
  11. package/dist/commonjs/components/AnimatedEntrance.js +2 -2
  12. package/dist/commonjs/components/ApiDetailView.d.ts +22 -0
  13. package/dist/commonjs/components/ApiDetailView.js +304 -0
  14. package/dist/commonjs/components/ApisTabView.d.ts +33 -0
  15. package/dist/commonjs/components/ApisTabView.js +235 -0
  16. package/dist/commonjs/components/CodeSnippet.d.ts +1 -5
  17. package/dist/commonjs/components/CodeSnippet.js +34 -34
  18. package/dist/commonjs/components/ConsoleLogCard.d.ts +1 -8
  19. package/dist/commonjs/components/ConsoleLogCard.js +262 -442
  20. package/dist/commonjs/components/ConsoleLogDetailView.d.ts +9 -0
  21. package/dist/commonjs/components/ConsoleLogDetailView.js +278 -0
  22. package/dist/commonjs/components/ConsoleLogsTabView.d.ts +24 -0
  23. package/dist/commonjs/components/ConsoleLogsTabView.js +354 -0
  24. package/dist/commonjs/components/DiffViewer.js +4 -2
  25. package/dist/commonjs/components/DomainHeader.js +66 -41
  26. package/dist/commonjs/components/EmptyState.d.ts +2 -2
  27. package/dist/commonjs/components/EmptyState.js +2 -2
  28. package/dist/commonjs/components/EndOfListFooter.d.ts +8 -0
  29. package/dist/commonjs/components/EndOfListFooter.js +90 -0
  30. package/dist/commonjs/components/ErrorBoundary.d.ts +5 -14
  31. package/dist/commonjs/components/ErrorBoundary.js +28 -28
  32. package/dist/commonjs/components/FloatingBubble.d.ts +14 -0
  33. package/dist/commonjs/components/FloatingBubble.js +75 -0
  34. package/dist/commonjs/components/HeadersSection.js +5 -3
  35. package/dist/commonjs/components/HighlightText.d.ts +1 -1
  36. package/dist/commonjs/components/HighlightText.js +5 -7
  37. package/dist/commonjs/components/Inspector/AnalyticsTab.d.ts +3 -0
  38. package/dist/commonjs/components/Inspector/AnalyticsTab.js +232 -0
  39. package/dist/commonjs/components/Inspector/ConsoleTab.d.ts +3 -0
  40. package/dist/commonjs/components/Inspector/ConsoleTab.js +410 -0
  41. package/dist/commonjs/components/Inspector/FabLauncher.d.ts +3 -0
  42. package/dist/commonjs/components/Inspector/FabLauncher.js +54 -0
  43. package/dist/commonjs/components/Inspector/InsightsDashboard.d.ts +3 -0
  44. package/dist/commonjs/components/Inspector/InsightsDashboard.js +619 -0
  45. package/dist/commonjs/components/Inspector/InspectorContext.d.ts +5 -0
  46. package/dist/commonjs/components/Inspector/InspectorContext.js +18 -0
  47. package/dist/commonjs/components/Inspector/InspectorHeader.d.ts +3 -0
  48. package/dist/commonjs/components/Inspector/InspectorHeader.js +452 -0
  49. package/dist/commonjs/components/Inspector/LogDetail.d.ts +3 -0
  50. package/dist/commonjs/components/Inspector/LogDetail.js +963 -0
  51. package/dist/commonjs/components/Inspector/MainScreen.d.ts +3 -0
  52. package/dist/commonjs/components/Inspector/MainScreen.js +68 -0
  53. package/dist/commonjs/components/Inspector/NavigationTracker.d.ts +3 -0
  54. package/dist/commonjs/components/Inspector/NavigationTracker.js +12 -0
  55. package/dist/commonjs/components/Inspector/NetworkDetail.d.ts +3 -0
  56. package/dist/commonjs/components/Inspector/NetworkDetail.js +405 -0
  57. package/dist/commonjs/components/Inspector/NetworkTab.d.ts +3 -0
  58. package/dist/commonjs/components/Inspector/NetworkTab.js +281 -0
  59. package/dist/commonjs/components/Inspector/ReduxTab.d.ts +3 -0
  60. package/dist/commonjs/components/Inspector/ReduxTab.js +75 -0
  61. package/dist/commonjs/components/Inspector/SettingsPanel.d.ts +3 -0
  62. package/dist/commonjs/components/Inspector/SettingsPanel.js +1476 -0
  63. package/dist/commonjs/components/Inspector/TabBar.d.ts +3 -0
  64. package/dist/commonjs/components/Inspector/TabBar.js +95 -0
  65. package/dist/commonjs/components/Inspector/WebViewTab.d.ts +3 -0
  66. package/dist/commonjs/components/Inspector/WebViewTab.js +757 -0
  67. package/dist/commonjs/components/InspectorHeader.d.ts +19 -0
  68. package/dist/commonjs/components/InspectorHeader.js +329 -0
  69. package/dist/commonjs/components/InspectorTabBar.d.ts +16 -0
  70. package/dist/commonjs/components/InspectorTabBar.js +90 -0
  71. package/dist/commonjs/components/JsonViewer.d.ts +4 -1
  72. package/dist/commonjs/components/JsonViewer.js +110 -171
  73. package/dist/commonjs/components/LogCard.js +109 -86
  74. package/dist/commonjs/components/MetaAccordion.d.ts +1 -10
  75. package/dist/commonjs/components/MetaAccordion.js +23 -21
  76. package/dist/commonjs/components/NavigationTracker.d.ts +7 -0
  77. package/dist/commonjs/components/NavigationTracker.js +76 -0
  78. package/dist/commonjs/components/NetworkIcons.d.ts +6 -0
  79. package/dist/commonjs/components/NetworkIcons.js +54 -8
  80. package/dist/commonjs/components/ReduxTabView.d.ts +9 -0
  81. package/dist/commonjs/components/ReduxTabView.js +56 -0
  82. package/dist/commonjs/components/ReduxTreeView.js +241 -200
  83. package/dist/commonjs/components/SegmentedTabs.d.ts +15 -0
  84. package/dist/commonjs/components/SegmentedTabs.js +52 -0
  85. package/dist/commonjs/components/SettingsView.d.ts +13 -0
  86. package/dist/commonjs/components/SettingsView.js +328 -0
  87. package/dist/commonjs/components/TouchableScale.d.ts +2 -2
  88. package/dist/commonjs/components/TouchableScale.js +2 -2
  89. package/dist/commonjs/components/TreeNode.js +2 -2
  90. package/dist/commonjs/constants/index.js +1 -12
  91. package/dist/commonjs/constants/version.d.ts +1 -1
  92. package/dist/commonjs/constants/version.js +1 -1
  93. package/dist/commonjs/customHooks/analyticsLogger.d.ts +8 -0
  94. package/dist/commonjs/customHooks/analyticsLogger.js +42 -1
  95. package/dist/commonjs/customHooks/consoleLogger.js +137 -13
  96. package/dist/commonjs/customHooks/networkLogger.d.ts +0 -1
  97. package/dist/commonjs/customHooks/networkLogger.js +0 -1
  98. package/dist/commonjs/customHooks/reduxLogger.d.ts +2 -9
  99. package/dist/commonjs/enums/index.d.ts +39 -0
  100. package/dist/commonjs/enums/index.js +50 -0
  101. package/dist/commonjs/helpers/index.d.ts +27 -1
  102. package/dist/commonjs/helpers/index.js +187 -12
  103. package/dist/commonjs/helpers/settingsStore.d.ts +2 -24
  104. package/dist/commonjs/i18n/en.json +144 -0
  105. package/dist/commonjs/i18n/index.d.ts +2 -0
  106. package/dist/commonjs/i18n/index.js +27 -0
  107. package/dist/commonjs/i18n/locales/en.json +314 -0
  108. package/dist/commonjs/index.d.ts +2 -3
  109. package/dist/commonjs/index.js +207 -4927
  110. package/dist/commonjs/styles/AppColors.d.ts +148 -0
  111. package/dist/commonjs/styles/AppColors.js +176 -0
  112. package/dist/commonjs/styles/common.d.ts +3 -0
  113. package/dist/commonjs/styles/common.js +201 -0
  114. package/dist/commonjs/styles/index.d.ts +219 -435
  115. package/dist/commonjs/styles/index.js +312 -488
  116. package/dist/commonjs/types/enums.d.ts +9 -0
  117. package/dist/commonjs/types/enums.js +4 -0
  118. package/dist/commonjs/types/index.d.ts +4 -111
  119. package/dist/commonjs/types/index.js +16 -0
  120. package/dist/commonjs/types/interfaces.d.ts +337 -0
  121. package/dist/commonjs/types/interfaces.js +2 -0
  122. package/dist/esm/assets/svgAssets.d.ts +3 -0
  123. package/dist/esm/assets/svgAssets.js +14 -0
  124. package/dist/esm/components/AnalyticsEventCard.d.ts +1 -14
  125. package/dist/esm/components/AnalyticsEventCard.js +118 -48
  126. package/dist/esm/components/AnalyticsGraph.d.ts +2 -6
  127. package/dist/esm/components/AnalyticsGraph.js +8 -8
  128. package/dist/esm/components/AnalyticsTabView.d.ts +15 -0
  129. package/dist/esm/components/AnalyticsTabView.js +151 -0
  130. package/dist/esm/components/AnimatedEntrance.d.ts +1 -1
  131. package/dist/esm/components/AnimatedEntrance.js +2 -2
  132. package/dist/esm/components/ApiDetailView.d.ts +22 -0
  133. package/dist/esm/components/ApiDetailView.js +264 -0
  134. package/dist/esm/components/ApisTabView.d.ts +33 -0
  135. package/dist/esm/components/ApisTabView.js +196 -0
  136. package/dist/esm/components/CodeSnippet.d.ts +1 -5
  137. package/dist/esm/components/CodeSnippet.js +34 -34
  138. package/dist/esm/components/ConsoleLogCard.d.ts +1 -8
  139. package/dist/esm/components/ConsoleLogCard.js +262 -409
  140. package/dist/esm/components/ConsoleLogDetailView.d.ts +9 -0
  141. package/dist/esm/components/ConsoleLogDetailView.js +271 -0
  142. package/dist/esm/components/ConsoleLogsTabView.d.ts +24 -0
  143. package/dist/esm/components/ConsoleLogsTabView.js +348 -0
  144. package/dist/esm/components/DiffViewer.js +4 -2
  145. package/dist/esm/components/DomainHeader.js +66 -41
  146. package/dist/esm/components/EmptyState.d.ts +2 -2
  147. package/dist/esm/components/EmptyState.js +2 -2
  148. package/dist/esm/components/EndOfListFooter.d.ts +8 -0
  149. package/dist/esm/components/EndOfListFooter.js +83 -0
  150. package/dist/esm/components/ErrorBoundary.d.ts +5 -14
  151. package/dist/esm/components/ErrorBoundary.js +29 -29
  152. package/dist/esm/components/FloatingBubble.d.ts +14 -0
  153. package/dist/esm/components/FloatingBubble.js +68 -0
  154. package/dist/esm/components/HeadersSection.js +5 -3
  155. package/dist/esm/components/HighlightText.d.ts +1 -1
  156. package/dist/esm/components/HighlightText.js +5 -7
  157. package/dist/esm/components/Inspector/AnalyticsTab.d.ts +3 -0
  158. package/dist/esm/components/Inspector/AnalyticsTab.js +194 -0
  159. package/dist/esm/components/Inspector/ConsoleTab.d.ts +3 -0
  160. package/dist/esm/components/Inspector/ConsoleTab.js +372 -0
  161. package/dist/esm/components/Inspector/FabLauncher.d.ts +3 -0
  162. package/dist/esm/components/Inspector/FabLauncher.js +49 -0
  163. package/dist/esm/components/Inspector/InsightsDashboard.d.ts +3 -0
  164. package/dist/esm/components/Inspector/InsightsDashboard.js +614 -0
  165. package/dist/esm/components/Inspector/InspectorContext.d.ts +5 -0
  166. package/dist/esm/components/Inspector/InspectorContext.js +13 -0
  167. package/dist/esm/components/Inspector/InspectorHeader.d.ts +3 -0
  168. package/dist/esm/components/Inspector/InspectorHeader.js +447 -0
  169. package/dist/esm/components/Inspector/LogDetail.d.ts +3 -0
  170. package/dist/esm/components/Inspector/LogDetail.js +925 -0
  171. package/dist/esm/components/Inspector/MainScreen.d.ts +3 -0
  172. package/dist/esm/components/Inspector/MainScreen.js +63 -0
  173. package/dist/esm/components/Inspector/NavigationTracker.d.ts +3 -0
  174. package/dist/esm/components/Inspector/NavigationTracker.js +10 -0
  175. package/dist/esm/components/Inspector/NetworkDetail.d.ts +3 -0
  176. package/dist/esm/components/Inspector/NetworkDetail.js +367 -0
  177. package/dist/esm/components/Inspector/NetworkTab.d.ts +3 -0
  178. package/dist/esm/components/Inspector/NetworkTab.js +243 -0
  179. package/dist/esm/components/Inspector/ReduxTab.d.ts +3 -0
  180. package/dist/esm/components/Inspector/ReduxTab.js +70 -0
  181. package/dist/esm/components/Inspector/SettingsPanel.d.ts +3 -0
  182. package/dist/esm/components/Inspector/SettingsPanel.js +1438 -0
  183. package/dist/esm/components/Inspector/TabBar.d.ts +3 -0
  184. package/dist/esm/components/Inspector/TabBar.js +90 -0
  185. package/dist/esm/components/Inspector/WebViewTab.d.ts +3 -0
  186. package/dist/esm/components/Inspector/WebViewTab.js +752 -0
  187. package/dist/esm/components/InspectorHeader.d.ts +19 -0
  188. package/dist/esm/components/InspectorHeader.js +323 -0
  189. package/dist/esm/components/InspectorTabBar.d.ts +16 -0
  190. package/dist/esm/components/InspectorTabBar.js +84 -0
  191. package/dist/esm/components/JsonViewer.d.ts +4 -1
  192. package/dist/esm/components/JsonViewer.js +111 -172
  193. package/dist/esm/components/LogCard.js +111 -88
  194. package/dist/esm/components/MetaAccordion.d.ts +1 -10
  195. package/dist/esm/components/MetaAccordion.js +23 -21
  196. package/dist/esm/components/NavigationTracker.d.ts +7 -0
  197. package/dist/esm/components/NavigationTracker.js +39 -0
  198. package/dist/esm/components/NetworkIcons.d.ts +6 -0
  199. package/dist/esm/components/NetworkIcons.js +46 -6
  200. package/dist/esm/components/ReduxTabView.d.ts +9 -0
  201. package/dist/esm/components/ReduxTabView.js +50 -0
  202. package/dist/esm/components/ReduxTreeView.js +243 -202
  203. package/dist/esm/components/SegmentedTabs.d.ts +15 -0
  204. package/dist/esm/components/SegmentedTabs.js +47 -0
  205. package/dist/esm/components/SettingsView.d.ts +13 -0
  206. package/dist/esm/components/SettingsView.js +321 -0
  207. package/dist/esm/components/TouchableScale.d.ts +2 -2
  208. package/dist/esm/components/TouchableScale.js +2 -2
  209. package/dist/esm/components/TreeNode.js +2 -2
  210. package/dist/esm/constants/index.js +1 -12
  211. package/dist/esm/constants/version.d.ts +1 -1
  212. package/dist/esm/constants/version.js +1 -1
  213. package/dist/esm/customHooks/analyticsLogger.d.ts +8 -0
  214. package/dist/esm/customHooks/analyticsLogger.js +37 -0
  215. package/dist/esm/customHooks/consoleLogger.js +137 -13
  216. package/dist/esm/customHooks/networkLogger.d.ts +0 -1
  217. package/dist/esm/customHooks/networkLogger.js +0 -1
  218. package/dist/esm/customHooks/reduxLogger.d.ts +2 -9
  219. package/dist/esm/enums/index.d.ts +39 -0
  220. package/dist/esm/enums/index.js +47 -0
  221. package/dist/esm/helpers/index.d.ts +27 -1
  222. package/dist/esm/helpers/index.js +180 -11
  223. package/dist/esm/helpers/settingsStore.d.ts +2 -24
  224. package/dist/esm/i18n/en.json +144 -0
  225. package/dist/esm/i18n/index.d.ts +2 -0
  226. package/dist/esm/i18n/index.js +22 -0
  227. package/dist/esm/i18n/locales/en.json +314 -0
  228. package/dist/esm/index.d.ts +2 -3
  229. package/dist/esm/index.js +207 -4923
  230. package/dist/esm/styles/AppColors.d.ts +148 -0
  231. package/dist/esm/styles/AppColors.js +176 -0
  232. package/dist/esm/styles/common.d.ts +3 -0
  233. package/dist/esm/styles/common.js +197 -0
  234. package/dist/esm/styles/index.d.ts +219 -435
  235. package/dist/esm/styles/index.js +312 -488
  236. package/dist/esm/types/enums.d.ts +9 -0
  237. package/dist/esm/types/enums.js +3 -0
  238. package/dist/esm/types/index.d.ts +4 -111
  239. package/dist/esm/types/index.js +2 -1
  240. package/dist/esm/types/interfaces.d.ts +337 -0
  241. package/dist/esm/types/interfaces.js +1 -0
  242. package/example/App.tsx +88 -1
  243. package/example/android/app/build.gradle +29 -1
  244. package/example/android/app/src/main/java/com/example/MainApplication.kt +25 -0
  245. package/example/android/build.gradle +31 -4
  246. package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  247. package/example/android/gradle.properties +1 -0
  248. package/example/android/settings.gradle +20 -1
  249. package/example/package-lock.json +1 -1
  250. package/package.json +3 -1
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const MainScreen: () => React.JSX.Element;
3
+ export default MainScreen;
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { ActivityIndicator, Modal, Pressable, StatusBar, StyleSheet, Text, View, } from 'react-native';
3
+ import { useInspector } from './InspectorContext';
4
+ import ErrorBoundary from '../ErrorBoundary';
5
+ import FabLauncher from './FabLauncher';
6
+ import InspectorHeader from './InspectorHeader';
7
+ import TabBar from './TabBar';
8
+ import NetworkTab from './NetworkTab';
9
+ import NetworkDetail from './NetworkDetail';
10
+ import LogDetail from './LogDetail';
11
+ import ConsoleTab from './ConsoleTab';
12
+ import AnalyticsTab from './AnalyticsTab';
13
+ import ReduxTab from './ReduxTab';
14
+ import SettingsPanel from './SettingsPanel';
15
+ import styles from '../../styles';
16
+ import { AppColors } from '../../styles/AppColors';
17
+ import NavigationTracker from './NavigationTracker';
18
+ const MainScreen = () => {
19
+ const { visible, modalAnimationType, closeModal, modalHeightPercent, selected, selectedEvent, selectedLog, settingsPage, activeTab, isReady, isEnabled, hasNavigationContext, setNavState, } = useInspector();
20
+ return (<>
21
+ {isEnabled && <FabLauncher />}
22
+ <Modal visible={visible} animationType={modalAnimationType} transparent>
23
+ {visible && (<ErrorBoundary onClose={closeModal}>
24
+ <View style={styles.modalBackdrop}>
25
+ <Pressable style={styles.modalBackdropPressable} onPress={closeModal}/>
26
+ <View style={[
27
+ styles.modalContentCard,
28
+ { height: `${modalHeightPercent}%` },
29
+ ]}>
30
+ <StatusBar translucent backgroundColor="transparent" barStyle="light-content"/>
31
+
32
+ <InspectorHeader />
33
+
34
+ {/* ─── Horizontal Scrollable Tab Bar inside Content ─── */}
35
+ {selected == null &&
36
+ selectedEvent == null &&
37
+ selectedLog == null &&
38
+ settingsPage === null ? (<TabBar />) : null}
39
+
40
+ {isReady ? (activeTab === 'analytics' ? (<AnalyticsTab />) : activeTab === 'apis' && selected == null ? (<NetworkTab />) : activeTab === 'logs' && selectedLog == null ? (<ConsoleTab />) : activeTab === 'logs' ? (<LogDetail />) : activeTab === 'redux' ? (<ReduxTab />) : (<NetworkDetail />)) : (<View style={styles.empty}>
41
+ <ActivityIndicator size="large" color={AppColors.purple}/>
42
+ <Text style={[styles.emptySub, { marginTop: 12 }]}>
43
+ Loading logs...
44
+ </Text>
45
+ </View>)}
46
+
47
+ {settingsPage !== null && (<View style={[
48
+ StyleSheet.absoluteFill,
49
+ {
50
+ backgroundColor: AppColors.grayBackground,
51
+ zIndex: 99999,
52
+ },
53
+ ]}>
54
+ <SettingsPanel />
55
+ </View>)}
56
+ </View>
57
+ </View>
58
+ </ErrorBoundary>)}
59
+ {hasNavigationContext && (<NavigationTracker onStateChange={setNavState}/>)}
60
+ </Modal>
61
+ </>);
62
+ };
63
+ export default MainScreen;
@@ -0,0 +1,3 @@
1
+ import { NavigationTrackerProps } from '../../types';
2
+ declare const NavigationTracker: ({ onStateChange }: NavigationTrackerProps) => null;
3
+ export default NavigationTracker;
@@ -0,0 +1,10 @@
1
+ import { useEffect } from 'react';
2
+ import { useNavigationState } from '@react-navigation/native';
3
+ const NavigationTracker = ({ onStateChange }) => {
4
+ const navState = useNavigationState(state => state);
5
+ useEffect(() => {
6
+ onStateChange(navState);
7
+ }, [navState, onStateChange]);
8
+ return null;
9
+ };
10
+ export default NavigationTracker;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const NetworkDetail: () => React.JSX.Element;
3
+ export default NetworkDetail;
@@ -0,0 +1,367 @@
1
+ import React from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Image, Linking, Pressable, ScrollView, Text, TextInput, View, } from 'react-native';
4
+ import Svg, { Circle } from 'react-native-svg';
5
+ import { animateNextLayout, useInspector } from './InspectorContext';
6
+ import TouchableScale from '../TouchableScale';
7
+ import SegmentedTabs from '../SegmentedTabs';
8
+ import MetaAccordion from '../MetaAccordion';
9
+ import HeadersSection from '../HeadersSection';
10
+ import SourcePageCard from '../SourcePageCard';
11
+ import SectionHeader from '../SectionHeader';
12
+ import JsonViewer from '../JsonViewer';
13
+ import DiffViewer from '../DiffViewer';
14
+ import CopyButton from '../CopyButton';
15
+ import styles from '../../styles';
16
+ import { AppColors } from '../../styles/AppColors';
17
+ import { AppFonts } from '../../styles/AppFonts';
18
+ import { METHOD_COLORS } from '../../constants';
19
+ import { getStatusColor, getSize, formatDateTime, getFetchCommand, getCurlCommand, } from '../../helpers';
20
+ import { FailIcon, GlobeIcon, StatusIcon, HeadersIcon, RequestIcon, ResponseIcon, DownloadIcon, ClearIcon, SizeIcon, } from '../NetworkIcons';
21
+ const NetworkDetail = () => {
22
+ const { t } = useTranslation();
23
+ const { selected, detailDisplayUrl, apiDetailActiveTab, setApiDetailActiveTab, detailSearch, setDetailSearch, reqExpanded, setReqExpanded, resExpanded, setResExpanded, showReqDiff, setShowReqDiff, showResDiff, setShowResDiff, prevRequestData, prevResponseData, logRouteMapRef, } = useInspector();
24
+ if (!selected)
25
+ return null;
26
+ return (<View style={{ flex: 1 }}>
27
+ {/* Non-scrollable details header */}
28
+ <View style={{ paddingHorizontal: 6, paddingTop: 4 }}>
29
+ <View style={styles.detailInfoBar}>
30
+ {(() => {
31
+ let schemeStr = '';
32
+ let hostStr = '';
33
+ let pathStr = detailDisplayUrl;
34
+ let queryStr = '';
35
+ try {
36
+ // Simple parsing fallback for React Native environments
37
+ const qIndex = detailDisplayUrl.indexOf('?');
38
+ let cleanUrlForParsing = detailDisplayUrl;
39
+ if (qIndex !== -1) {
40
+ pathStr = detailDisplayUrl.substring(0, qIndex);
41
+ queryStr = detailDisplayUrl.substring(qIndex);
42
+ cleanUrlForParsing = pathStr;
43
+ }
44
+ const schemeIndex = cleanUrlForParsing.indexOf('://');
45
+ if (schemeIndex !== -1) {
46
+ schemeStr = cleanUrlForParsing.substring(0, schemeIndex + 3);
47
+ const withoutScheme = cleanUrlForParsing.substring(schemeIndex + 3);
48
+ const firstSlash = withoutScheme.indexOf('/');
49
+ if (firstSlash !== -1) {
50
+ hostStr = withoutScheme.substring(0, firstSlash);
51
+ pathStr = withoutScheme.substring(firstSlash);
52
+ }
53
+ else {
54
+ hostStr = withoutScheme;
55
+ pathStr = '/';
56
+ }
57
+ }
58
+ else {
59
+ const firstSlash = cleanUrlForParsing.indexOf('/');
60
+ if (firstSlash !== -1) {
61
+ hostStr = cleanUrlForParsing.substring(0, firstSlash);
62
+ pathStr = cleanUrlForParsing.substring(firstSlash);
63
+ }
64
+ else if (cleanUrlForParsing) {
65
+ hostStr = cleanUrlForParsing;
66
+ pathStr = '/';
67
+ }
68
+ }
69
+ }
70
+ catch (e) { }
71
+ return (<>
72
+ <View style={styles.detailInfoTop}>
73
+ <View style={{
74
+ flexDirection: 'row',
75
+ alignItems: 'center',
76
+ gap: 8,
77
+ }}>
78
+ <View style={[
79
+ styles.methodBadge,
80
+ {
81
+ backgroundColor: METHOD_COLORS[selected.method] ?? METHOD_COLORS.ALL,
82
+ },
83
+ ]}>
84
+ <Text style={[
85
+ styles.methodBadgeText,
86
+ {
87
+ color: AppColors.white,
88
+ },
89
+ ]}>
90
+ {selected.method}
91
+ </Text>
92
+ </View>
93
+
94
+ {selected.status != null && (<View style={[
95
+ styles.chip,
96
+ {
97
+ backgroundColor: selected.status === 0
98
+ ? `${AppColors.errorColor}15`
99
+ : `${getStatusColor(selected.status)}15`,
100
+ borderColor: selected.status === 0
101
+ ? `${AppColors.errorColor}40`
102
+ : `${getStatusColor(selected.status)}40`,
103
+ },
104
+ ]}>
105
+ {selected.status === 0 ? (<FailIcon size={8} color={AppColors.errorColor}/>) : (<Svg width={6} height={6} viewBox="0 0 10 10" fill="none">
106
+ <Circle cx="5" cy="5" r="5" fill={getStatusColor(selected.status)}/>
107
+ </Svg>)}
108
+ <Text style={[
109
+ styles.chipText,
110
+ {
111
+ color: selected.status === 0
112
+ ? AppColors.errorColor
113
+ : getStatusColor(selected.status),
114
+ },
115
+ ]}>
116
+ {selected.status === 0
117
+ ? 'Failed'
118
+ : String(selected.status)}
119
+ </Text>
120
+ </View>)}
121
+
122
+ {selected.duration != null && (<View style={[
123
+ styles.chip,
124
+ {
125
+ backgroundColor: `${AppColors.purple}14`,
126
+ borderColor: `${AppColors.purple}2E`,
127
+ },
128
+ ]}>
129
+ <Text style={[
130
+ styles.chipText,
131
+ { color: AppColors.purple },
132
+ ]}>
133
+ {selected.duration}ms
134
+ </Text>
135
+ </View>)}
136
+ </View>
137
+ <View style={styles.detailInfoRight}>
138
+ <TouchableScale style={styles.iconSquareBtn} onPress={() => Linking.openURL(detailDisplayUrl)} hitSlop={12}>
139
+ <GlobeIcon color={AppColors.grayTextWeak} size={14}/>
140
+ </TouchableScale>
141
+ <CopyButton value={getFetchCommand(selected)} label="fetch()" iconType="fetch"/>
142
+ <CopyButton value={getCurlCommand(selected)} label="cURL" iconType="terminal"/>
143
+ <CopyButton value={detailDisplayUrl} label="URL"/>
144
+ </View>
145
+ </View>
146
+
147
+ <Pressable style={{
148
+ backgroundColor: AppColors.grayBackground,
149
+ borderRadius: 10,
150
+ borderWidth: 1,
151
+ borderColor: AppColors.dividerColor,
152
+ padding: 10,
153
+ marginTop: 6,
154
+ }} onPress={() => Linking.openURL(detailDisplayUrl)}>
155
+ <View style={{
156
+ flexDirection: 'row',
157
+ alignItems: 'center',
158
+ justifyContent: 'space-between',
159
+ marginBottom: 2,
160
+ }}>
161
+ <Text style={{
162
+ fontFamily: AppFonts.interMedium,
163
+ fontSize: 10,
164
+ color: AppColors.grayTextWeak,
165
+ flex: 1,
166
+ }} numberOfLines={1}>
167
+ {schemeStr ? (<>
168
+ <Text style={{
169
+ color: AppColors.slate400,
170
+ fontFamily: AppFonts.interRegular,
171
+ }}>
172
+ {schemeStr}
173
+ </Text>
174
+ {hostStr}
175
+ </>) : (hostStr || 'API Endpoint')}
176
+ </Text>
177
+ {queryStr ? (<View style={{
178
+ backgroundColor: `${AppColors.purple}14`,
179
+ paddingHorizontal: 5,
180
+ paddingVertical: 1,
181
+ borderRadius: 4,
182
+ }}>
183
+ <Text style={{
184
+ fontFamily: AppFonts.interBold,
185
+ fontSize: 8.5,
186
+ color: AppColors.purple,
187
+ }}>
188
+ {t('network.queryParams')}
189
+ </Text>
190
+ </View>) : null}
191
+ </View>
192
+ <Text selectable={true} style={{
193
+ fontFamily: AppFonts.interBold,
194
+ fontSize: 12,
195
+ color: AppColors.primaryBlack,
196
+ marginTop: 2,
197
+ }} numberOfLines={2}>
198
+ {pathStr}
199
+ </Text>
200
+ {queryStr ? (<Text selectable={true} style={{
201
+ fontFamily: AppFonts.interRegular,
202
+ fontSize: 10,
203
+ color: AppColors.grayTextWeak,
204
+ marginTop: 4,
205
+ }} numberOfLines={1}>
206
+ {queryStr}
207
+ </Text>) : null}
208
+ </Pressable>
209
+ </>);
210
+ })()}
211
+ </View>
212
+ </View>
213
+
214
+ {/* Sticky Segment Control */}
215
+ <SegmentedTabs tabs={[
216
+ {
217
+ key: 'metadata',
218
+ label: t('network.detailTabs.metadata'),
219
+ icon: (isActive) => (<StatusIcon color={isActive ? AppColors.white : AppColors.grayText}/>),
220
+ },
221
+ {
222
+ key: 'headers',
223
+ label: t('network.detailTabs.headers'),
224
+ icon: (isActive) => (<HeadersIcon color={isActive ? AppColors.white : AppColors.grayText}/>),
225
+ },
226
+ ...(selected.request != null
227
+ ? [
228
+ {
229
+ key: 'request',
230
+ label: t('network.detailTabs.request'),
231
+ icon: (isActive) => (<RequestIcon color={isActive ? AppColors.white : AppColors.grayText}/>),
232
+ },
233
+ ]
234
+ : []),
235
+ {
236
+ key: 'response',
237
+ label: t('network.detailTabs.response'),
238
+ icon: (isActive) => (<ResponseIcon color={isActive ? AppColors.white : AppColors.grayText}/>),
239
+ },
240
+ ]} activeKey={apiDetailActiveTab} onChange={tab => {
241
+ animateNextLayout();
242
+ setApiDetailActiveTab(tab);
243
+ }} style={{ marginHorizontal: 6, marginBottom: 10, marginTop: 6 }}/>
244
+
245
+ {/* Scrollable Tab Content */}
246
+ <ScrollView style={styles.detailScroll} contentContainerStyle={{
247
+ paddingHorizontal: 6,
248
+ paddingBottom: 24,
249
+ }} showsVerticalScrollIndicator={true}>
250
+ {apiDetailActiveTab === 'metadata' && (<>
251
+ <MetaAccordion status={selected.status} statusColor={getStatusColor(selected.status)} duration={selected.duration} size={getSize(selected.response)} triggeredAt={formatDateTime(selected.startTime)} method={selected.method} contentType={selected.responseHeaders?.['content-type'] ||
252
+ selected.responseHeaders?.['Content-Type']} url={selected.url}/>
253
+
254
+ {(() => {
255
+ const routeInfo = logRouteMapRef.current.get(selected.id);
256
+ if (!routeInfo || routeInfo.path === 'Navigators')
257
+ return null;
258
+ return <SourcePageCard routeInfo={routeInfo}/>;
259
+ })()}
260
+
261
+ {(() => {
262
+ const cType = selected.responseHeaders?.['content-type'] ||
263
+ selected.responseHeaders?.['Content-Type'];
264
+ if (cType?.includes('image/')) {
265
+ return (<View style={styles.imagePreviewWrapper}>
266
+ <Image source={{ uri: selected.url }} style={styles.imagePreview} resizeMode="contain"/>
267
+ <TouchableScale style={styles.imageDownloadBtn} onPress={() => Linking.openURL(selected.url)} hitSlop={10}>
268
+ <DownloadIcon color={AppColors.purple} size={18}/>
269
+ </TouchableScale>
270
+ </View>);
271
+ }
272
+ return null;
273
+ })()}
274
+ </>)}
275
+
276
+ {apiDetailActiveTab === 'headers' && (<>
277
+ <View style={styles.detailSearchRow}>
278
+ <View style={styles.detailSearchBox}>
279
+ <TextInput placeholder={t('network.searchHeaders')} placeholderTextColor={AppColors.grayTextWeak} value={detailSearch} onChangeText={setDetailSearch} style={styles.detailSearchInput} autoCorrect={false} autoCapitalize="none"/>
280
+ {detailSearch.length > 0 && (<Pressable onPress={() => setDetailSearch('')} hitSlop={10} style={{ padding: 8 }}>
281
+ <ClearIcon color={AppColors.grayTextWeak} size={14}/>
282
+ </Pressable>)}
283
+ </View>
284
+ </View>
285
+
286
+ <HeadersSection title="Request Headers" headers={selected.requestHeaders} search={detailSearch} resetKey={selected.id}/>
287
+ <HeadersSection title="Response Headers" headers={selected.responseHeaders} search={detailSearch} resetKey={selected.id}/>
288
+ </>)}
289
+
290
+ {apiDetailActiveTab === 'request' &&
291
+ selected.request != null && (<>
292
+ <View style={styles.detailSearchRow}>
293
+ <View style={styles.detailSearchBox}>
294
+ <TextInput placeholder={t('network.searchRequest')} placeholderTextColor={AppColors.grayTextWeak} value={detailSearch} onChangeText={setDetailSearch} style={styles.detailSearchInput} autoCorrect={false} autoCapitalize="none"/>
295
+ {detailSearch.length > 0 && (<Pressable onPress={() => setDetailSearch('')} hitSlop={10} style={{ padding: 8 }}>
296
+ <ClearIcon color={AppColors.grayTextWeak} size={14}/>
297
+ </Pressable>)}
298
+ </View>
299
+ </View>
300
+
301
+ <View style={styles.sectionContainer}>
302
+ <SectionHeader title={t('network.requestTitle')} value={selected.request} expanded={reqExpanded} onToggleExpand={() => setReqExpanded(v => !v)} showDiff={prevRequestData != null} isDiffing={showReqDiff} onToggleDiff={() => {
303
+ setShowReqDiff(v => !v);
304
+ if (!reqExpanded && !showReqDiff)
305
+ setReqExpanded(true);
306
+ }}/>
307
+ {showReqDiff ? (<DiffViewer oldData={prevRequestData} newData={selected.request} forceOpen={reqExpanded}/>) : reqExpanded ? (<JsonViewer data={selected.request} search={detailSearch} forceOpen/>) : (<View style={styles.codeBlock}>
308
+ <Text style={[
309
+ styles.codeText,
310
+ { color: AppColors.grayTextWeak },
311
+ ]}>
312
+ {t('network.bodyHidden')}
313
+ </Text>
314
+ </View>)}
315
+ </View>
316
+ </>)}
317
+
318
+ {apiDetailActiveTab === 'response' && (<>
319
+ <View style={styles.detailSearchRow}>
320
+ <View style={styles.detailSearchBox}>
321
+ <TextInput placeholder={t('network.searchResponse')} placeholderTextColor={AppColors.grayTextWeak} value={detailSearch} onChangeText={setDetailSearch} style={styles.detailSearchInput} autoCorrect={false} autoCapitalize="none"/>
322
+ {detailSearch.length > 0 && (<Pressable onPress={() => setDetailSearch('')} hitSlop={10} style={{ padding: 8 }}>
323
+ <ClearIcon color={AppColors.grayTextWeak} size={14}/>
324
+ </Pressable>)}
325
+ </View>
326
+ {selected.response != null && (<View style={{
327
+ flexDirection: 'row',
328
+ alignItems: 'center',
329
+ gap: 4,
330
+ paddingHorizontal: 10,
331
+ height: 34,
332
+ borderRadius: 8,
333
+ borderWidth: 1,
334
+ borderColor: `${AppColors.purple}30`,
335
+ backgroundColor: `${AppColors.purple}10`,
336
+ }}>
337
+ <SizeIcon color={AppColors.purple} size={12}/>
338
+ <Text style={{
339
+ fontFamily: AppFonts.interBold,
340
+ fontSize: 10.5,
341
+ color: AppColors.purple,
342
+ }}>
343
+ {getSize(selected.response)}
344
+ </Text>
345
+ </View>)}
346
+ </View>
347
+
348
+ <View style={styles.sectionContainer}>
349
+ <SectionHeader title={t('network.responseTitle')} value={selected.response} expanded={resExpanded} onToggleExpand={() => setResExpanded(v => !v)} showDiff={prevResponseData != null} isDiffing={showResDiff} onToggleDiff={() => {
350
+ setShowResDiff(v => !v);
351
+ if (!resExpanded && !showResDiff)
352
+ setResExpanded(true);
353
+ }}/>
354
+ {showResDiff ? (<DiffViewer oldData={prevResponseData} newData={selected.response} forceOpen={resExpanded}/>) : resExpanded ? (<JsonViewer data={selected.response} search={detailSearch} forceOpen wrap/>) : (<View style={styles.codeBlock}>
355
+ <Text style={[
356
+ styles.codeText,
357
+ { color: AppColors.grayTextWeak },
358
+ ]}>
359
+ {t('network.bodyHidden')}
360
+ </Text>
361
+ </View>)}
362
+ </View>
363
+ </>)}
364
+ </ScrollView>
365
+ </View>);
366
+ };
367
+ export default NetworkDetail;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const NetworkTab: () => React.JSX.Element;
3
+ export default NetworkTab;