@cosmicdrift/kumiko-samples 0.378.0 → 0.379.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 (506) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +18 -17
  3. package/packages/bundled-features/src/account-security/feature.ts +2 -2
  4. package/packages/bundled-features/src/account-security/index.ts +8 -8
  5. package/packages/bundled-features/src/account-security/{constants.ts → web/constants.ts} +0 -2
  6. package/packages/bundled-features/src/account-security/{i18n.ts → web/i18n.ts} +0 -1
  7. package/packages/bundled-features/src/admin-shell/feature.ts +10 -9
  8. package/packages/bundled-features/src/admin-shell/index.ts +8 -8
  9. package/packages/bundled-features/src/admin-shell/web/client-plugin.tsx +2 -3
  10. package/packages/bundled-features/src/admin-shell/{constants.ts → web/constants.ts} +0 -1
  11. package/packages/bundled-features/src/admin-shell/web/default-translations.ts +10 -0
  12. package/packages/bundled-features/src/admin-shell/web/i18n.ts +51 -9
  13. package/packages/bundled-features/src/admin-shell/web/index.ts +0 -1
  14. package/packages/bundled-features/src/audit/changes.json +7 -0
  15. package/packages/bundled-features/src/audit/feature.ts +72 -64
  16. package/packages/bundled-features/src/audit/handlers/audit-events.ts +153 -0
  17. package/packages/bundled-features/src/audit/handlers/audit-system-db.ts +13 -0
  18. package/packages/bundled-features/src/audit/handlers/details-all-tenants.query.ts +26 -0
  19. package/packages/bundled-features/src/audit/handlers/details.query.ts +11 -39
  20. package/packages/bundled-features/src/audit/handlers/list-all-tenants.query.ts +47 -0
  21. package/packages/bundled-features/src/audit/handlers/list.query.ts +16 -123
  22. package/packages/bundled-features/src/audit/handlers/resolve-audit-tenant.ts +21 -7
  23. package/packages/bundled-features/src/audit/index.ts +1 -1
  24. package/packages/bundled-features/src/audit/run-escape-hatch-retention.ts +4 -4
  25. package/packages/bundled-features/src/audit/screens.ts +82 -0
  26. package/packages/bundled-features/src/audit/web/client-plugin.tsx +2 -3
  27. package/packages/bundled-features/src/audit/{constants.ts → web/constants.ts} +11 -1
  28. package/packages/bundled-features/src/audit/web/default-translations.ts +7 -0
  29. package/packages/bundled-features/src/audit/web/i18n.ts +33 -7
  30. package/packages/bundled-features/src/audit/web/index.ts +0 -2
  31. package/packages/bundled-features/src/auth-email-password/bootstrap.ts +6 -6
  32. package/packages/bundled-features/src/auth-email-password/changes.json +6 -0
  33. package/packages/bundled-features/src/auth-email-password/errors.ts +1 -1
  34. package/packages/bundled-features/src/auth-email-password/feature.ts +2 -2
  35. package/packages/bundled-features/src/auth-email-password/handlers/confirm-account-unlock.write.ts +1 -1
  36. package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +4 -4
  37. package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +3 -3
  38. package/packages/bundled-features/src/auth-email-password/handlers/invite-info.query.ts +1 -1
  39. package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +38 -4
  40. package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
  41. package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +1 -1
  42. package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +1 -1
  43. package/packages/bundled-features/src/auth-email-password/handlers/reset-password.write.ts +1 -1
  44. package/packages/bundled-features/src/auth-email-password/handlers/verify-email.write.ts +1 -1
  45. package/packages/bundled-features/src/auth-email-password/index.ts +6 -1
  46. package/packages/bundled-features/src/auth-email-password/mail-notifications.ts +1 -1
  47. package/packages/bundled-features/src/auth-email-password/signup-activation.ts +1 -1
  48. package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +0 -1
  49. package/packages/bundled-features/src/auth-email-password/web/auth-form-logic.ts +0 -1
  50. package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +0 -1
  51. package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +0 -1
  52. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +0 -1
  53. package/packages/bundled-features/src/auth-email-password/web/client-actions.ts +0 -1
  54. package/packages/bundled-features/src/auth-email-password/web/client-plugin.ts +1 -2
  55. package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +0 -1
  56. package/packages/bundled-features/src/auth-email-password/{constants.ts → web/constants.ts} +3 -6
  57. package/packages/bundled-features/src/auth-email-password/web/default-topbar-actions.tsx +0 -1
  58. package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +0 -1
  59. package/packages/bundled-features/src/auth-email-password/{i18n.ts → web/i18n.ts} +3 -4
  60. package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -2
  61. package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +2 -3
  62. package/packages/bundled-features/src/auth-email-password/web/login-screen.tsx +0 -1
  63. package/packages/bundled-features/src/auth-email-password/{mail-i18n.ts → web/mail-i18n.ts} +0 -1
  64. package/packages/bundled-features/src/auth-email-password/web/request-account-unlock-screen.tsx +0 -1
  65. package/packages/bundled-features/src/auth-email-password/web/reset-password-screen.tsx +0 -1
  66. package/packages/bundled-features/src/auth-email-password/web/session-bootstrap-error.tsx +0 -1
  67. package/packages/bundled-features/src/auth-email-password/web/session.tsx +0 -1
  68. package/packages/bundled-features/src/auth-email-password/web/signup-complete-screen.tsx +2 -3
  69. package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +0 -1
  70. package/packages/bundled-features/src/auth-email-password/web/tenant-menu-items.tsx +0 -1
  71. package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +0 -1
  72. package/packages/bundled-features/src/auth-email-password/web/use-shell-user.ts +0 -1
  73. package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +0 -1
  74. package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +0 -1
  75. package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
  76. package/packages/bundled-features/src/auth-mfa/errors.ts +2 -2
  77. package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +1 -1
  78. package/packages/bundled-features/src/auth-mfa/handlers/enable-start-preauth.write.ts +1 -1
  79. package/packages/bundled-features/src/auth-mfa/handlers/enable-start.write.ts +1 -1
  80. package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +1 -1
  81. package/packages/bundled-features/src/auth-mfa/index.ts +8 -8
  82. package/packages/bundled-features/src/auth-mfa/mfa-status-checker.ts +4 -4
  83. package/packages/bundled-features/src/auth-mfa/screens.ts +1 -1
  84. package/packages/bundled-features/src/auth-mfa/web/client-plugin.ts +0 -1
  85. package/packages/bundled-features/src/auth-mfa/{constants.ts → web/constants.ts} +0 -1
  86. package/packages/bundled-features/src/auth-mfa/web/i18n.ts +0 -1
  87. package/packages/bundled-features/src/auth-mfa/web/index.ts +0 -1
  88. package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +0 -1
  89. package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -2
  90. package/packages/bundled-features/src/auth-mfa/web/mfa-recovery-codes-reveal.tsx +0 -1
  91. package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -2
  92. package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +21 -23
  93. package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +0 -1
  94. package/packages/bundled-features/src/billing-foundation/changes.json +18 -0
  95. package/packages/bundled-features/src/billing-foundation/checkout-core.ts +3 -3
  96. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +2 -2
  97. package/packages/bundled-features/src/billing-foundation/consumer-protection/issue-confirmation.ts +11 -3
  98. package/packages/bundled-features/src/billing-foundation/consumer-protection/mail-notifications.ts +11 -1
  99. package/packages/bundled-features/src/billing-foundation/consumer-protection/register-consent.ts +1 -1
  100. package/packages/bundled-features/src/billing-foundation/consumer-protection/register-termination.ts +12 -1
  101. package/packages/bundled-features/src/billing-foundation/consumer-protection/stored-user-email.ts +12 -0
  102. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-mail.ts +6 -1
  103. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -1
  104. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-pages.ts +167 -28
  105. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +102 -3
  106. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-request.ts +43 -12
  107. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +202 -0
  108. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-texts.ts +70 -0
  109. package/packages/bundled-features/src/billing-foundation/events.ts +20 -2
  110. package/packages/bundled-features/src/billing-foundation/feature.ts +5 -5
  111. package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +82 -9
  112. package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +1 -1
  113. package/packages/bundled-features/src/billing-foundation/handlers/sync-subscription.write.ts +1 -1
  114. package/packages/bundled-features/src/billing-foundation/index.ts +27 -27
  115. package/packages/bundled-features/src/billing-foundation/plan-catalog.ts +7 -7
  116. package/packages/bundled-features/src/billing-foundation/screens.ts +1 -1
  117. package/packages/bundled-features/src/billing-foundation/subscription-tier-sync.ts +1 -1
  118. package/packages/bundled-features/src/billing-foundation/types.ts +17 -3
  119. package/packages/bundled-features/src/billing-foundation/validate-options.ts +3 -3
  120. package/packages/bundled-features/src/billing-foundation/web/billing-contact-plan.tsx +1 -3
  121. package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +5 -7
  122. package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -3
  123. package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -3
  124. package/packages/bundled-features/src/billing-foundation/web/client-plugin.tsx +1 -2
  125. package/packages/bundled-features/src/billing-foundation/{constants.ts → web/constants.ts} +37 -31
  126. package/packages/bundled-features/src/billing-foundation/{consumer-protection → web/consumer-protection}/consent-locale.ts +0 -1
  127. package/packages/bundled-features/src/billing-foundation/{contact-card.ts → web/contact-card.ts} +0 -2
  128. package/packages/bundled-features/src/billing-foundation/web/index.ts +14 -15
  129. package/packages/bundled-features/src/billing-foundation/web/localized-params.ts +0 -2
  130. package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +5 -2
  131. package/packages/bundled-features/src/cap-overview/feature.ts +1 -1
  132. package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -1
  133. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +2 -2
  134. package/packages/bundled-features/src/cap-overview/index.ts +9 -9
  135. package/packages/bundled-features/src/cap-overview/screens.ts +2 -2
  136. package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +1 -2
  137. package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +1 -2
  138. package/packages/bundled-features/src/cap-overview/web/cap-usage-cell.tsx +0 -2
  139. package/packages/bundled-features/src/cap-overview/web/client-plugin.tsx +3 -4
  140. package/packages/bundled-features/src/cap-overview/{constants.ts → web/constants.ts} +0 -1
  141. package/packages/bundled-features/src/cap-overview/web/index.ts +0 -1
  142. package/packages/bundled-features/src/cap-overview/{usage-math.ts → web/usage-math.ts} +1 -2
  143. package/packages/bundled-features/src/compliance-profiles/feature.ts +5 -5
  144. package/packages/bundled-features/src/compliance-profiles/index.ts +6 -6
  145. package/packages/bundled-features/src/compliance-profiles/web/client-plugin.tsx +2 -3
  146. package/packages/bundled-features/src/compliance-profiles/web/compliance-profile-catalog.tsx +1 -2
  147. package/packages/bundled-features/src/compliance-profiles/{constants.ts → web/constants.ts} +0 -1
  148. package/packages/bundled-features/src/compliance-profiles/web/i18n.ts +0 -1
  149. package/packages/bundled-features/src/compliance-profiles/web/index.ts +0 -1
  150. package/packages/bundled-features/src/config/index.ts +6 -6
  151. package/packages/bundled-features/src/config/web/client-plugin.ts +1 -2
  152. package/packages/bundled-features/src/config/{constants.ts → web/constants.ts} +0 -1
  153. package/packages/bundled-features/src/config/web/i18n.ts +0 -1
  154. package/packages/bundled-features/src/config/web/index.ts +1 -3
  155. package/packages/bundled-features/src/config/write-helpers.ts +1 -1
  156. package/packages/bundled-features/src/custom-fields/feature.ts +8 -8
  157. package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +1 -1
  158. package/packages/bundled-features/src/custom-fields/handlers/define-tenant-field.write.ts +1 -1
  159. package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +1 -1
  160. package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +4 -4
  161. package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +1 -1
  162. package/packages/bundled-features/src/custom-fields/handlers/update-tenant-field.write.ts +1 -1
  163. package/packages/bundled-features/src/custom-fields/index.ts +8 -8
  164. package/packages/bundled-features/src/custom-fields/lib/value-schema.ts +1 -1
  165. package/packages/bundled-features/src/custom-fields/schemas.ts +1 -1
  166. package/packages/bundled-features/src/custom-fields/web/client-plugin.tsx +1 -2
  167. package/packages/bundled-features/src/custom-fields/{constants.ts → web/constants.ts} +18 -19
  168. package/packages/bundled-features/src/custom-fields/web/custom-fields-form-section.tsx +1 -2
  169. package/packages/bundled-features/src/custom-fields/web/i18n.ts +0 -1
  170. package/packages/bundled-features/src/custom-fields/web/index.ts +2 -3
  171. package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +1 -2
  172. package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -1
  173. package/packages/bundled-features/src/delivery/attempt-log-retention.ts +24 -8
  174. package/packages/bundled-features/src/delivery/changes.json +6 -0
  175. package/packages/bundled-features/src/delivery/constants.ts +2 -2
  176. package/packages/bundled-features/src/delivery/i18n.ts +1 -1
  177. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +1 -1
  178. package/packages/bundled-features/src/delivery/web/client-plugin.tsx +6 -7
  179. package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +0 -1
  180. package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +0 -1
  181. package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -2
  182. package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +0 -1
  183. package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +0 -1
  184. package/packages/bundled-features/src/delivery/web/index.ts +0 -1
  185. package/packages/bundled-features/src/delivery/{public-names.ts → web/public-names.ts} +0 -1
  186. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  187. package/packages/bundled-features/src/document-ingest-foundation/events.ts +4 -0
  188. package/packages/bundled-features/src/document-ingest-foundation/executor.ts +2 -1
  189. package/packages/bundled-features/src/document-ingest-foundation/feature.ts +18 -4
  190. package/packages/bundled-features/src/document-ingest-foundation/index.ts +1 -0
  191. package/packages/bundled-features/src/feature-toggles/feature.ts +7 -7
  192. package/packages/bundled-features/src/feature-toggles/handlers/list.query.ts +1 -1
  193. package/packages/bundled-features/src/feature-toggles/handlers/registered.query.ts +1 -1
  194. package/packages/bundled-features/src/feature-toggles/handlers/set.write.ts +3 -3
  195. package/packages/bundled-features/src/feature-toggles/index.ts +6 -6
  196. package/packages/bundled-features/src/feature-toggles/web/client-plugin.tsx +1 -2
  197. package/packages/bundled-features/src/feature-toggles/{constants.ts → web/constants.ts} +0 -1
  198. package/packages/bundled-features/src/feature-toggles/web/i18n.ts +0 -1
  199. package/packages/bundled-features/src/feature-toggles/web/index.ts +0 -1
  200. package/packages/bundled-features/src/files/changes.json +7 -0
  201. package/packages/bundled-features/src/folders/feature.ts +1 -1
  202. package/packages/bundled-features/src/folders/handlers/clear-folder.write.ts +1 -1
  203. package/packages/bundled-features/src/folders/handlers/delete-folder.write.ts +1 -1
  204. package/packages/bundled-features/src/folders/handlers/set-folder.write.ts +1 -1
  205. package/packages/bundled-features/src/folders/index.ts +8 -8
  206. package/packages/bundled-features/src/folders/web/client-plugin.tsx +1 -3
  207. package/packages/bundled-features/src/folders/{constants.ts → web/constants.ts} +0 -1
  208. package/packages/bundled-features/src/folders/web/folder-manager.tsx +1 -2
  209. package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -2
  210. package/packages/bundled-features/src/folders/web/i18n.ts +0 -1
  211. package/packages/bundled-features/src/folders/web/index.ts +1 -2
  212. package/packages/bundled-features/src/folders/web/tree.ts +0 -1
  213. package/packages/bundled-features/src/form-draft/changes.json +7 -0
  214. package/packages/bundled-features/src/form-draft/db/queries/cleanup.ts +25 -11
  215. package/packages/bundled-features/src/form-draft/decrypt-draft.ts +24 -0
  216. package/packages/bundled-features/src/form-draft/entity.ts +6 -9
  217. package/packages/bundled-features/src/form-draft/feature.ts +1 -1
  218. package/packages/bundled-features/src/form-draft/handlers/cleanup.job.ts +26 -5
  219. package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +1 -1
  220. package/packages/bundled-features/src/form-draft/handlers/get.query.ts +6 -7
  221. package/packages/bundled-features/src/form-draft/handlers/list.query.ts +13 -7
  222. package/packages/bundled-features/src/form-draft/handlers/save.write.ts +5 -5
  223. package/packages/bundled-features/src/form-draft/index.ts +8 -8
  224. package/packages/bundled-features/src/form-draft/lookup.ts +10 -4
  225. package/packages/bundled-features/src/form-draft/schemas.ts +1 -1
  226. package/packages/bundled-features/src/form-draft/{constants.ts → web/constants.ts} +0 -1
  227. package/packages/bundled-features/src/form-draft-user-data/hooks.ts +2 -2
  228. package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +10 -10
  229. package/packages/bundled-features/src/jobs/feature.ts +7 -7
  230. package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
  231. package/packages/bundled-features/src/jobs/handlers/trigger.write.ts +1 -1
  232. package/packages/bundled-features/src/jobs/index.ts +1 -1
  233. package/packages/bundled-features/src/jobs/web/client-plugin.tsx +2 -3
  234. package/packages/bundled-features/src/jobs/{constants.ts → web/constants.ts} +0 -1
  235. package/packages/bundled-features/src/jobs/web/default-translations.ts +7 -0
  236. package/packages/bundled-features/src/jobs/web/i18n.ts +53 -7
  237. package/packages/bundled-features/src/jobs/web/index.ts +0 -1
  238. package/packages/bundled-features/src/ledger/changes.json +7 -0
  239. package/packages/bundled-features/src/ledger/entity.ts +1 -1
  240. package/packages/bundled-features/src/ledger/feature.ts +1 -1
  241. package/packages/bundled-features/src/ledger/handlers/confirm-schedule-period.write.ts +2 -10
  242. package/packages/bundled-features/src/ledger/handlers/create-transaction.write.ts +1 -1
  243. package/packages/bundled-features/src/ledger/handlers/reports.query.ts +1 -1
  244. package/packages/bundled-features/src/ledger/handlers/reverse-transaction.write.ts +1 -1
  245. package/packages/bundled-features/src/ledger/index.ts +13 -13
  246. package/packages/bundled-features/src/ledger/recurring.ts +1 -1
  247. package/packages/bundled-features/src/ledger/reports.ts +1 -1
  248. package/packages/bundled-features/src/ledger/schemas.ts +1 -1
  249. package/packages/bundled-features/src/ledger/{constants.ts → web/constants.ts} +0 -1
  250. package/packages/bundled-features/src/ledger/web/index.ts +11 -12
  251. package/packages/bundled-features/src/legal-pages/README.md +1 -1
  252. package/packages/bundled-features/src/legal-pages/feature.ts +5 -5
  253. package/packages/bundled-features/src/legal-pages/index.ts +11 -11
  254. package/packages/bundled-features/src/legal-pages/lib/boot-check.ts +1 -1
  255. package/packages/bundled-features/src/legal-pages/lib/validate-routes.ts +1 -1
  256. package/packages/bundled-features/src/legal-pages/web/client-plugin.ts +1 -2
  257. package/packages/bundled-features/src/legal-pages/{constants.ts → web/constants.ts} +6 -8
  258. package/packages/bundled-features/src/legal-pages/web/index.ts +0 -1
  259. package/packages/bundled-features/src/managed-pages/feature.ts +1 -1
  260. package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +1 -2
  261. package/packages/bundled-features/src/managed-pages/web/default-translations.ts +17 -0
  262. package/packages/bundled-features/src/managed-pages/web/i18n.ts +59 -16
  263. package/packages/bundled-features/src/managed-pages/web/index.ts +1 -2
  264. package/packages/bundled-features/src/metrics/compute.ts +1 -1
  265. package/packages/bundled-features/src/metrics/feature.ts +6 -6
  266. package/packages/bundled-features/src/metrics/index.ts +8 -8
  267. package/packages/bundled-features/src/metrics/types.ts +1 -1
  268. package/packages/bundled-features/src/metrics/validate.ts +1 -1
  269. package/packages/bundled-features/src/metrics/{constants.ts → web/constants.ts} +0 -1
  270. package/packages/bundled-features/src/metrics/window.ts +1 -1
  271. package/packages/bundled-features/src/notes-history/feature.ts +1 -1
  272. package/packages/bundled-features/src/notes-history/handlers/add-note.write.ts +1 -1
  273. package/packages/bundled-features/src/notes-history/index.ts +8 -8
  274. package/packages/bundled-features/src/notes-history/web/client-plugin.tsx +1 -3
  275. package/packages/bundled-features/src/notes-history/{constants.ts → web/constants.ts} +0 -1
  276. package/packages/bundled-features/src/notes-history/web/i18n.ts +0 -1
  277. package/packages/bundled-features/src/notes-history/web/index.ts +2 -3
  278. package/packages/bundled-features/src/notes-history/web/notes-section.tsx +2 -3
  279. package/packages/bundled-features/src/personal-access-tokens/feature.ts +12 -10
  280. package/packages/bundled-features/src/personal-access-tokens/handlers/available-scopes.query.ts +1 -1
  281. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +1 -1
  282. package/packages/bundled-features/src/personal-access-tokens/handlers/revoke.write.ts +1 -1
  283. package/packages/bundled-features/src/personal-access-tokens/hash.ts +1 -1
  284. package/packages/bundled-features/src/personal-access-tokens/i18n.ts +2 -2
  285. package/packages/bundled-features/src/personal-access-tokens/index.ts +5 -5
  286. package/packages/bundled-features/src/personal-access-tokens/resolver.ts +1 -1
  287. package/packages/bundled-features/src/personal-access-tokens/schema/api-token.ts +1 -1
  288. package/packages/bundled-features/src/personal-access-tokens/screens.ts +2 -2
  289. package/packages/bundled-features/src/personal-access-tokens/{constants.ts → web/constants.ts} +0 -1
  290. package/packages/bundled-features/src/personal-access-tokens/{scopes.ts → web/scopes.ts} +0 -1
  291. package/packages/bundled-features/src/presets/changes.json +7 -0
  292. package/packages/bundled-features/src/presets/index.ts +0 -1
  293. package/packages/bundled-features/src/presets/security-baseline.ts +1 -1
  294. package/packages/bundled-features/src/renderer-foundation/types.ts +1 -1
  295. package/packages/bundled-features/src/secrets/feature.ts +1 -1
  296. package/packages/bundled-features/src/secrets/handlers/delete.write.ts +1 -1
  297. package/packages/bundled-features/src/secrets/handlers/list.query.ts +1 -1
  298. package/packages/bundled-features/src/secrets/handlers/set.write.ts +1 -1
  299. package/packages/bundled-features/src/secrets/i18n.ts +1 -1
  300. package/packages/bundled-features/src/secrets/index.ts +8 -8
  301. package/packages/bundled-features/src/secrets/{constants.ts → web/constants.ts} +0 -1
  302. package/packages/bundled-features/src/secrets/write-gate.ts +1 -1
  303. package/packages/bundled-features/src/sessions/feature.ts +7 -4
  304. package/packages/bundled-features/src/sessions/{i18n.ts → web/i18n.ts} +0 -1
  305. package/packages/bundled-features/src/shared/index.ts +6 -1
  306. package/packages/bundled-features/src/shared/purge-files-reaching-subject.ts +10 -2
  307. package/packages/bundled-features/src/shared/web/translate-or-raw.ts +0 -1
  308. package/packages/bundled-features/src/subscription-stripe/feature.ts +2 -0
  309. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +19 -0
  310. package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +1 -0
  311. package/packages/bundled-features/src/tags/changes.json +6 -0
  312. package/packages/bundled-features/src/tags/feature.ts +1 -1
  313. package/packages/bundled-features/src/tags/handlers/assign-tag.write.ts +11 -7
  314. package/packages/bundled-features/src/tags/handlers/create-tag.write.ts +1 -1
  315. package/packages/bundled-features/src/tags/handlers/delete-tag.write.ts +4 -1
  316. package/packages/bundled-features/src/tags/handlers/remove-tag.write.ts +1 -1
  317. package/packages/bundled-features/src/tags/handlers/update-tag.write.ts +1 -1
  318. package/packages/bundled-features/src/tags/index.ts +12 -12
  319. package/packages/bundled-features/src/tags/screens.ts +1 -1
  320. package/packages/bundled-features/src/tags/web/client-plugin.tsx +1 -3
  321. package/packages/bundled-features/src/tags/{constants.ts → web/constants.ts} +4 -1
  322. package/packages/bundled-features/src/tags/web/entity-tags.tsx +1 -2
  323. package/packages/bundled-features/src/tags/web/i18n.ts +2 -2
  324. package/packages/bundled-features/src/tags/web/index.ts +2 -3
  325. package/packages/bundled-features/src/tags/web/tag-chip.tsx +0 -1
  326. package/packages/bundled-features/src/tags/web/tag-filter.tsx +1 -2
  327. package/packages/bundled-features/src/tags/web/tag-manager.tsx +5 -4
  328. package/packages/bundled-features/src/tags/web/tag-picker.tsx +0 -1
  329. package/packages/bundled-features/src/tags/web/tag-section.tsx +1 -2
  330. package/packages/bundled-features/src/tags/web/tags-cell.tsx +1 -2
  331. package/packages/bundled-features/src/template-resolver/README.md +1 -1
  332. package/packages/bundled-features/src/template-resolver/api.ts +75 -28
  333. package/packages/bundled-features/src/template-resolver/changes.json +43 -0
  334. package/packages/bundled-features/src/template-resolver/compile-document-body.ts +1 -1
  335. package/packages/bundled-features/src/template-resolver/compile-steps-block.ts +2 -2
  336. package/packages/bundled-features/src/template-resolver/document-ops.ts +5 -5
  337. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +4 -4
  338. package/packages/bundled-features/src/template-resolver/feature.ts +13 -4
  339. package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +6 -1
  340. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +6 -2
  341. package/packages/bundled-features/src/template-resolver/handlers/collection-item.query.ts +1 -1
  342. package/packages/bundled-features/src/template-resolver/handlers/collection-list.query.ts +1 -1
  343. package/packages/bundled-features/src/template-resolver/handlers/collection-set.write.ts +19 -2
  344. package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +2 -2
  345. package/packages/bundled-features/src/template-resolver/handlers/diff-to-system.query.ts +7 -1
  346. package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +1 -1
  347. package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +8 -2
  348. package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +2 -2
  349. package/packages/bundled-features/src/template-resolver/handlers/export-bundle.query.ts +5 -2
  350. package/packages/bundled-features/src/template-resolver/handlers/find-by-id.query.ts +4 -2
  351. package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +10 -5
  352. package/packages/bundled-features/src/template-resolver/handlers/list.query.ts +5 -2
  353. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +68 -10
  354. package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +1 -1
  355. package/packages/bundled-features/src/template-resolver/handlers/resource-shared.ts +1 -1
  356. package/packages/bundled-features/src/template-resolver/handlers/resource-upload.write.ts +1 -1
  357. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +2 -2
  358. package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +1 -1
  359. package/packages/bundled-features/src/template-resolver/handlers/shared.ts +1 -1
  360. package/packages/bundled-features/src/template-resolver/handlers/template-gates.ts +6 -6
  361. package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +2 -2
  362. package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +8 -2
  363. package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +4 -2
  364. package/packages/bundled-features/src/template-resolver/i18n.ts +25 -0
  365. package/packages/bundled-features/src/template-resolver/index.ts +60 -59
  366. package/packages/bundled-features/src/template-resolver/layout-appearance.ts +1 -1
  367. package/packages/bundled-features/src/template-resolver/layout-regions.ts +1 -1
  368. package/packages/bundled-features/src/template-resolver/seeding.ts +16 -7
  369. package/packages/bundled-features/src/template-resolver/store-template-resource.ts +2 -2
  370. package/packages/bundled-features/src/template-resolver/table.ts +1 -1
  371. package/packages/bundled-features/src/template-resolver/template-bundle.ts +2 -2
  372. package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +82 -0
  373. package/packages/bundled-features/src/template-resolver/template-draft.ts +1 -1
  374. package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +2 -2
  375. package/packages/bundled-features/src/template-resolver/template-meta.ts +2 -2
  376. package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -10
  377. package/packages/bundled-features/src/template-resolver/template-usage.ts +1 -1
  378. package/packages/bundled-features/src/template-resolver/template-validation.ts +2 -2
  379. package/packages/bundled-features/src/template-resolver/testing.ts +2 -2
  380. package/packages/bundled-features/src/template-resolver/user-content-table.ts +1 -1
  381. package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +4 -5
  382. package/packages/bundled-features/src/template-resolver/{constants.ts → web/constants.ts} +7 -10
  383. package/packages/bundled-features/src/template-resolver/{document-blocks.ts → web/document-blocks.ts} +0 -1
  384. package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +2 -3
  385. package/packages/bundled-features/src/template-resolver/web/document-editor.tsx +0 -1
  386. package/packages/bundled-features/src/template-resolver/{document-images.ts → web/document-images.ts} +0 -1
  387. package/packages/bundled-features/src/template-resolver/{document-schema.ts → web/document-schema.ts} +0 -1
  388. package/packages/bundled-features/src/template-resolver/{document-steps.ts → web/document-steps.ts} +0 -1
  389. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +6 -7
  390. package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +2 -3
  391. package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -2
  392. package/packages/bundled-features/src/template-resolver/web/i18n.ts +2 -1
  393. package/packages/bundled-features/src/template-resolver/web/index.ts +13 -14
  394. package/packages/bundled-features/src/template-resolver/{mail-constants.ts → web/mail-constants.ts} +0 -1
  395. package/packages/bundled-features/src/template-resolver/{pdf-constants.ts → web/pdf-constants.ts} +0 -1
  396. package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor-lazy.tsx +0 -1
  397. package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor.tsx +5 -4
  398. package/packages/bundled-features/src/template-resolver/{placeholder-text.ts → web/placeholder-text.ts} +0 -1
  399. package/packages/bundled-features/src/template-resolver/{qualified-names.ts → web/qualified-names.ts} +0 -1
  400. package/packages/bundled-features/src/template-resolver/web/use-stable-by-key.ts +0 -1
  401. package/packages/bundled-features/src/tenant/handlers/add-member.write.ts +1 -1
  402. package/packages/bundled-features/src/tenant/index.ts +7 -7
  403. package/packages/bundled-features/src/tenant/invitation-table.ts +1 -1
  404. package/packages/bundled-features/src/tenant/invited-membership.ts +1 -1
  405. package/packages/bundled-features/src/tenant/last-tenant-admin.ts +1 -1
  406. package/packages/bundled-features/src/tenant/member-role-options.ts +1 -1
  407. package/packages/bundled-features/src/tenant/screens.ts +2 -2
  408. package/packages/bundled-features/src/tenant/web/client-plugin.tsx +1 -2
  409. package/packages/bundled-features/src/tenant/{constants.ts → web/constants.ts} +3 -6
  410. package/packages/bundled-features/src/tenant/web/index.ts +0 -1
  411. package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +0 -1
  412. package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +0 -1
  413. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +2 -2
  414. package/packages/bundled-features/src/tier-engine/entity.ts +1 -1
  415. package/packages/bundled-features/src/tier-engine/feature.ts +7 -7
  416. package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +1 -1
  417. package/packages/bundled-features/src/tier-engine/index.ts +8 -8
  418. package/packages/bundled-features/src/tier-engine/web/client-plugin.tsx +2 -3
  419. package/packages/bundled-features/src/tier-engine/{constants.ts → web/constants.ts} +2 -3
  420. package/packages/bundled-features/src/tier-engine/{i18n.ts → web/i18n.ts} +0 -1
  421. package/packages/bundled-features/src/tier-engine/web/index.ts +0 -1
  422. package/packages/bundled-features/src/user/handlers/create.write.ts +1 -1
  423. package/packages/bundled-features/src/user/handlers/update-roles.ts +1 -1
  424. package/packages/bundled-features/src/user/handlers/update.write.ts +1 -1
  425. package/packages/bundled-features/src/user/index.ts +1 -1
  426. package/packages/bundled-features/src/user/invited-global-roles.ts +1 -1
  427. package/packages/bundled-features/src/user/schema/user.ts +1 -1
  428. package/packages/bundled-features/src/user/{constants.ts → web/constants.ts} +0 -1
  429. package/packages/bundled-features/src/user-data-rights/changes.json +14 -0
  430. package/packages/bundled-features/src/user-data-rights/env.ts +1 -1
  431. package/packages/bundled-features/src/user-data-rights/feature.ts +9 -9
  432. package/packages/bundled-features/src/user-data-rights/index.ts +1 -1
  433. package/packages/bundled-features/src/user-data-rights/lib/resolve-tenant-model.ts +1 -1
  434. package/packages/bundled-features/src/user-data-rights/mail-notifications.ts +1 -1
  435. package/packages/bundled-features/src/user-data-rights/web/client-plugin.tsx +2 -3
  436. package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +0 -1
  437. package/packages/bundled-features/src/user-data-rights/{constants.ts → web/constants.ts} +11 -12
  438. package/packages/bundled-features/src/user-data-rights/web/default-translations.ts +91 -0
  439. package/packages/bundled-features/src/user-data-rights/web/i18n.ts +41 -91
  440. package/packages/bundled-features/src/user-data-rights/web/index.ts +1 -2
  441. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -2
  442. package/packages/bundled-features/src/user-data-rights/web/public-deletion-gate.tsx +0 -1
  443. package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +0 -1
  444. package/packages/bundled-features/src/user-data-rights-defaults/hooks/file-ref.userdata-hook.ts +10 -1
  445. package/packages/bundled-features/src/user-profile/feature.ts +2 -2
  446. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +1 -1
  447. package/packages/bundled-features/src/user-profile/index.ts +3 -2
  448. package/packages/bundled-features/src/user-profile/web/client-plugin.ts +2 -3
  449. package/packages/bundled-features/src/user-profile/{constants.ts → web/constants.ts} +0 -1
  450. package/packages/bundled-features/src/user-profile/{i18n.ts → web/i18n.ts} +0 -1
  451. package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
  452. package/packages/bundled-features/src/waitlist/changes.json +6 -0
  453. package/packages/bundled-features/src/waitlist/entity.ts +1 -1
  454. package/packages/bundled-features/src/waitlist/feature.ts +5 -5
  455. package/packages/bundled-features/src/waitlist/handlers/export-purge.write.ts +3 -3
  456. package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +5 -1
  457. package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
  458. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +3 -3
  459. package/packages/bundled-features/src/waitlist/import.ts +1 -1
  460. package/packages/bundled-features/src/waitlist/index.ts +11 -11
  461. package/packages/bundled-features/src/waitlist/legacy-migrate.ts +1 -1
  462. package/packages/bundled-features/src/waitlist/link-on-signup.ts +1 -1
  463. package/packages/bundled-features/src/waitlist/mail.ts +7 -6
  464. package/packages/bundled-features/src/waitlist/payloads.ts +1 -1
  465. package/packages/bundled-features/src/waitlist/screens.ts +1 -1
  466. package/packages/bundled-features/src/waitlist/{constants.ts → web/constants.ts} +0 -1
  467. package/samples/apps/styleguide/src/features/content/web.tsx +0 -1
  468. package/samples/apps/ui-walkthrough/src/app/client.tsx +2 -0
  469. package/samples/apps/ui-walkthrough/src/app/seed-rental.ts +17 -1
  470. package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +11 -0
  471. package/samples/apps/ui-walkthrough/src/app/server.ts +2 -1
  472. package/samples/apps/ui-walkthrough/src/features/billing/feature.ts +35 -7
  473. package/samples/apps/ui-walkthrough/src/features/billing/i18n.ts +6 -0
  474. package/samples/apps/ui-walkthrough/src/features/rental/entities.ts +27 -0
  475. package/samples/apps/ui-walkthrough/src/features/rental/feature.ts +61 -7
  476. package/samples/apps/ui-walkthrough/src/features/rental/i18n.ts +48 -24
  477. package/samples/apps/ui-walkthrough/src/features/rental/invoice-receive.ts +0 -1
  478. package/samples/apps/ui-walkthrough/src/features/rental/lease-support.ts +17 -1
  479. package/samples/apps/ui-walkthrough/src/features/rental/qualified-names.ts +3 -0
  480. package/samples/apps/ui-walkthrough/src/features/rental/receipts-upload.ts +70 -0
  481. package/samples/apps/ui-walkthrough/src/features/rental/screens.ts +90 -13
  482. package/samples/apps/ui-walkthrough/src/features/rental/web/index.ts +0 -2
  483. package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +103 -0
  484. package/samples/apps/ui-walkthrough/src/features/subscription-plans/i18n.ts +36 -0
  485. package/samples/apps/ui-walkthrough/src/features/subscription-plans/index.ts +2 -0
  486. package/samples/apps/ui-walkthrough/src/features/subscription-plans/seed.ts +21 -0
  487. package/samples/apps/ui-walkthrough/src/run-config.ts +11 -0
  488. package/samples/apps/use-all-bundled/e2e-billing-gallery/server.ts +1 -1
  489. package/samples/apps/use-all-bundled/feature-manifest.json +4 -4
  490. package/samples/apps/use-all-bundled/scripts/check-coverage.ts +1 -1
  491. package/samples/apps/use-all-bundled/src/app/dev-app-options.ts +3 -1
  492. package/samples/recipes/compose-stacks/README.md +1 -2
  493. package/samples/recipes/embedded/README.md +5 -5
  494. package/samples/recipes/embedded/src/handlers/invoice-receive.write.ts +0 -1
  495. package/samples/recipes/embedded/src/screens/invoice-receive.screen.ts +9 -12
  496. package/samples/recipes/legal-pages/README.md +2 -2
  497. package/samples/recipes/legal-pages/src/feature.ts +1 -1
  498. package/samples/recipes/reference-data/src/feature.ts +3 -7
  499. package/packages/bundled-features/src/admin-shell/i18n.ts +0 -54
  500. package/packages/bundled-features/src/audit/i18n.ts +0 -25
  501. package/packages/bundled-features/src/auth-mfa/web/qrcode-browser.d.ts +0 -11
  502. package/packages/bundled-features/src/jobs/i18n.ts +0 -55
  503. package/packages/bundled-features/src/managed-pages/i18n.ts +0 -63
  504. package/packages/bundled-features/src/presets/dsgvo-self-service.ts +0 -35
  505. package/packages/bundled-features/src/user-data-rights/i18n.ts +0 -44
  506. package/samples/apps/ui-walkthrough/src/features/rental/web/upload-standard-layout.tsx +0 -61
