@cosmicdrift/kumiko-samples 0.406.0 → 0.409.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 (238) hide show
  1. package/package.json +1 -1
  2. package/packages/bundled-features/package.json +26 -4
  3. package/packages/bundled-features/src/account-security/feature.ts +9 -1
  4. package/packages/bundled-features/src/admin-shell/changes.json +6 -0
  5. package/packages/bundled-features/src/admin-shell/feature.ts +4 -1
  6. package/packages/bundled-features/src/agent-tools/agent-manifest.ts +1 -0
  7. package/packages/bundled-features/src/agent-tools/changes.json +6 -0
  8. package/packages/bundled-features/src/agent-tools/tool-catalog.ts +1 -0
  9. package/packages/bundled-features/src/agent-tools/types.ts +4 -0
  10. package/packages/bundled-features/src/audit/event-classification.ts +1 -0
  11. package/packages/bundled-features/src/auth-email-password/bootstrap.ts +1 -0
  12. package/packages/bundled-features/src/auth-email-password/errors.ts +18 -66
  13. package/packages/bundled-features/src/auth-email-password/web/auth-client.ts +30 -64
  14. package/packages/bundled-features/src/auth-email-password/web/auth-redirect.ts +2 -2
  15. package/packages/bundled-features/src/auth-email-password/web/confirm-account-unlock-screen.tsx +20 -66
  16. package/packages/bundled-features/src/auth-email-password/web/index.ts +1 -0
  17. package/packages/bundled-features/src/auth-email-password/web/read-path-param.ts +8 -0
  18. package/packages/bundled-features/src/auth-email-password/web/return-path.ts +3 -2
  19. package/packages/bundled-features/src/auth-email-password/web/token-confirm-screen.tsx +97 -0
  20. package/packages/bundled-features/src/auth-email-password/web/verify-email-screen.tsx +20 -68
  21. package/packages/bundled-features/src/auth-foundation/boot-checks.ts +22 -15
  22. package/packages/bundled-features/src/auth-foundation/boot-rules.ts +33 -0
  23. package/packages/bundled-features/src/auth-mfa/errors.ts +12 -42
  24. package/packages/bundled-features/src/auth-mfa/feature-exports.ts +6 -45
  25. package/packages/bundled-features/src/auth-mfa/feature.ts +8 -19
  26. package/packages/bundled-features/src/auth-mfa/web/mfa-client.ts +19 -33
  27. package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-notify.ts +1 -0
  28. package/packages/bundled-features/src/billing-foundation/web/plan-price.ts +20 -7
  29. package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +1 -0
  30. package/packages/bundled-features/src/channel-in-app/changes.json +7 -0
  31. package/packages/bundled-features/src/channel-in-app/feature.ts +2 -0
  32. package/packages/bundled-features/src/channel-in-app/handlers/read-state-by-keys.query.ts +35 -0
  33. package/packages/bundled-features/src/channel-in-app/in-app-channel.ts +1 -0
  34. package/packages/bundled-features/src/channel-in-app/tables.ts +5 -1
  35. package/packages/bundled-features/src/contact/challenge.ts +41 -0
  36. package/packages/bundled-features/src/contact/changes.json +27 -0
  37. package/packages/bundled-features/src/contact/client/contact-client-source.ts +203 -0
  38. package/packages/bundled-features/src/contact/entity.ts +168 -0
  39. package/packages/bundled-features/src/contact/feature.ts +171 -0
  40. package/packages/bundled-features/src/contact/handlers/access.ts +17 -0
  41. package/packages/bundled-features/src/contact/handlers/attempts.ts +76 -0
  42. package/packages/bundled-features/src/contact/handlers/challenge.query.ts +44 -0
  43. package/packages/bundled-features/src/contact/handlers/forward-request.write.ts +98 -0
  44. package/packages/bundled-features/src/contact/handlers/mark-done.write.ts +40 -0
  45. package/packages/bundled-features/src/contact/handlers/notify-reporter-in-app.write.ts +48 -0
  46. package/packages/bundled-features/src/contact/handlers/open-count.query.ts +15 -0
  47. package/packages/bundled-features/src/contact/handlers/open-count.ts +17 -0
  48. package/packages/bundled-features/src/contact/handlers/replies.query.ts +29 -0
  49. package/packages/bundled-features/src/contact/handlers/reply.write.ts +197 -0
  50. package/packages/bundled-features/src/contact/handlers/report.write.ts +126 -0
  51. package/packages/bundled-features/src/contact/handlers/request-delivery.query.ts +143 -0
  52. package/packages/bundled-features/src/contact/handlers/request-detail.query.ts +50 -0
  53. package/packages/bundled-features/src/contact/handlers/request-list.query.ts +14 -0
  54. package/packages/bundled-features/src/contact/handlers/send-reply-mail.write.ts +124 -0
  55. package/packages/bundled-features/src/contact/handlers/send-test.write.ts +45 -0
  56. package/packages/bundled-features/src/contact/handlers/submit.write.ts +194 -0
  57. package/packages/bundled-features/src/contact/handlers/take-over-uploads.ts +47 -0
  58. package/packages/bundled-features/src/contact/i18n.ts +189 -0
  59. package/packages/bundled-features/src/contact/index.ts +29 -0
  60. package/packages/bundled-features/src/contact/lib.ts +176 -0
  61. package/packages/bundled-features/src/contact/mail.ts +401 -0
  62. package/packages/bundled-features/src/contact/options.ts +95 -0
  63. package/packages/bundled-features/src/contact/panels.ts +28 -0
  64. package/packages/bundled-features/src/contact/payloads.ts +106 -0
  65. package/packages/bundled-features/src/contact/pow.ts +22 -0
  66. package/packages/bundled-features/src/contact/screens.ts +506 -0
  67. package/packages/bundled-features/src/contact/subject.ts +13 -0
  68. package/packages/bundled-features/src/contact/user-agent.ts +39 -0
  69. package/packages/bundled-features/src/contact/user-data-hooks.ts +180 -0
  70. package/packages/bundled-features/src/contact/web/constants.ts +160 -0
  71. package/packages/bundled-features/src/contact/web/index.ts +29 -0
  72. package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +5 -16
  73. package/packages/bundled-features/src/data-retention/changes.json +6 -0
  74. package/packages/bundled-features/src/data-retention/feature.ts +16 -2
  75. package/packages/bundled-features/src/data-retention/index.ts +5 -0
  76. package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +138 -41
  77. package/packages/bundled-features/src/data-retention/tenant-destruction-hold.ts +196 -0
  78. package/packages/bundled-features/src/delivery/address-opt-out.ts +1 -0
  79. package/packages/bundled-features/src/delivery/changes.json +7 -0
  80. package/packages/bundled-features/src/delivery/channel-context.ts +2 -0
  81. package/packages/bundled-features/src/delivery/delivery-service.ts +29 -5
  82. package/packages/bundled-features/src/delivery/events.ts +2 -0
  83. package/packages/bundled-features/src/delivery/feature.ts +3 -2
  84. package/packages/bundled-features/src/delivery/handlers/attempts-by-keys.query.ts +55 -0
  85. package/packages/bundled-features/src/delivery/handlers/log.query.ts +1 -1
  86. package/packages/bundled-features/src/delivery/jobs.ts +5 -0
  87. package/packages/bundled-features/src/delivery/tables.ts +13 -2
  88. package/packages/bundled-features/src/delivery/types.ts +3 -0
  89. package/packages/bundled-features/src/delivery/unsubscribe-page.ts +2 -0
  90. package/packages/bundled-features/src/delivery/web/delivery-channel-cell.tsx +1 -1
  91. package/packages/bundled-features/src/delivery/web/delivery-error-cell.tsx +1 -1
  92. package/packages/bundled-features/src/delivery/web/delivery-status-cell.tsx +1 -1
  93. package/packages/bundled-features/src/delivery/web/delivery-time-cell.tsx +3 -2
  94. package/packages/bundled-features/src/delivery/web/delivery-type-cell.tsx +1 -1
  95. package/packages/bundled-features/src/delivery/web/public-names.ts +1 -0
  96. package/packages/bundled-features/src/document-ingest-foundation/boot-checks.ts +14 -9
  97. package/packages/bundled-features/src/document-ingest-foundation/boot-rules.ts +22 -0
  98. package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
  99. package/packages/bundled-features/src/document-ingest-foundation/events.ts +17 -0
  100. package/packages/bundled-features/src/document-ingest-foundation/feature.ts +39 -1
  101. package/packages/bundled-features/src/document-ingest-foundation/index.ts +10 -0
  102. package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +43 -0
  103. package/packages/bundled-features/src/document-ingest-foundation/tables.ts +43 -0
  104. package/packages/bundled-features/src/files-tenant-data/changes.json +6 -0
  105. package/packages/bundled-features/src/files-tenant-data/hooks.ts +4 -1
  106. package/packages/bundled-features/src/folders/web/folder-manager.tsx +8 -9
  107. package/packages/bundled-features/src/folders/web/folder-section.tsx +1 -1
  108. package/packages/bundled-features/src/form-draft-user-data/index.ts +2 -0
  109. package/packages/bundled-features/src/inbound-mail-foundation/changes.json +13 -0
  110. package/packages/bundled-features/src/inbound-mail-foundation/entities.ts +2 -0
  111. package/packages/bundled-features/src/inbound-mail-foundation/events.ts +2 -0
  112. package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +6 -6
  113. package/packages/bundled-features/src/inbound-mail-foundation/handlers/attach-message-content.write.ts +7 -0
  114. package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +6 -0
  115. package/packages/bundled-features/src/inbound-mail-foundation/handlers/list-messages.query.ts +6 -2
  116. package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.query.ts +3 -0
  117. package/packages/bundled-features/src/inbound-mail-foundation/handlers/message-content.ts +19 -0
  118. package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +2 -0
  119. package/packages/bundled-features/src/inbound-mail-foundation/sanitize-inbound-html.ts +150 -0
  120. package/packages/bundled-features/src/inbound-mail-foundation/types.ts +1 -0
  121. package/packages/bundled-features/src/jobs/job-run-logger.ts +24 -25
  122. package/packages/bundled-features/src/ledger/handlers/reports.query.ts +46 -31
  123. package/packages/bundled-features/src/ledger/recurring.ts +1 -0
  124. package/packages/bundled-features/src/notes-history/web/notes-section.tsx +3 -1
  125. package/packages/bundled-features/src/personal-access-tokens/feature.ts +9 -17
  126. package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +2 -7
  127. package/packages/bundled-features/src/secrets/changes.json +6 -0
  128. package/packages/bundled-features/src/secrets/handlers/delete.write.ts +8 -4
  129. package/packages/bundled-features/src/secrets/handlers/list.query.ts +6 -3
  130. package/packages/bundled-features/src/secrets/handlers/set.write.ts +9 -4
  131. package/packages/bundled-features/src/secrets/secret-scope.ts +33 -0
  132. package/packages/bundled-features/src/sessions/changes.json +6 -0
  133. package/packages/bundled-features/src/sessions/feature.ts +21 -18
  134. package/packages/bundled-features/src/sessions/handlers/last-activity-probe.query.ts +53 -0
  135. package/packages/bundled-features/src/sessions/handlers/last-activity-probe.route.ts +39 -0
  136. package/packages/bundled-features/src/sessions/screens.ts +1 -0
  137. package/packages/bundled-features/src/sessions/session-callbacks.ts +13 -12
  138. package/packages/bundled-features/src/sessions/web/i18n.ts +4 -1
  139. package/packages/bundled-features/src/shared/assert-billing-live.ts +14 -0
  140. package/packages/bundled-features/src/shared/collect-extension-options.ts +12 -0
  141. package/packages/bundled-features/src/shared/index.ts +16 -0
  142. package/packages/bundled-features/src/shared/late-bound-slot.ts +19 -0
  143. package/packages/bundled-features/src/shared/mail-locale-templates.ts +7 -1
  144. package/packages/bundled-features/src/shared/price-env-shape.ts +44 -0
  145. package/packages/bundled-features/src/shared/purge-row-file-refs.ts +1 -1
  146. package/packages/bundled-features/src/shared/read-feature-export-fn.ts +16 -0
  147. package/packages/bundled-features/src/shared/signup-handover.ts +3 -4
  148. package/packages/bundled-features/src/shared/tenant-destruction-hold.ts +49 -0
  149. package/packages/bundled-features/src/shared/unprocessable.ts +19 -0
  150. package/packages/bundled-features/src/shared/web/index.ts +3 -0
  151. package/packages/bundled-features/src/subscription-paddle/feature.ts +7 -15
  152. package/packages/bundled-features/src/subscription-paddle/runtime.ts +4 -7
  153. package/packages/bundled-features/src/subscription-stripe/feature.ts +7 -15
  154. package/packages/bundled-features/src/subscription-stripe/runtime.ts +4 -7
  155. package/packages/bundled-features/src/tags/entity.ts +1 -0
  156. package/packages/bundled-features/src/tags/web/tag-chip.tsx +14 -0
  157. package/packages/bundled-features/src/tags/web/tag-filter.tsx +4 -5
  158. package/packages/bundled-features/src/tags/web/tag-manager.tsx +1 -1
  159. package/packages/bundled-features/src/tags/web/tag-section.tsx +3 -6
  160. package/packages/bundled-features/src/tags/web/tags-cell.tsx +4 -5
  161. package/packages/bundled-features/src/template-resolver/compile-document-body.ts +27 -15
  162. package/packages/bundled-features/src/template-resolver/handlers/by-tenant.query.ts +11 -8
  163. package/packages/bundled-features/src/template-resolver/handlers/discard-draft.write.ts +1 -0
  164. package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +1 -0
  165. package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +5 -5
  166. package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +3 -0
  167. package/packages/bundled-features/src/template-resolver/linked-resources.ts +11 -6
  168. package/packages/bundled-features/src/template-resolver/store-template-resource.ts +15 -12
  169. package/packages/bundled-features/src/template-resolver/web/document-images.ts +6 -6
  170. package/packages/bundled-features/src/template-resolver/web/document-insert-fields.tsx +41 -36
  171. package/packages/bundled-features/src/template-resolver/web/document-schema.ts +11 -12
  172. package/packages/bundled-features/src/template-resolver/web/tiptap-attribute-parse-rule.ts +19 -0
  173. package/packages/bundled-features/src/tenant/i18n.ts +3 -0
  174. package/packages/bundled-features/src/tenant/schema/tenant.ts +1 -0
  175. package/packages/bundled-features/src/tenant/web/member-roles-cell.tsx +1 -1
  176. package/packages/bundled-features/src/tenant/web/member-status-cell.tsx +1 -1
  177. package/packages/bundled-features/src/tenant-inactivity/changes.json +8 -0
  178. package/packages/bundled-features/src/tenant-inactivity/check-inactive-tenants.ts +260 -0
  179. package/packages/bundled-features/src/tenant-inactivity/constants.ts +12 -0
  180. package/packages/bundled-features/src/tenant-inactivity/email-templates.ts +24 -0
  181. package/packages/bundled-features/src/tenant-inactivity/feature.ts +66 -0
  182. package/packages/bundled-features/src/tenant-inactivity/handlers/inactivity-state.query.ts +49 -0
  183. package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +56 -0
  184. package/packages/bundled-features/src/tenant-inactivity/inactivity-plan.ts +187 -0
  185. package/packages/bundled-features/src/tenant-inactivity/index.ts +5 -0
  186. package/packages/bundled-features/src/tenant-inactivity/keep-token.ts +44 -0
  187. package/packages/bundled-features/src/tenant-inactivity/mail-notifications.ts +62 -0
  188. package/packages/bundled-features/src/tenant-inactivity/options.ts +38 -0
  189. package/packages/bundled-features/src/tenant-inactivity/remote-activity.ts +32 -0
  190. package/packages/bundled-features/src/tenant-inactivity/state-store.ts +71 -0
  191. package/packages/bundled-features/src/tenant-inactivity/state-table.ts +50 -0
  192. package/packages/bundled-features/src/tenant-lifecycle/boot-checks.ts +8 -6
  193. package/packages/bundled-features/src/tenant-lifecycle/boot-rules.ts +16 -0
  194. package/packages/bundled-features/src/tenant-lifecycle/changes.json +18 -0
  195. package/packages/bundled-features/src/tenant-lifecycle/feature.ts +24 -1
  196. package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +12 -87
  197. package/packages/bundled-features/src/tenant-lifecycle/index.ts +4 -0
  198. package/packages/bundled-features/src/tenant-lifecycle/request-tenant-destruction.ts +108 -0
  199. package/packages/bundled-features/src/tenant-lifecycle/retention-config-destroy-hooks.ts +62 -0
  200. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +58 -5
  201. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +31 -2
  202. package/packages/bundled-features/src/tenant-lifecycle/testing.ts +1 -1
  203. package/packages/bundled-features/src/tier-engine/caps-for-tier-from-map.ts +16 -0
  204. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  205. package/packages/bundled-features/src/tier-engine/compose-app.ts +21 -20
  206. package/packages/bundled-features/src/tier-engine/index.ts +1 -0
  207. package/packages/bundled-features/src/user-data-rights/feature.ts +2 -0
  208. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +2 -0
  209. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  210. package/packages/bundled-features/src/user-data-rights/zip-path.ts +1 -0
  211. package/packages/bundled-features/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts +8 -27
  212. package/packages/bundled-features/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +11 -8
  213. package/packages/bundled-features/src/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.ts +42 -0
  214. package/packages/bundled-features/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +8 -27
  215. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +2 -6
  216. package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
  217. package/samples/apps/styleguide/src/features/widgets/i18n.ts +6 -0
  218. package/samples/apps/styleguide/src/features/widgets/web/InboxReaderExamples.tsx +158 -0
  219. package/samples/apps/styleguide/src/features/widgets/web/Widgets.tsx +2 -0
  220. package/samples/apps/styleguide/src/features/widgets/web/sample-pdf.ts +28 -0
  221. package/samples/apps/use-all-bundled/feature-manifest.json +134 -2
  222. package/samples/apps/use-all-bundled/kumiko/migrations/0063_contact.rebuild.json +4 -0
  223. package/samples/apps/use-all-bundled/package.json +1 -0
  224. package/samples/apps/use-all-bundled/playwright.config.ts +2 -0
  225. package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
  226. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +46 -2
  227. package/samples/apps/use-all-bundled/src/run-config.ts +38 -4
  228. package/samples/recipes/contact/README.md +46 -0
  229. package/samples/recipes/contact/package.json +12 -0
  230. package/samples/recipes/contact/src/feature.ts +27 -0
  231. package/samples/recipes/delivery-notifications/src/feature.ts +3 -0
  232. package/samples/recipes/record-detail-layout/src/feature.ts +9 -1
  233. package/samples/recipes/search/README.md +2 -0
  234. package/samples/recipes/search/src/feature.ts +27 -2
  235. package/samples/recipes/secrets-demo/README.md +1 -0
  236. package/samples/recipes/secrets-demo/src/feature.ts +56 -0
  237. package/samples/recipes/tenant-inactivity/README.md +21 -0
  238. package/samples/recipes/tenant-inactivity/package.json +12 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "source": "samples/apps/use-all-bundled APP_FEATURES (composeFeatures includeBundled + signup)",
