@marinoscar/vault-web 0.0.0-stage → 0.1.0-next.4

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 (287) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/LICENSE +21 -0
  3. package/README.md +98 -2
  4. package/dist/agent/headless/agentActivity.d.ts +57 -0
  5. package/dist/agent/headless/agentActivity.js +70 -0
  6. package/dist/agent/headless/cardGrants.d.ts +28 -0
  7. package/dist/agent/headless/cardGrants.js +61 -0
  8. package/dist/agent/headless/index.d.ts +4 -0
  9. package/dist/agent/headless/index.js +5 -0
  10. package/dist/agent/headless/useAgentActivity.d.ts +9 -0
  11. package/dist/agent/headless/useAgentActivity.js +30 -0
  12. package/dist/agent/headless/useCardGrants.d.ts +19 -0
  13. package/dist/agent/headless/useCardGrants.js +51 -0
  14. package/dist/agent/ui/components/AgentActivityTable.d.ts +25 -0
  15. package/dist/agent/ui/components/AgentActivityTable.js +122 -0
  16. package/dist/agent/ui/components/CardAgentAccessPanel.d.ts +17 -0
  17. package/dist/agent/ui/components/CardAgentAccessPanel.js +44 -0
  18. package/dist/agent/ui/components/CardGrantDialog.d.ts +16 -0
  19. package/dist/agent/ui/components/CardGrantDialog.js +101 -0
  20. package/dist/agent/ui/components/IdentityAgentAccessPanel.d.ts +20 -0
  21. package/dist/agent/ui/components/IdentityAgentAccessPanel.js +61 -0
  22. package/dist/agent/ui/index.d.ts +6 -0
  23. package/dist/agent/ui/index.js +7 -0
  24. package/dist/agent/ui/pages/AgentAccessSettingsPage.d.ts +7 -0
  25. package/dist/agent/ui/pages/AgentAccessSettingsPage.js +105 -0
  26. package/dist/agent/ui/pages/AgentActivityPage.d.ts +6 -0
  27. package/dist/agent/ui/pages/AgentActivityPage.js +61 -0
  28. package/dist/backups/headless/backupContents.d.ts +69 -0
  29. package/dist/backups/headless/backupContents.js +133 -0
  30. package/dist/backups/headless/backupPassword.d.ts +34 -0
  31. package/dist/backups/headless/backupPassword.js +80 -0
  32. package/dist/backups/headless/backupSchedule.d.ts +56 -0
  33. package/dist/backups/headless/backupSchedule.js +189 -0
  34. package/dist/backups/headless/index.d.ts +4 -0
  35. package/dist/backups/headless/index.js +5 -0
  36. package/dist/backups/headless/useBackupRunHistory.d.ts +36 -0
  37. package/dist/backups/headless/useBackupRunHistory.js +83 -0
  38. package/dist/backups/ui/components/AdminBackupDownloadDialog.d.ts +20 -0
  39. package/dist/backups/ui/components/AdminBackupDownloadDialog.js +65 -0
  40. package/dist/backups/ui/components/BackupContentsGroup.d.ts +17 -0
  41. package/dist/backups/ui/components/BackupContentsGroup.js +21 -0
  42. package/dist/backups/ui/components/BackupPasswordFields.d.ts +18 -0
  43. package/dist/backups/ui/components/BackupPasswordFields.js +40 -0
  44. package/dist/backups/ui/components/BackupRunsTable.d.ts +44 -0
  45. package/dist/backups/ui/components/BackupRunsTable.js +61 -0
  46. package/dist/backups/ui/components/DataBackup.d.ts +14 -0
  47. package/dist/backups/ui/components/DataBackup.js +169 -0
  48. package/dist/backups/ui/components/ScheduledBackups.d.ts +13 -0
  49. package/dist/backups/ui/components/ScheduledBackups.js +304 -0
  50. package/dist/backups/ui/index.d.ts +8 -0
  51. package/dist/backups/ui/index.js +9 -0
  52. package/dist/backups/ui/pages/BackupSettingsPage.d.ts +8 -0
  53. package/dist/backups/ui/pages/BackupSettingsPage.js +19 -0
  54. package/dist/backups/ui/pages/MyBackupsPage.d.ts +8 -0
  55. package/dist/backups/ui/pages/MyBackupsPage.js +19 -0
  56. package/dist/brand/BrandLockup.d.ts +14 -0
  57. package/dist/brand/BrandLockup.js +13 -0
  58. package/dist/brand/assets/vault-mark.png +0 -0
  59. package/dist/brand/contrast.d.ts +8 -0
  60. package/dist/brand/contrast.js +21 -0
  61. package/dist/brand/index.d.ts +7 -0
  62. package/dist/brand/index.js +8 -0
  63. package/dist/brand/mark.d.ts +6 -0
  64. package/dist/brand/mark.js +7 -0
  65. package/dist/brand/theme.d.ts +25 -0
  66. package/dist/brand/theme.js +84 -0
  67. package/dist/brand/tokens.d.ts +52 -0
  68. package/dist/brand/tokens.js +54 -0
  69. package/dist/cards/headless/cardExpiry.d.ts +57 -0
  70. package/dist/cards/headless/cardExpiry.js +138 -0
  71. package/dist/cards/headless/cardFormat.d.ts +60 -0
  72. package/dist/cards/headless/cardFormat.js +135 -0
  73. package/dist/cards/headless/cardImage.d.ts +293 -0
  74. package/dist/cards/headless/cardImage.js +518 -0
  75. package/dist/cards/headless/index.d.ts +6 -0
  76. package/dist/cards/headless/index.js +7 -0
  77. package/dist/cards/headless/useCardImport.d.ts +137 -0
  78. package/dist/cards/headless/useCardImport.js +391 -0
  79. package/dist/cards/headless/useCardRenewal.d.ts +102 -0
  80. package/dist/cards/headless/useCardRenewal.js +305 -0
  81. package/dist/cards/headless/useCards.d.ts +80 -0
  82. package/dist/cards/headless/useCards.js +114 -0
  83. package/dist/cards/ui/components/AiEgressNotice.d.ts +13 -0
  84. package/dist/cards/ui/components/AiEgressNotice.js +18 -0
  85. package/dist/cards/ui/components/CardCaptureStep.d.ts +59 -0
  86. package/dist/cards/ui/components/CardCaptureStep.js +96 -0
  87. package/dist/cards/ui/components/CardCropAdjuster.d.ts +43 -0
  88. package/dist/cards/ui/components/CardCropAdjuster.js +215 -0
  89. package/dist/cards/ui/components/CardCropReview.d.ts +51 -0
  90. package/dist/cards/ui/components/CardCropReview.js +88 -0
  91. package/dist/cards/ui/components/CardExpiryBadge.d.ts +8 -0
  92. package/dist/cards/ui/components/CardExpiryBadge.js +43 -0
  93. package/dist/cards/ui/components/CardFieldDiff.d.ts +37 -0
  94. package/dist/cards/ui/components/CardFieldDiff.js +66 -0
  95. package/dist/cards/ui/components/CardFlowStepper.d.ts +24 -0
  96. package/dist/cards/ui/components/CardFlowStepper.js +23 -0
  97. package/dist/cards/ui/components/CardReviewForm.d.ts +44 -0
  98. package/dist/cards/ui/components/CardReviewForm.js +102 -0
  99. package/dist/cards/ui/components/CardScanModelSection.d.ts +23 -0
  100. package/dist/cards/ui/components/CardScanModelSection.js +82 -0
  101. package/dist/cards/ui/components/CardTile.d.ts +40 -0
  102. package/dist/cards/ui/components/CardTile.js +94 -0
  103. package/dist/cards/ui/index.d.ts +15 -0
  104. package/dist/cards/ui/index.js +16 -0
  105. package/dist/cards/ui/pages/AiSettingsPage.d.ts +12 -0
  106. package/dist/cards/ui/pages/AiSettingsPage.js +24 -0
  107. package/dist/cards/ui/pages/CardsPage.d.ts +26 -0
  108. package/dist/cards/ui/pages/CardsPage.js +161 -0
  109. package/dist/cards/ui/pages/ImportCardPage.d.ts +24 -0
  110. package/dist/cards/ui/pages/ImportCardPage.js +343 -0
  111. package/dist/cards/ui/pages/RenewCardPage.d.ts +35 -0
  112. package/dist/cards/ui/pages/RenewCardPage.js +350 -0
  113. package/dist/core/headless/api.d.ts +276 -0
  114. package/dist/core/headless/api.js +432 -0
  115. package/dist/core/headless/cardScanAvailability.d.ts +20 -0
  116. package/dist/core/headless/cardScanAvailability.js +27 -0
  117. package/dist/core/headless/clipboard.d.ts +60 -0
  118. package/dist/core/headless/clipboard.js +101 -0
  119. package/dist/core/headless/http.d.ts +53 -0
  120. package/dist/core/headless/http.js +59 -0
  121. package/dist/core/headless/index.d.ts +12 -0
  122. package/dist/core/headless/index.js +13 -0
  123. package/dist/core/headless/relativeTime.d.ts +7 -0
  124. package/dist/core/headless/relativeTime.js +28 -0
  125. package/dist/core/headless/saveBlob.d.ts +6 -0
  126. package/dist/core/headless/saveBlob.js +21 -0
  127. package/dist/core/headless/types.d.ts +458 -0
  128. package/dist/core/headless/types.js +51 -0
  129. package/dist/core/headless/useAiStatus.d.ts +41 -0
  130. package/dist/core/headless/useAiStatus.js +42 -0
  131. package/dist/core/headless/useCopyToClipboard.d.ts +20 -0
  132. package/dist/core/headless/useCopyToClipboard.js +52 -0
  133. package/dist/core/headless/useDashboardResource.d.ts +22 -0
  134. package/dist/core/headless/useDashboardResource.js +52 -0
  135. package/dist/core/headless/useSystemSettings.d.ts +17 -0
  136. package/dist/core/headless/useSystemSettings.js +106 -0
  137. package/dist/core/headless/useUserSettings.d.ts +13 -0
  138. package/dist/core/headless/useUserSettings.js +103 -0
  139. package/dist/core/ui/ErrorBoundary.d.ts +15 -0
  140. package/dist/core/ui/ErrorBoundary.js +27 -0
  141. package/dist/core/ui/LoadingSpinner.d.ts +6 -0
  142. package/dist/core/ui/LoadingSpinner.js +14 -0
  143. package/dist/core/ui/SettingsPageFrame.d.ts +19 -0
  144. package/dist/core/ui/SettingsPageFrame.js +12 -0
  145. package/dist/core/ui/StorageSettingsLink.d.ts +19 -0
  146. package/dist/core/ui/StorageSettingsLink.js +26 -0
  147. package/dist/core/ui/index.d.ts +4 -0
  148. package/dist/core/ui/index.js +5 -0
  149. package/dist/home/headless/homeLinks.d.ts +24 -0
  150. package/dist/home/headless/homeLinks.js +24 -0
  151. package/dist/home/headless/index.d.ts +1 -0
  152. package/dist/home/headless/index.js +2 -0
  153. package/dist/home/ui/components/BackupStatusPanel.d.ts +28 -0
  154. package/dist/home/ui/components/BackupStatusPanel.js +99 -0
  155. package/dist/home/ui/components/DashboardPanel.d.ts +33 -0
  156. package/dist/home/ui/components/DashboardPanel.js +21 -0
  157. package/dist/home/ui/components/ExpiringCardsPanel.d.ts +31 -0
  158. package/dist/home/ui/components/ExpiringCardsPanel.js +35 -0
  159. package/dist/home/ui/components/FirstRunPanel.d.ts +7 -0
  160. package/dist/home/ui/components/FirstRunPanel.js +21 -0
  161. package/dist/home/ui/components/QuickActions.d.ts +14 -0
  162. package/dist/home/ui/components/QuickActions.js +40 -0
  163. package/dist/home/ui/components/RecentSecretsPanel.d.ts +19 -0
  164. package/dist/home/ui/components/RecentSecretsPanel.js +20 -0
  165. package/dist/home/ui/components/StatsRow.d.ts +19 -0
  166. package/dist/home/ui/components/StatsRow.js +46 -0
  167. package/dist/home/ui/components/WelcomeHeader.d.ts +11 -0
  168. package/dist/home/ui/components/WelcomeHeader.js +15 -0
  169. package/dist/home/ui/index.d.ts +9 -0
  170. package/dist/home/ui/index.js +10 -0
  171. package/dist/home/ui/pages/HomePage.d.ts +14 -0
  172. package/dist/home/ui/pages/HomePage.js +121 -0
  173. package/dist/index.d.ts +5 -0
  174. package/dist/index.js +5 -0
  175. package/dist/media/headless/index.d.ts +2 -0
  176. package/dist/media/headless/index.js +3 -0
  177. package/dist/media/headless/useMediaFiles.d.ts +20 -0
  178. package/dist/media/headless/useMediaFiles.js +82 -0
  179. package/dist/media/headless/useMediaFolders.d.ts +22 -0
  180. package/dist/media/headless/useMediaFolders.js +81 -0
  181. package/dist/media/ui/components/FolderList.d.ts +19 -0
  182. package/dist/media/ui/components/FolderList.js +36 -0
  183. package/dist/media/ui/components/MediaList.d.ts +20 -0
  184. package/dist/media/ui/components/MediaList.js +55 -0
  185. package/dist/media/ui/components/MediaPlayer.d.ts +7 -0
  186. package/dist/media/ui/components/MediaPlayer.js +361 -0
  187. package/dist/media/ui/index.d.ts +10 -0
  188. package/dist/media/ui/index.js +11 -0
  189. package/dist/media/ui/pages/CreateFolderPage.d.ts +1 -0
  190. package/dist/media/ui/pages/CreateFolderPage.js +39 -0
  191. package/dist/media/ui/pages/EditFolderPage.d.ts +1 -0
  192. package/dist/media/ui/pages/EditFolderPage.js +59 -0
  193. package/dist/media/ui/pages/MediaFolderPage.d.ts +1 -0
  194. package/dist/media/ui/pages/MediaFolderPage.js +68 -0
  195. package/dist/media/ui/pages/MediaFoldersPage.d.ts +1 -0
  196. package/dist/media/ui/pages/MediaFoldersPage.js +58 -0
  197. package/dist/media/ui/pages/MediaPlayerPage.d.ts +1 -0
  198. package/dist/media/ui/pages/MediaPlayerPage.js +76 -0
  199. package/dist/media/ui/pages/MediaUploadPage.d.ts +1 -0
  200. package/dist/media/ui/pages/MediaUploadPage.js +88 -0
  201. package/dist/media/ui/pages/RenameMediaFilePage.d.ts +1 -0
  202. package/dist/media/ui/pages/RenameMediaFilePage.js +63 -0
  203. package/dist/navigation/destinations.d.ts +50 -0
  204. package/dist/navigation/destinations.js +109 -0
  205. package/dist/navigation/index.d.ts +1 -0
  206. package/dist/navigation/index.js +4 -0
  207. package/dist/secrets/headless/fieldOptionsValidation.d.ts +45 -0
  208. package/dist/secrets/headless/fieldOptionsValidation.js +79 -0
  209. package/dist/secrets/headless/index.d.ts +6 -0
  210. package/dist/secrets/headless/index.js +7 -0
  211. package/dist/secrets/headless/secretFields.d.ts +91 -0
  212. package/dist/secrets/headless/secretFields.js +197 -0
  213. package/dist/secrets/headless/useSecretDetail.d.ts +34 -0
  214. package/dist/secrets/headless/useSecretDetail.js +88 -0
  215. package/dist/secrets/headless/useSecretTypes.d.ts +16 -0
  216. package/dist/secrets/headless/useSecretTypes.js +62 -0
  217. package/dist/secrets/headless/useSecrets.d.ts +24 -0
  218. package/dist/secrets/headless/useSecrets.js +59 -0
  219. package/dist/secrets/headless/useTotpCode.d.ts +24 -0
  220. package/dist/secrets/headless/useTotpCode.js +116 -0
  221. package/dist/secrets/ui/components/CardImages.d.ts +31 -0
  222. package/dist/secrets/ui/components/CardImages.js +208 -0
  223. package/dist/secrets/ui/components/DynamicSecretFields.d.ts +10 -0
  224. package/dist/secrets/ui/components/DynamicSecretFields.js +90 -0
  225. package/dist/secrets/ui/components/FieldDefinitionBuilder.d.ts +13 -0
  226. package/dist/secrets/ui/components/FieldDefinitionBuilder.js +114 -0
  227. package/dist/secrets/ui/components/FieldOptionsEditor.d.ts +15 -0
  228. package/dist/secrets/ui/components/FieldOptionsEditor.js +45 -0
  229. package/dist/secrets/ui/components/SecretAttachments.d.ts +15 -0
  230. package/dist/secrets/ui/components/SecretAttachments.js +106 -0
  231. package/dist/secrets/ui/components/SecretForm.d.ts +34 -0
  232. package/dist/secrets/ui/components/SecretForm.js +83 -0
  233. package/dist/secrets/ui/components/SecretFormDialog.d.ts +15 -0
  234. package/dist/secrets/ui/components/SecretFormDialog.js +95 -0
  235. package/dist/secrets/ui/components/SecretTypeFormDialog.d.ts +15 -0
  236. package/dist/secrets/ui/components/SecretTypeFormDialog.js +92 -0
  237. package/dist/secrets/ui/components/SecretTypeIcon.d.ts +8 -0
  238. package/dist/secrets/ui/components/SecretTypeIcon.js +16 -0
  239. package/dist/secrets/ui/components/SecretTypesList.d.ts +10 -0
  240. package/dist/secrets/ui/components/SecretTypesList.js +13 -0
  241. package/dist/secrets/ui/components/SecretValueField.d.ts +20 -0
  242. package/dist/secrets/ui/components/SecretValueField.js +52 -0
  243. package/dist/secrets/ui/components/SecretVersionDrawer.d.ts +22 -0
  244. package/dist/secrets/ui/components/SecretVersionDrawer.js +131 -0
  245. package/dist/secrets/ui/components/SecretsTable.d.ts +49 -0
  246. package/dist/secrets/ui/components/SecretsTable.js +174 -0
  247. package/dist/secrets/ui/components/TotpCodeCard.d.ts +8 -0
  248. package/dist/secrets/ui/components/TotpCodeCard.js +34 -0
  249. package/dist/secrets/ui/index.d.ts +20 -0
  250. package/dist/secrets/ui/index.js +21 -0
  251. package/dist/secrets/ui/pages/CreateSecretPage.d.ts +2 -0
  252. package/dist/secrets/ui/pages/CreateSecretPage.js +25 -0
  253. package/dist/secrets/ui/pages/CreateSecretTypePage.d.ts +1 -0
  254. package/dist/secrets/ui/pages/CreateSecretTypePage.js +62 -0
  255. package/dist/secrets/ui/pages/EditSecretPage.d.ts +5 -0
  256. package/dist/secrets/ui/pages/EditSecretPage.js +55 -0
  257. package/dist/secrets/ui/pages/EditSecretTypePage.d.ts +1 -0
  258. package/dist/secrets/ui/pages/EditSecretTypePage.js +88 -0
  259. package/dist/secrets/ui/pages/SecretDetailPage.d.ts +7 -0
  260. package/dist/secrets/ui/pages/SecretDetailPage.js +191 -0
  261. package/dist/secrets/ui/pages/SecretTypesPage.d.ts +1 -0
  262. package/dist/secrets/ui/pages/SecretTypesPage.js +23 -0
  263. package/dist/secrets/ui/pages/SecretsPage.d.ts +6 -0
  264. package/dist/secrets/ui/pages/SecretsPage.js +179 -0
  265. package/dist/settings/ui/components/FeatureFlagsList.d.ts +7 -0
  266. package/dist/settings/ui/components/FeatureFlagsList.js +46 -0
  267. package/dist/settings/ui/components/ImageUpload.d.ts +6 -0
  268. package/dist/settings/ui/components/ImageUpload.js +61 -0
  269. package/dist/settings/ui/components/ProfileSettings.d.ts +11 -0
  270. package/dist/settings/ui/components/ProfileSettings.js +55 -0
  271. package/dist/settings/ui/components/ThemeSettings.d.ts +7 -0
  272. package/dist/settings/ui/components/ThemeSettings.js +24 -0
  273. package/dist/settings/ui/components/UISettings.d.ts +9 -0
  274. package/dist/settings/ui/components/UISettings.js +25 -0
  275. package/dist/settings/ui/components/UserProfileCard.d.ts +1 -0
  276. package/dist/settings/ui/components/UserProfileCard.js +39 -0
  277. package/dist/settings/ui/components/UserSettingsSection.d.ts +23 -0
  278. package/dist/settings/ui/components/UserSettingsSection.js +29 -0
  279. package/dist/settings/ui/index.d.ts +10 -0
  280. package/dist/settings/ui/index.js +11 -0
  281. package/dist/settings/ui/pages/AppearanceSettingsPage.d.ts +6 -0
  282. package/dist/settings/ui/pages/AppearanceSettingsPage.js +11 -0
  283. package/dist/settings/ui/pages/GeneralSettingsPage.d.ts +9 -0
  284. package/dist/settings/ui/pages/GeneralSettingsPage.js +41 -0
  285. package/dist/settings/ui/pages/ProfileSettingsPage.d.ts +6 -0
  286. package/dist/settings/ui/pages/ProfileSettingsPage.js +12 -0
  287. package/package.json +144 -4
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Link } from '@mui/material';
3
+ import { Link as RouterLink } from 'react-router-dom';
4
+ import { usePermissions } from '@marinoscar/platform-web/identity/headless';
5
+ /**
6
+ * The Console's Storage card (E6.1 web follow-up): the packaged
7
+ * `StorageConfigPage`, where an administrator sets the bucket and its key.
8
+ * Since E6.1 (#84) object storage is runtime configuration, never environment
9
+ * variables, so every "storage is not configured" hint points here.
10
+ */
11
+ export const STORAGE_SETTINGS_PATH = '/admin/settings/storage';
12
+ /** The exact string the platform's storage-config controller enforces on its GET. */
13
+ export const STORAGE_SETTINGS_PERMISSION = 'storage_config:read';
14
+ export const STORAGE_SETTINGS_LINK_LABEL = 'Set up storage in Console → Storage';
15
+ /**
16
+ * A link to the Storage card, rendered only for a viewer who can open it
17
+ * (`storage_config:read`); for anyone else it renders nothing, so the hint
18
+ * around it reads as "ask an administrator". Hiding it is presentation only:
19
+ * the route and the API enforce the permission.
20
+ */
21
+ export function StorageSettingsLink({ label = STORAGE_SETTINGS_LINK_LABEL }) {
22
+ const { hasPermission } = usePermissions();
23
+ if (!hasPermission(STORAGE_SETTINGS_PERMISSION))
24
+ return null;
25
+ return (_jsx(Link, { component: RouterLink, to: STORAGE_SETTINGS_PATH, "data-testid": "storage-settings-link", children: label }));
26
+ }
@@ -0,0 +1,4 @@
1
+ export * from './ErrorBoundary.js';
2
+ export * from './LoadingSpinner.js';
3
+ export * from './SettingsPageFrame.js';
4
+ export * from './StorageSettingsLink.js';
@@ -0,0 +1,5 @@
1
+ // Components every slice uses: the spinner, the error boundary, the settings-page frame and the storage-settings link.
2
+ export * from './ErrorBoundary.js';
3
+ export * from './LoadingSpinner.js';
4
+ export * from './SettingsPageFrame.js';
5
+ export * from './StorageSettingsLink.js';
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Where the Home dashboard links to, in one place.
3
+ *
4
+ * The backup links point at their settings cards (E10.3, #94): the user's
5
+ * My backups card and the Console's Backups card.
6
+ */
7
+ export declare const HOME_LINKS: {
8
+ readonly secrets: "/secrets";
9
+ readonly newSecret: "/secrets/new";
10
+ readonly secretDetail: (id: string) => string;
11
+ readonly cards: "/cards";
12
+ /**
13
+ * The Cards gallery filtered to cards that need attention (expired or
14
+ * expiring within 60 days). The gallery reads `?filter=attention` (E10.5).
15
+ */
16
+ readonly cardsNeedingAttention: "/cards?filter=attention";
17
+ readonly scanCard: "/cards/import";
18
+ readonly renewCard: (id: string) => string;
19
+ readonly media: "/media";
20
+ /** The user's My backups card (`USER_SETTINGS_SECTIONS`). */
21
+ readonly myBackups: "/settings/backups";
22
+ /** The Console's Backups card (`ADMIN_SECTIONS`): the scheduled system backups. */
23
+ readonly systemBackups: "/admin/settings/backups";
24
+ };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Where the Home dashboard links to, in one place.
3
+ *
4
+ * The backup links point at their settings cards (E10.3, #94): the user's
5
+ * My backups card and the Console's Backups card.
6
+ */
7
+ export const HOME_LINKS = {
8
+ secrets: '/secrets',
9
+ newSecret: '/secrets/new',
10
+ secretDetail: (id) => `/secrets/${encodeURIComponent(id)}`,
11
+ cards: '/cards',
12
+ /**
13
+ * The Cards gallery filtered to cards that need attention (expired or
14
+ * expiring within 60 days). The gallery reads `?filter=attention` (E10.5).
15
+ */
16
+ cardsNeedingAttention: '/cards?filter=attention',
17
+ scanCard: '/cards/import',
18
+ renewCard: (id) => `/cards/${encodeURIComponent(id)}/renew`,
19
+ media: '/media',
20
+ /** The user's My backups card (`USER_SETTINGS_SECTIONS`). */
21
+ myBackups: '/settings/backups',
22
+ /** The Console's Backups card (`ADMIN_SECTIONS`): the scheduled system backups. */
23
+ systemBackups: '/admin/settings/backups',
24
+ };
@@ -0,0 +1 @@
1
+ export * from './homeLinks.js';
@@ -0,0 +1,2 @@
1
+ // Home: the links the dashboard panels share. No component.
2
+ export * from './homeLinks.js';
@@ -0,0 +1,28 @@
1
+ import type { DashboardResource } from '../../../core/headless/useDashboardResource.js';
2
+ import type { BackupRun, BackupRunsResponse, BackupSchedule } from '../../../core/headless/types.js';
3
+ /** The system backup source: the newest run and the schedule, fetched together. */
4
+ export interface SystemBackupStatus {
5
+ latest: BackupRun | null;
6
+ schedule: BackupSchedule;
7
+ }
8
+ /**
9
+ * A schedule whose next run is this far in the past has not started when it
10
+ * should have (the runner checks every minute), so the backups are stale.
11
+ */
12
+ export declare const BACKUP_OVERDUE_GRACE_MS: number;
13
+ export declare function isScheduleOverdue(schedule: BackupSchedule, now: Date): boolean;
14
+ interface BackupStatusPanelProps {
15
+ /** The user's saved backups (`GET /api/backups/me?pageSize=1`); null when not permitted. */
16
+ mine: DashboardResource<BackupRunsResponse> | null;
17
+ /** Admin only (`system_settings:read`); null hides the block. */
18
+ system: DashboardResource<SystemBackupStatus> | null;
19
+ phoneOrder?: number;
20
+ now?: Date;
21
+ }
22
+ /**
23
+ * The newest backup of the user and, for administrators, the newest
24
+ * scheduled run with the schedule's health. A failed or overdue system backup
25
+ * says so in words, with a link to the backup settings.
26
+ */
27
+ export declare function BackupStatusPanel({ mine, system, phoneOrder, now }: BackupStatusPanelProps): import("react").JSX.Element | null;
28
+ export {};
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, Button, Divider, Skeleton, Typography } from '@mui/material';
3
+ import { CheckCircleOutlineOutlined as SucceededIcon, ErrorOutlineOutlined as FailedIcon, Sync as RunningIcon, CloudOffOutlined as NoneIcon, ScheduleOutlined as OverdueIcon, Backup as BackupIcon, } from '@mui/icons-material';
4
+ import { Link as RouterLink } from 'react-router-dom';
5
+ import { formatBytes } from '../../../backups/headless/backupSchedule.js';
6
+ import { formatRelativeTime } from '../../../core/headless/relativeTime.js';
7
+ import { DashboardPanel, PanelError } from './DashboardPanel.js';
8
+ import { HOME_LINKS } from '../../headless/homeLinks.js';
9
+ /**
10
+ * A schedule whose next run is this far in the past has not started when it
11
+ * should have (the runner checks every minute), so the backups are stale.
12
+ */
13
+ export const BACKUP_OVERDUE_GRACE_MS = 60 * 60 * 1000;
14
+ export function isScheduleOverdue(schedule, now) {
15
+ if (!schedule.enabled || !schedule.nextRunAt)
16
+ return false;
17
+ const next = new Date(schedule.nextRunAt).getTime();
18
+ return !Number.isNaN(next) && now.getTime() - next > BACKUP_OVERDUE_GRACE_MS;
19
+ }
20
+ function presentRun(run) {
21
+ if (!run)
22
+ return { tone: 'neutral', icon: _jsx(NoneIcon, { fontSize: "small" }), label: 'No backup yet' };
23
+ switch (run.status) {
24
+ case 'succeeded':
25
+ return { tone: 'success', icon: _jsx(SucceededIcon, { fontSize: "small" }), label: 'Last backup succeeded' };
26
+ case 'failed':
27
+ return { tone: 'error', icon: _jsx(FailedIcon, { fontSize: "small" }), label: 'Last backup failed' };
28
+ case 'running':
29
+ default:
30
+ return { tone: 'primary', icon: _jsx(RunningIcon, { fontSize: "small" }), label: 'Backup running' };
31
+ }
32
+ }
33
+ const TONE_COLOR = {
34
+ success: 'success.main',
35
+ error: 'error.main',
36
+ primary: 'primary.main',
37
+ warning: 'warning.main',
38
+ neutral: 'text.secondary',
39
+ };
40
+ function runDetail(run, now) {
41
+ const when = formatRelativeTime(run.finishedAt ?? run.startedAt, now);
42
+ const parts = [run.status === 'running' ? `started ${when}` : when];
43
+ if (run.status === 'succeeded' && run.sizeBytes !== null)
44
+ parts.push(formatBytes(run.sizeBytes));
45
+ if (run.status === 'succeeded')
46
+ parts.push(`${run.secretCount} secret${run.secretCount === 1 ? '' : 's'}`);
47
+ return parts.join(' · ');
48
+ }
49
+ /** One status line: an icon and a label (never colour alone), plus a detail. */
50
+ function StatusLine({ tone, icon, label, detail }) {
51
+ return (_jsxs(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: 1.25, minWidth: 0 }, children: [_jsx(Box, { sx: { display: 'flex', color: TONE_COLOR[tone], mt: '1px', flexShrink: 0 }, children: icon }), _jsxs(Box, { sx: { minWidth: 0 }, children: [_jsx(Typography, { variant: "body2", sx: { fontWeight: 500 }, children: label }), detail && (_jsx(Typography, { variant: "caption", component: "div", sx: { color: 'text.secondary', overflowWrap: 'anywhere' }, children: detail }))] })] }));
52
+ }
53
+ function BlockSkeleton() {
54
+ return (_jsxs(Box, { "aria-busy": "true", sx: { display: 'flex', gap: 1.25, py: 0.5 }, children: [_jsx(Skeleton, { variant: "circular", width: 20, height: 20 }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Skeleton, { width: "60%", height: 20 }), _jsx(Skeleton, { width: "40%", height: 16 })] })] }));
55
+ }
56
+ function BlockLabel({ children }) {
57
+ return (_jsx(Typography, { variant: "overline", component: "h3", sx: { display: 'block', color: 'text.secondary', lineHeight: 1.6, mb: 0.75, letterSpacing: '0.06em' }, children: children }));
58
+ }
59
+ /**
60
+ * The newest backup of the user and, for administrators, the newest
61
+ * scheduled run with the schedule's health. A failed or overdue system backup
62
+ * says so in words, with a link to the backup settings.
63
+ */
64
+ export function BackupStatusPanel({ mine, system, phoneOrder, now = new Date() }) {
65
+ if (!mine && !system)
66
+ return null;
67
+ return (_jsxs(DashboardPanel, { title: "Backups", phoneOrder: phoneOrder, testId: "home-backups", children: [mine && (_jsxs(Box, { "data-testid": "home-backups-mine", children: [_jsx(BlockLabel, { children: "Your backups" }), mine.status === 'loading' && _jsx(BlockSkeleton, {}), mine.status === 'error' && (_jsx(PanelError, { message: mine.error ?? 'Could not load your backups.', onRetry: mine.reload })), mine.status === 'ready' && (() => {
68
+ const latest = mine.data?.items[0] ?? null;
69
+ const presentation = presentRun(latest);
70
+ return (_jsxs(Box, { sx: {
71
+ display: 'flex',
72
+ alignItems: { xs: 'stretch', sm: 'center' },
73
+ flexDirection: { xs: 'column', sm: 'row' },
74
+ gap: 1.5,
75
+ }, children: [_jsx(Box, { sx: { flexGrow: 1, minWidth: 0 }, children: _jsx(StatusLine, { ...presentation, label: latest ? presentation.label : 'You have not saved a backup yet', detail: latest
76
+ ? runDetail(latest, now)
77
+ : 'Keep an encrypted copy of your secrets in storage.' }) }), _jsx(Button, { component: RouterLink, to: HOME_LINKS.myBackups, variant: "outlined", size: "small", startIcon: _jsx(BackupIcon, {}), sx: { flexShrink: 0, alignSelf: { xs: 'flex-start', sm: 'center' }, ml: { xs: '30px', sm: 0 } }, children: "Back up now" })] }));
78
+ })()] })), mine && system && _jsx(Divider, { sx: { my: 2 } }), system && (_jsxs(Box, { "data-testid": "home-backups-system", children: [_jsx(BlockLabel, { children: "System backups" }), system.status === 'loading' && _jsx(BlockSkeleton, {}), system.status === 'error' && (_jsx(PanelError, { message: system.error ?? 'Could not load the system backups.', onRetry: system.reload })), system.status === 'ready' && system.data && (_jsx(SystemBlock, { status: system.data, now: now }))] }))] }));
79
+ }
80
+ function SystemBlock({ status, now }) {
81
+ const { latest, schedule } = status;
82
+ const overdue = isScheduleOverdue(schedule, now);
83
+ const failed = latest?.status === 'failed';
84
+ const presentation = presentRun(latest);
85
+ let scheduleLine;
86
+ if (!schedule.enabled) {
87
+ scheduleLine = 'Schedule off';
88
+ }
89
+ else if (schedule.nextRunAt && !overdue) {
90
+ scheduleLine = `Scheduled · next run ${formatRelativeTime(schedule.nextRunAt, now)}`;
91
+ }
92
+ else {
93
+ scheduleLine = 'Scheduled';
94
+ }
95
+ const lastRunDetail = latest
96
+ ? [runDetail(latest, now), failed && latest.error ? latest.error : null].filter(Boolean).join(' · ')
97
+ : null;
98
+ return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 1.25 }, children: [_jsx(StatusLine, { ...presentation, detail: _jsxs(_Fragment, { children: [lastRunDetail && _jsx(Box, { component: "span", sx: { display: 'block' }, children: lastRunDetail }), !overdue && _jsx(Box, { component: "span", sx: { display: 'block' }, children: scheduleLine })] }) }), overdue && (_jsx(StatusLine, { tone: "warning", icon: _jsx(OverdueIcon, { fontSize: "small" }), label: "Scheduled backup overdue", detail: `The run due ${formatRelativeTime(schedule.nextRunAt, now)} has not started.` })), (failed || overdue || !schedule.enabled) && (_jsx(Box, { children: _jsx(Button, { component: RouterLink, to: HOME_LINKS.systemBackups, size: "small", sx: { ml: '25px', mt: -0.5 }, children: "Open backup settings" }) }))] }));
99
+ }
@@ -0,0 +1,33 @@
1
+ import type { ReactNode } from 'react';
2
+ interface DashboardPanelProps {
3
+ title: string;
4
+ /** One short line under the title. */
5
+ subtitle?: string;
6
+ /** Header link, e.g. "View all". */
7
+ action?: {
8
+ label: string;
9
+ to: string;
10
+ ariaLabel?: string;
11
+ };
12
+ children: ReactNode;
13
+ /** Order in the phone's single column (urgency first); reset from `md`. */
14
+ phoneOrder?: number;
15
+ testId?: string;
16
+ }
17
+ /**
18
+ * The frame every Home panel shares: an outlined card that is a labelled
19
+ * `section` landmark, a heading level 2 and an optional header link.
20
+ */
21
+ export declare function DashboardPanel({ title, subtitle, action, children, phoneOrder, testId }: DashboardPanelProps): import("react").JSX.Element;
22
+ /** A panel's error state: what failed and a way to try again. */
23
+ export declare function PanelError({ message, onRetry }: {
24
+ message: string;
25
+ onRetry: () => void;
26
+ }): import("react").JSX.Element;
27
+ /** A panel's empty state: one calm sentence, an optional icon and action. */
28
+ export declare function PanelEmpty({ icon, children, action }: {
29
+ icon?: ReactNode;
30
+ children: ReactNode;
31
+ action?: ReactNode;
32
+ }): import("react").JSX.Element;
33
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useId } from 'react';
3
+ import { Alert, Box, Button, Card, Typography } from '@mui/material';
4
+ import { ChevronRight as ChevronRightIcon } from '@mui/icons-material';
5
+ import { Link as RouterLink } from 'react-router-dom';
6
+ /**
7
+ * The frame every Home panel shares: an outlined card that is a labelled
8
+ * `section` landmark, a heading level 2 and an optional header link.
9
+ */
10
+ export function DashboardPanel({ title, subtitle, action, children, phoneOrder, testId }) {
11
+ const headingId = useId();
12
+ return (_jsx(Card, { variant: "outlined", component: "section", "aria-labelledby": headingId, "data-testid": testId, sx: { order: { xs: phoneOrder ?? 0, md: 0 }, minWidth: 0 }, children: _jsxs(Box, { sx: { p: { xs: 2, sm: 2.5 } }, children: [_jsxs(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: 1, mb: 1.5 }, children: [_jsxs(Box, { sx: { flexGrow: 1, minWidth: 0 }, children: [_jsx(Typography, { id: headingId, variant: "subtitle1", component: "h2", sx: { fontWeight: 600, lineHeight: 1.4 }, children: title }), subtitle && (_jsx(Typography, { variant: "body2", sx: { color: 'text.secondary' }, children: subtitle }))] }), action && (_jsx(Button, { component: RouterLink, to: action.to, size: "small", endIcon: _jsx(ChevronRightIcon, {}), "aria-label": action.ariaLabel, sx: { flexShrink: 0, mt: -0.25, mr: -1 }, children: action.label }))] }), children] }) }));
13
+ }
14
+ /** A panel's error state: what failed and a way to try again. */
15
+ export function PanelError({ message, onRetry }) {
16
+ return (_jsx(Alert, { severity: "error", variant: "outlined", action: _jsx(Button, { color: "inherit", size: "small", onClick: onRetry, children: "Try again" }), children: message }));
17
+ }
18
+ /** A panel's empty state: one calm sentence, an optional icon and action. */
19
+ export function PanelEmpty({ icon, children, action }) {
20
+ return (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.5, py: 1.5, color: 'text.secondary' }, children: [icon && _jsx(Box, { sx: { display: 'flex', flexShrink: 0 }, children: icon }), _jsx(Typography, { variant: "body2", sx: { flexGrow: 1, color: 'text.secondary' }, children: children }), action] }));
21
+ }
@@ -0,0 +1,31 @@
1
+ import type { CardSummary } from '../../../cards/headless/useCards.js';
2
+ import type { DashboardResourceStatus } from '../../../core/headless/useDashboardResource.js';
3
+ /**
4
+ * A row's secondary line, `•••• 4242 · Exp 12/26`. A card the summary could not
5
+ * read (null last4 or expiry) shows a dash in that place, never a guess.
6
+ */
7
+ export declare function cardMetaLine(card: Pick<CardSummary, 'maskedNumber' | 'expiryLabel'>): string;
8
+ /** Rows shown on Home; the rest are one click away in the filtered gallery. */
9
+ export declare const EXPIRING_CARDS_LIMIT = 5;
10
+ interface ExpiringCardsPanelProps {
11
+ status: Exclude<DashboardResourceStatus, 'idle'>;
12
+ /**
13
+ * The loaded cards, soonest expiry first (as `useCards` returns them). Home
14
+ * loads with scope `attention`, so this holds every card needing attention
15
+ * and may stop short of the rest of the wallet.
16
+ */
17
+ cards: CardSummary[];
18
+ /** Cards in the whole wallet (the summary's `totalItems`). */
19
+ totalCards: number;
20
+ error: string | null;
21
+ onRetry: () => void;
22
+ /** `secrets:write`: rows open the renew flow; otherwise the card's detail. */
23
+ canRenew: boolean;
24
+ phoneOrder?: number;
25
+ }
26
+ /**
27
+ * Cards that are expired or expire within 60 days, soonest first. Never the
28
+ * full number: rows show the masked number and the `MM/YY` only.
29
+ */
30
+ export declare function ExpiringCardsPanel({ status, cards, totalCards, error, onRetry, canRenew, phoneOrder, }: ExpiringCardsPanelProps): import("react").JSX.Element;
31
+ export {};
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Box, List, ListItem, ListItemButton, ListItemText, Skeleton, Typography } from '@mui/material';
3
+ import { CreditCard as CardIcon, EventAvailableOutlined as AllClearIcon } from '@mui/icons-material';
4
+ import { Link as RouterLink } from 'react-router-dom';
5
+ import { CardExpiryBadge } from '../../../cards/ui/components/CardExpiryBadge.js';
6
+ import { EXPIRING_SOON_DAYS, isNeedsAttention } from '../../../cards/headless/cardExpiry.js';
7
+ import { DashboardPanel, PanelEmpty, PanelError } from './DashboardPanel.js';
8
+ import { HOME_LINKS } from '../../headless/homeLinks.js';
9
+ /**
10
+ * A row's secondary line, `•••• 4242 · Exp 12/26`. A card the summary could not
11
+ * read (null last4 or expiry) shows a dash in that place, never a guess.
12
+ */
13
+ export function cardMetaLine(card) {
14
+ return `${card.maskedNumber || '•••• —'} · Exp ${card.expiryLabel || '—'}`;
15
+ }
16
+ /** Rows shown on Home; the rest are one click away in the filtered gallery. */
17
+ export const EXPIRING_CARDS_LIMIT = 5;
18
+ /**
19
+ * Cards that are expired or expire within 60 days, soonest first. Never the
20
+ * full number: rows show the masked number and the `MM/YY` only.
21
+ */
22
+ export function ExpiringCardsPanel({ status, cards, totalCards, error, onRetry, canRenew, phoneOrder, }) {
23
+ const attention = cards.filter((card) => isNeedsAttention(card.status));
24
+ const shown = attention.slice(0, EXPIRING_CARDS_LIMIT);
25
+ const hidden = attention.length - shown.length;
26
+ return (_jsxs(DashboardPanel, { title: "Cards needing attention", subtitle: `Expired or expiring within ${EXPIRING_SOON_DAYS} days`, action: { label: 'View', to: HOME_LINKS.cardsNeedingAttention, ariaLabel: 'View cards needing attention' }, phoneOrder: phoneOrder, testId: "home-expiring-cards", children: [status === 'loading' && (_jsx(Box, { "aria-busy": "true", "aria-label": "Loading cards", children: [0, 1].map((i) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.5, py: 1 }, children: [_jsx(Skeleton, { variant: "rounded", width: 24, height: 24 }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Skeleton, { width: "55%", height: 20 }), _jsx(Skeleton, { width: "35%", height: 16 })] }), _jsx(Skeleton, { variant: "rounded", width: 92, height: 24 })] }, i))) })), status === 'error' && _jsx(PanelError, { message: error ?? 'Could not load your cards.', onRetry: onRetry }), status === 'ready' && attention.length === 0 && (_jsx(PanelEmpty, { icon: _jsx(AllClearIcon, { color: "success" }), children: totalCards === 0
27
+ ? 'No cards saved yet.'
28
+ : `No card expires in the next ${EXPIRING_SOON_DAYS} days.` })), status === 'ready' && shown.length > 0 && (_jsxs(_Fragment, { children: [_jsx(List, { disablePadding: true, "aria-label": "Cards needing attention", children: shown.map((card) => {
29
+ const meta = cardMetaLine(card);
30
+ return (_jsx(ListItem, { disablePadding: true, children: _jsxs(ListItemButton, { component: RouterLink, to: canRenew ? HOME_LINKS.renewCard(card.id) : HOME_LINKS.secretDetail(card.id), sx: { borderRadius: 1, px: 1, mx: -1, gap: 1.5, minHeight: 48 }, children: [_jsx(CardIcon, { fontSize: "small", sx: { color: 'text.secondary', flexShrink: 0 } }), _jsx(ListItemText, { primary: card.name, secondary: meta, sx: { my: 0.5, minWidth: 0 }, slotProps: {
31
+ primary: { noWrap: true, variant: 'body2', sx: { fontWeight: 500 } },
32
+ secondary: { noWrap: true, variant: 'caption' },
33
+ } }), _jsx(Box, { sx: { flexShrink: 0 }, children: _jsx(CardExpiryBadge, { status: card.status, expiryLabel: card.expiryLabel }) })] }) }, card.id));
34
+ }) }), hidden > 0 && (_jsx(Typography, { variant: "caption", sx: { display: 'block', mt: 1, color: 'text.secondary' }, children: `+${hidden} more in Cards` }))] }))] }));
35
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * First run (no secrets yet): one call to action instead of a row of empty
3
+ * panels.
4
+ */
5
+ export declare function FirstRunPanel({ canCreate }: {
6
+ canCreate: boolean;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button, Card, Typography } from '@mui/material';
3
+ import { Add as AddIcon, LockOutlined as LockIcon } from '@mui/icons-material';
4
+ import { Link as RouterLink } from 'react-router-dom';
5
+ import { HOME_LINKS } from '../../headless/homeLinks.js';
6
+ /**
7
+ * First run (no secrets yet): one call to action instead of a row of empty
8
+ * panels.
9
+ */
10
+ export function FirstRunPanel({ canCreate }) {
11
+ return (_jsx(Card, { variant: "outlined", component: "section", "aria-labelledby": "home-first-run-title", "data-testid": "home-first-run", children: _jsxs(Box, { sx: { p: { xs: 3, sm: 4 }, display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', gap: 1.5 }, children: [_jsx(Box, { sx: {
12
+ width: 56,
13
+ height: 56,
14
+ borderRadius: '50%',
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ bgcolor: 'secondary.main',
19
+ color: 'secondary.contrastText',
20
+ }, children: _jsx(LockIcon, {}) }), _jsx(Typography, { id: "home-first-run-title", variant: "h6", component: "h2", sx: { fontWeight: 600 }, children: "Your vault is empty" }), _jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', maxWidth: 420 }, children: "Store logins, API keys, payment cards and notes, encrypted and versioned." }), canCreate && (_jsx(Button, { component: RouterLink, to: HOME_LINKS.newSecret, variant: "contained", startIcon: _jsx(AddIcon, {}), sx: { mt: 1 }, children: "Add your first secret" }))] }) }));
21
+ }
@@ -0,0 +1,14 @@
1
+ interface QuickActionsProps {
2
+ /** `secrets:write` */
3
+ canCreateSecret: boolean;
4
+ /** `secrets:write` and card scanning available (`useAiStatus`, from `GET /api/ai/config`). */
5
+ canScanCard: boolean;
6
+ /** `secrets:read` (`/api/backups/me`). */
7
+ canBackUp: boolean;
8
+ }
9
+ /**
10
+ * The few things people come to Home to start. Each is a link (the work
11
+ * happens on its own page) and appears only for a user who may do it.
12
+ */
13
+ export declare function QuickActions({ canCreateSecret, canScanCard, canBackUp }: QuickActionsProps): import("react").JSX.Element | null;
14
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button } from '@mui/material';
3
+ import { Add as AddIcon, DocumentScannerOutlined as ScanIcon, Backup as BackupIcon, } from '@mui/icons-material';
4
+ import { Link as RouterLink } from 'react-router-dom';
5
+ import { HOME_LINKS } from '../../headless/homeLinks.js';
6
+ /**
7
+ * The few things people come to Home to start. Each is a link (the work
8
+ * happens on its own page) and appears only for a user who may do it.
9
+ */
10
+ export function QuickActions({ canCreateSecret, canScanCard, canBackUp }) {
11
+ const actions = [];
12
+ if (canCreateSecret) {
13
+ actions.push({ key: 'new-secret', label: 'New secret', to: HOME_LINKS.newSecret, icon: _jsx(AddIcon, {}), primary: true });
14
+ }
15
+ if (canScanCard) {
16
+ actions.push({ key: 'scan-card', label: 'Scan a card', to: HOME_LINKS.scanCard, icon: _jsx(ScanIcon, {}) });
17
+ }
18
+ if (canBackUp) {
19
+ actions.push({ key: 'back-up', label: 'Back up now', to: HOME_LINKS.myBackups, icon: _jsx(BackupIcon, {}) });
20
+ }
21
+ if (actions.length === 0)
22
+ return null;
23
+ return (_jsx(Box, { component: "nav", "aria-label": "Quick actions", sx: {
24
+ display: 'grid',
25
+ // Phone: equal columns, icon over label, so three actions fit 390px
26
+ // without wrapping. Wider: a compact row of ordinary buttons.
27
+ gridTemplateColumns: { xs: `repeat(${actions.length}, minmax(0, 1fr))`, sm: `repeat(${actions.length}, auto)` },
28
+ gap: 1,
29
+ justifyContent: { sm: 'end' },
30
+ }, children: actions.map((action) => (_jsxs(Button, { component: RouterLink, to: action.to, variant: action.primary ? 'contained' : 'outlined', sx: {
31
+ flexDirection: { xs: 'column', sm: 'row' },
32
+ gap: { xs: 0.25, sm: 1 },
33
+ py: { xs: 1, sm: 0.75 },
34
+ px: { xs: 1, sm: 2 },
35
+ minHeight: 44,
36
+ whiteSpace: 'nowrap',
37
+ lineHeight: 1.3,
38
+ '& .MuiSvgIcon-root': { fontSize: 20 },
39
+ }, children: [action.icon, action.label] }, action.key))) }));
40
+ }
@@ -0,0 +1,19 @@
1
+ import type { DashboardResourceStatus } from '../../../core/headless/useDashboardResource.js';
2
+ import type { SecretListItem } from '../../../core/headless/types.js';
3
+ /** How many recently updated secrets Home lists (one `GET /api/secrets` page). */
4
+ export declare const RECENT_SECRETS_LIMIT = 5;
5
+ interface RecentSecretsPanelProps {
6
+ status: Exclude<DashboardResourceStatus, 'idle'>;
7
+ secrets: SecretListItem[];
8
+ error: string | null;
9
+ onRetry: () => void;
10
+ canCreate: boolean;
11
+ phoneOrder?: number;
12
+ now?: Date;
13
+ }
14
+ /**
15
+ * The most recently updated secrets: name, type and age only. List responses
16
+ * are never decrypted, so no value can reach this panel.
17
+ */
18
+ export declare function RecentSecretsPanel({ status, secrets, error, onRetry, canCreate, phoneOrder, now, }: RecentSecretsPanelProps): import("react").JSX.Element;
19
+ export {};
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Button, List, ListItem, ListItemButton, ListItemText, Skeleton, Typography } from '@mui/material';
3
+ import { Add as AddIcon, LockOutlined as EmptyIcon } from '@mui/icons-material';
4
+ import { Link as RouterLink } from 'react-router-dom';
5
+ import { SecretTypeIcon } from '../../../secrets/ui/components/SecretTypeIcon.js';
6
+ import { formatRelativeTime } from '../../../core/headless/relativeTime.js';
7
+ import { DashboardPanel, PanelEmpty, PanelError } from './DashboardPanel.js';
8
+ import { HOME_LINKS } from '../../headless/homeLinks.js';
9
+ /** How many recently updated secrets Home lists (one `GET /api/secrets` page). */
10
+ export const RECENT_SECRETS_LIMIT = 5;
11
+ /**
12
+ * The most recently updated secrets: name, type and age only. List responses
13
+ * are never decrypted, so no value can reach this panel.
14
+ */
15
+ export function RecentSecretsPanel({ status, secrets, error, onRetry, canCreate, phoneOrder, now = new Date(), }) {
16
+ return (_jsxs(DashboardPanel, { title: "Recently updated", action: { label: 'View all', to: HOME_LINKS.secrets, ariaLabel: 'View all secrets' }, phoneOrder: phoneOrder, testId: "home-recent-secrets", children: [status === 'loading' && (_jsx(Box, { "aria-busy": "true", "aria-label": "Loading recent secrets", children: Array.from({ length: RECENT_SECRETS_LIMIT }).map((_, i) => (_jsxs(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1.5, py: 1 }, children: [_jsx(Skeleton, { variant: "circular", width: 24, height: 24 }), _jsxs(Box, { sx: { flexGrow: 1 }, children: [_jsx(Skeleton, { width: "50%", height: 20 }), _jsx(Skeleton, { width: "30%", height: 16 })] })] }, i))) })), status === 'error' && (_jsx(PanelError, { message: error ?? 'Could not load your recent secrets.', onRetry: onRetry })), status === 'ready' && secrets.length === 0 && (_jsx(PanelEmpty, { icon: _jsx(EmptyIcon, {}), action: canCreate ? (_jsx(Button, { component: RouterLink, to: HOME_LINKS.newSecret, size: "small", startIcon: _jsx(AddIcon, {}), children: "New secret" })) : undefined, children: "No secrets yet." })), status === 'ready' && secrets.length > 0 && (_jsx(List, { disablePadding: true, "aria-label": "Recently updated secrets", children: secrets.map((secret) => (_jsx(ListItem, { disablePadding: true, children: _jsxs(ListItemButton, { component: RouterLink, to: HOME_LINKS.secretDetail(secret.id), sx: { borderRadius: 1, px: 1, mx: -1, gap: 1.5, minHeight: 48 }, children: [_jsx(Box, { sx: { display: 'flex', color: 'primary.main', flexShrink: 0 }, children: _jsx(SecretTypeIcon, { icon: secret.type.icon, fontSize: "small" }) }), _jsx(ListItemText, { primary: secret.name, secondary: secret.type.name, sx: { my: 0.5, minWidth: 0 }, slotProps: {
17
+ primary: { noWrap: true, variant: 'body2', sx: { fontWeight: 500 } },
18
+ secondary: { noWrap: true, variant: 'caption' },
19
+ } }), _jsx(Typography, { variant: "caption", component: "time", dateTime: secret.updatedAt, sx: { color: 'text.secondary', flexShrink: 0, whiteSpace: 'nowrap' }, children: formatRelativeTime(secret.updatedAt, now) })] }) }, secret.id))) }))] }));
20
+ }
@@ -0,0 +1,19 @@
1
+ import type { DashboardResourceStatus } from '../../../core/headless/useDashboardResource.js';
2
+ export interface StatTile {
3
+ key: string;
4
+ label: string;
5
+ /** Null while loading or after the source failed (shown as an em dash). */
6
+ value: number | null;
7
+ status: Exclude<DashboardResourceStatus, 'idle'>;
8
+ to: string;
9
+ /** Draw attention to a non-zero value (e.g. cards that need attention). */
10
+ emphasize?: boolean;
11
+ }
12
+ /**
13
+ * A compact strip of counts, each a link to where the count lives. Every
14
+ * value comes from a response another panel already needs (a list's
15
+ * `totalItems`), except media, which is one `pageSize=1` request.
16
+ */
17
+ export declare function StatsRow({ tiles }: {
18
+ tiles: StatTile[];
19
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, ButtonBase, Card, Skeleton, Typography } from '@mui/material';
3
+ import { Link as RouterLink } from 'react-router-dom';
4
+ /**
5
+ * A compact strip of counts, each a link to where the count lives. Every
6
+ * value comes from a response another panel already needs (a list's
7
+ * `totalItems`), except media, which is one `pageSize=1` request.
8
+ */
9
+ export function StatsRow({ tiles }) {
10
+ if (tiles.length === 0)
11
+ return null;
12
+ return (_jsx(Card, { variant: "outlined", component: "section", "aria-label": "Summary", "data-testid": "home-stats", children: _jsx(Box, { component: "ul", sx: {
13
+ listStyle: 'none',
14
+ m: 0,
15
+ p: 0,
16
+ display: 'grid',
17
+ gridTemplateColumns: {
18
+ xs: `repeat(${Math.min(tiles.length, 2)}, minmax(0, 1fr))`,
19
+ sm: `repeat(${tiles.length}, minmax(0, 1fr))`,
20
+ },
21
+ // Hairlines between cells, never doubled on the outer edge.
22
+ gap: '1px',
23
+ bgcolor: 'divider',
24
+ }, children: tiles.map((tile) => {
25
+ const shown = tile.status === 'ready' && tile.value !== null ? String(tile.value) : '—';
26
+ const attention = tile.emphasize && tile.status === 'ready' && (tile.value ?? 0) > 0;
27
+ return (_jsx(Box, { component: "li", sx: { bgcolor: 'background.paper', minWidth: 0 }, children: _jsxs(ButtonBase, { component: RouterLink, to: tile.to, "aria-label": tile.status === 'ready' ? `View ${tile.label} (${shown})` : `View ${tile.label}`, sx: {
28
+ width: '100%',
29
+ height: '100%',
30
+ display: 'flex',
31
+ flexDirection: 'column',
32
+ alignItems: 'flex-start',
33
+ justifyContent: 'center',
34
+ textAlign: 'left',
35
+ px: { xs: 2, sm: 2.5 },
36
+ py: 1.5,
37
+ '&:hover': { bgcolor: 'action.hover' },
38
+ '&.Mui-focusVisible': { outline: '2px solid', outlineColor: 'primary.main', outlineOffset: '-2px' },
39
+ }, children: [tile.status === 'loading' ? (_jsx(Skeleton, { width: 40, height: 32, "data-testid": `stat-skeleton-${tile.key}` })) : (_jsx(Typography, { component: "span", variant: "h5", sx: {
40
+ fontWeight: 600,
41
+ lineHeight: 1.3,
42
+ fontVariantNumeric: 'tabular-nums',
43
+ color: attention ? 'error.main' : 'text.primary',
44
+ }, children: shown })), _jsx(Typography, { component: "span", variant: "body2", noWrap: true, sx: { color: 'text.secondary', maxWidth: '100%' }, children: tile.label })] }) }, tile.key));
45
+ }) }) }));
46
+ }
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ interface WelcomeHeaderProps {
3
+ displayName: string | null;
4
+ /** Rendered beside the greeting from 600px, under it on a phone. */
5
+ actions?: ReactNode;
6
+ /** Injectable for tests; defaults to the current time. */
7
+ now?: Date;
8
+ }
9
+ export declare function greetingFor(date: Date): string;
10
+ export declare function WelcomeHeader({ displayName, actions, now }: WelcomeHeaderProps): import("react").JSX.Element;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { Typography, Box } from '@mui/material';
3
+ export function greetingFor(date) {
4
+ const hour = date.getHours();
5
+ return hour < 12 ? 'Good morning' : hour < 18 ? 'Good afternoon' : 'Good evening';
6
+ }
7
+ export function WelcomeHeader({ displayName, actions, now = new Date() }) {
8
+ return (_jsxs(Box, { component: "header", sx: {
9
+ display: 'flex',
10
+ flexDirection: { xs: 'column', sm: 'row' },
11
+ alignItems: { xs: 'stretch', sm: 'flex-end' },
12
+ justifyContent: 'space-between',
13
+ gap: 2,
14
+ }, children: [_jsxs(Box, { sx: { minWidth: 0 }, children: [_jsxs(Typography, { variant: "h4", component: "h1", sx: { fontWeight: 700, fontSize: { xs: '1.5rem', sm: '1.875rem' }, lineHeight: 1.25, overflowWrap: 'anywhere' }, children: [greetingFor(now), displayName ? `, ${displayName}` : ''] }), _jsx(Typography, { sx: { color: 'text.secondary', mt: 0.5 }, children: "Here's what's happening in your vault" })] }), actions && _jsx(Box, { sx: { flexShrink: 0 }, children: actions })] }));
15
+ }
@@ -0,0 +1,9 @@
1
+ export * from './components/BackupStatusPanel.js';
2
+ export * from './components/DashboardPanel.js';
3
+ export * from './components/ExpiringCardsPanel.js';
4
+ export * from './components/FirstRunPanel.js';
5
+ export * from './components/QuickActions.js';
6
+ export * from './components/RecentSecretsPanel.js';
7
+ export * from './components/StatsRow.js';
8
+ export * from './components/WelcomeHeader.js';
9
+ export { default as HomePage } from './pages/HomePage.js';
@@ -0,0 +1,10 @@
1
+ // Home: the dashboard panels and the Home page.
2
+ export * from './components/BackupStatusPanel.js';
3
+ export * from './components/DashboardPanel.js';
4
+ export * from './components/ExpiringCardsPanel.js';
5
+ export * from './components/FirstRunPanel.js';
6
+ export * from './components/QuickActions.js';
7
+ export * from './components/RecentSecretsPanel.js';
8
+ export * from './components/StatsRow.js';
9
+ export * from './components/WelcomeHeader.js';
10
+ export { default as HomePage } from './pages/HomePage.js';