@processfocus/runtime-local 0.1.0-next.2 → 0.1.0-next.4

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 (332) hide show
  1. package/README.md +51 -253
  2. package/dist/authentication-server.mjs +52 -84
  3. package/dist/chunk-3wzp2sax.js +4806 -0
  4. package/dist/chunk-5kjvzbwr.js +512 -0
  5. package/dist/chunk-egeb4821.js +156 -0
  6. package/dist/chunk-q5v72erd.js +241 -0
  7. package/dist/{chunk-yhzbn4vx.js → chunk-wvbz0nmd.js} +19485 -34180
  8. package/dist/{chunk-352j1ayk.js → chunk-y8fnwbx0.js} +51781 -36259
  9. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
  10. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
  11. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
  12. package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
  13. package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/disconnect-form.tsx +57 -0
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/connected-apps/page.tsx +97 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +169 -18
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +21 -14
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +36 -18
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
  102. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
  103. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
  104. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
  105. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
  106. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
  107. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
  108. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
  109. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
  110. package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
  111. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
  112. package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +69 -1
  113. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
  114. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
  115. package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
  116. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
  117. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
  118. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +14 -6
  119. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
  120. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
  121. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
  122. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
  123. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
  124. package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
  125. package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +44 -0
  126. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
  127. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
  128. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
  129. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
  130. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
  131. package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
  132. package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
  133. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
  134. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
  135. package/dist/dashboard-source/apps/frontend/components/Header.tsx +14 -8
  136. package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
  137. package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
  138. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
  139. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
  140. package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
  141. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
  142. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
  143. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
  144. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
  145. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
  146. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
  147. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
  148. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
  149. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
  150. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
  151. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
  152. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
  153. package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
  154. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
  155. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
  156. package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
  157. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
  158. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
  159. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
  160. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
  161. package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
  162. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
  163. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
  164. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
  165. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
  166. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
  167. package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
  168. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
  169. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
  170. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
  171. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +115 -23
  172. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
  173. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
  174. package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +21 -1
  175. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
  176. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
  177. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
  178. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
  179. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +66 -9
  180. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +10 -6
  181. package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
  182. package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
  183. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
  184. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
  185. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
  186. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
  187. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
  188. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
  189. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
  190. package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
  191. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
  192. package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
  193. package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
  194. package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
  195. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
  196. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
  197. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +168 -30
  198. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
  199. package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
  200. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
  201. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
  202. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
  203. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
  204. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
  205. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
  206. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
  207. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
  208. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
  209. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
  210. package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
  211. package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
  212. package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
  213. package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
  214. package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +889 -0
  215. package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +50 -0
  216. package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
  217. package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
  218. package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
  219. package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
  220. package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +107 -0
  221. package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +260 -0
  222. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
  223. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
  224. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
  225. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
  226. package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
  227. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
  228. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
  229. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
  230. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
  231. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
  232. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
  233. package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
  234. package/dist/dashboard-source/apps/frontend/package.json +47 -47
  235. package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
  236. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
  237. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
  238. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
  239. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
  240. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
  241. package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
  242. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
  243. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
  244. package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
  245. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
  246. package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
  247. package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
  248. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
  249. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
  250. package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
  251. package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
  252. package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
  253. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
  254. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
  255. package/dist/dashboard-source/modules/form/src/index.ts +1 -10
  256. package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
  257. package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
  258. package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
  259. package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
  260. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
  261. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
  262. package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
  263. package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
  264. package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
  265. package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
  266. package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
  267. package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
  268. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
  269. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
  270. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
  271. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
  272. package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
  273. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
  274. package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
  275. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
  276. package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
  277. package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
  278. package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
  279. package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
  280. package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
  281. package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
  282. package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
  283. package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
  284. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
  285. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
  286. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
  287. package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
  288. package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
  289. package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
  290. package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
  291. package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
  292. package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
  293. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
  294. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
  295. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
  296. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
  297. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
  298. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
  299. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
  300. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +273 -0
  301. package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
  302. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
  303. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
  304. package/dist/dashboard-source.json +47 -47
  305. package/dist/graphql-server.mjs +272 -200
  306. package/dist/job-worker-supervisor.mjs +262 -0
  307. package/dist/job-worker.mjs +234 -133
  308. package/dist/main.mjs +30 -6
  309. package/dist/prepare-dashboard.mjs +8 -8
  310. package/dist/resources/cedar/policies.cedar +80 -38
  311. package/dist/resources/cedar/schema.cedarschema +39 -21
  312. package/dist/resources/graphql-schema/rxdb.graphql +2 -0
  313. package/dist/resources/graphql-schema/system.graphql +191 -51
  314. package/package.json +63 -62
  315. package/dist/chunk-6ntmymmx.js +0 -85
  316. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
  317. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
  318. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
  319. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
  320. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
  321. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
  322. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
  323. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
  324. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
  325. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
  326. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
  327. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
  328. package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
  329. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
  330. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
  331. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
  332. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
@@ -1,12 +1,14 @@
1
1
  "use client"
2
-
3
2
  import { useQuery } from "@tanstack/react-query"