3
- "featureCount": 90,
3
+ "featureCount": 92,
4
4
  "features": [
5
5
  {
6
6
  "name": "account-security",
@@ -694,6 +694,94 @@
694
694
  "recommended": true
695
695
  }
696
696
  },
697
+ {
698
+ "name": "contact",
699
+ "description": "Contact inbox: an anonymous browser client (GET /contact/client.js) submits questions, contact requests, bug reports and wishes behind a honeypot, a minimum submit time and a single-use proof-of-work challenge; signed-in users file reports from the admin. Every request is stored platform-wide and every SystemAdmin is notified by mail, optionally also in a Telegram chat (option `telegram`, off by default); the notification names only the kind, the app and a link, never name, address, phone, subject or message, because mail and Telegram cannot be shredded. SystemAdmins reply by mail (Reply-To set, attachments, quoting the original) and mark requests done; a website sender gets a fixed acknowledgement, a signed-in reporter a copy and an in-app note. Personal data is crypto-shredding-ready and the EXT_USER_DATA hooks export and erase a user's requests.",
700
+ "toggleableDefault": null,
701
+ "adoptsBundledLists": true,
702
+ "requires": [
703
+ "config",
704
+ "delivery",
705
+ "user-data-rights",
706
+ "files",
707
+ "notes-history",
708
+ "channel-telegram"
709
+ ],
710
+ "optionalRequires": [],
711
+ "configReads": [],
712
+ "exposesApis": [],
713
+ "usesApis": [],
714
+ "extensionsUsed": [
715
+ {
716
+ "extensionName": "userData",
717
+ "entityName": "contact-request"
718
+ },
719
+ {
720
+ "extensionName": "userData",
721
+ "entityName": "contact-reply"
722
+ }
723
+ ],
724
+ "configKeys": [
725
+ {
726
+ "key": "reply-to",
727
+ "qualifiedName": "contact:config:reply-to",
728
+ "type": "text",
729
+ "scope": "system",
730
+ "default": "",
731
+ "encrypted": false,
732
+ "computed": false,
733
+ "validated": false,
734
+ "options": null,
735
+ "bounds": null,
736
+ "pattern": {
737
+ "regex": "^$|^[^\\s@<>]{1,64}@[^\\s@<>]{1,200}\\.[^\\s@<>]{2,24}$"
738
+ },
739
+ "writeRoles": [
740
+ "SystemAdmin"
741
+ ],
742
+ "readRoles": [
743
+ "SystemAdmin"
744
+ ]
745
+ },
746
+ {
747
+ "key": "telegram-chat",
748
+ "qualifiedName": "contact:config:telegram-chat",
749
+ "type": "text",
750
+ "scope": "system",
751
+ "default": "",
752
+ "encrypted": false,
753
+ "computed": false,
754
+ "validated": false,
755
+ "options": null,
756
+ "bounds": null,
757
+ "pattern": {
758
+ "regex": "^$|^(-?[0-9]{1,20}|@[A-Za-z0-9_]{5,32})$"
759
+ },
760
+ "writeRoles": [
761
+ "SystemAdmin"
762
+ ],
763
+ "readRoles": [
764
+ "SystemAdmin"
765
+ ]
766
+ }
767
+ ],
768
+ "secrets": [],
769
+ "writeHandlers": [
770
+ "contact:write:forward-request",
771
+ "contact:write:mark-done",
772
+ "contact:write:notify-reporter-in-app",
773
+ "contact:write:reply",
774
+ "contact:write:report",
775
+ "contact:write:send-reply-mail",
776
+ "contact:write:send-test",
777
+ "contact:write:submit"
778
+ ],
779
+ "uiHints": {
780
+ "displayLabel": "Contact",
781
+ "category": "communication",
782
+ "recommended": false
783
+ }
784
+ },
697
785
  {
698
786
  "name": "crypto-shredding",
699
787
  "description": "Operator-level crypto-shredding trigger. `forget-subject` erases a user or tenant subject key in the configured KMS adapter, making every PII field encrypted under it permanently unreadable (reads render the `[[erased]]` sentinel), and appends a `subject-forgotten` audit event. Requires a KMS adapter (`runProdApp({ kms })`). The automated Art.-17 deletion pipeline in `user-data-rights` erases keys itself; this command covers manual forgets (authority requests, operator recovery, tenant destroy).",
@@ -3164,6 +3252,37 @@
3164
3252
  "recommended": false
3165
3253
  }
