@rapidmx/web-client 0.4.0 → 0.6.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 +88 -0
- package/apps/admin/audit-log/index.tsx +35 -8
- package/apps/admin/data-requests/index.tsx +480 -485
- package/apps/admin/distribution-lists/[uid].tsx +19 -1
- package/apps/admin/escrow-scopes/[uid].tsx +348 -237
- package/apps/admin/escrow-scopes/new/index.tsx +8 -2
- package/apps/admin/index.tsx +19 -1
- package/apps/admin/ingest-queue/index.tsx +44 -5
- package/apps/admin/mailboxes/[uid].tsx +211 -184
- package/apps/admin/quarantine/index.tsx +46 -14
- package/apps/admin/transport-rules/[uid].tsx +30 -1
- package/apps/admin/transport-rules/_transportRuleConfig.tsx +38 -2
- package/apps/admin/transport-rules/index.tsx +24 -6
- package/apps/admin/transport-rules/new/index.tsx +30 -1
- package/apps/escrow/_layout.tsx +2 -3
- package/apps/escrow/audit-log/index.tsx +196 -168
- package/apps/escrow/matters/[uid].tsx +621 -521
- package/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.tsx +22 -1
- package/apps/shared/components/admin/layout/AdminShell.tsx +28 -9
- package/apps/shared/components/admin/mailboxes/EscrowScopeCard.tsx +152 -0
- package/apps/shared/components/admin/mailboxes/ResourceSettingsCard.tsx +3 -3
- package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +55 -11
- package/apps/shared/components/admin/settings/BrandingForm.tsx +15 -4
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +18 -7
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +10 -2
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +6 -0
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +45 -12
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1235 -595
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +174 -98
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +49 -13
- package/apps/shared/components/admin/setup/SetupWizard.tsx +150 -34
- package/apps/shared/components/admin/signOut.ts +79 -0
- package/apps/shared/components/admin/usePagedList.tsx +129 -0
- package/apps/shared/components/calendar/EventModal.tsx +717 -549
- package/apps/shared/components/calendar/MonthView.tsx +173 -139
- package/apps/shared/components/calendar/RecurrenceEditor.tsx +222 -180
- package/apps/shared/components/calendar/SplitDayView.tsx +143 -137
- package/apps/shared/components/calendar/TimeGridView.tsx +244 -198
- package/apps/shared/components/calendar/allDay.ts +124 -0
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +194 -192
- package/apps/shared/components/contacts/ContactDetailPane.tsx +100 -21
- package/apps/shared/components/contacts/ContactForm.tsx +377 -348
- package/apps/shared/components/contacts/ContactsSidebar.tsx +6 -2
- package/apps/shared/components/contacts/KeyChangeReview.tsx +192 -0
- package/apps/shared/components/contacts/contactKeys.ts +78 -0
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +199 -197
- package/apps/shared/components/escrow/layout/EscrowShell.tsx +148 -134
- package/apps/shared/components/layout/AppShell.tsx +123 -33
- package/apps/shared/components/layout/BrandingChrome.tsx +48 -10
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +389 -298
- package/apps/shared/components/layout/MailboxProvisioning.tsx +19 -3
- package/apps/shared/components/layout/RecoveryCodeUnlock.tsx +350 -0
- package/apps/shared/components/layout/UnlockPromptProvider.tsx +257 -128
- package/apps/shared/components/mail/ConversationThreadPane.tsx +216 -181
- package/apps/shared/components/mail/MessageDetailPane.tsx +1318 -630
- package/apps/shared/components/mail/compose/ComposeContext.tsx +20 -15
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +854 -132
- package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +420 -408
- package/apps/shared/components/mail/pinnedSigners.ts +124 -0
- package/apps/shared/components/mail/verificationSeals.ts +125 -0
- package/apps/shared/components/mail/writableMailboxes.ts +101 -0
- package/apps/shared/components/rules/RuleBuilder.tsx +311 -276
- package/apps/shared/components/settings/layout/SettingsShell.tsx +23 -9
- package/apps/shared/components/tasks/layout/TasksShell.tsx +201 -199
- package/apps/shared/mail/listAllPages.ts +39 -0
- package/apps/shared/plugins/pluginNav.ts +73 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +64 -55
- package/apps/shared/search/localIndexBuilder.ts +481 -179
- package/apps/shared/search/localIndexRpcClient.ts +231 -29
- package/apps/shared/search/localIndexSchema.ts +15 -6
- package/apps/shared/search/localIndexStorage.ts +98 -0
- package/apps/shared/search/localIndexVFS.ts +32 -1
- package/apps/shared/search/localIndexWorker.ts +648 -186
- package/apps/www/calendar/index.tsx +438 -417
- package/apps/www/contacts/[uid].tsx +21 -2
- package/apps/www/contacts/index.tsx +116 -12
- package/apps/www/index.tsx +1314 -1041
- package/apps/www/messages/[uid].tsx +18 -6
- package/apps/www/settings/auto-reply/index.tsx +134 -129
- package/apps/www/settings/encryption/index.tsx +739 -216
- package/apps/www/settings/filters/[uid].tsx +171 -155
- package/apps/www/settings/filters/new/index.tsx +8 -1
- package/apps/www/settings/focused-inbox/index.tsx +150 -148
- package/apps/www/settings/privacy/index.tsx +494 -436
- package/apps/www/settings/read-receipts/index.tsx +148 -125
- package/apps/www/settings/sharing/index.tsx +17 -14
- package/apps/www/tasks/index.tsx +638 -579
- package/dist/apps/admin/_404.d.ts +2 -0
- package/dist/apps/admin/_500.d.ts +2 -0
- package/dist/apps/admin/_layout.d.ts +8 -0
- package/dist/apps/admin/audit-log/index.d.ts +11 -0
- package/dist/apps/admin/audit-log/index.js +38 -8
- package/dist/apps/admin/branding/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.js +52 -72
- package/dist/apps/admin/distribution-lists/[uid].d.ts +7 -0
- package/dist/apps/admin/distribution-lists/[uid].js +1 -1
- package/dist/apps/admin/distribution-lists/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/new/index.d.ts +3 -0
- package/dist/apps/admin/domains/[uid].d.ts +7 -0
- package/dist/apps/admin/domains/index.d.ts +3 -0
- package/dist/apps/admin/domains/new/index.d.ts +3 -0
- package/dist/apps/admin/encryption-policy/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/[uid].d.ts +21 -0
- package/dist/apps/admin/escrow-scopes/[uid].js +91 -12
- package/dist/apps/admin/escrow-scopes/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.js +8 -3
- package/dist/apps/admin/index.d.ts +3 -0
- package/dist/apps/admin/index.js +4 -1
- package/dist/apps/admin/ingest-queue/index.d.ts +4 -0
- package/dist/apps/admin/ingest-queue/index.js +24 -6
- package/dist/apps/admin/mailbox-policy/index.d.ts +3 -0
- package/dist/apps/admin/mailboxes/[uid].d.ts +7 -0
- package/dist/apps/admin/mailboxes/[uid].js +20 -4
- package/dist/apps/admin/mailboxes/new/index.d.ts +3 -0
- package/dist/apps/admin/plugins/index.d.ts +3 -0
- package/dist/apps/admin/quarantine/index.d.ts +6 -0
- package/dist/apps/admin/quarantine/index.js +20 -11
- package/dist/apps/admin/retention-policy/index.d.ts +3 -0
- package/dist/apps/admin/setup/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/[uid].d.ts +7 -0
- package/dist/apps/admin/transport-rules/[uid].js +18 -2
- package/dist/apps/admin/transport-rules/_transportRuleConfig.d.ts +21 -0
- package/dist/apps/admin/transport-rules/_transportRuleConfig.js +19 -0
- package/dist/apps/admin/transport-rules/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/index.js +22 -6
- package/dist/apps/admin/transport-rules/new/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/new/index.js +18 -2
- package/dist/apps/escrow/_layout.d.ts +10 -0
- package/dist/apps/escrow/_layout.js +3 -3
- package/dist/apps/escrow/audit-log/index.d.ts +9 -0
- package/dist/apps/escrow/audit-log/index.js +26 -1
- package/dist/apps/escrow/index.d.ts +3 -0
- package/dist/apps/escrow/matters/[uid].d.ts +7 -0
- package/dist/apps/escrow/matters/[uid].js +77 -42
- package/dist/apps/escrow/matters/new/index.d.ts +3 -0
- package/dist/apps/shared/components/admin/distributionLists/MemberListCard.d.ts +17 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.d.ts +32 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js +11 -2
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.js +15 -6
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.js +72 -0
- package/dist/apps/shared/components/admin/mailboxes/MailboxTable.d.ts +6 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.d.ts +19 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.js +3 -3
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +22 -4
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +15 -4
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +13 -7
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +7 -2
- package/dist/apps/shared/components/admin/settings/LoadedSettingsForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.d.ts +19 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +6 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.d.ts +10 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +34 -12
- package/dist/apps/shared/components/admin/settings/PluginsManager.d.ts +4 -0
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +390 -78
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +40 -11
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.d.ts +14 -0
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +29 -13
- package/dist/apps/shared/components/admin/setup/SetupWizard.d.ts +36 -0
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +87 -21
- package/dist/apps/shared/components/admin/signOut.d.ts +23 -0
- package/dist/apps/shared/components/admin/signOut.js +75 -0
- package/dist/apps/shared/components/admin/usePagedList.d.ts +39 -0
- package/dist/apps/shared/components/admin/usePagedList.js +99 -0
- package/dist/apps/shared/components/calendar/CalendarListSidebar.d.ts +26 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +46 -0
- package/dist/apps/shared/components/calendar/EventModal.js +142 -21
- package/dist/apps/shared/components/calendar/MonthView.d.ts +15 -0
- package/dist/apps/shared/components/calendar/MonthView.js +12 -5
- package/dist/apps/shared/components/calendar/RecurrenceEditor.d.ts +20 -0
- package/dist/apps/shared/components/calendar/RecurrenceEditor.js +40 -5
- package/dist/apps/shared/components/calendar/ResourcePicker.d.ts +19 -0
- package/dist/apps/shared/components/calendar/SplitDayView.d.ts +28 -0
- package/dist/apps/shared/components/calendar/SplitDayView.js +10 -4
- package/dist/apps/shared/components/calendar/TimeGridView.d.ts +17 -0
- package/dist/apps/shared/components/calendar/TimeGridView.js +23 -7
- package/dist/apps/shared/components/calendar/allDay.d.ts +51 -0
- package/dist/apps/shared/components/calendar/allDay.js +111 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +40 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +3 -3
- package/dist/apps/shared/components/contacts/ContactDetailPane.d.ts +23 -0
- package/dist/apps/shared/components/contacts/ContactDetailPane.js +43 -5
- package/dist/apps/shared/components/contacts/ContactForm.d.ts +20 -0
- package/dist/apps/shared/components/contacts/ContactForm.js +32 -10
- package/dist/apps/shared/components/contacts/ContactsSidebar.d.ts +40 -0
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +2 -2
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +25 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.d.ts +40 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.js +63 -0
- package/dist/apps/shared/components/contacts/contactKeys.d.ts +29 -0
- package/dist/apps/shared/components/contacts/contactKeys.js +64 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +21 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +2 -2
- package/dist/apps/shared/components/escrow/layout/EscrowShell.d.ts +25 -0
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +24 -5
- package/dist/apps/shared/components/forms/StringListField.d.ts +22 -0
- package/dist/apps/shared/components/layout/AppShell.d.ts +49 -0
- package/dist/apps/shared/components/layout/AppShell.js +97 -26
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +18 -0
- package/dist/apps/shared/components/layout/BrandingChrome.js +45 -10
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.d.ts +51 -0
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +49 -12
- package/dist/apps/shared/components/layout/MailboxProvisioning.d.ts +13 -0
- package/dist/apps/shared/components/layout/MailboxProvisioning.js +10 -2
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.d.ts +66 -0
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.js +174 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.d.ts +45 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.js +73 -14
- package/dist/apps/shared/components/layout/UserMenu.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationList.d.ts +11 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +50 -12
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +93 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.js +441 -36
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +58 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +9 -6
- package/dist/apps/shared/components/mail/compose/ComposeToolbar.d.ts +15 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +699 -128
- package/dist/apps/shared/components/mail/compose/EmojiPicker.d.ts +14 -0
- package/dist/apps/shared/components/mail/compose/GifPicker.d.ts +13 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +34 -0
- package/dist/apps/shared/components/mail/compose/ScheduleSendPicker.d.ts +16 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.d.ts +27 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.js +50 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +57 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +13 -4
- package/dist/apps/shared/components/mail/pinnedSigners.d.ts +33 -0
- package/dist/apps/shared/components/mail/pinnedSigners.js +98 -0
- package/dist/apps/shared/components/mail/verificationSeals.d.ts +22 -0
- package/dist/apps/shared/components/mail/verificationSeals.js +112 -0
- package/dist/apps/shared/components/mail/writableMailboxes.d.ts +15 -0
- package/dist/apps/shared/components/mail/writableMailboxes.js +87 -0
- package/dist/apps/shared/components/rules/RuleBuilder.d.ts +70 -0
- package/dist/apps/shared/components/rules/RuleBuilder.js +34 -6
- package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +41 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +19 -9
- package/dist/apps/shared/components/tasks/TasksSidebar.d.ts +41 -0
- package/dist/apps/shared/components/tasks/TasksToolbar.d.ts +14 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +24 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +2 -2
- package/dist/apps/shared/mail/findWellKnownFolderUid.d.ts +5 -0
- package/dist/apps/shared/mail/listAllPages.d.ts +17 -0
- package/dist/apps/shared/mail/listAllPages.js +25 -0
- package/dist/apps/shared/plugins/pluginNav.d.ts +39 -0
- package/dist/apps/shared/plugins/pluginNav.js +33 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.d.ts +13 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.js +58 -54
- package/dist/apps/shared/search/localIndexBlockCipher.d.ts +36 -0
- package/dist/apps/shared/search/localIndexBuilder.d.ts +85 -0
- package/dist/apps/shared/search/localIndexBuilder.js +292 -37
- package/dist/apps/shared/search/localIndexKey.d.ts +4 -0
- package/dist/apps/shared/search/localIndexRpcClient.d.ts +71 -0
- package/dist/apps/shared/search/localIndexRpcClient.js +191 -26
- package/dist/apps/shared/search/localIndexSchema.d.ts +111 -0
- package/dist/apps/shared/search/localIndexSchema.js +12 -6
- package/dist/apps/shared/search/localIndexSizePreference.d.ts +27 -0
- package/dist/apps/shared/search/localIndexStorage.d.ts +28 -0
- package/dist/apps/shared/search/localIndexStorage.js +86 -0
- package/dist/apps/shared/search/localIndexVFS.d.ts +101 -0
- package/dist/apps/shared/search/localIndexVFS.js +68 -40
- package/dist/apps/shared/search/localIndexWorker.d.ts +145 -0
- package/dist/apps/shared/search/localIndexWorker.js +519 -173
- package/dist/apps/shared/search/searchTier2.d.ts +30 -0
- package/dist/apps/www/_404.d.ts +2 -0
- package/dist/apps/www/_500.d.ts +2 -0
- package/dist/apps/www/_layout.d.ts +14 -0
- package/dist/apps/www/calendar/index.d.ts +3 -0
- package/dist/apps/www/calendar/index.js +28 -10
- package/dist/apps/www/contacts/[uid].d.ts +13 -0
- package/dist/apps/www/contacts/[uid].js +13 -2
- package/dist/apps/www/contacts/index.d.ts +3 -0
- package/dist/apps/www/contacts/index.js +80 -10
- package/dist/apps/www/index.d.ts +3 -0
- package/dist/apps/www/index.js +339 -108
- package/dist/apps/www/messages/[uid].d.ts +11 -0
- package/dist/apps/www/messages/[uid].js +18 -6
- package/dist/apps/www/settings/auto-reply/index.d.ts +4 -0
- package/dist/apps/www/settings/auto-reply/index.js +9 -4
- package/dist/apps/www/settings/encryption/index.d.ts +7 -0
- package/dist/apps/www/settings/encryption/index.js +514 -97
- package/dist/apps/www/settings/filters/[uid].d.ts +8 -0
- package/dist/apps/www/settings/filters/[uid].js +22 -7
- package/dist/apps/www/settings/filters/_mailFilterRuleConfig.d.ts +11 -0
- package/dist/apps/www/settings/filters/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.js +8 -2
- package/dist/apps/www/settings/focused-inbox/index.d.ts +4 -0
- package/dist/apps/www/settings/focused-inbox/index.js +3 -1
- package/dist/apps/www/settings/labels/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.js +57 -22
- package/dist/apps/www/settings/read-receipts/index.d.ts +4 -0
- package/dist/apps/www/settings/read-receipts/index.js +10 -3
- package/dist/apps/www/settings/sharing/index.d.ts +4 -0
- package/dist/apps/www/settings/sharing/index.js +7 -11
- package/dist/apps/www/settings/signatures/[uid].d.ts +8 -0
- package/dist/apps/www/settings/signatures/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/new/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/signatureDefaults.d.ts +10 -0
- package/dist/apps/www/tasks/index.d.ts +3 -0
- package/dist/apps/www/tasks/index.js +50 -10
- package/package.json +3 -3
- package/apps/shared/components/booking/AvailabilityEditor.tsx +0 -118
- package/apps/www/settings/booking-types/[uid].tsx +0 -300
- package/apps/www/settings/booking-types/index.tsx +0 -98
- package/apps/www/settings/booking-types/new/index.tsx +0 -212
- package/dist/apps/shared/components/booking/AvailabilityEditor.js +0 -45
- package/dist/apps/www/settings/booking-types/[uid].js +0 -129
- package/dist/apps/www/settings/booking-types/index.js +0 -29
- package/dist/apps/www/settings/booking-types/new/index.js +0 -86
|
@@ -7,15 +7,15 @@ import { useState } from "react";
|
|
|
7
7
|
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
8
|
import { createEscrowScope } from "@rapidmx/react-shared/admin/escrowScopesApi.js";
|
|
9
9
|
import AdminShell from "../../../shared/components/admin/layout/AdminShell.js";
|
|
10
|
-
import EscrowScopeKeyAndHoldersFields, { emptyEscrowScopeKeyAndHoldersValue, } from "../../../shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js";
|
|
10
|
+
import EscrowScopeKeyAndHoldersFields, { emptyEscrowScopeKeyAndHoldersValue, selfAsHolderError, } from "../../../shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js";
|
|
11
11
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
12
12
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
13
13
|
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
14
14
|
const INPUT_CLASS = "w-full text-sm py-2.5 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
15
15
|
export default function NewEscrowScopePage(props) {
|
|
16
|
-
return (_jsx(AdminShell, { ...props, active: "escrowScopes", children: _jsx(NewEscrowScopeForm, {}) }));
|
|
16
|
+
return (_jsx(AdminShell, { ...props, active: "escrowScopes", children: _jsx(NewEscrowScopeForm, { adminUid: props.userUid }) }));
|
|
17
17
|
}
|
|
18
|
-
function NewEscrowScopeForm() {
|
|
18
|
+
function NewEscrowScopeForm({ adminUid }) {
|
|
19
19
|
const [name, setName] = useState("");
|
|
20
20
|
const [description, setDescription] = useState("");
|
|
21
21
|
const [keyAndHolders, setKeyAndHolders] = useState(emptyEscrowScopeKeyAndHoldersValue());
|
|
@@ -40,6 +40,11 @@ function NewEscrowScopeForm() {
|
|
|
40
40
|
setError("Required holders must be between 1 and the number of holders.");
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
+
const selfError = selfAsHolderError(keyAndHolders.holderUserUids, adminUid);
|
|
44
|
+
if (selfError) {
|
|
45
|
+
setError(selfError);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
43
48
|
setSaving(true);
|
|
44
49
|
try {
|
|
45
50
|
const created = await createEscrowScope({
|
package/dist/apps/admin/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import AdminShell from "../shared/components/admin/layout/AdminShell.js";
|
|
|
11
11
|
import MailboxTable from "../shared/components/admin/mailboxes/MailboxTable.js";
|
|
12
12
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
13
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
14
15
|
const PAGE_SIZE = 25;
|
|
15
16
|
export default function MailboxesListPage(props) {
|
|
16
17
|
return (_jsx(AdminShell, { ...props, active: "mailboxes", children: _jsx(MailboxesListContent, {}) }));
|
|
@@ -30,6 +31,7 @@ function MailboxesListContent() {
|
|
|
30
31
|
}, [page]);
|
|
31
32
|
const hasNextPage = mailboxes.length === PAGE_SIZE;
|
|
32
33
|
const [reopening, setReopening] = useState(false);
|
|
34
|
+
const [confirmingSetup, setConfirmingSetup] = useState(false);
|
|
33
35
|
async function handleRunSetup() {
|
|
34
36
|
setReopening(true);
|
|
35
37
|
try {
|
|
@@ -39,7 +41,8 @@ function MailboxesListContent() {
|
|
|
39
41
|
catch (err) {
|
|
40
42
|
setError(err instanceof ApiRequestError ? err.message : "Could not reopen setup.");
|
|
41
43
|
setReopening(false);
|
|
44
|
+
setConfirmingSetup(false);
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between mb-5", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide", children: "Mailboxes" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto",
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between mb-5", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide", children: "Mailboxes" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", disabled: reopening, onClick: () => setConfirmingSetup(true), children: "Run setup again" }), _jsx("a", { href: "/admin/mailboxes/new", children: _jsx(Button, { type: "button", className: "!w-auto", children: "+ New mailbox" }) })] })] }), error && _jsx(Alert, { children: error }), _jsxs(Modal, { open: confirmingSetup, onClose: () => setConfirmingSetup(false), title: "Run setup again?", children: [_jsx("p", { className: "text-sm mb-4", children: "Setup starts again from its first step, and the admin console sends administrators to it until it's finished. Your existing settings, domains and mailboxes are kept." }), _jsxs("div", { className: "flex gap-2 justify-end", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", onClick: () => setConfirmingSetup(false), children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto", loading: reopening, disabled: reopening, onClick: () => void handleRunSetup(), children: "Run setup" })] })] }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : (_jsx(MailboxTable, { mailboxes: mailboxes })), _jsxs("div", { className: "flex gap-3 items-center mt-4", children: [_jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: page === 0 || loading, onClick: () => setPage((p) => Math.max(0, p - 1)), children: "Previous" }), _jsxs("span", { className: "text-sm text-text-muted", children: ["Page ", page + 1] }), _jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: !hasNextPage || loading, onClick: () => setPage((p) => p + 1), children: "Next" })] })] }));
|
|
45
48
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AdminShellProps } from "../../shared/components/admin/layout/AdminShell.js";
|
|
3
|
+
export declare function readMailboxUid(): string | null;
|
|
4
|
+
export default function IngestQueuePage(props: Omit<AdminShellProps, "active">): React.JSX.Element;
|
|
@@ -8,6 +8,8 @@ import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
|
8
8
|
import { listIngestQueue } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
9
9
|
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
10
10
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
|
+
const PAGE_SIZE = 25;
|
|
11
13
|
export function readMailboxUid() {
|
|
12
14
|
if (typeof window === "undefined")
|
|
13
15
|
return null;
|
|
@@ -24,6 +26,7 @@ export default function IngestQueuePage(props) {
|
|
|
24
26
|
}
|
|
25
27
|
function IngestQueueContent() {
|
|
26
28
|
const [mailboxUid, setMailboxUid] = useState(null);
|
|
29
|
+
const [page, setPage] = useState(0);
|
|
27
30
|
const [entries, setEntries] = useState([]);
|
|
28
31
|
const [loading, setLoading] = useState(true);
|
|
29
32
|
const [error, setError] = useState(null);
|
|
@@ -34,15 +37,30 @@ function IngestQueueContent() {
|
|
|
34
37
|
if (!mailboxUid) {
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
40
|
+
// Paging quickly can leave an older page's response landing last - only the latest request's is applied.
|
|
41
|
+
let cancelled = false;
|
|
37
42
|
setLoading(true);
|
|
38
43
|
setError(null);
|
|
39
|
-
listIngestQueue(mailboxUid)
|
|
40
|
-
.then(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
listIngestQueue(mailboxUid, { page, limit: PAGE_SIZE })
|
|
45
|
+
.then((data) => {
|
|
46
|
+
if (!cancelled)
|
|
47
|
+
setEntries(data);
|
|
48
|
+
})
|
|
49
|
+
.catch((err) => {
|
|
50
|
+
if (!cancelled)
|
|
51
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not load the ingest queue.");
|
|
52
|
+
})
|
|
53
|
+
.finally(() => {
|
|
54
|
+
if (!cancelled)
|
|
55
|
+
setLoading(false);
|
|
56
|
+
});
|
|
57
|
+
return () => {
|
|
58
|
+
cancelled = true;
|
|
59
|
+
};
|
|
60
|
+
}, [mailboxUid, page]);
|
|
61
|
+
const hasNextPage = entries.length === PAGE_SIZE;
|
|
44
62
|
if (!mailboxUid) {
|
|
45
63
|
return _jsx(Alert, { children: "No mailbox specified. Open a mailbox's detail page and choose \"View ingest queue\"." });
|
|
46
64
|
}
|
|
47
|
-
return (_jsxs("div", { className: "max-w-4xl flex flex-col gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: `/admin/mailboxes/${encodeURIComponent(mailboxUid)}`, className: "text-sm text-primary-dark hover:underline", children: "\u2190 Back to mailbox" }), _jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mt-1", children: "Ingest queue" })] }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : entries.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "Nothing pending or failed for this mailbox." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["From", "To", "Received", "Status", "Error"].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: entries.map((entry) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.envelopeFrom }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.envelopeTo.join(", ") }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: new Date(entry.dateCreated).toLocaleString() }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: _jsx("span", { className: `inline-block text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill ${STATUS_STYLES[entry.status]}`, children: entry.status }) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-text-muted", children: entry.errorMessage ?? "" })] }, entry.uid))) })] }) }))] }));
|
|
65
|
+
return (_jsxs("div", { className: "max-w-4xl flex flex-col gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: `/admin/mailboxes/${encodeURIComponent(mailboxUid)}`, className: "text-sm text-primary-dark hover:underline", children: "\u2190 Back to mailbox" }), _jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mt-1", children: "Ingest queue" })] }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : entries.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "Nothing pending or failed for this mailbox." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["From", "To", "Received", "Status", "Error"].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: entries.map((entry) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.envelopeFrom }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.envelopeTo.join(", ") }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: new Date(entry.dateCreated).toLocaleString() }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: _jsx("span", { className: `inline-block text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill ${STATUS_STYLES[entry.status]}`, children: entry.status }) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-text-muted", children: entry.errorMessage ?? "" })] }, entry.uid))) })] }) })), _jsxs("div", { className: "flex gap-3 items-center", children: [_jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: page === 0 || loading, onClick: () => setPage((p) => Math.max(0, p - 1)), children: "Previous" }), _jsxs("span", { className: "text-sm text-text-muted", children: ["Page ", page + 1] }), _jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: !hasNextPage || loading, onClick: () => setPage((p) => p + 1), children: "Next" })] })] }));
|
|
48
66
|
}
|
|
@@ -9,6 +9,7 @@ import { deleteMailbox, getMailbox, impersonateUser } from "@rapidmx/react-share
|
|
|
9
9
|
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
10
10
|
import ShareAccessCard from "../../shared/components/admin/mailboxes/ShareAccessCard.js";
|
|
11
11
|
import ResourceSettingsCard from "../../shared/components/admin/mailboxes/ResourceSettingsCard.js";
|
|
12
|
+
import EscrowScopeCard from "../../shared/components/admin/mailboxes/EscrowScopeCard.js";
|
|
12
13
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
14
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
15
|
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
@@ -28,22 +29,37 @@ function MailboxDetailContent({ uid, impersonationBaseUrl }) {
|
|
|
28
29
|
const [mailbox, setMailbox] = useState(null);
|
|
29
30
|
const [loading, setLoading] = useState(true);
|
|
30
31
|
const [error, setError] = useState(null);
|
|
32
|
+
const [confirmingAccess, setConfirmingAccess] = useState(false);
|
|
31
33
|
const [impersonating, setImpersonating] = useState(false);
|
|
34
|
+
const [accessError, setAccessError] = useState(null);
|
|
32
35
|
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
33
36
|
const [deleting, setDeleting] = useState(false);
|
|
34
37
|
const [deleteError, setDeleteError] = useState(null);
|
|
35
|
-
|
|
38
|
+
// Ignored while the action is under way (Escape/Close; Cancel is disabled then too), so its result or error
|
|
39
|
+
// can't land on a modal reopened afterwards.
|
|
40
|
+
function closeAccessModal() {
|
|
41
|
+
if (impersonating)
|
|
42
|
+
return;
|
|
43
|
+
setConfirmingAccess(false);
|
|
44
|
+
setAccessError(null);
|
|
45
|
+
}
|
|
46
|
+
// Only ever invoked from the access-confirmation modal below, which only renders for a loaded mailbox that has
|
|
47
|
+
// an owner. A failure stays in the modal rather than replacing the whole page.
|
|
48
|
+
async function handleAccessMailbox() {
|
|
36
49
|
setImpersonating(true);
|
|
50
|
+
setAccessError(null);
|
|
37
51
|
try {
|
|
38
|
-
await impersonateUser(impersonationBaseUrl ?? "", ownerUserUid);
|
|
52
|
+
await impersonateUser(impersonationBaseUrl ?? "", mailbox.ownerUserUid);
|
|
39
53
|
window.location.href = "/";
|
|
40
54
|
}
|
|
41
55
|
catch (err) {
|
|
42
|
-
|
|
56
|
+
setAccessError(err instanceof ApiRequestError ? err.message : "Could not access this mailbox.");
|
|
43
57
|
setImpersonating(false);
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
function closeDeleteModal() {
|
|
61
|
+
if (deleting)
|
|
62
|
+
return;
|
|
47
63
|
setConfirmingDelete(false);
|
|
48
64
|
}
|
|
49
65
|
// Only ever invoked from the delete-confirmation modal below, which itself only renders once
|
|
@@ -79,5 +95,5 @@ function MailboxDetailContent({ uid, impersonationBaseUrl }) {
|
|
|
79
95
|
}
|
|
80
96
|
const quarantineHref = `/admin/quarantine?mailboxUid=${encodeURIComponent(mailbox.uid)}`;
|
|
81
97
|
const ingestQueueHref = `/admin/ingest-queue?mailboxUid=${encodeURIComponent(mailbox.uid)}`;
|
|
82
|
-
return (_jsxs("div", { className: "max-w-3xl flex flex-col gap-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: "/admin", className: "text-sm text-primary-dark hover:underline", children: "\u2190 All mailboxes" }), _jsx("h1", { className: "text-xl font-bold tracking-tight mt-1", children: mailbox.primarySmtpAddress })] }), _jsxs("div", { className: "flex gap-3 shrink-0", children: [mailbox.ownerUserUid && (_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto",
|
|
98
|
+
return (_jsxs("div", { className: "max-w-3xl flex flex-col gap-5", children: [_jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: "/admin", className: "text-sm text-primary-dark hover:underline", children: "\u2190 All mailboxes" }), _jsx("h1", { className: "text-xl font-bold tracking-tight mt-1", children: mailbox.primarySmtpAddress })] }), _jsxs("div", { className: "flex gap-3 shrink-0", children: [mailbox.ownerUserUid && (_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", onClick: () => setConfirmingAccess(true), children: "Access this mailbox" })), _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto !border-danger !text-danger hover:!border-danger hover:!text-danger", onClick: () => setConfirmingDelete(true), children: "Delete mailbox" })] })] }), _jsxs("div", { className: "bg-surface border border-border rounded-md p-6", children: [_jsxs("dl", { className: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 text-sm", children: [_jsx("dt", { className: "text-text-muted", children: "Display name" }), _jsx("dd", { children: mailbox.displayName }), _jsx("dt", { className: "text-text-muted", children: "Owner" }), _jsx("dd", { children: mailbox.ownerUserUid ?? "None (shared mailbox)" }), _jsx("dt", { className: "text-text-muted", children: "Timezone" }), _jsx("dd", { children: mailbox.timezone }), _jsx("dt", { className: "text-text-muted", children: "Quota" }), _jsxs("dd", { children: [formatBytes(mailbox.usedBytes), " / ", formatBytes(mailbox.quotaBytes)] }), _jsx("dt", { className: "text-text-muted", children: "Alias addresses" }), _jsx("dd", { children: mailbox.aliasAddresses.length > 0 ? mailbox.aliasAddresses.join(", ") : "None" }), mailbox.isResource && (_jsxs(_Fragment, { children: [_jsx("dt", { className: "text-text-muted", children: "Resource type" }), _jsx("dd", { className: "capitalize", children: mailbox.resourceType ?? "room" })] })), _jsx("dt", { className: "text-text-muted", children: "Created" }), _jsx("dd", { children: new Date(mailbox.dateCreated).toLocaleString() })] }), _jsxs("div", { className: "flex gap-4 mt-5 pt-5 border-t border-border text-sm font-medium", children: [_jsx("a", { href: quarantineHref, className: "text-primary-dark hover:underline", children: "View quarantine" }), _jsx("a", { href: ingestQueueHref, className: "text-primary-dark hover:underline", children: "View ingest queue" })] })] }), _jsx(ShareAccessCard, { mailboxUid: mailbox.uid, ownerUserUid: mailbox.ownerUserUid }), _jsx(EscrowScopeCard, { mailbox: mailbox, onUpdate: setMailbox }), mailbox.isResource && _jsx(ResourceSettingsCard, { mailbox: mailbox, onUpdate: setMailbox }), _jsxs(Modal, { open: confirmingAccess, onClose: closeAccessModal, title: "Access this mailbox", children: [_jsxs("p", { className: "text-sm mb-3", children: ["You\u2019ll be signed in as ", _jsx("strong", { className: "break-all", children: mailbox.ownerUserUid }), ", the owner of ", _jsx("strong", { className: "break-all", children: mailbox.primarySmtpAddress }), ", and see everything they can - and act as them, until you stop impersonating."] }), accessError && _jsx(Alert, { children: accessError }), _jsxs("div", { className: "flex gap-3 justify-end mt-5", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", disabled: impersonating, onClick: closeAccessModal, children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto", loading: impersonating, disabled: impersonating, onClick: handleAccessMailbox, children: "Access mailbox" })] })] }), _jsxs(Modal, { open: confirmingDelete, onClose: closeDeleteModal, title: "Delete mailbox", children: [_jsxs("p", { className: "text-sm mb-5", children: ["Are you sure you want to delete ", _jsx("strong", { children: mailbox.primarySmtpAddress }), "? This permanently deletes the mailbox and everything in it, and cannot be undone. It fails if this mailbox is a custodian on an active legal hold."] }), deleteError && _jsx(Alert, { children: deleteError }), _jsxs("div", { className: "flex gap-3 justify-end mt-5", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", disabled: deleting, onClick: closeDeleteModal, children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto !bg-none !bg-danger !border-danger hover:!bg-danger", loading: deleting, disabled: deleting, onClick: handleDelete, children: "Delete" })] })] })] }));
|
|
83
99
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AdminShellProps } from "../../shared/components/admin/layout/AdminShell.js";
|
|
3
|
+
export declare function readMailboxUid(): string | null;
|
|
4
|
+
export default function QuarantinePage(props: Omit<AdminShellProps, "active"> & {
|
|
5
|
+
userUid?: string;
|
|
6
|
+
}): React.JSX.Element;
|
|
@@ -9,6 +9,7 @@ import { listQuarantine, releaseQuarantineEntry } from "@rapidmx/react-shared/ma
|
|
|
9
9
|
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
10
10
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
11
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
12
13
|
const PAGE_SIZE = 25;
|
|
13
14
|
export function readMailboxUid() {
|
|
14
15
|
if (typeof window === "undefined")
|
|
@@ -24,7 +25,9 @@ function QuarantineContent({ userUid }) {
|
|
|
24
25
|
const [entries, setEntries] = useState([]);
|
|
25
26
|
const [loading, setLoading] = useState(true);
|
|
26
27
|
const [error, setError] = useState(null);
|
|
27
|
-
const [
|
|
28
|
+
const [releaseTarget, setReleaseTarget] = useState(null);
|
|
29
|
+
const [releasing, setReleasing] = useState(false);
|
|
30
|
+
const [releaseError, setReleaseError] = useState(null);
|
|
28
31
|
useEffect(() => {
|
|
29
32
|
setMailboxUid(readMailboxUid());
|
|
30
33
|
}, []);
|
|
@@ -42,25 +45,31 @@ function QuarantineContent({ userUid }) {
|
|
|
42
45
|
}
|
|
43
46
|
}, [mailboxUid, page]);
|
|
44
47
|
const hasNextPage = entries.length === PAGE_SIZE;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
function closeReleaseModal() {
|
|
49
|
+
setReleaseTarget(null);
|
|
50
|
+
setReleaseError(null);
|
|
51
|
+
}
|
|
52
|
+
// Only ever invoked from the confirmation modal below, which only renders once `releaseTarget` is set, once
|
|
53
|
+
// `mailboxUid` is known, and once `AdminShell` has confirmed `userUid` (children only render once authorized).
|
|
54
|
+
// `releaseQuarantineEntry()` still sends its own `releasedAt`/`releasedByUserUid`; the server now stamps both
|
|
55
|
+
// itself and ignores the client's values, so what's displayed afterwards comes from the reloaded list.
|
|
56
|
+
async function handleRelease() {
|
|
57
|
+
setReleasing(true);
|
|
58
|
+
setReleaseError(null);
|
|
51
59
|
try {
|
|
52
|
-
await releaseQuarantineEntry(
|
|
60
|
+
await releaseQuarantineEntry(releaseTarget.uid, releaseTarget.version, userUid);
|
|
61
|
+
closeReleaseModal();
|
|
53
62
|
reload(mailboxUid);
|
|
54
63
|
}
|
|
55
64
|
catch (err) {
|
|
56
|
-
|
|
65
|
+
setReleaseError(err instanceof ApiRequestError ? err.message : "Could not mark this message released.");
|
|
57
66
|
}
|
|
58
67
|
finally {
|
|
59
|
-
setReleasing(
|
|
68
|
+
setReleasing(false);
|
|
60
69
|
}
|
|
61
70
|
}
|
|
62
71
|
if (!mailboxUid) {
|
|
63
72
|
return _jsx(Alert, { children: "No mailbox specified. Open a mailbox's detail page and choose \"View quarantine\"." });
|
|
64
73
|
}
|
|
65
|
-
return (_jsxs("div", { className: "max-w-4xl flex flex-col gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: `/admin/mailboxes/${encodeURIComponent(mailboxUid)}`, className: "text-sm text-primary-dark hover:underline", children: "\u2190 Back to mailbox" }), _jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mt-1", children: "Quarantine" })] }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : entries.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "Nothing quarantined for this mailbox." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Reason", "Quarantined", "Status", ""].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: entries.map((entry) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.reason }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: new Date(entry.dateCreated).toLocaleString() }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.releasedAt ? (_jsx("span", { className: "text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill bg-success text-white", children: "Released" })) : (_jsx("span", { className: "text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill bg-surface-alt text-text-muted", children: "Held" })) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-right", children: !entry.releasedAt && (_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto",
|
|
74
|
+
return (_jsxs("div", { className: "max-w-4xl flex flex-col gap-4", children: [_jsxs("div", { children: [_jsx("a", { href: `/admin/mailboxes/${encodeURIComponent(mailboxUid)}`, className: "text-sm text-primary-dark hover:underline", children: "\u2190 Back to mailbox" }), _jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mt-1", children: "Quarantine" })] }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : entries.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "Nothing quarantined for this mailbox." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Reason", "Quarantined", "Status", ""].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: entries.map((entry) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.reason }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: new Date(entry.dateCreated).toLocaleString() }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.releasedAt ? (_jsx("span", { className: "text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill bg-success text-white", children: "Released" })) : (_jsx("span", { className: "text-xs font-bold uppercase tracking-wide py-0.5 px-2 rounded-pill bg-surface-alt text-text-muted", children: "Held" })) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-right", children: !entry.releasedAt && (_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", onClick: () => setReleaseTarget(entry), children: "Mark released" })) })] }, entry.uid))) })] }) })), _jsxs("div", { className: "flex gap-3 items-center mt-4", children: [_jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: page === 0 || loading, onClick: () => setPage((p) => Math.max(0, p - 1)), children: "Previous" }), _jsxs("span", { className: "text-sm text-text-muted", children: ["Page ", page + 1] }), _jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: !hasNextPage || loading, onClick: () => setPage((p) => p + 1), children: "Next" })] }), _jsxs(Modal, { open: releaseTarget !== null, onClose: closeReleaseModal, title: "Mark message released", children: [_jsxs("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm mb-4", children: [_jsx("dt", { className: "text-text-muted", children: "Reason" }), _jsx("dd", { children: releaseTarget?.reason }), _jsx("dt", { className: "text-text-muted", children: "Quarantined" }), _jsx("dd", { children: releaseTarget && new Date(releaseTarget.dateCreated).toLocaleString() }), _jsx("dt", { className: "text-text-muted", children: "Message" }), _jsx("dd", { className: "break-all", children: releaseTarget?.originalMessageUid ?? "Not delivered to the mailbox" })] }), _jsx("p", { className: "text-sm mb-4", children: "This only records the entry as released (with you as the releaser). It does not deliver the message - if it\u2019s infected or unwanted, leave it held." }), releaseError && _jsx(Alert, { children: releaseError }), _jsxs("div", { className: "flex gap-3 justify-end", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", disabled: releasing, onClick: closeReleaseModal, children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto", loading: releasing, disabled: releasing, onClick: handleRelease, children: "Mark released" })] })] })] }));
|
|
66
75
|
}
|
|
@@ -8,7 +8,7 @@ import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
|
8
8
|
import { getTransportRule, updateTransportRule, } from "@rapidmx/react-shared/admin/transportRulesApi.js";
|
|
9
9
|
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
10
10
|
import RuleBuilder from "../../shared/components/rules/RuleBuilder.js";
|
|
11
|
-
import { TRANSPORT_RULE_ACTION_TYPES, TRANSPORT_RULE_CONDITION_FIELDS } from "./_transportRuleConfig.js";
|
|
11
|
+
import { checkRuleConditions, NO_CONDITIONS_BLOCKED_MESSAGE, NoConditionsConfirmModal, TRANSPORT_RULE_ACTION_TYPES, TRANSPORT_RULE_CONDITION_FIELDS, } from "./_transportRuleConfig.js";
|
|
12
12
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
13
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
14
|
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
@@ -24,6 +24,8 @@ function TransportRuleDetailContent({ uid }) {
|
|
|
24
24
|
const [error, setError] = useState(null);
|
|
25
25
|
const [saving, setSaving] = useState(false);
|
|
26
26
|
const [saved, setSaved] = useState(false);
|
|
27
|
+
const [showValidation, setShowValidation] = useState(false);
|
|
28
|
+
const [confirmingNoConditions, setConfirmingNoConditions] = useState(false);
|
|
27
29
|
useEffect(() => {
|
|
28
30
|
setLoading(true);
|
|
29
31
|
setError(null);
|
|
@@ -55,6 +57,20 @@ function TransportRuleDetailContent({ uid }) {
|
|
|
55
57
|
setError("A name is required.");
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
60
|
+
const check = checkRuleConditions(rule);
|
|
61
|
+
if (check === "blocked") {
|
|
62
|
+
setShowValidation(true);
|
|
63
|
+
setError(NO_CONDITIONS_BLOCKED_MESSAGE);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (check === "confirm") {
|
|
67
|
+
setConfirmingNoConditions(true);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
await save();
|
|
71
|
+
}
|
|
72
|
+
async function save() {
|
|
73
|
+
setConfirmingNoConditions(false);
|
|
58
74
|
setSaving(true);
|
|
59
75
|
setSaved(false);
|
|
60
76
|
try {
|
|
@@ -83,5 +99,5 @@ function TransportRuleDetailContent({ uid }) {
|
|
|
83
99
|
if (!original || !rule) {
|
|
84
100
|
return _jsx(Alert, { children: "Transport rule not found." });
|
|
85
101
|
}
|
|
86
|
-
return (_jsxs("div", { className: "max-w-3xl", children: [_jsx("a", { href: "/admin/transport-rules", className: "text-sm text-primary-dark hover:underline", children: "\u2190 All transport rules" }), _jsx("h1", { className: "text-xl font-bold tracking-tight mt-1 mb-5", children: original.name }), error && _jsx(Alert, { children: error }), saved && !error && (_jsx("div", { className: "mb-4 text-sm text-success font-medium", children: "Saved." })), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-5", children: [_jsx("div", { className: "bg-surface border border-border rounded-md p-6", children: _jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value) }) }) }), _jsx(RuleBuilder, { value: rule, onChange: setRule, conditionFields: TRANSPORT_RULE_CONDITION_FIELDS, actionTypes: TRANSPORT_RULE_ACTION_TYPES }), _jsx("div", { children: _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Save changes" }) })] })] }));
|
|
102
|
+
return (_jsxs("div", { className: "max-w-3xl", children: [_jsx("a", { href: "/admin/transport-rules", className: "text-sm text-primary-dark hover:underline", children: "\u2190 All transport rules" }), _jsx("h1", { className: "text-xl font-bold tracking-tight mt-1 mb-5", children: original.name }), error && _jsx(Alert, { children: error }), saved && !error && (_jsx("div", { className: "mb-4 text-sm text-success font-medium", children: "Saved." })), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-5", children: [_jsx("div", { className: "bg-surface border border-border rounded-md p-6", children: _jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value) }) }) }), _jsx(RuleBuilder, { value: rule, onChange: setRule, conditionFields: TRANSPORT_RULE_CONDITION_FIELDS, actionTypes: TRANSPORT_RULE_ACTION_TYPES, showValidation: showValidation }), _jsx("div", { children: _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Save changes" }) })] }), _jsx(NoConditionsConfirmModal, { open: confirmingNoConditions, onCancel: () => setConfirmingNoConditions(false), onConfirm: () => void save() })] }));
|
|
87
103
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TransportRuleAction, TransportRuleConditions } from "@rapidmx/react-shared/admin/transportRulesApi.js";
|
|
3
|
+
import { ActionTypeDef, ConditionFieldDef } from "../../shared/components/rules/RuleBuilder.js";
|
|
4
|
+
/** Refused outright when a rule has no conditions: it would reject or quarantine every message the server receives. */
|
|
5
|
+
export declare const NO_CONDITIONS_BLOCKED_MESSAGE = "Add at least one condition. A rule without conditions that rejects or quarantines mail would do so for every message.";
|
|
6
|
+
/**
|
|
7
|
+
* How a save should proceed given a rule's conditions: `"ok"` with at least one condition, `"blocked"` with none and a
|
|
8
|
+
* reject/quarantine action, or `"confirm"` with none and only other actions (which then apply to every message).
|
|
9
|
+
*/
|
|
10
|
+
export declare function checkRuleConditions(rule: {
|
|
11
|
+
conditions: TransportRuleConditions;
|
|
12
|
+
actions: TransportRuleAction[];
|
|
13
|
+
}): "ok" | "blocked" | "confirm";
|
|
14
|
+
/** Asks before saving a rule with no conditions whose actions will run on every message. */
|
|
15
|
+
export declare function NoConditionsConfirmModal({ open, onCancel, onConfirm }: {
|
|
16
|
+
open: boolean;
|
|
17
|
+
onCancel: () => void;
|
|
18
|
+
onConfirm: () => void;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
export declare const TRANSPORT_RULE_CONDITION_FIELDS: ConditionFieldDef[];
|
|
21
|
+
export declare const TRANSPORT_RULE_ACTION_TYPES: ActionTypeDef<TransportRuleAction>[];
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
3
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
4
|
+
import { hasConditions } from "../../shared/components/rules/RuleBuilder.js";
|
|
5
|
+
/** Refused outright when a rule has no conditions: it would reject or quarantine every message the server receives. */
|
|
6
|
+
export const NO_CONDITIONS_BLOCKED_MESSAGE = "Add at least one condition. A rule without conditions that rejects or quarantines mail would do so for every message.";
|
|
7
|
+
/**
|
|
8
|
+
* How a save should proceed given a rule's conditions: `"ok"` with at least one condition, `"blocked"` with none and a
|
|
9
|
+
* reject/quarantine action, or `"confirm"` with none and only other actions (which then apply to every message).
|
|
10
|
+
*/
|
|
11
|
+
export function checkRuleConditions(rule) {
|
|
12
|
+
if (hasConditions(rule.conditions)) {
|
|
13
|
+
return "ok";
|
|
14
|
+
}
|
|
15
|
+
return rule.actions.some((action) => action.type === "reject" || action.type === "quarantine") ? "blocked" : "confirm";
|
|
16
|
+
}
|
|
17
|
+
/** Asks before saving a rule with no conditions whose actions will run on every message. */
|
|
18
|
+
export function NoConditionsConfirmModal({ open, onCancel, onConfirm }) {
|
|
19
|
+
return (_jsxs(Modal, { open: open, onClose: onCancel, title: "Apply to every message?", children: [_jsx("p", { className: "text-sm mb-5", children: "This rule has no conditions, so its actions will run on every message this server receives or sends." }), _jsxs("div", { className: "flex gap-3 justify-end", children: [_jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", onClick: onCancel, children: "Cancel" }), _jsx(Button, { type: "button", className: "!w-auto", onClick: onConfirm, children: "Save anyway" })] })] }));
|
|
20
|
+
}
|
|
2
21
|
const FIELD_INPUT_CLASS = "w-full text-sm py-2 px-3 border border-border rounded-sm bg-surface text-text focus:outline-none focus:border-primary";
|
|
3
22
|
export const TRANSPORT_RULE_CONDITION_FIELDS = [
|
|
4
23
|
{ key: "fromContains", label: "From contains", kind: "list" },
|
|
@@ -10,6 +10,24 @@ import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
|
10
10
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
11
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
12
|
const PAGE_SIZE = 25;
|
|
13
|
+
/** The server's largest page (`limit` is capped at 1000). */
|
|
14
|
+
const FETCH_PAGE_SIZE = 1000;
|
|
15
|
+
/**
|
|
16
|
+
* Every transport rule, in evaluation order. `listTransportRules()` can't ask the server to sort, and sorting one
|
|
17
|
+
* server page at a time would order rules only within that page - so every page is fetched and sorted here (an
|
|
18
|
+
* organisation has few transport rules). Ties keep a stable order by name.
|
|
19
|
+
*/
|
|
20
|
+
async function listAllTransportRules() {
|
|
21
|
+
const all = [];
|
|
22
|
+
for (let page = 0;; page++) {
|
|
23
|
+
const batch = await listTransportRules({ page, limit: FETCH_PAGE_SIZE });
|
|
24
|
+
all.push(...batch);
|
|
25
|
+
if (batch.length < FETCH_PAGE_SIZE) {
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return all.sort((a, b) => a.sequence - b.sequence || a.name.localeCompare(b.name));
|
|
30
|
+
}
|
|
13
31
|
export default function TransportRulesPage(props) {
|
|
14
32
|
return (_jsx(AdminShell, { ...props, active: "transportRules", children: _jsx(TransportRulesContent, {}) }));
|
|
15
33
|
}
|
|
@@ -19,14 +37,12 @@ function TransportRulesContent() {
|
|
|
19
37
|
const [loading, setLoading] = useState(true);
|
|
20
38
|
const [error, setError] = useState(null);
|
|
21
39
|
useEffect(() => {
|
|
22
|
-
|
|
23
|
-
setError(null);
|
|
24
|
-
listTransportRules({ page, limit: PAGE_SIZE })
|
|
40
|
+
listAllTransportRules()
|
|
25
41
|
.then(setRules)
|
|
26
42
|
.catch((err) => setError(err instanceof ApiRequestError ? err.message : "Could not load transport rules."))
|
|
27
43
|
.finally(() => setLoading(false));
|
|
28
|
-
}, [
|
|
29
|
-
const hasNextPage = rules.length
|
|
30
|
-
const sorted =
|
|
44
|
+
}, []);
|
|
45
|
+
const hasNextPage = (page + 1) * PAGE_SIZE < rules.length;
|
|
46
|
+
const sorted = rules.slice(page * PAGE_SIZE, (page + 1) * PAGE_SIZE);
|
|
31
47
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center justify-between mb-5", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide", children: "Transport rules" }), _jsx("a", { href: "/admin/transport-rules/new", children: _jsx(Button, { type: "button", className: "!w-auto", children: "+ New transport rule" }) })] }), error && _jsx(Alert, { children: error }), loading ? (_jsx("p", { className: "text-sm text-text-muted", children: "Loading\u2026" })) : sorted.length === 0 ? (_jsx("p", { className: "text-sm text-text-muted", children: "No transport rules yet." })) : (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm border-collapse", children: [_jsx("thead", { children: _jsx("tr", { children: ["Sequence", "Name", "Enabled", "Actions", ""].map((h) => (_jsx("th", { className: "text-left text-xs uppercase tracking-wide text-text-muted py-2 px-2.5 border-b border-border", children: h }, h))) }) }), _jsx("tbody", { children: sorted.map((rule) => (_jsxs("tr", { children: [_jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: rule.sequence }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: rule.name }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: rule.enabled ? "Yes" : "No" }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: rule.actions.length }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border text-right", children: _jsx("a", { href: `/admin/transport-rules/${encodeURIComponent(rule.uid)}`, className: "text-primary-dark hover:underline font-medium", children: "View" }) })] }, rule.uid))) })] }) })), _jsxs("div", { className: "flex gap-3 items-center mt-4", children: [_jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: page === 0 || loading, onClick: () => setPage((p) => Math.max(0, p - 1)), children: "Previous" }), _jsxs("span", { className: "text-sm text-text-muted", children: ["Page ", page + 1] }), _jsx(Button, { variant: "secondary", type: "button", className: "!w-auto", disabled: !hasNextPage || loading, onClick: () => setPage((p) => p + 1), children: "Next" })] })] }));
|
|
32
48
|
}
|
|
@@ -8,7 +8,7 @@ import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
|
8
8
|
import { createTransportRule, } from "@rapidmx/react-shared/admin/transportRulesApi.js";
|
|
9
9
|
import AdminShell from "../../../shared/components/admin/layout/AdminShell.js";
|
|
10
10
|
import RuleBuilder from "../../../shared/components/rules/RuleBuilder.js";
|
|
11
|
-
import { TRANSPORT_RULE_ACTION_TYPES, TRANSPORT_RULE_CONDITION_FIELDS } from "../_transportRuleConfig.js";
|
|
11
|
+
import { checkRuleConditions, NO_CONDITIONS_BLOCKED_MESSAGE, NoConditionsConfirmModal, TRANSPORT_RULE_ACTION_TYPES, TRANSPORT_RULE_CONDITION_FIELDS, } from "../_transportRuleConfig.js";
|
|
12
12
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
13
|
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
14
|
import FormField from "@rapidmx/react-shared/components/forms/FormField.js";
|
|
@@ -27,6 +27,8 @@ function NewTransportRuleForm() {
|
|
|
27
27
|
});
|
|
28
28
|
const [error, setError] = useState(null);
|
|
29
29
|
const [saving, setSaving] = useState(false);
|
|
30
|
+
const [showValidation, setShowValidation] = useState(false);
|
|
31
|
+
const [confirmingNoConditions, setConfirmingNoConditions] = useState(false);
|
|
30
32
|
async function handleSubmit(e) {
|
|
31
33
|
e.preventDefault();
|
|
32
34
|
setError(null);
|
|
@@ -34,6 +36,20 @@ function NewTransportRuleForm() {
|
|
|
34
36
|
setError("A name is required.");
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
39
|
+
const check = checkRuleConditions(rule);
|
|
40
|
+
if (check === "blocked") {
|
|
41
|
+
setShowValidation(true);
|
|
42
|
+
setError(NO_CONDITIONS_BLOCKED_MESSAGE);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (check === "confirm") {
|
|
46
|
+
setConfirmingNoConditions(true);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await create();
|
|
50
|
+
}
|
|
51
|
+
async function create() {
|
|
52
|
+
setConfirmingNoConditions(false);
|
|
37
53
|
setSaving(true);
|
|
38
54
|
try {
|
|
39
55
|
const created = await createTransportRule({ name: name.trim(), ...rule });
|
|
@@ -46,5 +62,5 @@ function NewTransportRuleForm() {
|
|
|
46
62
|
setSaving(false);
|
|
47
63
|
}
|
|
48
64
|
}
|
|
49
|
-
return (_jsxs("div", { className: "max-w-3xl", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mb-1", children: "New transport rule" }), _jsx("p", { className: "text-sm text-text-muted mb-5", children: "Evaluated once per SMTP transaction, before any message is resolved to an individual mailbox." }), error && _jsx(Alert, { children: error }), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-5", children: [_jsx("div", { className: "bg-surface border border-border rounded-md p-6", children: _jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value), placeholder: "Flag external senders" }) }) }), _jsx(RuleBuilder, { value: rule, onChange: setRule, conditionFields: TRANSPORT_RULE_CONDITION_FIELDS, actionTypes: TRANSPORT_RULE_ACTION_TYPES }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Create transport rule" }), _jsx("a", { href: "/admin/transport-rules", children: _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", children: "Cancel" }) })] })] })] }));
|
|
65
|
+
return (_jsxs("div", { className: "max-w-3xl", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mb-1", children: "New transport rule" }), _jsx("p", { className: "text-sm text-text-muted mb-5", children: "Evaluated once per SMTP transaction, before any message is resolved to an individual mailbox." }), error && _jsx(Alert, { children: error }), _jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-5", children: [_jsx("div", { className: "bg-surface border border-border rounded-md p-6", children: _jsx(FormField, { label: "Name", htmlFor: "name", children: _jsx("input", { id: "name", type: "text", className: INPUT_CLASS, value: name, onChange: (e) => setName(e.target.value), placeholder: "Flag external senders" }) }) }), _jsx(RuleBuilder, { value: rule, onChange: setRule, conditionFields: TRANSPORT_RULE_CONDITION_FIELDS, actionTypes: TRANSPORT_RULE_ACTION_TYPES, showValidation: showValidation }), _jsxs("div", { className: "flex gap-3", children: [_jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Create transport rule" }), _jsx("a", { href: "/admin/transport-rules", children: _jsx(Button, { type: "button", variant: "secondary", className: "!w-auto", children: "Cancel" }) })] })] }), _jsx(NoConditionsConfirmModal, { open: confirmingNoConditions, onCancel: () => setConfirmingNoConditions(false), onConfirm: () => void create() })] }));
|
|
50
66
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { Branding } from "@rapidmx/react-shared/branding/brandingApi.js";
|
|
3
|
+
export interface LayoutProps {
|
|
4
|
+
/** See `apps/www/_layout.tsx`'s `LayoutProps` doc comment — identical mechanism, supplied by
|
|
5
|
+
* `EscrowConsoleRoute`'s `fetchProps()`. */
|
|
6
|
+
branding?: Branding;
|
|
7
|
+
}
|
|
8
|
+
/** Unlike the other apps, never links the admin-configured custom stylesheet: the escrow console handles escrow
|
|
9
|
+
* key material, so no admin-supplied CSS is loaded on it. */
|
|
10
|
+
export default function Layout({ children, branding }: PropsWithChildren<LayoutProps>): React.JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
/** Unlike the other apps, never links the admin-configured custom stylesheet: the escrow console handles escrow
|
|
3
|
+
* key material, so no admin-supplied CSS is loaded on it. */
|
|
3
4
|
export default function Layout({ children, branding }) {
|
|
4
5
|
const title = branding?.title || branding?.companyName
|
|
5
6
|
? `${branding?.title || branding?.companyName}: Escrow Console`
|
|
6
7
|
: "RapidMX: Escrow Console";
|
|
7
8
|
const iconHref = branding?.iconUrl || branding?.logoUrl || "/images/logo.svg";
|
|
8
|
-
|
|
9
|
-
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: title }), _jsx("link", { rel: "icon", type: "image/svg+xml", href: iconHref }), _jsx("link", { rel: "alternate icon", href: "/favicon.ico" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" }), stylesheetHref && _jsx("link", { rel: "stylesheet", href: stylesheetHref, id: CUSTOM_STYLESHEET_LINK_ID })] }), _jsx("body", { children: children })] }));
|
|
9
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: title }), _jsx("link", { rel: "icon", type: "image/svg+xml", href: iconHref }), _jsx("link", { rel: "alternate icon", href: "/favicon.ico" }), _jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" })] }), _jsx("body", { children: children })] }));
|
|
10
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { EscrowAuditVerificationResult } from "@rapidmx/react-shared/admin/escrowAuditLogApi.js";
|
|
3
|
+
import { EscrowShellProps } from "../../shared/components/escrow/layout/EscrowShell.js";
|
|
4
|
+
/** The label for an audit action - the raw action name for one this console doesn't know yet (a newer server). */
|
|
5
|
+
export declare function actionLabel(action: string): string;
|
|
6
|
+
/** Explains a failed chain verification by its `reason` (plus where it broke, when known). An unrecognized or missing
|
|
7
|
+
* reason (a newer or older server) reads as a generic failure. */
|
|
8
|
+
export declare function describeVerificationFailure(result: EscrowAuditVerificationResult): string;
|
|
9
|
+
export default function EscrowAuditLogPage(props: Omit<EscrowShellProps, "active">): React.JSX.Element;
|