react-native-inapp-inspector 2.3.19 → 2.3.21

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 (353) hide show
  1. package/README.md +14 -14
  2. package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
  3. package/dist/commonjs/analytics.js +1 -24
  4. package/dist/commonjs/bundle.js +1 -16
  5. package/dist/commonjs/capture.js +1 -35
  6. package/dist/commonjs/components/AnalyticsDetail.js +92 -623
  7. package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
  8. package/dist/commonjs/components/AnalyticsGraph.js +70 -370
  9. package/dist/commonjs/components/AnimatedEntrance.js +1 -11
  10. package/dist/commonjs/components/AppHeaderLogo.js +7 -134
  11. package/dist/commonjs/components/BrandCircleIcon.js +73 -118
  12. package/dist/commonjs/components/BrandSquareIcon.js +63 -108
  13. package/dist/commonjs/components/CodeSnippet.js +48 -623
  14. package/dist/commonjs/components/ConsoleLogCard.js +63 -537
  15. package/dist/commonjs/components/CopyButton.js +3 -89
  16. package/dist/commonjs/components/DiffViewer.js +19 -83
  17. package/dist/commonjs/components/DomainHeader.js +27 -127
  18. package/dist/commonjs/components/EmptyState.js +10 -87
  19. package/dist/commonjs/components/EndOfListFooter.js +7 -81
  20. package/dist/commonjs/components/ErrorBoundary.js +72 -566
  21. package/dist/commonjs/components/HeadersSection.js +31 -110
  22. package/dist/commonjs/components/HighlightText.js +17 -58
  23. package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
  24. package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
  25. package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
  26. package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
  27. package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
  28. package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
  29. package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
  30. package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
  31. package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
  32. package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
  33. package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
  34. package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
  35. package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
  36. package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
  37. package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
  38. package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
  39. package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
  40. package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
  41. package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
  42. package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
  43. package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
  44. package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
  45. package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
  46. package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
  47. package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
  48. package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
  49. package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
  50. package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
  51. package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
  52. package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
  53. package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
  54. package/dist/commonjs/components/Inspector/TabBar.js +36 -334
  55. package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
  56. package/dist/commonjs/components/JsonViewer.js +168 -381
  57. package/dist/commonjs/components/LogCard.js +57 -567
  58. package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
  59. package/dist/commonjs/components/MetaAccordion.js +69 -238
  60. package/dist/commonjs/components/MiniBarChart.js +3 -56
  61. package/dist/commonjs/components/MiniLineChart.js +3 -58
  62. package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
  63. package/dist/commonjs/components/NetworkIcons.js +521 -1022
  64. package/dist/commonjs/components/QRCodeView.js +5 -79
  65. package/dist/commonjs/components/SectionHeader.js +15 -37
  66. package/dist/commonjs/components/SegmentedTabs.js +7 -62
  67. package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
  68. package/dist/commonjs/components/Slider.js +15 -243
  69. package/dist/commonjs/components/SourcePageCard.js +30 -89
  70. package/dist/commonjs/components/Toast.js +5 -147
  71. package/dist/commonjs/components/TouchableScale.js +3 -24
  72. package/dist/commonjs/components/TreeNode.js +55 -130
  73. package/dist/commonjs/console.js +1 -16
  74. package/dist/commonjs/constants/index.js +1 -32
  75. package/dist/commonjs/constants/telemetryConfig.js +1 -6
  76. package/dist/commonjs/constants/version.d.ts +1 -1
  77. package/dist/commonjs/constants/version.js +1 -4
  78. package/dist/commonjs/crash.js +1 -23
  79. package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
  80. package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
  81. package/dist/commonjs/customHooks/consoleLogger.js +6 -445
  82. package/dist/commonjs/customHooks/crashHandler.js +7 -656
  83. package/dist/commonjs/customHooks/logFilters.js +1 -23
  84. package/dist/commonjs/customHooks/networkLogger.js +2 -536
  85. package/dist/commonjs/customHooks/performanceTracker.js +63 -750
  86. package/dist/commonjs/customHooks/reduxLogger.js +2 -313
  87. package/dist/commonjs/customHooks/storageInspector.js +1 -435
  88. package/dist/commonjs/customHooks/useAccordion.js +1 -18
  89. package/dist/commonjs/decorators/index.js +1 -100
  90. package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
  91. package/dist/commonjs/helpers/index.d.ts +1 -0
  92. package/dist/commonjs/helpers/index.js +8 -921
  93. package/dist/commonjs/helpers/memoryManager.js +1 -99
  94. package/dist/commonjs/helpers/qrGenerator.js +1 -367
  95. package/dist/commonjs/helpers/remoteConfig.js +1 -165
  96. package/dist/commonjs/helpers/searchQueryParser.js +1 -62
  97. package/dist/commonjs/helpers/settingsStore.js +1 -144
  98. package/dist/commonjs/helpers/telemetry.js +1 -501
  99. package/dist/commonjs/helpers/toast.js +1 -20
  100. package/dist/commonjs/i18n/index.js +1 -90
  101. package/dist/commonjs/i18n/locales/en.json +1 -1140
  102. package/dist/commonjs/index.js +5 -2168
  103. package/dist/commonjs/metro.js +6 -468
  104. package/dist/commonjs/native/NativeInspector.d.ts +1 -0
  105. package/dist/commonjs/native/NativeInspector.js +1 -415
  106. package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
  107. package/dist/commonjs/network.js +1 -13
  108. package/dist/commonjs/performance.js +1 -29
  109. package/dist/commonjs/redux.js +1 -20
  110. package/dist/commonjs/storage.js +1 -14
  111. package/dist/commonjs/styles/AppColors.js +1 -423
  112. package/dist/commonjs/styles/AppFonts.js +1 -17
  113. package/dist/commonjs/styles/common.js +1 -190
  114. package/dist/commonjs/styles/index.d.ts +6 -0
  115. package/dist/commonjs/styles/index.js +1 -1589
  116. package/dist/commonjs/types/enums.d.ts +0 -1
  117. package/dist/commonjs/types/enums.js +1 -152
  118. package/dist/commonjs/types/index.js +1 -18
  119. package/dist/commonjs/types/interfaces.d.ts +2 -2
  120. package/dist/commonjs/types/interfaces.js +1 -2
  121. package/dist/esm/analytics.js +1 -2
  122. package/dist/esm/bundle.js +1 -2
  123. package/dist/esm/capture.js +1 -32
  124. package/dist/esm/components/AnalyticsDetail.js +171 -664
  125. package/dist/esm/components/AnalyticsEventCard.js +77 -335
  126. package/dist/esm/components/AnalyticsGraph.js +95 -357
  127. package/dist/esm/components/AnimatedEntrance.js +1 -6
  128. package/dist/esm/components/AppHeaderLogo.js +7 -94
  129. package/dist/esm/components/BrandCircleIcon.js +114 -119
  130. package/dist/esm/components/BrandSquareIcon.js +73 -78
  131. package/dist/esm/components/CodeSnippet.js +58 -595
  132. package/dist/esm/components/ConsoleLogCard.js +91 -526
  133. package/dist/esm/components/CopyButton.js +3 -51
  134. package/dist/esm/components/DiffViewer.js +22 -48
  135. package/dist/esm/components/DomainHeader.js +43 -138
  136. package/dist/esm/components/EmptyState.js +17 -56
  137. package/dist/esm/components/EndOfListFooter.js +15 -83
  138. package/dist/esm/components/ErrorBoundary.js +125 -582
  139. package/dist/esm/components/HeadersSection.js +52 -93
  140. package/dist/esm/components/HighlightText.js +17 -53
  141. package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
  142. package/dist/esm/components/Inspector/AboutModal.js +243 -0
  143. package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
  144. package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
  145. package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
  146. package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
  147. package/dist/esm/components/Inspector/CrashDetail.js +236 -747
  148. package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
  149. package/dist/esm/components/Inspector/CrashTab.js +177 -711
  150. package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
  151. package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
  152. package/dist/esm/components/Inspector/FabLauncher.js +68 -454
  153. package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
  154. package/dist/esm/components/Inspector/InspectorContext.js +1 -12
  155. package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
  156. package/dist/esm/components/Inspector/LogDetail.js +235 -1023
  157. package/dist/esm/components/Inspector/MainScreen.js +78 -323
  158. package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
  159. package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
  160. package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
  161. package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
  162. package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
  163. package/dist/esm/components/Inspector/NetworkTab.js +125 -517
  164. package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
  165. package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
  166. package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
  167. package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
  168. package/dist/esm/components/Inspector/ReduxTab.js +144 -722
  169. package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
  170. package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
  171. package/dist/esm/components/Inspector/StorageTab.js +172 -866
  172. package/dist/esm/components/Inspector/TabBar.js +45 -305
  173. package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
  174. package/dist/esm/components/JsonViewer.js +179 -354
  175. package/dist/esm/components/LogCard.js +93 -565
  176. package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
  177. package/dist/esm/components/MetaAccordion.js +136 -267
  178. package/dist/esm/components/MiniBarChart.js +3 -18
  179. package/dist/esm/components/MiniLineChart.js +3 -20
  180. package/dist/esm/components/NetworkIcons.d.ts +13 -0
  181. package/dist/esm/components/NetworkIcons.js +523 -838
  182. package/dist/esm/components/QRCodeView.js +8 -45
  183. package/dist/esm/components/SectionHeader.js +22 -39
  184. package/dist/esm/components/SegmentedTabs.js +8 -58
  185. package/dist/esm/components/SkeletonPlaceholder.js +30 -163
  186. package/dist/esm/components/Slider.js +24 -213
  187. package/dist/esm/components/SourcePageCard.js +65 -86
  188. package/dist/esm/components/Toast.js +10 -117
  189. package/dist/esm/components/TouchableScale.js +3 -19
  190. package/dist/esm/components/TreeNode.js +58 -95
  191. package/dist/esm/console.js +1 -2
  192. package/dist/esm/constants/index.js +1 -28
  193. package/dist/esm/constants/telemetryConfig.js +1 -3
  194. package/dist/esm/constants/version.d.ts +1 -1
  195. package/dist/esm/constants/version.js +1 -1
  196. package/dist/esm/crash.js +1 -2
  197. package/dist/esm/customHooks/analyticsLogger.js +1 -230
  198. package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
  199. package/dist/esm/customHooks/consoleLogger.js +6 -432
  200. package/dist/esm/customHooks/crashHandler.js +7 -630
  201. package/dist/esm/customHooks/logFilters.js +1 -20
  202. package/dist/esm/customHooks/networkLogger.js +2 -519
  203. package/dist/esm/customHooks/performanceTracker.js +63 -723
  204. package/dist/esm/customHooks/reduxLogger.js +2 -293
  205. package/dist/esm/customHooks/storageInspector.js +1 -418
  206. package/dist/esm/customHooks/useAccordion.js +1 -16
  207. package/dist/esm/decorators/index.js +1 -95
  208. package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
  209. package/dist/esm/helpers/index.d.ts +1 -0
  210. package/dist/esm/helpers/index.js +8 -861
  211. package/dist/esm/helpers/memoryManager.js +1 -91
  212. package/dist/esm/helpers/qrGenerator.js +1 -364
  213. package/dist/esm/helpers/remoteConfig.js +1 -160
  214. package/dist/esm/helpers/searchQueryParser.js +1 -59
  215. package/dist/esm/helpers/settingsStore.js +1 -134
  216. package/dist/esm/helpers/telemetry.js +1 -489
  217. package/dist/esm/helpers/toast.js +1 -15
  218. package/dist/esm/i18n/index.js +1 -78
  219. package/dist/esm/i18n/locales/en.json +1 -1140
  220. package/dist/esm/index.js +7 -1982
  221. package/dist/esm/metro.js +6 -459
  222. package/dist/esm/native/NativeInspector.d.ts +1 -0
  223. package/dist/esm/native/NativeInspector.js +1 -382
  224. package/dist/esm/native/NativeNetworkInspector.js +1 -2
  225. package/dist/esm/network.js +1 -1
  226. package/dist/esm/performance.js +1 -2
  227. package/dist/esm/redux.js +1 -1
  228. package/dist/esm/storage.js +1 -1
  229. package/dist/esm/styles/AppColors.js +1 -417
  230. package/dist/esm/styles/AppFonts.js +1 -13
  231. package/dist/esm/styles/common.js +1 -186
  232. package/dist/esm/styles/index.d.ts +6 -0
  233. package/dist/esm/styles/index.js +1 -1551
  234. package/dist/esm/types/enums.d.ts +0 -1
  235. package/dist/esm/types/enums.js +1 -149
  236. package/dist/esm/types/index.js +1 -2
  237. package/dist/esm/types/interfaces.d.ts +2 -2
  238. package/dist/esm/types/interfaces.js +1 -1
  239. package/ios/NetworkInspectorModule.mm +60 -12
  240. package/package.json +5 -3
  241. package/src/native/NativeInspector.ts +18 -0
  242. package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
  243. package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
  244. package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
  245. package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
  246. package/src/analytics.ts +0 -35
  247. package/src/bundle.ts +0 -25
  248. package/src/capture.ts +0 -109
  249. package/src/components/AnalyticsDetail.tsx +0 -870
  250. package/src/components/AnalyticsEventCard.tsx +0 -444
  251. package/src/components/AnalyticsGraph.tsx +0 -583
  252. package/src/components/AnimatedEntrance.tsx +0 -20
  253. package/src/components/AppHeaderLogo.tsx +0 -143
  254. package/src/components/BrandCircleIcon.tsx +0 -144
  255. package/src/components/BrandSquareIcon.tsx +0 -184
  256. package/src/components/CodeSnippet.tsx +0 -725
  257. package/src/components/ConsoleLogCard.tsx +0 -679
  258. package/src/components/CopyButton.tsx +0 -87
  259. package/src/components/DiffViewer.tsx +0 -82
  260. package/src/components/DomainHeader.tsx +0 -224
  261. package/src/components/EmptyState.tsx +0 -97
  262. package/src/components/EndOfListFooter.tsx +0 -100
  263. package/src/components/ErrorBoundary.tsx +0 -688
  264. package/src/components/HeadersSection.tsx +0 -172
  265. package/src/components/HighlightText.tsx +0 -100
  266. package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
  267. package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
  268. package/src/components/Inspector/BundleTab.tsx +0 -4768
  269. package/src/components/Inspector/ConsoleTab.tsx +0 -726
  270. package/src/components/Inspector/CrashDetail.tsx +0 -997
  271. package/src/components/Inspector/CrashFilterModal.tsx +0 -721
  272. package/src/components/Inspector/CrashTab.tsx +0 -933
  273. package/src/components/Inspector/DebuggingTab.tsx +0 -1103
  274. package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
  275. package/src/components/Inspector/FabLauncher.tsx +0 -590
  276. package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
  277. package/src/components/Inspector/FeedbackModal.tsx +0 -626
  278. package/src/components/Inspector/InspectorContext.tsx +0 -28
  279. package/src/components/Inspector/InspectorHeader.tsx +0 -1583
  280. package/src/components/Inspector/LogDetail.tsx +0 -1431
  281. package/src/components/Inspector/MainScreen.tsx +0 -460
  282. package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
  283. package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
  284. package/src/components/Inspector/NavigationTracker.tsx +0 -13
  285. package/src/components/Inspector/NetworkDetail.tsx +0 -778
  286. package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
  287. package/src/components/Inspector/NetworkTab.tsx +0 -820
  288. package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
  289. package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
  290. package/src/components/Inspector/PerformanceTab.tsx +0 -1967
  291. package/src/components/Inspector/ReduxDetail.tsx +0 -1651
  292. package/src/components/Inspector/ReduxTab.tsx +0 -987
  293. package/src/components/Inspector/SettingsPanel.tsx +0 -5136
  294. package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
  295. package/src/components/Inspector/StorageTab.tsx +0 -1159
  296. package/src/components/Inspector/TabBar.tsx +0 -431
  297. package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
  298. package/src/components/JsonViewer.tsx +0 -549
  299. package/src/components/LogCard.tsx +0 -694
  300. package/src/components/LogSyntaxHighlighter.tsx +0 -178
  301. package/src/components/MetaAccordion.tsx +0 -355
  302. package/src/components/MiniBarChart.tsx +0 -42
  303. package/src/components/MiniLineChart.tsx +0 -33
  304. package/src/components/NetworkIcons.tsx +0 -2655
  305. package/src/components/QRCodeView.tsx +0 -75
  306. package/src/components/SectionHeader.tsx +0 -101
  307. package/src/components/SegmentedTabs.tsx +0 -84
  308. package/src/components/SkeletonPlaceholder.tsx +0 -206
  309. package/src/components/Slider.tsx +0 -300
  310. package/src/components/SourcePageCard.tsx +0 -150
  311. package/src/components/Toast.tsx +0 -131
  312. package/src/components/TouchableScale.tsx +0 -61
  313. package/src/components/TreeNode.tsx +0 -171
  314. package/src/console.ts +0 -24
  315. package/src/constants/index.ts +0 -41
  316. package/src/constants/telemetryConfig.ts +0 -4
  317. package/src/constants/version.ts +0 -3
  318. package/src/crash.ts +0 -32
  319. package/src/customHooks/analyticsLogger.ts +0 -336
  320. package/src/customHooks/bundleAnalyzer.ts +0 -1256
  321. package/src/customHooks/consoleLogger.ts +0 -530
  322. package/src/customHooks/crashHandler.ts +0 -944
  323. package/src/customHooks/logFilters.ts +0 -32
  324. package/src/customHooks/networkLogger.ts +0 -624
  325. package/src/customHooks/performanceTracker.ts +0 -1014
  326. package/src/customHooks/reduxLogger.ts +0 -406
  327. package/src/customHooks/storageInspector.ts +0 -513
  328. package/src/customHooks/useAccordion.tsx +0 -27
  329. package/src/decorators/index.ts +0 -184
  330. package/src/helpers/gaAnalyticsRegistry.ts +0 -204
  331. package/src/helpers/index.ts +0 -1092
  332. package/src/helpers/memoryManager.ts +0 -138
  333. package/src/helpers/qrGenerator.ts +0 -430
  334. package/src/helpers/remoteConfig.ts +0 -212
  335. package/src/helpers/searchQueryParser.ts +0 -84
  336. package/src/helpers/settingsStore.ts +0 -171
  337. package/src/helpers/telemetry.ts +0 -568
  338. package/src/helpers/toast.ts +0 -17
  339. package/src/i18n/index.ts +0 -104
  340. package/src/i18n/locales/en.json +0 -1141
  341. package/src/index.tsx +0 -2650
  342. package/src/metro.ts +0 -598
  343. package/src/network.ts +0 -22
  344. package/src/performance.ts +0 -38
  345. package/src/redux.ts +0 -23
  346. package/src/storage.ts +0 -18
  347. package/src/styles/AppColors.ts +0 -455
  348. package/src/styles/AppFonts.ts +0 -26
  349. package/src/styles/common.ts +0 -209
  350. package/src/styles/index.ts +0 -1606
  351. package/src/types/enums.ts +0 -210
  352. package/src/types/index.ts +0 -34
  353. package/src/types/interfaces.ts +0 -535
