@rapidmx/web-client 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -0
- package/apps/shared/components/admin/layout/AdminShell.tsx +25 -8
- package/apps/shared/components/admin/settings/BrandingForm.tsx +398 -385
- package/apps/shared/components/admin/settings/EncryptionPolicyForm.tsx +119 -112
- package/apps/shared/components/admin/settings/MailboxPolicyForm.tsx +159 -152
- package/apps/shared/components/admin/settings/PluginsManager.tsx +1288 -1235
- package/apps/shared/components/admin/settings/RetentionPolicyForm.tsx +9 -1
- package/apps/shared/components/admin/setup/EscrowSetupStep.tsx +288 -290
- package/apps/shared/components/admin/setup/SetupWizard.tsx +443 -416
- package/apps/shared/components/calendar/layout/CalendarShell.tsx +194 -192
- package/apps/shared/components/contacts/layout/ContactsShell.tsx +199 -197
- package/apps/shared/components/layout/AppShell.tsx +288 -270
- package/apps/shared/components/mail/ConversationList.tsx +225 -33
- package/apps/shared/components/mail/ConversationThreadPane.tsx +434 -216
- package/apps/shared/components/mail/MailListToolbar.tsx +265 -0
- package/apps/shared/components/mail/MailSelectionBar.tsx +222 -0
- package/apps/shared/components/mail/MenuButton.tsx +384 -0
- package/apps/shared/components/mail/MessageDetailPane.tsx +280 -215
- package/apps/shared/components/mail/MoveToFolderDialog.tsx +263 -0
- package/apps/shared/components/mail/compose/ComposeContext.tsx +29 -2
- package/apps/shared/components/mail/compose/ComposeWindow.tsx +1700 -1652
- package/apps/shared/components/mail/compose/RecipientInput.tsx +356 -0
- package/apps/shared/components/mail/compose/RichTextEditor.tsx +38 -3
- package/apps/shared/components/mail/compose/quotedBody.ts +100 -0
- package/apps/shared/components/mail/compose/recipients.ts +104 -0
- package/apps/shared/components/mail/labelMenu.tsx +278 -0
- package/apps/shared/components/mail/layout/MailShell.tsx +31 -4
- package/apps/shared/components/mail/listPreferences.ts +228 -0
- package/apps/shared/components/settings/layout/SettingsShell.tsx +23 -10
- package/apps/shared/components/tasks/layout/TasksShell.tsx +201 -199
- package/apps/shared/plugins/pluginNav.ts +73 -0
- package/apps/shared/search/localIndexRpcClient.ts +3 -1
- package/apps/shared/styles/app.css +28 -5
- package/apps/www/index.tsx +1854 -1314
- package/apps/www/messages/[uid].tsx +5 -4
- package/dist/apps/admin/_404.d.ts +2 -0
- package/dist/apps/admin/_500.d.ts +2 -0
- package/dist/apps/admin/_layout.d.ts +8 -0
- package/dist/apps/admin/audit-log/index.d.ts +11 -0
- package/dist/apps/admin/branding/index.d.ts +3 -0
- package/dist/apps/admin/data-requests/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/[uid].d.ts +7 -0
- package/dist/apps/admin/distribution-lists/index.d.ts +3 -0
- package/dist/apps/admin/distribution-lists/new/index.d.ts +3 -0
- package/dist/apps/admin/domains/[uid].d.ts +7 -0
- package/dist/apps/admin/domains/index.d.ts +3 -0
- package/dist/apps/admin/domains/new/index.d.ts +3 -0
- package/dist/apps/admin/encryption-policy/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/[uid].d.ts +21 -0
- package/dist/apps/admin/escrow-scopes/index.d.ts +3 -0
- package/dist/apps/admin/escrow-scopes/new/index.d.ts +3 -0
- package/dist/apps/admin/index.d.ts +3 -0
- package/dist/apps/admin/ingest-queue/index.d.ts +4 -0
- package/dist/apps/admin/mailbox-policy/index.d.ts +3 -0
- package/dist/apps/admin/mailboxes/[uid].d.ts +7 -0
- package/dist/apps/admin/mailboxes/new/index.d.ts +3 -0
- package/dist/apps/admin/plugins/index.d.ts +3 -0
- package/dist/apps/admin/quarantine/index.d.ts +6 -0
- package/dist/apps/admin/retention-policy/index.d.ts +3 -0
- package/dist/apps/admin/setup/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/[uid].d.ts +7 -0
- package/dist/apps/admin/transport-rules/_transportRuleConfig.d.ts +21 -0
- package/dist/apps/admin/transport-rules/index.d.ts +3 -0
- package/dist/apps/admin/transport-rules/new/index.d.ts +3 -0
- package/dist/apps/escrow/_layout.d.ts +10 -0
- package/dist/apps/escrow/audit-log/index.d.ts +9 -0
- package/dist/apps/escrow/index.d.ts +3 -0
- package/dist/apps/escrow/matters/[uid].d.ts +7 -0
- package/dist/apps/escrow/matters/new/index.d.ts +3 -0
- package/dist/apps/shared/components/admin/distributionLists/MemberListCard.d.ts +17 -0
- package/dist/apps/shared/components/admin/escrowScopes/EscrowScopeKeyAndHoldersFields.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +32 -0
- package/dist/apps/shared/components/admin/layout/AdminShell.js +12 -5
- package/dist/apps/shared/components/admin/mailboxes/EscrowScopeCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/mailboxes/MailboxTable.d.ts +6 -0
- package/dist/apps/shared/components/admin/mailboxes/ResourceSettingsCard.d.ts +19 -0
- package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +13 -0
- package/dist/apps/shared/components/admin/settings/BrandingForm.js +6 -5
- package/dist/apps/shared/components/admin/settings/DomainDnsSetup.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.d.ts +15 -0
- package/dist/apps/shared/components/admin/settings/EncryptionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/LoadedSettingsForm.d.ts +9 -0
- package/dist/apps/shared/components/admin/settings/MailboxCreateForm.d.ts +19 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.d.ts +13 -0
- package/dist/apps/shared/components/admin/settings/MailboxPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/settings/PluginsManager.d.ts +11 -0
- package/dist/apps/shared/components/admin/settings/PluginsManager.js +33 -14
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.d.ts +12 -0
- package/dist/apps/shared/components/admin/settings/RetentionPolicyForm.js +2 -2
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.d.ts +14 -0
- package/dist/apps/shared/components/admin/setup/EscrowSetupStep.js +1 -1
- package/dist/apps/shared/components/admin/setup/SetupWizard.d.ts +36 -0
- package/dist/apps/shared/components/admin/setup/SetupWizard.js +14 -10
- package/dist/apps/shared/components/admin/signOut.d.ts +23 -0
- package/dist/apps/shared/components/admin/usePagedList.d.ts +39 -0
- package/dist/apps/shared/components/calendar/CalendarListSidebar.d.ts +26 -0
- package/dist/apps/shared/components/calendar/EventModal.d.ts +46 -0
- package/dist/apps/shared/components/calendar/MonthView.d.ts +15 -0
- package/dist/apps/shared/components/calendar/RecurrenceEditor.d.ts +20 -0
- package/dist/apps/shared/components/calendar/ResourcePicker.d.ts +19 -0
- package/dist/apps/shared/components/calendar/SplitDayView.d.ts +28 -0
- package/dist/apps/shared/components/calendar/TimeGridView.d.ts +17 -0
- package/dist/apps/shared/components/calendar/allDay.d.ts +51 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +40 -0
- package/dist/apps/shared/components/calendar/layout/CalendarShell.js +2 -2
- package/dist/apps/shared/components/contacts/ContactDetailPane.d.ts +23 -0
- package/dist/apps/shared/components/contacts/ContactForm.d.ts +20 -0
- package/dist/apps/shared/components/contacts/ContactsSidebar.d.ts +40 -0
- package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +25 -0
- package/dist/apps/shared/components/contacts/KeyChangeReview.d.ts +40 -0
- package/dist/apps/shared/components/contacts/contactKeys.d.ts +29 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +21 -0
- package/dist/apps/shared/components/contacts/layout/ContactsShell.js +2 -2
- package/dist/apps/shared/components/escrow/layout/EscrowShell.d.ts +25 -0
- package/dist/apps/shared/components/forms/StringListField.d.ts +22 -0
- package/dist/apps/shared/components/layout/AppShell.d.ts +49 -0
- package/dist/apps/shared/components/layout/AppShell.js +15 -13
- package/dist/apps/shared/components/layout/BrandingChrome.d.ts +18 -0
- package/dist/apps/shared/components/layout/KeyEnrollmentGate.d.ts +51 -0
- package/dist/apps/shared/components/layout/MailboxProvisioning.d.ts +13 -0
- package/dist/apps/shared/components/layout/RecoveryCodeUnlock.d.ts +66 -0
- package/dist/apps/shared/components/layout/UnlockPromptProvider.d.ts +45 -0
- package/dist/apps/shared/components/layout/UserMenu.d.ts +23 -0
- package/dist/apps/shared/components/mail/ConversationList.d.ts +47 -0
- package/dist/apps/shared/components/mail/ConversationList.js +84 -10
- package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +62 -0
- package/dist/apps/shared/components/mail/ConversationThreadPane.js +217 -60
- package/dist/apps/shared/components/mail/MailListToolbar.d.ts +55 -0
- package/dist/apps/shared/components/mail/MailListToolbar.js +149 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +59 -0
- package/dist/apps/shared/components/mail/MailSelectionBar.js +48 -0
- package/dist/apps/shared/components/mail/MenuButton.d.ts +71 -0
- package/dist/apps/shared/components/mail/MenuButton.js +211 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +101 -0
- package/dist/apps/shared/components/mail/MessageDetailPane.js +126 -129
- package/dist/apps/shared/components/mail/MoveToFolderDialog.d.ts +57 -0
- package/dist/apps/shared/components/mail/MoveToFolderDialog.js +138 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +73 -0
- package/dist/apps/shared/components/mail/compose/ComposeContext.js +3 -1
- package/dist/apps/shared/components/mail/compose/ComposeToolbar.d.ts +15 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/ComposeWindow.js +52 -20
- package/dist/apps/shared/components/mail/compose/EmojiPicker.d.ts +14 -0
- package/dist/apps/shared/components/mail/compose/GifPicker.d.ts +13 -0
- package/dist/apps/shared/components/mail/compose/RecipientInput.d.ts +36 -0
- package/dist/apps/shared/components/mail/compose/RecipientInput.js +203 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +43 -0
- package/dist/apps/shared/components/mail/compose/RichTextEditor.js +21 -3
- package/dist/apps/shared/components/mail/compose/ScheduleSendPicker.d.ts +16 -0
- package/dist/apps/shared/components/mail/compose/composeFlushRegistry.d.ts +27 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +37 -0
- package/dist/apps/shared/components/mail/compose/quotedBody.js +85 -0
- package/dist/apps/shared/components/mail/compose/recipients.d.ts +24 -0
- package/dist/apps/shared/components/mail/compose/recipients.js +87 -0
- package/dist/apps/shared/components/mail/labelMenu.d.ts +97 -0
- package/dist/apps/shared/components/mail/labelMenu.js +134 -0
- package/dist/apps/shared/components/mail/layout/MailShell.d.ts +65 -0
- package/dist/apps/shared/components/mail/layout/MailShell.js +17 -5
- package/dist/apps/shared/components/mail/listPreferences.d.ts +101 -0
- package/dist/apps/shared/components/mail/listPreferences.js +186 -0
- package/dist/apps/shared/components/mail/pinnedSigners.d.ts +33 -0
- package/dist/apps/shared/components/mail/verificationSeals.d.ts +22 -0
- package/dist/apps/shared/components/mail/writableMailboxes.d.ts +15 -0
- package/dist/apps/shared/components/rules/RuleBuilder.d.ts +70 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +41 -0
- package/dist/apps/shared/components/settings/layout/SettingsShell.js +19 -10
- package/dist/apps/shared/components/tasks/TasksSidebar.d.ts +41 -0
- package/dist/apps/shared/components/tasks/TasksToolbar.d.ts +14 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +24 -0
- package/dist/apps/shared/components/tasks/layout/TasksShell.js +2 -2
- package/dist/apps/shared/mail/findWellKnownFolderUid.d.ts +5 -0
- package/dist/apps/shared/mail/listAllPages.d.ts +17 -0
- package/dist/apps/shared/plugins/pluginNav.d.ts +39 -0
- package/dist/apps/shared/plugins/pluginNav.js +33 -0
- package/dist/apps/shared/search/LocalIndexLifecycle.d.ts +13 -0
- package/dist/apps/shared/search/localIndexBlockCipher.d.ts +36 -0
- package/dist/apps/shared/search/localIndexBuilder.d.ts +85 -0
- package/dist/apps/shared/search/localIndexKey.d.ts +4 -0
- package/dist/apps/shared/search/localIndexRpcClient.d.ts +71 -0
- package/dist/apps/shared/search/localIndexRpcClient.js +3 -1
- package/dist/apps/shared/search/localIndexSchema.d.ts +111 -0
- package/dist/apps/shared/search/localIndexSizePreference.d.ts +27 -0
- package/dist/apps/shared/search/localIndexStorage.d.ts +28 -0
- package/dist/apps/shared/search/localIndexVFS.d.ts +101 -0
- package/dist/apps/shared/search/localIndexWorker.d.ts +145 -0
- package/dist/apps/shared/search/searchTier2.d.ts +30 -0
- package/dist/apps/shared/styles/app.css +28 -5
- package/dist/apps/www/_404.d.ts +2 -0
- package/dist/apps/www/_500.d.ts +2 -0
- package/dist/apps/www/_layout.d.ts +14 -0
- package/dist/apps/www/calendar/index.d.ts +3 -0
- package/dist/apps/www/contacts/[uid].d.ts +13 -0
- package/dist/apps/www/contacts/index.d.ts +3 -0
- package/dist/apps/www/index.d.ts +3 -0
- package/dist/apps/www/index.js +506 -112
- package/dist/apps/www/messages/[uid].d.ts +11 -0
- package/dist/apps/www/messages/[uid].js +2 -3
- package/dist/apps/www/settings/auto-reply/index.d.ts +4 -0
- package/dist/apps/www/settings/encryption/index.d.ts +7 -0
- package/dist/apps/www/settings/filters/[uid].d.ts +8 -0
- package/dist/apps/www/settings/filters/_mailFilterRuleConfig.d.ts +11 -0
- package/dist/apps/www/settings/filters/index.d.ts +4 -0
- package/dist/apps/www/settings/filters/new/index.d.ts +4 -0
- package/dist/apps/www/settings/labels/index.d.ts +4 -0
- package/dist/apps/www/settings/privacy/index.d.ts +4 -0
- package/dist/apps/www/settings/read-receipts/index.d.ts +4 -0
- package/dist/apps/www/settings/sharing/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/[uid].d.ts +8 -0
- package/dist/apps/www/settings/signatures/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/new/index.d.ts +4 -0
- package/dist/apps/www/settings/signatures/signatureDefaults.d.ts +10 -0
- package/dist/apps/www/tasks/index.d.ts +3 -0
- package/package.json +3 -3
- package/apps/shared/components/booking/AvailabilityEditor.tsx +0 -118
- package/apps/www/settings/booking-types/[uid].tsx +0 -306
- package/apps/www/settings/booking-types/index.tsx +0 -98
- package/apps/www/settings/booking-types/new/index.tsx +0 -212
- package/apps/www/settings/focused-inbox/index.tsx +0 -150
- package/dist/apps/shared/components/booking/AvailabilityEditor.js +0 -45
- package/dist/apps/www/settings/booking-types/[uid].js +0 -134
- package/dist/apps/www/settings/booking-types/index.js +0 -29
- package/dist/apps/www/settings/booking-types/new/index.js +0 -86
- package/dist/apps/www/settings/focused-inbox/index.js +0 -71
|
@@ -1,270 +1,288 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
-
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
-
import "../../styles/app.css";
|
|
6
|
-
import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
|
|
7
|
-
import type { IconType } from "react-icons";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export
|
|
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
|
-
const
|
|
91
|
-
mail: "Mail",
|
|
92
|
-
calendar: "Calendar",
|
|
93
|
-
contacts: "Contacts",
|
|
94
|
-
tasks: "Tasks",
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
//
|
|
185
|
-
//
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
>
|
|
237
|
-
<
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// Copyright (C) 2026 Jean-Philippe Steinmetz
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
import "../../styles/app.css";
|
|
6
|
+
import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
|
|
7
|
+
import type { IconType } from "react-icons";
|
|
8
|
+
import {
|
|
9
|
+
HiOutlineCalendarDays,
|
|
10
|
+
HiOutlineClipboardDocumentList,
|
|
11
|
+
HiOutlineEnvelope,
|
|
12
|
+
HiOutlinePuzzlePiece,
|
|
13
|
+
HiOutlineUsers,
|
|
14
|
+
} from "react-icons/hi2";
|
|
15
|
+
import { useRedirectIfUnauthenticated } from "@rapidmx/react-shared/auth/session.js";
|
|
16
|
+
import { getSetupStatus } from "@rapidmx/react-shared/admin/setupApi.js";
|
|
17
|
+
import { stopImpersonating } from "@rapidmx/react-shared/mail/mailApi.js";
|
|
18
|
+
import useBranding from "@rapidmx/react-shared/branding/useBranding.js";
|
|
19
|
+
import { useIdleKeyTimeout } from "@rapidmx/react-shared/crypto/useIdleKeyTimeout.js";
|
|
20
|
+
import ComposeProvider from "../mail/compose/ComposeContext.js";
|
|
21
|
+
import { flushComposeDrafts, markSigningOut } from "../mail/compose/composeFlushRegistry.js";
|
|
22
|
+
import BottomTabBar, { NavItem } from "@rapidmx/react-shared/components/navigation/BottomTabBar.js";
|
|
23
|
+
import { BrandingFooter, BrandingHeader } from "./BrandingChrome.js";
|
|
24
|
+
import UserMenu from "./UserMenu.js";
|
|
25
|
+
import { UnlockPromptProvider } from "./UnlockPromptProvider.js";
|
|
26
|
+
import { SIGN_OUT_CHANNEL, destroyAllLocalIndexes } from "../../search/localIndexRpcClient.js";
|
|
27
|
+
import { authApiFetch } from "@rapidmx/react-shared/util/api.js";
|
|
28
|
+
import { destroyUnlockedKeys } from "@rapidmx/react-shared/crypto/keySession.js";
|
|
29
|
+
import { clearPinnedSignerCache } from "../mail/pinnedSigners.js";
|
|
30
|
+
import { mergePluginNavItems, PluginNav, PluginNavProps } from "../../plugins/pluginNav.js";
|
|
31
|
+
|
|
32
|
+
/** How long sign-out waits for auth-server's logout before navigating anyway. */
|
|
33
|
+
export const LOGOUT_TIMEOUT_MS = 3_000;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Calls auth-server's logout (`POST /api/auth/logout`, cross-origin with credentials), which clears the auth
|
|
37
|
+
* cookie and invalidates the session's refresh token. Bounded by `LOGOUT_TIMEOUT_MS` and never rejects - a
|
|
38
|
+
* failure (unreachable server, CORS) must not keep the user from leaving.
|
|
39
|
+
*/
|
|
40
|
+
async function logOutOfAuthServer(authServerUrl: string | undefined): Promise<void> {
|
|
41
|
+
if (!authServerUrl) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const controller = new AbortController();
|
|
45
|
+
const timer = setTimeout(() => controller.abort(), LOGOUT_TIMEOUT_MS);
|
|
46
|
+
try {
|
|
47
|
+
await authApiFetch(authServerUrl, "/auth/logout", { method: "POST", signal: controller.signal });
|
|
48
|
+
} catch {
|
|
49
|
+
// Navigate anyway - see this function's doc comment.
|
|
50
|
+
} finally {
|
|
51
|
+
clearTimeout(timer);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type AppShellApp = "mail" | "calendar" | "contacts" | "tasks";
|
|
56
|
+
|
|
57
|
+
/** `"settings"` is a valid `active` value but deliberately has no entry in `APPS` below — Settings is
|
|
58
|
+
* reached via a `UserMenu` item, not a 5th rail icon (see `SettingsShell.tsx`), so it highlights no
|
|
59
|
+
* rail/tab icon at all; only the header title needs to account for it. Any other string is a plugin's
|
|
60
|
+
* `appRail` item id (see `PluginNav`). */
|
|
61
|
+
export type AppShellActive = AppShellApp | "settings" | (string & {});
|
|
62
|
+
|
|
63
|
+
export interface AppShellProps extends PluginNavProps {
|
|
64
|
+
/** Which icon in the rail is highlighted as the current app — `"settings"` highlights none, and a plugin
|
|
65
|
+
* app page passes its own `appRail` item id. */
|
|
66
|
+
active: AppShellActive;
|
|
67
|
+
/** Populated automatically by the framework from an authenticated request (e.g. a valid `jwt` cookie). */
|
|
68
|
+
userUid?: string;
|
|
69
|
+
/** auth-server's base URL, injected via the route's `fetchProps`. */
|
|
70
|
+
authServerUrl?: string;
|
|
71
|
+
/**
|
|
72
|
+
* `true` when this session is an admin "log in as user" impersonation (a `jwt_impersonator` cookie is
|
|
73
|
+
* present) — see `MailShell`'s original doc comment, unchanged now that this lives here. Drives the
|
|
74
|
+
* "you are viewing as this user — stop impersonating" banner below.
|
|
75
|
+
*/
|
|
76
|
+
impersonating?: boolean;
|
|
77
|
+
/** Where `mailApi.ts`'s `stopImpersonating()` should call — see `MailShell`'s original doc comment. */
|
|
78
|
+
impersonationBaseUrl?: string;
|
|
79
|
+
/** `true` when the caller's JWT carries a trusted role — shows an "Admin" item in the user menu below. */
|
|
80
|
+
trusted?: boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface AppDef {
|
|
84
|
+
id: AppShellApp;
|
|
85
|
+
href: string;
|
|
86
|
+
label: string;
|
|
87
|
+
icon: IconType;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const APPS: AppDef[] = [
|
|
91
|
+
{ id: "mail", href: "/", label: "Mail", icon: HiOutlineEnvelope },
|
|
92
|
+
{ id: "calendar", href: "/calendar", label: "Calendar", icon: HiOutlineCalendarDays },
|
|
93
|
+
{ id: "contacts", href: "/contacts", label: "Contacts", icon: HiOutlineUsers },
|
|
94
|
+
{ id: "tasks", href: "/tasks", label: "Tasks", icon: HiOutlineClipboardDocumentList },
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
/** Ids plugin `appRail` items can't take besides `APPS`' own - `"settings"` has no rail icon but is still a
|
|
98
|
+
* core `active` value. */
|
|
99
|
+
const RESERVED_APP_IDS = ["settings"];
|
|
100
|
+
|
|
101
|
+
/** `APPS` followed by the plugins' `appRail` items (generic icon), core ids winning - see `mergePluginNavItems`. */
|
|
102
|
+
export function appRailItems(pluginNav?: PluginNav): NavItem[] {
|
|
103
|
+
return mergePluginNavItems<NavItem>(
|
|
104
|
+
APPS,
|
|
105
|
+
pluginNav?.appRail,
|
|
106
|
+
({ id, href, label }) => ({ id, href, label, icon: HiOutlinePuzzlePiece }),
|
|
107
|
+
RESERVED_APP_IDS,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The persistent chrome shared by every webmail app (Mail, Calendar, Contacts, Tasks): a left icon rail for
|
|
113
|
+
* switching apps (full page loads — see `MailShell`'s original doc comment on this framework having no
|
|
114
|
+
* client-side router), a header with the current app's name and `UserMenu`, and the impersonation banner.
|
|
115
|
+
* Each app's own shell (e.g. `MailShell`) renders its own contextual sidebar + content as `children`, inside
|
|
116
|
+
* the area to the right of the icon rail and below the header.
|
|
117
|
+
*/
|
|
118
|
+
export default function AppShell({
|
|
119
|
+
active,
|
|
120
|
+
userUid,
|
|
121
|
+
authServerUrl,
|
|
122
|
+
impersonating,
|
|
123
|
+
impersonationBaseUrl,
|
|
124
|
+
trusted,
|
|
125
|
+
pluginNav,
|
|
126
|
+
children,
|
|
127
|
+
}: PropsWithChildren<AppShellProps>) {
|
|
128
|
+
const [stoppingImpersonation, setStoppingImpersonation] = useState(false);
|
|
129
|
+
const signingOutRef = useRef(false);
|
|
130
|
+
const { branding, iconSrc } = useBranding();
|
|
131
|
+
|
|
132
|
+
useRedirectIfUnauthenticated(userUid, authServerUrl);
|
|
133
|
+
// Mounted here, not scoped to Mail/Settings (the only shells that actually read unlocked keys),
|
|
134
|
+
// specifically so activity in *any* app resets the idle clock - see that hook's own doc comment.
|
|
135
|
+
useIdleKeyTimeout();
|
|
136
|
+
|
|
137
|
+
// An administrator on a server that hasn't finished first-run setup is sent to the setup wizard. The status
|
|
138
|
+
// check is admin-only, so it's only made for a trusted caller - everyone else would just get a 403 on every
|
|
139
|
+
// page load. Any failure is ignored.
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!userUid || impersonating || !trusted) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
getSetupStatus()
|
|
145
|
+
.then((status) => {
|
|
146
|
+
if (status.required) {
|
|
147
|
+
window.location.href = "/admin/setup";
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
.catch(() => undefined);
|
|
151
|
+
}, [userUid, impersonating, trusted]);
|
|
152
|
+
|
|
153
|
+
// Another tab signing out (this app's `handleSignOut`, or the admin/escrow consoles' `signOutOfConsole()`)
|
|
154
|
+
// ended this session too - its auth cookie is gone - so this tab destroys its own unlocked keys and every
|
|
155
|
+
// local search index on the device, then leaves as well. The consoles have no local-index client of their
|
|
156
|
+
// own, so this is what actually removes the indexes after a console sign-out (the console also records a
|
|
157
|
+
// pending deletion, retried on the next mail load, in case no mail tab is open). `destroyAllLocalIndexes()`
|
|
158
|
+
// announces the sign-out on this same channel, which this tab then hears itself, so the ref is set first:
|
|
159
|
+
// each tab reacts once, and the tab that started the sign-out ignores its own announcement.
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (!userUid || typeof BroadcastChannel === "undefined") {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const channel = new BroadcastChannel(SIGN_OUT_CHANNEL);
|
|
165
|
+
channel.addEventListener("message", (event: MessageEvent<{ type?: string }>) => {
|
|
166
|
+
if (event.data?.type !== "sign-out" || signingOutRef.current) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
signingOutRef.current = true;
|
|
170
|
+
// Compose windows must not ask "Leave site?" - that would let this forced navigation be cancelled.
|
|
171
|
+
markSigningOut();
|
|
172
|
+
destroyUnlockedKeys();
|
|
173
|
+
clearPinnedSignerCache();
|
|
174
|
+
// Bounded by its own timeout and never rejects - awaited so navigating doesn't kill the Worker mid-delete.
|
|
175
|
+
void destroyAllLocalIndexes().then(() => {
|
|
176
|
+
window.location.href = authServerUrl ?? "/";
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
return () => channel.close();
|
|
180
|
+
}, [userUid, authServerUrl]);
|
|
181
|
+
|
|
182
|
+
async function handleSignOut() {
|
|
183
|
+
signingOutRef.current = true;
|
|
184
|
+
// Before flushing and navigating: compose windows then skip their "Leave site?" prompt, which could
|
|
185
|
+
// otherwise cancel the sign-out's own navigation.
|
|
186
|
+
markSigningOut();
|
|
187
|
+
// Unlocked private keys never outlive an explicit sign-out.
|
|
188
|
+
destroyUnlockedKeys();
|
|
189
|
+
// Trusted signer pins read from contacts don't outlive the session either.
|
|
190
|
+
clearPinnedSignerCache();
|
|
191
|
+
// Open compose windows save edits still waiting on their autosave debounce while the session is still
|
|
192
|
+
// valid - logout invalidates it. Bounded the same way as logout itself, and never rejects.
|
|
193
|
+
await flushComposeDrafts(LOGOUT_TIMEOUT_MS);
|
|
194
|
+
// The Tier 2 local index MUST be destroyed on explicit logout, the same as unlocked keys themselves
|
|
195
|
+
// (spec §11). Destroys every index on this device (not only mailboxes opened this page load) and is
|
|
196
|
+
// awaited before navigating - a navigation tears down the Worker mid-delete otherwise.
|
|
197
|
+
// destroyAllLocalIndexes() is bounded by its own timeout and never rejects, so sign-out can't hang.
|
|
198
|
+
// In parallel, auth-server's logout clears the auth cookie and invalidates the session's refresh
|
|
199
|
+
// token - without it, "Sign Out" would only navigate away from a still-valid session.
|
|
200
|
+
await Promise.all([destroyAllLocalIndexes(), logOutOfAuthServer(authServerUrl)]);
|
|
201
|
+
window.location.href = authServerUrl ?? "/";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function handleStopImpersonating() {
|
|
205
|
+
setStoppingImpersonation(true);
|
|
206
|
+
try {
|
|
207
|
+
await stopImpersonating(impersonationBaseUrl ?? "");
|
|
208
|
+
} catch {
|
|
209
|
+
// Navigate either way: a failed call leaves the impersonator cookie (and this banner) exactly as
|
|
210
|
+
// they were, so there's nothing else useful to show — matching this app's other network-error
|
|
211
|
+
// handling, which surfaces via a full reload rather than an inline retry affordance.
|
|
212
|
+
} finally {
|
|
213
|
+
window.location.href = "/admin";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (!userUid) {
|
|
218
|
+
return <div className="min-h-screen" />;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const apps = appRailItems(pluginNav);
|
|
222
|
+
// The header title: "settings" has no rail item, everything else is labelled by its own rail item.
|
|
223
|
+
const activeLabel = active === "settings" ? "Settings" : apps.find((app) => app.id === active)?.label;
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
// Mounted here, not scoped to Mail/Settings, for the same reason as useIdleKeyTimeout() above -
|
|
227
|
+
// ComposeWindow's sign/encrypt toggles and MessageDetailPane's encrypted-message view (both Mail)
|
|
228
|
+
// are today's only useUnlockPrompt() callers, but this needs to be available to any app shell.
|
|
229
|
+
<UnlockPromptProvider>
|
|
230
|
+
{/* An impersonating admin acts with the impersonated user's access, so their own trusted role
|
|
231
|
+
mustn't skip the per-mailbox checks. */}
|
|
232
|
+
<ComposeProvider userUid={userUid} trusted={!!trusted && !impersonating}>
|
|
233
|
+
<div className="min-h-screen flex flex-col bg-surface-alt">
|
|
234
|
+
<BrandingHeader branding={branding} />
|
|
235
|
+
{impersonating && (
|
|
236
|
+
<div className="h-10 shrink-0 bg-warning text-warning-contrast flex items-center justify-center gap-3 text-sm font-medium px-4">
|
|
237
|
+
<span>
|
|
238
|
+
You are viewing as <strong>{userUid}</strong>.
|
|
239
|
+
</span>
|
|
240
|
+
<button
|
|
241
|
+
type="button"
|
|
242
|
+
onClick={handleStopImpersonating}
|
|
243
|
+
disabled={stoppingImpersonation}
|
|
244
|
+
className="underline hover:no-underline disabled:opacity-60"
|
|
245
|
+
>
|
|
246
|
+
{stoppingImpersonation ? "Returning to admin…" : "Return to admin"}
|
|
247
|
+
</button>
|
|
248
|
+
</div>
|
|
249
|
+
)}
|
|
250
|
+
<div className="flex-1 flex min-h-0">
|
|
251
|
+
<nav
|
|
252
|
+
aria-label="Apps"
|
|
253
|
+
className="hidden md:flex w-16 shrink-0 bg-surface border-r border-border flex-col items-center py-3 gap-1"
|
|
254
|
+
>
|
|
255
|
+
<img src={iconSrc} width="96" height="96" alt="" className="mb-3" />
|
|
256
|
+
{apps.map(({ id, href, label, icon: Icon }) => (
|
|
257
|
+
<a
|
|
258
|
+
key={id}
|
|
259
|
+
href={href}
|
|
260
|
+
aria-label={label}
|
|
261
|
+
aria-current={id === active ? "page" : undefined}
|
|
262
|
+
title={label}
|
|
263
|
+
className={[
|
|
264
|
+
"w-10 h-10 flex items-center justify-center rounded-sm",
|
|
265
|
+
id === active
|
|
266
|
+
? "bg-primary/10 text-primary-dark"
|
|
267
|
+
: "text-text-muted hover:bg-surface-alt hover:text-text",
|
|
268
|
+
].join(" ")}
|
|
269
|
+
>
|
|
270
|
+
<Icon size={20} aria-hidden="true" />
|
|
271
|
+
</a>
|
|
272
|
+
))}
|
|
273
|
+
</nav>
|
|
274
|
+
<BottomTabBar apps={apps} active={active} />
|
|
275
|
+
<div className="flex-1 flex flex-col min-w-0">
|
|
276
|
+
<header className="h-16 shrink-0 bg-surface border-b border-border flex items-center justify-between gap-4 px-6">
|
|
277
|
+
<span className="font-display font-bold text-lg uppercase tracking-wide">{activeLabel}</span>
|
|
278
|
+
<UserMenu userUid={userUid} authServerUrl={authServerUrl} onSignOut={handleSignOut} showAdminLink={trusted} showSettingsLink />
|
|
279
|
+
</header>
|
|
280
|
+
<div className="flex-1 flex min-h-0 pb-14 md:pb-0">{children}</div>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
<BrandingFooter branding={branding} />
|
|
284
|
+
</div>
|
|
285
|
+
</ComposeProvider>
|
|
286
|
+
</UnlockPromptProvider>
|
|
287
|
+
);
|
|
288
|
+
}
|