@marinoscar/vault-web 0.0.0-bootstrap → 0.1.0-next.3

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 (277) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +99 -0
  4. package/dist/agent/headless/agentActivity.d.ts +53 -0
  5. package/dist/agent/headless/agentActivity.js +58 -0
  6. package/dist/agent/headless/index.d.ts +2 -0
  7. package/dist/agent/headless/index.js +3 -0
  8. package/dist/agent/headless/useAgentActivity.d.ts +9 -0
  9. package/dist/agent/headless/useAgentActivity.js +30 -0
  10. package/dist/agent/ui/components/AgentActivityTable.d.ts +25 -0
  11. package/dist/agent/ui/components/AgentActivityTable.js +114 -0
  12. package/dist/agent/ui/index.d.ts +3 -0
  13. package/dist/agent/ui/index.js +4 -0
  14. package/dist/agent/ui/pages/AgentAccessSettingsPage.d.ts +7 -0
  15. package/dist/agent/ui/pages/AgentAccessSettingsPage.js +70 -0
  16. package/dist/agent/ui/pages/AgentActivityPage.d.ts +6 -0
  17. package/dist/agent/ui/pages/AgentActivityPage.js +61 -0
  18. package/dist/backups/headless/backupContents.d.ts +69 -0
  19. package/dist/backups/headless/backupContents.js +133 -0
  20. package/dist/backups/headless/backupPassword.d.ts +34 -0
  21. package/dist/backups/headless/backupPassword.js +80 -0
  22. package/dist/backups/headless/backupSchedule.d.ts +56 -0
  23. package/dist/backups/headless/backupSchedule.js +189 -0
  24. package/dist/backups/headless/index.d.ts +4 -0
  25. package/dist/backups/headless/index.js +5 -0
  26. package/dist/backups/headless/useBackupRunHistory.d.ts +36 -0
  27. package/dist/backups/headless/useBackupRunHistory.js +83 -0
  28. package/dist/backups/ui/components/AdminBackupDownloadDialog.d.ts +20 -0
  29. package/dist/backups/ui/components/AdminBackupDownloadDialog.js +65 -0
  30. package/dist/backups/ui/components/BackupContentsGroup.d.ts +17 -0
  31. package/dist/backups/ui/components/BackupContentsGroup.js +21 -0
  32. package/dist/backups/ui/components/BackupPasswordFields.d.ts +18 -0
  33. package/dist/backups/ui/components/BackupPasswordFields.js +40 -0
  34. package/dist/backups/ui/components/BackupRunsTable.d.ts +44 -0
  35. package/dist/backups/ui/components/BackupRunsTable.js +61 -0
  36. package/dist/backups/ui/components/DataBackup.d.ts +14 -0
  37. package/dist/backups/ui/components/DataBackup.js +169 -0
  38. package/dist/backups/ui/components/ScheduledBackups.d.ts +13 -0
  39. package/dist/backups/ui/components/ScheduledBackups.js +304 -0
  40. package/dist/backups/ui/index.d.ts +8 -0
  41. package/dist/backups/ui/index.js +9 -0
  42. package/dist/backups/ui/pages/BackupSettingsPage.d.ts +8 -0
  43. package/dist/backups/ui/pages/BackupSettingsPage.js +19 -0
  44. package/dist/backups/ui/pages/MyBackupsPage.d.ts +8 -0
  45. package/dist/backups/ui/pages/MyBackupsPage.js +19 -0
  46. package/dist/brand/BrandLockup.d.ts +14 -0
  47. package/dist/brand/BrandLockup.js +13 -0
  48. package/dist/brand/assets/vault-mark.png +0 -0
  49. package/dist/brand/contrast.d.ts +8 -0
  50. package/dist/brand/contrast.js +21 -0
  51. package/dist/brand/index.d.ts +7 -0
  52. package/dist/brand/index.js +8 -0
  53. package/dist/brand/mark.d.ts +6 -0
  54. package/dist/brand/mark.js +7 -0
  55. package/dist/brand/theme.d.ts +25 -0
  56. package/dist/brand/theme.js +84 -0
  57. package/dist/brand/tokens.d.ts +52 -0
  58. package/dist/brand/tokens.js +54 -0
  59. package/dist/cards/headless/cardExpiry.d.ts +57 -0
  60. package/dist/cards/headless/cardExpiry.js +138 -0
  61. package/dist/cards/headless/cardFormat.d.ts +60 -0
  62. package/dist/cards/headless/cardFormat.js +135 -0
  63. package/dist/cards/headless/cardImage.d.ts +293 -0
  64. package/dist/cards/headless/cardImage.js +518 -0
  65. package/dist/cards/headless/index.d.ts +6 -0
  66. package/dist/cards/headless/index.js +7 -0
  67. package/dist/cards/headless/useCardImport.d.ts +137 -0
  68. package/dist/cards/headless/useCardImport.js +391 -0
  69. package/dist/cards/headless/useCardRenewal.d.ts +102 -0
  70. package/dist/cards/headless/useCardRenewal.js +305 -0
  71. package/dist/cards/headless/useCards.d.ts +80 -0
  72. package/dist/cards/headless/useCards.js +114 -0
  73. package/dist/cards/ui/components/AiEgressNotice.d.ts +13 -0
  74. package/dist/cards/ui/components/AiEgressNotice.js +18 -0
  75. package/dist/cards/ui/components/CardCaptureStep.d.ts +59 -0
  76. package/dist/cards/ui/components/CardCaptureStep.js +96 -0
  77. package/dist/cards/ui/components/CardCropAdjuster.d.ts +43 -0
  78. package/dist/cards/ui/components/CardCropAdjuster.js +215 -0
  79. package/dist/cards/ui/components/CardCropReview.d.ts +51 -0
  80. package/dist/cards/ui/components/CardCropReview.js +88 -0
  81. package/dist/cards/ui/components/CardExpiryBadge.d.ts +8 -0
  82. package/dist/cards/ui/components/CardExpiryBadge.js +43 -0
  83. package/dist/cards/ui/components/CardFieldDiff.d.ts +37 -0
  84. package/dist/cards/ui/components/CardFieldDiff.js +66 -0
  85. package/dist/cards/ui/components/CardFlowStepper.d.ts +24 -0
  86. package/dist/cards/ui/components/CardFlowStepper.js +23 -0
  87. package/dist/cards/ui/components/CardReviewForm.d.ts +44 -0
  88. package/dist/cards/ui/components/CardReviewForm.js +102 -0
  89. package/dist/cards/ui/components/CardScanModelSection.d.ts +23 -0
  90. package/dist/cards/ui/components/CardScanModelSection.js +81 -0
  91. package/dist/cards/ui/components/CardTile.d.ts +40 -0
  92. package/dist/cards/ui/components/CardTile.js +94 -0
  93. package/dist/cards/ui/index.d.ts +15 -0
  94. package/dist/cards/ui/index.js +16 -0
  95. package/dist/cards/ui/pages/AiSettingsPage.d.ts +12 -0
  96. package/dist/cards/ui/pages/AiSettingsPage.js +24 -0
  97. package/dist/cards/ui/pages/CardsPage.d.ts +26 -0
  98. package/dist/cards/ui/pages/CardsPage.js +160 -0
  99. package/dist/cards/ui/pages/ImportCardPage.d.ts +24 -0
  100. package/dist/cards/ui/pages/ImportCardPage.js +343 -0
  101. package/dist/cards/ui/pages/RenewCardPage.d.ts +35 -0
  102. package/dist/cards/ui/pages/RenewCardPage.js +350 -0
  103. package/dist/core/headless/api.d.ts +272 -0
  104. package/dist/core/headless/api.js +425 -0
  105. package/dist/core/headless/cardScanAvailability.d.ts +20 -0
  106. package/dist/core/headless/cardScanAvailability.js +27 -0
  107. package/dist/core/headless/clipboard.d.ts +60 -0
  108. package/dist/core/headless/clipboard.js +101 -0
  109. package/dist/core/headless/http.d.ts +41 -0
  110. package/dist/core/headless/http.js +50 -0
  111. package/dist/core/headless/index.d.ts +12 -0
  112. package/dist/core/headless/index.js +13 -0
  113. package/dist/core/headless/relativeTime.d.ts +7 -0
  114. package/dist/core/headless/relativeTime.js +28 -0
  115. package/dist/core/headless/saveBlob.d.ts +6 -0
  116. package/dist/core/headless/saveBlob.js +21 -0
  117. package/dist/core/headless/types.d.ts +441 -0
  118. package/dist/core/headless/types.js +49 -0
  119. package/dist/core/headless/useAiStatus.d.ts +41 -0
  120. package/dist/core/headless/useAiStatus.js +42 -0
  121. package/dist/core/headless/useCopyToClipboard.d.ts +20 -0
  122. package/dist/core/headless/useCopyToClipboard.js +52 -0
  123. package/dist/core/headless/useDashboardResource.d.ts +22 -0
  124. package/dist/core/headless/useDashboardResource.js +52 -0
  125. package/dist/core/headless/useSystemSettings.d.ts +17 -0
  126. package/dist/core/headless/useSystemSettings.js +106 -0
  127. package/dist/core/headless/useUserSettings.d.ts +13 -0
  128. package/dist/core/headless/useUserSettings.js +103 -0
  129. package/dist/core/ui/ErrorBoundary.d.ts +15 -0
  130. package/dist/core/ui/ErrorBoundary.js +27 -0
  131. package/dist/core/ui/LoadingSpinner.d.ts +6 -0
  132. package/dist/core/ui/LoadingSpinner.js +14 -0
  133. package/dist/core/ui/SettingsPageFrame.d.ts +19 -0
  134. package/dist/core/ui/SettingsPageFrame.js +12 -0
  135. package/dist/core/ui/StorageSettingsLink.d.ts +19 -0
  136. package/dist/core/ui/StorageSettingsLink.js +26 -0
  137. package/dist/core/ui/index.d.ts +4 -0
  138. package/dist/core/ui/index.js +5 -0
  139. package/dist/home/headless/homeLinks.d.ts +24 -0
  140. package/dist/home/headless/homeLinks.js +24 -0
  141. package/dist/home/headless/index.d.ts +1 -0
  142. package/dist/home/headless/index.js +2 -0
  143. package/dist/home/ui/components/BackupStatusPanel.d.ts +28 -0
  144. package/dist/home/ui/components/BackupStatusPanel.js +99 -0
  145. package/dist/home/ui/components/DashboardPanel.d.ts +33 -0
  146. package/dist/home/ui/components/DashboardPanel.js +21 -0
  147. package/dist/home/ui/components/ExpiringCardsPanel.d.ts +31 -0
  148. package/dist/home/ui/components/ExpiringCardsPanel.js +35 -0
  149. package/dist/home/ui/components/FirstRunPanel.d.ts +7 -0
  150. package/dist/home/ui/components/FirstRunPanel.js +21 -0
  151. package/dist/home/ui/components/QuickActions.d.ts +14 -0
  152. package/dist/home/ui/components/QuickActions.js +40 -0
  153. package/dist/home/ui/components/RecentSecretsPanel.d.ts +19 -0
  154. package/dist/home/ui/components/RecentSecretsPanel.js +20 -0
  155. package/dist/home/ui/components/StatsRow.d.ts +19 -0
  156. package/dist/home/ui/components/StatsRow.js +46 -0
  157. package/dist/home/ui/components/WelcomeHeader.d.ts +11 -0
  158. package/dist/home/ui/components/WelcomeHeader.js +15 -0
  159. package/dist/home/ui/index.d.ts +9 -0
  160. package/dist/home/ui/index.js +10 -0
  161. package/dist/home/ui/pages/HomePage.d.ts +14 -0
  162. package/dist/home/ui/pages/HomePage.js +121 -0
  163. package/dist/index.d.ts +5 -0
  164. package/dist/index.js +5 -0
  165. package/dist/media/headless/index.d.ts +2 -0
  166. package/dist/media/headless/index.js +3 -0
  167. package/dist/media/headless/useMediaFiles.d.ts +20 -0
  168. package/dist/media/headless/useMediaFiles.js +82 -0
  169. package/dist/media/headless/useMediaFolders.d.ts +22 -0
  170. package/dist/media/headless/useMediaFolders.js +81 -0
  171. package/dist/media/ui/components/FolderList.d.ts +19 -0
  172. package/dist/media/ui/components/FolderList.js +36 -0
  173. package/dist/media/ui/components/MediaList.d.ts +20 -0
  174. package/dist/media/ui/components/MediaList.js +55 -0
  175. package/dist/media/ui/components/MediaPlayer.d.ts +7 -0
  176. package/dist/media/ui/components/MediaPlayer.js +361 -0
  177. package/dist/media/ui/index.d.ts +10 -0
  178. package/dist/media/ui/index.js +11 -0
  179. package/dist/media/ui/pages/CreateFolderPage.d.ts +1 -0
  180. package/dist/media/ui/pages/CreateFolderPage.js +39 -0
  181. package/dist/media/ui/pages/EditFolderPage.d.ts +1 -0
  182. package/dist/media/ui/pages/EditFolderPage.js +59 -0
  183. package/dist/media/ui/pages/MediaFolderPage.d.ts +1 -0
  184. package/dist/media/ui/pages/MediaFolderPage.js +68 -0
  185. package/dist/media/ui/pages/MediaFoldersPage.d.ts +1 -0
  186. package/dist/media/ui/pages/MediaFoldersPage.js +58 -0
  187. package/dist/media/ui/pages/MediaPlayerPage.d.ts +1 -0
  188. package/dist/media/ui/pages/MediaPlayerPage.js +76 -0
  189. package/dist/media/ui/pages/MediaUploadPage.d.ts +1 -0
  190. package/dist/media/ui/pages/MediaUploadPage.js +88 -0
  191. package/dist/media/ui/pages/RenameMediaFilePage.d.ts +1 -0
  192. package/dist/media/ui/pages/RenameMediaFilePage.js +63 -0
  193. package/dist/navigation/destinations.d.ts +50 -0
  194. package/dist/navigation/destinations.js +109 -0
  195. package/dist/navigation/index.d.ts +1 -0
  196. package/dist/navigation/index.js +4 -0
  197. package/dist/secrets/headless/fieldOptionsValidation.d.ts +45 -0
  198. package/dist/secrets/headless/fieldOptionsValidation.js +79 -0
  199. package/dist/secrets/headless/index.d.ts +6 -0
  200. package/dist/secrets/headless/index.js +7 -0
  201. package/dist/secrets/headless/secretFields.d.ts +86 -0
  202. package/dist/secrets/headless/secretFields.js +190 -0
  203. package/dist/secrets/headless/useSecretDetail.d.ts +33 -0
  204. package/dist/secrets/headless/useSecretDetail.js +87 -0
  205. package/dist/secrets/headless/useSecretTypes.d.ts +16 -0
  206. package/dist/secrets/headless/useSecretTypes.js +62 -0
  207. package/dist/secrets/headless/useSecrets.d.ts +24 -0
  208. package/dist/secrets/headless/useSecrets.js +59 -0
  209. package/dist/secrets/headless/useTotpCode.d.ts +24 -0
  210. package/dist/secrets/headless/useTotpCode.js +116 -0
  211. package/dist/secrets/ui/components/CardImages.d.ts +31 -0
  212. package/dist/secrets/ui/components/CardImages.js +208 -0
  213. package/dist/secrets/ui/components/DynamicSecretFields.d.ts +10 -0
  214. package/dist/secrets/ui/components/DynamicSecretFields.js +90 -0
  215. package/dist/secrets/ui/components/FieldDefinitionBuilder.d.ts +13 -0
  216. package/dist/secrets/ui/components/FieldDefinitionBuilder.js +114 -0
  217. package/dist/secrets/ui/components/FieldOptionsEditor.d.ts +15 -0
  218. package/dist/secrets/ui/components/FieldOptionsEditor.js +45 -0
  219. package/dist/secrets/ui/components/SecretAttachments.d.ts +15 -0
  220. package/dist/secrets/ui/components/SecretAttachments.js +106 -0
  221. package/dist/secrets/ui/components/SecretForm.d.ts +34 -0
  222. package/dist/secrets/ui/components/SecretForm.js +83 -0
  223. package/dist/secrets/ui/components/SecretFormDialog.d.ts +15 -0
  224. package/dist/secrets/ui/components/SecretFormDialog.js +95 -0
  225. package/dist/secrets/ui/components/SecretTypeFormDialog.d.ts +15 -0
  226. package/dist/secrets/ui/components/SecretTypeFormDialog.js +92 -0
  227. package/dist/secrets/ui/components/SecretTypeIcon.d.ts +8 -0
  228. package/dist/secrets/ui/components/SecretTypeIcon.js +16 -0
  229. package/dist/secrets/ui/components/SecretTypesList.d.ts +10 -0
  230. package/dist/secrets/ui/components/SecretTypesList.js +13 -0
  231. package/dist/secrets/ui/components/SecretValueField.d.ts +20 -0
  232. package/dist/secrets/ui/components/SecretValueField.js +52 -0
  233. package/dist/secrets/ui/components/SecretVersionDrawer.d.ts +22 -0
  234. package/dist/secrets/ui/components/SecretVersionDrawer.js +131 -0
  235. package/dist/secrets/ui/components/SecretsTable.d.ts +49 -0
  236. package/dist/secrets/ui/components/SecretsTable.js +174 -0
  237. package/dist/secrets/ui/components/TotpCodeCard.d.ts +8 -0
  238. package/dist/secrets/ui/components/TotpCodeCard.js +34 -0
  239. package/dist/secrets/ui/index.d.ts +20 -0
  240. package/dist/secrets/ui/index.js +21 -0
  241. package/dist/secrets/ui/pages/CreateSecretPage.d.ts +2 -0
  242. package/dist/secrets/ui/pages/CreateSecretPage.js +25 -0
  243. package/dist/secrets/ui/pages/CreateSecretTypePage.d.ts +1 -0
  244. package/dist/secrets/ui/pages/CreateSecretTypePage.js +62 -0
  245. package/dist/secrets/ui/pages/EditSecretPage.d.ts +5 -0
  246. package/dist/secrets/ui/pages/EditSecretPage.js +55 -0
  247. package/dist/secrets/ui/pages/EditSecretTypePage.d.ts +1 -0
  248. package/dist/secrets/ui/pages/EditSecretTypePage.js +88 -0
  249. package/dist/secrets/ui/pages/SecretDetailPage.d.ts +7 -0
  250. package/dist/secrets/ui/pages/SecretDetailPage.js +182 -0
  251. package/dist/secrets/ui/pages/SecretTypesPage.d.ts +1 -0
  252. package/dist/secrets/ui/pages/SecretTypesPage.js +23 -0
  253. package/dist/secrets/ui/pages/SecretsPage.d.ts +6 -0
  254. package/dist/secrets/ui/pages/SecretsPage.js +179 -0
  255. package/dist/settings/ui/components/FeatureFlagsList.d.ts +7 -0
  256. package/dist/settings/ui/components/FeatureFlagsList.js +46 -0
  257. package/dist/settings/ui/components/ImageUpload.d.ts +6 -0
  258. package/dist/settings/ui/components/ImageUpload.js +61 -0
  259. package/dist/settings/ui/components/ProfileSettings.d.ts +11 -0
  260. package/dist/settings/ui/components/ProfileSettings.js +55 -0
  261. package/dist/settings/ui/components/ThemeSettings.d.ts +7 -0
  262. package/dist/settings/ui/components/ThemeSettings.js +24 -0
  263. package/dist/settings/ui/components/UISettings.d.ts +9 -0
  264. package/dist/settings/ui/components/UISettings.js +25 -0
  265. package/dist/settings/ui/components/UserProfileCard.d.ts +1 -0
  266. package/dist/settings/ui/components/UserProfileCard.js +39 -0
  267. package/dist/settings/ui/components/UserSettingsSection.d.ts +23 -0
  268. package/dist/settings/ui/components/UserSettingsSection.js +29 -0
  269. package/dist/settings/ui/index.d.ts +10 -0
  270. package/dist/settings/ui/index.js +11 -0
  271. package/dist/settings/ui/pages/AppearanceSettingsPage.d.ts +6 -0
  272. package/dist/settings/ui/pages/AppearanceSettingsPage.js +11 -0
  273. package/dist/settings/ui/pages/GeneralSettingsPage.d.ts +9 -0
  274. package/dist/settings/ui/pages/GeneralSettingsPage.js +41 -0
  275. package/dist/settings/ui/pages/ProfileSettingsPage.d.ts +6 -0
  276. package/dist/settings/ui/pages/ProfileSettingsPage.js +11 -0
  277. package/package.json +146 -1
