@cosmicdrift/kumiko-samples 0.413.1 → 0.415.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 (479) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +16 -1
  3. package/packages/bundled-features/src/admin-shell/changes.json +6 -0
  4. package/packages/bundled-features/src/admin-shell/feature.ts +8 -7
  5. package/packages/bundled-features/src/agent-tools/agent-doc-lint.ts +5 -1
  6. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +36 -27
  7. package/packages/bundled-features/src/agent-tools/api-docs/collect-events.ts +8 -1
  8. package/packages/bundled-features/src/agent-tools/api-docs/collect.ts +3 -2
  9. package/packages/bundled-features/src/agent-tools/api-docs/generate.ts +6 -0
  10. package/packages/bundled-features/src/agent-tools/api-docs/index.ts +1 -0
  11. package/packages/bundled-features/src/agent-tools/api-docs/problems.ts +38 -1
  12. package/packages/bundled-features/src/agent-tools/api-docs/render-openapi.ts +1 -0
  13. package/packages/bundled-features/src/agent-tools/api-docs/resolve-config.ts +17 -0
  14. package/packages/bundled-features/src/agent-tools/api-docs/scope-slug-collisions.ts +17 -0
  15. package/packages/bundled-features/src/agent-tools/api-docs/translation-gaps.ts +42 -0
  16. package/packages/bundled-features/src/agent-tools/api-docs/webhook-example-problems.ts +30 -0
  17. package/packages/bundled-features/src/agent-tools/changes.json +12 -0
  18. package/packages/bundled-features/src/agent-tools/index.ts +1 -0
  19. package/packages/bundled-features/src/agent-tools/labels.ts +19 -6
  20. package/packages/bundled-features/src/agent-tools/tool-catalog.ts +18 -7
  21. package/packages/bundled-features/src/agent-tools/tool-dispatch.ts +14 -1
  22. package/packages/bundled-features/src/agent-tools/types.ts +4 -0
  23. package/packages/bundled-features/src/audit/event-classification.ts +6 -0
  24. package/packages/bundled-features/src/audit/web/i18n.ts +1 -0
  25. package/packages/bundled-features/src/auth-email-password/changes.json +18 -0
  26. package/packages/bundled-features/src/auth-email-password/errors.ts +0 -13
  27. package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +147 -121
  28. package/packages/bundled-features/src/auth-email-password/handlers/login-options.query.ts +1 -1
  29. package/packages/bundled-features/src/auth-email-password/handlers/request-account-unlock.write.ts +1 -1
  30. package/packages/bundled-features/src/auth-email-password/handlers/request-email-verification.write.ts +0 -1
  31. package/packages/bundled-features/src/auth-email-password/handlers/request-password-reset.write.ts +0 -1
  32. package/packages/bundled-features/src/auth-email-password/handlers/self-registration-status.query.ts +1 -1
  33. package/packages/bundled-features/src/auth-email-password/reset-token.ts +0 -2
  34. package/packages/bundled-features/src/auth-email-password/seeding.ts +39 -7
  35. package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +2 -3
  36. package/packages/bundled-features/src/auth-email-password/unlock-token.ts +0 -2
  37. package/packages/bundled-features/src/auth-email-password/verification-token.ts +0 -2
  38. package/packages/bundled-features/src/auth-email-password/web/auth-form-primitives.tsx +2 -2
  39. package/packages/bundled-features/src/auth-email-password/web/auth-gate.tsx +2 -2
  40. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +5 -0
  41. package/packages/bundled-features/src/auth-email-password/web/forgot-password-screen.tsx +1 -6
  42. package/packages/bundled-features/src/auth-email-password/web/invite-accept-screen.tsx +1 -1
  43. package/packages/bundled-features/src/auth-email-password/web/return-path.ts +2 -1
  44. package/packages/bundled-features/src/auth-email-password/web/session.tsx +12 -13
  45. package/packages/bundled-features/src/auth-email-password/web/signup-screen.tsx +1 -6
  46. package/packages/bundled-features/src/auth-email-password/web/static-account.ts +6 -1
  47. package/packages/bundled-features/src/auth-email-password/web/tenant-switcher.tsx +1 -1
  48. package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +4 -5
  49. package/packages/bundled-features/src/auth-email-password/web/user-menu.tsx +1 -1
  50. package/packages/bundled-features/src/auth-mfa/changes.json +6 -0
  51. package/packages/bundled-features/src/auth-mfa/web/mfa-code-or-recovery-field.tsx +17 -1
  52. package/packages/bundled-features/src/auth-mfa/web/mfa-disable-dialog.tsx +1 -1
  53. package/packages/bundled-features/src/auth-mfa/web/mfa-regenerate-recovery-dialog.tsx +1 -1
  54. package/packages/bundled-features/src/auth-mfa/web/mfa-setup-preauth-screen.tsx +1 -1
  55. package/packages/bundled-features/src/auth-mfa/web/mfa-verify-screen.tsx +16 -47
  56. package/packages/bundled-features/src/auth-mfa-user-data/index.ts +5 -6
  57. package/packages/bundled-features/src/billing-foundation/aggregate-id.ts +0 -4
  58. package/packages/bundled-features/src/billing-foundation/changes.json +61 -0
  59. package/packages/bundled-features/src/billing-foundation/checkout-core.ts +19 -1
  60. package/packages/bundled-features/src/billing-foundation/checkout-ledger.ts +67 -0
  61. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +2 -1
  62. package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-text.ts +49 -2
  63. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +5 -0
  64. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-timeout.ts +23 -0
  65. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +12 -7
  66. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +1 -1
  67. package/packages/bundled-features/src/billing-foundation/events.ts +51 -10
  68. package/packages/bundled-features/src/billing-foundation/feature.ts +15 -1
  69. package/packages/bundled-features/src/billing-foundation/handlers/billing-plans.query.ts +47 -14
  70. package/packages/bundled-features/src/billing-foundation/handlers/create-checkout-session.write.ts +9 -1
  71. package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +183 -17
  72. package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +35 -10
  73. package/packages/bundled-features/src/billing-foundation/handlers/record-checkout-opened.write.ts +25 -0
  74. package/packages/bundled-features/src/billing-foundation/handlers/start-plan-checkout.write.ts +9 -1
  75. package/packages/bundled-features/src/billing-foundation/handlers/switch-plan.write.ts +16 -4
  76. package/packages/bundled-features/src/billing-foundation/i18n.ts +3 -0
  77. package/packages/bundled-features/src/billing-foundation/pending-plan-switch.ts +80 -0
  78. package/packages/bundled-features/src/billing-foundation/scrub-raw-payload-headers.ts +50 -0
  79. package/packages/bundled-features/src/billing-foundation/types.ts +47 -30
  80. package/packages/bundled-features/src/billing-foundation/validate-options.ts +18 -0
  81. package/packages/bundled-features/src/billing-foundation/web/billing-plans-panel.tsx +10 -5
  82. package/packages/bundled-features/src/billing-foundation/web/cancel-contract-dialog.tsx +1 -1
  83. package/packages/bundled-features/src/billing-foundation/web/checkout-consent-dialog.tsx +1 -1
  84. package/packages/bundled-features/src/billing-foundation/web/constants.ts +5 -2
  85. package/packages/bundled-features/src/billing-foundation/web/plan-switch-confirm-dialog.tsx +1 -1
  86. package/packages/bundled-features/src/billing-foundation/webhook-handler.ts +65 -17
  87. package/packages/bundled-features/src/cap-counter/aggregate-id.ts +0 -2
  88. package/packages/bundled-features/src/cap-counter/changes.json +6 -0
  89. package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +19 -4
  90. package/packages/bundled-features/src/cap-overview/changes.json +6 -0
  91. package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +22 -6
  92. package/packages/bundled-features/src/cap-overview/i18n.ts +1 -0
  93. package/packages/bundled-features/src/cap-overview/index.ts +1 -0
  94. package/packages/bundled-features/src/cap-overview/types.ts +11 -1
  95. package/packages/bundled-features/src/cap-overview/web/cap-cards-panel.tsx +6 -2
  96. package/packages/bundled-features/src/cap-overview/web/cap-usage-bar.tsx +10 -1
  97. package/packages/bundled-features/src/cap-overview/web/usage-math.ts +5 -0
  98. package/packages/bundled-features/src/channel-in-app/changes.json +6 -0
  99. package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +2 -2
  100. package/packages/bundled-features/src/channel-whatsapp/aggregate-id.ts +29 -0
  101. package/packages/bundled-features/src/channel-whatsapp/changes.json +32 -0
  102. package/packages/bundled-features/src/channel-whatsapp/constants.ts +46 -0
  103. package/packages/bundled-features/src/channel-whatsapp/events.ts +94 -0
  104. package/packages/bundled-features/src/channel-whatsapp/feature.ts +72 -0
  105. package/packages/bundled-features/src/channel-whatsapp/graph-client.ts +398 -0
  106. package/packages/bundled-features/src/channel-whatsapp/in-memory-meta.ts +300 -0
  107. package/packages/bundled-features/src/channel-whatsapp/inbound-handlers.ts +210 -0
  108. package/packages/bundled-features/src/channel-whatsapp/index.ts +66 -0
  109. package/packages/bundled-features/src/channel-whatsapp/meta-signature.ts +26 -0
  110. package/packages/bundled-features/src/channel-whatsapp/options.ts +149 -0
  111. package/packages/bundled-features/src/channel-whatsapp/pii.ts +109 -0
  112. package/packages/bundled-features/src/channel-whatsapp/webhook-normalize.ts +247 -0
  113. package/packages/bundled-features/src/channel-whatsapp/webhook-routes.ts +185 -0
  114. package/packages/bundled-features/src/compliance-profiles/changes.json +5 -0
  115. package/packages/bundled-features/src/compliance-profiles/handlers/set-profile.write.ts +2 -0
  116. package/packages/bundled-features/src/compliance-profiles/handlers/sub-processors.query.ts +1 -1
  117. package/packages/bundled-features/src/config/changes.json +12 -0
  118. package/packages/bundled-features/src/config/handlers/set.write.ts +7 -0
  119. package/packages/bundled-features/src/config/handlers/values.query.ts +8 -1
  120. package/packages/bundled-features/src/config/index.ts +1 -0
  121. package/packages/bundled-features/src/config/read-redaction.ts +6 -3
  122. package/packages/bundled-features/src/config/table.ts +1 -0
  123. package/packages/bundled-features/src/config/write-helpers.ts +3 -2
  124. package/packages/bundled-features/src/crypto-shredding/changes.json +18 -0
  125. package/packages/bundled-features/src/crypto-shredding/constants.ts +2 -0
  126. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +38 -18
  127. package/packages/bundled-features/src/crypto-shredding/index.ts +4 -0
  128. package/packages/bundled-features/src/crypto-shredding/subject-forget-after-delete-hook.ts +49 -0
  129. package/packages/bundled-features/src/custom-fields/aggregate-id.ts +0 -1
  130. package/packages/bundled-features/src/custom-fields/entity.ts +1 -0
  131. package/packages/bundled-features/src/custom-fields/wire-for-entity.ts +0 -1
  132. package/packages/bundled-features/src/data-retention/changes.json +12 -0
  133. package/packages/bundled-features/src/data-retention/erase-notes-of-deleted-row.ts +23 -0
  134. package/packages/bundled-features/src/data-retention/feature.ts +2 -5
  135. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +38 -18
  136. package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +9 -0
  137. package/packages/bundled-features/src/delivery/attempt-log-factory.ts +11 -0
  138. package/packages/bundled-features/src/delivery/attempt-log.ts +3 -3
  139. package/packages/bundled-features/src/delivery/changes.json +12 -0
  140. package/packages/bundled-features/src/delivery/channel-context.ts +6 -3
  141. package/packages/bundled-features/src/delivery/db/queries/preferences.ts +0 -1
  142. package/packages/bundled-features/src/delivery/delivery-service.ts +3 -0
  143. package/packages/bundled-features/src/delivery/feature.ts +4 -13
  144. package/packages/bundled-features/src/delivery/handlers/opted-in-user-ids.query.ts +54 -0
  145. package/packages/bundled-features/src/delivery/handlers/preferences.query.ts +2 -20
  146. package/packages/bundled-features/src/delivery/handlers/resubscribe-user.write.ts +2 -25
  147. package/packages/bundled-features/src/delivery/handlers/unsubscribe-page-chrome.query.ts +2 -0
  148. package/packages/bundled-features/src/delivery/handlers/unsubscribe-user.write.ts +2 -27
  149. package/packages/bundled-features/src/delivery/index.ts +3 -1
  150. package/packages/bundled-features/src/delivery/options.ts +11 -0
  151. package/packages/bundled-features/src/delivery/preference-rows.ts +33 -0
  152. package/packages/bundled-features/src/delivery/set-preference-enabled.ts +40 -0
  153. package/packages/bundled-features/src/delivery/testing.ts +3 -1
  154. package/packages/bundled-features/src/delivery/types.ts +1 -0
  155. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +7 -1
  156. package/packages/bundled-features/src/delivery/upsert-preference.ts +0 -1
  157. package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
  158. package/packages/bundled-features/src/derivatives-sharp/render.ts +9 -9
  159. package/packages/bundled-features/src/document-ingest-foundation/aggregate-id.ts +0 -1
  160. package/packages/bundled-features/src/document-ingest-foundation/append-missing-extract-event.ts +37 -25
  161. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  162. package/packages/bundled-features/src/document-ingest-foundation/feature.ts +1 -0
  163. package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +34 -14
  164. package/packages/bundled-features/src/documents/aggregate-id.ts +0 -2
  165. package/packages/bundled-features/src/documents/changes.json +24 -0
  166. package/packages/bundled-features/src/documents/constants.ts +10 -2
  167. package/packages/bundled-features/src/documents/ensure-link.ts +3 -4
  168. package/packages/bundled-features/src/documents/feature.ts +33 -6
  169. package/packages/bundled-features/src/documents/handlers/import.write.ts +2 -2
  170. package/packages/bundled-features/src/documents/queries/expiry-overview.query.ts +2 -1
  171. package/packages/bundled-features/src/documents/queries/for-record.query.ts +3 -4
  172. package/packages/bundled-features/src/documents/queries/list-page.ts +11 -3
  173. package/packages/bundled-features/src/documents/queries/overview.query.ts +2 -2
  174. package/packages/bundled-features/src/documents/screens.ts +8 -3
  175. package/packages/bundled-features/src/documents/tab.ts +1 -1
  176. package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +6 -3
  177. package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +1 -1
  178. package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +1 -1
  179. package/packages/bundled-features/src/file-foundation/probe.ts +9 -3
  180. package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +24 -11
  181. package/packages/bundled-features/src/file-provider-inmemory/feature.ts +1 -1
  182. package/packages/bundled-features/src/file-provider-s3/changes.json +14 -0
  183. package/packages/bundled-features/src/file-provider-s3/env-feature.ts +1 -1
  184. package/packages/bundled-features/src/file-provider-s3/env-named-feature.ts +1 -1
  185. package/packages/bundled-features/src/file-provider-s3/env-schema.ts +24 -7
  186. package/packages/bundled-features/src/file-provider-s3/feature.ts +1 -1
  187. package/packages/bundled-features/src/file-provider-s3/index.ts +7 -1
  188. package/packages/bundled-features/src/file-provider-s3/lib/env-helper.ts +21 -13
  189. package/packages/bundled-features/src/file-provider-s3/lib/s3-provider.ts +8 -1
  190. package/packages/bundled-features/src/files/changes.json +7 -0
  191. package/packages/bundled-features/src/folders/aggregate-id.ts +0 -1
  192. package/packages/bundled-features/src/folders/web/folder-manager.tsx +6 -6
  193. package/packages/bundled-features/src/folders-user-data/index.ts +12 -14
  194. package/packages/bundled-features/src/form-draft/feature.ts +1 -0
  195. package/packages/bundled-features/src/helpdesk/changes.json +56 -0
  196. package/packages/bundled-features/src/helpdesk/entity.ts +4 -1
  197. package/packages/bundled-features/src/helpdesk/feature.ts +42 -0
  198. package/packages/bundled-features/src/helpdesk/handlers/access.ts +0 -10
  199. package/packages/bundled-features/src/helpdesk/handlers/attempts.ts +7 -14
  200. package/packages/bundled-features/src/helpdesk/handlers/challenge.query.ts +1 -2
  201. package/packages/bundled-features/src/helpdesk/handlers/reply.write.ts +5 -12
  202. package/packages/bundled-features/src/helpdesk/handlers/report.write.ts +4 -10
  203. package/packages/bundled-features/src/helpdesk/handlers/submit.write.ts +5 -12
  204. package/packages/bundled-features/src/helpdesk/index.ts +1 -0
  205. package/packages/bundled-features/src/helpdesk/legacy-contact-config.ts +61 -0
  206. package/packages/bundled-features/src/helpdesk/legacy-contact-erasure.ts +45 -0
  207. package/packages/bundled-features/src/helpdesk/legacy-contact-retention.ts +65 -0
  208. package/packages/bundled-features/src/helpdesk/legacy-contact-streams.ts +187 -0
  209. package/packages/bundled-features/src/helpdesk/legacy-contact-user-data.ts +84 -0
  210. package/packages/bundled-features/src/helpdesk/lib.ts +55 -37
  211. package/packages/bundled-features/src/helpdesk/user-data-hooks.ts +89 -48
  212. package/packages/bundled-features/src/helpdesk/web/constants.ts +0 -1
  213. package/packages/bundled-features/src/inbound-mail-foundation/account-health.ts +1 -1
  214. package/packages/bundled-features/src/inbound-mail-foundation/account-poll.ts +9 -2
  215. package/packages/bundled-features/src/inbound-mail-foundation/aggregate-id.ts +0 -2
  216. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +54 -0
  217. package/packages/bundled-features/src/inbound-mail-foundation/constants.ts +6 -0
  218. package/packages/bundled-features/src/inbound-mail-foundation/content-refetch.ts +23 -2
  219. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +73 -15
  220. package/packages/bundled-features/src/inbound-mail-foundation/events.ts +24 -16
  221. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +3 -1
  222. package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-address.ts +16 -2
  223. package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +10 -3
  224. package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +23 -9
  225. package/packages/bundled-features/src/inbound-mail-foundation/handlers/forget-message.write.ts +79 -0
  226. package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message-schema.ts +18 -5
  227. package/packages/bundled-features/src/inbound-mail-foundation/i18n.ts +3 -0
  228. package/packages/bundled-features/src/inbound-mail-foundation/index.ts +1 -0
  229. package/packages/bundled-features/src/inbound-mail-foundation/normalize-inbound-message.ts +22 -8
  230. package/packages/bundled-features/src/inbound-mail-foundation/oauth-access-token.ts +1 -1
  231. package/packages/bundled-features/src/inbound-mail-foundation/outbound-mail.ts +2 -0
  232. package/packages/bundled-features/src/inbound-mail-foundation/personal-address.ts +20 -0
  233. package/packages/bundled-features/src/inbound-mail-foundation/purge-messages.ts +54 -0
  234. package/packages/bundled-features/src/inbound-mail-foundation/quarantine.ts +15 -5
  235. package/packages/bundled-features/src/inbound-mail-foundation/retention-job.ts +1 -5
  236. package/packages/bundled-features/src/inbound-mail-foundation/retention-sweep.ts +21 -34
  237. package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +2 -5
  238. package/packages/bundled-features/src/inbound-mail-foundation/send-from-account.ts +9 -1
  239. package/packages/bundled-features/src/inbound-mail-foundation/supervisor-ingest.ts +7 -1
  240. package/packages/bundled-features/src/inbound-mail-foundation/sync-account-now.ts +1 -1
  241. package/packages/bundled-features/src/inbound-mail-foundation/tenant-destroy-hook.ts +14 -17
  242. package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
  243. package/packages/bundled-features/src/inbound-provider-imap/byte-budget.ts +80 -0
  244. package/packages/bundled-features/src/inbound-provider-imap/changes.json +13 -0
  245. package/packages/bundled-features/src/inbound-provider-imap/connect-mailbox.ts +8 -4
  246. package/packages/bundled-features/src/inbound-provider-imap/connect-my-mailbox.ts +23 -6
  247. package/packages/bundled-features/src/inbound-provider-imap/connect-target-rate-limit.ts +46 -0
  248. package/packages/bundled-features/src/inbound-provider-imap/download-batch.ts +47 -10
  249. package/packages/bundled-features/src/inbound-provider-imap/feature.ts +7 -4
  250. package/packages/bundled-features/src/inbound-provider-imap/fetch-content.ts +43 -29
  251. package/packages/bundled-features/src/inbound-provider-imap/i18n.ts +2 -2
  252. package/packages/bundled-features/src/inbound-provider-imap/parse-message.ts +14 -0
  253. package/packages/bundled-features/src/inbound-provider-imap/reconnect-mailbox.ts +5 -4
  254. package/packages/bundled-features/src/inbound-provider-imap/send-mail.ts +39 -7
  255. package/packages/bundled-features/src/inbound-provider-imap/smtp-client.ts +19 -4
  256. package/packages/bundled-features/src/inbound-provider-imap/watch-mailbox.ts +8 -23
  257. package/packages/bundled-features/src/inbound-provider-inmemory/feature.ts +1 -1
  258. package/packages/bundled-features/src/jobs/events.ts +10 -0
  259. package/packages/bundled-features/src/jobs/feature.ts +2 -0
  260. package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +41 -16
  261. package/packages/bundled-features/src/jobs/web/constants.ts +4 -0
  262. package/packages/bundled-features/src/mail-foundation/changes.json +6 -0
  263. package/packages/bundled-features/src/mail-transport-inmemory/feature.ts +1 -1
  264. package/packages/bundled-features/src/mail-transport-smtp/feature.ts +3 -2
  265. package/packages/bundled-features/src/managed-pages/changes.json +12 -0
  266. package/packages/bundled-features/src/managed-pages/handlers/branding.query.ts +1 -1
  267. package/packages/bundled-features/src/managed-pages/handlers/by-slug.query.ts +1 -1
  268. package/packages/bundled-features/src/managed-pages/handlers/by-tenant-published.query.ts +1 -1
  269. package/packages/bundled-features/src/managed-pages/render-page-body.ts +18 -10
  270. package/packages/bundled-features/src/managed-pages/screens/page-screens.ts +18 -38
  271. package/packages/bundled-features/src/managed-pages/table.ts +1 -0
  272. package/packages/bundled-features/src/managed-pages/web/client-plugin.tsx +8 -6
  273. package/packages/bundled-features/src/managed-pages/web/constants.ts +8 -1
  274. package/packages/bundled-features/src/managed-pages/web/i18n.ts +11 -3
  275. package/packages/bundled-features/src/managed-pages/web/markdown-to-document.ts +1 -1
  276. package/packages/bundled-features/src/managed-pages/web/page-edit-draft.ts +108 -0
  277. package/packages/bundled-features/src/managed-pages/web/page-edit-screen.tsx +204 -0
  278. package/packages/bundled-features/src/managed-pages/web/page-settings-rail.tsx +117 -0
  279. package/packages/bundled-features/src/notes-history-user-data/index.ts +8 -14
  280. package/packages/bundled-features/src/personal-access-tokens/boot-rules.ts +5 -0
  281. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +0 -1
  282. package/packages/bundled-features/src/personal-access-tokens/scope-events-check.ts +31 -5
  283. package/packages/bundled-features/src/presence/changes.json +6 -0
  284. package/packages/bundled-features/src/presence/handlers/list.query.ts +28 -11
  285. package/packages/bundled-features/src/presence/room.ts +21 -7
  286. package/packages/bundled-features/src/presence/store.ts +79 -21
  287. package/packages/bundled-features/src/readiness/changes.json +25 -0
  288. package/packages/bundled-features/src/readiness/handlers/latest-summary.query.ts +11 -6
  289. package/packages/bundled-features/src/readiness/handlers/run-probes.write.ts +35 -5
  290. package/packages/bundled-features/src/readiness/handlers/run-tone.ts +3 -2
  291. package/packages/bundled-features/src/readiness/handlers/status.query.ts +15 -1
  292. package/packages/bundled-features/src/readiness/probe-context.ts +11 -10
  293. package/packages/bundled-features/src/readiness/screens.ts +4 -4
  294. package/packages/bundled-features/src/readiness/visible-results.ts +5 -3
  295. package/packages/bundled-features/src/renderer-foundation/api.ts +6 -13
  296. package/packages/bundled-features/src/renderer-foundation/types.ts +2 -2
  297. package/packages/bundled-features/src/secrets/changes.json +7 -0
  298. package/packages/bundled-features/src/secrets/db/queries/read.ts +18 -4
  299. package/packages/bundled-features/src/secrets/handlers/list.query.ts +8 -2
  300. package/packages/bundled-features/src/secrets/secret-scope.ts +2 -3
  301. package/packages/bundled-features/src/secrets/secrets-context.ts +6 -4
  302. package/packages/bundled-features/src/secrets/write-gate.ts +4 -2
  303. package/packages/bundled-features/src/seo/handlers/seo-config.query.ts +1 -1
  304. package/packages/bundled-features/src/shared/acknowledged-system-db.ts +20 -0
  305. package/packages/bundled-features/src/shared/assert-billing-live.ts +9 -2
  306. package/packages/bundled-features/src/shared/changes.json +12 -0
  307. package/packages/bundled-features/src/shared/hmac-signature.ts +4 -2
  308. package/packages/bundled-features/src/shared/index.ts +7 -1
  309. package/packages/bundled-features/src/shared/normalize-email.ts +3 -0
  310. package/packages/bundled-features/src/shared/parent-visibility.ts +25 -1
  311. package/packages/bundled-features/src/shared/password-hashing.ts +0 -1
  312. package/packages/bundled-features/src/shared/price-env-shape.ts +1 -4
  313. package/packages/bundled-features/src/shared/register-user-data-hooks.ts +29 -0
  314. package/packages/bundled-features/src/shared/require-bootstrap-extension.ts +26 -0
  315. package/packages/bundled-features/src/shared/send-best-effort.ts +29 -0
  316. package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +22 -1
  317. package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +31 -1
  318. package/packages/bundled-features/src/step-dispatcher/changes.json +18 -0
  319. package/packages/bundled-features/src/step-dispatcher/constants.ts +13 -0
  320. package/packages/bundled-features/src/step-dispatcher/deliver-dispatch-request.ts +50 -2
  321. package/packages/bundled-features/src/step-dispatcher/feature.ts +42 -1
  322. package/packages/bundled-features/src/step-dispatcher/mail-runner.ts +0 -1
  323. package/packages/bundled-features/src/step-dispatcher/sweep-abandoned.ts +61 -0
  324. package/packages/bundled-features/src/subscription-mollie/changes.json +7 -0
  325. package/packages/bundled-features/src/subscription-mollie/plugin-methods.ts +5 -3
  326. package/packages/bundled-features/src/subscription-mollie/verify-webhook.ts +5 -5
  327. package/packages/bundled-features/src/subscription-paddle/backfill-checkout-ledger.ts +161 -0
  328. package/packages/bundled-features/src/subscription-paddle/changes.json +19 -0
  329. package/packages/bundled-features/src/subscription-paddle/checkout-config.query.ts +1 -1
  330. package/packages/bundled-features/src/subscription-paddle/checkout-methods.ts +2 -8
  331. package/packages/bundled-features/src/subscription-paddle/constants.ts +1 -2
  332. package/packages/bundled-features/src/subscription-paddle/feature.ts +26 -24
  333. package/packages/bundled-features/src/subscription-paddle/ledger-backfill-marker.ts +70 -0
  334. package/packages/bundled-features/src/subscription-paddle/plan-switch-methods.ts +2 -8
  335. package/packages/bundled-features/src/subscription-paddle/redeliver-legacy-checkout.ts +57 -0
  336. package/packages/bundled-features/src/subscription-paddle/runtime.ts +13 -24
  337. package/packages/bundled-features/src/subscription-paddle/subscription-state.ts +1 -0
  338. package/packages/bundled-features/src/subscription-paddle/webhook-events.ts +68 -21
  339. package/packages/bundled-features/src/subscription-stripe/changes.json +13 -0
  340. package/packages/bundled-features/src/subscription-stripe/feature.ts +5 -0
  341. package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +6 -6
  342. package/packages/bundled-features/src/subscription-stripe/runtime.ts +8 -7
  343. package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +38 -6
  344. package/packages/bundled-features/src/tags/aggregate-id.ts +0 -1
  345. package/packages/bundled-features/src/tags/web/tag-chip.tsx +4 -5
  346. package/packages/bundled-features/src/tags/web/tag-manager.tsx +2 -1
  347. package/packages/bundled-features/src/template-resolver/api.ts +6 -13
  348. package/packages/bundled-features/src/template-resolver/changes.json +48 -0
  349. package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +25 -0
  350. package/packages/bundled-features/src/template-resolver/feature.ts +2 -0
  351. package/packages/bundled-features/src/template-resolver/handlers/body-preview.query.ts +41 -0
  352. package/packages/bundled-features/src/template-resolver/handlers/by-slug.query.ts +1 -1
  353. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +1 -1
  354. package/packages/bundled-features/src/template-resolver/handlers/collection-shared.ts +5 -11
  355. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +3 -2
  356. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +37 -8
  357. package/packages/bundled-features/src/template-resolver/linked-resources.ts +2 -5
  358. package/packages/bundled-features/src/template-resolver/seeding.ts +107 -0
  359. package/packages/bundled-features/src/template-resolver/table.ts +1 -0
  360. package/packages/bundled-features/src/template-resolver/template-draft.ts +2 -1
  361. package/packages/bundled-features/src/template-resolver/template-preview.ts +14 -3
  362. package/packages/bundled-features/src/template-resolver/testing.ts +0 -2
  363. package/packages/bundled-features/src/template-resolver/web/client-plugin.tsx +3 -0
  364. package/packages/bundled-features/src/template-resolver/web/collection-entry-create-form.tsx +33 -33
  365. package/packages/bundled-features/src/template-resolver/web/constants.ts +7 -0
  366. package/packages/bundled-features/src/template-resolver/web/content-tree-provider.ts +0 -1
  367. package/packages/bundled-features/src/template-resolver/web/content-workbench.tsx +142 -0
  368. package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +3 -8
  369. package/packages/bundled-features/src/template-resolver/web/document-link-policy.ts +58 -0
  370. package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -57
  371. package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +2 -4
  372. package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +4 -5
  373. package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +2 -2
  374. package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +6 -3
  375. package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +2 -3
  376. package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +1 -0
  377. package/packages/bundled-features/src/template-resolver/web/fill-document-variables.ts +24 -0
  378. package/packages/bundled-features/src/template-resolver/web/i18n.ts +14 -0
  379. package/packages/bundled-features/src/template-resolver/web/index.ts +3 -0
  380. package/packages/bundled-features/src/template-resolver/web/preview-targets.ts +25 -0
  381. package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +1 -0
  382. package/packages/bundled-features/src/template-resolver/web/snippet-preview-renderer.tsx +24 -0
  383. package/packages/bundled-features/src/template-resolver/web/string-values.ts +7 -0
  384. package/packages/bundled-features/src/template-resolver/web/text-block-editor.tsx +38 -50
  385. package/packages/bundled-features/src/template-resolver/web/use-collection-entry-create.ts +7 -0
  386. package/packages/bundled-features/src/template-resolver/web/use-content-write.ts +1 -3
  387. package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +1 -2
  388. package/packages/bundled-features/src/template-resolver/web/use-text-block-editor.ts +28 -7
  389. package/packages/bundled-features/src/template-resolver/web/web-preview-renderer.tsx +132 -0
  390. package/packages/bundled-features/src/template-resolver-user-data/index.ts +11 -10
  391. package/packages/bundled-features/src/tenant/changes.json +6 -0
  392. package/packages/bundled-features/src/tenant/handlers/create.write.ts +7 -8
  393. package/packages/bundled-features/src/tenant/handlers/list.query.ts +7 -9
  394. package/packages/bundled-features/src/tenant/handlers/member-directory.query.ts +10 -4
  395. package/packages/bundled-features/src/tenant/handlers/toggle-enabled.write.ts +1 -1
  396. package/packages/bundled-features/src/tenant/invited-membership.ts +10 -1
  397. package/packages/bundled-features/src/tenant/seeding.ts +4 -2
  398. package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +5 -1
  399. package/packages/bundled-features/src/tenant/testing.ts +1 -1
  400. package/packages/bundled-features/src/tenant-inactivity/changes.json +6 -0
  401. package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +36 -17
  402. package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -2
  403. package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +7 -2
  404. package/packages/bundled-features/src/tenant-inactivity/state-store.ts +22 -2
  405. package/packages/bundled-features/src/tenant-lifecycle/changes.json +24 -0
  406. package/packages/bundled-features/src/tenant-lifecycle/constants.ts +4 -0
  407. package/packages/bundled-features/src/tenant-lifecycle/feature.ts +1 -0
  408. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +43 -6
  409. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +15 -2
  410. package/packages/bundled-features/src/tier-engine/aggregate-id.ts +0 -1
  411. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  412. package/packages/bundled-features/src/tier-engine/feature.ts +8 -2
  413. package/packages/bundled-features/src/user/changes.json +6 -0
  414. package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +2 -1
  415. package/packages/bundled-features/src/user/handlers/me.query.ts +3 -1
  416. package/packages/bundled-features/src/user/index.ts +1 -0
  417. package/packages/bundled-features/src/user/resolve-verified-user-email.ts +17 -0
  418. package/packages/bundled-features/src/user-data-rights/db/queries/export-jobs.ts +0 -1
  419. package/packages/bundled-features/src/user-data-rights/feature.ts +1 -0
  420. package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
  421. package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +1 -1
  422. package/packages/bundled-features/src/user-data-rights/handlers/request-deletion-by-email.write.ts +1 -1
  423. package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +0 -2
  424. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +3 -3
  425. package/packages/bundled-features/src/user-data-rights/schema/download-attempt.ts +3 -2
  426. package/packages/bundled-features/src/user-data-rights/web/confirm-deletion-screen.tsx +1 -1
  427. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  428. package/packages/bundled-features/src/user-data-rights/web/request-deletion-screen.tsx +1 -1
  429. package/packages/bundled-features/src/user-data-rights-defaults/hooks/api-token.userdata-hook.ts +5 -5
  430. package/packages/bundled-features/src/user-data-rights-defaults/hooks/hard-delete-own-rows-hook.ts +17 -0
  431. package/packages/bundled-features/src/user-data-rights-defaults/hooks/in-app-message.userdata-hook.ts +5 -5
  432. package/packages/bundled-features/src/user-data-rights-defaults/hooks/job-run.userdata-hook.ts +2 -1
  433. package/packages/bundled-features/src/user-data-rights-defaults/hooks/user-session.userdata-hook.ts +5 -5
  434. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +0 -1
  435. package/packages/bundled-features/src/waitlist/changes.json +6 -0
  436. package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
  437. package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +5 -29
  438. package/packages/bundled-features/src/waitlist/import.ts +2 -1
  439. package/packages/bundled-features/src/waitlist/lib.ts +2 -11
  440. package/packages/bundled-features/src/waitlist/link-on-signup.ts +2 -2
  441. package/packages/bundled-features/src/waitlist/user-data-hooks.ts +6 -19
  442. package/packages/bundled-features/src/workflow-runner/aggregate-id.ts +0 -1
  443. package/packages/bundled-features/src/workflow-runner/changes.json +6 -0
  444. package/packages/bundled-features/src/workflow-runner/event-trigger.ts +6 -2
  445. package/packages/bundled-features/src/workflow-runner/feature.ts +1 -5
  446. package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +7 -4
  447. package/packages/bundled-features/src/workflow-runner/runner.ts +2 -0
  448. package/samples/apps/admin-console/src/app/shell.tsx +1 -0
  449. package/samples/apps/showcase/src/features/demos/web/pages/dialog.tsx +0 -1
  450. package/samples/apps/showcase/src/features/demos/web/pages/layout.tsx +1 -1
  451. package/samples/apps/showcase/src/features/demos/web/pages/sidebar-panel.tsx +0 -1
  452. package/samples/apps/styleguide/src/features/gallery/web/Gallery.tsx +1 -4
  453. package/samples/apps/ui-walkthrough/src/features/subscription-plans/feature.ts +6 -2
  454. package/samples/apps/use-all-bundled/e2e-billing-gallery/gallery-features.ts +12 -14
  455. package/samples/apps/use-all-bundled/feature-manifest.json +60 -29
  456. package/samples/apps/use-all-bundled/playwright.billing-docs.config.ts +1 -1
  457. package/samples/apps/use-all-bundled/playwright.config.ts +1 -0
  458. package/samples/apps/use-all-bundled/src/app/seed.ts +1 -1
  459. package/samples/apps/use-all-bundled/src/run-config.ts +2 -1
  460. package/samples/recipes/auth-mfa/src/web/confirmation-code-step.tsx +32 -10
  461. package/samples/recipes/chat-channels/README.md +2 -0
  462. package/samples/recipes/crypto-shredding-hr/README.md +11 -0
  463. package/samples/recipes/crypto-shredding-hr/src/feature.ts +27 -0
  464. package/samples/recipes/currencies-global/src/entities/currency.ts +1 -0
  465. package/samples/recipes/managed-pages/README.md +5 -1
  466. package/samples/recipes/managed-pages/package.json +3 -2
  467. package/samples/recipes/managed-pages/src/web/branded-preview.tsx +21 -0
  468. package/samples/recipes/managed-pages/tsconfig.json +8 -0
  469. package/samples/recipes/pwa-shell/README.md +52 -0
  470. package/samples/recipes/pwa-shell/bin/server.ts +12 -0
  471. package/samples/recipes/pwa-shell/package.json +13 -0
  472. package/samples/recipes/pwa-shell/src/app.ts +34 -0
  473. package/samples/recipes/rate-limiting/README.md +3 -3
  474. package/samples/recipes/record-detail-layout/README.md +33 -0
  475. package/samples/recipes/record-detail-layout/src/feature.ts +556 -44
  476. package/samples/recipes/record-detail-layout/src/order-board.ts +529 -0
  477. package/packages/bundled-features/src/managed-pages/web/page-body-section.tsx +0 -72
  478. package/packages/bundled-features/src/subscription-paddle/tenant-binding.ts +0 -34
  479. package/packages/bundled-features/src/template-resolver/web/content-field.tsx +0 -61
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "source": "samples/apps/use-all-bundled APP_FEATURES (composeFeatures includeBundled + signup)",
3
- "featureCount": 93,
3
+ "featureCount": 94,
4
4
  "features": [
5
5
  {
6
6
  "name": "account-security",
@@ -343,6 +343,7 @@
343
343
  "billing-foundation:write:create-portal-session",
344
344
  "billing-foundation:write:process-event",
345
345
  "billing-foundation:write:process-payment-event",
346
+ "billing-foundation:write:record-checkout-opened",
346
347
  "billing-foundation:write:sync-subscription"
347
348
  ],
348
349
  "uiHints": {
@@ -613,6 +614,49 @@
613
614
  "recommended": false
614
615
  }
615
616
  },
