@cosmicdrift/kumiko-samples 0.405.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 (242) 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 +30 -0
  195. package/packages/bundled-features/src/tenant-lifecycle/constants.ts +6 -0
  196. package/packages/bundled-features/src/tenant-lifecycle/events.ts +2 -0
  197. package/packages/bundled-features/src/tenant-lifecycle/feature.ts +25 -2
  198. package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +12 -87
  199. package/packages/bundled-features/src/tenant-lifecycle/index.ts +6 -0
  200. package/packages/bundled-features/src/tenant-lifecycle/request-tenant-destruction.ts +108 -0
  201. package/packages/bundled-features/src/tenant-lifecycle/retention-config-destroy-hooks.ts +62 -0
  202. package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +131 -11
  203. package/packages/bundled-features/src/tenant-lifecycle/stages.ts +39 -4
  204. package/packages/bundled-features/src/tenant-lifecycle/testing.ts +1 -1
  205. package/packages/bundled-features/src/tier-engine/caps-for-tier-from-map.ts +16 -0
  206. package/packages/bundled-features/src/tier-engine/changes.json +6 -0
  207. package/packages/bundled-features/src/tier-engine/compose-app.ts +21 -20
  208. package/packages/bundled-features/src/tier-engine/index.ts +1 -0
  209. package/packages/bundled-features/src/user-data-rights/feature.ts +2 -0
  210. package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +2 -0
  211. package/packages/bundled-features/src/user-data-rights/web/privacy-center-screen.tsx +1 -1
  212. package/packages/bundled-features/src/user-data-rights/zip-path.ts +1 -0
  213. package/packages/bundled-features/src/user-data-rights-defaults/hooks/config-value.userdata-hook.ts +8 -27
  214. package/packages/bundled-features/src/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.ts +11 -8
  215. package/packages/bundled-features/src/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.ts +42 -0
  216. package/packages/bundled-features/src/user-data-rights-defaults/hooks/notification-preference.userdata-hook.ts +8 -27
  217. package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +2 -6
  218. package/packages/bundled-features/src/user-profile/web/profile-screen.tsx +2 -3
  219. package/samples/apps/styleguide/src/features/widgets/i18n.ts +6 -0
  220. package/samples/apps/styleguide/src/features/widgets/web/InboxReaderExamples.tsx +158 -0
  221. package/samples/apps/styleguide/src/features/widgets/web/Widgets.tsx +2 -0
  222. package/samples/apps/styleguide/src/features/widgets/web/sample-pdf.ts +28 -0
  223. package/samples/apps/use-all-bundled/feature-manifest.json +134 -2
  224. package/samples/apps/use-all-bundled/kumiko/migrations/0063_contact.rebuild.json +4 -0
  225. package/samples/apps/use-all-bundled/package.json +1 -0
  226. package/samples/apps/use-all-bundled/playwright.config.ts +2 -0
  227. package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
  228. package/samples/apps/use-all-bundled/src/app/screens-feature.ts +46 -2
  229. package/samples/apps/use-all-bundled/src/run-config.ts +38 -4
  230. package/samples/recipes/contact/README.md +46 -0
  231. package/samples/recipes/contact/package.json +12 -0
  232. package/samples/recipes/contact/src/feature.ts +27 -0
  233. package/samples/recipes/delivery-notifications/src/feature.ts +3 -0
  234. package/samples/recipes/lane-routing/README.md +1 -0
  235. package/samples/recipes/lane-routing/src/feature.ts +8 -0
  236. package/samples/recipes/record-detail-layout/src/feature.ts +9 -1
  237. package/samples/recipes/search/README.md +2 -0
  238. package/samples/recipes/search/src/feature.ts +27 -2
  239. package/samples/recipes/secrets-demo/README.md +1 -0
  240. package/samples/recipes/secrets-demo/src/feature.ts +56 -0
  241. package/samples/recipes/tenant-inactivity/README.md +21 -0
  242. package/samples/recipes/tenant-inactivity/package.json +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-samples",
3
- "version": "0.405.0",
3
+ "version": "0.409.0",
4
4
  "description": "Source trees of the Kumiko sample recipes, sample apps and bundled features in repo layout, for tooling such as few-shot corpus builds.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-bundled-features",
3
- "version": "0.405.0",
3
+ "version": "0.409.0",
4
4
  "description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
5
5
  "license": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -93,6 +93,8 @@
93
93
  "./tenant/constants": "./src/tenant/web/constants.ts",
