@processfocus/runtime-local 0.1.0-next.2 → 0.1.0-next.3
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.
- package/README.md +48 -253
- package/dist/authentication-server.mjs +52 -84
- package/dist/{chunk-yhzbn4vx.js → chunk-04r0t2mb.js} +34324 -49067
- package/dist/chunk-727y6qkb.js +156 -0
- package/dist/chunk-bg5r4wpv.js +4755 -0
- package/dist/chunk-cbd36jq1.js +512 -0
- package/dist/chunk-d4ctj079.js +241 -0
- package/dist/{chunk-352j1ayk.js → chunk-r5s2v669.js} +51753 -36263
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +12 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +31 -21
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +1 -12
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/client-layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/executions-client.tsx +1637 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +5 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +4 -1589
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +41 -33
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +11 -17
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +145 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +10 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +29 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +22 -28
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-load-error.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-schema-form.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +4 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +45 -142
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +10 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-process-dialog.tsx +72 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh-provider.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +162 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +4 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +4 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +15 -18
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +12 -6
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +7 -16
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +26 -48
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +4 -7
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client-layout.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +1 -3
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +193 -117
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +7 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +60 -204
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +12 -51
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +27 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +5 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +0 -5
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +26 -19
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +5 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +85 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +12 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +66 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +41 -13
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +442 -365
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +8 -2
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +61 -43
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +6 -67
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +111 -189
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-page.tsx +86 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +141 -256
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +2 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/page.tsx +7 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +6 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +30 -9
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/client.tsx +2 -4
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +47 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +37 -54
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +1 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +3 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/default.tsx +6 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +4 -25
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +4 -1315
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/to-dos-client.tsx +1282 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +81 -65
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +8 -2
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +10 -5
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +0 -1
- package/dist/dashboard-source/apps/frontend/app/api/auth/revalidate-google/route.ts +68 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +1 -3
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +25 -7
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +1 -2
- package/dist/dashboard-source/apps/frontend/app/api/public/start/[address]/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +4 -3
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +15 -4
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +11 -4
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +2 -1
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +31 -18
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +4 -4
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +11 -6
- package/dist/dashboard-source/apps/frontend/app/login/passkey-help/page.tsx +67 -0
- package/dist/dashboard-source/apps/frontend/app/mcp/[[...endpoint]]/route.ts +47 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +44 -25
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/form/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/layout.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-client.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page-content.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/public/start/[address]/page.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +1 -1
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +9 -15
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +4 -8
- package/dist/dashboard-source/apps/frontend/components/anonymous-page-link.tsx +57 -0
- package/dist/dashboard-source/apps/frontend/components/anonymous-start-form.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +21 -7
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +12 -7
- package/dist/dashboard-source/apps/frontend/components/browser-only.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +24 -13
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +22 -2
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +52 -45
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +38 -11
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +26 -15
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +0 -1
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +21 -10
- package/dist/dashboard-source/apps/frontend/hooks/use-process-draft.ts +173 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-form-values.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/anonymous-page-server.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +9 -3
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +7 -340
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +9 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/google-revalidation.ts +111 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +28 -30
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +4 -4
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +11 -7
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +27 -10
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -9
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +25 -3
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +112 -21
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +1 -8
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +6 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +8 -2
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +16 -4
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/navigation.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/page-runtime.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +18 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +1 -1
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +19 -23
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +9 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +12 -12
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +20 -18
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +32 -16
- package/dist/dashboard-source/apps/frontend/lib/embed-form-server.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +10 -103
- package/dist/dashboard-source/apps/frontend/lib/forms/invitation.ts +43 -0
- package/dist/dashboard-source/apps/frontend/lib/forms/provider-user.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-form-loaders.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +1 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +123 -33
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +169 -30
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/anonymous-page.ts +27 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +34 -29
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +82 -10
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +2 -5
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +25 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +11 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +13 -104
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +11 -4
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +1 -3
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/list-detail-selection.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/executions.ts +110 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/list-writes.ts +395 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/lists.ts +263 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/oauth.ts +900 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/origin.ts +42 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/processes.ts +436 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/read-tool.ts +72 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/result.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/server.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/store.ts +193 -0
- package/dist/dashboard-source/apps/frontend/lib/mcp/todos.ts +237 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +0 -5
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +0 -2
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +6 -4
- package/dist/dashboard-source/apps/frontend/lib/organisation-form-loaders.ts +4 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +39 -139
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +17 -16
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +0 -1
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +1 -77
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +3 -7
- package/dist/dashboard-source/apps/frontend/next.config.ts +33 -13
- package/dist/dashboard-source/apps/frontend/package.json +48 -47
- package/dist/dashboard-source/apps/frontend/proxy.ts +72 -14
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +0 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +165 -233
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +4 -3
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +111 -75
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +14 -18
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +1 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +19 -37
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +33 -29
- package/dist/dashboard-source/modules/auth-policy/src/lib/policy-revision.ts +23 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +24 -49
- package/dist/dashboard-source/modules/auth-session/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/project-subscription.ts +13 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +10 -2
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +82 -8
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-access.ts +48 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/workload-audit.ts +52 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +0 -1
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +6 -9
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +5 -3
- package/dist/dashboard-source/modules/form/src/index.ts +1 -10
- package/dist/dashboard-source/modules/form/src/lib/effect-schema-form.tsx +1271 -0
- package/dist/dashboard-source/modules/form/src/lib/form-actions.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/form-prefill.tsx +79 -0
- package/dist/dashboard-source/modules/form/src/lib/initial-focus.ts +31 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +18 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +4 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-scripts.ts +26 -0
- package/dist/dashboard-source/modules/form/src/lib/registered-plugin-field.tsx +57 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-lookup.tsx +124 -0
- package/dist/dashboard-source/modules/form/src/lib/schema-typeahead.tsx +522 -0
- package/dist/dashboard-source/modules/form/src/lib/validation-logic.ts +172 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +4 -1
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +19 -14
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +13 -11
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +15 -13
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +14 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-presentation.ts +33 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +186 -80
- package/dist/dashboard-source/modules/form-schema/src/lib/number-from-string.ts +26 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +8 -7
- package/dist/dashboard-source/modules/form-schema/src/lib/public-completion-correction.ts +7 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/search-lookup-items.ts +27 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/index.ts +5 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/executable-rules.ts +379 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/form-submission-schema.ts +475 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/json-schema.ts +58 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/schema-defaults.ts +158 -0
- package/dist/dashboard-source/modules/form-submission-schema/src/lib/submission-utils.ts +75 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +46 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +37 -30
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +9 -1
- package/dist/dashboard-source/modules/openauth/src/client.ts +25 -17
- package/dist/dashboard-source/modules/openauth/src/util.ts +16 -0
- package/dist/dashboard-source/modules/{aws-common/src/lib/project-balance-admission.ts → project-accounting/src/admission.ts} +4 -8
- package/dist/dashboard-source/modules/realtime-client/src/appsync-client.ts +377 -0
- package/dist/dashboard-source/modules/realtime-client/src/index.ts +5 -0
- package/dist/dashboard-source/modules/realtime-client/src/subscription-presence.ts +163 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +6 -24
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +28 -21
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +25 -18
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +60 -10
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +18 -2
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-calendar.tsx +93 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +147 -48
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-time-display.tsx +272 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/local-date-time-input.tsx +108 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +237 -351
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +2 -1
- package/dist/dashboard-source.json +48 -47
- package/dist/graphql-server.mjs +245 -200
- package/dist/job-worker-supervisor.mjs +262 -0
- package/dist/job-worker.mjs +234 -133
- package/dist/main.mjs +23 -4
- package/dist/prepare-dashboard.mjs +8 -8
- package/dist/resources/cedar/policies.cedar +80 -38
- package/dist/resources/cedar/schema.cedarschema +39 -21
- package/dist/resources/graphql-schema/rxdb.graphql +2 -0
- package/dist/resources/graphql-schema/system.graphql +190 -51
- package/package.json +64 -62
- package/dist/chunk-6ntmymmx.js +0 -85
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +0 -20
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +0 -105
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +0 -189
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +0 -79
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +0 -56
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +0 -152
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +0 -1421
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +0 -85
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +0 -1549
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +0 -440
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +0 -13
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +0 -336
- package/dist/dashboard-source/modules/form-rule/src/index.ts +0 -21
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +0 -531
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +0 -102
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +0 -121
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +0 -45
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useRouter } from "next/navigation"
|
|
4
|
+
import {
|
|
5
|
+
type ReactNode,
|
|
6
|
+
createContext,
|
|
7
|
+
use,
|
|
8
|
+
useEffect,
|
|
9
|
+
useMemo,
|
|
10
|
+
useRef,
|
|
11
|
+
useState,
|
|
12
|
+
} from "react"
|
|
13
|
+
import { LookupProvider, type LookupService } from "../../../../../../modules/form/src/index.ts"
|
|
14
|
+
import { AnonymousStartForm } from "@/components/anonymous-start-form"
|
|
15
|
+
import type { AnonymousPageData } from "@/lib/anonymous-page-server"
|
|
16
|
+
|
|
17
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
18
|
+
typeof value === "object" && value !== null && !Array.isArray(value)
|
|
19
|
+
|
|
20
|
+
function usePageSession() {
|
|
21
|
+
const [revision, setRevision] = useState(0)
|
|
22
|
+
const [message, setMessage] = useState("")
|
|
23
|
+
const [completed, setCompleted] = useState(false)
|
|
24
|
+
const [showSuccess, setShowSuccess] = useState(false)
|
|
25
|
+
const [isSubmitting, setIsSubmitting] = useState(false)
|
|
26
|
+
const activeSubmission = useRef(false)
|
|
27
|
+
const openedVisit = useRef<string | null>(null)
|
|
28
|
+
return {
|
|
29
|
+
revision,
|
|
30
|
+
setRevision,
|
|
31
|
+
message,
|
|
32
|
+
setMessage,
|
|
33
|
+
completed,
|
|
34
|
+
setCompleted,
|
|
35
|
+
showSuccess,
|
|
36
|
+
setShowSuccess,
|
|
37
|
+
isSubmitting,
|
|
38
|
+
setIsSubmitting,
|
|
39
|
+
activeSubmission,
|
|
40
|
+
openedVisit,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const PageSession = createContext<ReturnType<typeof usePageSession> | null>(
|
|
45
|
+
null,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
// This layout-owned state survives form unmount/Activity cleanup on browser Back.
|
|
49
|
+
export function AnonymousPageSession({ children }: { children: ReactNode }) {
|
|
50
|
+
const session = usePageSession()
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!session.showSuccess) return
|
|
53
|
+
const timeout = window.setTimeout(() => session.setShowSuccess(false), 5000)
|
|
54
|
+
return () => window.clearTimeout(timeout)
|
|
55
|
+
}, [session.showSuccess, session.setShowSuccess])
|
|
56
|
+
return <PageSession value={session}>{children}</PageSession>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function AnonymousPageClient({
|
|
60
|
+
address,
|
|
61
|
+
page,
|
|
62
|
+
routeView,
|
|
63
|
+
}: {
|
|
64
|
+
address: string
|
|
65
|
+
page: AnonymousPageData
|
|
66
|
+
routeView: "start" | "form"
|
|
67
|
+
}) {
|
|
68
|
+
const session = use(PageSession)
|
|
69
|
+
if (!session) throw new Error("Anonymous Page session is missing")
|
|
70
|
+
const {
|
|
71
|
+
revision,
|
|
72
|
+
setRevision,
|
|
73
|
+
message,
|
|
74
|
+
setMessage,
|
|
75
|
+
completed,
|
|
76
|
+
setCompleted,
|
|
77
|
+
showSuccess,
|
|
78
|
+
setShowSuccess,
|
|
79
|
+
isSubmitting,
|
|
80
|
+
setIsSubmitting,
|
|
81
|
+
activeSubmission,
|
|
82
|
+
openedVisit,
|
|
83
|
+
} = session
|
|
84
|
+
const router = useRouter()
|
|
85
|
+
const startPath = `/public/start/${encodeURIComponent(address)}`
|
|
86
|
+
const view = completed ? "complete" : routeView
|
|
87
|
+
const startButton = useRef<HTMLButtonElement>(null)
|
|
88
|
+
const formHeading = useRef<HTMLHeadingElement>(null)
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (isSubmitting) return
|
|
92
|
+
if (view === "form") formHeading.current?.focus()
|
|
93
|
+
else if (view === "start") startButton.current?.focus()
|
|
94
|
+
}, [view, isSubmitting])
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (view === "start" && showSuccess) {
|
|
98
|
+
window.scrollTo({ top: 0, left: 0, behavior: "instant" })
|
|
99
|
+
}
|
|
100
|
+
}, [view, showSuccess])
|
|
101
|
+
|
|
102
|
+
const endpoint = `/api/public/start/${encodeURIComponent(address)}`
|
|
103
|
+
const draftId = `anonymous-page-${page.stepPath}`
|
|
104
|
+
|
|
105
|
+
function returnToStart() {
|
|
106
|
+
setMessage("")
|
|
107
|
+
setShowSuccess(false)
|
|
108
|
+
localStorage.removeItem(draftId)
|
|
109
|
+
if (
|
|
110
|
+
openedVisit.current === window.location.search &&
|
|
111
|
+
openedVisit.current !== null
|
|
112
|
+
) {
|
|
113
|
+
router.back()
|
|
114
|
+
} else {
|
|
115
|
+
router.replace(startPath)
|
|
116
|
+
}
|
|
117
|
+
openedVisit.current = null
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const lookup = useMemo<LookupService>(() => {
|
|
121
|
+
// Refresh choices after a rejection while retaining field-addressable errors.
|
|
122
|
+
void revision
|
|
123
|
+
const request = async (
|
|
124
|
+
field: string,
|
|
125
|
+
filter: string,
|
|
126
|
+
limit: number,
|
|
127
|
+
selectedValue?: string,
|
|
128
|
+
) => {
|
|
129
|
+
const response = await fetch(endpoint, {
|
|
130
|
+
method: "POST",
|
|
131
|
+
headers: { "Content-Type": "application/json" },
|
|
132
|
+
body: JSON.stringify({
|
|
133
|
+
action: "lookup",
|
|
134
|
+
field,
|
|
135
|
+
filter,
|
|
136
|
+
limit,
|
|
137
|
+
selectedValue,
|
|
138
|
+
}),
|
|
139
|
+
})
|
|
140
|
+
const body: unknown = await response.json()
|
|
141
|
+
if (!response.ok || !isRecord(body) || !Array.isArray(body["items"]))
|
|
142
|
+
throw new Error("Unable to load choices. Please try again.")
|
|
143
|
+
return body["items"].flatMap((item: unknown) =>
|
|
144
|
+
isRecord(item) &&
|
|
145
|
+
typeof item["value"] === "string" &&
|
|
146
|
+
typeof item["label"] === "string"
|
|
147
|
+
? [
|
|
148
|
+
{
|
|
149
|
+
value: item["value"],
|
|
150
|
+
label: item["label"],
|
|
151
|
+
...(typeof item["searchText"] === "string" && {
|
|
152
|
+
searchText: item["searchText"],
|
|
153
|
+
}),
|
|
154
|
+
},
|
|
155
|
+
]
|
|
156
|
+
: [],
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
fetchSuggestions: async (_stepPath, field, filter, limit) =>
|
|
161
|
+
request(field, filter, limit),
|
|
162
|
+
resolveSelection: async (_stepPath, field, value) =>
|
|
163
|
+
(await request(field, "", 1, value))[0] ?? null,
|
|
164
|
+
search: async (_stepPath, field, filter, requestedLimit) => {
|
|
165
|
+
const limit = Math.max(1, Math.min(requestedLimit, 99))
|
|
166
|
+
const items = await request(field, filter, limit + 1)
|
|
167
|
+
return { items: items.slice(0, limit), hasMore: items.length > limit }
|
|
168
|
+
},
|
|
169
|
+
fetchCalendarSlots: async () => {
|
|
170
|
+
throw new Error("Calendar slots are not available on this page")
|
|
171
|
+
},
|
|
172
|
+
fetchDependentSuggestions: async () => {
|
|
173
|
+
throw new Error("Dependent lookups are not available on this page")
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
}, [endpoint, revision])
|
|
177
|
+
|
|
178
|
+
async function handleSubmit(values: Record<string, unknown>) {
|
|
179
|
+
if (activeSubmission.current) {
|
|
180
|
+
return [{ field: "", message: "A submission is already in progress." }]
|
|
181
|
+
}
|
|
182
|
+
activeSubmission.current = true
|
|
183
|
+
setIsSubmitting(true)
|
|
184
|
+
try {
|
|
185
|
+
const response = await fetch(endpoint, {
|
|
186
|
+
method: "POST",
|
|
187
|
+
headers: { "Content-Type": "application/json" },
|
|
188
|
+
body: JSON.stringify({ action: "submit", values }),
|
|
189
|
+
})
|
|
190
|
+
const body: unknown = await response.json()
|
|
191
|
+
if (!response.ok) {
|
|
192
|
+
const errors =
|
|
193
|
+
isRecord(body) && Array.isArray(body["errors"]) ? body["errors"] : []
|
|
194
|
+
const fieldErrors = errors.flatMap((error: unknown) =>
|
|
195
|
+
isRecord(error) &&
|
|
196
|
+
typeof error["field"] === "string" &&
|
|
197
|
+
typeof error["message"] === "string"
|
|
198
|
+
? [{ field: error["field"], message: error["message"] }]
|
|
199
|
+
: [],
|
|
200
|
+
)
|
|
201
|
+
setMessage("")
|
|
202
|
+
setRevision((value) => value + 1)
|
|
203
|
+
return fieldErrors.length
|
|
204
|
+
? fieldErrors
|
|
205
|
+
: [{ field: "", message: "Unable to submit. Please try again." }]
|
|
206
|
+
} else {
|
|
207
|
+
setMessage("")
|
|
208
|
+
setCompleted(page.afterSubmit !== "restart")
|
|
209
|
+
router.replace(startPath)
|
|
210
|
+
openedVisit.current = null
|
|
211
|
+
setShowSuccess(page.afterSubmit === "restart")
|
|
212
|
+
}
|
|
213
|
+
// Clear the successful draft and refresh choices for the next visit.
|
|
214
|
+
localStorage.removeItem(draftId)
|
|
215
|
+
setRevision((value) => value + 1)
|
|
216
|
+
} catch {
|
|
217
|
+
if (window.location.pathname === `${startPath}/form`) {
|
|
218
|
+
return [{ field: "", message: "Unable to submit. Please try again." }]
|
|
219
|
+
}
|
|
220
|
+
setMessage("Unable to submit. Please try again.")
|
|
221
|
+
} finally {
|
|
222
|
+
activeSubmission.current = false
|
|
223
|
+
setIsSubmitting(false)
|
|
224
|
+
}
|
|
225
|
+
return undefined
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<>
|
|
230
|
+
{view === "start" ? (
|
|
231
|
+
<button
|
|
232
|
+
ref={startButton}
|
|
233
|
+
type="button"
|
|
234
|
+
disabled={isSubmitting}
|
|
235
|
+
onClick={() => {
|
|
236
|
+
setShowSuccess(false)
|
|
237
|
+
setMessage("")
|
|
238
|
+
// router.push does not prefetch. A new search key on every opening
|
|
239
|
+
// also bypasses already visited route data, including after Back.
|
|
240
|
+
const visit = `?visit=${crypto.randomUUID()}`
|
|
241
|
+
openedVisit.current = visit
|
|
242
|
+
router.push(`${startPath}/form${visit}`)
|
|
243
|
+
}}
|
|
244
|
+
className="rounded-md bg-primary px-6 py-3 text-xl font-semibold text-primary-foreground shadow-sm transition-colors hover:bg-primary/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
245
|
+
>
|
|
246
|
+
{isSubmitting ? "Submitting…" : page.name}
|
|
247
|
+
</button>
|
|
248
|
+
) : (
|
|
249
|
+
<h1
|
|
250
|
+
ref={formHeading}
|
|
251
|
+
tabIndex={-1}
|
|
252
|
+
className="mb-6 text-2xl font-semibold"
|
|
253
|
+
>
|
|
254
|
+
{page.name}
|
|
255
|
+
</h1>
|
|
256
|
+
)}
|
|
257
|
+
<div role="status" aria-live="polite" aria-atomic="true">
|
|
258
|
+
{showSuccess ? (
|
|
259
|
+
<p className="fixed right-4 bottom-4 left-4 z-50 rounded-md border border-green-300 bg-green-50 px-6 py-4 text-green-950 shadow-lg sm:left-auto">
|
|
260
|
+
Submitted successfully.
|
|
261
|
+
</p>
|
|
262
|
+
) : null}
|
|
263
|
+
</div>
|
|
264
|
+
{view === "complete" ? <p>Submitted successfully.</p> : null}
|
|
265
|
+
{message ? (
|
|
266
|
+
<p role="status" className="mb-4">
|
|
267
|
+
{message}
|
|
268
|
+
</p>
|
|
269
|
+
) : null}
|
|
270
|
+
{view === "form" ? (
|
|
271
|
+
<fieldset disabled={isSubmitting} aria-busy={isSubmitting}>
|
|
272
|
+
<LookupProvider value={lookup}>
|
|
273
|
+
<AnonymousStartForm
|
|
274
|
+
formPath={page.formPath}
|
|
275
|
+
draftId={draftId}
|
|
276
|
+
defaultValues={page.defaultValues}
|
|
277
|
+
requestData={page.requestData}
|
|
278
|
+
pluginConfiguration={page.pluginConfiguration}
|
|
279
|
+
stepPath={page.stepPath}
|
|
280
|
+
onSubmit={handleSubmit}
|
|
281
|
+
>
|
|
282
|
+
{({ formState }) => (
|
|
283
|
+
<div className="flex flex-wrap items-center justify-between gap-3">
|
|
284
|
+
<button
|
|
285
|
+
type="button"
|
|
286
|
+
disabled={isSubmitting || formState.isSubmitting}
|
|
287
|
+
onClick={returnToStart}
|
|
288
|
+
className="rounded-md border border-input bg-background px-6 py-3 text-foreground transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
289
|
+
>
|
|
290
|
+
Back
|
|
291
|
+
</button>
|
|
292
|
+
<div className="ml-auto flex flex-wrap justify-end gap-3">
|
|
293
|
+
<button
|
|
294
|
+
type="button"
|
|
295
|
+
disabled={isSubmitting || formState.isSubmitting}
|
|
296
|
+
onClick={returnToStart}
|
|
297
|
+
className="rounded-md border border-input bg-background px-6 py-3 text-foreground transition-colors hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
298
|
+
>
|
|
299
|
+
Cancel
|
|
300
|
+
</button>
|
|
301
|
+
<button
|
|
302
|
+
type="submit"
|
|
303
|
+
disabled={isSubmitting || formState.isSubmitting}
|
|
304
|
+
className="rounded-md bg-primary px-6 py-3 text-primary-foreground shadow-sm transition-colors hover:bg-primary/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50"
|
|
305
|
+
>
|
|
306
|
+
{isSubmitting || formState.isSubmitting
|
|
307
|
+
? "Submitting…"
|
|
308
|
+
: "Submit"}
|
|
309
|
+
</button>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
)}
|
|
313
|
+
</AnonymousStartForm>
|
|
314
|
+
</LookupProvider>
|
|
315
|
+
</fieldset>
|
|
316
|
+
) : null}
|
|
317
|
+
</>
|
|
318
|
+
)
|
|
319
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ClientError } from "graphql-request"
|
|
2
|
+
import { notFound, redirect } from "next/navigation"
|
|
3
|
+
import { AnonymousPageClient } from "./page-client.tsx"
|
|
4
|
+
import { fetchAnonymousPage } from "@/lib/anonymous-page-server"
|
|
5
|
+
|
|
6
|
+
export type AnonymousRouteProps = {
|
|
7
|
+
params: Promise<{ address: string }>
|
|
8
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function AnonymousPageContent({
|
|
12
|
+
params,
|
|
13
|
+
searchParams,
|
|
14
|
+
view,
|
|
15
|
+
}: AnonymousRouteProps & { view: "start" | "form" }) {
|
|
16
|
+
const { address } = await params
|
|
17
|
+
// Consume searchParams: each button activation has its own visit key, so a
|
|
18
|
+
// previously visited form cannot satisfy this navigation from the client cache.
|
|
19
|
+
const query = await searchParams
|
|
20
|
+
if (view === "start" && query["view"] === "form") {
|
|
21
|
+
redirect(`/public/start/${encodeURIComponent(address)}/form`)
|
|
22
|
+
}
|
|
23
|
+
const page = await fetchAnonymousPage(address).catch((error: unknown) => {
|
|
24
|
+
if (
|
|
25
|
+
error instanceof ClientError &&
|
|
26
|
+
error.response.errors?.some(
|
|
27
|
+
(item) => item.extensions?.["code"] === "NotAuthorized",
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
notFound()
|
|
31
|
+
throw error
|
|
32
|
+
})
|
|
33
|
+
return (
|
|
34
|
+
<AnonymousPageClient
|
|
35
|
+
key={typeof query["visit"] === "string" ? query["visit"] : view}
|
|
36
|
+
address={address}
|
|
37
|
+
page={page}
|
|
38
|
+
routeView={view}
|
|
39
|
+
/>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Suspense } from "react"
|
|
2
|
+
import { AnonymousPageContent, type AnonymousRouteProps } from "./page-content.tsx"
|
|
3
|
+
|
|
4
|
+
export default function AnonymousPage(props: AnonymousRouteProps) {
|
|
5
|
+
return (
|
|
6
|
+
<Suspense fallback={<p>Loading form…</p>}>
|
|
7
|
+
<AnonymousPageContent {...props} view="start" />
|
|
8
|
+
</Suspense>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* starts using a new shared component file, add that file here or Tailwind may
|
|
16
16
|
* purge its classes from the production public CSS.
|
|
17
17
|
*/
|
|
18
|
-
@source "../../../modules/form/src/lib/
|
|
18
|
+
@source "../../../modules/form/src/lib/effect-schema-form.tsx";
|
|
19
19
|
@source "../../../modules/form/src/lib/walker.tsx";
|
|
20
20
|
@source "../../../modules/shadcn-components/src/lib/boolean-field.tsx";
|
|
21
21
|
@source "../../../modules/shadcn-components/src/lib/field-set.tsx";
|
package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx
CHANGED
|
@@ -206,6 +206,20 @@ export function RegisterPasskeyClient({
|
|
|
206
206
|
// Application home only — never a caller-controlled target.
|
|
207
207
|
window.location.href = verifyData.redirectUrl || "/"
|
|
208
208
|
} catch (err) {
|
|
209
|
+
if (
|
|
210
|
+
err instanceof Error &&
|
|
211
|
+
(err.name === "InvalidStateError" ||
|
|
212
|
+
("code" in err &&
|
|
213
|
+
err.code === "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED"))
|
|
214
|
+
) {
|
|
215
|
+
setState({
|
|
216
|
+
kind: "error",
|
|
217
|
+
email,
|
|
218
|
+
message:
|
|
219
|
+
"This passkey is already registered to your account. Sign in with it, or try a different passkey.",
|
|
220
|
+
})
|
|
221
|
+
return
|
|
222
|
+
}
|
|
209
223
|
if (err instanceof Error && err.name === "NotAllowedError") {
|
|
210
224
|
setState({
|
|
211
225
|
kind: "error",
|
|
@@ -287,6 +301,9 @@ export function RegisterPasskeyClient({
|
|
|
287
301
|
>
|
|
288
302
|
{state.kind === "registering" ? "Creating passkey…" : "Create passkey"}
|
|
289
303
|
</Button>
|
|
304
|
+
<Button asChild variant="outline" className="w-full">
|
|
305
|
+
<a href="/login">Back to sign in</a>
|
|
306
|
+
</Button>
|
|
290
307
|
</div>
|
|
291
308
|
)
|
|
292
309
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateTimeDisplay } from "../../../modules/shadcn-components/src/lib/date-time-display.tsx"
|
|
1
2
|
import { useMocks } from "./mocks-provider.tsx"
|
|
2
3
|
import type { Execution, SlaBucket, TrendPoint } from "@/lib/mock-data"
|
|
3
4
|
import { cn } from "@/lib/utils"
|
|
@@ -440,20 +441,6 @@ function RoleLoadCard({
|
|
|
440
441
|
)
|
|
441
442
|
}
|
|
442
443
|
|
|
443
|
-
function formatRelativeTime(isoString: string | null | undefined): string {
|
|
444
|
-
if (!isoString) return "—"
|
|
445
|
-
const date = new Date(isoString)
|
|
446
|
-
const now = new Date()
|
|
447
|
-
const diffMs = now.getTime() - date.getTime()
|
|
448
|
-
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
|
|
449
|
-
|
|
450
|
-
if (diffDays === 0) return "Today"
|
|
451
|
-
if (diffDays === 1) return "Yesterday"
|
|
452
|
-
if (diffDays < 7) return `${diffDays} days ago`
|
|
453
|
-
if (diffDays < 30) return `${Math.floor(diffDays / 7)} weeks ago`
|
|
454
|
-
return date.toLocaleDateString()
|
|
455
|
-
}
|
|
456
|
-
|
|
457
444
|
function formatLiveCycleTime(durationMs: number | null | undefined): string {
|
|
458
445
|
if (
|
|
459
446
|
durationMs === null ||
|
|
@@ -580,7 +567,14 @@ function LiveRecentExecutionsTable({
|
|
|
580
567
|
</td>
|
|
581
568
|
<td className="rounded-r-xl px-3 py-3">
|
|
582
569
|
<div className="text-sm text-slate-600 dark:text-slate-300">
|
|
583
|
-
{
|
|
570
|
+
{exec.finishedAt ? (
|
|
571
|
+
<DateTimeDisplay
|
|
572
|
+
kind="timestamp"
|
|
573
|
+
value={exec.finishedAt}
|
|
574
|
+
/>
|
|
575
|
+
) : (
|
|
576
|
+
"Not finished"
|
|
577
|
+
)}
|
|
584
578
|
</div>
|
|
585
579
|
</td>
|
|
586
580
|
</tr>
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import Image from "next/image"
|
|
16
16
|
import Link from "next/link"
|
|
17
17
|
import { useEffect, useState } from "react"
|
|
18
|
-
import {
|
|
18
|
+
import { DelegationExpiryMenuItem } from "./delegation-expiry.tsx"
|
|
19
19
|
import { useMocks } from "./mocks-provider.tsx"
|
|
20
20
|
import { NotificationBell } from "./notification-bell.tsx"
|
|
21
21
|
import { listDelegations } from "@/app/(protected)/act-on-behalf/actions"
|
|
@@ -168,8 +168,8 @@ export const navigation: ShellNavigationItem[] = [
|
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
id: "settings",
|
|
171
|
-
label: "
|
|
172
|
-
description: "
|
|
171
|
+
label: "Users & Sign-in",
|
|
172
|
+
description: "Manage users, invitations, roles, and sign-in providers.",
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
id: "authorization",
|
|
@@ -233,12 +233,10 @@ export function Header({
|
|
|
233
233
|
retry: false,
|
|
234
234
|
})
|
|
235
235
|
|
|
236
|
-
// Calculate initials from firstName and lastName
|
|
237
236
|
const initials = providerUser
|
|
238
237
|
? getInitials(providerUser.firstName, providerUser.lastName)
|
|
239
238
|
: "?"
|
|
240
239
|
|
|
241
|
-
// Use provider user data or fallback to default
|
|
242
240
|
const displayName = providerUser?.name ?? "Loading..."
|
|
243
241
|
const delegation = "email" in session ? session.delegation : undefined
|
|
244
242
|
const providerEmail = "email" in session ? session.email : providerUser?.email
|
|
@@ -418,9 +416,7 @@ export function Header({
|
|
|
418
416
|
<Copy className="h-4 w-4 shrink-0" aria-hidden="true" />
|
|
419
417
|
</DropdownMenuItem>
|
|
420
418
|
{delegation && (
|
|
421
|
-
<
|
|
422
|
-
<DelegationExpiry expiresAt={delegation.expiresAt} />
|
|
423
|
-
</div>
|
|
419
|
+
<DelegationExpiryMenuItem expiresAt={delegation.expiresAt} />
|
|
424
420
|
)}
|
|
425
421
|
<DropdownMenuSeparator />
|
|
426
422
|
</>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { QRCodeSVG } from "qrcode.react"
|
|
4
|
+
import { useState } from "react"
|
|
5
|
+
import {
|
|
6
|
+
Button,
|
|
7
|
+
Popover,
|
|
8
|
+
PopoverContent,
|
|
9
|
+
PopoverTrigger,
|
|
10
|
+
} from "../../../modules/shadcn-components/src/index.ts"
|
|
11
|
+
import { CopyButton } from "@/components/copy-button"
|
|
12
|
+
|
|
13
|
+
/** Only rendered from the caller's authorized List metadata. */
|
|
14
|
+
export function AnonymousPageLink({
|
|
15
|
+
name,
|
|
16
|
+
path,
|
|
17
|
+
}: {
|
|
18
|
+
name: string
|
|
19
|
+
path: string
|
|
20
|
+
}) {
|
|
21
|
+
const [address, setAddress] = useState<string | null>(null)
|
|
22
|
+
return (
|
|
23
|
+
<Popover>
|
|
24
|
+
<PopoverTrigger asChild>
|
|
25
|
+
<Button
|
|
26
|
+
size="sm"
|
|
27
|
+
variant="outline"
|
|
28
|
+
onClick={() => setAddress(new URL(path, window.location.origin).href)}
|
|
29
|
+
>
|
|
30
|
+
{name} page QR code
|
|
31
|
+
</Button>
|
|
32
|
+
</PopoverTrigger>
|
|
33
|
+
{address ? (
|
|
34
|
+
<PopoverContent className="w-80 max-w-[calc(100vw-2rem)] space-y-4 p-4">
|
|
35
|
+
<QRCodeSVG
|
|
36
|
+
value={address}
|
|
37
|
+
size={192}
|
|
38
|
+
title={`${name} page`}
|
|
39
|
+
className="mx-auto h-auto max-w-full"
|
|
40
|
+
/>
|
|
41
|
+
<div className="flex items-center gap-2">
|
|
42
|
+
<a
|
|
43
|
+
href={address}
|
|
44
|
+
target="_blank"
|
|
45
|
+
rel="noreferrer"
|
|
46
|
+
title={address}
|
|
47
|
+
className="min-w-0 flex-1 truncate underline"
|
|
48
|
+
>
|
|
49
|
+
{address}
|
|
50
|
+
</a>
|
|
51
|
+
<CopyButton value={address} label={`Copy ${name} page URL`} />
|
|
52
|
+
</div>
|
|
53
|
+
</PopoverContent>
|
|
54
|
+
) : null}
|
|
55
|
+
</Popover>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps } from "react"
|
|
4
|
+
import { Suspense, use } from "react"
|
|
5
|
+
import { EffectSchemaForm } from "../../../modules/form/src/lib/effect-schema-form.tsx"
|
|
6
|
+
import { loadBrowserFormDefinition } from "@/lib/frontend-form-loaders"
|
|
7
|
+
|
|
8
|
+
type Props = Omit<ComponentProps<typeof EffectSchemaForm>, "schema"> & {
|
|
9
|
+
formPath: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function LoadedForm({ formPath, ...props }: Props) {
|
|
13
|
+
const schema = use(loadBrowserFormDefinition(formPath))
|
|
14
|
+
return <EffectSchemaForm {...props} schema={schema} />
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Both anonymous start surfaces use the same lazy organisation artifact and renderer. */
|
|
18
|
+
export function AnonymousStartForm(props: Props) {
|
|
19
|
+
return (
|
|
20
|
+
<Suspense fallback={<p role="status">Loading form…</p>}>
|
|
21
|
+
<LoadedForm {...props} />
|
|
22
|
+
</Suspense>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -11,6 +11,7 @@ import dynamic from "next/dynamic"
|
|
|
11
11
|
import Link from "next/link"
|
|
12
12
|
import { usePathname } from "next/navigation"
|
|
13
13
|
import { Button } from "../../../modules/shadcn-components/src/index.ts"
|
|
14
|
+
import { BrowserOnly } from "@/components/browser-only"
|
|
14
15
|
import {
|
|
15
16
|
Sidebar,
|
|
16
17
|
SidebarContent,
|
|
@@ -56,7 +57,6 @@ interface AppSidebarProps {
|
|
|
56
57
|
showAuthorization: boolean
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
// Menu items.
|
|
60
60
|
const items: Array<{
|
|
61
61
|
id: ShellSectionKey
|
|
62
62
|
title: string
|
|
@@ -97,8 +97,8 @@ const items: Array<{
|
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
id: "settings",
|
|
100
|
-
title: "
|
|
101
|
-
description: "
|
|
100
|
+
title: "Users & Sign-in",
|
|
101
|
+
description: "Manage users, invitations, roles, and sign-in providers.",
|
|
102
102
|
url: "/settings",
|
|
103
103
|
icon: UserCog,
|
|
104
104
|
},
|
|
@@ -135,7 +135,6 @@ export function AppSidebar({
|
|
|
135
135
|
|
|
136
136
|
const handleLogout = () => performClientLogout()
|
|
137
137
|
|
|
138
|
-
// Filter menu items based on permissions
|
|
139
138
|
const visibleItems = items.filter((item) => {
|
|
140
139
|
if (item.id === "settings") return showSettings
|
|
141
140
|
if (item.id === "authorization") return showAuthorization
|
|
@@ -168,6 +167,9 @@ export function AppSidebar({
|
|
|
168
167
|
{visibleItems.map((item) => {
|
|
169
168
|
const isActive =
|
|
170
169
|
pathname === item.url ||
|
|
170
|
+
(item.id === "settings" &&
|
|
171
|
+
pathname.startsWith("/settings/") &&
|
|
172
|
+
!pathname.startsWith("/settings/cedar")) ||
|
|
171
173
|
(item.id === "executions" && isExecutionsPath(pathname)) ||
|
|
172
174
|
(item.id === "authorization" &&
|
|
173
175
|
pathname.startsWith("/settings/cedar/"))
|
|
@@ -215,13 +217,25 @@ export function AppSidebar({
|
|
|
215
217
|
</p>
|
|
216
218
|
</div>
|
|
217
219
|
</div>
|
|
218
|
-
{item.id === "todos" &&
|
|
220
|
+
{item.id === "todos" && (
|
|
221
|
+
<BrowserOnly>
|
|
222
|
+
<TodoCountBadge />
|
|
223
|
+
</BrowserOnly>
|
|
224
|
+
)}
|
|
219
225
|
</div>
|
|
220
226
|
</Link>
|
|
221
227
|
)
|
|
222
228
|
})}
|
|
223
|
-
<
|
|
224
|
-
|
|
229
|
+
<BrowserOnly
|
|
230
|
+
fallback={
|
|
231
|
+
<p role="status" className="px-4 py-3 text-sm text-slate-500">
|
|
232
|
+
Loading navigation…
|
|
233
|
+
</p>
|
|
234
|
+
}
|
|
235
|
+
>
|
|
236
|
+
<SidebarLists />
|
|
237
|
+
<SidebarStatsViews />
|
|
238
|
+
</BrowserOnly>
|
|
225
239
|
</nav>
|
|
226
240
|
</SidebarGroupContent>
|
|
227
241
|
</SidebarGroup>
|