@rapidmx/web-client 0.9.0 → 0.11.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.
Files changed (443) hide show
  1. package/README.md +373 -88
  2. package/apps/admin/_layout.tsx +8 -2
  3. package/apps/admin/index.tsx +7 -1
  4. package/apps/admin/ingest-queue/index.tsx +2 -1
  5. package/apps/admin/mailboxes/[uid].tsx +23 -10
  6. package/apps/admin/quarantine/index.tsx +2 -1
  7. package/apps/admin/signing-certificates/index.tsx +343 -0
  8. package/apps/escrow/_layout.tsx +8 -2
  9. package/apps/shared/appearance/AppearanceForm.tsx +392 -0
  10. package/apps/shared/appearance/AppearanceHead.tsx +49 -0
  11. package/apps/shared/appearance/AppearanceProvider.tsx +470 -0
  12. package/apps/shared/appearance/ColorField.tsx +107 -0
  13. package/apps/shared/appearance/appearanceCache.ts +106 -0
  14. package/apps/shared/appearance/appearanceContext.ts +77 -0
  15. package/apps/shared/appearance/bootScript.ts +35 -0
  16. package/apps/shared/appearance/color.ts +169 -0
  17. package/apps/shared/appearance/photo.ts +88 -0
  18. package/apps/shared/appearance/resolvedTheme.ts +67 -0
  19. package/apps/shared/appearance/theme.ts +355 -0
  20. package/apps/shared/auth/accountUrl.ts +9 -0
  21. package/apps/shared/auth/adminAccess.ts +99 -0
  22. package/apps/shared/components/admin/layout/AdminShell.tsx +22 -10
  23. package/apps/shared/components/admin/mailboxes/ShareAccessCard.tsx +107 -60
  24. package/apps/shared/components/admin/settings/BrandingForm.tsx +24 -0
  25. package/apps/shared/components/admin/settings/DomainDnsSetup.tsx +2 -1
  26. package/apps/shared/components/admin/settings/PluginsManager.tsx +228 -25
  27. package/apps/shared/components/admin/setup/SetupWizard.tsx +2 -1
  28. package/apps/shared/components/calendar/CalendarListSidebar.tsx +4 -5
  29. package/apps/shared/components/calendar/layout/CalendarShell.tsx +8 -2
  30. package/apps/shared/components/contacts/ContactForm.tsx +11 -5
  31. package/apps/shared/components/contacts/ContactsSidebar.tsx +5 -3
  32. package/apps/shared/components/contacts/ContactsToolbar.tsx +98 -115
  33. package/apps/shared/components/contacts/layout/ContactsShell.tsx +25 -8
  34. package/apps/shared/components/escrow/layout/EscrowShell.tsx +13 -6
  35. package/apps/shared/components/layout/AppShell.tsx +477 -288
  36. package/apps/shared/components/layout/BrandingChrome.tsx +200 -13
  37. package/apps/shared/components/layout/KeyEnrollmentGate.tsx +398 -389
  38. package/apps/shared/components/layout/MailboxProvisioning.tsx +168 -164
  39. package/apps/shared/components/layout/RailIcon.tsx +100 -0
  40. package/apps/shared/components/layout/ResponsiveToolbar.tsx +315 -0
  41. package/apps/shared/components/layout/ThemeSwitch.tsx +84 -0
  42. package/apps/shared/components/layout/UserMenu.tsx +372 -185
  43. package/apps/shared/components/mail/ConversationList.tsx +271 -262
  44. package/apps/shared/components/mail/ConversationThreadPane.tsx +147 -94
  45. package/apps/shared/components/mail/LazyReadingPane.tsx +113 -0
  46. package/apps/shared/components/mail/MailSelectionBar.tsx +227 -222
  47. package/apps/shared/components/mail/MessageDetailPane.tsx +1537 -1387
  48. package/apps/shared/components/mail/OutboxBadge.tsx +44 -0
  49. package/apps/shared/components/mail/OutboxRowStatus.tsx +31 -0
  50. package/apps/shared/components/mail/compose/ComposeContext.tsx +312 -160
  51. package/apps/shared/components/mail/compose/ComposeToolbar.tsx +422 -418
  52. package/apps/shared/components/mail/compose/ComposeWindow.tsx +1644 -1736
  53. package/apps/shared/components/mail/compose/ComposeWindowPlaceholder.tsx +111 -0
  54. package/apps/shared/components/mail/compose/RichTextEditor.tsx +147 -118
  55. package/apps/shared/components/mail/compose/composePerf.ts +46 -0
  56. package/apps/shared/components/mail/compose/encryptionRequirement.ts +86 -0
  57. package/apps/shared/components/mail/compose/quotedBody.ts +161 -100
  58. package/apps/shared/components/mail/layout/MailShell.tsx +490 -472
  59. package/apps/shared/components/mail/reading/EncryptedBody.tsx +65 -0
  60. package/apps/shared/components/mail/reading/EncryptedPreview.tsx +35 -0
  61. package/apps/shared/components/mail/reading/MessageBody.tsx +240 -0
  62. package/apps/shared/components/mail/reading/MessageCard.tsx +174 -0
  63. package/apps/shared/components/mail/reading/bodyContent.ts +100 -0
  64. package/apps/shared/components/mail/reading/bodyHtml.ts +298 -0
  65. package/apps/shared/components/mail/reading/color.ts +245 -0
  66. package/apps/shared/components/mail/reading/frameControl.ts +142 -0
  67. package/apps/shared/components/mail/reading/frameDocument.ts +123 -0
  68. package/apps/shared/components/mail/reading/safeDocument.ts +24 -0
  69. package/apps/shared/components/mail/reading/themeAdaptation.ts +221 -0
  70. package/apps/shared/components/mail/reading/themeSurface.ts +90 -0
  71. package/apps/shared/components/mail/reading/viewOriginal.ts +38 -0
  72. package/apps/shared/components/mail/unreadStyle.tsx +75 -0
  73. package/apps/shared/components/settings/SigningCertificateCard.tsx +344 -0
  74. package/apps/shared/components/settings/layout/SettingsShell.tsx +253 -240
  75. package/apps/shared/components/sharing/PrincipalPicker.tsx +145 -0
  76. package/apps/shared/components/tasks/TasksSidebar.tsx +5 -3
  77. package/apps/shared/components/tasks/layout/TasksShell.tsx +24 -8
  78. package/apps/shared/keyboard/GlobalShortcuts.tsx +51 -0
  79. package/apps/shared/keyboard/ShortcutProvider.tsx +62 -0
  80. package/apps/shared/keyboard/ShortcutsDialog.tsx +84 -0
  81. package/apps/shared/keyboard/dispatch.ts +124 -0
  82. package/apps/shared/keyboard/format.ts +89 -0
  83. package/apps/shared/keyboard/keymap.ts +114 -0
  84. package/apps/shared/keyboard/match.ts +44 -0
  85. package/apps/shared/keyboard/parse.ts +136 -0
  86. package/apps/shared/keyboard/platform.ts +34 -0
  87. package/apps/shared/keyboard/registry.ts +65 -0
  88. package/apps/shared/keyboard/targets.ts +79 -0
  89. package/apps/shared/keyboard/useShortcut.ts +50 -0
  90. package/apps/shared/keyboard/useShortcutProps.ts +17 -0
  91. package/apps/shared/mail/folderCounts.ts +308 -0
  92. package/apps/shared/mail/folderTree.ts +143 -0
  93. package/apps/shared/mail/listSnapshots.ts +87 -0
  94. package/apps/shared/mail/messageReadState.ts +85 -0
  95. package/apps/shared/mail/newMailNotifications.ts +183 -0
  96. package/apps/shared/mail/outbox/UnlockBridge.tsx +23 -0
  97. package/apps/shared/mail/outbox/composeBridge.ts +69 -0
  98. package/apps/shared/mail/outbox/outboxState.ts +88 -0
  99. package/apps/shared/mail/outbox/pendingSends.ts +146 -0
  100. package/apps/shared/mail/outbox/sendDecision.ts +157 -0
  101. package/apps/shared/mail/outbox/sendJob.ts +427 -0
  102. package/apps/shared/mail/outbox/sendOutcomes.ts +146 -0
  103. package/apps/shared/mail/outbox/sendState.ts +35 -0
  104. package/apps/shared/mail/outbox/useOutboxStatus.ts +61 -0
  105. package/apps/shared/mail/useMailConnection.ts +203 -0
  106. package/apps/shared/mail/useMailLiveUpdates.ts +277 -224
  107. package/apps/shared/mail/useMarkMessageRead.ts +47 -0
  108. package/apps/shared/mail/useNewMailNotifications.ts +178 -0
  109. package/apps/shared/mail/useUnreadTitle.ts +42 -0
  110. package/apps/shared/navigation/AppRouter.tsx +300 -0
  111. package/apps/shared/navigation/appHrefs.ts +23 -0
  112. package/apps/shared/navigation/frameContext.tsx +35 -0
  113. package/apps/shared/navigation/idle.ts +45 -0
  114. package/apps/shared/navigation/routerContext.tsx +83 -0
  115. package/apps/shared/navigation/routes.ts +72 -0
  116. package/apps/shared/notifications/NotificationCenter.tsx +215 -0
  117. package/apps/shared/notifications/NotificationHistoryDialog.tsx +90 -0
  118. package/apps/shared/notifications/apiErrors.ts +98 -0
  119. package/apps/shared/notifications/headerOffset.ts +35 -0
  120. package/apps/shared/notifications/pushStatus.ts +56 -0
  121. package/apps/shared/notifications/store.ts +549 -0
  122. package/apps/shared/notifications/systemErrors.ts +63 -0
  123. package/apps/shared/notifications/useNotifications.ts +41 -0
  124. package/apps/shared/search/LocalIndexLifecycle.tsx +114 -98
  125. package/apps/shared/signing/enrollmentStorage.ts +33 -0
  126. package/apps/shared/signing/enrollmentTracker.ts +385 -0
  127. package/apps/shared/signing/enrollmentView.ts +251 -0
  128. package/apps/shared/signing/signingInfo.ts +58 -0
  129. package/apps/shared/signing/useNow.ts +19 -0
  130. package/apps/shared/signing/useSigningEnrollmentWatcher.ts +90 -0
  131. package/apps/shared/styles/app.css +108 -10
  132. package/apps/www/_layout.tsx +8 -2
  133. package/apps/www/_routedPage.tsx +24 -0
  134. package/apps/www/_routes.ts +36 -0
  135. package/apps/www/calendar/index.tsx +64 -33
  136. package/apps/www/contacts/[uid].tsx +109 -107
  137. package/apps/www/contacts/index.tsx +62 -42
  138. package/apps/www/index.tsx +2291 -1917
  139. package/apps/www/messages/[uid].tsx +108 -101
  140. package/apps/www/settings/appearance/index.tsx +21 -0
  141. package/apps/www/settings/auto-reply/index.tsx +7 -8
  142. package/apps/www/settings/encryption/index.tsx +1287 -1249
  143. package/apps/www/settings/filters/[uid].tsx +7 -2
  144. package/apps/www/settings/filters/index.tsx +102 -99
  145. package/apps/www/settings/filters/new/index.tsx +140 -133
  146. package/apps/www/settings/labels/index.tsx +204 -201
  147. package/apps/www/settings/privacy/index.tsx +7 -9
  148. package/apps/www/settings/read-receipts/index.tsx +7 -8
  149. package/apps/www/settings/sharing/index.tsx +256 -274
  150. package/apps/www/settings/signatures/[uid].tsx +172 -167
  151. package/apps/www/settings/signatures/index.tsx +88 -85
  152. package/apps/www/settings/signatures/new/index.tsx +135 -129
  153. package/apps/www/tasks/index.tsx +29 -18
  154. package/dist/apps/admin/_layout.d.ts +5 -1
  155. package/dist/apps/admin/_layout.js +3 -2
  156. package/dist/apps/admin/index.js +3 -2
  157. package/dist/apps/admin/ingest-queue/index.js +2 -1
  158. package/dist/apps/admin/mailboxes/[uid].js +9 -6
  159. package/dist/apps/admin/quarantine/index.js +2 -1
  160. package/dist/apps/admin/signing-certificates/index.d.ts +3 -0
  161. package/dist/apps/admin/signing-certificates/index.js +161 -0
  162. package/dist/apps/escrow/_layout.d.ts +5 -1
  163. package/dist/apps/escrow/_layout.js +3 -2
  164. package/dist/apps/shared/appearance/AppearanceForm.d.ts +7 -0
  165. package/dist/apps/shared/appearance/AppearanceForm.js +131 -0
  166. package/dist/apps/shared/appearance/AppearanceHead.d.ts +15 -0
  167. package/dist/apps/shared/appearance/AppearanceHead.js +31 -0
  168. package/dist/apps/shared/appearance/AppearanceProvider.d.ts +32 -0
  169. package/dist/apps/shared/appearance/AppearanceProvider.js +390 -0
  170. package/dist/apps/shared/appearance/ColorField.d.ts +22 -0
  171. package/dist/apps/shared/appearance/ColorField.js +40 -0
  172. package/dist/apps/shared/appearance/appearanceCache.d.ts +45 -0
  173. package/dist/apps/shared/appearance/appearanceCache.js +80 -0
  174. package/dist/apps/shared/appearance/appearanceContext.d.ts +45 -0
  175. package/dist/apps/shared/appearance/appearanceContext.js +29 -0
  176. package/dist/apps/shared/appearance/bootScript.d.ts +16 -0
  177. package/dist/apps/shared/appearance/bootScript.js +33 -0
  178. package/dist/apps/shared/appearance/color.d.ts +65 -0
  179. package/dist/apps/shared/appearance/color.js +132 -0
  180. package/dist/apps/shared/appearance/photo.d.ts +17 -0
  181. package/dist/apps/shared/appearance/photo.js +79 -0
  182. package/dist/apps/shared/appearance/resolvedTheme.d.ts +21 -0
  183. package/dist/apps/shared/appearance/resolvedTheme.js +55 -0
  184. package/dist/apps/shared/appearance/theme.d.ts +111 -0
  185. package/dist/apps/shared/appearance/theme.js +251 -0
  186. package/dist/apps/shared/auth/accountUrl.d.ts +2 -0
  187. package/dist/apps/shared/auth/accountUrl.js +8 -0
  188. package/dist/apps/shared/auth/adminAccess.d.ts +30 -0
  189. package/dist/apps/shared/auth/adminAccess.js +89 -0
  190. package/dist/apps/shared/components/admin/layout/AdminShell.d.ts +1 -1
  191. package/dist/apps/shared/components/admin/layout/AdminShell.js +16 -6
  192. package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.d.ts +10 -5
  193. package/dist/apps/shared/components/admin/mailboxes/ShareAccessCard.js +49 -34
  194. package/dist/apps/shared/components/admin/settings/BrandingForm.d.ts +2 -0
  195. package/dist/apps/shared/components/admin/settings/BrandingForm.js +7 -1
  196. package/dist/apps/shared/components/admin/settings/DomainDnsSetup.js +1 -1
  197. package/dist/apps/shared/components/admin/settings/PluginsManager.js +106 -20
  198. package/dist/apps/shared/components/admin/setup/SetupWizard.js +2 -1
  199. package/dist/apps/shared/components/calendar/CalendarListSidebar.js +8 -8
  200. package/dist/apps/shared/components/calendar/layout/CalendarShell.d.ts +1 -1
  201. package/dist/apps/shared/components/calendar/layout/CalendarShell.js +8 -4
  202. package/dist/apps/shared/components/contacts/ContactForm.js +1 -1
  203. package/dist/apps/shared/components/contacts/ContactsSidebar.js +4 -2
  204. package/dist/apps/shared/components/contacts/ContactsToolbar.d.ts +6 -2
  205. package/dist/apps/shared/components/contacts/ContactsToolbar.js +28 -10
  206. package/dist/apps/shared/components/contacts/layout/ContactsShell.d.ts +1 -1
  207. package/dist/apps/shared/components/contacts/layout/ContactsShell.js +19 -6
  208. package/dist/apps/shared/components/escrow/layout/EscrowShell.js +7 -4
  209. package/dist/apps/shared/components/layout/AppShell.d.ts +34 -4
  210. package/dist/apps/shared/components/layout/AppShell.js +122 -17
  211. package/dist/apps/shared/components/layout/BrandingChrome.d.ts +69 -10
  212. package/dist/apps/shared/components/layout/BrandingChrome.js +140 -12
  213. package/dist/apps/shared/components/layout/KeyEnrollmentGate.js +10 -9
  214. package/dist/apps/shared/components/layout/MailboxProvisioning.js +3 -1
  215. package/dist/apps/shared/components/layout/RailIcon.d.ts +21 -0
  216. package/dist/apps/shared/components/layout/RailIcon.js +85 -0
  217. package/dist/apps/shared/components/layout/ResponsiveToolbar.d.ts +55 -0
  218. package/dist/apps/shared/components/layout/ResponsiveToolbar.js +199 -0
  219. package/dist/apps/shared/components/layout/ThemeSwitch.d.ts +9 -0
  220. package/dist/apps/shared/components/layout/ThemeSwitch.js +54 -0
  221. package/dist/apps/shared/components/layout/UserMenu.d.ts +25 -3
  222. package/dist/apps/shared/components/layout/UserMenu.js +88 -7
  223. package/dist/apps/shared/components/mail/ConversationList.js +5 -11
  224. package/dist/apps/shared/components/mail/ConversationThreadPane.d.ts +6 -2
  225. package/dist/apps/shared/components/mail/ConversationThreadPane.js +87 -40
  226. package/dist/apps/shared/components/mail/LazyReadingPane.d.ts +9 -0
  227. package/dist/apps/shared/components/mail/LazyReadingPane.js +83 -0
  228. package/dist/apps/shared/components/mail/MailSelectionBar.d.ts +6 -4
  229. package/dist/apps/shared/components/mail/MailSelectionBar.js +11 -4
  230. package/dist/apps/shared/components/mail/MessageDetailPane.d.ts +25 -8
  231. package/dist/apps/shared/components/mail/MessageDetailPane.js +167 -73
  232. package/dist/apps/shared/components/mail/OutboxBadge.d.ts +17 -0
  233. package/dist/apps/shared/components/mail/OutboxBadge.js +18 -0
  234. package/dist/apps/shared/components/mail/OutboxRowStatus.d.ts +10 -0
  235. package/dist/apps/shared/components/mail/OutboxRowStatus.js +19 -0
  236. package/dist/apps/shared/components/mail/compose/ComposeContext.d.ts +38 -0
  237. package/dist/apps/shared/components/mail/compose/ComposeContext.js +97 -6
  238. package/dist/apps/shared/components/mail/compose/ComposeToolbar.js +4 -3
  239. package/dist/apps/shared/components/mail/compose/ComposeWindow.d.ts +3 -2
  240. package/dist/apps/shared/components/mail/compose/ComposeWindow.js +316 -339
  241. package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.d.ts +19 -0
  242. package/dist/apps/shared/components/mail/compose/ComposeWindowPlaceholder.js +33 -0
  243. package/dist/apps/shared/components/mail/compose/RichTextEditor.d.ts +9 -1
  244. package/dist/apps/shared/components/mail/compose/RichTextEditor.js +20 -2
  245. package/dist/apps/shared/components/mail/compose/composePerf.d.ts +16 -0
  246. package/dist/apps/shared/components/mail/compose/composePerf.js +41 -0
  247. package/dist/apps/shared/components/mail/compose/encryptionRequirement.d.ts +49 -0
  248. package/dist/apps/shared/components/mail/compose/encryptionRequirement.js +35 -0
  249. package/dist/apps/shared/components/mail/compose/quotedBody.d.ts +13 -0
  250. package/dist/apps/shared/components/mail/compose/quotedBody.js +67 -11
  251. package/dist/apps/shared/components/mail/layout/MailShell.d.ts +14 -4
  252. package/dist/apps/shared/components/mail/layout/MailShell.js +90 -104
  253. package/dist/apps/shared/components/mail/reading/EncryptedBody.d.ts +21 -0
  254. package/dist/apps/shared/components/mail/reading/EncryptedBody.js +22 -0
  255. package/dist/apps/shared/components/mail/reading/EncryptedPreview.d.ts +18 -0
  256. package/dist/apps/shared/components/mail/reading/EncryptedPreview.js +22 -0
  257. package/dist/apps/shared/components/mail/reading/MessageBody.d.ts +32 -0
  258. package/dist/apps/shared/components/mail/reading/MessageBody.js +136 -0
  259. package/dist/apps/shared/components/mail/reading/MessageCard.d.ts +62 -0
  260. package/dist/apps/shared/components/mail/reading/MessageCard.js +58 -0
  261. package/dist/apps/shared/components/mail/reading/bodyContent.d.ts +38 -0
  262. package/dist/apps/shared/components/mail/reading/bodyContent.js +84 -0
  263. package/dist/apps/shared/components/mail/reading/bodyHtml.d.ts +47 -0
  264. package/dist/apps/shared/components/mail/reading/bodyHtml.js +267 -0
  265. package/dist/apps/shared/components/mail/reading/color.d.ts +63 -0
  266. package/dist/apps/shared/components/mail/reading/color.js +201 -0
  267. package/dist/apps/shared/components/mail/reading/frameControl.d.ts +33 -0
  268. package/dist/apps/shared/components/mail/reading/frameControl.js +120 -0
  269. package/dist/apps/shared/components/mail/reading/frameDocument.d.ts +52 -0
  270. package/dist/apps/shared/components/mail/reading/frameDocument.js +98 -0
  271. package/dist/apps/shared/components/mail/reading/safeDocument.d.ts +3 -0
  272. package/dist/apps/shared/components/mail/reading/safeDocument.js +12 -0
  273. package/dist/apps/shared/components/mail/reading/themeAdaptation.d.ts +56 -0
  274. package/dist/apps/shared/components/mail/reading/themeAdaptation.js +144 -0
  275. package/dist/apps/shared/components/mail/reading/themeSurface.d.ts +17 -0
  276. package/dist/apps/shared/components/mail/reading/themeSurface.js +83 -0
  277. package/dist/apps/shared/components/mail/reading/viewOriginal.d.ts +9 -0
  278. package/dist/apps/shared/components/mail/reading/viewOriginal.js +32 -0
  279. package/dist/apps/shared/components/mail/unreadStyle.d.ts +45 -0
  280. package/dist/apps/shared/components/mail/unreadStyle.js +61 -0
  281. package/dist/apps/shared/components/settings/SigningCertificateCard.d.ts +32 -0
  282. package/dist/apps/shared/components/settings/SigningCertificateCard.js +98 -0
  283. package/dist/apps/shared/components/settings/layout/SettingsShell.d.ts +1 -1
  284. package/dist/apps/shared/components/settings/layout/SettingsShell.js +16 -5
  285. package/dist/apps/shared/components/sharing/PrincipalPicker.d.ts +26 -0
  286. package/dist/apps/shared/components/sharing/PrincipalPicker.js +77 -0
  287. package/dist/apps/shared/components/tasks/TasksSidebar.js +4 -2
  288. package/dist/apps/shared/components/tasks/layout/TasksShell.d.ts +1 -1
  289. package/dist/apps/shared/components/tasks/layout/TasksShell.js +18 -6
  290. package/dist/apps/shared/keyboard/GlobalShortcuts.d.ts +14 -0
  291. package/dist/apps/shared/keyboard/GlobalShortcuts.js +37 -0
  292. package/dist/apps/shared/keyboard/ShortcutProvider.d.ts +20 -0
  293. package/dist/apps/shared/keyboard/ShortcutProvider.js +52 -0
  294. package/dist/apps/shared/keyboard/ShortcutsDialog.d.ts +14 -0
  295. package/dist/apps/shared/keyboard/ShortcutsDialog.js +42 -0
  296. package/dist/apps/shared/keyboard/dispatch.d.ts +16 -0
  297. package/dist/apps/shared/keyboard/dispatch.js +109 -0
  298. package/dist/apps/shared/keyboard/format.d.ts +12 -0
  299. package/dist/apps/shared/keyboard/format.js +74 -0
  300. package/dist/apps/shared/keyboard/keymap.d.ts +294 -0
  301. package/dist/apps/shared/keyboard/keymap.js +84 -0
  302. package/dist/apps/shared/keyboard/match.d.ts +20 -0
  303. package/dist/apps/shared/keyboard/match.js +31 -0
  304. package/dist/apps/shared/keyboard/parse.d.ts +31 -0
  305. package/dist/apps/shared/keyboard/parse.js +107 -0
  306. package/dist/apps/shared/keyboard/platform.d.ts +15 -0
  307. package/dist/apps/shared/keyboard/platform.js +22 -0
  308. package/dist/apps/shared/keyboard/registry.d.ts +39 -0
  309. package/dist/apps/shared/keyboard/registry.js +33 -0
  310. package/dist/apps/shared/keyboard/targets.d.ts +14 -0
  311. package/dist/apps/shared/keyboard/targets.js +67 -0
  312. package/dist/apps/shared/keyboard/useShortcut.d.ts +19 -0
  313. package/dist/apps/shared/keyboard/useShortcut.js +35 -0
  314. package/dist/apps/shared/keyboard/useShortcutProps.d.ts +10 -0
  315. package/dist/apps/shared/keyboard/useShortcutProps.js +15 -0
  316. package/dist/apps/shared/mail/folderCounts.d.ts +78 -0
  317. package/dist/apps/shared/mail/folderCounts.js +218 -0
  318. package/dist/apps/shared/mail/folderTree.d.ts +55 -0
  319. package/dist/apps/shared/mail/folderTree.js +116 -0
  320. package/dist/apps/shared/mail/listSnapshots.d.ts +46 -0
  321. package/dist/apps/shared/mail/listSnapshots.js +43 -0
  322. package/dist/apps/shared/mail/messageReadState.d.ts +32 -0
  323. package/dist/apps/shared/mail/messageReadState.js +63 -0
  324. package/dist/apps/shared/mail/newMailNotifications.d.ts +62 -0
  325. package/dist/apps/shared/mail/newMailNotifications.js +138 -0
  326. package/dist/apps/shared/mail/outbox/UnlockBridge.d.ts +5 -0
  327. package/dist/apps/shared/mail/outbox/UnlockBridge.js +18 -0
  328. package/dist/apps/shared/mail/outbox/composeBridge.d.ts +34 -0
  329. package/dist/apps/shared/mail/outbox/composeBridge.js +32 -0
  330. package/dist/apps/shared/mail/outbox/outboxState.d.ts +41 -0
  331. package/dist/apps/shared/mail/outbox/outboxState.js +42 -0
  332. package/dist/apps/shared/mail/outbox/pendingSends.d.ts +39 -0
  333. package/dist/apps/shared/mail/outbox/pendingSends.js +109 -0
  334. package/dist/apps/shared/mail/outbox/sendDecision.d.ts +80 -0
  335. package/dist/apps/shared/mail/outbox/sendDecision.js +94 -0
  336. package/dist/apps/shared/mail/outbox/sendJob.d.ts +68 -0
  337. package/dist/apps/shared/mail/outbox/sendJob.js +319 -0
  338. package/dist/apps/shared/mail/outbox/sendOutcomes.d.ts +3 -0
  339. package/dist/apps/shared/mail/outbox/sendOutcomes.js +141 -0
  340. package/dist/apps/shared/mail/outbox/sendState.d.ts +25 -0
  341. package/dist/apps/shared/mail/outbox/sendState.js +8 -0
  342. package/dist/apps/shared/mail/outbox/useOutboxStatus.d.ts +11 -0
  343. package/dist/apps/shared/mail/outbox/useOutboxStatus.js +49 -0
  344. package/dist/apps/shared/mail/useMailConnection.d.ts +56 -0
  345. package/dist/apps/shared/mail/useMailConnection.js +138 -0
  346. package/dist/apps/shared/mail/useMailLiveUpdates.d.ts +29 -9
  347. package/dist/apps/shared/mail/useMailLiveUpdates.js +60 -32
  348. package/dist/apps/shared/mail/useMarkMessageRead.d.ts +12 -0
  349. package/dist/apps/shared/mail/useMarkMessageRead.js +44 -0
  350. package/dist/apps/shared/mail/useNewMailNotifications.d.ts +35 -0
  351. package/dist/apps/shared/mail/useNewMailNotifications.js +130 -0
  352. package/dist/apps/shared/mail/useUnreadTitle.d.ts +18 -0
  353. package/dist/apps/shared/mail/useUnreadTitle.js +31 -0
  354. package/dist/apps/shared/navigation/AppRouter.d.ts +52 -0
  355. package/dist/apps/shared/navigation/AppRouter.js +242 -0
  356. package/dist/apps/shared/navigation/appHrefs.d.ts +14 -0
  357. package/dist/apps/shared/navigation/appHrefs.js +20 -0
  358. package/dist/apps/shared/navigation/frameContext.d.ts +19 -0
  359. package/dist/apps/shared/navigation/frameContext.js +24 -0
  360. package/dist/apps/shared/navigation/idle.d.ts +14 -0
  361. package/dist/apps/shared/navigation/idle.js +43 -0
  362. package/dist/apps/shared/navigation/routerContext.d.ts +37 -0
  363. package/dist/apps/shared/navigation/routerContext.js +56 -0
  364. package/dist/apps/shared/navigation/routes.d.ts +32 -0
  365. package/dist/apps/shared/navigation/routes.js +37 -0
  366. package/dist/apps/shared/notifications/NotificationCenter.d.ts +19 -0
  367. package/dist/apps/shared/notifications/NotificationCenter.js +90 -0
  368. package/dist/apps/shared/notifications/NotificationHistoryDialog.d.ts +10 -0
  369. package/dist/apps/shared/notifications/NotificationHistoryDialog.js +36 -0
  370. package/dist/apps/shared/notifications/apiErrors.d.ts +19 -0
  371. package/dist/apps/shared/notifications/apiErrors.js +86 -0
  372. package/dist/apps/shared/notifications/headerOffset.d.ts +8 -0
  373. package/dist/apps/shared/notifications/headerOffset.js +33 -0
  374. package/dist/apps/shared/notifications/pushStatus.d.ts +9 -0
  375. package/dist/apps/shared/notifications/pushStatus.js +54 -0
  376. package/dist/apps/shared/notifications/store.d.ts +136 -0
  377. package/dist/apps/shared/notifications/store.js +416 -0
  378. package/dist/apps/shared/notifications/systemErrors.d.ts +9 -0
  379. package/dist/apps/shared/notifications/systemErrors.js +58 -0
  380. package/dist/apps/shared/notifications/useNotifications.d.ts +17 -0
  381. package/dist/apps/shared/notifications/useNotifications.js +18 -0
  382. package/dist/apps/shared/search/LocalIndexLifecycle.js +17 -3
  383. package/dist/apps/shared/signing/enrollmentStorage.d.ts +10 -0
  384. package/dist/apps/shared/signing/enrollmentStorage.js +33 -0
  385. package/dist/apps/shared/signing/enrollmentTracker.d.ts +73 -0
  386. package/dist/apps/shared/signing/enrollmentTracker.js +307 -0
  387. package/dist/apps/shared/signing/enrollmentView.d.ts +57 -0
  388. package/dist/apps/shared/signing/enrollmentView.js +214 -0
  389. package/dist/apps/shared/signing/signingInfo.d.ts +11 -0
  390. package/dist/apps/shared/signing/signingInfo.js +48 -0
  391. package/dist/apps/shared/signing/useNow.d.ts +2 -0
  392. package/dist/apps/shared/signing/useNow.js +18 -0
  393. package/dist/apps/shared/signing/useSigningEnrollmentWatcher.d.ts +16 -0
  394. package/dist/apps/shared/signing/useSigningEnrollmentWatcher.js +87 -0
  395. package/dist/apps/shared/styles/app.css +108 -10
  396. package/dist/apps/www/_layout.d.ts +5 -1
  397. package/dist/apps/www/_layout.js +3 -2
  398. package/dist/apps/www/_routedPage.d.ts +12 -0
  399. package/dist/apps/www/_routedPage.js +19 -0
  400. package/dist/apps/www/_routes.d.ts +11 -0
  401. package/dist/apps/www/_routes.js +30 -0
  402. package/dist/apps/www/calendar/index.d.ts +2 -2
  403. package/dist/apps/www/calendar/index.js +41 -11
  404. package/dist/apps/www/contacts/[uid].d.ts +3 -9
  405. package/dist/apps/www/contacts/[uid].js +11 -9
  406. package/dist/apps/www/contacts/index.d.ts +2 -2
  407. package/dist/apps/www/contacts/index.js +30 -24
  408. package/dist/apps/www/index.d.ts +2 -2
  409. package/dist/apps/www/index.js +332 -48
  410. package/dist/apps/www/messages/[uid].d.ts +3 -7
  411. package/dist/apps/www/messages/[uid].js +10 -5
  412. package/dist/apps/www/settings/appearance/index.d.ts +4 -0
  413. package/dist/apps/www/settings/appearance/index.js +13 -0
  414. package/dist/apps/www/settings/auto-reply/index.d.ts +2 -2
  415. package/dist/apps/www/settings/auto-reply/index.js +6 -7
  416. package/dist/apps/www/settings/encryption/index.d.ts +2 -2
  417. package/dist/apps/www/settings/encryption/index.js +106 -96
  418. package/dist/apps/www/settings/filters/[uid].d.ts +2 -2
  419. package/dist/apps/www/settings/filters/[uid].js +6 -2
  420. package/dist/apps/www/settings/filters/index.d.ts +2 -2
  421. package/dist/apps/www/settings/filters/index.js +3 -1
  422. package/dist/apps/www/settings/filters/new/index.d.ts +2 -2
  423. package/dist/apps/www/settings/filters/new/index.js +9 -3
  424. package/dist/apps/www/settings/labels/index.d.ts +2 -2
  425. package/dist/apps/www/settings/labels/index.js +3 -1
  426. package/dist/apps/www/settings/privacy/index.d.ts +2 -2
  427. package/dist/apps/www/settings/privacy/index.js +8 -9
  428. package/dist/apps/www/settings/read-receipts/index.d.ts +2 -2
  429. package/dist/apps/www/settings/read-receipts/index.js +6 -7
  430. package/dist/apps/www/settings/sharing/index.d.ts +2 -2
  431. package/dist/apps/www/settings/sharing/index.js +22 -34
  432. package/dist/apps/www/settings/signatures/[uid].d.ts +2 -2
  433. package/dist/apps/www/settings/signatures/[uid].js +6 -2
  434. package/dist/apps/www/settings/signatures/index.d.ts +2 -2
  435. package/dist/apps/www/settings/signatures/index.js +3 -1
  436. package/dist/apps/www/settings/signatures/new/index.d.ts +2 -2
  437. package/dist/apps/www/settings/signatures/new/index.js +9 -4
  438. package/dist/apps/www/tasks/index.d.ts +2 -2
  439. package/dist/apps/www/tasks/index.js +22 -16
  440. package/package.json +2 -2
  441. package/apps/shared/components/mail/compose/SendFailureAlert.tsx +0 -48
  442. package/dist/apps/shared/components/mail/compose/SendFailureAlert.d.ts +0 -14
  443. package/dist/apps/shared/components/mail/compose/SendFailureAlert.js +0 -11