94
94
  "./tenant/web": "./src/tenant/web/index.ts",
95
95
  "./tenant/seeding": "./src/tenant/seeding.ts",
96
+ "./tenant-inactivity": "./src/tenant-inactivity/index.ts",
97
+ "./tenant-inactivity/email-templates": "./src/tenant-inactivity/email-templates.ts",
96
98
  "./tenant-lifecycle": "./src/tenant-lifecycle/index.ts",
97
99
  "./tenant-lifecycle/testing": "./src/tenant-lifecycle/testing.ts",
98
100
  "./tenant-handover": "./src/tenant-handover/index.ts",
@@ -151,6 +153,8 @@
151
153
  "./legal-pages": "./src/legal-pages/index.ts",
152
154
  "./legal-pages/constants": "./src/legal-pages/web/constants.ts",
153
155
  "./legal-pages/web": "./src/legal-pages/web/index.ts",
156
+ "./contact": "./src/contact/index.ts",
157
+ "./contact/web": "./src/contact/web/index.ts",
154
158
  "./waitlist": "./src/waitlist/index.ts",
155
159
  "./page-render": "./src/page-render/index.ts",
156
160
  "./page-render/web": "./src/page-render/web.ts",
@@ -192,6 +196,7 @@
192
196
  "qrcode": "^1.5.4",
193
197
  "react": "^19.3.1",
194
198
  "react-dom": "^19.3.1",
199
+ "sanitize-html": "^2.18.1",
195
200
  "sharp": "^0.35.5",
196
201
  "stripe": "^22.6.2",
197
202
  "tailwind-merge": "^3.7.0",
@@ -479,6 +484,14 @@
479
484
  "types": "./dist/tenant/seeding.d.ts",
480
485
  "default": "./dist/tenant/seeding.js"
481
486
  },
487
+ "./tenant-inactivity": {
488
+ "types": "./dist/tenant-inactivity/index.d.ts",
489
+ "default": "./dist/tenant-inactivity/index.js"
490
+ },
491
+ "./tenant-inactivity/email-templates": {
492
+ "types": "./dist/tenant-inactivity/email-templates.d.ts",
493
+ "default": "./dist/tenant-inactivity/email-templates.js"
494
+ },
482
495
  "./tenant-lifecycle": {
483
496
  "types": "./dist/tenant-lifecycle/index.d.ts",
484
497
  "default": "./dist/tenant-lifecycle/index.js"
@@ -711,6 +724,14 @@
711
724
  "types": "./dist/legal-pages/web/index.d.ts",
712
725
  "default": "./dist/legal-pages/web/index.js"
713
726
  },
727
+ "./contact": {
728
+ "types": "./dist/contact/index.d.ts",
729
+ "default": "./dist/contact/index.js"
730
+ },
731
+ "./contact/web": {
732
+ "types": "./dist/contact/web/index.d.ts",
733
+ "default": "./dist/contact/web/index.js"
734
+ },
714
735
  "./waitlist": {
715
736
  "types": "./dist/waitlist/index.d.ts",
716
737
  "default": "./dist/waitlist/index.js"
@@ -757,15 +778,16 @@
757
778
  "LICENSE"
758
779
  ],
759
780
  "devDependencies": {
760
- "@testing-library/user-event": "^14.6.8",
761
781
  "@cosmicdrift/kumiko-locale-de": "workspace:*",
762
782
  "@cosmicdrift/kumiko-locale-es": "workspace:*",
763
783
  "@cosmicdrift/kumiko-locale-fr": "workspace:*",
764
784
  "@cosmicdrift/kumiko-locale-it": "workspace:*",
765
785
  "@cosmicdrift/kumiko-renderer-mail-html": "workspace:*",
786
+ "@cosmicdrift/kumiko-testing": "workspace:*",
787
+ "@testing-library/user-event": "^14.6.8",
788
+ "@types/sanitize-html": "^2.16.2",
766
789
  "jsqr": "^1.4.0",
767
- "unpdf": "^1.9.1",
768
- "@cosmicdrift/kumiko-testing": "workspace:*"
790
+ "unpdf": "^1.9.1"
769
791
  },
