@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,184 +1,211 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
import React, { useEffect, useState } from "react";
|
|
6
|
-
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
-
import { deleteMailbox, getMailbox, impersonateUser, Mailbox } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
8
|
-
import AdminShell, { AdminShellProps } from "../../shared/components/admin/layout/AdminShell.js";
|
|
9
|
-
import ShareAccessCard from "../../shared/components/admin/mailboxes/ShareAccessCard.js";
|
|
10
|
-
import ResourceSettingsCard from "../../shared/components/admin/mailboxes/ResourceSettingsCard.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (bytes >=
|
|
18
|
-
if (bytes >=
|
|
19
|
-
return `${bytes}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const [
|
|
33
|
-
const [
|
|
34
|
-
const [
|
|
35
|
-
const [
|
|
36
|
-
const [
|
|
37
|
-
const [
|
|
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
|
-
onClick={() =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</dd>
|
|
135
|
-
<dt className="text-text-muted">
|
|
136
|
-
<dd>{mailbox.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
<dt className="text-text-muted">
|
|
144
|
-
<dd>{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
</
|
|
153
|
-
</
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import React, { useEffect, useState } from "react";
|
|
6
|
+
import { ApiRequestError } from "@rapidmx/react-shared/util/api.js";
|
|
7
|
+
import { deleteMailbox, getMailbox, impersonateUser, Mailbox } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
8
|
+
import AdminShell, { AdminShellProps } from "../../shared/components/admin/layout/AdminShell.js";
|
|
9
|
+
import ShareAccessCard from "../../shared/components/admin/mailboxes/ShareAccessCard.js";
|
|
10
|
+
import ResourceSettingsCard from "../../shared/components/admin/mailboxes/ResourceSettingsCard.js";
|
|
11
|
+
import EscrowScopeCard from "../../shared/components/admin/mailboxes/EscrowScopeCard.js";
|
|
12
|
+
import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
|
|
13
|
+
import Button from "@rapidmx/react-shared/components/buttons/Button.js";
|
|
14
|
+
import Modal from "@rapidmx/react-shared/components/overlays/Modal.js";
|
|
15
|
+
|
|
16
|
+
function formatBytes(bytes: number): string {
|
|
17
|
+
if (bytes >= 1_000_000_000) return `${(bytes / 1_000_000_000).toFixed(2)} GB`;
|
|
18
|
+
if (bytes >= 1_000_000) return `${(bytes / 1_000_000).toFixed(1)} MB`;
|
|
19
|
+
if (bytes >= 1_000) return `${(bytes / 1_000).toFixed(1)} KB`;
|
|
20
|
+
return `${bytes} B`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function MailboxDetailPage(props: Omit<AdminShellProps, "active"> & { params: { uid: string } }) {
|
|
24
|
+
return (
|
|
25
|
+
<AdminShell {...props} active="mailboxes">
|
|
26
|
+
<MailboxDetailContent uid={props.params.uid} impersonationBaseUrl={props.impersonationBaseUrl} />
|
|
27
|
+
</AdminShell>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function MailboxDetailContent({ uid, impersonationBaseUrl }: { uid: string } & Pick<AdminShellProps, "impersonationBaseUrl">) {
|
|
32
|
+
const [mailbox, setMailbox] = useState<Mailbox | null>(null);
|
|
33
|
+
const [loading, setLoading] = useState(true);
|
|
34
|
+
const [error, setError] = useState<string | null>(null);
|
|
35
|
+
const [confirmingAccess, setConfirmingAccess] = useState(false);
|
|
36
|
+
const [impersonating, setImpersonating] = useState(false);
|
|
37
|
+
const [accessError, setAccessError] = useState<string | null>(null);
|
|
38
|
+
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
39
|
+
const [deleting, setDeleting] = useState(false);
|
|
40
|
+
const [deleteError, setDeleteError] = useState<string | null>(null);
|
|
41
|
+
|
|
42
|
+
// Ignored while the action is under way (Escape/Close; Cancel is disabled then too), so its result or error
|
|
43
|
+
// can't land on a modal reopened afterwards.
|
|
44
|
+
function closeAccessModal() {
|
|
45
|
+
if (impersonating) return;
|
|
46
|
+
setConfirmingAccess(false);
|
|
47
|
+
setAccessError(null);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Only ever invoked from the access-confirmation modal below, which only renders for a loaded mailbox that has
|
|
51
|
+
// an owner. A failure stays in the modal rather than replacing the whole page.
|
|
52
|
+
async function handleAccessMailbox() {
|
|
53
|
+
setImpersonating(true);
|
|
54
|
+
setAccessError(null);
|
|
55
|
+
try {
|
|
56
|
+
await impersonateUser(impersonationBaseUrl ?? "", mailbox!.ownerUserUid!);
|
|
57
|
+
window.location.href = "/";
|
|
58
|
+
} catch (err) {
|
|
59
|
+
setAccessError(err instanceof ApiRequestError ? err.message : "Could not access this mailbox.");
|
|
60
|
+
setImpersonating(false);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function closeDeleteModal() {
|
|
65
|
+
if (deleting) return;
|
|
66
|
+
setConfirmingDelete(false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Only ever invoked from the delete-confirmation modal below, which itself only renders once
|
|
70
|
+
// `mailbox` is resolved (the `error || !mailbox` branch below returns before this content mounts).
|
|
71
|
+
async function handleDelete() {
|
|
72
|
+
setDeleting(true);
|
|
73
|
+
setDeleteError(null);
|
|
74
|
+
try {
|
|
75
|
+
await deleteMailbox(mailbox!.uid, mailbox!.version);
|
|
76
|
+
window.location.href = "/admin";
|
|
77
|
+
} catch (err) {
|
|
78
|
+
// Most commonly a 409 if this mailbox is a custodian on an open legal hold (restapi's own
|
|
79
|
+
// `assertNotOnLegalHold()`, naming the blocking Matter uid(s)) - surfaced as-is, same as
|
|
80
|
+
// every other destructive-action error in this codebase, rather than special-cased here.
|
|
81
|
+
setDeleteError(err instanceof ApiRequestError ? err.message : "Could not delete this mailbox.");
|
|
82
|
+
setDeleting(false);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
setLoading(true);
|
|
88
|
+
setError(null);
|
|
89
|
+
getMailbox(uid)
|
|
90
|
+
.then(setMailbox)
|
|
91
|
+
.catch((err) => setError(err instanceof ApiRequestError ? err.message : "Could not load this mailbox."))
|
|
92
|
+
.finally(() => setLoading(false));
|
|
93
|
+
}, [uid]);
|
|
94
|
+
|
|
95
|
+
if (loading) {
|
|
96
|
+
return <p className="text-sm text-text-muted">Loading…</p>;
|
|
97
|
+
}
|
|
98
|
+
if (error || !mailbox) {
|
|
99
|
+
return <Alert>{error ?? "Mailbox not found."}</Alert>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const quarantineHref = `/admin/quarantine?mailboxUid=${encodeURIComponent(mailbox.uid)}`;
|
|
103
|
+
const ingestQueueHref = `/admin/ingest-queue?mailboxUid=${encodeURIComponent(mailbox.uid)}`;
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className="max-w-3xl flex flex-col gap-5">
|
|
107
|
+
<div className="flex items-start justify-between gap-4">
|
|
108
|
+
<div>
|
|
109
|
+
<a href="/admin" className="text-sm text-primary-dark hover:underline">
|
|
110
|
+
← All mailboxes
|
|
111
|
+
</a>
|
|
112
|
+
<h1 className="text-xl font-bold tracking-tight mt-1">{mailbox.primarySmtpAddress}</h1>
|
|
113
|
+
</div>
|
|
114
|
+
<div className="flex gap-3 shrink-0">
|
|
115
|
+
{mailbox.ownerUserUid && (
|
|
116
|
+
<Button type="button" variant="secondary" className="!w-auto" onClick={() => setConfirmingAccess(true)}>
|
|
117
|
+
Access this mailbox
|
|
118
|
+
</Button>
|
|
119
|
+
)}
|
|
120
|
+
<Button
|
|
121
|
+
type="button"
|
|
122
|
+
variant="secondary"
|
|
123
|
+
className="!w-auto !border-danger !text-danger hover:!border-danger hover:!text-danger"
|
|
124
|
+
onClick={() => setConfirmingDelete(true)}
|
|
125
|
+
>
|
|
126
|
+
Delete mailbox
|
|
127
|
+
</Button>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div className="bg-surface border border-border rounded-md p-6">
|
|
132
|
+
<dl className="grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3 text-sm">
|
|
133
|
+
<dt className="text-text-muted">Display name</dt>
|
|
134
|
+
<dd>{mailbox.displayName}</dd>
|
|
135
|
+
<dt className="text-text-muted">Owner</dt>
|
|
136
|
+
<dd>{mailbox.ownerUserUid ?? "None (shared mailbox)"}</dd>
|
|
137
|
+
<dt className="text-text-muted">Timezone</dt>
|
|
138
|
+
<dd>{mailbox.timezone}</dd>
|
|
139
|
+
<dt className="text-text-muted">Quota</dt>
|
|
140
|
+
<dd>
|
|
141
|
+
{formatBytes(mailbox.usedBytes)} / {formatBytes(mailbox.quotaBytes)}
|
|
142
|
+
</dd>
|
|
143
|
+
<dt className="text-text-muted">Alias addresses</dt>
|
|
144
|
+
<dd>{mailbox.aliasAddresses.length > 0 ? mailbox.aliasAddresses.join(", ") : "None"}</dd>
|
|
145
|
+
{mailbox.isResource && (
|
|
146
|
+
<>
|
|
147
|
+
<dt className="text-text-muted">Resource type</dt>
|
|
148
|
+
<dd className="capitalize">{mailbox.resourceType ?? "room"}</dd>
|
|
149
|
+
</>
|
|
150
|
+
)}
|
|
151
|
+
<dt className="text-text-muted">Created</dt>
|
|
152
|
+
<dd>{new Date(mailbox.dateCreated).toLocaleString()}</dd>
|
|
153
|
+
</dl>
|
|
154
|
+
<div className="flex gap-4 mt-5 pt-5 border-t border-border text-sm font-medium">
|
|
155
|
+
<a href={quarantineHref} className="text-primary-dark hover:underline">
|
|
156
|
+
View quarantine
|
|
157
|
+
</a>
|
|
158
|
+
<a href={ingestQueueHref} className="text-primary-dark hover:underline">
|
|
159
|
+
View ingest queue
|
|
160
|
+
</a>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<ShareAccessCard mailboxUid={mailbox.uid} ownerUserUid={mailbox.ownerUserUid} />
|
|
165
|
+
|
|
166
|
+
<EscrowScopeCard mailbox={mailbox} onUpdate={setMailbox} />
|
|
167
|
+
|
|
168
|
+
{mailbox.isResource && <ResourceSettingsCard mailbox={mailbox} onUpdate={setMailbox} />}
|
|
169
|
+
|
|
170
|
+
<Modal open={confirmingAccess} onClose={closeAccessModal} title="Access this mailbox">
|
|
171
|
+
<p className="text-sm mb-3">
|
|
172
|
+
You’ll be signed in as <strong className="break-all">{mailbox.ownerUserUid}</strong>, the owner
|
|
173
|
+
of <strong className="break-all">{mailbox.primarySmtpAddress}</strong>, and see everything they can -
|
|
174
|
+
and act as them, until you stop impersonating.
|
|
175
|
+
</p>
|
|
176
|
+
{accessError && <Alert>{accessError}</Alert>}
|
|
177
|
+
<div className="flex gap-3 justify-end mt-5">
|
|
178
|
+
<Button type="button" variant="secondary" className="!w-auto" disabled={impersonating} onClick={closeAccessModal}>
|
|
179
|
+
Cancel
|
|
180
|
+
</Button>
|
|
181
|
+
<Button type="button" className="!w-auto" loading={impersonating} disabled={impersonating} onClick={handleAccessMailbox}>
|
|
182
|
+
Access mailbox
|
|
183
|
+
</Button>
|
|
184
|
+
</div>
|
|
185
|
+
</Modal>
|
|
186
|
+
|
|
187
|
+
<Modal open={confirmingDelete} onClose={closeDeleteModal} title="Delete mailbox">
|
|
188
|
+
<p className="text-sm mb-5">
|
|
189
|
+
Are you sure you want to delete <strong>{mailbox.primarySmtpAddress}</strong>? This permanently
|
|
190
|
+
deletes the mailbox and everything in it, and cannot be undone. It fails if this mailbox is a
|
|
191
|
+
custodian on an active legal hold.
|
|
192
|
+
</p>
|
|
193
|
+
{deleteError && <Alert>{deleteError}</Alert>}
|
|
194
|
+
<div className="flex gap-3 justify-end mt-5">
|
|
195
|
+
<Button type="button" variant="secondary" className="!w-auto" disabled={deleting} onClick={closeDeleteModal}>
|
|
196
|
+
Cancel
|
|
197
|
+
</Button>
|
|
198
|
+
<Button
|
|
199
|
+
type="button"
|
|
200
|
+
className="!w-auto !bg-none !bg-danger !border-danger hover:!bg-danger"
|
|
201
|
+
loading={deleting}
|
|
202
|
+
disabled={deleting}
|
|
203
|
+
onClick={handleDelete}
|
|
204
|
+
>
|
|
205
|
+
Delete
|
|
206
|
+
</Button>
|
|
207
|
+
</div>
|
|
208
|
+
</Modal>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
}
|