@open-pencil/cloud 0.17.0-beta.2 → 0.17.0-beta.5

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 (339) hide show
  1. package/README.md +3 -2
  2. package/dist/bin/server.mjs +1 -1
  3. package/dist/bin/server.mjs.map +1 -1
  4. package/dist/bin/{ai-relay.mjs → services.mjs} +9 -9
  5. package/dist/bin/services.mjs.map +1 -0
  6. package/dist/client.d.ts +525 -66
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +1257 -654
  9. package/dist/client.js.map +1 -1
  10. package/dist/contract.d.ts +2 -2
  11. package/dist/contract.js +2 -2
  12. package/dist/contract2.js +1028 -481
  13. package/dist/contract2.js.map +1 -1
  14. package/dist/email.d.ts +1780 -31
  15. package/dist/email.d.ts.map +1 -1
  16. package/dist/email.js +3556 -325
  17. package/dist/email.js.map +1 -1
  18. package/dist/errors.d.ts +2 -0
  19. package/dist/errors.js +48 -0
  20. package/dist/errors.js.map +1 -0
  21. package/dist/index.d.ts +929 -72
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index2.d.ts +35 -0
  24. package/dist/index2.d.ts.map +1 -0
  25. package/dist/listen.mjs +802 -927
  26. package/dist/listen.mjs.map +1 -1
  27. package/dist/runtime-cloudflare.d.ts +89 -0
  28. package/dist/runtime-cloudflare.d.ts.map +1 -0
  29. package/dist/runtime-cloudflare.js +15667 -0
  30. package/dist/runtime-cloudflare.js.map +1 -0
  31. package/dist/runtime-node.d.mts +7166 -3101
  32. package/dist/runtime-node.d.mts.map +1 -1
  33. package/dist/runtime-node.mjs +6 -5
  34. package/dist/runtime-node.mjs.map +1 -1
  35. package/dist/server.d.ts +6525 -2205
  36. package/dist/server.d.ts.map +1 -1
  37. package/dist/server.js +12500 -7613
  38. package/dist/server.js.map +1 -1
  39. package/dist/server.mjs +8625 -2878
  40. package/dist/server.mjs.map +1 -1
  41. package/dist/server2.mjs +101 -79
  42. package/dist/server2.mjs.map +1 -1
  43. package/package.json +27 -9
  44. package/src/admin/api/routes.ts +59 -0
  45. package/src/admin/audit/service.ts +27 -8
  46. package/src/admin/documents/service.ts +431 -0
  47. package/src/admin/errors.ts +9 -1
  48. package/src/admin/index.ts +6 -0
  49. package/src/admin/operations/service.ts +7 -0
  50. package/src/admin/reports/service.ts +153 -0
  51. package/src/admin/schema.ts +6 -0
  52. package/src/client/api.ts +28 -461
  53. package/src/client/auth/client.ts +22 -3
  54. package/src/client/auth/navigation.ts +6 -5
  55. package/src/client/billing.ts +80 -0
  56. package/src/client/community.ts +40 -0
  57. package/src/client/discovery.ts +35 -9
  58. package/src/client/documents.ts +160 -0
  59. package/src/client/index.ts +14 -7
  60. package/src/client/portal/account.ts +79 -2
  61. package/src/client/portal/administration.ts +56 -0
  62. package/src/client/portal/request.ts +2 -0
  63. package/src/client/response.ts +21 -0
  64. package/src/client/schema.ts +8 -0
  65. package/src/client/services.ts +118 -0
  66. package/src/client/sharing.ts +262 -0
  67. package/src/client/versions.ts +104 -0
  68. package/src/contract/account.ts +108 -2
  69. package/src/contract/admin/index.ts +67 -3
  70. package/src/contract/billing.ts +166 -0
  71. package/src/contract/collaboration.ts +11 -1
  72. package/src/contract/community.ts +60 -0
  73. package/src/contract/discovery.ts +83 -4
  74. package/src/contract/documents.ts +27 -0
  75. package/src/contract/entitlements.ts +12 -2
  76. package/src/contract/index.ts +114 -39
  77. package/src/contract/links.ts +57 -4
  78. package/src/contract/locale.ts +27 -0
  79. package/src/contract/portal.ts +12 -1
  80. package/src/contract/relay.ts +6 -0
  81. package/src/contract/reports.ts +42 -0
  82. package/src/contract/routes.ts +10 -0
  83. package/src/contract/services.ts +235 -0
  84. package/src/contract/sharing.ts +3 -9
  85. package/src/email/i18n.ts +174 -0
  86. package/src/email/index.ts +13 -2
  87. package/src/email/locales/ar.json +141 -0
  88. package/src/email/locales/de.json +141 -0
  89. package/src/email/locales/es.json +141 -0
  90. package/src/email/locales/fr.json +141 -0
  91. package/src/email/locales/it.json +141 -0
  92. package/src/email/locales/ja.json +141 -0
  93. package/src/email/locales/pl.json +141 -0
  94. package/src/email/locales/pt-br.json +141 -0
  95. package/src/email/locales/ru.json +141 -0
  96. package/src/email/locales/zh-cn.json +141 -0
  97. package/src/email/messages.ts +200 -0
  98. package/src/email/render.ts +138 -246
  99. package/src/email/samples.ts +115 -0
  100. package/src/email/schema.ts +79 -5
  101. package/src/email/templates/BrandEmail.vue +54 -0
  102. package/src/email/templates/DocumentBlocked.vue +45 -0
  103. package/src/email/templates/DocumentInvitation.vue +24 -0
  104. package/src/email/templates/DocumentReport.vue +32 -0
  105. package/src/email/templates/DocumentReportDecided.vue +36 -0
  106. package/src/email/templates/DocumentReportReceived.vue +18 -0
  107. package/src/email/templates/DocumentRestored.vue +24 -0
  108. package/src/email/templates/EmailChangeRequested.vue +24 -0
  109. package/src/email/templates/EmailRoot.vue +19 -0
  110. package/src/email/templates/EmailText.vue +9 -0
  111. package/src/email/templates/EmailVerification.vue +38 -0
  112. package/src/email/templates/EnrollmentNotification.vue +24 -0
  113. package/src/email/templates/EnrollmentUpdate.vue +52 -0
  114. package/src/email/templates/NewSignIn.vue +37 -0
  115. package/src/email/templates/PasswordChanged.vue +22 -0
  116. package/src/email/templates/PasswordReset.vue +23 -0
  117. package/src/email/templates/StorageLimitReached.vue +28 -0
  118. package/src/email/templates/TwoStepChanged.vue +32 -0
  119. package/src/email/templates/WaitlistConfirmation.vue +29 -0
  120. package/src/email/templates/WorkspaceInvitation.vue +28 -0
  121. package/src/email/templates/brand.ts +9 -61
  122. package/src/email/templates/localization.ts +17 -0
  123. package/src/errors/index.ts +6 -0
  124. package/src/errors/posthog.ts +80 -0
  125. package/src/global.d.ts +7 -0
  126. package/src/runtime/cloudflare/environment.ts +22 -11
  127. package/src/runtime/cloudflare/index.ts +1 -1
  128. package/src/runtime/cloudflare/logging.ts +15 -0
  129. package/src/runtime/cloudflare/maintenance.ts +31 -0
  130. package/src/runtime/cloudflare/relay/index.ts +69 -15
  131. package/src/runtime/cloudflare/tsconfig.json +2 -1
  132. package/src/runtime/cloudflare/worker.ts +46 -13
  133. package/src/runtime/node/application.ts +5 -3
  134. package/src/runtime/node/bootstrap.ts +15 -4
  135. package/src/runtime/node/cleanup.ts +20 -3
  136. package/src/runtime/node/email/transport.ts +13 -10
  137. package/src/runtime/node/entitlements/main.ts +14 -11
  138. package/src/runtime/node/index.ts +1 -1
  139. package/src/runtime/node/main.ts +1 -1
  140. package/src/runtime/node/migrate.ts +5 -1
  141. package/src/runtime/node/relay.ts +8 -2
  142. package/src/runtime/node/request-id.ts +13 -0
  143. package/src/runtime/node/server.ts +50 -16
  144. package/src/runtime/node/{ai-relay → services}/main.ts +7 -7
  145. package/src/runtime/node/{ai-relay → services}/server.ts +18 -18
  146. package/src/runtime/postgres/database.ts +20 -1
  147. package/src/runtime/posthog/errors.ts +15 -30
  148. package/src/runtime/s3/objects.ts +41 -1
  149. package/src/runtime/site/community.ts +101 -0
  150. package/src/runtime/site/server.ts +49 -6
  151. package/src/server/account/actions.ts +5 -0
  152. package/src/server/account/deletion.ts +304 -0
  153. package/src/server/account/routes.ts +281 -206
  154. package/src/server/account/terms.ts +42 -0
  155. package/src/server/account/tokens.ts +57 -0
  156. package/src/server/api/router.ts +32 -5
  157. package/src/server/api/types.ts +2 -0
  158. package/src/server/app/checks.ts +84 -0
  159. package/src/server/app/editors.ts +20 -0
  160. package/src/server/app/index.ts +128 -0
  161. package/src/server/app/indexing.ts +40 -0
  162. package/src/server/app/limiters.ts +53 -0
  163. package/src/server/app/routes.ts +114 -0
  164. package/src/server/app/services.ts +185 -0
  165. package/src/server/auth/access-control.ts +63 -0
  166. package/src/server/auth/access-tokens.ts +62 -0
  167. package/src/server/auth/adapter.ts +32 -1
  168. package/src/server/auth/email.ts +4 -1
  169. package/src/server/auth/endpoints.ts +5 -1
  170. package/src/server/auth/enrollment.ts +116 -0
  171. package/src/server/auth/factory.ts +116 -132
  172. package/src/server/auth/index.ts +10 -1
  173. package/src/server/auth/logger.ts +23 -0
  174. package/src/server/auth/mfa-assurance.ts +51 -0
  175. package/src/server/auth/passwords.ts +43 -0
  176. package/src/server/auth/session.ts +2 -0
  177. package/src/server/billing/index.ts +6 -0
  178. package/src/server/billing/routes.ts +27 -0
  179. package/src/server/billing/tokens.ts +37 -0
  180. package/src/server/cleanup/configured.ts +27 -7
  181. package/src/server/cleanup/documents.ts +165 -71
  182. package/src/server/cleanup/revisions.ts +16 -5
  183. package/src/server/cleanup/uploads.ts +8 -2
  184. package/src/server/cleanup/worker.ts +15 -3
  185. package/src/server/collaboration/relay/connection.ts +4 -3
  186. package/src/server/collaboration/relay/documents.ts +13 -10
  187. package/src/server/collaboration/relay/hub.ts +77 -122
  188. package/src/server/collaboration/relay/log.ts +5 -2
  189. package/src/server/collaboration/relay/room.ts +154 -0
  190. package/src/server/collaboration/service.ts +48 -33
  191. package/src/server/community/index.ts +2 -0
  192. package/src/server/community/routes.ts +93 -0
  193. package/src/server/community/service.ts +134 -0
  194. package/src/server/config/deployment.ts +41 -9
  195. package/src/server/config/index.ts +1 -1
  196. package/src/server/config/public.ts +11 -4
  197. package/src/server/config/schema.ts +91 -277
  198. package/src/server/config/toml/schema.ts +307 -0
  199. package/src/server/db/expressions.ts +15 -1
  200. package/src/server/db/index.ts +1 -0
  201. package/src/server/db/migrate.ts +46 -116
  202. package/src/server/db/migrations/001_accounts.ts +79 -0
  203. package/src/server/db/migrations/002_workspaces.ts +48 -0
  204. package/src/server/db/migrations/003_storage.ts +44 -0
  205. package/src/server/db/migrations/004_documents.ts +193 -0
  206. package/src/server/db/migrations/005_sharing.ts +95 -0
  207. package/src/server/db/migrations/006_operations.ts +110 -0
  208. package/src/server/db/migrations/007_trash.ts +33 -0
  209. package/src/server/db/migrations/008_terms.ts +18 -0
  210. package/src/server/db/migrations/009_access_tokens.ts +47 -0
  211. package/src/server/db/migrations/010_storage_limit_notices.ts +50 -0
  212. package/src/server/db/migrations/011_account_ids.ts +30 -0
  213. package/src/server/db/migrations/012_email_locales.ts +34 -0
  214. package/src/server/db/migrations/013_document_block_emails.ts +40 -0
  215. package/src/server/db/migrations/014_report_replies.ts +28 -0
  216. package/src/server/db/migrations/schema.ts +96 -0
  217. package/src/server/db/tables.ts +82 -4
  218. package/src/server/db/users.ts +22 -0
  219. package/src/server/documents/access.ts +66 -55
  220. package/src/server/documents/errors.ts +7 -0
  221. package/src/server/documents/images.ts +2 -1
  222. package/src/server/documents/index.ts +1 -1
  223. package/src/server/documents/limits.ts +14 -8
  224. package/src/server/documents/purge.ts +75 -0
  225. package/src/server/documents/repository.ts +2 -0
  226. package/src/server/documents/routes.ts +26 -0
  227. package/src/server/documents/service.ts +30 -406
  228. package/src/server/documents/summary.ts +1 -0
  229. package/src/server/documents/trash.ts +203 -0
  230. package/src/server/documents/uploads.ts +450 -0
  231. package/src/server/documents/versions/checkpoint.ts +2 -1
  232. package/src/server/documents/versions/history.ts +11 -7
  233. package/src/server/documents/versions/service.ts +94 -28
  234. package/src/server/email/invitations.ts +1 -0
  235. package/src/server/email/service.ts +31 -4
  236. package/src/server/email/types.ts +12 -0
  237. package/src/server/errors/index.ts +51 -16
  238. package/src/server/index.ts +52 -16
  239. package/src/server/internal/index.ts +3 -3
  240. package/src/server/internal/routes.ts +7 -10
  241. package/src/server/internal/schema.ts +1 -1
  242. package/src/server/internal/service.ts +17 -23
  243. package/src/server/invitations/budget.ts +66 -0
  244. package/src/server/invitations/index.ts +1 -0
  245. package/src/server/invitations/types.ts +5 -1
  246. package/src/server/logging.ts +76 -0
  247. package/src/server/objects/types.ts +5 -0
  248. package/src/server/pictures/service.ts +2 -1
  249. package/src/server/policy/configured.ts +9 -3
  250. package/src/server/policy/database.ts +52 -27
  251. package/src/server/policy/index.ts +2 -1
  252. package/src/server/policy/keys.ts +5 -2
  253. package/src/server/policy/policy.ts +40 -12
  254. package/src/server/policy/schema.ts +2 -2
  255. package/src/server/policy/service.ts +78 -56
  256. package/src/server/policy/static.ts +5 -5
  257. package/src/server/policy/storage.ts +33 -0
  258. package/src/server/policy/workspace.ts +41 -0
  259. package/src/server/quota/index.ts +6 -0
  260. package/src/server/quota/notices.ts +121 -0
  261. package/src/server/quota/reconcile.ts +2 -0
  262. package/src/server/quota/storage.ts +74 -31
  263. package/src/server/rate-limit/cleanup.ts +17 -5
  264. package/src/server/rate-limit/middleware.ts +6 -2
  265. package/src/server/reports/index.ts +9 -0
  266. package/src/server/reports/replies.ts +55 -0
  267. package/src/server/reports/routes.ts +39 -0
  268. package/src/server/reports/service.ts +145 -0
  269. package/src/server/services/errors.ts +7 -0
  270. package/src/server/services/index.ts +8 -0
  271. package/src/server/{ai → services}/keys.ts +11 -11
  272. package/src/server/services/routes.ts +47 -0
  273. package/src/server/{ai/service.ts → services/tokens.ts} +23 -20
  274. package/src/server/sharing/capabilities/service.ts +68 -23
  275. package/src/server/sharing/grants/service.ts +11 -18
  276. package/src/server/sharing/http.ts +4 -0
  277. package/src/server/sharing/invitations/service.ts +35 -15
  278. package/src/server/sharing/policy.ts +9 -14
  279. package/src/server/sharing/routes.ts +0 -16
  280. package/src/server/sharing/service.ts +1 -17
  281. package/src/server/validation.ts +4 -0
  282. package/src/server/workspaces/index.ts +1 -0
  283. package/src/server/workspaces/members.ts +91 -52
  284. package/src/server/workspaces/repository.ts +2 -1
  285. package/src/server/workspaces/routes.ts +4 -0
  286. package/src/{ai-relay → services}/app.ts +46 -44
  287. package/src/{ai-relay → services}/config.ts +26 -19
  288. package/src/services/db/index.ts +10 -0
  289. package/src/services/db/migrate.ts +37 -0
  290. package/src/{ai-relay/db/migrations/001_usage.ts → services/db/migrations/001_baseline.ts} +18 -7
  291. package/src/services/db/schema.ts +22 -0
  292. package/src/services/index.ts +18 -0
  293. package/src/{ai-relay → services}/metering.ts +2 -2
  294. package/src/{ai-relay → services}/usage.ts +35 -19
  295. package/dist/bin/ai-relay.mjs.map +0 -1
  296. package/src/ai-relay/db/index.ts +0 -10
  297. package/src/ai-relay/db/migrate.ts +0 -32
  298. package/src/ai-relay/db/schema.ts +0 -20
  299. package/src/ai-relay/index.ts +0 -18
  300. package/src/client/ai.ts +0 -96
  301. package/src/contract/ai.ts +0 -150
  302. package/src/email/templates/document-invitation.ts +0 -35
  303. package/src/email/templates/enrollment.ts +0 -27
  304. package/src/email/templates/layout.ts +0 -18
  305. package/src/server/ai/errors.ts +0 -7
  306. package/src/server/ai/index.ts +0 -4
  307. package/src/server/ai/routes.ts +0 -43
  308. package/src/server/app.ts +0 -379
  309. package/src/server/auth/workspace-access.ts +0 -23
  310. package/src/server/db/migrations/001_foundation.ts +0 -164
  311. package/src/server/db/migrations/002_upload_cleanup_claims.ts +0 -34
  312. package/src/server/db/migrations/003_document_cleanup_claims.ts +0 -23
  313. package/src/server/db/migrations/004_document_sharing.ts +0 -82
  314. package/src/server/db/migrations/005_document_collaboration_epoch.ts +0 -13
  315. package/src/server/db/migrations/006_invitation_continuation.ts +0 -27
  316. package/src/server/db/migrations/007_collaboration_state.ts +0 -25
  317. package/src/server/db/migrations/008_storage_reservations.ts +0 -37
  318. package/src/server/db/migrations/009_workspace_entitlements.ts +0 -22
  319. package/src/server/db/migrations/010_upload_finalization.ts +0 -22
  320. package/src/server/db/migrations/011_upload_finalization_lease.ts +0 -12
  321. package/src/server/db/migrations/012_transactional_email.ts +0 -48
  322. package/src/server/db/migrations/013_admin_enrollment.ts +0 -54
  323. package/src/server/db/migrations/014_enrollment_email_kinds.ts +0 -30
  324. package/src/server/db/migrations/015_cloud_rate_limit.ts +0 -22
  325. package/src/server/db/migrations/016_auth_schema.ts +0 -16
  326. package/src/server/db/migrations/017_authentication_email_kinds.ts +0 -32
  327. package/src/server/db/migrations/018_authentication_mfa.ts +0 -78
  328. package/src/server/db/migrations/019_better_auth_account_issuer.ts +0 -42
  329. package/src/server/db/migrations/020_workspace_invitations.ts +0 -57
  330. package/src/server/db/migrations/021_document_versions.ts +0 -66
  331. package/src/server/db/migrations/022_entitlement_external_version.ts +0 -17
  332. package/src/server/db/migrations/023_document_images.ts +0 -61
  333. package/src/server/db/migrations/024_account_activity.ts +0 -66
  334. package/src/server/db/migrations/025_table_names.ts +0 -58
  335. package/src/server/db/migrations/026_user_picture.ts +0 -30
  336. package/src/server/db/migrations/027_document_kind.ts +0 -19
  337. package/src/server/db/migrations/028_collaboration_updates.ts +0 -84
  338. package/src/server/db/migrations/helpers.ts +0 -78
  339. /package/dist/bin/{ai-relay.d.mts → services.d.mts} +0 -0