@@ -0,0 +1,111 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ import React, { useEffect } from "react";
6
+ import { HiOutlineMinus, HiOutlineXMark } from "react-icons/hi2";
7
+ import Skeleton from "@rapidmx/react-shared/components/feedback/Skeleton.js";
8
+ import Alert from "@rapidmx/react-shared/components/feedback/Alert.js";
9
+ import Button from "@rapidmx/react-shared/components/buttons/Button.js";
10
+ import useIsMobile from "@rapidmx/react-shared/util/useIsMobile.js";
11
+ import type { ComposeSession } from "./ComposeContext.js";
12
+ import { markComposePhase } from "./composePerf.js";
13
+
14
+ export interface ComposeWindowPlaceholderProps {
15
+ session: ComposeSession;
16
+ /** The compose window's code couldn't be downloaded. */
17
+ failed: boolean;
18
+ onRetry: () => void;
19
+ onClose: () => void;
20
+ onToggleMinimize: () => void;
21
+ }
22
+
23
+ /**
24
+ * What stands in for the compose window in the moment between clicking Compose/Reply/Forward and the window's code being
25
+ * loaded (already there when it was prefetched, so usually not seen at all): the window's own frame at its own size and
26
+ * place, its title and the recipients and subject the window will open with, all of which are known without the network -
27
+ * so the click is answered on the same frame. It is deliberately tiny and lives in the page's own chunk.
28
+ *
29
+ * Nothing here can be typed into yet, and there is no draft to save or discard, so Close just closes.
30
+ */
31
+ export default function ComposeWindowPlaceholder({ session, failed, onRetry, onClose, onToggleMinimize }: ComposeWindowPlaceholderProps) {
32
+ const isMobile = useIsMobile();
33
+ const title = session.initialSubject?.trim() || "New Message";
34
+ const titleId = `compose-title-${session.id}`;
35
+
36
+ useEffect(() => markComposePhase(session.id, "shell"), [session.id]);
37
+
38
+ if (session.minimized) {
39
+ return (
40
+ <div role="dialog" aria-label={title} className="w-64 shrink-0 bg-surface border border-border border-b-0 rounded-t-md shadow-modal">
41
+ <div className="h-10 flex items-center justify-between gap-2 px-3 rounded-t-md bg-primary-darker text-white cursor-pointer" onClick={onToggleMinimize}>
42
+ <span className="text-sm font-medium truncate">{title}</span>
43
+ </div>
44
+ </div>
45
+ );
46
+ }
47
+
48
+ return (
49
+ <div
50
+ role="dialog"
51
+ aria-labelledby={titleId}
52
+ aria-busy={!failed}
53
+ className={[
54
+ "relative shrink-0 flex flex-col bg-surface border border-border shadow-modal overflow-hidden",
55
+ isMobile ? "fixed inset-0 w-full h-full rounded-none border-0" : "border-b-0 rounded-t-md w-[480px] h-[520px]",
56
+ ].join(" ")}
57
+ >
58
+ <div className="h-10 shrink-0 flex items-center justify-between gap-2 px-3 bg-primary-darker text-white cursor-pointer" onClick={onToggleMinimize}>
59
+ <span id={titleId} className="text-sm font-medium truncate">
60
+ {title}
61
+ </span>
62
+ <div className="flex items-center gap-0.5" onClick={(e) => e.stopPropagation()}>
63
+ <button
64
+ type="button"
65
+ aria-label="Minimize"
66
+ title="Minimize"
67
+ onClick={onToggleMinimize}
68
+ className="w-6 h-6 flex items-center justify-center rounded-sm text-white/80 hover:bg-white/15 hover:text-white"
69
+ >
70
+ <HiOutlineMinus size={14} />
71
+ </button>
72
+ <button
73
+ type="button"
74
+ aria-label="Close"
75
+ title="Close"
76
+ onClick={onClose}
77
+ className="w-6 h-6 flex items-center justify-center rounded-sm text-white/80 hover:bg-white/15 hover:text-white"
78
+ >
79
+ <HiOutlineXMark size={14} />
80
+ </button>
81
+ </div>
82
+ </div>
83
+ {failed ? (
84
+ <div className="px-3 pt-2">
85
+ <Alert>
86
+ <p className="mb-2">The compose window couldn&rsquo;t be loaded. Check your connection and try again.</p>
87
+ <Button type="button" variant="secondary" className="!w-auto" onClick={onRetry}>
88
+ Retry
89
+ </Button>
90
+ </Alert>
91
+ </div>
92
+ ) : (
93
+ <div role="status" className="flex-1 min-h-0 flex flex-col">
94
+ <span className="sr-only">Opening the compose window</span>
95
+ <div className="flex items-center gap-2 px-3 py-1.5 border-b border-border text-sm">
96
+ <span className="text-text-muted">To</span>
97
+ <span className="truncate">{session.initialTo}</span>
98
+ </div>
99
+ <div className="flex items-center gap-2 px-3 py-1.5 border-b border-border text-sm">
100
+ <span className="truncate">{session.initialSubject || <span className="text-text-muted">Subject</span>}</span>
101
+ </div>
102
+ <div className="flex-1 p-3 flex flex-col gap-2" aria-hidden="true">
103
+ <Skeleton height="h-4" />
104
+ <Skeleton height="h-4" />
105
+ <Skeleton height="h-4" />
106
+ </div>
107
+ </div>
108
+ )}
109
+ </div>
110
+ );
111
+ }
@@ -1,118 +1,147 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2026 Jean-Philippe Steinmetz
3
- // SPDX-License-Identifier: MPL-2.0
4
- ///////////////////////////////////////////////////////////////////////////////
5
- import React, { useRef, useState } from "react";
6
- import { EditorContent, useEditor } from "@tiptap/react";
7
- import StarterKit from "@tiptap/starter-kit";
8
- import { TextStyleKit } from "@tiptap/extension-text-style";
9
- import TextAlign from "@tiptap/extension-text-align";
10
- import Highlight from "@tiptap/extension-highlight";
11
- import Image from "@tiptap/extension-image";
12
- import { TableKit } from "@tiptap/extension-table";
13
- import Placeholder from "@tiptap/extension-placeholder";
14
- import ComposeToolbar from "./ComposeToolbar.js";
15
-
16
- export interface RichTextEditorProps {
17
- value: string;
18
- onChange: (value: string) => void;
19
- height?: string;
20
- /** When true, the editor fills its parent's height via flexbox instead of a fixed `height` — for
21
- * embedding inside a flex-column container of variable height (the floating Compose window) where
22
- * a literal pixel height can't be computed up front. `height` is ignored when this is set. */
23
- fill?: boolean;
24
- /** Passed straight through to `ComposeToolbar` — see its own doc comment on this prop. */
25
- onUploadImage: (file: File) => Promise<string | null>;
26
- /** Focuses the editor with the caret at the very start of the document once it mounts - a reply or forward, whose
27
- * body starts with an empty paragraph above the signature and quote, so typing goes above them. Only read when
28
- * the editor is created. */
29
- autoFocusStart?: boolean;
30
- /** Called once the editor is ready, with `value` as the editor itself serializes it: TipTap drops what its schema
31
- * doesn't hold (e.g. a blockquote's `style`) and adds an empty paragraph after a trailing non-paragraph node (a
32
- * quote). That normalization happens on the editor's first transaction - even one that only moves the caret -
33
- * and isn't reported through `onChange`, so a caller can compare later edits against this instead of `value`. */
34
- onInitialized?: (value: string) => void;
35
- }
36
-
37
- /**
38
- * A WYSIWYG rich-text editor for the Compose window's message body — replaces `MonacoHtmlEditor` (an HTML
39
- * *source* editor) with a real Outlook-Home-tab-style formatting experience, built on TipTap/ProseMirror.
40
- * Used by `ComposeWindow` (the floating overlay, not a dedicated page — see `ComposeContext.tsx`'s doc
41
- * comment).
42
- *
43
- * `value` seeds the editor's initial content only — like `MonacoHtmlEditor`, this never re-syncs from a
44
- * later `value` prop change; TipTap owns its own document once created. Live edits flow out as HTML (via
45
- * `editor.getHTML()`) through `onChange`.
46
- *
47
- * `immediatelyRender: false` is required for this framework's SSR: the page embedding `ComposeWindow` is
48
- * rendered server-side under plain Node before hydration (see `ReactRoute`), and TipTap's default
49
- * (`immediatelyRender: true`) tries to mount its ProseMirror view during that very first render, which
50
- * both can't work without a real DOM and produces a hydration mismatch. With it `false`, `useEditor`
51
- * returns `null` until the editor actually mounts client-side after hydration — `ComposeToolbar`/
52
- * `EditorContent` both already handle a `null` editor by rendering their disabled/empty state, so this
53
- * needs no extra loading-placeholder logic here. Unlike `MonacoHtmlEditor`, no dynamic `import()` is
54
- * needed to defer loading TipTap's modules off the SSR path — `immediatelyRender: false` alone is
55
- * sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
56
- * an editor view actually mounts.
57
- */
58
- export default function RichTextEditor({
59
- value,
60
- onChange,
61
- height = "360px",
62
- fill = false,
63
- onUploadImage,
64
- autoFocusStart = false,
65
- onInitialized,
66
- }: RichTextEditorProps) {
67
- const onChangeRef = useRef(onChange);
68
- onChangeRef.current = onChange;
69
- const onInitializedRef = useRef(onInitialized);
70
- onInitializedRef.current = onInitialized;
71
- // Transactions before `create` (the autofocus, and the normalizing one below) aren't edits.
72
- const initializedRef = useRef(false);
73
- // Held for this editor's lifetime: TipTap focuses a tick after creating the editor, and a re-render passing a
74
- // different value in between would replace the option (via `setOptions`) before it's read.
75
- const [autofocus] = useState<"start" | false>(autoFocusStart ? "start" : false);
76
-
77
- const editor = useEditor({
78
- extensions: [
79
- StarterKit.configure({ link: { openOnClick: false } }),
80
- TextStyleKit.configure({ backgroundColor: false, lineHeight: false }),
81
- TextAlign.configure({ types: ["heading", "paragraph"] }),
82
- Highlight,
83
- Image,
84
- TableKit.configure({ table: { resizable: true } }),
85
- Placeholder.configure({ placeholder: "Write your message…" }),
86
- ],
87
- content: value,
88
- autofocus,
89
- immediatelyRender: false,
90
- onCreate: ({ editor: created }) => {
91
- // An empty transaction runs the schema's append-transaction normalization now, before any edit.
92
- created.view.dispatch(created.state.tr);
93
- initializedRef.current = true;
94
- onInitializedRef.current?.(created.getHTML());
95
- },
96
- onUpdate: ({ editor: updated }) => {
97
- if (initializedRef.current) {
98
- onChangeRef.current(updated.getHTML());
99
- }
100
- },
101
- });
102
-
103
- return (
104
- <div className={["border border-border rounded-sm overflow-hidden", fill ? "h-full flex flex-col" : ""].filter(Boolean).join(" ")}>
105
- <ComposeToolbar editor={editor} onUploadImage={onUploadImage} />
106
- <EditorContent
107
- editor={editor}
108
- style={fill ? undefined : { height }}
109
- className={[
110
- "overflow-y-auto px-3 py-2 text-sm [&_.tiptap]:outline-none [&_.tiptap]:h-full",
111
- fill ? "flex-1 min-h-0" : "",
112
- ]
113
- .filter(Boolean)
114
- .join(" ")}
115
- />
116
- </div>
117
- );
118
- }
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ import React, { useEffect, useRef, useState } from "react";
6
+ import { EditorContent, useEditor } from "@tiptap/react";
7
+ import StarterKit from "@tiptap/starter-kit";
8
+ import { TextStyleKit } from "@tiptap/extension-text-style";
9
+ import TextAlign from "@tiptap/extension-text-align";
10
+ import Highlight from "@tiptap/extension-highlight";
11
+ import Image from "@tiptap/extension-image";
12
+ import { TableKit } from "@tiptap/extension-table";
13
+ import Placeholder from "@tiptap/extension-placeholder";
14
+ import ComposeToolbar from "./ComposeToolbar.js";
15
+
16
+ export interface RichTextEditorProps {
17
+ value: string;
18
+ onChange: (value: string) => void;
19
+ height?: string;
20
+ /** When true, the editor fills its parent's height via flexbox instead of a fixed `height` — for
21
+ * embedding inside a flex-column container of variable height (the floating Compose window) where
22
+ * a literal pixel height can't be computed up front. `height` is ignored when this is set. */
23
+ fill?: boolean;
24
+ /** Passed straight through to `ComposeToolbar` — see its own doc comment on this prop. */
25
+ onUploadImage: (file: File) => Promise<string | null>;
26
+ /** Focuses the editor with the caret at the very start of the document once it mounts - a reply or forward, whose
27
+ * body starts with an empty paragraph above the signature and quote, so typing goes above them. Only read when
28
+ * the editor is created. */
29
+ autoFocusStart?: boolean;
30
+ /** Called once the editor is ready, with `value` as the editor itself serializes it: TipTap drops what its schema
31
+ * doesn't hold (e.g. a blockquote's `style`) and adds an empty paragraph after a trailing non-paragraph node (a
32
+ * quote). That normalization happens on the editor's first transaction - even one that only moves the caret -
33
+ * and isn't reported through `onChange`, so a caller can compare later edits against this instead of `value`. */
34
+ onInitialized?: (value: string) => void;
35
+ /**
36
+ * HTML to add at the end of the document, once, as soon as there is some (it may be undefined when the editor is created and
37
+ * defined later). A reply opens its editor before the quoted original has been fetched and hands the quote in through this when
38
+ * it arrives - so whatever has been typed above stays, and the quote lands where it always did, under the signature.
39
+ */
40
+ appendHtml?: string;
41
+ /** Called with the document as the editor serializes it, right after `appendHtml` was added. */
42
+ onAppended?: (value: string) => void;
43
+ }
44
+
45
+ /**
46
+ * A WYSIWYG rich-text editor for the Compose window's message body — replaces `MonacoHtmlEditor` (an HTML
47
+ * *source* editor) with a real Outlook-Home-tab-style formatting experience, built on TipTap/ProseMirror.
48
+ * Used by `ComposeWindow` (the floating overlay, not a dedicated page — see `ComposeContext.tsx`'s doc
49
+ * comment).
50
+ *
51
+ * `value` seeds the editor's initial content only — like `MonacoHtmlEditor`, this never re-syncs from a
52
+ * later `value` prop change; TipTap owns its own document once created. Live edits flow out as HTML (via
53
+ * `editor.getHTML()`) through `onChange`.
54
+ *
55
+ * `immediatelyRender: false` is required for this framework's SSR: the page embedding `ComposeWindow` is
56
+ * rendered server-side under plain Node before hydration (see `ReactRoute`), and TipTap's default
57
+ * (`immediatelyRender: true`) tries to mount its ProseMirror view during that very first render, which
58
+ * both can't work without a real DOM and produces a hydration mismatch. With it `false`, `useEditor`
59
+ * returns `null` until the editor actually mounts client-side after hydration — `ComposeToolbar`/
60
+ * `EditorContent` both already handle a `null` editor by rendering their disabled/empty state, so this
61
+ * needs no extra loading-placeholder logic here. Unlike `MonacoHtmlEditor`, no dynamic `import()` is
62
+ * needed to defer loading TipTap's modules off the SSR path — `immediatelyRender: false` alone is
63
+ * sufficient here since TipTap (unlike Monaco) never touches the DOM at module-evaluation time, only when
64
+ * an editor view actually mounts.
65
+ */
66
+ export default function RichTextEditor({
67
+ value,
68
+ onChange,
69
+ height = "360px",
70
+ fill = false,
71
+ onUploadImage,
72
+ autoFocusStart = false,
73
+ onInitialized,
74
+ appendHtml,
75
+ onAppended,
76
+ }: RichTextEditorProps) {
77
+ const onChangeRef = useRef(onChange);
78
+ onChangeRef.current = onChange;
79
+ const onInitializedRef = useRef(onInitialized);
80
+ onInitializedRef.current = onInitialized;
81
+ const onAppendedRef = useRef(onAppended);
82
+ onAppendedRef.current = onAppended;
83
+ const appendedRef = useRef<string | undefined>(undefined);
84
+ // Transactions before `create` (the autofocus, and the normalizing one below) aren't edits.
85
+ const initializedRef = useRef(false);
86
+ // Held for this editor's lifetime: TipTap focuses a tick after creating the editor, and a re-render passing a
87
+ // different value in between would replace the option (via `setOptions`) before it's read.
88
+ const [autofocus] = useState<"start" | false>(autoFocusStart ? "start" : false);
89
+
90
+ const editor = useEditor({
91
+ extensions: [
92
+ StarterKit.configure({ link: { openOnClick: false } }),
93
+ TextStyleKit.configure({ backgroundColor: false, lineHeight: false }),
94
+ TextAlign.configure({ types: ["heading", "paragraph"] }),
95
+ Highlight,
96
+ Image,
97
+ TableKit.configure({ table: { resizable: true } }),
98
+ Placeholder.configure({ placeholder: "Write your message…" }),
99
+ ],
100
+ content: value,
101
+ autofocus,
102
+ immediatelyRender: false,
103
+ editorProps: {
104
+ // Ctrl/Cmd+Enter is the compose window's Send. TipTap binds it to a hard break, and a key it handles never reaches the
105
+ // window's shortcut (which skips what a widget already took), so it inserted a line break and sent nothing. Returning true here
106
+ // stops ProseMirror handling it without preventing the event, which goes on to the shortcut. Shift+Enter is still the hard break.
107
+ handleDOMEvents: { keydown: (_view, event) => event.key === "Enter" && (event.ctrlKey || event.metaKey) },
108
+ },
109
+ onCreate: ({ editor: created }) => {
110
+ // An empty transaction runs the schema's append-transaction normalization now, before any edit.
111
+ created.view.dispatch(created.state.tr);
112
+ initializedRef.current = true;
113
+ onInitializedRef.current?.(created.getHTML());
114
+ },
115
+ onUpdate: ({ editor: updated }) => {
116
+ if (initializedRef.current) {
117
+ onChangeRef.current(updated.getHTML());
118
+ }
119
+ },
120
+ });
121
+
122
+ // Added once, at the end, whatever the reader has typed meanwhile (the caret stays where it is).
123
+ useEffect(() => {
124
+ if (!editor || appendHtml === undefined || appendedRef.current === appendHtml) {
125
+ return;
126
+ }
127
+ appendedRef.current = appendHtml;
128
+ editor.commands.insertContentAt(editor.state.doc.content.size, appendHtml);
129
+ onAppendedRef.current?.(editor.getHTML());
130
+ }, [editor, appendHtml]);
131
+
132
+ return (
133
+ <div className={["border border-border rounded-sm overflow-hidden", fill ? "h-full flex flex-col" : ""].filter(Boolean).join(" ")}>
134
+ <ComposeToolbar editor={editor} onUploadImage={onUploadImage} />
135
+ <EditorContent
136
+ editor={editor}
137
+ style={fill ? undefined : { height }}
138
+ className={[
139
+ "overflow-y-auto px-3 py-2 text-sm [&_.tiptap]:outline-none [&_.tiptap]:h-full",
140
+ fill ? "flex-1 min-h-0" : "",
141
+ ]
142
+ .filter(Boolean)
143
+ .join(" ")}
144
+ />
145
+ </div>
146
+ );
147
+ }
@@ -0,0 +1,46 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ /**
6
+ * `performance.mark()`/`measure()` around the phases between clicking Compose/Reply/Forward and the window being usable,
7
+ * for the browser's Performance panel (or `performance.getEntriesByType("measure")`). Marks are named
8
+ * `compose:<window id>:<phase>`; the measures are named `compose:<from>-><to>` and carry the window id in `detail`.
9
+ *
10
+ * Phases, in order: `click` (the handler ran), `shell` (the window's frame is on screen - the placeholder, or the real
11
+ * window once its chunk has loaded), `chunk` (the window's code has loaded and rendered), `body` (the seeded body -
12
+ * signature and quoted original - is ready), `editor` (the editor has mounted and can be typed into), `draft` (the server
13
+ * draft exists).
14
+ *
15
+ * On in development builds, and in a production build when `window.__RAPIDMX_PERF__` is set to `true` (from the console:
16
+ * `window.__RAPIDMX_PERF__ = true`). Off otherwise, when each call is a no-op.
17
+ */
18
+
19
+ export type ComposePhase = "click" | "shell" | "chunk" | "body" | "editor" | "draft";
20
+
21
+ function enabled(): boolean {
22
+ if (typeof performance === "undefined" || typeof performance.mark !== "function") {
23
+ return false;
24
+ }
25
+ return import.meta.env?.DEV === true || (globalThis as { __RAPIDMX_PERF__?: boolean }).__RAPIDMX_PERF__ === true;
26
+ }
27
+
28
+ /** The compose sessions a `click` mark was made for, so the first mark of each phase is the only one that counts. */
29
+ const marked = new Set<string>();
30
+
31
+ /** Marks `phase` of window `id` once (later calls for the same phase are ignored), and measures it from `click`. */
32
+ export function markComposePhase(id: string, phase: ComposePhase): void {
33
+ if (!enabled()) {
34
+ return;
35
+ }
36
+ const key = `compose:${id}:${phase}`;
37
+ if (marked.has(key)) {
38
+ return;
39
+ }
40
+ marked.add(key);
41
+ performance.mark(key);
42
+ const start = `compose:${id}:click`;
43
+ if (phase !== "click" && marked.has(start)) {
44
+ performance.measure(`compose:click->${phase}`, { start, end: key, detail: { id } });
45
+ }
46
+ }
@@ -0,0 +1,86 @@
1
+ ///////////////////////////////////////////////////////////////////////////////
2
+ // Copyright (C) 2026 Jean-Philippe Steinmetz
3
+ // SPDX-License-Identifier: MPL-2.0
4
+ ///////////////////////////////////////////////////////////////////////////////
5
+ import { RecipientEncryptionStatus, decideMessageEncryption } from "@rapidmx/react-shared/crypto/composeSecurity.js";
6
+ import type { EncryptionPolicy } from "@rapidmx/react-shared/crypto/keyvaultApi.js";
7
+
8
+ /**
9
+ * Whether a message must be treated as encrypted - the one place that decides it, as a pure function of what is *known*.
10
+ *
11
+ * **The rule is fail open.** A message is plain, its draft is saved, and nothing about encryption is ever shown, unless encryption is
12
+ * actually in play. Encryption is in play only when
13
+ *
14
+ * 1. the user asked for it ("Encrypt this message", or a reply to encrypted mail, whose quote may carry decrypted text) - that is local
15
+ * knowledge and needs no request to have succeeded; or
16
+ * 2. the system's encryption policy **was loaded successfully**, this sender has an encryption key (enrolled on their mailbox, or unlocked
17
+ * in this tab), the message has recipients, **every** recipient's key lookup succeeded, and the policy auto-applies encryption to all
18
+ * of them (`decideMessageEncryption().autoEncrypt`: policy `automatic` for their tier, both sides preferring "mutual", a key found).
19
+ *
20
+ * Anything that failed to load, is still loading or is slow (the policy, the mailbox, a recipient's lookup) is **unknown**, and unknown
21
+ * counts as "not encrypted": that is what stops a gateway that flaps, a slow request, or a user who has never set encryption up from
22
+ * ever blocking a draft, blocking Close, blocking Send or showing an "encryption can't be checked" message. What was unknown is
23
+ * reported in `unknown`, so a caller that is about to send can give the loads a moment - and only a caller that finds out later that the
24
+ * message *does* need encryption acts on it (see `ComposeWindow`'s transition rules).
25
+ *
26
+ * Why this is safe enough: the requirement only ever protects *this client's* plaintext drafts and sends from being unencrypted when the
27
+ * server's policy says they should be; it is not the enforcement point (the keys are the user's, the server never sees them). A missing
28
+ * policy therefore does not mean "encrypt or refuse" - it means the client cannot tell, and the honest default is the one that works.
29
+ */
30
+ export interface EncryptionFacts {
31
+ /** The user turned encryption on, or this compose is a reply to / forward of an encrypted message. */
32
+ encryptRequested: boolean;
33
+ /** The policy, once it has loaded; `undefined` while loading, failed or slow. */
34
+ policy: EncryptionPolicy | undefined;
35
+ /** The sender's mailbox has loaded (its enrolled keys are known). */
36
+ mailboxLoaded: boolean;
37
+ /** The sender has an encryption key to encrypt with: enrolled on the mailbox, unlocked in this tab, or offered earlier this session. */
38
+ hasEncryptionKey: boolean;
39
+ /** One entry per current recipient (To, Cc and Bcc): the resolved status, or `undefined` while that recipient's lookup is pending or failed. */
40
+ recipients: (RecipientEncryptionStatus | undefined)[];
41
+ }
42
+
43
+ export type EncryptionReason = "requested" | "policy";
44
+
45
+ /** What was not known, and could still change the answer. */
46
+ export type UnknownFact = "mailbox" | "policy" | "recipients";
47
+
48
+ export interface EncryptionRequirement {
49
+ /** The message must be encrypted: it is never stored as a plaintext draft and never sent in the clear. */
50
+ required: boolean;
51
+ reason: EncryptionReason | null;
52
+ /** What was unknown (and so assumed "no encryption"). Empty when the answer cannot change with more loading. Never shown to the user. */
53
+ unknown: UnknownFact[];
54
+ }
55
+
56
+ /** Any tier of `policy` auto-encrypts - only then can what is still unknown about the recipients turn a message into an encrypted one. */
57
+ export function policyCanAutoEncrypt(policy: EncryptionPolicy): boolean {
58
+ return [policy.encryptSameOrg, policy.encryptFederated, policy.encryptExternal].includes("automatic");
59
+ }
60
+
61
+ export function evaluateEncryptionRequirement(facts: EncryptionFacts): EncryptionRequirement {
62
+ if (facts.encryptRequested) {
63
+ return { required: true, reason: "requested", unknown: [] };
64
+ }
65
+ const unknown: UnknownFact[] = [];
66
+ if (!facts.hasEncryptionKey) {
67
+ // Without a key nothing can be encrypted: a user who never set encryption up sees nothing at all. Whether the mailbox has one is
68
+ // only *unknown* while it has not loaded.
69
+ return { required: false, reason: null, unknown: facts.mailboxLoaded ? [] : ["mailbox"] };
70
+ }
71
+ if (!facts.policy) {
72
+ return { required: false, reason: null, unknown: ["policy"] };
73
+ }
74
+ if (!policyCanAutoEncrypt(facts.policy)) {
75
+ return { required: false, reason: null, unknown };
76
+ }
77
+ if (facts.recipients.length === 0) {
78
+ // Nobody to decide by yet: plain until a recipient is added.
79
+ return { required: false, reason: null, unknown };
80
+ }
81
+ const statuses = facts.recipients.filter((status): status is RecipientEncryptionStatus => !!status);
82
+ if (statuses.length < facts.recipients.length) {
83
+ return { required: false, reason: null, unknown: ["recipients"] };
84
+ }
85
+ return decideMessageEncryption(statuses).autoEncrypt ? { required: true, reason: "policy", unknown } : { required: false, reason: null, unknown };
86
+ }