@vertesia/ui 1.4.0 → 1.5.0-dev.20260713.151751Z
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/lib/core/components/InputList.d.ts.map +1 -1
- package/lib/core/components/InputList.js +3 -2
- package/lib/core/components/InputList.js.map +1 -1
- package/lib/core/components/SelectList.d.ts.map +1 -1
- package/lib/core/components/SelectList.js +1 -1
- package/lib/core/components/SelectList.js.map +1 -1
- package/lib/core/components/TagsInput.d.ts.map +1 -1
- package/lib/core/components/TagsInput.js +36 -4
- package/lib/core/components/TagsInput.js.map +1 -1
- package/lib/core/components/popup/Popup.js +2 -1
- package/lib/core/components/popup/Popup.js.map +1 -1
- package/lib/core/components/popup/position.d.ts.map +1 -1
- package/lib/core/components/popup/position.js +3 -6
- package/lib/core/components/popup/position.js.map +1 -1
- package/lib/core/components/shadcn/badge.d.ts +2 -2
- package/lib/core/components/shadcn/badge.d.ts.map +1 -1
- package/lib/core/components/shadcn/badge.js +3 -0
- package/lib/core/components/shadcn/badge.js.map +1 -1
- package/lib/core/components/shadcn/breadcrumb.d.ts.map +1 -1
- package/lib/core/components/shadcn/breadcrumb.js +2 -2
- package/lib/core/components/shadcn/breadcrumb.js.map +1 -1
- package/lib/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
- package/lib/core/components/shadcn/filters/filterBar.js +1 -3
- package/lib/core/components/shadcn/filters/filterBar.js.map +1 -1
- package/lib/core/components/shadcn/resizeable.d.ts +1 -1
- package/lib/core/components/shadcn/resizeable.d.ts.map +1 -1
- package/lib/core/components/shadcn/resizeable.js +12 -2
- package/lib/core/components/shadcn/resizeable.js.map +1 -1
- package/lib/core/components/shadcn/selectBox.d.ts +7 -1
- package/lib/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/core/components/shadcn/selectBox.js +29 -12
- package/lib/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/core/components/table/index.d.ts.map +1 -1
- package/lib/core/components/table/index.js +1 -1
- package/lib/core/components/table/index.js.map +1 -1
- package/lib/core/hooks/useIntersectionObserver.d.ts.map +1 -1
- package/lib/core/hooks/useIntersectionObserver.js +3 -1
- package/lib/core/hooks/useIntersectionObserver.js.map +1 -1
- package/lib/features/agent/chat/AgentRightPanel.d.ts.map +1 -1
- package/lib/features/agent/chat/AgentRightPanel.js +3 -6
- package/lib/features/agent/chat/AgentRightPanel.js.map +1 -1
- package/lib/features/agent/chat/AnimatedThinkingDots.d.ts.map +1 -1
- package/lib/features/agent/chat/AnimatedThinkingDots.js +1 -1
- package/lib/features/agent/chat/AnimatedThinkingDots.js.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.d.ts.map +1 -1
- package/lib/features/agent/chat/AskUserWidget.js +4 -3
- package/lib/features/agent/chat/AskUserWidget.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentConversation.js +56 -11
- package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +8 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +40 -31
- package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +3 -3
- package/lib/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +5 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +3 -7
- package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/PlanPanel.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/PlanPanel.js +5 -5
- package/lib/features/agent/chat/ModernAgentOutput/PlanPanel.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js +4 -4
- package/lib/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +3 -3
- package/lib/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -1
- package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +156 -8
- package/lib/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
- package/lib/features/agent/chat/hooks/useFileProcessing.d.ts +1 -0
- package/lib/features/agent/chat/hooks/useFileProcessing.d.ts.map +1 -1
- package/lib/features/agent/chat/hooks/useFileProcessing.js +37 -3
- package/lib/features/agent/chat/hooks/useFileProcessing.js.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.js +1 -1
- package/lib/features/facets/AgentRunnerFacetsNav.js.map +1 -1
- package/lib/features/facets/InteractionsFacetsNav.d.ts +10 -1
- package/lib/features/facets/InteractionsFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/InteractionsFacetsNav.js +14 -5
- package/lib/features/facets/InteractionsFacetsNav.js.map +1 -1
- package/lib/features/facets/PromptsFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/PromptsFacetsNav.js +12 -1
- package/lib/features/facets/PromptsFacetsNav.js.map +1 -1
- package/lib/features/facets/RunsFacetsNav.d.ts.map +1 -1
- package/lib/features/facets/RunsFacetsNav.js +1 -1
- package/lib/features/facets/RunsFacetsNav.js.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.d.ts.map +1 -1
- package/lib/features/magic-pdf/AnnotatedImageSlider.js +1 -3
- package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
- package/lib/features/magic-pdf/MagicPdfProvider.js +2 -3
- package/lib/features/magic-pdf/MagicPdfProvider.js.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.d.ts +6 -2
- package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
- package/lib/features/store/objects/DocumentSearchResults.js +6 -6
- package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/features/store/objects/components/ContentOverview.js +1 -1
- package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/features/store/objects/components/DocumentIcon.d.ts.map +1 -1
- package/lib/features/store/objects/components/DocumentIcon.js +1 -1
- package/lib/features/store/objects/components/DocumentIcon.js.map +1 -1
- package/lib/features/store/objects/components/DocumentInput.js.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts +4 -4
- package/lib/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js +1 -1
- package/lib/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionContext.d.ts.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionContext.js +2 -25
- package/lib/features/store/objects/selection/ObjectsActionContext.js.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionContextClass.d.ts +0 -2
- package/lib/features/store/objects/selection/ObjectsActionContextClass.d.ts.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionContextClass.js +1 -7
- package/lib/features/store/objects/selection/ObjectsActionContextClass.js.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionHooks.d.ts +0 -1
- package/lib/features/store/objects/selection/ObjectsActionHooks.d.ts.map +1 -1
- package/lib/features/store/objects/selection/ObjectsActionHooks.js +0 -10
- package/lib/features/store/objects/selection/ObjectsActionHooks.js.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.d.ts +4 -0
- package/lib/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
- package/lib/features/store/objects/selection/SelectionActions.js +4 -18
- package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.d.ts.map +1 -1
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js +16 -7
- package/lib/features/store/objects/selection/actions/DeleteObjectsAction.js.map +1 -1
- package/lib/features/store/objects/selection/actions/StartWorkflowButton.d.ts +7 -0
- package/lib/features/store/objects/selection/actions/StartWorkflowButton.d.ts.map +1 -0
- package/lib/features/store/objects/selection/actions/StartWorkflowButton.js +51 -0
- package/lib/features/store/objects/selection/actions/StartWorkflowButton.js.map +1 -0
- package/lib/features/store/objects/selection/actions/index.d.ts +0 -1
- package/lib/features/store/objects/selection/actions/index.d.ts.map +1 -1
- package/lib/features/store/objects/selection/actions/index.js +0 -1
- package/lib/features/store/objects/selection/actions/index.js.map +1 -1
- package/lib/features/store/types/ContentObjectTypesSearch.d.ts.map +1 -1
- package/lib/features/store/types/ContentObjectTypesSearch.js +55 -3
- package/lib/features/store/types/ContentObjectTypesSearch.js.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.d.ts +5 -1
- package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
- package/lib/features/store/types/ContentObjectTypesTable.js +4 -2
- package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.js +1 -1
- package/lib/features/store/types/search/ObjectTypeSearchContext.js.map +1 -1
- package/lib/i18n/locales/ar.json +17 -0
- package/lib/i18n/locales/de.json +17 -0
- package/lib/i18n/locales/en.json +33 -0
- package/lib/i18n/locales/es.json +17 -0
- package/lib/i18n/locales/fr.json +17 -0
- package/lib/i18n/locales/it.json +17 -0
- package/lib/i18n/locales/ja.json +17 -0
- package/lib/i18n/locales/ko.json +17 -0
- package/lib/i18n/locales/pt.json +17 -0
- package/lib/i18n/locales/ru.json +17 -0
- package/lib/i18n/locales/tr.json +17 -0
- package/lib/i18n/locales/zh-TW.json +17 -0
- package/lib/i18n/locales/zh.json +17 -0
- package/lib/layout/Sidebar.d.ts +5 -1
- package/lib/layout/Sidebar.d.ts.map +1 -1
- package/lib/layout/Sidebar.js.map +1 -1
- package/lib/router/NestedRouterProvider.d.ts +1 -1
- package/lib/router/NestedRouterProvider.d.ts.map +1 -1
- package/lib/router/NestedRouterProvider.js +2 -2
- package/lib/router/NestedRouterProvider.js.map +1 -1
- package/lib/router/Redirect.d.ts +13 -0
- package/lib/router/Redirect.d.ts.map +1 -0
- package/lib/router/Redirect.js +20 -0
- package/lib/router/Redirect.js.map +1 -0
- package/lib/router/Router.d.ts.map +1 -1
- package/lib/router/Router.js +1 -2
- package/lib/router/Router.js.map +1 -1
- package/lib/router/index.d.ts +1 -0
- package/lib/router/index.d.ts.map +1 -1
- package/lib/router/index.js +1 -0
- package/lib/router/index.js.map +1 -1
- package/lib/session/DevSessionProvider.d.ts +8 -0
- package/lib/session/DevSessionProvider.d.ts.map +1 -0
- package/lib/session/DevSessionProvider.js +33 -0
- package/lib/session/DevSessionProvider.js.map +1 -0
- package/lib/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/session/UserSessionProvider.js +16 -2
- package/lib/session/UserSessionProvider.js.map +1 -1
- package/lib/session/auth/composable.d.ts +10 -1
- package/lib/session/auth/composable.d.ts.map +1 -1
- package/lib/session/auth/composable.js +38 -2
- package/lib/session/auth/composable.js.map +1 -1
- package/lib/session/index.d.ts +1 -0
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +1 -0
- package/lib/session/index.js.map +1 -1
- package/lib/shell/VertesiaShell.d.ts +3 -1
- package/lib/shell/VertesiaShell.d.ts.map +1 -1
- package/lib/shell/VertesiaShell.js +5 -4
- package/lib/shell/VertesiaShell.js.map +1 -1
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts +14 -0
- package/lib/shell/login/SignInRestrictedEnvStep.d.ts.map +1 -0
- package/lib/shell/login/SignInRestrictedEnvStep.js +50 -0
- package/lib/shell/login/SignInRestrictedEnvStep.js.map +1 -0
- package/lib/shell/login/SigninScreen.d.ts.map +1 -1
- package/lib/shell/login/SigninScreen.js +16 -3
- package/lib/shell/login/SigninScreen.js.map +1 -1
- package/lib/shell/login/productionUrl.d.ts +16 -0
- package/lib/shell/login/productionUrl.d.ts.map +1 -0
- package/lib/shell/login/productionUrl.js +19 -0
- package/lib/shell/login/productionUrl.js.map +1 -0
- package/lib/shell/login/signInUtils.d.ts.map +1 -1
- package/lib/shell/login/signInUtils.js +14 -1
- package/lib/shell/login/signInUtils.js.map +1 -1
- package/lib/vertesia-ui-core.js +95 -2
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-env.js +2 -2
- package/lib/vertesia-ui-env.js.map +1 -1
- package/lib/vertesia-ui-features.js +454 -2
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-i18n.js +41 -2
- package/lib/vertesia-ui-i18n.js.map +1 -1
- package/lib/vertesia-ui-layout.js +2 -2
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-router.js +2 -2
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +2 -2
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +2 -2
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +9 -2
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/lib/widgets/json-view/JSONCode.d.ts.map +1 -1
- package/lib/widgets/json-view/JSONCode.js +1 -1
- package/lib/widgets/json-view/JSONCode.js.map +1 -1
- package/lib/widgets/json-view/JSONTable.d.ts.map +1 -1
- package/lib/widgets/json-view/JSONTable.js +1 -1
- package/lib/widgets/json-view/JSONTable.js.map +1 -1
- package/lib/widgets/markdown/ArtifactContentRenderer.d.ts.map +1 -1
- package/lib/widgets/markdown/ArtifactContentRenderer.js +1 -1
- package/lib/widgets/markdown/ArtifactContentRenderer.js.map +1 -1
- package/lib/widgets/markdown/CodeBlockPlaceholder.d.ts.map +1 -1
- package/lib/widgets/markdown/CodeBlockPlaceholder.js +1 -1
- package/lib/widgets/markdown/CodeBlockPlaceholder.js.map +1 -1
- package/lib/widgets/monacoEditor/foldingProviders.d.ts.map +1 -1
- package/lib/widgets/monacoEditor/foldingProviders.js +5 -10
- package/lib/widgets/monacoEditor/foldingProviders.js.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/widgets/schema-editor/ManagedSchema.js +1 -2
- package/lib/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/widgets/upload/UploadResultCategory.d.ts.map +1 -1
- package/lib/widgets/upload/UploadResultCategory.js +1 -1
- package/lib/widgets/upload/UploadResultCategory.js.map +1 -1
- package/lib/widgets/xml-viewer/components/TextElement/index.d.ts.map +1 -1
- package/lib/widgets/xml-viewer/components/TextElement/index.js +1 -1
- package/lib/widgets/xml-viewer/components/TextElement/index.js.map +1 -1
- package/package.json +38 -43
- package/src/core/components/InputList.tsx +5 -10
- package/src/core/components/SelectList.tsx +7 -2
- package/src/core/components/TagsInput.tsx +41 -4
- package/src/core/components/popup/Popup.tsx +3 -3
- package/src/core/components/popup/position.ts +3 -6
- package/src/core/components/shadcn/badge.tsx +3 -0
- package/src/core/components/shadcn/breadcrumb.tsx +2 -4
- package/src/core/components/shadcn/filters/filterBar.tsx +2 -3
- package/src/core/components/shadcn/resizeable.test.tsx +77 -0
- package/src/core/components/shadcn/resizeable.tsx +28 -2
- package/src/core/components/shadcn/selectBox.tsx +70 -36
- package/src/core/components/table/index.tsx +1 -2
- package/src/core/hooks/useIntersectionObserver.tsx +3 -1
- package/src/features/agent/chat/AgentRightPanel.tsx +5 -6
- package/src/features/agent/chat/AnimatedThinkingDots.tsx +1 -2
- package/src/features/agent/chat/AskUserWidget.test.tsx +49 -0
- package/src/features/agent/chat/AskUserWidget.tsx +32 -22
- package/src/features/agent/chat/ModernAgentConversation.test.tsx +198 -1
- package/src/features/agent/chat/ModernAgentConversation.tsx +62 -15
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +60 -34
- package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +3 -3
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.test.tsx +25 -0
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +5 -1
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +30 -30
- package/src/features/agent/chat/ModernAgentOutput/PlanPanel.tsx +5 -6
- package/src/features/agent/chat/ModernAgentOutput/SlidingPlanPanel.tsx +4 -5
- package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +3 -5
- package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +326 -42
- package/src/features/agent/chat/hooks/useFileProcessing.test.tsx +70 -0
- package/src/features/agent/chat/hooks/useFileProcessing.ts +37 -6
- package/src/features/facets/AgentRunnerFacetsNav.tsx +1 -2
- package/src/features/facets/InteractionsFacetsNav.tsx +30 -5
- package/src/features/facets/PromptsFacetsNav.tsx +13 -1
- package/src/features/facets/RunsFacetsNav.tsx +1 -2
- package/src/features/magic-pdf/AnnotatedImageSlider.tsx +1 -2
- package/src/features/magic-pdf/MagicPdfProvider.tsx +4 -4
- package/src/features/store/objects/DocumentSearchResults.tsx +11 -1
- package/src/features/store/objects/components/ContentOverview.tsx +1 -2
- package/src/features/store/objects/components/DocumentIcon.tsx +1 -2
- package/src/features/store/objects/components/DocumentInput.tsx +2 -2
- package/src/features/store/objects/search/DocumentSearchContext.test.ts +2 -2
- package/src/features/store/objects/search/DocumentSearchContext.ts +3 -3
- package/src/features/store/objects/selection/ObjectsActionContext.tsx +2 -27
- package/src/features/store/objects/selection/ObjectsActionContextClass.ts +1 -7
- package/src/features/store/objects/selection/ObjectsActionHooks.ts +0 -11
- package/src/features/store/objects/selection/SelectionActions.tsx +9 -34
- package/src/features/store/objects/selection/actions/DeleteObjectsAction.tsx +40 -7
- package/src/features/store/objects/selection/actions/StartWorkflowButton.tsx +104 -0
- package/src/features/store/objects/selection/actions/index.ts +0 -1
- package/src/features/store/types/ContentObjectTypesSearch.tsx +110 -1
- package/src/features/store/types/ContentObjectTypesTable.tsx +42 -3
- package/src/features/store/types/search/ObjectTypeSearchContext.tsx +1 -1
- package/src/i18n/locales/ar.json +17 -0
- package/src/i18n/locales/de.json +17 -0
- package/src/i18n/locales/en.json +33 -0
- package/src/i18n/locales/es.json +17 -0
- package/src/i18n/locales/fr.json +17 -0
- package/src/i18n/locales/it.json +17 -0
- package/src/i18n/locales/ja.json +17 -0
- package/src/i18n/locales/ko.json +17 -0
- package/src/i18n/locales/pt.json +17 -0
- package/src/i18n/locales/ru.json +17 -0
- package/src/i18n/locales/tr.json +17 -0
- package/src/i18n/locales/zh-TW.json +17 -0
- package/src/i18n/locales/zh.json +17 -0
- package/src/layout/Sidebar.tsx +6 -1
- package/src/router/NestedRouterProvider.tsx +2 -2
- package/src/router/Redirect.tsx +29 -0
- package/src/router/Router.tsx +1 -2
- package/src/router/index.ts +1 -0
- package/src/session/DevSessionProvider.tsx +46 -0
- package/src/session/UserSessionProvider.tsx +18 -2
- package/src/session/auth/composable.ts +41 -3
- package/src/session/index.ts +1 -0
- package/src/shell/VertesiaShell.tsx +27 -14
- package/src/shell/login/SignInRestrictedEnvStep.tsx +87 -0
- package/src/shell/login/SigninScreen.tsx +29 -16
- package/src/shell/login/productionUrl.test.ts +19 -0
- package/src/shell/login/productionUrl.ts +18 -0
- package/src/shell/login/signInUtils.ts +14 -1
- package/src/widgets/json-view/JSONCode.tsx +1 -2
- package/src/widgets/json-view/JSONTable.tsx +1 -2
- package/src/widgets/markdown/ArtifactContentRenderer.tsx +4 -7
- package/src/widgets/markdown/CodeBlockPlaceholder.tsx +1 -2
- package/src/widgets/monacoEditor/foldingProviders.ts +10 -15
- package/src/widgets/schema-editor/ManagedSchema.ts +1 -2
- package/src/widgets/upload/UploadResultCategory.tsx +2 -3
- package/src/widgets/xml-viewer/components/TextElement/index.tsx +1 -2
- package/lib/features/store/objects/selection/actions/StartWorkflowComponent.d.ts +0 -4
- package/lib/features/store/objects/selection/actions/StartWorkflowComponent.d.ts.map +0 -1
- package/lib/features/store/objects/selection/actions/StartWorkflowComponent.js +0 -77
- package/lib/features/store/objects/selection/actions/StartWorkflowComponent.js.map +0 -1
- package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +0 -127
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertesia-ui-session.js","sources":["session/constants.js","session/auth/firebase.js","session/auth/composable.js","session/auth/useAuthState.js","session/auth/domainRouting.js","session/UserSession.js","session/auth/useCurrentTenant.js","session/UserSessionProvider.js","session/useUXTracking.js"],"sourcesContent":["export const LastSelectedAccountId_KEY = 'composableai.lastSelectedAccountId';\nexport const LastSelectedProjectId_KEY = 'composableai.lastSelectedProjectId';\n//# sourceMappingURL=constants.js.map","import { Env } from '@vertesia/ui/env';\nimport { getAnalytics } from 'firebase/analytics';\nimport { initializeApp } from 'firebase/app';\nimport { getAuth } from 'firebase/auth';\n// Use lazy initialization to avoid accessing Env before it's initialized\nlet _firebaseApp = null;\nlet _analytics = null;\nlet _firebaseAuth = null;\n// Getters that lazily initialize Firebase components when first accessed\nexport function getFirebaseApp() {\n if (!_firebaseApp) {\n try {\n if (!Env.firebase) {\n throw new Error('Firebase configuration is not available in the environment');\n }\n _firebaseApp = initializeApp(Env.firebase);\n }\n catch (error) {\n console.error('Failed to initialize Firebase app:', error);\n throw new Error('Firebase initialization failed - environment may not be properly initialized', {\n cause: error,\n });\n }\n }\n return _firebaseApp;\n}\nexport function getFirebaseAnalytics() {\n if (!_analytics) {\n _analytics = getAnalytics(getFirebaseApp());\n }\n return _analytics;\n}\nexport function getFirebaseAuth() {\n if (!_firebaseAuth) {\n _firebaseAuth = getAuth(getFirebaseApp());\n }\n return _firebaseAuth;\n}\nexport async function setFirebaseTenant(tenantEmail) {\n if (!tenantEmail) {\n console.log('No tenant name or email specified, skipping tenant setup');\n return;\n }\n if (!Env.firebase) {\n console.log('Firebase configuration is not available in the environment');\n return;\n }\n try {\n if (tenantEmail)\n console.log(`Resolving tenant ID from email: ${tenantEmail}`);\n // Add retry logic with exponential backoff\n let retries = 3;\n let retryDelay = 250; // Start with 250ms delay\n while (retries > 0) {\n try {\n // Call the API endpoint to resolve the tenant ID\n const response = await fetch('/api/resolve-tenant', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n tenantEmail: tenantEmail,\n }),\n // Add timeout to prevent hanging requests\n signal: AbortSignal.timeout(5000),\n });\n // Check for network errors\n if (!response) {\n throw new Error('No response received from tenant API');\n }\n // Handle HTTP error responses\n if (!response.ok) {\n // Try to parse the error response\n try {\n const errorData = await response.json();\n console.error('Failed to resolve tenant ID:', errorData.error);\n }\n catch {\n console.error(`Failed to resolve tenant ID: HTTP ${response.status}`);\n }\n // If the error is 404 Not Found, no need to retry\n if (response.status === 404) {\n console.warn(`Tenant not found for ${tenantEmail}`);\n return;\n }\n throw new Error(`HTTP error ${response.status}`);\n }\n // Successfully got a response, parse it\n const data = (await response.json());\n if (data?.firebaseTenantId) {\n const auth = getFirebaseAuth();\n auth.tenantId = data.firebaseTenantId;\n Env.firebase.providerType = data.provider ?? 'oidc';\n console.log(`Tenant ID set to ${auth.tenantId}`);\n return data;\n }\n else {\n console.error(`Invalid response format, missing tenantId for ${tenantEmail}`);\n return; // No need to retry for invalid response format\n }\n }\n catch (fetchError) {\n // Only retry for network-related errors\n if (retries > 1) {\n console.warn(`Tenant resolution failed, retrying in ${retryDelay}ms...`, fetchError);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n retryDelay *= 2; // Exponential backoff\n retries--;\n }\n else {\n throw fetchError; // Last retry failed, propagate error\n }\n }\n }\n }\n catch (error) {\n // Final error handler\n console.error('Error setting Firebase tenant:', error instanceof Error ? error.message : 'Unknown error');\n // Continue without tenant ID - authentication will work without multi-tenancy\n // but the user will access the default tenant\n }\n}\nexport async function getFirebaseAuthToken(refresh) {\n const auth = getFirebaseAuth();\n const user = auth.currentUser;\n if (user) {\n return user\n .getIdToken(refresh)\n .then((token) => {\n Env.logger.info('Got Firebase token', {\n vertesia: {\n user_email: user.email,\n user_name: user.displayName,\n user_id: user.uid,\n refresh: refresh,\n },\n });\n return token;\n })\n .catch((err) => {\n Env.logger.error('Failed to get Firebase token', {\n vertesia: {\n user_email: user.email,\n user_name: user.displayName,\n user_id: user.uid,\n refresh: refresh,\n error: err,\n },\n });\n console.error('Failed to get access token', err);\n return null;\n });\n }\n else {\n Env.logger.warn('No user found');\n return Promise.resolve(null);\n }\n}\n//# sourceMappingURL=firebase.js.map","import { Env } from '@vertesia/ui/env';\nimport { jwtDecode } from 'jwt-decode';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY } from '../constants';\nimport { getFirebaseAuth, getFirebaseAuthToken } from './firebase';\nlet AUTH_TOKEN_RAW;\nlet AUTH_TOKEN;\nexport async function fetchComposableToken(getIdToken, accountId, projectId, ttl, retryCount = 0) {\n console.log(`Getting/refreshing composable token for account ${accountId} and project ${projectId} `);\n Env.logger.info('Getting/refreshing composable token', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n retry_count: retryCount,\n },\n });\n const idToken = await getIdToken(); //get from firebase\n if (!idToken) {\n console.log('No id token found - using cookie auth');\n throw new Error('No id token found');\n }\n // Use STS endpoint - either configured or default to sts.vertesia.io\n const stsEndpoint = Env.endpoints.sts;\n console.log('Using STS for token generation:', stsEndpoint);\n Env.logger.info('Using STS for token generation', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n sts_url: stsEndpoint,\n },\n });\n try {\n // Call STS to generate a user token\n const stsUrl = new URL(`${stsEndpoint}/token/issue`);\n const requestBody = {\n type: 'user',\n account_id: accountId,\n project_id: projectId,\n expires_at: ttl ? Math.floor(Date.now() / 1000) + ttl : undefined,\n };\n const stsRes = await fetch(stsUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${idToken}`, // Firebase token for authentication\n },\n body: JSON.stringify(requestBody),\n }).catch((error) => {\n console.error('Failed to call STS endpoint', error);\n Env.logger.error('Failed to call STS endpoint', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n error: error,\n },\n });\n throw new STSError('Failed to call STS endpoint', stsEndpoint);\n });\n if (idToken && stsRes?.status === 404) {\n // User not found in token-server - call ensure-user endpoint\n console.log('404: User not found - calling ensure-user endpoint');\n Env.logger.info('404: User not found - calling ensure-user endpoint', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes?.status,\n },\n });\n const ensureResponse = await fetch(`${Env.endpoints.studio}/auth/ensure-user`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${idToken}`,\n 'Content-Type': 'application/json',\n },\n });\n if (ensureResponse.status === 412) {\n // No invite - trigger signup\n console.log('412: No invite found - signup required');\n Env.logger.info('412: No invite found - signup required', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n const idTokenDecoded = jwtDecode(idToken);\n if (!idTokenDecoded?.email) {\n Env.logger.error('No email found in id token');\n throw new Error('No email found in id token');\n }\n throw new UserNotFoundError('User not found - signup required', idTokenDecoded.email);\n }\n if (ensureResponse.status === 403) {\n // SigninScreen keys the invite-required view off this message.\n Env.logger.warn('403: Customer-domain user requires an invite to join', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n throw new Error('Customer-domain user requires an invite to join');\n }\n if (!ensureResponse.ok) {\n console.error('Failed to ensure user exists', ensureResponse.status);\n Env.logger.error('Failed to ensure user exists', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: ensureResponse.status,\n },\n });\n throw new Error('Failed to ensure user exists');\n }\n // User created/exists - retry token generation\n console.log('User ensured - retrying token generation');\n Env.logger.info('User ensured - retrying token generation', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n return fetchComposableToken(getIdToken, accountId, projectId, ttl, retryCount);\n }\n if (idToken && stsRes?.status === 412) {\n console.log(\"412: auth succeeded but user doesn't exist - signup required\", stsRes?.status);\n Env.logger.error(\"412: auth succeeded but user doesn't exist - signup required\", {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes?.status,\n },\n });\n const idTokenDecoded = jwtDecode(idToken);\n if (!idTokenDecoded?.email) {\n Env.logger.error('No email found in id token');\n throw new Error('No email found in id token');\n }\n Env.logger.error('User not found', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n email: idTokenDecoded.email,\n },\n });\n throw new UserNotFoundError('User not found', idTokenDecoded.email);\n }\n if (stsRes.status === 403) {\n // User doesn't have access to the requested account/project, or has no accounts\n // This can happen with:\n // 1. Stale localStorage from previous user\n // 2. User invited to a new account (doesn't have access yet)\n // 3. User exists but has no accounts at all\n if (retryCount > 0) {\n // Already retried without account scope - this is a real authorization failure\n console.error('403: Access denied even without account scope - user may have no accounts');\n Env.logger.error('403: Access denied after retry - authorization failure', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes.status,\n retry_count: retryCount,\n },\n });\n throw new Error('Access denied - user may not have access to any accounts');\n }\n console.log('403: Access denied - clearing cached account and retrying without account scope');\n Env.logger.warn('403: Access denied - clearing cached account and retrying', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes.status,\n retry_count: retryCount,\n },\n });\n // Clear any stale account/project from localStorage\n localStorage.removeItem(LastSelectedAccountId_KEY);\n if (accountId) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${accountId}`);\n }\n // Retry without account/project scope - let user log in to their default account\n return fetchComposableToken(getIdToken, undefined, undefined, ttl, retryCount + 1);\n }\n if (!stsRes.ok) {\n const errorText = await stsRes.text();\n console.error('STS token generation failed:', stsRes.status, errorText);\n Env.logger.error('STS token generation failed', {\n vertesia: {\n status: stsRes.status,\n error: errorText,\n account_id: accountId,\n project_id: projectId,\n },\n });\n throw new Error(`Failed to get token from STS: ${stsRes.status}`);\n }\n const { token } = await stsRes.json();\n console.log('Successfully got token from STS');\n Env.logger.info('Successfully got token from STS');\n return token;\n }\n catch (error) {\n if (error instanceof UserNotFoundError || error instanceof STSError) {\n throw error; // Re-throw UserNotFoundError and STSError to be handled separately in the caller\n }\n // Clear any stale account/project from localStorage on error\n localStorage.removeItem(LastSelectedAccountId_KEY);\n if (accountId) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${accountId}`);\n }\n console.error('Failed to get composable token from STS', error);\n Env.logger.error('Failed to get composable token from STS', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n error: error,\n },\n });\n throw new Error('Failed to get composable token', { cause: error });\n }\n}\n/**\n *\n * @param accountId\n * @param projectId\n * @param ttl time to live for the token in seconds\n * @returns\n */\nexport async function fetchComposableTokenFromFirebaseToken(accountId, projectId, ttl) {\n return fetchComposableToken(getFirebaseAuthToken, accountId, projectId, ttl);\n}\n/**\n * Mint a scoped Vertesia token from an existing Vertesia JWT. STS accepts STS-issued\n * tokens on /token/issue, so this works for sessions established via Central Auth where\n * the browser has no Firebase user.\n */\nexport async function fetchComposableTokenFromVertesiaToken(vertesiaToken, accountId, projectId, ttl) {\n return fetchComposableToken(() => Promise.resolve(vertesiaToken), accountId, projectId, ttl);\n}\n/** Returns the cached Vertesia raw JWT, if any. Does not refresh. */\nexport function getCurrentVertesiaToken() {\n return AUTH_TOKEN_RAW;\n}\nexport async function getComposableToken(accountId, projectId, initToken, forceRefresh = false, useInternalAuth = false) {\n const selectedAccount = accountId ?? localStorage.getItem(LastSelectedAccountId_KEY) ?? undefined;\n const selectedProject = projectId ?? localStorage.getItem(`${LastSelectedProjectId_KEY}-${selectedAccount}`) ?? undefined;\n //token is still valid for more than 5 minutes\n if (!forceRefresh && AUTH_TOKEN_RAW && AUTH_TOKEN && AUTH_TOKEN.exp > Date.now() / 1000 + 300) {\n return { rawToken: AUTH_TOKEN_RAW, token: AUTH_TOKEN, error: false };\n }\n //token is close to expire, refresh it\n if (!useInternalAuth && getFirebaseAuth().currentUser) {\n //we have a firebase user, get the token from there\n AUTH_TOKEN_RAW = await fetchComposableTokenFromFirebaseToken(selectedAccount, selectedProject);\n }\n else if (initToken || AUTH_TOKEN_RAW) {\n // we have a token already and no firebase user, refresh it\n AUTH_TOKEN_RAW = await fetchComposableToken(() => Promise.resolve(initToken ?? AUTH_TOKEN_RAW), selectedAccount, selectedProject);\n }\n if (!AUTH_TOKEN_RAW) {\n Env.logger.error('Cannot acquire a composable token', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n throw new Error('Cannot acquire a composable token');\n }\n AUTH_TOKEN = jwtDecode(AUTH_TOKEN_RAW);\n if (!AUTH_TOKEN?.exp || !AUTH_TOKEN_RAW) {\n console.error('Invalid composable token', AUTH_TOKEN);\n Env.logger.error('Invalid composable token', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n throw new Error('Invalid composable token');\n }\n return { rawToken: AUTH_TOKEN_RAW, token: AUTH_TOKEN, error: false };\n}\nexport class UserNotFoundError extends Error {\n email;\n constructor(message, email) {\n super(message);\n this.name = 'UserNotFoundError';\n this.email = email;\n }\n}\nexport class STSError extends Error {\n stsURL;\n constructor(message, stsURL) {\n super(message);\n this.name = 'STSError';\n this.stsURL = stsURL;\n }\n}\n//# sourceMappingURL=composable.js.map","/**\n * This hook is used to generate and verify state for OAuth2 authorization requests.\n * @returns\n */\nimport { useCallback } from 'react';\nconst AUTH_STATE_KEY = 'auth_state';\nconst STATE_EXPIRY_KEY = 'auth_state_expiry';\nconst STATE_TTL = 5 * 60 * 1000; // 5 min\nexport function useAuthState() {\n // Generate new state\n const generateState = useCallback(() => {\n const state = crypto.randomUUID();\n const expiryTime = Date.now() + STATE_TTL;\n // Store state and expiry\n sessionStorage.setItem(AUTH_STATE_KEY, state);\n sessionStorage.setItem(STATE_EXPIRY_KEY, expiryTime.toString());\n return state;\n }, []);\n // Verify returned state\n const verifyState = useCallback((returnedState) => {\n if (!returnedState) {\n return 'Missing state';\n }\n const savedState = sessionStorage.getItem(AUTH_STATE_KEY);\n const expiryTime = parseInt(sessionStorage.getItem(STATE_EXPIRY_KEY) || '0', 10);\n let reason;\n // Verify state matches and hasn't expired\n if (savedState !== returnedState) {\n reason = `State mismatched (${savedState} !== ${returnedState})`;\n }\n else if (Date.now() > expiryTime) {\n reason = 'State expired';\n }\n else {\n reason = undefined; // No errors\n }\n return reason;\n }, []);\n // Clear state (useful for cleanup)\n const clearState = useCallback(() => {\n sessionStorage.removeItem(AUTH_STATE_KEY);\n sessionStorage.removeItem(STATE_EXPIRY_KEY);\n }, []);\n return { generateState, verifyState, clearState };\n}\n//# sourceMappingURL=useAuthState.js.map","export function shouldUseFirebaseAuth(_hostname) {\n return window.AUTH_MODE === 'firebase';\n}\nexport function shouldRedirectToCentralAuth(_hostname) {\n return !shouldUseFirebaseAuth();\n}\n//# sourceMappingURL=domainRouting.js.map","import { VertesiaClient } from '@vertesia/client';\nimport { Env } from '@vertesia/ui/env';\nimport { jwtDecode } from 'jwt-decode';\nimport { createContext, useContext } from 'react';\nimport { getComposableToken } from './auth/composable';\nimport { shouldRedirectToCentralAuth } from './auth/domainRouting';\nimport { getFirebaseAuth } from './auth/firebase';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY } from './constants';\nexport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY };\nconst CENTRAL_AUTH_REDIRECT = 'https://internal-auth.vertesia.app/';\nclass UserSession {\n isLoading = true;\n client;\n authError;\n authToken;\n setSession;\n lastSelectedAccount;\n lastSelectedProject;\n onboardingComplete;\n constructor(client, setSession) {\n if (client) {\n this.client = client;\n }\n else {\n this.client = new VertesiaClient({\n serverUrl: Env.endpoints.studio,\n storeUrl: Env.endpoints.zeno,\n tokenServerUrl: Env.endpoints.sts,\n });\n }\n if (setSession) {\n this.setSession = setSession;\n }\n this.logout = this.logout.bind(this);\n }\n get store() {\n return this.client.store;\n }\n get user() {\n //compatibility\n return this.authToken;\n }\n get account() {\n //compatibility\n return this.authToken?.account;\n }\n get project() {\n return this.authToken?.project;\n }\n get accounts() {\n //compatibility\n return this.authToken?.accounts;\n }\n get authCallback() {\n return this.rawAuthToken.then((token) => `Bearer ${token}`);\n }\n get rawAuthToken() {\n return getComposableToken().then((res) => {\n const token = res?.rawToken;\n if (!token) {\n throw new Error('No token available');\n }\n this.authToken = jwtDecode(token);\n return token;\n });\n }\n signOut() {\n //compatibility\n this.logout();\n }\n getAccount() {\n return this.authToken?.account;\n }\n async login(token, options = {}) {\n this.authError = undefined;\n this.isLoading = false;\n this.client.withAuthCallback(() => this.authCallback);\n this.authToken = jwtDecode(token);\n console.log(`Logging in as ${this.authToken?.name} with account ${this.authToken?.account.name} (${this.authToken?.account.id}, and project ${this.authToken?.project?.name} (${this.authToken?.project?.id})`);\n //store selected account in local storage\n localStorage.setItem(LastSelectedAccountId_KEY, this.authToken.account.id);\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.authToken.account.id}`, this.authToken.project?.id ?? '');\n // notify the host app of the login\n Env.onLogin?.(this.authToken);\n if (options.loadOnboardingStatus ?? true) {\n await this.fetchOnboardingStatus();\n }\n return Promise.resolve();\n }\n isLoggedIn() {\n return !!this.authToken;\n }\n logout() {\n console.log('Logging out');\n if (shouldRedirectToCentralAuth()) {\n // Redirect to central auth for logout\n // Central auth will handle Firebase logout\n console.log('Using central auth logout');\n this.authError = undefined;\n this.isLoading = false;\n this.authToken = undefined;\n this.setSession = undefined;\n this.client.withAuthCallback(undefined);\n const logoutUrl = new URL(CENTRAL_AUTH_REDIRECT);\n const currentUrl = new URL(window.location.href);\n currentUrl.hash = '';\n logoutUrl.pathname = '/logout';\n logoutUrl.searchParams.set('redirect_uri', currentUrl.toString());\n location.replace(logoutUrl.toString());\n }\n else {\n // Use Firebase logout directly\n console.log('Using Firebase logout');\n const wasLoggedIn = !!this.authToken;\n if (this.authToken) {\n void getFirebaseAuth().signOut();\n }\n this.authError = undefined;\n this.isLoading = false;\n this.authToken = undefined;\n this.setSession = undefined;\n this.client.withAuthCallback(undefined);\n // Navigate to root to avoid React rendering errors when\n // unmounting deeply nested route components during logout.\n // Only navigate if user was actually logged in to avoid\n // infinite reload loop on fresh/incognito sessions.\n if (wasLoggedIn) {\n location.replace('/');\n }\n }\n }\n async switchAccount(targetAccountId) {\n localStorage.setItem(LastSelectedAccountId_KEY, targetAccountId);\n if (this) {\n if (this.account && this.project) {\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.account.id}`, this.project.id);\n }\n else if (this.account) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${this.account.id}`);\n }\n }\n window.location.replace(`/?a=${targetAccountId}`);\n }\n async switchProject(targetProjectId) {\n if (this.account) {\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.account.id}`, targetProjectId);\n }\n window.location.replace(`/?a=${this.account?.id}&p=${targetProjectId}`);\n }\n async fetchAccounts() {\n return this.client.accounts\n .list()\n .then((accounts) => {\n if (!this.authToken) {\n throw new Error('No token available');\n }\n this.authToken.accounts = accounts;\n this.setSession?.(this.clone());\n })\n .catch((err) => {\n console.error('Failed to fetch accounts', err);\n throw err;\n });\n }\n async fetchProjects(accountId) {\n return this.client.projects\n .list([accountId])\n .then((projects) => {\n if (!this.authToken) {\n throw new Error('No token available');\n }\n this.authToken = {\n ...this.authToken,\n accounts: this.authToken.accounts?.map((account) => {\n if (account.id === accountId) {\n return {\n ...account,\n projects: projects.filter((project) => project.account === accountId),\n };\n }\n return account;\n }),\n };\n this.setSession?.(this.clone());\n })\n .catch((err) => {\n console.error('Failed to fetch projects', err);\n throw err;\n });\n }\n async fetchOnboardingStatus() {\n if (this.onboardingComplete) {\n console.log('Onboarding already completed');\n return false;\n }\n const previousStatus = this.onboardingComplete;\n try {\n const onboarding = await this.client.account.onboardingProgress();\n this.onboardingComplete = Object.values(onboarding).every((value) => value === true);\n if (previousStatus !== this.onboardingComplete) {\n return true;\n }\n this.setSession?.(this.clone());\n }\n catch (error) {\n console.error('Error fetching onboarding status:', error);\n this.onboardingComplete = false;\n this.setSession?.(this.clone());\n }\n return false;\n }\n clone() {\n const session = new UserSession(this.client);\n session.isLoading = this.isLoading;\n session.authError = this.authError;\n session.authToken = this.authToken;\n session.setSession = this.setSession;\n session.lastSelectedAccount = this.lastSelectedAccount;\n session.switchAccount = this.switchAccount;\n session.onboardingComplete = this.onboardingComplete;\n return session;\n }\n}\nconst UserSessionContext = createContext(undefined);\nexport function useUserSession() {\n const session = useContext(UserSessionContext);\n if (!session) {\n throw new Error('useUserSession must be used within a UserSessionProvider');\n }\n return session;\n}\nexport { UserSession, UserSessionContext };\n//# sourceMappingURL=UserSession.js.map","import { i18nInstance, NAMESPACE } from '@vertesia/ui/i18n';\nimport { useEffect, useState } from 'react';\nimport { useUserSession } from '../UserSession';\nexport function useCurrentTenant() {\n const { user } = useUserSession();\n const [currentTenant, setCurrentTenant] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n useEffect(() => {\n const loadCurrentTenant = async () => {\n if (!user?.email) {\n setCurrentTenant(null);\n setIsLoading(false);\n return;\n }\n try {\n const response = await fetch('/api/resolve-tenant', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n tenantEmail: user.email,\n }),\n });\n if (response.ok) {\n const tenantData = await response.json();\n if (tenantData) {\n // Convert the resolved tenant data to our TenantConfig format\n setCurrentTenant({\n tenantKey: tenantData.name || 'unknown',\n name: tenantData.label || tenantData.name || 'Unknown',\n domain: tenantData.domain || [],\n firebaseTenantId: tenantData.firebaseTenantId,\n provider: tenantData.provider,\n logo: tenantData.logo,\n });\n }\n else {\n setCurrentTenant(null);\n }\n }\n else {\n setCurrentTenant(null);\n }\n }\n catch (error) {\n console.error('Error loading current tenant:', error);\n setError(i18nInstance.getFixedT(null, NAMESPACE)('errors.failedToLoadTenantConfig'));\n setCurrentTenant(null);\n }\n finally {\n setIsLoading(false);\n }\n };\n void loadCurrentTenant();\n }, [user?.email]);\n return {\n currentTenant,\n isLoading,\n error,\n };\n}\n//# sourceMappingURL=useCurrentTenant.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Env } from '@vertesia/ui/env';\nimport { onAuthStateChanged } from 'firebase/auth';\nimport { useEffect, useRef, useState } from 'react';\nimport { getComposableToken, STSError, UserNotFoundError } from './auth/composable';\nimport { shouldRedirectToCentralAuth } from './auth/domainRouting';\nimport { getFirebaseAuth } from './auth/firebase';\nimport { useAuthState } from './auth/useAuthState';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, UserSession, UserSessionContext } from './UserSession';\nconst CENTRAL_AUTH_REDIRECT = 'https://internal-auth.vertesia.app/';\nexport function UserSessionProvider({ children, loadOnboardingStatus = true }) {\n const hashParams = new URLSearchParams(location.hash.substring(1));\n const token = hashParams.get('token');\n const state = hashParams.get('state');\n const [session, setSession] = useState(new UserSession());\n const { generateState, verifyState, clearState } = useAuthState();\n const hasInitiatedAuthRef = useRef(false);\n const authFlowRef = useRef(undefined);\n const redirectToCentralAuth = (projectId, accountId) => {\n const url = new URL(`${CENTRAL_AUTH_REDIRECT}?sts=${Env.endpoints.sts ?? 'https://sts.vertesia.io'}`);\n const currentUrl = new URL(window.location.href);\n currentUrl.hash = '';\n if (projectId)\n currentUrl.searchParams.set('p', projectId);\n if (accountId)\n currentUrl.searchParams.set('a', accountId);\n url.searchParams.set('redirect_uri', currentUrl.toString());\n url.searchParams.set('state', generateState());\n location.replace(url.toString());\n };\n authFlowRef.current = () => {\n // Make this effect idempotent - only run auth flow once\n if (hasInitiatedAuthRef.current) {\n console.log('Auth: skipping duplicate auth flow initiation');\n return;\n }\n hasInitiatedAuthRef.current = true;\n console.log('Auth: starting auth flow');\n Env.logger.info('Starting auth flow');\n const currentUrl = new URL(window.location.href);\n const selectedAccount = currentUrl.searchParams.get('a') ?? localStorage.getItem(LastSelectedAccountId_KEY) ?? undefined;\n const selectedProject = currentUrl.searchParams.get('p') ??\n localStorage.getItem(`${LastSelectedProjectId_KEY}-${selectedAccount}`) ??\n undefined;\n console.log('Auth: selected account', selectedAccount);\n console.log('Auth: selected project', selectedProject);\n Env.logger.info('Selected account and project', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n if (token && state) {\n session.setSession = setSession;\n const validationError = verifyState(state);\n if (validationError) {\n console.error(`Auth: invalid state: ${validationError}`);\n Env.logger.error(`Invalid state: ${validationError}`, {\n vertesia: {\n state: state,\n },\n });\n redirectToCentralAuth();\n }\n else {\n clearState();\n }\n getComposableToken(selectedAccount, selectedProject, token, false, shouldRedirectToCentralAuth())\n .then((res) => {\n session.login(res.rawToken, { loadOnboardingStatus }).then(() => {\n setSession(session.clone());\n //cleanup the hash\n window.location.hash = '';\n });\n })\n .catch((err) => {\n // Don't redirect to central auth for UserNotFoundError - let signup flow handle it\n if (err instanceof UserNotFoundError) {\n console.log('User not found - will trigger signup flow', err);\n session.isLoading = false;\n session.authError = err;\n setSession(session.clone());\n return;\n }\n if (err instanceof STSError) {\n console.error('STS error during token exchange', err);\n Env.logger.error('STS error during token exchange', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n sts_url: err.stsURL,\n error: err,\n },\n });\n window.alert('Authentication failed due to an issue with the authentication service. Please try again later.');\n session.logout();\n setSession(session.clone());\n window.location.hash = '';\n return;\n }\n console.error('Failed to fetch user token from studio, redirecting to central auth', err);\n Env.logger.error('Failed to fetch user token from studio, redirecting to central auth', {\n vertesia: {\n error: err,\n },\n });\n redirectToCentralAuth();\n });\n return;\n }\n else {\n // If the current host is not in the Firebase allowlist, central auth owns sign-in.\n if (!session.isLoggedIn()) {\n console.log('Auth: not logged in & no token/state');\n Env.logger.info('Not logged in & no token/state', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n if (shouldRedirectToCentralAuth()) {\n console.log('Auth: host is not in Firebase auth allowlist, redirecting to central auth with selection', selectedAccount, selectedProject);\n Env.logger.info('Redirecting to central auth with selection', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n redirectToCentralAuth();\n return; // Don't register onAuthStateChanged listener when redirecting\n }\n else {\n console.log('Auth: host is in Firebase auth allowlist');\n Env.logger.info('Host is in Firebase auth allowlist', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n }\n }\n }\n return onAuthStateChanged(getFirebaseAuth(), async (firebaseUser) => {\n if (firebaseUser) {\n console.log('Auth: successful login with firebase');\n Env.logger.info('Successful login with firebase', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n session.setSession = setSession;\n await getComposableToken(selectedAccount, selectedProject, undefined, false, shouldRedirectToCentralAuth())\n .then((res) => {\n session.login(res.rawToken, { loadOnboardingStatus }).then(() => setSession(session.clone()));\n })\n .catch((err) => {\n console.error('Failed to fetch user token from studio', err);\n Env.logger.error('Failed to fetch user token from studio', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n error: err,\n },\n });\n if (!(err instanceof UserNotFoundError))\n session.logout();\n session.isLoading = false;\n session.authError = err;\n setSession(session.clone());\n });\n }\n else {\n // anonymous user\n console.log('Auth: using anonymous user');\n Env.logger.info('Using anonymous user', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n session.client.withAuthCallback(undefined);\n session.logout();\n setSession(session.clone());\n }\n });\n };\n useEffect(() => {\n return authFlowRef.current?.();\n }, []);\n return _jsx(UserSessionContext.Provider, { value: session, children: children });\n}\n//# sourceMappingURL=UserSessionProvider.js.map","import { Env } from '@vertesia/ui/env';\nimport { logEvent } from 'firebase/analytics';\nimport { getFirebaseAnalytics } from './auth/firebase';\nexport function useUXTracking() {\n //identify user in monitoring and UX systems\n const tagUserSession = async (user) => {\n const signupData = window.localStorage.getItem('composableSignupData');\n if (!user) {\n console.error('No user found -- skipping tagging');\n return;\n }\n if (signupData) {\n window.localStorage.removeItem('composableSignupData');\n }\n };\n //send event to analytics and UX systems\n const trackEvent = (eventName, eventProperties) => {\n if (!Env.isProd) {\n console.debug('track event', eventName, eventProperties);\n }\n //GA via firebase\n logEvent(getFirebaseAnalytics(), eventName, { ...eventProperties, debug_mode: !Env.isProd });\n };\n return {\n tagUserSession,\n trackEvent,\n };\n}\n//# sourceMappingURL=useUXTracking.js.map"],"names":["LastSelectedAccountId_KEY","LastSelectedProjectId_KEY","AUTH_TOKEN_RAW","AUTH_TOKEN","_firebaseApp","_analytics","_firebaseAuth","getFirebaseApp","Env","firebase","Error","initializeApp","error","console","cause","getFirebaseAnalytics","getAnalytics","getFirebaseAuth","getAuth","async","setFirebaseTenant","tenantEmail","log","retries","retryDelay","response","fetch","method","headers","body","JSON","stringify","signal","AbortSignal","timeout","ok","errorData","json","status","warn","data","firebaseTenantId","auth","tenantId","providerType","provider","fetchError","Promise","resolve","setTimeout","message","getFirebaseAuthToken","refresh","user","currentUser","getIdToken","then","token","logger","info","vertesia","user_email","email","user_name","displayName","user_id","uid","catch","err","fetchComposableToken","accountId","projectId","ttl","retryCount","account_id","project_id","retry_count","idToken","stsEndpoint","endpoints","sts","sts_url","stsUrl","URL","requestBody","type","expires_at","Math","floor","Date","now","undefined","stsRes","Authorization","STSError","ensureResponse","studio","idTokenDecoded","jwtDecode","UserNotFoundError","localStorage","removeItem","errorText","text","fetchComposableTokenFromFirebaseToken","fetchComposableTokenFromVertesiaToken","vertesiaToken","getCurrentVertesiaToken","getComposableToken","initToken","forceRefresh","useInternalAuth","selectedAccount","getItem","selectedProject","exp","rawToken","constructor","super","this","name","stsURL","AUTH_STATE_KEY","STATE_EXPIRY_KEY","useAuthState","generateState","useCallback","state","crypto","randomUUID","expiryTime","sessionStorage","setItem","toString","verifyState","returnedState","savedState","parseInt","reason","clearState","shouldRedirectToCentralAuth","_hostname","window","AUTH_MODE","UserSession","isLoading","client","authError","authToken","setSession","lastSelectedAccount","lastSelectedProject","onboardingComplete","VertesiaClient","serverUrl","storeUrl","zeno","tokenServerUrl","logout","bind","store","account","project","accounts","authCallback","rawAuthToken","res","signOut","getAccount","login","options","withAuthCallback","id","onLogin","loadOnboardingStatus","fetchOnboardingStatus","isLoggedIn","logoutUrl","currentUrl","location","href","hash","pathname","searchParams","set","replace","wasLoggedIn","switchAccount","targetAccountId","switchProject","targetProjectId","fetchAccounts","list","clone","fetchProjects","projects","map","filter","previousStatus","onboarding","onboardingProgress","Object","values","every","value","session","UserSessionContext","createContext","useUserSession","useContext","useCurrentTenant","currentTenant","setCurrentTenant","useState","setIsLoading","setError","useEffect","tenantData","tenantKey","label","domain","logo","i18nInstance","getFixedT","NAMESPACE","loadCurrentTenant","UserSessionProvider","children","hashParams","URLSearchParams","substring","get","hasInitiatedAuthRef","useRef","authFlowRef","redirectToCentralAuth","url","current","validationError","alert","onAuthStateChanged","firebaseUser","_jsx","Provider","useUXTracking","tagUserSession","signupData","trackEvent","eventName","eventProperties","isProd","debug","logEvent","debug_mode"],"mappings":"qgBAAY,MAACA,EAA4B,qCAC5BC,EAA4B,qCCIzC,ICDIC,EACAC,EDAAC,EAAe,KACfC,EAAa,KACbC,EAAgB,KAEb,SAASC,IACZ,IAAKH,EACD,IACI,IAAKI,EAAIC,SACL,MAAM,IAAIC,MAAM,8DAEpBN,EAAeO,EAAcH,EAAIC,SACrC,CACA,MAAOG,GAEH,MADAC,QAAQD,MAAM,qCAAsCA,GAC9C,IAAIF,MAAM,+EAAgF,CAC5FI,MAAOF,GAEf,CAEJ,OAAOR,CACX,CACO,SAASW,IAIZ,OAHKV,IACDA,EAAaW,EAAaT,MAEvBF,CACX,CACO,SAASY,IAIZ,OAHKX,IACDA,EAAgBY,EAAQX,MAErBD,CACX,CACOa,eAAeC,EAAkBC,GACpC,GAAKA,EAIL,GAAKb,EAAIC,SAIT,IACQY,GACAR,QAAQS,IAAI,mCAAmCD,KAEnD,IAAIE,EAAU,EACVC,EAAa,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
|
1
|
+
{"version":3,"file":"vertesia-ui-session.js","names":["CENTRAL_AUTH_REDIRECT","_jsx","_jsx"],"sources":["session/constants.js","session/auth/firebase.js","session/auth/composable.js","session/auth/useAuthState.js","session/auth/domainRouting.js","session/UserSession.js","session/auth/useCurrentTenant.js","session/DevSessionProvider.js","session/UserSessionProvider.js","session/useUXTracking.js"],"sourcesContent":["export const LastSelectedAccountId_KEY = 'composableai.lastSelectedAccountId';\nexport const LastSelectedProjectId_KEY = 'composableai.lastSelectedProjectId';\n//# sourceMappingURL=constants.js.map","import { Env } from '@vertesia/ui/env';\nimport { getAnalytics } from 'firebase/analytics';\nimport { initializeApp } from 'firebase/app';\nimport { getAuth } from 'firebase/auth';\n// Use lazy initialization to avoid accessing Env before it's initialized\nlet _firebaseApp = null;\nlet _analytics = null;\nlet _firebaseAuth = null;\n// Getters that lazily initialize Firebase components when first accessed\nexport function getFirebaseApp() {\n if (!_firebaseApp) {\n try {\n if (!Env.firebase) {\n throw new Error('Firebase configuration is not available in the environment');\n }\n _firebaseApp = initializeApp(Env.firebase);\n }\n catch (error) {\n console.error('Failed to initialize Firebase app:', error);\n throw new Error('Firebase initialization failed - environment may not be properly initialized', {\n cause: error,\n });\n }\n }\n return _firebaseApp;\n}\nexport function getFirebaseAnalytics() {\n if (!_analytics) {\n _analytics = getAnalytics(getFirebaseApp());\n }\n return _analytics;\n}\nexport function getFirebaseAuth() {\n if (!_firebaseAuth) {\n _firebaseAuth = getAuth(getFirebaseApp());\n }\n return _firebaseAuth;\n}\nexport async function setFirebaseTenant(tenantEmail) {\n if (!tenantEmail) {\n console.log('No tenant name or email specified, skipping tenant setup');\n return;\n }\n if (!Env.firebase) {\n console.log('Firebase configuration is not available in the environment');\n return;\n }\n try {\n if (tenantEmail)\n console.log(`Resolving tenant ID from email: ${tenantEmail}`);\n // Add retry logic with exponential backoff\n let retries = 3;\n let retryDelay = 250; // Start with 250ms delay\n while (retries > 0) {\n try {\n // Call the API endpoint to resolve the tenant ID\n const response = await fetch('/api/resolve-tenant', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n tenantEmail: tenantEmail,\n }),\n // Add timeout to prevent hanging requests\n signal: AbortSignal.timeout(5000),\n });\n // Check for network errors\n if (!response) {\n throw new Error('No response received from tenant API');\n }\n // Handle HTTP error responses\n if (!response.ok) {\n // Try to parse the error response\n try {\n const errorData = await response.json();\n console.error('Failed to resolve tenant ID:', errorData.error);\n }\n catch {\n console.error(`Failed to resolve tenant ID: HTTP ${response.status}`);\n }\n // If the error is 404 Not Found, no need to retry\n if (response.status === 404) {\n console.warn(`Tenant not found for ${tenantEmail}`);\n return;\n }\n throw new Error(`HTTP error ${response.status}`);\n }\n // Successfully got a response, parse it\n const data = (await response.json());\n if (data?.firebaseTenantId) {\n const auth = getFirebaseAuth();\n auth.tenantId = data.firebaseTenantId;\n Env.firebase.providerType = data.provider ?? 'oidc';\n console.log(`Tenant ID set to ${auth.tenantId}`);\n return data;\n }\n else {\n console.error(`Invalid response format, missing tenantId for ${tenantEmail}`);\n return; // No need to retry for invalid response format\n }\n }\n catch (fetchError) {\n // Only retry for network-related errors\n if (retries > 1) {\n console.warn(`Tenant resolution failed, retrying in ${retryDelay}ms...`, fetchError);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n retryDelay *= 2; // Exponential backoff\n retries--;\n }\n else {\n throw fetchError; // Last retry failed, propagate error\n }\n }\n }\n }\n catch (error) {\n // Final error handler\n console.error('Error setting Firebase tenant:', error instanceof Error ? error.message : 'Unknown error');\n // Continue without tenant ID - authentication will work without multi-tenancy\n // but the user will access the default tenant\n }\n}\nexport async function getFirebaseAuthToken(refresh) {\n const auth = getFirebaseAuth();\n const user = auth.currentUser;\n if (user) {\n return user\n .getIdToken(refresh)\n .then((token) => {\n Env.logger.info('Got Firebase token', {\n vertesia: {\n user_email: user.email,\n user_name: user.displayName,\n user_id: user.uid,\n refresh: refresh,\n },\n });\n return token;\n })\n .catch((err) => {\n Env.logger.error('Failed to get Firebase token', {\n vertesia: {\n user_email: user.email,\n user_name: user.displayName,\n user_id: user.uid,\n refresh: refresh,\n error: err,\n },\n });\n console.error('Failed to get access token', err);\n return null;\n });\n }\n else {\n Env.logger.warn('No user found');\n return Promise.resolve(null);\n }\n}\n//# sourceMappingURL=firebase.js.map","/**\n * Handle client caching and refresh of auth token\n */\nimport { RESTRICTED_ENVIRONMENT_ERROR_CODE } from '@vertesia/common';\nimport { Env } from '@vertesia/ui/env';\nimport { jwtDecode } from 'jwt-decode';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY } from '../constants';\nimport { getFirebaseAuth, getFirebaseAuthToken } from './firebase';\nlet AUTH_TOKEN_RAW;\nlet AUTH_TOKEN;\nexport async function fetchComposableToken(getIdToken, accountId, projectId, ttl, retryCount = 0) {\n console.log(`Getting/refreshing composable token for account ${accountId} and project ${projectId} `);\n Env.logger.info('Getting/refreshing composable token', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n retry_count: retryCount,\n },\n });\n const idToken = await getIdToken(); //get from firebase\n if (!idToken) {\n console.log('No id token found - using cookie auth');\n throw new Error('No id token found');\n }\n // Use STS endpoint - either configured or default to sts.vertesia.io\n const stsEndpoint = Env.endpoints.sts;\n console.log('Using STS for token generation:', stsEndpoint);\n Env.logger.info('Using STS for token generation', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n sts_url: stsEndpoint,\n },\n });\n try {\n // Call STS to generate a user token\n const stsUrl = new URL(`${stsEndpoint}/token/issue`);\n const requestBody = {\n type: 'user',\n account_id: accountId,\n project_id: projectId,\n expires_at: ttl ? Math.floor(Date.now() / 1000) + ttl : undefined,\n };\n const stsRes = await fetch(stsUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${idToken}`, // Firebase token for authentication\n },\n body: JSON.stringify(requestBody),\n }).catch((error) => {\n console.error('Failed to call STS endpoint', error);\n Env.logger.error('Failed to call STS endpoint', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n error: error,\n },\n });\n throw new STSError('Failed to call STS endpoint', stsEndpoint);\n });\n if (idToken && stsRes?.status === 404) {\n // User not found in token-server - call ensure-user endpoint\n console.log('404: User not found - calling ensure-user endpoint');\n Env.logger.info('404: User not found - calling ensure-user endpoint', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes?.status,\n },\n });\n const ensureResponse = await fetch(`${Env.endpoints.studio}/auth/ensure-user`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${idToken}`,\n 'Content-Type': 'application/json',\n },\n });\n if (ensureResponse.status === 412) {\n // No invite - trigger signup\n console.log('412: No invite found - signup required');\n Env.logger.info('412: No invite found - signup required', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n const idTokenDecoded = jwtDecode(idToken);\n if (!idTokenDecoded?.email) {\n Env.logger.error('No email found in id token');\n throw new Error('No email found in id token');\n }\n throw new UserNotFoundError('User not found - signup required', idTokenDecoded.email);\n }\n if (ensureResponse.status === 403) {\n // SigninScreen keys the invite-required view off this message.\n Env.logger.warn('403: Customer-domain user requires an invite to join', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n throw new Error('Customer-domain user requires an invite to join');\n }\n if (!ensureResponse.ok) {\n console.error('Failed to ensure user exists', ensureResponse.status);\n Env.logger.error('Failed to ensure user exists', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: ensureResponse.status,\n },\n });\n throw new Error('Failed to ensure user exists');\n }\n // User created/exists - retry token generation\n console.log('User ensured - retrying token generation');\n Env.logger.info('User ensured - retrying token generation', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n return fetchComposableToken(getIdToken, accountId, projectId, ttl, retryCount);\n }\n if (idToken && stsRes?.status === 412) {\n console.log(\"412: auth succeeded but user doesn't exist - signup required\", stsRes?.status);\n Env.logger.error(\"412: auth succeeded but user doesn't exist - signup required\", {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes?.status,\n },\n });\n const idTokenDecoded = jwtDecode(idToken);\n if (!idTokenDecoded?.email) {\n Env.logger.error('No email found in id token');\n throw new Error('No email found in id token');\n }\n Env.logger.error('User not found', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n email: idTokenDecoded.email,\n },\n });\n throw new UserNotFoundError('User not found', idTokenDecoded.email);\n }\n if (stsRes.status === 403) {\n // Distinguish the \"restricted environment\" rejection (preview/preprod gated to\n // early-access users) from the account-access 403 handled below. The STS tags it\n // with a machine-readable business error code. Peek a clone so the body stays\n // readable for the fall-through path.\n const body = await stsRes\n .clone()\n .json()\n .catch(() => undefined);\n if (body?.errorCode === RESTRICTED_ENVIRONMENT_ERROR_CODE) {\n Env.logger.warn('403: User lacks early-access for this restricted environment', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n },\n });\n throw new RestrictedEnvironmentError(body.message ?? \"You don't have sufficient permission to visit unstable environments\");\n }\n // User doesn't have access to the requested account/project, or has no accounts\n // This can happen with:\n // 1. Stale localStorage from previous user\n // 2. User invited to a new account (doesn't have access yet)\n // 3. User exists but has no accounts at all\n if (retryCount > 0) {\n // Already retried without account scope - this is a real authorization failure\n console.error('403: Access denied even without account scope - user may have no accounts');\n Env.logger.error('403: Access denied after retry - authorization failure', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes.status,\n retry_count: retryCount,\n },\n });\n throw new Error('Access denied - user may not have access to any accounts');\n }\n console.log('403: Access denied - clearing cached account and retrying without account scope');\n Env.logger.warn('403: Access denied - clearing cached account and retrying', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n status: stsRes.status,\n retry_count: retryCount,\n },\n });\n // Clear any stale account/project from localStorage\n localStorage.removeItem(LastSelectedAccountId_KEY);\n if (accountId) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${accountId}`);\n }\n // Retry without account/project scope - let user log in to their default account\n return fetchComposableToken(getIdToken, undefined, undefined, ttl, retryCount + 1);\n }\n if (!stsRes.ok) {\n const errorText = await stsRes.text();\n console.error('STS token generation failed:', stsRes.status, errorText);\n Env.logger.error('STS token generation failed', {\n vertesia: {\n status: stsRes.status,\n error: errorText,\n account_id: accountId,\n project_id: projectId,\n },\n });\n throw new Error(`Failed to get token from STS: ${stsRes.status}`);\n }\n const { token } = await stsRes.json();\n console.log('Successfully got token from STS');\n Env.logger.info('Successfully got token from STS');\n return token;\n }\n catch (error) {\n if (error instanceof UserNotFoundError ||\n error instanceof STSError ||\n error instanceof RestrictedEnvironmentError) {\n // Re-throw typed auth errors to be handled separately in the caller\n throw error;\n }\n // Clear any stale account/project from localStorage on error\n localStorage.removeItem(LastSelectedAccountId_KEY);\n if (accountId) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${accountId}`);\n }\n console.error('Failed to get composable token from STS', error);\n Env.logger.error('Failed to get composable token from STS', {\n vertesia: {\n account_id: accountId,\n project_id: projectId,\n error: error,\n },\n });\n throw new Error('Failed to get composable token', { cause: error });\n }\n}\n/**\n *\n * @param accountId\n * @param projectId\n * @param ttl time to live for the token in seconds\n * @returns\n */\nexport async function fetchComposableTokenFromFirebaseToken(accountId, projectId, ttl) {\n return fetchComposableToken(getFirebaseAuthToken, accountId, projectId, ttl);\n}\n/**\n * Mint a scoped Vertesia token from an existing Vertesia JWT. STS accepts STS-issued\n * tokens on /token/issue, so this works for sessions established via Central Auth where\n * the browser has no Firebase user.\n */\nexport async function fetchComposableTokenFromVertesiaToken(vertesiaToken, accountId, projectId, ttl) {\n return fetchComposableToken(() => Promise.resolve(vertesiaToken), accountId, projectId, ttl);\n}\n/** Returns the cached Vertesia raw JWT, if any. Does not refresh. */\nexport function getCurrentVertesiaToken() {\n return AUTH_TOKEN_RAW;\n}\nexport async function getComposableToken(accountId, projectId, initToken, forceRefresh = false, useInternalAuth = false) {\n const selectedAccount = accountId ?? localStorage.getItem(LastSelectedAccountId_KEY) ?? undefined;\n const selectedProject = projectId ?? localStorage.getItem(`${LastSelectedProjectId_KEY}-${selectedAccount}`) ?? undefined;\n //token is still valid for more than 5 minutes\n if (!forceRefresh && AUTH_TOKEN_RAW && AUTH_TOKEN && AUTH_TOKEN.exp > Date.now() / 1000 + 300) {\n return { rawToken: AUTH_TOKEN_RAW, token: AUTH_TOKEN, error: false };\n }\n //token is close to expire, refresh it\n if (!useInternalAuth && getFirebaseAuth().currentUser) {\n //we have a firebase user, get the token from there\n AUTH_TOKEN_RAW = await fetchComposableTokenFromFirebaseToken(selectedAccount, selectedProject);\n }\n else if (initToken || AUTH_TOKEN_RAW) {\n // we have a token already and no firebase user, refresh it\n AUTH_TOKEN_RAW = await fetchComposableToken(() => Promise.resolve(initToken ?? AUTH_TOKEN_RAW), selectedAccount, selectedProject);\n }\n if (!AUTH_TOKEN_RAW) {\n Env.logger.error('Cannot acquire a composable token', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n throw new Error('Cannot acquire a composable token');\n }\n AUTH_TOKEN = jwtDecode(AUTH_TOKEN_RAW);\n if (!AUTH_TOKEN?.exp || !AUTH_TOKEN_RAW) {\n console.error('Invalid composable token', AUTH_TOKEN);\n Env.logger.error('Invalid composable token', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n throw new Error('Invalid composable token');\n }\n return { rawToken: AUTH_TOKEN_RAW, token: AUTH_TOKEN, error: false };\n}\nexport class UserNotFoundError extends Error {\n email;\n constructor(message, email) {\n super(message);\n this.name = 'UserNotFoundError';\n this.email = email;\n }\n}\nexport class STSError extends Error {\n stsURL;\n constructor(message, stsURL) {\n super(message);\n this.name = 'STSError';\n this.stsURL = stsURL;\n }\n}\n/**\n * Thrown when the STS rejects sign-in because the current environment (preview/preprod) is\n * restricted to early-access users and this user lacks the `early-access` annotation. The\n * sign-in screen renders a dedicated \"restricted environment\" step for this error.\n * See docs/restrict-access-to-non-production-envs.md.\n */\nexport class RestrictedEnvironmentError extends Error {\n constructor(message) {\n super(message);\n this.name = 'RestrictedEnvironmentError';\n }\n}\n//# sourceMappingURL=composable.js.map","/**\n * This hook is used to generate and verify state for OAuth2 authorization requests.\n * @returns\n */\nimport { useCallback } from 'react';\nconst AUTH_STATE_KEY = 'auth_state';\nconst STATE_EXPIRY_KEY = 'auth_state_expiry';\nconst STATE_TTL = 5 * 60 * 1000; // 5 min\nexport function useAuthState() {\n // Generate new state\n const generateState = useCallback(() => {\n const state = crypto.randomUUID();\n const expiryTime = Date.now() + STATE_TTL;\n // Store state and expiry\n sessionStorage.setItem(AUTH_STATE_KEY, state);\n sessionStorage.setItem(STATE_EXPIRY_KEY, expiryTime.toString());\n return state;\n }, []);\n // Verify returned state\n const verifyState = useCallback((returnedState) => {\n if (!returnedState) {\n return 'Missing state';\n }\n const savedState = sessionStorage.getItem(AUTH_STATE_KEY);\n const expiryTime = parseInt(sessionStorage.getItem(STATE_EXPIRY_KEY) || '0', 10);\n let reason;\n // Verify state matches and hasn't expired\n if (savedState !== returnedState) {\n reason = `State mismatched (${savedState} !== ${returnedState})`;\n }\n else if (Date.now() > expiryTime) {\n reason = 'State expired';\n }\n else {\n reason = undefined; // No errors\n }\n return reason;\n }, []);\n // Clear state (useful for cleanup)\n const clearState = useCallback(() => {\n sessionStorage.removeItem(AUTH_STATE_KEY);\n sessionStorage.removeItem(STATE_EXPIRY_KEY);\n }, []);\n return { generateState, verifyState, clearState };\n}\n//# sourceMappingURL=useAuthState.js.map","export function shouldUseFirebaseAuth(_hostname) {\n return window.AUTH_MODE === 'firebase';\n}\nexport function shouldRedirectToCentralAuth(_hostname) {\n return !shouldUseFirebaseAuth();\n}\n//# sourceMappingURL=domainRouting.js.map","import { VertesiaClient } from '@vertesia/client';\nimport { Env } from '@vertesia/ui/env';\nimport { jwtDecode } from 'jwt-decode';\nimport { createContext, useContext } from 'react';\nimport { getComposableToken } from './auth/composable';\nimport { shouldRedirectToCentralAuth } from './auth/domainRouting';\nimport { getFirebaseAuth } from './auth/firebase';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY } from './constants';\nexport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY };\nconst CENTRAL_AUTH_REDIRECT = 'https://internal-auth.vertesia.app/';\nclass UserSession {\n isLoading = true;\n client;\n authError;\n authToken;\n setSession;\n lastSelectedAccount;\n lastSelectedProject;\n onboardingComplete;\n constructor(client, setSession) {\n if (client) {\n this.client = client;\n }\n else {\n this.client = new VertesiaClient({\n serverUrl: Env.endpoints.studio,\n storeUrl: Env.endpoints.zeno,\n tokenServerUrl: Env.endpoints.sts,\n });\n }\n if (setSession) {\n this.setSession = setSession;\n }\n this.logout = this.logout.bind(this);\n }\n get store() {\n return this.client.store;\n }\n get user() {\n //compatibility\n return this.authToken;\n }\n get account() {\n //compatibility\n return this.authToken?.account;\n }\n get project() {\n return this.authToken?.project;\n }\n get accounts() {\n //compatibility\n return this.authToken?.accounts;\n }\n get authCallback() {\n return this.rawAuthToken.then((token) => `Bearer ${token}`);\n }\n get rawAuthToken() {\n return getComposableToken().then((res) => {\n const token = res?.rawToken;\n if (!token) {\n throw new Error('No token available');\n }\n this.authToken = jwtDecode(token);\n return token;\n });\n }\n signOut() {\n //compatibility\n this.logout();\n }\n getAccount() {\n return this.authToken?.account;\n }\n async login(token, options = {}) {\n this.authError = undefined;\n this.isLoading = false;\n this.client.withAuthCallback(() => this.authCallback);\n this.authToken = jwtDecode(token);\n console.log(`Logging in as ${this.authToken?.name} with account ${this.authToken?.account.name} (${this.authToken?.account.id}, and project ${this.authToken?.project?.name} (${this.authToken?.project?.id})`);\n //store selected account in local storage\n localStorage.setItem(LastSelectedAccountId_KEY, this.authToken.account.id);\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.authToken.account.id}`, this.authToken.project?.id ?? '');\n // notify the host app of the login\n Env.onLogin?.(this.authToken);\n if (options.loadOnboardingStatus ?? true) {\n await this.fetchOnboardingStatus();\n }\n return Promise.resolve();\n }\n isLoggedIn() {\n return !!this.authToken;\n }\n logout() {\n console.log('Logging out');\n if (shouldRedirectToCentralAuth()) {\n // Redirect to central auth for logout\n // Central auth will handle Firebase logout\n console.log('Using central auth logout');\n this.authError = undefined;\n this.isLoading = false;\n this.authToken = undefined;\n this.setSession = undefined;\n this.client.withAuthCallback(undefined);\n const logoutUrl = new URL(CENTRAL_AUTH_REDIRECT);\n const currentUrl = new URL(window.location.href);\n currentUrl.hash = '';\n logoutUrl.pathname = '/logout';\n logoutUrl.searchParams.set('redirect_uri', currentUrl.toString());\n location.replace(logoutUrl.toString());\n }\n else {\n // Use Firebase logout directly\n console.log('Using Firebase logout');\n const wasLoggedIn = !!this.authToken;\n if (this.authToken) {\n void getFirebaseAuth().signOut();\n }\n this.authError = undefined;\n this.isLoading = false;\n this.authToken = undefined;\n this.setSession = undefined;\n this.client.withAuthCallback(undefined);\n // Navigate to root to avoid React rendering errors when\n // unmounting deeply nested route components during logout.\n // Only navigate if user was actually logged in to avoid\n // infinite reload loop on fresh/incognito sessions.\n if (wasLoggedIn) {\n location.replace('/');\n }\n }\n }\n async switchAccount(targetAccountId) {\n localStorage.setItem(LastSelectedAccountId_KEY, targetAccountId);\n if (this) {\n if (this.account && this.project) {\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.account.id}`, this.project.id);\n }\n else if (this.account) {\n localStorage.removeItem(`${LastSelectedProjectId_KEY}-${this.account.id}`);\n }\n }\n window.location.replace(`/?a=${targetAccountId}`);\n }\n async switchProject(targetProjectId) {\n if (this.account) {\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${this.account.id}`, targetProjectId);\n }\n window.location.replace(`/?a=${this.account?.id}&p=${targetProjectId}`);\n }\n async fetchAccounts() {\n return this.client.accounts\n .list()\n .then((accounts) => {\n if (!this.authToken) {\n throw new Error('No token available');\n }\n this.authToken.accounts = accounts;\n this.setSession?.(this.clone());\n })\n .catch((err) => {\n console.error('Failed to fetch accounts', err);\n throw err;\n });\n }\n async fetchProjects(accountId) {\n return this.client.projects\n .list([accountId])\n .then((projects) => {\n if (!this.authToken) {\n throw new Error('No token available');\n }\n this.authToken = {\n ...this.authToken,\n accounts: this.authToken.accounts?.map((account) => {\n if (account.id === accountId) {\n return {\n ...account,\n projects: projects.filter((project) => project.account === accountId),\n };\n }\n return account;\n }),\n };\n this.setSession?.(this.clone());\n })\n .catch((err) => {\n console.error('Failed to fetch projects', err);\n throw err;\n });\n }\n async fetchOnboardingStatus() {\n if (this.onboardingComplete) {\n console.log('Onboarding already completed');\n return false;\n }\n const previousStatus = this.onboardingComplete;\n try {\n const onboarding = await this.client.account.onboardingProgress();\n this.onboardingComplete = Object.values(onboarding).every((value) => value === true);\n if (previousStatus !== this.onboardingComplete) {\n return true;\n }\n this.setSession?.(this.clone());\n }\n catch (error) {\n console.error('Error fetching onboarding status:', error);\n this.onboardingComplete = false;\n this.setSession?.(this.clone());\n }\n return false;\n }\n clone() {\n const session = new UserSession(this.client);\n session.isLoading = this.isLoading;\n session.authError = this.authError;\n session.authToken = this.authToken;\n session.setSession = this.setSession;\n session.lastSelectedAccount = this.lastSelectedAccount;\n session.switchAccount = this.switchAccount;\n session.onboardingComplete = this.onboardingComplete;\n return session;\n }\n}\nconst UserSessionContext = createContext(undefined);\nexport function useUserSession() {\n const session = useContext(UserSessionContext);\n if (!session) {\n throw new Error('useUserSession must be used within a UserSessionProvider');\n }\n return session;\n}\nexport { UserSession, UserSessionContext };\n//# sourceMappingURL=UserSession.js.map","import { i18nInstance, NAMESPACE } from '@vertesia/ui/i18n';\nimport { useEffect, useState } from 'react';\nimport { useUserSession } from '../UserSession';\nexport function useCurrentTenant() {\n const { user } = useUserSession();\n const [currentTenant, setCurrentTenant] = useState(null);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState(null);\n useEffect(() => {\n const loadCurrentTenant = async () => {\n if (!user?.email) {\n setCurrentTenant(null);\n setIsLoading(false);\n return;\n }\n try {\n const response = await fetch('/api/resolve-tenant', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n tenantEmail: user.email,\n }),\n });\n if (response.ok) {\n const tenantData = await response.json();\n if (tenantData) {\n // Convert the resolved tenant data to our TenantConfig format\n setCurrentTenant({\n tenantKey: tenantData.name || 'unknown',\n name: tenantData.label || tenantData.name || 'Unknown',\n domain: tenantData.domain || [],\n firebaseTenantId: tenantData.firebaseTenantId,\n provider: tenantData.provider,\n logo: tenantData.logo,\n });\n }\n else {\n setCurrentTenant(null);\n }\n }\n else {\n setCurrentTenant(null);\n }\n }\n catch (error) {\n console.error('Error loading current tenant:', error);\n setError(i18nInstance.getFixedT(null, NAMESPACE)('errors.failedToLoadTenantConfig'));\n setCurrentTenant(null);\n }\n finally {\n setIsLoading(false);\n }\n };\n void loadCurrentTenant();\n }, [user?.email]);\n return {\n currentTenant,\n isLoading,\n error,\n };\n}\n//# sourceMappingURL=useCurrentTenant.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useMemo } from 'react';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY } from './constants';\nimport { UserSession, UserSessionContext } from './UserSession';\nfunction decodeJwtPayload(token) {\n const [, payload] = token.split('.');\n if (!payload) {\n throw new Error('Invalid Vertesia auth token');\n }\n const padded = payload\n .replace(/-/g, '+')\n .replace(/_/g, '/')\n .padEnd(Math.ceil(payload.length / 4) * 4, '=');\n return JSON.parse(atob(padded));\n}\nexport function DevSessionProvider({ children, token }) {\n const session = useMemo(() => {\n const next = new UserSession();\n next.isLoading = false;\n try {\n next.authToken = decodeJwtPayload(token);\n next.client.withAuthCallback(() => Promise.resolve(`Bearer ${token}`));\n localStorage.setItem(LastSelectedAccountId_KEY, next.authToken.account.id);\n localStorage.setItem(`${LastSelectedProjectId_KEY}-${next.authToken.account.id}`, next.authToken.project?.id ?? '');\n }\n catch (error) {\n next.authError = error instanceof Error ? error : new Error(String(error));\n }\n return next.clone();\n }, [token]);\n return _jsx(UserSessionContext.Provider, { value: session, children: children });\n}\n//# sourceMappingURL=DevSessionProvider.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Env } from '@vertesia/ui/env';\nimport { onAuthStateChanged } from 'firebase/auth';\nimport { useEffect, useRef, useState } from 'react';\nimport { getComposableToken, RestrictedEnvironmentError, STSError, UserNotFoundError } from './auth/composable';\nimport { shouldRedirectToCentralAuth } from './auth/domainRouting';\nimport { getFirebaseAuth } from './auth/firebase';\nimport { useAuthState } from './auth/useAuthState';\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, UserSession, UserSessionContext } from './UserSession';\nconst CENTRAL_AUTH_REDIRECT = 'https://internal-auth.vertesia.app/';\nexport function UserSessionProvider({ children, loadOnboardingStatus = true }) {\n const hashParams = new URLSearchParams(location.hash.substring(1));\n const token = hashParams.get('token');\n const state = hashParams.get('state');\n const [session, setSession] = useState(new UserSession());\n const { generateState, verifyState, clearState } = useAuthState();\n const hasInitiatedAuthRef = useRef(false);\n const authFlowRef = useRef(undefined);\n const redirectToCentralAuth = (projectId, accountId) => {\n const url = new URL(`${CENTRAL_AUTH_REDIRECT}?sts=${Env.endpoints.sts ?? 'https://sts.vertesia.io'}`);\n const currentUrl = new URL(window.location.href);\n currentUrl.hash = '';\n if (projectId)\n currentUrl.searchParams.set('p', projectId);\n if (accountId)\n currentUrl.searchParams.set('a', accountId);\n url.searchParams.set('redirect_uri', currentUrl.toString());\n url.searchParams.set('state', generateState());\n location.replace(url.toString());\n };\n authFlowRef.current = () => {\n // Make this effect idempotent - only run auth flow once\n if (hasInitiatedAuthRef.current) {\n console.log('Auth: skipping duplicate auth flow initiation');\n return;\n }\n hasInitiatedAuthRef.current = true;\n console.log('Auth: starting auth flow');\n Env.logger.info('Starting auth flow');\n const currentUrl = new URL(window.location.href);\n const selectedAccount = currentUrl.searchParams.get('a') ?? localStorage.getItem(LastSelectedAccountId_KEY) ?? undefined;\n const selectedProject = currentUrl.searchParams.get('p') ??\n localStorage.getItem(`${LastSelectedProjectId_KEY}-${selectedAccount}`) ??\n undefined;\n console.log('Auth: selected account', selectedAccount);\n console.log('Auth: selected project', selectedProject);\n Env.logger.info('Selected account and project', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n if (token && state) {\n session.setSession = setSession;\n const validationError = verifyState(state);\n if (validationError) {\n console.error(`Auth: invalid state: ${validationError}`);\n Env.logger.error(`Invalid state: ${validationError}`, {\n vertesia: {\n state: state,\n },\n });\n redirectToCentralAuth();\n }\n else {\n clearState();\n }\n getComposableToken(selectedAccount, selectedProject, token, false, shouldRedirectToCentralAuth())\n .then((res) => {\n session.login(res.rawToken, { loadOnboardingStatus }).then(() => {\n setSession(session.clone());\n //cleanup the hash\n window.location.hash = '';\n });\n })\n .catch((err) => {\n // Don't redirect to central auth for UserNotFoundError - let signup flow handle it\n if (err instanceof UserNotFoundError) {\n console.log('User not found - will trigger signup flow', err);\n session.isLoading = false;\n session.authError = err;\n setSession(session.clone());\n return;\n }\n // Restricted environment (preview/preprod without early-access): surface the\n // error so the sign-in screen shows the dedicated step. Redirecting to central\n // auth here would loop, since the identity is valid but the environment is gated.\n if (err instanceof RestrictedEnvironmentError) {\n console.warn('Restricted environment - user lacks early-access', err);\n session.isLoading = false;\n session.authError = err;\n setSession(session.clone());\n return;\n }\n if (err instanceof STSError) {\n console.error('STS error during token exchange', err);\n Env.logger.error('STS error during token exchange', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n sts_url: err.stsURL,\n error: err,\n },\n });\n window.alert('Authentication failed due to an issue with the authentication service. Please try again later.');\n session.logout();\n setSession(session.clone());\n window.location.hash = '';\n return;\n }\n console.error('Failed to fetch user token from studio, redirecting to central auth', err);\n Env.logger.error('Failed to fetch user token from studio, redirecting to central auth', {\n vertesia: {\n error: err,\n },\n });\n redirectToCentralAuth();\n });\n return;\n }\n else {\n // If the current host is not in the Firebase allowlist, central auth owns sign-in.\n if (!session.isLoggedIn()) {\n console.log('Auth: not logged in & no token/state');\n Env.logger.info('Not logged in & no token/state', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n if (shouldRedirectToCentralAuth()) {\n console.log('Auth: host is not in Firebase auth allowlist, redirecting to central auth with selection', selectedAccount, selectedProject);\n Env.logger.info('Redirecting to central auth with selection', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n redirectToCentralAuth();\n return; // Don't register onAuthStateChanged listener when redirecting\n }\n else {\n console.log('Auth: host is in Firebase auth allowlist');\n Env.logger.info('Host is in Firebase auth allowlist', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n }\n }\n }\n return onAuthStateChanged(getFirebaseAuth(), async (firebaseUser) => {\n if (firebaseUser) {\n console.log('Auth: successful login with firebase');\n Env.logger.info('Successful login with firebase', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n session.setSession = setSession;\n await getComposableToken(selectedAccount, selectedProject, undefined, false, shouldRedirectToCentralAuth())\n .then((res) => {\n session.login(res.rawToken, { loadOnboardingStatus }).then(() => setSession(session.clone()));\n })\n .catch((err) => {\n console.error('Failed to fetch user token from studio', err);\n Env.logger.error('Failed to fetch user token from studio', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n error: err,\n },\n });\n // Keep the Firebase session for UserNotFoundError (signup flow) and\n // RestrictedEnvironmentError (identity is valid; the environment is gated).\n // Logging out would retrigger onAuthStateChanged and clear the authError.\n if (!(err instanceof UserNotFoundError) && !(err instanceof RestrictedEnvironmentError)) {\n session.logout();\n }\n session.isLoading = false;\n session.authError = err;\n setSession(session.clone());\n });\n }\n else {\n // anonymous user\n console.log('Auth: using anonymous user');\n Env.logger.info('Using anonymous user', {\n vertesia: {\n account_id: selectedAccount,\n project_id: selectedProject,\n },\n });\n session.client.withAuthCallback(undefined);\n session.logout();\n setSession(session.clone());\n }\n });\n };\n useEffect(() => {\n return authFlowRef.current?.();\n }, []);\n return _jsx(UserSessionContext.Provider, { value: session, children: children });\n}\n//# sourceMappingURL=UserSessionProvider.js.map","import { Env } from '@vertesia/ui/env';\nimport { logEvent } from 'firebase/analytics';\nimport { getFirebaseAnalytics } from './auth/firebase';\nexport function useUXTracking() {\n //identify user in monitoring and UX systems\n const tagUserSession = async (user) => {\n const signupData = window.localStorage.getItem('composableSignupData');\n if (!user) {\n console.error('No user found -- skipping tagging');\n return;\n }\n if (signupData) {\n window.localStorage.removeItem('composableSignupData');\n }\n };\n //send event to analytics and UX systems\n const trackEvent = (eventName, eventProperties) => {\n if (!Env.isProd) {\n console.debug('track event', eventName, eventProperties);\n }\n //GA via firebase\n logEvent(getFirebaseAnalytics(), eventName, { ...eventProperties, debug_mode: !Env.isProd });\n };\n return {\n tagUserSession,\n trackEvent,\n };\n}\n//# sourceMappingURL=useUXTracking.js.map"],"mappings":"ulBAAA,MAAa,EAA4B,qCAC5B,EAA4B,qCCIzC,IAAI,EAAe,KACf,EAAa,KACb,EAAgB,KAEpB,SAAgB,GAAiB,CAC7B,GAAI,CAAC,EACD,GAAI,CACA,GAAI,CAAC,EAAI,SACL,MAAU,MAAM,4DAA4D,EAEhF,EAAe,EAAc,EAAI,QAAQ,CAC7C,OACO,EAAO,CAEV,MADA,QAAQ,MAAM,qCAAsC,CAAK,EAC/C,MAAM,+EAAgF,CAC5F,MAAO,CACX,CAAC,CACL,CAEJ,OAAO,CACX,CACA,SAAgB,GAAuB,CAInC,MAHA,CACI,IAAa,EAAa,EAAe,CAAC,EAEvC,CACX,CACA,SAAgB,GAAkB,CAI9B,MAHA,CACI,IAAgB,EAAQ,EAAe,CAAC,EAErC,CACX,CACA,eAAsB,EAAkB,EAAa,CACjD,GAAI,CAAC,EAAa,CACd,QAAQ,IAAI,0DAA0D,EACtE,MACJ,CACA,GAAI,CAAC,EAAI,SAAU,CACf,QAAQ,IAAI,4DAA4D,EACxE,MACJ,CACA,GAAI,CACI,GACA,QAAQ,IAAI,mCAAmC,GAAa,EAEhE,IAAI,EAAU,EACV,EAAa,IACjB,KAAO,EAAU,GACb,GAAI,CAEA,IAAM,EAAW,MAAM,MAAM,sBAAuB,CAChD,OAA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AE,aAAe,IACxD,EAAQ,OAAO,EAEnB,EAAQ,UAAY,GACpB,EAAQ,UAAY,EACpB,EAAW,EAAQ,MAAM,CAAC,CAC9B,CAAC,IAID,QAAQ,IAAI,4BAA4B,EACxC,EAAI,OAAO,KAAK,uBAAwB,CACpC,SAAU,CACN,WAAY,EACZ,WAAY,CAChB,CACJ,CAAC,EACD,EAAQ,OAAO,iBAAiB,IAAA,EAAS,EACzC,EAAQ,OAAO,EACf,EAAW,EAAQ,MAAM,CAAC,EAElC,CAAC,CACL,EACA,MACW,EAAY,UAAU,EAC9B,CAAC,CAAC,EACEC,EAAK,EAAmB,SAAU,CAAE,MAAO,EAAmB,UAAS,CAAC,CACnF,CC1MA,SAAgB,GAAgB,CAoB5B,MAAO,CACH,oBAnB0B,IAAS,CACnC,IAAM,EAAa,OAAO,aAAa,QAAQ,sBAAsB,EACrE,GAAI,CAAC,EAAM,CACP,QAAQ,MAAM,mCAAmC,EACjD,MACJ,CACI,GACA,OAAO,aAAa,WAAW,sBAAsB,CAE7D,EAWI,YATgB,EAAW,IAAoB,CAC1C,EAAI,QACL,QAAQ,MAAM,cAAe,EAAW,CAAe,EAG3D,EAAS,EAAqB,EAAG,EAAW,CAAE,GAAG,EAAiB,WAAY,CAAC,EAAI,MAAO,CAAC,CAC/F,CAIA,CACJ"}
|
package/lib/vertesia-ui-shell.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as i,useContext as r,useState as a,useEffect as o,useMemo as l,useRef as c,useCallback as s}from"react";import{useFetch as d,errorMessage as u,SelectBox as m,Center as p,Button as h,Modal as g,ModalTitle as f,ModalBody as v,Spinner as x,RadioGroup as b,Input as y,useToast as N,ErrorBox as w,ModalFooter as k,Tabs as C,TabsBar as S,TabsPanel as j,VTooltip as z,Popover as I,PopoverTrigger as P,Avatar as A,PopoverContent as L,ModeToggle as T,MenuList as O,ToastProvider as B,ThemeProvider as R}from"@vertesia/ui/core";import{useUserSession as E,LastSelectedAccountId_KEY as D,LastSelectedProjectId_KEY as _,getFirebaseAuth as $,setFirebaseTenant as q,useUXTracking as F,UserNotFoundError as M,getCurrentVertesiaToken as W,fetchComposableTokenFromVertesiaToken as V,fetchComposableTokenFromFirebaseToken as U,UserSessionProvider as H}from"@vertesia/ui/session";import{useUITranslation as J,LanguageProvider as Y,LanguageBoundI18nProvider as G}from"@vertesia/ui/i18n";import{LockIcon as K,LockKeyhole as Q,ArrowRight as X,Mail as Z,ShieldOff as ee,Check as te,CopyIcon as ne}from"lucide-react";import{Env as ie}from"@vertesia/ui/env";import{RegionTag as re}from"@vertesia/ui/layout";import{signOut as ae,signInWithRedirect as oe,OAuthProvider as le,GithubAuthProvider as ce,GoogleAuthProvider as se}from"firebase/auth";import{useLocation as de,useNavigate as ue}from"@vertesia/ui/router";import{getTenantIdFromProject as me,Permission as pe}from"@vertesia/common";import{useUserPermissions as he,TypeRegistryProvider as ge,UserPermissionProvider as fe}from"@vertesia/ui/features";import ve from"clsx";import{AnimatePresence as xe,motion as be}from"framer-motion";const ye=i(null);function Ne({installation:t,children:n}){return e(ye.Provider,{value:t,children:n})}function we(){return r(ye)}function ke({app:n,onChange:i,placeholder:r}){const{client:a,project:o}=E(),{data:l,error:c}=d(()=>a.apps.getAppInstallationProjects(n),[n.id,n.name]);return c?t("span",{className:"text-red-600",children:["Error: failed to fetch projects: ",u(c)]}):e(Ce,{placeholder:r,initialValue:o?.id,projects:l||[],onChange:e=>{i&&!i(e)||(localStorage.setItem(D,e.account),localStorage.setItem(`${_}-${e.account}`,e.id),window.location.reload())}})}function Ce({initialValue:t,projects:n,onChange:i,placeholder:r="Select Project"}){const[o,l]=a(),c=!o&&t?n.find(e=>e.id===t):o;return e(m,{by:"id",value:c,options:n,optionLabel:e=>e.name,placeholder:r,onChange:e=>{l(e),i(e)}})}function Se({name:t,AccessDenied:n=ze,children:i}){return t?e(je,{name:t,AccessDenied:n,children:i}):e(Ie,{})}function je({name:t,AccessDenied:n=ze,children:i}){const{authToken:r,client:l}=E(),[c,s]=a(null),[d,u]=a("loading");return o(()=>{if(r){r.apps.includes(t)?l.apps.getAppInstallationByName(t).then(e=>{e?(u("loaded"),s(e)):(console.log(`App ${t} not found!`),u("error"))}):u("error")}else u("loading")},[t,r,l.apps.getAppInstallationByName]),"loading"===d?null:"error"===d?e(n,{name:t}):c?e(Ne,{installation:c,children:i}):void 0}function ze({name:n}){const{project:i,accounts:r,client:c}=E(),{t:s}=J(),[u,h]=a(),{data:g}=d(()=>c.apps.getAppInstallationProjects({name:n}),[n]),{projectsByOrg:f,orgOptions:v}=l(()=>{if(!g||!r)return{projectsByOrg:{},orgOptions:[]};const e={};for(const t of g)e[t.account]||(e[t.account]=[]),e[t.account].push(t);const t=r.filter(t=>e[t.id]?.length>0);return{projectsByOrg:e,orgOptions:t}},[g,r]);o(()=>{!u&&v.length>0&&h(v[0].id)},[v,u]);const x=u&&f[u]||[],b=v.find(e=>e.id===u);return t(p,{className:"pt-10 flex flex-col items-center text-center text-gray-700",children:[e(K,{className:"w-10 h-10 mb-4 text-gray-500"}),e("div",{className:"text-xl font-semibold",children:s("shell.accessDenied")}),t("div",{className:"mt-2 text-sm text-gray-500",children:["You don't have permission to view the ",e("span",{className:"font-semibold",children:n})," app in project:"," ",t("span",{className:"font-semibold",children:["«",i?.name,"»"]}),"."]}),0===v.length&&void 0!==g&&e("div",{className:"mt-4 text-sm text-gray-500",children:"This app is not installed in any project you have access to."}),v.length>0&&t("div",{className:"mt-4 flex flex-row gap-4 items-end",children:[v.length>1&&t("div",{children:[e("div",{className:"text-sm text-gray-500 mb-2",children:s("shell.organization")}),e(m,{by:"id",value:b,options:v,optionLabel:e=>e.name,placeholder:s("shell.selectOrganization"),onChange:e=>h(e.id)})]}),t("div",{children:[v.length>1&&e("div",{className:"text-sm text-gray-500 mb-2",children:s("login.terminal.project")}),e(m,{by:"id",value:void 0,options:x,optionLabel:e=>e.name,placeholder:s("shell.selectProject"),onChange:e=>{localStorage.setItem(D,e.account),localStorage.setItem(`${_}-${e.account}`,e.id),window.location.reload()}})]})]})]})}function Ie(){const{t:n}=J();return t(p,{className:"pt-10 flex flex-col items-center text-center text-gray-700",children:[e(K,{className:"w-10 h-10 mb-4 text-gray-500"}),e("div",{className:"text-xl font-semibold",children:n("shell.applicationNotRegistered")}),t("div",{className:"mt-2 text-sm text-gray-500",children:["Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.",e("p",{}),"Then use the created app name as a parameter to"," ",e("code",{children:'<StandaloneApp name="your-app-name">'})," in the ",e("code",{children:"src/main.tsx"})," file."]})]})}function Pe(){const n=E(),{client:i}=n,{t:r}=J(),[l,c]=a(!1),[s,d]=a([]);o(()=>{i.account.listInvites().then(e=>{if(e.length>0){const t=e.filter(e=>e.data.account);if(0===t.length)return void console.log("No valid invites found, closing modal");console.log("Found valid invites",t.length),c(!0),d(t)}else console.log("No invites found, closing modal"),c(!1)}).catch(e=>{console.error("Error fetching invites",e)})},[i.account.listInvites]);const u=()=>c(!1),m=s.map(a=>a.data.account?t("div",{className:"flex flex-row w-full justify-between border rounded-sm px-2 py-2 ",children:[t("div",{className:"flex flex-col",children:[e("div",{className:"w-full font-semibold",children:a.data.account.name??a.data.account}),a.data.project&&t("div",{className:"w-full text-base",children:["- ",a.data.project.name]}),t("div",{className:"text-xs",children:["Role: ",a.data.role]}),a.data.invited_by&&t("div",{className:"text-xs",children:["by ",a.data.invited_by.name??a.data.invited_by]})]}),t("div",{className:"flex flex-col gap-4",children:[e(h,{size:"xs",onClick:()=>(async e=>{await i.account.acceptInvite(e.id),await n.authCallback,await n.fetchAccounts(),await n.fetchProjects(e.data.account.id);const t=s.filter(t=>t.id!==e.id).filter(e=>e.data.account);t.length>0?d(t):u()})(a),children:r("login.accept")})," ",e(h,{size:"xs",variant:"secondary",onClick:()=>(async e=>{await i.account.rejectInvite(e.id);const t=s.filter(t=>t.id!==e.id);d(t),0===t.length&&u()})(a),children:r("login.reject")})]})]},a.id):(console.warn("Invite has no account data",a),null));return e("div",{children:t(g,{isOpen:l,onClose:u,children:[e(f,{children:r("login.reviewInvites")}),t(v,{children:[e("div",{className:"text-sm pb-4",children:"You have received the following invites to join other accounts. Please review and accept or declined them."}),m]})]})})}const Ae=Q,Le={google:function(n){return t("svg",{viewBox:"0 0 48 48","aria-hidden":"true",...n,children:[e("path",{fill:"#FFC107",d:"M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z"}),e("path",{fill:"#FF3D00",d:"M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z"}),e("path",{fill:"#4CAF50",d:"M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z"}),e("path",{fill:"#1976D2",d:"M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z"})]})},github:function(t){return e("svg",{viewBox:"0 0 24 24","aria-hidden":"true",...t,children:e("path",{fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z"})})},microsoft:function(n){return t("svg",{viewBox:"0 0 24 24","aria-hidden":"true",...n,children:[e("path",{fill:"#F25022",d:"M2 2h9.5v9.5H2z"}),e("path",{fill:"#7FBA00",d:"M12.5 2H22v9.5h-9.5z"}),e("path",{fill:"#00A4EF",d:"M2 12.5h9.5V22H2z"}),e("path",{fill:"#FFB900",d:"M12.5 12.5H22V22h-9.5z"})]})},oidc:Ae};function Te(e){return e&&e in Le?Le[e]:Ae}function Oe({children:t,centered:n=!1}){return e("div",{className:n?"w-full max-w-[420px] flex flex-col gap-6 items-center text-center":"w-full max-w-[420px] flex flex-col gap-6",children:t})}function Be({eyebrow:n,title:i,body:r,variant:a="info"}){return t("div",{children:[n&&e("div",{className:`${"destructive"===a?"text-destructive":"text-info"} text-[12.5px] font-medium mb-2`,children:n}),e("h1",{className:"text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5",children:i}),r&&e("p",{className:"text-muted text-sm leading-relaxed",children:r})]})}const Re={primary:"h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",loading:"h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90",ghost:"h-9 text-muted hover:text-foreground"};function Ee({variant:t="primary",className:n="",type:i="button",disabled:r,...a}){return e(h,{variant:"unstyled",size:"none",type:i,disabled:"loading"===t||r,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${Re[t]} ${n}`.trim(),...a})}function De({size:t="xs",className:n="",type:i="button",...r}){const a=`cursor-pointer ${"smaller"===t?"!text-[11px]":"!text-xs"} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return e(h,{variant:"unstyled",size:"none",type:i,className:n?`${a} ${n}`:a,...r})}const _e={circle:"size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border",square:"size-[30px] rounded-md text-[11px]"};function $e({initials:t,shape:n="circle"}){return e("span",{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${_e[n]}`,children:t})}function qe({children:t}){return e("div",{className:"inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5",children:t})}function Fe({title:n,subtitle:i,titleClass:r,subtitleClass:a}){return t("div",{className:"flex-1 min-w-0",children:[e("div",{className:r,children:n}),e("div",{className:a,children:i})]})}const Me={tenant:{topRow:"flex items-center gap-2.5 px-3 py-2.5",title:"text-[13.5px] font-semibold text-foreground leading-tight",subtitle:"text-[11.5px] text-muted leading-tight mt-0.5",bottomRow:"flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background",mailBox:"size-[30px] grid place-items-center shrink-0",mailIcon:"size-4 text-muted",email:"text-sm text-foreground/80 flex-1 truncate",actionSize:"xs"},returning:{topRow:"flex items-center gap-3 px-3.5 py-2.5",title:"text-sm font-semibold text-foreground truncate",subtitle:"text-xs text-foreground/80 truncate",bottomRow:"flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background",mailBox:"w-9 h-6 grid place-items-center shrink-0",mailIcon:"size-3.5 text-muted",email:"text-xs text-foreground/80 flex-1 truncate",actionSize:"smaller"}};function We({variant:n="returning",badge:i,title:r,subtitle:a,email:o,actionLabel:l,onAction:c}){const s=Me[n];return t("div",{className:"rounded-md border border-border bg-background overflow-hidden",children:[t("div",{className:s.topRow,children:[i,e(Fe,{title:r,subtitle:a,titleClass:s.title,subtitleClass:s.subtitle})]}),t("div",{className:s.bottomRow,children:[e("div",{className:s.mailBox,children:e(Z,{className:s.mailIcon})}),e("span",{className:s.email,children:o}),e(De,{size:s.actionSize,onClick:c,children:l})]})]})}function Ve({badge:n,title:i,subtitle:r,actionLabel:a,onAction:o}){return t("div",{className:"flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background",children:[n,e(Fe,{title:i,subtitle:r,titleClass:"text-sm font-semibold text-foreground truncate",subtitleClass:"text-xs text-muted truncate"}),e(De,{onClick:o,children:a})]})}function Ue({email:n,actionLabel:i,onAction:r}){return t("div",{className:"flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background",children:[e(Z,{className:"size-4 text-muted shrink-0"}),e("span",{className:"text-sm text-foreground/80 flex-1 truncate",children:n}),e(De,{onClick:r,children:i})]})}function He({provider:n,label:i,onClick:r,variant:a="outline"}){const o=Te(n);if("arrow"===a){const n="!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition";return t(h,{variant:"unstyled",size:"none",onClick:r,className:"cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background",children:[e(o,{className:"!size-[18px] shrink-0"}),e("span",{className:"flex-1 text-start",children:i}),e(X,{className:n})]})}return t(h,{variant:"outline",onClick:r,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${"filled"===a?"!bg-foreground text-background hover:!bg-foreground/90":"hover:shadow-sm"}`,children:[e(o,{className:"!size-[18px]"}),e("span",{className:"text-sm font-medium",children:i})]})}function Je({icon:n,title:i,meta:r}){return t("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20",children:[e(n,{className:"size-5 text-destructive shrink-0"}),t("div",{className:"flex-1 min-w-0 text-sm",children:[e("div",{className:"font-semibold text-destructive",children:i}),e("div",{className:"text-xs text-destructive/80",children:r})]})]})}function Ye({inputRef:n,label:i,placeholder:r,value:a,onChange:o,invalid:l=!1,error:c}){return t("div",{className:"flex flex-col gap-1.5",children:[e("label",{htmlFor:"vt-login-email",className:"text-xs font-medium text-foreground/80",children:i}),e("input",{ref:n,id:"vt-login-email",name:"vt-login-email",type:"email",className:"h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15",placeholder:r,value:a,onChange:e=>o(e.target.value),"aria-invalid":l,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":"true","data-form-type":"other"}),c&&e("div",{role:"alert",className:"text-xs text-destructive",children:c})]})}const Ge="vt.lastSuccessfulLogin",Ke="vt.pendingSignin";function Qe(){try{const e=localStorage.getItem(Ge);if(!e)return null;const t=JSON.parse(e);return t?.email&&t?.lastProvider?t:null}catch{return null}}function Xe(){try{localStorage.removeItem(Ge)}catch{}}function Ze(){try{const e=sessionStorage.getItem(Ke);return e?JSON.parse(e):null}catch{return null}}function et(){try{sessionStorage.removeItem(Ke)}catch{}}async function tt(){Xe(),et();try{await ae($())}catch{}}function nt(e){let t=e||window.location.pathname||"/";return"/"!==t[0]&&(t=`/${t}`),t}const it={google:(e,t)=>{const n=new se;return n.addScope("profile"),n.addScope("email"),n.setCustomParameters({redirect_uri:window.location.origin+nt(t),...e?{login_hint:e}:{prompt:"select_account"}}),n},github:e=>{const t=new ce;return t.addScope("profile"),t.addScope("email"),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{const t=new le("microsoft.com");return t.addScope("profile"),t.addScope("email"),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{const t=new le("oidc.main");return e&&t.setCustomParameters({login_hint:e}),t}};function rt(e,t,n){return it[e](t,n)}async function at(e,t,n){if(!t)return{ok:!1,reason:"no-email"};const i=await q(t),r=$();let a,o=e;return i?(i.provider&&(o=i.provider),a=i.label||i.name||void 0,localStorage.setItem("tenantName",a??"")):(localStorage.removeItem("tenantName"),r.tenantId&&(r.tenantId=null)),function(e){try{sessionStorage.setItem(Ke,JSON.stringify(e))}catch{}}({email:t,provider:o,tenantName:a}),oe(r,rt(o,t,n)),{ok:!0}}function ot(e){return"google"===e?"Google":"github"===e?"GitHub":"microsoft"===e?"Microsoft":"Sign In"}function lt(e){const t=function(e){if(!e)return"";const t=e.lastIndexOf("@");return t>0?e.slice(0,t):e}(e),n=t.split(/[._-]+/).filter(Boolean)[0]||"friend";return n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()}function ct(e){let t=e;for(let e=0;null!=t&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes("Customer-domain user requires an invite to join"))return!0;t=t instanceof Error?t.cause:void 0}return!1}function st({provider:n,onCancel:i}){const{t:r}=J(),a=Te(n),o="oidc"===n?r("auth.pending.genericProvider"):ot(n);return t(Oe,{centered:!0,children:[t("div",{children:[e(qe,{children:e(a,{className:"oidc"===n?"size-6 text-info":"size-6"})}),e(Be,{title:r("auth.pending.title",{provider:o}),body:r("auth.pending.body")})]}),t("div",{className:"w-full flex flex-col gap-2",children:[t(Ee,{variant:"loading",children:[e(x,{}),e("span",{children:r("auth.pending.authenticating")})]}),i&&e(Ee,{variant:"ghost",onClick:i,children:r("auth.pending.cancel")})]})]})}function dt({initialEmail:i,onProceed:r}){const{t:l}=J(),[s,d]=a(i??""),[u,m]=a(!1),[p,h]=a(!1),g=c(null);o(()=>{g.current?.focus()},[]);return t(Oe,{children:[e(Be,{eyebrow:l("auth.email.eyebrow"),title:l("auth.email.title"),body:l("auth.email.body")}),t("form",{onSubmit:async e=>{if(e.preventDefault(),!p)if(function(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test((e||"").trim())}(s)){m(!1),h(!0);try{const e=await q(s.trim().toLowerCase());r(s.trim().toLowerCase(),e??void 0)}catch{r(s.trim().toLowerCase(),void 0)}finally{h(!1)}}else m(!0)},noValidate:!0,className:"flex flex-col "+(u?"gap-2":"gap-6"),children:[e(Ye,{inputRef:g,label:l("auth.email.label"),placeholder:l("auth.email.placeholder"),value:s,onChange:e=>{d(e),u&&m(!1)},invalid:u,error:u?l("auth.email.invalidError"):void 0}),e(Ee,{type:"submit",disabled:p,children:p?e(x,{}):t(n,{children:[e("span",{children:l("auth.continue")}),e(X,{className:"!size-3.5"})]})})]})]})}const ut=["google","github","microsoft"];function mt({email:n,onBack:i,onProviderClicked:r,redirectTo:a}){const{t:o}=J();return t(Oe,{children:[e(Be,{eyebrow:o("auth.providers.eyebrow"),title:o("auth.providers.title"),body:o("auth.providers.bodyConsumer")}),e(Ue,{email:n,actionLabel:o("auth.change"),onAction:i}),e("div",{className:"flex flex-col gap-2",children:ut.map(t=>e(He,{provider:t,label:o("auth.continueWithProvider",{provider:ot(t)}),onClick:()=>(async e=>{r(e),await at(e,n,a)})(t),variant:"arrow"},t))})]})}function pt({session:n,onNotYou:i,onProviderClicked:r,redirectTo:a}){const{t:o}=J(),l=n.name?n.name.split(" ")[0]||n.name:lt(n.email),c=n.name||lt(n.email),s=e($e,{initials:(d=n.email,(d||"?").charAt(0).toUpperCase())});var d;const u=!!n.tenantName,m="oidc"===n.lastProvider?o("auth.continueWithSignIn"):o("auth.continueWithProvider",{provider:ot(n.lastProvider)});return t(Oe,{children:[e(Be,{eyebrow:o("auth.returning.eyebrow"),title:o("auth.returning.title",{name:l}),body:o("auth.returning.body")}),u&&n.tenantName?e(We,{variant:"returning",badge:s,title:c,subtitle:n.tenantName,email:n.email,actionLabel:o("auth.returning.notYou"),onAction:i}):e(Ve,{badge:s,title:c,subtitle:n.email,actionLabel:o("auth.returning.notYou"),onAction:i}),t("div",{className:"flex flex-col gap-2",children:[e(He,{provider:n.lastProvider,label:m,onClick:()=>(async e=>{r(e),await at(e,n.email,a)})(n.lastProvider),variant:"filled"}),e(Ee,{variant:"ghost",onClick:i,children:o("auth.returning.useDifferent")})]})]})}function ht({email:n,tenantName:i,onBack:r}){const{t:a}=J(),o=i||a("auth.blocked.tenantFallback"),l=function(e){if(!e)return"";const t=e.lastIndexOf("@");return t>0?e.slice(t+1):""}(n),c=i||(l?a("auth.blocked.teamFromDomain",{domain:(s=l,s?s.charAt(0).toUpperCase()+s.slice(1):s)}):a("auth.blocked.tenantFallback"));var s;return t(Oe,{children:[e(Be,{variant:"destructive",eyebrow:a("auth.blocked.eyebrow"),title:a("auth.blocked.title"),body:a("auth.blocked.body",{name:o,email:n})}),t("div",{className:"flex flex-col gap-2",children:[e(Je,{icon:ee,title:c,meta:a("auth.blocked.tenantMeta",{email:n})}),e(Ee,{variant:"ghost",onClick:r,children:a("auth.blocked.useDifferent")})]})]})}function gt({provider:t,email:n,redirectTo:i,variant:r="outline",onClick:a}){const{t:o}=J(),l="oidc"===t?o("auth.continueWithSignIn"):o("auth.continueWithProvider",{provider:ot(t)});return e(He,{provider:t,label:l,onClick:()=>{a?.(),n?at(t,n,i):function(e,t){const n=$();localStorage.removeItem("tenantName"),n.tenantId&&(n.tenantId=null),oe(n,rt(e,void 0,t))}(t,i)},variant:r})}function ft({email:n,tenant:i,onBack:r,onProviderClicked:a,redirectTo:o}){const{t:l}=J(),c=i.label||i.name||l("auth.blocked.tenantFallback"),s="google"===i.provider||"github"===i.provider||"microsoft"===i.provider?i.provider:"oidc",d="oidc"===s?l("auth.tenant.viaIdpFallback"):ot(s);return t(Oe,{children:[e(Be,{eyebrow:l("auth.tenant.eyebrow"),title:l("auth.tenant.title",{name:c}),body:l("auth.tenant.body")}),e(We,{variant:"tenant",badge:e($e,{initials:(u=c,u.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join("")),shape:"square"}),title:c,subtitle:l("auth.tenant.viaIdp",{idp:d}),email:n,actionLabel:l("auth.change"),onAction:r}),t("div",{className:"flex flex-col gap-2",children:[e(gt,{provider:s,email:n,redirectTo:o,variant:"filled",onClick:a}),e(Ee,{variant:"ghost",onClick:r,children:l("auth.tenant.notPartOf",{name:c})})]})]});var u}function vt({onSignup:i,goBack:r}){const{t:l}=J(),[c,s]=a(void 0),[d,u]=a(void 0),[p,g]=a(void 0),[f,v]=a(void 0),[x,N]=a(void 0),[w,k]=a(void 0),[C,S]=a(void 0),j="company"===c,z=[{id:1,label:l("signup.size1to10")},{id:11,label:l("signup.size11to100")},{id:101,label:l("signup.size101to1000")},{id:1001,label:l("signup.size1001to5000")},{id:5001,label:l("signup.size5000plus")}],I=[{id:"personal",label:l("signup.personal"),description:l("signup.personalDescription")},{id:"company",label:l("signup.company"),description:l("signup.companyDescription")}],P=[{id:"testing",label:l("signup.justTesting")},{id:"exploring",label:l("signup.activelyExploring")},{id:"using",label:l("signup.alreadyUsing")},{id:"migrating",label:l("signup.migratingLLMs")},{id:"other",label:l("signup.other")}];o(()=>{const e=$().currentUser;e?k(e):console.error("No user found")},[]);return t("div",{className:"flex flex-col space-y-2",children:[t("div",{className:"prose",children:[e("p",{className:"prose text-sm text-muted pt-4",children:l("signup.welcomeMessage",{name:w?.displayName,email:w?.email})}),C&&e("div",{className:"text-destructive",children:C})]}),e(xt,{label:l("signup.accountType"),children:e(b,{options:I,selected:I.find(e=>e.id===c),onSelect:e=>s(e.id)})}),j&&t(n,{children:[e(xt,{label:l("signup.companySize"),children:e(m,{className:"w-full border border-accent bg-muted",value:d,options:z,onChange:u,optionLabel:e=>e?.label,placeholder:l("signup.selectCompanySize")})}),e(xt,{label:l("signup.companyName"),children:e(y,{value:p,onChange:g,type:"text",required:!0})}),e(xt,{label:l("signup.companyWebsite"),children:e(y,{value:f,onChange:v,type:"text"})})]}),e(xt,{label:l("signup.projectMaturity"),children:e(m,{className:"w-full border border-accent bg-muted",options:P,value:P.find(e=>e.id===x),optionLabel:e=>e?.label,placeholder:l("signup.selectProjectMaturity"),onChange:e=>N(e?.id)})}),t("div",{className:"pt-8 flex flex-col",children:[e(h,{variant:"primary",onClick:async()=>{if(!(c?j&&!p?(S(l("signup.pleaseEnterOrgName")),0):!j||d||(S(l("signup.pleaseSelectCompanySize")),0):(S(l("signup.pleaseSelectAccountType")),0)))return;if(!c)return;const e={accountType:c,companyName:p,companySize:d?.id,companyWebsite:f,maturity:x};window.localStorage.setItem("composableSignupData",JSON.stringify(e));const t=await($().currentUser?.getIdToken());console.log("Got firebase token",$(),t),t?i(e,t):console.error("No firebase token found")},size:"xl",children:e("span",{className:"text-lg",children:l("signup.signUp")})}),e(h,{variant:"ghost",size:"xl",className:"mt-4",onClick:r,children:e("span",{className:"",children:l("signup.wrongAccountGoBack")})})]})]})}function xt({label:n,children:i}){return t("div",{className:"flex flex-col space-y-2 pt-4",children:[e("div",{className:"text-sm text-muted",children:n}),i]})}function bt({allowedPrefix:t,isNested:n=!1,lightLogo:i,darkLogo:r,preservePath:a,suppressAuthErrorPrefix:o}){const l="undefined"==typeof window?"":window.location.pathname,c=yt(l,t),s=yt(l,o);return c?null:e(Nt,{isNested:n,lightLogo:i,darkLogo:r,preservePath:a,suppressAuthError:s})}function yt(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t||e.startsWith(t.endsWith("/")?t:`${t}/`))}function Nt({isNested:n=!1,lightLogo:i,darkLogo:r,preservePath:l,suppressAuthError:c}){const{t:d}=J(),{isLoading:u,user:m,authError:p,signOut:h}=E(),{trackEvent:g}=F(),[f,v]=a(()=>Qe()),[x,b]=a(()=>Qe()?"returning":"email"),[y,N]=a(""),[w,k]=a(void 0),[C,S]=a(null);o(()=>{l||history.replaceState({},"","/")},[l]),o(()=>{if(p)if(p instanceof M)b("signup");else if(ct(p)){const e=Ze();e&&N(e.email),b("blocked")}},[p]),o(()=>{if(!m)return;const e=Ze();e&&(!function(e){try{localStorage.setItem(Ge,JSON.stringify(e))}catch{}}({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:m.name||void 0}),et())},[m]);const j=s((e,t)=>{N(e),k(t),b(t?"tenant":"providers")},[]),z=s(()=>{b("email"),k(void 0)},[]),I=s(()=>{Xe(),et(),v(null),N(""),k(void 0),b("email"),h()},[h]),P=s(e=>{(!!w||!!f?.tenantName)&&g("enterprise_signin",{provider:e}),S(e),b("pending")},[g,f?.tenantName,w]),A=s(()=>{v(null),N(""),k(void 0),b("email"),tt()},[]),L=(e,t)=>{const n={signupData:e,firebaseToken:t};fetch(`${ie.endpoints.studio}/auth/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(()=>{g("sign_up"),window.location.href="/"})};if(u||m||c&&void 0!==p&&!(p instanceof M))return null;let T=null;return T="pending"===x&&C?e(st,{provider:C}):"blocked"===x?e(ht,{email:y||f?.email||"",tenantName:w?.label||w?.name||f?.tenantName||void 0,onBack:A}):"signup"!==x||localStorage.getItem("tenantName")?"tenant"===x&&w?e(ft,{email:y,tenant:w,onBack:z,onProviderClicked:()=>P(w.provider??"oidc")}):"providers"===x?e(mt,{email:y,onBack:z,onProviderClicked:P}):"returning"===x&&f?e(pt,{session:f,onNotYou:I,onProviderClicked:P}):e(dt,{initialEmail:y,onProceed:j}):e(vt,{onSignup:L,goBack:A}),e("div",{style:{zIndex:999998},className:(n?"absolute":"fixed")+" inset-0 overflow-y-auto bg-background",children:e("div",{className:"min-h-full flex flex-col items-center justify-center py-12 px-4",children:t("div",{className:"flex flex-col items-center w-full",children:[(i||r)&&t("div",{className:"mb-7",children:[i&&e("img",{src:i,alt:"Vertesia",className:"h-10 block dark:hidden"}),r&&e("img",{src:r,alt:"Vertesia",className:"h-10 hidden dark:block"})]}),T,p&&!(p instanceof M)&&!ct(p)&&e("div",{className:"mt-6 max-w-[420px] text-center text-sm text-muted",children:t("div",{children:[d("auth.signInError"),e("br",{}),d("auth.signInErrorContact"),e("a",{className:"text-info mx-1",href:"mailto:support@vertesiahq.com",children:"support@vertesiahq.com"}),d("auth.signInErrorPersists"),e("pre",{className:"mt-2 text-xs",children:d("auth.error",{message:p.message})})]})}),t("div",{className:"flex items-center gap-5 mt-10 text-xs text-muted-foreground",children:[e("a",{href:"https://vertesiahq.com/privacy",className:"hover:text-foreground transition",children:d("auth.privacyPolicy")}),e("span",{className:"text-border",children:"·"}),e("a",{href:"https://vertesiahq.com/terms",className:"hover:text-foreground transition",children:d("auth.termsOfService")}),e("span",{className:"text-border",children:"·"}),e(re,{className:"cursor-default"})]})]})})})}const wt=new Set(["127.0.0.1","localhost"]);function kt(e){const t=new URLSearchParams(e.search),n=function(e){if(!e)return null;let t,n;try{t=decodeURIComponent(e)}catch{return null}try{n=new URL(t)}catch{return null}return"http:"!==n.protocol?null:n.port?n.username||n.password?null:wt.has(n.hostname)?n.toString():null:null}(t.get("redirect_uri")),i=t.get("code");if(!n||!i)return null;return{redirect:n,code:i,profile:t.get("profile")??"default",project:t.get("project")??void 0,account:t.get("account")??void 0}}function Ct(){const[t,n]=a(),[i,r]=a(),o=kt(de()),l=N(),{t:c}=J(),s=async e=>{if(!o)return;if(!e.profile)return void l({title:c("login.terminal.profileRequired"),description:c("login.terminal.profileRequiredDesc"),status:"error",duration:2e3});if(!e.account)return void l({title:c("login.terminal.accountRequired"),description:c("login.terminal.accountRequiredDesc"),status:"error",duration:2e3});if(!e.project)return void l({title:c("login.terminal.projectRequired"),description:c("login.terminal.projectRequiredDesc"),status:"error",duration:2e3});let t;try{const i=W(),r=i?await V(i,e.account,e.project,86400):await U(e.account,e.project,86400);r?(t={...e,studio_server_url:ie.endpoints.studio,zeno_server_url:ie.endpoints.zeno,token:r},await fetch(o.redirect,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),n(t)):l({title:c("login.terminal.failedToGetToken"),status:"error",duration:5e3})}catch(e){t?(r(e instanceof Error?e:new Error(u(e))),n(t)):l({title:c("login.terminal.errorAuthorizingClient"),description:u(e),status:"error",duration:5e3})}},d=o?t?e(jt,{payload:t,error:i}):e(St,{clientInfo:o,onAccept:s}):e(w,{title:c("login.terminal.invalidRequest"),children:c("login.terminal.invalidRequestDesc")});return e("div",{className:"w-full flex flex-col items-center gap-4 mt-24",children:d})}function St({onAccept:i,clientInfo:r}){const{client:a,user:o}=E(),{data:l,error:c}=d(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:s}=J();if(c)return e(w,{title:s("login.terminal.errorLoadingProjects"),children:u(c)});const m=ie.isLocalDev?s("login.terminal.envLocalDev"):ie.isDev?s("login.terminal.envStaging"):s("login.terminal.envProduction");return o&&l?t(n,{children:[t("div",{className:"w-1/3",children:[t("div",{className:"mb-4 text-xl font-semibold text-info",children:["Authorizing client on ",m," environment."]}),t("div",{className:"mb-2 text-md text-muted-foreground",children:[e("div",{children:s("login.terminal.clientWantsAuth")}),t("div",{children:["The client app code is ",e("b",{className:"text-foreground",children:r.code}),". You can check if the code is correct in the terminal."]})]}),t("div",{className:"mb-2 text-sm text-muted-foreground",children:[e("div",{children:s("login.terminal.chooseAccountProject")}),e("div",{children:s("login.terminal.profileNameNote")})]})]}),e(zt,{onAccept:i,allProjects:l,data:r})]}):e(x,{size:"lg"})}function jt({payload:n,error:i}){const r=N(),{t:a}=J();return t("div",{children:[e("div",i?{children:e(w,{title:a("login.terminal.failedToSendToken"),children:a("login.terminal.failedToSendTokenDesc",{error:i.message})})}:{children:a("login.terminal.clientAuthenticated")}),e(p,{className:"mt-4",children:e(h,{variant:"secondary",onClick:()=>{n&&(navigator.clipboard.writeText(JSON.stringify(n)),r({title:a("login.terminal.authPayloadCopied"),description:i?a("login.terminal.authPayloadCopiedWithError",{error:i.message}):a("login.terminal.authPayloadCopiedSuccess"),status:"success",duration:5e3}))},children:a("login.terminal.copyAuthPayload")})})]})}function zt({allProjects:n,data:i,onAccept:r}){const{accounts:o,account:l,project:c}=E(),{t:s}=J(),[d,u]=a(()=>({profile:i.profile,account:i.account??l?.id,project:i.project??c?.id})),m=n.filter(e=>e.account===d.account);return t("div",{className:"w-1/3",children:[t("div",{className:"mb-4 flex flex-col gap-2",children:[e("span",{className:"font-semibold text-muted-foreground",children:s("login.terminal.profileName")}),e(y,{type:"text",value:d.profile,onChange:e=>{u({...d,profile:e})}})]}),t("div",{className:"mb-4 flex flex-col gap-2",children:[e("span",{className:"font-semibold text-muted-foreground",children:s("login.terminal.account")}),e(It,{value:d.account,onChange:e=>{u({...d,account:e.id,project:void 0})},accounts:o||[]})]}),t("div",{className:"mb-4 flex flex-col gap-2",children:[e("span",{className:"font-semibold text-muted-foreground",children:s("login.terminal.project")}),e(Pt,{value:d.project,onChange:e=>{u({...d,project:e.id})},projects:m})]}),e("div",{className:"mb-4 text-sm text-attention",children:s("login.terminal.browserPermissionNote")}),e("div",{children:e(h,{size:"xl",onClick:()=>r(d),children:s("login.terminal.authorizeClient")})})]})}function It({value:t,accounts:n,onChange:i}){const{t:r}=J();return e(m,{options:n,value:n?.find(e=>e.id===t),onChange:e=>{i(e)},by:"id",optionLabel:e=>e.name,placeholder:r("login.terminal.selectAccount")})}function Pt({value:t,projects:n,onChange:i}){const{t:r}=J();return e(m,{by:"id",value:n.find(e=>e.id===t),options:n,optionLabel:e=>e.name,placeholder:r("login.terminal.selectProject"),onChange:e=>{i(e)}})}function At({isOpen:n,onClose:i}){return t(g,{isOpen:n,onClose:i,children:[e(f,{children:"Sign In"}),t(v,{className:"flex flex-col gap-2",children:[e(gt,{provider:"google"}),e(gt,{provider:"github"}),e(gt,{provider:"microsoft"})]}),e(k,{align:"right",children:e(h,{variant:"ghost",onClick:i,children:"Cancel"})})]})}function Lt({title:n,value:i}){const[r,o]=a(!1);return t("div",{className:"w-full flex justify-between items-center mb-1",children:[t("div",{className:"flex flex-col w-[calc(100%-3rem)]",children:[e("div",{className:"text-sm px-2 dark:text-slate-200",children:n}),e(z,{description:i,size:"xs",placement:"left",children:t("div",{className:"text-xs truncate text-muted w-full text-start px-2",children:[i," "]})})]}),r?e(te,{className:"size-4 cursor-pointer text-success"}):e(ne,{className:"size-4 cursor-pointer text-gray-400 dark:text-slate-400",onClick:()=>function(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}(i)})]})}function Tt(){const{t:n}=J(),i=E(),{account:r,project:a,client:o,authToken:l}=i,c=o.baseUrl,s=o.store.baseUrl,d=s.replace(/\/+$/,"")!==c.replace(/\/+$/,""),u=ie.endpoints.mcp??n("user.unknown"),m=a?me(a):"",p=[{name:"user",label:n("user.user"),content:t("div",{className:"space-y-1 p-2",children:[e(Lt,{title:n("user.organizationId"),value:r?.id??n("user.unknown")}),e(Lt,{title:n("user.projectId"),value:a?.id??n("user.unknown")}),e(Lt,{title:n("user.userId"),value:l?.sub??n("user.unknown")}),e(Lt,{title:n("user.organizationRoles"),value:l?.account_roles?.join(",")??n("user.unknown")}),e(Lt,{title:n("user.projectRoles"),value:l?.project_roles?.join(",")??n("user.unknown")})]})},{name:"environment",label:n("user.environment"),content:t("div",{className:"space-y-1 p-2",children:[e(Lt,{title:n("user.tenantId"),value:m}),e(Lt,{title:n("user.environment"),value:ie.type}),e(Lt,{title:n("user.server"),value:c}),d&&e(Lt,{title:n("user.store"),value:s}),e(Lt,{title:n("user.mcpServer"),value:u}),e(Lt,{title:n("user.appVersion"),value:ie.version}),e(Lt,{title:n("user.sdkVersion"),value:ie.sdkVersion||n("user.unknown")})]})}];return e("div",{className:"w-full",children:t(C,{defaultValue:"user",tabs:p,fullWidth:!0,updateHash:!1,children:[e(S,{}),e(j,{})]})})}function Ot(i){const{user:r,isLoading:o}=E(),[l,c]=a(!1);return o?e(x,{}):r?e("div",{className:"px-3",children:e(Bt,{asMenuTrigger:!0})}):t(n,{children:[e(h,{onClick:()=>c(!0),children:"Sign In"}),e(At,{isOpen:l,onClose:()=>c(!1)})]})}function Bt({className:n,asMenuTrigger:i=!1}){const r=E(),a=ue(),o=he(),{user:l}=r;if(!r||!l)return null;const c=o.hasPermission(pe.project_admin);return t(I,{click:!0,children:[e(P,{children:e("div",{className:ve(n,"flex items-center justify-start",i&&"cursor-pointer"),children:e(A,{size:"sm",color:"bg-amber-500",shape:"circle",name:l?.name})})}),e(L,{align:"start",className:"w-[280px] mx-2 my-1 p-0",children:t("div",{className:"divide-y divide-gray-200 dark:divide-slate-700",children:[t("div",{className:"py-2 ps-2",children:[e("p",{className:"px-4 dark:text-white mb-1",children:l?.name??"Unknown"}),e("p",{className:"px-4 text-xs text-gray-500",children:l?.email??""})]}),e("div",{className:"w-full p-1",children:e(Tt,{})}),e("div",{className:"py-2 ps-2",children:e(T,{})}),e("div",{className:"py-2",children:t(O,{children:[c&&e(O.Item,{className:"px-2",onClick:()=>a("/settings",{replace:!0}),children:"Settings"}),e(O.Item,{className:"px-2",onClick:()=>r.logout(),children:"Sign out"})]})})]})})]})}function Rt(e){return!!e&&(e.endsWith("@vertesiahq.com")||e.endsWith("@becomposable.com")||e.endsWith("@composableprompts.com"))}function Et({icon:t}){const{isLoading:n}=E(),[i,r]=a(!0);return o(()=>{n||r(!1)},[n]),e(xe,{children:i&&e(be.div,{style:{zIndex:999999,position:"fixed",inset:0},className:"fixed inset-x-0 inset-y-0",initial:{opacity:1},exit:{opacity:0},transition:{ease:"easeIn",duration:.5},children:e("div",{style:{display:"flex",width:"100%",height:"100%",alignItems:"center",justifyContent:"center"},className:"flex w-full h-full items-center justify-center",children:e("div",{className:"animate-[spin_4s_linear_infinite]",children:e("div",{className:"animate-pulse rounded-full bg-transparent",children:t||e(Dt,{})})})})})})}function Dt(){return t("svg",{width:"32",height:"32",className:"w-8 h-8 text-indigo-600",viewBox:"0 0 50 50",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Loading",children:[e("title",{children:"Loading"}),e("defs",{children:t("linearGradient",{id:"spinner-gradient",x1:"1",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),e("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),e("circle",{cx:"25",cy:"25",r:"20",stroke:"url(#spinner-gradient)",strokeWidth:"5",fill:"none",strokeLinecap:"round"})]})}function _t({children:n,lightLogo:i,darkLogo:r,loadingIcon:a,loadOnboardingStatus:o,preserveSignInPath:l,suppressSignInErrorPrefixes:c,defaultLanguage:s}){return e(B,{children:e(H,{loadOnboardingStatus:o,children:e(ge,{children:e(R,{defaultTheme:"system",storageKey:"vite-ui-theme",children:e(Y,{defaultLanguage:s,children:t(G,{children:[e(Et,{icon:a}),e(bt,{allowedPrefix:"/shared/",darkLogo:r,lightLogo:i,preservePath:l,suppressAuthErrorPrefix:c}),e(fe,{children:n})]})})})})})})}export{ye as AppInstallationContext,Ne as AppInstallationProvider,ke as AppProjectSelector,Pe as InviteAcceptModal,bt as SigninScreen,Se as StandaloneApp,je as StandaloneAppImpl,Ct as TerminalLogin,Ot as UserSessionMenu,_t as VertesiaShell,Rt as isVertesiaEmail,we as useAppInstallation};
|
|
2
|
-
//# sourceMappingURL=vertesia-ui-shell.js.map
|
|
1
|
+
import{Fragment as e,jsx as t,jsxs as n}from"react/jsx-runtime";import{createContext as r,useCallback as i,useContext as a,useEffect as o,useMemo as s,useRef as c,useState as l}from"react";import{Avatar as u,Button as d,Center as f,ErrorBox as p,Input as m,MenuList as h,Modal as g,ModalBody as _,ModalFooter as v,ModalTitle as y,ModeToggle as b,Popover as x,PopoverContent as S,PopoverTrigger as C,RadioGroup as w,SelectBox as T,Spinner as E,Tabs as D,TabsBar as O,TabsPanel as k,ThemeProvider as A,ToastProvider as ee,VTooltip as te,errorMessage as j,useFetch as M,useToast as ne}from"@vertesia/ui/core";import{DevSessionProvider as re,LastSelectedAccountId_KEY as ie,LastSelectedProjectId_KEY as ae,RestrictedEnvironmentError as N,UserNotFoundError as P,UserSessionProvider as oe,fetchComposableTokenFromFirebaseToken as se,fetchComposableTokenFromVertesiaToken as ce,getCurrentVertesiaToken as le,getFirebaseAuth as F,setFirebaseTenant as ue,useUXTracking as de,useUserSession as I}from"@vertesia/ui/session";import{LanguageBoundI18nProvider as fe,LanguageProvider as pe,useUITranslation as L}from"@vertesia/ui/i18n";import{ArrowRight as me,Check as he,CopyIcon as ge,LockIcon as _e,LockKeyhole as ve,Mail as ye,ShieldOff as be}from"lucide-react";import{Env as R}from"@vertesia/ui/env";import{RegionTag as xe}from"@vertesia/ui/layout";import{GithubAuthProvider as Se,GoogleAuthProvider as Ce,OAuthProvider as we,signInWithRedirect as Te,signOut as Ee}from"firebase/auth";import{useLocation as De,useNavigate as Oe}from"@vertesia/ui/router";import{Permission as ke,getTenantIdFromProject as Ae}from"@vertesia/common";import{TypeRegistryProvider as je,UserPermissionProvider as Me,useUserPermissions as Ne}from"@vertesia/ui/features";import Pe from"clsx";import{AnimatePresence as Fe,motion as Ie}from"framer-motion";const z=r(null);function Le({installation:e,children:n}){return t(z.Provider,{value:e,children:n})}function Re(){return a(z)}function ze({app:e,onChange:r,placeholder:i}){let{client:a,project:o}=I(),{data:s,error:c}=M(()=>a.apps.getAppInstallationProjects(e),[e.id,e.name]);return c?n(`span`,{className:`text-red-600`,children:[`Error: failed to fetch projects: `,j(c)]}):t(Be,{placeholder:i,initialValue:o?.id,projects:s||[],onChange:e=>{r&&!r(e)||(localStorage.setItem(ie,e.account),localStorage.setItem(`${ae}-${e.account}`,e.id),window.location.reload())}})}function Be({initialValue:e,projects:n,onChange:r,placeholder:i=`Select Project`}){let[a,o]=l();return t(T,{by:`id`,value:!a&&e?n.find(t=>t.id===e):a,options:n,optionLabel:e=>e.name,placeholder:i,onChange:e=>{o(e),r(e)}})}function Ve({name:e,AccessDenied:n=Ue,children:r}){return e?t(He,{name:e,AccessDenied:n,children:r}):t(We,{})}function He({name:e,AccessDenied:n=Ue,children:r}){let{authToken:i,client:a}=I(),[s,c]=l(null),[u,d]=l(`loading`);if(o(()=>{i?i.apps.includes(e)?a.apps.getAppInstallationByName(e).then(t=>{t?(d(`loaded`),c(t)):(console.log(`App ${e} not found!`),d(`error`))}):d(`error`):d(`loading`)},[e,i,a.apps.getAppInstallationByName]),u===`loading`)return null;if(u===`error`)return t(n,{name:e});if(s)return t(Le,{installation:s,children:r})}function Ue({name:e}){let{project:r,accounts:i,client:a}=I(),{t:c}=L(),[u,d]=l(),{data:p}=M(()=>a.apps.getAppInstallationProjects({name:e}),[e]),{projectsByOrg:m,orgOptions:h}=s(()=>{if(!p||!i)return{projectsByOrg:{},orgOptions:[]};let e={};for(let t of p)e[t.account]||(e[t.account]=[]),e[t.account].push(t);return{projectsByOrg:e,orgOptions:i.filter(t=>e[t.id]?.length>0)}},[p,i]);o(()=>{!u&&h.length>0&&d(h[0].id)},[h,u]);let g=e=>{localStorage.setItem(ie,e.account),localStorage.setItem(`${ae}-${e.account}`,e.id),window.location.reload()},_=u&&m[u]||[],v=h.find(e=>e.id===u);return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(_e,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:c(`shell.accessDenied`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`You don't have permission to view the `,t(`span`,{className:`font-semibold`,children:e}),` app in project:`,` `,n(`span`,{className:`font-semibold`,children:[`«`,r?.name,`»`]}),`.`]}),h.length===0&&p!==void 0&&t(`div`,{className:`mt-4 text-sm text-gray-500`,children:`This app is not installed in any project you have access to.`}),h.length>0&&n(`div`,{className:`mt-4 flex flex-row gap-4 items-end`,children:[h.length>1&&n(`div`,{children:[t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`shell.organization`)}),t(T,{by:`id`,value:v,options:h,optionLabel:e=>e.name,placeholder:c(`shell.selectOrganization`),onChange:e=>d(e.id)})]}),n(`div`,{children:[h.length>1&&t(`div`,{className:`text-sm text-gray-500 mb-2`,children:c(`login.terminal.project`)}),t(T,{by:`id`,value:void 0,options:_,optionLabel:e=>e.name,placeholder:c(`shell.selectProject`),onChange:g})]})]})]})}function We(){let{t:e}=L();return n(f,{className:`pt-10 flex flex-col items-center text-center text-gray-700`,children:[t(_e,{className:`w-10 h-10 mb-4 text-gray-500`}),t(`div`,{className:`text-xl font-semibold`,children:e(`shell.applicationNotRegistered`)}),n(`div`,{className:`mt-2 text-sm text-gray-500`,children:[`Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.`,t(`p`,{}),`Then use the created app name as a parameter to`,` `,t(`code`,{children:`<StandaloneApp name="your-app-name">`}),` in the `,t(`code`,{children:`src/main.tsx`}),` file.`]})]})}function Ge(){let e=I(),{client:r}=e,{t:i}=L(),[a,s]=l(!1),[c,u]=l([]);o(()=>{r.account.listInvites().then(e=>{if(e.length>0){let t=e.filter(e=>e.data.account);if(t.length===0){console.log(`No valid invites found, closing modal`);return}console.log(`Found valid invites`,t.length),s(!0),u(t)}else console.log(`No invites found, closing modal`),s(!1)}).catch(e=>{console.error(`Error fetching invites`,e)})},[r.account.listInvites]);let f=()=>s(!1),p=async t=>{await r.account.acceptInvite(t.id),await e.authCallback,await e.fetchAccounts(),await e.fetchProjects(t.data.account.id);let n=c.filter(e=>e.id!==t.id).filter(e=>e.data.account);n.length>0?u(n):f()},m=async e=>{await r.account.rejectInvite(e.id);let t=c.filter(t=>t.id!==e.id);u(t),t.length===0&&f()},h=c.map(e=>e.data.account?n(`div`,{className:`flex flex-row w-full justify-between border rounded-sm px-2 py-2 `,children:[n(`div`,{className:`flex flex-col`,children:[t(`div`,{className:`w-full font-semibold`,children:e.data.account.name??e.data.account}),e.data.project&&n(`div`,{className:`w-full text-base`,children:[`- `,e.data.project.name]}),n(`div`,{className:`text-xs`,children:[`Role: `,e.data.role]}),e.data.invited_by&&n(`div`,{className:`text-xs`,children:[`by `,e.data.invited_by.name??e.data.invited_by]})]}),n(`div`,{className:`flex flex-col gap-4`,children:[t(d,{size:`xs`,onClick:()=>p(e),children:i(`login.accept`)}),` `,t(d,{size:`xs`,variant:`secondary`,onClick:()=>m(e),children:i(`login.reject`)})]})]},e.id):(console.warn(`Invite has no account data`,e),null));return t(`div`,{children:n(g,{isOpen:a,onClose:f,children:[t(y,{children:i(`login.reviewInvites`)}),n(_,{children:[t(`div`,{className:`text-sm pb-4`,children:`You have received the following invites to join other accounts. Please review and accept or declined them.`}),h]})]})})}function Ke(e){return n(`svg`,{viewBox:`0 0 48 48`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#FFC107`,d:`M43.6 20.5H42V20H24v8h11.3c-1.6 4.7-6.1 8-11.3 8a12 12 0 0 1 0-24c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 1 0 24 44c11 0 20-9 20-20 0-1.2-.1-2.3-.4-3.5z`}),t(`path`,{fill:`#FF3D00`,d:`M6.3 14.7l6.6 4.8A12 12 0 0 1 24 12c3 0 5.8 1.1 7.9 3l5.7-5.7A20 20 0 0 0 6.3 14.7z`}),t(`path`,{fill:`#4CAF50`,d:`M24 44c5.2 0 10-2 13.6-5.2l-6.3-5.3A12 12 0 0 1 12.7 28.5l-6.6 5.1A20 20 0 0 0 24 44z`}),t(`path`,{fill:`#1976D2`,d:`M43.6 20.5H42V20H24v8h11.3a12 12 0 0 1-4 5.5l6.3 5.3C37.9 36.6 44 31 44 24c0-1.2-.1-2.3-.4-3.5z`})]})}function qe(e){return t(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:t(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.48 2 2 6.58 2 12.25c0 4.54 2.87 8.39 6.84 9.75.5.09.68-.22.68-.49v-1.7c-2.78.62-3.37-1.36-3.37-1.36-.46-1.18-1.11-1.5-1.11-1.5-.91-.63.07-.62.07-.62 1 .07 1.53 1.05 1.53 1.05.89 1.57 2.34 1.12 2.91.86.09-.66.35-1.12.63-1.38-2.22-.26-4.56-1.14-4.56-5.07 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.3.1-2.7 0 0 .84-.28 2.76 1.05A9.4 9.4 0 0 1 12 7.07c.85 0 1.71.12 2.51.34 1.91-1.33 2.75-1.05 2.75-1.05.55 1.4.2 2.44.1 2.7.64.72 1.03 1.63 1.03 2.75 0 3.94-2.34 4.81-4.57 5.06.36.32.68.94.68 1.9v2.81c0 .27.18.59.69.49C19.13 20.64 22 16.78 22 12.25 22 6.58 17.52 2 12 2z`})})}function Je(e){return n(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,...e,children:[t(`path`,{fill:`#F25022`,d:`M2 2h9.5v9.5H2z`}),t(`path`,{fill:`#7FBA00`,d:`M12.5 2H22v9.5h-9.5z`}),t(`path`,{fill:`#00A4EF`,d:`M2 12.5h9.5V22H2z`}),t(`path`,{fill:`#FFB900`,d:`M12.5 12.5H22V22h-9.5z`})]})}const Ye=ve,Xe={google:Ke,github:qe,microsoft:Je,oidc:Ye};function Ze(e){return e&&e in Xe?Xe[e]:Ye}function B({children:e,centered:n=!1}){return t(`div`,{className:n?`w-full max-w-[420px] flex flex-col gap-6 items-center text-center`:`w-full max-w-[420px] flex flex-col gap-6`,children:e})}function V({eyebrow:e,title:r,body:i,variant:a=`info`}){return n(`div`,{children:[e&&t(`div`,{className:`${a===`destructive`?`text-destructive`:`text-info`} text-[12.5px] font-medium mb-2`,children:e}),t(`h1`,{className:`text-foreground text-[22px] font-semibold tracking-tight leading-tight mb-1.5`,children:r}),i&&t(`p`,{className:`text-muted text-sm leading-relaxed`,children:i})]})}const Qe={primary:`h-[42px] gap-2.5 rounded-md bg-foreground text-background hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed`,loading:`h-[42px] gap-2.5 rounded-md bg-foreground text-background opacity-90`,ghost:`h-9 text-muted hover:text-foreground`};function H({variant:e=`primary`,className:n=``,type:r=`button`,disabled:i,...a}){return t(d,{variant:`unstyled`,size:`none`,type:r,disabled:e===`loading`?!0:i,className:`cursor-pointer inline-flex items-center justify-center text-sm font-medium transition ${Qe[e]} ${n}`.trim(),...a})}function U({size:e=`xs`,className:n=``,type:r=`button`,...i}){let a=`cursor-pointer ${e===`smaller`?`!text-[11px]`:`!text-xs`} text-muted hover:text-foreground !transition px-2 py-1 !rounded underline decoration-transparent hover:decoration-current underline-offset-[3px]`;return t(d,{variant:`unstyled`,size:`none`,type:r,className:n?`${a} ${n}`:a,...i})}const $e={circle:`size-9 rounded-full text-sm ring-4 ring-background ring-offset-1 ring-offset-border`,square:`size-[30px] rounded-md text-[11px]`};function et({initials:e,shape:n=`circle`}){return t(`span`,{className:`bg-info text-info-foreground grid place-items-center font-semibold shrink-0 ${$e[n]}`,children:e})}function tt({children:e}){return t(`div`,{className:`inline-grid place-items-center size-14 rounded-xl bg-info-background border border-info/15 mb-3.5`,children:e})}function nt({title:e,subtitle:r,titleClass:i,subtitleClass:a}){return n(`div`,{className:`flex-1 min-w-0`,children:[t(`div`,{className:i,children:e}),t(`div`,{className:a,children:r})]})}const rt={tenant:{topRow:`flex items-center gap-2.5 px-3 py-2.5`,title:`text-[13.5px] font-semibold text-foreground leading-tight`,subtitle:`text-[11.5px] text-muted leading-tight mt-0.5`,bottomRow:`flex items-center gap-2.5 px-3 py-1.5 border-t border-border bg-muted-background`,mailBox:`size-[30px] grid place-items-center shrink-0`,mailIcon:`size-4 text-muted`,email:`text-sm text-foreground/80 flex-1 truncate`,actionSize:`xs`},returning:{topRow:`flex items-center gap-3 px-3.5 py-2.5`,title:`text-sm font-semibold text-foreground truncate`,subtitle:`text-xs text-foreground/80 truncate`,bottomRow:`flex items-center gap-3 px-3.5 py-1 border-t border-border bg-muted-background`,mailBox:`w-9 h-6 grid place-items-center shrink-0`,mailIcon:`size-3.5 text-muted`,email:`text-xs text-foreground/80 flex-1 truncate`,actionSize:`smaller`}};function it({variant:e=`returning`,badge:r,title:i,subtitle:a,email:o,actionLabel:s,onAction:c}){let l=rt[e];return n(`div`,{className:`rounded-md border border-border bg-background overflow-hidden`,children:[n(`div`,{className:l.topRow,children:[r,t(nt,{title:i,subtitle:a,titleClass:l.title,subtitleClass:l.subtitle})]}),n(`div`,{className:l.bottomRow,children:[t(`div`,{className:l.mailBox,children:t(ye,{className:l.mailIcon})}),t(`span`,{className:l.email,children:o}),t(U,{size:l.actionSize,onClick:c,children:s})]})]})}function at({badge:e,title:r,subtitle:i,actionLabel:a,onAction:o}){return n(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5 rounded-md border border-border bg-muted-background`,children:[e,t(nt,{title:r,subtitle:i,titleClass:`text-sm font-semibold text-foreground truncate`,subtitleClass:`text-xs text-muted truncate`}),t(U,{onClick:o,children:a})]})}function ot({email:e,actionLabel:r,onAction:i}){return n(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md border border-border bg-muted-background`,children:[t(ye,{className:`size-4 text-muted shrink-0`}),t(`span`,{className:`text-sm text-foreground/80 flex-1 truncate`,children:e}),t(U,{onClick:i,children:r})]})}function W({provider:e,label:r,onClick:i,variant:a=`outline`}){let o=Ze(e);return a===`arrow`?n(d,{variant:`unstyled`,size:`none`,onClick:i,className:`cursor-pointer group h-[42px] w-full inline-flex items-center gap-3 ps-3.5 pe-3 rounded-md border border-border bg-background text-sm font-medium text-foreground transition hover:bg-muted-background`,children:[t(o,{className:`!size-[18px] shrink-0`}),t(`span`,{className:`flex-1 text-start`,children:r}),t(me,{className:`!size-3.5 text-muted opacity-0 group-hover:opacity-100 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 transition`})]}):n(d,{variant:`outline`,onClick:i,className:`w-full py-5 flex rounded-lg transition duration-150 text-center ${a===`filled`?`!bg-foreground text-background hover:!bg-foreground/90`:`hover:shadow-sm`}`,children:[t(o,{className:`!size-[18px]`}),t(`span`,{className:`text-sm font-medium`,children:r})]})}function st({icon:e,title:r,meta:i}){return n(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5 rounded-md bg-destructive-background border border-destructive/20`,children:[t(e,{className:`size-5 text-destructive shrink-0`}),n(`div`,{className:`flex-1 min-w-0 text-sm`,children:[t(`div`,{className:`font-semibold text-destructive`,children:r}),t(`div`,{className:`text-xs text-destructive/80`,children:i})]})]})}function ct({inputRef:e,label:r,placeholder:i,value:a,onChange:o,invalid:s=!1,error:c}){return n(`div`,{className:`flex flex-col gap-1.5`,children:[t(`label`,{htmlFor:`vt-login-email`,className:`text-xs font-medium text-foreground/80`,children:r}),t(`input`,{ref:e,id:`vt-login-email`,name:`vt-login-email`,type:`email`,className:`h-[42px] px-3.5 rounded-md border border-border bg-background text-sm text-foreground placeholder:text-muted-foreground outline-none transition focus:border-info focus:ring-4 focus:ring-info/15 aria-[invalid=true]:border-destructive aria-[invalid=true]:ring-destructive/15`,placeholder:i,value:a,onChange:e=>o(e.target.value),"aria-invalid":s,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`off`,spellCheck:!1,"data-1p-ignore":!0,"data-lpignore":`true`,"data-form-type":`other`}),c&&t(`div`,{role:`alert`,className:`text-xs text-destructive`,children:c})]})}const G=`vt.lastSuccessfulLogin`,K=`vt.pendingSignin`;function lt(){try{let e=localStorage.getItem(G);if(!e)return null;let t=JSON.parse(e);return!t?.email||!t?.lastProvider?null:t}catch{return null}}function ut(e){try{localStorage.setItem(G,JSON.stringify(e))}catch{}}function dt(){try{localStorage.removeItem(G)}catch{}}function ft(){try{let e=sessionStorage.getItem(K);return e?JSON.parse(e):null}catch{return null}}function pt(e){try{sessionStorage.setItem(K,JSON.stringify(e))}catch{}}function q(){try{sessionStorage.removeItem(K)}catch{}}async function mt(){dt(),q();try{await Ee(F())}catch{}}function ht(e){let t=e||window.location.pathname||`/`;return t[0]!==`/`&&(t=`/${t}`),t}const gt={google:(e,t)=>{let n=new Ce;return n.addScope(`profile`),n.addScope(`email`),n.setCustomParameters({redirect_uri:window.location.origin+ht(t),...e?{login_hint:e}:{prompt:`select_account`}}),n},github:e=>{let t=new Se;return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login:e}),t},microsoft:e=>{let t=new we(`microsoft.com`);return t.addScope(`profile`),t.addScope(`email`),e&&t.setCustomParameters({login_hint:e}),t},oidc:e=>{let t=new we(`oidc.main`);return e&&t.setCustomParameters({login_hint:e}),t}};function _t(e,t,n){return gt[e](t,n)}async function J(e,t,n){if(!t)return{ok:!1,reason:`no-email`};let r=await ue(t),i=F(),a=e,o;return r?(r.provider&&(a=r.provider),o=r.label||r.name||void 0,localStorage.setItem(`tenantName`,o??``)):(localStorage.removeItem(`tenantName`),i.tenantId&&=null),pt({email:t,provider:a,tenantName:o}),Te(i,_t(a,t,n)),{ok:!0}}function vt(e,t){let n=F();localStorage.removeItem(`tenantName`),n.tenantId&&=null,Te(n,_t(e,void 0,t))}function Y(e){return e===`google`?`Google`:e===`github`?`GitHub`:e===`microsoft`?`Microsoft`:`Sign In`}function yt(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(0,t):e}function bt(e){if(!e)return``;let t=e.lastIndexOf(`@`);return t>0?e.slice(t+1):``}function xt(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}function St(e){return(e||`?`).charAt(0).toUpperCase()}function Ct(e){let t=yt(e).split(/[._-]+/).filter(Boolean)[0]||`friend`;return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function wt(e){for(let t of e)if(t.trim()===``)return!0;return!1}function Tt(e){let t=(e||``).trim(),n=t.indexOf(`@`);if(n<=0||n!==t.lastIndexOf(`@`))return!1;let r=t.slice(n+1),i=r.indexOf(`.`);return i>0&&i<r.length-1&&!wt(t)}function X(e){let t=e;for(let e=0;t!=null&&e<8;e++){if((t instanceof Error?t.message:String(t)).includes(`Customer-domain user requires an invite to join`))return!0;t=t instanceof Error?t.cause:void 0}return!1}function Et({provider:e,onCancel:r}){let{t:i}=L(),a=Ze(e),o=e===`oidc`?i(`auth.pending.genericProvider`):Y(e);return n(B,{centered:!0,children:[n(`div`,{children:[t(tt,{children:t(a,{className:e===`oidc`?`size-6 text-info`:`size-6`})}),t(V,{title:i(`auth.pending.title`,{provider:o}),body:i(`auth.pending.body`)})]}),n(`div`,{className:`w-full flex flex-col gap-2`,children:[n(H,{variant:`loading`,children:[t(E,{}),t(`span`,{children:i(`auth.pending.authenticating`)})]}),r&&t(H,{variant:`ghost`,onClick:r,children:i(`auth.pending.cancel`)})]})]})}function Dt({initialEmail:r,onProceed:i}){let{t:a}=L(),[s,u]=l(r??``),[d,f]=l(!1),[p,m]=l(!1),h=c(null);return o(()=>{h.current?.focus()},[]),n(B,{children:[t(V,{eyebrow:a(`auth.email.eyebrow`),title:a(`auth.email.title`),body:a(`auth.email.body`)}),n(`form`,{onSubmit:async e=>{if(e.preventDefault(),!p){if(!Tt(s)){f(!0);return}f(!1),m(!0);try{let e=await ue(s.trim().toLowerCase());i(s.trim().toLowerCase(),e??void 0)}catch{i(s.trim().toLowerCase(),void 0)}finally{m(!1)}}},noValidate:!0,className:`flex flex-col ${d?`gap-2`:`gap-6`}`,children:[t(ct,{inputRef:h,label:a(`auth.email.label`),placeholder:a(`auth.email.placeholder`),value:s,onChange:e=>{u(e),d&&f(!1)},invalid:d,error:d?a(`auth.email.invalidError`):void 0}),t(H,{type:`submit`,disabled:p,children:p?t(E,{}):n(e,{children:[t(`span`,{children:a(`auth.continue`)}),t(me,{className:`!size-3.5`})]})})]})]})}const Ot=[`google`,`github`,`microsoft`];function kt({email:e,onBack:r,onProviderClicked:i,redirectTo:a}){let{t:o}=L(),s=async t=>{i(t),await J(t,e,a)};return n(B,{children:[t(V,{eyebrow:o(`auth.providers.eyebrow`),title:o(`auth.providers.title`),body:o(`auth.providers.bodyConsumer`)}),t(ot,{email:e,actionLabel:o(`auth.change`),onAction:r}),t(`div`,{className:`flex flex-col gap-2`,children:Ot.map(e=>t(W,{provider:e,label:o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>s(e),variant:`arrow`},e))})]})}function At(e){return e&&e!==`us`&&e!==`us1`?`https://cloud.${e}.vertesia.io/`:`https://cloud.vertesia.io/`}function jt({onUseDifferentEmail:e}){let{t:r}=L(),i=At(R.region),[a,s]=l(15);return o(()=>{mt()},[]),o(()=>{let e=setTimeout(()=>{window.location.href=i},15*1e3),t=setInterval(()=>{s(e=>e>0?e-1:0)},1e3);return()=>{clearTimeout(e),clearInterval(t)}},[i]),n(B,{children:[t(V,{variant:`destructive`,eyebrow:r(`auth.restricted.eyebrow`),title:r(`auth.restricted.title`),body:r(`auth.restricted.body`)}),n(`div`,{className:`flex flex-col gap-2`,children:[t(st,{icon:be,title:r(`auth.restricted.calloutTitle`),meta:r(`auth.restricted.calloutMeta`)}),t(H,{className:`w-full`,onClick:()=>{window.location.href=i},children:r(`auth.restricted.redirect`)}),t(H,{variant:`ghost`,onClick:e,children:r(`auth.restricted.useDifferent`)}),t(`p`,{className:`text-center text-xs text-muted`,children:r(`auth.restricted.autoRedirect`,{seconds:a})})]})]})}function Mt({session:e,onNotYou:r,onProviderClicked:i,redirectTo:a}){let{t:o}=L(),s=e.name?e.name.split(` `)[0]||e.name:Ct(e.email),c=e.name||Ct(e.email),l=t(et,{initials:St(e.email)}),u=!!e.tenantName,d=e.lastProvider===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e.lastProvider)}),f=async t=>{i(t),await J(t,e.email,a)};return n(B,{children:[t(V,{eyebrow:o(`auth.returning.eyebrow`),title:o(`auth.returning.title`,{name:s}),body:o(`auth.returning.body`)}),u&&e.tenantName?t(it,{variant:`returning`,badge:l,title:c,subtitle:e.tenantName,email:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}):t(at,{badge:l,title:c,subtitle:e.email,actionLabel:o(`auth.returning.notYou`),onAction:r}),n(`div`,{className:`flex flex-col gap-2`,children:[t(W,{provider:e.lastProvider,label:d,onClick:()=>f(e.lastProvider),variant:`filled`}),t(H,{variant:`ghost`,onClick:r,children:o(`auth.returning.useDifferent`)})]})]})}function Nt({email:e,tenantName:r,onBack:i}){let{t:a}=L(),o=r||a(`auth.blocked.tenantFallback`),s=bt(e),c=r||(s?a(`auth.blocked.teamFromDomain`,{domain:xt(s)}):a(`auth.blocked.tenantFallback`));return n(B,{children:[t(V,{variant:`destructive`,eyebrow:a(`auth.blocked.eyebrow`),title:a(`auth.blocked.title`),body:a(`auth.blocked.body`,{name:o,email:e})}),n(`div`,{className:`flex flex-col gap-2`,children:[t(st,{icon:be,title:c,meta:a(`auth.blocked.tenantMeta`,{email:e})}),t(H,{variant:`ghost`,onClick:i,children:a(`auth.blocked.useDifferent`)})]})]})}function Z({provider:e,email:n,redirectTo:r,variant:i=`outline`,onClick:a}){let{t:o}=L();return t(W,{provider:e,label:e===`oidc`?o(`auth.continueWithSignIn`):o(`auth.continueWithProvider`,{provider:Y(e)}),onClick:()=>{a?.(),n?J(e,n,r):vt(e,r)},variant:i})}function Pt(e){return e.split(/\s+/).filter(Boolean).slice(0,2).map(e=>e.charAt(0).toUpperCase()).join(``)}function Ft({email:e,tenant:r,onBack:i,onProviderClicked:a,redirectTo:o}){let{t:s}=L(),c=r.label||r.name||s(`auth.blocked.tenantFallback`),l=r.provider===`google`||r.provider===`github`||r.provider===`microsoft`?r.provider:`oidc`,u=l===`oidc`?s(`auth.tenant.viaIdpFallback`):Y(l);return n(B,{children:[t(V,{eyebrow:s(`auth.tenant.eyebrow`),title:s(`auth.tenant.title`,{name:c}),body:s(`auth.tenant.body`)}),t(it,{variant:`tenant`,badge:t(et,{initials:Pt(c),shape:`square`}),title:c,subtitle:s(`auth.tenant.viaIdp`,{idp:u}),email:e,actionLabel:s(`auth.change`),onAction:i}),n(`div`,{className:`flex flex-col gap-2`,children:[t(Z,{provider:l,email:e,redirectTo:o,variant:`filled`,onClick:a}),t(H,{variant:`ghost`,onClick:i,children:s(`auth.tenant.notPartOf`,{name:c})})]})]})}function It({onSignup:r,goBack:i}){let{t:a}=L(),[s,c]=l(void 0),[u,f]=l(void 0),[p,h]=l(void 0),[g,_]=l(void 0),[v,y]=l(void 0),[b,x]=l(void 0),[S,C]=l(void 0),E=s===`company`,D=[{id:1,label:a(`signup.size1to10`)},{id:11,label:a(`signup.size11to100`)},{id:101,label:a(`signup.size101to1000`)},{id:1001,label:a(`signup.size1001to5000`)},{id:5001,label:a(`signup.size5000plus`)}],O=[{id:`personal`,label:a(`signup.personal`),description:a(`signup.personalDescription`)},{id:`company`,label:a(`signup.company`),description:a(`signup.companyDescription`)}],k=[{id:`testing`,label:a(`signup.justTesting`)},{id:`exploring`,label:a(`signup.activelyExploring`)},{id:`using`,label:a(`signup.alreadyUsing`)},{id:`migrating`,label:a(`signup.migratingLLMs`)},{id:`other`,label:a(`signup.other`)}];o(()=>{let e=F().currentUser;if(!e){console.error(`No user found`);return}x(e)},[]);let A=()=>s?E&&!p?(C(a(`signup.pleaseEnterOrgName`)),!1):E&&!u?(C(a(`signup.pleaseSelectCompanySize`)),!1):!0:(C(a(`signup.pleaseSelectAccountType`)),!1);return n(`div`,{className:`flex flex-col space-y-2`,children:[n(`div`,{className:`prose`,children:[t(`p`,{className:`prose text-sm text-muted pt-4`,children:a(`signup.welcomeMessage`,{name:b?.displayName,email:b?.email})}),S&&t(`div`,{className:`text-destructive`,children:S})]}),t(Q,{label:a(`signup.accountType`),children:t(w,{options:O,selected:O.find(e=>e.id===s),onSelect:e=>c(e.id)})}),E&&n(e,{children:[t(Q,{label:a(`signup.companySize`),children:t(T,{className:`w-full border border-accent bg-muted`,value:u,options:D,onChange:f,optionLabel:e=>e?.label,placeholder:a(`signup.selectCompanySize`)})}),t(Q,{label:a(`signup.companyName`),children:t(m,{value:p,onChange:h,type:`text`,required:!0})}),t(Q,{label:a(`signup.companyWebsite`),children:t(m,{value:g,onChange:_,type:`text`})})]}),t(Q,{label:a(`signup.projectMaturity`),children:t(T,{className:`w-full border border-accent bg-muted`,options:k,value:k.find(e=>e.id===v),optionLabel:e=>e?.label,placeholder:a(`signup.selectProjectMaturity`),onChange:e=>y(e?.id)})}),n(`div`,{className:`pt-8 flex flex-col`,children:[t(d,{variant:`primary`,onClick:async()=>{if(!A()||!s)return;let e={accountType:s,companyName:p,companySize:u?.id,companyWebsite:g,maturity:v};window.localStorage.setItem(`composableSignupData`,JSON.stringify(e));let t=await F().currentUser?.getIdToken();if(console.log(`Got firebase token`,F(),t),!t){console.error(`No firebase token found`);return}r(e,t)},size:`xl`,children:t(`span`,{className:`text-lg`,children:a(`signup.signUp`)})}),t(d,{variant:`ghost`,size:`xl`,className:`mt-4`,onClick:i,children:t(`span`,{className:``,children:a(`signup.wrongAccountGoBack`)})})]})]})}function Q({label:e,children:r}){return n(`div`,{className:`flex flex-col space-y-2 pt-4`,children:[t(`div`,{className:`text-sm text-muted`,children:e}),r]})}function Lt({allowedPrefix:e,isNested:n=!1,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthErrorPrefix:o}){let s=typeof window>`u`?``:window.location.pathname,c=Rt(s,e),l=Rt(s,o);return c?null:t(zt,{isNested:n,lightLogo:r,darkLogo:i,preservePath:a,suppressAuthError:l})}function Rt(e,t){return(Array.isArray(t)?t:t?[t]:[]).some(t=>e===t?!0:e.startsWith(t.endsWith(`/`)?t:`${t}/`))}function zt({isNested:e=!1,lightLogo:r,darkLogo:a,preservePath:s,suppressAuthError:c}){let{t:u}=L(),{isLoading:d,user:f,authError:p,signOut:m}=I(),{trackEvent:h}=de(),[g,_]=l(()=>lt()),[v,y]=l(()=>lt()?`returning`:`email`),[b,x]=l(``),[S,C]=l(void 0),[w,T]=l(null);o(()=>{s||history.replaceState({},``,`/`)},[s]),o(()=>{if(p){if(p instanceof P)y(`signup`);else if(p instanceof N)y(`restricted`);else if(X(p)){let e=ft();e&&x(e.email),y(`blocked`)}}},[p]),o(()=>{if(!f)return;let e=ft();e&&(ut({email:e.email,lastProvider:e.provider,tenantName:e.tenantName,name:f.name||void 0}),q())},[f]);let E=i((e,t)=>{x(e),C(t),y(t?`tenant`:`providers`)},[]),D=i(()=>{y(`email`),C(void 0)},[]),O=i(()=>{dt(),q(),_(null),x(``),C(void 0),y(`email`),m()},[m]),k=i(e=>{(S||g?.tenantName)&&h(`enterprise_signin`,{provider:e}),T(e),y(`pending`)},[h,g?.tenantName,S]),A=i(()=>{_(null),x(``),C(void 0),y(`email`),mt()},[]),ee=(e,t)=>{let n={signupData:e,firebaseToken:t};fetch(`${R.endpoints.studio}/auth/signup`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)}).then(()=>{h(`sign_up`),window.location.href=`/`})},te=c&&p!==void 0&&!(p instanceof P)&&!(p instanceof N);if(d||f||te)return null;let j=null;return j=v===`pending`&&w?t(Et,{provider:w}):v===`blocked`?t(Nt,{email:b||g?.email||``,tenantName:S?.label||S?.name||g?.tenantName||void 0,onBack:A}):v===`restricted`?t(jt,{onUseDifferentEmail:A}):v===`signup`&&!localStorage.getItem(`tenantName`)?t(It,{onSignup:ee,goBack:A}):v===`tenant`&&S?t(Ft,{email:b,tenant:S,onBack:D,onProviderClicked:()=>k(S.provider??`oidc`)}):v===`providers`?t(kt,{email:b,onBack:D,onProviderClicked:k}):v===`returning`&&g?t(Mt,{session:g,onNotYou:O,onProviderClicked:k}):t(Dt,{initialEmail:b,onProceed:E}),t(`div`,{style:{zIndex:999998},className:`${e?`absolute`:`fixed`} inset-0 overflow-y-auto bg-background`,children:t(`div`,{className:`min-h-full flex flex-col items-center justify-center py-12 px-4`,children:n(`div`,{className:`flex flex-col items-center w-full`,children:[(r||a)&&n(`div`,{className:`mb-7`,children:[r&&t(`img`,{src:r,alt:`Vertesia`,className:`h-10 block dark:hidden`}),a&&t(`img`,{src:a,alt:`Vertesia`,className:`h-10 hidden dark:block`})]}),j,p&&!(p instanceof P)&&!(p instanceof N)&&!X(p)&&t(`div`,{className:`mt-6 max-w-[420px] text-center text-sm text-muted`,children:n(`div`,{children:[u(`auth.signInError`),t(`br`,{}),u(`auth.signInErrorContact`),t(`a`,{className:`text-info mx-1`,href:`mailto:support@vertesiahq.com`,children:`support@vertesiahq.com`}),u(`auth.signInErrorPersists`),t(`pre`,{className:`mt-2 text-xs`,children:u(`auth.error`,{message:p.message})})]})}),n(`div`,{className:`flex items-center gap-5 mt-10 text-xs text-muted-foreground`,children:[t(`a`,{href:`https://vertesiahq.com/privacy`,className:`hover:text-foreground transition`,children:u(`auth.privacyPolicy`)}),t(`span`,{className:`text-border`,children:`·`}),t(`a`,{href:`https://vertesiahq.com/terms`,className:`hover:text-foreground transition`,children:u(`auth.termsOfService`)}),t(`span`,{className:`text-border`,children:`·`}),t(xe,{className:`cursor-default`})]})]})})})}const Bt=new Set([`127.0.0.1`,`localhost`]);function Vt(e){if(!e)return null;let t;try{t=decodeURIComponent(e)}catch{return null}let n;try{n=new URL(t)}catch{return null}return n.protocol!==`http:`||!n.port||n.username||n.password||!Bt.has(n.hostname)?null:n.toString()}function Ht(e){let t=new URLSearchParams(e.search),n=Vt(t.get(`redirect_uri`)),r=t.get(`code`);return!n||!r?null:{redirect:n,code:r,profile:t.get(`profile`)??`default`,project:t.get(`project`)??void 0,account:t.get(`account`)??void 0}}function Ut(){let[e,n]=l(),[r,i]=l(),a=Ht(De()),o=ne(),{t:s}=L();return t(`div`,{className:`w-full flex flex-col items-center gap-4 mt-24`,children:a?e?t(Gt,{payload:e,error:r}):t(Wt,{clientInfo:a,onAccept:async e=>{if(!a)return;if(!e.profile){o({title:s(`login.terminal.profileRequired`),description:s(`login.terminal.profileRequiredDesc`),status:`error`,duration:2e3});return}if(!e.account){o({title:s(`login.terminal.accountRequired`),description:s(`login.terminal.accountRequiredDesc`),status:`error`,duration:2e3});return}if(!e.project){o({title:s(`login.terminal.projectRequired`),description:s(`login.terminal.projectRequiredDesc`),status:`error`,duration:2e3});return}let t;try{let r=le(),i=r?await ce(r,e.account,e.project,24*3600):await se(e.account,e.project,24*3600);i?(t={...e,studio_server_url:R.endpoints.studio,zeno_server_url:R.endpoints.zeno,token:i},await fetch(a.redirect,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),n(t)):o({title:s(`login.terminal.failedToGetToken`),status:`error`,duration:5e3})}catch(e){t?(i(e instanceof Error?e:Error(j(e))),n(t)):o({title:s(`login.terminal.errorAuthorizingClient`),description:j(e),status:`error`,duration:5e3})}}}):t(p,{title:s(`login.terminal.invalidRequest`),children:s(`login.terminal.invalidRequestDesc`)})})}function Wt({onAccept:r,clientInfo:i}){let{client:a,user:o}=I(),{data:s,error:c}=M(()=>o?a.projects.list():Promise.resolve([]),[o]),{t:l}=L();if(c)return t(p,{title:l(`login.terminal.errorLoadingProjects`),children:j(c)});let u=R.isLocalDev?l(`login.terminal.envLocalDev`):R.isDev?l(`login.terminal.envStaging`):l(`login.terminal.envProduction`);return o&&s?n(e,{children:[n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 text-xl font-semibold text-info`,children:[`Authorizing client on `,u,` environment.`]}),n(`div`,{className:`mb-2 text-md text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.clientWantsAuth`)}),n(`div`,{children:[`The client app code is `,t(`b`,{className:`text-foreground`,children:i.code}),`. You can check if the code is correct in the terminal.`]})]}),n(`div`,{className:`mb-2 text-sm text-muted-foreground`,children:[t(`div`,{children:l(`login.terminal.chooseAccountProject`)}),t(`div`,{children:l(`login.terminal.profileNameNote`)})]})]}),t(Kt,{onAccept:r,allProjects:s,data:i})]}):t(E,{size:`lg`})}function Gt({payload:e,error:r}){let i=ne(),{t:a}=L();return n(`div`,{children:[r?t(`div`,{children:t(p,{title:a(`login.terminal.failedToSendToken`),children:a(`login.terminal.failedToSendTokenDesc`,{error:r.message})})}):t(`div`,{children:a(`login.terminal.clientAuthenticated`)}),t(f,{className:`mt-4`,children:t(d,{variant:`secondary`,onClick:()=>{e&&(navigator.clipboard.writeText(JSON.stringify(e)),i({title:a(`login.terminal.authPayloadCopied`),description:r?a(`login.terminal.authPayloadCopiedWithError`,{error:r.message}):a(`login.terminal.authPayloadCopiedSuccess`),status:`success`,duration:5e3}))},children:a(`login.terminal.copyAuthPayload`)})})]})}function Kt({allProjects:e,data:r,onAccept:i}){let{accounts:a,account:o,project:s}=I(),{t:c}=L(),[u,f]=l(()=>({profile:r.profile,account:r.account??o?.id,project:r.project??s?.id})),p=e=>{f({...u,profile:e})},h=e=>{f({...u,account:e.id,project:void 0})},g=e=>{f({...u,project:e.id})},_=e.filter(e=>e.account===u.account);return n(`div`,{className:`w-1/3`,children:[n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.profileName`)}),t(m,{type:`text`,value:u.profile,onChange:p})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.account`)}),t(qt,{value:u.account,onChange:h,accounts:a||[]})]}),n(`div`,{className:`mb-4 flex flex-col gap-2`,children:[t(`span`,{className:`font-semibold text-muted-foreground`,children:c(`login.terminal.project`)}),t(Jt,{value:u.project,onChange:g,projects:_})]}),t(`div`,{className:`mb-4 text-sm text-attention`,children:c(`login.terminal.browserPermissionNote`)}),t(`div`,{children:t(d,{size:`xl`,onClick:()=>i(u),children:c(`login.terminal.authorizeClient`)})})]})}function qt({value:e,accounts:n,onChange:r}){let{t:i}=L();return t(T,{options:n,value:n?.find(t=>t.id===e),onChange:e=>{r(e)},by:`id`,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectAccount`)})}function Jt({value:e,projects:n,onChange:r}){let{t:i}=L();return t(T,{by:`id`,value:n.find(t=>t.id===e),options:n,optionLabel:e=>e.name,placeholder:i(`login.terminal.selectProject`),onChange:e=>{r(e)}})}function Yt({isOpen:e,onClose:r}){return n(g,{isOpen:e,onClose:r,children:[t(y,{children:`Sign In`}),n(_,{className:`flex flex-col gap-2`,children:[t(Z,{provider:`google`}),t(Z,{provider:`github`}),t(Z,{provider:`microsoft`})]}),t(v,{align:`right`,children:t(d,{variant:`ghost`,onClick:r,children:`Cancel`})})]})}function $({title:e,value:r}){function i(e){navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}let[a,o]=l(!1);return n(`div`,{className:`w-full flex justify-between items-center mb-1`,children:[n(`div`,{className:`flex flex-col w-[calc(100%-3rem)]`,children:[t(`div`,{className:`text-sm px-2 dark:text-slate-200`,children:e}),t(te,{description:r,size:`xs`,placement:`left`,children:n(`div`,{className:`text-xs truncate text-muted w-full text-start px-2`,children:[r,` `]})})]}),a?t(he,{className:`size-4 cursor-pointer text-success`}):t(ge,{className:`size-4 cursor-pointer text-gray-400 dark:text-slate-400`,onClick:()=>i(r)})]})}function Xt(){let{t:e}=L(),{account:r,project:i,client:a,authToken:o}=I(),s=a.baseUrl,c=a.store.baseUrl,l=c.replace(/\/+$/,``)!==s.replace(/\/+$/,``),u=R.endpoints.mcp??e(`user.unknown`),d=i?Ae(i):``;return t(`div`,{className:`w-full`,children:n(D,{defaultValue:`user`,tabs:[{name:`user`,label:e(`user.user`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.organizationId`),value:r?.id??e(`user.unknown`)}),t($,{title:e(`user.projectId`),value:i?.id??e(`user.unknown`)}),t($,{title:e(`user.userId`),value:o?.sub??e(`user.unknown`)}),t($,{title:e(`user.organizationRoles`),value:o?.account_roles?.join(`,`)??e(`user.unknown`)}),t($,{title:e(`user.projectRoles`),value:o?.project_roles?.join(`,`)??e(`user.unknown`)})]})},{name:`environment`,label:e(`user.environment`),content:n(`div`,{className:`space-y-1 p-2`,children:[t($,{title:e(`user.tenantId`),value:d}),t($,{title:e(`user.environment`),value:R.type}),t($,{title:e(`user.server`),value:s}),l&&t($,{title:e(`user.store`),value:c}),t($,{title:e(`user.mcpServer`),value:u}),t($,{title:e(`user.appVersion`),value:R.version}),t($,{title:e(`user.sdkVersion`),value:R.sdkVersion||e(`user.unknown`)})]})}],fullWidth:!0,updateHash:!1,children:[t(O,{}),t(k,{})]})})}function Zt(r){let{user:i,isLoading:a}=I(),[o,s]=l(!1);return a?t(E,{}):i?t(`div`,{className:`px-3`,children:t(Qt,{asMenuTrigger:!0})}):n(e,{children:[t(d,{onClick:()=>s(!0),children:`Sign In`}),t(Yt,{isOpen:o,onClose:()=>s(!1)})]})}function Qt({className:e,asMenuTrigger:r=!1}){let i=I(),a=Oe(),o=Ne(),{user:s}=i;if(!i||!s)return null;let c=o.hasPermission(ke.project_admin);return n(x,{click:!0,children:[t(C,{children:t(`div`,{className:Pe(e,`flex items-center justify-start`,r&&`cursor-pointer`),children:t(u,{size:`sm`,color:`bg-amber-500`,shape:`circle`,name:s?.name})})}),t(S,{align:`start`,className:`w-[280px] mx-2 my-1 p-0`,children:n(`div`,{className:`divide-y divide-gray-200 dark:divide-slate-700`,children:[n(`div`,{className:`py-2 ps-2`,children:[t(`p`,{className:`px-4 dark:text-white mb-1`,children:s?.name??`Unknown`}),t(`p`,{className:`px-4 text-xs text-gray-500`,children:s?.email??``})]}),t(`div`,{className:`w-full p-1`,children:t(Xt,{})}),t(`div`,{className:`py-2 ps-2`,children:t(b,{})}),t(`div`,{className:`py-2`,children:n(h,{children:[c&&t(h.Item,{className:`px-2`,onClick:()=>a(`/settings`,{replace:!0}),children:`Settings`}),t(h.Item,{className:`px-2`,onClick:()=>i.logout(),children:`Sign out`})]})})]})})]})}function $t(e){return e?e.endsWith(`@vertesiahq.com`)||e.endsWith(`@becomposable.com`)||e.endsWith(`@composableprompts.com`):!1}function en({icon:e}){let{isLoading:n}=I(),[r,i]=l(!0);return o(()=>{n||i(!1)},[n]),t(Fe,{children:r&&t(Ie.div,{style:{zIndex:999999,position:`fixed`,inset:0},className:`fixed inset-x-0 inset-y-0`,initial:{opacity:1},exit:{opacity:0},transition:{ease:`easeIn`,duration:.5},children:t(`div`,{style:{display:`flex`,width:`100%`,height:`100%`,alignItems:`center`,justifyContent:`center`},className:`flex w-full h-full items-center justify-center`,children:t(`div`,{className:`animate-[spin_4s_linear_infinite]`,children:t(`div`,{className:`animate-pulse rounded-full bg-transparent`,children:e||t(tn,{})})})})})})}function tn(){return n(`svg`,{width:`32`,height:`32`,className:`w-8 h-8 text-indigo-600`,viewBox:`0 0 50 50`,xmlns:`http://www.w3.org/2000/svg`,role:`img`,"aria-label":`Loading`,children:[t(`title`,{children:`Loading`}),t(`defs`,{children:n(`linearGradient`,{id:`spinner-gradient`,x1:`1`,y1:`0`,x2:`0`,y2:`1`,children:[t(`stop`,{offset:`0%`,stopColor:`currentColor`,stopOpacity:`1`}),t(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0`})]})}),t(`circle`,{cx:`25`,cy:`25`,r:`20`,stroke:`url(#spinner-gradient)`,strokeWidth:`5`,fill:`none`,strokeLinecap:`round`})]})}function nn({children:r,lightLogo:i,darkLogo:a,loadingIcon:o,loadOnboardingStatus:s,preserveSignInPath:c,suppressSignInErrorPrefixes:l,authToken:u,defaultLanguage:d}){let f=t(je,{children:t(A,{defaultTheme:`system`,storageKey:`vite-ui-theme`,children:t(pe,{defaultLanguage:d,children:n(fe,{children:[!u&&n(e,{children:[t(en,{icon:o}),t(Lt,{allowedPrefix:`/shared/`,darkLogo:a,lightLogo:i,preservePath:c,suppressAuthErrorPrefix:l})]}),t(Me,{children:r})]})})})});return t(ee,{children:u?t(re,{token:u,children:f}):t(oe,{loadOnboardingStatus:s,children:f})})}export{z as AppInstallationContext,Le as AppInstallationProvider,ze as AppProjectSelector,Ge as InviteAcceptModal,Lt as SigninScreen,Ve as StandaloneApp,He as StandaloneAppImpl,Ut as TerminalLogin,Zt as UserSessionMenu,nn as VertesiaShell,$t as isVertesiaEmail,Re as useAppInstallation};
|
|
2
|
+
//# sourceMappingURL=vertesia-ui-shell.js.map
|