@rapidmx/web-client 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -2
- package/apps/admin/_layout.tsx +8 -2
- package/apps/admin/index.tsx +7 -1
- package/apps/admin/ingest-queue/index.tsx +2 -1
- package/apps/admin/mailboxes/[uid].tsx +23 -10
- package/apps/admin/mailboxes/new/index.tsx +3 -3
- package/apps/admin/quarantine/index.tsx +2 -1
- package/apps/admin/signing-certificates/index.tsx +343 -0
- package/apps/escrow/_layout.tsx +8 -2
- package/apps/shared/appearance/AppearanceForm.tsx +392 -0
- package/apps/shared/appearance/AppearanceHead.tsx +49 -0
- package/apps/shared/appearance/AppearanceProvider.tsx +470 -0
- package/apps/shared/appearance/ColorField.tsx +107 -0
- package/apps/shared/appearance/appearanceCache.ts +106 -0
- package/apps/shared/appearance/appearanceContext.ts +77 -0
- package/apps/shared/appearance/bootScript.ts +35 -0
- package/apps/shared/appearance/color.ts +169 -0
- package/apps/shared/appearance/photo.ts +88 -0
- package/apps/shared/appearance/resolvedTheme.ts +67 -0
- package/apps/shared/appearance/theme.ts +355 -0
- package/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.tsx +4 -4
- package/apps/shared/components/admin/layout/AdminShell.tsx +22 -10
- package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +107 -60
- package/apps/shared/components/admin/settings/BrandingForm.tsx +24 -0
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +60 -14
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +65 -16
- package/apps/shared/components/admin/settings/PluginsManager.tsx +228 -25
- package/apps/shared/components/admin/setup/SetupWizard.tsx +2 -1
- package/apps/shared/components/calendar/CalendarListSidebar.tsx +4 -5
- package/apps/shared/components/contacts/ContactForm.tsx +11 -5
- package/apps/shared/components/contacts/ContactsSidebar.tsx +5 -3
- package/apps/shared/components/contacts/ContactsToolbar.tsx +25 -52
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +10 -5
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +13 -6
- package/apps/shared/components/layout/AppShell.tsx +98 -32
- package/apps/shared/components/layout/BrandingChrome.tsx +200 -13
- package/apps/shared/components/layout/RailIcon.tsx +100 -0
- package/apps/shared/components/layout/ResponsiveToolbar.tsx +315 -0
- package/apps/shared/components/layout/ThemeSwitch.tsx +84 -0
- package/apps/shared/components/layout/UserMenu.tsx +75 -6
- package/apps/shared/components/mail/ConversationList.tsx +4 -2
- package/apps/shared/components/mail/ConversationThreadPane.tsx +487 -475
- package/apps/shared/components/mail/LazyReadingPane.tsx +14 -16
- package/apps/shared/components/mail/MailSelectionBar.tsx +2 -10
- package/apps/shared/components/mail/MessageDetailPane.tsx +366 -287
- package/apps/shared/components/mail/OutboxBadge.tsx +44 -0
- package/apps/shared/components/mail/OutboxRowStatus.tsx +31 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +35 -2
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +239 -437
- package/apps/shared/components/mail/compose/encryptionRequirement.ts +86 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +39 -25
- package/apps/shared/components/mail/reading/EncryptedBody.tsx +65 -0
- package/apps/shared/components/mail/reading/EncryptedPreview.tsx +35 -0
- package/apps/shared/components/mail/reading/MessageBody.tsx +240 -0
- package/apps/shared/components/mail/reading/MessageCard.tsx +174 -0
- package/apps/shared/components/mail/reading/bodyContent.ts +100 -0
- package/apps/shared/components/mail/reading/bodyHtml.ts +298 -0
- package/apps/shared/components/mail/reading/color.ts +245 -0
- package/apps/shared/components/mail/reading/frameControl.ts +142 -0
- package/apps/shared/components/mail/reading/frameDocument.ts +123 -0
- package/apps/shared/components/mail/reading/safeDocument.ts +24 -0
- package/apps/shared/components/mail/reading/themeAdaptation.ts +221 -0
- package/apps/shared/components/mail/reading/themeSurface.ts +90 -0
- package/apps/shared/components/mail/reading/viewOriginal.ts +38 -0
- package/apps/shared/components/settings/SigningCertificateCard.tsx +344 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +1 -0
- package/apps/shared/components/sharing/PrincipalListField.tsx +82 -0
- package/apps/shared/components/sharing/PrincipalPicker.tsx +76 -0
- package/apps/shared/components/sharing/PrincipalResolver.tsx +164 -0
- package/apps/shared/components/tasks/TasksSidebar.tsx +5 -3
- package/apps/shared/components/tasks/layout/TasksShell.tsx +9 -5
- package/apps/shared/mail/folderCounts.ts +9 -3
- package/apps/shared/mail/folderTree.ts +143 -0
- package/apps/shared/mail/outbox/UnlockBridge.tsx +23 -0
- package/apps/shared/mail/outbox/composeBridge.ts +69 -0
- package/apps/shared/mail/outbox/outboxState.ts +88 -0
- package/apps/shared/mail/outbox/pendingSends.ts +146 -0
- package/apps/shared/mail/outbox/sendDecision.ts +157 -0
- package/apps/shared/mail/outbox/sendJob.ts +427 -0
- package/apps/shared/mail/outbox/sendOutcomes.ts +146 -0
- package/apps/shared/mail/outbox/sendState.ts +35 -0
- package/apps/shared/mail/outbox/useOutboxStatus.ts +61 -0
- package/apps/shared/mail/useMailConnection.ts +81 -28
- package/apps/shared/mail/useMailLiveUpdates.ts +55 -10
- package/apps/shared/mail/useNewMailNotifications.ts +47 -32
- package/apps/shared/navigation/AppRouter.tsx +2 -2
- package/apps/shared/notifications/NotificationCenter.tsx +215 -0
- package/apps/shared/notifications/NotificationHistoryDialog.tsx +90 -0
- package/apps/shared/notifications/apiErrors.ts +98 -0
- package/apps/shared/notifications/headerOffset.ts +35 -0
- package/apps/shared/notifications/pushStatus.ts +56 -0
- package/apps/shared/notifications/store.ts +549 -0
- package/apps/shared/notifications/systemErrors.ts +63 -0
- package/apps/shared/notifications/useNotifications.ts +41 -0
- package/apps/shared/signing/enrollmentStorage.ts +33 -0
- package/apps/shared/signing/enrollmentTracker.ts +385 -0
- package/apps/shared/signing/enrollmentView.ts +251 -0
- package/apps/shared/signing/signingInfo.ts +58 -0
- package/apps/shared/signing/useNow.ts +19 -0
- package/apps/shared/signing/useSigningEnrollmentWatcher.ts +90 -0
- package/apps/shared/styles/app.css +80 -0
- package/apps/www/_layout.tsx +8 -2
- package/apps/www/_routes.ts +1 -0
- package/apps/www/calendar/index.tsx +9 -14
- package/apps/www/contacts/[uid].tsx +5 -8
- package/apps/www/contacts/index.tsx +587 -584
- package/apps/www/index.tsx +38 -27
- package/apps/www/messages/[uid].tsx +3 -1
- package/apps/www/settings/appearance/index.tsx +21 -0
- package/apps/www/settings/auto-reply/index.tsx +3 -7
- package/apps/www/settings/encryption/index.tsx +151 -116
- package/apps/www/settings/filters/[uid].tsx +3 -1
- package/apps/www/settings/filters/new/index.tsx +3 -1
- package/apps/www/settings/privacy/index.tsx +3 -8
- package/apps/www/settings/read-receipts/index.tsx +3 -7
- package/apps/www/settings/sharing/index.tsx +44 -65
- package/apps/www/settings/signatures/[uid].tsx +3 -1
- package/apps/www/settings/signatures/new/index.tsx +3 -2
- package/apps/www/tasks/index.tsx +11 -16
- package/dist/apps/admin/_layout.d.ts +5 -1
- package/dist/apps/admin/_layout.js +3 -2
- package/dist/apps/admin/index.js +3 -2
- package/dist/apps/admin/ingest-queue/index.js +2 -1
- package/dist/apps/admin/mailboxes/[uid].js +9 -6
- package/dist/apps/admin/mailboxes/new/index.js +1 -1
- package/dist/apps/admin/quarantine/index.js +2 -1
- package/dist/apps/admin/signing-certificates/index.d.ts +3 -0
- package/dist/apps/admin/signing-certificates/index.js +161 -0
- package/dist/apps/escrow/_layout.d.ts +5 -1
- package/dist/apps/escrow/_layout.js +3 -2
- package/dist/apps/shared/appearance/AppearanceForm.d.ts +7 -0
- package/dist/apps/shared/appearance/AppearanceForm.js +131 -0
- package/dist/apps/shared/appearance/AppearanceHead.d.ts +15 -0
- package/dist/apps/shared/appearance/AppearanceHead.js +31 -0
- package/dist/apps/shared/appearance/AppearanceProvider.d.ts +32 -0
- package/dist/apps/shared/appearance/AppearanceProvider.js +390 -0
- package/dist/apps/shared/appearance/ColorField.d.ts +22 -0
- package/dist/apps/shared/appearance/ColorField.js +40 -0
- package/dist/apps/shared/appearance/appearanceCache.d.ts +45 -0
- package/dist/apps/shared/appearance/appearanceCache.js +80 -0
- package/dist/apps/shared/appearance/appearanceContext.d.ts +45 -0
- package/dist/apps/shared/appearance/appearanceContext.js +29 -0
- package/dist/apps/shared/appearance/bootScript.d.ts +16 -0
- package/dist/apps/shared/appearance/bootScript.js +33 -0
- package/dist/apps/shared/appearance/color.d.ts +65 -0
- package/dist/apps/shared/appearance/color.js +132 -0
- package/dist/apps/shared/appearance/photo.d.ts +17 -0
- package/dist/apps/shared/appearance/photo.js +79 -0
- package/dist/apps/shared/appearance/resolvedTheme.d.ts +21 -0
- package/dist/apps/shared/appearance/resolvedTheme.js +55 -0
- package/dist/apps/shared/appearance/theme.d.ts +111 -0
- package/dist/apps/shared/appearance/theme.js +251 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js +3 -2
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +1 -1
- package/dist/apps/shared/components/admin/layout/AdminShell.js +16 -6
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +10 -5
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +49 -34
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +2 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +7 -1
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +25 -5
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +18 -7
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +106 -20
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +2 -1
- package/dist/apps/shared/components/calendar/CalendarListSidebar.js +8 -8
- package/dist/apps/shared/components/contacts/ContactForm.js +1 -1
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +4 -2
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +3 -1
- package/dist/apps/shared/components/contacts/ContactsToolbar.js +24 -9
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +4 -1
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +7 -4
- package/dist/apps/shared/components/layout/AppShell.d.ts +6 -1
- package/dist/apps/shared/components/layout/AppShell.js +59 -13
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +69 -10
- package/dist/apps/shared/components/layout/BrandingChrome.js +140 -12
- package/dist/apps/shared/components/layout/RailIcon.d.ts +21 -0
- package/dist/apps/shared/components/layout/RailIcon.js +85 -0
- package/dist/apps/shared/components/layout/ResponsiveToolbar.d.ts +55 -0
- package/dist/apps/shared/components/layout/ResponsiveToolbar.js +199 -0
- package/dist/apps/shared/components/layout/ThemeSwitch.d.ts +9 -0
- package/dist/apps/shared/components/layout/ThemeSwitch.js +54 -0
- package/dist/apps/shared/components/layout/UserMenu.d.ts +7 -1
- package/dist/apps/shared/components/layout/UserMenu.js +41 -7
- package/dist/apps/shared/components/mail/ConversationList.js +3 -2
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +2 -1
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +42 -20
- package/dist/apps/shared/components/mail/LazyReadingPane.js +9 -8
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +3 -4
- package/dist/apps/shared/components/mail/MailSelectionBar.js +2 -3
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +18 -7
- package/dist/apps/shared/components/mail/MessageDetailPane.js +86 -41
- package/dist/apps/shared/components/mail/OutboxBadge.d.ts +17 -0
- package/dist/apps/shared/components/mail/OutboxBadge.js +18 -0
- package/dist/apps/shared/components/mail/OutboxRowStatus.d.ts +10 -0
- package/dist/apps/shared/components/mail/OutboxRowStatus.js +19 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +8 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +28 -3
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +2 -1
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +229 -328
- package/dist/apps/shared/components/mail/compose/encryptionRequirement.d.ts +49 -0
- package/dist/apps/shared/components/mail/compose/encryptionRequirement.js +35 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +2 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +20 -14
- package/dist/apps/shared/components/mail/reading/EncryptedBody.d.ts +21 -0
- package/dist/apps/shared/components/mail/reading/EncryptedBody.js +22 -0
- package/dist/apps/shared/components/mail/reading/EncryptedPreview.d.ts +18 -0
- package/dist/apps/shared/components/mail/reading/EncryptedPreview.js +22 -0
- package/dist/apps/shared/components/mail/reading/MessageBody.d.ts +32 -0
- package/dist/apps/shared/components/mail/reading/MessageBody.js +136 -0
- package/dist/apps/shared/components/mail/reading/MessageCard.d.ts +62 -0
- package/dist/apps/shared/components/mail/reading/MessageCard.js +58 -0
- package/dist/apps/shared/components/mail/reading/bodyContent.d.ts +38 -0
- package/dist/apps/shared/components/mail/reading/bodyContent.js +84 -0
- package/dist/apps/shared/components/mail/reading/bodyHtml.d.ts +47 -0
- package/dist/apps/shared/components/mail/reading/bodyHtml.js +267 -0
- package/dist/apps/shared/components/mail/reading/color.d.ts +63 -0
- package/dist/apps/shared/components/mail/reading/color.js +201 -0
- package/dist/apps/shared/components/mail/reading/frameControl.d.ts +33 -0
- package/dist/apps/shared/components/mail/reading/frameControl.js +120 -0
- package/dist/apps/shared/components/mail/reading/frameDocument.d.ts +52 -0
- package/dist/apps/shared/components/mail/reading/frameDocument.js +98 -0
- package/dist/apps/shared/components/mail/reading/safeDocument.d.ts +3 -0
- package/dist/apps/shared/components/mail/reading/safeDocument.js +12 -0
- package/dist/apps/shared/components/mail/reading/themeAdaptation.d.ts +56 -0
- package/dist/apps/shared/components/mail/reading/themeAdaptation.js +144 -0
- package/dist/apps/shared/components/mail/reading/themeSurface.d.ts +17 -0
- package/dist/apps/shared/components/mail/reading/themeSurface.js +83 -0
- package/dist/apps/shared/components/mail/reading/viewOriginal.d.ts +9 -0
- package/dist/apps/shared/components/mail/reading/viewOriginal.js +32 -0
- package/dist/apps/shared/components/settings/SigningCertificateCard.d.ts +32 -0
- package/dist/apps/shared/components/settings/SigningCertificateCard.js +98 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +1 -0
- package/dist/apps/shared/components/sharing/PrincipalListField.d.ts +24 -0
- package/dist/apps/shared/components/sharing/PrincipalListField.js +23 -0
- package/dist/apps/shared/components/sharing/PrincipalPicker.d.ts +28 -0
- package/dist/apps/shared/components/sharing/PrincipalPicker.js +24 -0
- package/dist/apps/shared/components/sharing/PrincipalResolver.d.ts +44 -0
- package/dist/apps/shared/components/sharing/PrincipalResolver.js +92 -0
- package/dist/apps/shared/components/tasks/TasksSidebar.js +4 -2
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +3 -1
- package/dist/apps/shared/mail/folderCounts.d.ts +1 -1
- package/dist/apps/shared/mail/folderCounts.js +9 -3
- package/dist/apps/shared/mail/folderTree.d.ts +55 -0
- package/dist/apps/shared/mail/folderTree.js +116 -0
- package/dist/apps/shared/mail/outbox/UnlockBridge.d.ts +5 -0
- package/dist/apps/shared/mail/outbox/UnlockBridge.js +18 -0
- package/dist/apps/shared/mail/outbox/composeBridge.d.ts +34 -0
- package/dist/apps/shared/mail/outbox/composeBridge.js +32 -0
- package/dist/apps/shared/mail/outbox/outboxState.d.ts +41 -0
- package/dist/apps/shared/mail/outbox/outboxState.js +42 -0
- package/dist/apps/shared/mail/outbox/pendingSends.d.ts +39 -0
- package/dist/apps/shared/mail/outbox/pendingSends.js +109 -0
- package/dist/apps/shared/mail/outbox/sendDecision.d.ts +80 -0
- package/dist/apps/shared/mail/outbox/sendDecision.js +94 -0
- package/dist/apps/shared/mail/outbox/sendJob.d.ts +68 -0
- package/dist/apps/shared/mail/outbox/sendJob.js +319 -0
- package/dist/apps/shared/mail/outbox/sendOutcomes.d.ts +3 -0
- package/dist/apps/shared/mail/outbox/sendOutcomes.js +141 -0
- package/dist/apps/shared/mail/outbox/sendState.d.ts +25 -0
- package/dist/apps/shared/mail/outbox/sendState.js +8 -0
- package/dist/apps/shared/mail/outbox/useOutboxStatus.d.ts +11 -0
- package/dist/apps/shared/mail/outbox/useOutboxStatus.js +49 -0
- package/dist/apps/shared/mail/useMailConnection.d.ts +9 -8
- package/dist/apps/shared/mail/useMailConnection.js +64 -22
- package/dist/apps/shared/mail/useMailLiveUpdates.d.ts +17 -4
- package/dist/apps/shared/mail/useMailLiveUpdates.js +36 -10
- package/dist/apps/shared/mail/useNewMailNotifications.d.ts +4 -10
- package/dist/apps/shared/mail/useNewMailNotifications.js +43 -23
- package/dist/apps/shared/navigation/AppRouter.js +2 -2
- package/dist/apps/shared/notifications/NotificationCenter.d.ts +19 -0
- package/dist/apps/shared/notifications/NotificationCenter.js +90 -0
- package/dist/apps/shared/notifications/NotificationHistoryDialog.d.ts +10 -0
- package/dist/apps/shared/notifications/NotificationHistoryDialog.js +36 -0
- package/dist/apps/shared/notifications/apiErrors.d.ts +19 -0
- package/dist/apps/shared/notifications/apiErrors.js +86 -0
- package/dist/apps/shared/notifications/headerOffset.d.ts +8 -0
- package/dist/apps/shared/notifications/headerOffset.js +33 -0
- package/dist/apps/shared/notifications/pushStatus.d.ts +9 -0
- package/dist/apps/shared/notifications/pushStatus.js +54 -0
- package/dist/apps/shared/notifications/store.d.ts +136 -0
- package/dist/apps/shared/notifications/store.js +416 -0
- package/dist/apps/shared/notifications/systemErrors.d.ts +9 -0
- package/dist/apps/shared/notifications/systemErrors.js +58 -0
- package/dist/apps/shared/notifications/useNotifications.d.ts +17 -0
- package/dist/apps/shared/notifications/useNotifications.js +18 -0
- package/dist/apps/shared/signing/enrollmentStorage.d.ts +10 -0
- package/dist/apps/shared/signing/enrollmentStorage.js +33 -0
- package/dist/apps/shared/signing/enrollmentTracker.d.ts +73 -0
- package/dist/apps/shared/signing/enrollmentTracker.js +307 -0
- package/dist/apps/shared/signing/enrollmentView.d.ts +57 -0
- package/dist/apps/shared/signing/enrollmentView.js +214 -0
- package/dist/apps/shared/signing/signingInfo.d.ts +11 -0
- package/dist/apps/shared/signing/signingInfo.js +48 -0
- package/dist/apps/shared/signing/useNow.d.ts +2 -0
- package/dist/apps/shared/signing/useNow.js +18 -0
- package/dist/apps/shared/signing/useSigningEnrollmentWatcher.d.ts +16 -0
- package/dist/apps/shared/signing/useSigningEnrollmentWatcher.js +87 -0
- package/dist/apps/shared/styles/app.css +80 -0
- package/dist/apps/www/_layout.d.ts +5 -1
- package/dist/apps/www/_layout.js +3 -2
- package/dist/apps/www/_routes.js +1 -0
- package/dist/apps/www/calendar/index.js +3 -4
- package/dist/apps/www/contacts/[uid].js +5 -7
- package/dist/apps/www/contacts/index.js +14 -21
- package/dist/apps/www/index.js +37 -19
- package/dist/apps/www/messages/[uid].js +3 -1
- package/dist/apps/www/settings/appearance/index.d.ts +4 -0
- package/dist/apps/www/settings/appearance/index.js +13 -0
- package/dist/apps/www/settings/auto-reply/index.js +3 -6
- package/dist/apps/www/settings/encryption/index.js +103 -95
- package/dist/apps/www/settings/filters/[uid].js +3 -1
- package/dist/apps/www/settings/filters/new/index.js +3 -1
- package/dist/apps/www/settings/privacy/index.js +5 -8
- package/dist/apps/www/settings/read-receipts/index.js +3 -6
- package/dist/apps/www/settings/sharing/index.js +19 -33
- package/dist/apps/www/settings/signatures/[uid].js +3 -1
- package/dist/apps/www/settings/signatures/new/index.js +3 -2
- package/dist/apps/www/tasks/index.js +8 -14
- package/package.json +2 -2
- package/apps/shared/components/mail/NewMailToasts.tsx +0 -141
- package/apps/shared/components/mail/compose/SendFailureAlert.tsx +0 -48
- package/dist/apps/shared/components/mail/NewMailToasts.d.ts +0 -19
- package/dist/apps/shared/components/mail/NewMailToasts.js +0 -55
- package/dist/apps/shared/components/mail/compose/SendFailureAlert.d.ts +0 -14
- package/dist/apps/shared/components/mail/compose/SendFailureAlert.js +0 -11
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import { useCallback, useState } from "react";
|
|
6
|
+
/** Messages the reader chose to see exactly as authored rather than adapted to the theme, for the life of the tab. */
|
|
7
|
+
const original = new Set();
|
|
8
|
+
/** Whether the reader asked to see `uid` as authored. */
|
|
9
|
+
export function isViewedOriginal(uid) {
|
|
10
|
+
return original.has(uid);
|
|
11
|
+
}
|
|
12
|
+
/** Forgets every choice (the tests). */
|
|
13
|
+
export function clearViewedOriginal() {
|
|
14
|
+
original.clear();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The per-message "View original" choice: `false` (follow the theme) until the reader flips it, then remembered for the session so
|
|
18
|
+
* collapsing and expanding a message, or coming back to it, keeps the choice.
|
|
19
|
+
*/
|
|
20
|
+
export function useViewOriginal(uid) {
|
|
21
|
+
const [value, setValue] = useState(() => isViewedOriginal(uid));
|
|
22
|
+
const update = useCallback((next) => {
|
|
23
|
+
if (next) {
|
|
24
|
+
original.add(uid);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
original.delete(uid);
|
|
28
|
+
}
|
|
29
|
+
setValue(next);
|
|
30
|
+
}, [uid]);
|
|
31
|
+
return [value, update];
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { EnrollmentResult } from "@rapidmx/react-shared/crypto/keyvaultApi.js";
|
|
3
|
+
import type { EnrollmentSnapshot } from "../../signing/enrollmentTracker.js";
|
|
4
|
+
import type { SigningEnrollmentInfo } from "../../signing/signingInfo.js";
|
|
5
|
+
export type SigningCertificateMode = "pending" | "issued" | "failed" | "expired";
|
|
6
|
+
export interface SigningCertificateCardProps {
|
|
7
|
+
mode: SigningCertificateMode;
|
|
8
|
+
/** What the server last said about the enrollment (the extended fields are all optional - an older server sends only `status`). */
|
|
9
|
+
enrollment: EnrollmentResult | null;
|
|
10
|
+
/** The tracker's view of it: busy flags, the check cooldown, the last check. Absent when nothing is being followed. */
|
|
11
|
+
snapshot?: EnrollmentSnapshot;
|
|
12
|
+
/** For an issued certificate when the enrollment carries no details (one installed long ago): the active key's own expiry (epoch ms). */
|
|
13
|
+
keyNotAfter?: number;
|
|
14
|
+
/** How this deployment issues certificates (`GET /system/signing-enrollment`): what a pending request says follows it. `null` / absent when it is not known. */
|
|
15
|
+
info?: SigningEnrollmentInfo | null;
|
|
16
|
+
/** The mailbox's address - the one the CA's verification e-mail goes to. */
|
|
17
|
+
address?: string;
|
|
18
|
+
/** Only the mailbox's owner can request a certificate. */
|
|
19
|
+
canRequest: boolean;
|
|
20
|
+
/** "Try again" / "Renew" / "Request a new certificate" is under way. */
|
|
21
|
+
requesting: boolean;
|
|
22
|
+
onCheck?: () => void;
|
|
23
|
+
onRequest?: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Settings > Encryption's "Digital signature certificate" card: where a signing-certificate enrollment is, in the words of the person waiting for
|
|
27
|
+
* it. A progress bar (determinate from the server's `progress`), the steps with a state icon and time each, a status line, when it was requested
|
|
28
|
+
* and last checked (kept current), and a "Check status" button with a busy state and a cooldown. An issued certificate shows its subject, issuer,
|
|
29
|
+
* serial (copyable) and expiry with a warning (and "Renew") inside 30 days; a failed one shows the reason and "Try again"; an expired one offers a
|
|
30
|
+
* new request. Everything but `mode` is optional so a server that only says `pending`/`issued`/`failed` still gets a useful card.
|
|
31
|
+
*/
|
|
32
|
+
export default function SigningCertificateCard({ mode, enrollment, snapshot, keyNotAfter, info, address, canRequest, requesting, onCheck, onRequest }: SigningCertificateCardProps): React.JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { HiOutlineCheckCircle, HiOutlineExclamationTriangle, HiOutlineXCircle } from "react-icons/hi2";
|
|
3
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
4
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
5
|
+
import CopyButton from "@rapidmx/react-shared/components/buttons/CopyButton.js";
|
|
6
|
+
import { CA_UNREACHABLE_TEXT, MANUAL_ISSUE_TEXT, PENDING_FALLBACK_TEXT, expiryOf, formatDate, formatDateTime, healthWarning, isInstalling, isOverdue, issueModeOf, progressOf, requestedFromText, relativeTime, statusLineOf, stepsOf, timeOf, truncateSerial, } from "../../signing/enrollmentView.js";
|
|
7
|
+
import { useNow } from "../../signing/useNow.js";
|
|
8
|
+
const BADGE = {
|
|
9
|
+
pending: { text: "Pending", className: "bg-primary/15 text-primary-dark" },
|
|
10
|
+
issued: { text: "Active", className: "bg-success/15 text-success" },
|
|
11
|
+
failed: { text: "Failed", className: "bg-danger/15 text-danger" },
|
|
12
|
+
expired: { text: "Expired", className: "bg-danger/15 text-danger" },
|
|
13
|
+
};
|
|
14
|
+
const STEP_TEXT = {
|
|
15
|
+
done: "done",
|
|
16
|
+
active: "in progress",
|
|
17
|
+
pending: "waiting",
|
|
18
|
+
failed: "failed",
|
|
19
|
+
};
|
|
20
|
+
function StepIcon({ state }) {
|
|
21
|
+
if (state === "done") {
|
|
22
|
+
return _jsx(HiOutlineCheckCircle, { size: 18, "aria-hidden": "true", className: "shrink-0 text-success" });
|
|
23
|
+
}
|
|
24
|
+
if (state === "failed") {
|
|
25
|
+
return _jsx(HiOutlineXCircle, { size: 18, "aria-hidden": "true", className: "shrink-0 text-danger" });
|
|
26
|
+
}
|
|
27
|
+
if (state === "active") {
|
|
28
|
+
return (_jsx("span", { "aria-hidden": "true", className: "flex h-[18px] w-[18px] shrink-0 items-center justify-center", children: _jsx("span", { className: "h-3.5 w-3.5 rounded-full border-2 border-primary/30 border-t-primary motion-safe:animate-spin motion-reduce:border-primary" }) }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsx("span", { "aria-hidden": "true", className: "flex h-[18px] w-[18px] shrink-0 items-center justify-center", children: _jsx("span", { className: "h-3 w-3 rounded-full border-2 border-border" }) }));
|
|
31
|
+
}
|
|
32
|
+
function Stepper({ steps }) {
|
|
33
|
+
return (_jsx("ol", { "aria-label": "Certificate steps", className: "flex flex-col gap-2", children: steps.map((step) => (_jsxs("li", { className: "flex items-start gap-2 text-sm", "aria-current": step.state === "active" ? "step" : undefined, children: [_jsx(StepIcon, { state: step.state }), _jsxs("span", { className: step.state === "pending" ? "text-text-muted" : "text-text", children: [step.label, _jsxs("span", { className: "sr-only", children: [" - ", STEP_TEXT[step.state]] })] }), step.at && _jsx("span", { className: "ml-auto shrink-0 text-xs text-text-muted", children: formatDateTime(step.at) })] }, step.id))) }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The progress bar: determinate when the server says how far along it is, an endless shimmer while a step is active and no number is known.
|
|
37
|
+
* `role="progressbar"` with `aria-valuenow` (left off when unknown, as ARIA says for an indeterminate bar) and a `aria-valuetext` in words.
|
|
38
|
+
*/
|
|
39
|
+
function ProgressBar({ value, text }) {
|
|
40
|
+
return (_jsx("div", { role: "progressbar", "aria-label": "Certificate progress", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": value, "aria-valuetext": text, className: "h-2 w-full overflow-hidden rounded-pill bg-border/60", children: value === undefined ? (_jsx("div", { className: "rr-progress-indeterminate h-full w-1/3 rounded-pill bg-primary motion-reduce:w-full motion-reduce:opacity-40" })) : (_jsx("div", { className: "rr-progress-shimmer h-full rounded-pill bg-primary transition-[width] duration-500", style: { width: `${Math.max(value, value > 0 ? 3 : 0)}%` } })) }));
|
|
41
|
+
}
|
|
42
|
+
function Detail({ label, children }) {
|
|
43
|
+
return (_jsxs("div", { className: "grid grid-cols-[6.5rem_1fr] gap-2 text-sm sm:grid-cols-[8rem_1fr]", children: [_jsx("dt", { className: "text-text-muted", children: label }), _jsx("dd", { className: "min-w-0 break-words", children: children })] }));
|
|
44
|
+
}
|
|
45
|
+
/** The sentence under the button: what the last manual check found, or why it cannot be pressed again yet. */
|
|
46
|
+
function checkMessage(snapshot, statusLine, now) {
|
|
47
|
+
if (snapshot?.offline) {
|
|
48
|
+
return "Could not reach the server - showing what was last known.";
|
|
49
|
+
}
|
|
50
|
+
const last = snapshot?.lastCheck;
|
|
51
|
+
if (!last) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
if (last.outcome === "failed") {
|
|
55
|
+
return "Could not check just now - try again in a moment.";
|
|
56
|
+
}
|
|
57
|
+
if (last.outcome === "limited") {
|
|
58
|
+
return "Checked a moment ago - please wait a few seconds before checking again.";
|
|
59
|
+
}
|
|
60
|
+
if (last.outcome === "changed") {
|
|
61
|
+
return `Updated - ${statusLine ?? "the status changed"}`;
|
|
62
|
+
}
|
|
63
|
+
return `Still waiting - checked ${relativeTime(last.at, now)}`;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Settings > Encryption's "Digital signature certificate" card: where a signing-certificate enrollment is, in the words of the person waiting for
|
|
67
|
+
* it. A progress bar (determinate from the server's `progress`), the steps with a state icon and time each, a status line, when it was requested
|
|
68
|
+
* and last checked (kept current), and a "Check status" button with a busy state and a cooldown. An issued certificate shows its subject, issuer,
|
|
69
|
+
* serial (copyable) and expiry with a warning (and "Renew") inside 30 days; a failed one shows the reason and "Try again"; an expired one offers a
|
|
70
|
+
* new request. Everything but `mode` is optional so a server that only says `pending`/`issued`/`failed` still gets a useful card.
|
|
71
|
+
*/
|
|
72
|
+
export default function SigningCertificateCard({ mode, enrollment, snapshot, keyNotAfter, info, address, canRequest, requesting, onCheck, onRequest }) {
|
|
73
|
+
const busy = mode === "pending" || (snapshot?.retryAt ?? 0) > Date.now();
|
|
74
|
+
const now = useNow(busy ? 1000 : 30000);
|
|
75
|
+
const steps = stepsOf(enrollment);
|
|
76
|
+
const progress = progressOf(enrollment);
|
|
77
|
+
const statusLine = statusLineOf(enrollment);
|
|
78
|
+
// Any of the newer fields gives a percentage (the server's, or the share of steps done), so this is "the server told us more than pending".
|
|
79
|
+
const detailed = progress !== undefined;
|
|
80
|
+
const badge = BADGE[mode];
|
|
81
|
+
// What the words say depends on how this deployment issues certificates: a public CA does it by itself, an administrator uploads it, or nobody has said.
|
|
82
|
+
const issueMode = issueModeOf(enrollment, info);
|
|
83
|
+
const problem = healthWarning(info);
|
|
84
|
+
const notAfter = enrollment?.notAfter ?? keyNotAfter;
|
|
85
|
+
const expiry = expiryOf(notAfter, now);
|
|
86
|
+
const requestedAgo = relativeTime(enrollment?.requestedAt, now);
|
|
87
|
+
const checkedAt = timeOf(enrollment?.lastCheckedAt) ?? snapshot?.answeredAt ?? undefined;
|
|
88
|
+
const checkedAgo = relativeTime(checkedAt, now);
|
|
89
|
+
const waitSeconds = Math.max(0, Math.ceil(((snapshot?.retryAt ?? 0) - now) / 1000));
|
|
90
|
+
const checkingNow = snapshot?.checkingNow ?? false;
|
|
91
|
+
const message = checkMessage(snapshot, statusLine, now);
|
|
92
|
+
const overdue = isOverdue(enrollment, now);
|
|
93
|
+
return (_jsxs("section", { "aria-label": "Digital signature certificate", className: "flex flex-col gap-3 rounded-md border border-border bg-surface p-4", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("h3", { className: "text-sm font-semibold", children: "Digital signature certificate" }), _jsx("span", { className: ["rounded-pill px-2 py-0.5 text-xs font-bold", badge.className].join(" "), children: badge.text })] }), mode === "pending" && (_jsxs(_Fragment, { children: [issueMode === "manual" ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm", children: MANUAL_ISSUE_TEXT }), info?.contactEmail && _jsxs("p", { className: "text-xs text-text-muted", children: ["Administrator: ", info.contactEmail] })] })) : (_jsxs(_Fragment, { children: [issueMode === "automatic" && _jsx("p", { className: "text-sm text-text-muted", children: requestedFromText(info, address) }), detailed ? (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm", children: statusLine ?? "In progress" }), _jsx(ProgressBar, { value: progress, text: `${progress} percent - ${statusLine ?? "in progress"}` })] })) : (_jsxs(_Fragment, { children: [_jsx(ProgressBar, { value: undefined, text: "In progress" }), issueMode === "unknown" && _jsx("p", { className: "text-sm text-text-muted", children: PENDING_FALLBACK_TEXT })] }))] })), problem && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-sm border border-danger/40 bg-danger/10 px-3 py-2 text-sm", children: [_jsx(HiOutlineExclamationTriangle, { size: 18, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-danger" }), _jsx("span", { children: problem })] })), overdue && (_jsxs("p", { className: "text-sm", children: ["This is taking longer than expected", checkedAgo ? ` - last checked ${checkedAgo}` : "", ". Use Check status to ask again."] })), enrollment?.errorCode === "ca-unreachable" && _jsx("p", { className: "text-sm text-text-muted", children: CA_UNREACHABLE_TEXT }), enrollment?.note && _jsx("p", { className: "text-xs text-text-muted", children: enrollment.note }), steps.length > 0 && _jsx(Stepper, { steps: steps }), issueMode === "automatic" && (_jsx("p", { className: "text-xs text-text-muted", children: "You can leave this page - you will be told when the certificate is issued or the request fails." })), (requestedAgo || checkedAgo) && (_jsxs("p", { className: "text-xs text-text-muted", children: [requestedAgo ? `Requested ${issueMode === "manual" ? formatDateTime(enrollment?.requestedAt) : requestedAgo}` : "", requestedAgo && checkedAgo ? " - " : "", checkedAgo ? `last checked ${checkedAgo}` : ""] })), onCheck && (_jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", loading: checkingNow, disabled: checkingNow || waitSeconds > 0, "aria-busy": checkingNow, onClick: onCheck, children: checkingNow ? "Checking..." : waitSeconds > 0 ? `Check again in ${waitSeconds} s` : "Check status" }), _jsx("span", { role: "status", "aria-live": "polite", className: "text-xs text-text-muted", children: message })] }))] })), mode === "issued" && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm", children: isInstalling(enrollment)
|
|
94
|
+
? statusLineOf(enrollment)
|
|
95
|
+
: notAfter !== undefined
|
|
96
|
+
? `Issued - valid until ${formatDate(notAfter)}`
|
|
97
|
+
: "Issued" }), enrollment?.note && _jsx("p", { className: "text-xs text-text-muted", children: enrollment.note }), expiry.state === "soon" && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-sm border border-danger/40 bg-danger/10 px-3 py-2 text-sm", children: [_jsx(HiOutlineExclamationTriangle, { size: 18, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-danger" }), _jsxs("span", { children: ["This certificate expires ", expiry.daysLeft === 1 ? "tomorrow" : `in ${expiry.daysLeft} days`, ". Renew it so your mail stays signed."] })] })), (enrollment?.subject || enrollment?.issuer || enrollment?.serialNumber || enrollment?.issuedAt) && (_jsxs("dl", { className: "flex flex-col gap-1.5", children: [enrollment.subject && _jsx(Detail, { label: "Subject", children: enrollment.subject }), enrollment.issuer && _jsx(Detail, { label: "Issuer", children: enrollment.issuer }), enrollment.serialNumber && (_jsx(Detail, { label: "Serial number", children: _jsxs("span", { className: "inline-flex flex-wrap items-center gap-2", children: [_jsx("span", { className: "font-mono text-xs", title: enrollment.serialNumber, children: truncateSerial(enrollment.serialNumber) }), _jsx(CopyButton, { value: enrollment.serialNumber, label: "Copy the certificate's serial number" })] }) })), enrollment.issuedAt && _jsx(Detail, { label: "Issued", children: formatDate(enrollment.issuedAt) }), notAfter !== undefined && _jsx(Detail, { label: "Valid until", children: formatDate(notAfter) })] })), canRequest && onRequest && expiry.state === "soon" && (_jsx("div", { children: _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", loading: requesting, disabled: requesting, onClick: onRequest, children: "Renew" }) }))] })), mode === "failed" && (_jsxs(_Fragment, { children: [_jsx(Alert, { children: statusLine ?? "Failed: the certificate could not be issued." }), steps.length > 0 && _jsx(Stepper, { steps: steps }), canRequest && onRequest && enrollment?.retryable !== false && (_jsx("div", { children: _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", loading: requesting, disabled: requesting, onClick: onRequest, children: "Try again" }) }))] })), mode === "expired" && (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-sm", children: notAfter !== undefined ? `Expired on ${formatDate(notAfter)}. Mail from this mailbox is no longer signed.` : "This certificate has expired. Mail from this mailbox is no longer signed." }), canRequest && onRequest && (_jsx("div", { children: _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", loading: requesting, disabled: requesting, onClick: onRequest, children: "Request a new certificate" }) }))] }))] }));
|
|
98
|
+
}
|
|
@@ -16,6 +16,7 @@ import MailboxProvisioning from "../../layout/MailboxProvisioning.js";
|
|
|
16
16
|
import { mergePluginNavItems } from "../../../plugins/pluginNav.js";
|
|
17
17
|
/** Every settings section with its own sidebar entry. */
|
|
18
18
|
export const SETTINGS_SECTIONS = [
|
|
19
|
+
{ id: "appearance", href: "/settings/appearance", label: "Appearance" },
|
|
19
20
|
{ id: "auto-reply", href: "/settings/auto-reply", label: "Automatic Replies" },
|
|
20
21
|
{ id: "filters", href: "/settings/filters", label: "Mail Filters" },
|
|
21
22
|
{ id: "signatures", href: "/settings/signatures", label: "Signatures" },
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ResolvedPrincipal } from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
3
|
+
export interface PrincipalListFieldProps {
|
|
4
|
+
label: string;
|
|
5
|
+
values: string[];
|
|
6
|
+
onChange: (values: string[]) => void;
|
|
7
|
+
/** Exact-match resolve call for what's typed - see `PrincipalResolver`. */
|
|
8
|
+
resolve: (principal: string) => Promise<ResolvedPrincipal>;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
emptyMessage?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A list-of-user-uids editor - the same visual list/per-item-remove shape `StringListField` established, but a
|
|
15
|
+
* uid can only be ADDED by looking it up and confirming who it is first (`PrincipalResolver`), never typed
|
|
16
|
+
* directly. Unlike `StringListField`'s free-text values (a distribution list's member addresses, a legal hold's
|
|
17
|
+
* custodian MAILBOX uids - values nobody needs to be "looked up" as a person for), every value here is a PERSON's
|
|
18
|
+
* user uid, granted a real role purely by what gets typed here - the exact "raw uid text field with no way to see
|
|
19
|
+
* whose it is" gap this app closes everywhere else a person is assigned by identifier.
|
|
20
|
+
*
|
|
21
|
+
* An already-added uid is still shown as plain text (same as `StringListField`, and as `ShareAccessCard`'s own
|
|
22
|
+
* member list) - it was already resolved and confirmed when it was added, so there is nothing left to look up.
|
|
23
|
+
*/
|
|
24
|
+
export default function PrincipalListField({ label, values, onChange, resolve, placeholder, emptyMessage, disabled }: PrincipalListFieldProps): React.JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import PrincipalResolver, { describePerson } from "./PrincipalResolver.js";
|
|
3
|
+
/**
|
|
4
|
+
* A list-of-user-uids editor - the same visual list/per-item-remove shape `StringListField` established, but a
|
|
5
|
+
* uid can only be ADDED by looking it up and confirming who it is first (`PrincipalResolver`), never typed
|
|
6
|
+
* directly. Unlike `StringListField`'s free-text values (a distribution list's member addresses, a legal hold's
|
|
7
|
+
* custodian MAILBOX uids - values nobody needs to be "looked up" as a person for), every value here is a PERSON's
|
|
8
|
+
* user uid, granted a real role purely by what gets typed here - the exact "raw uid text field with no way to see
|
|
9
|
+
* whose it is" gap this app closes everywhere else a person is assigned by identifier.
|
|
10
|
+
*
|
|
11
|
+
* An already-added uid is still shown as plain text (same as `StringListField`, and as `ShareAccessCard`'s own
|
|
12
|
+
* member list) - it was already resolved and confirmed when it was added, so there is nothing left to look up.
|
|
13
|
+
*/
|
|
14
|
+
export default function PrincipalListField({ label, values, onChange, resolve, placeholder, emptyMessage = "None added yet.", disabled }) {
|
|
15
|
+
function handleRemove(uid) {
|
|
16
|
+
onChange(values.filter((v) => v !== uid));
|
|
17
|
+
}
|
|
18
|
+
return (_jsxs("div", { className: "mb-4", children: [_jsx("span", { className: "block text-sm font-semibold mb-1.5 text-text", children: label }), _jsxs("ul", { className: "flex flex-col gap-2 mb-2", children: [values.length === 0 && (_jsx("li", { className: "text-sm text-text-muted", children: emptyMessage }, "empty")), values.map((uid) => (_jsxs("li", { className: "flex items-center justify-between gap-3 py-2 px-3 border border-border rounded-sm", children: [_jsx("span", { className: "text-sm font-medium break-all", children: uid }), _jsx("button", { type: "button", onClick: () => handleRemove(uid), disabled: disabled, className: "text-sm text-danger hover:underline disabled:opacity-55 shrink-0", children: "Remove" })] }, uid)))] }), !disabled && (_jsx(PrincipalResolver, { resolve: resolve, onResolved: (person) => {
|
|
19
|
+
if (!values.includes(person.userUid)) {
|
|
20
|
+
onChange([...values, person.userUid]);
|
|
21
|
+
}
|
|
22
|
+
}, placeholder: placeholder ?? "Email address, username or user id", ariaLabel: label, confirmLabel: "Add", confirmErrorMessage: "Could not add this person.", describeConfirm: (person) => (_jsxs(_Fragment, { children: ["Add ", _jsx("strong", { className: "break-all", children: describePerson(person) }), "?"] })) }))] }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MailboxAccessRole, ResolvedPrincipal } from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
3
|
+
import { describePerson } from "./PrincipalResolver.js";
|
|
4
|
+
export { describePerson };
|
|
5
|
+
export interface PrincipalPickerProps {
|
|
6
|
+
mailboxUid: string;
|
|
7
|
+
/** What each access level is called on this page. */
|
|
8
|
+
roleLabels: Record<MailboxAccessRole, string>;
|
|
9
|
+
/** Text put in the box to start with - a stored entry being replaced, say. */
|
|
10
|
+
initialPrincipal?: string;
|
|
11
|
+
/** The access level pre-selected. */
|
|
12
|
+
defaultRole?: MailboxAccessRole;
|
|
13
|
+
/** What the box asks for. */
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
/** Called once the grant is saved, with the person it went to. */
|
|
16
|
+
onGranted: (person: ResolvedPrincipal, role: MailboxAccessRole) => void | Promise<void>;
|
|
17
|
+
/** Shown as a Cancel button next to the box when set (replacing an entry). */
|
|
18
|
+
onCancel?: () => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* "Who?" for a sharing screen - a thin wrapper around the general `PrincipalResolver`, supplying mailbox sharing's
|
|
22
|
+
* own resolve call (`resolveMailboxPrincipal()`), its role selector, and its grant action (`setMailboxAccess()`).
|
|
23
|
+
* What is typed - a mailbox address, an auth-server username or e-mail alias, or a user id - is RESOLVED by the
|
|
24
|
+
* server before anything is saved, and the person is shown (name and address) for the caller to confirm; only then
|
|
25
|
+
* is the grant made, against that person's uid. Free text is never stored: an ACL record matches a user uid and
|
|
26
|
+
* nothing else, so a grant to a typed username applies to nobody.
|
|
27
|
+
*/
|
|
28
|
+
export default function PrincipalPicker({ mailboxUid, roleLabels, initialPrincipal, defaultRole, placeholder, onGranted, onCancel }: PrincipalPickerProps): React.JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { resolveMailboxPrincipal, setMailboxAccess, } from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
8
|
+
import PrincipalResolver, { describePerson } from "./PrincipalResolver.js";
|
|
9
|
+
export { describePerson };
|
|
10
|
+
/**
|
|
11
|
+
* "Who?" for a sharing screen - a thin wrapper around the general `PrincipalResolver`, supplying mailbox sharing's
|
|
12
|
+
* own resolve call (`resolveMailboxPrincipal()`), its role selector, and its grant action (`setMailboxAccess()`).
|
|
13
|
+
* What is typed - a mailbox address, an auth-server username or e-mail alias, or a user id - is RESOLVED by the
|
|
14
|
+
* server before anything is saved, and the person is shown (name and address) for the caller to confirm; only then
|
|
15
|
+
* is the grant made, against that person's uid. Free text is never stored: an ACL record matches a user uid and
|
|
16
|
+
* nothing else, so a grant to a typed username applies to nobody.
|
|
17
|
+
*/
|
|
18
|
+
export default function PrincipalPicker({ mailboxUid, roleLabels, initialPrincipal, defaultRole = "viewer", placeholder, onGranted, onCancel }) {
|
|
19
|
+
const [role, setRole] = useState(defaultRole);
|
|
20
|
+
return (_jsx(PrincipalResolver, { resolve: (principal) => resolveMailboxPrincipal(mailboxUid, principal), onResolved: async (person) => {
|
|
21
|
+
await setMailboxAccess(mailboxUid, person.userUid, role);
|
|
22
|
+
await onGranted(person, role);
|
|
23
|
+
}, initialPrincipal: initialPrincipal, placeholder: placeholder ?? "Email address, username or user id", ariaLabel: "Who to share with", confirmLabel: "Grant", confirmErrorMessage: "Could not grant access.", describeConfirm: (person) => (_jsxs(_Fragment, { children: ["Share with ", _jsx("strong", { className: "break-all", children: describePerson(person) }), " as ", _jsx("em", { children: roleLabels[role] }), "?"] })), onCancel: onCancel, children: _jsx("select", { "aria-label": "Access level", className: "text-sm border border-border rounded-sm py-1.5 px-2 bg-surface text-text", value: role, onChange: (e) => setRole(e.target.value), children: Object.keys(roleLabels).map((value) => (_jsx("option", { value: value, children: roleLabels[value] }, value))) }) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { ResolvedPrincipal } from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
3
|
+
export interface PrincipalResolverProps {
|
|
4
|
+
/** Resolves what was typed - a mailbox address, an auth-server username or e-mail alias, or a user uid - to
|
|
5
|
+
* the one person it names, exact match only. Rejects (typically with an `ApiRequestError`) for nobody. */
|
|
6
|
+
resolve: (principal: string) => Promise<ResolvedPrincipal>;
|
|
7
|
+
/** Called once the caller confirms the resolved person is the right one. The box is cleared once this
|
|
8
|
+
* resolves - throw (or reject) to keep the person on screen and show an error instead. */
|
|
9
|
+
onResolved: (person: ResolvedPrincipal) => void | Promise<void>;
|
|
10
|
+
/** Text put in the box to start with - a stored entry being replaced, say - looked up automatically on mount. */
|
|
11
|
+
initialPrincipal?: string;
|
|
12
|
+
/** What the box asks for. */
|
|
13
|
+
placeholder: string;
|
|
14
|
+
/** The box's accessible name. */
|
|
15
|
+
ariaLabel: string;
|
|
16
|
+
/** Extra controls rendered between the text box and the Find button (e.g. a role selector). */
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/** The confirm button's label (e.g. "Grant", "Use this owner"). */
|
|
19
|
+
confirmLabel: string;
|
|
20
|
+
/** What the confirmation row says once a person is found - e.g. "Share with X as Y?". */
|
|
21
|
+
describeConfirm: (person: ResolvedPrincipal) => ReactNode;
|
|
22
|
+
/** Shown if `onResolved` rejects, unless it was an `ApiRequestError` (then its own message is shown). */
|
|
23
|
+
confirmErrorMessage: string;
|
|
24
|
+
/** Shown as a Cancel button next to the box when set (replacing an entry). */
|
|
25
|
+
onCancel?: () => void;
|
|
26
|
+
}
|
|
27
|
+
/** Who a resolved person is, for a person to check before confirming: their name and address, else their uid. */
|
|
28
|
+
export declare function describePerson(person: ResolvedPrincipal): string;
|
|
29
|
+
/**
|
|
30
|
+
* "Who?" - anywhere a person is assigned by typed identifier rather than picked from an already-loaded list. What
|
|
31
|
+
* is typed is RESOLVED by the server (`resolve`) to the person it names before anything is saved, and the person is
|
|
32
|
+
* shown (name and address) for the caller to confirm; only `onResolved` ever sees the resolved, verified person -
|
|
33
|
+
* never the free text. This is deliberately exact-match, type-then-confirm - never a live/fuzzy search-as-you-type
|
|
34
|
+
* autocomplete, which would let anyone with access to the field enumerate the user directory by partial name.
|
|
35
|
+
*
|
|
36
|
+
* Parameterized entirely by `resolve`/`onResolved` (and the wording props) so every caller - mailbox sharing
|
|
37
|
+
* (`PrincipalPicker`, a thin wrapper around this component), mailbox ownership, escrow-scope holders, ... - reuses
|
|
38
|
+
* the same resolve-then-confirm UX and privacy posture rather than each reimplementing it.
|
|
39
|
+
*
|
|
40
|
+
* Deliberately renders no `<form>` of its own (Enter-to-find is wired up by hand instead, see `handleKeyDown()`) -
|
|
41
|
+
* some callers (`MailboxCreateForm`) use this as one field of their own, larger `<form>`, and a nested `<form>` is
|
|
42
|
+
* invalid HTML that real browsers mis-handle (an inner Enter keypress can submit the wrong one).
|
|
43
|
+
*/
|
|
44
|
+
export default function PrincipalResolver({ resolve, onResolved, initialPrincipal, placeholder, ariaLabel, children, confirmLabel, describeConfirm, confirmErrorMessage, onCancel, }: PrincipalResolverProps): React.JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
3
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
5
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
9
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
10
|
+
/** Who a resolved person is, for a person to check before confirming: their name and address, else their uid. */
|
|
11
|
+
export function describePerson(person) {
|
|
12
|
+
if (person.displayName && person.address)
|
|
13
|
+
return `${person.displayName} <${person.address}>`;
|
|
14
|
+
return person.displayName ?? person.address ?? `user ${person.userUid}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* "Who?" - anywhere a person is assigned by typed identifier rather than picked from an already-loaded list. What
|
|
18
|
+
* is typed is RESOLVED by the server (`resolve`) to the person it names before anything is saved, and the person is
|
|
19
|
+
* shown (name and address) for the caller to confirm; only `onResolved` ever sees the resolved, verified person -
|
|
20
|
+
* never the free text. This is deliberately exact-match, type-then-confirm - never a live/fuzzy search-as-you-type
|
|
21
|
+
* autocomplete, which would let anyone with access to the field enumerate the user directory by partial name.
|
|
22
|
+
*
|
|
23
|
+
* Parameterized entirely by `resolve`/`onResolved` (and the wording props) so every caller - mailbox sharing
|
|
24
|
+
* (`PrincipalPicker`, a thin wrapper around this component), mailbox ownership, escrow-scope holders, ... - reuses
|
|
25
|
+
* the same resolve-then-confirm UX and privacy posture rather than each reimplementing it.
|
|
26
|
+
*
|
|
27
|
+
* Deliberately renders no `<form>` of its own (Enter-to-find is wired up by hand instead, see `handleKeyDown()`) -
|
|
28
|
+
* some callers (`MailboxCreateForm`) use this as one field of their own, larger `<form>`, and a nested `<form>` is
|
|
29
|
+
* invalid HTML that real browsers mis-handle (an inner Enter keypress can submit the wrong one).
|
|
30
|
+
*/
|
|
31
|
+
export default function PrincipalResolver({ resolve, onResolved, initialPrincipal, placeholder, ariaLabel, children, confirmLabel, describeConfirm, confirmErrorMessage, onCancel, }) {
|
|
32
|
+
const [typed, setTyped] = useState(initialPrincipal ?? "");
|
|
33
|
+
const [person, setPerson] = useState(null);
|
|
34
|
+
const [busy, setBusy] = useState(false);
|
|
35
|
+
const [error, setError] = useState(null);
|
|
36
|
+
// A stored entry being replaced is looked up straight away, so its person is shown without a click.
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (initialPrincipal) {
|
|
39
|
+
void find(initialPrincipal);
|
|
40
|
+
}
|
|
41
|
+
}, [initialPrincipal]);
|
|
42
|
+
async function find(principal) {
|
|
43
|
+
setBusy(true);
|
|
44
|
+
setError(null);
|
|
45
|
+
setPerson(null);
|
|
46
|
+
try {
|
|
47
|
+
setPerson(await resolve(principal));
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not look that person up.");
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
setBusy(false);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function submitFind() {
|
|
57
|
+
const principal = typed.trim();
|
|
58
|
+
if (principal) {
|
|
59
|
+
void find(principal);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Enter in the text box finds, same as clicking the button - handled here (not a native `<form>` submit,
|
|
63
|
+
* see this component's own doc comment on why) so it works whether or not a caller nests this inside one of
|
|
64
|
+
* their own forms (`MailboxCreateForm` does). */
|
|
65
|
+
function handleKeyDown(e) {
|
|
66
|
+
if (e.key === "Enter") {
|
|
67
|
+
// Stops the keystroke from also submitting an ANCESTOR `<form>` this component happens to be nested in.
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
submitFind();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// Only reachable from the confirm button, which only renders once `person` is set.
|
|
73
|
+
async function handleConfirm() {
|
|
74
|
+
setBusy(true);
|
|
75
|
+
setError(null);
|
|
76
|
+
try {
|
|
77
|
+
await onResolved(person);
|
|
78
|
+
setTyped("");
|
|
79
|
+
setPerson(null);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
setError(err instanceof ApiRequestError ? err.message : confirmErrorMessage);
|
|
83
|
+
}
|
|
84
|
+
finally {
|
|
85
|
+
setBusy(false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [error && _jsx(Alert, { children: error }), _jsxs("div", { className: "flex gap-2", children: [_jsx("input", { type: "text", "aria-label": ariaLabel, placeholder: placeholder, className: "flex-1 text-sm border border-border rounded-sm py-1.5 px-2 bg-surface text-text", value: typed, onChange: (e) => {
|
|
89
|
+
setTyped(e.target.value);
|
|
90
|
+
setPerson(null);
|
|
91
|
+
}, onKeyDown: handleKeyDown, disabled: busy }), children, _jsx(Button, { type: "button", variant: "secondary", loading: busy && !person, disabled: busy, className: "!w-auto", onClick: submitFind, children: "Find" }), onCancel && (_jsx(Button, { type: "button", variant: "text", className: "!w-auto", onClick: onCancel, children: "Cancel" }))] }), person && (_jsxs("div", { className: "flex items-center justify-between gap-3 text-sm py-2 px-3 border border-border rounded-sm", children: [_jsx("span", { children: describeConfirm(person) }), _jsx(Button, { type: "button", loading: busy, disabled: busy, className: "!w-auto", onClick: () => void handleConfirm(), children: confirmLabel })] }))] }));
|
|
92
|
+
}
|
|
@@ -8,6 +8,7 @@ import { HiOutlineBars3 } from "react-icons/hi2";
|
|
|
8
8
|
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
9
9
|
import { createTaskList, listTaskLists } from "@rapidmx/react-shared/tasks/tasksApi.js";
|
|
10
10
|
import Drawer from "@rapidmx/react-shared/components/overlays/Drawer.js";
|
|
11
|
+
import { notifyApiError } from "../../notifications/apiErrors.js";
|
|
11
12
|
export function tasksViewKey(view) {
|
|
12
13
|
return view.type === "list" ? `list:${view.uid}` : view.type;
|
|
13
14
|
}
|
|
@@ -66,7 +67,8 @@ export default function TasksSidebar({ mailboxUid, tasks, userUid, active, onSel
|
|
|
66
67
|
setAddingList(false);
|
|
67
68
|
}
|
|
68
69
|
catch (err) {
|
|
69
|
-
|
|
70
|
+
// A pop-up: `listsError` is only the lists' own load failure.
|
|
71
|
+
notifyApiError(err, "Couldn't create the list");
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
74
|
function handleSelect(view) {
|
|
@@ -77,5 +79,5 @@ export default function TasksSidebar({ mailboxUid, tasks, userUid, active, onSel
|
|
|
77
79
|
// `Drawer` (see `ContactsSidebar` for the identical pattern and the duplicate-id reasoning behind
|
|
78
80
|
// the `idPrefix`).
|
|
79
81
|
const navContent = (idPrefix) => (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex flex-col gap-0.5", children: [_jsx(NavItem, { label: "My Day", count: myDayCount, active: active.type === "myDay", onClick: () => handleSelect({ type: "myDay" }) }), _jsx(NavItem, { label: "Important", count: importantCount, active: active.type === "important", onClick: () => handleSelect({ type: "important" }) }), _jsx(NavItem, { label: "Planned", count: plannedCount, active: active.type === "planned", onClick: () => handleSelect({ type: "planned" }) }), _jsx(NavItem, { label: "Assigned to me", count: assignedToMeCount, active: active.type === "assignedToMe", onClick: () => handleSelect({ type: "assignedToMe" }) }), _jsx(NavItem, { label: "Flagged email", active: active.type === "flagged", onClick: () => handleSelect({ type: "flagged" }) })] }), _jsx(NavItem, { label: "Tasks", count: tasks.length, active: active.type === "all", onClick: () => handleSelect({ type: "all" }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between px-2.5 mb-1", children: [_jsx("h2", { className: "text-xs font-bold uppercase tracking-wide text-text-muted", children: "Lists" }), _jsx("button", { type: "button", onClick: () => setAddingList(true), "aria-label": "New list", className: "text-xs font-bold text-primary-dark hover:underline", children: "+" })] }), listsError && _jsx("p", { className: "px-2.5 text-xs text-danger", children: listsError }), _jsx("div", { className: "flex flex-col gap-0.5", children: lists.map((list) => (_jsx(NavItem, { label: list.name, count: listCounts.get(list.uid) ?? 0, active: active.type === "list" && active.uid === list.uid, onClick: () => handleSelect({ type: "list", uid: list.uid, name: list.name }) }, list.uid))) }), addingList && (_jsxs("form", { onSubmit: handleAddList, className: "flex items-center gap-1 px-2.5 mt-1", children: [_jsx("input", { type: "text", autoFocus: true, "aria-label": "New list name", id: `${idPrefix}-new-list-name`, value: newListName, onChange: (e) => setNewListName(e.target.value), className: "flex-1 text-xs py-1 px-1.5 border border-border rounded-sm bg-surface" }), _jsx("button", { type: "submit", className: "text-xs font-semibold text-primary-dark", children: "Add" })] }))] })] }));
|
|
80
|
-
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "lg:hidden m-3 mb-0 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open tasks menu", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) }), _jsx("nav", { "aria-label": "Tasks", className: "hidden lg:flex w-56 shrink-0 border-r border-border flex-col gap-4 p-3 overflow-y-auto", children: navContent("desktop") }), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Tasks", children: _jsx("div", { className: "flex flex-col gap-4", children: navContent("mobile") }) })] }));
|
|
81
83
|
}
|
|
@@ -96,7 +96,9 @@ export default function TasksShell({ userUid, authServerUrl, impersonating, impe
|
|
|
96
96
|
const sidebarContent = (idPrefix) => (_jsxs(_Fragment, { children: [mailboxes.length > 1 && (_jsxs("div", { children: [_jsx("label", { className: "block text-xs font-bold uppercase tracking-wide text-text-muted mb-1", htmlFor: `${idPrefix}-tasks-mailbox-switcher`, children: "Mailbox" }), _jsx("select", { id: `${idPrefix}-tasks-mailbox-switcher`, className: "w-full text-sm border border-border rounded-sm py-1.5 px-2 bg-surface", value: mailboxUid, onChange: (e) => {
|
|
97
97
|
navigate(`/tasks?mailboxUid=${encodeURIComponent(e.target.value)}`);
|
|
98
98
|
}, children: mailboxes.map((mb) => (_jsxs("option", { value: mb.uid, children: [mb.displayName, mb.ownerUserUid ? "" : " (shared)"] }, mb.uid))) })] })), folderError && _jsx(Alert, { children: folderError })] }));
|
|
99
|
-
|
|
99
|
+
// With a single mailbox and no error this column would be empty: no 224 px of nothing beside the tasks' own menu.
|
|
100
|
+
const hasSidebar = mailboxes.length > 1 || !!folderError;
|
|
101
|
+
inner = (_jsxs(_Fragment, { children: [hasSidebar && (_jsx("aside", { className: "hidden lg:flex w-56 shrink-0 bg-surface border-r border-border flex-col p-3 gap-3", children: sidebarContent("desktop") })), _jsx(Drawer, { open: drawerOpen, onClose: () => setDrawerOpen(false), title: "Mailbox", children: _jsx("div", { className: "flex flex-col gap-3", children: sidebarContent("mobile") }) }), _jsxs("main", { className: "flex-1 min-w-0 flex flex-col", children: [hasSidebar && (_jsx("button", { type: "button", className: "lg:hidden m-3 w-9 h-9 flex items-center justify-center rounded-sm text-text-muted hover:bg-surface-alt hover:text-text", "aria-label": "Open mailbox switcher", onClick: () => setDrawerOpen(true), children: _jsx(HiOutlineBars3, { size: 20, "aria-hidden": "true" }) })), _jsx(TasksShellContext.Provider, { value: contextValue, children: children })] })] }));
|
|
100
102
|
}
|
|
101
103
|
return (_jsx(AppShell, { active: "tasks", userUid: userUid, authServerUrl: authServerUrl, impersonating: impersonating, impersonationBaseUrl: impersonationBaseUrl, trusted: trusted, trustedRoles: trustedRoles, pluginNav: pluginNav, children: inner }));
|
|
102
104
|
}
|
|
@@ -75,4 +75,4 @@ export interface FolderCounts {
|
|
|
75
75
|
* Holds the folder counts overlay for `MailShell`. `folders` is every folder the sidebar lists (the overlay starts from what
|
|
76
76
|
* each was loaded with); `mailboxes` is whose folders to read back. The overlay starts again whenever `mailboxes` does.
|
|
77
77
|
*/
|
|
78
|
-
export declare function useFolderCounts(mailboxes: Mailbox[], folders: Folder[]): FolderCounts;
|
|
78
|
+
export declare function useFolderCounts(mailboxes: Mailbox[], folders: Folder[], onFoldersListed?: (folders: Folder[]) => void): FolderCounts;
|
|
@@ -62,10 +62,10 @@ const SEEN_LIMIT = 500;
|
|
|
62
62
|
* Holds the folder counts overlay for `MailShell`. `folders` is every folder the sidebar lists (the overlay starts from what
|
|
63
63
|
* each was loaded with); `mailboxes` is whose folders to read back. The overlay starts again whenever `mailboxes` does.
|
|
64
64
|
*/
|
|
65
|
-
export function useFolderCounts(mailboxes, folders) {
|
|
65
|
+
export function useFolderCounts(mailboxes, folders, onFoldersListed) {
|
|
66
66
|
const [counts, setCounts] = useState({});
|
|
67
|
-
const latestRef = useRef({ mailboxes, folders });
|
|
68
|
-
latestRef.current = { mailboxes, folders };
|
|
67
|
+
const latestRef = useRef({ mailboxes, folders, onFoldersListed });
|
|
68
|
+
latestRef.current = { mailboxes, folders, onFoldersListed };
|
|
69
69
|
// Bumped by every change of the overlay this page makes, so a read that started before one can tell it is out of date.
|
|
70
70
|
const changesRef = useRef(0);
|
|
71
71
|
const inFlightRef = useRef(0);
|
|
@@ -116,6 +116,12 @@ export function useFolderCounts(mailboxes, folders) {
|
|
|
116
116
|
if (stoppedRef.current || run !== runRef.current) {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
+
// Whatever the counts' fate below, these are the mailboxes' folders as they are: a folder the sidebar does not have yet is filed now.
|
|
120
|
+
for (const list of results) {
|
|
121
|
+
if (list) {
|
|
122
|
+
latestRef.current.onFoldersListed?.(list);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
119
125
|
if (inFlightRef.current > 0 || changesRef.current !== startedAt) {
|
|
120
126
|
// A change of this page's own began or ended while that was being read, so it may predate it: read again.
|
|
121
127
|
refresh();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Folder } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
2
|
+
import type { MailboxFolders } from "../components/mail/layout/MailShell.js";
|
|
3
|
+
/**
|
|
4
|
+
* The sidebar's order of a mailbox's well-known folders; anything else (`user`) follows, alphabetically. Also the order push channels are asked
|
|
5
|
+
* for (`pushChannelsFor()`), so when the server's channel cap bites it is the folders lowest in this list that go without live updates.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FOLDER_ORDER: string[];
|
|
8
|
+
/**
|
|
9
|
+
* A mailbox's `calendar`/`contacts`/`tasks`/`notes` folders back their own dedicated apps (see `CalendarShell`/`ContactsShell`/`TasksShell`), not
|
|
10
|
+
* Mail - `listFolders()` returns every well-known folder for the mailbox regardless of which app owns it, so Mail's own folder tree filters down
|
|
11
|
+
* to just the mail ones itself, or those other apps' folders leak into its sidebar.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MAIL_FOLDER_TYPES: Set<string>;
|
|
14
|
+
/** The well-known folders the server creates lazily around a first send: what the sidebar shows a placeholder for while a message is on its way. */
|
|
15
|
+
export declare const SEND_FOLDER_TYPES: readonly ["outbox", "sent_items"];
|
|
16
|
+
export declare function isMailFolder(folder: {
|
|
17
|
+
type: string;
|
|
18
|
+
}): boolean;
|
|
19
|
+
/** Well-known folders in `FOLDER_ORDER`, then the rest by name. A new array; the input is left alone. */
|
|
20
|
+
export declare function sortFolders(folders: Folder[]): Folder[];
|
|
21
|
+
/** What a sidebar row is: a folder that exists, or (`placeholder`) one that is expected to but has not arrived yet. */
|
|
22
|
+
export type FolderRow = {
|
|
23
|
+
kind: "folder";
|
|
24
|
+
folder: Folder;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "placeholder";
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The rows of one mailbox's sidebar section, in order: every folder that exists, and - while `sending` messages are on their way and the
|
|
31
|
+
* server has not made the folder yet - a placeholder for each of the Outbox and Sent Items that is missing. The one place a folder that has not
|
|
32
|
+
* arrived is drawn, so it can never appear twice: the moment the real folder is in `folders` its placeholder is not built.
|
|
33
|
+
*/
|
|
34
|
+
export declare function folderRows(folders: Folder[], sending: number): FolderRow[];
|
|
35
|
+
/** What a folder can be changed to by an event or a refetch: everything about it except the counts, which the counts overlay owns. */
|
|
36
|
+
export type FolderChange = Partial<Pick<Folder, "name" | "type" | "parentFolderUid" | "color">> & {
|
|
37
|
+
uid: string;
|
|
38
|
+
mailboxUid?: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Files `folder` in the tree: added under its mailbox when unknown (a type Mail does not list is ignored), else its name, type, parent and
|
|
42
|
+
* colour brought up to date (a folder that became a type Mail does not list leaves the tree). Returns `entries` itself - the same array - when
|
|
43
|
+
* nothing changed, because everything on screen that depends on the tree starts over when it is a new one.
|
|
44
|
+
*/
|
|
45
|
+
export declare function upsertFolder(entries: MailboxFolders[], folder: Folder | FolderChange): MailboxFolders[];
|
|
46
|
+
/** Takes a deleted folder out of the tree. The same array when it was not in it. */
|
|
47
|
+
export declare function removeFolder(entries: MailboxFolders[], folderUid: string): MailboxFolders[];
|
|
48
|
+
/**
|
|
49
|
+
* Brings one mailbox's part of the tree up to date with a listing the server just gave (`listFolders()`): folders it has that the tree lacks
|
|
50
|
+
* are added, changed names and types are taken. Nothing is removed - a listing that began before a folder was created here would take it out
|
|
51
|
+
* again, and deletions arrive as events - and the counts are not touched (see `useFolderCounts()`). The same array when there is nothing to do.
|
|
52
|
+
*/
|
|
53
|
+
export declare function reconcileFolders(entries: MailboxFolders[], listed: Folder[]): MailboxFolders[];
|
|
54
|
+
/** Every folder uid in the tree. */
|
|
55
|
+
export declare function knownFolderUids(entries: MailboxFolders[]): Set<string>;
|