react-native-inapp-inspector 1.0.0

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 (291) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +97 -0
  3. package/dist/commonjs/components/AnalyticsDetail.d.ts +6 -0
  4. package/dist/commonjs/components/AnalyticsDetail.js +558 -0
  5. package/dist/commonjs/components/AnalyticsEventCard.d.ts +18 -0
  6. package/dist/commonjs/components/AnalyticsEventCard.js +327 -0
  7. package/dist/commonjs/components/AnalyticsGraph.d.ts +8 -0
  8. package/dist/commonjs/components/AnalyticsGraph.js +416 -0
  9. package/dist/commonjs/components/CodeSnippet.d.ts +8 -0
  10. package/dist/commonjs/components/CodeSnippet.js +427 -0
  11. package/dist/commonjs/components/ConsoleLogCard.d.ts +10 -0
  12. package/dist/commonjs/components/ConsoleLogCard.js +401 -0
  13. package/dist/commonjs/components/CopyButton.d.ts +4 -0
  14. package/dist/commonjs/components/CopyButton.js +69 -0
  15. package/dist/commonjs/components/DiffViewer.d.ts +7 -0
  16. package/dist/commonjs/components/DiffViewer.js +86 -0
  17. package/dist/commonjs/components/DomainHeader.d.ts +18 -0
  18. package/dist/commonjs/components/DomainHeader.js +136 -0
  19. package/dist/commonjs/components/EmptyState.d.ts +5 -0
  20. package/dist/commonjs/components/EmptyState.js +40 -0
  21. package/dist/commonjs/components/HeadersSection.d.ts +4 -0
  22. package/dist/commonjs/components/HeadersSection.js +155 -0
  23. package/dist/commonjs/components/HighlightText.d.ts +3 -0
  24. package/dist/commonjs/components/HighlightText.js +57 -0
  25. package/dist/commonjs/components/JsonViewer.d.ts +7 -0
  26. package/dist/commonjs/components/JsonViewer.js +19 -0
  27. package/dist/commonjs/components/LogCard.d.ts +4 -0
  28. package/dist/commonjs/components/LogCard.js +179 -0
  29. package/dist/commonjs/components/MetaAccordion.d.ts +4 -0
  30. package/dist/commonjs/components/MetaAccordion.js +113 -0
  31. package/dist/commonjs/components/MiniBarChart.d.ts +7 -0
  32. package/dist/commonjs/components/MiniBarChart.js +56 -0
  33. package/dist/commonjs/components/MiniLineChart.d.ts +6 -0
  34. package/dist/commonjs/components/MiniLineChart.js +58 -0
  35. package/dist/commonjs/components/NetworkIcons.d.ts +31 -0
  36. package/dist/commonjs/components/NetworkIcons.js +245 -0
  37. package/dist/commonjs/components/SectionHeader.d.ts +4 -0
  38. package/dist/commonjs/components/SectionHeader.js +87 -0
  39. package/dist/commonjs/components/SourcePageCard.d.ts +4 -0
  40. package/dist/commonjs/components/SourcePageCard.js +132 -0
  41. package/dist/commonjs/components/TouchableScale.d.ts +9 -0
  42. package/dist/commonjs/components/TouchableScale.js +44 -0
  43. package/dist/commonjs/components/TreeNode.d.ts +4 -0
  44. package/dist/commonjs/components/TreeNode.js +140 -0
  45. package/dist/commonjs/constants/index.d.ts +7 -0
  46. package/dist/commonjs/constants/index.js +35 -0
  47. package/dist/commonjs/customHooks/analyticsLogger.d.ts +21 -0
  48. package/dist/commonjs/customHooks/analyticsLogger.js +160 -0
  49. package/dist/commonjs/customHooks/consoleLogger.d.ts +5 -0
  50. package/dist/commonjs/customHooks/consoleLogger.js +141 -0
  51. package/dist/commonjs/customHooks/logFilters.d.ts +5 -0
  52. package/dist/commonjs/customHooks/logFilters.js +34 -0
  53. package/dist/commonjs/customHooks/networkLogger.d.ts +20 -0
  54. package/dist/commonjs/customHooks/networkLogger.js +272 -0
  55. package/dist/commonjs/customHooks/useAccordion.d.ts +17 -0
  56. package/dist/commonjs/customHooks/useAccordion.js +48 -0
  57. package/dist/commonjs/customHooks/webViewLogger.d.ts +22 -0
  58. package/dist/commonjs/customHooks/webViewLogger.js +412 -0
  59. package/dist/commonjs/helpers/index.d.ts +20 -0
  60. package/dist/commonjs/helpers/index.js +229 -0
  61. package/dist/commonjs/index.d.ts +7 -0
  62. package/dist/commonjs/index.js +2668 -0
  63. package/dist/commonjs/styles/AppColors.d.ts +27 -0
  64. package/dist/commonjs/styles/AppColors.js +30 -0
  65. package/dist/commonjs/styles/AppFonts.d.ts +7 -0
  66. package/dist/commonjs/styles/AppFonts.js +10 -0
  67. package/dist/commonjs/styles/index.d.ts +1488 -0
  68. package/dist/commonjs/styles/index.js +1357 -0
  69. package/dist/commonjs/types/index.d.ts +127 -0
  70. package/dist/commonjs/types/index.js +2 -0
  71. package/dist/esm/components/AnalyticsDetail.d.ts +6 -0
  72. package/dist/esm/components/AnalyticsDetail.js +520 -0
  73. package/dist/esm/components/AnalyticsEventCard.d.ts +18 -0
  74. package/dist/esm/components/AnalyticsEventCard.js +288 -0
  75. package/dist/esm/components/AnalyticsGraph.d.ts +8 -0
  76. package/dist/esm/components/AnalyticsGraph.js +378 -0
  77. package/dist/esm/components/CodeSnippet.d.ts +8 -0
  78. package/dist/esm/components/CodeSnippet.js +392 -0
  79. package/dist/esm/components/ConsoleLogCard.d.ts +10 -0
  80. package/dist/esm/components/ConsoleLogCard.js +362 -0
  81. package/dist/esm/components/CopyButton.d.ts +4 -0
  82. package/dist/esm/components/CopyButton.js +31 -0
  83. package/dist/esm/components/DiffViewer.d.ts +7 -0
  84. package/dist/esm/components/DiffViewer.js +48 -0
  85. package/dist/esm/components/DomainHeader.d.ts +18 -0
  86. package/dist/esm/components/DomainHeader.js +98 -0
  87. package/dist/esm/components/EmptyState.d.ts +5 -0
  88. package/dist/esm/components/EmptyState.js +35 -0
  89. package/dist/esm/components/HeadersSection.d.ts +4 -0
  90. package/dist/esm/components/HeadersSection.js +117 -0
  91. package/dist/esm/components/HighlightText.d.ts +3 -0
  92. package/dist/esm/components/HighlightText.js +52 -0
  93. package/dist/esm/components/JsonViewer.d.ts +7 -0
  94. package/dist/esm/components/JsonViewer.js +14 -0
  95. package/dist/esm/components/LogCard.d.ts +4 -0
  96. package/dist/esm/components/LogCard.js +141 -0
  97. package/dist/esm/components/MetaAccordion.d.ts +4 -0
  98. package/dist/esm/components/MetaAccordion.js +108 -0
  99. package/dist/esm/components/MiniBarChart.d.ts +7 -0
  100. package/dist/esm/components/MiniBarChart.js +18 -0
  101. package/dist/esm/components/MiniLineChart.d.ts +6 -0
  102. package/dist/esm/components/MiniLineChart.js +20 -0
  103. package/dist/esm/components/NetworkIcons.d.ts +31 -0
  104. package/dist/esm/components/NetworkIcons.js +176 -0
  105. package/dist/esm/components/SectionHeader.d.ts +4 -0
  106. package/dist/esm/components/SectionHeader.js +49 -0
  107. package/dist/esm/components/SourcePageCard.d.ts +4 -0
  108. package/dist/esm/components/SourcePageCard.js +94 -0
  109. package/dist/esm/components/TouchableScale.d.ts +9 -0
  110. package/dist/esm/components/TouchableScale.js +9 -0
  111. package/dist/esm/components/TreeNode.d.ts +4 -0
  112. package/dist/esm/components/TreeNode.js +102 -0
  113. package/dist/esm/constants/index.d.ts +7 -0
  114. package/dist/esm/constants/index.js +32 -0
  115. package/dist/esm/customHooks/analyticsLogger.d.ts +21 -0
  116. package/dist/esm/customHooks/analyticsLogger.js +152 -0
  117. package/dist/esm/customHooks/consoleLogger.d.ts +5 -0
  118. package/dist/esm/customHooks/consoleLogger.js +134 -0
  119. package/dist/esm/customHooks/logFilters.d.ts +5 -0
  120. package/dist/esm/customHooks/logFilters.js +31 -0
  121. package/dist/esm/customHooks/networkLogger.d.ts +20 -0
  122. package/dist/esm/customHooks/networkLogger.js +264 -0
  123. package/dist/esm/customHooks/useAccordion.d.ts +17 -0
  124. package/dist/esm/customHooks/useAccordion.js +46 -0
  125. package/dist/esm/customHooks/webViewLogger.d.ts +22 -0
  126. package/dist/esm/customHooks/webViewLogger.js +365 -0
  127. package/dist/esm/helpers/index.d.ts +20 -0
  128. package/dist/esm/helpers/index.js +207 -0
  129. package/dist/esm/index.d.ts +7 -0
  130. package/dist/esm/index.js +2611 -0
  131. package/dist/esm/styles/AppColors.d.ts +27 -0
  132. package/dist/esm/styles/AppColors.js +27 -0
  133. package/dist/esm/styles/AppFonts.d.ts +7 -0
  134. package/dist/esm/styles/AppFonts.js +7 -0
  135. package/dist/esm/styles/index.d.ts +1488 -0
  136. package/dist/esm/styles/index.js +1355 -0
  137. package/dist/esm/types/index.d.ts +127 -0
  138. package/dist/esm/types/index.js +1 -0
  139. package/fonts/Inter/Inter.ttc +0 -0
  140. package/fonts/Inter/InterVariable-Italic.ttf +0 -0
  141. package/fonts/Inter/InterVariable.ttf +0 -0
  142. package/fonts/Inter/LICENSE.txt +92 -0
  143. package/fonts/Inter/extras/otf/Inter-Black.otf +0 -0
  144. package/fonts/Inter/extras/otf/Inter-BlackItalic.otf +0 -0
  145. package/fonts/Inter/extras/otf/Inter-Bold.otf +0 -0
  146. package/fonts/Inter/extras/otf/Inter-BoldItalic.otf +0 -0
  147. package/fonts/Inter/extras/otf/Inter-ExtraBold.otf +0 -0
  148. package/fonts/Inter/extras/otf/Inter-ExtraBoldItalic.otf +0 -0
  149. package/fonts/Inter/extras/otf/Inter-ExtraLight.otf +0 -0
  150. package/fonts/Inter/extras/otf/Inter-ExtraLightItalic.otf +0 -0
  151. package/fonts/Inter/extras/otf/Inter-Italic.otf +0 -0
  152. package/fonts/Inter/extras/otf/Inter-Light.otf +0 -0
  153. package/fonts/Inter/extras/otf/Inter-LightItalic.otf +0 -0
  154. package/fonts/Inter/extras/otf/Inter-Medium.otf +0 -0
  155. package/fonts/Inter/extras/otf/Inter-MediumItalic.otf +0 -0
  156. package/fonts/Inter/extras/otf/Inter-Regular.otf +0 -0
  157. package/fonts/Inter/extras/otf/Inter-SemiBold.otf +0 -0
  158. package/fonts/Inter/extras/otf/Inter-SemiBoldItalic.otf +0 -0
  159. package/fonts/Inter/extras/otf/Inter-Thin.otf +0 -0
  160. package/fonts/Inter/extras/otf/Inter-ThinItalic.otf +0 -0
  161. package/fonts/Inter/extras/otf/InterDisplay-Black.otf +0 -0
  162. package/fonts/Inter/extras/otf/InterDisplay-BlackItalic.otf +0 -0
  163. package/fonts/Inter/extras/otf/InterDisplay-Bold.otf +0 -0
  164. package/fonts/Inter/extras/otf/InterDisplay-BoldItalic.otf +0 -0
  165. package/fonts/Inter/extras/otf/InterDisplay-ExtraBold.otf +0 -0
  166. package/fonts/Inter/extras/otf/InterDisplay-ExtraBoldItalic.otf +0 -0
  167. package/fonts/Inter/extras/otf/InterDisplay-ExtraLight.otf +0 -0
  168. package/fonts/Inter/extras/otf/InterDisplay-ExtraLightItalic.otf +0 -0
  169. package/fonts/Inter/extras/otf/InterDisplay-Italic.otf +0 -0
  170. package/fonts/Inter/extras/otf/InterDisplay-Light.otf +0 -0
  171. package/fonts/Inter/extras/otf/InterDisplay-LightItalic.otf +0 -0
  172. package/fonts/Inter/extras/otf/InterDisplay-Medium.otf +0 -0
  173. package/fonts/Inter/extras/otf/InterDisplay-MediumItalic.otf +0 -0
  174. package/fonts/Inter/extras/otf/InterDisplay-Regular.otf +0 -0
  175. package/fonts/Inter/extras/otf/InterDisplay-SemiBold.otf +0 -0
  176. package/fonts/Inter/extras/otf/InterDisplay-SemiBoldItalic.otf +0 -0
  177. package/fonts/Inter/extras/otf/InterDisplay-Thin.otf +0 -0
  178. package/fonts/Inter/extras/otf/InterDisplay-ThinItalic.otf +0 -0
  179. package/fonts/Inter/extras/ttf/Inter-Black.ttf +0 -0
  180. package/fonts/Inter/extras/ttf/Inter-BlackItalic.ttf +0 -0
  181. package/fonts/Inter/extras/ttf/Inter-Bold.ttf +0 -0
  182. package/fonts/Inter/extras/ttf/Inter-BoldItalic.ttf +0 -0
  183. package/fonts/Inter/extras/ttf/Inter-ExtraBold.ttf +0 -0
  184. package/fonts/Inter/extras/ttf/Inter-ExtraBoldItalic.ttf +0 -0
  185. package/fonts/Inter/extras/ttf/Inter-ExtraLight.ttf +0 -0
  186. package/fonts/Inter/extras/ttf/Inter-ExtraLightItalic.ttf +0 -0
  187. package/fonts/Inter/extras/ttf/Inter-Italic.ttf +0 -0
  188. package/fonts/Inter/extras/ttf/Inter-Light.ttf +0 -0
  189. package/fonts/Inter/extras/ttf/Inter-LightItalic.ttf +0 -0
  190. package/fonts/Inter/extras/ttf/Inter-Medium.ttf +0 -0
  191. package/fonts/Inter/extras/ttf/Inter-MediumItalic.ttf +0 -0
  192. package/fonts/Inter/extras/ttf/Inter-Regular.ttf +0 -0
  193. package/fonts/Inter/extras/ttf/Inter-SemiBold.ttf +0 -0
  194. package/fonts/Inter/extras/ttf/Inter-SemiBoldItalic.ttf +0 -0
  195. package/fonts/Inter/extras/ttf/Inter-Thin.ttf +0 -0
  196. package/fonts/Inter/extras/ttf/Inter-ThinItalic.ttf +0 -0
  197. package/fonts/Inter/extras/ttf/InterDisplay-Black.ttf +0 -0
  198. package/fonts/Inter/extras/ttf/InterDisplay-BlackItalic.ttf +0 -0
  199. package/fonts/Inter/extras/ttf/InterDisplay-Bold.ttf +0 -0
  200. package/fonts/Inter/extras/ttf/InterDisplay-BoldItalic.ttf +0 -0
  201. package/fonts/Inter/extras/ttf/InterDisplay-ExtraBold.ttf +0 -0
  202. package/fonts/Inter/extras/ttf/InterDisplay-ExtraBoldItalic.ttf +0 -0
  203. package/fonts/Inter/extras/ttf/InterDisplay-ExtraLight.ttf +0 -0
  204. package/fonts/Inter/extras/ttf/InterDisplay-ExtraLightItalic.ttf +0 -0
  205. package/fonts/Inter/extras/ttf/InterDisplay-Italic.ttf +0 -0
  206. package/fonts/Inter/extras/ttf/InterDisplay-Light.ttf +0 -0
  207. package/fonts/Inter/extras/ttf/InterDisplay-LightItalic.ttf +0 -0
  208. package/fonts/Inter/extras/ttf/InterDisplay-Medium.ttf +0 -0
  209. package/fonts/Inter/extras/ttf/InterDisplay-MediumItalic.ttf +0 -0
  210. package/fonts/Inter/extras/ttf/InterDisplay-Regular.ttf +0 -0
  211. package/fonts/Inter/extras/ttf/InterDisplay-SemiBold.ttf +0 -0
  212. package/fonts/Inter/extras/ttf/InterDisplay-SemiBoldItalic.ttf +0 -0
  213. package/fonts/Inter/extras/ttf/InterDisplay-Thin.ttf +0 -0
  214. package/fonts/Inter/extras/ttf/InterDisplay-ThinItalic.ttf +0 -0
  215. package/fonts/Inter/extras/woff-hinted/Inter-Black.woff2 +0 -0
  216. package/fonts/Inter/extras/woff-hinted/Inter-BlackItalic.woff2 +0 -0
  217. package/fonts/Inter/extras/woff-hinted/Inter-Bold.woff2 +0 -0
  218. package/fonts/Inter/extras/woff-hinted/Inter-BoldItalic.woff2 +0 -0
  219. package/fonts/Inter/extras/woff-hinted/Inter-ExtraBold.woff2 +0 -0
  220. package/fonts/Inter/extras/woff-hinted/Inter-ExtraBoldItalic.woff2 +0 -0
  221. package/fonts/Inter/extras/woff-hinted/Inter-ExtraLight.woff2 +0 -0
  222. package/fonts/Inter/extras/woff-hinted/Inter-ExtraLightItalic.woff2 +0 -0
  223. package/fonts/Inter/extras/woff-hinted/Inter-Italic.woff2 +0 -0
  224. package/fonts/Inter/extras/woff-hinted/Inter-Light.woff2 +0 -0
  225. package/fonts/Inter/extras/woff-hinted/Inter-LightItalic.woff2 +0 -0
  226. package/fonts/Inter/extras/woff-hinted/Inter-Medium.woff2 +0 -0
  227. package/fonts/Inter/extras/woff-hinted/Inter-MediumItalic.woff2 +0 -0
  228. package/fonts/Inter/extras/woff-hinted/Inter-Regular.woff2 +0 -0
  229. package/fonts/Inter/extras/woff-hinted/Inter-SemiBold.woff2 +0 -0
  230. package/fonts/Inter/extras/woff-hinted/Inter-SemiBoldItalic.woff2 +0 -0
  231. package/fonts/Inter/extras/woff-hinted/Inter-Thin.woff2 +0 -0
  232. package/fonts/Inter/extras/woff-hinted/Inter-ThinItalic.woff2 +0 -0
  233. package/fonts/Inter/extras/woff-hinted/InterDisplay-Black.woff2 +0 -0
  234. package/fonts/Inter/extras/woff-hinted/InterDisplay-BlackItalic.woff2 +0 -0
  235. package/fonts/Inter/extras/woff-hinted/InterDisplay-Bold.woff2 +0 -0
  236. package/fonts/Inter/extras/woff-hinted/InterDisplay-BoldItalic.woff2 +0 -0
  237. package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBold.woff2 +0 -0
  238. package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraBoldItalic.woff2 +0 -0
  239. package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLight.woff2 +0 -0
  240. package/fonts/Inter/extras/woff-hinted/InterDisplay-ExtraLightItalic.woff2 +0 -0
  241. package/fonts/Inter/extras/woff-hinted/InterDisplay-Italic.woff2 +0 -0
  242. package/fonts/Inter/extras/woff-hinted/InterDisplay-Light.woff2 +0 -0
  243. package/fonts/Inter/extras/woff-hinted/InterDisplay-LightItalic.woff2 +0 -0
  244. package/fonts/Inter/extras/woff-hinted/InterDisplay-Medium.woff2 +0 -0
  245. package/fonts/Inter/extras/woff-hinted/InterDisplay-MediumItalic.woff2 +0 -0
  246. package/fonts/Inter/extras/woff-hinted/InterDisplay-Regular.woff2 +0 -0
  247. package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBold.woff2 +0 -0
  248. package/fonts/Inter/extras/woff-hinted/InterDisplay-SemiBoldItalic.woff2 +0 -0
  249. package/fonts/Inter/extras/woff-hinted/InterDisplay-Thin.woff2 +0 -0
  250. package/fonts/Inter/extras/woff-hinted/InterDisplay-ThinItalic.woff2 +0 -0
  251. package/fonts/Inter/help.txt +165 -0
  252. package/fonts/Inter/web/Inter-Black.woff2 +0 -0
  253. package/fonts/Inter/web/Inter-BlackItalic.woff2 +0 -0
  254. package/fonts/Inter/web/Inter-Bold.woff2 +0 -0
  255. package/fonts/Inter/web/Inter-BoldItalic.woff2 +0 -0
  256. package/fonts/Inter/web/Inter-ExtraBold.woff2 +0 -0
  257. package/fonts/Inter/web/Inter-ExtraBoldItalic.woff2 +0 -0
  258. package/fonts/Inter/web/Inter-ExtraLight.woff2 +0 -0
  259. package/fonts/Inter/web/Inter-ExtraLightItalic.woff2 +0 -0
  260. package/fonts/Inter/web/Inter-Italic.woff2 +0 -0
  261. package/fonts/Inter/web/Inter-Light.woff2 +0 -0
  262. package/fonts/Inter/web/Inter-LightItalic.woff2 +0 -0
  263. package/fonts/Inter/web/Inter-Medium.woff2 +0 -0
  264. package/fonts/Inter/web/Inter-MediumItalic.woff2 +0 -0
  265. package/fonts/Inter/web/Inter-Regular.woff2 +0 -0
  266. package/fonts/Inter/web/Inter-SemiBold.woff2 +0 -0
  267. package/fonts/Inter/web/Inter-SemiBoldItalic.woff2 +0 -0
  268. package/fonts/Inter/web/Inter-Thin.woff2 +0 -0
  269. package/fonts/Inter/web/Inter-ThinItalic.woff2 +0 -0
  270. package/fonts/Inter/web/InterDisplay-Black.woff2 +0 -0
  271. package/fonts/Inter/web/InterDisplay-BlackItalic.woff2 +0 -0
  272. package/fonts/Inter/web/InterDisplay-Bold.woff2 +0 -0
  273. package/fonts/Inter/web/InterDisplay-BoldItalic.woff2 +0 -0
  274. package/fonts/Inter/web/InterDisplay-ExtraBold.woff2 +0 -0
  275. package/fonts/Inter/web/InterDisplay-ExtraBoldItalic.woff2 +0 -0
  276. package/fonts/Inter/web/InterDisplay-ExtraLight.woff2 +0 -0
  277. package/fonts/Inter/web/InterDisplay-ExtraLightItalic.woff2 +0 -0
  278. package/fonts/Inter/web/InterDisplay-Italic.woff2 +0 -0
  279. package/fonts/Inter/web/InterDisplay-Light.woff2 +0 -0
  280. package/fonts/Inter/web/InterDisplay-LightItalic.woff2 +0 -0
  281. package/fonts/Inter/web/InterDisplay-Medium.woff2 +0 -0
  282. package/fonts/Inter/web/InterDisplay-MediumItalic.woff2 +0 -0
  283. package/fonts/Inter/web/InterDisplay-Regular.woff2 +0 -0
  284. package/fonts/Inter/web/InterDisplay-SemiBold.woff2 +0 -0
  285. package/fonts/Inter/web/InterDisplay-SemiBoldItalic.woff2 +0 -0
  286. package/fonts/Inter/web/InterDisplay-Thin.woff2 +0 -0
  287. package/fonts/Inter/web/InterDisplay-ThinItalic.woff2 +0 -0
  288. package/fonts/Inter/web/InterVariable-Italic.woff2 +0 -0
  289. package/fonts/Inter/web/InterVariable.woff2 +0 -0
  290. package/fonts/Inter/web/inter.css +148 -0
  291. package/package.json +52 -0
