amliq-dashboard 2.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 (492) hide show
  1. package/.env.example +3 -0
  2. package/.env.production +1 -0
  3. package/Dockerfile +26 -0
  4. package/QUICK_START.md +267 -0
  5. package/README.md +161 -0
  6. package/TESTING_GUIDE.md +322 -0
  7. package/dist/.well-known/ai-plugin.json +15 -0
  8. package/dist/_headers +8 -0
  9. package/dist/_redirects +1 -0
  10. package/dist/assets/APIKeys-BvwFauIs.js +6 -0
  11. package/dist/assets/APIKeys-DaMSBZQL.js +1 -0
  12. package/dist/assets/AdverseMedia-DckXfMzS.js +4 -0
  13. package/dist/assets/AlertDetailPage-Bc2_zwu_.js +1 -0
  14. package/dist/assets/AlertQueue-DFtBiRoM.js +8 -0
  15. package/dist/assets/Analytics-DtruB5lQ.js +1 -0
  16. package/dist/assets/AuditTrail-BK68ePu0.js +1 -0
  17. package/dist/assets/AuthDivider-gRHEt7gx.js +1 -0
  18. package/dist/assets/Badge-B9VFkofy.js +1 -0
  19. package/dist/assets/BatchJobs-Bz6KFnXD.js +6 -0
  20. package/dist/assets/BillingPage-R9nQ5nFb.js +11 -0
  21. package/dist/assets/Card-Cw-T_-oU.js +1 -0
  22. package/dist/assets/CaseDetail-DYs7Zg_y.js +7 -0
  23. package/dist/assets/CaseManagement-B1Q4Dp1Y.js +1 -0
  24. package/dist/assets/ComplianceReport-Dhssqc9T.js +1 -0
  25. package/dist/assets/Configuration-B92kl9T0.js +1 -0
  26. package/dist/assets/CryptoScreening-C7yFlskC.js +1 -0
  27. package/dist/assets/Dashboard-w4-Nhv9q.js +17 -0
  28. package/dist/assets/DataSources-u3-Ri_5_.js +3 -0
  29. package/dist/assets/EDDWorkflow-CFzlEO0e.js +1 -0
  30. package/dist/assets/EmptyState-Do0xJAT9.js +6 -0
  31. package/dist/assets/ForgotPassword-BPYyQFQp.js +1 -0
  32. package/dist/assets/LandingPage-CjaP0zw4.js +41 -0
  33. package/dist/assets/ListsMarketplace-CG6KkT9B.js +6 -0
  34. package/dist/assets/Login-677LEGP1.js +1 -0
  35. package/dist/assets/MFASetup-BxqCPvui.js +1 -0
  36. package/dist/assets/Monitoring-9TN9MK4y.js +1 -0
  37. package/dist/assets/Onboarding-Cf0Y83lX.js +1 -0
  38. package/dist/assets/Operations-CcXwc2xw.js +10 -0
  39. package/dist/assets/Overview-B_Ky0VWV.js +1 -0
  40. package/dist/assets/PEPScreening-pUQjTH9c.js +1 -0
  41. package/dist/assets/PageHeader-BObHFn0i.js +1 -0
  42. package/dist/assets/PrivacyPolicy-DZ2xrKir.js +1 -0
  43. package/dist/assets/ResetPassword-AtxtpIG1.js +1 -0
  44. package/dist/assets/RiskAssessment-Dzuh1Usv.js +1 -0
  45. package/dist/assets/SARForm-D8w2ZGe-.js +1 -0
  46. package/dist/assets/SanctionsLists-CPA3UH2v.js +1 -0
  47. package/dist/assets/ScheduledTasks-Dsjk-6UR.js +1 -0
  48. package/dist/assets/ScreenEntity-D1U0YL7v.js +3 -0
  49. package/dist/assets/ScreeningProgress-BW49PzoB.js +66 -0
  50. package/dist/assets/SearchField-CulFKdiI.js +1 -0
  51. package/dist/assets/Signup-C0FmFOo_.js +1 -0
  52. package/dist/assets/SystemHealth-B_8u4eva.js +1 -0
  53. package/dist/assets/TaskHistory-BCmEM89q.js +3 -0
  54. package/dist/assets/Team-CUo_FlU7.js +1 -0
  55. package/dist/assets/TenantDetail-CgZQHUY8.js +1 -0
  56. package/dist/assets/Tenants-RB9E9ick.js +2 -0
  57. package/dist/assets/TermsOfService-BfL-kndX.js +1 -0
  58. package/dist/assets/TransactionMonitoring-DGh_T22s.js +14 -0
  59. package/dist/assets/TxnScreening-B7cm2-eh.js +1 -0
  60. package/dist/assets/UBOChain-falXAsCo.js +1 -0
  61. package/dist/assets/Users-Doakpg9c.js +1 -0
  62. package/dist/assets/Webhooks-BZpAfaxv.js +1 -0
  63. package/dist/assets/alert-triangle-YCFVm7B_.js +6 -0
  64. package/dist/assets/alerts-COUnTwWY.js +1 -0
  65. package/dist/assets/arrow-left-9ApLqP95.js +6 -0
  66. package/dist/assets/check-VTcvVtIU.js +6 -0
  67. package/dist/assets/check-circle-2-Dn-lG5YQ.js +6 -0
  68. package/dist/assets/code-DIJRWFVv.js +6 -0
  69. package/dist/assets/fingerprint-C0MGVtax.js +6 -0
  70. package/dist/assets/flag-B8_Gwxh6.js +6 -0
  71. package/dist/assets/index-CfdYcqRM.js +289 -0
  72. package/dist/assets/index-HPU_Rhdu.css +1 -0
  73. package/dist/assets/layers-zHz2o4vo.js +6 -0
  74. package/dist/assets/loader-B9_dNihg.js +6 -0
  75. package/dist/assets/mail-BijL2qwp.js +6 -0
  76. package/dist/assets/plus-i0oBIIPS.js +6 -0
  77. package/dist/assets/refresh-cw-CSuAwutt.js +6 -0
  78. package/dist/assets/useAnalytics-Bj8IONcw.js +72 -0
  79. package/dist/assets/x-circle-DLGKvijE.js +6 -0
  80. package/dist/favicon.svg +15 -0
  81. package/dist/index.html +51 -0
  82. package/dist/llms.txt +28 -0
  83. package/dist/logo.png +0 -0
  84. package/dist/logo.svg +17 -0
  85. package/dist/manifest.json +44 -0
  86. package/dist/robots.txt +15 -0
  87. package/dist/schema.json +13 -0
  88. package/dist/sitemap.xml +28 -0
  89. package/dist/sw.js +67 -0
  90. package/e2e/auth-setup.ts +20 -0
  91. package/e2e/billing.spec.ts +50 -0
  92. package/e2e/cases.spec.ts +53 -0
  93. package/e2e/compliance.spec.ts +65 -0
  94. package/e2e/config.spec.ts +56 -0
  95. package/e2e/dashboard.spec.ts +47 -0
  96. package/e2e/fixtures.ts +33 -0
  97. package/e2e/lists.spec.ts +43 -0
  98. package/e2e/login.spec.ts +64 -0
  99. package/e2e/media.spec.ts +48 -0
  100. package/e2e/mocks.ts +51 -0
  101. package/e2e/monitoring.spec.ts +44 -0
  102. package/e2e/navigation.spec.ts +56 -0
  103. package/e2e/onboarding.spec.ts +49 -0
  104. package/e2e/responsive.spec.ts +40 -0
  105. package/e2e/risk.spec.ts +61 -0
  106. package/e2e/screening.spec.ts +76 -0
  107. package/e2e/team.spec.ts +53 -0
  108. package/index.html +50 -0
  109. package/package.json +47 -0
  110. package/playwright.config.ts +35 -0
  111. package/postcss.config.js +6 -0
  112. package/public/.well-known/ai-plugin.json +15 -0
  113. package/public/_headers +8 -0
  114. package/public/_redirects +1 -0
  115. package/public/favicon.svg +15 -0
  116. package/public/llms.txt +28 -0
  117. package/public/logo.png +0 -0
  118. package/public/logo.svg +17 -0
  119. package/public/manifest.json +44 -0
  120. package/public/robots.txt +15 -0
  121. package/public/schema.json +13 -0
  122. package/public/sitemap.xml +28 -0
  123. package/public/sw.js +67 -0
  124. package/scripts/test-runner.sh +152 -0
  125. package/src/App.tsx +48 -0
  126. package/src/api/alerts.ts +19 -0
  127. package/src/api/analytics.ts +6 -0
  128. package/src/api/audit.ts +11 -0
  129. package/src/api/auth.ts +26 -0
  130. package/src/api/billing.ts +54 -0
  131. package/src/api/cases.ts +48 -0
  132. package/src/api/client.ts +50 -0
  133. package/src/api/config.ts +30 -0
  134. package/src/api/edd.ts +25 -0
  135. package/src/api/enforcement.ts +33 -0
  136. package/src/api/lists.ts +24 -0
  137. package/src/api/monitoring.ts +82 -0
  138. package/src/api/pep.ts +30 -0
  139. package/src/api/risk.ts +26 -0
  140. package/src/api/screening.ts +37 -0
  141. package/src/api/team.ts +27 -0
  142. package/src/api/transactions.ts +37 -0
  143. package/src/components/admin/TenantCards.tsx +51 -0
  144. package/src/components/alerts/AlertActions.test.tsx +80 -0
  145. package/src/components/alerts/AlertActions.tsx +68 -0
  146. package/src/components/alerts/AlertCard.test.tsx +86 -0
  147. package/src/components/alerts/AlertCard.tsx +60 -0
  148. package/src/components/alerts/AlertDetailSidebar.tsx +63 -0
  149. package/src/components/alerts/AlertFilters.test.tsx +73 -0
  150. package/src/components/alerts/AlertFilters.tsx +88 -0
  151. package/src/components/alerts/EntityDetailsCard.test.tsx +61 -0
  152. package/src/components/alerts/EntityDetailsCard.tsx +37 -0
  153. package/src/components/alerts/NotesCard.test.tsx +39 -0
  154. package/src/components/alerts/NotesCard.tsx +28 -0
  155. package/src/components/auth/AuthDivider.tsx +18 -0
  156. package/src/components/auth/LoginForm.tsx +62 -0
  157. package/src/components/auth/LoginLeftPanel.tsx +43 -0
  158. package/src/components/auth/PasswordStrength.tsx +26 -0
  159. package/src/components/auth/SignInButtons.tsx +46 -0
  160. package/src/components/auth/SignupLeftPanel.tsx +35 -0
  161. package/src/components/auth/countries.ts +17 -0
  162. package/src/components/charts/AreaChart.tsx +45 -0
  163. package/src/components/charts/BarChart.tsx +48 -0
  164. package/src/components/charts/DonutChart.tsx +47 -0
  165. package/src/components/compliance/CaseActions.tsx +74 -0
  166. package/src/components/compliance/CaseTimeline.tsx +68 -0
  167. package/src/components/compliance/MediaResultCard.tsx +87 -0
  168. package/src/components/compliance/PEPResultCard.tsx +78 -0
  169. package/src/components/config/MatchingModesCard.test.tsx +75 -0
  170. package/src/components/config/MatchingModesCard.tsx +40 -0
  171. package/src/components/config/ScreeningLayersCard.test.tsx +57 -0
  172. package/src/components/config/ScreeningLayersCard.tsx +36 -0
  173. package/src/components/config/ThresholdsCard.test.tsx +79 -0
  174. package/src/components/config/ThresholdsCard.tsx +51 -0
  175. package/src/components/dashboard/ActivityFeed.tsx +93 -0
  176. package/src/components/dashboard/DashboardGreeting.tsx +23 -0
  177. package/src/components/dashboard/DashboardSkeleton.tsx +35 -0
  178. package/src/components/dashboard/QuickActions.tsx +52 -0
  179. package/src/components/dashboard/TopEntitiesTable.tsx +63 -0
  180. package/src/components/data/ComplianceMetrics.test.tsx +32 -0
  181. package/src/components/data/ComplianceMetrics.tsx +40 -0
  182. package/src/components/data/ConfidenceScore.test.tsx +62 -0
  183. package/src/components/data/ConfidenceScore.tsx +27 -0
  184. package/src/components/data/StatCard.test.tsx +72 -0
  185. package/src/components/data/StatCard.tsx +63 -0
  186. package/src/components/data/StatusBadge.test.tsx +63 -0
  187. package/src/components/data/StatusBadge.tsx +39 -0
  188. package/src/components/layout/AppShell.tsx +48 -0
  189. package/src/components/layout/Breadcrumbs.tsx +48 -0
  190. package/src/components/layout/CommandPalette.tsx +81 -0
  191. package/src/components/layout/DashboardLayout.tsx +19 -0
  192. package/src/components/layout/MobileHeader.tsx +30 -0
  193. package/src/components/layout/NavGroup.test.tsx +63 -0
  194. package/src/components/layout/NavGroup.tsx +64 -0
  195. package/src/components/layout/NotificationBell.tsx +89 -0
  196. package/src/components/layout/PageHeader.test.tsx +61 -0
  197. package/src/components/layout/PageHeader.tsx +19 -0
  198. package/src/components/layout/ProtectedRoute.tsx +31 -0
  199. package/src/components/layout/PublicLayout.tsx +17 -0
  200. package/src/components/layout/Sidebar.test.tsx +67 -0
  201. package/src/components/layout/Sidebar.tsx +92 -0
  202. package/src/components/layout/Toolbar.test.tsx +47 -0
  203. package/src/components/layout/Toolbar.tsx +68 -0
  204. package/src/components/layout/navItems.ts +94 -0
  205. package/src/components/lists/ListCard.tsx +78 -0
  206. package/src/components/lists/ListMarketplaceCard.tsx +77 -0
  207. package/src/components/screening/CircularConfidence.tsx +38 -0
  208. package/src/components/screening/LimitReachedBanner.tsx +31 -0
  209. package/src/components/screening/ListSelector.tsx +64 -0
  210. package/src/components/screening/MatchDetailHeader.tsx +64 -0
  211. package/src/components/screening/MatchEntityInfo.tsx +56 -0
  212. package/src/components/screening/MatchEvidenceBars.tsx +65 -0
  213. package/src/components/screening/MatchMetadata.tsx +95 -0
  214. package/src/components/screening/ScreenResults.tsx +49 -0
  215. package/src/components/screening/ScreeningForm.test.tsx +83 -0
  216. package/src/components/screening/ScreeningForm.tsx +100 -0
  217. package/src/components/screening/ScreeningLayersList.test.tsx +33 -0
  218. package/src/components/screening/ScreeningLayersList.tsx +46 -0
  219. package/src/components/screening/ScreeningProgress.tsx +91 -0
  220. package/src/components/screening/ScreeningQuotaBanner.tsx +64 -0
  221. package/src/components/screening/ScreeningResultCard.tsx +47 -0
  222. package/src/components/screening/ScreeningResultRow.tsx +45 -0
  223. package/src/components/screening/ScreeningResults.test.tsx +37 -0
  224. package/src/components/screening/ScreeningResults.tsx +33 -0
  225. package/src/components/screening/ShareResults.tsx +103 -0
  226. package/src/components/screening/ThresholdSlider.tsx +23 -0
  227. package/src/components/transactions/WebhookCTA.tsx +63 -0
  228. package/src/components/ui/Avatar.test.tsx +47 -0
  229. package/src/components/ui/Avatar.tsx +35 -0
  230. package/src/components/ui/Badge.test.tsx +49 -0
  231. package/src/components/ui/Badge.tsx +33 -0
  232. package/src/components/ui/Button.test.tsx +56 -0
  233. package/src/components/ui/Button.tsx +46 -0
  234. package/src/components/ui/Card.test.tsx +61 -0
  235. package/src/components/ui/Card.tsx +29 -0
  236. package/src/components/ui/ConfirmModal.tsx +67 -0
  237. package/src/components/ui/Divider.test.tsx +24 -0
  238. package/src/components/ui/Divider.tsx +5 -0
  239. package/src/components/ui/EmptyState.test.tsx +49 -0
  240. package/src/components/ui/EmptyState.tsx +22 -0
  241. package/src/components/ui/ErrorBoundary.tsx +44 -0
  242. package/src/components/ui/ExportMenu.tsx +71 -0
  243. package/src/components/ui/LanguageSwitcher.tsx +37 -0
  244. package/src/components/ui/LoadingSpinner.test.tsx +41 -0
  245. package/src/components/ui/LoadingSpinner.tsx +21 -0
  246. package/src/components/ui/MetricCard.tsx +63 -0
  247. package/src/components/ui/ScoreRing.tsx +51 -0
  248. package/src/components/ui/SearchField.test.tsx +55 -0
  249. package/src/components/ui/SearchField.tsx +31 -0
  250. package/src/components/ui/SeverityBadge.tsx +57 -0
  251. package/src/components/ui/ThemeToggle.tsx +37 -0
  252. package/src/components/ui/Toast.test.tsx +79 -0
  253. package/src/components/ui/Toast.tsx +75 -0
  254. package/src/components/ui/Toggle.test.tsx +85 -0
  255. package/src/components/ui/Toggle.tsx +46 -0
  256. package/src/context/AuthContext.tsx +71 -0
  257. package/src/data/pepProfiles.ts +76 -0
  258. package/src/data/pepProfilesExtra.ts +58 -0
  259. package/src/hooks/useAlerts.ts +36 -0
  260. package/src/hooks/useAnalytics.ts +23 -0
  261. package/src/hooks/useApi.test.ts +79 -0
  262. package/src/hooks/useApi.ts +33 -0
  263. package/src/hooks/useAudit.ts +28 -0
  264. package/src/hooks/useBilling.ts +38 -0
  265. package/src/hooks/useConfig.ts +35 -0
  266. package/src/hooks/useDebounce.test.ts +84 -0
  267. package/src/hooks/useDebounce.ts +15 -0
  268. package/src/hooks/useDirection.ts +15 -0
  269. package/src/hooks/useLists.ts +34 -0
  270. package/src/hooks/useMediaQuery.test.ts +97 -0
  271. package/src/hooks/useMediaQuery.ts +28 -0
  272. package/src/hooks/useScreening.ts +33 -0
  273. package/src/hooks/useSidebar.ts +18 -0
  274. package/src/hooks/useUsage.ts +27 -0
  275. package/src/i18n/config.ts +33 -0
  276. package/src/i18n/locales/ar/admin.json +19 -0
  277. package/src/i18n/locales/ar/alerts.json +52 -0
  278. package/src/i18n/locales/ar/analytics.json +9 -0
  279. package/src/i18n/locales/ar/audit.json +12 -0
  280. package/src/i18n/locales/ar/auth.json +60 -0
  281. package/src/i18n/locales/ar/batch.json +5 -0
  282. package/src/i18n/locales/ar/billing.json +41 -0
  283. package/src/i18n/locales/ar/common.json +65 -0
  284. package/src/i18n/locales/ar/compliance.json +83 -0
  285. package/src/i18n/locales/ar/config.json +13 -0
  286. package/src/i18n/locales/ar/dashboard.json +19 -0
  287. package/src/i18n/locales/ar/errors.json +9 -0
  288. package/src/i18n/locales/ar/index.ts +29 -0
  289. package/src/i18n/locales/ar/legal.json +10 -0
  290. package/src/i18n/locales/ar/lists.json +6 -0
  291. package/src/i18n/locales/ar/marketing.json +110 -0
  292. package/src/i18n/locales/ar/monitoring.json +15 -0
  293. package/src/i18n/locales/ar/nav.json +35 -0
  294. package/src/i18n/locales/ar/onboarding.json +25 -0
  295. package/src/i18n/locales/ar/platform.json +23 -0
  296. package/src/i18n/locales/ar/screening.json +26 -0
  297. package/src/i18n/locales/ar/team.json +11 -0
  298. package/src/i18n/locales/en/admin.json +21 -0
  299. package/src/i18n/locales/en/alerts.json +52 -0
  300. package/src/i18n/locales/en/analytics.json +9 -0
  301. package/src/i18n/locales/en/audit.json +12 -0
  302. package/src/i18n/locales/en/auth.json +60 -0
  303. package/src/i18n/locales/en/batch.json +5 -0
  304. package/src/i18n/locales/en/billing.json +87 -0
  305. package/src/i18n/locales/en/common.json +65 -0
  306. package/src/i18n/locales/en/compliance.json +83 -0
  307. package/src/i18n/locales/en/config.json +29 -0
  308. package/src/i18n/locales/en/dashboard.json +23 -0
  309. package/src/i18n/locales/en/errors.json +9 -0
  310. package/src/i18n/locales/en/index.ts +29 -0
  311. package/src/i18n/locales/en/legal.json +114 -0
  312. package/src/i18n/locales/en/lists.json +6 -0
  313. package/src/i18n/locales/en/marketing.json +174 -0
  314. package/src/i18n/locales/en/monitoring.json +15 -0
  315. package/src/i18n/locales/en/nav.json +35 -0
  316. package/src/i18n/locales/en/onboarding.json +31 -0
  317. package/src/i18n/locales/en/platform.json +25 -0
  318. package/src/i18n/locales/en/screening.json +26 -0
  319. package/src/i18n/locales/en/team.json +12 -0
  320. package/src/i18n/locales/he/admin.json +19 -0
  321. package/src/i18n/locales/he/alerts.json +52 -0
  322. package/src/i18n/locales/he/analytics.json +9 -0
  323. package/src/i18n/locales/he/audit.json +12 -0
  324. package/src/i18n/locales/he/auth.json +60 -0
  325. package/src/i18n/locales/he/batch.json +5 -0
  326. package/src/i18n/locales/he/billing.json +41 -0
  327. package/src/i18n/locales/he/common.json +65 -0
  328. package/src/i18n/locales/he/compliance.json +83 -0
  329. package/src/i18n/locales/he/config.json +13 -0
  330. package/src/i18n/locales/he/dashboard.json +19 -0
  331. package/src/i18n/locales/he/errors.json +9 -0
  332. package/src/i18n/locales/he/index.ts +29 -0
  333. package/src/i18n/locales/he/legal.json +10 -0
  334. package/src/i18n/locales/he/lists.json +6 -0
  335. package/src/i18n/locales/he/marketing.json +110 -0
  336. package/src/i18n/locales/he/monitoring.json +15 -0
  337. package/src/i18n/locales/he/nav.json +35 -0
  338. package/src/i18n/locales/he/onboarding.json +25 -0
  339. package/src/i18n/locales/he/platform.json +23 -0
  340. package/src/i18n/locales/he/screening.json +26 -0
  341. package/src/i18n/locales/he/team.json +11 -0
  342. package/src/index.css +112 -0
  343. package/src/main.tsx +15 -0
  344. package/src/pages/APIKeys.tsx +120 -0
  345. package/src/pages/AddMonitorModal.tsx +30 -0
  346. package/src/pages/AdverseMedia.test.tsx +18 -0
  347. package/src/pages/AdverseMedia.tsx +89 -0
  348. package/src/pages/AlertDetailPage.tsx +64 -0
  349. package/src/pages/AlertQueue.test.tsx +48 -0
  350. package/src/pages/AlertQueue.tsx +63 -0
  351. package/src/pages/Analytics.tsx +50 -0
  352. package/src/pages/AuditTrail.tsx +64 -0
  353. package/src/pages/BatchJobs.tsx +79 -0
  354. package/src/pages/CaseDetail.tsx +72 -0
  355. package/src/pages/CaseManagement.test.tsx +31 -0
  356. package/src/pages/CaseManagement.tsx +92 -0
  357. package/src/pages/Configuration.test.tsx +96 -0
  358. package/src/pages/Configuration.tsx +123 -0
  359. package/src/pages/CryptoScreening.tsx +109 -0
  360. package/src/pages/Dashboard.test.tsx +51 -0
  361. package/src/pages/Dashboard.tsx +66 -0
  362. package/src/pages/EDDWorkflow.test.tsx +29 -0
  363. package/src/pages/EDDWorkflow.tsx +73 -0
  364. package/src/pages/ForgotPassword.test.tsx +49 -0
  365. package/src/pages/ForgotPassword.tsx +67 -0
  366. package/src/pages/ListsMarketplace.tsx +102 -0
  367. package/src/pages/Login.test.tsx +100 -0
  368. package/src/pages/Login.tsx +57 -0
  369. package/src/pages/MFASetup.tsx +114 -0
  370. package/src/pages/MonitorProfileCard.tsx +27 -0
  371. package/src/pages/Monitoring.tsx +68 -0
  372. package/src/pages/Onboarding.test.tsx +36 -0
  373. package/src/pages/Onboarding.tsx +60 -0
  374. package/src/pages/PEPScreening.test.tsx +15 -0
  375. package/src/pages/PEPScreening.tsx +100 -0
  376. package/src/pages/ResetPassword.tsx +81 -0
  377. package/src/pages/RiskAssessment.test.tsx +15 -0
  378. package/src/pages/RiskAssessment.tsx +108 -0
  379. package/src/pages/SanctionsLists.tsx +74 -0
  380. package/src/pages/ScreenEntity.test.tsx +82 -0
  381. package/src/pages/ScreenEntity.tsx +76 -0
  382. package/src/pages/Signup.test.tsx +98 -0
  383. package/src/pages/Signup.tsx +92 -0
  384. package/src/pages/TaskHistory.tsx +183 -0
  385. package/src/pages/Team.test.tsx +15 -0
  386. package/src/pages/Team.tsx +140 -0
  387. package/src/pages/TransactionMonitoring.test.tsx +18 -0
  388. package/src/pages/TransactionMonitoring.tsx +118 -0
  389. package/src/pages/TxnScreening.tsx +125 -0
  390. package/src/pages/UBOChain.test.tsx +35 -0
  391. package/src/pages/UBOChain.tsx +65 -0
  392. package/src/pages/Webhooks.tsx +137 -0
  393. package/src/pages/admin/DataSources.tsx +230 -0
  394. package/src/pages/admin/Operations.tsx +103 -0
  395. package/src/pages/admin/ScheduledTasks.tsx +155 -0
  396. package/src/pages/admin/SystemHealth.tsx +58 -0
  397. package/src/pages/admin/TenantDetail.tsx +62 -0
  398. package/src/pages/admin/Tenants.test.tsx +20 -0
  399. package/src/pages/admin/Tenants.tsx +63 -0
  400. package/src/pages/admin/opsRunners.ts +81 -0
  401. package/src/pages/admin/opsTerminal.tsx +63 -0
  402. package/src/pages/billing/ActiveSubscriptions.tsx +41 -0
  403. package/src/pages/billing/AddProductModal.tsx +99 -0
  404. package/src/pages/billing/BillingPage.test.tsx +30 -0
  405. package/src/pages/billing/BillingPage.tsx +67 -0
  406. package/src/pages/billing/CurrentPlan.tsx +50 -0
  407. package/src/pages/billing/InvoiceList.tsx +104 -0
  408. package/src/pages/billing/InvoiceRow.tsx +37 -0
  409. package/src/pages/billing/LemonSqueezySetup.tsx +51 -0
  410. package/src/pages/billing/PaymentAlert.tsx +33 -0
  411. package/src/pages/billing/PlanComparison.tsx +53 -0
  412. package/src/pages/billing/ProductUsage.tsx +43 -0
  413. package/src/pages/billing/PromoCodeInput.tsx +58 -0
  414. package/src/pages/billing/SeatManager.tsx +80 -0
  415. package/src/pages/billing/SeatRow.tsx +32 -0
  416. package/src/pages/billing/SubscriptionCard.tsx +73 -0
  417. package/src/pages/billing/UpgradeModal.tsx +53 -0
  418. package/src/pages/billing/UsageHistory.tsx +37 -0
  419. package/src/pages/billing/UsageMeter.tsx +26 -0
  420. package/src/pages/billing/UsageOverview.tsx +38 -0
  421. package/src/pages/legal/PrivacyPolicy.tsx +25 -0
  422. package/src/pages/legal/TermsOfService.tsx +25 -0
  423. package/src/pages/marketing/BundleCallout.tsx +24 -0
  424. package/src/pages/marketing/CTASection.tsx +48 -0
  425. package/src/pages/marketing/CaseStudy.tsx +37 -0
  426. package/src/pages/marketing/ComparisonTable.tsx +66 -0
  427. package/src/pages/marketing/CompetitiveEdge.tsx +55 -0
  428. package/src/pages/marketing/DataCoverage.tsx +54 -0
  429. package/src/pages/marketing/DataRain.tsx +30 -0
  430. package/src/pages/marketing/EnterpriseCTA.tsx +26 -0
  431. package/src/pages/marketing/FAQItem.tsx +27 -0
  432. package/src/pages/marketing/FAQSchema.tsx +43 -0
  433. package/src/pages/marketing/FAQSection.tsx +19 -0
  434. package/src/pages/marketing/FeatureDetail.tsx +19 -0
  435. package/src/pages/marketing/FeaturesGrid.tsx +60 -0
  436. package/src/pages/marketing/FeaturesSpotlight.tsx +68 -0
  437. package/src/pages/marketing/FooterSection.tsx +92 -0
  438. package/src/pages/marketing/GradientOrbs.tsx +26 -0
  439. package/src/pages/marketing/HeroSearch.tsx +113 -0
  440. package/src/pages/marketing/HeroSection.tsx +72 -0
  441. package/src/pages/marketing/LandingPage.tsx +45 -0
  442. package/src/pages/marketing/LogoCloud.tsx +31 -0
  443. package/src/pages/marketing/LogoMarquee.tsx +45 -0
  444. package/src/pages/marketing/MarketingNav.tsx +80 -0
  445. package/src/pages/marketing/MatchingLayers.tsx +78 -0
  446. package/src/pages/marketing/MobileMenu.tsx +45 -0
  447. package/src/pages/marketing/PricingCard.tsx +57 -0
  448. package/src/pages/marketing/PricingFeatureRow.tsx +16 -0
  449. package/src/pages/marketing/PricingSection.tsx +103 -0
  450. package/src/pages/marketing/PricingToggle.tsx +40 -0
  451. package/src/pages/marketing/ProductPricingCards.tsx +23 -0
  452. package/src/pages/marketing/ProductShowcase.tsx +81 -0
  453. package/src/pages/marketing/ProductTabs.tsx +45 -0
  454. package/src/pages/marketing/QuoteRotator.tsx +56 -0
  455. package/src/pages/marketing/StatsBar.tsx +81 -0
  456. package/src/pages/marketing/StatsSection.tsx +44 -0
  457. package/src/pages/marketing/TestimonialCard.tsx +38 -0
  458. package/src/pages/marketing/TestimonialsSection.tsx +32 -0
  459. package/src/pages/marketing/animations.tsx +56 -0
  460. package/src/pages/onboarding/CountryStep.tsx +38 -0
  461. package/src/pages/onboarding/ListsStep.tsx +44 -0
  462. package/src/pages/onboarding/StepIndicator.tsx +34 -0
  463. package/src/pages/onboarding/ThresholdStep.tsx +49 -0
  464. package/src/pages/platform/APIKeys.tsx +102 -0
  465. package/src/pages/platform/Overview.tsx +58 -0
  466. package/src/pages/platform/Users.tsx +110 -0
  467. package/src/pages/reporting/ComplianceReport.tsx +99 -0
  468. package/src/pages/reporting/SARForm.tsx +99 -0
  469. package/src/routes/appRoutes.tsx +60 -0
  470. package/src/routes/compliance.tsx +28 -0
  471. package/src/routes/lazyCompliance.ts +34 -0
  472. package/src/routes/lazyPages.ts +35 -0
  473. package/src/routes/lazyPlatform.ts +5 -0
  474. package/src/routes/platform.tsx +15 -0
  475. package/src/styles/effects.css +76 -0
  476. package/src/test/setup.ts +25 -0
  477. package/src/test/utils.tsx +49 -0
  478. package/src/types/alert.ts +31 -0
  479. package/src/types/analytics.ts +16 -0
  480. package/src/types/audit.ts +11 -0
  481. package/src/types/billing.ts +60 -0
  482. package/src/types/common.ts +15 -0
  483. package/src/types/config.ts +19 -0
  484. package/src/types/entity.ts +34 -0
  485. package/src/types/index.ts +8 -0
  486. package/src/types/list.ts +15 -0
  487. package/src/types/screening.ts +32 -0
  488. package/src/vite-env.d.ts +1 -0
  489. package/tailwind.config.js +65 -0
  490. package/tsconfig.json +22 -0
  491. package/vite.config.ts +11 -0
  492. package/vitest.config.ts +19 -0