3
+ import { Schema } from "effect"
4
4
  import Link from "next/link"
5
5
  import { useRouter } from "next/navigation"
6
- import { useEffect, useState } from "react"
6
+ import { QRCodeSVG } from "qrcode.react"
7
+ import { useEffect, useRef, useState } from "react"
8
+ import { EffectSchemaForm } from "../../../../../../modules/form/src/lib/effect-schema-form.tsx"
7
9
  import { Button } from "../../../../../../modules/shadcn-components/src/index.ts"
10
+ import { DateTimeDisplay } from "../../../../../../modules/shadcn-components/src/lib/date-time-display.tsx"
8
11
  import { InvitationDetailSkeleton } from "./invitation-detail-skeleton.tsx"
9
- import { Checkbox } from "@/components/ui/checkbox"
10
12
  import {
11
13
  Dialog,
12
14
  DialogContent,
@@ -15,7 +17,8 @@ import {
15
17
  DialogHeader,
16
18
  DialogTitle,
17
19
  } from "@/components/ui/dialog"
18
- import { Input } from "@/components/ui/input"
20
+ import type { LoginAuthProviders } from "@/lib/auth/providers"
21
+ import { invitationForm } from "@/lib/forms/invitation"
19
22
  import { useGraphqlClient } from "@/lib/graphql/client-provider"
20
23
  import {
21
24
  createInvitation,
@@ -31,25 +34,37 @@ import {
31
34
 
32
35
  interface InvitationDetailClientProps {
33
36
  invitationId?: string
37
+ invitationMethods?: LoginAuthProviders["invitationMethods"]
34
38
  }
35
39
 
36
- const isValidEmail = (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
40
+ export function InvitationDetailClient(props: InvitationDetailClientProps) {
41
+ return <InvitationEditor key={props.invitationId ?? "new"} {...props} />
42
+ }
37
43
 
38
- export function InvitationDetailClient({
44
+ function InvitationEditor({
39
45
  invitationId,
46
+ invitationMethods,
40
47
  }: InvitationDetailClientProps) {
41
48
  const router = useRouter()
42
49
  const client = useGraphqlClient()
43
- const [email, setEmail] = useState("")
44
- const [selectedRoleIds, setSelectedRoleIds] = useState<string[]>([])
45
- const [formInitialized, setFormInitialized] = useState(false)
46
- const [saving, setSaving] = useState(false)
50
+ const [formReady, setFormReady] = useState(false)
51
+ const operationBusy = useRef(false)
52
+ const visibilityGeneration = useRef(0)
47
53
  const [deleting, setDeleting] = useState(false)
48
54
  const [linkBusy, setLinkBusy] = useState(false)
49
55
  const [error, setError] = useState<string | null>(null)
50
56
  const [revealedLink, setRevealedLink] = useState<string | null>(null)
51
57
  const [deleteDialogOpen, setDeleteDialogOpen] = useState(false)
52
58
 
59
+ useEffect(() => {
60
+ // Next.js can retain route state in Activity; hiding the page must discard
61
+ // the revealed bearer URL as well as its QR code.
62
+ return () => {
63
+ visibilityGeneration.current++
64
+ setRevealedLink(null)
65
+ }
66
+ }, [])
67
+
53
68
  const {
54
69
  data: invitationDetail,
55
70
  isLoading: invitationLoading,
@@ -62,26 +77,37 @@ export function InvitationDetailClient({
62
77
  })
63
78
 
64
79
  const {
65
- data: roles = [],
80
+ data: loadedRoles,
66
81
  isLoading: rolesLoading,
67
82
  error: rolesError,
83
+ refetch: refetchRoles,
68
84
  } = useQuery({
69
85
  queryKey: ["settings", "invitation-roles"],
70
86
  queryFn: () => fetchAllInvitationRoles(client),
71
87
  })
72
88
 
89
+ const roles = loadedRoles ?? []
90
+
73
91
  useEffect(() => {
74
- if (!invitationDetail || formInitialized) {
75
- return
92
+ let active = true
93
+ setFormReady(false)
94
+ setDeleteDialogOpen(false)
95
+ setError(null)
96
+ void Promise.all([
97
+ refetchRoles(),
98
+ ...(invitationId === undefined ? [] : [refetchInvitation()]),
99
+ ]).then(() => {
100
+ if (active) setFormReady(true)
101
+ })
102
+ return () => {
103
+ active = false
76
104
  }
77
-
78
- setEmail(invitationDetail.email)
79
- setSelectedRoleIds(invitationDetail.roles.map((role) => role.id))
80
- setFormInitialized(true)
81
- }, [formInitialized, invitationDetail])
105
+ }, [invitationId, refetchInvitation, refetchRoles])
82
106
 
83
107
  const loading =
84
- rolesLoading || (invitationId !== undefined && invitationLoading)
108
+ !formReady ||
109
+ rolesLoading ||
110
+ (invitationId !== undefined && invitationLoading)
85
111
  const queryError = invitationError || rolesError
86
112
  const isImmutable =
87
113
  invitationDetail?.status === "ACCEPTED" ||
@@ -99,71 +125,64 @@ export function InvitationDetailClient({
99
125
  : "Review and update the invitation before the user signs in."
100
126
  : "Create an invitation and assign the roles it should grant."
101
127
 
102
- const handleRoleToggle = (roleId: string) => {
103
- if (isReadOnly) {
104
- return
105
- }
106
- setSelectedRoleIds((current) =>
107
- current.includes(roleId)
108
- ? current.filter((id) => id !== roleId)
109
- : [...current, roleId],
110
- )
111
- }
112
-
113
- const handleSave = async () => {
114
- if (isReadOnly) {
115
- setError(
116
- "This invitation can no longer be changed. Create a new invitation if you need to grant roles again.",
117
- )
118
- return
119
- }
120
-
121
- const trimmedEmail = email.trim()
122
- if (!trimmedEmail) {
123
- setError("Email is required")
124
- return
125
- }
126
-
127
- if (!isValidEmail(trimmedEmail)) {
128
- setError("Enter a valid email address")
129
- return
130
- }
128
+ const schema = invitationForm(
129
+ roles.map((role) => ({
130
+ value: role.id,
131
+ label: role.name,
132
+ description: role.path,
133
+ })),
134
+ isReadOnly,
135
+ )
131
136
 
132
- if (selectedRoleIds.length === 0) {
133
- setError("Select at least one role")
134
- return
137
+ const handleSave = async (values: Record<string, unknown>) => {
138
+ if (isReadOnly || operationBusy.current) {
139
+ return [
140
+ {
141
+ field: "",
142
+ message: "Wait for the current action to finish before saving.",
143
+ },
144
+ ]
135
145
  }
136
-
137
- setSaving(true)
146
+ operationBusy.current = true
138
147
  setError(null)
139
- const saveInvitation = invitationId
140
- ? () =>
141
- updateInvitation(client, invitationId, trimmedEmail, selectedRoleIds)
142
- : () => createInvitation(client, trimmedEmail, selectedRoleIds)
143
-
144
148
  try {
145
- const result = await saveInvitation()
149
+ const submitted = Schema.decodeUnknownSync(
150
+ Schema.Struct({
151
+ ...schema.fields.invitation.fields,
152
+ ...schema.fields.assignments.fields,
153
+ }),
154
+ )(values)
155
+ const result = invitationId
156
+ ? await updateInvitation(client, invitationId, submitted.email, [
157
+ ...submitted.roleIds,
158
+ ])
159
+ : await createInvitation(client, submitted.email, [
160
+ ...submitted.roleIds,
161
+ ])
146
162
  if (result.__typename === "SaveInvitationFailure") {
147
- setError(result.error)
163
+ return [{ field: "", message: result.error }]
148
164
  } else {
149
- router.push("/settings")
165
+ router.push("/settings/invitations")
150
166
  router.refresh()
167
+ return undefined
151
168
  }
152
169
  } catch (saveError) {
153
170
  let message = "Failed to save invitation"
154
171
  if (saveError instanceof Error) {
155
172
  message = saveError.message
156
173
  }
157
- setError(message)
174
+ return [{ field: "", message }]
175
+ } finally {
176
+ operationBusy.current = false
158
177
  }
159
- setSaving(false)
160
178
  }
161
179
 
162
180
  const handleDelete = async () => {
163
- if (!invitationId || isReadOnly) {
181
+ if (!invitationId || isReadOnly || operationBusy.current) {
164
182
  return
165
183
  }
166
184
 
185
+ operationBusy.current = true
167
186
  try {
168
187
  setDeleting(true)
169
188
  setError(null)
@@ -177,7 +196,7 @@ export function InvitationDetailClient({
177
196
  setError(message)
178
197
  } else {
179
198
  setDeleteDialogOpen(false)
180
- router.push("/settings")
199
+ router.push("/settings/invitations")
181
200
  router.refresh()
182
201
  }
183
202
  } catch (deleteError) {
@@ -188,17 +207,7 @@ export function InvitationDetailClient({
188
207
  setError(message)
189
208
  }
190
209
  setDeleting(false)
191
- }
192
-
193
- const formatWhen = (value: string | null | undefined) => {
194
- if (!value) {
195
- return null
196
- }
197
- const date = new Date(value)
198
- if (Number.isNaN(date.getTime())) {
199
- return value
200
- }
201
- return date.toLocaleString()
210
+ operationBusy.current = false
202
211
  }
203
212
 
204
213
  const registrationLinkStatusLabel = (
@@ -221,11 +230,13 @@ export function InvitationDetailClient({
221
230
  const handleRegistrationLinkAction = async (
222
231
  action: "generate" | "reveal" | "rotate" | "revoke",
223
232
  ) => {
224
- if (!invitationId || isReadOnly) {
233
+ if (!invitationId || isReadOnly || operationBusy.current) {
225
234
  return
226
235
  }
227
236
 
237
+ operationBusy.current = true
228
238
  setLinkBusy(true)
239
+ const generation = visibilityGeneration.current
229
240
  setError(null)
230
241
 
231
242
  try {
@@ -250,8 +261,10 @@ export function InvitationDetailClient({
250
261
  if (result.__typename === "RegistrationLinkActionFailure") {
251
262
  setError(result.error)
252
263
  } else {
253
- setRevealedLink(result.registrationLinkUrl)
254
- await copyLinkToClipboard(result.registrationLinkUrl)
264
+ if (generation === visibilityGeneration.current) {
265
+ setRevealedLink(result.registrationLinkUrl)
266
+ await copyLinkToClipboard(result.registrationLinkUrl)
267
+ }
255
268
  await refetchInvitation()
256
269
  }
257
270
  } catch (linkError) {
@@ -262,6 +275,7 @@ export function InvitationDetailClient({
262
275
  setError(message)
263
276
  } finally {
264
277
  setLinkBusy(false)
278
+ operationBusy.current = false
265
279
  }
266
280
  }
267
281
 
@@ -269,18 +283,26 @@ export function InvitationDetailClient({
269
283
  return <InvitationDetailSkeleton />
270
284
  }
271
285
 
272
- if (queryError) {
273
- const message =
274
- queryError instanceof Error
275
- ? queryError.message
276
- : "Failed to load invitation data"
277
-
278
- return (
279
- <div className="rounded-md border border-red-200 bg-red-50 p-4 text-red-700">
280
- <p className="font-medium">Error</p>
281
- <p className="text-sm">{message}</p>
282
- </div>
283
- )
286
+ const queryErrorBanner = queryError ? (
287
+ <div
288
+ role="alert"
289
+ className="rounded-md border border-red-200 bg-red-50 p-4 text-red-700"
290
+ >
291
+ <p className="font-medium">Error</p>
292
+ <p className="text-sm">
293
+ {queryError instanceof Error
294
+ ? queryError.message
295
+ : "Failed to load invitation data"}
296
+ </p>
297
+ </div>
298
+ ) : null
299
+
300
+ if (
301
+ queryError &&
302
+ ((invitationDetail === undefined && invitationId !== undefined) ||
303
+ loadedRoles === undefined)
304
+ ) {
305
+ return queryErrorBanner
284
306
  }
285
307
 
286
308
  if (invitationId && !invitationDetail) {
@@ -302,10 +324,39 @@ export function InvitationDetailClient({
302
324
  </div>
303
325
 
304
326
  <Button asChild variant="outline">
305
- <Link href="/settings">Back to Settings</Link>
327
+ <Link href="/settings/invitations">Back to Invited Users</Link>
306
328
  </Button>
307
329
  </div>
308
330
 
331
+ {!invitationId ? (
332
+ <div className="space-y-2 text-sm text-slate-600 dark:text-slate-400">
333
+ <p>
334
+ <strong>Invitations are not sent automatically.</strong>
335
+ {invitationMethods?.sso || invitationMethods?.passkey
336
+ ? " After creating the invitation:"
337
+ : null}
338
+ </p>
339
+ {invitationMethods?.sso || invitationMethods?.passkey ? (
340
+ <ul className="list-disc space-y-1 pl-5">
341
+ {invitationMethods.sso ? (
342
+ <li>
343
+ <strong>SSO:</strong> Ask the person to visit the login page
344
+ and sign in using the invited email address.
345
+ </li>
346
+ ) : null}
347
+ {invitationMethods.passkey ? (
348
+ <li>
349
+ <strong>Passkey:</strong> Generate a registration link and
350
+ send it to the person yourself.
351
+ </li>
352
+ ) : null}
353
+ </ul>
354
+ ) : null}
355
+ </div>
356
+ ) : null}
357
+
358
+ {queryErrorBanner}
359
+
309
360
  {error && (
310
361
  <div className="rounded-md border border-red-200 bg-red-50 p-4 text-red-700">
311
362
  <p className="font-medium">Error</p>
@@ -313,282 +364,308 @@ export function InvitationDetailClient({
313
364
  </div>
314
365
  )}
315
366
 
316
- <div className="space-y-4 rounded-lg border border-slate-200 bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
317
- <h2 className="text-lg font-semibold">Invitation</h2>
318
-
319
- <div className="space-y-2">
320
- <label htmlFor="invitation-email" className="text-sm font-medium">
321
- Email
322
- </label>
323
- <Input
324
- id="invitation-email"
325
- type="email"
326
- value={email}
327
- onChange={(event) => setEmail(event.target.value)}
328
- placeholder="user@example.com"
329
- disabled={saving || deleting || isReadOnly}
330
- readOnly={isReadOnly}
331
- />
332
- </div>
333
-
334
- {invitationDetail ? (
335
- <div className="space-y-1 text-sm text-slate-600 dark:text-slate-400">
336
- <p>
337
- Status:{" "}
338
- <span className="font-medium text-slate-900 dark:text-slate-100">
339
- {invitationDetail.status === "PENDING"
340
- ? "Pending"
341
- : invitationDetail.status === "ACCEPTED"
342
- ? "Accepted"
343
- : "Legacy closed"}
344
- </span>
345
- </p>
346
- {invitationDetail.status === "ACCEPTED" ? (
347
- <p>
348
- Accepted by{" "}
349
- {[
350
- invitationDetail.acceptedByProvider,
351
- invitationDetail.acceptedBySubject,
352
- ]
353
- .filter(Boolean)
354
- .join(" / ") || "unknown identity"}
355
- {formatWhen(invitationDetail.acceptedAt)
356
- ? ` at ${formatWhen(invitationDetail.acceptedAt)}`
357
- : ""}
358
- </p>
359
- ) : null}
360
- {invitationDetail.status === "LEGACY_CLOSED" ? (
361
- <p>
362
- Closed during migration
363
- {invitationDetail.legacyClosureReason
364
- ? ` (${invitationDetail.legacyClosureReason})`
365
- : ""}
366
- {formatWhen(invitationDetail.legacyClosedAt)
367
- ? ` at ${formatWhen(invitationDetail.legacyClosedAt)}`
368
- : ""}
369
- . This does not claim that this invitation created the user or
370
- assigned roles.
371
- </p>
372
- ) : null}
373
- </div>
374
- ) : null}
375
- </div>
376
-
377
- {invitationDetail && invitationDetail.status === "PENDING" ? (
378
- <div className="space-y-4 rounded-lg border border-slate-200 bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
379
- <h2 className="text-lg font-semibold">Registration Link</h2>
380
- <p className="text-sm text-slate-600 dark:text-slate-400">
381
- Passkey Invitation registration requires a seven-day Registration
382
- Link. The bulk list never includes the bearer token; generate or
383
- reveal it explicitly when you need to share it outside Process
384
- Focus.
385
- </p>
386
-
387
- <div className="space-y-1 text-sm text-slate-600 dark:text-slate-400">
388
- <p>
389
- Status:{" "}
390
- <span className="font-medium text-slate-900 dark:text-slate-100">
391
- {registrationLinkStatusLabel(
392
- invitationDetail.registrationLinkStatus,
367
+ <fieldset disabled={deleting || linkBusy} className="space-y-6">
368
+ <EffectSchemaForm
369
+ schema={schema}
370
+ defaultValues={{
371
+ email: invitationDetail?.email ?? "",
372
+ roleIds: [
373
+ ...new Set(invitationDetail?.roles.map((role) => role.id) ?? []),
374
+ ],
375
+ }}
376
+ onSubmit={handleSave}
377
+ >
378
+ {({ formState: { isSubmitting: saving } }) => (
379
+ <>
380
+ {invitationDetail ? (
381
+ <div className="space-y-1 text-sm text-slate-600 dark:text-slate-400">
382
+ <p>
383
+ Status:{" "}
384
+ <span className="font-medium text-slate-900 dark:text-slate-100">
385
+ {invitationDetail.status === "PENDING"
386
+ ? "Pending"
387
+ : invitationDetail.status === "ACCEPTED"
388
+ ? "Accepted"
389
+ : "Legacy closed"}
390
+ </span>
391
+ </p>
392
+ {invitationDetail.status === "ACCEPTED" ? (
393
+ <p>
394
+ Accepted by{" "}
395
+ {[
396
+ invitationDetail.acceptedByProvider,
397
+ invitationDetail.acceptedBySubject,
398
+ ]
399
+ .filter(Boolean)
400
+ .join(" / ") || "unknown identity"}
401
+ {invitationDetail.acceptedAt && (
402
+ <>
403
+ {" "}
404
+ ·{" "}
405
+ <DateTimeDisplay
406
+ kind="timestamp"
407
+ value={invitationDetail.acceptedAt}
408
+ />
409
+ </>
410
+ )}
411
+ </p>
412
+ ) : null}
413
+ {invitationDetail.status === "LEGACY_CLOSED" ? (
414
+ <p>
415
+ Closed during migration
416
+ {invitationDetail.legacyClosureReason
417
+ ? ` (${invitationDetail.legacyClosureReason})`
418
+ : ""}
419
+ {invitationDetail.legacyClosedAt && (
420
+ <>
421
+ {" "}
422
+ ·{" "}
423
+ <DateTimeDisplay
424
+ kind="timestamp"
425
+ value={invitationDetail.legacyClosedAt}
426
+ />
427
+ </>
428
+ )}
429
+ . This does not claim that this invitation created the
430
+ user or assigned roles.
431
+ </p>
432
+ ) : null}
433
+ </div>
434
+ ) : null}
435
+ {invitationDetail && invitationDetail.status === "PENDING" ? (
436
+ <div className="space-y-4 rounded-lg border border-slate-200 bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
437
+ <h2 className="text-lg font-semibold">Registration Link</h2>
438
+ <p className="text-sm text-slate-600 dark:text-slate-400">
439
+ Passkey Invitation registration requires a seven-day
440
+ Registration Link. The bulk list never includes the bearer
441
+ token; generate or reveal it explicitly when you need to
442
+ share it outside Process Focus.
443
+ </p>
444
+
445
+ <div className="space-y-1 text-sm text-slate-600 dark:text-slate-400">
446
+ <p>
447
+ Status:{" "}
448
+ <span className="font-medium text-slate-900 dark:text-slate-100">
449
+ {registrationLinkStatusLabel(
450
+ invitationDetail.registrationLinkStatus,
451
+ )}
452
+ </span>
453
+ </p>
454
+ {invitationDetail.registrationLinkExpiresAt ? (
455
+ <p>
456
+ Expires:{" "}
457
+ <DateTimeDisplay
458
+ kind="timestamp"
459
+ value={invitationDetail.registrationLinkExpiresAt}
460
+ initialMode="browser-local"
461
+ />
462
+ </p>
463
+ ) : null}
464
+ {invitationDetail.registrationLinkGeneratedAt ? (
465
+ <p>
466
+ Last generated
467
+ {invitationDetail.registrationLinkGeneratedBy
468
+ ? ` by ${invitationDetail.registrationLinkGeneratedBy}`
469
+ : ""}
470
+ {" · "}
471
+ <DateTimeDisplay
472
+ kind="timestamp"
473
+ value={invitationDetail.registrationLinkGeneratedAt}
474
+ />
475
+ </p>
476
+ ) : null}
477
+ {invitationDetail.registrationLinkRevealedAt ? (
478
+ <p>
479
+ Last revealed
480
+ {invitationDetail.registrationLinkRevealedBy
481
+ ? ` by ${invitationDetail.registrationLinkRevealedBy}`
482
+ : ""}
483
+ {" · "}
484
+ <DateTimeDisplay
485
+ kind="timestamp"
486
+ value={invitationDetail.registrationLinkRevealedAt}
487
+ />
488
+ </p>
489
+ ) : null}
490
+ {invitationDetail.registrationLinkRevokedAt ? (
491
+ <p>
492
+ Last revoked
493
+ {invitationDetail.registrationLinkRevokedBy
494
+ ? ` by ${invitationDetail.registrationLinkRevokedBy}`
495
+ : ""}
496
+ {" · "}
497
+ <DateTimeDisplay
498
+ kind="timestamp"
499
+ value={invitationDetail.registrationLinkRevokedAt}
500
+ />
501
+ </p>
502
+ ) : null}
503
+ </div>
504
+
505
+ {revealedLink ? (
506
+ <div className="space-y-2 rounded-md border border-slate-200 bg-slate-50 p-3 dark:border-slate-700 dark:bg-slate-950">
507
+ <p className="text-xs font-medium uppercase tracking-wide text-slate-500">
508
+ Registration link (copy now; it is not stored in this
509
+ page after you leave)
510
+ </p>
511
+ <code className="block break-all text-sm text-slate-900 dark:text-slate-100">
512
+ {revealedLink}
513
+ </code>
514
+ <Button
515
+ type="button"
516
+ size="sm"
517
+ variant="outline"
518
+ onClick={() => copyLinkToClipboard(revealedLink)}
519
+ >
520
+ Copy to clipboard
521
+ </Button>
522
+ <figure className="space-y-2 pt-2">
523
+ <QRCodeSVG
524
+ value={revealedLink}
525
+ size={256}
526
+ level="M"
527
+ marginSize={4}
528
+ bgColor="#ffffff"
529
+ fgColor="#000000"
530
+ role="img"
531
+ title="Registration link QR code"
532
+ aria-label="Registration link QR code"
533
+ className="h-auto max-w-full"
534
+ />
535
+ <figcaption className="text-sm text-slate-600 dark:text-slate-400">
536
+ Scan to register on your phone.
537
+ </figcaption>
538
+ </figure>
539
+ </div>
540
+ ) : null}
541
+
542
+ <div className="flex flex-wrap gap-2">
543
+ {invitationDetail.registrationLinkStatus ===
544
+ "NOT_GENERATED" ||
545
+ invitationDetail.registrationLinkStatus === "EXPIRED" ||
546
+ invitationDetail.registrationLinkStatus === "REVOKED" ? (
547
+ <Button
548
+ type="button"
549
+ onClick={() => handleRegistrationLinkAction("generate")}
550
+ disabled={saving || deleting || linkBusy}
551
+ >
552
+ {invitationDetail.registrationLinkStatus ===
553
+ "NOT_GENERATED"
554
+ ? "Generate registration link"
555
+ : "Generate new registration link"}
556
+ </Button>
557
+ ) : null}
558
+ {invitationDetail.registrationLinkStatus === "ACTIVE" ? (
559
+ <>
560
+ <Button
561
+ type="button"
562
+ onClick={() => handleRegistrationLinkAction("reveal")}
563
+ disabled={saving || deleting || linkBusy}
564
+ >
565
+ Copy / reveal link
566
+ </Button>
567
+ <Button
568
+ type="button"
569
+ variant="outline"
570
+ onClick={() => handleRegistrationLinkAction("rotate")}
571
+ disabled={saving || deleting || linkBusy}
572
+ >
573
+ Rotate link
574
+ </Button>
575
+ <Button
576
+ type="button"
577
+ variant="destructive"
578
+ onClick={() => handleRegistrationLinkAction("revoke")}
579
+ disabled={saving || deleting || linkBusy}
580
+ >
581
+ Revoke link
582
+ </Button>
583
+ </>
584
+ ) : null}
585
+ </div>
586
+ </div>
587
+ ) : null}
588
+
589
+ {roles.length === 0 ? (
590
+ <div className="rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700">
591
+ No roles are available.
592
+ </div>
593
+ ) : null}
594
+
595
+ <div className="flex flex-wrap items-center justify-between gap-3">
596
+ {invitationId && !isReadOnly ? (
597
+ <Button
598
+ type="button"
599
+ variant="destructive"
600
+ onClick={() => setDeleteDialogOpen(true)}
601
+ disabled={saving || deleting || linkBusy}
602
+ >
603
+ Delete Invitation
604
+ </Button>
605
+ ) : null}
606
+
607
+ {!isReadOnly ? (
608
+ <Button
609
+ type="submit"
610
+ // The schema preserves the invitation email contract; the
611
+ // browser's email constraint accepts a narrower set.
612
+ formNoValidate
613
+ className="ml-auto"
614
+ disabled={
615
+ saving || deleting || linkBusy || roles.length === 0
616
+ }
617
+ >
618
+ {saving
619
+ ? "Saving..."
620
+ : invitationId
621
+ ? "Save"
622
+ : "Create Invitation"}
623
+ </Button>
624
+ ) : (
625
+ <p className="ml-auto text-sm text-slate-500 dark:text-slate-400">
626
+ No bootstrap or edit actions are available for this
627
+ invitation.
628
+ </p>
393
629
  )}
394
- </span>
395
- </p>
396
- {invitationDetail.registrationLinkExpiresAt ? (
397
- <p>
398
- Expires:{" "}
399
- {formatWhen(invitationDetail.registrationLinkExpiresAt) ?? "—"}
400
- </p>
401
- ) : null}
402
- {invitationDetail.registrationLinkGeneratedAt ? (
403
- <p>
404
- Last generated
405
- {invitationDetail.registrationLinkGeneratedBy
406
- ? ` by ${invitationDetail.registrationLinkGeneratedBy}`
407
- : ""}
408
- {formatWhen(invitationDetail.registrationLinkGeneratedAt)
409
- ? ` at ${formatWhen(invitationDetail.registrationLinkGeneratedAt)}`
410
- : ""}
411
- </p>
412
- ) : null}
413
- {invitationDetail.registrationLinkRevealedAt ? (
414
- <p>
415
- Last revealed
416
- {invitationDetail.registrationLinkRevealedBy
417
- ? ` by ${invitationDetail.registrationLinkRevealedBy}`
418
- : ""}
419
- {formatWhen(invitationDetail.registrationLinkRevealedAt)
420
- ? ` at ${formatWhen(invitationDetail.registrationLinkRevealedAt)}`
421
- : ""}
422
- </p>
423
- ) : null}
424
- {invitationDetail.registrationLinkRevokedAt ? (
425
- <p>
426
- Last revoked
427
- {invitationDetail.registrationLinkRevokedBy
428
- ? ` by ${invitationDetail.registrationLinkRevokedBy}`
429
- : ""}
430
- {formatWhen(invitationDetail.registrationLinkRevokedAt)
431
- ? ` at ${formatWhen(invitationDetail.registrationLinkRevokedAt)}`
432
- : ""}
433
- </p>
434
- ) : null}
435
- </div>
436
-
437
- {revealedLink ? (
438
- <div className="space-y-2 rounded-md border border-slate-200 bg-slate-50 p-3 dark:border-slate-700 dark:bg-slate-950">
439
- <p className="text-xs font-medium uppercase tracking-wide text-slate-500">
440
- Registration link (copy now; it is not stored in this page after
441
- you leave)
442
- </p>
443
- <code className="block break-all text-sm text-slate-900 dark:text-slate-100">
444
- {revealedLink}
445
- </code>
446
- <Button
447
- type="button"
448
- size="sm"
449
- variant="outline"
450
- onClick={() => copyLinkToClipboard(revealedLink)}
451
- >
452
- Copy to clipboard
453
- </Button>
454
- </div>
455
- ) : null}
456
-
457
- <div className="flex flex-wrap gap-2">
458
- {invitationDetail.registrationLinkStatus === "NOT_GENERATED" ||
459
- invitationDetail.registrationLinkStatus === "EXPIRED" ||
460
- invitationDetail.registrationLinkStatus === "REVOKED" ? (
461
- <Button
462
- type="button"
463
- onClick={() => handleRegistrationLinkAction("generate")}
464
- disabled={saving || deleting || linkBusy}
465
- >
466
- {invitationDetail.registrationLinkStatus === "NOT_GENERATED"
467
- ? "Generate registration link"
468
- : "Generate new registration link"}
469
- </Button>
470
- ) : null}
471
- {invitationDetail.registrationLinkStatus === "ACTIVE" ? (
472
- <>
473
- <Button
474
- type="button"
475
- onClick={() => handleRegistrationLinkAction("reveal")}
476
- disabled={saving || deleting || linkBusy}
477
- >
478
- Copy / reveal link
479
- </Button>
480
- <Button
481
- type="button"
482
- variant="outline"
483
- onClick={() => handleRegistrationLinkAction("rotate")}
484
- disabled={saving || deleting || linkBusy}
485
- >
486
- Rotate link
487
- </Button>
488
- <Button
489
- type="button"
490
- variant="destructive"
491
- onClick={() => handleRegistrationLinkAction("revoke")}
492
- disabled={saving || deleting || linkBusy}
493
- >
494
- Revoke link
495
- </Button>
496
- </>
497
- ) : null}
498
- </div>
499
- </div>
500
- ) : null}
501
-
502
- <div className="space-y-4 rounded-lg border border-slate-200 bg-white p-6 dark:border-slate-700 dark:bg-slate-900">
503
- <h2 className="text-lg font-semibold">Role Assignments</h2>
504
-
505
- {roles.length === 0 ? (
506
- <div className="rounded-md border border-amber-200 bg-amber-50 p-4 text-sm text-amber-700">
507
- No roles are available.
508
- </div>
509
- ) : (
510
- <div className="space-y-3">
511
- {roles.map((role) => (
512
- <div key={role.id} className="flex items-center gap-3">
513
- <Checkbox
514
- id={`role-${role.id}`}
515
- checked={selectedRoleIds.includes(role.id)}
516
- onCheckedChange={() => handleRoleToggle(role.id)}
517
- disabled={saving || deleting || isReadOnly}
518
- />
519
- <label
520
- htmlFor={`role-${role.id}`}
521
- className="flex cursor-pointer flex-col"
522
- >
523
- <span className="font-medium">{role.name}</span>
524
- <span className="text-sm text-slate-500 dark:text-slate-400">
525
- {role.path}
526
- </span>
527
- </label>
528
630
  </div>
529
- ))}
530
- </div>
531
- )}
532
- </div>
533
631
 
534
- <div className="flex flex-wrap items-center justify-between gap-3">
535
- {invitationId && !isReadOnly ? (
536
- <Button
537
- type="button"
538
- variant="destructive"
539
- onClick={() => setDeleteDialogOpen(true)}
540
- disabled={saving || deleting}
541
- >
542
- Delete Invitation
543
- </Button>
544
- ) : null}
545
-
546
- {!isReadOnly ? (
547
- <Button
548
- type="button"
549
- className="ml-auto"
550
- onClick={handleSave}
551
- disabled={saving || deleting || roles.length === 0}
552
- >
553
- {saving ? "Saving..." : invitationId ? "Save" : "Create Invitation"}
554
- </Button>
555
- ) : (
556
- <p className="ml-auto text-sm text-slate-500 dark:text-slate-400">
557
- No bootstrap or edit actions are available for this invitation.
558
- </p>
559
- )}
560
- </div>
561
-
562
- <Dialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
563
- <DialogContent>
564
- <DialogHeader>
565
- <DialogTitle>Delete Invitation</DialogTitle>
566
- <DialogDescription>
567
- This removes the invitation for{" "}
568
- {invitationDetail?.email ?? (email || "this user")}.
569
- </DialogDescription>
570
- </DialogHeader>
571
-
572
- <DialogFooter>
573
- <Button
574
- type="button"
575
- variant="outline"
576
- onClick={() => setDeleteDialogOpen(false)}
577
- disabled={deleting}
578
- >
579
- Cancel
580
- </Button>
581
- <Button
582
- type="button"
583
- variant="destructive"
584
- onClick={handleDelete}
585
- disabled={deleting}
586
- >
587
- {deleting ? "Deleting..." : "Delete Invitation"}
588
- </Button>
589
- </DialogFooter>
590
- </DialogContent>
591
- </Dialog>
632
+ <Dialog
633
+ open={deleteDialogOpen}
634
+ onOpenChange={setDeleteDialogOpen}
635
+ >
636
+ <DialogContent>
637
+ <DialogHeader>
638
+ <DialogTitle>Delete Invitation</DialogTitle>
639
+ <DialogDescription>
640
+ This removes the invitation for{" "}
641
+ {invitationDetail?.email ?? "this user"}.
642
+ </DialogDescription>
643
+ </DialogHeader>
644
+
645
+ <DialogFooter>
646
+ <Button
647
+ type="button"
648
+ variant="outline"
649
+ onClick={() => setDeleteDialogOpen(false)}
650
+ disabled={saving || deleting || linkBusy}
651
+ >
652
+ Cancel
653
+ </Button>
654
+ <Button
655
+ type="button"
656
+ variant="destructive"
657
+ onClick={handleDelete}
658
+ disabled={saving || deleting || linkBusy}
659
+ >
660
+ {deleting ? "Deleting..." : "Delete Invitation"}
661
+ </Button>
662
+ </DialogFooter>
663
+ </DialogContent>
664
+ </Dialog>
665
+ </>
666
+ )}
667
+ </EffectSchemaForm>
668
+ </fieldset>
592
669
  </div>
593
670
  )
594
671
  }