@@ -1,549 +0,0 @@
1
- import React, {useState, useEffect} from 'react';
2
- import {ScrollView, View, Text, StyleSheet, TouchableOpacity} from 'react-native';
3
- import {useTranslation} from '../i18n';
4
-
5
- // Components
6
- import TreeNode from './TreeNode';
7
- import SegmentedTabs from './SegmentedTabs';
8
- import HighlightText from './HighlightText';
9
- import CopyButton from './CopyButton';
10
- import {PrettyIcon, RawIcon, TableIcon, ChevronIcon} from './NetworkIcons';
11
-
12
- // Styles
13
- import {AppColors} from '../styles/AppColors';
14
- import {AppFonts} from '../styles/AppFonts';
15
- import styles from '../styles';
16
-
17
- // ── Table Row Component with 3-Line Clamp & Show More/Less ───────────────────
18
-
19
- const JsonTableRow = React.memo(({
20
- itemKey,
21
- val,
22
- search,
23
- }: {
24
- itemKey: string;
25
- val: any;
26
- search?: string;
27
- }) => {
28
- const [expanded, setExpanded] = useState(false);
29
- const isObject = val !== null && typeof val === 'object';
30
-
31
- let rawStr = '';
32
- if (val === null) {
33
- rawStr = 'null';
34
- } else if (val === undefined) {
35
- rawStr = 'undefined';
36
- } else if (isObject) {
37
- try {
38
- rawStr = JSON.stringify(val, null, 2);
39
- } catch {
40
- rawStr = String(val);
41
- }
42
- } else {
43
- rawStr = String(val);
44
- }
45
-
46
- const isMultiline = rawStr.includes('\n') || rawStr.length > 90;
47
-
48
- return (
49
- <View style={localStyles.tableRow}>
50
- <View style={{flex: 2, paddingRight: 8}}>
51
- <HighlightText
52
- text={itemKey}
53
- search={search}
54
- style={localStyles.tableCellKey}
55
- highlightStyle={localStyles.highlight}
56
- />
57
- {isObject && (
58
- <Text style={localStyles.tableTypeBadge}>
59
- {Array.isArray(val) ? `Array(${val.length})` : 'Object'}
60
- </Text>
61
- )}
62
- </View>
63
-
64
- <View style={{flex: 3}}>
65
- <HighlightText
66
- text={rawStr}
67
- search={search}
68
- style={[
69
- localStyles.tableCellValue,
70
- isObject && localStyles.tableCellRawCode,
71
- ]}
72
- highlightStyle={localStyles.highlight}
73
- numberOfLines={expanded ? undefined : 3}
74
- selectable={true}
75
- />
76
- {isMultiline && (
77
- <TouchableOpacity
78
- onPress={() => setExpanded(prev => !prev)}
79
- hitSlop={6}
80
- style={[localStyles.showMoreBtn, {flexDirection: 'row', alignItems: 'center', gap: 4}]}>
81
- <Text style={localStyles.showMoreText}>
82
- {expanded ? 'Show less' : 'Show more'}
83
- </Text>
84
- <ChevronIcon
85
- direction={expanded ? 'up' : 'down'}
86
- size={10}
87
- color={AppColors.purple}
88
- />
89
- </TouchableOpacity>
90
- )}
91
- </View>
92
- </View>
93
- );
94
- });
95
-
96
- // ── JsonViewer Component ─────────────────────────────────────────────────────
97
-
98
- const JsonViewer = React.memo(({
99
- data,
100
- search,
101
- forceOpen,
102
- defaultExpandDepth = 1,
103
- wrap,
104
- fullHeight = false,
105
- maxHeight,
106
- mode: externalMode,
107
- onModeChange,
108
- hideTabs = false,
109
- }: {
110
- data: unknown;
111
- search?: string;
112
- forceOpen?: boolean;
113
- defaultExpandDepth?: number;
114
- wrap?: boolean;
115
- fullHeight?: boolean;
116
- maxHeight?: number;
117
- mode?: 'pretty' | 'raw' | 'table';
118
- onModeChange?: (mode: 'pretty' | 'raw' | 'table') => void;
119
- hideTabs?: boolean;
120
- }) => {
121
- const {t} = useTranslation();
122
- const [internalMode, setInternalMode] = useState<'pretty' | 'raw' | 'table'>('raw');
123
- const mode = externalMode ?? internalMode;
124
-
125
- const setMode = (newMode: 'pretty' | 'raw' | 'table') => {
126
- if (onModeChange) {
127
- onModeChange(newMode);
128
- } else {
129
- setInternalMode(newMode);
130
- }
131
- };
132
-
133
- const rawText = React.useMemo(() => {
134
- if (data === undefined || data === null) {
135
- return '';
136
- }
137
- if (typeof data === 'string') {
138
- return data;
139
- }
140
- try {
141
- const stringified = JSON.stringify(data);
142
- return stringified ?? '';
143
- } catch {
144
- return String(data) || '';
145
- }
146
- }, [data]);
147
-
148
- const [showFullRaw, setShowFullRaw] = useState(false);
149
- const RAW_LIMIT = 50000;
150
- const safeRawText = typeof rawText === 'string' ? rawText : '';
151
- const isTruncated = safeRawText.length > RAW_LIMIT && !showFullRaw;
152
- const displayRawText = isTruncated ? safeRawText.slice(0, RAW_LIMIT) : safeRawText;
153
-
154
- useEffect(() => {
155
- if (externalMode) {
156
- setInternalMode(externalMode);
157
- }
158
- }, [externalMode]);
159
-
160
- const contentWrapperStyle = [
161
- localStyles.contentWrapper,
162
- {backgroundColor: AppColors.contentBg},
163
- fullHeight && {flex: 1, maxHeight: undefined},
164
- !fullHeight && maxHeight != null && {maxHeight},
165
- ];
166
- const scrollStyle = [
167
- localStyles.rawScroll,
168
- !fullHeight && maxHeight != null && {maxHeight},
169
- ];
170
-
171
- // Determine type and size details
172
- const isObject = typeof data === 'object' && data !== null;
173
- const isEmpty =
174
- data === null ||
175
- data === undefined ||
176
- (isObject && Object.keys(data as object).length === 0);
177
-
178
- // Render Table view (Key-Value flat table for root keys)
179
- const renderTableMode = () => {
180
- if (!isObject) {
181
- return (
182
- <View style={localStyles.tableRow}>
183
- <Text style={localStyles.tableCellKey}>{t('network.jsonViewer.value')}</Text>
184
- <Text style={localStyles.tableCellValue}>{String(data)}</Text>
185
- </View>
186
- );
187
- }
188
-
189
- let keys = Object.keys(data as object);
190
- if (search && search.trim().length > 0) {
191
- const q = search.trim().toLowerCase();
192
- keys = keys.filter(key => {
193
- const val = (data as any)[key];
194
- const valStr = typeof val === 'object' && val !== null ? JSON.stringify(val) : String(val);
195
- return key.toLowerCase().includes(q) || valStr.toLowerCase().includes(q);
196
- });
197
- }
198
-
199
- if (keys.length === 0) {
200
- return (
201
- <View style={localStyles.emptyTable}>
202
- <Text style={localStyles.emptyTableText}>
203
- {search && search.trim().length > 0
204
- ? 'No matching keys or values found'
205
- : t('network.jsonViewer.emptyTable')}
206
- </Text>
207
- </View>
208
- );
209
- }
210
-
211
- return (
212
- <View style={localStyles.tableView}>
213
- <View style={localStyles.tableHeaderRow}>
214
- <Text style={[localStyles.tableHeaderCell, {flex: 2}]}>{t('network.jsonViewer.key')}</Text>
215
- <Text style={[localStyles.tableHeaderCell, {flex: 3}]}>{t('network.jsonViewer.value')}</Text>
216
- </View>
217
- {keys.map((key) => (
218
- <JsonTableRow
219
- key={key}
220
- itemKey={key}
221
- val={(data as any)[key]}
222
- search={search}
223
- />
224
- ))}
225
- </View>
226
- );
227
- };
228
-
229
- // Tree View Content
230
- const tree = (
231
- <TreeNode
232
- data={data}
233
- search={search}
234
- forceOpen={forceOpen}
235
- defaultExpandDepth={defaultExpandDepth}
236
- />
237
- );
238
-
239
- return (
240
- <View style={[localStyles.container, fullHeight && {flex: 1}]}>
241
- {/* ── Top Toolbar (Postman-style) ── */}
242
- {!hideTabs && (
243
- <View style={localStyles.toolbar}>
244
- <SegmentedTabs
245
- style={{flex: 1, minWidth: 0, marginRight: 8}}
246
- tabs={[
247
- {
248
- key: 'pretty',
249
- label: t('network.jsonViewer.pretty'),
250
- icon: (isActive: boolean) => (
251
- <PrettyIcon
252
- color={isActive ? AppColors.white : AppColors.slate400}
253
- size={12}
254
- />
255
- ),
256
- },
257
- {
258
- key: 'raw',
259
- label: t('network.jsonViewer.raw'),
260
- icon: (isActive: boolean) => (
261
- <RawIcon
262
- color={isActive ? AppColors.white : AppColors.slate400}
263
- size={12}
264
- />
265
- ),
266
- },
267
- {
268
- key: 'table',
269
- label: t('network.jsonViewer.table'),
270
- icon: (isActive: boolean) => (
271
- <TableIcon
272
- color={isActive ? AppColors.white : AppColors.slate400}
273
- size={12}
274
- />
275
- ),
276
- },
277
- ]}
278
- activeKey={mode}
279
- onChange={key =>
280
- setMode(key as 'pretty' | 'raw' | 'table')
281
- }
282
- />
283
- <CopyButton value={data} label="JSON" />
284
- </View>
285
- )}
286
-
287
- {/* ── Main View Content Area (Royal Monospace Theme) ── */}
288
- <View style={contentWrapperStyle}>
289
- {mode === 'pretty' && (
290
- isEmpty ? (
291
- <View style={localStyles.emptyTable}>
292
- <Text style={localStyles.emptyTableText}>
293
- {t('network.jsonViewer.emptyPayload')}
294
- </Text>
295
- </View>
296
- ) : (
297
- wrap ? (
298
- fullHeight ? (
299
- <ScrollView style={{flex: 1}} contentContainerStyle={{flexGrow: 1}}>
300
- <View style={[styles.codeBlock, {width: '100%'}]}>{tree}</View>
301
- </ScrollView>
302
- ) : (
303
- <View style={[styles.codeBlock, {width: '100%'}]}>{tree}</View>
304
- )
305
- ) : (
306
- fullHeight ? (
307
- <ScrollView style={{flex: 1}} contentContainerStyle={{flexGrow: 1}}>
308
- <ScrollView
309
- horizontal
310
- showsHorizontalScrollIndicator={true}
311
- style={styles.codeBlockScroll}>
312
- <View style={styles.codeBlock}>{tree}</View>
313
- </ScrollView>
314
- </ScrollView>
315
- ) : (
316
- <ScrollView
317
- horizontal
318
- showsHorizontalScrollIndicator={true}
319
- style={styles.codeBlockScroll}>
320
- <View style={styles.codeBlock}>{tree}</View>
321
- </ScrollView>
322
- )
323
- )
324
- )
325
- )}
326
-
327
- {mode === 'raw' && (
328
- fullHeight ? (
329
- <ScrollView
330
- style={{flex: 1}}
331
- contentContainerStyle={localStyles.rawContainer}
332
- showsVerticalScrollIndicator={true}>
333
- <HighlightText
334
- text={displayRawText}
335
- search={search}
336
- detectLinks={rawText.length < 20000}
337
- style={localStyles.rawPlainText}
338
- selectable={true}
339
- highlightStyle={{
340
- backgroundColor: AppColors.yellowHighlight,
341
- color: AppColors.primaryBlack,
342
- borderRadius: 3,
343
- paddingHorizontal: 2,
344
- }}
345
- />
346
- {isTruncated && (
347
- <TouchableOpacity
348
- onPress={() => setShowFullRaw(true)}
349
- style={{
350
- marginTop: 10,
351
- backgroundColor: `${AppColors.brandPurple}15`,
352
- paddingVertical: 8,
353
- paddingHorizontal: 12,
354
- borderRadius: 6,
355
- alignItems: 'center',
356
- borderWidth: 1,
357
- borderColor: `${AppColors.brandPurple}30`,
358
- }}>
359
- <Text
360
- style={{
361
- fontFamily: AppFonts.interBold,
362
- fontSize: 11,
363
- color: AppColors.brandPurple,
364
- }}>
365
- Showing first 50 KB ({Math.round(rawText.length / 1024)} KB total) · Tap to load full
366
- </Text>
367
- </TouchableOpacity>
368
- )}
369
- </ScrollView>
370
- ) : (
371
- <View style={localStyles.rawContainer}>
372
- <HighlightText
373
- text={displayRawText}
374
- search={search}
375
- detectLinks={rawText.length < 20000}
376
- style={localStyles.rawPlainText}
377
- selectable={true}
378
- highlightStyle={{
379
- backgroundColor: AppColors.yellowHighlight,
380
- color: AppColors.primaryBlack,
381
- borderRadius: 3,
382
- paddingHorizontal: 2,
383
- }}
384
- />
385
- {isTruncated && (
386
- <TouchableOpacity
387
- onPress={() => setShowFullRaw(true)}
388
- style={{
389
- marginTop: 10,
390
- backgroundColor: `${AppColors.brandPurple}15`,
391
- paddingVertical: 8,
392
- paddingHorizontal: 12,
393
- borderRadius: 6,
394
- alignItems: 'center',
395
- borderWidth: 1,
396
- borderColor: `${AppColors.brandPurple}30`,
397
- }}>
398
- <Text
399
- style={{
400
- fontFamily: AppFonts.interBold,
401
- fontSize: 11,
402
- color: AppColors.brandPurple,
403
- }}>
404
- Showing first 50 KB ({Math.round(rawText.length / 1024)} KB total) · Tap to load full
405
- </Text>
406
- </TouchableOpacity>
407
- )}
408
- </View>
409
- )
410
- )}
411
-
412
- {mode === 'table' && (
413
- fullHeight ? (
414
- <ScrollView style={{flex: 1}}>
415
- {renderTableMode()}
416
- </ScrollView>
417
- ) : (
418
- <View style={localStyles.tableView}>
419
- {renderTableMode()}
420
- </View>
421
- )
422
- )}
423
- </View>
424
- </View>
425
- );
426
- });
427
-
428
- const localStyles = StyleSheet.create({
429
- container: {
430
- backgroundColor: AppColors.white,
431
- borderRadius: 12,
432
- borderWidth: 1.5,
433
- borderColor: AppColors.slate200,
434
- overflow: 'hidden',
435
- shadowColor: AppColors.black,
436
- shadowOpacity: 0.04,
437
- shadowRadius: 5,
438
- shadowOffset: {width: 0, height: 2},
439
- elevation: 2,
440
- width: '100%',
441
- },
442
- toolbar: {
443
- flexDirection: 'row',
444
- alignItems: 'center',
445
- justifyContent: 'space-between',
446
- backgroundColor: AppColors.slate50,
447
- borderBottomWidth: 1,
448
- borderBottomColor: AppColors.slate200,
449
- paddingHorizontal: 8,
450
- paddingVertical: 6,
451
- gap: 8,
452
- },
453
- contentWrapper: {
454
- backgroundColor: AppColors.white,
455
- minHeight: 120,
456
- },
457
- rawScroll: {
458
- flex: 1,
459
- backgroundColor: AppColors.paperBg, // Royal off-white paper tone
460
- },
461
- rawContainer: {
462
- padding: 12,
463
- },
464
- rawPlainText: {
465
- fontFamily: AppFonts.interRegular,
466
- fontSize: 12.5,
467
- color: AppColors.primaryBlack,
468
- lineHeight: 18,
469
- },
470
- tableView: {
471
- flex: 1,
472
- },
473
- tableHeaderRow: {
474
- flexDirection: 'row',
475
- backgroundColor: AppColors.slate100,
476
- borderBottomWidth: 1,
477
- borderBottomColor: AppColors.slate200,
478
- paddingVertical: 8,
479
- paddingHorizontal: 12,
480
- },
481
- tableHeaderCell: {
482
- fontFamily: AppFonts.interBold,
483
- fontSize: 11,
484
- color: AppColors.slate600,
485
- letterSpacing: 0.5,
486
- textTransform: 'uppercase',
487
- },
488
- tableRow: {
489
- flexDirection: 'row',
490
- borderBottomWidth: 1,
491
- borderBottomColor: AppColors.slate100,
492
- paddingVertical: 10,
493
- paddingHorizontal: 12,
494
- alignItems: 'center',
495
- },
496
- tableCellKey: {
497
- fontFamily: AppFonts.interBold,
498
- fontSize: 12.5,
499
- color: AppColors.purple,
500
- },
501
- tableTypeBadge: {
502
- fontFamily: AppFonts.interMedium,
503
- fontSize: 9.5,
504
- color: AppColors.slate400,
505
- marginTop: 2,
506
- },
507
- tableCellValue: {
508
- fontFamily: AppFonts.interRegular,
509
- fontSize: 12,
510
- color: AppColors.primaryBlack,
511
- lineHeight: 17,
512
- },
513
- tableCellRawCode: {
514
- fontFamily: AppFonts.interRegular,
515
- fontSize: 11.5,
516
- color: AppColors.slate700,
517
- backgroundColor: `${AppColors.slate100}80`,
518
- padding: 6,
519
- borderRadius: 6,
520
- },
521
- showMoreBtn: {
522
- alignSelf: 'flex-start',
523
- marginTop: 4,
524
- paddingVertical: 2,
525
- paddingHorizontal: 4,
526
- },
527
- showMoreText: {
528
- fontFamily: AppFonts.interBold,
529
- fontSize: 11,
530
- color: AppColors.purple,
531
- },
532
- emptyTable: {
533
- padding: 24,
534
- alignItems: 'center',
535
- justifyContent: 'center',
536
- },
537
- emptyTableText: {
538
- fontFamily: AppFonts.interMedium,
539
- fontSize: 12.5,
540
- color: AppColors.slate400,
541
- },
542
- highlight: {
543
- backgroundColor: '#FEF08A',
544
- color: '#854D0E',
545
- fontFamily: AppFonts.interBold,
546
- },
547
- });
548
-
549
- export default JsonViewer;