@@ -6,6 +6,7 @@ import { escapeHtml, escapeHtmlAttr } from "@cosmicdrift/kumiko-renderer/headles
6
6
  import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
7
7
  import type { Context } from "hono";
8
8
  import { getCookie } from "hono/cookie";
9
+ import * as z from "zod";
9
10
  import {
10
11
  type PublicPageWrapLayout,
11
12
  redirectToCanonicalPath,
@@ -13,11 +14,16 @@ import {
13
14
  slashVariantOf,
14
15
  wrapInLayout,
15
16
  } from "../../page-render/index.ts";
16
- import { SubscriptionFoundationHandlers } from "../constants.ts";
17
17
  import { CONTRACT_TERMINATION_DECLARATION_TYPES, CONTRACT_TERMINATION_KINDS } from "../events.ts";
18
+ import { SubscriptionFoundationHandlers } from "../web/constants.ts";
18
19
  import type { ConsentLocale } from "./consent-text.ts";
19
20
  import { formatReceivedAt } from "./termination-mail.ts";
20
21
  import { requestContractTerminationSchema } from "./termination-request.ts";
22
+ import {
23
+ REVOCATION_PATHS,
24
+ type RevocationOutcome,
25
+ revokeContractTerminationSchema,
26
+ } from "./termination-revoke.ts";
21
27
  import { type PageTexts, TERMINATION_TEXTS } from "./termination-texts.ts";
22
28
 
23
29
  export type ContractTerminationRoutesOptions = {
@@ -77,6 +83,8 @@ function pageHeaders(): Record<string, string> {
77
83
  ...headers,
78
84
  "content-security-policy": `${headers["content-security-policy"] ?? ""}; frame-ancestors 'none'; form-action 'self'`,
79
85
  "x-frame-options": "DENY",
86
+ // The revoke link carries its token in the query string.
87
+ "referrer-policy": "no-referrer",
80
88
  };
81
89
  }
82
90
 
@@ -302,17 +310,19 @@ function reentryHeaders(c: Context): Headers {
302
310
  return headers;
303
311
  }
304
312
 
305
- async function submitDeclaration(
313
+ type PageApp = { fetch: (request: Request, env?: unknown) => Response | Promise<Response> };
314
+
315
+ async function dispatchAnonymousWrite(
306
316
  c: Context,
307
- app: { fetch: (request: Request, env?: unknown) => Response | Promise<Response> },
317
+ app: PageApp,
308
318
  clientIp: string,
309
- values: FormValues,
310
- locale: ConsentLocale,
311
- ): Promise<
312
- | { readonly kind: "received"; readonly requestId: string; readonly receivedAtIso: string }
313
- | { readonly kind: "rate-limited" }
314
- | { readonly kind: "failed" }
315
- > {
319
+ type: string,
320
+ payload: Record<string, string>,
321
+ ): Promise<{
322
+ readonly rateLimited: boolean;
323
+ readonly ok: boolean;
324
+ readonly data: WriteResponseBody["data"];
325
+ }> {
316
326
  // deps.write only resolves a session user under /api/*; this page lives
317
327
  // outside it, so it re-enters the dispatcher through the app like the
318
328
  // user-export by-token route. The resolved clientIp as env keeps the
@@ -323,30 +333,158 @@ async function submitDeclaration(
323
333
  new Request(`${new URL(c.req.url).origin}/api/write`, {
324
334
  method: "POST",
325
335
  headers: reentryHeaders(c),
326
- body: JSON.stringify({
327
- type: SubscriptionFoundationHandlers.requestContractTermination,
328
- payload: payloadOf(values, locale),
329
- }),
336
+ body: JSON.stringify({ type, payload }),
330
337
  }),
331
338
  clientIp,
332
339
  );
333
340
  const parsed: WriteResponseBody | null = await response.json().catch(() => null);
334
- if (response.status === 429 || parsed?.error?.code === RATE_LIMITED_CODE) {
335
- return { kind: "rate-limited" };
336
- }
337
- const requestId = parsed?.data?.requestId;
338
- const receivedAtIso = parsed?.data?.receivedAtIso;
339
- if (
340
- response.ok &&
341
- parsed?.isSuccess === true &&
342
- typeof requestId === "string" &&
343
- typeof receivedAtIso === "string"
344
- ) {
341
+ return {
342
+ rateLimited: response.status === 429 || parsed?.error?.code === RATE_LIMITED_CODE,
343
+ ok: response.ok && parsed?.isSuccess === true,
344
+ data: parsed?.data,
345
+ };
346
+ }
347
+
348
+ async function submitDeclaration(
349
+ c: Context,
350
+ app: PageApp,
351
+ clientIp: string,
352
+ values: FormValues,
353
+ locale: ConsentLocale,
354
+ ): Promise<
355
+ | { readonly kind: "received"; readonly requestId: string; readonly receivedAtIso: string }
356
+ | { readonly kind: "rate-limited" }
357
+ | { readonly kind: "failed" }
358
+ > {
359
+ const response = await dispatchAnonymousWrite(
360
+ c,
361
+ app,
362
+ clientIp,
363
+ SubscriptionFoundationHandlers.requestContractTermination,
364
+ payloadOf(values, locale),
365
+ );
366
+ if (response.rateLimited) return { kind: "rate-limited" };
367
+ const requestId = response.data?.requestId;
368
+ const receivedAtIso = response.data?.receivedAtIso;
369
+ if (response.ok && typeof requestId === "string" && typeof receivedAtIso === "string") {
345
370
  return { kind: "received", requestId, receivedAtIso };
346
371
  }
347
372
  return { kind: "failed" };
348
373
  }
349
374
 
375
+ const revocationOutcomeSchema = z.object({
376
+ outcome: z.enum(["revoked", "already-revoked", "too-late", "invalid"]),
377
+ });
378
+
379
+ type RevocationLinkValues = z.infer<typeof revokeContractTerminationSchema>;
380
+
381
+ // Missing or malformed link parameters answer like a wrong token.
382
+ function revocationValuesOf(source: Record<string, unknown>): RevocationLinkValues | null {
383
+ const text = (key: string): string => {
384
+ const value = source[key];
385
+ return typeof value === "string" ? value : "";
386
+ };
387
+ const parsed = revokeContractTerminationSchema.safeParse({
388
+ requestId: text("r"),
389
+ token: text("t"),
390
+ tenantId: text("tenant"),
391
+ });
392
+ return parsed.success ? parsed.data : null;
393
+ }
394
+
395
+ async function submitRevocation(
396
+ c: Context,
397
+ app: PageApp,
398
+ clientIp: string,
399
+ values: RevocationLinkValues,
400
+ ): Promise<RevocationOutcome | "rate-limited"> {
401
+ const response = await dispatchAnonymousWrite(
402
+ c,
403
+ app,
404
+ clientIp,
405
+ SubscriptionFoundationHandlers.revokeContractTermination,
406
+ values,
407
+ );
408
+ if (response.rateLimited) return "rate-limited";
409
+ const outcome = revocationOutcomeSchema.safeParse(response.data);
410
+ return response.ok && outcome.success ? outcome.data.outcome : "invalid";
411
+ }
412
+
413
+ function revokeConfirmPage(
414
+ ctx: PageContext,
415
+ revokePath: string,
416
+ values: RevocationLinkValues,
417
+ ): Response {
418
+ const { revoke } = TERMINATION_TEXTS[ctx.locale].page;
419
+ const hidden = (
420
+ [
421
+ ["r", values.requestId],
422
+ ["t", values.token],
423
+ ["tenant", values.tenantId],
424
+ ] as const
425
+ )
426
+ .map(
427
+ ([name, value]) =>
428
+ `<input type="hidden" name="${escapeHtmlAttr(name)}" value="${escapeHtmlAttr(value ?? "")}">`,
429
+ )
430
+ .join("\n");
431
+ const body = `<h1>${escapeHtml(revoke.confirmTitle)}</h1>
432
+ <p>${escapeHtml(revoke.confirmLead)}</p>
433
+ <form method="post" action="${escapeHtmlAttr(revokePath)}" data-kumiko-form="contract-termination-revoke">
434
+ ${hidden}
435
+ <button type="submit" data-kumiko-button="revoke">${escapeHtml(revoke.confirmButton)}</button>
436
+ </form>`;
437
+ return htmlResponse(ctx, revoke.confirmTitle, body, 200);
438
+ }
439
+
440
+ function revokeResultPage(ctx: PageContext, outcome: RevocationOutcome | "rate-limited"): Response {
441
+ const { page } = TERMINATION_TEXTS[ctx.locale];
442
+ const { revoke } = page;
443
+ const simple = (title: string, text: string, status: 200 | 400 | 429): Response =>
444
+ htmlResponse(ctx, title, `<h1>${escapeHtml(title)}</h1><p>${escapeHtml(text)}</p>`, status);
445
+ switch (outcome) {
446
+ case "revoked":
447
+ return simple(revoke.revokedTitle, revoke.revokedBody, 200);
448
+ case "already-revoked":
449
+ return simple(revoke.alreadyRevokedTitle, revoke.alreadyRevokedBody, 200);
450
+ case "too-late":
451
+ return simple(revoke.tooLateTitle, revoke.tooLateBody, 200);
452
+ case "rate-limited":
453
+ return simple(page.rateLimitedTitle, page.rateLimitedBody, 429);
454
+ case "invalid":
455
+ return simple(revoke.invalidTitle, revoke.invalidBody, 400);
456
+ }
457
+ }
458
+
459
+ // GET only renders the confirmation form: mail scanners prefetch links, so the
460
+ // state change waits for the POST.
461
+ function revokeRoutesFor(ctx: PageContext): AnonymousExtraRoute[] {
462
+ const revokePath = REVOCATION_PATHS[ctx.locale];
463
+ return [
464
+ {
465
+ method: "GET",
466
+ path: revokePath,
467
+ entry: "anonymous",
468
+ handler: (c) => {
469
+ const values = revocationValuesOf(c.req.query());
470
+ return values === null
471
+ ? revokeResultPage(ctx, "invalid")
472
+ : revokeConfirmPage(ctx, revokePath, values);
473
+ },
474
+ },
475
+ {
476
+ method: "POST",
477
+ path: revokePath,
478
+ entry: "anonymous",
479
+ handler: async (c, deps) => {
480
+ const values = revocationValuesOf(await c.req.parseBody());
481
+ if (values === null) return revokeResultPage(ctx, "invalid");
482
+ return revokeResultPage(ctx, await submitRevocation(c, deps.app, deps.clientIp, values));
483
+ },
484
+ },
485
+ ];
486
+ }
487
+
350
488
  function routesFor(ctx: PageContext): AnonymousExtraRoute[] {
351
489
  const { locale, path } = ctx;
352
490
  const slashVariant = slashVariantOf(path);
@@ -409,7 +547,8 @@ export function createContractTerminationRoutes(
409
547
  en: options.paths?.en ?? DEFAULT_PATHS.en,
410
548
  };
411
549
  const wrapLayout = options.wrapLayout ?? wrapInLayout;
412
- return (["de", "en"] as const).flatMap((locale) =>
413
- routesFor({ locale, path: alternates[locale], wrapLayout, alternates }),
414
- );
550
+ return (["de", "en"] as const).flatMap((locale) => {
551
+ const pageContext = { locale, path: alternates[locale], wrapLayout, alternates };
552
+ return [...routesFor(pageContext), ...revokeRoutesFor(pageContext)];
553
+ });
415
554
  }
@@ -14,25 +14,30 @@ import { UnprocessableError } from "@cosmicdrift/kumiko-framework/errors";
14
14
  import * as z from "zod";
15
15
  import { subscriptionAggregateId, terminationUnmatchedAggregateId } from "../aggregate-id.ts";
16
16
  import { resolveProviderPlugin } from "../checkout-core.ts";
17
- import { isTerminalSubscriptionStatus, SubscriptionCancelTimings } from "../constants.ts";
18
17
  import {
19
18
  CONTRACT_TERMINATION_CHANNELS,
20
19
  CONTRACT_TERMINATION_DECLARATION_TYPES,
21
20
  CONTRACT_TERMINATION_DECLARED_EVENT_QN,
22
21
  CONTRACT_TERMINATION_KINDS,
23
22
  CONTRACT_TERMINATION_REQUESTED_EVENT_QN,
23
+ CONTRACT_TERMINATION_REVOKED_EVENT_QN,
24
24
  CONTRACT_TERMINATION_UNMATCHED_AGGREGATE_TYPE,
25
25
  CONTRACT_TERMINATION_UNMATCHED_EVENT_QN,
26
26
  type ContractTerminationDeclaredPayload,
27
27
  type ContractTerminationRequestedPayload,
28
28
  type ContractTerminationUnmatchedPayload,
29
29
  contractTerminationRequestedPayloadSchema,
30
+ contractTerminationRevokedPayloadSchema,
30
31
  type ProviderCancelOutcome,
31
32
  SUBSCRIPTION_AGGREGATE_TYPE,
32
33
  } from "../events.ts";
33
- import { getSubscriptionForTenant } from "../get-subscription-for-tenant.ts";
34
+ import { getSubscriptionForTenant, type SubscriptionView } from "../get-subscription-for-tenant.ts";
34
35
  import type { ConsumerProtectionOptions, ResolvedBillingFoundationOptions } from "../types.ts";
35
- import { CONSENT_LOCALES, FALLBACK_CONSENT_LOCALE } from "./consent-locale.ts";
36
+ import { isTerminalSubscriptionStatus, SubscriptionCancelTimings } from "../web/constants.ts";
37
+ import {
38
+ CONSENT_LOCALES,
39
+ FALLBACK_CONSENT_LOCALE,
40
+ } from "../web/consumer-protection/consent-locale.ts";
36
41
  import { notifyOperator } from "./termination-notify.ts";
37
42
  import type { OperatorNoticeReason } from "./termination-texts.ts";
38
43
  import { isWithinWithdrawalPeriod } from "./withdrawal-period.ts";
@@ -64,6 +69,7 @@ export const declareContractTerminationSchema = z
64
69
  terminationKind: z.enum(CONTRACT_TERMINATION_KINDS),
65
70
  receivedAtIso: z.string().min(1),
66
71
  locale: z.enum(CONSENT_LOCALES),
72
+ revocationTokenHash: z.string().length(64).optional(),
67
73
  })
68
74
  .strict();
69
75
 
@@ -170,6 +176,51 @@ export function createDeclareContractTerminationHandler(): WriteHandlerDef {
170
176
  };
171
177
  }