@@ -1,276 +1,168 @@
1
1
  import { render } from '@vue-email/render'
2
- import { compact } from 'es-toolkit'
3
-
2
+ import type { Component } from 'vue'
3
+
4
+ import {
5
+ emailLocalization,
6
+ type EmailLocale,
7
+ type EmailLocalization,
8
+ type EmailMessages
9
+ } from './i18n'
4
10
  import type {
5
- AdminEnrollmentNotificationPayload,
6
- AuthenticationEmailPayload,
7
11
  DocumentInvitationEmailPayload,
8
- EmailChangeRequestedPayload,
9
- EnrollmentEmailPayload,
10
- NewSignInPayload,
11
12
  RenderedTransactionalEmail,
12
13
  TransactionalEmailContent,
13
14
  TransactionalEmailKind,
14
- TwoStepChange,
15
- TwoStepChangedPayload,
16
- WorkspaceInvitationEmailPayload
15
+ TransactionalEmailPayloadByKind
17
16
  } from './schema'
18
- import { DocumentInvitationEmail } from './templates/document-invitation'
19
- import { EnrollmentEmail } from './templates/enrollment'
20
-
21
- async function rendered(
22
- component: Parameters<typeof render>[0],
23
- props: Record<string, string | undefined>,
24
- subject: string
25
- ): Promise<RenderedTransactionalEmail> {
26
- const [html, text] = await Promise.all([
27
- render(component, props),
28
- render(component, props, { plainText: true })
29
- ])
30
- return { subject, html, text }
17
+ import DocumentBlocked from './templates/DocumentBlocked.vue'
18
+ import DocumentInvitation from './templates/DocumentInvitation.vue'
19
+ import DocumentReport from './templates/DocumentReport.vue'
20
+ import DocumentReportDecided from './templates/DocumentReportDecided.vue'
21
+ import DocumentReportReceived from './templates/DocumentReportReceived.vue'
22
+ import DocumentRestored from './templates/DocumentRestored.vue'
23
+ import EmailChangeRequested from './templates/EmailChangeRequested.vue'
24
+ import EmailRoot from './templates/EmailRoot.vue'
25
+ import EmailVerification from './templates/EmailVerification.vue'
26
+ import EnrollmentNotification from './templates/EnrollmentNotification.vue'
27
+ import EnrollmentUpdate from './templates/EnrollmentUpdate.vue'
28
+ import NewSignIn from './templates/NewSignIn.vue'
29
+ import PasswordChanged from './templates/PasswordChanged.vue'
30
+ import PasswordReset from './templates/PasswordReset.vue'
31
+ import StorageLimitReached from './templates/StorageLimitReached.vue'
32
+ import TwoStepChanged from './templates/TwoStepChanged.vue'
33
+ import WaitlistConfirmation from './templates/WaitlistConfirmation.vue'
34
+ import WorkspaceInvitation from './templates/WorkspaceInvitation.vue'
35
+
36
+ /** One kind of email: the component that draws it from its payload, and its subject line. */
37
+ type EmailDefinition<Payload> = {
38
+ component: Component
39
+ /** What the component takes besides `payload`. */
40
+ props?: Record<string, unknown>
41
+ subject: (payload: Payload, t: EmailMessages) => string
31
42
  }
32
43
 
33
- async function renderDocumentInvitation(payload: DocumentInvitationEmailPayload) {
34
- const permissionLabel = payload.permission === 'edit' ? 'edit' : 'view'
35
- return rendered(
36
- DocumentInvitationEmail,
37
- {
38
- inviterName: payload.inviterName,
39
- documentName: payload.documentName,
40
- permissionLabel,
41
- expiresAt: new Date(payload.expiresAt).toUTCString(),
42
- acceptanceURL: payload.acceptanceURL
43
- },
44
- `${payload.inviterName} invited you to ${permissionLabel} ${payload.documentName}`
45
- )
46
- }
47
-
48
- const WORKSPACE_ROLE_LABELS = { admin: 'manage', editor: 'edit in', viewer: 'view' } as const
49
-
50
- async function renderWorkspaceInvitation(payload: WorkspaceInvitationEmailPayload) {
51
- const action = WORKSPACE_ROLE_LABELS[payload.role]
52
- return rendered(
53
- EnrollmentEmail,
54
- {
55
- heading: `Join ${payload.workspaceName}`,
56
- preview: `${payload.inviterName} invited you to ${payload.workspaceName}`,
57
- message: `${payload.inviterName} invited you to ${action} the workspace “${payload.workspaceName}” on OpenPencil Cloud. You will see its documents on Home once you join.`,
58
- actionLabel: 'Join workspace',
59
- actionURL: payload.acceptanceURL,
60
- footer: `This invitation expires ${new Date(payload.expiresAt).toUTCString()}.`
61
- },
62
- `${payload.inviterName} invited you to ${payload.workspaceName}`
63
- )
64
- }
65
-
66
- type EnrollmentMessageKind = Exclude<
67
- TransactionalEmailKind,
68
- | 'document-invitation'
69
- | 'workspace-invitation'
70
- | 'admin-enrollment-notification'
71
- | 'email-verification'
72
- | 'password-reset'
73
- | 'password-changed'
74
- | 'email-change-requested'
75
- | 'new-sign-in'
76
- | 'two-step-changed'
77
- >
78
-
79
- type EnrollmentCopy = {
80
- subject: string
81
- heading: string
82
- preview: string
83
- message: string
84
- actionLabel: string
44
+ function documentInvitationSubject(payload: DocumentInvitationEmailPayload, t: EmailMessages) {
45
+ const names = { inviter: payload.inviterName ?? t.someone, document: payload.documentName }
46
+ return payload.permission === 'edit'
47
+ ? t.documentInvitationEditSubject(names)
48
+ : t.documentInvitationViewSubject(names)
85
49
  }
86
50
 
87
- const ENROLLMENT_COPY: Record<EnrollmentMessageKind, Omit<EnrollmentCopy, 'message'>> = {
51
+ const EMAILS: {
52
+ [Kind in TransactionalEmailKind]: EmailDefinition<TransactionalEmailPayloadByKind[Kind]>
53
+ } = {
54
+ 'document-invitation': { component: DocumentInvitation, subject: documentInvitationSubject },
55
+ 'workspace-invitation': {
56
+ component: WorkspaceInvitation,
57
+ subject: (payload, t) =>
58
+ t.workspaceInvitationSubject({
59
+ inviter: payload.inviterName ?? t.someone,
60
+ workspace: payload.workspaceName
61
+ })
62
+ },
88
63
  'enrollment-requested': {
89
- subject: 'We received your OpenPencil Cloud request',
90
- heading: 'Request received',
91
- preview: 'Your OpenPencil Cloud access request is awaiting review.',
92
- actionLabel: 'Open OpenPencil Cloud'
64
+ component: EnrollmentUpdate,
65
+ props: { kind: 'requested' },
66
+ subject: (_payload, t) => t.enrollmentRequestedSubject
93
67
  },
94
68
  'enrollment-approved': {
95
- subject: 'Your OpenPencil Cloud access is ready',
96
- heading: 'Access approved',
97
- preview: 'You can now sign in to OpenPencil Cloud.',
98
- actionLabel: 'Sign in'
69
+ component: EnrollmentUpdate,
70
+ props: { kind: 'approved' },
71
+ subject: (_payload, t) => t.enrollmentApprovedSubject
99
72
  },
100
73
  'enrollment-rejected': {
101
- subject: 'Your OpenPencil Cloud request was reviewed',
102
- heading: 'Request reviewed',
103
- preview: 'Your current access request was not approved.',
104
- actionLabel: 'Request access again'
74
+ component: EnrollmentUpdate,
75
+ props: { kind: 'rejected' },
76
+ subject: (_payload, t) => t.enrollmentRejectedSubject
105
77
  },
106
78
  'enrollment-revoked': {
107
- subject: 'Your OpenPencil Cloud access has changed',
108
- heading: 'Access changed',
109
- preview: 'Your OpenPencil Cloud access is no longer active.',
110
- actionLabel: 'Open OpenPencil'
111
- }
112
- }
113
-
114
- function enrollmentCopy(kind: EnrollmentMessageKind, name: string): EnrollmentCopy {
115
- const copy = ENROLLMENT_COPY[kind]
116
- const messages: Record<EnrollmentMessageKind, string> = {
117
- 'enrollment-requested': `Hi ${name}, your request is awaiting manual review.`,
118
- 'enrollment-approved': `Hi ${name}, your access request was approved.`,
119
- 'enrollment-rejected': `Hi ${name}, your current access request was not approved.`,
120
- 'enrollment-revoked': `Hi ${name}, your Cloud access is no longer active.`
121
- }
122
- return { ...copy, message: messages[kind] }
123
- }
124
-
125
- async function renderEnrollment(kind: EnrollmentMessageKind, payload: EnrollmentEmailPayload) {
126
- const copy = enrollmentCopy(kind, payload.name)
127
- return rendered(EnrollmentEmail, { ...copy, actionURL: payload.actionURL }, copy.subject)
128
- }
129
-
130
- async function renderAdminNotification(payload: AdminEnrollmentNotificationPayload) {
131
- return rendered(
132
- EnrollmentEmail,
133
- {
134
- heading: 'New Cloud access request',
135
- preview: `${payload.requesterEmail} requested OpenPencil Cloud access.`,
136
- message: `${payload.requesterName} (${payload.requesterEmail}) requested access. ${payload.reason}`,
137
- actionLabel: 'Review request',
138
- actionURL: payload.actionURL
139
- },
140
- 'New OpenPencil Cloud access request'
141
- )
142
- }
143
-
144
- async function renderAuthentication(
145
- kind: 'email-verification' | 'password-reset' | 'password-changed',
146
- payload: AuthenticationEmailPayload
147
- ) {
148
- const copy = {
149
- 'email-verification':
150
- payload.purpose === 'change'
151
- ? {
152
- subject: 'Confirm your new OpenPencil Cloud email',
153
- heading: 'Confirm your new email',
154
- preview: 'One click to move your OpenPencil Cloud account to this address.',
155
- message: `Hi ${payload.name}, confirm this address to make it your OpenPencil Cloud account’s email. Your old address stays until you do.`,
156
- actionLabel: 'Confirm email',
157
- footer: 'Didn’t ask for this? Ignore this email and nothing changes.'
158
- }
159
- : {
160
- subject: 'Confirm your OpenPencil Cloud email',
161
- heading: 'Confirm your email',
162
- preview: 'One click to finish creating your OpenPencil Cloud account.',
163
- message: `Hi ${payload.name}, confirm this address to finish creating your OpenPencil Cloud account. Then go back to OpenPencil; it signs you in by itself.`,
164
- actionLabel: 'Confirm email',
165
- footer: 'Didn’t create an account? Ignore this email and nothing happens.'
166
- },
167
- 'password-reset': {
168
- subject: 'Reset your OpenPencil Cloud password',
169
- heading: 'Reset your password',
170
- preview: 'Use this secure link to choose a new password.',
171
- message: `Hi ${payload.name}, use the link below to choose a new password.`,
172
- actionLabel: 'Reset password',
173
- footer: 'Didn’t ask for this? Ignore this email and your password stays the same.'
174
- },
175
- 'password-changed': {
176
- subject: 'Your OpenPencil Cloud password changed',
177
- heading: 'Password changed',
178
- preview: 'Your OpenPencil Cloud password was changed.',
179
- message: `Hi ${payload.name}, your password was changed. If this was not you, contact your administrator.`,
180
- actionLabel: 'Open OpenPencil Cloud'
181
- }
182
- }[kind]
183
- return rendered(EnrollmentEmail, { ...copy, actionURL: payload.actionURL ?? '#' }, copy.subject)
184
- }
185
-
186
- async function renderEmailChangeRequested(payload: EmailChangeRequestedPayload) {
187
- return rendered(
188
- EnrollmentEmail,
189
- {
190
- heading: 'Your email is changing',
191
- preview: `Your OpenPencil Cloud email is changing to ${payload.newEmail}.`,
192
- message: `Hi ${payload.name}, someone signed in to your account asked to change its email to ${payload.newEmail}. It changes once that address confirms it. If this wasn’t you, change your password and sign out of your other sessions.`,
193
- actionLabel: 'Review your account',
194
- actionURL: payload.actionURL
195
- },
196
- 'Your OpenPencil Cloud email is changing'
197
- )
198
- }
199
-
200
- async function renderNewSignIn(payload: NewSignInPayload) {
201
- const device = payload.desktop
202
- ? 'the OpenPencil app'
203
- : compact([payload.browser, payload.system]).join(' on ') || 'an unknown browser'
204
- const place = payload.ipAddress ? ` from ${payload.ipAddress}` : ''
205
- return rendered(
206
- EnrollmentEmail,
207
- {
208
- heading: 'New sign-in to your account',
209
- preview: `Your OpenPencil Cloud account was signed in to with ${device}.`,
210
- message: `Hi ${payload.name}, your account was signed in to with ${device}${place} on ${new Date(payload.signedInAt).toUTCString()}. If this was you, there’s nothing to do. If it wasn’t, sign that session out and change your password.`,
211
- actionLabel: 'Review sessions',
212
- actionURL: payload.actionURL
213
- },
214
- 'New sign-in to your OpenPencil Cloud account'
215
- )
216
- }
217
-
218
- const TWO_STEP_COPY: Record<TwoStepChange, { heading: string; message: string }> = {
219
- 'authenticator-on': {
220
- heading: 'Authenticator app turned on',
221
- message: 'an authenticator app now confirms your sign-ins.'
79
+ component: EnrollmentUpdate,
80
+ props: { kind: 'revoked' },
81
+ subject: (_payload, t) => t.enrollmentRevokedSubject
82
+ },
83
+ 'admin-enrollment-notification': {
84
+ component: EnrollmentNotification,
85
+ subject: (_payload, t) => t.enrollmentNotificationSubject
86
+ },
87
+ 'email-verification': {
88
+ component: EmailVerification,
89
+ subject: (payload, t) =>
90
+ payload.purpose === 'change' ? t.verifyChangeSubject : t.verifyAccountSubject
91
+ },
92
+ 'password-reset': { component: PasswordReset, subject: (_payload, t) => t.passwordResetSubject },
93
+ 'password-changed': {
94
+ component: PasswordChanged,
95
+ subject: (_payload, t) => t.passwordChangedSubject
96
+ },
97
+ 'email-change-requested': {
98
+ component: EmailChangeRequested,
99
+ subject: (_payload, t) => t.emailChangeSubject
100
+ },
101
+ 'new-sign-in': { component: NewSignIn, subject: (_payload, t) => t.newSignInSubject },
102
+ 'two-step-changed': { component: TwoStepChanged, subject: (_payload, t) => t.twoStepSubject },
103
+ 'document-report': {
104
+ component: DocumentReport,
105
+ subject: (_payload, t) => t.documentReportSubject
106
+ },
107
+ 'storage-limit-reached': {
108
+ component: StorageLimitReached,
109
+ subject: (_payload, t) => t.storageFullSubject
222
110
  },
223
- 'authenticator-off': {
224
- heading: 'Authenticator app turned off',
225
- message: 'your sign-ins no longer ask for a code from an authenticator app.'
111
+ 'document-blocked': {
112
+ component: DocumentBlocked,
113
+ subject: (payload, t) => t.documentBlockedSubject({ document: payload.documentName })
226
114
  },
227
- 'passkey-added': {
228
- heading: 'Passkey added',
229
- message: 'a passkey was added to your account.'
115
+ 'document-restored': {
116
+ component: DocumentRestored,
117
+ subject: (payload, t) => t.documentRestoredSubject({ document: payload.documentName })
230
118
  },
231
- 'passkey-removed': {
232
- heading: 'Passkey removed',
233
- message: 'a passkey was removed from your account.'
119
+ 'document-report-received': {
120
+ component: DocumentReportReceived,
121
+ subject: (payload, t) => t.reportReceivedSubject({ document: payload.documentName })
234
122
  },
235
- 'reset-by-administrator': {
236
- heading: 'Two-step sign-in was reset',
237
- message:
238
- 'an administrator removed your authenticator app, recovery codes, and passkeys, so you can set them up again.'
123
+ 'document-report-decided': {
124
+ component: DocumentReportDecided,
125
+ subject: (payload, t) => t.reportDecidedSubject({ document: payload.documentName })
239
126
  }
240
127
  }
241
128
 
242
- async function renderTwoStepChanged(payload: TwoStepChangedPayload) {
243
- const copy = TWO_STEP_COPY[payload.change]
244
- return rendered(
245
- EnrollmentEmail,
246
- {
247
- heading: copy.heading,
248
- preview: `${copy.heading} on your OpenPencil Cloud account.`,
249
- message: `Hi ${payload.name}, ${copy.message} If this wasn’t you, change your password and contact your administrator.`,
250
- actionLabel: 'Review security',
251
- actionURL: payload.actionURL
252
- },
253
- `${copy.heading} on your OpenPencil Cloud account`
254
- )
129
+ /** Renders an email component as HTML and as plain text, in its reader's language. */
130
+ async function renderComponent(
131
+ email: Component,
132
+ props: Record<string, unknown>,
133
+ subject: string,
134
+ localization: EmailLocalization
135
+ ): Promise<RenderedTransactionalEmail> {
136
+ const root = { email, props, localization }
137
+ const [html, text] = await Promise.all([
138
+ render(EmailRoot, root),
139
+ render(EmailRoot, root, { plainText: true })
140
+ ])
141
+ return { subject, html, text }
142
+ }
143
+
144
+ function renderKind<Kind extends TransactionalEmailKind>(
145
+ kind: Kind,
146
+ payload: TransactionalEmailPayloadByKind[Kind],
147
+ localization: EmailLocalization
148
+ ) {
149
+ const { component, props, subject } = EMAILS[kind]
150
+ const content = { ...props, payload }
151
+ return renderComponent(component, content, subject(payload, localization.t), localization)
255
152
  }
256
153
 
257
154
  export async function renderTransactionalEmail(
258
- content: TransactionalEmailContent
155
+ content: TransactionalEmailContent,
156
+ locale: EmailLocale
259
157
  ): Promise<RenderedTransactionalEmail> {
260
- if (content.kind === 'document-invitation') return renderDocumentInvitation(content.payload)
261
- if (content.kind === 'workspace-invitation') return renderWorkspaceInvitation(content.payload)
262
- if (content.kind === 'admin-enrollment-notification') {
263
- return renderAdminNotification(content.payload)
264
- }
265
- if (
266
- content.kind === 'email-verification' ||
267
- content.kind === 'password-reset' ||
268
- content.kind === 'password-changed'
269
- ) {
270
- return renderAuthentication(content.kind, content.payload)
271
- }
272
- if (content.kind === 'email-change-requested') return renderEmailChangeRequested(content.payload)
273
- if (content.kind === 'new-sign-in') return renderNewSignIn(content.payload)
274
- if (content.kind === 'two-step-changed') return renderTwoStepChanged(content.payload)
275
- return renderEnrollment(content.kind, content.payload)
158
+ return renderKind(content.kind, content.payload, emailLocalization(locale))
159
+ }
160
+
161
+ /** The waitlist's confirmation email, which the feedback service sends rather than Cloud. */
162
+ export async function renderWaitlistConfirmation(
163
+ links: { confirmURL: string; leaveURL: string },
164
+ locale: EmailLocale
165
+ ): Promise<RenderedTransactionalEmail> {
166
+ const localization = emailLocalization(locale)
167
+ return renderComponent(WaitlistConfirmation, links, localization.t.waitlistSubject, localization)
276
168
  }
@@ -0,0 +1,115 @@
1
+ import type { TransactionalEmailContent } from './schema'
2
+
3
+ /** Where every sample's button goes. */
4
+ export const EMAIL_SAMPLE_URL = 'https://cloud.example.com/next'
5
+
6
+ /**
7
+ * One email of every kind, with every optional part filled, as previews and tests show them. Its
8
+ * names and addresses are made up.
9
+ */
10
+ export const EMAIL_SAMPLES: TransactionalEmailContent[] = [
11
+ {
12
+ kind: 'document-invitation',
13
+ payload: {
14
+ inviterName: 'Ada',
15
+ documentName: 'Homepage',
16
+ permission: 'edit',
17
+ expiresAt: '2026-11-20T10:00:00.000Z',
18
+ acceptanceURL: EMAIL_SAMPLE_URL
19
+ }
20
+ },
21
+ {
22
+ kind: 'workspace-invitation',
23
+ payload: {
24
+ inviterName: null,
25
+ workspaceName: 'Studio',
26
+ role: 'viewer',
27
+ expiresAt: '2026-11-20T10:00:00.000Z',
28
+ acceptanceURL: EMAIL_SAMPLE_URL
29
+ }
30
+ },
31
+ ...(
32
+ [
33
+ 'enrollment-requested',
34
+ 'enrollment-approved',
35
+ 'enrollment-rejected',
36
+ 'enrollment-revoked'
37
+ ] as const
38
+ ).map((kind): TransactionalEmailContent => ({
39
+ kind,
40
+ payload: { name: 'Ada', actionURL: EMAIL_SAMPLE_URL }
41
+ })),
42
+ {
43
+ kind: 'admin-enrollment-notification',
44
+ payload: {
45
+ requesterEmail: 'ada@example.com',
46
+ requesterName: 'Ada',
47
+ reason: 'Design',
48
+ actionURL: EMAIL_SAMPLE_URL
49
+ }
50
+ },
51
+ {
52
+ kind: 'email-verification',
53
+ payload: { name: 'Ada', actionURL: EMAIL_SAMPLE_URL, purpose: 'change' }
54
+ },
55
+ { kind: 'password-reset', payload: { name: 'Ada', actionURL: EMAIL_SAMPLE_URL } },
56
+ { kind: 'password-changed', payload: { name: 'Ada', actionURL: EMAIL_SAMPLE_URL } },
57
+ {
58
+ kind: 'email-change-requested',
59
+ payload: { name: 'Ada', newEmail: 'ada@new.example.com', actionURL: EMAIL_SAMPLE_URL }
60
+ },
61
+ {
62
+ kind: 'new-sign-in',
63
+ payload: {
64
+ name: 'Ada',
65
+ signedInAt: '2026-11-13T10:00:00.000Z',
66
+ ipAddress: '203.0.113.9',
67
+ browser: 'Firefox',
68
+ system: 'Linux',
69
+ desktop: false,
70
+ actionURL: EMAIL_SAMPLE_URL
71
+ }
72
+ },
73
+ {
74
+ kind: 'two-step-changed',
75
+ payload: { name: 'Ada', change: 'passkey-added', actionURL: EMAIL_SAMPLE_URL }
76
+ },
77
+ {
78
+ kind: 'document-report',
79
+ payload: {
80
+ documentName: 'Homepage',
81
+ reason: 'copyright',
82
+ description: 'Copied',
83
+ actionURL: EMAIL_SAMPLE_URL
84
+ }
85
+ },
86
+ {
87
+ kind: 'storage-limit-reached',
88
+ payload: {
89
+ name: 'Ada',
90
+ usedBytes: 310 * 1024 ** 2,
91
+ limitBytes: 300 * 1024 ** 2,
92
+ upgradable: true,
93
+ actionURL: EMAIL_SAMPLE_URL
94
+ }
95
+ },
96
+ {
97
+ kind: 'document-blocked',
98
+ payload: {
99
+ name: 'Ada',
100
+ documentName: 'Homepage',
101
+ reason: 'Phishing page imitating a bank',
102
+ contactEmail: 'abuse@example.com',
103
+ actionURL: EMAIL_SAMPLE_URL
104
+ }
105
+ },
106
+ {
107
+ kind: 'document-restored',
108
+ payload: { name: 'Ada', documentName: 'Homepage', actionURL: EMAIL_SAMPLE_URL }
109
+ },
110
+ { kind: 'document-report-received', payload: { documentName: 'Homepage' } },
111
+ {
112
+ kind: 'document-report-decided',
113
+ payload: { documentName: 'Homepage', outcome: 'blocked', contactEmail: 'abuse@example.com' }
114
+ }
115
+ ]
@@ -1,4 +1,8 @@
1
- import { documentPermissionSchema, workspaceRoleSchema } from '#cloud/contract'
1
+ import {
2
+ documentPermissionSchema,
3
+ documentReportReasonSchema,
4
+ workspaceRoleSchema
5
+ } from '#cloud/contract'
2
6
  import * as v from 'valibot'
3
7
 
4
8
  export type TransactionalEmailKind =
@@ -15,9 +19,16 @@ export type TransactionalEmailKind =
15
19
  | 'email-change-requested'
16
20
  | 'new-sign-in'
17
21
  | 'two-step-changed'
22
+ | 'document-report'
23
+ | 'storage-limit-reached'
24
+ | 'document-blocked'
25
+ | 'document-restored'
26
+ | 'document-report-received'
27
+ | 'document-report-decided'
18
28
 
19
29
  const documentInvitationEmailPayloadSchema = v.object({
20
- inviterName: v.string(),
30
+ /** Null when the inviter's account is gone, so the email says someone invited you. */
31
+ inviterName: v.nullable(v.string()),
21
32
  documentName: v.string(),
22
33
  permission: documentPermissionSchema,
23
34
  expiresAt: v.string(),
@@ -25,7 +36,8 @@ const documentInvitationEmailPayloadSchema = v.object({
25
36
  })
26
37
 
27
38
  const workspaceInvitationEmailPayloadSchema = v.object({
28
- inviterName: v.string(),
39
+ /** Null when the inviter's account is gone, so the email says someone invited you. */
40
+ inviterName: v.nullable(v.string()),
29
41
  workspaceName: v.string(),
30
42
  role: workspaceRoleSchema,
31
43
  expiresAt: v.string(),
@@ -33,7 +45,8 @@ const workspaceInvitationEmailPayloadSchema = v.object({
33
45
  })
34
46
 
35
47
  const enrollmentEmailPayloadSchema = v.object({
36
- name: v.string(),
48
+ /** Null when the request named no one, so the email greets no one by name. */
49
+ name: v.nullable(v.string()),
37
50
  actionURL: v.string()
38
51
  })
39
52
 
@@ -44,6 +57,53 @@ const adminEnrollmentNotificationPayloadSchema = v.object({
44
57
  actionURL: v.string()
45
58
  })
46
59
 
60
+ const documentReportPayloadSchema = v.object({
61
+ documentName: v.string(),
62
+ reason: documentReportReasonSchema,
63
+ description: v.string(),
64
+ actionURL: v.string()
65
+ })
66
+
67
+ const storageLimitReachedPayloadSchema = v.object({
68
+ name: v.string(),
69
+ usedBytes: v.number(),
70
+ limitBytes: v.number(),
71
+ /** Whether the server sells plans, so the account can get more storage rather than only free it. */
72
+ upgradable: v.boolean(),
73
+ actionURL: v.string()
74
+ })
75
+
76
+ /** To a workspace's owner: an administrator took one of its documents down. */
77
+ const documentBlockedPayloadSchema = v.object({
78
+ /** The owner's name, or null when the account has none. */
79
+ name: v.nullable(v.string()),
80
+ documentName: v.string(),
81
+ /** Why, as the administrator wrote it, or null when they gave no reason. */
82
+ reason: v.nullable(v.string()),
83
+ /** Where to write to contest it: the deployment's abuse address, or null without one. */
84
+ contactEmail: v.nullable(v.pipe(v.string(), v.email())),
85
+ actionURL: v.string()
86
+ })
87
+
88
+ /** To a workspace's owner: a document taken down is back. */
89
+ const documentRestoredPayloadSchema = v.object({
90
+ name: v.nullable(v.string()),
91
+ documentName: v.string(),
92
+ actionURL: v.string()
93
+ })
94
+
95
+ /** To whoever reported a document: their report arrived. */
96
+ const documentReportReceivedPayloadSchema = v.object({ documentName: v.string() })
97
+
98
+ /** To whoever reported a document: what the administrators decided. */
99
+ const documentReportDecidedPayloadSchema = v.object({
100
+ documentName: v.string(),
101
+ /** The document blocked, the report acted on some other way, or the document left as it was. */
102
+ outcome: v.picklist(['blocked', 'actioned', 'dismissed']),
103
+ /** Where to write to disagree: the deployment's abuse address, or null without one. */
104
+ contactEmail: v.nullable(v.pipe(v.string(), v.email()))
105
+ })
106
+
47
107
  const authenticationEmailPayloadSchema = v.object({
48
108
  name: v.string(),
49
109
  actionURL: v.optional(v.string()),
@@ -102,7 +162,13 @@ export const transactionalEmailContentSchema = v.variant('kind', [
102
162
  content('password-changed', authenticationEmailPayloadSchema),
103
163
  content('email-change-requested', emailChangeRequestedPayloadSchema),
104
164
  content('new-sign-in', newSignInPayloadSchema),
105
- content('two-step-changed', twoStepChangedPayloadSchema)
165
+ content('two-step-changed', twoStepChangedPayloadSchema),
166
+ content('document-report', documentReportPayloadSchema),
167
+ content('storage-limit-reached', storageLimitReachedPayloadSchema),
168
+ content('document-blocked', documentBlockedPayloadSchema),
169
+ content('document-restored', documentRestoredPayloadSchema),
170
+ content('document-report-received', documentReportReceivedPayloadSchema),
171
+ content('document-report-decided', documentReportDecidedPayloadSchema)
106
172
  ])
107
173
 
108
174
  /** A transactional email's kind with the payload that kind renders. */
@@ -142,3 +208,11 @@ export type RenderedTransactionalEmail = {
142
208
  html: string
143
209
  text: string
144
210
  }
211
+ export type DocumentReportPayload = v.InferOutput<typeof documentReportPayloadSchema>
212
+ export type StorageLimitReachedPayload = v.InferOutput<typeof storageLimitReachedPayloadSchema>
213
+ export type DocumentBlockedPayload = v.InferOutput<typeof documentBlockedPayloadSchema>
214
+ export type DocumentRestoredPayload = v.InferOutput<typeof documentRestoredPayloadSchema>
215
+ export type DocumentReportReceivedPayload = v.InferOutput<
216
+ typeof documentReportReceivedPayloadSchema
217
+ >
218
+ export type DocumentReportDecidedPayload = v.InferOutput<typeof documentReportDecidedPayloadSchema>