@processfocus/runtime-local 0.1.0-next.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 (470) hide show
  1. package/LICENSE.md +28 -0
  2. package/README.md +290 -0
  3. package/dist/authentication-server.mjs +188 -0
  4. package/dist/chunk-2sb4v2sx.js +70 -0
  5. package/dist/chunk-9weqs8n8.js +56031 -0
  6. package/dist/chunk-mvkr77wp.js +54113 -0
  7. package/dist/chunk-tkn4cnc8.js +453 -0
  8. package/dist/chunk-vpsm84e8.js +85 -0
  9. package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
  10. package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
  11. package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
  12. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
  13. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
  14. package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
  15. package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
  16. package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
  17. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
  18. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
  19. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -0
  20. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
  21. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +11 -0
  22. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
  23. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
  24. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
  25. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
  26. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
  27. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
  28. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
  29. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
  30. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
  31. package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
  32. package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
  33. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
  34. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -0
  35. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
  36. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +678 -0
  37. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
  38. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
  39. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
  40. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
  41. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
  42. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
  43. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
  44. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
  45. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
  46. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
  47. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
  48. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
  49. package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
  50. package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
  51. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
  52. package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
  53. package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
  54. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
  55. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
  56. package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
  57. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
  58. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
  59. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
  60. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
  61. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
  62. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
  63. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
  64. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
  65. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
  66. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
  67. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
  68. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
  69. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
  70. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
  71. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
  72. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
  73. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
  74. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
  75. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
  76. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
  77. package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
  78. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
  79. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
  80. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
  81. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
  82. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
  83. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
  84. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
  85. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
  86. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
  87. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
  88. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
  89. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
  90. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
  91. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
  92. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
  93. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
  94. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
  95. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
  96. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
  97. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
  98. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
  99. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
  100. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
  101. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
  102. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
  103. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
  104. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
  105. package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
  106. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
  107. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
  108. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
  109. package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
  110. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
  111. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
  112. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
  113. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +131 -0
  114. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
  115. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
  116. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
  117. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
  118. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
  119. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
  120. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
  121. package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
  122. package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
  123. package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
  124. package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
  125. package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
  126. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
  127. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
  128. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
  129. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
  130. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
  131. package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
  132. package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
  133. package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
  134. package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
  135. package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
  136. package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
  137. package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
  138. package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
  139. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
  140. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
  141. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
  142. package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
  143. package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
  144. package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
  145. package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
  146. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
  147. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
  148. package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
  149. package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
  150. package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
  151. package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
  152. package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
  153. package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
  154. package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
  155. package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
  156. package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
  157. package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
  158. package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
  159. package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
  160. package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
  161. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
  162. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
  163. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
  164. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
  165. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
  166. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
  167. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
  168. package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
  169. package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
  170. package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
  171. package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
  172. package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
  173. package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
  174. package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
  175. package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
  176. package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
  177. package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
  178. package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
  179. package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
  180. package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
  181. package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
  182. package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
  183. package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
  184. package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
  185. package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
  186. package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
  187. package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
  188. package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
  189. package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
  190. package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
  191. package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
  192. package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
  193. package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
  194. package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
  195. package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
  196. package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
  197. package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
  198. package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
  199. package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
  200. package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
  201. package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
  202. package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
  203. package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
  204. package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
  205. package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
  206. package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
  207. package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
  208. package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
  209. package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
  210. package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
  211. package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
  212. package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
  213. package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
  214. package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
  215. package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
  216. package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
  217. package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
  218. package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
  219. package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
  220. package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
  221. package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
  222. package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
  223. package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
  224. package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
  225. package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
  226. package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
  227. package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
  228. package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
  229. package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
  230. package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
  231. package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
  232. package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
  233. package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
  234. package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
  235. package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
  236. package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
  237. package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
  238. package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
  239. package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
  240. package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
  241. package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
  242. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
  243. package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
  244. package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
  245. package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
  246. package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
  247. package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
  248. package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
  249. package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
  250. package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
  251. package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
  252. package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
  253. package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
  254. package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
  255. package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
  256. package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
  257. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
  258. package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
  259. package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
  260. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
  261. package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
  262. package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
  263. package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
  264. package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
  265. package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
  266. package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
  267. package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
  268. package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
  269. package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
  270. package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
  271. package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
  272. package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
  273. package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
  274. package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
  275. package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
  276. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
  277. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
  278. package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
  279. package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
  280. package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
  281. package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
  282. package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
  283. package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
  284. package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
  285. package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
  286. package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
  287. package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
  288. package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
  289. package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
  290. package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
  291. package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
  292. package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
  293. package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
  294. package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
  295. package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
  296. package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
  297. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
  298. package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
  299. package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
  300. package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
  301. package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
  302. package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
  303. package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
  304. package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
  305. package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
  306. package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
  307. package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
  308. package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
  309. package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
  310. package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
  311. package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
  312. package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
  313. package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
  314. package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
  315. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
  316. package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
  317. package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
  318. package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
  319. package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
  320. package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
  321. package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
  322. package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
  323. package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
  324. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
  325. package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
  326. package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
  327. package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
  328. package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
  329. package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
  330. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
  331. package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
  332. package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
  333. package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
  334. package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
  335. package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
  336. package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
  337. package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
  338. package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
  339. package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
  340. package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
  341. package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
  342. package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
  343. package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
  344. package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
  345. package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
  346. package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
  347. package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
  348. package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
  349. package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
  350. package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
  351. package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
  352. package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
  353. package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
  354. package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
  355. package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
  356. package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
  357. package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
  358. package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
  359. package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
  360. package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
  361. package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
  362. package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
  363. package/dist/dashboard-source/apps/frontend/package.json +71 -0
  364. package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
  365. package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
  366. package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
  367. package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
  368. package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
  369. package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
  370. package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
  371. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
  372. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
  373. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
  374. package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
  375. package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
  376. package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
  377. package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
  378. package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
  379. package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
  380. package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
  381. package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
  382. package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
  383. package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
  384. package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
  385. package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
  386. package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
  387. package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
  388. package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
  389. package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
  390. package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
  391. package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
  392. package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
  393. package/dist/dashboard-source/modules/form/src/index.ts +20 -0
  394. package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
  395. package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
  396. package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
  397. package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
  398. package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
  399. package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
  400. package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
  401. package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
  402. package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
  403. package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
  404. package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
  405. package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
  406. package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
  407. package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
  408. package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
  409. package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
  410. package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
  411. package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
  412. package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
  413. package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
  414. package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
  415. package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
  416. package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
  417. package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
  418. package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
  419. package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
  420. package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
  421. package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
  422. package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
  423. package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
  424. package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
  425. package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
  426. package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
  427. package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
  428. package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
  429. package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
  430. package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
  431. package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
  432. package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
  433. package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
  434. package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
  435. package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
  436. package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
  437. package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
  438. package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
  439. package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
  440. package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
  441. package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
  442. package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
  443. package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
  444. package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
  445. package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
  446. package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
  447. package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
  448. package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
  449. package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
  450. package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
  451. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
  452. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
  453. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
  454. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
  455. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
  456. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
  457. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
  458. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
  459. package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
  460. package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
  461. package/dist/dashboard-source.json +70 -0
  462. package/dist/graphql-server.mjs +1319 -0
  463. package/dist/job-worker.mjs +989 -0
  464. package/dist/main.mjs +495 -0
  465. package/dist/prepare-dashboard.mjs +35 -0
  466. package/dist/resources/cedar/policies.cedar +315 -0
  467. package/dist/resources/cedar/schema.cedarschema +276 -0
  468. package/dist/resources/graphql-schema/rxdb.graphql +401 -0
  469. package/dist/resources/graphql-schema/system.graphql +1200 -0
  470. package/package.json +98 -0