3166
3254
  },
3255
+ {
3256
+ "name": "tenant-inactivity",
3257
+ "description": "Deletes abandoned free accounts: warns the tenant owners before the deadline, then files the regular tenant-lifecycle deletion request. Activity or the keep-account link restarts the period; tiers without a rule are exempt.",
3258
+ "toggleableDefault": null,
3259
+ "requires": [
3260
+ "sessions",
3261
+ "tenant",
3262
+ "tenant-lifecycle",
3263
+ "delivery"
3264
+ ],
3265
+ "optionalRequires": [],
3266
+ "configReads": [],
3267
+ "exposesApis": [],
3268
+ "usesApis": [],
3269
+ "extensionsUsed": [
3270
+ {
3271
+ "extensionName": "tenantData",
3272
+ "entityName": "tenant-inactivity-state"
3273
+ }
3274
+ ],
3275
+ "configKeys": [],
3276
+ "secrets": [],
3277
+ "writeHandlers": [
3278
+ "tenant-inactivity:write:keep-account"
3279
+ ],
3280
+ "uiHints": {
3281
+ "displayLabel": "Tenant Inactivity · Deletion",
3282
+ "category": "compliance",
3283
+ "recommended": false
3284
+ }
3285
+ },
3167
3286
  {
3168
3287
  "name": "tenant-lifecycle",
3169
3288
  "description": "Tenant-destroy lifecycle: request/cancel destruction with compliance-profile grace, auth 410 gate for teardown states, cron trigger after grace, and staged destroy runner (extension fan-out, subject-key erase, tenant tombstone).",
@@ -3173,7 +3292,8 @@
3173
3292
  "compliance-profiles"
3174
3293
  ],
