@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,125 +1,148 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
import React, { FormEvent, useState } from "react";
|
|
6
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
-
import { updateMailbox } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
8
|
-
import SettingsShell, { SettingsShellProps, useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
9
|
-
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
10
|
-
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
11
|
-
|
|
12
|
-
export type SettingsReadReceiptsPageProps = Omit<SettingsShellProps, "active">;
|
|
13
|
-
|
|
14
|
-
export default function SettingsReadReceiptsPage(props: SettingsReadReceiptsPageProps) {
|
|
15
|
-
return (
|
|
16
|
-
<SettingsShell {...props} active="read-receipts">
|
|
17
|
-
<ReadReceiptsContent />
|
|
18
|
-
</SettingsShell>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function ReadReceiptsContent() {
|
|
23
|
-
const { mailboxUid, mailboxes } = useSettingsShell();
|
|
24
|
-
// `SettingsShell` only ever renders its children once `mailboxes` has loaded and `mailboxUid` has
|
|
25
|
-
// resolved to one of them — same established non-null pattern as `apps/www/settings/auto-reply/index.tsx`.
|
|
26
|
-
const mailbox = mailboxes.find((mb) => mb.uid === mailboxUid)!;
|
|
27
|
-
|
|
28
|
-
const [alwaysRequestReceiptInternal, setAlwaysRequestReceiptInternal] = useState(mailbox.alwaysRequestReceiptInternal ?? true);
|
|
29
|
-
const [
|
|
30
|
-
const [
|
|
31
|
-
const [
|
|
32
|
-
const [
|
|
33
|
-
const [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { FormEvent, useState } from "react";
|
|
6
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
+
import { updateMailbox } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
8
|
+
import SettingsShell, { SettingsShellProps, useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
9
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
10
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
11
|
+
|
|
12
|
+
export type SettingsReadReceiptsPageProps = Omit<SettingsShellProps, "active">;
|
|
13
|
+
|
|
14
|
+
export default function SettingsReadReceiptsPage(props: SettingsReadReceiptsPageProps) {
|
|
15
|
+
return (
|
|
16
|
+
<SettingsShell {...props} active="read-receipts">
|
|
17
|
+
<ReadReceiptsContent />
|
|
18
|
+
</SettingsShell>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function ReadReceiptsContent() {
|
|
23
|
+
const { mailboxUid, mailboxes } = useSettingsShell();
|
|
24
|
+
// `SettingsShell` only ever renders its children once `mailboxes` has loaded and `mailboxUid` has
|
|
25
|
+
// resolved to one of them — same established non-null pattern as `apps/www/settings/auto-reply/index.tsx`.
|
|
26
|
+
const mailbox = mailboxes.find((mb) => mb.uid === mailboxUid)!;
|
|
27
|
+
|
|
28
|
+
const [alwaysRequestReceiptInternal, setAlwaysRequestReceiptInternal] = useState(mailbox.alwaysRequestReceiptInternal ?? true);
|
|
29
|
+
const [alwaysRequestReceiptFederated, setAlwaysRequestReceiptFederated] = useState(mailbox.alwaysRequestReceiptFederated ?? false);
|
|
30
|
+
const [alwaysRequestReceiptExternal, setAlwaysRequestReceiptExternal] = useState(mailbox.alwaysRequestReceiptExternal ?? false);
|
|
31
|
+
const [autoSendReceiptsInternal, setAutoSendReceiptsInternal] = useState(mailbox.autoSendReceiptsInternal ?? true);
|
|
32
|
+
const [autoSendReceiptsFederated, setAutoSendReceiptsFederated] = useState(mailbox.autoSendReceiptsFederated ?? false);
|
|
33
|
+
const [autoSendReceiptsExternal, setAutoSendReceiptsExternal] = useState(mailbox.autoSendReceiptsExternal ?? false);
|
|
34
|
+
// See auto-reply/index.tsx's identical note - later saves must carry the version the previous save returned.
|
|
35
|
+
const [version, setVersion] = useState(mailbox.version);
|
|
36
|
+
const [error, setError] = useState<string | null>(null);
|
|
37
|
+
const [saving, setSaving] = useState(false);
|
|
38
|
+
const [saved, setSaved] = useState(false);
|
|
39
|
+
|
|
40
|
+
async function handleSubmit(e: FormEvent) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
setError(null);
|
|
43
|
+
setSaved(false);
|
|
44
|
+
setSaving(true);
|
|
45
|
+
try {
|
|
46
|
+
const updated = await updateMailbox({
|
|
47
|
+
uid: mailbox.uid,
|
|
48
|
+
version,
|
|
49
|
+
alwaysRequestReceiptInternal,
|
|
50
|
+
alwaysRequestReceiptFederated,
|
|
51
|
+
alwaysRequestReceiptExternal,
|
|
52
|
+
autoSendReceiptsInternal,
|
|
53
|
+
autoSendReceiptsFederated,
|
|
54
|
+
autoSendReceiptsExternal,
|
|
55
|
+
});
|
|
56
|
+
setVersion(updated.version);
|
|
57
|
+
setSaved(true);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not save read receipt settings.");
|
|
60
|
+
} finally {
|
|
61
|
+
setSaving(false);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex-1 min-w-0 overflow-y-auto p-6">
|
|
67
|
+
<div className="max-w-xl">
|
|
68
|
+
<h1 className="text-lg font-bold tracking-tight mb-1">Read Receipts</h1>
|
|
69
|
+
<p className="text-sm text-text-muted mb-4">
|
|
70
|
+
Controls when this mailbox requests a delivery/read receipt on mail it sends, and how it
|
|
71
|
+
responds to a receipt requested of it. A per-message “Request a read receipt”
|
|
72
|
+
checkbox in Compose always overrides the request-side settings below for that one message.
|
|
73
|
+
</p>
|
|
74
|
+
|
|
75
|
+
{error && <Alert>{error}</Alert>}
|
|
76
|
+
{saved && !error && <div className="mb-4 text-sm text-success font-medium">Saved.</div>}
|
|
77
|
+
|
|
78
|
+
<form onSubmit={handleSubmit} className="flex flex-col gap-5">
|
|
79
|
+
<fieldset className="flex flex-col gap-2">
|
|
80
|
+
<legend className="text-sm font-semibold mb-1">Request receipts when sending</legend>
|
|
81
|
+
<label className="flex items-center gap-2 text-sm">
|
|
82
|
+
<input
|
|
83
|
+
type="checkbox"
|
|
84
|
+
checked={alwaysRequestReceiptInternal}
|
|
85
|
+
onChange={(e) => setAlwaysRequestReceiptInternal(e.target.checked)}
|
|
86
|
+
/>
|
|
87
|
+
From internal recipients (mail to this organization)
|
|
88
|
+
</label>
|
|
89
|
+
<label className="flex items-center gap-2 text-sm">
|
|
90
|
+
<input
|
|
91
|
+
type="checkbox"
|
|
92
|
+
checked={alwaysRequestReceiptFederated}
|
|
93
|
+
onChange={(e) => setAlwaysRequestReceiptFederated(e.target.checked)}
|
|
94
|
+
/>
|
|
95
|
+
From federated recipients (partner organizations)
|
|
96
|
+
</label>
|
|
97
|
+
<label className="flex items-center gap-2 text-sm">
|
|
98
|
+
<input
|
|
99
|
+
type="checkbox"
|
|
100
|
+
checked={alwaysRequestReceiptExternal}
|
|
101
|
+
onChange={(e) => setAlwaysRequestReceiptExternal(e.target.checked)}
|
|
102
|
+
/>
|
|
103
|
+
From external recipients
|
|
104
|
+
</label>
|
|
105
|
+
</fieldset>
|
|
106
|
+
|
|
107
|
+
<fieldset className="flex flex-col gap-2">
|
|
108
|
+
<legend className="text-sm font-semibold mb-1">Respond automatically to requests</legend>
|
|
109
|
+
<label className="flex items-center gap-2 text-sm">
|
|
110
|
+
<input
|
|
111
|
+
type="checkbox"
|
|
112
|
+
checked={autoSendReceiptsInternal}
|
|
113
|
+
onChange={(e) => setAutoSendReceiptsInternal(e.target.checked)}
|
|
114
|
+
/>
|
|
115
|
+
From internal senders
|
|
116
|
+
</label>
|
|
117
|
+
<label className="flex items-center gap-2 text-sm">
|
|
118
|
+
<input
|
|
119
|
+
type="checkbox"
|
|
120
|
+
checked={autoSendReceiptsFederated}
|
|
121
|
+
onChange={(e) => setAutoSendReceiptsFederated(e.target.checked)}
|
|
122
|
+
/>
|
|
123
|
+
From federated senders (partner organizations)
|
|
124
|
+
</label>
|
|
125
|
+
<label className="flex items-center gap-2 text-sm">
|
|
126
|
+
<input
|
|
127
|
+
type="checkbox"
|
|
128
|
+
checked={autoSendReceiptsExternal}
|
|
129
|
+
onChange={(e) => setAutoSendReceiptsExternal(e.target.checked)}
|
|
130
|
+
/>
|
|
131
|
+
From external senders
|
|
132
|
+
</label>
|
|
133
|
+
<p className="text-xs text-text-muted">
|
|
134
|
+
Unchecked means a request from that sender waits in your Inbox for you to send or
|
|
135
|
+
decline it explicitly.
|
|
136
|
+
</p>
|
|
137
|
+
</fieldset>
|
|
138
|
+
|
|
139
|
+
<div>
|
|
140
|
+
<Button type="submit" loading={saving} disabled={saving} className="!w-auto">
|
|
141
|
+
Save
|
|
142
|
+
</Button>
|
|
143
|
+
</div>
|
|
144
|
+
</form>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { FormEvent, useEffect, useState } from "react";
|
|
6
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
+
import {
|
|
8
|
+
MailboxAccessMember,
|
|
9
|
+
MailboxAccessRole,
|
|
10
|
+
listMailboxAccess,
|
|
11
|
+
lookupMailboxOwnerByEmail,
|
|
12
|
+
removeMailboxAccess,
|
|
13
|
+
setMailboxAccess,
|
|
14
|
+
} from "@rapidmx/react-shared/mail/mailboxAccessApi.js";
|
|
15
|
+
import SettingsShell, { SettingsShellProps, useSettingsShell } from "../../../shared/components/settings/layout/SettingsShell.js";
|
|
16
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
17
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
18
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
19
|
+
import { SkeletonList } from "@rapidmx/react-shared/components/feedback/Skeleton.js";
|
|
20
|
+
|
|
21
|
+
const ROLE_LABELS: Record<MailboxAccessRole, string> = { viewer: "Can view", manager: "Can manage" };
|
|
22
|
+
|
|
23
|
+
export type SettingsSharingPageProps = Omit<SettingsShellProps, "active">;
|
|
24
|
+
|
|
25
|
+
export default function SettingsSharingPage(props: SettingsSharingPageProps) {
|
|
26
|
+
return (
|
|
27
|
+
<SettingsShell {...props} active="sharing">
|
|
28
|
+
<SharingContent />
|
|
29
|
+
</SettingsShell>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type Status = "loading" | "ready" | "forbidden" | "error";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Manages who else can access whichever mailbox Settings is currently scoped to (the ambient mailbox from
|
|
37
|
+
* `useSettingsShell()`'s own switcher, which already lists every mailbox the caller can reach, shared ones
|
|
38
|
+
* included) - not just for shared/ownerless mailboxes specifically, matching every other settings page's
|
|
39
|
+
* own mailbox-agnostic design. A single grant here already cascades to that mailbox's calendar/contacts/
|
|
40
|
+
* tasks/mail folders (see `@rapidmx/restapi`'s `BaseMailboxAccessRoute` doc comment), so there is nothing
|
|
41
|
+
* else to configure per data type.
|
|
42
|
+
*/
|
|
43
|
+
function SharingContent() {
|
|
44
|
+
const { mailboxUid, mailboxes } = useSettingsShell();
|
|
45
|
+
const mailbox = mailboxes.find((mb) => mb.uid === mailboxUid);
|
|
46
|
+
|
|
47
|
+
const [members, setMembers] = useState<MailboxAccessMember[]>([]);
|
|
48
|
+
const [status, setStatus] = useState<Status>("loading");
|
|
49
|
+
const [error, setError] = useState<string | null>(null);
|
|
50
|
+
|
|
51
|
+
const [emailInput, setEmailInput] = useState("");
|
|
52
|
+
const [newRole, setNewRole] = useState<MailboxAccessRole>("viewer");
|
|
53
|
+
const [adding, setAdding] = useState(false);
|
|
54
|
+
const [addError, setAddError] = useState<string | null>(null);
|
|
55
|
+
|
|
56
|
+
const [pendingRoleChange, setPendingRoleChange] = useState<string | null>(null);
|
|
57
|
+
const [removeTarget, setRemoveTarget] = useState<MailboxAccessMember | null>(null);
|
|
58
|
+
const [removing, setRemoving] = useState(false);
|
|
59
|
+
|
|
60
|
+
// `SettingsShell` only ever renders its children once `mailboxUid` has resolved (a mailbox-less caller
|
|
61
|
+
// gets `<MailboxProvisioning />` instead) - same established precedent as the Labels/Focused Inbox
|
|
62
|
+
// settings pages, so none of the handlers below need their own `!mailboxUid` guard.
|
|
63
|
+
function reload() {
|
|
64
|
+
setStatus("loading");
|
|
65
|
+
setError(null);
|
|
66
|
+
listMailboxAccess(mailboxUid!)
|
|
67
|
+
.then((result) => {
|
|
68
|
+
setMembers(result);
|
|
69
|
+
setStatus("ready");
|
|
70
|
+
})
|
|
71
|
+
.catch((err) => {
|
|
72
|
+
// A 403 here is the live, server-verified "can this caller manage this mailbox's sharing"
|
|
73
|
+
// signal - the same permission threshold (ACLAction.UPDATE) this route itself requires, so
|
|
74
|
+
// no separate probe call is needed to decide which state to render.
|
|
75
|
+
if (err instanceof ApiRequestError && err.status === 403) {
|
|
76
|
+
setStatus("forbidden");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not load sharing settings.");
|
|
80
|
+
setStatus("error");
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
useEffect(reload, [mailboxUid]);
|
|
85
|
+
|
|
86
|
+
async function handleAdd(e: FormEvent) {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
const email = emailInput.trim();
|
|
89
|
+
if (!email) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
setAddError(null);
|
|
93
|
+
setAdding(true);
|
|
94
|
+
try {
|
|
95
|
+
const found = await lookupMailboxOwnerByEmail(email);
|
|
96
|
+
if (!found) {
|
|
97
|
+
setAddError("No one found with that email on this platform.");
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
await setMailboxAccess(mailboxUid!, found.userUid, newRole);
|
|
101
|
+
setEmailInput("");
|
|
102
|
+
setNewRole("viewer");
|
|
103
|
+
reload();
|
|
104
|
+
} catch (err) {
|
|
105
|
+
setAddError(err instanceof ApiRequestError ? err.message : "Could not grant access.");
|
|
106
|
+
} finally {
|
|
107
|
+
setAdding(false);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function handleRoleChange(userOrRoleId: string, role: MailboxAccessRole) {
|
|
112
|
+
setPendingRoleChange(userOrRoleId);
|
|
113
|
+
setError(null);
|
|
114
|
+
try {
|
|
115
|
+
await setMailboxAccess(mailboxUid!, userOrRoleId, role);
|
|
116
|
+
reload();
|
|
117
|
+
} catch (err) {
|
|
118
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not update this member's role.");
|
|
119
|
+
} finally {
|
|
120
|
+
setPendingRoleChange(null);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function closeRemoveModal() {
|
|
125
|
+
setRemoveTarget(null);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function handleRemove() {
|
|
129
|
+
// Only reachable from the confirm modal's own "Remove" button, and `Modal` renders nothing at all
|
|
130
|
+
// unless `removeTarget` is set, so `removeTarget` is always non-null here.
|
|
131
|
+
setRemoving(true);
|
|
132
|
+
setError(null);
|
|
133
|
+
try {
|
|
134
|
+
await removeMailboxAccess(mailboxUid!, removeTarget!.userOrRoleId);
|
|
135
|
+
setRemoveTarget(null);
|
|
136
|
+
reload();
|
|
137
|
+
} catch (err) {
|
|
138
|
+
setError(err instanceof ApiRequestError ? err.message : "Could not remove this member.");
|
|
139
|
+
} finally {
|
|
140
|
+
setRemoving(false);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div className="flex-1 min-w-0 overflow-y-auto p-6">
|
|
146
|
+
<div className="max-w-xl flex flex-col gap-6">
|
|
147
|
+
<div>
|
|
148
|
+
<h1 className="text-lg font-bold tracking-tight mb-1">Sharing</h1>
|
|
149
|
+
<p className="text-sm text-text-muted">
|
|
150
|
+
Manage who else can access {mailbox?.displayName ?? "this mailbox"}’s mail, calendar,
|
|
151
|
+
contacts, and tasks. Granting access here covers all of it at once - there’s nothing
|
|
152
|
+
else to configure per data type.
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
{status === "loading" && <SkeletonList count={3} />}
|
|
157
|
+
|
|
158
|
+
{status === "forbidden" && (
|
|
159
|
+
<Alert>You don’t have permission to manage sharing for this mailbox.</Alert>
|
|
160
|
+
)}
|
|
161
|
+
|
|
162
|
+
{status === "error" && error && <Alert>{error}</Alert>}
|
|
163
|
+
|
|
164
|
+
{status === "ready" && (
|
|
165
|
+
<>
|
|
166
|
+
{error && <Alert>{error}</Alert>}
|
|
167
|
+
|
|
168
|
+
<div>
|
|
169
|
+
<h2 className="text-sm font-semibold mb-2">People with access</h2>
|
|
170
|
+
{members.length === 0 ? (
|
|
171
|
+
<p className="text-sm text-text-muted">No one else has access to this mailbox yet.</p>
|
|
172
|
+
) : (
|
|
173
|
+
<ul className="flex flex-col gap-2">
|
|
174
|
+
{members.map((member) => (
|
|
175
|
+
<li
|
|
176
|
+
key={member.userOrRoleId}
|
|
177
|
+
className="flex items-center justify-between gap-3 text-sm py-1.5 px-3 bg-surface-alt rounded-sm"
|
|
178
|
+
>
|
|
179
|
+
<span className="truncate">{member.userOrRoleId}</span>
|
|
180
|
+
<span className="flex items-center gap-2 shrink-0">
|
|
181
|
+
<select
|
|
182
|
+
aria-label={`Role for ${member.userOrRoleId}`}
|
|
183
|
+
className="text-sm border border-border rounded-sm py-1 px-2 bg-surface"
|
|
184
|
+
value={member.role}
|
|
185
|
+
disabled={pendingRoleChange === member.userOrRoleId}
|
|
186
|
+
onChange={(e) =>
|
|
187
|
+
handleRoleChange(member.userOrRoleId, e.target.value as MailboxAccessRole)
|
|
188
|
+
}
|
|
189
|
+
>
|
|
190
|
+
{/* Access granted outside this page can't be set here, only replaced by a
|
|
191
|
+
standard role. */}
|
|
192
|
+
{member.role === "custom" && (
|
|
193
|
+
<option value="custom" disabled>
|
|
194
|
+
Custom access
|
|
195
|
+
</option>
|
|
196
|
+
)}
|
|
197
|
+
{(Object.keys(ROLE_LABELS) as MailboxAccessRole[]).map((role) => (
|
|
198
|
+
<option key={role} value={role}>
|
|
199
|
+
{ROLE_LABELS[role]}
|
|
200
|
+
</option>
|
|
201
|
+
))}
|
|
202
|
+
</select>
|
|
203
|
+
<Button
|
|
204
|
+
type="button"
|
|
205
|
+
variant="text"
|
|
206
|
+
className="!w-auto text-danger"
|
|
207
|
+
onClick={() => setRemoveTarget(member)}
|
|
208
|
+
>
|
|
209
|
+
Remove
|
|
210
|
+
</Button>
|
|
211
|
+
</span>
|
|
212
|
+
</li>
|
|
213
|
+
))}
|
|
214
|
+
</ul>
|
|
215
|
+
)}
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<form onSubmit={handleAdd} className="flex flex-col gap-2">
|
|
219
|
+
<h2 className="text-sm font-semibold">Add someone</h2>
|
|
220
|
+
{addError && <Alert>{addError}</Alert>}
|
|
221
|
+
<div className="flex gap-2">
|
|
222
|
+
<input
|
|
223
|
+
type="email"
|
|
224
|
+
aria-label="Email address"
|
|
225
|
+
placeholder="Email address"
|
|
226
|
+
className="flex-1 text-sm border border-border rounded-sm py-1.5 px-2 bg-surface"
|
|
227
|
+
value={emailInput}
|
|
228
|
+
onChange={(e) => setEmailInput(e.target.value)}
|
|
229
|
+
disabled={adding}
|
|
230
|
+
/>
|
|
231
|
+
<select
|
|
232
|
+
aria-label="Role to grant"
|
|
233
|
+
className="text-sm border border-border rounded-sm py-1.5 px-2 bg-surface"
|
|
234
|
+
value={newRole}
|
|
235
|
+
onChange={(e) => setNewRole(e.target.value as MailboxAccessRole)}
|
|
236
|
+
disabled={adding}
|
|
237
|
+
>
|
|
238
|
+
{(Object.keys(ROLE_LABELS) as MailboxAccessRole[]).map((role) => (
|
|
239
|
+
<option key={role} value={role}>
|
|
240
|
+
{ROLE_LABELS[role]}
|
|
241
|
+
</option>
|
|
242
|
+
))}
|
|
243
|
+
</select>
|
|
244
|
+
<Button type="submit" loading={adding} disabled={adding} className="!w-auto">
|
|
245
|
+
Add
|
|
246
|
+
</Button>
|
|
247
|
+
</div>
|
|
248
|
+
</form>
|
|
249
|
+
</>
|
|
250
|
+
)}
|
|
251
|
+
|
|
252
|
+
<Modal open={!!removeTarget} onClose={closeRemoveModal} title="Remove access">
|
|
253
|
+
<p className="text-sm mb-5">
|
|
254
|
+
{removeTarget?.userOrRoleId} will no longer be able to access {mailbox?.displayName ?? "this mailbox"}.
|
|
255
|
+
</p>
|
|
256
|
+
<div className="flex gap-3 justify-end">
|
|
257
|
+
<Button type="button" variant="secondary" className="!w-auto" disabled={removing} onClick={closeRemoveModal}>
|
|
258
|
+
Cancel
|
|
259
|
+
</Button>
|
|
260
|
+
<Button
|
|
261
|
+
type="button"
|
|
262
|
+
className="!w-auto !bg-none !bg-danger !border-danger hover:!bg-danger"
|
|
263
|
+
loading={removing}
|
|
264
|
+
disabled={removing}
|
|
265
|
+
onClick={handleRemove}
|
|
266
|
+
>
|
|
267
|
+
Remove
|
|
268
|
+
</Button>
|
|
269
|
+
</div>
|
|
270
|
+
</Modal>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
);
|
|
274
|
+
}
|