@@ -0,0 +1,66 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Chip, Typography } from '@mui/material';
3
+ import { ArrowForward as ArrowIcon } from '@mui/icons-material';
4
+ /**
5
+ * How many trailing characters of a sensitive value the diff reveals.
6
+ *
7
+ * Enough to recognise the outgoing card, short of reconstructing it.
8
+ */
9
+ const SENSITIVE_TAIL = 4;
10
+ const EMPTY_PLACEHOLDER = '—';
11
+ /**
12
+ * Render a value for the comparison line.
13
+ *
14
+ * Sensitive values are reduced to their last few characters. The editable field
15
+ * above this line already has a reveal toggle for the NEW value, so the user can
16
+ * see in full whatever they are about to save; the OLD value has no such toggle
17
+ * and no reason for one — "is this the card ending 4242?" is the entire question
18
+ * the old value has to answer, and printing a full PAN to answer it would put a
19
+ * live card number on screen that nobody asked to see.
20
+ */
21
+ export function formatDiffValue(value, sensitive) {
22
+ const trimmed = value.trim();
23
+ if (trimmed === '')
24
+ return EMPTY_PLACEHOLDER;
25
+ if (!sensitive)
26
+ return trimmed;
27
+ if (trimmed.length <= SENSITIVE_TAIL)
28
+ return '••••';
29
+ return `•••• ${trimmed.slice(-SENSITIVE_TAIL)}`;
30
+ }
31
+ /**
32
+ * One field's before/after, shown beneath its input on the renewal review.
33
+ *
34
+ * This is the step that distinguishes a renewal from an import: the user is not
35
+ * confirming values in a vacuum, they are confirming a CHANGE to a card they
36
+ * already hold, and the thing worth checking is which fields moved. Unchanged
37
+ * fields are stated explicitly rather than hidden — "cardholder stays the same"
38
+ * is information, and a field that silently shows nothing reads as a field that
39
+ * was forgotten.
40
+ */
41
+ export function CardFieldDiff({ field, current, proposed, changed, notCarriedForward = false, }) {
42
+ const label = `${field.label}: ${notCarriedForward
43
+ ? 'not carried over from the old card'
44
+ : changed
45
+ ? `changes from ${formatDiffValue(current, field.sensitive)} to ${formatDiffValue(proposed, field.sensitive)}`
46
+ : 'unchanged'}`;
47
+ return (_jsx(Box, { "aria-label": label, sx: {
48
+ display: 'flex',
49
+ alignItems: 'center',
50
+ flexWrap: 'wrap',
51
+ gap: 0.75,
52
+ mt: 0.5,
53
+ pl: 1.5,
54
+ borderLeft: 2,
55
+ borderColor: changed ? 'primary.main' : 'divider',
56
+ }, children: notCarriedForward ? (_jsxs(_Fragment, { children: [_jsx(Chip, { label: "New code needed", size: "small", color: "info", variant: "outlined", sx: { height: 20, fontSize: 11 } }), _jsx(Typography, { variant: "caption", sx: {
57
+ color: "text.secondary"
58
+ }, children: "The old card's code is never reused." })] })) : (_jsxs(_Fragment, { children: [_jsx(Chip, { label: changed ? 'Changes' : 'Unchanged', size: "small", color: changed ? 'primary' : 'default', variant: "outlined", sx: { height: 20, fontSize: 11 } }), _jsx(Typography, { variant: "caption", sx: {
59
+ color: "text.secondary"
60
+ }, children: "Current" }), _jsx(Typography, { variant: "caption", sx: { fontFamily: 'monospace', wordBreak: 'break-all' }, children: formatDiffValue(current, field.sensitive) }), changed && (_jsxs(_Fragment, { children: [_jsx(ArrowIcon, { "aria-hidden": "true", sx: { fontSize: 14, color: 'text.secondary' } }), _jsx(Typography, { variant: "caption", sx: {
61
+ color: "primary.main",
62
+ fontFamily: 'monospace',
63
+ fontWeight: 600,
64
+ wordBreak: 'break-all'
65
+ }, children: formatDiffValue(proposed, field.sensitive) })] }))] })) }));
66
+ }
@@ -0,0 +1,24 @@
1
+ /** The four steps every card flow walks (import and renew; E10.5, spec §8). */
2
+ export type CardFlowStep = 'capture' | 'crop' | 'review' | 'save';
3
+ export declare const CARD_FLOW_STEPS: readonly {
4
+ id: CardFlowStep;
5
+ label: string;
6
+ }[];
7
+ interface CardFlowStepperProps {
8
+ active: CardFlowStep;
9
+ /**
10
+ * Steps that were passed over (no photo taken, so nothing to crop). They are
11
+ * still listed, so the flow reads the same every time, but say "Skipped".
12
+ */
13
+ skipped?: ReadonlySet<CardFlowStep>;
14
+ /** True once the save went through: every step shows as done. */
15
+ done?: boolean;
16
+ }
17
+ /**
18
+ * Capture → Crop → Review → Save, the same four steps for scanning a new card
19
+ * and renewing one. Labels sit under the icons (`alternativeLabel`) so the
20
+ * four fit a 390px phone without wrapping. The active step is exposed to
21
+ * assistive technology through `aria-current="step"`.
22
+ */
23
+ export declare function CardFlowStepper({ active, skipped, done }: CardFlowStepperProps): import("react").JSX.Element;
24
+ export {};
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Step, StepLabel, Stepper, Typography } from '@mui/material';
3
+ export const CARD_FLOW_STEPS = [
4
+ { id: 'capture', label: 'Capture' },
5
+ { id: 'crop', label: 'Crop' },
6
+ { id: 'review', label: 'Review' },
7
+ { id: 'save', label: 'Save' },
8
+ ];
9
+ /**
10
+ * Capture → Crop → Review → Save, the same four steps for scanning a new card
11
+ * and renewing one. Labels sit under the icons (`alternativeLabel`) so the
12
+ * four fit a 390px phone without wrapping. The active step is exposed to
13
+ * assistive technology through `aria-current="step"`.
14
+ */
15
+ export function CardFlowStepper({ active, skipped, done = false }) {
16
+ const activeIndex = done
17
+ ? CARD_FLOW_STEPS.length
18
+ : CARD_FLOW_STEPS.findIndex((step) => step.id === active);
19
+ return (_jsx(Stepper, { activeStep: activeIndex, alternativeLabel: true, "aria-label": "Progress", sx: { my: { xs: 2, sm: 3 }, mx: { xs: -1, sm: 0 } }, children: CARD_FLOW_STEPS.map((step, index) => {
20
+ const isSkipped = skipped?.has(step.id) && index < activeIndex;
21
+ return (_jsx(Step, { completed: index < activeIndex && !isSkipped, "aria-current": index === activeIndex ? 'step' : undefined, children: _jsx(StepLabel, { optional: isSkipped ? (_jsx(Typography, { variant: "caption", sx: { color: 'text.secondary', display: 'block' }, children: "Skipped" })) : undefined, children: step.label }) }, step.id));
22
+ }) }));
23
+ }
@@ -0,0 +1,44 @@
1
+ import type { FieldDefinition } from '../../../core/headless/types.js';
2
+ interface CardReviewFormProps {
3
+ /** Field definitions from the Card secret type, rendered in order. */
4
+ fields: FieldDefinition[];
5
+ values: Record<string, string>;
6
+ onChange: (name: string, value: string) => void;
7
+ /** Field names the model was unsure about. */
8
+ lowConfidenceFields?: Set<string>;
9
+ /**
10
+ * Field names whose current value was read from the photo by the AI and not
11
+ * edited since. Each gets a "Read by AI" marker so the user knows which
12
+ * values to check against the card. Never contains the CVV.
13
+ */
14
+ aiFields?: Set<string>;
15
+ /** Warnings returned by the extraction, rendered above the form. */
16
+ warnings?: string[];
17
+ errors?: Record<string, string>;
18
+ disabled?: boolean;
19
+ /**
20
+ * The outgoing version's values, turning this into a diff.
21
+ *
22
+ * Supplied only by the renewal flow. When present, each field gains a
23
+ * before/after line showing what changes and what stays — the review step of
24
+ * a renewal is a comparison against a card the user already holds, not a
25
+ * first look at values. Absent for import, where there is nothing to compare
26
+ * against and the form renders exactly as it always has.
27
+ */
28
+ currentValues?: Record<string, string>;
29
+ /**
30
+ * Field whose current value is deliberately never carried forward (the CVV).
31
+ * Its diff line explains the absence instead of showing an empty comparison.
32
+ */
33
+ notCarriedForwardField?: string;
34
+ }
35
+ /**
36
+ * Editable review of the extracted card, plus the fields the extraction could
37
+ * not supply.
38
+ *
39
+ * Every value is editable and nothing is trusted: the model's output is a
40
+ * starting point the user confirms, which is also why this renders identically
41
+ * when the extraction failed outright and all the values are empty.
42
+ */
43
+ export declare function CardReviewForm({ fields, values, onChange, lowConfidenceFields, aiFields, warnings, errors, disabled, currentValues, notCarriedForwardField, }: CardReviewFormProps): import("react").JSX.Element;
44
+ export {};
@@ -0,0 +1,102 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Alert, AlertTitle, Box, Chip, IconButton, InputAdornment, MenuItem, Stack, TextField, Typography, } from '@mui/material';
4
+ import { AutoAwesomeOutlined as AiIcon, Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, WarningAmber as WarningIcon, } from '@mui/icons-material';
5
+ import { CardFieldDiff } from './CardFieldDiff.js';
6
+ /**
7
+ * The CVV is typed by hand, always (E10.5, issue #96; AGENTS.md AI rule 2).
8
+ *
9
+ * It is never seeded from the photo: the review form starts it empty whatever
10
+ * the extraction returned, and the user types it from the card. It is required
11
+ * (`POST /api/secrets` rejects a card without one) and has no checksum behind
12
+ * it, so its helper says plainly where the value has to come from, and stays
13
+ * quiet once something is typed.
14
+ */
15
+ const CVV_FIELD = 'cvv';
16
+ const CVV_EMPTY_HELPER = 'Not read from the photo — type it from the card. Required.';
17
+ const CVV_TYPED_HELPER = 'Typed by you. Never read from the photo.';
18
+ const LOW_CONFIDENCE_HELPER = 'The photo was hard to read here. Check this against the card.';
19
+ /**
20
+ * Editable review of the extracted card, plus the fields the extraction could
21
+ * not supply.
22
+ *
23
+ * Every value is editable and nothing is trusted: the model's output is a
24
+ * starting point the user confirms, which is also why this renders identically
25
+ * when the extraction failed outright and all the values are empty.
26
+ */
27
+ export function CardReviewForm({ fields, values, onChange, lowConfidenceFields, aiFields, warnings = [], errors = {}, disabled = false, currentValues, notCarriedForwardField, }) {
28
+ const [revealed, setRevealed] = useState(new Set());
29
+ const toggleReveal = (name) => {
30
+ setRevealed((prev) => {
31
+ const next = new Set(prev);
32
+ if (next.has(name))
33
+ next.delete(name);
34
+ else
35
+ next.add(name);
36
+ return next;
37
+ });
38
+ };
39
+ return (_jsxs(Box, { children: [warnings.length > 0 && (_jsxs(Alert, { severity: "warning", icon: _jsx(WarningIcon, {}), sx: { mb: 2 }, children: [_jsx(AlertTitle, { children: "Check these before saving" }), _jsx(Box, { component: "ul", sx: { pl: 2, m: 0 }, children: warnings.map((warning) => (_jsx("li", { children: _jsx(Typography, { variant: "body2", children: warning }) }, warning))) })] })), _jsx(Stack, { spacing: 2, children: fields.map((field) => {
40
+ const value = values[field.name] ?? '';
41
+ const error = errors[field.name];
42
+ const isLowConfidence = lowConfidenceFields?.has(field.name) ?? false;
43
+ const isCvv = field.name === CVV_FIELD;
44
+ // The CVV is never an AI value, whatever a caller passes.
45
+ const isAiValue = !isCvv && value !== '' && (aiFields?.has(field.name) ?? false);
46
+ // An empty CVV outranks the low-confidence hint: "type it from the
47
+ // card" is actionable, "check this against the card" is not when
48
+ // there is nothing in the box to check.
49
+ const helperText = error ??
50
+ (isCvv && !value
51
+ ? CVV_EMPTY_HELPER
52
+ : isLowConfidence
53
+ ? LOW_CONFIDENCE_HELPER
54
+ : isCvv
55
+ ? CVV_TYPED_HELPER
56
+ : undefined);
57
+ // A low-confidence field is not an error — the value may well be
58
+ // right — so its outline takes the amber accent (a fill/stroke, never
59
+ // text: spec §5) rather than being marked invalid, which keeps the
60
+ // red reserved for things that actually block saving. The words come
61
+ // from the "Check" chip and the helper text, never the colour alone.
62
+ const warningSx = !error && isLowConfidence
63
+ ? {
64
+ '& .MuiOutlinedInput-notchedOutline': {
65
+ borderColor: 'secondary.main',
66
+ borderWidth: 2,
67
+ },
68
+ }
69
+ : undefined;
70
+ const label = (_jsxs(Box, { component: "span", sx: { display: 'inline-flex', alignItems: 'center', gap: 0.5 }, children: [field.label, isAiValue && !isLowConfidence && (_jsx(Chip, { icon: _jsx(AiIcon, {}), label: "AI", size: "small", color: "primary", variant: "outlined", "aria-label": "Read by AI", sx: { height: 18, fontSize: 11, '& .MuiChip-icon': { fontSize: 12 } } })), isLowConfidence && (_jsx(Chip, { label: "Check", size: "small", color: "secondary", sx: { height: 18, fontSize: 11, fontWeight: 600 } }))] }));
71
+ // Built as a value rather than returned directly so the renewal diff
72
+ // can be appended beneath it without duplicating all three branches.
73
+ const input = (() => {
74
+ if (field.type === 'select') {
75
+ const options = Array.isArray(field.options) ? field.options : [];
76
+ // Keep an extracted value that is not a configured option visible
77
+ // rather than silently dropping it on first render.
78
+ const orphan = value !== '' && !options.includes(value) ? value : null;
79
+ return (_jsxs(TextField, { select: true, fullWidth: true, label: label, required: field.required, value: value, onChange: (e) => onChange(field.name, e.target.value), error: Boolean(error), helperText: helperText, disabled: disabled, sx: warningSx, slotProps: {
80
+ select: { displayEmpty: true },
81
+ inputLabel: { shrink: true }
82
+ }, children: [!field.required && (_jsx(MenuItem, { value: "", children: _jsx("em", { children: "None" }) })), orphan !== null && (_jsx(MenuItem, { value: orphan, children: orphan })), options.map((option) => (_jsx(MenuItem, { value: option, children: option }, option)))] }, field.name));
83
+ }
84
+ if (field.sensitive) {
85
+ const isRevealed = revealed.has(field.name);
86
+ return (_jsx(TextField, { fullWidth: true, label: label, required: field.required, type: isRevealed ? 'text' : 'password', value: value, onChange: (e) => onChange(field.name, e.target.value), error: Boolean(error), helperText: helperText, disabled: disabled, sx: warningSx, slotProps: {
87
+ input: {
88
+ endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { edge: "end", size: "small", onClick: () => toggleReveal(field.name), "aria-label": isRevealed ? `Hide ${field.label}` : `Show ${field.label}`, children: isRevealed ? _jsx(VisibilityOffIcon, {}) : _jsx(VisibilityIcon, {}) }) })),
89
+ }
90
+ } }, field.name));
91
+ }
92
+ return (_jsx(TextField, { fullWidth: true, label: label, required: field.required, multiline: field.name === 'notes', minRows: field.name === 'notes' ? 2 : undefined, value: value, onChange: (e) => onChange(field.name, e.target.value), error: Boolean(error), helperText: helperText, disabled: disabled, sx: warningSx }, field.name));
93
+ })();
94
+ // Import passes no `currentValues`, so its markup is unchanged: the
95
+ // TextField is returned exactly as before, with the key on it.
96
+ if (!currentValues)
97
+ return input;
98
+ return (_jsxs(Box, { children: [input, _jsx(CardFieldDiff, { field: field, current: currentValues[field.name] ?? '', proposed: value, changed: field.name === notCarriedForwardField
99
+ ? value.trim() !== ''
100
+ : value.trim() !== (currentValues[field.name] ?? '').trim(), notCarriedForward: field.name === notCarriedForwardField })] }, field.name));
101
+ }) })] }));
102
+ }
@@ -0,0 +1,23 @@
1
+ import type { AiModel } from '@marinoscar/platform-web/ai/headless';
2
+ /**
3
+ * What the `card_extract` AI feature needs from a model (`app-registrations/ai.ts`
4
+ * in the API): the platform refuses a model that lacks one, so only models that
5
+ * declare all three are offered.
6
+ */
7
+ export declare const CARD_EXTRACT_NEEDS: readonly ["responses", "structured_output", "vision_input"];
8
+ /** The models listed for card scanning: enabled, and able to do what it needs. */
9
+ export declare function cardScanCandidates(models: readonly AiModel[]): AiModel[];
10
+ /**
11
+ * Vault's one AI setting the packaged AI page does not draw (E8.2, issue #88):
12
+ * `ai.cardExtractModel`, the model card scanning runs on (`VaultAiTargetResolver`
13
+ * in the API). Rendered in the `AfterContent` slot of the packaged `AiConfigPage`
14
+ * (`pages/admin/AiSettingsPage.tsx`), a section of that page, never a tab.
15
+ *
16
+ * The choices are the models the platform lists (`GET /api/admin/ai/models`,
17
+ * enabled and image-capable); a stored model that is no longer among them stays
18
+ * selected and is flagged. It saves through `PATCH /api/system-settings`
19
+ * (`{ ai: { cardExtractModel } }`, `If-Match`), so it reads with
20
+ * `system_settings:read` and saves with `system_settings:write`; without the
21
+ * latter the control is visible and disabled.
22
+ */
23
+ export declare function CardScanModelSection(): import("react").JSX.Element | null;
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
+ import { Link as RouterLink } from 'react-router-dom';
4
+ import { Alert, Box, Button, CircularProgress, Link, MenuItem, Paper, Snackbar, TextField, Typography, } from '@mui/material';
5
+ import { usePermissions } from '@marinoscar/platform-web/identity/headless';
6
+ import { useAiModels } from '@marinoscar/platform-web/ai/headless';
7
+ import { useSystemSettings } from '../../../core/headless/useSystemSettings.js';
8
+ /**
9
+ * What the `card_extract` AI feature needs from a model (`app-registrations/ai.ts`
10
+ * in the API): the platform refuses a model that lacks one, so only models that
11
+ * declare all three are offered.
12
+ */
13
+ export const CARD_EXTRACT_NEEDS = ['responses', 'structured_output', 'vision_input'];
14
+ /** The models listed for card scanning: enabled, and able to do what it needs. */
15
+ export function cardScanCandidates(models) {
16
+ const seen = new Set();
17
+ const out = [];
18
+ for (const model of models) {
19
+ if (!model.enabled || model.deprecatedAt)
20
+ continue;
21
+ const caps = model.capabilities?.capabilities ?? [];
22
+ if (!CARD_EXTRACT_NEEDS.every((need) => caps.includes(need)))
23
+ continue;
24
+ if (seen.has(model.modelId))
25
+ continue;
26
+ seen.add(model.modelId);
27
+ out.push(model);
28
+ }
29
+ return out;
30
+ }
31
+ /** The model catalogue page (the packaged `AiModelsPage`, its card in `adminSections.tsx`). */
32
+ const MODELS_PATH = '/admin/settings/ai/models';
33
+ /**
34
+ * Vault's one AI setting the packaged AI page does not draw (E8.2, issue #88):
35
+ * `ai.cardExtractModel`, the model card scanning runs on (`VaultAiTargetResolver`
36
+ * in the API). Rendered in the `AfterContent` slot of the packaged `AiConfigPage`
37
+ * (`pages/admin/AiSettingsPage.tsx`), a section of that page, never a tab.
38
+ *
39
+ * The choices are the models the platform lists (`GET /api/admin/ai/models`,
40
+ * enabled and image-capable); a stored model that is no longer among them stays
41
+ * selected and is flagged. It saves through `PATCH /api/system-settings`
42
+ * (`{ ai: { cardExtractModel } }`, `If-Match`), so it reads with
43
+ * `system_settings:read` and saves with `system_settings:write`; without the
44
+ * latter the control is visible and disabled.
45
+ */
46
+ export function CardScanModelSection() {
47
+ const { hasPermission } = usePermissions();
48
+ const canRead = hasPermission('system_settings:read');
49
+ const canWrite = hasPermission('system_settings:write');
50
+ const { settings, isLoading, error, isSaving, updateCardExtractModel } = useSystemSettings();
51
+ const { models, isLoading: modelsLoading, error: modelsError } = useAiModels({
52
+ enabled: true,
53
+ capability: 'vision_input',
54
+ pageSize: 100,
55
+ });
56
+ const stored = typeof settings?.ai?.cardExtractModel === 'string' ? settings.ai.cardExtractModel : '';
57
+ const [selected, setSelected] = useState(stored);
58
+ const [saved, setSaved] = useState(false);
59
+ const [saveError, setSaveError] = useState(null);
60
+ useEffect(() => {
61
+ setSelected(stored);
62
+ }, [stored]);
63
+ const candidates = useMemo(() => cardScanCandidates(models), [models]);
64
+ const storedListed = stored === '' || candidates.some((m) => m.modelId === stored);
65
+ if (!canRead)
66
+ return null;
67
+ const handleSave = async () => {
68
+ setSaveError(null);
69
+ try {
70
+ await updateCardExtractModel(selected);
71
+ setSaved(true);
72
+ }
73
+ catch (err) {
74
+ setSaveError(err instanceof Error ? err.message : 'Failed to save the card scanning model');
75
+ }
76
+ };
77
+ const busy = isLoading || modelsLoading;
78
+ return (_jsxs(Paper, { variant: "outlined", sx: { p: { xs: 2, sm: 3 }, mt: 3 }, component: "section", "aria-labelledby": "card-scan-model-heading", children: [_jsx(Typography, { id: "card-scan-model-heading", variant: "h6", component: "h2", gutterBottom: true, children: "Card scanning model" }), _jsxs(Typography, { variant: "body2", sx: { color: 'text.secondary', mb: 2 }, children: ["The model Vault reads card photos with. It must be enabled on", ' ', _jsx(Link, { component: RouterLink, to: MODELS_PATH, children: "AI models" }), ' ', "and accept images. The card security code is never read or sent."] }), busy ? (_jsx(Box, { sx: { display: 'flex', justifyContent: 'center', py: 2 }, children: _jsx(CircularProgress, { size: 28, "aria-label": "Loading the card scanning model" }) })) : (_jsxs(_Fragment, { children: [(error || modelsError) && (_jsx(Alert, { severity: "error", sx: { mb: 2 }, children: error ?? modelsError })), !storedListed && !modelsError && (_jsxs(Alert, { severity: "warning", sx: { mb: 2 }, children: ["The saved model, ", stored, ", is not an enabled model that accepts images. Card scans will fail until you pick one below or enable it on AI models."] })), candidates.length === 0 && !modelsError && (_jsx(Alert, { severity: "info", sx: { mb: 2 }, children: "No enabled model accepts images yet. Enable one on AI models, then choose it here." })), !canWrite && (_jsx(Alert, { severity: "info", sx: { mb: 2 }, children: "You can see this setting but not change it (needs system_settings:write)." })), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexDirection: { xs: 'column', sm: 'row' }, alignItems: { sm: 'flex-start' } }, children: [_jsxs(TextField, { select: true, fullWidth: true, label: "Model", value: selected, onChange: (e) => setSelected(e.target.value), disabled: !canWrite || isSaving, helperText: "Used for every card scan in this deployment.", children: [!storedListed && (_jsxs(MenuItem, { value: stored, children: [stored, " (not available)"] })), candidates.map((model) => (_jsx(MenuItem, { value: model.modelId, children: model.displayName && model.displayName !== model.modelId
79
+ ? `${model.displayName} (${model.modelId})`
80
+ : model.modelId }, model.id)))] }), _jsx(Button, { variant: "contained", onClick: () => void handleSave(), disabled: !canWrite || isSaving || selected === '' || selected === stored, sx: { minHeight: 56, flexShrink: 0 }, children: isSaving ? 'Saving…' : 'Save model' })] }), saveError && (_jsx(Alert, { severity: "error", sx: { mt: 2 }, onClose: () => setSaveError(null), children: saveError }))] })), _jsx(Snackbar, { open: saved, autoHideDuration: 4000, onClose: () => setSaved(false), message: "Card scanning model saved" })] }));
81
+ }
@@ -0,0 +1,40 @@
1
+ import type { CardSummary } from '../../headless/useCards.js';
2
+ /**
3
+ * One payment card, drawn as a card (E10.5, issue #96; spec §8).
4
+ *
5
+ * The tile is a card face in the brand colour (a `primary` gradient, read from
6
+ * the theme so light and dark both hold their contrast) carrying the facts a
7
+ * user scans a wallet for: the name they gave the card, its network, the last
8
+ * four digits and the expiry, with kind, issuing bank and cardholder as
9
+ * supporting detail. Below the face sit the expiry badge, a photo indicator and
10
+ * the Renew action.
11
+ *
12
+ * The heading is the user's own name for the card, not the network. A network
13
+ * does not distinguish anything once a user holds several cards on it, whereas
14
+ * the name is the label the user chose for exactly this purpose. Network, kind
15
+ * and issuing bank drop to the subheading.
16
+ *
17
+ * The data comes from `GET /api/secrets/cards/summary` (#118), decrypted
18
+ * server-side. A field the card does not store (null) is simply omitted, never
19
+ * shown as a dash.
20
+ *
21
+ * Only `•••• last4` is ever rendered here — a list view must never put a full
22
+ * PAN on screen, and this component never receives one. Never the CVV either.
23
+ *
24
+ * Every tile has the same height (the face keeps the ISO card aspect ratio and
25
+ * the footer is one row), so the gallery reads as a uniform grid on a phone.
26
+ */
27
+ interface CardTileProps {
28
+ card: CardSummary;
29
+ onClick: (id: string) => void;
30
+ /**
31
+ * Start a renewal for this card.
32
+ *
33
+ * Offered on EVERY card, not only the expiring ones — a card can be reissued
34
+ * after loss or fraud at any time, long before its printed date. Expiry
35
+ * status only decides how prominent the button is.
36
+ */
37
+ onRenew?: (id: string) => void;
38
+ }
39
+ export declare function CardTile({ card, onClick, onRenew }: CardTileProps): import("react").JSX.Element;
40
+ export {};
@@ -0,0 +1,94 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Button, Card, CardActionArea, CardActions, Typography, } from '@mui/material';
3
+ import { alpha, useTheme } from '@mui/material/styles';
4
+ import { Autorenew as RenewIcon, ContactlessOutlined as ContactlessIcon, PhotoCameraBackOutlined as PhotoIcon, } from '@mui/icons-material';
5
+ import { CardExpiryBadge } from './CardExpiryBadge.js';
6
+ import { isNeedsAttention } from '../../headless/cardExpiry.js';
7
+ import { CARD_ASPECT_RATIO } from '../../headless/cardImage.js';
8
+ export function CardTile({ card, onClick, onRenew }) {
9
+ const theme = useTheme();
10
+ // `name` is required on a secret, so the fallbacks only guard a blank row.
11
+ const heading = card.name || card.network || 'Card';
12
+ // Anything that merely restates the heading is dropped, so a card the user
13
+ // named "Visa" does not read "Visa · Visa". Missing fields are skipped.
14
+ const subheading = [card.network, card.kind, card.issuingBank]
15
+ .filter((part) => Boolean(part) && part.trim().toLowerCase() !== heading.trim().toLowerCase())
16
+ .join(' · ');
17
+ const needsAttention = isNeedsAttention(card.status);
18
+ const isExpired = card.status === 'expired';
19
+ // The face: the brand primary, or a muted slate once the card is dead, so an
20
+ // expired card recedes in the grid (the badge still says so in words). Both
21
+ // gradients are read from the theme; no colour is written here.
22
+ //
23
+ // Light mode: a solid deep-teal face (primary.dark -> primary.main) with
24
+ // white text (7.37:1 and up). Dark mode: the dark primary is a bright teal,
25
+ // which would glare in a dark gallery, so the face is a TONAL teal (primary
26
+ // at 38% -> 18% over the paper) with the body text colour (about 6:1).
27
+ const { palette } = theme;
28
+ const isDark = palette.mode === 'dark';
29
+ let faceBackground;
30
+ let onFace;
31
+ if (isExpired) {
32
+ const start = palette.grey[isDark ? 800 : 700];
33
+ const end = palette.grey[isDark ? 700 : 600];
34
+ faceBackground = `linear-gradient(135deg, ${start} 0%, ${end} 100%)`;
35
+ onFace = palette.getContrastText(start);
36
+ }
37
+ else if (isDark) {
38
+ faceBackground = `linear-gradient(135deg, ${alpha(palette.primary.main, 0.38)} 0%, ${alpha(palette.primary.main, 0.18)} 100%), ${palette.background.paper}`;
39
+ onFace = palette.text.primary;
40
+ }
41
+ else {
42
+ faceBackground = `linear-gradient(135deg, ${palette.primary.dark} 0%, ${palette.primary.main} 100%)`;
43
+ onFace = palette.primary.contrastText;
44
+ }
45
+ const onFaceMuted = alpha(onFace, 0.82);
46
+ return (_jsxs(Card, { variant: "outlined", sx: { height: '100%', display: 'flex', flexDirection: 'column' }, "data-testid": "card-tile", "data-status": card.status, children: [_jsx(CardActionArea, { onClick: () => onClick(card.id), sx: { p: 1.5, pb: 1, alignItems: 'stretch' }, children: _jsxs(Box, { sx: {
47
+ position: 'relative',
48
+ aspectRatio: String(CARD_ASPECT_RATIO),
49
+ borderRadius: 2,
50
+ p: { xs: 2, sm: 1.75, md: 2 },
51
+ display: 'flex',
52
+ flexDirection: 'column',
53
+ color: onFace,
54
+ background: faceBackground,
55
+ overflow: 'hidden',
56
+ // A soft sheen so the face reads as a card, not a coloured box.
57
+ '&::after': {
58
+ content: '""',
59
+ position: 'absolute',
60
+ right: '-20%',
61
+ top: '-45%',
62
+ width: '75%',
63
+ aspectRatio: '1',
64
+ borderRadius: '50%',
65
+ background: alpha(onFace, 0.08),
66
+ pointerEvents: 'none',
67
+ },
68
+ }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: 1, minWidth: 0 }, children: [_jsxs(Box, { sx: { minWidth: 0, flexGrow: 1 }, children: [_jsx(Typography, { variant: "subtitle1", component: "h3", noWrap: true, sx: { fontWeight: 600, lineHeight: 1.3 }, children: heading }), subheading && (_jsx(Typography, { variant: "caption", noWrap: true, sx: { color: onFaceMuted, display: 'block' }, children: subheading }))] }), _jsx(ContactlessIcon, { "aria-hidden": "true", sx: { color: onFaceMuted, flexShrink: 0 } })] }), _jsx(Box, { "aria-hidden": "true", sx: {
69
+ mt: { xs: 1.5, sm: 1, md: 1.5 },
70
+ width: 38,
71
+ height: 28,
72
+ borderRadius: 1,
73
+ border: '1px solid',
74
+ borderColor: alpha(onFace, 0.35),
75
+ background: `linear-gradient(135deg, ${alpha(onFace, 0.28)}, ${alpha(onFace, 0.12)})`,
76
+ } }), _jsx(Typography, { variant: "body1", sx: {
77
+ mt: 'auto',
78
+ mb: 1,
79
+ fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, monospace',
80
+ fontSize: { xs: '1.05rem', sm: '1rem', md: '1.05rem' },
81
+ letterSpacing: 1.5,
82
+ whiteSpace: 'nowrap',
83
+ overflow: 'hidden',
84
+ textOverflow: 'ellipsis',
85
+ }, children: card.maskedNumber || '•••• —' }), _jsxs(Box, { sx: { display: 'flex', alignItems: 'flex-end', gap: 2, minWidth: 0 }, children: [_jsx(Box, { sx: { minWidth: 0, flexGrow: 1 }, children: card.cardholderName && (_jsxs(_Fragment, { children: [_jsx(Typography, { variant: "caption", sx: { color: onFaceMuted, display: 'block', fontSize: 10, letterSpacing: 0.6, textTransform: 'uppercase' }, children: "Cardholder" }), _jsx(Typography, { variant: "body2", noWrap: true, sx: { fontWeight: 500 }, children: card.cardholderName })] })) }), _jsxs(Box, { sx: { flexShrink: 0, textAlign: 'right' }, children: [_jsx(Typography, { variant: "caption", sx: { color: onFaceMuted, display: 'block', fontSize: 10, letterSpacing: 0.6, textTransform: 'uppercase' }, children: "Expires" }), _jsx(Typography, { variant: "body2", sx: { fontWeight: 500, fontVariantNumeric: 'tabular-nums' }, children: card.expiryLabel || '—' })] })] })] }) }), _jsxs(CardActions, { sx: {
86
+ px: 1.5,
87
+ pt: 0.5,
88
+ pb: 1.5,
89
+ mt: 'auto',
90
+ gap: 1,
91
+ justifyContent: 'space-between',
92
+ flexWrap: 'nowrap',
93
+ }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, minWidth: 0 }, children: [_jsx(CardExpiryBadge, { status: card.status, expiryLabel: card.expiryLabel }), card.hasPhotos && (_jsx(PhotoIcon, { fontSize: "small", titleAccess: "Has card photos", sx: { color: 'text.secondary' } }))] }), onRenew && (_jsx(Button, { size: "small", startIcon: _jsx(RenewIcon, {}), variant: needsAttention ? 'contained' : 'text', color: isExpired ? 'error' : 'primary', onClick: () => onRenew(card.id), "aria-label": `Renew ${heading}`, sx: { flexShrink: 0, ml: 'auto' }, children: "Renew" }))] })] }));
94
+ }
@@ -0,0 +1,15 @@
1
+ export * from './components/AiEgressNotice.js';
2
+ export * from './components/CardCaptureStep.js';
3
+ export * from './components/CardCropAdjuster.js';
4
+ export * from './components/CardCropReview.js';
5
+ export * from './components/CardExpiryBadge.js';
6
+ export * from './components/CardFieldDiff.js';
7
+ export * from './components/CardFlowStepper.js';
8
+ export * from './components/CardReviewForm.js';
9
+ export * from './components/CardScanModelSection.js';
10
+ export * from './components/CardTile.js';
11
+ export { default as AiSettingsPage } from './pages/AiSettingsPage.js';
12
+ export { default as CardsPage } from './pages/CardsPage.js';
13
+ export * from './pages/CardsPage.js';
14
+ export { default as ImportCardPage } from './pages/ImportCardPage.js';
15
+ export { default as RenewCardPage } from './pages/RenewCardPage.js';
@@ -0,0 +1,16 @@
1
+ // Payment cards: the components, the Cards, Import and Renew pages and the AI settings page with the card-scanning model.
2
+ export * from './components/AiEgressNotice.js';
3
+ export * from './components/CardCaptureStep.js';
4
+ export * from './components/CardCropAdjuster.js';
5
+ export * from './components/CardCropReview.js';
6
+ export * from './components/CardExpiryBadge.js';
7
+ export * from './components/CardFieldDiff.js';
8
+ export * from './components/CardFlowStepper.js';
9
+ export * from './components/CardReviewForm.js';
10
+ export * from './components/CardScanModelSection.js';
11
+ export * from './components/CardTile.js';
12
+ export { default as AiSettingsPage } from './pages/AiSettingsPage.js';
13
+ export { default as CardsPage } from './pages/CardsPage.js';
14
+ export * from './pages/CardsPage.js';
15
+ export { default as ImportCardPage } from './pages/ImportCardPage.js';
16
+ export { default as RenewCardPage } from './pages/RenewCardPage.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The `AI` card of the Console (`/admin/settings/ai`, E8.2 #88): the platform AI
3
+ * slice's `AiConfigPage` (switch AI on, the key policy, the OpenAI provider and
4
+ * its write-only key, limits), gated on `ai_config:read` and editable with
5
+ * `ai_config:write`, plus Vault's `Card scanning model` section in its
6
+ * `AfterContent` slot (`ai.cardExtractModel`, saved through system settings).
7
+ *
8
+ * This is the card that switches AI on, so it is never hidden behind
9
+ * `feature: 'ai'`. The page redirects to `/` without `ai_config:read` itself;
10
+ * the route's `RequirePermission` and the API are the gates.
11
+ */
12
+ export default function AiSettingsPage(): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import AiConfigPage from '@marinoscar/platform-web/ai/ui/config-page';
3
+ import { CardScanModelSection } from '../components/CardScanModelSection.js';
4
+ /**
5
+ * Vault's slots on the packaged AI page. A module constant: a new object every
6
+ * render would re-render the page's slot tree.
7
+ */
8
+ const SLOTS = {
9
+ AfterContent: CardScanModelSection,
10
+ };
11
+ /**
12
+ * The `AI` card of the Console (`/admin/settings/ai`, E8.2 #88): the platform AI
13
+ * slice's `AiConfigPage` (switch AI on, the key policy, the OpenAI provider and
14
+ * its write-only key, limits), gated on `ai_config:read` and editable with
15
+ * `ai_config:write`, plus Vault's `Card scanning model` section in its
16
+ * `AfterContent` slot (`ai.cardExtractModel`, saved through system settings).
17
+ *
18
+ * This is the card that switches AI on, so it is never hidden behind
19
+ * `feature: 'ai'`. The page redirects to `/` without `ai_config:read` itself;
20
+ * the route's `RequirePermission` and the API are the gates.
21
+ */
22
+ export default function AiSettingsPage() {
23
+ return _jsx(AiConfigPage, { slots: SLOTS });
24
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The gallery's status filter (E10.5, spec §8). `attention` is expiring soon
3
+ * OR expired: what the Home dashboard's "Cards needing attention" links to.
4
+ */
5
+ export type CardFilter = 'all' | 'attention' | 'expiring_soon' | 'expired';
6
+ /**
7
+ * Read `?filter=` (all | attention | expiring_soon | expired; `expiring` is
8
+ * accepted for expiring_soon). Anything else, or nothing, is `all`.
9
+ */
10
+ export declare function parseCardFilter(raw: string | null): CardFilter;
11
+ /**
12
+ * The Cards destination: a gallery of the user's payment cards (E10.5, #96).
13
+ *
14
+ * Cards previously sat undifferentiated in the secrets list, so an expiry was
15
+ * only discovered when a payment failed. Everything here is derived from values
16
+ * the user already has; since #118 they arrive in one paged
17
+ * `GET /api/secrets/cards/summary` (display fields only) instead of
18
+ * one decrypted detail request per card.
19
+ *
20
+ * Layout: a header with the two ways to add a card (scan, gated on AI; manual),
21
+ * a toolbar with search and the status filter chips, then a responsive grid of
22
+ * `CardTile`s (one column on a phone, two from `sm`, three from `md`). The
23
+ * shell's `<main>` already pads the page, so the container adds no gutters of
24
+ * its own (no double padding on a phone).
25
+ */
26
+ export default function CardsPage(): import("react").JSX.Element;