770
792
  "peerDependencies": {
771
793
  "@cosmicdrift/kumiko-testing": "workspace:*"
@@ -66,23 +66,31 @@ export function createAccountSecurityFeature(
66
66
  panels: [
67
67
  {
68
68
  kind: "screen",
69
+ chromeless: true,
69
70
  id: "mfa-enable",
70
71
  screen: `auth-mfa:screen:${MFA_ENABLE_SCREEN_ID}`,
71
72
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: false },
72
73
  },
73
74
  {
74
75
  kind: "screen",
76
+ chromeless: true,
75
77
  id: "mfa-regenerate",
76
78
  screen: `auth-mfa:screen:${MFA_REGENERATE_RECOVERY_SCREEN_ID}`,
77
79
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: true },
78
80
  },
79
81
  {
80
82
  kind: "screen",
83
+ chromeless: true,
81
84
  id: "mfa-disable",
82
85
  screen: `auth-mfa:screen:${MFA_DISABLE_SCREEN_ID}`,
83
86
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: true },
84
87
  },
85
- { kind: "screen", id: "sessions", screen: `sessions:screen:${SESSION_MINE_SCREEN_ID}` },
88
+ {
89
+ kind: "screen",
90
+ chromeless: true,
91
+ id: "sessions",
92
+ screen: `sessions:screen:${SESSION_MINE_SCREEN_ID}`,
93
+ },
86
94
  ],
87
95
  });
