@cosmicdrift/kumiko-bundled-features 0.406.0 → 0.410.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 (353) hide show
  1. package/dist/account-security/feature.js +9 -1
  2. package/dist/admin-shell/feature.d.ts +3 -0
  3. package/dist/admin-shell/feature.js +1 -1
  4. package/dist/agent-tools/agent-manifest.js +1 -0
  5. package/dist/agent-tools/tool-catalog.js +1 -0
  6. package/dist/agent-tools/types.d.ts +4 -1
  7. package/dist/audit/event-classification.js +1 -0
  8. package/dist/auth-email-password/bootstrap.js +1 -0
  9. package/dist/auth-email-password/errors.js +16 -41
  10. package/dist/auth-email-password/handlers/login-options.query.js +1 -1
  11. package/dist/auth-email-password/handlers/self-registration-status.query.js +1 -1
  12. package/dist/auth-email-password/web/auth-client.d.ts +8 -32
  13. package/dist/auth-email-password/web/auth-client.js +18 -52
  14. package/dist/auth-email-password/web/auth-redirect.js +2 -2
  15. package/dist/auth-email-password/web/confirm-account-unlock-screen.d.ts +2 -2
  16. package/dist/auth-email-password/web/confirm-account-unlock-screen.js +14 -35
  17. package/dist/auth-email-password/web/index.d.ts +1 -0
  18. package/dist/auth-email-password/web/index.js +1 -0
  19. package/dist/auth-email-password/web/read-path-param.d.ts +1 -0
  20. package/dist/auth-email-password/web/read-path-param.js +4 -0
  21. package/dist/auth-email-password/web/return-path.js +2 -2
  22. package/dist/auth-email-password/web/token-confirm-screen.d.ts +20 -0
  23. package/dist/auth-email-password/web/token-confirm-screen.js +38 -0
  24. package/dist/auth-email-password/web/verify-email-screen.d.ts +2 -2
  25. package/dist/auth-email-password/web/verify-email-screen.js +14 -37
  26. package/dist/auth-foundation/boot-checks.js +24 -12
  27. package/dist/auth-foundation/boot-rules.d.ts +27 -0
  28. package/dist/auth-foundation/boot-rules.js +27 -0
  29. package/dist/auth-mfa/errors.d.ts +1 -1
  30. package/dist/auth-mfa/errors.js +11 -24
  31. package/dist/auth-mfa/feature-exports.js +6 -45
  32. package/dist/auth-mfa/feature.js +7 -18
  33. package/dist/auth-mfa/web/mfa-client.js +11 -25
  34. package/dist/billing-foundation/consumer-protection/termination-notify.js +1 -0
  35. package/dist/billing-foundation/web/plan-price.js +7 -8
  36. package/dist/cap-counter/stock-cap-guard.js +1 -0
  37. package/dist/channel-in-app/constants.d.ts +1 -0
  38. package/dist/channel-in-app/feature.js +2 -0
  39. package/dist/channel-in-app/handlers/read-state-by-keys.query.d.ts +9 -0
  40. package/dist/channel-in-app/handlers/read-state-by-keys.query.js +21 -0
  41. package/dist/channel-in-app/in-app-channel.js +1 -0
  42. package/dist/channel-in-app/tables.js +5 -1
  43. package/dist/compliance-profiles/handlers/sub-processors.query.js +4 -1
  44. package/dist/contact/challenge.d.ts +14 -0
  45. package/dist/contact/challenge.js +30 -0
  46. package/dist/contact/client/contact-client-source.d.ts +1 -0
  47. package/dist/contact/client/contact-client-source.js +203 -0
  48. package/dist/contact/client/contact-website-client.d.ts +26 -0
  49. package/dist/contact/client/contact-website-client.js +1 -0
  50. package/dist/contact/client/index.d.ts +2 -0
  51. package/dist/contact/client/index.js +1 -0
  52. package/dist/contact/entity.d.ts +777 -0
  53. package/dist/contact/entity.js +145 -0
  54. package/dist/contact/feature.d.ts +3 -0
  55. package/dist/contact/feature.js +134 -0
  56. package/dist/contact/handlers/access.d.ts +7 -0
  57. package/dist/contact/handlers/access.js +9 -0
  58. package/dist/contact/handlers/attempts.d.ts +14 -0
  59. package/dist/contact/handlers/attempts.js +54 -0
  60. package/dist/contact/handlers/challenge.query.d.ts +9 -0
  61. package/dist/contact/handlers/challenge.query.js +35 -0
  62. package/dist/contact/handlers/forward-request.write.d.ts +9 -0
  63. package/dist/contact/handlers/forward-request.write.js +61 -0
  64. package/dist/contact/handlers/mark-done.write.d.ts +7 -0
  65. package/dist/contact/handlers/mark-done.write.js +30 -0
  66. package/dist/contact/handlers/notify-reporter-in-app.write.d.ts +10 -0
  67. package/dist/contact/handlers/notify-reporter-in-app.write.js +36 -0
  68. package/dist/contact/handlers/open-count.d.ts +2 -0
  69. package/dist/contact/handlers/open-count.js +11 -0
  70. package/dist/contact/handlers/open-count.query.d.ts +3 -0
  71. package/dist/contact/handlers/open-count.query.js +13 -0
  72. package/dist/contact/handlers/replies.query.d.ts +11 -0
  73. package/dist/contact/handlers/replies.query.js +28 -0
  74. package/dist/contact/handlers/reply.write.d.ts +12 -0
  75. package/dist/contact/handlers/reply.write.js +118 -0
  76. package/dist/contact/handlers/report.write.d.ts +16 -0
  77. package/dist/contact/handlers/report.write.js +90 -0
  78. package/dist/contact/handlers/request-delivery.query.d.ts +16 -0
  79. package/dist/contact/handlers/request-delivery.query.js +85 -0
  80. package/dist/contact/handlers/request-detail.query.d.ts +41 -0
  81. package/dist/contact/handlers/request-detail.query.js +32 -0
  82. package/dist/contact/handlers/request-list.query.d.ts +2 -0
  83. package/dist/contact/handlers/request-list.query.js +9 -0
  84. package/dist/contact/handlers/send-reply-mail.write.d.ts +8 -0
  85. package/dist/contact/handlers/send-reply-mail.write.js +82 -0
  86. package/dist/contact/handlers/send-test.write.d.ts +5 -0
  87. package/dist/contact/handlers/send-test.write.js +36 -0
  88. package/dist/contact/handlers/submit.write.d.ts +20 -0
  89. package/dist/contact/handlers/submit.write.js +137 -0
  90. package/dist/contact/handlers/take-over-uploads.d.ts +9 -0
  91. package/dist/contact/handlers/take-over-uploads.js +33 -0
  92. package/dist/contact/i18n.d.ts +6 -0
  93. package/dist/contact/i18n.js +189 -0
  94. package/dist/contact/index.d.ts +5 -0
  95. package/dist/contact/index.js +4 -0
  96. package/dist/contact/lib.d.ts +101 -0
  97. package/dist/contact/lib.js +109 -0
  98. package/dist/contact/mail.d.ts +91 -0
  99. package/dist/contact/mail.js +279 -0
  100. package/dist/contact/options.d.ts +51 -0
  101. package/dist/contact/options.js +32 -0
  102. package/dist/contact/panels.d.ts +2 -0
  103. package/dist/contact/panels.js +21 -0
  104. package/dist/contact/payloads.d.ts +56 -0
  105. package/dist/contact/payloads.js +82 -0
  106. package/dist/contact/pow.d.ts +6 -0
  107. package/dist/contact/pow.js +19 -0
  108. package/dist/contact/screens.d.ts +5 -0
  109. package/dist/contact/screens.js +465 -0
  110. package/dist/contact/subject.d.ts +1 -0
  111. package/dist/contact/subject.js +13 -0
  112. package/dist/contact/user-agent.d.ts +1 -0
  113. package/dist/contact/user-agent.js +35 -0
  114. package/dist/contact/user-data-hooks.d.ts +3 -0
  115. package/dist/contact/user-data-hooks.js +129 -0
  116. package/dist/contact/web/constants.d.ts +127 -0
  117. package/dist/contact/web/constants.js +126 -0
  118. package/dist/contact/web/index.d.ts +1 -0
  119. package/dist/contact/web/index.js +1 -0
  120. package/dist/crypto-shredding/handlers/forget-subject.write.js +5 -13
  121. package/dist/data-retention/feature.js +16 -2
  122. package/dist/data-retention/index.d.ts +1 -0
  123. package/dist/data-retention/index.js +1 -0
  124. package/dist/data-retention/run-retention-cleanup.d.ts +14 -2
  125. package/dist/data-retention/run-retention-cleanup.js +102 -36
  126. package/dist/data-retention/tenant-destruction-hold.d.ts +23 -0
  127. package/dist/data-retention/tenant-destruction-hold.js +132 -0
  128. package/dist/delivery/address-opt-out.js +1 -0
  129. package/dist/delivery/channel-context.d.ts +1 -1
  130. package/dist/delivery/channel-context.js +2 -1
  131. package/dist/delivery/delivery-service.js +18 -8
  132. package/dist/delivery/events.d.ts +1 -0
  133. package/dist/delivery/events.js +2 -0
  134. package/dist/delivery/feature.js +3 -0
  135. package/dist/delivery/handlers/attempts-by-keys.query.d.ts +15 -0
  136. package/dist/delivery/handlers/attempts-by-keys.query.js +35 -0
  137. package/dist/delivery/handlers/log.query.d.ts +1 -0
  138. package/dist/delivery/handlers/log.query.js +1 -1
  139. package/dist/delivery/jobs.js +5 -2
  140. package/dist/delivery/tables.js +12 -2
  141. package/dist/delivery/types.d.ts +2 -0
  142. package/dist/delivery/unsubscribe-page.js +2 -0
  143. package/dist/delivery/web/delivery-channel-cell.js +1 -1
  144. package/dist/delivery/web/delivery-error-cell.js +1 -1
  145. package/dist/delivery/web/delivery-status-cell.js +1 -1
  146. package/dist/delivery/web/delivery-time-cell.js +3 -2
  147. package/dist/delivery/web/delivery-type-cell.js +1 -1
  148. package/dist/delivery/web/public-names.d.ts +1 -0
  149. package/dist/delivery/web/public-names.js +1 -0
  150. package/dist/document-ingest-foundation/boot-checks.js +19 -11
  151. package/dist/document-ingest-foundation/boot-rules.d.ts +17 -0
  152. package/dist/document-ingest-foundation/boot-rules.js +17 -0
  153. package/dist/document-ingest-foundation/events.d.ts +8 -0
  154. package/dist/document-ingest-foundation/events.js +12 -0
  155. package/dist/document-ingest-foundation/feature.js +30 -2
  156. package/dist/document-ingest-foundation/index.d.ts +3 -1
  157. package/dist/document-ingest-foundation/index.js +3 -1
  158. package/dist/document-ingest-foundation/report-ingest-progress.d.ts +14 -0
  159. package/dist/document-ingest-foundation/report-ingest-progress.js +20 -0
  160. package/dist/document-ingest-foundation/tables.d.ts +3 -0
  161. package/dist/document-ingest-foundation/tables.js +26 -0
  162. package/dist/file-derivatives/handlers/public-variant-by-file-ref.query.js +1 -1
  163. package/dist/file-derivatives/handlers/public-variant.query.js +1 -1
  164. package/dist/files-tenant-data/hooks.js +4 -1
  165. package/dist/folders/web/folder-manager.js +3 -10
  166. package/dist/folders/web/folder-section.js +1 -1
  167. package/dist/form-draft-user-data/index.js +4 -1
  168. package/dist/inbound-mail-foundation/entities.d.ts +3 -0
  169. package/dist/inbound-mail-foundation/entities.js +2 -0
  170. package/dist/inbound-mail-foundation/events.d.ts +2 -0
  171. package/dist/inbound-mail-foundation/events.js +2 -0
  172. package/dist/inbound-mail-foundation/feature.js +6 -6
  173. package/dist/inbound-mail-foundation/handlers/attach-message-content.write.js +3 -1
  174. package/dist/inbound-mail-foundation/handlers/ingest-message.write.js +5 -0
  175. package/dist/inbound-mail-foundation/handlers/list-messages.query.js +4 -2
  176. package/dist/inbound-mail-foundation/handlers/message-content.d.ts +1 -0
  177. package/dist/inbound-mail-foundation/handlers/message-content.js +8 -0
  178. package/dist/inbound-mail-foundation/handlers/message-content.query.d.ts +2 -0
  179. package/dist/inbound-mail-foundation/handlers/message-content.query.js +1 -0
  180. package/dist/inbound-mail-foundation/projection.d.ts +3 -0
  181. package/dist/inbound-mail-foundation/projection.js +2 -0
  182. package/dist/inbound-mail-foundation/sanitize-inbound-html.d.ts +2 -0
  183. package/dist/inbound-mail-foundation/sanitize-inbound-html.js +135 -0
  184. package/dist/inbound-mail-foundation/types.js +1 -0
  185. package/dist/jobs/job-run-logger.js +16 -20
  186. package/dist/ledger/handlers/reports.query.js +25 -27
  187. package/dist/ledger/recurring.js +1 -0
  188. package/dist/managed-pages/handlers/branding.query.js +1 -1
  189. package/dist/managed-pages/handlers/by-slug.query.js +1 -1
  190. package/dist/managed-pages/handlers/by-tenant-published.query.js +1 -1
  191. package/dist/notes-history/web/notes-section.js +3 -2
  192. package/dist/personal-access-tokens/feature.js +5 -18
  193. package/dist/personal-access-tokens/handlers/create.write.js +2 -5
  194. package/dist/secrets/handlers/delete.write.d.ts +4 -0
  195. package/dist/secrets/handlers/delete.write.js +9 -4
  196. package/dist/secrets/handlers/list.query.d.ts +6 -1
  197. package/dist/secrets/handlers/list.query.js +7 -3
  198. package/dist/secrets/handlers/set.write.d.ts +4 -0
  199. package/dist/secrets/handlers/set.write.js +10 -4
  200. package/dist/secrets/secret-scope.d.ts +17 -0
  201. package/dist/secrets/secret-scope.js +18 -0
  202. package/dist/seo/handlers/seo-config.query.js +1 -1
  203. package/dist/sessions/feature.d.ts +3 -0
  204. package/dist/sessions/feature.js +13 -19
  205. package/dist/sessions/handlers/last-activity-probe.query.d.ts +7 -0
  206. package/dist/sessions/handlers/last-activity-probe.query.js +40 -0
  207. package/dist/sessions/handlers/last-activity-probe.route.d.ts +2 -0
  208. package/dist/sessions/handlers/last-activity-probe.route.js +30 -0
  209. package/dist/sessions/screens.js +1 -0
  210. package/dist/sessions/session-callbacks.d.ts +2 -0
  211. package/dist/sessions/session-callbacks.js +9 -7
  212. package/dist/sessions/web/i18n.js +4 -1
  213. package/dist/shared/assert-billing-live.d.ts +2 -0
  214. package/dist/shared/assert-billing-live.js +7 -0
  215. package/dist/shared/collect-extension-options.d.ts +1 -0
  216. package/dist/shared/collect-extension-options.js +8 -0
  217. package/dist/shared/index.d.ts +7 -1
  218. package/dist/shared/index.js +7 -1
  219. package/dist/shared/late-bound-slot.d.ts +5 -0
  220. package/dist/shared/late-bound-slot.js +13 -0
  221. package/dist/shared/mail-locale-templates.d.ts +1 -0
  222. package/dist/shared/mail-locale-templates.js +1 -1
  223. package/dist/shared/price-env-shape.d.ts +11 -0
  224. package/dist/shared/price-env-shape.js +15 -0
  225. package/dist/shared/purge-row-file-refs.d.ts +1 -0
  226. package/dist/shared/purge-row-file-refs.js +1 -1
  227. package/dist/shared/read-feature-export-fn.d.ts +2 -0
  228. package/dist/shared/read-feature-export-fn.js +11 -0
  229. package/dist/shared/signup-handover.js +3 -5
  230. package/dist/shared/tenant-destruction-hold.d.ts +23 -0
  231. package/dist/shared/tenant-destruction-hold.js +15 -0
  232. package/dist/shared/unprocessable.d.ts +4 -0
  233. package/dist/shared/unprocessable.js +4 -0
  234. package/dist/shared/web/index.d.ts +3 -0
  235. package/dist/shared/web/index.js +3 -0
  236. package/dist/subscription-paddle/checkout-config.query.js +1 -1
  237. package/dist/subscription-paddle/feature.d.ts +1 -5
  238. package/dist/subscription-paddle/feature.js +7 -9
  239. package/dist/subscription-paddle/runtime.js +3 -7
  240. package/dist/subscription-stripe/feature.d.ts +1 -5
  241. package/dist/subscription-stripe/feature.js +7 -9
  242. package/dist/subscription-stripe/runtime.js +3 -7
  243. package/dist/tags/entity.js +1 -0
  244. package/dist/tags/web/tag-chip.d.ts +7 -0
  245. package/dist/tags/web/tag-chip.js +4 -0
  246. package/dist/tags/web/tag-filter.js +2 -5
  247. package/dist/tags/web/tag-manager.js +1 -1
  248. package/dist/tags/web/tag-section.js +3 -6
  249. package/dist/tags/web/tags-cell.js +2 -5
  250. package/dist/template-resolver/compile-document-body.js +12 -17
  251. package/dist/template-resolver/handlers/by-slug.query.js +1 -1
  252. package/dist/template-resolver/handlers/by-tenant.query.js +4 -2
  253. package/dist/template-resolver/handlers/discard-draft.write.js +1 -0
  254. package/dist/template-resolver/handlers/overview.query.js +3 -1
  255. package/dist/template-resolver/handlers/send-test.write.js +2 -4
  256. package/dist/template-resolver/handlers/toggle-status.write.js +3 -0
  257. package/dist/template-resolver/linked-resources.js +6 -5
  258. package/dist/template-resolver/store-template-resource.js +5 -10
  259. package/dist/template-resolver/web/document-images.js +6 -6
  260. package/dist/template-resolver/web/document-insert-fields.js +22 -4
  261. package/dist/template-resolver/web/document-schema.js +11 -12
  262. package/dist/template-resolver/web/tiptap-attribute-parse-rule.d.ts +15 -0
  263. package/dist/template-resolver/web/tiptap-attribute-parse-rule.js +11 -0
  264. package/dist/tenant/i18n.js +3 -0
  265. package/dist/tenant/schema/tenant.d.ts +9 -7
  266. package/dist/tenant/schema/tenant.js +1 -0
  267. package/dist/tenant/web/member-roles-cell.js +1 -1
  268. package/dist/tenant/web/member-status-cell.js +1 -1
  269. package/dist/tenant-inactivity/check-inactive-tenants.d.ts +3 -0
  270. package/dist/tenant-inactivity/check-inactive-tenants.js +184 -0
  271. package/dist/tenant-inactivity/constants.d.ts +10 -0
  272. package/dist/tenant-inactivity/constants.js +10 -0
  273. package/dist/tenant-inactivity/email-templates.d.ts +3 -0
  274. package/dist/tenant-inactivity/email-templates.js +16 -0
  275. package/dist/tenant-inactivity/feature.d.ts +8 -0
  276. package/dist/tenant-inactivity/feature.js +45 -0
  277. package/dist/tenant-inactivity/handlers/inactivity-state.query.d.ts +11 -0
  278. package/dist/tenant-inactivity/handlers/inactivity-state.query.js +45 -0
  279. package/dist/tenant-inactivity/handlers/keep-account.write.d.ts +8 -0
  280. package/dist/tenant-inactivity/handlers/keep-account.write.js +51 -0
  281. package/dist/tenant-inactivity/inactivity-plan.d.ts +51 -0
  282. package/dist/tenant-inactivity/inactivity-plan.js +113 -0
  283. package/dist/tenant-inactivity/index.d.ts +5 -0
  284. package/dist/tenant-inactivity/index.js +3 -0
  285. package/dist/tenant-inactivity/keep-token.d.ts +16 -0
  286. package/dist/tenant-inactivity/keep-token.js +24 -0
  287. package/dist/tenant-inactivity/mail-notifications.d.ts +4 -0
  288. package/dist/tenant-inactivity/mail-notifications.js +42 -0
  289. package/dist/tenant-inactivity/options.d.ts +27 -0
  290. package/dist/tenant-inactivity/options.js +5 -0
  291. package/dist/tenant-inactivity/remote-activity.d.ts +15 -0
  292. package/dist/tenant-inactivity/remote-activity.js +24 -0
  293. package/dist/tenant-inactivity/state-store.d.ts +10 -0
  294. package/dist/tenant-inactivity/state-store.js +50 -0
  295. package/dist/tenant-inactivity/state-table.d.ts +109 -0
  296. package/dist/tenant-inactivity/state-table.js +38 -0
  297. package/dist/tenant-lifecycle/boot-checks.js +8 -3
  298. package/dist/tenant-lifecycle/boot-rules.d.ts +12 -0
  299. package/dist/tenant-lifecycle/boot-rules.js +12 -0
  300. package/dist/tenant-lifecycle/feature.js +17 -2
  301. package/dist/tenant-lifecycle/handlers/request-destruction.write.js +11 -67
  302. package/dist/tenant-lifecycle/index.d.ts +1 -0
  303. package/dist/tenant-lifecycle/index.js +1 -0
  304. package/dist/tenant-lifecycle/request-tenant-destruction.d.ts +20 -0
  305. package/dist/tenant-lifecycle/request-tenant-destruction.js +66 -0
  306. package/dist/tenant-lifecycle/retention-config-destroy-hooks.d.ts +5 -0
  307. package/dist/tenant-lifecycle/retention-config-destroy-hooks.js +29 -0
  308. package/dist/tenant-lifecycle/run-tenant-destroy.d.ts +3 -0
  309. package/dist/tenant-lifecycle/run-tenant-destroy.js +43 -5
  310. package/dist/tenant-lifecycle/stages.d.ts +2 -0
  311. package/dist/tenant-lifecycle/stages.js +23 -2
  312. package/dist/tenant-lifecycle/testing.js +1 -1
  313. package/dist/tier-engine/caps-for-tier-from-map.d.ts +5 -0
  314. package/dist/tier-engine/caps-for-tier-from-map.js +12 -0
  315. package/dist/tier-engine/compose-app.d.ts +0 -22
  316. package/dist/tier-engine/compose-app.js +9 -16
  317. package/dist/tier-engine/index.d.ts +1 -0
  318. package/dist/tier-engine/index.js +1 -0
  319. package/dist/user/handlers/detail.query.d.ts +1 -1
  320. package/dist/user-data-rights/feature.js +2 -0
  321. package/dist/user-data-rights/handlers/confirm-deletion-by-token.write.js +4 -1
  322. package/dist/user-data-rights/handlers/download-by-token.query.js +1 -0
  323. package/dist/user-data-rights/handlers/request-deletion-by-email.write.js +4 -1
  324. package/dist/user-data-rights/run-forget-cleanup.js +2 -0
  325. package/dist/user-data-rights/web/privacy-center-screen.js +1 -1
  326. package/dist/user-data-rights/zip-path.js +1 -0
  327. package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.d.ts +1 -1
  328. package/dist/user-data-rights-defaults/hooks/config-value.userdata-hook.js +7 -20
  329. package/dist/user-data-rights-defaults/hooks/delivery-attempt.userdata-hook.js +3 -1
  330. package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.d.ts +10 -0
  331. package/dist/user-data-rights-defaults/hooks/forget-own-rows-delete-hook.js +26 -0
  332. package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.d.ts +1 -1
  333. package/dist/user-data-rights-defaults/hooks/notification-preference.userdata-hook.js +7 -20
  334. package/dist/user-profile/handlers/change-email.write.js +2 -4
  335. package/dist/user-profile/web/profile-screen.js +2 -3
  336. package/dist/waitlist/handlers/submit.write.js +1 -2
  337. package/kumiko-es-tables.json +12 -0
  338. package/package.json +54 -12
  339. package/src/admin-shell/changes.json +6 -0
  340. package/src/agent-tools/changes.json +6 -0
  341. package/src/channel-in-app/changes.json +7 -0
  342. package/src/contact/changes.json +33 -0
  343. package/src/data-retention/changes.json +6 -0
  344. package/src/delivery/changes.json +7 -0
  345. package/src/document-ingest-foundation/changes.json +6 -0
  346. package/src/files-tenant-data/changes.json +6 -0
  347. package/src/inbound-mail-foundation/changes.json +13 -0
  348. package/src/secrets/changes.json +6 -0
  349. package/src/sessions/changes.json +6 -0
  350. package/src/tenant-inactivity/changes.json +8 -0
  351. package/src/tenant-lifecycle/changes.json +18 -0
  352. package/src/tier-engine/changes.json +6 -0
  353. package/src/waitlist/changes.json +6 -0