3175
3294
  "optionalRequires": [
3176
- "sessions"
3295
+ "sessions",
3296
+ "data-retention"
3177
3297
  ],
3178
3298
  "configReads": [],
3179
3299
  "exposesApis": [
@@ -3183,6 +3303,18 @@
3183
3303
  "compliance.forTenant"
3184
3304
  ],
3185
3305
  "extensionsUsed": [
3306
+ {
3307
+ "extensionName": "tenantDestructionHold",
3308
+ "entityName": "tenant-lifecycle"
3309
+ },
3310
+ {
3311
+ "extensionName": "tenantData",
3312
+ "entityName": "tenant-compliance-profile"
3313
+ },
3314
+ {
3315
+ "extensionName": "tenantData",
3316
+ "entityName": "tenant-retention-override"
3317
+ },
3186
3318
  {
3187
3319
  "extensionName": "tenantLifecycleStatus",
3188
3320
  "entityName": "tenant-lifecycle"
@@ -0,0 +1,4 @@
1
+ {
2
+ "version": 1,
3
+ "tables": ["read_contact_replies", "read_contact_requests"]
4
+ }
@@ -11,6 +11,7 @@
11
11
  "screenshots": "bun x playwright test e2e/screenshots.spec.ts --config=playwright.config.ts",
12
12
  "billing-gallery": "bun x playwright test --config=playwright.billing-gallery.config.ts",
13
13
  "docs-guides": "bun x playwright test e2e/docs-guides.screenshots.spec.ts --config=playwright.config.ts && bun x playwright test --config=playwright.billing-docs.config.ts",
14
+ "contact-shots": "bun x playwright test e2e/contact.screenshots.spec.ts --config=playwright.config.ts",
14
15
  "e2e": "bun x playwright test e2e/mfa-login.spec.ts --config=playwright.config.ts",
15
16
  "gen:manifest": "bun run scripts/gen-feature-manifest.ts",
16
17
  "gen:sample-index": "bun run scripts/gen-sample-index.ts"
@@ -8,6 +8,7 @@ import { chromium } from "@playwright/test";
8
8
  import { E2E_PORTS } from "../../e2e/e2e-ports";
9
9
 
10
10
  const PORT = E2E_PORTS["framework/use-all-bundled"];
11
+ const FAKE_TELEGRAM_PORT = E2E_PORTS["framework/use-all-bundled-fake-telegram"];
11
12
  const PRINT_SERVICE_PORT = E2E_PORTS["framework/use-all-bundled-puppeteer-service"];
12
13
  // Both sides of the print service handshake; any value of 16+ characters will do for a local run.
13
14
  const PRINT_SERVICE_TOKEN = "use-all-bundled-e2e-print-service";
@@ -18,6 +19,7 @@ const appConfig = defineAppE2eConfig({
18
19
  ...PLAYWRIGHT_DEMO_ENV,
19
20
  PUPPETEER_SERVICE_URL: `http://127.0.0.1:${PRINT_SERVICE_PORT}`,
20
21
  PUPPETEER_AUTH_TOKEN: PRINT_SERVICE_TOKEN,
22
+ SAMPLE_TELEGRAM_API_URL: `http://127.0.0.1:${FAKE_TELEGRAM_PORT}`,
21
23
  },
22
24
  });
23
25
 
@@ -29,6 +29,7 @@ import { foldersClient } from "@cosmicdrift/kumiko-bundled-features/folders/web"
29
29
  import { inboundMailFoundationClient } from "@cosmicdrift/kumiko-bundled-features/inbound-mail-foundation/web";
30
30
  import { jobsClient } from "@cosmicdrift/kumiko-bundled-features/jobs/web";
31
31
  import { managedPagesClient } from "@cosmicdrift/kumiko-bundled-features/managed-pages/web";
32
+ import { notesHistoryClient } from "@cosmicdrift/kumiko-bundled-features/notes-history/web";
32
33
  import { sessionsClient } from "@cosmicdrift/kumiko-bundled-features/sessions/web";
33
34
  import { tagsClient } from "@cosmicdrift/kumiko-bundled-features/tags/web";
34
35
  import { textBlocksClient } from "@cosmicdrift/kumiko-bundled-features/template-resolver/web";
@@ -119,6 +120,8 @@ createKumikoApp({
119
120
  userProfileClient(),
120
121
  customFieldsClient(),
121
122
  foldersClient(),
123
+ // The contact request detail frames its internal notes with the NotesSection extension.
124
+ notesHistoryClient(),
122
125
  inboundMailFoundationClient(),
123
126
  complianceProfilesClient(),
124
127
  featureTogglesClient(),
@@ -5,13 +5,20 @@
5
5
  // (#1258): an open screen not reachable via nav is no longer an eligible
6
6
  // fallback candidate.
7
7
 
8
+ import { ContactScreens } from "@cosmicdrift/kumiko-bundled-features/contact";
8
9
  import { MAIL_ACCOUNT_LIST_SCREEN_QN } from "@cosmicdrift/kumiko-bundled-features/inbound-mail-foundation";
9
- import { defineFeature, type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
10
+ import {
11
+ access,
12
+ defineFeature,
13
+ type FeatureDefinition,
14
+ } from "@cosmicdrift/kumiko-framework/engine";
10
15
  import { ADMIN_NAV_QN, ADMIN_NAV_WORKSPACES } from "./admin-nav-feature";
11
16
 
17
+ const PLATFORM_WORKSPACES = ["admin-shell:workspace:platform"] as const;
18
+
12
19
  export const appScreensFeature: FeatureDefinition = defineFeature("app-screens", (r) => {
13
20
  r.describe("App-side nav placement for the user-profile self-service page and the mailbox list.");
14
- r.requires({ features: ["user-profile", "inbound-mail-foundation"] });
21
+ r.requires({ features: ["user-profile", "inbound-mail-foundation", "contact"] });
15
22
  r.nav({
16
23
  id: "profile",
17
24
  label: "screen:profile.title",
@@ -40,8 +47,45 @@ export const appScreensFeature: FeatureDefinition = defineFeature("app-screens",
40
47
  workspaces: ADMIN_NAV_WORKSPACES,
41
48
  order: 20,
42
49
  });
50
+ r.nav({
51
+ id: "contact-requests",
52
+ label: "screen:request-list.title",
53
+ icon: "mail",
54
+ screen: ContactScreens.requestList,
55
+ order: 25,
56
+ access: { roles: access.systemAdmin },
57
+ workspaces: PLATFORM_WORKSPACES,
58
+ });
59
+ r.nav({
60
+ id: "contact-forwarding",
61
+ label: "nav:contact-forwarding.title",
62
+ icon: "settings",
63
+ screen: ContactScreens.forwarding,
64
+ parent: ADMIN_NAV_QN,
65
+ order: 30,
66
+ access: { roles: access.systemAdmin },
67
+ workspaces: ADMIN_NAV_WORKSPACES,
68
+ });
69
+ r.nav({
70
+ id: "help",
71
+ label: "nav:help.title",
72
+ icon: "info",
73
+ order: 90,
74
+ workspaces: ADMIN_NAV_WORKSPACES,
75
+ });
76
+ r.nav({
77
+ id: "contact-report",
78
+ label: "screen:report.title",
79
+ icon: "mail",
80
+ screen: ContactScreens.report,
81
+ parent: "app-screens:nav:help",
82
+ order: 10,
83
+ workspaces: ADMIN_NAV_WORKSPACES,
84
+ });
43
85
  r.translations({
44
86
  keys: {
87
+ "nav:contact-forwarding.title": { de: "Weiterleitung", en: "Forwarding" },
88
+ "nav:help.title": { de: "Hilfe", en: "Help" },
45
89
  "nav:mail-accounts.title": { de: "Postfächer", en: "Mailboxes" },
46
90
  "screen:profile.title": { de: "Profil", en: "Profile" },
47
91
  "nav:content.title": { de: "Inhalte", en: "Content" },
@@ -35,9 +35,16 @@ import {
35
35
  } from "@cosmicdrift/kumiko-bundled-features/channel-push";
36
36
  import { createChannelSlackFeature } from "@cosmicdrift/kumiko-bundled-features/channel-slack";
37
37
  import { createChannelTeamsFeature } from "@cosmicdrift/kumiko-bundled-features/channel-teams";
38
- import { createChannelTelegramFeature } from "@cosmicdrift/kumiko-bundled-features/channel-telegram";
38
+ import {
39
+ createChannelTelegramFeature,
40
+ type TelegramChannelOptions,
41
+ } from "@cosmicdrift/kumiko-bundled-features/channel-telegram";
39
42
  import { createComplianceProfilesFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles";
40
43
  import { createComplianceProfilesOpsFeature } from "@cosmicdrift/kumiko-bundled-features/compliance-profiles-ops";
44
+ import {
45
+ contactOpenRequestsPanels,
46
+ createContactFeature,
47
+ } from "@cosmicdrift/kumiko-bundled-features/contact";
41
48
  import { createCustomFieldsFeature } from "@cosmicdrift/kumiko-bundled-features/custom-fields";
42
49
  import { createDataRetentionFeature } from "@cosmicdrift/kumiko-bundled-features/data-retention";
43
50
  import { createDeliveryFeature } from "@cosmicdrift/kumiko-bundled-features/delivery";
@@ -83,6 +90,7 @@ import { createTagsFeature } from "@cosmicdrift/kumiko-bundled-features/tags";
83
90
  import { createTemplateResolverFeature } from "@cosmicdrift/kumiko-bundled-features/template-resolver";
84
91
  import { createTemplateResolverUserDataFeature } from "@cosmicdrift/kumiko-bundled-features/template-resolver-user-data";
85
92
  import { createTenantHandoverFeature } from "@cosmicdrift/kumiko-bundled-features/tenant-handover";
93
+ import { createTenantInactivityFeature } from "@cosmicdrift/kumiko-bundled-features/tenant-inactivity";
86
94
  import { createTenantLifecycleFeature } from "@cosmicdrift/kumiko-bundled-features/tenant-lifecycle";
87
95
  import { createTenantSettingsFeature } from "@cosmicdrift/kumiko-bundled-features/tenant-settings";
88
96
  import { createTierEngineFeature } from "@cosmicdrift/kumiko-bundled-features/tier-engine";
@@ -126,10 +134,18 @@ const stubPushTransport: PushTransport = {
126
134
  // no token minted here is ever trusted by a deployment.
127
135
  const SMOKE_HMAC_SECRET = "use-all-bundled-smoke-hmac-key-0123456789";
128
136
 
137
+ // The e2e points the Telegram channel at a local stub so the contact forward reads "delivered" without the real Bot API.
138
+ function fakeTelegramApiOptions(): TelegramChannelOptions {
139
+ const apiBaseUrl = process.env["SAMPLE_TELEGRAM_API_URL"];
140
+ if (apiBaseUrl === undefined) return {};
141
+ return { apiBaseUrl, allowedHosts: [new URL(apiBaseUrl).hostname], requireHttps: false };
142
+ }
143
+
129
144
  export const APP_FEATURES = [
130
145
  localeDe(),
131
146
  // foundations not in the auto-mounted bundled-set
132
- createSecretsFeature(),
147
+ // SystemAdmin stores the contact Telegram bot token, which lives in the system tenant.
148
+ createSecretsFeature({ roles: ["TenantAdmin", "SystemAdmin"] }),
133
149
  ...composeSecurityStack(),
134
150
  // auth-mfa: composeFeatures auto-threads mfaStatusCheckerFromFeature into
135
151
  // the auto-mounted auth-email-password login handler when this feature is
@@ -185,7 +201,7 @@ export const APP_FEATURES = [
185
201
  createChannelSlackFeature(),
186
202
  createChannelDiscordFeature(),
187
203
  createChannelTeamsFeature(),
188
- createChannelTelegramFeature(),
204
+ createChannelTelegramFeature(fakeTelegramApiOptions()),
189
205
 
190
206
  ...composeMailStack({ transports: ["inmemory", "smtp"] }),
191
207
 
@@ -276,6 +292,11 @@ export const APP_FEATURES = [
276
292
  createComplianceProfilesFeature(),
277
293
  createComplianceProfilesOpsFeature(),
278
294
  createTenantLifecycleFeature(),
295
+ // Opt-in: free accounts without activity get warning mails, then a regular deletion request.
296
+ createTenantInactivityFeature({
297
+ rule: { after: { months: 12 }, warnings: [{ days: 30 }, { days: 7 }] },
298
+ keepAccountUrl: "https://app.example.test/keep-account",
299
+ }),
279
300
  // tenant-handover: try-before-signup ownership handover (kumiko-
280
301
  // framework#3035). No entities/mount-options of its own — it reads
281
302
  // OTHER entities' `transferable`/`parentRef` declarations off the
@@ -303,6 +324,15 @@ export const APP_FEATURES = [
303
324
  // CMS / content
304
325
  createLegalPagesFeature(),
305
326
  createWaitlistFeature(),
327
+ createContactFeature({
328
+ appName: "publicstatus",
329
+ appVersion: "2026.10.30",
330
+ fields: { phone: "optional" },
331
+ telegram: true,
332
+ reportCancelTarget: "admin-shell:screen:tenant-overview",
333
+ // Lowest values the options allow, so the e2e submit does not wait on the challenge.
334
+ spamProtection: { minSubmitSeconds: 0, proofOfWorkBits: 8 },
335
+ }),
306
336
  createTemplateResolverFeature({
307
337
  // One collection per ownership mode so the smoke app exercises both paths:
308
338
  // a shared set an admin curates, and a per-user set every agent keeps.
@@ -388,7 +418,11 @@ export const APP_FEATURES = [
388
418
  // admin-shell: requires tenant (auto-mounted) + audit + jobs + tier-engine,
389
419
  // all mounted above. includeCapOverview:true exercises the my-caps /
390
420
  // tenant-caps nav entries end-to-end — cap-overview is mounted below.
391
- createAdminShellFeature({ includeCapOverview: true, includeDocumentDesigner: true }),
421
+ createAdminShellFeature({
422
+ includeCapOverview: true,
423
+ includeDocumentDesigner: true,
424
+ extraPlatformPanels: contactOpenRequestsPanels(),
425
+ }),
392
426
 
393
427
  // app-author-grade
394
428
  createCustomFieldsFeature(),
@@ -0,0 +1,46 @@
1
+ # Recipe: contact
2
+
3
+ Public contact form backend. The `contact` bundled feature stores questions, contact
4
+ requests and problem reports from website visitors and notifies every SystemAdmin (mail,
5
+ optional Telegram). The notification names only the kind, the app and a link into the inbox:
6
+ no name, address, phone, subject or message. Telegram is a third party where nothing can be
7
+ shredded or recalled, so it gets the same minimal text. Website senders get a fixed
8
+ acknowledgement that repeats nothing they typed; signed-in admin reports get a copy.
9
+ SystemAdmins reply from the admin. Phone is off and Telegram is not mounted unless the app
10
+ turns them on (`fields.phone`, `telegram: true`).
11
+
12
+ **What the recipe demonstrates:**
13
+ - Mounting `createContactFeature` with its companions (delivery, user-data-rights, files)
14
+ - The anonymous flow: `contact:query:challenge` hands out a proof-of-work challenge,
15
+ `contact:write:submit` verifies it; spam gets the same 200 body and stores nothing
16
+ - The browser client at `GET /contact/client.js` (`window.KumikoContact.load()` / `submit()`)
17
+
18
+ ## Layout
19
+
20
+ ```
21
+ samples/recipes/contact/
22
+ ├── package.json
23
+ ├── README.md
24
+ └── src/
25
+ ├── feature.ts # createContactFeature options
26
+ └── __tests__/
27
+ └── feature.integration.test.ts # challenge query + client route
28
+ ```
29
+
30
+ The behavior (submit, silent drops, replies, Telegram, GDPR export and erasure, retention) is
31
+ covered by the integration tests next to the feature in
32
+ `packages/bundled-features/src/contact/__tests__/`.
33
+
34
+ ## Run tests
35
+
36
+ ```bash
37
+ bun test --config=bunfig.integration.toml samples/recipes/contact
38
+ ```
39
+
40
+ ## Integration into a real app
41
+
42
+ 1. Mount `createContactFeature({ appName })` plus delivery, a mail channel, `user-data-rights`,
43
+ `files` with a file provider, and `config`/`secrets` for the Telegram bot token.
44
+ 2. Run `kumiko schema generate` (new tables, plus the delivery `idempotency_key` column).
45
+ 3. SystemAdmins set `contact:config:reply-to` and `contact:config:telegram-chat` in the admin.
46
+ 4. Embed `/contact/client.js` on the website; the form is yours.
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@cosmicdrift/kumiko-sample-contact",
3
+ "description": "Public contact form backend: the contact bundled feature with its required companions (delivery, user-data-rights, files) and the anonymous browser client.",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@cosmicdrift/kumiko-bundled-features": "workspace:*",
7
+ "@cosmicdrift/kumiko-framework": "workspace:*"
8
+ },
9
+ "devDependencies": {
10
+ "@cosmicdrift/kumiko-testing": "workspace:*"
11
+ }
12
+ }
@@ -0,0 +1,27 @@
1
+ // Contact sample
2
+ //
3
+ // A public website form (question, contact request, problem report) that lands with the
4
+ // SystemAdmins: mail, optional Telegram, a copy to the sender. Spam is handled without a
5
+ // captcha: honeypot field, single-use proof-of-work challenge, minimum submit time, per-IP
6
+ // and per-email rate limits. Rejected submits answer 200 with the normal body.
7
+ //
8
+ // The website embeds the anonymous client the feature serves itself:
9
+ // <script src="https://api.example.com/contact/client.js"></script>
10
+ // const { kinds, phone } = await window.KumikoContact.load();
11
+ // const result = await window.KumikoContact.submit({ kind, name, email, message, locale });
12
+ // // result.kind: "sent" | "rate-limited" (retryAfterSeconds) | "failed"
13
+ //
14
+ // Prerequisites the app wires itself:
15
+ // - `anonymousAccess` (defaultTenantId = SYSTEM_TENANT_ID) so the form needs no login
16
+ // - delivery with a mail channel (and channel-telegram for the optional Telegram forward)
17
+ // - a file provider, because the entities carry file fields
18
+ // - `kumiko schema generate` for the new tables
19
+
20
+ import { createContactFeature } from "@cosmicdrift/kumiko-bundled-features/contact";
21
+
22
+ export const contactFeature = createContactFeature({
23
+ appName: "Sample App",
24
+ fields: { phone: "optional" },
25
+ // Lowered only to keep the sample test fast; the default (19 bits, 3 seconds) suits production.
26
+ spamProtection: { proofOfWorkBits: 8, minSubmitSeconds: 0 },
27
+ });
@@ -99,6 +99,9 @@ export const supportFeature = defineFeature("support", (r) => {
99
99
  const ticketId = created.data.id;
100
100
  await ctx.notify(TICKET_ASSIGNED, {
101
101
  to: assigneeId,
102
+ // Known key per ticket: dedups a replayed handler and lets an admin screen ask
103
+ // channel-in-app:query:read-state-by-keys whether the assignee has seen it.
104
+ idempotencyKey: `ticket-assigned:${ticketId}`,
102
105
  data: {
103
106
  ticketId,
104
107
  title: event.payload.title,
@@ -77,7 +77,15 @@ export function createOrderDeskFeature(): FeatureDefinition {
77
77
  id: "order-detail",
78
78
  type: "projectionDetail",
79
79
  query: "order-desk:query:order:detail",
80
- header: { title: "customerName", subtitle: "orderNumber", status: "status" },
80
+ header: {
81
+ title: "customerName",
82
+ // Parts are joined by a separator; `format` formats the raw field value.
83
+ subtitle: [
84
+ "orderNumber",
85
+ { field: "placedAt", format: { format: "date", dateStyle: "medium" } },
86
+ ],
87
+ status: "status",
88
+ },
81
89
  metrics: [
82
90
  { field: "totalAmount", label: "order-desk.metric.totalAmount" },
83
91
  { field: "outstandingAmount", label: "order-desk.metric.outstandingAmount" },
@@ -6,6 +6,8 @@ Tenant-scoped full-text search (Meilisearch / in-memory adapter).
6
6
 
7
7
  - `searchable` / `searchWeight` on fields
8
8
  - Handler reads via `ctx.services.searchAdapter`
9
+ - `createLongTextField({ personal: "tenant", find: "fuzzy" })`: a long body is searchable, decrypted for the index (Meilisearch splits it into pieces)
10
+ - Trash list: `softDelete` entity, list with `onlyDeleted: true`, restore via `article:restore`
9
11
 
10
12
  ## Source
11
13
 
@@ -1,10 +1,18 @@
1
1
  // Search Sample
2
- // Shows: searchable fields, searchWeight, search via InMemory SearchAdapter.
2
+ // Shows: searchable fields, searchWeight, search via InMemory SearchAdapter, a longText field
3
+ // with find: "fuzzy" (chunked in Meilisearch) and a trash list (onlyDeleted) for restore.
3
4
  // Each handler builds its executor inline so `ctx.services.searchAdapter` is read fresh
4
5
  // per call — tests swap the adapter between runs.
5
6
 
6
7
  import { buildEntityTable, createEventStoreExecutor } from "@cosmicdrift/kumiko-framework/db";
7
- import { createEntity, createTextField, defineFeature } from "@cosmicdrift/kumiko-framework/engine";
8
+ import {
9
+ createEntity,
10
+ createLongTextField,
11
+ createTextField,
12
+ defineEntityQueryHandler,
13
+ defineEntityWriteHandler,
14
+ defineFeature,
15
+ } from "@cosmicdrift/kumiko-framework/engine";
8
16
  import { z } from "zod";
9
17
 
10
18
  export const productEntity = createEntity({
@@ -23,10 +31,27 @@ export const productEntity = createEntity({
23
31
  searchWeight: 10,
24
32
  });
25
33
 
34
+ // A long body is searched like any text field; softDelete gives the trash list and restore.
35
+ export const articleEntity = createEntity({
36
+ table: "read_sample_articles",
37
+ softDelete: true,
38
+ fields: {
39
+ title: createTextField({ personal: false, reason: "is_business_data", required: true }),
40
+ body: createLongTextField({ personal: "tenant", find: "fuzzy" }),
41
+ },
42
+ });
43
+
26
44
  const productTable = buildEntityTable("product", productEntity);
27
45
 
28
46
  export const productFeature = defineFeature("shop", (r) => {
29
47
  r.entity({ name: "product", ...productEntity });
48
+ r.entity({ name: "article", ...articleEntity });
49
+
50
+ const articleAccess = { access: { roles: ["Admin"] } };
51
+ for (const verb of ["create", "delete", "restore"] as const) {
52
+ r.writeHandler(defineEntityWriteHandler(`article:${verb}`, articleEntity, articleAccess));
53
+ }
54
+ r.queryHandler(defineEntityQueryHandler("article:list", articleEntity, articleAccess));
30
55
 
31
56
  r.writeHandler({
32
57
  name: "product:create",
@@ -6,6 +6,7 @@ Tenant-owned secrets with envelope encryption, DEK cache, and KEK rotation.
6
6
 
7
7
  - `r.secret` + `ctx.services.secrets.get` (audited reads)
8
8
  - Charge-style handler that never returns the plaintext key
9
+ - A system-scope secret edited on a `configEdit` screen (`secretKeys`) with a handler button row (`actions`)
9
10
 
10
11
  ## Source
11
12
 
@@ -5,6 +5,8 @@
5
5
 
6
6
  import { requireSecretsContext } from "@cosmicdrift/kumiko-bundled-features/secrets";
7
7
  import {
8
+ access,
9
+ createTextField,
8
10
  defineFeature,
9
11
  defineWriteHandler,
10
12
  type FeatureDefinition,
@@ -66,6 +68,26 @@ const chargeWrite = defineWriteHandler({
66
68
  },
67
69
  });
68
70
 
71
+ // Platform-wide secret edited on a configEdit screen. The declaration keeps scope "tenant" (the
72
+ // only declared scope); the screen's scope "system" stores one value for the whole platform under
73
+ // the system tenant, and only a SystemAdmin may write it.
74
+ export let WEBHOOK_SIGNING_KEY: SecretKeyHandle;
75
+
76
+ const webhookSendTestWrite = defineWriteHandler({
77
+ name: "webhook-send-test",
78
+ schema: z.object({}),
79
+ access: { roles: access.systemAdmin },
80
+ handler: async (event, ctx) => {
81
+ const secrets = requireSecretsContext(
82
+ { secrets: ctx.services.secrets, user: ctx.user },
83
+ "billing:write:webhook-send-test",
84
+ );
85
+ const key = await secrets.get(event.user.tenantId, WEBHOOK_SIGNING_KEY);
86
+ if (!key) return failUnprocessable("webhook_key_missing");
87
+ return { isSuccess: true, data: { signed: true } };
88
+ },
89
+ });
90
+
69
91
  export function createBillingFeature(): FeatureDefinition {
70
92
  return defineFeature("billing", (r) => {
71
93
  // Typed declaration of the secret this feature needs. Admin UIs can
@@ -86,6 +108,40 @@ export function createBillingFeature(): FeatureDefinition {
86
108
  },
87
109
  scope: "tenant",
88
110
  });
111
+ WEBHOOK_SIGNING_KEY = r.secret("webhook.signingKey", {
112
+ label: { de: "Webhook-Signaturschlüssel", en: "Webhook signing key" },
113
+ scope: "tenant",
114
+ });
89
115
  r.writeHandler(chargeWrite);
116
+ r.writeHandler(webhookSendTestWrite);
117
+ r.screen({
118
+ id: "webhook-settings",
119
+ type: "configEdit",
120
+ dormant: true,
121
+ scope: "system",
122
+ configKeys: {},
123
+ secretKeys: { signingKey: WEBHOOK_SIGNING_KEY.name },
124
+ fields: {
125
+ signingKey: createTextField({
126
+ writeOnly: true,
127
+ maxLength: 200,
128
+ personal: false,
129
+ reason: "is_business_data",
130
+ }),
131
+ },
132
+ layout: { variant: "settings-list", sections: [{ fields: ["signingKey"] }] },
133
+ // A button row calls a handler with {} on the stored values; it is disabled while the
134
+ // form has unsaved changes.
135
+ actions: [
136
+ {
137
+ id: "send-test",
138
+ handler: "billing:write:webhook-send-test",
139
+ label: "billing.webhook.test.label",
140
+ buttonLabel: "billing.webhook.test.button",
141
+ afterField: "signingKey",
142
+ },
143
+ ],
144
+ access: { roles: access.systemAdmin },
145
+ });
90
146
  });
91
147
  }