@@ -0,0 +1,1549 @@
1
+ "use client"
2
+
3
+ import type { Collection } from "@tanstack/db"
4
+ import { useLiveQuery } from "@tanstack/react-db"
5
+ import { ChevronLeft } from "lucide-react"
6
+ import Image from "next/image"
7
+ import Link from "next/link"
8
+ import { useRouter, useSearchParams } from "next/navigation"
9
+ import { Suspense, use, useMemo, useRef, useState } from "react"
10
+ import { ExecutionCardMenu } from "./execution-card-menu.tsx"
11
+ import { useMocks } from "@/components/mocks-provider"
12
+ import { ProcessWorkflowLink } from "@/components/process-workflow-link"
13
+ import { TabPill } from "@/components/ui/tab-pill"
14
+ import { WithoutWaitingBadge } from "@/components/without-waiting-badge"
15
+ import { useIsMobile } from "@/hooks/use-mobile"
16
+ import {
17
+ type ExecutionDocType,
18
+ useExecutionCollection,
19
+ } from "@/lib/collections/execution-collection-provider"
20
+ import { type Execution, executions as mockExecutions } from "@/lib/mock-data"
21
+ import { cn } from "@/lib/utils"
22
+
23
+ type ExecutionStatus = "Running" | "Completed" | "Failed" | "Abandoned"
24
+ type ExecutionTabKey = "in-progress" | "completed" | "failed" | "all"
25
+ type MockExecutionView = "timeline" | "kanban"
26
+ type MockExecutionTabKey = "in-progress" | "completed" | "failed" | "all"
27
+
28
+ const executionStatusTheme: Record<ExecutionStatus, string> = {
29
+ Running:
30
+ "bg-sky-100 text-sky-700 border border-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:border-sky-500/30",
31
+ Completed:
32
+ "bg-emerald-100 text-emerald-700 border border-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/30",
33
+ Failed:
34
+ "bg-rose-100 text-rose-700 border border-rose-200 dark:bg-rose-500/10 dark:text-rose-300 dark:border-rose-500/30",
35
+ Abandoned:
36
+ "bg-slate-100 text-slate-600 border border-slate-200 dark:bg-slate-500/10 dark:text-slate-400 dark:border-slate-500/30",
37
+ }
38
+
39
+ const mockExecutionStatusTheme = {
40
+ Running:
41
+ "bg-sky-100 text-sky-700 border border-sky-200 dark:bg-sky-500/10 dark:text-sky-300 dark:border-sky-500/30",
42
+ Paused:
43
+ "bg-amber-100 text-amber-700 border border-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/30",
44
+ Completed:
45
+ "bg-emerald-100 text-emerald-700 border border-emerald-200 dark:bg-emerald-500/10 dark:text-emerald-300 dark:border-emerald-500/30",
46
+ Failed:
47
+ "bg-rose-100 text-rose-700 border border-rose-200 dark:bg-rose-500/10 dark:text-rose-300 dark:border-rose-500/30",
48
+ }
49
+
50
+ const mockExecutionTabFilters: Record<
51
+ MockExecutionTabKey,
52
+ Execution["status"][]
53
+ > = {
54
+ "in-progress": ["Running", "Paused"],
55
+ completed: ["Completed"],
56
+ failed: ["Failed"],
57
+ all: ["Running", "Paused", "Completed", "Failed"],
58
+ }
59
+
60
+ const executionTabKeys = [
61
+ "in-progress",
62
+ "completed",
63
+ "failed",
64
+ "all",
65
+ ] as const satisfies readonly ExecutionTabKey[]
66
+
67
+ function parseExecutionTabKey(value: string | null): ExecutionTabKey | null {
68
+ return executionTabKeys.find((key) => key === value) ?? null
69
+ }
70
+
71
+ /**
72
+ * Format timestamp to relative time string
73
+ * Accepts either epoch ms (number) or ISO date string
74
+ */
75
+ function formatRelativeTime(timestamp: number | string): string {
76
+ const time =
77
+ typeof timestamp === "string" ? new Date(timestamp).getTime() : timestamp
78
+
79
+ if (!Number.isFinite(time) || time <= 0) {
80
+ return "Unknown"
81
+ }
82
+
83
+ const now = Date.now()
84
+ const diff = now - time
85
+
86
+ if (diff < 0) {
87
+ return "Just now"
88
+ }
89
+
90
+ const seconds = Math.floor(diff / 1000)
91
+ const minutes = Math.floor(seconds / 60)
92
+ const hours = Math.floor(minutes / 60)
93
+ const days = Math.floor(hours / 24)
94
+
95
+ if (days > 0) return `${days} day${days > 1 ? "s" : ""} ago`
96
+ if (hours > 0) return `${hours} hour${hours > 1 ? "s" : ""} ago`
97
+ if (minutes > 0) return `${minutes} minute${minutes > 1 ? "s" : ""} ago`
98
+ return "Just now"
99
+ }
100
+
101
+ function ExecutionsSkeleton() {
102
+ return (
103
+ <div className="flex-1 overflow-y-auto">
104
+ <section className="space-y-6">
105
+ <div className="rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
106
+ <div className="flex items-center justify-center py-12">
107
+ <div className="text-center">
108
+ <output
109
+ className="inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-blue-600 border-r-transparent motion-reduce:animate-[spin_1.5s_linear_infinite]"
110
+ aria-label="Loading executions"
111
+ />
112
+ <p className="mt-4 text-sm text-slate-500 dark:text-slate-400">
113
+ Loading executions...
114
+ </p>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </section>
119
+ </div>
120
+ )
121
+ }
122
+
123
+ // =============================================================================
124
+ // LIVE IMPLEMENTATION (using RxDB data)
125
+ // =============================================================================
126
+
127
+ function ExecutionsPageInner({
128
+ collectionPromise,
129
+ initialSelectedExecutionId = null,
130
+ onMobileBack,
131
+ }: {
132
+ collectionPromise: Promise<Collection<ExecutionDocType, string>>
133
+ initialSelectedExecutionId?: string | null
134
+ onMobileBack?: () => void
135
+ }) {
136
+ "use memo"
137
+
138
+ const executionCollection = use(collectionPromise)
139
+ const router = useRouter()
140
+ const searchParams = useSearchParams()
141
+ const isMobile = useIsMobile()
142
+ const defaultTab = initialSelectedExecutionId ? "all" : "in-progress"
143
+ const tab = parseExecutionTabKey(searchParams.get("filter")) ?? defaultTab
144
+ const currentQueryString = searchParams.toString()
145
+ const currentQuerySuffix = currentQueryString ? `?${currentQueryString}` : ""
146
+ const [selectedExecutionId, setSelectedExecutionId] = useState<string | null>(
147
+ null,
148
+ )
149
+
150
+ // Live query for all executions, ordered by most recent first
151
+ const executionsQuery = useLiveQuery((q) =>
152
+ q
153
+ .from({ execution: executionCollection })
154
+ .select(({ execution }) => ({
155
+ id: execution.id,
156
+ updatedAt: execution.updatedAt,
157
+ processStateId: execution.processStateId,
158
+ processName: execution.processName,
159
+ withoutWaiting: execution.withoutWaiting ?? false,
160
+ processPath: execution.processPath,
161
+ canAbandonExecution: execution.canAbandonExecution ?? false,
162
+ canRestartExecution: execution.canRestartExecution ?? false,
163
+ status: execution.status,
164
+ failureReason: execution.failureReason,
165
+ abandonedReason: execution.abandonedReason,
166
+ startedAt: execution.startedAt,
167
+ finishedAt: execution.finishedAt,
168
+ completedSteps: execution.completedSteps,
169
+ totalSteps: execution.totalSteps,
170
+ durationMs: execution.durationMs,
171
+ estimatedCompletionAt: execution.estimatedCompletionAt,
172
+ slaTargetAt: execution.slaTargetAt,
173
+ steps: execution.steps,
174
+ }))
175
+ .orderBy(({ execution }) => execution.startedAt, "desc"),
176
+ )
177
+
178
+ const executions = executionsQuery.data ?? []
179
+
180
+ const routeSelectedExecution = initialSelectedExecutionId
181
+ ? executions.find(
182
+ (execution) => execution.id === initialSelectedExecutionId,
183
+ )
184
+ : null
185
+
186
+ // Count by status
187
+ const runningCount = executions.filter((e) => e.status === "Running").length
188
+ const completedCount = executions.filter(
189
+ (e) => e.status === "Completed",
190
+ ).length
191
+ const failedCount = executions.filter(
192
+ (e) => e.status === "Failed" || e.status === "Abandoned",
193
+ ).length
194
+
195
+ // Filter based on tab
196
+ const filtered = (() => {
197
+ switch (tab) {
198
+ case "in-progress":
199
+ return executions.filter((e) => e.status === "Running")
200
+ case "completed":
201
+ return executions.filter((e) => e.status === "Completed")
202
+ case "failed":
203
+ return executions.filter(
204
+ (e) => e.status === "Failed" || e.status === "Abandoned",
205
+ )
206
+ default:
207
+ return executions
208
+ }
209
+ })()
210
+
211
+ // Selected execution
212
+ const selectedExecution = (() => {
213
+ if (filtered.length === 0) return null
214
+
215
+ if (selectedExecutionId) {
216
+ const found = filtered.find((e) => e.id === selectedExecutionId)
217
+ if (found) return found
218
+ }
219
+
220
+ if (initialSelectedExecutionId) {
221
+ if (!routeSelectedExecution) return null
222
+
223
+ const routeSelection = filtered.find(
224
+ (execution) => execution.id === initialSelectedExecutionId,
225
+ )
226
+
227
+ if (routeSelection) return routeSelection
228
+ return isMobile ? routeSelectedExecution : (filtered[0] ?? null)
229
+ }
230
+
231
+ return filtered[0] ?? null
232
+ })()
233
+
234
+ const handleSelectExecution = (executionId: string) => {
235
+ setSelectedExecutionId(executionId)
236
+
237
+ const executionPath = `/executions/${encodeURIComponent(executionId)}${currentQuerySuffix}`
238
+
239
+ if (isMobile) {
240
+ router.push(executionPath, { scroll: false })
241
+ return
242
+ }
243
+
244
+ router.replace(executionPath, { scroll: false })
245
+ }
246
+
247
+ const handleSelectTab = (nextTab: ExecutionTabKey) => {
248
+ const nextSearchParams = new URLSearchParams(searchParams)
249
+
250
+ if (nextTab === defaultTab) {
251
+ nextSearchParams.delete("filter")
252
+ } else {
253
+ nextSearchParams.set("filter", nextTab)
254
+ }
255
+
256
+ const nextQueryString = nextSearchParams.toString()
257
+ router.replace(
258
+ nextQueryString ? `/executions?${nextQueryString}` : "/executions",
259
+ { scroll: false },
260
+ )
261
+ }
262
+
263
+ const handleCloseMobileDetail = () => {
264
+ if (onMobileBack) {
265
+ onMobileBack()
266
+ return
267
+ }
268
+
269
+ router.push(`/executions${currentQuerySuffix}`, { scroll: false })
270
+ }
271
+
272
+ const isMobileDetailRoute = isMobile && initialSelectedExecutionId !== null
273
+ const isRouteExecutionMissing =
274
+ initialSelectedExecutionId !== null && routeSelectedExecution === null
275
+
276
+ if (!executionsQuery.isReady) {
277
+ return <ExecutionsSkeleton />
278
+ }
279
+
280
+ return (
281
+ <section className="space-y-6">
282
+ {!isMobileDetailRoute && (
283
+ <div className="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
284
+ <div className="flex flex-wrap items-center gap-2">
285
+ <TabPill
286
+ label="In Progress"
287
+ count={runningCount}
288
+ active={tab === "in-progress"}
289
+ onClick={() => handleSelectTab("in-progress")}
290
+ />
291
+ <TabPill
292
+ label="Completed"
293
+ count={completedCount}
294
+ active={tab === "completed"}
295
+ onClick={() => handleSelectTab("completed")}
296
+ />
297
+ <TabPill
298
+ label="Failed"
299
+ count={failedCount}
300
+ active={tab === "failed"}
301
+ onClick={() => handleSelectTab("failed")}
302
+ />
303
+ <TabPill
304
+ label="All"
305
+ count={executions.length}
306
+ active={tab === "all"}
307
+ onClick={() => handleSelectTab("all")}
308
+ />
309
+ </div>
310
+ </div>
311
+ )}
312
+
313
+ {isMobileDetailRoute ? (
314
+ selectedExecution ? (
315
+ <MobileExecutionDetail
316
+ execution={selectedExecution}
317
+ onBack={handleCloseMobileDetail}
318
+ />
319
+ ) : (
320
+ <EmptyState
321
+ title="Execution not found"
322
+ description="This execution is no longer available or you no longer have access to it."
323
+ />
324
+ )
325
+ ) : filtered.length === 0 ? (
326
+ <EmptyState
327
+ title="No executions in this view"
328
+ description="Adjust filters or start a process from the catalog to see live executions."
329
+ />
330
+ ) : isMobile ? (
331
+ <div className="space-y-3">
332
+ {filtered.map((exec) => (
333
+ <ExecutionListCard
334
+ key={exec.id}
335
+ execution={exec}
336
+ isSelected={false}
337
+ onSelect={() => handleSelectExecution(exec.id)}
338
+ />
339
+ ))}
340
+ </div>
341
+ ) : (
342
+ <div className="mt-4 grid gap-6 lg:grid-cols-[380px_1fr]">
343
+ <div className="space-y-3">
344
+ {filtered.map((exec) => (
345
+ <ExecutionListCard
346
+ key={exec.id}
347
+ execution={exec}
348
+ isSelected={exec.id === selectedExecution?.id}
349
+ onSelect={() => handleSelectExecution(exec.id)}
350
+ />
351
+ ))}
352
+ </div>
353
+ {selectedExecution ? (
354
+ <LiveExecutionDetail execution={selectedExecution} />
355
+ ) : isRouteExecutionMissing ? (
356
+ <EmptyState
357
+ title="Execution not found"
358
+ description="This execution is no longer available or you no longer have access to it."
359
+ />
360
+ ) : null}
361
+ </div>
362
+ )}
363
+ </section>
364
+ )
365
+ }
366
+
367
+ function ExecutionListCard({
368
+ execution,
369
+ isSelected,
370
+ onSelect,
371
+ }: {
372
+ execution: ExecutionData
373
+ isSelected: boolean
374
+ onSelect: () => void
375
+ }) {
376
+ "use memo"
377
+
378
+ const waitingStep = execution.steps.find(
379
+ (step) =>
380
+ step.status === "Correction Required" || step.status === "Waiting",
381
+ )
382
+
383
+ return (
384
+ // biome-ignore lint/a11y/useSemanticElements: div needed to allow nested button in ExecutionCardMenu
385
+ <div
386
+ role="button"
387
+ tabIndex={0}
388
+ onClick={onSelect}
389
+ onKeyDown={(event) => {
390
+ if (event.key === "Enter" || event.key === " ") {
391
+ event.preventDefault()
392
+ onSelect()
393
+ }
394
+ }}
395
+ className={cn(
396
+ "flex w-full cursor-pointer flex-col gap-3 rounded-2xl border bg-white p-4 text-left shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800 dark:bg-slate-900/70",
397
+ isSelected
398
+ ? "border-blue-500 dark:border-blue-400 dark:bg-blue-500/10"
399
+ : "border-slate-200",
400
+ )}
401
+ >
402
+ <div className="flex items-center justify-between">
403
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
404
+ {execution.processName}
405
+ {execution.withoutWaiting && <WithoutWaitingBadge />}
406
+ </h4>
407
+ <div className="flex items-center gap-2">
408
+ <ExecutionCardMenu
409
+ executionId={execution.id}
410
+ status={execution.status}
411
+ processPath={execution.processPath}
412
+ canAbandonExecution={execution.canAbandonExecution}
413
+ canRestartExecution={execution.canRestartExecution}
414
+ />
415
+ <span
416
+ className={cn(
417
+ "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold",
418
+ executionStatusTheme[execution.status as ExecutionStatus] ||
419
+ executionStatusTheme.Running,
420
+ )}
421
+ >
422
+ {execution.status}
423
+ </span>
424
+ </div>
425
+ </div>
426
+ <p className="text-sm text-slate-500 dark:text-slate-400">
427
+ {execution.status === "Completed"
428
+ ? "Finished"
429
+ : `Step ${execution.completedSteps} of ${execution.totalSteps}`}
430
+ </p>
431
+ <div className="flex items-center justify-between text-xs text-slate-500 dark:text-slate-400">
432
+ <span>Started {formatRelativeTime(execution.startedAt)}</span>
433
+ <span>
434
+ {execution.status === "Completed" && execution.finishedAt
435
+ ? `Completed ${formatRelativeTime(execution.finishedAt)}`
436
+ : `Last activity ${formatRelativeTime(execution.updatedAt)}`}
437
+ </span>
438
+ </div>
439
+ {waitingStep && (
440
+ <div className="flex items-center gap-2">
441
+ <span
442
+ className={cn(
443
+ "rounded-full px-2 py-0.5 text-xs font-semibold",
444
+ waitingStep.status === "Correction Required"
445
+ ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-200"
446
+ : "bg-slate-200 text-slate-600 dark:bg-slate-800 dark:text-slate-300",
447
+ )}
448
+ >
449
+ {waitingStep.status === "Correction Required"
450
+ ? `Correction required: ${waitingStep.name}`
451
+ : waitingStep.name}
452
+ </span>
453
+ </div>
454
+ )}
455
+ <StepParticipants steps={execution.steps} />
456
+ </div>
457
+ )
458
+ }
459
+
460
+ interface ExecutionStep {
461
+ readonly id: string
462
+ readonly name: string
463
+ readonly path: string
464
+ readonly status:
465
+ | "Completed"
466
+ | "Waiting"
467
+ | "Potential"
468
+ | "Failed"
469
+ | "Correction Required"
470
+ readonly failureReason?: string | undefined
471
+ readonly role?:
472
+ | {
473
+ readonly id: string
474
+ readonly name: string
475
+ }
476
+ | undefined
477
+ readonly submittedViaEmbeddedForm?: boolean | undefined
478
+ readonly externalSubmitterEmail?: string | undefined
479
+ readonly assignedProviderUserEmail?: string | undefined
480
+ readonly providerUser?:
481
+ | {
482
+ readonly id: string
483
+ readonly firstName: string
484
+ readonly lastName: string
485
+ readonly picture: string
486
+ readonly orgUnit: string
487
+ }
488
+ | undefined
489
+ readonly startedAt?: string | undefined // ISO date string
490
+ readonly completedAt?: string | undefined // ISO date string
491
+ }
492
+
493
+ interface ExecutionData {
494
+ withoutWaiting: boolean
495
+ id: string
496
+ updatedAt: number
497
+ processStateId: string
498
+ processName: string
499
+ processPath: string
500
+ canAbandonExecution: boolean
501
+ canRestartExecution: boolean
502
+ status: "Running" | "Completed" | "Failed" | "Abandoned"
503
+ failureReason?: string | undefined
504
+ abandonedReason?: string | undefined
505
+ startedAt: string // ISO date string
506
+ finishedAt: string | undefined // ISO date string
507
+ completedSteps: number
508
+ totalSteps: number
509
+ durationMs: number | undefined
510
+ estimatedCompletionAt: string | undefined // ISO date string
511
+ slaTargetAt: string | undefined // ISO date string
512
+ steps: readonly ExecutionStep[]
513
+ }
514
+
515
+ const SWIPE_CLOSE_MIN_PX = 72
516
+ const SWIPE_CLOSE_HORIZONTAL_RATIO = 1.25
517
+
518
+ /**
519
+ * Format ISO date string to readable date/time
520
+ */
521
+ function formatDateTime(isoString: string | undefined): string {
522
+ if (!isoString) return "N/A"
523
+ const date = new Date(isoString)
524
+ return date.toLocaleString(undefined, {
525
+ month: "short",
526
+ day: "numeric",
527
+ hour: "2-digit",
528
+ minute: "2-digit",
529
+ })
530
+ }
531
+
532
+ /**
533
+ * Extract unique participants from execution steps
534
+ */
535
+ function getParticipants(steps: readonly ExecutionStep[]) {
536
+ const completedWithProviderUser = steps.filter(
537
+ (
538
+ s,
539
+ ): s is typeof s & {
540
+ providerUser: NonNullable<typeof s.providerUser>
541
+ } => s.status === "Completed" && s.providerUser != null,
542
+ )
543
+ const waitingWithRole = steps.filter(
544
+ (s): s is typeof s & { role: NonNullable<typeof s.role> } =>
545
+ (s.status === "Waiting" || s.status === "Correction Required") &&
546
+ s.role != null,
547
+ )
548
+
549
+ // Dedupe provider users by id
550
+ const seenProviderUsers = new Set<string>()
551
+ const uniqueProviderUsers = completedWithProviderUser.filter((step) => {
552
+ const key = step.providerUser.id
553
+ if (seenProviderUsers.has(key)) return false
554
+ seenProviderUsers.add(key)
555
+ return true
556
+ })
557
+
558
+ return { providerUsers: uniqueProviderUsers, waitingRoles: waitingWithRole }
559
+ }
560
+
561
+ function LiveExecutionDetail({ execution }: { execution: ExecutionData }) {
562
+ "use memo"
563
+
564
+ // Find current waiting step for display
565
+ const currentWaitingStep = execution.steps.find(
566
+ (s) => s.status === "Waiting" || s.status === "Correction Required",
567
+ )
568
+ const failedStep = execution.steps.find((s) => s.status === "Failed")
569
+ const { providerUsers, waitingRoles } = getParticipants(execution.steps)
570
+
571
+ return (
572
+ <div className="flex flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
573
+ <div className="flex flex-wrap items-start justify-between gap-3">
574
+ <div>
575
+ <h3 className="text-2xl font-semibold text-slate-900 dark:text-slate-100">
576
+ {execution.processName}
577
+ {execution.withoutWaiting && <WithoutWaitingBadge />}
578
+ </h3>
579
+ <p className="text-sm text-slate-500 dark:text-slate-400">
580
+ Started {formatRelativeTime(execution.startedAt)}.
581
+ {currentWaitingStep?.status === "Correction Required"
582
+ ? ` Correction required on ${currentWaitingStep.name}.`
583
+ : currentWaitingStep?.providerUser
584
+ ? ` Current assignee: ${currentWaitingStep.providerUser.firstName} ${currentWaitingStep.providerUser.lastName}`
585
+ : ""}
586
+ </p>
587
+ </div>
588
+ <div className="flex items-center gap-2">
589
+ <span
590
+ className={cn(
591
+ "inline-flex items-center rounded-full px-3 py-1 text-sm font-semibold",
592
+ executionStatusTheme[execution.status as ExecutionStatus] ||
593
+ executionStatusTheme.Running,
594
+ )}
595
+ >
596
+ {execution.status}
597
+ </span>
598
+ <ProcessWorkflowLink
599
+ processName={execution.processName}
600
+ processPath={execution.processPath}
601
+ />
602
+ </div>
603
+ </div>
604
+
605
+ {/* Progress */}
606
+ {execution.status === "Failed" &&
607
+ (execution.failureReason || failedStep) && (
608
+ <div className="rounded-2xl border border-rose-200 bg-rose-50 p-4 text-rose-800 dark:border-rose-900/40 dark:bg-rose-950/20 dark:text-rose-200">
609
+ <h4 className="text-sm font-semibold tracking-wide uppercase">
610
+ Failure
611
+ </h4>
612
+ <p className="mt-2 text-sm leading-relaxed">
613
+ {execution.failureReason ??
614
+ failedStep?.failureReason ??
615
+ "A system step failed."}
616
+ </p>
617
+ </div>
618
+ )}
619
+
620
+ {execution.status === "Abandoned" && (
621
+ <div className="rounded-2xl border border-slate-300 bg-slate-100 p-4 text-slate-700 dark:border-slate-600 dark:bg-slate-800/40 dark:text-slate-300">
622
+ <h4 className="text-sm font-semibold tracking-wide uppercase">
623
+ Abandoned
624
+ </h4>
625
+ <p className="mt-2 text-sm leading-relaxed">
626
+ {execution.abandonedReason || "This execution was abandoned."}
627
+ </p>
628
+ </div>
629
+ )}
630
+
631
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
632
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
633
+ Progress
634
+ </h4>
635
+ <div className="mt-4 space-y-3">
636
+ <div className="flex items-center justify-between text-sm">
637
+ <span className="text-slate-600 dark:text-slate-300">
638
+ Steps completed
639
+ </span>
640
+ <span className="font-semibold text-slate-900 dark:text-slate-100">
641
+ {execution.completedSteps} / {execution.totalSteps}
642
+ </span>
643
+ </div>
644
+ <div className="h-2 w-full rounded-full bg-slate-200 dark:bg-slate-700">
645
+ <div
646
+ className="h-2 rounded-full bg-blue-500"
647
+ style={{
648
+ width: `${execution.totalSteps > 0 ? (execution.completedSteps / execution.totalSteps) * 100 : 0}%`,
649
+ }}
650
+ />
651
+ </div>
652
+ </div>
653
+ </div>
654
+
655
+ {/* Timeline */}
656
+ {execution.steps.length > 0 && (
657
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
658
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
659
+ Timeline
660
+ </h4>
661
+ <ul className="mt-4 space-y-4">
662
+ {execution.steps.map((step) => {
663
+ const isEmbeddedSubmission =
664
+ step.submittedViaEmbeddedForm === true
665
+ const hasExternalSubmitterEmail =
666
+ step.externalSubmitterEmail != null &&
667
+ step.externalSubmitterEmail.length > 0
668
+ const showExternalSubmissionInfo =
669
+ step.status !== "Correction Required" &&
670
+ (isEmbeddedSubmission || hasExternalSubmitterEmail)
671
+
672
+ return (
673
+ <li key={step.id} className="relative pl-8">
674
+ <span
675
+ className={cn(
676
+ "absolute left-0 top-1.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold",
677
+ step.status === "Completed"
678
+ ? "border-emerald-500 bg-emerald-500 text-white"
679
+ : step.status === "Failed"
680
+ ? "border-rose-500 bg-rose-500 text-white"
681
+ : step.status === "Correction Required"
682
+ ? "border-amber-500 bg-amber-500 text-white"
683
+ : step.status === "Waiting"
684
+ ? "border-blue-500 bg-blue-500 text-white"
685
+ : "border-slate-300 bg-white text-slate-400 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-500",
686
+ )}
687
+ >
688
+ {step.status === "Completed"
689
+ ? "\u2713"
690
+ : step.status === "Failed"
691
+ ? "!"
692
+ : step.status === "Correction Required"
693
+ ? "?"
694
+ : step.status === "Waiting"
695
+ ? "\u2022"
696
+ : ""}
697
+ </span>
698
+ <div className="flex flex-wrap items-center gap-2">
699
+ <p className="text-sm font-semibold text-slate-900 dark:text-slate-100">
700
+ {step.name}
701
+ </p>
702
+ {/* External submissions can have internal roles but external submitters. */}
703
+ {showExternalSubmissionInfo ? (
704
+ <span className="rounded-full bg-cyan-500/10 px-2 py-0.5 text-[11px] font-semibold text-cyan-700 dark:text-cyan-300">
705
+ External Participant
706
+ </span>
707
+ ) : step.assignedProviderUserEmail ? (
708
+ <span className="rounded-full bg-blue-500/10 px-2 py-0.5 text-[11px] font-semibold text-blue-700 dark:text-blue-300">
709
+ {step.assignedProviderUserEmail}
710
+ </span>
711
+ ) : step.role ? (
712
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-[11px] font-semibold text-slate-600 dark:bg-slate-800/60 dark:text-slate-300">
713
+ {step.role.name}
714
+ </span>
715
+ ) : null}
716
+ </div>
717
+ {showExternalSubmissionInfo && hasExternalSubmitterEmail ? (
718
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
719
+ {step.status === "Waiting"
720
+ ? "Waiting for"
721
+ : isEmbeddedSubmission
722
+ ? "Submitted via embedded form by"
723
+ : "Submitted by"}{" "}
724
+ {step.externalSubmitterEmail}
725
+ </p>
726
+ ) : isEmbeddedSubmission &&
727
+ step.status !== "Waiting" &&
728
+ step.status !== "Correction Required" ? (
729
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
730
+ Submitted via embedded form (no email recorded)
731
+ </p>
732
+ ) : !showExternalSubmissionInfo && step.providerUser ? (
733
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
734
+ {step.status === "Completed"
735
+ ? "Completed by"
736
+ : step.status === "Failed"
737
+ ? "Failed at"
738
+ : step.status === "Correction Required"
739
+ ? "Correction assigned to"
740
+ : "Assigned to"}{" "}
741
+ {step.providerUser.firstName} {step.providerUser.lastName}
742
+ </p>
743
+ ) : step.status === "Correction Required" && step.role ? (
744
+ <p className="mt-1 text-[11px] text-slate-500 dark:text-slate-400">
745
+ Correction assigned to {step.role.name}
746
+ </p>
747
+ ) : null}
748
+ {step.status === "Failed" && step.failureReason && (
749
+ <p className="mt-1 text-xs text-rose-700 dark:text-rose-300">
750
+ {step.failureReason}
751
+ </p>
752
+ )}
753
+ {step.status === "Correction Required" &&
754
+ step.failureReason && (
755
+ <p className="mt-1 text-xs text-amber-700 dark:text-amber-300">
756
+ {step.failureReason}
757
+ </p>
758
+ )}
759
+ <div className="mt-1 flex flex-wrap items-center gap-3 text-xs text-slate-500 dark:text-slate-400">
760
+ {step.startedAt && (
761
+ <span>Started {formatRelativeTime(step.startedAt)}</span>
762
+ )}
763
+ {step.completedAt && (
764
+ <span>
765
+ {step.status === "Failed"
766
+ ? `Failed ${formatRelativeTime(step.completedAt)}`
767
+ : `Completed ${formatRelativeTime(step.completedAt)}`}
768
+ </span>
769
+ )}
770
+ </div>
771
+ </li>
772
+ )
773
+ })}
774
+ </ul>
775
+ </div>
776
+ )}
777
+
778
+ {/* Participants and State Snapshot cards */}
779
+ <div className="grid gap-4 md:grid-cols-2">
780
+ {/* Participants */}
781
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
782
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
783
+ Participants
784
+ </h4>
785
+ <div className="mt-3 space-y-2">
786
+ {providerUsers.map((step) => (
787
+ <div
788
+ key={step.id}
789
+ className="flex items-center justify-between rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
790
+ >
791
+ <span>
792
+ {step.providerUser.firstName} {step.providerUser.lastName}
793
+ </span>
794
+ <span className="text-xs text-slate-500 dark:text-slate-400">
795
+ {step.providerUser.orgUnit}
796
+ </span>
797
+ </div>
798
+ ))}
799
+ {waitingRoles.map((step) => (
800
+ <div
801
+ key={step.id}
802
+ className="flex items-center justify-between rounded-xl border border-dashed border-slate-300 bg-white px-3 py-2 text-sm text-slate-500 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-400"
803
+ >
804
+ <span className="italic">
805
+ Waiting for{" "}
806
+ {step.externalSubmitterEmail ??
807
+ step.assignedProviderUserEmail ??
808
+ step.role.name}
809
+ </span>
810
+ </div>
811
+ ))}
812
+ {providerUsers.length === 0 && waitingRoles.length === 0 && (
813
+ <p className="text-sm text-slate-500 dark:text-slate-400">
814
+ No participants yet
815
+ </p>
816
+ )}
817
+ </div>
818
+ </div>
819
+
820
+ {/* State Snapshot */}
821
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
822
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
823
+ State snapshot
824
+ </h4>
825
+ <dl className="mt-3 grid grid-cols-2 gap-3 text-sm text-slate-600 dark:text-slate-300">
826
+ <div>
827
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
828
+ {execution.status === "Abandoned"
829
+ ? "Abandoned"
830
+ : execution.finishedAt
831
+ ? "Completed"
832
+ : "Estimated completion"}
833
+ </dt>
834
+ <dd>
835
+ {execution.finishedAt
836
+ ? formatDateTime(execution.finishedAt)
837
+ : execution.estimatedCompletionAt
838
+ ? formatDateTime(execution.estimatedCompletionAt)
839
+ : "N/A"}
840
+ </dd>
841
+ </div>
842
+ <div>
843
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
844
+ SLA target
845
+ </dt>
846
+ <dd>
847
+ {execution.slaTargetAt
848
+ ? formatDateTime(execution.slaTargetAt)
849
+ : "Not set"}
850
+ </dd>
851
+ </div>
852
+ </dl>
853
+ </div>
854
+ </div>
855
+ </div>
856
+ )
857
+ }
858
+
859
+ function MobileExecutionDetail({
860
+ execution,
861
+ onBack,
862
+ }: {
863
+ execution: ExecutionData
864
+ onBack: () => void
865
+ }) {
866
+ "use memo"
867
+
868
+ const touchStartX = useRef<number | null>(null)
869
+ const touchStartY = useRef<number | null>(null)
870
+ const touchCurrentX = useRef<number | null>(null)
871
+ const touchCurrentY = useRef<number | null>(null)
872
+
873
+ const resetSwipe = () => {
874
+ touchStartX.current = null
875
+ touchStartY.current = null
876
+ touchCurrentX.current = null
877
+ touchCurrentY.current = null
878
+ }
879
+
880
+ return (
881
+ <div
882
+ className="space-y-4"
883
+ onTouchStart={(event) => {
884
+ const touch = event.touches[0]
885
+ if (!touch) return
886
+
887
+ touchStartX.current = touch.clientX
888
+ touchStartY.current = touch.clientY
889
+ touchCurrentX.current = touch.clientX
890
+ touchCurrentY.current = touch.clientY
891
+ }}
892
+ onTouchMove={(event) => {
893
+ const touch = event.touches[0]
894
+ if (!touch) return
895
+
896
+ touchCurrentX.current = touch.clientX
897
+ touchCurrentY.current = touch.clientY
898
+ }}
899
+ onTouchEnd={() => {
900
+ if (
901
+ touchStartX.current === null ||
902
+ touchStartY.current === null ||
903
+ touchCurrentX.current === null ||
904
+ touchCurrentY.current === null
905
+ ) {
906
+ resetSwipe()
907
+ return
908
+ }
909
+
910
+ const deltaX = touchCurrentX.current - touchStartX.current
911
+ const deltaY = Math.abs(touchCurrentY.current - touchStartY.current)
912
+
913
+ resetSwipe()
914
+
915
+ if (
916
+ deltaX > SWIPE_CLOSE_MIN_PX &&
917
+ deltaX > deltaY * SWIPE_CLOSE_HORIZONTAL_RATIO
918
+ ) {
919
+ onBack()
920
+ }
921
+ }}
922
+ onTouchCancel={resetSwipe}
923
+ >
924
+ <div className="flex items-center gap-3 rounded-2xl border border-slate-200 bg-white px-3 py-2.5 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
925
+ <button
926
+ type="button"
927
+ onClick={onBack}
928
+ className="inline-flex items-center gap-1 rounded-full px-2 py-1 text-sm font-medium text-slate-600 hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-800 dark:hover:text-slate-50"
929
+ >
930
+ <ChevronLeft className="h-4 w-4" />
931
+ Back
932
+ </button>
933
+ <div className="min-w-0">
934
+ <p className="text-[11px] font-semibold tracking-[0.18em] text-slate-400 uppercase dark:text-slate-500">
935
+ Execution detail
936
+ </p>
937
+ <p className="truncate text-sm font-semibold text-slate-900 dark:text-slate-100">
938
+ {execution.processName}
939
+ {execution.withoutWaiting && <WithoutWaitingBadge />}
940
+ </p>
941
+ </div>
942
+ </div>
943
+
944
+ <div className="animate-in slide-in-from-right-4 duration-200">
945
+ <LiveExecutionDetail execution={execution} />
946
+ </div>
947
+ </div>
948
+ )
949
+ }
950
+
951
+ // =============================================================================
952
+ // MOCK IMPLEMENTATION (for reference)
953
+ // =============================================================================
954
+
955
+ function MockExecutionsSection() {
956
+ const [tab, setTab] = useState<MockExecutionTabKey>("in-progress")
957
+ const [view, setView] = useState<MockExecutionView>("timeline")
958
+ const [selectedExecutionId, setSelectedExecutionId] = useState<string | null>(
959
+ mockExecutions[0]?.id ?? null,
960
+ )
961
+
962
+ const filtered = useMemo(() => {
963
+ const statuses = mockExecutionTabFilters[tab]
964
+ return mockExecutions.filter((exec) => statuses.includes(exec.status))
965
+ }, [tab])
966
+
967
+ const selectedExecution = useMemo(() => {
968
+ if (filtered.length === 0) return null
969
+ const selected = filtered.find((exec) => exec.id === selectedExecutionId)
970
+ return selected ?? filtered[0] ?? null
971
+ }, [filtered, selectedExecutionId])
972
+
973
+ return (
974
+ <section className="space-y-6">
975
+ <div className="rounded-2xl border-2 border-amber-500 bg-amber-50 p-2 dark:border-amber-400 dark:bg-amber-900/20">
976
+ <h2 className="mb-4 text-lg font-bold text-amber-700 dark:text-amber-300">
977
+ MOCK DATA (for reference)
978
+ </h2>
979
+ <div className="flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/60">
980
+ <div className="flex flex-wrap items-center gap-2">
981
+ <TabPill
982
+ label="In Progress"
983
+ count={
984
+ mockExecutions.filter(
985
+ (exec) =>
986
+ exec.status === "Running" || exec.status === "Paused",
987
+ ).length
988
+ }
989
+ active={tab === "in-progress"}
990
+ onClick={() => setTab("in-progress")}
991
+ />
992
+ <TabPill
993
+ label="Completed"
994
+ count={
995
+ mockExecutions.filter((exec) => exec.status === "Completed")
996
+ .length
997
+ }
998
+ active={tab === "completed"}
999
+ onClick={() => setTab("completed")}
1000
+ />
1001
+ <TabPill
1002
+ label="Failed / Cancelled"
1003
+ count={
1004
+ mockExecutions.filter((exec) => exec.status === "Failed").length
1005
+ }
1006
+ active={tab === "failed"}
1007
+ onClick={() => setTab("failed")}
1008
+ />
1009
+ <TabPill
1010
+ label="All"
1011
+ count={mockExecutions.length}
1012
+ active={tab === "all"}
1013
+ onClick={() => setTab("all")}
1014
+ />
1015
+ </div>
1016
+ <div className="flex items-center gap-2">
1017
+ <button
1018
+ type="button"
1019
+ onClick={() => setView("timeline")}
1020
+ className={cn(
1021
+ "rounded-full border px-3 py-1.5 text-sm font-medium",
1022
+ view === "timeline"
1023
+ ? "border-blue-500 text-blue-600 dark:text-blue-300"
1024
+ : "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
1025
+ )}
1026
+ >
1027
+ Timeline
1028
+ </button>
1029
+ <button
1030
+ type="button"
1031
+ onClick={() => setView("kanban")}
1032
+ className={cn(
1033
+ "rounded-full border px-3 py-1.5 text-sm font-medium",
1034
+ view === "kanban"
1035
+ ? "border-blue-500 text-blue-600 dark:text-blue-300"
1036
+ : "border-slate-200 text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",
1037
+ )}
1038
+ >
1039
+ Kanban
1040
+ </button>
1041
+ <button
1042
+ type="button"
1043
+ className="rounded-full border border-slate-200 px-3 py-1.5 text-sm text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200"
1044
+ >
1045
+ Export CSV
1046
+ </button>
1047
+ </div>
1048
+ </div>
1049
+
1050
+ {filtered.length === 0 ? (
1051
+ <EmptyState
1052
+ title="No executions in this view"
1053
+ description="Adjust filters or start a process from the catalog to see live executions."
1054
+ />
1055
+ ) : view === "kanban" ? (
1056
+ <div className="mt-4">
1057
+ <MockExecutionKanban executions={filtered} />
1058
+ </div>
1059
+ ) : (
1060
+ <div className="mt-4 grid gap-6 lg:grid-cols-[380px_1fr]">
1061
+ <div className="space-y-3">
1062
+ {filtered.map((exec) => (
1063
+ <button
1064
+ key={exec.id}
1065
+ type="button"
1066
+ onClick={() => setSelectedExecutionId(exec.id)}
1067
+ className={cn(
1068
+ "flex w-full flex-col gap-3 rounded-2xl border bg-white p-4 text-left shadow-sm transition hover:-translate-y-0.5 hover:shadow-md dark:border-slate-800 dark:bg-slate-900/70",
1069
+ exec.id === selectedExecution?.id
1070
+ ? "border-blue-500 dark:border-blue-400 dark:bg-blue-500/10"
1071
+ : "border-slate-200",
1072
+ )}
1073
+ >
1074
+ <div className="flex items-center justify-between">
1075
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1076
+ {exec.processName} {exec.executionId}
1077
+ </h4>
1078
+ <span
1079
+ className={cn(
1080
+ "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-semibold",
1081
+ mockExecutionStatusTheme[exec.status],
1082
+ )}
1083
+ >
1084
+ {exec.status}
1085
+ </span>
1086
+ </div>
1087
+ <p className="text-sm text-slate-500 dark:text-slate-400">
1088
+ {exec.progress}
1089
+ </p>
1090
+ <div className="flex items-center justify-between text-xs text-slate-500 dark:text-slate-400">
1091
+ <span>Started {exec.startDate}</span>
1092
+ <span>Last activity {exec.lastActivity}</span>
1093
+ </div>
1094
+ <div className="flex items-center gap-2">
1095
+ {exec.participants.map((participant) => (
1096
+ <MockAvatar
1097
+ key={participant.id}
1098
+ name={participant.name}
1099
+ title={participant.role}
1100
+ />
1101
+ ))}
1102
+ </div>
1103
+ </button>
1104
+ ))}
1105
+ </div>
1106
+ {selectedExecution && (
1107
+ <MockExecutionDetail execution={selectedExecution} />
1108
+ )}
1109
+ </div>
1110
+ )}
1111
+ </div>
1112
+ </section>
1113
+ )
1114
+ }
1115
+
1116
+ function StepParticipants({ steps }: { steps: readonly ExecutionStep[] }) {
1117
+ "use memo"
1118
+
1119
+ const firstParticipant = steps.find(
1120
+ (step) =>
1121
+ isExternalParticipantStep(step) ||
1122
+ (step.status === "Completed" && step.providerUser != null) ||
1123
+ ((step.status === "Waiting" || step.status === "Correction Required") &&
1124
+ step.role != null),
1125
+ )
1126
+
1127
+ if (!firstParticipant) {
1128
+ return null
1129
+ }
1130
+
1131
+ const isExternalParticipant = isExternalParticipantStep(firstParticipant)
1132
+
1133
+ return (
1134
+ <div className="flex flex-wrap items-center gap-2">
1135
+ {isExternalParticipant ? (
1136
+ <ExternalParticipantChip
1137
+ email={firstParticipant.externalSubmitterEmail}
1138
+ />
1139
+ ) : firstParticipant.providerUser ? (
1140
+ <CompletedProviderUserChip
1141
+ firstName={firstParticipant.providerUser.firstName}
1142
+ lastName={firstParticipant.providerUser.lastName}
1143
+ orgUnit={firstParticipant.providerUser.orgUnit}
1144
+ picture={firstParticipant.providerUser.picture}
1145
+ />
1146
+ ) : firstParticipant.role ? (
1147
+ <PendingRoleChip roleName={firstParticipant.role.name} />
1148
+ ) : null}
1149
+ </div>
1150
+ )
1151
+ }
1152
+
1153
+ function isExternalParticipantStep(step: ExecutionStep) {
1154
+ if (step.status === "Correction Required") return false
1155
+
1156
+ return (
1157
+ step.submittedViaEmbeddedForm === true ||
1158
+ (step.externalSubmitterEmail != null &&
1159
+ step.externalSubmitterEmail.length > 0)
1160
+ )
1161
+ }
1162
+
1163
+ function ExternalParticipantChip({ email }: { email: string | undefined }) {
1164
+ "use memo"
1165
+
1166
+ return (
1167
+ <div className="flex items-center gap-2 rounded-full border border-cyan-400/50 bg-cyan-400/10 py-1 pl-2 pr-3 text-xs text-cyan-700 dark:border-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-200">
1168
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-cyan-500 text-[10px] font-bold tracking-wide text-slate-950">
1169
+ EXT
1170
+ </span>
1171
+ <div>
1172
+ <p className="font-semibold">External Participant</p>
1173
+ <p className="text-[11px] text-cyan-800/80 dark:text-cyan-200/80">
1174
+ {email ?? "Embedded form"}
1175
+ </p>
1176
+ </div>
1177
+ </div>
1178
+ )
1179
+ }
1180
+
1181
+ function CompletedProviderUserChip({
1182
+ firstName,
1183
+ lastName,
1184
+ orgUnit,
1185
+ picture,
1186
+ }: {
1187
+ firstName: string
1188
+ lastName: string
1189
+ orgUnit: string
1190
+ picture?: string
1191
+ }) {
1192
+ "use memo"
1193
+
1194
+ const initials = `${firstName.charAt(0)}${lastName.charAt(0)}`.toUpperCase()
1195
+ return (
1196
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 py-1 pl-2 pr-3 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1197
+ {picture ? (
1198
+ <Image
1199
+ src={picture}
1200
+ alt={`${firstName} ${lastName}`}
1201
+ width={28}
1202
+ height={28}
1203
+ className="h-7 w-7 rounded-full"
1204
+ />
1205
+ ) : (
1206
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-emerald-600 text-[11px] font-semibold text-white">
1207
+ {initials}
1208
+ </span>
1209
+ )}
1210
+ <div>
1211
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1212
+ {firstName}
1213
+ <br />
1214
+ {lastName}
1215
+ </p>
1216
+ <p className="text-[11px] text-slate-500 dark:text-slate-400">
1217
+ {orgUnit}
1218
+ </p>
1219
+ </div>
1220
+ </div>
1221
+ )
1222
+ }
1223
+
1224
+ function PendingRoleChip({ roleName }: { roleName: string }) {
1225
+ "use memo"
1226
+
1227
+ return (
1228
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 py-1 pl-2 pr-3 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1229
+ <span className="flex h-7 w-7 items-center justify-center rounded-full border-2 border-blue-500 text-[11px] font-semibold text-blue-500">
1230
+ ?
1231
+ </span>
1232
+ <div>
1233
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1234
+ {roleName}
1235
+ </p>
1236
+ </div>
1237
+ </div>
1238
+ )
1239
+ }
1240
+
1241
+ function MockAvatar({ name, title }: { name: string; title: string }) {
1242
+ const initials = name
1243
+ .split(" ")
1244
+ .map((part) => part[0])
1245
+ .join("")
1246
+ .slice(0, 2)
1247
+ .toUpperCase()
1248
+ return (
1249
+ <div className="flex items-center gap-2 rounded-full border border-slate-200 bg-slate-50 px-2 py-1 text-xs dark:border-slate-700 dark:bg-slate-800/60">
1250
+ <span className="flex h-7 w-7 items-center justify-center rounded-full bg-blue-600 text-[11px] font-semibold text-white">
1251
+ {initials}
1252
+ </span>
1253
+ <div>
1254
+ <p className="font-semibold text-slate-700 dark:text-slate-200">
1255
+ {name}
1256
+ </p>
1257
+ <p className="text-[11px] text-slate-500 dark:text-slate-400">
1258
+ {title}
1259
+ </p>
1260
+ </div>
1261
+ </div>
1262
+ )
1263
+ }
1264
+
1265
+ function MockExecutionDetail({ execution }: { execution: Execution }) {
1266
+ return (
1267
+ <div className="flex flex-col gap-4 rounded-2xl border border-slate-200 bg-white p-6 shadow-sm dark:border-slate-800 dark:bg-slate-900/70">
1268
+ <div className="flex flex-wrap items-start justify-between gap-3">
1269
+ <div>
1270
+ <h3 className="text-2xl font-semibold text-slate-900 dark:text-slate-100">
1271
+ {execution.processName} {execution.executionId}
1272
+ </h3>
1273
+ <p className="text-sm text-slate-500 dark:text-slate-400">
1274
+ Started {execution.startDate}. Current assignee{" "}
1275
+ {execution.currentRole ? `${execution.currentRole}` : "N/A"}.
1276
+ </p>
1277
+ </div>
1278
+ <div className="flex items-center gap-2">
1279
+ <span
1280
+ className={cn(
1281
+ "inline-flex items-center rounded-full px-3 py-1 text-sm font-semibold",
1282
+ mockExecutionStatusTheme[execution.status],
1283
+ )}
1284
+ >
1285
+ {execution.status}
1286
+ </span>
1287
+ <button
1288
+ type="button"
1289
+ className="rounded-full border border-slate-200 px-3 py-1.5 text-sm text-slate-500 hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:text-slate-300 dark:hover:border-slate-600 dark:hover:text-slate-200"
1290
+ >
1291
+ Share
1292
+ </button>
1293
+ <button
1294
+ type="button"
1295
+ className="rounded-full bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
1296
+ >
1297
+ View audit log
1298
+ </button>
1299
+ </div>
1300
+ </div>
1301
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1302
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1303
+ Timeline
1304
+ </h4>
1305
+ <ul className="mt-4 space-y-4">
1306
+ {execution.steps.map((step) => (
1307
+ <li key={step.id} className="relative pl-8">
1308
+ <span
1309
+ className={cn(
1310
+ "absolute left-0 top-1.5 inline-flex h-5 w-5 items-center justify-center rounded-full border text-xs font-semibold",
1311
+ step.status === "Complete"
1312
+ ? "border-emerald-500 bg-emerald-500 text-white"
1313
+ : step.status === "Current"
1314
+ ? "border-blue-500 bg-blue-500 text-white"
1315
+ : step.status === "Upcoming"
1316
+ ? "border-slate-300 bg-white text-slate-400 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-500"
1317
+ : "border-slate-300 bg-slate-100 text-slate-400",
1318
+ )}
1319
+ >
1320
+ {step.status === "Complete"
1321
+ ? "✓"
1322
+ : step.status === "Current"
1323
+ ? "•"
1324
+ : ""}
1325
+ </span>
1326
+ <div className="flex flex-wrap items-center gap-2">
1327
+ <p className="text-sm font-semibold text-slate-900 dark:text-slate-100">
1328
+ {step.name}
1329
+ </p>
1330
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-[11px] font-semibold text-slate-600 dark:bg-slate-800/60 dark:text-slate-300">
1331
+ {step.role}
1332
+ </span>
1333
+ {step.assignee && (
1334
+ <span className="text-[11px] text-slate-500 dark:text-slate-400">
1335
+ Assigned to {step.assignee}
1336
+ </span>
1337
+ )}
1338
+ </div>
1339
+ <div className="mt-1 flex flex-wrap items-center gap-3 text-xs text-slate-500 dark:text-slate-400">
1340
+ {step.startedAt && <span>Started {step.startedAt}</span>}
1341
+ {step.completedAt && <span>Completed {step.completedAt}</span>}
1342
+ {step.notes && (
1343
+ <span className="rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-amber-600 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-200">
1344
+ {step.notes}
1345
+ </span>
1346
+ )}
1347
+ </div>
1348
+ </li>
1349
+ ))}
1350
+ </ul>
1351
+ </div>
1352
+ {execution.failureReason && (
1353
+ <div className="rounded-2xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700 dark:border-rose-500/40 dark:bg-rose-900/20 dark:text-rose-200">
1354
+ <p className="font-semibold">Failure reason</p>
1355
+ <p>{execution.failureReason}</p>
1356
+ </div>
1357
+ )}
1358
+ {execution.abandonedReason && (
1359
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 text-sm text-slate-700 dark:border-slate-700 dark:bg-slate-900/60 dark:text-slate-200">
1360
+ <p className="font-semibold">Abandoned reason</p>
1361
+ <p>{execution.abandonedReason}</p>
1362
+ </div>
1363
+ )}
1364
+ <div className="grid gap-4 md:grid-cols-2">
1365
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1366
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1367
+ Participants
1368
+ </h4>
1369
+ <div className="mt-3 space-y-2">
1370
+ {execution.participants.map((participant) => (
1371
+ <div
1372
+ key={participant.id}
1373
+ className="flex items-center justify-between rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm text-slate-600 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"
1374
+ >
1375
+ <span>{participant.name}</span>
1376
+ <span className="text-xs text-slate-500 dark:text-slate-400">
1377
+ {participant.role}
1378
+ </span>
1379
+ </div>
1380
+ ))}
1381
+ </div>
1382
+ </div>
1383
+ <div className="rounded-2xl border border-slate-200 bg-slate-50 p-4 dark:border-slate-700 dark:bg-slate-900/60">
1384
+ <h4 className="text-sm font-semibold tracking-wide text-slate-500 uppercase dark:text-slate-400">
1385
+ State snapshot
1386
+ </h4>
1387
+ <dl className="mt-3 grid grid-cols-2 gap-3 text-sm text-slate-600 dark:text-slate-300">
1388
+ <div>
1389
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1390
+ Estimated completion
1391
+ </dt>
1392
+ <dd>In 2 days</dd>
1393
+ </div>
1394
+ <div>
1395
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1396
+ SLA target
1397
+ </dt>
1398
+ <dd>Oct 16, 18:00</dd>
1399
+ </div>
1400
+ <div>
1401
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1402
+ Current form
1403
+ </dt>
1404
+ <dd>IT account setup</dd>
1405
+ </div>
1406
+ <div>
1407
+ <dt className="text-xs tracking-wide text-slate-400 uppercase dark:text-slate-500">
1408
+ Pending approvals
1409
+ </dt>
1410
+ <dd>1 manager</dd>
1411
+ </div>
1412
+ </dl>
1413
+ </div>
1414
+ </div>
1415
+ </div>
1416
+ )
1417
+ }
1418
+
1419
+ function MockExecutionKanban({ executions }: { executions: Execution[] }) {
1420
+ const columns: { title: string; statuses: Execution["status"][] }[] = [
1421
+ { title: "Running", statuses: ["Running", "Paused"] },
1422
+ { title: "Completed", statuses: ["Completed"] },
1423
+ { title: "Failed", statuses: ["Failed"] },
1424
+ ]
1425
+
1426
+ return (
1427
+ <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
1428
+ {columns.map((column) => (
1429
+ <div
1430
+ key={column.title}
1431
+ className="rounded-2xl border border-slate-200 bg-white p-4 shadow-sm dark:border-slate-800 dark:bg-slate-900/70"
1432
+ >
1433
+ <div className="flex items-center justify-between">
1434
+ <h4 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1435
+ {column.title}
1436
+ </h4>
1437
+ <span className="rounded-full bg-slate-200 px-2 py-0.5 text-xs font-semibold text-slate-600 dark:bg-slate-800 dark:text-slate-300">
1438
+ {
1439
+ executions.filter((exec) =>
1440
+ column.statuses.includes(exec.status),
1441
+ ).length
1442
+ }
1443
+ </span>
1444
+ </div>
1445
+ <div className="mt-3 space-y-3">
1446
+ {executions
1447
+ .filter((exec) => column.statuses.includes(exec.status))
1448
+ .map((exec) => (
1449
+ <div
1450
+ key={exec.id}
1451
+ className="rounded-2xl border border-slate-200 bg-slate-50/60 p-3 text-sm text-slate-600 shadow-sm dark:border-slate-700 dark:bg-slate-900/60 dark:text-slate-300"
1452
+ >
1453
+ <div className="flex items-center justify-between">
1454
+ <p className="font-semibold text-slate-900 dark:text-slate-100">
1455
+ {exec.processName} {exec.executionId}
1456
+ </p>
1457
+ <span
1458
+ className={cn(
1459
+ "inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold",
1460
+ mockExecutionStatusTheme[exec.status],
1461
+ )}
1462
+ >
1463
+ {exec.status}
1464
+ </span>
1465
+ </div>
1466
+ <p className="text-xs text-slate-500 dark:text-slate-400">
1467
+ {exec.progress}
1468
+ </p>
1469
+ <div className="mt-2 flex items-center justify-between text-[11px] text-slate-500 dark:text-slate-400">
1470
+ <span>{exec.startDate}</span>
1471
+ <span>{exec.lastActivity}</span>
1472
+ </div>
1473
+ </div>
1474
+ ))}
1475
+ {executions.filter((exec) => column.statuses.includes(exec.status))
1476
+ .length === 0 && (
1477
+ <div className="rounded-xl border border-dashed border-slate-300 p-4 text-center text-sm text-slate-500 dark:border-slate-700 dark:text-slate-400">
1478
+ No executions here yet
1479
+ </div>
1480
+ )}
1481
+ </div>
1482
+ </div>
1483
+ ))}
1484
+ </div>
1485
+ )
1486
+ }
1487
+
1488
+ // =============================================================================
1489
+ // SHARED COMPONENTS
1490
+ // =============================================================================
1491
+
1492
+ export function ExecutionsPageContent({
1493
+ initialSelectedExecutionId = null,
1494
+ onMobileBack,
1495
+ }: {
1496
+ initialSelectedExecutionId?: string | null
1497
+ onMobileBack?: () => void
1498
+ }) {
1499
+ "use memo"
1500
+
1501
+ const { collectionPromise } = useExecutionCollection()
1502
+ const { showMocks } = useMocks()
1503
+ const isMobile = useIsMobile()
1504
+ const showMocksSection = !isMobile || initialSelectedExecutionId === null
1505
+
1506
+ return (
1507
+ <div className="flex-1 space-y-8 overflow-y-auto">
1508
+ <Suspense fallback={<ExecutionsSkeleton />}>
1509
+ <ExecutionsPageInner
1510
+ collectionPromise={collectionPromise}
1511
+ initialSelectedExecutionId={initialSelectedExecutionId}
1512
+ {...(onMobileBack ? { onMobileBack } : {})}
1513
+ />
1514
+ </Suspense>
1515
+ {showMocks && showMocksSection && <MockExecutionsSection />}
1516
+ </div>
1517
+ )
1518
+ }
1519
+
1520
+ export default function ExecutionsPage() {
1521
+ return <ExecutionsPageContent />
1522
+ }
1523
+
1524
+ function EmptyState({
1525
+ title,
1526
+ description,
1527
+ }: {
1528
+ title: string
1529
+ description: string
1530
+ }) {
1531
+ "use memo"
1532
+
1533
+ return (
1534
+ <div className="col-span-full flex flex-col items-center justify-center rounded-3xl border border-dashed border-slate-300 bg-white/60 p-12 text-center dark:border-slate-700 dark:bg-slate-900/40">
1535
+ <h3 className="text-lg font-semibold text-slate-900 dark:text-slate-100">
1536
+ {title}
1537
+ </h3>
1538
+ <p className="mt-2 max-w-md text-sm text-slate-500 dark:text-slate-400">
1539
+ {description}
1540
+ </p>
1541
+ <Link
1542
+ href="/processes"
1543
+ className="mt-5 rounded-full bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500"
1544
+ >
1545
+ Browse processes
1546
+ </Link>
1547
+ </div>
1548
+ )
1549
+ }