617
+ {
618
+ "name": "channel-whatsapp",
619
+ "description": "WhatsApp Business (Meta Cloud API) as a two-way channel, not a delivery channel. Inbound: mount `createWhatsappWebhookRoutes()` via `extraRoutes` (default path `/api/channel-whatsapp/webhook/:tenantId`, the tenant id is part of the URL because the secrets are tenant-scoped); GET answers Meta's `hub.challenge` handshake, POST checks `X-Hub-Signature-256` over the raw body and normalizes each message and status. Events: `channel-whatsapp:event:message-received` (sender, wamid, type text|audio|image|interactive_button|other, text, button payload, `contextWamid`, media id and mime type, `phoneNumberId`), `status-updated` (sent|delivered|read|failed|other) and `throttled` (sender over the per-number limit). Sender number, text, button payload and status recipient are PII, stored as tenant-key ciphertext; read them with `readWhatsappMessagePii`. A redelivered wamid is stored once and answered 200; a failed dispatch answers 500 so Meta redelivers. Outbound: `createWhatsappClient(opts)` gives `sendText`, `sendTemplate`, `sendButtons`, `sendMedia` (each takes the sending `phoneNumberId` and answers `{ ok: true, wamid }` or a typed failure) and `fetchMedia` (media id to bytes and mime type; the URL from the Graph answer is checked against `allowedHosts` before the token is sent). Tenant secrets `channel-whatsapp:secret:access-token`, `app-secret` and `verify-token`. App options of `createChannelWhatsappFeature(opts)`: `apiBaseUrl`, `apiVersion` (default v21.0), `allowedHosts` (default graph.facebook.com and lookaside.fbsbx.com), `requireHttps` (default true; boot fails on a mismatch), `timeoutMs`, `mediaMaxBytes`, `transport` (in-memory Meta for tests), `senderRateLimits` (default 30 per hour and 200 per day per sender and tenant) and `rateLimit` (flood guard of the inbound handlers; cannot be disabled while a sender limit is set). Requires `secrets`. A worker-run job triggered by `message-received` attaches the business process.",
620
+ "toggleableDefault": null,
621
+ "requires": [
622
+ "secrets"
623
+ ],
624
+ "optionalRequires": [],
625
+ "configReads": [],
626
+ "exposesApis": [],
627
+ "usesApis": [],
628
+ "extensionsUsed": [],
629
+ "configKeys": [],
630
+ "secrets": [
631
+ {
632
+ "qualifiedName": "channel-whatsapp:secret:access-token",
633
+ "scope": "tenant",
634
+ "label": "WhatsApp access token",
635
+ "hint": "System-user access token of the Meta app. Used to send messages and to download media."
636
+ },
637
+ {
638
+ "qualifiedName": "channel-whatsapp:secret:app-secret",
639
+ "scope": "tenant",
640
+ "label": "WhatsApp app secret",
641
+ "hint": "App secret of the Meta app. Verifies the signature of every incoming webhook."
642
+ },
643
+ {
644
+ "qualifiedName": "channel-whatsapp:secret:verify-token",
645
+ "scope": "tenant",
646
+ "label": "WhatsApp verify token",
647
+ "hint": "Any string you also enter in the Meta webhook settings; answers Meta's subscription handshake."
648
+ }
649
+ ],
650
+ "writeHandlers": [
651
+ "channel-whatsapp:write:receive-message",
652
+ "channel-whatsapp:write:record-status"
653
+ ],
654
+ "uiHints": {
655
+ "displayLabel": "WhatsApp Channel",
656
+ "category": "notifications",
657
+ "recommended": false
658
+ }
659
+ },
616
660
  {
617
661
  "name": "collection-labels",
618
662
  "description": "Nav labels for the content collections mounted by this sample app.",
@@ -764,7 +808,7 @@
764
808
  },
