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,1362 +0,0 @@
1
- import React, {useCallback, useState, useMemo, useEffect, useRef} from 'react';
2
- import {
3
- FlatList,
4
- Platform,
5
- Pressable,
6
- Text,
7
- TextInput,
8
- TouchableOpacity,
9
- View,
10
- } from 'react-native';
11
- import {animateNextLayout, useInspector} from './InspectorContext';
12
- import AnalyticsEventCard from '../AnalyticsEventCard';
13
- import AnalyticsFilterModal from './AnalyticsFilterModal';
14
- import EndOfListFooter from '../EndOfListFooter';
15
- import EmptyState from '../EmptyState';
16
- import styles from '../../styles';
17
- import {AppColors} from '../../styles/AppColors';
18
- import {AppFonts} from '../../styles/AppFonts';
19
- import {useTranslation} from '../../i18n';
20
- import Svg, {
21
- Path,
22
- Rect,
23
- Line,
24
- Circle,
25
- G,
26
- Defs,
27
- LinearGradient as SvgLinearGradient,
28
- Stop,
29
- } from 'react-native-svg';
30
- import TouchableScale from '../TouchableScale';
31
- import {
32
- getCurrentUserId,
33
- getCurrentUserProperties,
34
- getDefaultEventParameters,
35
- getCollectionEnabled,
36
- } from '../../customHooks/analyticsLogger';
37
- import {
38
- getEventCategory,
39
- getCategoryColors,
40
- } from '../../helpers';
41
- import {
42
- LayersIcon,
43
- CheckIcon,
44
- SearchIcon,
45
- ClearIcon,
46
- TrashIcon,
47
- EmptyRadarIcon,
48
- HeaderPauseIcon,
49
- FilterIcon,
50
- CartIcon,
51
- GlobeIcon,
52
- BoltIcon,
53
- SparkleIcon,
54
- ClockIcon,
55
- TargetGoalIcon,
56
- PinIcon,
57
- MoneyIcon,
58
- UserCheckIcon,
59
- ChevronIcon,
60
- } from '../NetworkIcons';
61
-
62
- const AnalyticsHeader = React.memo(() => {
63
- const {t} = useTranslation();
64
- const {
65
- analyticsEvents,
66
- filteredAnalyticsEvents,
67
- analyticsFilters,
68
- setAnalyticsFilters,
69
- analyticsHeaderExpanded,
70
- setAnalyticsHeaderExpanded,
71
- } = useInspector();
72
-
73
- const userId = getCurrentUserId();
74
- const userProperties = getCurrentUserProperties();
75
- const defaultParams = getDefaultEventParameters();
76
- const isTrackingEnabled = getCollectionEnabled();
77
-
78
- // If there are no analytics events in the session, hide the graph, category breakdown, and realtime card
79
- if (analyticsEvents.length === 0) {
80
- return null;
81
- }
82
-
83
- const hasUserProps = Object.keys(userProperties).length > 0;
84
- const hasDefaultParams = Object.keys(defaultParams).length > 0;
85
- const totalEvents = filteredAnalyticsEvents.length;
86
-
87
- // Category counts & breakdown across all session events
88
- const categoryStats = useMemo(() => {
89
- let ecommerce = 0;
90
- let page_view = 0;
91
- let system = 0;
92
- let custom = 0;
93
- let totalRevenue = 0;
94
-
95
- for (const e of analyticsEvents) {
96
- const cat = getEventCategory(e.name);
97
- const c = (e as any).count || 1;
98
- if (cat === 'ecommerce') {
99
- ecommerce += c;
100
- const val = e.params?.value ?? e.params?.price;
101
- if (val && !isNaN(Number(val))) {
102
- totalRevenue += Number(val);
103
- }
104
- } else if (cat === 'page_view') {
105
- page_view += c;
106
- } else if (cat === 'system') {
107
- system += c;
108
- } else {
109
- custom += c;
110
- }
111
- }
112
-
113
- const total = ecommerce + page_view + system + custom || 1;
114
- return {
115
- ecommerce,
116
- page_view,
117
- system,
118
- custom,
119
- totalRevenue,
120
- ecommercePct: Math.round((ecommerce / total) * 100),
121
- page_viewPct: Math.round((page_view / total) * 100),
122
- systemPct: Math.round((system / total) * 100),
123
- customPct: Math.round((custom / total) * 100),
124
- totalCount: total,
125
- };
126
- }, [analyticsEvents]);
127
-
128
- // Top Screen Views Leaderboard (GA4 Realtime Card)
129
- const topScreens = useMemo(() => {
130
- const screenMap = new Map<string, number>();
131
- for (const e of filteredAnalyticsEvents) {
132
- const scr =
133
- e.screenName ||
134
- e.params?.firebase_screen ||
135
- e.params?.screen_name ||
136
- e.params?.firebase_screen_class ||
137
- e.screenClass;
138
- if (scr && typeof scr === 'string' && scr.trim() !== '') {
139
- screenMap.set(scr, (screenMap.get(scr) || 0) + ((e as any).count || 1));
140
- }
141
- }
142
- const arr = Array.from(screenMap.entries()).sort((a, b) => b[1] - a[1]);
143
- const maxVal = arr.length > 0 ? arr[0][1] : 1;
144
- return arr.slice(0, 3).map(([name, count]) => ({
145
- name,
146
- count,
147
- pct: Math.round((count / (filteredAnalyticsEvents.length || 1)) * 100),
148
- barWidthPct: Math.round((count / maxVal) * 100),
149
- }));
150
- }, [filteredAnalyticsEvents]);
151
-
152
- // Multi-select category toggle from top button group
153
- const toggleCategoryFilter = (cat: string) => {
154
- animateNextLayout();
155
- setAnalyticsFilters(prev => {
156
- if (cat === 'all') {
157
- return {...prev, categories: new Set(['all'])};
158
- }
159
-
160
- const nextCategories = new Set(prev.categories);
161
- if (nextCategories.has('all')) {
162
- nextCategories.delete('all');
163
- nextCategories.add(cat);
164
- } else {
165
- if (nextCategories.has(cat)) {
166
- nextCategories.delete(cat);
167
- if (nextCategories.size === 0) {
168
- nextCategories.add('all');
169
- }
170
- } else {
171
- nextCategories.add(cat);
172
- if (
173
- nextCategories.has('ecommerce') &&
174
- nextCategories.has('page_view') &&
175
- nextCategories.has('system') &&
176
- nextCategories.has('custom')
177
- ) {
178
- return {...prev, categories: new Set(['all'])};
179
- }
180
- }
181
- }
182
-
183
- return {...prev, categories: nextCategories};
184
- });
185
- };
186
-
187
- // 12-Bucket GA4 Realtime Stacked Histogram & Spline Wave Graph (60s live rolling stream)
188
- const BUCKET_COUNT = 12;
189
- const chartHeight = 64;
190
- const svgWidth = 320;
191
- const [selectedBucketIdx, setSelectedBucketIdx] = useState<number | null>(null);
192
- const [liveTick, setLiveTick] = useState<number>(0);
193
-
194
- useEffect(() => {
195
- if (!isTrackingEnabled) return;
196
- const interval = setInterval(() => {
197
- setLiveTick(t => (t + 1) % 100000);
198
- }, 1000);
199
- return () => clearInterval(interval);
200
- }, [isTrackingEnabled]);
201
-
202
- const histogramData = useMemo(() => {
203
- const buckets: {
204
- index: number;
205
- ecommerce: number;
206
- page_view: number;
207
- system: number;
208
- custom: number;
209
- total: number;
210
- x: number;
211
- y: number;
212
- isLatest: boolean;
213
- ageLabel: string;
214
- }[] = [];
215
-
216
- const now = Date.now();
217
- const windowMs = 60000; // 60s live rolling window
218
- const bucketDuration = windowMs / BUCKET_COUNT; // 5s per bucket
219
-
220
- for (let i = 0; i < BUCKET_COUNT; i++) {
221
- const bucketAgeSec = Math.round(((BUCKET_COUNT - 1 - i) * bucketDuration) / 1000);
222
- buckets.push({
223
- index: i,
224
- ecommerce: 0,
225
- page_view: 0,
226
- system: 0,
227
- custom: 0,
228
- total: 0,
229
- x: (i / (BUCKET_COUNT - 1)) * (svgWidth - 24) + 12,
230
- y: chartHeight - 12,
231
- isLatest: i === BUCKET_COUNT - 1,
232
- ageLabel: i === BUCKET_COUNT - 1 ? t('analytics.timeNow') : `-${bucketAgeSec}s`,
233
- });
234
- }
235
-
236
- for (const e of filteredAnalyticsEvents) {
237
- const age = now - e.timestamp;
238
- if (age >= 0 && age < windowMs) {
239
- const bucketIdx = Math.floor((windowMs - 1 - age) / bucketDuration);
240
- if (bucketIdx >= 0 && bucketIdx < BUCKET_COUNT) {
241
- const cat = getEventCategory(e.name);
242
- const c = (e as any).count || 1;
243
- buckets[bucketIdx].total += c;
244
- if (cat === 'ecommerce') buckets[bucketIdx].ecommerce += c;
245
- else if (cat === 'page_view') buckets[bucketIdx].page_view += c;
246
- else if (cat === 'system') buckets[bucketIdx].system += c;
247
- else buckets[bucketIdx].custom += c;
248
- }
249
- }
250
- }
251
-
252
- const maxVal = Math.max(...buckets.map(b => b.total), 4);
253
- buckets.forEach(b => {
254
- const normalizedH = (b.total / maxVal) * (chartHeight - 22);
255
- b.y = chartHeight - 10 - normalizedH;
256
- });
257
-
258
- // Generate Cubic Bézier Spline paths
259
- let linePath = `M ${buckets[0].x.toFixed(1)} ${buckets[0].y.toFixed(1)}`;
260
- for (let i = 0; i < buckets.length - 1; i++) {
261
- const p0 = buckets[Math.max(0, i - 1)];
262
- const p1 = buckets[i];
263
- const p2 = buckets[i + 1];
264
- const p3 = buckets[Math.min(buckets.length - 1, i + 2)];
265
-
266
- const cp1x = p1.x + (p2.x - p0.x) / 6;
267
- const cp1y = p1.y + (p2.y - p0.y) / 6;
268
- const cp2x = p2.x - (p3.x - p1.x) / 6;
269
- const cp2y = p2.y - (p3.y - p1.y) / 6;
270
-
271
- linePath += ` C ${cp1x.toFixed(1)} ${cp1y.toFixed(1)}, ${cp2x.toFixed(1)} ${cp2y.toFixed(1)}, ${p2.x.toFixed(1)} ${p2.y.toFixed(1)}`;
272
- }
273
-
274
- const lastB = buckets[buckets.length - 1];
275
- const firstB = buckets[0];
276
- const areaPath = `${linePath} L ${lastB.x.toFixed(1)} ${chartHeight - 4} L ${firstB.x.toFixed(1)} ${chartHeight - 4} Z`;
277
-
278
- const peakVal = Math.max(...buckets.map(b => b.total), 0);
279
- const eventRate = Math.round(buckets.reduce((a, b) => a + b.total, 0));
280
-
281
- return {
282
- buckets,
283
- linePath,
284
- areaPath,
285
- peakVal,
286
- eventRate,
287
- };
288
- }, [filteredAnalyticsEvents, chartHeight, svgWidth, liveTick, t]);
289
-
290
- const selectedBucket = selectedBucketIdx != null ? histogramData.buckets[selectedBucketIdx] : null;
291
-
292
- return (
293
- <View style={styles.analyticsHeaderCard}>
294
- {/* ── 1. Top Header Row (GA4 Style) ─────────────────────────────────── */}
295
- <View style={styles.analyticsHeaderTop}>
296
- <View style={{flex: 1}}>
297
- <View style={{flexDirection: 'row', alignItems: 'center', gap: 6}}>
298
- <Text style={styles.analyticsHeaderTitle}>{t('analytics.realtimeStream')}</Text>
299
- <View
300
- style={[
301
- styles.statusDot,
302
- {
303
- backgroundColor: isTrackingEnabled
304
- ? AppColors.greenColor
305
- : AppColors.errorColor,
306
- },
307
- ]}
308
- />
309
- <Text
310
- style={[
311
- styles.statusText,
312
- {
313
- color: isTrackingEnabled
314
- ? AppColors.greenColor
315
- : AppColors.errorColor,
316
- fontFamily: AppFonts.interBold,
317
- },
318
- ]}>
319
- {isTrackingEnabled ? t('performance.live') : t('common.pause')}
320
- </Text>
321
- </View>
322
- <Text style={styles.analyticsHeaderSubtitle} numberOfLines={1}>
323
- {userId ? `${t('analytics.userId')}: ${userId}` : t('analytics.emptySubtitle')}
324
- </Text>
325
- </View>
326
-
327
- <TouchableOpacity
328
- style={styles.analyticsHeaderToggle}
329
- activeOpacity={0.7}
330
- onPress={() => {
331
- animateNextLayout();
332
- setAnalyticsHeaderExpanded(!analyticsHeaderExpanded);
333
- }}>
334
- <Text style={styles.analyticsHeaderToggleText}>
335
- {analyticsHeaderExpanded ? t('common.close') : t('analytics.eventDetails')}
336
- </Text>
337
- </TouchableOpacity>
338
- </View>
339
-
340
- {/* ── 2. Multi-Select Category Filter Buttons (AT THE TOP) ──────────── */}
341
- <View style={{marginTop: 10, marginBottom: 8}}>
342
- {/* Multi-color Proportional Segmented Bar */}
343
- <View
344
- style={{
345
- height: 4.5,
346
- borderRadius: 2.5,
347
- backgroundColor: `${AppColors.grayBorderSecondary}40`,
348
- flexDirection: 'row',
349
- overflow: 'hidden',
350
- marginBottom: 8,
351
- }}>
352
- {categoryStats.ecommerce > 0 && (
353
- <View
354
- style={{
355
- flex: categoryStats.ecommerce,
356
- backgroundColor: AppColors.amber500,
357
- }}
358
- />
359
- )}
360
- {categoryStats.page_view > 0 && (
361
- <View
362
- style={{
363
- flex: categoryStats.page_view,
364
- backgroundColor: AppColors.sky500,
365
- }}
366
- />
367
- )}
368
- {categoryStats.system > 0 && (
369
- <View
370
- style={{
371
- flex: categoryStats.system,
372
- backgroundColor: AppColors.purple,
373
- }}
374
- />
375
- )}
376
- {categoryStats.custom > 0 && (
377
- <View
378
- style={{
379
- flex: categoryStats.custom,
380
- backgroundColor: AppColors.brandPurple,
381
- }}
382
- />
383
- )}
384
- </View>
385
-
386
- {/* Multi-Select Category Buttons */}
387
- <View
388
- style={{
389
- flexDirection: 'row',
390
- flexWrap: 'wrap',
391
- gap: 6,
392
- }}>
393
- {/* All Button */}
394
- {(() => {
395
- const isAllSelected = analyticsFilters.categories.has('all');
396
- return (
397
- <TouchableScale
398
- onPress={() => toggleCategoryFilter('all')}
399
- style={[
400
- {
401
- flexDirection: 'row',
402
- alignItems: 'center',
403
- gap: 5,
404
- backgroundColor: isAllSelected ? AppColors.indigo600Alt : AppColors.indigo50,
405
- paddingHorizontal: 8,
406
- paddingVertical: 5,
407
- borderRadius: 7,
408
- borderWidth: 1,
409
- borderColor: isAllSelected ? AppColors.indigo600 : AppColors.indigo400,
410
- },
411
- isAllSelected && {
412
- shadowColor: AppColors.indigo600Alt,
413
- shadowOffset: {width: 0, height: 1},
414
- shadowOpacity: 0.28,
415
- shadowRadius: 2.5,
416
- elevation: 2,
417
- },
418
- ]}>
419
- <LayersIcon
420
- color={isAllSelected ? AppColors.white : AppColors.indigo600Alt}
421
- size={11}
422
- />
423
- <Text
424
- style={{
425
- fontFamily: AppFonts.interBold,
426
- fontSize: 10,
427
- color: isAllSelected ? AppColors.white : AppColors.indigo600Alt,
428
- }}>
429
- {t('analytics.allCategory')}: {categoryStats.totalCount}
430
- </Text>
431
- </TouchableScale>
432
- );
433
- })()}
434
-
435
- {/* Ecommerce Button */}
436
- {(() => {
437
- const isSelected =
438
- !analyticsFilters.categories.has('all') &&
439
- analyticsFilters.categories.has('ecommerce');
440
- return (
441
- <TouchableScale
442
- onPress={() => toggleCategoryFilter('ecommerce')}
443
- style={[
444
- {
445
- flexDirection: 'row',
446
- alignItems: 'center',
447
- gap: 5,
448
- backgroundColor: isSelected ? AppColors.amber600 : AppColors.amber100,
449
- paddingHorizontal: 8,
450
- paddingVertical: 5,
451
- borderRadius: 7,
452
- borderWidth: 1,
453
- borderColor: isSelected ? AppColors.amber700 : AppColors.amber200,
454
- },
455
- isSelected && {
456
- shadowColor: AppColors.amber600,
457
- shadowOffset: {width: 0, height: 1},
458
- shadowOpacity: 0.28,
459
- shadowRadius: 2.5,
460
- elevation: 2,
461
- },
462
- ]}>
463
- <CartIcon
464
- color={isSelected ? AppColors.white : AppColors.amber700}
465
- size={11}
466
- />
467
- <Text
468
- style={{
469
- fontFamily: AppFonts.interBold,
470
- fontSize: 10,
471
- color: isSelected ? AppColors.white : AppColors.amber800Warm,
472
- }}>
473
- {t('analytics.ecommerceCategory')}: {categoryStats.ecommerce} ({categoryStats.ecommercePct}%)
474
- </Text>
475
- </TouchableScale>
476
- );
477
- })()}
478
-
479
- {/* Screens Button */}
480
- {(() => {
481
- const isSelected =
482
- !analyticsFilters.categories.has('all') &&
483
- analyticsFilters.categories.has('page_view');
484
- return (
485
- <TouchableScale
486
- onPress={() => toggleCategoryFilter('page_view')}
487
- style={[
488
- {
489
- flexDirection: 'row',
490
- alignItems: 'center',
491
- gap: 5,
492
- backgroundColor: isSelected ? AppColors.sky600 : AppColors.sky100,
493
- paddingHorizontal: 8,
494
- paddingVertical: 5,
495
- borderRadius: 7,
496
- borderWidth: 1,
497
- borderColor: isSelected ? AppColors.blue700 : AppColors.sky400,
498
- },
499
- isSelected && {
500
- shadowColor: AppColors.sky600,
501
- shadowOffset: {width: 0, height: 1},
502
- shadowOpacity: 0.28,
503
- shadowRadius: 2.5,
504
- elevation: 2,
505
- },
506
- ]}>
507
- <GlobeIcon
508
- color={isSelected ? AppColors.white : AppColors.sky600}
509
- size={11}
510
- />
511
- <Text
512
- style={{
513
- fontFamily: AppFonts.interBold,
514
- fontSize: 10,
515
- color: isSelected ? AppColors.white : AppColors.sky600,
516
- }}>
517
- {t('analytics.screensCategory')}: {categoryStats.page_view} ({categoryStats.page_viewPct}%)
518
- </Text>
519
- </TouchableScale>
520
- );
521
- })()}
522
-
523
- {/* System Button */}
524
- {(() => {
525
- const isSelected =
526
- !analyticsFilters.categories.has('all') &&
527
- analyticsFilters.categories.has('system');
528
- return (
529
- <TouchableScale
530
- onPress={() => toggleCategoryFilter('system')}
531
- style={[
532
- {
533
- flexDirection: 'row',
534
- alignItems: 'center',
535
- gap: 5,
536
- backgroundColor: isSelected ? AppColors.violet600 : AppColors.purple100,
537
- paddingHorizontal: 8,
538
- paddingVertical: 5,
539
- borderRadius: 7,
540
- borderWidth: 1,
541
- borderColor: isSelected ? AppColors.purpleShade700 : AppColors.purple200,
542
- },
543
- isSelected && {
544
- shadowColor: AppColors.violet600,
545
- shadowOffset: {width: 0, height: 1},
546
- shadowOpacity: 0.28,
547
- shadowRadius: 2.5,
548
- elevation: 2,
549
- },
550
- ]}>
551
- <BoltIcon
552
- color={isSelected ? AppColors.white : AppColors.purple}
553
- size={11}
554
- />
555
- <Text
556
- style={{
557
- fontFamily: AppFonts.interBold,
558
- fontSize: 10,
559
- color: isSelected ? AppColors.white : AppColors.brandPurple,
560
- }}>
561
- {t('analytics.systemCategory')}: {categoryStats.system} ({categoryStats.systemPct}%)
562
- </Text>
563
- </TouchableScale>
564
- );
565
- })()}
566
-
567
- {/* Custom Button */}
568
- {(() => {
569
- const isSelected =
570
- !analyticsFilters.categories.has('all') &&
571
- analyticsFilters.categories.has('custom');
572
- return (
573
- <TouchableScale
574
- onPress={() => toggleCategoryFilter('custom')}
575
- style={[
576
- {
577
- flexDirection: 'row',
578
- alignItems: 'center',
579
- gap: 5,
580
- backgroundColor: isSelected ? AppColors.pink600 : AppColors.pink100,
581
- paddingHorizontal: 8,
582
- paddingVertical: 5,
583
- borderRadius: 7,
584
- borderWidth: 1,
585
- borderColor: isSelected ? AppColors.rose700 : AppColors.roseBorder,
586
- },
587
- isSelected && {
588
- shadowColor: AppColors.pink600,
589
- shadowOffset: {width: 0, height: 1},
590
- shadowOpacity: 0.28,
591
- shadowRadius: 2.5,
592
- elevation: 2,
593
- },
594
- ]}>
595
- <SparkleIcon
596
- color={isSelected ? AppColors.white : AppColors.brandPurple}
597
- size={11}
598
- />
599
- <Text
600
- style={{
601
- fontFamily: AppFonts.interBold,
602
- fontSize: 10,
603
- color: isSelected ? AppColors.white : AppColors.pink600,
604
- }}>
605
- {t('analytics.customCategory')}: {categoryStats.custom} ({categoryStats.customPct}%)
606
- </Text>
607
- </TouchableScale>
608
- );
609
- })()}
610
- </View>
611
- </View>
612
-
613
- {/* ── 3. GA4 Realtime Metric Hero & Activity Chart (UNDER CATEGORIES) ─ */}
614
- <View
615
- style={{
616
- marginTop: 2,
617
- marginBottom: 8,
618
- backgroundColor: AppColors.grayBackground,
619
- borderRadius: 10,
620
- borderWidth: 1,
621
- borderColor: AppColors.dividerColor,
622
- padding: 10,
623
- }}>
624
- {/* Hero Metric Row */}
625
- <View
626
- style={{
627
- flexDirection: 'row',
628
- justifyContent: 'space-between',
629
- alignItems: 'flex-start',
630
- marginBottom: 6,
631
- }}>
632
- <View>
633
- <View style={{flexDirection: 'row', alignItems: 'baseline', gap: 6}}>
634
- <Text
635
- style={{
636
- fontFamily: AppFonts.interBold,
637
- fontSize: 22,
638
- color: AppColors.primaryBlack,
639
- lineHeight: 26,
640
- }}>
641
- {totalEvents}
642
- </Text>
643
- <Text
644
- style={{
645
- fontFamily: AppFonts.interMedium,
646
- fontSize: 10.5,
647
- color: AppColors.grayTextWeak,
648
- }}>
649
- {t('analytics.eventsInWindow')}
650
- </Text>
651
- </View>
652
- </View>
653
-
654
- {/* Realtime Rate Badges */}
655
- <View style={{flexDirection: 'row', alignItems: 'center', gap: 5}}>
656
- <View
657
- style={{
658
- flexDirection: 'row',
659
- alignItems: 'center',
660
- gap: 3,
661
- backgroundColor: `${AppColors.purple}14`,
662
- paddingHorizontal: 6,
663
- paddingVertical: 2.5,
664
- borderRadius: 4,
665
- borderWidth: 1,
666
- borderColor: `${AppColors.purple}2E`,
667
- }}>
668
- <Text
669
- style={{
670
- fontFamily: AppFonts.interBold,
671
- fontSize: 9.5,
672
- color: AppColors.purple,
673
- }}>
674
- {t('analytics.eventVelocity', {rate: histogramData.eventRate})}
675
- </Text>
676
- </View>
677
-
678
- {categoryStats.totalRevenue > 0 && (
679
- <View
680
- style={{
681
- flexDirection: 'row',
682
- alignItems: 'center',
683
- gap: 3,
684
- backgroundColor: `${AppColors.emerald600}15`,
685
- paddingHorizontal: 6,
686
- paddingVertical: 2.5,
687
- borderRadius: 4,
688
- borderWidth: 1,
689
- borderColor: `${AppColors.emerald600}30`,
690
- }}>
691
- <MoneyIcon color={AppColors.emerald600} size={10} />
692
- <Text
693
- style={{
694
- fontFamily: AppFonts.interBold,
695
- fontSize: 9.5,
696
- color: AppColors.emerald600,
697
- }}>
698
- ${categoryStats.totalRevenue.toFixed(2)}
699
- </Text>
700
- </View>
701
- )}
702
- </View>
703
- </View>
704
-
705
- {/* ── Crashlytics-Style Multi-Bar Histogram with Trendline Overlay ── */}
706
- <View style={{height: chartHeight, position: 'relative', overflow: 'hidden', borderRadius: 8}}>
707
- <Svg width="100%" height={chartHeight} viewBox={`0 0 ${svgWidth} ${chartHeight}`} preserveAspectRatio="none">
708
- <Defs>
709
- <SvgLinearGradient id="crashlyticsBarGrad" x1="0" y1="0" x2="0" y2="1">
710
- <Stop offset="0%" stopColor="#8B5CF6" stopOpacity="0.9" />
711
- <Stop offset="100%" stopColor="#6366F1" stopOpacity="0.6" />
712
- </SvgLinearGradient>
713
- <SvgLinearGradient id="crashlyticsAreaGrad" x1="0" y1="0" x2="0" y2="1">
714
- <Stop offset="0%" stopColor="#8B5CF6" stopOpacity="0.25" />
715
- <Stop offset="80%" stopColor="#8B5CF6" stopOpacity="0.04" />
716
- <Stop offset="100%" stopColor="#8B5CF6" stopOpacity="0.0" />
717
- </SvgLinearGradient>
718
- </Defs>
719
-
720
- {/* Subtle Grid Guidelines */}
721
- <Line
722
- x1="6"
723
- y1={chartHeight - 6}
724
- x2={svgWidth - 6}
725
- y2={chartHeight - 6}
726
- stroke="#E2E8F0"
727
- strokeWidth="1"
728
- />
729
- <Line
730
- x1="6"
731
- y1={chartHeight / 2}
732
- x2={svgWidth - 6}
733
- y2={chartHeight / 2}
734
- stroke="#F1F5F9"
735
- strokeWidth="1"
736
- strokeDasharray="4,4"
737
- />
738
-
739
- {/* Glowing Area Underlay */}
740
- <Path d={histogramData.areaPath} fill="url(#crashlyticsAreaGrad)" />
741
-
742
- {/* Vertical Crashlytics Histogram Bars */}
743
- {histogramData.buckets.map((b, idx) => {
744
- const isSelected = selectedBucketIdx === idx;
745
- const barWidth = 10;
746
- const barX = b.x - barWidth / 2;
747
- const barHeight = Math.max(3, chartHeight - 8 - b.y);
748
- const barY = chartHeight - 8 - barHeight;
749
-
750
- return (
751
- <G key={`bar-${b.index}`}>
752
- {/* Background slot */}
753
- <Rect
754
- x={barX}
755
- y={6}
756
- width={barWidth}
757
- height={chartHeight - 14}
758
- rx={3}
759
- fill={isSelected ? '#EDE9FE' : '#F8FAFC'}
760
- />
761
-
762
- {/* Active Event Bar */}
763
- {b.total > 0 && (
764
- <Rect
765
- x={barX}
766
- y={barY}
767
- width={barWidth}
768
- height={barHeight}
769
- rx={3}
770
- fill="url(#crashlyticsBarGrad)"
771
- />
772
- )}
773
-
774
- {/* Selected Cursor Line */}
775
- {isSelected && (
776
- <Line
777
- x1={b.x}
778
- y1={4}
779
- x2={b.x}
780
- y2={chartHeight - 6}
781
- stroke="#8B5CF6"
782
- strokeWidth="1.5"
783
- strokeDasharray="2,2"
784
- />
785
- )}
786
- </G>
787
- );
788
- })}
789
-
790
- {/* Crashlytics Apex Trendline */}
791
- <Path
792
- d={histogramData.linePath}
793
- fill="none"
794
- stroke="#8B5CF6"
795
- strokeWidth="2"
796
- strokeLinecap="round"
797
- strokeLinejoin="round"
798
- />
799
-
800
- {/* Pulsing Dot on Current Active Time Bucket */}
801
- {histogramData.buckets.length > 0 && (
802
- <G>
803
- <Circle
804
- cx={histogramData.buckets[histogramData.buckets.length - 1].x}
805
- cy={histogramData.buckets[histogramData.buckets.length - 1].y}
806
- r="5.5"
807
- fill="#8B5CF6"
808
- opacity="0.25"
809
- />
810
- <Circle
811
- cx={histogramData.buckets[histogramData.buckets.length - 1].x}
812
- cy={histogramData.buckets[histogramData.buckets.length - 1].y}
813
- r="3"
814
- fill="#7C3AED"
815
- />
816
- </G>
817
- )}
818
- </Svg>
819
-
820
- {/* Invisible Touch Columns for Interactive Bucket Selection */}
821
- <View
822
- style={{
823
- position: 'absolute',
824
- top: 0,
825
- left: 0,
826
- right: 0,
827
- bottom: 0,
828
- flexDirection: 'row',
829
- }}>
830
- {histogramData.buckets.map((b, idx) => (
831
- <TouchableOpacity
832
- key={b.index}
833
- style={{flex: 1, height: '100%'}}
834
- activeOpacity={0.8}
835
- onPress={() => setSelectedBucketIdx(selectedBucketIdx === idx ? null : idx)}
836
- />
837
- ))}
838
- </View>
839
- </View>
840
-
841
- {/* Selected Bucket Quick Breakdown Overlay */}
842
- {selectedBucket && (
843
- <View
844
- style={{
845
- flexDirection: 'row',
846
- alignItems: 'center',
847
- justifyContent: 'space-between',
848
- backgroundColor: AppColors.white,
849
- borderRadius: 6,
850
- paddingHorizontal: 8,
851
- paddingVertical: 4,
852
- marginTop: 4,
853
- borderWidth: 1,
854
- borderColor: AppColors.brandPurple,
855
- }}>
856
- <Text
857
- style={{
858
- fontFamily: AppFonts.interBold,
859
- fontSize: 10,
860
- color: AppColors.primaryBlack,
861
- }}>
862
- {t('analytics.selectedBucket', {
863
- time: selectedBucket.ageLabel,
864
- count: selectedBucket.total,
865
- })}
866
- </Text>
867
- <View style={{flexDirection: 'row', alignItems: 'center', gap: 6}}>
868
- {selectedBucket.ecommerce > 0 && (
869
- <Text style={{fontSize: 9, fontFamily: AppFonts.interBold, color: AppColors.amber700}}>
870
- Ecom: {selectedBucket.ecommerce}
871
- </Text>
872
- )}
873
- {selectedBucket.page_view > 0 && (
874
- <Text style={{fontSize: 9, fontFamily: AppFonts.interBold, color: AppColors.sky500}}>
875
- Screen: {selectedBucket.page_view}
876
- </Text>
877
- )}
878
- {selectedBucket.custom > 0 && (
879
- <Text style={{fontSize: 9, fontFamily: AppFonts.interBold, color: AppColors.brandPurple}}>
880
- Custom: {selectedBucket.custom}
881
- </Text>
882
- )}
883
- </View>
884
- </View>
885
- )}
886
-
887
- {/* Timeline Axis Labels (60s Realtime Rolling Stream) */}
888
- <View
889
- style={{
890
- flexDirection: 'row',
891
- justifyContent: 'space-between',
892
- marginTop: 4,
893
- paddingHorizontal: 4,
894
- }}>
895
- <Text
896
- style={{
897
- fontFamily: AppFonts.interMedium,
898
- fontSize: 8.5,
899
- color: AppColors.grayTextWeak,
900
- }}>
901
- -60s
902
- </Text>
903
- <Text
904
- style={{
905
- fontFamily: AppFonts.interMedium,
906
- fontSize: 8.5,
907
- color: AppColors.grayTextWeak,
908
- }}>
909
- -40s
910
- </Text>
911
- <Text
912
- style={{
913
- fontFamily: AppFonts.interMedium,
914
- fontSize: 8.5,
915
- color: AppColors.grayTextWeak,
916
- }}>
917
- -20s
918
- </Text>
919
- <Text
920
- style={{
921
- fontFamily: AppFonts.interBold,
922
- fontSize: 8.5,
923
- color: AppColors.brandPurple,
924
- }}>
925
- {t('analytics.timeNow')}
926
- </Text>
927
- </View>
928
- </View>
929
-
930
- {/* ── Top Screens / Views Mini Leaderboard (GA4 Realtime Overview) ──── */}
931
- {topScreens.length > 0 && (
932
- <View
933
- style={{
934
- marginTop: 8,
935
- backgroundColor: `${AppColors.sky500}0A`,
936
- borderRadius: 8,
937
- borderWidth: 1,
938
- borderColor: `${AppColors.sky500}22`,
939
- padding: 8,
940
- }}>
941
- <View
942
- style={{
943
- flexDirection: 'row',
944
- justifyContent: 'space-between',
945
- alignItems: 'center',
946
- marginBottom: 6,
947
- }}>
948
- <View style={{flexDirection: 'row', alignItems: 'center', gap: 4}}>
949
- <PinIcon color={AppColors.sky600} size={11} />
950
- <Text
951
- style={{
952
- fontFamily: AppFonts.interBold,
953
- fontSize: 9.5,
954
- color: AppColors.sky600,
955
- letterSpacing: 0.3,
956
- }}>
957
- TOP SCREENS (REALTIME)
958
- </Text>
959
- </View>
960
- <Text
961
- style={{
962
- fontFamily: AppFonts.interMedium,
963
- fontSize: 9,
964
- color: AppColors.grayTextWeak,
965
- }}>
966
- Views
967
- </Text>
968
- </View>
969
-
970
- <View style={{gap: 4}}>
971
- {topScreens.map(scr => (
972
- <View key={scr.name}>
973
- <View
974
- style={{
975
- flexDirection: 'row',
976
- justifyContent: 'space-between',
977
- alignItems: 'center',
978
- marginBottom: 2,
979
- }}>
980
- <Text
981
- style={{
982
- fontFamily: AppFonts.interMedium,
983
- fontSize: 10,
984
- color: AppColors.primaryBlack,
985
- }}
986
- numberOfLines={1}>
987
- {scr.name}
988
- </Text>
989
- <Text
990
- style={{
991
- fontFamily: AppFonts.interBold,
992
- fontSize: 9.5,
993
- color: AppColors.sky600,
994
- }}>
995
- {scr.count} ({scr.pct}%)
996
- </Text>
997
- </View>
998
- {/* Mini Horizontal Progress Meter */}
999
- <View
1000
- style={{
1001
- height: 3,
1002
- borderRadius: 1.5,
1003
- backgroundColor: `${AppColors.sky500}22`,
1004
- overflow: 'hidden',
1005
- }}>
1006
- <View
1007
- style={{
1008
- height: '100%',
1009
- width: `${scr.barWidthPct}%`,
1010
- backgroundColor: AppColors.sky500,
1011
- }}
1012
- />
1013
- </View>
1014
- </View>
1015
- ))}
1016
- </View>
1017
- </View>
1018
- )}
1019
-
1020
- {/* ── Expandable User Properties & Default Parameters ───────────────── */}
1021
- {analyticsHeaderExpanded && (
1022
- <>
1023
- {/* Stats Row */}
1024
- <View style={styles.analyticsStatsRow}>
1025
- <View style={styles.analyticsStatBox}>
1026
- <Text style={styles.analyticsStatValue}>{totalEvents}</Text>
1027
- <Text style={styles.analyticsStatLabel}>{t('analytics.eventCount', {count: totalEvents})}</Text>
1028
- </View>
1029
- <View style={styles.analyticsStatBox}>
1030
- <Text style={styles.analyticsStatValue}>
1031
- {Object.keys(userProperties).length}
1032
- </Text>
1033
- <Text style={styles.analyticsStatLabel}>{t('analytics.props')}</Text>
1034
- </View>
1035
- <View style={styles.analyticsStatBox}>
1036
- <Text style={styles.analyticsStatValue}>
1037
- {Object.keys(defaultParams).length}
1038
- </Text>
1039
- <Text style={styles.analyticsStatLabel}>{t('analytics.defaultParameters')}</Text>
1040
- </View>
1041
- </View>
1042
-
1043
- {/* Details Section */}
1044
- {(hasUserProps || hasDefaultParams) && (
1045
- <View style={styles.analyticsHeaderDetails}>
1046
- {hasUserProps && (
1047
- <View style={{marginBottom: 10}}>
1048
- <Text style={styles.detailsGroupTitle}>{t('analytics.userProperties')}</Text>
1049
- {Object.entries(userProperties).map(([k, v]) => (
1050
- <View key={k} style={styles.detailsRow}>
1051
- <Text style={styles.detailsKey} selectable={true}>{k}</Text>
1052
- <Text style={styles.detailsValue} selectable={true}>{String(v)}</Text>
1053
- </View>
1054
- ))}
1055
- </View>
1056
- )}
1057
-
1058
- {hasDefaultParams && (
1059
- <View>
1060
- <Text style={styles.detailsGroupTitle}>{t('analytics.defaultParameters')}</Text>
1061
- {Object.entries(defaultParams).map(([k, v]) => (
1062
- <View key={k} style={styles.detailsRow}>
1063
- <Text style={styles.detailsKey} selectable={true}>{k}</Text>
1064
- <Text style={styles.detailsValue} selectable={true}>{String(v)}</Text>
1065
- </View>
1066
- ))}
1067
- </View>
1068
- )}
1069
- </View>
1070
- )}
1071
- </>
1072
- )}
1073
- </View>
1074
- );
1075
- });
1076
-
1077
- const AnalyticsTab = React.memo(() => {
1078
- const {t} = useTranslation();
1079
- const {
1080
- filteredAnalyticsEvents,
1081
- analyticsSearch,
1082
- setAnalyticsSearch,
1083
- handleDelete,
1084
- selectedEvent,
1085
- setSelectedEvent,
1086
- newEventIds,
1087
- logRouteMapRef,
1088
- isAnalyticsLayoutReady,
1089
- setIsAnalyticsLayoutReady,
1090
- isAnalyticsPaused,
1091
- setIsAnalyticsPaused,
1092
- isAnalyticsFilterApplied,
1093
- } = useInspector();
1094
-
1095
- const listRef = useRef<FlatList>(null);
1096
- const [isFilterModalOpen, setIsFilterModalOpen] = useState(false);
1097
-
1098
- const keyExtractor = useCallback(
1099
- (item: any, index: number) => item?.id?.toString() ?? index.toString(),
1100
- [],
1101
- );
1102
-
1103
- const renderItem = useCallback(
1104
- ({item, index}: {item: any; index: number}) => {
1105
- const prev = filteredAnalyticsEvents[index + 1];
1106
- const next = filteredAnalyticsEvents[index - 1];
1107
- const msSincePrev = prev
1108
- ? item.timestamp - prev.timestamp
1109
- : undefined;
1110
- const thisMin = Math.floor(item.timestamp / 60000);
1111
- const nextMin = next
1112
- ? Math.floor(next.timestamp / 60000)
1113
- : -1;
1114
- const showTimestamp =
1115
- index === 0 || thisMin !== nextMin;
1116
- return (
1117
- <AnalyticsEventCard
1118
- event={item}
1119
- onPress={() => {
1120
- setSelectedEvent(item);
1121
- }}
1122
- isNew={newEventIds.has(item.id)}
1123
- searchStr={analyticsSearch}
1124
- isFirst={index === 0}
1125
- isLast={
1126
- index === filteredAnalyticsEvents.length - 1
1127
- }
1128
- msSincePrev={msSincePrev}
1129
- showTimestamp={showTimestamp}
1130
- computedScreenName={(() => {
1131
- if (!item) return '';
1132
- const rawScreenName =
1133
- item.screenName ||
1134
- item.screenClass ||
1135
- item.pageTitle ||
1136
- item.pageLocation ||
1137
- item.params?.firebase_screen ||
1138
- item.params?.screen_name ||
1139
- item.params?.firebase_screen_class ||
1140
- item.params?.screen_class;
1141
- let screenName = typeof rawScreenName === 'string'
1142
- ? rawScreenName
1143
- : (rawScreenName ? JSON.stringify(rawScreenName) : '');
1144
- const routeInfo = logRouteMapRef.current.get(
1145
- item.id + 1000000,
1146
- );
1147
- if (!screenName) {
1148
- if (
1149
- routeInfo &&
1150
- routeInfo.path !== 'Navigators'
1151
- ) {
1152
- const parts = routeInfo.path.split(' ➔ ');
1153
- screenName = parts[parts.length - 1];
1154
- }
1155
- }
1156
- return screenName;
1157
- })()}
1158
- />
1159
- );
1160
- },
1161
- [filteredAnalyticsEvents, analyticsSearch, newEventIds, setSelectedEvent, logRouteMapRef],
1162
- );
1163
-
1164
-
1165
- return (
1166
- <>
1167
- {/* ─── Search + Shared Toolbar for Analytics ──────────────────────── */}
1168
- {selectedEvent == null && (
1169
- <View
1170
- style={[
1171
- styles.toolbarRow,
1172
- {marginTop: 12, marginBottom: 8},
1173
- ]}>
1174
- <View style={styles.searchContainer}>
1175
- <SearchIcon
1176
- color={AppColors.grayTextWeak}
1177
- size={16}
1178
- />
1179
- <TextInput
1180
- placeholder="Search events..."
1181
- placeholderTextColor={AppColors.grayTextWeak}
1182
- value={analyticsSearch}
1183
- onChangeText={setAnalyticsSearch}
1184
- style={styles.searchInput}
1185
- autoCorrect={false}
1186
- autoCapitalize="none"
1187
- />
1188
- {analyticsSearch.length > 0 && (
1189
- <View
1190
- style={{
1191
- flexDirection: 'row',
1192
- alignItems: 'center',
1193
- gap: 4,
1194
- }}>
1195
- <View
1196
- style={{
1197
- backgroundColor: `${AppColors.purple}20`,
1198
- borderRadius: 10,
1199
- paddingHorizontal: 6,
1200
- paddingVertical: 1.5,
1201
- }}>
1202
- <Text
1203
- style={{
1204
- color: AppColors.purple,
1205
- fontSize: 9.5,
1206
- fontFamily: AppFonts.interBold,
1207
- }}>
1208
- {filteredAnalyticsEvents.length}
1209
- </Text>
1210
- </View>
1211
- <Pressable
1212
- onPress={() => setAnalyticsSearch('')}
1213
- hitSlop={10}
1214
- style={styles.clearBtn}>
1215
- <ClearIcon
1216
- color={AppColors.grayTextWeak}
1217
- size={13}
1218
- />
1219
- </Pressable>
1220
- </View>
1221
- )}
1222
- </View>
1223
- <View style={styles.toolbarRight}>
1224
- <TouchableOpacity
1225
- style={[
1226
- styles.toolbarBtn,
1227
- isAnalyticsPaused && {
1228
- borderColor: `${AppColors.darkOrange}50`,
1229
- backgroundColor: `${AppColors.darkOrange}18`,
1230
- },
1231
- ]}
1232
- onPress={() => setIsAnalyticsPaused(p => !p)}
1233
- hitSlop={6}>
1234
- <HeaderPauseIcon
1235
- isPaused={isAnalyticsPaused}
1236
- color={
1237
- isAnalyticsPaused
1238
- ? AppColors.darkOrange
1239
- : AppColors.grayTextStrong
1240
- }
1241
- size={16}
1242
- />
1243
- </TouchableOpacity>
1244
-
1245
- {/* GA Dashboard-style Filter Button */}
1246
- <TouchableOpacity
1247
- style={[
1248
- styles.toolbarBtn,
1249
- isAnalyticsFilterApplied && {
1250
- borderColor: `${AppColors.brandPurple}60`,
1251
- backgroundColor: `${AppColors.brandPurple}15`,
1252
- },
1253
- ]}
1254
- onPress={() => setIsFilterModalOpen(true)}
1255
- hitSlop={6}>
1256
- <FilterIcon
1257
- color={
1258
- isAnalyticsFilterApplied
1259
- ? AppColors.brandPurple
1260
- : AppColors.grayTextStrong
1261
- }
1262
- size={15}
1263
- />
1264
- {isAnalyticsFilterApplied && (
1265
- <View
1266
- style={{
1267
- position: 'absolute',
1268
- top: 2,
1269
- right: 2,
1270
- width: 7,
1271
- height: 7,
1272
- borderRadius: 3.5,
1273
- backgroundColor: AppColors.darkOrange,
1274
- borderWidth: 1,
1275
- borderColor: AppColors.white,
1276
- }}
1277
- />
1278
- )}
1279
- </TouchableOpacity>
1280
-
1281
- <TouchableOpacity
1282
- style={[
1283
- styles.toolbarBtn,
1284
- {
1285
- borderColor: `${AppColors.errorColor}38`,
1286
- backgroundColor: `${AppColors.errorColor}0F`,
1287
- },
1288
- ]}
1289
- onPress={handleDelete}
1290
- hitSlop={6}>
1291
- <TrashIcon
1292
- color={AppColors.errorColor}
1293
- size={15}
1294
- />
1295
- </TouchableOpacity>
1296
- </View>
1297
- </View>
1298
- )}
1299
-
1300
- {/* Filter Modal */}
1301
- <AnalyticsFilterModal
1302
- visible={isFilterModalOpen}
1303
- onClose={() => setIsFilterModalOpen(false)}
1304
- />
1305
-
1306
- <View
1307
- style={{flex: 1}}
1308
- onLayout={() => setIsAnalyticsLayoutReady(true)}>
1309
- {isAnalyticsLayoutReady ? (
1310
- <>
1311
- <FlatList
1312
- ref={listRef}
1313
- data={filteredAnalyticsEvents}
1314
- keyExtractor={keyExtractor}
1315
- ListHeaderComponent={AnalyticsHeader}
1316
- renderItem={renderItem}
1317
- initialNumToRender={12}
1318
- maxToRenderPerBatch={8}
1319
- windowSize={5}
1320
- removeClippedSubviews={Platform.OS === 'android'}
1321
- renderToHardwareTextureAndroid={true}
1322
- ListEmptyComponent={
1323
- <EmptyState
1324
- isSearch={analyticsSearch.length > 0}
1325
- searchQuery={analyticsSearch}
1326
- customTitle={
1327
- analyticsSearch.length > 0
1328
- ? 'No matching analytics events'
1329
- : 'No analytics events yet'
1330
- }
1331
- customSub={
1332
- analyticsSearch.length > 0
1333
- ? `No events matched "${analyticsSearch}"`
1334
- : 'Call setupAnalyticsLogger(analytics()) at app start.'
1335
- }
1336
- onClearSearch={() => setAnalyticsSearch('')}
1337
- />
1338
- }
1339
- ListFooterComponent={
1340
- filteredAnalyticsEvents.length > 0 ? (
1341
- <EndOfListFooter
1342
- count={filteredAnalyticsEvents.length}
1343
- label="events"
1344
- />
1345
- ) : null
1346
- }
1347
- contentContainerStyle={[
1348
- styles.listContent,
1349
- filteredAnalyticsEvents.length === 0 && {
1350
- flexGrow: 1,
1351
- },
1352
- ]}
1353
- keyboardShouldPersistTaps="handled"
1354
- />
1355
- </>
1356
- ) : null}
1357
- </View>
1358
- </>
1359
- );
1360
- });
1361
-
1362
- export default AnalyticsTab;