@vertesia/ui 1.5.0 → 1.6.0-dev.20260918.061604Z
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 +125 -0
- package/lib/boot/branding.d.ts +58 -0
- package/lib/boot/branding.d.ts.map +1 -0
- package/lib/boot/branding.js +62 -0
- package/lib/boot/branding.js.map +1 -0
- package/lib/boot/index.d.ts +27 -0
- package/lib/boot/index.d.ts.map +1 -0
- package/lib/boot/index.js +325 -0
- package/lib/boot/index.js.map +1 -0
- package/lib/boot/vite.d.ts +63 -0
- package/lib/boot/vite.d.ts.map +1 -0
- package/lib/boot/vite.js +108 -0
- package/lib/boot/vite.js.map +1 -0
- package/lib/core/components/shadcn/button.d.ts.map +1 -1
- package/lib/core/components/shadcn/button.js +1 -2
- package/lib/core/components/shadcn/button.js.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.d.ts.map +1 -1
- package/lib/core/components/shadcn/filters/filter-styles.js +4 -4
- package/lib/core/components/shadcn/label.js +1 -1
- package/lib/core/components/shadcn/label.js.map +1 -1
- package/lib/env/index.d.ts +32 -1
- package/lib/env/index.d.ts.map +1 -1
- package/lib/env/index.js +55 -3
- package/lib/env/index.js.map +1 -1
- package/lib/features/agent/PayloadBuilder.d.ts +4 -0
- package/lib/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/features/agent/PayloadBuilder.js +6 -1
- package/lib/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/features/agent/chat/AgentRunFeedback.d.ts +66 -0
- package/lib/features/agent/chat/AgentRunFeedback.d.ts.map +1 -0
- package/lib/features/agent/chat/AgentRunFeedback.js +298 -0
- package/lib/features/agent/chat/AgentRunFeedback.js.map +1 -0
- package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +7 -5
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +11 -10
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +3 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +28 -7
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js +2 -0
- package/lib/features/agent/chat/ModernAgentOutput/SummaryConversation.js.map +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.d.ts +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useAgentPlans.js +5 -5
- package/lib/features/agent/chat/hooks/useAgentPlans.js.map +1 -1
- package/lib/features/agent/chat/index.d.ts +1 -0
- package/lib/features/agent/chat/index.d.ts.map +1 -1
- package/lib/features/agent/chat/index.js +1 -0
- package/lib/features/agent/chat/index.js.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts +8 -0
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.js +12 -0
- package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts +15 -1
- package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
- package/lib/features/permissions/UserPermissionsProvider.js +20 -12
- package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js +6 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/types/TypeRegistry.d.ts +130 -0
- package/lib/features/store/types/TypeRegistry.d.ts.map +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts +130 -0
- package/lib/features/store/types/search/ObjectTypeSearchContext.d.ts.map +1 -1
- package/lib/i18n/index.d.ts +5 -4
- package/lib/i18n/index.d.ts.map +1 -1
- package/lib/i18n/index.js +16 -2
- package/lib/i18n/index.js.map +1 -1
- package/lib/i18n/locales/ar.json +30 -0
- package/lib/i18n/locales/de.json +30 -0
- package/lib/i18n/locales/en.json +30 -0
- package/lib/i18n/locales/es.json +30 -0
- package/lib/i18n/locales/fr.json +30 -0
- package/lib/i18n/locales/it.json +30 -0
- package/lib/i18n/locales/ja.json +30 -0
- package/lib/i18n/locales/ko.json +30 -0
- package/lib/i18n/locales/pt.json +30 -0
- package/lib/i18n/locales/ru.json +30 -0
- package/lib/i18n/locales/tr.json +30 -0
- package/lib/i18n/locales/zh-TW.json +30 -0
- package/lib/i18n/locales/zh.json +30 -0
- package/lib/layout/ErrorPage.js +1 -1
- package/lib/layout/ErrorPage.js.map +1 -1
- package/lib/layout/Navbar.d.ts.map +1 -1
- package/lib/layout/Navbar.js +3 -2
- package/lib/layout/Navbar.js.map +1 -1
- package/lib/session/UserSession.d.ts.map +1 -1
- package/lib/session/UserSession.js +2 -3
- package/lib/session/UserSession.js.map +1 -1
- package/lib/session/UserSessionProvider.d.ts +2 -1
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +13 -4
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +88 -3
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/auth/domainRouting.d.ts +22 -12
- package/lib/session/auth/domainRouting.d.ts.map +1 -1
- package/lib/session/auth/domainRouting.js +35 -21
- package/lib/session/auth/domainRouting.js.map +1 -1
- package/lib/session/auth/firebase.d.ts.map +1 -1
- package/lib/session/auth/firebase.js +10 -0
- package/lib/session/auth/firebase.js.map +1 -1
- package/lib/session/auth/useAuthState.d.ts +9 -4
- package/lib/session/auth/useAuthState.d.ts.map +1 -1
- package/lib/session/auth/useAuthState.js +9 -4
- package/lib/session/auth/useAuthState.js.map +1 -1
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +3 -1
- package/lib/session/index.js.map +1 -1
- package/lib/shell/AuthScreenPreview.d.ts +12 -0
- package/lib/shell/AuthScreenPreview.d.ts.map +1 -0
- package/lib/shell/AuthScreenPreview.js +140 -0
- package/lib/shell/AuthScreenPreview.js.map +1 -0
- package/lib/shell/BrandedAuthScreens.d.ts +19 -0
- package/lib/shell/BrandedAuthScreens.d.ts.map +1 -0
- package/lib/shell/BrandedAuthScreens.js +64 -0
- package/lib/shell/BrandedAuthScreens.js.map +1 -0
- package/lib/shell/SplashScreen.d.ts +13 -2
- package/lib/shell/SplashScreen.d.ts.map +1 -1
- package/lib/shell/SplashScreen.js +20 -19
- package/lib/shell/SplashScreen.js.map +1 -1
- package/lib/shell/VertesiaShell.d.ts +15 -4
- package/lib/shell/VertesiaShell.d.ts.map +1 -1
- package/lib/shell/VertesiaShell.js +8 -3
- package/lib/shell/VertesiaShell.js.map +1 -1
- package/lib/shell/apps/StandaloneApp.js +5 -1
- package/lib/shell/apps/StandaloneApp.js.map +1 -1
- package/lib/shell/index.d.ts +6 -0
- package/lib/shell/index.d.ts.map +1 -1
- package/lib/shell/index.js +5 -0
- package/lib/shell/index.js.map +1 -1
- package/lib/shell/login/SignInAuthPending.js +1 -1
- package/lib/shell/login/SignInAuthPending.js.map +1 -1
- package/lib/shell/login/SignInEmailStep.d.ts.map +1 -1
- package/lib/shell/login/SignInEmailStep.js +2 -2
- package/lib/shell/login/SignInEmailStep.js.map +1 -1
- package/lib/shell/login/SignInFlow.d.ts +68 -0
- package/lib/shell/login/SignInFlow.d.ts.map +1 -0
- package/lib/shell/login/SignInFlow.js +108 -0
- package/lib/shell/login/SignInFlow.js.map +1 -0
- package/lib/shell/login/SignInIcons.d.ts +1 -1
- package/lib/shell/login/SignInIcons.d.ts.map +1 -1
- package/lib/shell/login/SignInPageShell.d.ts +13 -0
- package/lib/shell/login/SignInPageShell.d.ts.map +1 -0
- package/lib/shell/login/SignInPageShell.js +14 -0
- package/lib/shell/login/SignInPageShell.js.map +1 -0
- package/lib/shell/login/SignInPrimitives.d.ts +3 -3
- package/lib/shell/login/SignInPrimitives.d.ts.map +1 -1
- package/lib/shell/login/SignInPrimitives.js +13 -11
- package/lib/shell/login/SignInPrimitives.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +5 -0
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.js +8 -4
- package/lib/shell/login/SignInRestrictedEnvStep.js.map +1 -1
- package/lib/shell/login/SigninScreen.d.ts +38 -3
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +33 -86
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/SignupForm.d.ts +3 -1
- package/lib/shell/login/SignupForm.d.ts.map +1 -1
- package/lib/shell/login/SignupForm.js +7 -3
- package/lib/shell/login/SignupForm.js.map +1 -1
- package/lib/shell/login/signInUtils.d.ts +12 -1
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +34 -11
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-boot.js +237 -0
- package/lib/vertesia-ui-boot.js.map +1 -0
- package/lib/vertesia-ui-core.js +88 -46
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +1 -1
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +350 -317
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.B3NFclwl.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWSrNIxc.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BWvWeB1p.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BZCXvTC1.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.BbJMvFZW.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CE5ldwpt.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CMC0IShY.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.CkcRqBKU.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.D-Mq1sw_.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.DkK68-A-.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.XE_dcCg6.chunk.js.map +1 -0
- package/lib/vertesia-ui-i18n.js +2 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js +5 -0
- package/lib/vertesia-ui-i18n.qgNqMPvK.chunk.js.map +1 -0
- package/lib/vertesia-ui-layout.js +43 -19
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-rich-text.js +123 -74
- package/lib/vertesia-ui-rich-text.js.map +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +87 -33
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +154 -98
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/xml-viewer/hooks/useCollapsible.d.ts +1 -1
- package/llms.txt +6 -2
- package/package.json +45 -36
- package/src/__tests__/a11y.test.tsx +25 -0
- package/src/__tests__/theme.test.ts +91 -0
- package/src/boot/branding.test.ts +72 -0
- package/src/boot/branding.ts +108 -0
- package/src/boot/index.test.ts +216 -0
- package/src/boot/index.ts +356 -0
- package/src/boot/vite.test.ts +93 -0
- package/src/boot/vite.ts +118 -0
- package/src/core/components/shadcn/button.tsx +1 -2
- package/src/core/components/shadcn/filters/filter-styles.ts +4 -4
- package/src/core/components/shadcn/label.tsx +1 -1
- package/src/env/index.test.ts +127 -0
- package/src/env/index.ts +73 -3
- package/src/features/agent/PayloadBuilder.tsx +10 -1
- package/src/features/agent/chat/AgentRunFeedback.test.tsx +347 -0
- package/src/features/agent/chat/AgentRunFeedback.tsx +465 -0
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +1 -1
- package/src/features/agent/chat/ModernAgentConversation.tsx +52 -47
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +145 -0
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +42 -24
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +4 -0
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +38 -5
- package/src/features/agent/chat/ModernAgentOutput/SummaryConversation.ts +2 -0
- package/src/features/agent/chat/ModernAgentOutput/utils.test.ts +14 -0
- package/src/features/agent/chat/hooks/useAgentPlans.test.ts +52 -0
- package/src/features/agent/chat/hooks/useAgentPlans.ts +5 -5
- package/src/features/agent/chat/hooks/useFileProcessing.test.tsx +0 -5
- package/src/features/agent/chat/index.ts +6 -0
- package/src/features/facets/AgentRunnerFacetsNav.tsx +26 -0
- package/src/features/permissions/UserPermissionsProvider.test.tsx +50 -1
- package/src/features/permissions/UserPermissionsProvider.tsx +82 -44
- package/src/features/store/objects/search/DocumentSearchContext.ts +8 -3
- package/src/features/store/objects/selection/SelectionActions.tsx +4 -1
- package/src/i18n/index.tsx +25 -2
- package/src/i18n/locales/ar.json +30 -0
- package/src/i18n/locales/de.json +30 -0
- package/src/i18n/locales/en.json +30 -0
- package/src/i18n/locales/es.json +30 -0
- package/src/i18n/locales/fr.json +30 -0
- package/src/i18n/locales/it.json +30 -0
- package/src/i18n/locales/ja.json +30 -0
- package/src/i18n/locales/ko.json +30 -0
- package/src/i18n/locales/pt.json +30 -0
- package/src/i18n/locales/ru.json +30 -0
- package/src/i18n/locales/tr.json +30 -0
- package/src/i18n/locales/zh-TW.json +30 -0
- package/src/i18n/locales/zh.json +30 -0
- package/src/layout/ErrorPage.tsx +1 -1
- package/src/layout/Navbar.test.tsx +58 -0
- package/src/layout/Navbar.tsx +5 -2
- package/src/router/path.test.ts +5 -5
- package/src/session/UserSession.ts +2 -4
- package/src/session/UserSessionProvider.strict-mode.test.tsx +44 -0
- package/src/session/UserSessionProvider.test.ts +62 -1
- package/src/session/UserSessionProvider.tsx +12 -4
- package/src/session/auth/composable.renewal.test.ts +170 -0
- package/src/session/auth/composable.test.ts +23 -1
- package/src/session/auth/composable.ts +101 -2
- package/src/session/auth/domainRouting.test.ts +35 -65
- package/src/session/auth/domainRouting.ts +51 -34
- package/src/session/auth/firebase.test.ts +25 -0
- package/src/session/auth/firebase.ts +10 -0
- package/src/session/auth/useAuthState.ts +11 -4
- package/src/session/index.ts +3 -1
- package/src/shell/AuthScreenPreview.test.tsx +44 -0
- package/src/shell/AuthScreenPreview.tsx +228 -0
- package/src/shell/BrandedAuthScreens.test.tsx +181 -0
- package/src/shell/BrandedAuthScreens.tsx +117 -0
- package/src/shell/SplashScreen.test.tsx +37 -0
- package/src/shell/SplashScreen.tsx +44 -39
- package/src/shell/VertesiaShell.tsx +49 -22
- package/src/shell/apps/StandaloneApp.tsx +5 -1
- package/src/shell/index.tsx +6 -0
- package/src/shell/login/SignInAuthPending.tsx +3 -3
- package/src/shell/login/SignInEmailStep.test.tsx +32 -0
- package/src/shell/login/SignInEmailStep.tsx +13 -9
- package/src/shell/login/SignInFlow.tsx +213 -0
- package/src/shell/login/SignInPageShell.tsx +62 -0
- package/src/shell/login/SignInPrimitives.tsx +14 -11
- package/src/shell/login/SignInRestrictedEnvStep.tsx +19 -7
- package/src/shell/login/SigninScreen.test.tsx +104 -0
- package/src/shell/login/SigninScreen.tsx +115 -145
- package/src/shell/login/SignupForm.tsx +8 -3
- package/src/shell/login/signInUtils.ts +42 -9
- package/src/widgets/markdown/CollaborativeMarkdownRenderer.test.tsx +11 -3
- package/src/widgets/markdown/markdown.css +21 -21
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BfN7iOHb.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjH2zEZw.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.BjSwAZXl.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.C7PUm5Au.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.CF_1mUS5.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.ChfUl3_-.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D-Sk-5d1.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.D4rnu1_S.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DDf0-laK.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DN79y06J.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DWLIciYQ.chunk.js.map +0 -1
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js +0 -5
- package/lib/vertesia-ui-i18n.DvF_YaAJ.chunk.js.map +0 -1
- package/src/session/auth/authState.test.ts +0 -35
|
@@ -1,51 +1,45 @@
|
|
|
1
1
|
import { useUserSession } from '@vertesia/ui/session';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface AuthLoadingScreenProps {
|
|
5
|
+
loadingIcon?: ReactNode;
|
|
6
|
+
}
|
|
4
7
|
|
|
5
8
|
interface SplashScreenProps {
|
|
9
|
+
Presentation?: ComponentType<AuthLoadingScreenProps>;
|
|
10
|
+
Screen?: ComponentType<AuthLoadingScreenProps>;
|
|
6
11
|
icon?: ReactNode;
|
|
7
12
|
}
|
|
8
|
-
export function SplashScreen({ icon: Icon }: SplashScreenProps) {
|
|
13
|
+
export function SplashScreen({ icon: Icon, Screen, Presentation = DefaultAuthLoadingScreen }: SplashScreenProps) {
|
|
9
14
|
const { isLoading, authToken } = useUserSession();
|
|
10
|
-
|
|
15
|
+
// Hand off synchronously: an exiting splash must never cover the next view.
|
|
16
|
+
if (authToken || !isLoading) return null;
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, [isLoading]);
|
|
17
|
-
|
|
18
|
-
// The permission gate owns the loading UI once a token is available.
|
|
19
|
-
// Skip the exit animation too, so two loading indicators never overlap.
|
|
20
|
-
if (authToken) return null;
|
|
18
|
+
// Custom screens own the entire page, including their animation and positioning.
|
|
19
|
+
const LoadingScreen = Screen ?? Presentation;
|
|
20
|
+
return <LoadingScreen loadingIcon={Icon} />;
|
|
21
|
+
}
|
|
21
22
|
|
|
23
|
+
/** Presentation shared by the default shell and configured branding. */
|
|
24
|
+
export function DefaultAuthLoadingScreen({
|
|
25
|
+
loadingIcon,
|
|
26
|
+
loadingLabel = 'Loading',
|
|
27
|
+
}: AuthLoadingScreenProps & { loadingLabel?: string }) {
|
|
22
28
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
}}
|
|
40
|
-
className="flex w-full h-full items-center justify-center"
|
|
41
|
-
>
|
|
42
|
-
<div className="animate-[spin_4s_linear_infinite]">
|
|
43
|
-
<div className="animate-pulse rounded-full bg-transparent">{Icon || <LoadingIcon />}</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</motion.div>
|
|
47
|
-
)}
|
|
48
|
-
</AnimatePresence>
|
|
29
|
+
<div style={{ position: 'fixed', inset: 0, zIndex: 999999 }} role="status" aria-label={loadingLabel}>
|
|
30
|
+
<div
|
|
31
|
+
style={{
|
|
32
|
+
display: 'flex',
|
|
33
|
+
width: '100%',
|
|
34
|
+
height: '100%',
|
|
35
|
+
alignItems: 'center',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
}}
|
|
38
|
+
className="flex w-full h-full items-center justify-center"
|
|
39
|
+
>
|
|
40
|
+
<LoadingAnimation loadingIcon={loadingIcon} />
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
49
43
|
);
|
|
50
44
|
}
|
|
51
45
|
|
|
@@ -83,3 +77,14 @@ function LoadingIcon() {
|
|
|
83
77
|
</svg>
|
|
84
78
|
);
|
|
85
79
|
}
|
|
80
|
+
|
|
81
|
+
/** Shared logo motion for full-screen and in-content loading states. */
|
|
82
|
+
export function LoadingAnimation({ loadingIcon }: AuthLoadingScreenProps) {
|
|
83
|
+
return (
|
|
84
|
+
<div className="animate-[var(--vertesia-loading-animation,spin_4s_linear_infinite)] motion-reduce:animate-none">
|
|
85
|
+
<div className="animate-[var(--vertesia-loading-pulse-animation,pulse_2s_cubic-bezier(0.4,0,0.6,1)_infinite)] motion-reduce:animate-none rounded-full bg-transparent">
|
|
86
|
+
{loadingIcon || <LoadingIcon />}
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { ThemeProvider, ToastProvider } from '@vertesia/ui/core';
|
|
2
|
-
import { TypeRegistryProvider, UserPermissionProvider } from '@vertesia/ui/features';
|
|
2
|
+
import { type PermissionLoadingScreenProps, TypeRegistryProvider, UserPermissionProvider } from '@vertesia/ui/features';
|
|
3
3
|
import { LanguageBoundI18nProvider, LanguageProvider, type SupportedLanguage } from '@vertesia/ui/i18n';
|
|
4
4
|
import { DevSessionProvider, UserSessionProvider } from '@vertesia/ui/session';
|
|
5
|
-
import type { ReactNode } from 'react';
|
|
5
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
6
|
+
import type { AppBranding } from '../boot/branding.js';
|
|
6
7
|
import { IframeAppContextSync } from './apps/IframeAppContextSync.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { AppBrandingProvider, BrandedAuthLoadingScreen, brandedAuthScreens } from './BrandedAuthScreens';
|
|
9
|
+
import { type SignInScreenViewProps, SigninScreen } from './login/SigninScreen';
|
|
10
|
+
import { type AuthLoadingScreenProps, SplashScreen } from './SplashScreen';
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
/** Optional full-page presentations. Session and permission gating remain owned by the shell. */
|
|
13
|
+
export interface AuthScreens {
|
|
14
|
+
SignIn?: ComponentType<SignInScreenViewProps>;
|
|
15
|
+
Loading?: ComponentType<AuthLoadingScreenProps>;
|
|
16
|
+
Permissions?: ComponentType<PermissionLoadingScreenProps>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface VertesiaShellProps {
|
|
20
|
+
authScreens?: AuthScreens;
|
|
21
|
+
branding?: AppBranding;
|
|
11
22
|
children: React.ReactNode;
|
|
12
23
|
lightLogo?: string;
|
|
13
24
|
darkLogo?: string;
|
|
@@ -30,26 +41,38 @@ export function VertesiaShell({
|
|
|
30
41
|
suppressSignInErrorPrefixes,
|
|
31
42
|
authToken,
|
|
32
43
|
defaultLanguage,
|
|
44
|
+
authScreens,
|
|
45
|
+
branding,
|
|
33
46
|
}: VertesiaShellProps) {
|
|
34
|
-
const
|
|
47
|
+
const screens = { ...(branding ? brandedAuthScreens : {}), ...authScreens };
|
|
48
|
+
const brandedContent = (
|
|
35
49
|
<TypeRegistryProvider>
|
|
36
50
|
<ThemeProvider defaultTheme="system" storageKey="vite-ui-theme">
|
|
37
51
|
<LanguageProvider defaultLanguage={defaultLanguage}>
|
|
38
52
|
<LanguageBoundI18nProvider>
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
<AppBrandingBoundary branding={branding}>
|
|
54
|
+
<IframeAppContextSync />
|
|
55
|
+
{!authToken && (
|
|
56
|
+
<>
|
|
57
|
+
<SplashScreen
|
|
58
|
+
icon={loadingIcon}
|
|
59
|
+
Screen={authScreens?.Loading}
|
|
60
|
+
Presentation={branding ? BrandedAuthLoadingScreen : undefined}
|
|
61
|
+
/>
|
|
62
|
+
<SigninScreen
|
|
63
|
+
View={screens.SignIn}
|
|
64
|
+
allowedPrefix="/shared/"
|
|
65
|
+
darkLogo={darkLogo}
|
|
66
|
+
lightLogo={lightLogo}
|
|
67
|
+
preservePath={preserveSignInPath}
|
|
68
|
+
suppressAuthErrorPrefix={suppressSignInErrorPrefixes}
|
|
69
|
+
/>
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
<UserPermissionProvider loadingIcon={loadingIcon} LoadingScreen={screens.Permissions}>
|
|
73
|
+
{children}
|
|
74
|
+
</UserPermissionProvider>
|
|
75
|
+
</AppBrandingBoundary>
|
|
53
76
|
</LanguageBoundI18nProvider>
|
|
54
77
|
</LanguageProvider>
|
|
55
78
|
</ThemeProvider>
|
|
@@ -59,10 +82,14 @@ export function VertesiaShell({
|
|
|
59
82
|
return (
|
|
60
83
|
<ToastProvider>
|
|
61
84
|
{authToken ? (
|
|
62
|
-
<DevSessionProvider token={authToken}>{
|
|
85
|
+
<DevSessionProvider token={authToken}>{brandedContent}</DevSessionProvider>
|
|
63
86
|
) : (
|
|
64
|
-
<UserSessionProvider loadOnboardingStatus={loadOnboardingStatus}>{
|
|
87
|
+
<UserSessionProvider loadOnboardingStatus={loadOnboardingStatus}>{brandedContent}</UserSessionProvider>
|
|
65
88
|
)}
|
|
66
89
|
</ToastProvider>
|
|
67
90
|
);
|
|
68
91
|
}
|
|
92
|
+
|
|
93
|
+
function AppBrandingBoundary({ branding, children }: { branding?: AppBranding; children: ReactNode }) {
|
|
94
|
+
return branding ? <AppBrandingProvider branding={branding}>{children}</AppBrandingProvider> : children;
|
|
95
|
+
}
|
|
@@ -109,7 +109,11 @@ function AccessDeniedMessage({ name }: AccessDeniedMessageProps) {
|
|
|
109
109
|
const onProjectChange = (selected: ProjectRef) => {
|
|
110
110
|
localStorage.setItem(LastSelectedAccountId_KEY, selected.account);
|
|
111
111
|
localStorage.setItem(`${LastSelectedProjectId_KEY}-${selected.account}`, selected.id);
|
|
112
|
-
|
|
112
|
+
// An explicit selection must override configured workspace defaults on the next load.
|
|
113
|
+
const url = new URL(window.location.href);
|
|
114
|
+
url.searchParams.set('a', selected.account);
|
|
115
|
+
url.searchParams.set('p', selected.id);
|
|
116
|
+
window.location.assign(url.toString());
|
|
113
117
|
};
|
|
114
118
|
|
|
115
119
|
const filteredProjects = selectedAccountId ? projectsByOrg[selectedAccountId] || [] : [];
|
package/src/shell/index.tsx
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
export * from './AuthScreenPreview';
|
|
1
2
|
export * from './apps/index';
|
|
3
|
+
export * from './BrandedAuthScreens';
|
|
2
4
|
export * from './login/InviteAcceptModal';
|
|
5
|
+
export * from './login/SignInFlow';
|
|
6
|
+
export * from './login/SignInPageShell';
|
|
3
7
|
export * from './login/SigninScreen';
|
|
8
|
+
export * from './login/signInUtils';
|
|
4
9
|
export * from './login/TerminalLogin';
|
|
5
10
|
export * from './login/UserSessionMenu';
|
|
11
|
+
export type { AuthLoadingScreenProps } from './SplashScreen';
|
|
6
12
|
export * from './utils';
|
|
7
13
|
export * from './VertesiaShell';
|
|
@@ -28,10 +28,10 @@ export default function SignInAuthPending({ provider, onCancel }: SignInAuthPend
|
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
30
|
<div className="w-full flex flex-col gap-2">
|
|
31
|
-
<
|
|
31
|
+
<div className="flex justify-center">
|
|
32
32
|
<Spinner />
|
|
33
|
-
|
|
34
|
-
</
|
|
33
|
+
</div>
|
|
34
|
+
<span>{t('auth.pending.authenticating')}</span>
|
|
35
35
|
{onCancel && (
|
|
36
36
|
<SignInStepButton variant="ghost" onClick={onCancel}>
|
|
37
37
|
{t('auth.pending.cancel')}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import { afterEach, expect, it, vi } from 'vitest';
|
|
3
|
+
import SignInEmailStep from './SignInEmailStep';
|
|
4
|
+
|
|
5
|
+
const resolveTenant = vi.hoisted(() => vi.fn());
|
|
6
|
+
vi.mock('@vertesia/ui/session', () => ({ setFirebaseTenant: resolveTenant }));
|
|
7
|
+
vi.mock('@vertesia/ui/i18n', () => ({ useUITranslation: () => ({ t: (key: string) => key }) }));
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cleanup();
|
|
10
|
+
vi.clearAllMocks();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('keeps feedback visible and prevents duplicate requests while tenant discovery is pending', async () => {
|
|
14
|
+
let finish!: () => void;
|
|
15
|
+
resolveTenant.mockReturnValue(
|
|
16
|
+
new Promise<void>((resolve) => {
|
|
17
|
+
finish = resolve;
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
const onProceed = vi.fn();
|
|
21
|
+
render(<SignInEmailStep initialEmail="person@example.com" onProceed={onProceed} />);
|
|
22
|
+
const button = screen.getByRole('button', { name: 'auth.continue' });
|
|
23
|
+
fireEvent.click(button);
|
|
24
|
+
expect(screen.queryByRole('button', { name: 'auth.continue' })).toBeNull();
|
|
25
|
+
expect(screen.getByRole('textbox')).toBeTruthy();
|
|
26
|
+
expect(screen.getByRole('status')).toBeTruthy();
|
|
27
|
+
expect(button.contains(screen.getByRole('status'))).toBe(false);
|
|
28
|
+
fireEvent.submit(screen.getByRole('textbox').closest('form')!);
|
|
29
|
+
expect(resolveTenant).toHaveBeenCalledTimes(1);
|
|
30
|
+
finish();
|
|
31
|
+
await waitFor(() => expect(onProceed).toHaveBeenCalledWith('person@example.com', undefined));
|
|
32
|
+
});
|
|
@@ -67,16 +67,20 @@ export default function SignInEmailStep({ initialEmail, onProceed }: SignInEmail
|
|
|
67
67
|
error={submitError ? t('auth.email.invalidError') : undefined}
|
|
68
68
|
/>
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
{loading ? (
|
|
71
|
+
<div
|
|
72
|
+
role="status"
|
|
73
|
+
aria-label={t('auth.pending.authenticating')}
|
|
74
|
+
className="h-[42px] flex items-center justify-center"
|
|
75
|
+
>
|
|
72
76
|
<Spinner />
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
</div>
|
|
78
|
+
) : (
|
|
79
|
+
<SignInStepButton type="submit">
|
|
80
|
+
<span>{t('auth.continue')}</span>
|
|
81
|
+
<ArrowRight className="!size-3.5" />
|
|
82
|
+
</SignInStepButton>
|
|
83
|
+
)}
|
|
80
84
|
</form>
|
|
81
85
|
</SignInStepLayout>
|
|
82
86
|
);
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sign-in state machine, extracted from SigninScreen so more than one host can drive it.
|
|
3
|
+
*
|
|
4
|
+
* Two hosts run it today: the Studio shell, which layers its own error-recovery modes on top
|
|
5
|
+
* (`SigninScreen`), and the Central Auth broker, which has no Vertesia session and renders only the
|
|
6
|
+
* modes below. The interesting behaviour is not the markup — it is the ordering: remembered
|
|
7
|
+
* identity first, then email, then tenant resolution deciding which providers are even offered.
|
|
8
|
+
* Re-implementing that per host is how the two pages drift apart.
|
|
9
|
+
*
|
|
10
|
+
* The hook takes no session dependency of its own: `signOut` and `trackEvent` come in as options
|
|
11
|
+
* because a host without a `UserSessionProvider` cannot call those hooks.
|
|
12
|
+
*/
|
|
13
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
14
|
+
import SignInAuthPending from './SignInAuthPending';
|
|
15
|
+
import SignInEmailStep, { type TenantInfo } from './SignInEmailStep';
|
|
16
|
+
import SignInProvidersStep from './SignInProvidersStep';
|
|
17
|
+
import SignInReturningStep from './SignInReturningStep';
|
|
18
|
+
import SignInTenantStep from './SignInTenantStep';
|
|
19
|
+
import {
|
|
20
|
+
clearLastSuccessfulLogin,
|
|
21
|
+
clearPendingSignin,
|
|
22
|
+
finalizeSuccessfulLogin,
|
|
23
|
+
type LastSuccessfulLogin,
|
|
24
|
+
type ProviderId,
|
|
25
|
+
readLastSuccessfulLogin,
|
|
26
|
+
resetSignInState,
|
|
27
|
+
signOutOfFirebase,
|
|
28
|
+
} from './signInUtils';
|
|
29
|
+
|
|
30
|
+
/** The modes every host shares. Hosts may add their own; see the `M` parameter below. */
|
|
31
|
+
export type SignInCoreMode = 'email' | 'providers' | 'tenant' | 'returning' | 'pending';
|
|
32
|
+
|
|
33
|
+
export interface SignInFlowOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Host sign-out, run when the user abandons the remembered identity. Defaults to a plain
|
|
36
|
+
* Firebase sign-out; a host with a Vertesia session passes its own so the session goes too.
|
|
37
|
+
*/
|
|
38
|
+
signOut?: () => void | Promise<void>;
|
|
39
|
+
/** Analytics sink. Only `enterprise_signin` is emitted, and only for a tenant-resolved sign-in. */
|
|
40
|
+
trackEvent?: (eventName: string, eventProperties?: Record<string, unknown>) => void;
|
|
41
|
+
/**
|
|
42
|
+
* The authenticated user, once there is one. Supplying it lets the flow stamp the display name
|
|
43
|
+
* onto the remembered-login record; a host that unmounts the flow on login should call
|
|
44
|
+
* {@link finalizeSuccessfulLogin} itself instead.
|
|
45
|
+
*/
|
|
46
|
+
user?: { name?: string | null } | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Flow state plus the handlers the steps are wired to.
|
|
51
|
+
*
|
|
52
|
+
* `M` is the host's own extra modes: `SigninScreen` passes its error-recovery union so `mode` and
|
|
53
|
+
* `setMode` stay exhaustively typed there, while a host with no extra modes gets `SignInCoreMode`.
|
|
54
|
+
*/
|
|
55
|
+
export interface SignInFlowController<M extends string = never> {
|
|
56
|
+
mode: SignInCoreMode | M;
|
|
57
|
+
setMode: (mode: SignInCoreMode | M) => void;
|
|
58
|
+
email: string;
|
|
59
|
+
setEmail: (email: string) => void;
|
|
60
|
+
tenant: TenantInfo | undefined;
|
|
61
|
+
setTenant: (tenant: TenantInfo | undefined) => void;
|
|
62
|
+
storedSession: LastSuccessfulLogin | null;
|
|
63
|
+
setStoredSession: (session: LastSuccessfulLogin | null) => void;
|
|
64
|
+
pendingProvider: ProviderId | null;
|
|
65
|
+
/** Email accepted: go to the tenant step when one resolved, otherwise the provider list. */
|
|
66
|
+
onProceedFromEmail: (email: string, tenant?: TenantInfo) => void;
|
|
67
|
+
/** Back to the email step, dropping the resolved tenant. */
|
|
68
|
+
onBack: () => void;
|
|
69
|
+
/** "Not you?" — forget the remembered identity and sign out. */
|
|
70
|
+
onNotYou: () => void;
|
|
71
|
+
/** A provider was picked; show the pending screen while the IdP redirect happens. */
|
|
72
|
+
onProviderClicked: (provider: ProviderId) => void;
|
|
73
|
+
/** Full reset: clear the persisted records and the Firebase session, back to the email step. */
|
|
74
|
+
startOver: () => void;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function useSignInFlow<M extends string = never>(options: SignInFlowOptions = {}): SignInFlowController<M> {
|
|
78
|
+
const { signOut, trackEvent, user } = options;
|
|
79
|
+
|
|
80
|
+
const [storedSession, setStoredSession] = useState<LastSuccessfulLogin | null>(() => readLastSuccessfulLogin());
|
|
81
|
+
const [mode, setMode] = useState<SignInCoreMode | M>(() => (readLastSuccessfulLogin() ? 'returning' : 'email'));
|
|
82
|
+
const [email, setEmail] = useState('');
|
|
83
|
+
const [tenant, setTenant] = useState<TenantInfo | undefined>(undefined);
|
|
84
|
+
const [pendingProvider, setPendingProvider] = useState<ProviderId | null>(null);
|
|
85
|
+
|
|
86
|
+
// On successful login, finalize the last-successful-login entry with the user's name.
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!user) return;
|
|
89
|
+
finalizeSuccessfulLogin(user.name ?? undefined);
|
|
90
|
+
}, [user]);
|
|
91
|
+
|
|
92
|
+
const onProceedFromEmail = useCallback((e: string, t: TenantInfo | undefined) => {
|
|
93
|
+
setEmail(e);
|
|
94
|
+
setTenant(t);
|
|
95
|
+
setMode(t ? 'tenant' : 'providers');
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
const onBack = useCallback(() => {
|
|
99
|
+
setMode('email');
|
|
100
|
+
setTenant(undefined);
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
const onNotYou = useCallback(() => {
|
|
104
|
+
clearLastSuccessfulLogin();
|
|
105
|
+
clearPendingSignin();
|
|
106
|
+
setStoredSession(null);
|
|
107
|
+
setEmail('');
|
|
108
|
+
setTenant(undefined);
|
|
109
|
+
setMode('email');
|
|
110
|
+
// Without a host sign-out, drop the Firebase session anyway: leaving it behind means the
|
|
111
|
+
// next auth-state change re-authenticates the identity the user just said isn't theirs.
|
|
112
|
+
void (signOut ? signOut() : signOutOfFirebase());
|
|
113
|
+
}, [signOut]);
|
|
114
|
+
|
|
115
|
+
const onProviderClicked = useCallback(
|
|
116
|
+
(provider: ProviderId) => {
|
|
117
|
+
// Tenant context comes from a resolved tenant or stored tenantName, not the provider.
|
|
118
|
+
const hasTenant = !!tenant || !!storedSession?.tenantName;
|
|
119
|
+
// Only the pre-existing enterprise_signin event; non-tenant sign-ins emit nothing.
|
|
120
|
+
if (hasTenant) trackEvent?.('enterprise_signin', { provider });
|
|
121
|
+
setPendingProvider(provider);
|
|
122
|
+
setMode('pending');
|
|
123
|
+
// The redirect itself happens in the calling step's startSignIn(); this just shows the pending screen.
|
|
124
|
+
},
|
|
125
|
+
[trackEvent, storedSession?.tenantName, tenant],
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
const startOver = useCallback(() => {
|
|
129
|
+
setStoredSession(null); // drop the in-memory mirror too — resetSignInState only clears storage
|
|
130
|
+
setEmail('');
|
|
131
|
+
setTenant(undefined);
|
|
132
|
+
setMode('email');
|
|
133
|
+
void resetSignInState();
|
|
134
|
+
}, []);
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
mode,
|
|
138
|
+
setMode,
|
|
139
|
+
email,
|
|
140
|
+
setEmail,
|
|
141
|
+
tenant,
|
|
142
|
+
setTenant,
|
|
143
|
+
storedSession,
|
|
144
|
+
setStoredSession,
|
|
145
|
+
pendingProvider,
|
|
146
|
+
onProceedFromEmail,
|
|
147
|
+
onBack,
|
|
148
|
+
onNotYou,
|
|
149
|
+
onProviderClicked,
|
|
150
|
+
startOver,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The part of the controller the shared steps read.
|
|
156
|
+
*
|
|
157
|
+
* Deliberately excludes the setters: their parameter types mention the host's extra modes, and a
|
|
158
|
+
* contravariant position would stop `SignInFlowController<never>` from being passed here.
|
|
159
|
+
*/
|
|
160
|
+
export type SignInStepsController = Omit<
|
|
161
|
+
SignInFlowController<string>,
|
|
162
|
+
'setMode' | 'setEmail' | 'setTenant' | 'setStoredSession' | 'startOver'
|
|
163
|
+
>;
|
|
164
|
+
|
|
165
|
+
interface SignInFlowStepsProps {
|
|
166
|
+
flow: SignInStepsController;
|
|
167
|
+
/** Path to return to after the IdP round-trip. Defaults to the current pathname. */
|
|
168
|
+
redirectTo?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Renders the step for the current core mode. A host mode this doesn't know falls through to the
|
|
173
|
+
* email step, which is where the original screen sent an unrecognized state too.
|
|
174
|
+
*/
|
|
175
|
+
export function SignInFlowSteps({ flow, redirectTo }: SignInFlowStepsProps) {
|
|
176
|
+
const { mode, email, tenant, storedSession, pendingProvider } = flow;
|
|
177
|
+
|
|
178
|
+
if (mode === 'pending' && pendingProvider) {
|
|
179
|
+
return <SignInAuthPending provider={pendingProvider} />;
|
|
180
|
+
}
|
|
181
|
+
if (mode === 'tenant' && tenant) {
|
|
182
|
+
return (
|
|
183
|
+
<SignInTenantStep
|
|
184
|
+
email={email}
|
|
185
|
+
tenant={tenant}
|
|
186
|
+
onBack={flow.onBack}
|
|
187
|
+
onProviderClicked={() => flow.onProviderClicked((tenant.provider ?? 'oidc') as ProviderId)}
|
|
188
|
+
redirectTo={redirectTo}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
if (mode === 'providers') {
|
|
193
|
+
return (
|
|
194
|
+
<SignInProvidersStep
|
|
195
|
+
email={email}
|
|
196
|
+
onBack={flow.onBack}
|
|
197
|
+
onProviderClicked={flow.onProviderClicked}
|
|
198
|
+
redirectTo={redirectTo}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
if (mode === 'returning' && storedSession) {
|
|
203
|
+
return (
|
|
204
|
+
<SignInReturningStep
|
|
205
|
+
session={storedSession}
|
|
206
|
+
onNotYou={flow.onNotYou}
|
|
207
|
+
onProviderClicked={flow.onProviderClicked}
|
|
208
|
+
redirectTo={redirectTo}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
return <SignInEmailStep initialEmail={email} onProceed={flow.onProceedFromEmail} />;
|
|
213
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chrome around a sign-in step: product logo, the step itself, an optional notice, and the
|
|
3
|
+
* legal footer. Hosts supply their own outer container — the Studio shell overlays the app, the
|
|
4
|
+
* Central Auth broker owns the whole document — so this component deliberately does not position
|
|
5
|
+
* itself.
|
|
6
|
+
*/
|
|
7
|
+
import { useUITranslation } from '@vertesia/ui/i18n';
|
|
8
|
+
import { RegionTag } from '@vertesia/ui/layout';
|
|
9
|
+
import type { ReactNode } from 'react';
|
|
10
|
+
|
|
11
|
+
interface SignInPageShellProps {
|
|
12
|
+
logoAlt?: string;
|
|
13
|
+
footer?: string;
|
|
14
|
+
lightLogo?: string;
|
|
15
|
+
darkLogo?: string;
|
|
16
|
+
/** Rendered between the step and the footer — e.g. a generic authentication error. */
|
|
17
|
+
notice?: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function SignInPageShell({
|
|
22
|
+
lightLogo,
|
|
23
|
+
darkLogo,
|
|
24
|
+
notice,
|
|
25
|
+
children,
|
|
26
|
+
logoAlt = 'Vertesia',
|
|
27
|
+
footer,
|
|
28
|
+
}: SignInPageShellProps) {
|
|
29
|
+
const { t } = useUITranslation();
|
|
30
|
+
return (
|
|
31
|
+
<div className="min-h-full flex flex-col items-center justify-center py-12 px-4">
|
|
32
|
+
<div className="flex flex-col items-center w-full">
|
|
33
|
+
{(lightLogo || darkLogo) && (
|
|
34
|
+
<div className="mb-7">
|
|
35
|
+
{lightLogo && <img src={lightLogo} alt={logoAlt} className="h-10 block dark:hidden" />}
|
|
36
|
+
{darkLogo && <img src={darkLogo} alt={logoAlt} className="h-10 hidden dark:block" />}
|
|
37
|
+
</div>
|
|
38
|
+
)}
|
|
39
|
+
|
|
40
|
+
{children}
|
|
41
|
+
|
|
42
|
+
{notice}
|
|
43
|
+
|
|
44
|
+
{footer ? (
|
|
45
|
+
<p className="mt-10 text-xs text-muted">{footer}</p>
|
|
46
|
+
) : (
|
|
47
|
+
<div className="flex items-center gap-5 mt-10 text-xs text-muted">
|
|
48
|
+
<a href="https://vertesiahq.com/privacy" className="hover:text-foreground transition">
|
|
49
|
+
{t('auth.privacyPolicy')}
|
|
50
|
+
</a>
|
|
51
|
+
<span className="text-border">·</span>
|
|
52
|
+
<a href="https://vertesiahq.com/terms" className="hover:text-foreground transition">
|
|
53
|
+
{t('auth.termsOfService')}
|
|
54
|
+
</a>
|
|
55
|
+
<span className="text-border">·</span>
|
|
56
|
+
<RegionTag className="cursor-default" />
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|