765
809
  {
766
810
  "name": "delivery",
767
- "description": "The notification dispatch core: call `ctx.notify(notificationType, { to, route, data, priority, idempotencyKey })` from any handler to fan out a notification across all registered channels (email, in-app, push). Inside a write handler the delivery runs after the write has committed (the call returns `{ kind: \"deferred\" }`, a rolled-back write sends nothing); `immediate: true` delivers synchronously and returns `{ kind: \"dispatched\", deliveries }`. It stores per-user channel preferences in the `notification-preference` entity, opt-outs for no-account recipient addresses in `notification-address-opt-out` (keyed by a blind-index hash, never the plaintext address), logs every attempt to `store_delivery_attempts`, and enforces idempotency and rate-limiting — add `channel-email`, `channel-in-app`, or `channel-push` on top to actually send anything. Unsubscribe/resubscribe links are served by `createUnsubscribeRoutes({ secret })` mounted via the app's `extraRoutes` at `/api/delivery/unsubscribe` and `/api/delivery/resubscribe`: `GET /unsubscribe?token=` renders a confirmation page (no write), `POST /unsubscribe` performs the opt-out (RFC 8058 one-click, token from the form body or query), `POST /resubscribe` undoes it (JSON `{token}` or form body only, never the query — reachable by a mail-client link prefetcher) — sign links with `signUnsubscribeToken` / `signAddressUnsubscribeToken` using the same secret. `channel-email` sets `List-Unsubscribe` / `List-Unsubscribe-Post` automatically when a message's `data.unsubscribeUrl` points at the unsubscribe route. A notification declared with `unsubscribe: true` gets that link from delivery itself when the service has `unsubscribeLinks` (the `runProdApp` and `runDevApp` option `unsubscribe: { secret }` mounts the routes and wires it; base URL from `auth.publicOrigin`, `auth.mail.baseUrl` or `APP_BASE_URL`): user recipients get a user token, `route` recipients an address token (needs a blind-index key, otherwise no link); a `data.unsubscribeUrl` from the caller wins. `unsubscribe.tenantOrigin: (ctx) => origin | null` points the link at the tenant's own host (subdomain or custom domain, must serve this app's `/api`); null, a throw or a non-https value fall back to the app origin. The token carries the mail's locale, so the confirmation and result pages render in the mail's language. An app serving its own (e.g. legacy) unsubscribe links renders the same result page with `renderUnsubscribeResultPage({ kind, locale })`. To react to a no-account opt-out (e.g. remove the app's own subscriber row), declare `r.job(name, { trigger: { on: DeliveryHandlers.unsubscribeAddress } }, handler)` on a lane the app consumes: it runs after each committed opt-out, also an idempotent repeat, with `unsubscribeAddressPayloadSchema` (`addressHash`, `notificationType`, `channel`) as payload and the tenant in `ctx.triggeredBy.tenantId`; match the subscriber via `hashUnsubscribeAddress(email)`. Declare `unsubscribeUrl` as an optional template variable if the mail body shows it.",
811
+ "description": "The notification dispatch core: call `ctx.notify(notificationType, { to, route, data, priority, idempotencyKey })` from any handler to fan out a notification across all registered channels (email, in-app, push). Inside a write handler the delivery runs after the write has committed (the call returns `{ kind: \"deferred\" }`, a rolled-back write sends nothing); `immediate: true` delivers synchronously and returns `{ kind: \"dispatched\", deliveries }`. It stores per-user channel preferences in the `notification-preference` entity, opt-outs for no-account recipient addresses in `notification-address-opt-out` (keyed by a blind-index hash, never the plaintext address), logs every attempt to `store_delivery_attempts`, and enforces idempotency and rate-limiting — add `channel-email`, `channel-in-app`, or `channel-push` on top to actually send anything. Unsubscribe/resubscribe links are served by `createUnsubscribeRoutes({ secret })` mounted via the app's `extraRoutes` at `/api/delivery/unsubscribe` and `/api/delivery/resubscribe`: `GET /unsubscribe?token=` renders a confirmation page (no write), `POST /unsubscribe` performs the opt-out (RFC 8058 one-click, token from the form body or query), `POST /resubscribe` undoes it (JSON `{token}` or form body only, never the query — reachable by a mail-client link prefetcher) — sign links with `signUnsubscribeToken` / `signAddressUnsubscribeToken` using the same secret. `channel-email` sets `List-Unsubscribe` / `List-Unsubscribe-Post` automatically when a message's `data.unsubscribeUrl` points at the unsubscribe route. A notification declared with `unsubscribe: true` gets that link from delivery itself when the service has `unsubscribeLinks` (the `runProdApp` and `runDevApp` option `unsubscribe: { secret }` mounts the routes and wires it; base URL from `auth.publicOrigin`, `auth.mail.baseUrl` or `APP_BASE_URL`): user recipients get a user token, `route` recipients an address token (needs a blind-index key, otherwise no link); a `data.unsubscribeUrl` from the caller wins. `unsubscribe.tenantOrigin: (ctx) => origin | null` points the link at the tenant's own host (subdomain or custom domain, must serve this app's `/api`); null, a throw or a non-https value fall back to the app origin. The token carries the mail's locale, so the confirmation and result pages render in the mail's language. An app serving its own (e.g. legacy) unsubscribe links renders the same result page with `renderUnsubscribeResultPage({ kind, locale })`. To react to a no-account opt-out (e.g. remove the app's own subscriber row), declare `r.job(name, { trigger: { on: DeliveryHandlers.unsubscribeAddress } }, handler)` on a lane the app consumes: it runs after each committed opt-out, also an idempotent repeat, with `unsubscribeAddressPayloadSchema` (`addressHash`, `notificationType`, `channel`) as payload and the tenant in `ctx.triggeredBy.tenantId`; match the subscriber via `hashUnsubscribeAddress(email)`. Declare `unsubscribeUrl` as an optional template variable if the mail body shows it. A job that sends an opt-in notification (e.g. a daily digest) reads the members who switched it on from the job-only query `delivery:query:opted-in-user-ids` (`{ notificationType, channel }` answers `{ userIds }`).",
768
812
  "toggleableDefault": null,
769
813
  "adoptsBundledLists": true,
770
814
  "requires": [
@@ -1422,6 +1466,10 @@
1422
1466
  "extensionName": "userData",
1423
1467
  "entityName": "helpdesk-request"
1424
1468
  },
1469
+ {
1470
+ "extensionName": "userData",
1471
+ "entityName": "contact-request"
1472
+ },
1425
1473
  {
1426
1474
  "extensionName": "userData",
1427
1475
  "entityName": "helpdesk-reply"
@@ -1490,7 +1538,7 @@
1490
1538
  },
1491
1539
  {
1492
1540
  "name": "inbound-mail-foundation",
1493
- "description": "Plugin host for inbound e-mail (inbox federation) — provider plugins (inbound-provider-imap, later M365 Graph / Gmail REST) register at the `inboundMailProvider` extension point with verify/fetch and optional oauth/watch (live push) and send. `sendMailFromAccount(ctx, { accountId, message })` sends from a connected mailbox through its provider (From = the mailbox address, no fallback to the app sender) and answers typed failures (not configured, login rejected, server unreachable, rejected, invalid message); app write handlers call it, it is no endpoint of its own. The foundation owns three event-sourced streams (mail-account lifecycle, inbound-message with exactly-once ingest via deterministic aggregate ids, mail-thread rollup) and their projections `read_mail_accounts`/`read_inbound_messages`/`read_mail_threads`; PII fields are envelope-encrypted per tenant subject key before every append (crypto-shredding on tenant destroy). Wire `createInboundMailConnectRoutes` (OAuth connect + anonymous callback outside /api) and `createInboundMailSupervisor` (IDLE watch with backoff + reconciliation poll) in bin/server.ts. Consume `inbound-mail-foundation:event:inbound-message-received` from app features to attach business processes.",
1541
+ "description": "Plugin host for inbound e-mail (inbox federation) — provider plugins (inbound-provider-imap, later M365 Graph / Gmail REST) register at the `inboundMailProvider` extension point with verify/fetch and optional oauth/watch (live push) and send. `sendMailFromAccount(ctx, { accountId, message })` sends from a connected mailbox through its provider (From = the mailbox address, no fallback to the app sender) and answers typed failures (not configured, login rejected, server unreachable, rejected, invalid message); app write handlers call it from `beforeTransaction` (it sends at once and a rollback cannot recall the mail), it is no endpoint of its own. The foundation owns three event-sourced streams (mail-account lifecycle, inbound-message with exactly-once ingest via deterministic aggregate ids, mail-thread rollup) and their projections `read_mail_accounts`/`read_inbound_messages`/`read_mail_threads`; PII fields are envelope-encrypted per tenant subject key before every append (crypto-shredding on tenant destroy). Wire `createInboundMailConnectRoutes` (OAuth connect + anonymous callback outside /api) and `createInboundMailSupervisor` (IDLE watch with backoff + reconciliation poll) in bin/server.ts. Consume `inbound-mail-foundation:event:inbound-message-received` from app features to attach business processes.",
1494
1542
  "toggleableDefault": null,
1495
1543
  "adoptsBundledLists": true,
1496
1544
  "requires": [
@@ -1521,6 +1569,7 @@
1521
1569
  "inbound-mail-foundation:write:attach-message-content",
1522
1570
  "inbound-mail-foundation:write:connect-account",
1523
1571
  "inbound-mail-foundation:write:disconnect-account",
1572
+ "inbound-mail-foundation:write:forget-message",
1524
1573
  "inbound-mail-foundation:write:ingest-message",
1525
1574
  "inbound-mail-foundation:write:mark-credential-stored",
1526
1575
  "inbound-mail-foundation:write:reactivate-account",
@@ -1536,11 +1585,12 @@
1536
1585
  },
1537
1586
  {
1538
1587
  "name": "inbound-provider-imap",
1539
- "description": "Registers the `\"imap\"` provider for `inbound-mail-foundation` using imapflow — password/app-password auth covers classic IMAP hosts without any OAuth (plus an XOAUTH2 fallback consuming an access token from the secret slot). Incremental sync via a UIDVALIDITY:lastUid cursor (UIDVALIDITY change triggers a cursor-invalid full resync), initial backfill bounded by the foundation backfill window, and live push via IMAP IDLE for the watch supervisor. Tenant admins connect a shared mailbox through the \"Connect mailbox\" form on the mail accounts list and members a personal one through the same form on \"My mail accounts\" (`connect-mailbox` and `connect-my-mailbox` check the IMAP login and the SMTP login of the outgoing server first, then creates the account and its credential secret in one transaction; `reconnect-mailbox` does the same check for an existing mailbox with a sign-in error and overwrites its credential secret); programmatic setups store the per-account connection JSON (host/port/secure/user/password, plus smtpHost/smtpPort for sending) in the account credential secret slot before the first sync. Implements the provider `send`: `sendMailFromAccount` sends over the SMTP server of the mailbox itself (implicit TLS, same login) with the mailbox address as From and stores a copy in its sent folder.",
1588
+ "description": "Registers the `\"imap\"` provider for `inbound-mail-foundation` using imapflow — password/app-password auth covers classic IMAP hosts without any OAuth (plus an XOAUTH2 fallback consuming an access token from the secret slot). Incremental sync via a UIDVALIDITY:lastUid cursor (UIDVALIDITY change triggers a cursor-invalid full resync), initial backfill bounded by the foundation backfill window, and live push via IMAP IDLE for the watch supervisor. Tenant admins connect a shared mailbox through the \"Connect mailbox\" form on the mail accounts list and members a personal one through the same form on \"My mail accounts\" (`connect-mailbox` and `connect-my-mailbox` check the IMAP login and the SMTP login of the outgoing server first, then creates the account and its credential secret in one transaction; `reconnect-mailbox` does the same check for an existing mailbox with a sign-in error and overwrites its credential secret); programmatic setups store the per-account connection JSON (host/port/secure/user/password, plus smtpHost/smtpPort for sending) in the account credential secret slot before the first sync. Implements the provider `send`: `sendMailFromAccount` sends over the SMTP server of the mailbox itself (TLS enforced: implicit on port 465, STARTTLS with requireTLS on every other port, port from the credential document, connect form default 587; same login) with the mailbox address as From and stores a copy in its sent folder.",
1540
1589
  "toggleableDefault": null,
1541
1590
  "requires": [
1542
1591
  "inbound-mail-foundation",
1543
- "secrets"
1592
+ "secrets",
1593
+ "user"
1544
1594
  ],
1545
1595
  "optionalRequires": [],
1546
1596
  "configReads": [],
@@ -2610,7 +2660,7 @@
2610
2660
  },
2611
2661
  {
2612
2662
  "name": "step-dispatcher",
2613
- "description": "Internal system feature that drains deferred Tier-2 side-effects (currently `webhook.send` and `mail.send`) after their originating transaction commits. An `r.multiStreamProjection` on the `kumiko:system:step.dispatch-requested` system event enqueues one `step-dispatcher:job:deliver` BullMQ job per dispatch (Redis carries only the stream id and tenant, never the request payload). The job performs the actual HTTP or mail delivery and appends `kumiko:system:step.dispatched` or `kumiko:system:step.dispatch-failed` back onto the same stream, so the outcome is recorded in the event log without a separate status table. Transient failures (network error, timeout, 5xx, 408, 429, any mail adapter failure) are retried 3 times with exponential backoff; the outcome is recorded after the final attempt and the payload key is erased only then. Permanent failures (invalid url, blocked host, other 4xx, unavailable auth secret) are recorded immediately. At most 2 deliveries per tenant run at once (`maxPerTenant` with `onLimit: \"defer\"`), so a slow receiver of one tenant does not delay other tenants. Requires a job runner (Redis) and a worker consuming the job's default `worker` lane; without a job runner the projection fails loudly. Mount this feature explicitly via `createStepDispatcherFeature()` in your app's feature list alongside any features that use `r.step.webhook.send` or `r.step.mail.send`. Requires the `secrets` feature (`createSecretsFeature()`) to be mounted — `webhook.send` auth resolves per-tenant through it, under `step-dispatcher:webhook-auth.<name>`. Every `webhook.send` request carries `Idempotency-Key: <dispatch stream id>`, stable across retries and redeliveries of the same dispatch request; an explicit `Idempotency-Key` in `headers` takes precedence.",
2663
+ "description": "Internal system feature that drains deferred Tier-2 side-effects (currently `webhook.send` and `mail.send`) after their originating transaction commits. An `r.multiStreamProjection` on the `kumiko:system:step.dispatch-requested` system event enqueues one `step-dispatcher:job:deliver` BullMQ job per dispatch (Redis carries only the stream id and tenant, never the request payload). The job performs the actual HTTP or mail delivery and appends `kumiko:system:step.dispatched` or `kumiko:system:step.dispatch-failed` back onto the same stream, so the outcome is recorded in the event log without a separate status table. Transient failures (network error, timeout, 5xx, 408, 429, any mail adapter failure) are retried 3 times with exponential backoff; the outcome is recorded after the final attempt and the payload key is erased only then. A request that still has no outcome after 24 hours (job stalled or lost, or its final attempt could not record one) is closed by the daily `step-dispatcher:job:sweep-abandoned` cron (it pages through all such requests; requests that already have an outcome are not swept) with a generic `dispatch-failed` event and its payload key is erased. Permanent failures (invalid url, blocked host, other 4xx, unavailable auth secret) are recorded immediately. At most 2 deliveries per tenant run at once (`maxPerTenant` with `onLimit: \"defer\"`), so a slow receiver of one tenant does not delay other tenants. Requires a job runner (Redis) and a worker consuming the job's default `worker` lane; without a job runner the projection fails loudly. Mount this feature explicitly via `createStepDispatcherFeature()` in your app's feature list alongside any features that use `r.step.webhook.send` or `r.step.mail.send`. Requires the `secrets` feature (`createSecretsFeature()`) to be mounted — `webhook.send` auth resolves per-tenant through it, under `step-dispatcher:webhook-auth.<name>`. Every `webhook.send` request carries `Idempotency-Key: <dispatch stream id>`, stable across retries and redeliveries of the same dispatch request; an explicit `Idempotency-Key` in `headers` takes precedence.",
2614
2664
  "toggleableDefault": null,
2615
2665
  "requires": [
2616
2666
  "secrets"
@@ -2657,7 +2707,7 @@
2657
2707
  },
2658
2708
  {
2659
2709
  "name": "subscription-paddle",
2660
- "description": "Paddle Billing provider plugin for `billing-foundation`. Paddle acts as merchant of record: it sells to the customer and issues invoice and VAT, so the consumer-protection texts for this provider come from `consumerProtection.providerTexts`. Reads its API key, webhook secret and tenant binding key from system config keys with `backing:\"secrets\"` (envelope-encrypted in the secrets store under the system tenant), the public Paddle.js `client-token`, a `billingLive` master switch and an `environment` key (sandbox | live). `environment` is its own key because Paddle serves sandbox and live from different API hosts and a live key must never hit the sandbox host or the other way round; `billingLive` only decides whether checkouts are offered at all. All of them are runtime config, so keys rotate and prod goes live without a redeploy, and the `mask` on each derives the sysadmin settings screen and nav. Mount via `createSubscriptionPaddleFeature({ priceToTier })`; the optional `apiKey`/`webhookSecret`/`tenantBindingKey`/`clientToken` options are env to config bridge fallbacks (`PADDLE_API_KEY`, `PADDLE_WEBHOOK_SECRET`, `PADDLE_TENANT_BINDING_KEY`, `PADDLE_CLIENT_TOKEN`). The plugin always mounts; `createCheckoutSession` throws `feature_disabled` unless `billingLive` is true, and billing counts as enabled only with API key and binding key present. Webhooks arrive at `/webhooks/subscription/paddle` when mounted through the server-runtime `billing.paddle` boot option, or at `/api/subscription/webhook/paddle` when `createSubscriptionWebhookRoute` is mounted by hand and are verified with the `Paddle-Signature` header (HMAC-SHA256 over `ts:rawBody` keyed with the raw secret, any `h1` may match, 5 minute tolerance). Paddle.js can open checkouts with arbitrary `customData` from the browser, so `custom_data.tenantId` is only trusted together with `tenantBinding`, an HMAC of the tenant id under the binding key; events without a valid binding, for prices outside `priceToTier` or without a tenant are dropped. Rotating the binding key makes the webhooks of existing subscriptions fail that check until they are re-bound. Paddle has no hosted checkout page, so the feature serves the Default Payment Link itself at `/billing/paddle-checkout` (the Default Payment Link in the Paddle dashboard must point to `<APP_BASE_URL>/billing/paddle-checkout`; it is the only source, because checkouts are created without a `checkout.url`). Create subscription prices in the Paddle catalog with quantity minimum and maximum 1; for one-off packs set the quantity limits on purpose, because the payment event carries `quantity` and the app has to multiply its credits by it: an anonymous page with its own CSP that loads Paddle.js from cdn.paddle.com, the one external script this framework allows, and opens the overlay for the transaction. Implements checkout, customer portal, cancel and resume, `retrievePrices` (batched, 10-minute TTL cache), `retrieveSubscription` for the sync job, and an in-app plan switch: `previewPlanSwitch` shows the proration before the customer confirms, `applyPlanSwitch` changes the plan without a hosted page and waits for the `subscription.updated` webhook to move the tier.",
2710
+ "description": "Paddle Billing provider plugin for `billing-foundation`. Paddle acts as merchant of record: it sells to the customer and issues invoice and VAT, so the consumer-protection texts for this provider come from `consumerProtection.providerTexts`. Reads its API key and webhook secret from system config keys with `backing:\"secrets\"` (envelope-encrypted in the secrets store under the system tenant), the public Paddle.js `client-token`, a `billingLive` master switch and an `environment` key (sandbox | live). `environment` is its own key because Paddle serves sandbox and live from different API hosts and a live key must never hit the sandbox host or the other way round; `billingLive` only decides whether checkouts are offered at all. All of them are runtime config, so keys rotate and prod goes live without a redeploy, and the `mask` on each derives the sysadmin settings screen and nav. Mount via `createSubscriptionPaddleFeature({ priceToTier })`; the optional `apiKey`/`webhookSecret`/`clientToken` options are env to config bridge fallbacks (`PADDLE_API_KEY`, `PADDLE_WEBHOOK_SECRET`, `PADDLE_CLIENT_TOKEN`). The plugin always mounts; `createCheckoutSession` throws `feature_disabled` unless `billingLive` is true, and billing counts as enabled only with the API key present. Webhooks arrive at `/webhooks/subscription/paddle` when mounted through the server-runtime `billing.paddle` boot option, or at `/api/subscription/webhook/paddle` when `createSubscriptionWebhookRoute` is mounted by hand and are verified with the `Paddle-Signature` header (HMAC-SHA256 over `ts:rawBody` keyed with the raw secret, any `h1` may match, 5 minute tolerance). Paddle.js can open checkouts with arbitrary `customData` from the browser, so `custom_data.tenantId` only locates the tenant stream: billing-foundation keeps a checkout ledger and accepts a webhook only for a transaction the server opened itself (a `subscription.created` must name it in `transaction_id`), so events for prices outside `priceToTier`, without a tenant or for foreign transactions are dropped. The `backfill-checkout-ledger` job ledgers Paddle checkouts that were open when the ledger was introduced, then goes quiet. Paddle has no hosted checkout page, so the feature serves the Default Payment Link itself at `/billing/paddle-checkout` (the Default Payment Link in the Paddle dashboard must point to `<APP_BASE_URL>/billing/paddle-checkout`; it is the only source, because checkouts are created without a `checkout.url`). Create subscription prices in the Paddle catalog with quantity minimum and maximum 1; for one-off packs set the quantity limits on purpose, because the payment event carries `quantity` and the app has to multiply its credits by it: an anonymous page with its own CSP that loads Paddle.js from cdn.paddle.com, the one external script this framework allows, and opens the overlay for the transaction. Implements checkout, customer portal, cancel and resume, `retrievePrices` (batched, 10-minute TTL cache), `retrieveSubscription` for the sync job, and an in-app plan switch: `previewPlanSwitch` shows the proration before the customer confirms, `applyPlanSwitch` changes the plan without a hosted page and waits for the `subscription.updated` webhook to move the tier.",
2661
2711
  "toggleableDefault": null,
2662
2712
  "requires": [
2663
2713
  "billing-foundation",
@@ -2763,27 +2813,6 @@
2763
2813
  "SystemAdmin"
2764
2814
  ]
2765
2815
  },
2766
- {
2767
- "key": "tenant-binding-key",
2768
- "qualifiedName": "subscription-paddle:config:tenant-binding-key",
2769
- "type": "text",
2770
- "scope": "system",
2771
- "default": null,
2772
- "encrypted": true,
2773
- "computed": false,
2774
- "validated": false,
2775
- "options": null,
2776
- "bounds": null,
2777
- "pattern": null,
2778
- "writeRoles": [
2779
- "SystemAdmin"
2780
- ],
2781
- "readRoles": [
2782
- "TenantAdmin",
2783
- "Admin",
2784
- "SystemAdmin"
2785
- ]
2786
- },
2787
2816
  {
2788
2817
  "key": "webhook-secret",
2789
2818
  "qualifiedName": "subscription-paddle:config:webhook-secret",
@@ -2807,7 +2836,9 @@
2807
2836
  }
2808
2837
  ],
2809
2838
  "secrets": [],
2810
- "writeHandlers": [],
2839
+ "writeHandlers": [
2840
+ "subscription-paddle:write:ledger-backfill-marker"
2841
+ ],
2811
2842
  "uiHints": {
2812
2843
  "displayLabel": "Billing · Paddle",
2813
2844
  "category": "billing",
@@ -1,7 +1,7 @@
1
1
  // @runtime test
2
2
  // English docs screenshots of the billing plans screen. Boots the gallery server with the docs
3
3
  // variant switched on (net prices with a note, gross recurring price in the plan switch); the
4
- // German review gallery has its own config. Gated by SCREENSHOT_DIR, see the `billing-docs` script.
4
+ // German review gallery has its own config. Gated by SCREENSHOT_DIR, see the `docs-guides` script.
5
5
  import { defineAppE2eConfig, PLAYWRIGHT_DEMO_ENV } from "@cosmicdrift/kumiko-testing/e2e";
6
6
  import { E2E_PORTS } from "../../e2e/e2e-ports";
7
7
  import { GALLERY_DOCS_VARIANT_ENV } from "./e2e-billing-gallery/gallery-constants";
@@ -25,6 +25,7 @@ const appConfig = defineAppE2eConfig({
25
25
  // that `playwright install chromium` provides instead of a Chrome download of its own.
26
26
  export default {
27
27
  ...appConfig,
28
+ globalSetup: "./e2e/global-setup.ts",
28
29
  webServer: [
29
30
  {
30
31
  command: "bun run src/index.ts",
@@ -126,7 +126,7 @@ async function seedTagsAndNotes(
126
126
  db,
127
127
  tenantId,
128
128
  mode: "system",
129
- reason: "demo seed writes tier assignments for the tenant being provisioned",
129
+ reason: "demo seed writes tags and notes for the tenant being provisioned",
130
130
  });
131
131
 
132
132
  const created = async (
@@ -36,6 +36,7 @@ import {
36
36
  import { createChannelSlackFeature } from "@cosmicdrift/kumiko-bundled-features/channel-slack";
37
37
  import { createChannelTeamsFeature } from "@cosmicdrift/kumiko-bundled-features/channel-teams";
38
38
  import { createChannelTelegramFeature } from "@cosmicdrift/kumiko-bundled-features/channel-telegram";
39
+ import { createChannelWhatsappFeature } from "@cosmicdrift/kumiko-bundled-features/channel-whatsapp";
39
40
  import { createComplianceProfilesFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
40
41
  import { createComplianceProfilesOpsFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles-ops";
41
42
  import { createCustomFieldsFeature } from "@cosmicdrift/kumiko-bundled-features/custom-fields";
@@ -192,6 +193,7 @@ export const APP_FEATURES = [
192
193
  createChannelDiscordFeature(),
193
194
  createChannelTeamsFeature(),
194
195
  createChannelTelegramFeature(),
196
+ createChannelWhatsappFeature(),
195
197
 
196
198
  ...composeMailStack({ transports: ["inmemory", "smtp"] }),
197
199
 
@@ -222,7 +224,6 @@ export const APP_FEATURES = [
222
224
  createSubscriptionPaddleFeature({
223
225
  apiKey: "paddle_smoke",
224
226
  webhookSecret: "pdl_ntfset_smoke",
225
- tenantBindingKey: "paddle_smoke_binding_key",
226
227
  clientToken: "test_smoke_client_token",
227
228
  priceToTier: { pri_smoke: "free" },
228
229
  }),
@@ -1,5 +1,5 @@
1
1
  import { usePrimitives } from "@cosmicdrift/kumiko-renderer";
2
- import { type ReactNode, useState } from "react";
2
+ import { type ReactNode, useRef, useState } from "react";
3
3
 
4
4
  const CONFIRMATION_CODE_LENGTH = 6;
5
5
 
@@ -13,15 +13,32 @@ export function ConfirmationCodeStep({ onConfirm }: ConfirmationCodeStepProps):
13
13
  const [code, setCode] = useState("");
14
14
  const [attempt, setAttempt] = useState(0);
15
15
  const [pending, setPending] = useState(false);
16
- const [rejected, setRejected] = useState(false);
16
+ const [confirmed, setConfirmed] = useState(false);
17
+ // A ref, not `pending`: two onComplete calls in one tick both see the stale render closure.
18
+ const inFlight = useRef(false);
19
+ const [failure, setFailure] = useState<"rejected" | "error" | null>(null);
17
20
 
18
21
  const confirm = async (submittedCode: string): Promise<void> => {
19
- if (pending) return;
22
+ if (inFlight.current) return;
23
+ inFlight.current = true;
20
24
  setPending(true);
21
- setRejected(false);
22
- const accepted = await onConfirm(submittedCode).finally(() => setPending(false));
23
- if (accepted) return;
24
- setRejected(true);
25
+ setFailure(null);
26
+ let accepted = false;
27
+ let technicalError = false;
28
+ try {
29
+ accepted = await onConfirm(submittedCode);
30
+ } catch {
31
+ // A network or server error must not leave the step stuck with a full field.
32
+ technicalError = true;
33
+ } finally {
34
+ inFlight.current = false;
35
+ setPending(false);
36
+ }
37
+ if (accepted) {
38
+ setConfirmed(true);
39
+ return;
40
+ }
41
+ setFailure(technicalError ? "error" : "rejected");
25
42
  setCode("");
26
43
  // The input was disabled while pending and lost focus; remounting restores autoFocus.
27
44
  setAttempt((n) => n + 1);
@@ -39,11 +56,16 @@ export function ConfirmationCodeStep({ onConfirm }: ConfirmationCodeStepProps):
39
56
  value={code}
40
57
  onChange={setCode}
41
58
  onComplete={(next) => void confirm(next)}
42
- disabled={pending}
43
- hasError={rejected}
59
+ disabled={pending || confirmed}
60
+ hasError={failure !== null}
44
61
  autoFocus
45
62
  />
46
- {rejected ? <Banner variant="error">That code is not valid. Try again.</Banner> : null}
63
+ {failure === "rejected" ? (
64
+ <Banner variant="error">That code is not valid. Try again.</Banner>
65
+ ) : null}
66
+ {failure === "error" ? (
67
+ <Banner variant="error">Could not verify the code. Try again in a moment.</Banner>
68
+ ) : null}
47
69
  </>
48
70
  );
49
71
  }
@@ -14,6 +14,8 @@ Shows how a feature posts to a tenant's Slack channel without ever handling the
14
14
 
15
15
  The same shape works for `channel-discord`, `channel-teams` (connection name + webhook secret) and `channel-telegram` (one `botToken` secret, the address is the chat id).
16
16
 
17
+ WhatsApp is two-way and not a delivery channel; `channel-whatsapp` is covered in `docs/guides/whatsapp-channel.md` and its own integration test.
18
+
17
19
  ## Run
18
20
 
19
21
  ```bash
@@ -72,3 +72,14 @@ deletion grace period.
72
72
  blind index immediately (`nullBlindIndexesForSubject`), and every
73
73
  projection rebuild recomputes it from the (now undecryptable) ciphertext
74
74
  to `NULL`.
75
+
76
+ ## Irreversible operations in jobs
77
+
78
+ `forget`, hard deletes, `kms.eraseKey` and writes to `readAsInstruction` fields are gated: they run only from a
79
+ handler marked `agent: { risk: "high" }`. A job or an event consumer has no handler entry, so it must declare
80
+ `irreversibleWithoutEntryHandler` on `r.job` or `r.multiStreamProjection`, or the gate refuses with
81
+ `irreversible_operation_without_entry_handler`. The value names why no entry handler exists:
82
+ `rebuildable-derived-data` (the data is derived and a rebuild recreates it), `high-risk-or-cron-pipeline`
83
+ (a maintenance pipeline that is high-risk by design, like `purge-archived-comments`) or
84
+ `per-dispatch-record-key` (the key belongs to one dispatch record). Hooks and routes never inherit the
85
+ declaration; they dispatch a `risk: "high"` handler instead.
@@ -1,4 +1,6 @@
1
+ import { buildEntityTable, createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
1
2
  import { createEntity, createTextField, defineFeature } from "@cosmicdrift/kumiko-framework/engine";
3
+ import * as z from "zod";
2
4
 
3
5
  export const employeeEntity = createEntity({
4
6
  table: "read_hr_employees",
@@ -20,6 +22,13 @@ export const hrCommentEntity = createEntity({
20
22
  softDelete: true,
21
23
  });
22
24
 
25
+ const hrCommentTable = buildEntityTable("hr-comment", hrCommentEntity);
26
+ const hrCommentExecutor = createEventStoreExecutor(hrCommentTable, hrCommentEntity, {
27
+ entityName: "hr-comment",
28
+ });
29
+
30
+ const purgeArchivedCommentsPayload = z.object({ commentIds: z.array(z.uuid()) });
31
+
23
32
  const hrWrite = { access: { roles: ["Admin"] } } as const;
24
33
  const hrRead = { access: { roles: ["Admin"] } } as const;
25
34
 
@@ -35,4 +44,22 @@ export const hrFeature = defineFeature("hr", (r) => {
35
44
  read: hrRead,
36
45
  verbs: { update: false, delete: false, restore: false, list: false },
37
46
  });
47
+
48
+ // A job runs without a write-handler entry, so the irreversible-operation gate refuses
49
+ // `forget` here unless the job declares why it may. Remove the declaration and the run fails.
50
+ r.job(
51
+ "purge-archived-comments",
52
+ {
53
+ trigger: { maintenance: true },
54
+ runIn: "worker",
55
+ irreversibleWithoutEntryHandler: "high-risk-or-cron-pipeline",
56
+ },
57
+ async (payload, ctx) => {
58
+ const { commentIds } = purgeArchivedCommentsPayload.parse(payload);
59
+ for (const id of commentIds) {
60
+ const result = await hrCommentExecutor.forget({ id }, ctx.systemUser, ctx.db);
61
+ if (!result.isSuccess) throw new Error(`purge of hr-comment ${id} failed`);
62
+ }
63
+ },
64
+ );
38
65
  });
@@ -6,6 +6,7 @@ import { createEntity, createTextField } from "@cosmicdrift/kumiko-framework/eng
6
6
 
7
7
  export const currencyEntity = createEntity({
8
8
  table: "read_sample_currencies",
9
+ systemRowsReadable: true,
9
10
  fields: {
10
11
  code: createTextField({ personal: false, reason: "is_reference_data", required: true }),
11
12
  name: createTextField({ personal: false, reason: "is_reference_data", required: true }),
@@ -13,6 +13,8 @@ opt-in, tier-gated **custom CSS** — the framework generalization of the
13
13
  branding applied as scoped `:root` vars, custom CSS allowlist-sanitized and
14
14
  contained in a `<style data-tenant-css>` block
15
15
  - 6 integration tests proving end-to-end behavior
16
+ - A custom preview renderer for the admin editor: `src/web/branded-preview.tsx` registers its own
17
+ `contentPreviews.web` next to `managedPagesClient()`, tested in `branded-preview.test.tsx`
16
18
 
17
19
  ## Layout
18
20
 
@@ -22,8 +24,10 @@ samples/recipes/managed-pages/
22
24
  ├── README.md # this file
23
25
  └── src/
24
26
  ├── feature.ts # the composed features re-exported for tests
27
+ ├── web/branded-preview.tsx # custom `contentPreviews` renderer (client feature)
25
28
  └── __tests__/
26
- └── feature.integration.test.ts # 6 tests: render + branding + CSS
29
+ ├── feature.integration.test.ts # 6 tests: render + branding + CSS
30
+ └── branded-preview.test.tsx # custom preview renderer in the editor workbench
27
31
  ```
28
32
 
29
33
  ## Run tests
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-sample-managed-pages",
3
- "description": "Tenant-editable, server-rendered public pages with per-tenant branding + tier-gated sanitized custom CSS — managed-pages wired up with config + anonymousAccess.",
3
+ "description": "Tenant-editable, server-rendered public pages with per-tenant branding + tier-gated sanitized custom CSS \u2014 managed-pages wired up with config + anonymousAccess.",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "@cosmicdrift/kumiko-bundled-features": "workspace:*",
7
- "@cosmicdrift/kumiko-framework": "workspace:*"
7
+ "@cosmicdrift/kumiko-framework": "workspace:*",
8
+ "@cosmicdrift/kumiko-renderer": "workspace:*"
8
9
  },
9
10
  "devDependencies": {
10
11
  "@cosmicdrift/kumiko-testing": "workspace:*"
@@ -0,0 +1,21 @@
1
+ import type { PreviewRenderer, PreviewRendererProps } from "@cosmicdrift/kumiko-renderer";
2
+ import type { ClientFeatureDefinition } from "@cosmicdrift/kumiko-renderer/web";
3
+ import type { ReactNode } from "react";
4
+
5
+ // A custom renderer for one preview target. The editor workbench hands it the draft content, the
6
+ // example variables and what is being edited; it decides how that looks. This one shows the body
7
+ // inside the shop's own page chrome instead of the framework's plain web frame.
8
+ const BrandedWebPreview: PreviewRenderer = ({ content }: PreviewRendererProps): ReactNode => (
9
+ <article data-testid="branded-preview" className="mx-auto max-w-[680px] border p-8">
10
+ <header className="mb-4 font-semibold tracking-wide">Acme Hardware</header>
11
+ <div data-testid="branded-preview-body" className="whitespace-pre-wrap">
12
+ {content}
13
+ </div>
14
+ </article>
15
+ );
16
+
17
+ // Registered next to managedPagesClient(): the later client feature wins the "web" target, and
18
+ // createKumikoApp logs the replacement once at boot.
19
+ export function brandedPreviewClient(): ClientFeatureDefinition {
20
+ return { name: "acme-branded-preview", contentPreviews: { web: BrandedWebPreview } };
21
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
5
+ "jsx": "react-jsx"
6
+ },
7
+ "include": ["src"]
8
+ }
@@ -0,0 +1,52 @@
1
+ # PWA shell
2
+
3
+ Make the web app installable and keep its shell available offline with one `pwa`
4
+ option. Pass the same object to `runProdApp` and to the dev server (`runDevApp` or
5
+ `createKumikoServer`); without it nothing changes and no service worker is registered.
6
+
7
+ ## What it shows
8
+
9
+ - **Manifest**: `GET /manifest.webmanifest` is built from `name`, `shortName`,
10
+ `themeColor`, `backgroundColor` and `icons` (`display: standalone`, scope `/`).
11
+ `/manifest.json` stays the hashed-asset map that `kumiko build` writes.
12
+ - **Head tags**: every HTML shell gets the manifest link, `theme-color`, the Apple
13
+ home-screen tags, an `apple-touch-icon` (largest icon that is not maskable) and
14
+ `<meta name="kumiko-pwa-sw">`. The web client registers the worker only when that
15
+ meta is present.
16
+ - **Service worker**: `GET /sw.js` is generated by the server, no build step and no
17
+ external library. It precaches `/`, the manifest, the icons and the hashed bundles,
18
+ serves `/assets/*` cache-first, goes to the network first for navigations and falls
19
+ back to the cached shell only when offline. `/api/`, `/sse/`, `/auth/`, SSE streams,
20
+ non-GET and cross-origin requests never touch the cache. A new build gets a new
21
+ cache name and the old cache is dropped on activate.
22
+ - **Install hint**: a one-time banner. iOS explains Share and "Add to Home Screen",
23
+ other browsers get an Install button behind `beforeinstallprompt`. "Not now" is
24
+ remembered in `localStorage`; standalone launches never show it.
25
+
26
+ - **Base path**: an app mounted below the origin root (for example `veridom.de/a`) sets
27
+ `basePath: "/a/"`. Only the shell, manifest and worker live under it: the manifest and
28
+ worker are served at `/a/manifest.webmanifest` and `/a/sw.js`, `start_url`, `scope`, the
29
+ shell precache and the offline fallback use `/a/`, and the client registers the worker with
30
+ the scope of its directory. A worker can only control its own directory, so it must live
31
+ under the base path. `/assets/*` and the API paths (`/api`, `/sse`, `/auth`) stay at the
32
+ origin root, so the ingress must route them to the app as well (for example `/a`, `/api`
33
+ and `/assets` on veridom.de). Each base path gets its own cache name prefix, so apps on one
34
+ origin do not delete each other's precache. The boot rejects a base path that does not
35
+ start and end with `/`, has an empty, `.` or `..` segment, or contains `?` or `#`.
36
+
37
+ Icons must be same-origin paths (`/icons/...`) served from `public/` in dev and
38
+ `dist/` in production; the boot rejects anything else. The default CSP
39
+ (`default-src 'self'`) already allows the manifest and the worker.
40
+
41
+ ## Flow
42
+
43
+ 1. `src/app.ts` defines the feature and the `pwa` option.
44
+ 2. `bin/server.ts` passes both to `runProdApp` with `staticDir: "dist"`.
45
+ 3. The test boots the dev server with the same option and checks the shell tags,
46
+ the manifest and the generated worker over HTTP.
47
+
48
+ ## Run
49
+
50
+ ```bash
51
+ bun kumiko test all samples/recipes/pwa-shell/
52
+ ```
@@ -0,0 +1,12 @@
1
+ import { composeEnvSchema } from "@cosmicdrift/kumiko-framework/env";
2
+ import { runProdApp } from "@cosmicdrift/kumiko-server-runtime";
3
+ import { notesFeature, pwa } from "../src/app";
4
+
5
+ const features = [notesFeature];
6
+
7
+ await runProdApp({
8
+ features,
9
+ envSchema: composeEnvSchema({ features }),
10
+ staticDir: "dist",
11
+ pwa,
12
+ });
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@cosmicdrift/kumiko-sample-pwa-shell",
3
+ "description": "pwa option on runProdApp and the dev server: web manifest, generated service worker with an offline app shell and a one-time install hint.",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "bun bin/server.ts"
7
+ },
8
+ "dependencies": {
9
+ "@cosmicdrift/kumiko-dev-server": "workspace:*",
10
+ "@cosmicdrift/kumiko-framework": "workspace:*",
11
+ "@cosmicdrift/kumiko-server-runtime": "workspace:*"
12
+ }
13
+ }
@@ -0,0 +1,34 @@
1
+ import { createEntity, createTextField, defineFeature } from "@cosmicdrift/kumiko-framework/engine";
2
+ import type { PwaOptions } from "@cosmicdrift/kumiko-server-runtime/pwa";
3
+
4
+ const noteEntity = createEntity({
5
+ fields: {
6
+ title: createTextField({ personal: false, reason: "is_business_data", required: true }),
7
+ },
8
+ table: "pwa_shell_note",
9
+ });
10
+
11
+ export const notesFeature = defineFeature("pwa-notes", (r) => {
12
+ r.entity({ name: "note", ...noteEntity });
13
+ });
14
+
15
+ // Icons live in public/ (dist/ after kumiko build); the boot rejects any src that is not a
16
+ // same-origin path.
17
+ export const pwa: PwaOptions = {
18
+ name: "Field Notes",
19
+ shortName: "Notes",
20
+ themeColor: "#14532d",
21
+ backgroundColor: "#ffffff",
22
+ icons: [
23
+ { src: "/icons/icon-192.png", sizes: "192x192", type: "image/png" },
24
+ { src: "/icons/icon-512.png", sizes: "512x512", type: "image/png" },
25
+ {
26
+ src: "/icons/icon-maskable-512.png",
27
+ sizes: "512x512",
28
+ type: "image/png",
29
+ purpose: "maskable",
30
+ },
31
+ ],
32
+ };
33
+
34
+ export const pwaUnderBasePath: PwaOptions = { ...pwa, basePath: "/a/" };
@@ -41,9 +41,9 @@ r.writeHandler({
41
41
  });
42
42
  ```
43
43
 
44
- The cost is computed from the validated payload and booked on every declared bucket, so an
45
- invalid payload costs nothing and a rejected request consumes nothing. Results below 1 count
46
- as 1. Because it books after the parse, boot rejects `rateLimitCost` on anonymous or ip-limited
44
+ The cost is computed from the validated payload and booked on every declared bucket, so a
45
+ schema-invalid payload costs nothing, while a payload rejected afterwards by a validation hook or
46
+ field roles still consumes its cost. Results below 1 count as 1. Because it books after the parse, boot rejects `rateLimitCost` on anonymous or ip-limited
47
47
  handlers.
48
48
 
49
49
  ## Per-payload limits