@@ -0,0 +1,288 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { Animated, StyleSheet, Text, View } from 'react-native';
3
+ import { AppColors } from '../styles/AppColors';
4
+ import { AppFonts } from '../styles/AppFonts';
5
+ import HighlightText from './HighlightText';
6
+ import TouchableScale from './TouchableScale';
7
+ // ─── Palette (Google Analytics colours) ───────────────────────────────────────
8
+ const EVENT_PALETTE = [
9
+ '#4285F4', // blue
10
+ '#34A853', // green
11
+ '#9C27B0', // purple
12
+ '#00897B', // teal
13
+ '#E53935', // red
14
+ '#F57C00', // orange
15
+ '#1565C0', // dark blue
16
+ '#2E7D32', // dark green
17
+ ];
18
+ export function getEventColor(name) {
19
+ let hash = 0;
20
+ for (let i = 0; i < name.length; i++) {
21
+ hash = (hash * 31 + name.charCodeAt(i)) | 0;
22
+ }
23
+ return EVENT_PALETTE[Math.abs(hash) % EVENT_PALETTE.length];
24
+ }
25
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
26
+ function formatTime(ts) {
27
+ const d = new Date(ts);
28
+ const hh = String(d.getHours()).padStart(2, '0');
29
+ const mm = String(d.getMinutes()).padStart(2, '0');
30
+ const ss = String(d.getSeconds()).padStart(2, '0');
31
+ const ms = String(d.getMilliseconds()).padStart(3, '0');
32
+ return `${hh}:${mm}:${ss}.${ms}`;
33
+ }
34
+ function formatGap(ms) {
35
+ if (ms < 1000)
36
+ return `+${ms}ms`;
37
+ const s = Math.round(ms / 1000);
38
+ if (s < 60)
39
+ return `+${s}s`;
40
+ const m = Math.floor(s / 60);
41
+ const rem = s % 60;
42
+ return rem > 0 ? `+${m}m ${rem}s` : `+${m}m`;
43
+ }
44
+ // ─── Component ────────────────────────────────────────────────────────────────
45
+ const AnalyticsEventCard = React.memo(function AnalyticsEventCard({ event, onPress, isNew = false, searchStr = '', msSincePrev, computedScreenName, }) {
46
+ const color = getEventColor(event.name);
47
+ const paramCount = event.params ? Object.keys(event.params).length : 0;
48
+ const userPropCount = event.userProperties
49
+ ? Object.keys(event.userProperties).length
50
+ : 0;
51
+ // Flash animation for newly logged events
52
+ const flashOpacity = useRef(new Animated.Value(isNew ? 1 : 0)).current;
53
+ useEffect(() => {
54
+ if (isNew) {
55
+ Animated.timing(flashOpacity, {
56
+ toValue: 0,
57
+ duration: 1200,
58
+ useNativeDriver: true,
59
+ }).start();
60
+ }
61
+ }, [isNew]);
62
+ const showGap = msSincePrev != null && msSincePrev >= 2000;
63
+ return (<View style={cardStyles.container}>
64
+ {/* ── Gap Indicator ─────────────────────────────────────────────────── */}
65
+ {showGap && (<View style={cardStyles.gapContainer}>
66
+ <Text style={cardStyles.gapText}>{formatGap(msSincePrev)}</Text>
67
+ </View>)}
68
+
69
+ {/* ── Main Card ─────────────────────────────────────────────────────── */}
70
+ <TouchableScale onPress={onPress} style={cardStyles.modernCard}>
71
+ <Animated.View style={[
72
+ StyleSheet.absoluteFill,
73
+ {
74
+ backgroundColor: color,
75
+ opacity: flashOpacity.interpolate({
76
+ inputRange: [0, 1],
77
+ outputRange: [0, 0.08],
78
+ }),
79
+ },
80
+ ]}/>
81
+
82
+ {/* Top Row: Event Name & Timestamp */}
83
+ <View style={cardStyles.cardHeader}>
84
+ <View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
85
+ <View style={[
86
+ cardStyles.nameBadge,
87
+ { backgroundColor: `${color}1A`, borderColor: `${color}30` },
88
+ ]}>
89
+ <HighlightText text={event.name} search={searchStr} style={[cardStyles.eventName, { color: color }]} highlightStyle={cardStyles.highlight}/>
90
+ </View>
91
+
92
+ {event.count !== undefined ? (<View style={[
93
+ cardStyles.duplicateBadge,
94
+ event.count === 1 && {
95
+ backgroundColor: AppColors.grayBackground,
96
+ borderColor: AppColors.grayBorderSecondary,
97
+ },
98
+ ]}>
99
+ <Text style={[
100
+ cardStyles.duplicateText,
101
+ event.count === 1 && { color: AppColors.grayTextStrong },
102
+ ]}>
103
+ {event.count}×{event.count > 1 ? ' Duplicate' : ''}
104
+ </Text>
105
+ </View>) : null}
106
+ </View>
107
+ <Text style={cardStyles.timestamp}>
108
+ {formatTime(event.timestamp)}
109
+ </Text>
110
+ </View>
111
+
112
+ {/* Bottom Row: Metadata Chips & Sparkline */}
113
+ <View style={cardStyles.cardBody}>
114
+ <View style={cardStyles.chipsRow}>
115
+ {computedScreenName ||
116
+ event.screenName ||
117
+ event.params?.firebase_screen ||
118
+ event.params?.screen_name ||
119
+ event.params?.firebase_screen_class ? (<View style={cardStyles.chip}>
120
+ <View style={[cardStyles.screenDot, { backgroundColor: color }]}/>
121
+ <Text style={cardStyles.chipText} numberOfLines={1}>
122
+ {computedScreenName ||
123
+ event.screenName ||
124
+ event.params?.firebase_screen ||
125
+ event.params?.screen_name ||
126
+ event.params?.firebase_screen_class}
127
+ </Text>
128
+ </View>) : null}
129
+
130
+ <View style={cardStyles.chip}>
131
+ <Text style={cardStyles.chipText}>
132
+ {'{} '} {paramCount} params
133
+ </Text>
134
+ </View>
135
+
136
+ {userPropCount > 0 && (<View style={cardStyles.chip}>
137
+ <Text style={cardStyles.chipText}>★ {userPropCount} props</Text>
138
+ </View>)}
139
+ </View>
140
+
141
+ {/* Inline Mini Graph for E-commerce Items */}
142
+ {(() => {
143
+ const items = event.params?.items;
144
+ if (!Array.isArray(items) || items.length === 0)
145
+ return null;
146
+ const prices = items
147
+ .map((item) => parseFloat(item.price || item.value))
148
+ .filter(p => !isNaN(p));
149
+ if (prices.length === 0)
150
+ return null;
151
+ const max = Math.max(...prices);
152
+ if (max === 0)
153
+ return null;
154
+ return (<View style={cardStyles.miniGraphWrapper}>
155
+ {prices.map((val, idx) => {
156
+ const hPct = (val / max) * 100;
157
+ return (<View key={idx} style={[
158
+ cardStyles.miniGraphBar,
159
+ {
160
+ height: `${Math.max(15, hPct)}%`,
161
+ backgroundColor: color,
162
+ },
163
+ ]}/>);
164
+ })}
165
+ </View>);
166
+ })()}
167
+ </View>
168
+ </TouchableScale>
169
+ </View>);
170
+ });
171
+ // ─── Styles ───────────────────────────────────────────────────────────────────
172
+ const cardStyles = StyleSheet.create({
173
+ container: {
174
+ paddingHorizontal: 16,
175
+ paddingVertical: 4,
176
+ },
177
+ gapContainer: {
178
+ alignItems: 'center',
179
+ marginVertical: 4,
180
+ },
181
+ gapText: {
182
+ fontFamily: AppFonts.interMedium,
183
+ fontSize: 10,
184
+ color: AppColors.grayTextWeak,
185
+ letterSpacing: 0.5,
186
+ },
187
+ modernCard: {
188
+ backgroundColor: '#FFFFFF',
189
+ borderRadius: 8,
190
+ borderWidth: 1,
191
+ borderColor: '#EFEFEF',
192
+ padding: 12,
193
+ shadowColor: '#000',
194
+ shadowOpacity: 0.03,
195
+ shadowRadius: 3,
196
+ shadowOffset: { width: 0, height: 1 },
197
+ elevation: 1,
198
+ overflow: 'hidden',
199
+ },
200
+ cardHeader: {
201
+ flexDirection: 'row',
202
+ justifyContent: 'space-between',
203
+ alignItems: 'center',
204
+ marginBottom: 8,
205
+ },
206
+ nameBadge: {
207
+ paddingHorizontal: 8,
208
+ paddingVertical: 4,
209
+ borderRadius: 6,
210
+ borderWidth: 1,
211
+ },
212
+ eventName: {
213
+ fontFamily: AppFonts.interBold,
214
+ fontSize: 12,
215
+ letterSpacing: 0.2,
216
+ },
217
+ timestamp: {
218
+ fontFamily: AppFonts.interMedium,
219
+ fontSize: 11,
220
+ color: AppColors.grayTextWeak,
221
+ },
222
+ highlight: {
223
+ backgroundColor: '#FFE44D',
224
+ color: AppColors.primaryBlack,
225
+ borderRadius: 2,
226
+ },
227
+ cardBody: {
228
+ flexDirection: 'row',
229
+ alignItems: 'flex-end',
230
+ justifyContent: 'space-between',
231
+ },
232
+ chipsRow: {
233
+ flexDirection: 'row',
234
+ alignItems: 'center',
235
+ flexWrap: 'wrap',
236
+ gap: 8,
237
+ flex: 1,
238
+ },
239
+ chip: {
240
+ flexDirection: 'row',
241
+ alignItems: 'center',
242
+ backgroundColor: AppColors.grayBackground,
243
+ paddingHorizontal: 6,
244
+ paddingVertical: 3,
245
+ borderRadius: 4,
246
+ borderWidth: 1,
247
+ borderColor: AppColors.grayBorderSecondary,
248
+ },
249
+ chipText: {
250
+ fontFamily: AppFonts.interMedium,
251
+ fontSize: 10,
252
+ color: AppColors.grayText,
253
+ },
254
+ screenDot: {
255
+ width: 6,
256
+ height: 6,
257
+ borderRadius: 3,
258
+ marginRight: 4,
259
+ },
260
+ duplicateBadge: {
261
+ backgroundColor: '#FFE4E6',
262
+ borderColor: '#FCC2D7',
263
+ borderWidth: 1,
264
+ paddingHorizontal: 6,
265
+ paddingVertical: 3,
266
+ borderRadius: 4,
267
+ },
268
+ duplicateText: {
269
+ fontFamily: AppFonts.interBold,
270
+ fontSize: 9,
271
+ color: '#E11D48',
272
+ textTransform: 'uppercase',
273
+ letterSpacing: 0.5,
274
+ },
275
+ miniGraphWrapper: {
276
+ flexDirection: 'row',
277
+ alignItems: 'flex-end',
278
+ height: 18,
279
+ gap: 2,
280
+ marginLeft: 12,
281
+ },
282
+ miniGraphBar: {
283
+ width: 4,
284
+ borderRadius: 2,
285
+ opacity: 0.7,
286
+ },
287
+ });
288
+ export default AnalyticsEventCard;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { AnalyticsEvent } from '../types';
3
+ interface Props {
4
+ event: AnalyticsEvent;
5
+ accentColor: string;
6
+ }
7
+ declare const AnalyticsGraph: ({ event, accentColor }: Props) => React.JSX.Element;
8
+ export default AnalyticsGraph;
@@ -0,0 +1,378 @@
1
+ import React from 'react';
2
+ import { View, Text, ScrollView, Dimensions, StyleSheet } from 'react-native';
3
+ import Svg, { Rect, Text as SvgText, Line, Circle, Path, Defs, LinearGradient, Stop, } from 'react-native-svg';
4
+ import { AppColors } from '../styles/AppColors';
5
+ import { AppFonts } from '../styles/AppFonts';
6
+ const BAR_HEIGHT = 24;
7
+ const PADDING_Y = 12;
8
+ const AnalyticsGraph = ({ event, accentColor }) => {
9
+ const params = event.params || {};
10
+ // 1. Check for E-commerce items array
11
+ const itemsArray = Array.isArray(params.items) ? params.items : null;
12
+ const filteredItems = itemsArray?.filter((item) => typeof item.price === 'number') || [];
13
+ // 2. Discover root-level numeric fields (exclude ids)
14
+ const rootNumericKeys = [];
15
+ Object.entries(params).forEach(([k, v]) => {
16
+ if (typeof v === 'number' &&
17
+ !k.toLowerCase().includes('id') &&
18
+ !k.toLowerCase().includes('timestamp')) {
19
+ rootNumericKeys.push({ key: k, value: v });
20
+ }
21
+ });
22
+ // 3. Discover dates (YYYY-MM-DD format commonly used in booking/flights)
23
+ const dateKeys = [];
24
+ Object.entries(params).forEach(([k, v]) => {
25
+ if (typeof v === 'string' &&
26
+ v.length >= 10 &&
27
+ /^\d{4}-\d{2}-\d{2}/.test(v)) {
28
+ const d = new Date(v);
29
+ if (!isNaN(d.getTime())) {
30
+ dateKeys.push({ key: k, date: d });
31
+ }
32
+ }
33
+ });
34
+ // 4. Calculate parameter types
35
+ const paramTypes = { string: 0, number: 0, boolean: 0, object: 0 };
36
+ const strings = [];
37
+ Object.entries(params).forEach(([k, v]) => {
38
+ const t = typeof v;
39
+ if (t === 'string') {
40
+ paramTypes.string++;
41
+ strings.push({ label: k, value: v.length });
42
+ }
43
+ else if (t === 'number') {
44
+ paramTypes.number++;
45
+ }
46
+ else if (t === 'boolean') {
47
+ paramTypes.boolean++;
48
+ }
49
+ else if (t === 'object' && v !== null) {
50
+ paramTypes.object++;
51
+ }
52
+ });
53
+ const typeData = [
54
+ { label: 'Strings', value: paramTypes.string, color: AppColors.purple },
55
+ { label: 'Numbers', value: paramTypes.number, color: AppColors.skyBlue },
56
+ { label: 'Booleans', value: paramTypes.boolean, color: '#F59E0B' }, // Amber
57
+ { label: 'Objects', value: paramTypes.object, color: AppColors.greenColor },
58
+ ].filter(d => d.value > 0);
59
+ strings.sort((a, b) => b.value - a.value);
60
+ const topStrings = strings.slice(0, 5);
61
+ const hasItemsChart = filteredItems.length > 0;
62
+ const hasRootNumericChart = rootNumericKeys.length > 0;
63
+ const hasDatesChart = dateKeys.length > 0;
64
+ const hasStringsChart = topStrings.length > 0;
65
+ const hasTypeData = typeData.length > 0;
66
+ const screenWidth = Dimensions.get('window').width - 60; // Padding adjustments
67
+ const rightMargin = 40; // Space for labels at the end of the bar
68
+ const maxBarWidth = screenWidth - rightMargin;
69
+ return (<View style={graphStyles.container}>
70
+ <Text style={graphStyles.headerTitle}>Data Visualization</Text>
71
+
72
+ {hasTypeData && (<View style={graphStyles.chartBlock}>
73
+ <Text style={graphStyles.chartTitle}>Data Types Breakdown</Text>
74
+ <DonutChart data={typeData}/>
75
+ </View>)}
76
+
77
+ {hasStringsChart && (<View style={graphStyles.chartBlock}>
78
+ <Text style={graphStyles.chartTitle}>Highest Payload Strings</Text>
79
+ <BarChart data={topStrings} accentColor={AppColors.purple} maxBarWidth={maxBarWidth} isGradient/>
80
+ </View>)}
81
+
82
+ {hasRootNumericChart && (<View style={graphStyles.chartBlock}>
83
+ <Text style={graphStyles.chartTitle}>Top-Level Metrics</Text>
84
+ <GaugeChart data={rootNumericKeys.map(d => ({ label: d.key, value: d.value }))} accentColor={accentColor}/>
85
+ </View>)}
86
+
87
+ {hasDatesChart && (<View style={graphStyles.chartBlock}>
88
+ <Text style={graphStyles.chartTitle}>Important Dates</Text>
89
+ <CalendarChart data={dateKeys.map(d => ({ label: d.key, date: d.date }))} accentColor={accentColor}/>
90
+ </View>)}
91
+
92
+ {hasItemsChart && (<View style={graphStyles.chartBlock}>
93
+ <Text style={graphStyles.chartTitle}>Item Prices</Text>
94
+ <BarChart data={filteredItems.map((item, i) => ({
95
+ label: item.item_name || item.item_id || `Item ${i + 1}`,
96
+ value: item.price,
97
+ }))} accentColor={AppColors.successGreen || '#22C55E'} maxBarWidth={maxBarWidth} isGradient={false}/>
98
+ </View>)}
99
+ </View>);
100
+ };
101
+ // --- Donut Chart Helpers ---
102
+ const polarToCartesian = (centerX, centerY, radius, angleInDegrees) => {
103
+ const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
104
+ return {
105
+ x: centerX + radius * Math.cos(angleInRadians),
106
+ y: centerY + radius * Math.sin(angleInRadians),
107
+ };
108
+ };
109
+ const getPiePath = (x, y, radius, innerRadius, startAngle, endAngle) => {
110
+ const start = polarToCartesian(x, y, radius, endAngle);
111
+ const end = polarToCartesian(x, y, radius, startAngle);
112
+ const startInner = polarToCartesian(x, y, innerRadius, endAngle);
113
+ const endInner = polarToCartesian(x, y, innerRadius, startAngle);
114
+ const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';
115
+ return `
116
+ M ${start.x} ${start.y}
117
+ A ${radius} ${radius} 0 ${largeArcFlag} 0 ${end.x} ${end.y}
118
+ L ${endInner.x} ${endInner.y}
119
+ A ${innerRadius} ${innerRadius} 0 ${largeArcFlag} 1 ${startInner.x} ${startInner.y}
120
+ Z
121
+ `;
122
+ };
123
+ const DonutChart = ({ data, }) => {
124
+ const total = data.reduce((sum, d) => sum + d.value, 0);
125
+ if (total === 0)
126
+ return null;
127
+ let currentAngle = 0;
128
+ const radius = 50;
129
+ const innerRadius = 30;
130
+ const center = 60;
131
+ return (<View style={{ flexDirection: 'row', alignItems: 'center' }}>
132
+ <Svg width="120" height="120" viewBox="0 0 120 120">
133
+ {data.map((d, i) => {
134
+ if (d.value === 0)
135
+ return null;
136
+ const angle = (d.value / total) * 360;
137
+ const startAngle = currentAngle;
138
+ const endAngle = currentAngle + angle;
139
+ currentAngle += angle;
140
+ if (angle === 360) {
141
+ return (<React.Fragment key={i}>
142
+ <Circle cx={center} cy={center} r={radius} fill={d.color}/>
143
+ <Circle cx={center} cy={center} r={innerRadius} fill={AppColors.primaryLight}/>
144
+ </React.Fragment>);
145
+ }
146
+ const path = getPiePath(center, center, radius, innerRadius, startAngle, endAngle);
147
+ return <Path key={i} d={path} fill={d.color}/>;
148
+ })}
149
+ </Svg>
150
+ <View style={{ marginLeft: 16, flex: 1, gap: 6 }}>
151
+ {data.map((d, i) => {
152
+ if (d.value === 0)
153
+ return null;
154
+ return (<View key={i} style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
155
+ <View style={{
156
+ width: 10,
157
+ height: 10,
158
+ borderRadius: 5,
159
+ backgroundColor: d.color,
160
+ }}/>
161
+ <Text style={{
162
+ fontFamily: AppFonts.interMedium,
163
+ fontSize: 11,
164
+ color: AppColors.grayTextStrong,
165
+ }}>
166
+ {d.label} ({d.value})
167
+ </Text>
168
+ </View>);
169
+ })}
170
+ </View>
171
+ </View>);
172
+ };
173
+ const GaugeChart = ({ data, accentColor, }) => {
174
+ const maxVal = Math.max(...data.map(d => Math.abs(d.value)), 1);
175
+ const radius = 26;
176
+ const stroke = 5;
177
+ const circumference = 2 * Math.PI * radius;
178
+ return (<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={{
179
+ gap: 16,
180
+ paddingRight: 16,
181
+ paddingTop: 6,
182
+ paddingBottom: 6,
183
+ }}>
184
+ {data.map((d, i) => {
185
+ const fillPct = Math.min(Math.abs(d.value) / maxVal, 1);
186
+ const strokeDashoffset = Math.max(circumference - fillPct * circumference, 0.001); // avoid exact 0
187
+ return (<View key={d.label} style={{ alignItems: 'center', width: 70 }}>
188
+ <Svg width="60" height="60" viewBox="0 0 60 60">
189
+ <Circle cx="30" cy="30" r={radius} stroke="#F3F4F6" strokeWidth={stroke} fill="none"/>
190
+ <Circle cx="30" cy="30" r={radius} stroke={accentColor} strokeWidth={stroke} fill="none" strokeLinecap="round" strokeDasharray={circumference} strokeDashoffset={strokeDashoffset} rotation="-90" origin="30, 30"/>
191
+ </Svg>
192
+ <View style={{
193
+ position: 'absolute',
194
+ top: 20,
195
+ height: 20,
196
+ width: 60,
197
+ justifyContent: 'center',
198
+ alignItems: 'center',
199
+ }}>
200
+ <Text style={{
201
+ fontFamily: AppFonts.interBold,
202
+ fontSize: 13,
203
+ color: AppColors.primaryBlack,
204
+ textAlign: 'center',
205
+ }}>
206
+ {d.value >= 1000 ? (d.value / 1000).toFixed(1) + 'k' : d.value}
207
+ </Text>
208
+ </View>
209
+ <Text style={{
210
+ fontFamily: AppFonts.interMedium,
211
+ fontSize: 10,
212
+ color: AppColors.grayTextWeak,
213
+ marginTop: 6,
214
+ textAlign: 'center',
215
+ }} numberOfLines={1}>
216
+ {d.label}
217
+ </Text>
218
+ </View>);
219
+ })}
220
+ </ScrollView>);
221
+ };
222
+ const CalendarChart = ({ data, accentColor, }) => {
223
+ const months = [
224
+ 'Jan',
225
+ 'Feb',
226
+ 'Mar',
227
+ 'Apr',
228
+ 'May',
229
+ 'Jun',
230
+ 'Jul',
231
+ 'Aug',
232
+ 'Sep',
233
+ 'Oct',
234
+ 'Nov',
235
+ 'Dec',
236
+ ];
237
+ return (<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={{
238
+ gap: 16,
239
+ paddingRight: 16,
240
+ paddingTop: 6,
241
+ paddingBottom: 6,
242
+ }}>
243
+ {data.map((d, i) => {
244
+ const monthText = months[d.date.getMonth()];
245
+ const dayText = d.date.getDate();
246
+ const yearText = d.date.getFullYear();
247
+ return (<View key={d.label + i} style={{ width: 70, alignItems: 'center' }}>
248
+ <View style={{
249
+ width: 58,
250
+ height: 62,
251
+ backgroundColor: '#FFFFFF',
252
+ borderRadius: 8,
253
+ borderWidth: 1,
254
+ borderColor: AppColors.grayBorderSecondary,
255
+ overflow: 'hidden',
256
+ shadowColor: '#000',
257
+ shadowOpacity: 0.05,
258
+ shadowRadius: 4,
259
+ shadowOffset: { width: 0, height: 2 },
260
+ elevation: 2,
261
+ }}>
262
+ {/* Calendar Header with Accent Color */}
263
+ <View style={{
264
+ backgroundColor: accentColor,
265
+ height: 18,
266
+ justifyContent: 'center',
267
+ alignItems: 'center',
268
+ }}>
269
+ <Text style={{
270
+ fontFamily: AppFonts.interBold,
271
+ fontSize: 9,
272
+ color: '#FFF',
273
+ textTransform: 'uppercase',
274
+ letterSpacing: 0.5,
275
+ }}>
276
+ {monthText} {yearText}
277
+ </Text>
278
+ </View>
279
+ {/* Calendar Body */}
280
+ <View style={{
281
+ flex: 1,
282
+ justifyContent: 'center',
283
+ alignItems: 'center',
284
+ backgroundColor: '#FAFAFA',
285
+ }}>
286
+ <Text style={{
287
+ fontFamily: AppFonts.interBold,
288
+ fontSize: 24,
289
+ color: AppColors.primaryBlack,
290
+ }}>
291
+ {dayText}
292
+ </Text>
293
+ </View>
294
+ </View>
295
+
296
+ <Text style={{
297
+ fontFamily: AppFonts.interMedium,
298
+ fontSize: 10,
299
+ color: AppColors.grayTextWeak,
300
+ marginTop: 8,
301
+ textAlign: 'center',
302
+ }} numberOfLines={2}>
303
+ {d.label.replace(/_/g, ' ')}
304
+ </Text>
305
+ </View>);
306
+ })}
307
+ </ScrollView>);
308
+ };
309
+ const BarChart = ({ data, accentColor, maxBarWidth, isGradient = false, }) => {
310
+ const maxVal = Math.max(...data.map(d => d.value), 1);
311
+ const chartHeight = data.length * (BAR_HEIGHT + PADDING_Y) + 10;
312
+ return (<View style={graphStyles.svgContainer}>
313
+ <Svg width="100%" height={chartHeight}>
314
+ <Defs>
315
+ <LinearGradient id="barGrad" x1="0" y1="0" x2="1" y2="0">
316
+ <Stop offset="0" stopColor={accentColor} stopOpacity="0.6"/>
317
+ <Stop offset="1" stopColor={accentColor} stopOpacity="1"/>
318
+ </LinearGradient>
319
+ </Defs>
320
+ {data.map((d, i) => {
321
+ const y = i * (BAR_HEIGHT + PADDING_Y);
322
+ const barWidth = Math.max((d.value / maxVal) * maxBarWidth, 2);
323
+ return (<React.Fragment key={d.label}>
324
+ {/* Label above bar */}
325
+ <SvgText x={0} y={y + 12} fill={AppColors.grayTextStrong} fontSize="11" fontFamily={AppFonts.interMedium}>
326
+ {d.label}
327
+ </SvgText>
328
+
329
+ {/* Background trace line */}
330
+ <Line x1={0} y1={y + 24} x2={maxBarWidth} y2={y + 24} stroke={AppColors.grayBorderSecondary} strokeDasharray="4"/>
331
+
332
+ {/* The actual Bar */}
333
+ <Rect x={0} y={y + 16} width={barWidth} height={14} fill={isGradient ? 'url(#barGrad)' : accentColor} rx={4} opacity={0.85}/>
334
+
335
+ {/* Value Text at the end of the bar */}
336
+ <SvgText x={barWidth + 6} y={y + 26} fill={AppColors.primaryBlack} fontSize="11" fontFamily={AppFonts.interBold}>
337
+ {d.value}
338
+ </SvgText>
339
+ </React.Fragment>);
340
+ })}
341
+ </Svg>
342
+ </View>);
343
+ };
344
+ const graphStyles = StyleSheet.create({
345
+ container: {
346
+ backgroundColor: AppColors.primaryLight,
347
+ borderWidth: 1,
348
+ borderColor: AppColors.grayBorderSecondary,
349
+ borderRadius: 12,
350
+ marginBottom: 10,
351
+ padding: 14,
352
+ overflow: 'hidden',
353
+ },
354
+ headerTitle: {
355
+ fontFamily: AppFonts.interBold,
356
+ color: AppColors.primaryBlack,
357
+ fontSize: 14,
358
+ marginBottom: 12,
359
+ borderBottomWidth: 1,
360
+ borderBottomColor: AppColors.dividerColor,
361
+ paddingBottom: 8,
362
+ },
363
+ chartBlock: {
364
+ marginBottom: 16,
365
+ },
366
+ chartTitle: {
367
+ fontFamily: AppFonts.interMedium,
368
+ color: AppColors.grayTextWeak,
369
+ fontSize: 12,
370
+ textTransform: 'uppercase',
371
+ letterSpacing: 0.5,
372
+ marginBottom: 8,
373
+ },
374
+ svgContainer: {
375
+ marginTop: 4,
376
+ },
377
+ });
378
+ export default AnalyticsGraph;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface CodeSnippetProps {
3
+ code: string;
4
+ language: 'html' | 'css' | 'javascript';
5
+ search?: string;
6
+ }
7
+ declare const CodeSnippet: React.FC<CodeSnippetProps>;
8
+ export default CodeSnippet;