172
178
 
179
+ function revokedRecordResult(receivedAtIso: string) {
180
+ return {
181
+ isSuccess: true as const,
182
+ data: {
183
+ receivedAtIso,
184
+ effectiveAtIso: null,
185
+ providerCancel: "none",
186
+ noticeReason: null,
187
+ withdrawalPeriodExpired: false,
188
+ } satisfies RecordContractTerminationResult,
189
+ };
190
+ }
191
+
192
+ // A revocation that landed during the provider cancel found nothing to take back yet.
193
+ async function takeBackLateRevokedCancel(
194
+ ctx: HandlerContext,
195
+ consumerProtection: ConsumerProtectionOptions,
196
+ args: {
197
+ readonly payload: z.infer<typeof recordContractTerminationSchema>;
198
+ readonly tenantId: string;
199
+ readonly receivedAtIso: string;
200
+ readonly providerCancel: ProviderCancelOutcome;
201
+ },
202
+ ): Promise<void> {
203
+ const { payload, tenantId, receivedAtIso, providerCancel } = args;
204
+ // skip: nothing was cancelled at the provider, nothing to resume
205
+ if (providerCancel !== "period-end") return;
206
+ const reasons = await resumeAtProvider(ctx, await getSubscriptionForTenant(ctx, tenantId));
207
+ // skip: resumed cleanly, the revocation notice already tells the operator
208
+ if (reasons.length === 0) return;
209
+ await notifyOperator(ctx, consumerProtection, {
210
+ locale: payload.locale ?? FALLBACK_CONSENT_LOCALE,
211
+ requestId: payload.requestId,
212
+ receivedAtIso,
213
+ channel: "public",
214
+ declaration: {
215
+ declarationType: payload.declarationType,
216
+ terminationKind: payload.terminationKind,
217
+ },
218
+ reasons,
219
+ tenantId,
220
+ providerCancel,
221
+ });
222
+ }
223
+
173
224
  export function createRecordContractTerminationHandler(
174
225
  options: ResolvedBillingFoundationOptions,
175
226
  consumerProtection: ConsumerProtectionOptions,
@@ -218,6 +269,11 @@ export function createRecordContractTerminationHandler(
218
269
  };
219
270
  }