@@ -27,23 +27,31 @@ export function createAccountSecurityFeature(options = {}) {
27
27
  panels: [
28
28
  {
29
29
  kind: "screen",
30
+ chromeless: true,
30
31
  id: "mfa-enable",
31
32
  screen: `auth-mfa:screen:${MFA_ENABLE_SCREEN_ID}`,
32
33
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: false },
33
34
  },
34
35
  {
35
36
  kind: "screen",
37
+ chromeless: true,
36
38
  id: "mfa-regenerate",
37
39
  screen: `auth-mfa:screen:${MFA_REGENERATE_RECOVERY_SCREEN_ID}`,
38
40
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: true },
39
41
  },
40
42
  {
41
43
  kind: "screen",
44
+ chromeless: true,
42
45
  id: "mfa-disable",
43
46
  screen: `auth-mfa:screen:${MFA_DISABLE_SCREEN_ID}`,
44
47
  visibleWhen: { ...accountSecurityMfaStatusVisibility, eq: true },
45
48
  },
46
- { kind: "screen", id: "sessions", screen: `sessions:screen:${SESSION_MINE_SCREEN_ID}` },
49
+ {
50
+ kind: "screen",
51
+ chromeless: true,
52
+ id: "sessions",
53
+ screen: `sessions:screen:${SESSION_MINE_SCREEN_ID}`,
54
+ },
47
55
  ],
