@rapidmx/web-client 0.3.1 → 0.5.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/apps/admin/audit-log/index.tsx +35 -8
- package/apps/admin/branding/index.tsx +39 -404
- package/apps/admin/data-requests/index.tsx +480 -485
- package/apps/admin/distribution-lists/[uid].tsx +19 -1
- package/apps/admin/domains/[uid].tsx +92 -259
- package/apps/admin/encryption-policy/index.tsx +19 -0
- package/apps/admin/escrow-scopes/[uid].tsx +348 -237
- package/apps/admin/escrow-scopes/new/index.tsx +8 -2
- package/apps/admin/index.tsx +118 -82
- package/apps/admin/ingest-queue/index.tsx +44 -5
- package/apps/admin/mailbox-policy/index.tsx +19 -0
- package/apps/admin/mailboxes/[uid].tsx +211 -184
- package/apps/admin/mailboxes/new/index.tsx +28 -291
- package/apps/admin/plugins/index.tsx +15 -0
- package/apps/admin/quarantine/index.tsx +46 -14
- package/apps/admin/retention-policy/index.tsx +39 -132
- package/apps/admin/setup/index.tsx +15 -0
- 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 +251 -210
- 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 +385 -0
- package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +187 -0
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +112 -0
- package/apps/shared/components/admin/settings/LoadedSettingsForm.tsx +34 -0
- package/apps/shared/components/admin/settings/MailboxCreateForm.tsx +308 -0
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +152 -0
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1235 -0
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +174 -0
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +290 -0
- package/apps/shared/components/admin/setup/SetupWizard.tsx +416 -0
- package/apps/shared/components/admin/signOut.ts +79 -0
- package/apps/shared/components/admin/usePagedList.tsx +129 -0
- package/apps/shared/components/calendar/CalendarListSidebar.tsx +120 -76
- package/apps/shared/components/calendar/EventModal.tsx +717 -513
- 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 +80 -99
- package/apps/shared/components/contacts/ContactDetailPane.tsx +100 -21
- package/apps/shared/components/contacts/ContactForm.tsx +377 -314
- 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/escrow/layout/EscrowShell.tsx +148 -134
- package/apps/shared/components/layout/AppShell.tsx +270 -169
- package/apps/shared/components/layout/BrandingChrome.tsx +48 -10
- package/apps/shared/components/layout/KeyEnrollmentGate.tsx +150 -26
- 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 -0
- package/apps/shared/components/mail/ConversationThreadPane.tsx +216 -181
- package/apps/shared/components/mail/MessageDetailPane.tsx +799 -76
- package/apps/shared/components/mail/compose/ComposeContext.tsx +26 -16
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1652 -765
- package/apps/shared/components/mail/compose/composeFlushRegistry.ts +60 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +418 -302
- 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 +1 -0
- package/apps/shared/mail/findWellKnownFolderUid.ts +13 -0
- package/apps/shared/mail/listAllPages.ts +39 -0
- package/apps/shared/search/LocalIndexLifecycle.tsx +98 -0
- package/apps/shared/search/localIndexBlockCipher.ts +83 -0
- package/apps/shared/search/localIndexBuilder.ts +481 -0
- package/apps/shared/search/localIndexKey.ts +27 -0
- package/apps/shared/search/localIndexRpcClient.ts +316 -0
- package/apps/shared/search/localIndexSchema.ts +236 -0
- package/apps/shared/search/localIndexSizePreference.ts +88 -0
- package/apps/shared/search/localIndexStorage.ts +98 -0
- package/apps/shared/search/localIndexVFS.ts +266 -0
- package/apps/shared/search/localIndexWorker.ts +926 -0
- package/apps/shared/search/searchTier2.ts +79 -0
- package/apps/shared/search/wa-sqlite-shims.d.ts +44 -0
- package/apps/www/calendar/index.tsx +438 -407
- package/apps/www/contacts/[uid].tsx +21 -2
- package/apps/www/contacts/index.tsx +148 -17
- package/apps/www/index.tsx +1314 -486
- package/apps/www/messages/[uid].tsx +23 -7
- package/apps/www/settings/auto-reply/index.tsx +134 -129
- package/apps/www/settings/booking-types/[uid].tsx +306 -300
- package/apps/www/settings/encryption/index.tsx +800 -215
- 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 +274 -0
- package/apps/www/tasks/index.tsx +638 -530
- package/dist/apps/admin/audit-log/index.js +38 -8
- package/dist/apps/admin/branding/index.js +4 -98
- package/dist/apps/admin/data-requests/index.js +52 -72
- package/dist/apps/admin/distribution-lists/[uid].js +1 -1
- package/dist/apps/admin/domains/[uid].js +5 -68
- package/dist/apps/admin/encryption-policy/index.js +8 -0
- package/dist/apps/admin/escrow-scopes/[uid].js +91 -12
- package/dist/apps/admin/escrow-scopes/new/index.js +8 -3
- package/dist/apps/admin/index.js +17 -1
- package/dist/apps/admin/ingest-queue/index.js +24 -6
- package/dist/apps/admin/mailbox-policy/index.js +8 -0
- package/dist/apps/admin/mailboxes/[uid].js +20 -4
- package/dist/apps/admin/mailboxes/new/index.js +4 -89
- package/dist/apps/admin/plugins/index.js +6 -0
- package/dist/apps/admin/quarantine/index.js +20 -11
- package/dist/apps/admin/retention-policy/index.js +3 -36
- package/dist/apps/admin/setup/index.js +6 -0
- package/dist/apps/admin/transport-rules/[uid].js +18 -2
- package/dist/apps/admin/transport-rules/_transportRuleConfig.js +19 -0
- package/dist/apps/admin/transport-rules/index.js +22 -6
- package/dist/apps/admin/transport-rules/new/index.js +18 -2
- package/dist/apps/escrow/_layout.js +3 -3
- package/dist/apps/escrow/audit-log/index.js +26 -1
- package/dist/apps/escrow/matters/[uid].js +77 -42
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.js +11 -2
- package/dist/apps/shared/components/admin/layout/AdminShell.js +37 -4
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.js +72 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.js +3 -3
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +22 -4
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +116 -0
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +83 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +62 -0
- package/dist/apps/shared/components/admin/settings/LoadedSettingsForm.js +25 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.js +112 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +74 -0
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +572 -0
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +73 -0
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +147 -0
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +208 -0
- package/dist/apps/shared/components/admin/signOut.js +75 -0
- package/dist/apps/shared/components/admin/usePagedList.js +99 -0
- package/dist/apps/shared/components/calendar/CalendarListSidebar.js +24 -13
- package/dist/apps/shared/components/calendar/EventModal.js +154 -21
- package/dist/apps/shared/components/calendar/MonthView.js +12 -5
- package/dist/apps/shared/components/calendar/RecurrenceEditor.js +40 -5
- package/dist/apps/shared/components/calendar/SplitDayView.js +10 -4
- package/dist/apps/shared/components/calendar/TimeGridView.js +23 -7
- package/dist/apps/shared/components/calendar/allDay.js +111 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +47 -39
- package/dist/apps/shared/components/contacts/ContactDetailPane.js +43 -5
- package/dist/apps/shared/components/contacts/ContactForm.js +45 -12
- package/dist/apps/shared/components/contacts/ContactsSidebar.js +2 -2
- package/dist/apps/shared/components/contacts/KeyChangeReview.js +63 -0
- package/dist/apps/shared/components/contacts/contactKeys.js +64 -0
- package/dist/apps/shared/components/escrow/layout/EscrowShell.js +24 -5
- package/dist/apps/shared/components/layout/AppShell.js +100 -8
- package/dist/apps/shared/components/layout/BrandingChrome.js +45 -10
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +63 -14
- package/dist/apps/shared/components/layout/MailboxProvisioning.js +10 -2
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.js +174 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.js +136 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +50 -12
- package/dist/apps/shared/components/mail/MessageDetailPane.js +464 -34
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +9 -6
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +807 -116
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.js +50 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +116 -41
- package/dist/apps/shared/components/mail/pinnedSigners.js +98 -0
- package/dist/apps/shared/components/mail/verificationSeals.js +112 -0
- package/dist/apps/shared/components/mail/writableMailboxes.js +87 -0
- package/dist/apps/shared/components/rules/RuleBuilder.js +34 -6
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +1 -0
- package/dist/apps/shared/mail/findWellKnownFolderUid.js +12 -0
- package/dist/apps/shared/mail/listAllPages.js +25 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.js +80 -0
- package/dist/apps/shared/search/localIndexBlockCipher.js +63 -0
- package/dist/apps/shared/search/localIndexBuilder.js +408 -0
- package/dist/apps/shared/search/localIndexKey.js +25 -0
- package/dist/apps/shared/search/localIndexRpcClient.js +241 -0
- package/dist/apps/shared/search/localIndexSchema.js +185 -0
- package/dist/apps/shared/search/localIndexSizePreference.js +78 -0
- package/dist/apps/shared/search/localIndexStorage.js +86 -0
- package/dist/apps/shared/search/localIndexVFS.js +258 -0
- package/dist/apps/shared/search/localIndexWorker.js +687 -0
- package/dist/apps/shared/search/searchTier2.js +38 -0
- package/dist/apps/www/calendar/index.js +38 -18
- package/dist/apps/www/contacts/[uid].js +13 -2
- package/dist/apps/www/contacts/index.js +94 -15
- package/dist/apps/www/index.js +770 -137
- package/dist/apps/www/messages/[uid].js +23 -7
- package/dist/apps/www/settings/auto-reply/index.js +9 -4
- package/dist/apps/www/settings/booking-types/[uid].js +17 -12
- package/dist/apps/www/settings/encryption/index.js +541 -96
- package/dist/apps/www/settings/filters/[uid].js +22 -7
- package/dist/apps/www/settings/filters/new/index.js +8 -2
- package/dist/apps/www/settings/focused-inbox/index.js +3 -1
- package/dist/apps/www/settings/privacy/index.js +57 -22
- package/dist/apps/www/settings/read-receipts/index.js +10 -3
- package/dist/apps/www/settings/sharing/index.js +124 -0
- package/dist/apps/www/tasks/index.js +76 -14
- package/package.json +3 -2
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
///////////////////////////////////////////////////////////////////////////////
|
|
3
3
|
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
4
4
|
// SPDX-License-Identifier: MPL-2.0
|
|
5
5
|
///////////////////////////////////////////////////////////////////////////////
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
7
|
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
8
|
-
import {
|
|
8
|
+
import { getRetentionPolicy } from "@rapidmx/react-shared/admin/retentionPolicyApi.js";
|
|
9
9
|
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
10
|
+
import RetentionPolicyForm from "../../shared/components/admin/settings/RetentionPolicyForm.js";
|
|
10
11
|
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
11
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
12
|
-
const 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";
|
|
13
12
|
export default function RetentionPolicyPage(props) {
|
|
14
13
|
return (_jsx(AdminShell, { ...props, active: "retentionPolicy", children: _jsx(RetentionPolicyContent, {}) }));
|
|
15
14
|
}
|
|
@@ -31,35 +30,3 @@ function RetentionPolicyContent() {
|
|
|
31
30
|
}
|
|
32
31
|
return _jsx(RetentionPolicyForm, { policy: policy, onChange: setPolicy });
|
|
33
32
|
}
|
|
34
|
-
function RetentionPolicyForm({ policy, onChange }) {
|
|
35
|
-
const [messageRetentionDays, setMessageRetentionDays] = useState(policy.messageRetentionDays?.toString() ?? "");
|
|
36
|
-
const [auditLogRetentionDays, setAuditLogRetentionDays] = useState(policy.auditLogRetentionDays?.toString() ?? "");
|
|
37
|
-
const [error, setError] = useState(null);
|
|
38
|
-
const [saving, setSaving] = useState(false);
|
|
39
|
-
const [saved, setSaved] = useState(false);
|
|
40
|
-
async function handleSubmit(e) {
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
setError(null);
|
|
43
|
-
setSaved(false);
|
|
44
|
-
setSaving(true);
|
|
45
|
-
try {
|
|
46
|
-
const patch = {};
|
|
47
|
-
if (messageRetentionDays.trim() !== "") {
|
|
48
|
-
patch.messageRetentionDays = Number(messageRetentionDays);
|
|
49
|
-
}
|
|
50
|
-
if (auditLogRetentionDays.trim() !== "") {
|
|
51
|
-
patch.auditLogRetentionDays = Number(auditLogRetentionDays);
|
|
52
|
-
}
|
|
53
|
-
const updated = await updateRetentionPolicy(patch);
|
|
54
|
-
onChange(updated);
|
|
55
|
-
setSaved(true);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
setError(err instanceof ApiRequestError ? err.message : "Could not save the retention policy.");
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
61
|
-
setSaving(false);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return (_jsxs("div", { className: "max-w-xl", children: [_jsx("h1", { className: "text-xl font-bold uppercase tracking-wide mb-1", children: "Retention Policy" }), _jsx("p", { className: "text-sm text-text-muted mb-5", children: "Automatically and permanently deletes mail/audit-log entries older than the configured age. Leave a field blank for no automatic purge. This does not apply to a mailbox that is a custodian on an active legal hold \u2014 a held message is skipped and retried on a later run once the hold is lifted." }), 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-4", children: [_jsxs("label", { className: "flex flex-col gap-1.5 text-sm", children: [_jsx("span", { className: "font-semibold", children: "Message retention (days)" }), _jsx("input", { "aria-label": "Message retention (days)", type: "number", min: 1, className: INPUT_CLASS, value: messageRetentionDays, onChange: (e) => setMessageRetentionDays(e.target.value), placeholder: "No automatic purge" }), _jsx("span", { className: "text-xs text-text-muted", children: "Applies to any message, in any folder, regardless of age." })] }), _jsxs("label", { className: "flex flex-col gap-1.5 text-sm", children: [_jsx("span", { className: "font-semibold", children: "Audit log retention (days)" }), _jsx("input", { "aria-label": "Audit log retention (days)", type: "number", min: MIN_AUDIT_LOG_RETENTION_DAYS, className: INPUT_CLASS, value: auditLogRetentionDays, onChange: (e) => setAuditLogRetentionDays(e.target.value), placeholder: "Keep forever" }), _jsxs("span", { className: "text-xs text-text-muted", children: ["Cannot be set below ", MIN_AUDIT_LOG_RETENTION_DAYS, " days. Never applies to the tamper-evident escrow audit chain."] })] }), _jsx("div", { children: _jsx(Button, { type: "submit", loading: saving, disabled: saving, className: "!w-auto", children: "Save" }) })] })] }));
|
|
65
|
-
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import AdminShell from "../../shared/components/admin/layout/AdminShell.js";
|
|
3
|
+
import SetupWizard from "../../shared/components/admin/setup/SetupWizard.js";
|
|
4
|
+
export default function SetupPage(props) {
|
|
5
|
+
return (_jsx(AdminShell, { ...props, active: "setup", children: _jsx(SetupWizard, { userUid: props.userUid ?? "" }) }));
|
|
6
|
+
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -14,7 +14,32 @@ const ACTION_LABELS = {
|
|
|
14
14
|
"escrow_access_request.created": "Access request created",
|
|
15
15
|
"escrow_access_request.approved": "Access request approved",
|
|
16
16
|
"escrow_access_request.material_read": "Material read",
|
|
17
|
+
"matter_export.requested": "Matter export requested",
|
|
18
|
+
"matter_export.ready": "Matter export ready",
|
|
19
|
+
"matter_export.failed": "Matter export failed",
|
|
17
20
|
};
|
|
21
|
+
/** The label for an audit action - the raw action name for one this console doesn't know yet (a newer server). */
|
|
22
|
+
export function actionLabel(action) {
|
|
23
|
+
return ACTION_LABELS[action] ?? action;
|
|
24
|
+
}
|
|
25
|
+
const VERIFICATION_FAILURES = {
|
|
26
|
+
link_mismatch: "An entry was deleted, inserted or reordered.",
|
|
27
|
+
hash_mismatch: "An entry was edited after it was written.",
|
|
28
|
+
unknown_algorithm: "An entry uses a hash algorithm this server doesn't recognize.",
|
|
29
|
+
algorithm_downgrade: "An unkeyed entry follows keyed ones, which suggests a forged entry.",
|
|
30
|
+
hmac_key_unavailable: "Audit key not configured: this server can't check keyed entries, so the chain couldn't be verified.",
|
|
31
|
+
truncated: "Entries missing at the end: entries were deleted from the end of the chain.",
|
|
32
|
+
head_mismatch: "The chain's head record doesn't match its last entry.",
|
|
33
|
+
head_mac_mismatch: "The chain's head record was forged or edited.",
|
|
34
|
+
head_missing: "The chain's head record is missing.",
|
|
35
|
+
};
|
|
36
|
+
/** Explains a failed chain verification by its `reason` (plus where it broke, when known). An unrecognized or missing
|
|
37
|
+
* reason (a newer or older server) reads as a generic failure. */
|
|
38
|
+
export function describeVerificationFailure(result) {
|
|
39
|
+
const where = result.brokenAtSequence === undefined ? "" : ` (at sequence ${result.brokenAtSequence})`;
|
|
40
|
+
const known = result.reason === undefined ? undefined : VERIFICATION_FAILURES[result.reason];
|
|
41
|
+
return known ? `Chain integrity check failed${where}. ${known}` : `Chain integrity check failed${where}.`;
|
|
42
|
+
}
|
|
18
43
|
export default function EscrowAuditLogPage(props) {
|
|
19
44
|
return (_jsx(EscrowShell, { ...props, active: "auditLog", children: _jsx(EscrowAuditLogContent, {}) }));
|
|
20
45
|
}
|
|
@@ -62,5 +87,5 @@ function EscrowAuditLogContent() {
|
|
|
62
87
|
}
|
|
63
88
|
const hasNextPage = entries.length === PAGE_SIZE;
|
|
64
89
|
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: "Escrow audit log" }), isTrustedAdmin && (_jsx(Button, { type: "button", className: "!w-auto", loading: verifying, disabled: verifying, onClick: handleVerify, children: "Verify chain integrity" }))] }), _jsx("p", { className: "text-sm text-text-muted mb-5", children: "Every escrow access lifecycle event visible to you \u2014 matters under a scope you hold. A trusted administrator sees every entry across every scope instead." }), verifyError && _jsx(Alert, { children: verifyError }), verifyResult &&
|
|
65
|
-
(verifyResult.valid ? (_jsx("div", { className: "mb-5 py-3 px-3.5 rounded-sm text-sm bg-success/10 text-success font-medium", children: "Chain verified \u2014 no tampering detected." })) : (
|
|
90
|
+
(verifyResult.valid ? (_jsx("div", { className: "mb-5 py-3 px-3.5 rounded-sm text-sm bg-success/10 text-success font-medium", children: "Chain verified \u2014 no tampering detected." })) : (_jsx(Alert, { children: describeVerificationFailure(verifyResult) }))), 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: "No audit log entries visible to you 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", "Action", "Holder", "Mailbox", "Occurred"].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.sequence }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: actionLabel(entry.action) }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.holderUserUid }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: entry.mailboxUid }), _jsx("td", { className: "py-2.5 px-2.5 border-b border-border", children: new Date(entry.occurredAt).toLocaleString() })] }, 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" })] })] }));
|
|
66
91
|
}
|