220
271
 
272
+ // A revoked public declaration never reaches the provider.
273
+ if (hasRevocation(stream.events, payload.requestId)) {
274
+ return revokedRecordResult(receivedAtIso);
275
+ }
276
+
221
277
  const withdrawalPeriodExpired =
222
278
  payload.declarationType === "withdrawal" &&
223
279
  payload.when === SubscriptionCancelTimings.immediately &&
@@ -245,6 +301,16 @@ export function createRecordContractTerminationHandler(
245
301
  aggregateId: subscriptionAggregateId(tenantId),
246
302
  aggregateType: SUBSCRIPTION_AGGREGATE_TYPE,
247
303
  });
304
+ // A revocation that landed during the provider call found no cancel to take back.
305
+ if (hasRevocation(streamAfterProviderCall.events, payload.requestId)) {
306
+ await takeBackLateRevokedCancel(ctx, consumerProtection, {
307
+ payload,
308
+ tenantId,
309
+ receivedAtIso,
310
+ providerCancel,
311
+ });
312
+ return revokedRecordResult(receivedAtIso);
313
+ }
248
314
  await streamAfterProviderCall.appendOne({
249
315
  type: CONTRACT_TERMINATION_REQUESTED_EVENT_QN,
250
316
  payload: recorded,
@@ -282,6 +348,39 @@ export function createRecordContractTerminationHandler(
282
348
  };
283
349
  }
284
350
 
351
+ export function hasRevocation(
352
+ events: readonly { type: string; payload: unknown }[],
353
+ requestId: string,
354
+ ) {
355
+ return events.some(
356
+ (e) =>
357
+ e.type === CONTRACT_TERMINATION_REVOKED_EVENT_QN &&
358
+ contractTerminationRevokedPayloadSchema.safeParse(e.payload).data?.requestId === requestId,
359
+ );
360
+ }
361
+
362
+ export async function resumeAtProvider(
363
+ ctx: HandlerContext,
364
+ subscription: SubscriptionView | null,
365
+ ): Promise<OperatorNoticeReason[]> {
366
+ if (subscription === null || isTerminalSubscriptionStatus(subscription.status)) {
367
+ return ["revocation_resume_manual"];
368
+ }
369
+ const plugin = findPlugin(ctx, subscription.providerName);
370
+ if (!plugin?.resumeSubscription) return ["revocation_resume_manual"];
371
+ try {
372
+ await plugin.resumeSubscription(ctx, {
373
+ providerSubscriptionId: subscription.providerSubscriptionId,
374
+ });
375
+ } catch (error) {
376
+ ctx.log?.warn(
377
+ `[billing-foundation:revoke-contract-termination] provider resume failed: ${error instanceof Error ? error.message : String(error)}`,
378
+ );
379
+ return ["revocation_resume_failed"];
380
+ }
381
+ return [];
382
+ }
383
+
285
384
  function findPlugin(ctx: Parameters<typeof resolveProviderPlugin>[0], providerName: string) {
286
385
  try {
287
386
  return resolveProviderPlugin(ctx, providerName).plugin;
@@ -15,12 +15,6 @@ import { generateId } from "@cosmicdrift/kumiko-framework/utils";
15
15
  import * as z from "zod";
16
16
  import { TenantQueries } from "../../tenant/index.ts";
17
17
  import { UserQueries } from "../../user/index.ts";
18
- import {
19
- CONTRACT_TERMINATION_RECEIPT_NOTIFICATION_TYPE,
20
- SubscriptionCancelTimings,
21
- SubscriptionFoundationHandlers,
22
- SubscriptionFoundationQueries,
23
- } from "../constants.ts";
24
18
  import {
25
19
  CONTRACT_TERMINATION_DECLARATION_TYPES,
26
20
  CONTRACT_TERMINATION_KINDS,
@@ -30,11 +24,19 @@ import {
30
24
  } from "../events.ts";
31
25
  import { purchaseRolesOf } from "../plan-catalog.ts";
32
26
  import type { ConsumerProtectionOptions, ResolvedBillingFoundationOptions } from "../types.ts";
27
+ import {
28
+ CONTRACT_TERMINATION_RECEIPT_NOTIFICATION_TYPE,
29
+ SubscriptionCancelTimings,
30
+ SubscriptionFoundationHandlers,
31
+ SubscriptionFoundationQueries,
32
+ } from "../web/constants.ts";
33
33
  import { resolveConsentLocale } from "./consent-text.ts";
34
+ import { openStoredUserEmail } from "./stored-user-email.ts";
34
35
  import { type TerminationDeclaration, terminationReceiptVariables } from "./termination-mail.ts";
35
36
  import { notifyOperator, type OperatorNoticePlan, requireNotify } from "./termination-notify.ts";
36
37
  import { mayMailReceipt } from "./termination-receipt-limit.ts";
37
38
  import type { RecordContractTerminationResult } from "./termination-record.ts";
39
+ import { createRevocationToken, revocationUrl } from "./termination-revoke.ts";
38
40
  import type { OperatorNoticeReason } from "./termination-texts.ts";
39
41
 
40
42
  const EXTRAORDINARY_REASON_MESSAGE = "reason is required for an extraordinary termination";
@@ -102,7 +104,10 @@ function needsOperatorNotice(declaration: {
102
104
  ];
103
105
  }
104
106
 
105
- type TerminationMailPlan = OperatorNoticePlan & { readonly declaration: TerminationDeclaration };
107
+ type TerminationMailPlan = OperatorNoticePlan & {
108
+ readonly declaration: TerminationDeclaration;
109
+ readonly revokeUrl?: string;
110
+ };
106
111
 
107
112
  async function sendTerminationMails(
108
113
  ctx: HandlerContext,
@@ -122,6 +127,7 @@ async function sendTerminationMails(
122
127
  terminationKind: plan.declaration.terminationKind,
123
128
  },
124
129
  operatorEmail: consumerProtection.operatorEmail,
130
+ ...(plan.revokeUrl !== undefined && { revokeUrl: plan.revokeUrl }),
125
131
  }),
126
132
  locale: plan.locale,
127
133
  priority: "critical",
@@ -132,7 +138,8 @@ async function sendTerminationMails(
132
138
  : [...plan.reasons, "receipt_rate_limited" as const];
133
139
  // skip: no operator notice needed for this declaration
134
140
  if (reasons.length === 0) return;
135
- await notifyOperator(ctx, consumerProtection, { ...plan, reasons });
141
+ const { revokeUrl: _revokeUrl, ...noticePlan } = plan;
142
+ await notifyOperator(ctx, consumerProtection, { ...noticePlan, reasons });
136
143
  }
137
144
 
138
145
  // Tenants the entered email can terminate a contract for: tenants where the
@@ -205,6 +212,7 @@ export function createRequestContractTerminationHandler(
205
212
  const reasons: OperatorNoticeReason[] = [];
206
213
  const locale = resolveConsentLocale(payload.locale);
207
214
  let matchedTenantId: string | undefined;
215
+ let revokeUrl: string | undefined;
208
216
 
209
217
  const candidates = await findTerminableTenantIds(
210
218
  ctx,
@@ -215,12 +223,30 @@ export function createRequestContractTerminationHandler(
215
223
  const [onlyCandidate] = candidates;
216
224
  if (candidates.length === 1 && onlyCandidate !== undefined) {
217
225
  matchedTenantId = onlyCandidate;
226
+ const revocation = createRevocationToken();
218
227
  const declared = await ctx.writeAs(
219
228
  createSystemUser(onlyCandidate),
220
229
  SubscriptionFoundationHandlers.declareContractTermination,
221
- { requestId, declarationType, terminationKind, receivedAtIso, locale },
230
+ {
231
+ requestId,
232
+ declarationType,
233
+ terminationKind,
234
+ receivedAtIso,
235
+ locale,
236
+ revocationTokenHash: revocation.tokenHash,
237
+ },
222
238
  );
223
- if (!declared.isSuccess) reasons.push("recording_failed");
239
+ if (!declared.isSuccess) {
240
+ reasons.push("recording_failed");
241
+ } else if (options.baseUrl !== undefined) {
242
+ revokeUrl = revocationUrl({
243
+ baseUrl: options.baseUrl,
244
+ locale,
245
+ requestId,
246
+ token: revocation.token,
247
+ tenantId: onlyCandidate,
248
+ });
249
+ }
224
250
  } else {
225
251
  reasons.push(candidates.length === 0 ? "unmatched" : "ambiguous");
226
252
  const recorded = await ctx.writeAs(
@@ -255,6 +281,7 @@ export function createRequestContractTerminationHandler(
255
281
  },
256
282
  reasons,
257
283
  ...(matchedTenantId !== undefined && { tenantId: matchedTenantId }),
284
+ ...(revokeUrl !== undefined && { revokeUrl }),
258
285
  });
259
286
 
260
287
  return {
@@ -291,7 +318,11 @@ export function createTerminateContractHandler(
291
318
  id: event.user.id,
292
319
  }),
293
320
  );
294
- if (!caller.success || !caller.data.email || caller.data.isDeleted === true) {
321
+ const callerEmail =
322
+ caller.success && caller.data.email && caller.data.isDeleted !== true
323
+ ? await openStoredUserEmail(caller.data.email, "billing-foundation:terminate-contract")
324
+ : null;
325
+ if (callerEmail === null) {
295
326
  throw new InternalError({
296
327
  message: "billing-foundation:terminate-contract: calling user has no email on record",
297
328
  });
@@ -323,7 +354,7 @@ export function createTerminateContractHandler(
323
354
  declaration: {
324
355
  declarationType,
325
356
  terminationKind,
326
- email: caller.data.email,
357
+ email: callerEmail,
327
358
  ...(payload.reason !== undefined && { reason: payload.reason }),
328
359
  },
329
360
  reasons: [