48
56
  });
49
57
  if (nav !== undefined) {
@@ -1,4 +1,5 @@
1
1
  import { type FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
2
+ import type { DashboardPanelDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
3
  import { type MetricDefinition } from "../metrics/index.ts";
3
4
  export type CreateAdminShellOptions = {
4
5
  /** Short workspace id for tenant operators (URL segment). Default `tenant-admin`. */
@@ -24,5 +25,7 @@ export type CreateAdminShellOptions = {
24
25
  * createMetricsFeature / createSystemMetricsFeature. Panels exist only for
25
26
  * ids in this list. Default DEFAULT_METRICS. */
26
27
  readonly metrics?: readonly MetricDefinition[];
28
+ /** Panels appended to the platform overview, for tiles a mounted feature owns (e.g. the contact inbox count). */
29
+ readonly extraPlatformPanels?: readonly DashboardPanelDefinition[];
27
30
  };
28
31
  export declare function createAdminShellFeature(options?: CreateAdminShellOptions): FeatureDefinition;
@@ -91,7 +91,7 @@ export function createAdminShellFeature(options = {}) {
91
91
  timeRange: OVERVIEW_TIME_RANGE,
92
92
  // The picker needs a SystemAdmin {rows:{value,label}} tenant query; only cap-overview ships one.
93
93
  ...(includeCapOverview && { filter: PLATFORM_TENANT_FILTER }),
94
- panels: [...platformOverviewPanels(metrics)],
94
+ panels: [...platformOverviewPanels(metrics), ...(options.extraPlatformPanels ?? [])],
95
95
  });
96
96
  r.nav({
97
97
  id: "platform-overview",
@@ -203,6 +203,7 @@ function buildHandlerEntry(qn, kind, def, roles, getHandlerEntity, denyQns) {
203
203
  kind,
204
204
  ...(description !== undefined && { description }),
205
205
  risk: exposure.risk,
206
+ ...(exposure.effect !== undefined && { effect: exposure.effect }),
206
207
  inputSchema,
207
208
  ...(entity !== undefined && { entity }),
208
209
  ...(excludedFields !== undefined && { excludedFields }),
@@ -426,6 +426,7 @@ function addWriteHandlerTools(manifest, detailQnByEntity, denyQns, sink) {
426
426
  op: "write",
427
427
  qn: handler.qn,
428
428
  risk: handler.risk,
429
+ ...(handler.effect !== undefined && { effect: handler.effect }),
429
430
  ...(handler.entity !== undefined && { entity: handler.entity }),
430
431
  ...(detailQn !== undefined && { detailQn }),
431
432
  ...(injectsVersion && { injectsVersion: true }),
@@ -1,4 +1,4 @@
1
- import type { AgentRisk, EntityDefinition, FeatureDefinition, NavDefinition, QueryHandlerDef, ScreenDefinition, TranslationKeys, WorkspaceDefinition, WriteHandlerDef } from "@cosmicdrift/kumiko-framework/engine";
1
+ import type { AgentEffect, AgentRisk, EntityDefinition, FeatureDefinition, NavDefinition, QueryHandlerDef, ScreenDefinition, TranslationKeys, WorkspaceDefinition, WriteHandlerDef } from "@cosmicdrift/kumiko-framework/engine";
2
2
  export type AgentToolMode = "read-only" | "approval" | "edit";
3
3
  export type ToolCatalogOptions = {
4
4
  readonly mode: AgentToolMode;
@@ -59,6 +59,8 @@ export type ToolDispatchDescriptor = {
59
59
  readonly op: "write";
60
60
  readonly qn: string;
61
61
  readonly risk: AgentRisk;
62
+ /** "proposal": the write changes a suggestion a person still approves, so no approval step. */
63
+ readonly effect?: AgentEffect;
62
64
  readonly entity?: string;
63
65
  /** `<feature>:query:<entity>:detail` QN when one is mounted and readable.
64
66
  * Dispatch reads the current `version` from it before an optimistic-lock
@@ -128,6 +130,7 @@ export type AgentManifestHandler = {
128
130
  readonly kind: "query" | "write";
129
131
  readonly description?: string;
130
132
  readonly risk: AgentRisk;
133
+ readonly effect?: AgentEffect;
131
134
  readonly inputSchema: Readonly<Record<string, unknown>>;
132
135
  readonly entity?: string;
133
136
  /** Fields this generic create/update handler never writes; sending one fails validation. */
@@ -14,6 +14,7 @@ export const AUDIT_EVENT_STANCES = {
14
14
  "inbound-mail-foundation:event:inbound-message-received": TECHNICAL_EVENT,
15
15
  "inbound-mail-foundation:event:inbound-message-content-fetched": TECHNICAL_EVENT,
16
16
  "inbound-mail-foundation:event:mail-thread-updated": TECHNICAL_EVENT,
17
+ "document-ingest-foundation:event:document-ingest-progress": TECHNICAL_EVENT,
17
18
  "document-ingest-foundation:event:document-ingest-requested": TECHNICAL_EVENT,
18
19
  "document-ingest-foundation:event:document-ingest-skipped": TECHNICAL_EVENT,
19
20
  "tenant-lifecycle:event:tenant-destruction-stage-started": TECHNICAL_EVENT,
@@ -141,6 +141,7 @@ function isMailingOutcome(outcome) {
141
141
  return outcome === "invited" || outcome === "resent";
142
142
  }
143
143
  // A one-shot operator process, not a tenant request: it looks up users, memberships and invitations across tenants.
144
+ // guard:dup-ok the single runInSystemRowLevelSecurityScope call with this entry point's own reason
144
145
  export function bootstrapTenants(deps, plan) {
145
146
  return runInSystemRowLevelSecurityScope("boot tenant bootstrap creates tenants and memberships before any tenant exists", () => bootstrapTenantsInScope(deps, plan));
146
147
  }
@@ -1,82 +1,57 @@
1
- import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
1
+ import { unprocessable } from "../shared/index.js";
2
2
  import { AuthErrors } from "./web/constants.js";
3
3
  // @wrapper-known error-helper
4
4
  export function invalidCredentials() {
5
- return writeFailure(new UnprocessableError(AuthErrors.invalidCredentials, {
6
- i18nKey: "auth.errors.invalidCredentials",
7
- }));
5
+ return unprocessable(AuthErrors.invalidCredentials, "auth.errors.invalidCredentials");
8
6
  }
9
7
  // @wrapper-known error-helper
10
8
  export function invalidInviteToken() {
11
- return writeFailure(new UnprocessableError(AuthErrors.invalidInviteToken, {
12
- i18nKey: "auth.errors.invalidInviteToken",
13
- }));
9
+ return unprocessable(AuthErrors.invalidInviteToken, "auth.errors.invalidInviteToken");
14
10
  }
15
11
  // @wrapper-known error-helper
16
12
  export function inviteEmailMismatch() {
17
- return writeFailure(new UnprocessableError(AuthErrors.inviteEmailMismatch, {
18
- i18nKey: "auth.errors.inviteEmailMismatch",
19
- }));
13
+ return unprocessable(AuthErrors.inviteEmailMismatch, "auth.errors.inviteEmailMismatch");
20
14
  }
21
15
  // @wrapper-known error-helper
22
16
  export function inviteAlreadyAccepted() {
23
- return writeFailure(new UnprocessableError(AuthErrors.inviteAlreadyAccepted, {
24
- i18nKey: "auth.errors.inviteAlreadyAccepted",
25
- }));
17
+ return unprocessable(AuthErrors.inviteAlreadyAccepted, "auth.errors.inviteAlreadyAccepted");
26
18
  }
27
19
  // @wrapper-known error-helper
28
20
  export function invalidResetToken() {
29
- return writeFailure(new UnprocessableError(AuthErrors.invalidResetToken, {
30
- i18nKey: "auth.errors.invalidResetToken",
31
- }));
21
+ return unprocessable(AuthErrors.invalidResetToken, "auth.errors.invalidResetToken");
32
22
  }
33
23
  // @wrapper-known error-helper
34
24
  export function invalidUnlockToken() {
35
- return writeFailure(new UnprocessableError(AuthErrors.invalidUnlockToken, {
36
- i18nKey: "auth.errors.invalidUnlockToken",
37
- }));
25
+ return unprocessable(AuthErrors.invalidUnlockToken, "auth.errors.invalidUnlockToken");
38
26
  }
39
27
  // @wrapper-known error-helper
40
28
  export function invalidVerificationToken() {
41
- return writeFailure(new UnprocessableError(AuthErrors.invalidVerificationToken, {
42
- i18nKey: "auth.errors.invalidVerificationToken",
43
- }));
29
+ return unprocessable(AuthErrors.invalidVerificationToken, "auth.errors.invalidVerificationToken");
44
30
  }
45
31
  // @wrapper-known error-helper
46
32
  export function invalidSignupToken() {
47
- return writeFailure(new UnprocessableError(AuthErrors.invalidSignupToken, {
48
- i18nKey: "auth.errors.invalidSignupToken",
49
- }));
33
+ return unprocessable(AuthErrors.invalidSignupToken, "auth.errors.invalidSignupToken");
50
34
  }
51
35
  // @wrapper-known error-helper
52
36
  export function signupEmailAlreadyRegistered() {
53
- return writeFailure(new UnprocessableError(AuthErrors.signupEmailAlreadyRegistered, {
54
- i18nKey: "auth.errors.signupEmailAlreadyRegistered",
55
- }));
37
+ return unprocessable(AuthErrors.signupEmailAlreadyRegistered, "auth.errors.signupEmailAlreadyRegistered");
56
38
  }
57
39
  // @wrapper-known error-helper
58
40
  export function noMembership() {
59
- return writeFailure(new UnprocessableError(AuthErrors.noMembership, {
60
- i18nKey: "auth.errors.noMembership",
61
- }));
41
+ return unprocessable(AuthErrors.noMembership, "auth.errors.noMembership");
62
42
  }
63
43
  // @wrapper-known error-helper
64
44
  export function emailNotVerified() {
65
- return writeFailure(new UnprocessableError(AuthErrors.emailNotVerified, {
66
- i18nKey: "auth.errors.emailNotVerified",
67
- }));
45
+ return unprocessable(AuthErrors.emailNotVerified, "auth.errors.emailNotVerified");
68
46
  }
69
47
  // retryAfterSeconds drives the login/signup UI countdown — must stay > 0.
70
48
  // @wrapper-known error-helper
71
49
  export function accountLocked(retryAfterSeconds) {
72
- return writeFailure(new UnprocessableError(AuthErrors.accountLocked, {
73
- i18nKey: "auth.errors.accountLocked",
74
- details: { retryAfterSeconds },
75
- }));
50
+ return unprocessable(AuthErrors.accountLocked, "auth.errors.accountLocked", {
51
+ retryAfterSeconds,
52
+ });
76
53
  }
77
54
  // @wrapper-known error-helper
78
55
  export function accountRestricted() {
79
- return writeFailure(new UnprocessableError(AuthErrors.accountRestricted, {
80
- i18nKey: "auth.errors.accountRestricted",
81
- }));
56
+ return unprocessable(AuthErrors.accountRestricted, "auth.errors.accountRestricted");
82
57
  }
@@ -7,7 +7,7 @@ import { AuthHandlers } from "../web/constants.js";
7
7
  export const loginOptionsQuery = defineQueryHandler({
8
8
  name: "login-options",
9
9
  schema: z.object({}),
10
- access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"] },
10
+ access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
11
11
  rateLimit: { per: "ip+handler", limit: 30, windowSeconds: 60 },
12
12
  description: "Reports which optional login-page flows (password reset, account unlock) are available, readable without signing in, so the login screen links only to flows that exist.",
13
13
  handler: async (_query, ctx) => ({
@@ -12,7 +12,7 @@ import { AUTH_SELF_REGISTRATION_FEATURE } from "../self-registration-toggle.js";
12
12
  export const selfRegistrationStatusQuery = defineQueryHandler({
13
13
  name: "signup-registration-status",
14
14
  schema: z.object({}),
15
- access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"] },
15
+ access: { roles: ["anonymous", "User", "TenantAdmin", "SystemAdmin"], anySignedIn: true },
16
16
  rateLimit: { per: "ip+handler", limit: 30, windowSeconds: 60 },
17
17
  description: "Reports whether self-registration is currently switched on, readable without signing in, so a signup page can hide its own form instead of collecting an address that would be silently ignored.",
18
18
  handler: async (_query, ctx) => {
@@ -50,42 +50,18 @@ export type AuthTokenFailure = {
50
50
  };
51
51
  export type ResetPasswordFailure = AuthTokenFailure;
52
52
  export type VerifyEmailFailure = AuthTokenFailure;
53
- export declare function requestPasswordReset(email: string, returnTo?: string): Promise<{
53
+ type AuthTokenResult = {
54
54
  ok: true;
55
55
  } | {
56
56
  ok: false;
57
57
  error: AuthTokenFailure;
58
- }>;
59
- export declare function resetPassword(token: string, newPassword: string): Promise<{
60
- ok: true;
61
- } | {
62
- ok: false;
63
- error: AuthTokenFailure;
64
- }>;
65
- export declare function requestEmailVerification(email: string): Promise<{
66
- ok: true;
67
- } | {
68
- ok: false;
69
- error: AuthTokenFailure;
70
- }>;
71
- export declare function verifyEmail(token: string): Promise<{
72
- ok: true;
73
- } | {
74
- ok: false;
75
- error: AuthTokenFailure;
76
- }>;
77
- export declare function requestAccountUnlock(email: string): Promise<{
78
- ok: true;
79
- } | {
80
- ok: false;
81
- error: AuthTokenFailure;
82
- }>;
83
- export declare function confirmAccountUnlock(token: string): Promise<{
84
- ok: true;
85
- } | {
86
- ok: false;
87
- error: AuthTokenFailure;
88
- }>;
58
+ };
59
+ export declare function requestPasswordReset(email: string, returnTo?: string): Promise<AuthTokenResult>;
60
+ export declare function resetPassword(token: string, newPassword: string): Promise<AuthTokenResult>;
61
+ export declare function requestEmailVerification(email: string): Promise<AuthTokenResult>;
62
+ export declare function verifyEmail(token: string): Promise<AuthTokenResult>;
63
+ export declare function requestAccountUnlock(email: string): Promise<AuthTokenResult>;
64
+ export declare function confirmAccountUnlock(token: string): Promise<AuthTokenResult>;
89
65
  export declare function requestSignup(email: string, handover?: {
90
66
  readonly entityType: string;
91
67
  readonly token: string;
@@ -90,21 +90,27 @@ async function parseTokenFailure(res) {
90
90
  const reason = body.error?.details?.reason ?? body.error?.code ?? "unknown";
91
91
  return { reason };
92
92
  }
93
- // POST /api/auth/request-password-reset. 200 silent-success: even if the
94
- // email doesn't exist, the caller sees `{ ok: true }` — no account
95
- // enumeration. Server only triggers the mail internally when a user is
96
- // found. 429 → typed rate-limit failure. 5xx → unknown-error.
97
- export async function requestPasswordReset(email, returnTo) {
98
- const res = await fetch("/api/auth/request-password-reset", {
93
+ async function postTokenRequest(path, payload) {
94
+ const res = await fetch(path, {
99
95
  method: "POST",
100
96
  credentials: "same-origin",
101
97
  headers: { "Content-Type": "application/json", ...csrfHeader() },
102
- body: JSON.stringify({ email, ...(returnTo !== undefined && { returnTo }) }),
98
+ body: JSON.stringify(payload),
103
99
  });
104
100
  if (res.ok)
105
101
  return { ok: true };
106
102
  return { ok: false, error: await parseTokenFailure(res) };
107
103
  }
104
+ // POST /api/auth/request-password-reset. 200 silent-success: even if the
105
+ // email doesn't exist, the caller sees `{ ok: true }` — no account
106
+ // enumeration. Server only triggers the mail internally when a user is
107
+ // found. 429 → typed rate-limit failure. 5xx → unknown-error.
108
+ export async function requestPasswordReset(email, returnTo) {
109
+ return postTokenRequest("/api/auth/request-password-reset", {
110
+ email,
111
+ ...(returnTo !== undefined && { returnTo }),
112
+ });
113
+ }
108
114
  // POST /api/auth/reset-password. The token comes from the URL and the
109
115
  // request includes the new password. On 422, the server collapses all
110
116
  // token-verification errors (malformed, bad signature, expired) into the
@@ -112,55 +118,23 @@ export async function requestPasswordReset(email, returnTo) {
112
118
  // failures (newPassword < 8) use a separate 4xx code, "validation_failed".
113
119
  // The UI maps reason to an i18n key.
114
120
  export async function resetPassword(token, newPassword) {
115
- const res = await fetch("/api/auth/reset-password", {
116
- method: "POST",
117
- credentials: "same-origin",
118
- headers: { "Content-Type": "application/json", ...csrfHeader() },
119
- body: JSON.stringify({ token, newPassword }),
120
- });
121
- if (res.ok)
122
- return { ok: true };
123
- return { ok: false, error: await parseTokenFailure(res) };
121
+ return postTokenRequest("/api/auth/reset-password", { token, newPassword });
124
122
  }
125
123
  // POST /api/auth/request-email-verification. Same silent-success
126
124
  // semantics as request-password-reset. 429 → rate-limit failure.
127
125
  export async function requestEmailVerification(email) {
128
- const res = await fetch("/api/auth/request-email-verification", {
129
- method: "POST",
130
- credentials: "same-origin",
131
- headers: { "Content-Type": "application/json", ...csrfHeader() },
132
- body: JSON.stringify({ email }),
133
- });
134
- if (res.ok)
135
- return { ok: true };
136
- return { ok: false, error: await parseTokenFailure(res) };
126
+ return postTokenRequest("/api/auth/request-email-verification", { email });
137
127
  }
138
128
  // POST /api/auth/verify-email. VerifyEmailScreen submits this automatically
139
129
  // after parsing `?token=...`. The server collapses all verification failures
140
130
  // into `invalid_verification_token` to prevent enumeration, as with reset.
141
131
  export async function verifyEmail(token) {
142
- const res = await fetch("/api/auth/verify-email", {
143
- method: "POST",
144
- credentials: "same-origin",
145
- headers: { "Content-Type": "application/json", ...csrfHeader() },
146
- body: JSON.stringify({ token }),
147
- });
148
- if (res.ok)
149
- return { ok: true };
150
- return { ok: false, error: await parseTokenFailure(res) };
132
+ return postTokenRequest("/api/auth/verify-email", { token });
151
133
  }
152
134
  // POST /api/auth/request-account-unlock. Same silent-success semantics as
153
135
  // request-password-reset. 429 → rate-limit failure.
154
136
  export async function requestAccountUnlock(email) {
155
- const res = await fetch("/api/auth/request-account-unlock", {
156
- method: "POST",
157
- credentials: "same-origin",
158
- headers: { "Content-Type": "application/json", ...csrfHeader() },
159
- body: JSON.stringify({ email }),
160
- });
161
- if (res.ok)
162
- return { ok: true };
163
- return { ok: false, error: await parseTokenFailure(res) };
137
+ return postTokenRequest("/api/auth/request-account-unlock", { email });
164
138
  }
165
139
  // POST /api/auth/confirm-account-unlock. Auto-submitted by
166
140
  // ConfirmAccountUnlockScreen after parsing `?token=...`. Server collapses
@@ -168,15 +142,7 @@ export async function requestAccountUnlock(email) {
168
142
  // parallel to reset/verify). Only clears the Redis lockout state, no
169
143
  // entity write.
170
144
  export async function confirmAccountUnlock(token) {
171
- const res = await fetch("/api/auth/confirm-account-unlock", {
172
- method: "POST",
173
- credentials: "same-origin",
174
- headers: { "Content-Type": "application/json", ...csrfHeader() },
175
- body: JSON.stringify({ token }),
176
- });
177
- if (res.ok)
178
- return { ok: true };
179
- return { ok: false, error: await parseTokenFailure(res) };
145
+ return postTokenRequest("/api/auth/confirm-account-unlock", { token });
180
146
  }
181
147
  // POST /api/auth/signup-request. Always returns 200 to prevent enumeration;
182
148
  // the response does not reveal whether the email is already registered. The
@@ -2,12 +2,12 @@
2
2
  // string, so anything read back from it is untrusted: only same-origin
3
3
  // root-relative paths pass (no "//host", no "/\host", no scheme).
4
4
  import { appendReturnTo, NEXT_QUERY_PARAM } from "./login-url.js";
5
+ import { readPathParam } from "./read-path-param.js";
5
6
  import { isSafeReturnPath, readReturnToFromSearch } from "./return-path.js";
6
7
  export { appendReturnTo, NEXT_QUERY_PARAM };
7
8
  export const isSafeNextPath = isSafeReturnPath;
8
9
  export function readNextFromSearch(search) {
9
- const candidate = new URLSearchParams(search).get(NEXT_QUERY_PARAM);
10
- return isSafeNextPath(candidate) ? candidate : null;
10
+ return readPathParam(search, NEXT_QUERY_PARAM, isSafeNextPath);
11
11
  }
12
12
  // The returnTo a mail link or sibling auth page carried in this page's own URL; null on native, where there is no window.
13
13
  export function readReturnToFromWindow() {
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export type ConfirmAccountUnlockScreenProps = {
3
3
  readonly title?: string;
4
4
  /** Override for the token from the URL. Default: parsed from `?token=...`. */
@@ -6,4 +6,4 @@ export type ConfirmAccountUnlockScreenProps = {
6
6
  /** href for the "go to sign in" link. Default "/login". */
7
7
  readonly loginHref?: string;
8
8
  };
9
- export declare function ConfirmAccountUnlockScreen({ title, token: tokenProp, loginHref, }: ConfirmAccountUnlockScreenProps): ReactNode;
9
+ export declare function ConfirmAccountUnlockScreen({ title, token, loginHref, }: ConfirmAccountUnlockScreenProps): ReactNode;
@@ -1,42 +1,21 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // ConfirmAccountUnlockScreen — reads `?token=...` from the URL, auto-posts
3
3
  // it to /api/auth/confirm-account-unlock on mount, shows success/error.
4
4
  // Idempotent server-side (clearLockoutState is a no-op when already
5
5
  // unlocked), so no re-submit risk. Mirrors VerifyEmailScreen 1:1.
6
- //
7
- // useEffect with empty deps + a once-guard so React Strict Mode's double
8
- // useEffect dispatch in dev fires the confirm call only once.
9
- import { usePrimitives, useTranslation } from "@cosmicdrift/kumiko-renderer";
10
- import { useEffect, useRef, useState } from "react";
6
+ import { useTranslation } from "@cosmicdrift/kumiko-renderer";
11
7
  import { confirmAccountUnlock } from "./auth-client.js";
12
- import { AuthCard, useUrlToken } from "./auth-form-primitives.js";
13
- export function ConfirmAccountUnlockScreen({ title, token: tokenProp, loginHref = "/login", }) {
8
+ import { TokenConfirmScreen } from "./token-confirm-screen.js";
9
+ // guard:dup-ok TokenConfirmScreen holds the logic; each screen only supplies its own literal label keys
10
+ export function ConfirmAccountUnlockScreen({ title, token, loginHref = "/login", }) {
14
11
  const t = useTranslation();
15
- const { Link } = usePrimitives();
16
- const token = useUrlToken(tokenProp);
17
- const [status, setStatus] = useState(token === "" ? "missing-token" : "verifying");
18
- const startedRef = useRef(false);
19
- // kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
20
- useEffect(() => {
21
- if (status !== "verifying")
22
- return;
23
- if (startedRef.current)
24
- return;
25
- startedRef.current = true;
26
- void (async () => {
27
- const res = await confirmAccountUnlock(token);
28
- setStatus(res.ok ? "success" : "error");
29
- })();
30
- }, [status, token]);
31
- if (status === "missing-token") {
32
- return (_jsxs(AuthCard, { title: title ?? t("auth.unlockAccount.errorTitle"), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.unlockAccount.missingToken") }), _jsx(Link, { href: loginHref, variant: "muted", children: t("auth.unlockAccount.goToLogin") })] }));
33
- }
34
- if (status === "verifying") {
35
- return (_jsx(AuthCard, { children: _jsx("div", { className: "p-6", children: _jsx("p", { className: "text-sm text-muted-foreground", role: "status", children: t("auth.unlockAccount.verifying") }) }) }));
36
- }
37
- if (status === "success") {
38
- return (_jsxs(AuthCard, { title: title ?? t("auth.unlockAccount.successTitle"), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.unlockAccount.successBody") }), _jsx(Link, { href: loginHref, variant: "button", children: t("auth.unlockAccount.goToLogin") })] }));
39
- }
40
- // status === "error"
41
- return (_jsxs(AuthCard, { title: title ?? t("auth.unlockAccount.errorTitle"), children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t("auth.unlockAccount.errorBody") }), _jsx(Link, { href: loginHref, variant: "muted", children: t("auth.unlockAccount.goToLogin") })] }));
12
+ return (_jsx(TokenConfirmScreen, { title: title, token: token, loginHref: loginHref, confirm: confirmAccountUnlock, labels: {
13
+ errorTitle: t("auth.unlockAccount.errorTitle"),
14
+ missingToken: t("auth.unlockAccount.missingToken"),
15
+ goToLogin: t("auth.unlockAccount.goToLogin"),
16
+ verifying: t("auth.unlockAccount.verifying"),
17
+ successTitle: t("auth.unlockAccount.successTitle"),
18
+ successBody: t("auth.unlockAccount.successBody"),
19
+ errorBody: t("auth.unlockAccount.errorBody"),
20
+ } }));
42
21
  }
@@ -9,6 +9,7 @@ export type { EmailPasswordClientFeature, EmailPasswordClientOptions, } from "./
9
9
  export { emailPasswordClient } from "./client-plugin.ts";
10
10
  export type { ConfirmAccountUnlockScreenProps } from "./confirm-account-unlock-screen.tsx";
11
11
  export { ConfirmAccountUnlockScreen } from "./confirm-account-unlock-screen.tsx";
12
+ export { AuthHandlers } from "./constants.ts";
12
13
  export type { DefaultTopbarActionsProps } from "./default-topbar-actions.tsx";
13
14
  export { DefaultTopbarActions } from "./default-topbar-actions.tsx";
14
15
  export type { ForgotPasswordScreenProps } from "./forgot-password-screen.tsx";
@@ -9,6 +9,7 @@ export { createLoginRoute, makeAuthGate, makeSessionAuthGate } from "./auth-gate
9
9
  export { buildLoginRedirectUrl, isSafeNextPath, NEXT_QUERY_PARAM, readNextFromSearch, } from "./auth-redirect.js";
10
10
  export { emailPasswordClient } from "./client-plugin.js";
11
11
  export { ConfirmAccountUnlockScreen } from "./confirm-account-unlock-screen.js";
12
+ export { AuthHandlers } from "./constants.js";
12
13
  export { DefaultTopbarActions } from "./default-topbar-actions.js";
13
14
  export { ForgotPasswordScreen } from "./forgot-password-screen.js";
14
15
  export { defaultTranslations, mergeTranslations } from "./i18n.js";
@@ -0,0 +1 @@
1
+ export declare function readPathParam(search: string, paramName: string, isSafePath: (candidate: unknown) => candidate is string): string | null;
@@ -0,0 +1,4 @@
1
+ export function readPathParam(search, paramName, isSafePath) {
2
+ const candidate = new URLSearchParams(search).get(paramName);
3
+ return isSafePath(candidate) ? candidate : null;
4
+ }
@@ -1,5 +1,6 @@
1
1
  // Shared by the server (mail link) and the web pages (landing page), so it is plain string logic:
2
2
  // no DOM, no window, no `new URL` (React Native's URL getters throw).
3
+ import { readPathParam } from "./read-path-param.js";
3
4
  export const RETURN_TO_QUERY_PARAM = "returnTo";
4
5
  export const MAX_RETURN_PATH_LENGTH = 2048;
5
6
  const DOT_SEGMENTS = new Set([".", "..", ".%2e", "%2e.", "%2e%2e", "%2e"]);
@@ -29,6 +30,5 @@ export function isSafeReturnPath(candidate) {
29
30
  return !hasForbiddenCharacter(candidate) && !hasDotSegment(candidate);
30
31
  }
31
32
  export function readReturnToFromSearch(search) {
32
- const candidate = new URLSearchParams(search).get(RETURN_TO_QUERY_PARAM);
33
- return isSafeReturnPath(candidate) ? candidate : null;
33
+ return readPathParam(search, RETURN_TO_QUERY_PARAM, isSafeReturnPath);
34
34
  }
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from "react";
2
+ export type TokenConfirmLabels = {
3
+ readonly errorTitle: string;
4
+ readonly missingToken: string;
5
+ readonly goToLogin: string;
6
+ readonly verifying: string;
7
+ readonly successTitle: string;
8
+ readonly successBody: string;
9
+ readonly errorBody: string;
10
+ };
11
+ export type TokenConfirmScreenProps = {
12
+ readonly title?: string | undefined;
13
+ readonly token?: string | undefined;
14
+ readonly loginHref: string;
15
+ readonly confirm: (token: string) => Promise<{
16
+ readonly ok: boolean;
17
+ }>;
18
+ readonly labels: TokenConfirmLabels;
19
+ };
20
+ export declare function TokenConfirmScreen({ title, token: tokenProp, loginHref, confirm, labels, }: TokenConfirmScreenProps): ReactNode;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Reads `?token=...` from the URL, auto-posts it on mount and shows success/error. The server
3
+ // side is idempotent, so a repeated call is safe.
4
+ //
5
+ // useEffect with empty deps + a once-guard so React Strict Mode's double
6
+ // useEffect dispatch in dev fires the confirm call only once.
7
+ import { usePrimitives } from "@cosmicdrift/kumiko-renderer";
8
+ import { useEffect, useRef, useState } from "react";
9
+ import { AuthCard, useUrlToken } from "./auth-form-primitives.js";
10
+ export function TokenConfirmScreen({ title, token: tokenProp, loginHref, confirm, labels, }) {
11
+ const { Link } = usePrimitives();
12
+ const token = useUrlToken(tokenProp);
13
+ const [status, setStatus] = useState(token === "" ? "missing-token" : "verifying");
14
+ const startedRef = useRef(false);
15
+ // kumiko-lint-ignore no-raw-hooks not yet converted to the framework hook set
16
+ useEffect(() => {
17
+ if (status !== "verifying")
18
+ return;
19
+ if (startedRef.current)
20
+ return;
21
+ startedRef.current = true;
22
+ void (async () => {
23
+ const res = await confirm(token);
24
+ setStatus(res.ok ? "success" : "error");
25
+ })();
26
+ }, [status, token, confirm]);
27
+ if (status === "missing-token") {
28
+ return (_jsxs(AuthCard, { title: title ?? labels.errorTitle, children: [_jsx("p", { className: "text-sm text-muted-foreground", children: labels.missingToken }), _jsx(Link, { href: loginHref, variant: "muted", children: labels.goToLogin })] }));
29
+ }
30
+ if (status === "verifying") {
31
+ return (_jsx(AuthCard, { children: _jsx("div", { className: "p-6", children: _jsx("p", { className: "text-sm text-muted-foreground", role: "status", children: labels.verifying }) }) }));
32
+ }
33
+ if (status === "success") {
34
+ return (_jsxs(AuthCard, { title: title ?? labels.successTitle, children: [_jsx("p", { className: "text-sm text-muted-foreground", children: labels.successBody }), _jsx(Link, { href: loginHref, variant: "button", children: labels.goToLogin })] }));
35
+ }
36
+ // status === "error"
37
+ return (_jsxs(AuthCard, { title: title ?? labels.errorTitle, children: [_jsx("p", { className: "text-sm text-muted-foreground", children: labels.errorBody }), _jsx(Link, { href: loginHref, variant: "muted", children: labels.goToLogin })] }));
38
+ }
@@ -1,4 +1,4 @@
1
- import { type ReactNode } from "react";
1
+ import type { ReactNode } from "react";
2
2
  export type VerifyEmailScreenProps = {
3
3
  readonly title?: string;
4
4
  /** Override the token from the URL. Default: parsed from `?token=...`. */
@@ -6,4 +6,4 @@ export type VerifyEmailScreenProps = {
6
6
  /** href for the "Zum Login" link. Default "/login". */
7
7
  readonly loginHref?: string;
8
8
  };
9
- export declare function VerifyEmailScreen({ title, token: tokenProp, loginHref, }: VerifyEmailScreenProps): ReactNode;
9
+ export declare function VerifyEmailScreen({ title, token, loginHref, }: VerifyEmailScreenProps): ReactNode;