@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.
- package/LICENSE.md +28 -0
- package/README.md +290 -0
- package/dist/authentication-server.mjs +188 -0
- package/dist/chunk-2sb4v2sx.js +70 -0
- package/dist/chunk-9weqs8n8.js +56031 -0
- package/dist/chunk-mvkr77wp.js +54113 -0
- package/dist/chunk-tkn4cnc8.js +453 -0
- package/dist/chunk-vpsm84e8.js +85 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/app-icons/[...path]/route.ts +63 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/health/page.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/%5Fpf/public-form-branding/[...path]/route.ts +95 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/actions.ts +248 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +751 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client-index.tsx +375 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/client.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/client.tsx +73 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/page.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/@modal/(.)[executionId]/process-state/page.tsx +22 -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 +11 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/[executionId]/process-state/page.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/abandon-execution-dialog.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/execution-card-menu.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/layout.tsx +19 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +1549 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-dialog.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-modal-client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-page-client.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/process-state-route-fallback.tsx +18 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/restart-execution-feedback.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/layout.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/client.tsx +215 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/@modal/(.)item/[id]/page.tsx +23 -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 +678 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/page.tsx +228 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-create-form.tsx +147 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/components/list-item-edit-form.tsx +246 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/metric-control-url-state.ts +71 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-deleted-callback.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/hooks/use-list-item-detail.ts +315 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/client.tsx +259 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/item/[id]/page.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-detail-title.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/lib/list-refresh.ts +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/utils.ts +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/loading.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/org-chart-client.tsx +74 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/org-chart/page.tsx +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/page.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/actions.ts +188 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/page.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/passkeys/passkeys-client.tsx +320 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/client.tsx +152 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/(.)start/[...startStepPath]/page.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/@modal/default.tsx +3 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/client.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-form-actions.tsx +105 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/process-submit-button.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/components/start-process-form.tsx +282 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/layout.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/mobile-process-catalog.ts +28 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/lib/start-process-actions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/loading.tsx +10 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/processes-client.tsx +504 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/client.tsx +153 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/start/[...startStepPath]/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/loading.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/page.tsx +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/process-documentation.tsx +209 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/use-workflow-auto-refresh.ts +120 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-flow.tsx +319 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/processes/workflow/[...processPath]/workflow-form-preview-sheet.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/loading.tsx +1 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/[[...tab]]/page.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/access-handbook.tsx +110 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-loading.tsx +25 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/authorization-tabs.tsx +47 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-authorize.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-helpers.ts +17 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-source.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/cedar-types.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/evaluate-cedar.ts +43 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/explorer.tsx +526 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/layout.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-cedar.ts +174 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/load-handbook.ts +390 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/cedar/org-data.ts +70 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/[invitationId]/page.tsx +22 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-client.tsx +594 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/invitation-detail-skeleton.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations/new/page.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/invitations-table.tsx +186 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/page.tsx +69 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/providers-table.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/roles-table.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/settings-client.tsx +244 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/client.tsx +329 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/page.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users/[userId]/tokens/page.tsx +39 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/settings/users-table.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/error.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/not-found.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/page.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/stats/[...statsPath]/stats-data-fetcher.tsx +93 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/client.tsx +143 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/@modal/(.)complete/[...stepPath]/page.tsx +50 -0
- 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 +131 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/complete/[...stepPath]/page.tsx +50 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/complete-todo-form.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/public-completion-correction-form.tsx +233 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/components/todo-form-actions.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/correct/[...stepPath]/page.tsx +58 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/layout.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/lib/mobile-todo-list.ts +154 -0
- package/dist/dashboard-source/apps/frontend/app/(protected)/to-dos/page.tsx +1317 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +259 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +127 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/login/route.ts +49 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/logout/route.ts +33 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-options/route.ts +79 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/auth-verify/route.ts +142 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register/route.ts +103 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/register-verify/route.ts +136 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/registration-session/route.ts +129 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/passkey/start/route.ts +153 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/refresh/route.ts +122 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/switch-role/route.ts +177 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-completed/route.ts +22 -0
- package/dist/dashboard-source/apps/frontend/app/api/dev/import-events/route.ts +38 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/lookup/route.ts +266 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/submit/route.ts +118 -0
- package/dist/dashboard-source/apps/frontend/app/api/embed/test-host/route.ts +125 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/calendar-slots/route.ts +44 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/complete/route.ts +56 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/lookup/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/api/public/to-dos/request-fresh-link/route.ts +41 -0
- package/dist/dashboard-source/apps/frontend/app/api/revalidate/route.ts +61 -0
- package/dist/dashboard-source/apps/frontend/app/app-shell.tsx +100 -0
- package/dist/dashboard-source/apps/frontend/app/cli-auth/route.ts +261 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/embed-client.tsx +393 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/loading.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/app/embed/[...startStepPath]/page.tsx +51 -0
- package/dist/dashboard-source/apps/frontend/app/embed/embedded.css +48 -0
- package/dist/dashboard-source/apps/frontend/app/embed/layout.tsx +15 -0
- package/dist/dashboard-source/apps/frontend/app/global.css +13 -0
- package/dist/dashboard-source/apps/frontend/app/layout.tsx +102 -0
- package/dist/dashboard-source/apps/frontend/app/login/layout.tsx +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-button.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +117 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/app/login/page.tsx +52 -0
- package/dist/dashboard-source/apps/frontend/app/login/passkey-button.tsx +226 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +91 -0
- package/dist/dashboard-source/apps/frontend/app/manifest.ts +7 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/error.tsx +63 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/layout.tsx +34 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/page.tsx +129 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-client.tsx +553 -0
- package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-todo-state-content.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/app/public.css +33 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/layout.tsx +49 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/page.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/app/register/passkey/register-passkey-client.tsx +292 -0
- package/dist/dashboard-source/apps/frontend/app/theme.css +117 -0
- package/dist/dashboard-source/apps/frontend/components/DashboardSection.tsx +693 -0
- package/dist/dashboard-source/apps/frontend/components/Header.tsx +481 -0
- package/dist/dashboard-source/apps/frontend/components/OrgUnitNode.tsx +41 -0
- package/dist/dashboard-source/apps/frontend/components/app-sidebar.tsx +245 -0
- package/dist/dashboard-source/apps/frontend/components/auth-provider.tsx +158 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-card.tsx +218 -0
- package/dist/dashboard-source/apps/frontend/components/collections/collection-table-header-row.tsx +97 -0
- package/dist/dashboard-source/apps/frontend/components/config-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/copy-button.tsx +40 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-activity.tsx +35 -0
- package/dist/dashboard-source/apps/frontend/components/dashboard-skeleton.tsx +17 -0
- package/dist/dashboard-source/apps/frontend/components/delegation-expiry.tsx +21 -0
- package/dist/dashboard-source/apps/frontend/components/feature-permissions-provider.tsx +28 -0
- package/dist/dashboard-source/apps/frontend/components/form-dialog-content.tsx +66 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-host.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-identify.tsx +33 -0
- package/dist/dashboard-source/apps/frontend/components/frontend-client-plugin-provider.tsx +55 -0
- package/dist/dashboard-source/apps/frontend/components/journey-timeline.tsx +378 -0
- package/dist/dashboard-source/apps/frontend/components/mobile-home-switchboard.tsx +98 -0
- package/dist/dashboard-source/apps/frontend/components/mocks-provider.tsx +27 -0
- package/dist/dashboard-source/apps/frontend/components/notification-bell.tsx +137 -0
- package/dist/dashboard-source/apps/frontend/components/org-settings-provider.tsx +26 -0
- package/dist/dashboard-source/apps/frontend/components/process-workflow-link.tsx +36 -0
- package/dist/dashboard-source/apps/frontend/components/session-reissue.tsx +48 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-lists.tsx +89 -0
- package/dist/dashboard-source/apps/frontend/components/sidebar-stats-views.tsx +65 -0
- package/dist/dashboard-source/apps/frontend/components/theme-provider.tsx +132 -0
- package/dist/dashboard-source/apps/frontend/components/todo-count-badge.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/token-refresh-scheduler.tsx +304 -0
- package/dist/dashboard-source/apps/frontend/components/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dialog.tsx +142 -0
- package/dist/dashboard-source/apps/frontend/components/ui/dropdown-menu.tsx +256 -0
- package/dist/dashboard-source/apps/frontend/components/ui/input.tsx +20 -0
- package/dist/dashboard-source/apps/frontend/components/ui/pagination.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sheet.tsx +138 -0
- package/dist/dashboard-source/apps/frontend/components/ui/sidebar.tsx +741 -0
- package/dist/dashboard-source/apps/frontend/components/ui/skeleton.tsx +13 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tab-pill.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/components/ui/table.tsx +115 -0
- package/dist/dashboard-source/apps/frontend/components/ui/tooltip.tsx +60 -0
- package/dist/dashboard-source/apps/frontend/components/without-waiting-badge.tsx +24 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/step-node.tsx +116 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/swimlane-node.tsx +46 -0
- package/dist/dashboard-source/apps/frontend/components/workflow/workflow-edge.tsx +172 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-process-save.ts +189 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-draft-state.ts +79 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-form-metadata.ts +74 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-mobile.ts +27 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-notification-preference.ts +246 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-processes-query.ts +56 -0
- package/dist/dashboard-source/apps/frontend/hooks/use-weekly-execution-stats.ts +101 -0
- package/dist/dashboard-source/apps/frontend/index.d.ts +12 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.node.ts +25 -0
- package/dist/dashboard-source/apps/frontend/instrumentation.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/app-icons-metadata.ts +66 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/adapter.ts +128 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/client.ts +355 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/config.ts +18 -0
- package/dist/dashboard-source/apps/frontend/lib/appsync-events/reconnect-registry.ts +34 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/act-on-behalf-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/callback-error.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client-session.ts +32 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/client.ts +46 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/config.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/delegations.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/issuer.ts +164 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/jwt.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/logout.ts +35 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys-menu.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/passkeys.ts +117 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/providers.ts +52 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/realtime-session-token.ts +62 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/reauthentication-state.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/redirect.ts +105 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/secret-login-presentation.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-cache-scope.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-role.ts +6 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session.ts +277 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/ssr-session.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +95 -0
- package/dist/dashboard-source/apps/frontend/lib/authorization-tabs.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/cedar-highlight.ts +116 -0
- package/dist/dashboard-source/apps/frontend/lib/client-plugin-error-reporting.ts +28 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-factory.tsx +1119 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/collection-provider-scope.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/database-error-ui.tsx +61 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution-collection-provider.tsx +32 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/draft-process-execution.ts +161 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution-collection-provider.tsx +42 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +215 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/graphql-stream.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/process.ts +123 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-factory.ts +394 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/replication-registry.ts +196 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-database-name.ts +19 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-lifecycle.ts +368 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/rxdb-provider.tsx +577 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo-collection-provider.tsx +30 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/todo.ts +133 -0
- package/dist/dashboard-source/apps/frontend/lib/current-provider-user.ts +30 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/frontend-port-file.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-events.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-query-invalidation.tsx +62 -0
- package/dist/dashboard-source/apps/frontend/lib/dev/import-completed-refresh.ts +40 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/error-boundary.tsx +84 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/index.ts +31 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/params.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/run-effect.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/runtime.ts +168 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/access-token.ts +48 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/authorization.ts +206 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/form-validation.ts +36 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/graphql.ts +94 -0
- package/dist/dashboard-source/apps/frontend/lib/effect/services/index.ts +21 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest-store.ts +20 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-manifest.ts +152 -0
- package/dist/dashboard-source/apps/frontend/lib/embed-request-origin.ts +39 -0
- package/dist/dashboard-source/apps/frontend/lib/errors/get-display-error-message.ts +22 -0
- package/dist/dashboard-source/apps/frontend/lib/execution-menu-actions-registry.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/feature-permissions.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-boot-health.tsx +161 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-client-plugin-registry.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest-store.ts +214 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-manifest.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/frontend-plugin-loaders.ts +191 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/fragment-masking.ts +87 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +292 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +443 -0
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/index.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-consumer.tsx +23 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-error-reporting.ts +268 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/client-provider.tsx +59 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dashboard-activity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/dependent-lookup-query.ts +78 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/endpoint.ts +26 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/execution-queries.ts +70 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/file-upload-provider.tsx +82 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/graphql-identifiers.ts +10 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +327 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/lookup-provider.tsx +81 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-operations.ts +63 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/org-chart-queries.ts +67 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/provider-user-queries.ts +65 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/queries.ts +80 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/server-client.ts +15 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/settings-queries.ts +634 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views-server.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/stats-views.ts +33 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/user-queries.ts +138 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-operations.ts +54 -0
- package/dist/dashboard-source/apps/frontend/lib/graphql/workflow-queries.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-home-view-model.ts +74 -0
- package/dist/dashboard-source/apps/frontend/lib/mobile-shell-policy.ts +124 -0
- package/dist/dashboard-source/apps/frontend/lib/mock-data.ts +364 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/notification-preference.ts +251 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notification-observer.ts +178 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/todo-notifications-runtime.tsx +14 -0
- package/dist/dashboard-source/apps/frontend/lib/notifications/use-todo-notifications.tsx +103 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-data.ts +50 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-depth-config.ts +71 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-layout.ts +149 -0
- package/dist/dashboard-source/apps/frontend/lib/org-chart-types.ts +17 -0
- package/dist/dashboard-source/apps/frontend/lib/org-identity.ts +57 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-loaders.ts +13 -0
- package/dist/dashboard-source/apps/frontend/lib/organisation-plugin-preparation.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins-client.tsx +99 -0
- package/dist/dashboard-source/apps/frontend/lib/plugins.ts +1 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-form-runtime.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-graphql-errors.ts +45 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-model.ts +200 -0
- package/dist/dashboard-source/apps/frontend/lib/public-todo-server.ts +209 -0
- package/dist/dashboard-source/apps/frontend/lib/query-client.ts +41 -0
- package/dist/dashboard-source/apps/frontend/lib/restart-execution-action.ts +76 -0
- package/dist/dashboard-source/apps/frontend/lib/runtime-config.ts +23 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/constants.ts +5 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/otlp-config.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/telemetry/register-otel.ts +308 -0
- package/dist/dashboard-source/apps/frontend/lib/theme.ts +9 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-types.ts +64 -0
- package/dist/dashboard-source/apps/frontend/lib/todo-utils.ts +144 -0
- package/dist/dashboard-source/apps/frontend/lib/types/org-identity.ts +7 -0
- package/dist/dashboard-source/apps/frontend/lib/utils.ts +16 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/constants.ts +118 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/edge-routing.ts +195 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/form-preview.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/layout.ts +878 -0
- package/dist/dashboard-source/apps/frontend/lib/workflow/types.ts +63 -0
- package/dist/dashboard-source/apps/frontend/next.config.ts +238 -0
- package/dist/dashboard-source/apps/frontend/package.json +71 -0
- package/dist/dashboard-source/apps/frontend/postcss.config.mjs +5 -0
- package/dist/dashboard-source/apps/frontend/proxy.ts +293 -0
- package/dist/dashboard-source/apps/frontend/public/.gitkeep +0 -0
- package/dist/dashboard-source/apps/frontend/public/favicon.ico +0 -0
- package/dist/dashboard-source/apps/frontend/public/processfocus-embed.js +553 -0
- package/dist/dashboard-source/apps/frontend/tsconfig.json +35 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/index.ts +7 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/auth-local-cedar.ts +1397 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/cedar-reload-notifier.ts +18 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/config-base.ts +346 -0
- package/dist/dashboard-source/modules/auth-local-cedar/src/lib/policy-watcher.ts +172 -0
- package/dist/dashboard-source/modules/auth-policy/src/index.ts +4 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/auth-policy.ts +263 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/current-principal.ts +34 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/errors.ts +47 -0
- package/dist/dashboard-source/modules/auth-policy/src/lib/types.ts +595 -0
- package/dist/dashboard-source/modules/auth-session/src/index.ts +22 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/issuer-url.ts +192 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/realtime-recipient.ts +76 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/session-cache-scope.ts +24 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/subjects.ts +54 -0
- package/dist/dashboard-source/modules/auth-session/src/lib/url.ts +2 -0
- package/dist/dashboard-source/modules/aws-common/src/index.ts +3 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/acm.ts +50 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/otlp-config.ts +66 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/runtime-ssm.ts +28 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/index.ts +1 -0
- package/dist/dashboard-source/modules/effect-json-logger/src/lib/effect-json-logger.ts +65 -0
- package/dist/dashboard-source/modules/form/src/hooks/use-local-storage.ts +78 -0
- package/dist/dashboard-source/modules/form/src/index.ts +20 -0
- package/dist/dashboard-source/modules/form/src/lib/ajv-standard-schema.ts +152 -0
- package/dist/dashboard-source/modules/form/src/lib/client-components-to-form.tsx +1421 -0
- package/dist/dashboard-source/modules/form/src/lib/friendly-validation-message.ts +85 -0
- package/dist/dashboard-source/modules/form/src/lib/lookup-context.tsx +58 -0
- package/dist/dashboard-source/modules/form/src/lib/plugin-registry.ts +34 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +1554 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/client-form-definition.ts +440 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/plugin-registry.ts +13 -0
- package/dist/dashboard-source/modules/form-client-representation/src/lib/types.ts +336 -0
- package/dist/dashboard-source/modules/form-rule/src/index.ts +21 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/evaluator.ts +531 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/paths.ts +102 -0
- package/dist/dashboard-source/modules/form-rule/src/lib/types.ts +121 -0
- package/dist/dashboard-source/modules/form-schema/src/index.ts +8 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/annotation-helpers.ts +44 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/deferred-value.ts +21 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/email.ts +50 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/field-count.ts +82 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-annotations.ts +58 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/form-schema.ts +975 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/phone.ts +60 -0
- package/dist/dashboard-source/modules/form-schema/src/lib/property-signature.ts +45 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/endpoint.ts +137 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/index.ts +11 -0
- package/dist/dashboard-source/modules/frontend-endpoints/src/port-files.ts +219 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/index.ts +2 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/browser-plugin-artifact.ts +201 -0
- package/dist/dashboard-source/modules/frontend-manifest/src/lib/frontend-manifest.ts +408 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/index.ts +29 -0
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +288 -0
- package/dist/dashboard-source/modules/openauth/src/client.ts +1045 -0
- package/dist/dashboard-source/modules/openauth/src/error.ts +140 -0
- package/dist/dashboard-source/modules/openauth/src/pkce.ts +40 -0
- package/dist/dashboard-source/modules/openauth/src/random.ts +24 -0
- package/dist/dashboard-source/modules/openauth/src/subject.ts +132 -0
- package/dist/dashboard-source/modules/openauth/src/util.ts +13 -0
- package/dist/dashboard-source/modules/request-time/src/index.ts +1 -0
- package/dist/dashboard-source/modules/request-time/src/lib/request-time.ts +30 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/draft-process-execution-schema.json +45 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +217 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/process-schema.json +77 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/todo-schema.json +94 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/index.ts +2 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +181 -0
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/to-rxdb-schema.ts +166 -0
- package/dist/dashboard-source/modules/shadcn-components/src/index.ts +60 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/boolean-field.tsx +73 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/calendar-slot-field.tsx +808 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/date-field.tsx +127 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/field-set.tsx +14 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-field.tsx +321 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/file-upload-context.tsx +45 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/form-context.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/lookup-field.tsx +394 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/radio-field.tsx +96 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/select-field.tsx +106 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/text-field.tsx +245 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/button.tsx +63 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/checkbox.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/command.tsx +101 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/field.tsx +275 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/input.tsx +29 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/label.tsx +23 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/popover.tsx +31 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/separator.tsx +27 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/ui/textarea.tsx +19 -0
- package/dist/dashboard-source/modules/shadcn-components/src/lib/utils/utils.ts +4 -0
- package/dist/dashboard-source.json +70 -0
- package/dist/graphql-server.mjs +1319 -0
- package/dist/job-worker.mjs +989 -0
- package/dist/main.mjs +495 -0
- package/dist/prepare-dashboard.mjs +35 -0
- package/dist/resources/cedar/policies.cedar +315 -0
- package/dist/resources/cedar/schema.cedarschema +276 -0
- package/dist/resources/graphql-schema/rxdb.graphql +401 -0
- package/dist/resources/graphql-schema/system.graphql +1200 -0
- package/package.json +98 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { startRegistration } from "@simplewebauthn/browser"
|
|
4
|
+
import { useState } from "react"
|
|
5
|
+
import { Button } from "../../../../modules/shadcn-components/src/index.ts"
|
|
6
|
+
import { authenticateWithPasskey } from "@/lib/auth/verify-passkey"
|
|
7
|
+
|
|
8
|
+
type PasskeyMode = "idle" | "register"
|
|
9
|
+
|
|
10
|
+
interface PasskeyButtonProps {
|
|
11
|
+
redirect?: string | undefined
|
|
12
|
+
/**
|
|
13
|
+
* When false (invite-only), hide self-registration and explain that
|
|
14
|
+
* first-time users must use their Registration Link.
|
|
15
|
+
*/
|
|
16
|
+
openRegistration?: boolean
|
|
17
|
+
purpose?: "signin" | "reauthenticate"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const throwPasskeyResponseError = (
|
|
21
|
+
data: { error?: string },
|
|
22
|
+
fallback: string,
|
|
23
|
+
): never => {
|
|
24
|
+
throw new Error(data.error || fallback)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function PasskeyButton({
|
|
28
|
+
redirect,
|
|
29
|
+
openRegistration = false,
|
|
30
|
+
purpose = "signin",
|
|
31
|
+
}: PasskeyButtonProps) {
|
|
32
|
+
const [mode, setMode] = useState<PasskeyMode>("idle")
|
|
33
|
+
const [email, setEmail] = useState("")
|
|
34
|
+
const [error, setError] = useState<string | null>(null)
|
|
35
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
36
|
+
|
|
37
|
+
const handleRegister = async () => {
|
|
38
|
+
if (!email.trim()) {
|
|
39
|
+
setError("Please enter your email")
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setError(null)
|
|
44
|
+
setIsLoading(true)
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
// Step 1: Start the OAuth flow to set up authorization state
|
|
48
|
+
// This calls the auth server server-side and forwards the cookies
|
|
49
|
+
const startResponse = await fetch("/api/auth/passkey/start", {
|
|
50
|
+
method: "POST",
|
|
51
|
+
headers: { "Content-Type": "application/json" },
|
|
52
|
+
body: JSON.stringify({ redirect }),
|
|
53
|
+
credentials: "include",
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
if (!startResponse.ok) {
|
|
57
|
+
const data = await startResponse.json()
|
|
58
|
+
throwPasskeyResponseError(data, "Failed to start passkey flow")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Step 2: Get registration options from the server
|
|
62
|
+
const optionsResponse = await fetch("/api/auth/passkey/register", {
|
|
63
|
+
method: "POST",
|
|
64
|
+
headers: { "Content-Type": "application/json" },
|
|
65
|
+
body: JSON.stringify({ email: email.trim() }),
|
|
66
|
+
credentials: "include",
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
if (!optionsResponse.ok) {
|
|
70
|
+
const data = await optionsResponse.json()
|
|
71
|
+
throwPasskeyResponseError(data, "Failed to get registration options")
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const { challengeId, options } = await optionsResponse.json()
|
|
75
|
+
|
|
76
|
+
// Step 4: Start the WebAuthn registration ceremony in the browser
|
|
77
|
+
const attestation = await startRegistration({ optionsJSON: options })
|
|
78
|
+
|
|
79
|
+
// Step 5: Verify the registration with the server
|
|
80
|
+
const verifyResponse = await fetch("/api/auth/passkey/register-verify", {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: { "Content-Type": "application/json" },
|
|
83
|
+
body: JSON.stringify({ challengeId, response: attestation }),
|
|
84
|
+
credentials: "include",
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const verifyData = await verifyResponse.json()
|
|
88
|
+
|
|
89
|
+
if (!verifyResponse.ok) {
|
|
90
|
+
throwPasskeyResponseError(
|
|
91
|
+
verifyData,
|
|
92
|
+
"Registration verification failed",
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Step 6: On success, redirect to the callback URL
|
|
97
|
+
if (verifyData.redirectUrl) {
|
|
98
|
+
window.location.href = verifyData.redirectUrl
|
|
99
|
+
} else if (verifyData.success) {
|
|
100
|
+
// Fallback: redirect to home
|
|
101
|
+
window.location.href = "/"
|
|
102
|
+
}
|
|
103
|
+
} catch (err) {
|
|
104
|
+
console.error("Passkey registration error:", err)
|
|
105
|
+
if (err instanceof Error) {
|
|
106
|
+
// Handle user cancellation
|
|
107
|
+
if (err.name === "NotAllowedError") {
|
|
108
|
+
setError("Registration was cancelled")
|
|
109
|
+
} else {
|
|
110
|
+
setError(err.message)
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
setError("Registration failed")
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
setIsLoading(false)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const handleAuthenticate = async () => {
|
|
120
|
+
setError(null)
|
|
121
|
+
setIsLoading(true)
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
await authenticateWithPasskey({ redirect, purpose })
|
|
125
|
+
} catch (err) {
|
|
126
|
+
console.error("Passkey authentication error:", err)
|
|
127
|
+
if (err instanceof Error) {
|
|
128
|
+
// Browsers do not distinguish missing credentials, cancellation, and timeout.
|
|
129
|
+
if (err.name === "NotAllowedError") {
|
|
130
|
+
setError(
|
|
131
|
+
"Couldn’t sign in with a passkey. Your device or security key may not have a passkey for this site, or the request was cancelled or timed out. Try the device or security key you used when setting up your passkey, or use another sign-in method.",
|
|
132
|
+
)
|
|
133
|
+
} else {
|
|
134
|
+
setError(err.message)
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
setError("Authentication failed")
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
setIsLoading(false)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (mode === "idle") {
|
|
144
|
+
return (
|
|
145
|
+
<div className="space-y-3">
|
|
146
|
+
<Button
|
|
147
|
+
type="button"
|
|
148
|
+
onClick={handleAuthenticate}
|
|
149
|
+
variant="outline"
|
|
150
|
+
className="w-full"
|
|
151
|
+
disabled={isLoading}
|
|
152
|
+
>
|
|
153
|
+
{isLoading
|
|
154
|
+
? "Please wait..."
|
|
155
|
+
: purpose === "reauthenticate"
|
|
156
|
+
? "Authenticate again with Passkey"
|
|
157
|
+
: "Sign in with Passkey"}
|
|
158
|
+
</Button>
|
|
159
|
+
{openRegistration ? (
|
|
160
|
+
<Button
|
|
161
|
+
onClick={() => setMode("register")}
|
|
162
|
+
variant="ghost"
|
|
163
|
+
className="w-full text-sm"
|
|
164
|
+
disabled={isLoading}
|
|
165
|
+
>
|
|
166
|
+
Register a new Passkey
|
|
167
|
+
</Button>
|
|
168
|
+
) : purpose === "signin" ? (
|
|
169
|
+
<p className="text-center text-sm text-gray-600">
|
|
170
|
+
First-time users must use their Registration Link.
|
|
171
|
+
</p>
|
|
172
|
+
) : null}
|
|
173
|
+
{error && (
|
|
174
|
+
<div className="rounded-md bg-red-50 p-3 text-sm text-red-700">
|
|
175
|
+
{error}
|
|
176
|
+
</div>
|
|
177
|
+
)}
|
|
178
|
+
</div>
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<div className="space-y-4">
|
|
184
|
+
<div className="space-y-2">
|
|
185
|
+
<label htmlFor="passkey-email" className="text-sm font-medium">
|
|
186
|
+
Email for new passkey
|
|
187
|
+
</label>
|
|
188
|
+
<input
|
|
189
|
+
id="passkey-email"
|
|
190
|
+
type="email"
|
|
191
|
+
value={email}
|
|
192
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
193
|
+
placeholder="your@email.com"
|
|
194
|
+
className="w-full rounded-md border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500 focus:outline-none"
|
|
195
|
+
disabled={isLoading}
|
|
196
|
+
/>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
{error && (
|
|
200
|
+
<div className="rounded-md bg-red-50 p-3 text-sm text-red-700">
|
|
201
|
+
{error}
|
|
202
|
+
</div>
|
|
203
|
+
)}
|
|
204
|
+
|
|
205
|
+
<div className="flex gap-2">
|
|
206
|
+
<Button
|
|
207
|
+
onClick={() => {
|
|
208
|
+
setMode("idle")
|
|
209
|
+
setError(null)
|
|
210
|
+
}}
|
|
211
|
+
variant="ghost"
|
|
212
|
+
disabled={isLoading}
|
|
213
|
+
>
|
|
214
|
+
Back
|
|
215
|
+
</Button>
|
|
216
|
+
<Button
|
|
217
|
+
onClick={handleRegister}
|
|
218
|
+
className="flex-1"
|
|
219
|
+
disabled={isLoading || !email.trim()}
|
|
220
|
+
>
|
|
221
|
+
{isLoading ? "Please wait..." : "Register Passkey"}
|
|
222
|
+
</Button>
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
)
|
|
226
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useState } from "react"
|
|
4
|
+
import { Button } from "../../../../modules/shadcn-components/src/index.ts"
|
|
5
|
+
import { Input } from "@/components/ui/input"
|
|
6
|
+
import { getValidRedirect } from "@/lib/auth/redirect"
|
|
7
|
+
|
|
8
|
+
export function SecretLoginForm({
|
|
9
|
+
enabled = false,
|
|
10
|
+
redirect,
|
|
11
|
+
}: {
|
|
12
|
+
enabled?: boolean
|
|
13
|
+
redirect?: string | undefined
|
|
14
|
+
}) {
|
|
15
|
+
const [pending, setPending] = useState(false)
|
|
16
|
+
const [failed, setFailed] = useState(false)
|
|
17
|
+
if (!enabled) return null
|
|
18
|
+
return (
|
|
19
|
+
<details className="rounded-lg border p-4">
|
|
20
|
+
<summary className="cursor-pointer text-sm font-medium">
|
|
21
|
+
Log in with a secret
|
|
22
|
+
</summary>
|
|
23
|
+
<form
|
|
24
|
+
method="post"
|
|
25
|
+
action="/api/auth/delegation"
|
|
26
|
+
className="mt-4 space-y-3"
|
|
27
|
+
autoComplete="off"
|
|
28
|
+
onSubmit={async (event) => {
|
|
29
|
+
event.preventDefault()
|
|
30
|
+
if (pending) return
|
|
31
|
+
const form = event.currentTarget
|
|
32
|
+
const secret = new FormData(form).get("secret")
|
|
33
|
+
form.reset()
|
|
34
|
+
setPending(true)
|
|
35
|
+
setFailed(false)
|
|
36
|
+
try {
|
|
37
|
+
const response = await fetch("/api/auth/delegation", {
|
|
38
|
+
method: "POST",
|
|
39
|
+
headers: { "Content-Type": "application/json" },
|
|
40
|
+
body: JSON.stringify({ secret }),
|
|
41
|
+
credentials: "same-origin",
|
|
42
|
+
cache: "no-store",
|
|
43
|
+
})
|
|
44
|
+
if (response.ok) {
|
|
45
|
+
const destination = new URL(
|
|
46
|
+
getValidRedirect(redirect),
|
|
47
|
+
window.location.origin,
|
|
48
|
+
)
|
|
49
|
+
window.location.replace(
|
|
50
|
+
destination.origin === window.location.origin
|
|
51
|
+
? destination.href
|
|
52
|
+
: `${window.location.origin}/`,
|
|
53
|
+
)
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
} catch {
|
|
57
|
+
// Errors may contain request details. Show only fixed safe copy.
|
|
58
|
+
}
|
|
59
|
+
setFailed(true)
|
|
60
|
+
setPending(false)
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<label htmlFor="login-secret" className="text-sm">
|
|
64
|
+
Delegation Secret
|
|
65
|
+
</label>
|
|
66
|
+
<Input
|
|
67
|
+
id="login-secret"
|
|
68
|
+
name="secret"
|
|
69
|
+
type="password"
|
|
70
|
+
required
|
|
71
|
+
maxLength={48}
|
|
72
|
+
autoComplete="off"
|
|
73
|
+
spellCheck={false}
|
|
74
|
+
autoCapitalize="none"
|
|
75
|
+
className="ph-no-capture"
|
|
76
|
+
data-private="true"
|
|
77
|
+
disabled={pending}
|
|
78
|
+
/>
|
|
79
|
+
{failed && (
|
|
80
|
+
<p role="alert" className="text-sm text-destructive">
|
|
81
|
+
Unable to log in with this secret. It may be invalid or delegated
|
|
82
|
+
access may be unavailable.
|
|
83
|
+
</p>
|
|
84
|
+
)}
|
|
85
|
+
<Button type="submit" disabled={pending}>
|
|
86
|
+
{pending ? "Logging in..." : "Log in with a secret"}
|
|
87
|
+
</Button>
|
|
88
|
+
</form>
|
|
89
|
+
</details>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MetadataRoute } from "next"
|
|
2
|
+
import { buildWebAppManifest } from "@/lib/app-icons-metadata"
|
|
3
|
+
import { getFrontendManifest } from "@/lib/frontend-manifest-store"
|
|
4
|
+
|
|
5
|
+
export default function manifest(): MetadataRoute.Manifest {
|
|
6
|
+
return buildWebAppManifest(getFrontendManifest())
|
|
7
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef, useTransition } from "react"
|
|
4
|
+
import { PublicFormBrandingCard } from "./public-form-branding-card.tsx"
|
|
5
|
+
import { usePublicFormBranding } from "./public-form-branding-context.tsx"
|
|
6
|
+
import { useActiveFrontendClientPlugins } from "@/components/frontend-client-plugin-provider"
|
|
7
|
+
import { reportClientException } from "@/lib/client-plugin-error-reporting"
|
|
8
|
+
|
|
9
|
+
export default function PublicFormError({
|
|
10
|
+
error,
|
|
11
|
+
retry,
|
|
12
|
+
}: {
|
|
13
|
+
readonly error: Error
|
|
14
|
+
readonly retry: () => void
|
|
15
|
+
}) {
|
|
16
|
+
const [isPending, startTransition] = useTransition()
|
|
17
|
+
const activePlugins = useActiveFrontendClientPlugins()
|
|
18
|
+
const publicFormBranding = usePublicFormBranding()
|
|
19
|
+
const reportedRef = useRef(false)
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (reportedRef.current || activePlugins.length === 0) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
reportClientException(activePlugins, error, {
|
|
27
|
+
public_form_action: "initial-load",
|
|
28
|
+
public_form_pathname: "/public/form/[token]",
|
|
29
|
+
})
|
|
30
|
+
reportedRef.current = true
|
|
31
|
+
}, [activePlugins, error])
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<main className="min-h-screen bg-slate-50 px-4 py-10 text-slate-950 sm:px-6 lg:px-8">
|
|
35
|
+
<section
|
|
36
|
+
aria-labelledby="public-form-error-title"
|
|
37
|
+
className="mx-auto w-full max-w-2xl"
|
|
38
|
+
>
|
|
39
|
+
<PublicFormBrandingCard branding={publicFormBranding} className="p-8">
|
|
40
|
+
<h1
|
|
41
|
+
className="mt-3 text-3xl font-semibold text-slate-950"
|
|
42
|
+
id="public-form-error-title"
|
|
43
|
+
>
|
|
44
|
+
This form is temporarily unavailable
|
|
45
|
+
</h1>
|
|
46
|
+
<p className="mt-3 text-base leading-7 text-slate-600">
|
|
47
|
+
We could not load this form. Please try again or contact the sender
|
|
48
|
+
if the problem continues.
|
|
49
|
+
</p>
|
|
50
|
+
<button
|
|
51
|
+
type="button"
|
|
52
|
+
className="mt-6 rounded-md bg-slate-950 px-4 py-2 font-medium text-white focus-visible:outline-2 focus-visible:outline-offset-2 disabled:opacity-50"
|
|
53
|
+
disabled={isPending}
|
|
54
|
+
aria-busy={isPending}
|
|
55
|
+
onClick={() => startTransition(retry)}
|
|
56
|
+
>
|
|
57
|
+
{isPending ? "Trying again…" : "Try again"}
|
|
58
|
+
</button>
|
|
59
|
+
</PublicFormBrandingCard>
|
|
60
|
+
</section>
|
|
61
|
+
</main>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { PublicFormBrandingProvider } from "./public-form-branding-context.tsx"
|
|
2
|
+
import type { FrontendManifest } from "@/lib/frontend-manifest"
|
|
3
|
+
import {
|
|
4
|
+
disabledFrontendManifest,
|
|
5
|
+
getFrontendManifest,
|
|
6
|
+
} from "@/lib/frontend-manifest-store"
|
|
7
|
+
import { FrontendPlugins } from "@/lib/plugins-client"
|
|
8
|
+
|
|
9
|
+
const publicFormAnalyticsManifest = (
|
|
10
|
+
manifest: FrontendManifest,
|
|
11
|
+
): FrontendManifest => ({
|
|
12
|
+
...disabledFrontendManifest,
|
|
13
|
+
organisation: manifest.organisation,
|
|
14
|
+
// Branding is rendered by the page shell; this layout only narrows plugins.
|
|
15
|
+
plugins: {
|
|
16
|
+
analytics: manifest.plugins.analytics,
|
|
17
|
+
formComponents: [],
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export default function PublicFormLayout({
|
|
22
|
+
children,
|
|
23
|
+
}: {
|
|
24
|
+
readonly children: React.ReactNode
|
|
25
|
+
}) {
|
|
26
|
+
const frontendManifest = getFrontendManifest()
|
|
27
|
+
const manifest = publicFormAnalyticsManifest(frontendManifest)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<PublicFormBrandingProvider branding={frontendManifest.publicFormBranding}>
|
|
31
|
+
<FrontendPlugins manifest={manifest}>{children}</FrontendPlugins>
|
|
32
|
+
</PublicFormBrandingProvider>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { notFound } from "next/navigation"
|
|
2
|
+
import { Suspense } from "react"
|
|
3
|
+
import { PublicFormBrandingCard } from "./public-form-branding-card.tsx"
|
|
4
|
+
import { ExpiredPublicTodoClient, PublicTodoClient } from "./public-todo-client.tsx"
|
|
5
|
+
import { PublicTodoStateContent } from "./public-todo-state-content.tsx"
|
|
6
|
+
import type { FrontendManifest } from "@/lib/frontend-manifest"
|
|
7
|
+
import { getFrontendManifest } from "@/lib/frontend-manifest-store"
|
|
8
|
+
import { publicTodoStateCopy } from "@/lib/public-todo-model"
|
|
9
|
+
import {
|
|
10
|
+
PublicTodoConfigurationError,
|
|
11
|
+
fetchPublicTodo,
|
|
12
|
+
isPublicTodoLinkError,
|
|
13
|
+
} from "@/lib/public-todo-server"
|
|
14
|
+
|
|
15
|
+
const StateCard = ({
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
publicFormBranding,
|
|
19
|
+
}: {
|
|
20
|
+
readonly title: string
|
|
21
|
+
readonly description: string
|
|
22
|
+
readonly publicFormBranding: FrontendManifest["publicFormBranding"]
|
|
23
|
+
}) => (
|
|
24
|
+
<PublicFormBrandingCard branding={publicFormBranding} className="p-8">
|
|
25
|
+
<PublicTodoStateContent title={title} description={description} />
|
|
26
|
+
</PublicFormBrandingCard>
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
const LoadingCard = ({
|
|
30
|
+
publicFormBranding,
|
|
31
|
+
}: {
|
|
32
|
+
readonly publicFormBranding: FrontendManifest["publicFormBranding"]
|
|
33
|
+
}) => (
|
|
34
|
+
<PublicFormBrandingCard branding={publicFormBranding} className="p-8">
|
|
35
|
+
<div aria-busy="true" aria-live="polite" className="space-y-4">
|
|
36
|
+
<p className="text-sm font-semibold uppercase tracking-[0.18em] text-emerald-700">
|
|
37
|
+
Loading form
|
|
38
|
+
</p>
|
|
39
|
+
<div className="h-8 w-2/3 rounded-md bg-slate-200" />
|
|
40
|
+
<div className="space-y-2">
|
|
41
|
+
<div className="h-4 w-full rounded bg-slate-100" />
|
|
42
|
+
<div className="h-4 w-5/6 rounded bg-slate-100" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</PublicFormBrandingCard>
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
export default function PublicTodoPage({
|
|
49
|
+
params,
|
|
50
|
+
}: {
|
|
51
|
+
readonly params: Promise<{ token: string }>
|
|
52
|
+
}) {
|
|
53
|
+
const publicFormBranding = getFrontendManifest().publicFormBranding
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<main className="min-h-screen bg-slate-50 px-4 py-10 text-slate-950 sm:px-6 lg:px-8">
|
|
57
|
+
<div className="mx-auto w-full max-w-2xl">
|
|
58
|
+
<Suspense
|
|
59
|
+
fallback={<LoadingCard publicFormBranding={publicFormBranding} />}
|
|
60
|
+
>
|
|
61
|
+
<PublicTodoContent
|
|
62
|
+
params={params}
|
|
63
|
+
publicFormBranding={publicFormBranding}
|
|
64
|
+
/>
|
|
65
|
+
</Suspense>
|
|
66
|
+
</div>
|
|
67
|
+
</main>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Exported so route tests can exercise dynamic token handling without rendering the static shell.
|
|
72
|
+
export async function PublicTodoContent({
|
|
73
|
+
params,
|
|
74
|
+
publicFormBranding,
|
|
75
|
+
}: {
|
|
76
|
+
readonly params: Promise<{ token: string }>
|
|
77
|
+
readonly publicFormBranding: FrontendManifest["publicFormBranding"]
|
|
78
|
+
}) {
|
|
79
|
+
const { token } = await params
|
|
80
|
+
const todo = await fetchPublicTodo(token).catch((error: unknown) => {
|
|
81
|
+
if (error instanceof PublicTodoConfigurationError) {
|
|
82
|
+
throw error
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!isPublicTodoLinkError(error)) {
|
|
86
|
+
throw error
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return null
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
if (!todo) {
|
|
93
|
+
notFound()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
{todo.status === "ACTIVE" && todo.formMetadata ? (
|
|
99
|
+
<PublicFormBrandingCard branding={publicFormBranding}>
|
|
100
|
+
<PublicTodoClient
|
|
101
|
+
token={token}
|
|
102
|
+
todoId={todo.todoId}
|
|
103
|
+
submittedTitle={
|
|
104
|
+
publicFormBranding
|
|
105
|
+
? todo.formMetadata.processName
|
|
106
|
+
: (todo.organisationName ?? todo.formMetadata.processName)
|
|
107
|
+
}
|
|
108
|
+
formMetadata={todo.formMetadata}
|
|
109
|
+
/>
|
|
110
|
+
</PublicFormBrandingCard>
|
|
111
|
+
) : todo.status === "ACTIVE" ? (
|
|
112
|
+
<StateCard
|
|
113
|
+
title="Temporarily unavailable"
|
|
114
|
+
description="This form is temporarily unavailable. Try again later."
|
|
115
|
+
publicFormBranding={publicFormBranding}
|
|
116
|
+
/>
|
|
117
|
+
) : todo.status === "EXPIRED" ? (
|
|
118
|
+
<PublicFormBrandingCard branding={publicFormBranding} className="p-8">
|
|
119
|
+
<ExpiredPublicTodoClient token={token} />
|
|
120
|
+
</PublicFormBrandingCard>
|
|
121
|
+
) : (
|
|
122
|
+
<StateCard
|
|
123
|
+
{...publicTodoStateCopy(todo.status)}
|
|
124
|
+
publicFormBranding={publicFormBranding}
|
|
125
|
+
/>
|
|
126
|
+
)}
|
|
127
|
+
</>
|
|
128
|
+
)
|
|
129
|
+
}
|
package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-card.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type React from "react"
|
|
2
|
+
import { PublicFormBrandingHtml } from "./public-form-branding-html.tsx"
|
|
3
|
+
import type { FrontendManifest } from "@/lib/frontend-manifest"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
type PublicFormBranding = FrontendManifest["publicFormBranding"]
|
|
7
|
+
|
|
8
|
+
interface PublicFormBrandingCardProps {
|
|
9
|
+
readonly branding: PublicFormBranding
|
|
10
|
+
readonly children: React.ReactNode
|
|
11
|
+
readonly className?: string | undefined
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function PublicFormBrandingCard({
|
|
15
|
+
branding,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
}: PublicFormBrandingCardProps) {
|
|
19
|
+
const headerHtml = branding?.headerHtml
|
|
20
|
+
const footerHtml = branding?.footerHtml
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<section
|
|
24
|
+
className={cn(
|
|
25
|
+
"rounded-3xl border border-slate-200 bg-white p-6 shadow-sm sm:p-8",
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
28
|
+
>
|
|
29
|
+
{headerHtml ? (
|
|
30
|
+
<header className="mb-8 border-b border-slate-200 pb-6">
|
|
31
|
+
<PublicFormBrandingHtml html={headerHtml} />
|
|
32
|
+
</header>
|
|
33
|
+
) : null}
|
|
34
|
+
{children}
|
|
35
|
+
{footerHtml ? (
|
|
36
|
+
<footer className="mt-8 border-t border-slate-200 pt-6 text-sm text-slate-600">
|
|
37
|
+
<PublicFormBrandingHtml html={footerHtml} />
|
|
38
|
+
</footer>
|
|
39
|
+
) : null}
|
|
40
|
+
</section>
|
|
41
|
+
)
|
|
42
|
+
}
|
package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-context.tsx
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from "react"
|
|
4
|
+
import type { FrontendManifest } from "@/lib/frontend-manifest"
|
|
5
|
+
|
|
6
|
+
type PublicFormBranding = FrontendManifest["publicFormBranding"]
|
|
7
|
+
|
|
8
|
+
const PublicFormBrandingContext = createContext<PublicFormBranding | null>(null)
|
|
9
|
+
PublicFormBrandingContext.displayName = "PublicFormBrandingContext"
|
|
10
|
+
|
|
11
|
+
export function PublicFormBrandingProvider({
|
|
12
|
+
branding,
|
|
13
|
+
children,
|
|
14
|
+
}: {
|
|
15
|
+
readonly branding: PublicFormBranding
|
|
16
|
+
readonly children: React.ReactNode
|
|
17
|
+
}) {
|
|
18
|
+
return (
|
|
19
|
+
<PublicFormBrandingContext.Provider value={branding}>
|
|
20
|
+
{children}
|
|
21
|
+
</PublicFormBrandingContext.Provider>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** Returns tenant branding for public forms, or null when no branding is configured. */
|
|
26
|
+
export const usePublicFormBranding = (): PublicFormBranding | null =>
|
|
27
|
+
useContext(PublicFormBrandingContext)
|
package/dist/dashboard-source/apps/frontend/app/public/form/[token]/public-form-branding-html.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from "react"
|
|
4
|
+
|
|
5
|
+
const activateScripts = (root: HTMLElement | null): void => {
|
|
6
|
+
if (!root) {
|
|
7
|
+
return
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
for (const script of root.querySelectorAll("script")) {
|
|
11
|
+
const replacement = document.createElement("script")
|
|
12
|
+
|
|
13
|
+
for (const attribute of script.attributes) {
|
|
14
|
+
replacement.setAttribute(attribute.name, attribute.value)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
replacement.text = script.text
|
|
18
|
+
script.replaceWith(replacement)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const PublicFormBrandingHtml = ({ html }: { readonly html: string }) => {
|
|
23
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
24
|
+
const activatedHtmlRef = useRef<string | undefined>(undefined)
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
// React Strict Mode can mount effects twice; avoid re-running trusted scripts.
|
|
28
|
+
if (activatedHtmlRef.current === html) {
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
activateScripts(ref.current)
|
|
33
|
+
activatedHtmlRef.current = html
|
|
34
|
+
}, [html])
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: public form branding is trusted deploy-time organisation HTML.
|
|
38
|
+
<div ref={ref} dangerouslySetInnerHTML={{ __html: html }} />
|
|
39
|
+
)
|
|
40
|
+
}
|