88
96
 
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.409.0",
4
+ "type": "improvement",
5
+ "title": "createAdminShellFeature extraPlatformPanels",
6
+ "detail": "`createAdminShellFeature({ extraPlatformPanels })` appends dashboard panels to the platform \"Overview\" dashboard, so a feature can put a tile (for example the open contact requests) there instead of mounting a dashboard of its own."
7
+ },
2
8
  {
3
9
  "version": "0.392.0",
4
10
  "type": "improvement",
@@ -7,6 +7,7 @@ import {
7
7
  defineFeature,
8
8
  type FeatureDefinition,
9
9
  } from "@cosmicdrift/kumiko-framework/engine";
10
+ import type { DashboardPanelDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
10
11
  import { DEFAULT_METRICS, type MetricDefinition } from "../metrics/index.ts";
11
12
  import {
12
13
  OVERVIEW_TIME_RANGE,
@@ -48,6 +49,8 @@ export type CreateAdminShellOptions = {
48
49
  * createMetricsFeature / createSystemMetricsFeature. Panels exist only for
49
50
  * ids in this list. Default DEFAULT_METRICS. */
50
51
  readonly metrics?: readonly MetricDefinition[];
52
+ /** Panels appended to the platform overview, for tiles a mounted feature owns (e.g. the contact inbox count). */
53
+ readonly extraPlatformPanels?: readonly DashboardPanelDefinition[];
51
54
  };
52
55
 
53
56
  type NavIdOptions = {
@@ -148,7 +151,7 @@ export function createAdminShellFeature(options: CreateAdminShellOptions = {}):
148
151
  timeRange: OVERVIEW_TIME_RANGE,
149
152
  // The picker needs a SystemAdmin {rows:{value,label}} tenant query; only cap-overview ships one.
150
153
  ...(includeCapOverview && { filter: PLATFORM_TENANT_FILTER }),
151
- panels: [...platformOverviewPanels(metrics)],
154
+ panels: [...platformOverviewPanels(metrics), ...(options.extraPlatformPanels ?? [])],
152
155
  });
153
156
  r.nav({
154
157
  id: "platform-overview",
@@ -304,6 +304,7 @@ function buildHandlerEntry(
304
304
  kind,
305
305
  ...(description !== undefined && { description }),
306
306
  risk: exposure.risk,
307
+ ...(exposure.effect !== undefined && { effect: exposure.effect }),
307
308
  inputSchema,
308
309
  ...(entity !== undefined && { entity }),
309
310
  ...(excludedFields !== undefined && { excludedFields }),
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.409.0",
4
+ "type": "improvement",
5
+ "title": "Agent write handlers can be marked as proposal changes",
6
+ "detail": "AgentHandlerHints takes effect \"proposal\" for a write whose result is itself a suggestion that a person approves later (for example a plan step the clerk still checks). resolveAgentExposure, the agent manifest handler entry and the write ToolDispatchDescriptor carry the effect, so an agent runtime can skip its own approval step for these calls. Boot rejects effect \"proposal\" unless the handler declares risk \"low\" explicitly (the write default is mid), and rejects any effect on a query handler."
7
+ },
2
8
  {
3
9
  "version": "0.402.0",
4
10
  "type": "breaking",
@@ -575,6 +575,7 @@ function addWriteHandlerTools(
575
575
  op: "write",
576
576
  qn: handler.qn,
577
577
  risk: handler.risk,
578
+ ...(handler.effect !== undefined && { effect: handler.effect }),
578
579
  ...(handler.entity !== undefined && { entity: handler.entity }),
579
580
  ...(detailQn !== undefined && { detailQn }),
580
581
  ...(injectsVersion && { injectsVersion: true as const }),
@@ -1,4 +1,5 @@
1
1
  import type {
2
+ AgentEffect,
2
3
  AgentRisk,
3
4
  EntityDefinition,
4
5
  FeatureDefinition,
@@ -74,6 +75,8 @@ export type ToolDispatchDescriptor =
74
75
  readonly op: "write";
75
76
  readonly qn: string;
76
77
  readonly risk: AgentRisk;
78
+ /** "proposal": the write changes a suggestion a person still approves, so no approval step. */
79
+ readonly effect?: AgentEffect;
77
80
  readonly entity?: string;
78
81
  /** `<feature>:query:<entity>:detail` QN when one is mounted and readable.
79
82
  * Dispatch reads the current `version` from it before an optimistic-lock
@@ -150,6 +153,7 @@ export type AgentManifestHandler = {
150
153
  readonly kind: "query" | "write";
151
154
  readonly description?: string;
152
155
  readonly risk: AgentRisk;
156
+ readonly effect?: AgentEffect;
153
157
  readonly inputSchema: Readonly<Record<string, unknown>>;
154
158
  readonly entity?: string;
155
159
  /** Fields this generic create/update handler never writes; sending one fails validation. */
@@ -20,6 +20,7 @@ export const AUDIT_EVENT_STANCES: Readonly<Record<string, AuditEventStance>> = {
20
20
  "inbound-mail-foundation:event:inbound-message-received": TECHNICAL_EVENT,
21
21
  "inbound-mail-foundation:event:inbound-message-content-fetched": TECHNICAL_EVENT,
22
22
  "inbound-mail-foundation:event:mail-thread-updated": TECHNICAL_EVENT,
23
+ "document-ingest-foundation:event:document-ingest-progress": TECHNICAL_EVENT,
23
24
  "document-ingest-foundation:event:document-ingest-requested": TECHNICAL_EVENT,
24
25
  "document-ingest-foundation:event:document-ingest-skipped": TECHNICAL_EVENT,
25
26
  "tenant-lifecycle:event:tenant-destruction-stage-started": TECHNICAL_EVENT,
@@ -295,6 +295,7 @@ function isMailingOutcome(outcome: BootstrapInviteOutcome): boolean {
295
295
  }
296
296
 
297
297
  // A one-shot operator process, not a tenant request: it looks up users, memberships and invitations across tenants.
298
+ // guard:dup-ok the single runInSystemRowLevelSecurityScope call with this entry point's own reason
298
299
  export function bootstrapTenants(
299
300
  deps: BootstrapDeps,
300
301
  plan: BootstrapPlan,
@@ -1,121 +1,73 @@
1
- import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
1
+ import { unprocessable } from "../shared/index.ts";
2
2
  import { AuthErrors } from "./web/constants.ts";
3
3
 
4
4
  // @wrapper-known error-helper
5
5
  export function invalidCredentials() {
6
- return writeFailure(
7
- new UnprocessableError(AuthErrors.invalidCredentials, {
8
- i18nKey: "auth.errors.invalidCredentials",
9
- }),
10
- );
6
+ return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
11
7
  }
12
8
 
13
9
  // @wrapper-known error-helper
14
10
  export function invalidInviteToken() {
15
- return writeFailure(
16
- new UnprocessableError(AuthErrors.invalidInviteToken, {
17
- i18nKey: "auth.errors.invalidInviteToken",
18
- }),
19
- );
11
+ return unprocessable(AuthErrors.invalidInviteToken, "auth.errors.invalidInviteToken");
20
12
  }
21
13
 
22
14
  // @wrapper-known error-helper
23
15
  export function inviteEmailMismatch() {
24
- return writeFailure(
25
- new UnprocessableError(AuthErrors.inviteEmailMismatch, {
26
- i18nKey: "auth.errors.inviteEmailMismatch",
27
- }),
28
- );
16
+ return unprocessable(AuthErrors.inviteEmailMismatch, "auth.errors.inviteEmailMismatch");
29
17
  }
30
18
 
31
19
  // @wrapper-known error-helper
32
20
  export function inviteAlreadyAccepted() {
33
- return writeFailure(
34
- new UnprocessableError(AuthErrors.inviteAlreadyAccepted, {
35
- i18nKey: "auth.errors.inviteAlreadyAccepted",
36
- }),
37
- );
21
+ return unprocessable(AuthErrors.inviteAlreadyAccepted, "auth.errors.inviteAlreadyAccepted");
38
22
  }
39
23
 
40
24
  // @wrapper-known error-helper
41
25
  export function invalidResetToken() {
42
- return writeFailure(
43
- new UnprocessableError(AuthErrors.invalidResetToken, {
44
- i18nKey: "auth.errors.invalidResetToken",
45
- }),
46
- );
26
+ return unprocessable(AuthErrors.invalidResetToken, "auth.errors.invalidResetToken");
47
27
  }
48
28
 
49
29
  // @wrapper-known error-helper
50
30
  export function invalidUnlockToken() {
51
- return writeFailure(
52
- new UnprocessableError(AuthErrors.invalidUnlockToken, {
53
- i18nKey: "auth.errors.invalidUnlockToken",
54
- }),
55
- );
31
+ return unprocessable(AuthErrors.invalidUnlockToken, "auth.errors.invalidUnlockToken");
56
32
  }
57
33
 
58
34
  // @wrapper-known error-helper
59
35
  export function invalidVerificationToken() {
60
- return writeFailure(
61
- new UnprocessableError(AuthErrors.invalidVerificationToken, {
62
- i18nKey: "auth.errors.invalidVerificationToken",
63
- }),
64
- );
36
+ return unprocessable(AuthErrors.invalidVerificationToken, "auth.errors.invalidVerificationToken");
65
37
  }
66
38
 
67
39
  // @wrapper-known error-helper
68
40
  export function invalidSignupToken() {
69
- return writeFailure(
70
- new UnprocessableError(AuthErrors.invalidSignupToken, {
71
- i18nKey: "auth.errors.invalidSignupToken",
72
- }),
73
- );
41
+ return unprocessable(AuthErrors.invalidSignupToken, "auth.errors.invalidSignupToken");
74
42
  }
75
43
 
76
44
  // @wrapper-known error-helper
77
45
  export function signupEmailAlreadyRegistered() {
78
- return writeFailure(
79
- new UnprocessableError(AuthErrors.signupEmailAlreadyRegistered, {
80
- i18nKey: "auth.errors.signupEmailAlreadyRegistered",
81
- }),
46
+ return unprocessable(
47
+ AuthErrors.signupEmailAlreadyRegistered,
48
+ "auth.errors.signupEmailAlreadyRegistered",
82
49
  );
83
50
  }
84
51
 
85
52
  // @wrapper-known error-helper
86
53
  export function noMembership() {
87
- return writeFailure(
88
- new UnprocessableError(AuthErrors.noMembership, {
89
- i18nKey: "auth.errors.noMembership",
90
- }),
91
- );
54
+ return unprocessable(AuthErrors.noMembership, "auth.errors.noMembership");
92
55
  }
93
56
 
94
57
  // @wrapper-known error-helper
95
58
  export function emailNotVerified() {
96
- return writeFailure(
97
- new UnprocessableError(AuthErrors.emailNotVerified, {
98
- i18nKey: "auth.errors.emailNotVerified",
99
- }),
100
- );
59
+ return unprocessable(AuthErrors.emailNotVerified, "auth.errors.emailNotVerified");
101
60
  }
102
61
 
103
62
  // retryAfterSeconds drives the login/signup UI countdown — must stay > 0.
104
63
  // @wrapper-known error-helper
105
64
  export function accountLocked(retryAfterSeconds: number) {
106
- return writeFailure(
107
- new UnprocessableError(AuthErrors.accountLocked, {
108
- i18nKey: "auth.errors.accountLocked",
109
- details: { retryAfterSeconds },
110
- }),
111
- );
65
+ return unprocessable(AuthErrors.accountLocked, "auth.errors.accountLocked", {
66
+ retryAfterSeconds,
67
+ });
112
68
  }
113
69
 
114
70
  // @wrapper-known error-helper
115
71
  export function accountRestricted() {
116
- return writeFailure(
117
- new UnprocessableError(AuthErrors.accountRestricted, {
118
- i18nKey: "auth.errors.accountRestricted",
119
- }),
120
- );
72
+ return unprocessable(AuthErrors.accountRestricted, "auth.errors.accountRestricted");
121
73
  }
@@ -178,6 +178,22 @@ async function parseTokenFailure(res: Response): Promise<AuthTokenFailure> {
178
178
  return { reason };
179
179
  }
180
180
 
181
+ type AuthTokenResult = { ok: true } | { ok: false; error: AuthTokenFailure };
182
+
183
+ async function postTokenRequest(
184
+ path: string,
185
+ payload: Record<string, unknown>,
186
+ ): Promise<AuthTokenResult> {
187
+ const res = await fetch(path, {
188
+ method: "POST",
189
+ credentials: "same-origin",
190
+ headers: { "Content-Type": "application/json", ...csrfHeader() },
191
+ body: JSON.stringify(payload),
192
+ });
193
+ if (res.ok) return { ok: true };
194
+ return { ok: false, error: await parseTokenFailure(res) };
195
+ }
196
+
181
197
  // POST /api/auth/request-password-reset. 200 silent-success: even if the
182
198
  // email doesn't exist, the caller sees `{ ok: true }` — no account
183
199
  // enumeration. Server only triggers the mail internally when a user is
@@ -185,15 +201,11 @@ async function parseTokenFailure(res: Response): Promise<AuthTokenFailure> {
185
201
  export async function requestPasswordReset(
186
202
  email: string,
187
203
  returnTo?: string,
188
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
189
- const res = await fetch("/api/auth/request-password-reset", {
190
- method: "POST",
191
- credentials: "same-origin",
192
- headers: { "Content-Type": "application/json", ...csrfHeader() },
193
- body: JSON.stringify({ email, ...(returnTo !== undefined && { returnTo }) }),
204
+ ): Promise<AuthTokenResult> {
205
+ return postTokenRequest("/api/auth/request-password-reset", {
206
+ email,
207
+ ...(returnTo !== undefined && { returnTo }),
194
208
  });
195
- if (res.ok) return { ok: true };
196
- return { ok: false, error: await parseTokenFailure(res) };
197
209
  }
198
210
 
199
211
  // POST /api/auth/reset-password. The token comes from the URL and the
@@ -202,64 +214,27 @@ export async function requestPasswordReset(
202
214
  // single code `invalid_reset_token` to prevent enumeration. Zod validation
203
215
  // failures (newPassword < 8) use a separate 4xx code, "validation_failed".
204
216
  // The UI maps reason to an i18n key.
205
- export async function resetPassword(
206
- token: string,
207
- newPassword: string,
208
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
209
- const res = await fetch("/api/auth/reset-password", {
210
- method: "POST",
211
- credentials: "same-origin",
212
- headers: { "Content-Type": "application/json", ...csrfHeader() },
213
- body: JSON.stringify({ token, newPassword }),
214
- });
215
- if (res.ok) return { ok: true };
216
- return { ok: false, error: await parseTokenFailure(res) };
217
+ export async function resetPassword(token: string, newPassword: string): Promise<AuthTokenResult> {
218
+ return postTokenRequest("/api/auth/reset-password", { token, newPassword });
217
219
  }
218
220
 
219
221
  // POST /api/auth/request-email-verification. Same silent-success
220
222
  // semantics as request-password-reset. 429 → rate-limit failure.
221
- export async function requestEmailVerification(
222
- email: string,
223
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
224
- const res = await fetch("/api/auth/request-email-verification", {
225
- method: "POST",
226
- credentials: "same-origin",
227
- headers: { "Content-Type": "application/json", ...csrfHeader() },
228
- body: JSON.stringify({ email }),
229
- });
230
- if (res.ok) return { ok: true };
231
- return { ok: false, error: await parseTokenFailure(res) };
223
+ export async function requestEmailVerification(email: string): Promise<AuthTokenResult> {
224
+ return postTokenRequest("/api/auth/request-email-verification", { email });
232
225
  }
233
226
 
234
227
  // POST /api/auth/verify-email. VerifyEmailScreen submits this automatically
235
228
  // after parsing `?token=...`. The server collapses all verification failures
236
229
  // into `invalid_verification_token` to prevent enumeration, as with reset.
237
- export async function verifyEmail(
238
- token: string,
239
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
240
- const res = await fetch("/api/auth/verify-email", {
241
- method: "POST",
242
- credentials: "same-origin",
243
- headers: { "Content-Type": "application/json", ...csrfHeader() },
244
- body: JSON.stringify({ token }),
245
- });
246
- if (res.ok) return { ok: true };
247
- return { ok: false, error: await parseTokenFailure(res) };
230
+ export async function verifyEmail(token: string): Promise<AuthTokenResult> {
231
+ return postTokenRequest("/api/auth/verify-email", { token });
248
232
  }
249
233
 
250
234
  // POST /api/auth/request-account-unlock. Same silent-success semantics as
251
235
  // request-password-reset. 429 → rate-limit failure.
252
- export async function requestAccountUnlock(
253
- email: string,
254
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
255
- const res = await fetch("/api/auth/request-account-unlock", {
256
- method: "POST",
257
- credentials: "same-origin",
258
- headers: { "Content-Type": "application/json", ...csrfHeader() },
259
- body: JSON.stringify({ email }),
260
- });
261
- if (res.ok) return { ok: true };
262
- return { ok: false, error: await parseTokenFailure(res) };
236
+ export async function requestAccountUnlock(email: string): Promise<AuthTokenResult> {
237
+ return postTokenRequest("/api/auth/request-account-unlock", { email });
263
238
  }
264
239
 
265
240
  // POST /api/auth/confirm-account-unlock. Auto-submitted by
@@ -267,17 +242,8 @@ export async function requestAccountUnlock(
267
242
  // every verify failure into `invalid_unlock_token` (anti-enumeration,
268
243
  // parallel to reset/verify). Only clears the Redis lockout state, no
269
244
  // entity write.
270
- export async function confirmAccountUnlock(
271
- token: string,
272
- ): Promise<{ ok: true } | { ok: false; error: AuthTokenFailure }> {
273
- const res = await fetch("/api/auth/confirm-account-unlock", {
274
- method: "POST",
275
- credentials: "same-origin",
276
- headers: { "Content-Type": "application/json", ...csrfHeader() },
277
- body: JSON.stringify({ token }),
278
- });
279
- if (res.ok) return { ok: true };
280
- return { ok: false, error: await parseTokenFailure(res) };
245
+ export async function confirmAccountUnlock(token: string): Promise<AuthTokenResult> {
246
+ return postTokenRequest("/api/auth/confirm-account-unlock", { token });
281
247
  }
282
248
 
283
249
  // POST /api/auth/signup-request. Always returns 200 to prevent enumeration;
@@ -3,6 +3,7 @@
3
3
  // root-relative paths pass (no "//host", no "/\host", no scheme).
4
4
 
5
5
  import { appendReturnTo, NEXT_QUERY_PARAM } from "./login-url.ts";
6
+ import { readPathParam } from "./read-path-param.ts";
6
7
  import { isSafeReturnPath, readReturnToFromSearch } from "./return-path.ts";
7
8
 
8
9
  export { appendReturnTo, NEXT_QUERY_PARAM };
@@ -10,8 +11,7 @@ export { appendReturnTo, NEXT_QUERY_PARAM };
10
11
  export const isSafeNextPath = isSafeReturnPath;
11
12
 
12
13
  export function readNextFromSearch(search: string): string | null {
13
- const candidate = new URLSearchParams(search).get(NEXT_QUERY_PARAM);
14
- return isSafeNextPath(candidate) ? candidate : null;
14
+ return readPathParam(search, NEXT_QUERY_PARAM, isSafeNextPath);
15
15
  }
16
16
 
17
17
  // The returnTo a mail link or sibling auth page carried in this page's own URL; null on native, where there is no window.
@@ -2,14 +2,11 @@
2
2
  // it to /api/auth/confirm-account-unlock on mount, shows success/error.
3
3
  // Idempotent server-side (clearLockoutState is a no-op when already
4
4
  // unlocked), so no re-submit risk. Mirrors VerifyEmailScreen 1:1.
5
- //
6
- // useEffect with empty deps + a once-guard so React Strict Mode's double
7
- // useEffect dispatch in dev fires the confirm call only once.
8
5
 
9
- import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
10
- import { type ReactNode, useEffect, useRef, useState } from "react";
6
+ import { useTranslation } from "@cosmicdrift/kumiko-renderer";
7
+ import type { ReactNode } from "react";
11
8
  import { confirmAccountUnlock } from "./auth-client.ts";
12
- import { AuthCard, useUrlToken } from "./auth-form-primitives.tsx";
9
+ import { TokenConfirmScreen } from "./token-confirm-screen.tsx";
13
10
 
14
11
  export type ConfirmAccountUnlockScreenProps = {
15
12
  readonly title?: string;
@@ -19,71 +16,28 @@ export type ConfirmAccountUnlockScreenProps = {
19
16
  readonly loginHref?: string;
20
17
  };
21
18
 
22
- type Status = "verifying" | "success" | "error" | "missing-token";
23
-
19
+ // guard:dup-ok TokenConfirmScreen holds the logic; each screen only supplies its own literal label keys
24
20
  export function ConfirmAccountUnlockScreen({
25
21
  title,
26
- token: tokenProp,
22
+ token,
27
23
  loginHref = "/login",
28
24
  }: ConfirmAccountUnlockScreenProps): ReactNode {
29
25
  const t = useTranslation();
30
- const { Link } = usePrimitives();
31
- const token = useUrlToken(tokenProp);
32
- const [status, setStatus] = useState<Status>(token === "" ? "missing-token" : "verifying");
33
- const startedRef = useRef(false);
34
-
35
- // kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
36
- useEffect(() => {
37
- if (status !== "verifying") return;
38
- if (startedRef.current) return;
39
- startedRef.current = true;
40
- void (async () => {
41
- const res = await confirmAccountUnlock(token);
42
- setStatus(res.ok ? "success" : "error");
43
- })();
44
- }, [status, token]);
45
-
46
- if (status === "missing-token") {
47
- return (
48
- <AuthCard title={title ?? t("auth.unlockAccount.errorTitle")}>
49
- <p className="text-sm text-muted-foreground">{t("auth.unlockAccount.missingToken")}</p>
50
- <Link href={loginHref} variant="muted">
51
- {t("auth.unlockAccount.goToLogin")}
52
- </Link>
53
- </AuthCard>
54
- );
55
- }
56
-
57
- if (status === "verifying") {
58
- return (
59
- <AuthCard>
60
- <div className="p-6">
61
- <p className="text-sm text-muted-foreground" role="status">
62
- {t("auth.unlockAccount.verifying")}
63
- </p>
64
- </div>
65
- </AuthCard>
66
- );
67
- }
68
-
69
- if (status === "success") {
70
- return (
71
- <AuthCard title={title ?? t("auth.unlockAccount.successTitle")}>
72
- <p className="text-sm text-muted-foreground">{t("auth.unlockAccount.successBody")}</p>
73
- <Link href={loginHref} variant="button">
74
- {t("auth.unlockAccount.goToLogin")}
75
- </Link>
76
- </AuthCard>
77
- );
78
- }
79
-
80
- // status === "error"
81
26
  return (
82
- <AuthCard title={title ?? t("auth.unlockAccount.errorTitle")}>
83
- <p className="text-sm text-muted-foreground">{t("auth.unlockAccount.errorBody")}</p>
84
- <Link href={loginHref} variant="muted">
85
- {t("auth.unlockAccount.goToLogin")}
86
- </Link>
87
- </AuthCard>
27
+ <TokenConfirmScreen
28
+ title={title}
29
+ token={token}
30
+ loginHref={loginHref}
31
+ confirm={confirmAccountUnlock}
32
+ labels={{
33
+ errorTitle: t("auth.unlockAccount.errorTitle"),
34
+ missingToken: t("auth.unlockAccount.missingToken"),
35
+ goToLogin: t("auth.unlockAccount.goToLogin"),
36
+ verifying: t("auth.unlockAccount.verifying"),
37
+ successTitle: t("auth.unlockAccount.successTitle"),
38
+ successBody: t("auth.unlockAccount.successBody"),
39
+ errorBody: t("auth.unlockAccount.errorBody"),
40
+ }}
41
+ />
88
42
  );
89
43
  }
@@ -51,6 +51,7 @@ export type {
51
51
  export { emailPasswordClient } from "./client-plugin.ts";
52
52
  export type { ConfirmAccountUnlockScreenProps } from "./confirm-account-unlock-screen.tsx";
53
53
  export { ConfirmAccountUnlockScreen } from "./confirm-account-unlock-screen.tsx";
54
+ export { AuthHandlers } from "./constants.ts";
54
55
  export type { DefaultTopbarActionsProps } from "./default-topbar-actions.tsx";
55
56
  export { DefaultTopbarActions } from "./default-topbar-actions.tsx";
56
57
  export type { ForgotPasswordScreenProps } from "./forgot-password-screen.tsx";
@@ -0,0 +1,8 @@
1
+ export function readPathParam(
2
+ search: string,
3
+ paramName: string,
4
+ isSafePath: (candidate: unknown) => candidate is string,
5
+ ): string | null {
6
+ const candidate = new URLSearchParams(search).get(paramName);
7
+ return isSafePath(candidate) ? candidate : null;
8
+ }