@@ -0,0 +1,75 @@
1
+ import React, { useState, useCallback, createContext, useContext } from 'react'
2
+ import { CheckCircle, AlertCircle, Info, X } from 'lucide-react'
3
+ import clsx from 'clsx'
4
+
5
+ type ToastType = 'success' | 'error' | 'info'
6
+ interface ToastItem { id: number; message: string; type: ToastType }
7
+
8
+ interface ToastContextValue {
9
+ toast: (message: string, type?: ToastType) => void
10
+ }
11
+
12
+ const ToastContext = createContext<ToastContextValue>({ toast: () => {} })
13
+ export const useToast = () => useContext(ToastContext)
14
+
15
+ let nextId = 0
16
+
17
+ const icons: Record<ToastType, typeof Info> = {
18
+ success: CheckCircle, error: AlertCircle, info: Info,
19
+ }
20
+
21
+ const accents: Record<ToastType, string> = {
22
+ success: 'bg-green-500', error: 'bg-red-500', info: 'bg-blue-500',
23
+ }
24
+
25
+ const iconColors: Record<ToastType, string> = {
26
+ success: 'text-green-400', error: 'text-red-400', info: 'text-blue-400',
27
+ }
28
+
29
+ export function ToastProvider({ children }: { children: React.ReactNode }) {
30
+ const [items, setItems] = useState<ToastItem[]>([])
31
+
32
+ const toast = useCallback((message: string, type: ToastType = 'info') => {
33
+ const id = nextId++
34
+ setItems(prev => [...prev, { id, message, type }])
35
+ setTimeout(() => setItems(prev => prev.filter(t => t.id !== id)), 4000)
36
+ }, [])
37
+
38
+ const dismiss = (id: number) => setItems(prev => prev.filter(t => t.id !== id))
39
+
40
+ return (
41
+ <ToastContext.Provider value={{ toast }}>
42
+ {children}
43
+ <div className="fixed bottom-4 right-4 z-50 space-y-2 max-w-sm" aria-live="polite">
44
+ {items.map(item => {
45
+ const Icon = icons[item.type]
46
+ return (
47
+ <div key={item.id} role="alert"
48
+ className="flex items-start gap-3 px-4 py-3 rounded-xl
49
+ bg-[rgba(18,18,26,0.9)] backdrop-blur-xl border border-white/[0.08]
50
+ shadow-[0_8px_30px_rgba(0,0,0,0.4)] text-sm
51
+ animate-[slideInRight_0.3s_ease-out]"
52
+ style={{ overflow: 'hidden', position: 'relative' }}>
53
+ {/* accent stripe */}
54
+ <div className={clsx(
55
+ 'absolute left-0 top-0 bottom-0 w-[3px] rounded-l-xl',
56
+ accents[item.type],
57
+ )} />
58
+ <div className={clsx(
59
+ 'w-7 h-7 rounded-lg flex items-center justify-center shrink-0 mt-0.5',
60
+ `${accents[item.type]}/10`,
61
+ )}>
62
+ <Icon className={clsx('w-4 h-4', iconColors[item.type])} />
63
+ </div>
64
+ <p className="text-white/90 flex-1 leading-relaxed">{item.message}</p>
65
+ <button type="button" onClick={() => dismiss(item.id)}
66
+ className="text-white/30 hover:text-white/60 transition-colors cursor-pointer mt-0.5">
67
+ <X className="w-3.5 h-3.5" />
68
+ </button>
69
+ </div>
70
+ )
71
+ })}
72
+ </div>
73
+ </ToastContext.Provider>
74
+ )
75
+ }
@@ -0,0 +1,85 @@
1
+ import { render, screen } from '@testing-library/react'
2
+ import userEvent from '@testing-library/user-event'
3
+ import { describe, it, expect, vi } from 'vitest'
4
+ import { Toggle } from './Toggle'
5
+
6
+ describe('Toggle', () => {
7
+ it('renders toggle with checked state', () => {
8
+ const { container } = render(
9
+ <Toggle checked={true} onChange={vi.fn()} />
10
+ )
11
+ const toggle = container.querySelector('div[class*="bg-apple-green"]')
12
+ expect(toggle).toBeInTheDocument()
13
+ })
14
+
15
+ it('renders toggle with unchecked state', () => {
16
+ const { container } = render(
17
+ <Toggle checked={false} onChange={vi.fn()} />
18
+ )
19
+ const toggle = container.querySelector('div[class*="bg-apple-bg-tertiary"]')
20
+ expect(toggle).toBeInTheDocument()
21
+ })
22
+
23
+ it('calls onChange when clicked', async () => {
24
+ const handler = vi.fn()
25
+ const { container } = render(
26
+ <Toggle checked={false} onChange={handler} />
27
+ )
28
+ const toggleDiv = container.querySelector('div[class*="rounded-full"]')
29
+ await userEvent.click(toggleDiv!)
30
+ expect(handler).toHaveBeenCalledWith(true)
31
+ })
32
+
33
+ it('toggles between true and false', async () => {
34
+ const handler = vi.fn()
35
+ const { rerender, container } = render(
36
+ <Toggle checked={false} onChange={handler} />
37
+ )
38
+ const toggleDiv = container.querySelector('div[class*="rounded-full"]')
39
+ await userEvent.click(toggleDiv!)
40
+ expect(handler).toHaveBeenCalledWith(true)
41
+
42
+ rerender(<Toggle checked={true} onChange={handler} />)
43
+ await userEvent.click(toggleDiv!)
44
+ expect(handler).toHaveBeenCalledWith(false)
45
+ })
46
+
47
+ it('renders with label', () => {
48
+ render(<Toggle checked={true} onChange={vi.fn()} label="Enable feature" />)
49
+ expect(screen.getByText('Enable feature')).toBeInTheDocument()
50
+ })
51
+
52
+ it('does not call onChange when disabled', async () => {
53
+ const handler = vi.fn()
54
+ const { container } = render(
55
+ <Toggle checked={false} onChange={handler} disabled={true} />
56
+ )
57
+ const toggleDiv = container.querySelector('div[class*="rounded-full"]')
58
+ await userEvent.click(toggleDiv!)
59
+ expect(handler).not.toHaveBeenCalled()
60
+ })
61
+
62
+ it('applies disabled styling', () => {
63
+ const { container } = render(
64
+ <Toggle checked={false} onChange={vi.fn()} disabled={true} />
65
+ )
66
+ const toggleDiv = container.querySelector('div[class*="rounded-full"]')
67
+ expect(toggleDiv).toHaveClass('opacity-50', 'cursor-not-allowed')
68
+ })
69
+
70
+ it('slides indicator to the right when checked', () => {
71
+ const { container } = render(
72
+ <Toggle checked={true} onChange={vi.fn()} />
73
+ )
74
+ const span = container.querySelector('span[class*="translate-x"]')
75
+ expect(span).toHaveClass('translate-x-7')
76
+ })
77
+
78
+ it('slides indicator to the left when unchecked', () => {
79
+ const { container } = render(
80
+ <Toggle checked={false} onChange={vi.fn()} />
81
+ )
82
+ const span = container.querySelector('span[class*="translate-x"]')
83
+ expect(span).toHaveClass('translate-x-0.5')
84
+ })
85
+ })
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import clsx from 'clsx';
3
+
4
+ interface ToggleProps {
5
+ checked: boolean;
6
+ onChange: (checked: boolean) => void;
7
+ label?: string;
8
+ disabled?: boolean;
9
+ }
10
+
11
+ export function Toggle({ checked, onChange, label, disabled }: ToggleProps) {
12
+ const handleKeyDown = (e: React.KeyboardEvent) => {
13
+ if (e.key === ' ' || e.key === 'Enter') {
14
+ e.preventDefault();
15
+ if (!disabled) onChange(!checked);
16
+ }
17
+ };
18
+
19
+ return (
20
+ <label className="flex items-center gap-md cursor-pointer">
21
+ <div
22
+ role="switch"
23
+ aria-checked={checked}
24
+ aria-disabled={disabled}
25
+ aria-label={label}
26
+ tabIndex={disabled ? -1 : 0}
27
+ onClick={() => !disabled && onChange(!checked)}
28
+ onKeyDown={handleKeyDown}
29
+ className={clsx(
30
+ 'relative inline-flex h-8 w-14 items-center rounded-full transition-colors',
31
+ 'focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-apple-blue',
32
+ checked ? 'bg-apple-green' : 'bg-apple-bg-tertiary',
33
+ disabled && 'opacity-50 cursor-not-allowed'
34
+ )}
35
+ >
36
+ <span
37
+ className={clsx(
38
+ 'inline-block h-7 w-7 transform rounded-full bg-white transition-transform',
39
+ checked ? 'translate-x-7' : 'translate-x-0.5'
40
+ )}
41
+ />
42
+ </div>
43
+ {label && <span className="sf-body">{label}</span>}
44
+ </label>
45
+ );
46
+ }
@@ -0,0 +1,71 @@
1
+ import React, { createContext, useContext, useState, useEffect, useCallback } from 'react';
2
+ import { authApi, AuthResponse } from '../api/auth';
3
+
4
+ interface User {
5
+ id: string;
6
+ email: string;
7
+ role: string;
8
+ tenant_id: string;
9
+ }
10
+
11
+ interface AuthContextValue {
12
+ user: User | null;
13
+ loading: boolean;
14
+ login: (email: string, password: string) => Promise<void>;
15
+ loginWithToken: (token: string) => Promise<void>;
16
+ signup: (email: string, password: string, orgName: string, country: string) => Promise<void>;
17
+ logout: () => void;
18
+ isAuthenticated: boolean;
19
+ }
20
+
21
+ const AuthContext = createContext<AuthContextValue | null>(null);
22
+
23
+ export function useAuth(): AuthContextValue {
24
+ const ctx = useContext(AuthContext);
25
+ if (!ctx) throw new Error('useAuth must be inside AuthProvider');
26
+ return ctx;
27
+ }
28
+
29
+ export function AuthProvider({ children }: { children: React.ReactNode }) {
30
+ const [user, setUser] = useState<User | null>(null);
31
+ const [loading, setLoading] = useState(true);
32
+
33
+ useEffect(() => {
34
+ const token = localStorage.getItem('amliq_token');
35
+ if (!token) { setLoading(false); return; }
36
+ authApi.me().then(setUser).catch(() => localStorage.removeItem('amliq_token'))
37
+ .finally(() => setLoading(false));
38
+ }, []);
39
+
40
+ const login = useCallback(async (email: string, password: string) => {
41
+ const resp = await authApi.login({ email, password });
42
+ localStorage.setItem('amliq_token', resp.token);
43
+ setUser(resp.user);
44
+ }, []);
45
+
46
+ const loginWithToken = useCallback(async (token: string) => {
47
+ localStorage.setItem('amliq_token', token);
48
+ const me = await authApi.me();
49
+ setUser(me);
50
+ }, []);
51
+
52
+ const signup = useCallback(async (
53
+ email: string, password: string, orgName: string, country: string,
54
+ ) => {
55
+ const resp = await authApi.signup({ email, password, org_name: orgName, country });
56
+ localStorage.setItem('amliq_token', resp.token);
57
+ setUser(resp.user);
58
+ }, []);
59
+
60
+ const logout = useCallback(() => {
61
+ localStorage.removeItem('amliq_token');
62
+ setUser(null);
63
+ window.location.href = '/login';
64
+ }, []);
65
+
66
+ const value: AuthContextValue = {
67
+ user, loading, login, loginWithToken, signup, logout,
68
+ isAuthenticated: !!user,
69
+ };
70
+ return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;
71
+ }
@@ -0,0 +1,76 @@
1
+ export interface PEPProfile {
2
+ id: string
3
+ name: string
4
+ position: string
5
+ country: string
6
+ tier: 'Tier1' | 'Tier2' | 'Tier3' | 'Tier4'
7
+ riskWeight: number
8
+ isActive: boolean
9
+ startDate: string
10
+ endDate?: string
11
+ aliases: string[]
12
+ sanctions: string[]
13
+ }
14
+
15
+ export const SAMPLE_PEP_PROFILES: PEPProfile[] = [
16
+ {
17
+ id: 'PEP-001', name: 'Vladimir V. Putin', position: 'President',
18
+ country: 'Russia', tier: 'Tier1', riskWeight: 1.0, isActive: true,
19
+ startDate: '2000-05-07', aliases: ['Путин Владимир Владимирович'],
20
+ sanctions: ['OFAC SDN', 'EU Consolidated', 'UK Sanctions'],
21
+ },
22
+ {
23
+ id: 'PEP-002', name: 'Xi Jinping', position: 'President',
24
+ country: 'China', tier: 'Tier1', riskWeight: 1.0, isActive: true,
25
+ startDate: '2013-03-14', aliases: ['习近平'],
26
+ sanctions: [],
27
+ },
28
+ {
29
+ id: 'PEP-003', name: 'Mohammed bin Salman', position: 'Crown Prince',
30
+ country: 'Saudi Arabia', tier: 'Tier1', riskWeight: 1.0, isActive: true,
31
+ startDate: '2017-06-21', aliases: ['MBS', 'محمد بن سلمان'],
32
+ sanctions: [],
33
+ },
34
+ {
35
+ id: 'PEP-004', name: 'Sergei Lavrov', position: 'Foreign Minister',
36
+ country: 'Russia', tier: 'Tier2', riskWeight: 0.8, isActive: true,
37
+ startDate: '2004-03-09', aliases: ['Лавров Сергей Викторович'],
38
+ sanctions: ['OFAC SDN', 'EU Consolidated'],
39
+ },
40
+ {
41
+ id: 'PEP-005', name: 'Hassan Nasrallah', position: 'Secretary General',
42
+ country: 'Lebanon', tier: 'Tier2', riskWeight: 0.8, isActive: false,
43
+ startDate: '1992-02-16', endDate: '2024-09-27',
44
+ aliases: ['حسن نصر الله'], sanctions: ['OFAC SDN'],
45
+ },
46
+ {
47
+ id: 'PEP-006', name: 'Elvira Nabiullina', position: 'Central Bank Governor',
48
+ country: 'Russia', tier: 'Tier2', riskWeight: 0.8, isActive: true,
49
+ startDate: '2013-06-24', aliases: ['Набиуллина Эльвира'],
50
+ sanctions: ['EU Consolidated'],
51
+ },
52
+ {
53
+ id: 'PEP-007', name: 'Kim Jong-un', position: 'Supreme Leader',
54
+ country: 'North Korea', tier: 'Tier1', riskWeight: 1.0, isActive: true,
55
+ startDate: '2011-12-30', aliases: ['김정은'],
56
+ sanctions: ['OFAC SDN', 'UN Consolidated', 'EU Consolidated'],
57
+ },
58
+ {
59
+ id: 'PEP-008', name: 'Bashar al-Assad', position: 'Former President',
60
+ country: 'Syria', tier: 'Tier1', riskWeight: 1.0, isActive: false,
61
+ startDate: '2000-07-17', endDate: '2024-12-08',
62
+ aliases: ['بشار الأسد'], sanctions: ['OFAC SDN', 'EU Consolidated'],
63
+ },
64
+ {
65
+ id: 'PEP-009', name: 'Recep Tayyip Erdogan', position: 'President',
66
+ country: 'Turkey', tier: 'Tier1', riskWeight: 1.0, isActive: true,
67
+ startDate: '2014-08-28', aliases: ['رجب طيب أردوغان'],
68
+ sanctions: [],
69
+ },
70
+ {
71
+ id: 'PEP-010', name: 'Nikolai Patrushev', position: 'Security Council Secretary',
72
+ country: 'Russia', tier: 'Tier2', riskWeight: 0.8, isActive: true,
73
+ startDate: '2008-05-12', aliases: ['Патрушев Николай'],
74
+ sanctions: ['OFAC SDN', 'EU Consolidated', 'UK Sanctions'],
75
+ },
76
+ ]
@@ -0,0 +1,58 @@
1
+ import type { PEPProfile } from './pepProfiles'
2
+
3
+ export const PEP_PROFILES_EXTRA: PEPProfile[] = [
4
+ {
5
+ id: 'PEP-011', name: 'Benjamin Netanyahu', position: 'Prime Minister',
6
+ country: 'Israel', tier: 'Tier1', riskWeight: 1.0, isActive: true,
7
+ startDate: '2022-12-29', aliases: ['Bibi', 'בנימין נתניהו'],
8
+ sanctions: [],
9
+ },
10
+ {
11
+ id: 'PEP-012', name: 'Bill Clinton', position: 'Former President',
12
+ country: 'United States', tier: 'Tier1', riskWeight: 0.6, isActive: false,
13
+ startDate: '1993-01-20', endDate: '2001-01-20',
14
+ aliases: ['William Jefferson Clinton'], sanctions: [],
15
+ },
16
+ {
17
+ id: 'PEP-013', name: 'Joe Biden', position: 'President',
18
+ country: 'United States', tier: 'Tier1', riskWeight: 1.0, isActive: true,
19
+ startDate: '2021-01-20', aliases: ['Joseph Robinette Biden Jr.'],
20
+ sanctions: [],
21
+ },
22
+ {
23
+ id: 'PEP-014', name: 'Emmanuel Macron', position: 'President',
24
+ country: 'France', tier: 'Tier1', riskWeight: 1.0, isActive: true,
25
+ startDate: '2017-05-14', aliases: ['Макрон'], sanctions: [],
26
+ },
27
+ {
28
+ id: 'PEP-015', name: 'Donald Trump', position: 'President',
29
+ country: 'United States', tier: 'Tier1', riskWeight: 1.0, isActive: true,
30
+ startDate: '2025-01-20', aliases: ['DJT'], sanctions: [],
31
+ },
32
+ {
33
+ id: 'PEP-016', name: 'Olaf Scholz', position: 'Chancellor',
34
+ country: 'Germany', tier: 'Tier1', riskWeight: 1.0, isActive: true,
35
+ startDate: '2021-12-08', aliases: [], sanctions: [],
36
+ },
37
+ {
38
+ id: 'PEP-017', name: 'Narendra Modi', position: 'Prime Minister',
39
+ country: 'India', tier: 'Tier1', riskWeight: 1.0, isActive: true,
40
+ startDate: '2014-05-26', aliases: ['नरेन्द्र मोदी'], sanctions: [],
41
+ },
42
+ {
43
+ id: 'PEP-018', name: 'Keir Starmer', position: 'Prime Minister',
44
+ country: 'United Kingdom', tier: 'Tier1', riskWeight: 1.0, isActive: true,
45
+ startDate: '2024-07-05', aliases: [], sanctions: [],
46
+ },
47
+ {
48
+ id: 'PEP-019', name: 'Yair Lapid', position: 'Opposition Leader',
49
+ country: 'Israel', tier: 'Tier2', riskWeight: 0.7, isActive: true,
50
+ startDate: '2023-01-01', aliases: ['יאיר לפיד'], sanctions: [],
51
+ },
52
+ {
53
+ id: 'PEP-020', name: 'Hillary Clinton', position: 'Former Secretary of State',
54
+ country: 'United States', tier: 'Tier2', riskWeight: 0.6, isActive: false,
55
+ startDate: '2009-01-21', endDate: '2013-02-01',
56
+ aliases: ['Hillary Rodham Clinton'], sanctions: [],
57
+ },
58
+ ]
@@ -0,0 +1,36 @@
1
+ import { useState, useEffect, useCallback } from 'react';
2
+ import { alertsApi } from '../api/alerts';
3
+ import type { Alert } from '../types';
4
+
5
+ export function useAlerts() {
6
+ const [alerts, setAlerts] = useState<Alert[]>([]);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState<Error | null>(null);
9
+
10
+ const fetchAlerts = useCallback(async () => {
11
+ setLoading(true);
12
+ try {
13
+ const resp = await alertsApi.list();
14
+ if (!resp) { setAlerts([]); return; }
15
+ setAlerts(Array.isArray(resp) ? resp : resp?.data ?? []);
16
+ } catch (err) {
17
+ setError(err instanceof Error ? err : new Error(String(err)));
18
+ } finally {
19
+ setLoading(false);
20
+ }
21
+ }, []);
22
+
23
+ useEffect(() => {
24
+ fetchAlerts();
25
+ }, [fetchAlerts]);
26
+
27
+ const resolve = useCallback(
28
+ async (id: string, resolution: string, notes: string) => {
29
+ await alertsApi.resolve(id, { resolution, notes });
30
+ await fetchAlerts();
31
+ },
32
+ [fetchAlerts],
33
+ );
34
+
35
+ return { alerts, loading, error, refetch: fetchAlerts, resolve };
36
+ }
@@ -0,0 +1,23 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { analyticsApi } from '../api/analytics';
3
+ import type { DashboardAnalytics } from '../types';
4
+
5
+ export function useAnalytics() {
6
+ const [analytics, setAnalytics] = useState<DashboardAnalytics | null>(null);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState<Error | null>(null);
9
+
10
+ useEffect(() => {
11
+ let mounted = true;
12
+ analyticsApi
13
+ .getDashboard()
14
+ .then((data) => { if (mounted) setAnalytics(data); })
15
+ .catch((err) => {
16
+ if (mounted) setError(err instanceof Error ? err : new Error(String(err)));
17
+ })
18
+ .finally(() => { if (mounted) setLoading(false); });
19
+ return () => { mounted = false; };
20
+ }, []);
21
+
22
+ return { analytics, loading, error };
23
+ }
@@ -0,0 +1,79 @@
1
+ import { renderHook, waitFor } from '@testing-library/react'
2
+ import { describe, it, expect, vi } from 'vitest'
3
+ import { useApi } from './useApi'
4
+
5
+ describe('useApi', () => {
6
+ it('sets initial loading state to true', () => {
7
+ const fetchFn = vi.fn(() => new Promise<any>(() => {}))
8
+ const { result } = renderHook(() => useApi(fetchFn))
9
+ expect(result.current.loading).toBe(true)
10
+ })
11
+
12
+ it('fetches data successfully', async () => {
13
+ const fetchFn = vi.fn().mockResolvedValue({ data: 'test' })
14
+ const { result } = renderHook(() => useApi(fetchFn))
15
+
16
+ await waitFor(() => {
17
+ expect(result.current.loading).toBe(false)
18
+ })
19
+
20
+ expect(result.current.data).toEqual({ data: 'test' })
21
+ expect(result.current.error).toBeNull()
22
+ })
23
+
24
+ it('handles fetch errors', async () => {
25
+ const error = new Error('Network error')
26
+ const fetchFn = vi.fn().mockRejectedValue(error)
27
+ const { result } = renderHook(() => useApi(fetchFn))
28
+
29
+ await waitFor(() => {
30
+ expect(result.current.loading).toBe(false)
31
+ })
32
+
33
+ expect(result.current.data).toBeNull()
34
+ expect(result.current.error).toEqual(error)
35
+ })
36
+
37
+ it('converts non-Error objects to Error', async () => {
38
+ const fetchFn = vi.fn().mockRejectedValue('string error')
39
+ const { result } = renderHook(() => useApi(fetchFn))
40
+
41
+ await waitFor(() => {
42
+ expect(result.current.loading).toBe(false)
43
+ })
44
+
45
+ expect(result.current.error).toBeInstanceOf(Error)
46
+ expect(result.current.error?.message).toBe('string error')
47
+ })
48
+
49
+ it('respects dependencies array', async () => {
50
+ const fetchFn = vi.fn().mockResolvedValue({ id: 1 })
51
+ const { rerender } = renderHook(
52
+ ({ id }) => useApi(fetchFn, [id]),
53
+ { initialProps: { id: 1 } }
54
+ )
55
+
56
+ await waitFor(() => {
57
+ expect(fetchFn).toHaveBeenCalledTimes(1)
58
+ })
59
+
60
+ rerender({ id: 1 })
61
+ expect(fetchFn).toHaveBeenCalledTimes(1)
62
+
63
+ rerender({ id: 2 })
64
+ await waitFor(() => {
65
+ expect(fetchFn).toHaveBeenCalledTimes(2)
66
+ })
67
+ })
68
+
69
+ it('provides refetch function', async () => {
70
+ const fetchFn = vi.fn().mockResolvedValue({ value: 1 })
71
+ const { result } = renderHook(() => useApi(fetchFn))
72
+
73
+ await waitFor(() => {
74
+ expect(result.current.loading).toBe(false)
75
+ })
76
+
77
+ expect(typeof result.current.refetch).toBe('function')
78
+ })
79
+ })
@@ -0,0 +1,33 @@
1
+ import { useState, useEffect } from 'react';
2
+
3
+ export function useApi<T>(
4
+ fetchFn: () => Promise<T>,
5
+ deps: any[] = []
6
+ ) {
7
+ const [data, setData] = useState<T | null>(null);
8
+ const [loading, setLoading] = useState(true);
9
+ const [error, setError] = useState<Error | null>(null);
10
+
11
+ useEffect(() => {
12
+ let mounted = true;
13
+ setLoading(true);
14
+ setError(null);
15
+
16
+ fetchFn()
17
+ .then((result) => {
18
+ if (mounted) setData(result);
19
+ })
20
+ .catch((err) => {
21
+ if (mounted) setError(err instanceof Error ? err : new Error(String(err)));
22
+ })
23
+ .finally(() => {
24
+ if (mounted) setLoading(false);
25
+ });
26
+
27
+ return () => {
28
+ mounted = false;
29
+ };
30
+ }, deps);
31
+
32
+ return { data, loading, error, refetch: () => fetchFn() };
33
+ }
@@ -0,0 +1,28 @@
1
+ import { useState, useEffect, useCallback } from 'react';
2
+ import { auditApi } from '../api/audit';
3
+ import type { AuditEntry } from '../types';
4
+
5
+ export function useAudit() {
6
+ const [entries, setEntries] = useState<AuditEntry[]>([]);
7
+ const [loading, setLoading] = useState(true);
8
+ const [error, setError] = useState<Error | null>(null);
9
+
10
+ const fetchAudit = useCallback(async () => {
11
+ setLoading(true);
12
+ try {
13
+ const resp = await auditApi.list();
14
+ const data = resp as { entries?: AuditEntry[] };
15
+ setEntries(data?.entries ?? []);
16
+ } catch (err) {
17
+ setError(err instanceof Error ? err : new Error(String(err)));
18
+ } finally {
19
+ setLoading(false);
20
+ }
21
+ }, []);
22
+
23
+ useEffect(() => {
24
+ fetchAudit();
25
+ }, [fetchAudit]);
26
+
27
+ return { entries, loading, error, refetch: fetchAudit };
28
+ }
@@ -0,0 +1,38 @@
1
+ import { useState, useEffect, useCallback } from 'react'
2
+ import * as billingApi from '../api/billing'
3
+ import type { Subscription, Invoice } from '../types/billing'
4
+
5
+ export function useBilling() {
6
+ const [subscriptions, setSubscriptions] = useState<Subscription[]>([])
7
+ const [invoices, setInvoices] = useState<Invoice[]>([])
8
+ const [loading, setLoading] = useState(true)
9
+ const [error, setError] = useState<string | null>(null)
10
+
11
+ const fetchAll = useCallback(async () => {
12
+ setLoading(true)
13
+ try {
14
+ const [subs, invs] = await Promise.all([
15
+ billingApi.getSubscriptions(),
16
+ billingApi.getInvoices(),
17
+ ])
18
+ setSubscriptions(subs ?? [])
19
+ setInvoices(invs ?? [])
20
+ setError(null)
21
+ } catch (e) {
22
+ setError(e instanceof Error ? e.message : 'Failed to load billing')
23
+ } finally {
24
+ setLoading(false)
25
+ }
26
+ }, [])
27
+
28
+ useEffect(() => { fetchAll() }, [fetchAll])
29
+
30
+ const checkout = useCallback(async (
31
+ product: string, planId: string, promo?: string,
32
+ ) => {
33
+ const { checkoutUrl } = await billingApi.createCheckout(product, planId, promo)
34
+ window.location.href = checkoutUrl
35
+ }, [])
36
+
37
+ return { subscriptions, invoices, loading, error, refetch: fetchAll, checkout }
38
+ }