@vertesia/ui 0.70.0 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/lib/esm/core/components/shadcn/index.js +2 -2
  2. package/lib/esm/core/components/shadcn/index.js.map +1 -1
  3. package/lib/esm/core/components/shadcn/tabs.js +13 -8
  4. package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
  5. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js +1 -0
  6. package/lib/esm/core/components/shadcn/theme/ThemeProvider.js.map +1 -1
  7. package/lib/esm/features/permissions/UserPermissionsProvider.js +1 -0
  8. package/lib/esm/features/permissions/UserPermissionsProvider.js.map +1 -1
  9. package/lib/esm/session/auth/useCurrentTenant.js +63 -0
  10. package/lib/esm/session/auth/useCurrentTenant.js.map +1 -0
  11. package/lib/esm/session/index.js +1 -0
  12. package/lib/esm/session/index.js.map +1 -1
  13. package/lib/esm/shell/SplashScreen.js +10 -3
  14. package/lib/esm/shell/SplashScreen.js.map +1 -1
  15. package/lib/esm/shell/VertesiaShell.js +2 -2
  16. package/lib/esm/shell/VertesiaShell.js.map +1 -1
  17. package/lib/esm/shell/apps/CheckAppAccess.js +23 -0
  18. package/lib/esm/shell/apps/CheckAppAccess.js.map +1 -0
  19. package/lib/esm/shell/apps/index.js +2 -0
  20. package/lib/esm/shell/apps/index.js.map +1 -0
  21. package/lib/esm/shell/index.js +1 -0
  22. package/lib/esm/shell/index.js.map +1 -1
  23. package/lib/esm/shell/login/InviteAcceptModal.js +29 -12
  24. package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -1
  25. package/lib/tsconfig.tsbuildinfo +1 -1
  26. package/lib/types/core/components/shadcn/index.d.ts +2 -2
  27. package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
  28. package/lib/types/core/components/shadcn/tabs.d.ts +4 -1
  29. package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
  30. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts +2 -1
  31. package/lib/types/core/components/shadcn/theme/ThemeProvider.d.ts.map +1 -1
  32. package/lib/types/features/permissions/UserPermissionsProvider.d.ts +2 -1
  33. package/lib/types/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
  34. package/lib/types/session/auth/useCurrentTenant.d.ts +15 -0
  35. package/lib/types/session/auth/useCurrentTenant.d.ts.map +1 -0
  36. package/lib/types/session/index.d.ts +1 -0
  37. package/lib/types/session/index.d.ts.map +1 -1
  38. package/lib/types/shell/SplashScreen.d.ts +3 -1
  39. package/lib/types/shell/SplashScreen.d.ts.map +1 -1
  40. package/lib/types/shell/VertesiaShell.d.ts +3 -1
  41. package/lib/types/shell/VertesiaShell.d.ts.map +1 -1
  42. package/lib/types/shell/apps/CheckAppAccess.d.ts +6 -0
  43. package/lib/types/shell/apps/CheckAppAccess.d.ts.map +1 -0
  44. package/lib/types/shell/apps/index.d.ts +2 -0
  45. package/lib/types/shell/apps/index.d.ts.map +1 -0
  46. package/lib/types/shell/index.d.ts +1 -0
  47. package/lib/types/shell/index.d.ts.map +1 -1
  48. package/lib/types/shell/login/InviteAcceptModal.d.ts.map +1 -1
  49. package/lib/vertesia-ui-core.js +1 -1
  50. package/lib/vertesia-ui-core.js.map +1 -1
  51. package/lib/vertesia-ui-features.js +1 -1
  52. package/lib/vertesia-ui-features.js.map +1 -1
  53. package/lib/vertesia-ui-session.js +1 -1
  54. package/lib/vertesia-ui-session.js.map +1 -1
  55. package/lib/vertesia-ui-shell.js +1 -1
  56. package/lib/vertesia-ui-shell.js.map +1 -1
  57. package/package.json +4 -4
  58. package/src/core/components/shadcn/index.ts +2 -2
  59. package/src/core/components/shadcn/tabs.tsx +31 -14
  60. package/src/core/components/shadcn/theme/ThemeProvider.tsx +2 -0
  61. package/src/features/permissions/UserPermissionsProvider.tsx +1 -0
  62. package/src/session/auth/useCurrentTenant.ts +73 -0
  63. package/src/session/index.ts +1 -0
  64. package/src/shell/SplashScreen.tsx +36 -3
  65. package/src/shell/VertesiaShell.tsx +4 -2
  66. package/src/shell/apps/CheckAppAccess.tsx +25 -0
  67. package/src/shell/apps/index.ts +1 -0
  68. package/src/shell/index.tsx +1 -0
  69. package/src/shell/login/InviteAcceptModal.tsx +36 -20
@@ -1 +1 @@
1
- {"version":3,"file":"vertesia-ui-shell.js","sources":["esm/shell/login/InviteAcceptModal.js","esm/shell/login/EnterpriseSigninButton.js","esm/shell/login/GitHubSignInButton.js","esm/shell/login/GoogleSignInButton.js","esm/shell/login/MicrosoftSigninButton.js","esm/shell/login/SignupForm.js","esm/shell/login/SigninScreen.js","esm/shell/login/TerminalLogin.js","esm/shell/login/SignInModal.js","esm/shell/login/UserInfo.js","esm/shell/login/UserSessionMenu.js","esm/shell/utils.js","esm/shell/SplashScreen.js","esm/shell/VertesiaShell.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, Modal, ModalBody, ModalTitle } from \"@vertesia/ui/core\";\nimport { useEffect, useState } from \"react\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nexport function InviteAcceptModal() {\n const session = useUserSession();\n const { client, account } = session;\n const [showModal, setShowModal] = useState(false);\n const [invites, setInvites] = useState([]);\n useEffect(() => {\n client.account.listInvites().then(invites => {\n if (invites.length > 0) {\n console.log(\"Got invites - showing modal\");\n setInvites(invites);\n /*toast({\n status: 'info',\n title: 'You have pending invites',\n description: 'Click the button on the top right to review them.'\n })*/\n setShowModal(true);\n }\n });\n }, [account?.id]);\n const closeModal = () => setShowModal(false);\n const accept = async (invite) => {\n await client.account.acceptInvite(invite.id);\n await session.fetchAccounts();\n const remainingInvites = invites.filter(i => i.id !== invite.id);\n setInvites(remainingInvites);\n if (remainingInvites.length === 0) {\n closeModal();\n }\n };\n const reject = async (invite) => {\n await client.account.rejectInvite(invite.id);\n const remainingInvites = invites.filter(i => i.id !== invite.id);\n setInvites(remainingInvites);\n if (remainingInvites.length === 0) {\n closeModal();\n }\n };\n const inviteList = invites.map(invite => (_jsxs(\"div\", { className: \"flex flex-row w-full justify-between border rounded-sm px-2 py-2 \", children: [_jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(\"div\", { className: \"w-full font-semibold\", children: invite.data.account.name }), _jsxs(\"div\", { className: \"text-xs\", children: [\"Role: \", invite.data.role] }), _jsxs(\"div\", { className: \"text-xs\", children: [\"by \", invite.data.invitedBy.name] })] }), _jsxs(\"div\", { className: \"flex flex-col gap-4\", children: [_jsx(Button, { size: 'xs', onClick: () => accept(invite), children: \"Accept\" }), \" \", _jsx(Button, { size: 'xs', variant: \"secondary\", onClick: () => reject(invite), children: \"Reject\" })] })] }, invite.id)));\n return (_jsx(\"div\", { children: _jsxs(Modal, { isOpen: showModal, onClose: closeModal, children: [_jsx(ModalTitle, { children: \"Review Invites\" }), _jsxs(ModalBody, { children: [_jsx(\"div\", { className: \"text-sm pb-4\", children: \"You have received the following invites to join other accounts. Please review and accept or declined them.\" }), inviteList] })] }) }));\n}\n//# sourceMappingURL=InviteAcceptModal.js.map","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, Input, Spinner, useToast } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { getFirebaseAuth, setFirebaseTenant, useUXTracking } from \"@vertesia/ui/session\";\nimport { GoogleAuthProvider, OAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { useState } from \"react\";\nfunction getProvider(redirectTo) {\n const providerType = Env.firebase.providerType;\n switch (providerType) {\n case \"oidc\":\n return new OAuthProvider(\"oidc.main\");\n case \"google\": {\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new GoogleAuthProvider();\n provider.addScope('profile');\n provider.addScope('email');\n provider.setCustomParameters({\n prompt: 'select_account',\n redirect_uri: window.location.origin + redirectPath\n });\n return provider;\n }\n case \"microsoft\":\n return new OAuthProvider(\"microsoft.com\");\n case \"github\":\n return new OAuthProvider(\"github.com\");\n default:\n return new OAuthProvider(\"oidc.main\");\n }\n}\nexport default function EnterpriseSigninButton({ redirectTo }) {\n const [isLoading, setIsLoading] = useState(false);\n const { trackEvent } = useUXTracking();\n const [email, setEmail] = useState(\"\");\n const toast = useToast();\n const signIn = async () => {\n if (!email)\n return;\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(email)) {\n toast({\n title: \"Invalid email address\",\n status: \"error\",\n duration: 5000,\n });\n return;\n }\n // Env.firebase.tenantEmail = email;\n setIsLoading(true);\n setFirebaseTenant(email).then((data) => {\n if (!data) {\n toast({\n title: \"Tenant not found\",\n status: \"error\",\n duration: 5000,\n });\n setIsLoading(false);\n return;\n }\n localStorage.setItem(\"tenantName\", data.name ?? \"\");\n const provider = getProvider(redirectTo);\n trackEvent(\"enterprise_signin\", {\n firebaseTenantName: data.name,\n });\n Env.logger.info('Enterprise single sign-in', {\n vertesia: {\n email: email,\n firebaseTenantName: data.name,\n firebaseTenantId: data.firebaseTenantId,\n },\n });\n signInWithRedirect(getFirebaseAuth(), provider);\n setIsLoading(false);\n });\n };\n return (_jsxs(_Fragment, { children: [_jsx(Input, { value: email, onChange: setEmail, placeholder: \"Enter your enterprise email\", type: \"email\" }), isLoading ? (_jsx(\"div\", { className: \"w-full flex justify-center\", children: _jsx(Spinner, {}) })) : (_jsx(Button, { variant: \"outline\", onClick: signIn, className: \"w-full mt-2 py-4 flex rounded-lg hover:shadow-sm transition duration-150 text-center\", children: _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Enterprise SSO\" }) }))] }));\n}\n//# sourceMappingURL=EnterpriseSigninButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { GithubAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function GitHubSignInButton({}) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n //with github can only have one allowed redirect\n const baseUrl = \"https://dengenlabs.firebaseapp.com/__/auth/handler\";\n let redirectPath = baseUrl + window.location.pathname;\n if (redirectPath[0] !== \"/\") {\n redirectPath = \"/\" + redirectPath;\n }\n const provider = new GithubAuthProvider();\n provider.addScope(\"profile\");\n provider.addScope(\"email\");\n /*provider.setCustomParameters({\n redirect_uri: redirectPath,\n });*/\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center mb-2\", children: [_jsx(\"img\", { className: \"size-6 bg-white rounded-full\", src: \"https://www.svgrepo.com/show/503359/github.svg\", loading: \"lazy\", alt: \"github logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with GitHub\" })] }));\n}\n//# sourceMappingURL=GitHubSignInButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { GoogleAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function GoogleSignInButton({ redirectTo }) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new GoogleAuthProvider();\n provider.addScope('profile');\n provider.addScope('email');\n // always ask to select the google account\n //console.log('redirectPath', window.location.origin + redirectPath)\n provider.setCustomParameters({\n prompt: 'select_account',\n redirect_uri: window.location.origin + redirectPath\n });\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center mb-2\", children: [_jsx(\"img\", { className: \"size-6\", src: \"https://www.svgrepo.com/show/475656/google-color.svg\", loading: \"lazy\", alt: \"google logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Google\" })] }));\n}\n//# sourceMappingURL=GoogleSignInButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { OAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function MicrosoftSignInButton({ redirectTo }) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new OAuthProvider('microsoft.com');\n provider.addScope('profile');\n provider.addScope('email');\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center\", children: [_jsx(\"img\", { className: \"size-6\", src: \"https://learn.microsoft.com/en-us/entra/identity-platform/media/howto-add-branding-in-apps/ms-symbollockup_mssymbol_19.svg\", loading: \"lazy\", alt: \"microsoft logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Microsoft\" })] }));\n}\n//# sourceMappingURL=MicrosoftSigninButton.js.map","import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Button, Input, VSelectBox, SelectStack } from \"@vertesia/ui/core\";\nimport { getAuth } from \"firebase/auth\";\nimport { useEffect, useState } from \"react\";\nconst companySizeOptions = [\n { id: 1, label: \"1-10 employees\" },\n { id: 11, label: \"11-100 employees\" },\n { id: 101, label: \"101-1000 employees\" },\n { id: 1001, label: \"1001-5000 employees\" },\n { id: 5001, label: \"5000+ employees\" },\n];\nconst accountTypeOptions = [\n {\n id: \"personal\",\n label: \"Personal\",\n description: \"For personal use, or for a small team.\",\n },\n {\n id: \"company\",\n label: \"Company\",\n description: \"For a company or organization.\",\n },\n];\nconst projectMaturityOptions = [\n { id: \"testing\", label: \"Just Testing or Evaluating LLMs\" },\n { id: \"exploring\", label: \"Actively Exploring LLMs on a Project\" },\n { id: \"using\", label: \"Already Using LLMs in Production\" },\n { id: \"migrating\", label: \"Migrating to different LLMs\" },\n { id: \"other\", label: \"Other\" },\n];\nexport default function SignupForm({ onSignup, goBack }) {\n const [accountType, setAccountType] = useState(undefined);\n const [companySize, setCompanySize] = useState(undefined);\n const [companyName, setCompanyName] = useState(undefined);\n const [companyWebsite, setCompanyWebsite] = useState(undefined);\n const [projectMaturity, setProjectMaturity] = useState(undefined);\n const [fbUser, setFbUser] = useState(undefined);\n const [error, setError] = useState(undefined);\n const isCompany = accountType === \"company\";\n useEffect(() => {\n const user = getAuth().currentUser;\n if (!user) {\n console.error('No user found');\n return;\n }\n setFbUser(user);\n }, [fbUser]);\n const isValid = () => {\n if (!accountType) {\n setError(\"Please select an account type\");\n return false;\n }\n if (isCompany && !companyName) {\n setError(\"Please enter an organization name\");\n return false;\n }\n if (isCompany && !companySize) {\n setError(\"Please select a company size\");\n return false;\n }\n return true;\n };\n const onSubmit = async () => {\n if (!isValid())\n return;\n if (!accountType)\n return;\n const signupData = {\n accountType: accountType,\n companyName: companyName,\n companySize: companySize?.id,\n companyWebsite: companyWebsite,\n maturity: projectMaturity,\n };\n window.localStorage.setItem(\"composableSignupData\", JSON.stringify(signupData));\n const fbToken = await getAuth().currentUser?.getIdToken();\n console.log('Got firebase token', getAuth(), fbToken);\n if (!fbToken) {\n console.error('No firebase token found');\n return;\n }\n onSignup(signupData, fbToken);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col space-y-2\", children: [_jsxs(\"div\", { className: \"prose\", children: [_jsxs(\"p\", { className: \"prose text-sm text-muted pt-4\", children: [\"Welcome to Vertesia, \", fbUser?.displayName, \" (\", fbUser?.email, \"). Please tell us a little bit about yourself and you'll be on your way. No credit card is required.\"] }), error &&\n _jsx(\"div\", { className: \"text-destructive\", children: error })] }), _jsx(FormItem, { label: \"Account Type\", children: _jsx(SelectStack, { options: accountTypeOptions, selected: accountTypeOptions.find((option) => option.id === accountType), onSelect: (option) => setAccountType(option.id) }) }), isCompany &&\n _jsxs(_Fragment, { children: [_jsx(FormItem, { label: \"Company Size\", children: _jsx(VSelectBox, { className: \"w-full border border-accent bg-muted\", value: companySize, options: companySizeOptions, onChange: setCompanySize, optionLabel: (option) => option?.label, placeholder: 'Select Company Size' }) }), _jsx(FormItem, { label: \"Company Name\", children: _jsx(Input, { value: companyName, onChange: setCompanyName, type: \"text\", required: true }) }), _jsx(FormItem, { label: \"Company Website\", children: _jsx(Input, { value: companyWebsite, onChange: setCompanyWebsite, type: \"text\" }) })] }), _jsx(FormItem, { label: \"Project Maturity\", children: _jsx(VSelectBox, { className: \"w-full border border-accent bg-muted\", options: projectMaturityOptions, value: projectMaturityOptions.find((option) => option.id === projectMaturity), optionLabel: (option) => option?.label, placeholder: 'Select Project Maturity', onChange: (option) => setProjectMaturity(option?.id) }) }), _jsxs(\"div\", { className: \"pt-8 flex flex-col\", children: [_jsx(Button, { variant: \"primary\", onClick: onSubmit, size: \"xl\", children: _jsx(\"span\", { className: \"text-lg\", children: \"Sign Up\" }) }), _jsx(Button, { variant: \"ghost\", size: \"xl\", className: \"mt-4\", onClick: goBack, children: _jsx(\"span\", { className: \"\", children: \"Wrong account, go back\" }) })] })] }));\n}\nfunction FormItem({ label, children }) {\n return (_jsxs(\"div\", { className: \"flex flex-col space-y-2 pt-4\", children: [_jsx(\"div\", { className: \"text-sm text-muted\", children: label }), children] }));\n}\n//# sourceMappingURL=SignupForm.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Button, useSafeLayoutEffect } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { UserNotFoundError, useUserSession, useUXTracking } from \"@vertesia/ui/session\";\nimport clsx from \"clsx\";\nimport { useEffect, useState } from \"react\";\nimport EnterpriseSigninButton from \"./EnterpriseSigninButton\";\nimport GitHubSignInButton from \"./GitHubSignInButton\";\nimport GoogleSignInButton from \"./GoogleSignInButton\";\nimport MicrosoftSignInButton from \"./MicrosoftSigninButton\";\nimport SignupForm from \"./SignupForm\";\nexport function SigninScreen({ allowedPrefix, isNested = false, lightLogo, darkLogo }) {\n const [allow, setAllow] = useState(false);\n useSafeLayoutEffect(() => {\n allowedPrefix && setAllow(window.location.href.startsWith(allowedPrefix));\n }, []);\n return allow ? null : _jsx(SigninScreenImpl, { isNested: isNested, lightLogo: lightLogo, darkLogo: darkLogo });\n}\nfunction SigninScreenImpl({ isNested = false, lightLogo, darkLogo }) {\n const { isLoading, user, authError } = useUserSession();\n return !isLoading && !user ? (_jsx(\"div\", { style: { zIndex: 999998 }, className: (isNested ? \"absolute\" : \"fixed\") + \"overflow-y-auto \", children: _jsxs(\"div\", { className: clsx(\"flex flex-col items-center justify-center py-14 px-4\"), children: [_jsx(StandardSigninPanel, { authError: authError, lightLogo: lightLogo, darkLogo: darkLogo }), _jsxs(\"div\", { className: \"flex gap-x-6 mt-10 justify-center text-muted\", children: [_jsx(\"a\", { href: \"https://vertesiahq.com/privacy\", className: \"text-sm\", children: \"Privacy Policy\" }), _jsx(\"a\", { href: \"https://vertesiahq.com/terms\", className: \"text-sm\", children: \"Terms of Service\" })] })] }) })) : null;\n}\nfunction StandardSigninPanel({ authError, darkLogo, lightLogo }) {\n const [signupData, setSignupData] = useState(undefined);\n const [collectSignupData, setCollectSignupData] = useState(false);\n const { signOut } = useUserSession();\n const { trackEvent } = useUXTracking();\n history.replaceState({}, '', '/');\n const goBack = () => {\n console.log(\"Going back, signing out\");\n setSignupData(undefined);\n setCollectSignupData(false);\n signOut();\n };\n const goToSignup = () => {\n setSignupData(undefined);\n setCollectSignupData(true);\n };\n useEffect(() => {\n if (authError instanceof UserNotFoundError) {\n console.log(\"User not found, redirecting to signup\");\n goToSignup();\n }\n }, [authError]);\n const onSignup = (data, fbToken) => {\n console.log(\"Got Signup data\", data);\n setSignupData(data);\n const payload = {\n signupData: data,\n firebaseToken: fbToken,\n };\n fetch(Env.endpoints.studio + \"/auth/signup\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }).then((res) => {\n console.log(\"Signup successful\", payload, res);\n trackEvent(\"sign_up\");\n window.location.href = \"/\";\n });\n };\n return (_jsxs(_Fragment, { children: [lightLogo && _jsx(\"img\", { src: lightLogo, alt: 'logo', className: 'h-15 block dark:hidden' }), darkLogo && _jsx(\"img\", { src: darkLogo, alt: 'logo', className: 'h-15 hidden dark:block' }), signupData && (_jsxs(\"div\", { className: \"my-6\", children: [\"Need to make a change?\", \" \", _jsx(Button, { onClick: goToSignup, children: \" Go back\" })] })), _jsx(\"div\", { className: \"flex flex-col space-y-2\", children: collectSignupData && !localStorage.getItem('tenantName') ? (_jsx(SignupForm, { onSignup: onSignup, goBack: goBack })) : (_jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(\"div\", { className: \"my-4\", children: _jsx(\"h2\", { className: \"text-2xl font-bold text-center\", children: \"Log in or Sign up\" }) }), _jsxs(\"div\", { className: \"max-w-2xl text-center my-2 px-2\", children: [\"First time here? No problem, it's free to try!\", _jsx(\"br\", {}), \"We'll just ask you a couple of questions next and you'll be on your way.\"] }), _jsxs(\"div\", { className: \"flex items-center flex-col\", children: [_jsxs(\"div\", { className: \"py-4 w-70\", children: [_jsx(GoogleSignInButton, {}), _jsx(GitHubSignInButton, {}), _jsx(MicrosoftSignInButton, {})] }), _jsxs(\"div\", { className: \"flex items-center flex-row w-70 text-muted\", children: [_jsx(\"hr\", { className: \"w-full\" }), _jsx(\"div\", { className: \"px-2 text-xs\", children: \"OR\" }), _jsx(\"hr\", { className: \"w-full\" })] }), _jsx(\"div\", { className: \"py-4 w-70\", children: _jsx(EnterpriseSigninButton, {}) })] }), authError && (_jsx(\"div\", { className: \"text-center\", children: _jsxs(\"div\", { className: \"\", children: [\"Sorry, we have not been able to sign you in.\", _jsx(\"br\", {}), \"Please try again or contact\", _jsx(\"a\", { className: 'text-info mx-1', href: \"mailto:support@vertesiahq.com\", children: \"support@vertesiahq.com\" }), \"if it persists.\", _jsxs(\"pre\", { className: \"mt-2\", children: [\"Error: \", authError.message] })] }) }))] })) })] }));\n}\n//# sourceMappingURL=SigninScreen.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { Button, Center, ErrorBox, Input, SelectBox, Spinner, useFetch, useToast } from '@vertesia/ui/core';\nimport { Env } from \"@vertesia/ui/env\";\nimport { useLocation } from \"@vertesia/ui/router\";\nimport { fetchComposableTokenFromFirebaseToken, useUserSession } from '@vertesia/ui/session';\nfunction getClientInfo(location) {\n const params = new URLSearchParams(location.search);\n let redirect = params.get('redirect_uri');\n const code = params.get('code');\n if (!redirect || !code) {\n return null;\n }\n redirect = decodeURI(redirect);\n if (!redirect.startsWith('http://127.0.0.1:') && !redirect.startsWith('http://localhost:')) {\n return null;\n }\n const profile = params.get('profile') ?? \"default\";\n const project = params.get('project') ?? undefined;\n const account = params.get('account') ?? undefined;\n return { redirect, code, profile, project, account };\n}\nexport function TerminalLogin() {\n const [payload, setPayload] = useState();\n const [error, setError] = useState();\n const location = useLocation();\n const clientInfo = getClientInfo(location);\n const toast = useToast();\n const onAccept = async (data) => {\n if (!clientInfo)\n return;\n if (!data.profile) {\n toast({\n title: 'Profile is required',\n description: 'Please enter a profile name to save the client authorization',\n status: 'error',\n duration: 2000\n });\n return;\n }\n if (!data.account) {\n toast({\n title: 'Account is required',\n description: 'Please select an account to authorize the client to access the ComposablePrompts servers',\n status: 'error',\n duration: 2000\n });\n return;\n }\n if (!data.project) {\n toast({\n title: 'Project is required',\n description: 'Please select a project to authorize the client to access the ComposablePrompts servers',\n status: 'error',\n duration: 2000\n });\n return;\n }\n // expire in 1 day\n let payload;\n try {\n const token = await fetchComposableTokenFromFirebaseToken(data.account, data.project, 24 * 3600);\n if (token) {\n payload = {\n ...data,\n studio_server_url: Env.endpoints.studio,\n zeno_server_url: Env.endpoints.zeno,\n token,\n };\n await fetch(clientInfo.redirect, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload)\n });\n setPayload(payload);\n }\n else {\n toast({\n title: 'Failed to get composable token',\n status: 'error',\n duration: 5000\n });\n }\n }\n catch (err) {\n if (payload) {\n setError(err);\n setPayload(payload);\n }\n else {\n toast({\n title: 'Error authorizing client',\n description: err.message,\n status: 'error',\n duration: 5000\n });\n }\n }\n };\n const getPageContent = () => {\n if (!clientInfo) {\n return _jsx(ErrorBox, { title: 'Invalid request', children: \"This page should be called by a terminal client to authenticate against the ComposablePrompts servers\" });\n }\n return payload\n ? _jsx(AuthDoneScreen, { payload: payload, error: error })\n : _jsx(AuthAcceptScreen, { clientInfo: clientInfo, onAccept: onAccept });\n };\n const page = getPageContent();\n return (_jsx(\"div\", { className: \"w-full flex flex-col items-center gap-4 mt-24\", children: page }));\n}\nfunction AuthAcceptScreen({ onAccept, clientInfo }) {\n const { client, user } = useUserSession();\n const { data: allProjects, error } = useFetch(() => user ? client.projects.list() : Promise.resolve([]), [user]);\n if (error) {\n return _jsx(ErrorBox, { title: 'Error loading projects', children: error.message });\n }\n const getEnvironmentName = () => {\n if (Env.isLocalDev) {\n return \"Local Dev\";\n }\n else if (Env.isDev) {\n return \"Staging\";\n }\n return \"Production\";\n };\n const envName = getEnvironmentName();\n return user && allProjects ? (_jsxs(_Fragment, { children: [_jsxs(\"div\", { className: 'w-1/3', children: [_jsxs(\"div\", { className: \"mb-4 text-xl font-semibold text-gray-800\", children: [\"Authorizing client on \", envName, \" environment.\"] }), _jsxs(\"div\", { className: 'mb-2 text-md text-gray-800', children: [_jsx(\"div\", { children: \"A client app wants authorization to access the composable prompt servers in your name.\" }), _jsxs(\"div\", { children: [\"The client app code is \", _jsx(\"b\", { children: clientInfo.code }), \". You can check if the code is correct in the terminal.\"] })] }), _jsxs(\"div\", { className: 'mb-2 text-sm text-gray-600', children: [_jsx(\"div\", { children: \"You must choose the target account and project for the client to access.\" }), _jsx(\"div\", { children: \"Also, enter a profile name that will be used to save the authorization in your client configuration.\" })] })] }), _jsx(ProfileForm, { onAccept: onAccept, allProjects: allProjects, data: clientInfo })] })) : _jsx(Spinner, { size: 'lg' });\n}\nfunction AuthDoneScreen({ payload, error }) {\n const toast = useToast();\n const onCopy = () => {\n if (payload) {\n navigator.clipboard.writeText(JSON.stringify(payload));\n toast({\n title: 'Authentication Payload copied',\n description: error ? 'You can paste the authentication payload in the terminal to authenticate the client.' : 'You can close the page now.',\n status: 'success',\n duration: 5000\n });\n }\n };\n return (_jsxs(\"div\", { children: [error ?\n _jsxs(\"div\", { children: [_jsxs(ErrorBox, { title: 'Failed to send the authorization token to the cli tool', children: [\"This can happen due to security checks on Safari. The error is \\\"\", error.message, \"\\\"\"] }), _jsx(\"div\", { children: \"Don't worry, you can still authenticate the cli tool by pasting the authentication token in the terminal. You can close this page.\" })] })\n : _jsx(\"div\", { children: \"The client is authenticated. You can close this page.\" }), _jsx(Center, { className: \"mt-4\", children: _jsx(Button, { variant: 'secondary', onClick: onCopy, children: \"Copy the Authentication Payload\" }) })] }));\n}\nfunction ProfileForm({ allProjects, data, onAccept }) {\n const { accounts, account, project } = useUserSession();\n const [currentData, setCurrentData] = useState(() => ({\n profile: data.profile,\n account: data.account ?? account?.id,\n project: data.project ?? project?.id,\n }));\n const onChangeProfile = (value) => {\n setCurrentData({ ...currentData, profile: value });\n };\n const onChangeAccount = (value) => {\n setCurrentData({ ...currentData, account: value.id, project: undefined });\n };\n const onChangeProject = (value) => {\n setCurrentData({ ...currentData, project: value.id });\n };\n const projects = allProjects.filter(p => p.account === currentData.account);\n return (_jsxs(\"div\", { className: 'w-1/3', children: [_jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Profile Name\" }), _jsx(Input, { type: 'text', value: currentData.profile, onChange: onChangeProfile })] }), _jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Account\" }), _jsx(SelectAccount, { value: currentData.account, onChange: onChangeAccount, accounts: accounts || [] })] }), _jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Project\" }), _jsx(SelectProject, { value: currentData.project, onChange: onChangeProject, projects: projects })] }), _jsx(\"div\", { className: \"pt-2\", children: _jsx(Button, { size: 'xl', onClick: () => onAccept(currentData), children: \"Authorize Client\" }) })] }));\n}\nfunction SelectAccount({ value, accounts, onChange }) {\n const _onChange = (value) => {\n onChange(value);\n };\n return _jsx(SelectBox, { options: accounts, value: accounts?.find(a => a.id === value), onChange: _onChange, by: \"id\", optionLabel: (option) => option.name, placeholder: 'Select Account' });\n}\nfunction SelectProject({ value, projects, onChange }) {\n const _onChange = (value) => {\n onChange(value);\n };\n return (_jsx(SelectBox, { by: \"id\", value: projects.find(p => p.id === value), options: projects, optionLabel: (option) => option.name, placeholder: 'Select Project', onChange: _onChange }));\n}\n//# sourceMappingURL=TerminalLogin.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, Modal, ModalBody, ModalFooter, ModalTitle } from \"@vertesia/ui/core\";\nimport GitHubSignInButton from \"./GitHubSignInButton\";\nimport GoogleSignInButton from \"./GoogleSignInButton\";\nimport MicrosoftSignInButton from \"./MicrosoftSigninButton\";\nexport default function SignInModal({ isOpen, onClose }) {\n return (_jsxs(Modal, { isOpen: isOpen, onClose: onClose, children: [_jsx(ModalTitle, { children: \"Sign In\" }), _jsxs(ModalBody, { className: \"flex justify-center\", children: [_jsx(GoogleSignInButton, {}), _jsx(GitHubSignInButton, {}), _jsx(MicrosoftSignInButton, {})] }), _jsx(ModalFooter, { justify: \"end\", children: _jsx(Button, { variant: \"ghost\", onClick: onClose, children: \"Cancel\" }) })] }));\n}\n//# sourceMappingURL=SignInModal.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { getTenantIdFromProject } from \"@vertesia/common\";\nimport { VTabs, VTabsBar, VTabsPanel, VTooltip } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nimport { Check, CopyIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nexport function InfoItems({ title, value }) {\n function copyToClipboard(value) {\n navigator.clipboard.writeText(value);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n const [isCopied, setIsCopied] = useState(false);\n return (_jsxs(\"div\", { className: \"w-full flex justify-between items-center mb-1\", children: [_jsxs(\"div\", { className: \"flex flex-col w-[calc(100%-3rem)]\", children: [_jsx(\"div\", { className: 'text-sm px-2 dark:text-slate-200', children: title }), _jsx(VTooltip, { description: value, size: \"xs\", placement: \"left\", children: _jsxs(\"div\", { className: 'text-xs truncate text-muted w-full text-left px-2', children: [value, \" \"] }) })] }), isCopied ?\n _jsx(Check, { className: \"size-4 cursor-pointer text-success\" })\n :\n _jsx(CopyIcon, { className: \"size-4 cursor-pointer text-gray-400 dark:text-slate-400\", onClick: () => copyToClipboard(value) })] }));\n}\nexport default function InfoList() {\n const session = useUserSession();\n const { account, project, client, authToken } = session;\n const server = new URL(client.baseUrl).hostname;\n const store = new URL(client.store.baseUrl).hostname;\n const tenantId = project ? getTenantIdFromProject(project) : '';\n const tabs = [\n {\n name: 'user',\n label: 'User',\n content: _jsxs(\"div\", { className: \"space-y-1 p-2\", children: [_jsx(InfoItems, { title: \"Organization ID\", value: account?.id ?? 'Unknown' }), _jsx(InfoItems, { title: \"Project ID\", value: project?.id ?? 'Unknown' }), _jsx(InfoItems, { title: \"User ID\", value: authToken?.sub ?? 'Unknown' }), _jsx(InfoItems, { title: \"Organization Roles\", value: authToken?.account_roles?.join(',') ?? 'Unknown' }), _jsx(InfoItems, { title: \"Project Roles\", value: authToken?.project_roles?.join(',') ?? 'Unknown' })] })\n },\n {\n name: 'environment',\n label: 'Environment',\n content: _jsxs(\"div\", { className: \"space-y-1 p-2\", children: [_jsx(InfoItems, { title: \"Tenant ID\", value: tenantId }), _jsx(InfoItems, { title: \"Environment\", value: Env.type }), _jsx(InfoItems, { title: \"Server\", value: server }), _jsx(InfoItems, { title: \"Store\", value: store }), _jsx(InfoItems, { title: \"App Version\", value: Env.version })] })\n }\n ];\n return (_jsx(\"div\", { className: \"w-full\", children: _jsxs(VTabs, { defaultValue: \"user\", tabs: tabs, fullWidth: true, children: [_jsx(VTabsBar, {}), _jsx(VTabsPanel, {})] }) }));\n}\n//# sourceMappingURL=UserInfo.js.map","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Avatar, Button, MenuList, ModeToggle, Spinner } from \"@vertesia/ui/core\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nimport { Popover } from \"@vertesia/ui/widgets\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport SignInModal from \"./SignInModal\";\nimport InfoList from \"./UserInfo\";\nexport function UserSessionMenu({}) {\n const { user, isLoading } = useUserSession();\n const [showModal, setShowModal] = useState(false);\n if (isLoading) {\n return _jsx(Spinner, {});\n }\n else if (!user) {\n return _jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setShowModal(true), children: \"Sign In\" }), _jsx(SignInModal, { isOpen: showModal, onClose: () => setShowModal(false) })] });\n }\n else {\n return (_jsx(\"div\", { className: \"px-3\", children: _jsx(UserSessionPopup, { asMenuTrigger: true }) }));\n }\n}\nfunction UserSessionPopup({ className, asMenuTrigger = false }) {\n const session = useUserSession();\n const { user } = session;\n if (!session || !user)\n return null;\n return (_jsxs(Popover, { strategy: 'fixed', placement: 'bottom-start', zIndex: 100, children: [_jsx(Popover.Trigger, { click: true, children: _jsx(\"div\", { className: clsx(className, \"flex items-center justify-start\", asMenuTrigger && \"cursor-pointer\"), children: _jsx(Avatar, { size: 'sm', color: 'bg-amber-500', shape: 'circle', \n /*src={picture} */\n name: user?.name }) }) }), _jsx(Popover.Content, { className: \"w-[280px] mx-2 my-1\", children: _jsx(\"div\", { className: \"bg-white dark:bg-slate-900 shadow-lg rounded-md ring-1 ring-gray-200 dark:ring-slate-700\", children: _jsxs(\"div\", { className: 'divide-y divide-gray-200 dark:divide-slate-700', children: [_jsxs(\"div\", { className: 'py-2 pl-2', children: [_jsx(\"p\", { className: \"px-4 dark:text-white mb-1\", children: user?.name ?? 'Unknown' }), _jsx(\"p\", { className: \"px-4 text-xs text-gray-500\", children: user?.email ?? '' })] }), _jsx(\"div\", { className: \"w-full p-1\", children: _jsx(InfoList, {}) }), _jsx(\"div\", { className: 'py-2 pl-2', children: _jsx(ModeToggle, {}) }), _jsx(\"div\", { className: 'py-2', children: _jsx(MenuList, { children: _jsx(MenuList.Item, { className: 'px-2', onClick: () => session.logout(), children: \"Sign out\" }) }) })] }) }) })] }));\n}\n//# sourceMappingURL=UserSessionMenu.js.map","export function isVertesiaEmail(email) {\n return email ? (email.endsWith('@vertesiahq.com') ||\n email.endsWith('@becomposable.com') ||\n email.endsWith('@composableprompts.com')) : false;\n}\n//# sourceMappingURL=utils.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { Transition } from \"@headlessui/react\";\nimport { Fragment, useEffect, useState } from \"react\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nexport function SplashScreen({}) {\n const { isLoading } = useUserSession();\n const [show, setShow] = useState(true);\n useEffect(() => {\n if (!isLoading) {\n setShow(false);\n }\n // setTimeout(() => {\n // setShow(false)\n // }, 2000)\n }, [isLoading]);\n // 300 500 700 1000\n return (_jsx(Transition, { appear: true, show: show, as: Fragment, unmount: true, leave: \"transition ease-in duration-500\", leaveFrom: \"opacity-100\", leaveTo: \"opacity-0\", children: _jsx(\"div\", { style: { zIndex: 999999 }, className: 'fixed inset-x-0 inset-y-0', children: _jsx(\"div\", { className: \"flex w-full h-full items-center justify-center\", children: _jsx(\"div\", { className: \"animate-[spin_4s_linear_infinite]\", children: _jsx(\"img\", { src: '/icon.svg', className: 'w-10 h-auto animate-pulse rounded-full' }) }) }) }) }));\n}\n//# sourceMappingURL=SplashScreen.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { ThemeProvider, ToastProvider } from \"@vertesia/ui/core\";\nimport { UserPermissionProvider } from \"@vertesia/ui/features\";\nimport { UserSessionProvider } from \"@vertesia/ui/session\";\nimport { SplashScreen } from \"./SplashScreen\";\nimport { SigninScreen } from \"./login/SigninScreen\";\nexport function VertesiaShell({ children, lightLogo, darkLogo }) {\n return (_jsx(ToastProvider, { children: _jsx(UserSessionProvider, { children: _jsxs(ThemeProvider, { defaultTheme: \"system\", storageKey: \"vite-ui-theme\", children: [_jsx(SplashScreen, {}), _jsx(SigninScreen, { allowedPrefix: \"/shared/\", lightLogo: lightLogo, darkLogo: darkLogo }), _jsx(UserPermissionProvider, { children: children })] }) }) }));\n}\n//# sourceMappingURL=VertesiaShell.js.map"],"names":["InviteAcceptModal","session","useUserSession","client","account","showModal","setShowModal","useState","invites","setInvites","useEffect","listInvites","then","length","console","log","id","closeModal","inviteList","map","invite","_jsxs","className","children","_jsx","data","name","role","invitedBy","Button","size","onClick","async","acceptInvite","fetchAccounts","remainingInvites","filter","i","accept","variant","rejectInvite","reject","Modal","isOpen","onClose","ModalTitle","ModalBody","EnterpriseSigninButton","redirectTo","isLoading","setIsLoading","trackEvent","useUXTracking","email","setEmail","toast","useToast","_Fragment","Input","value","onChange","placeholder","type","Spinner","test","setFirebaseTenant","title","status","duration","localStorage","setItem","provider","Env","firebase","providerType","OAuthProvider","redirectPath","window","location","pathname","GoogleAuthProvider","addScope","setCustomParameters","prompt","redirect_uri","origin","getProvider","firebaseTenantName","logger","info","vertesia","firebaseTenantId","signInWithRedirect","getFirebaseAuth","GitHubSignInButton","removeItem","GithubAuthProvider","src","loading","alt","GoogleSignInButton","MicrosoftSignInButton","companySizeOptions","label","accountTypeOptions","description","projectMaturityOptions","SignupForm","onSignup","goBack","accountType","setAccountType","undefined","companySize","setCompanySize","companyName","setCompanyName","companyWebsite","setCompanyWebsite","projectMaturity","setProjectMaturity","fbUser","setFbUser","error","setError","isCompany","user","getAuth","currentUser","displayName","FormItem","SelectStack","options","selected","find","option","onSelect","VSelectBox","optionLabel","required","signupData","maturity","JSON","stringify","fbToken","getIdToken","SigninScreen","allowedPrefix","isNested","lightLogo","darkLogo","allow","setAllow","useSafeLayoutEffect","href","startsWith","SigninScreenImpl","authError","style","zIndex","clsx","StandardSigninPanel","setSignupData","collectSignupData","setCollectSignupData","signOut","history","replaceState","goToSignup","UserNotFoundError","getItem","payload","firebaseToken","fetch","endpoints","studio","method","headers","body","res","message","TerminalLogin","setPayload","clientInfo","params","URLSearchParams","search","redirect","get","code","decodeURI","profile","project","getClientInfo","useLocation","onAccept","token","fetchComposableTokenFromFirebaseToken","studio_server_url","zeno_server_url","zeno","err","page","AuthDoneScreen","AuthAcceptScreen","ErrorBox","allProjects","useFetch","projects","list","Promise","resolve","envName","isLocalDev","isDev","ProfileForm","Center","navigator","clipboard","writeText","accounts","currentData","setCurrentData","p","SelectAccount","SelectProject","SelectBox","a","by","SignInModal","ModalFooter","justify","InfoItems","isCopied","setIsCopied","VTooltip","placement","Check","CopyIcon","setTimeout","copyToClipboard","InfoList","authToken","server","URL","baseUrl","hostname","store","tenantId","getTenantIdFromProject","tabs","content","sub","account_roles","join","project_roles","version","VTabs","defaultValue","fullWidth","VTabsBar","VTabsPanel","UserSessionMenu","UserSessionPopup","asMenuTrigger","Popover","strategy","Trigger","click","Avatar","color","shape","Content","ModeToggle","MenuList","Item","logout","isVertesiaEmail","endsWith","SplashScreen","show","setShow","Transition","appear","as","Fragment","unmount","leave","leaveFrom","leaveTo","VertesiaShell","ToastProvider","UserSessionProvider","ThemeProvider","defaultTheme","storageKey","UserPermissionProvider"],"mappings":"4sCAIO,SAASA,IACZ,MAAMC,EAAUC,KACVC,OAAEA,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AW,OAAQC,SAAUC,EAAK0P,EAAU,CAAE3P,SAAUC,EAAK0P,EAASC,KAAM,CAAE7P,UAAW,OAAQS,QAAS,IAAM9B,EAAQmR,SAAU7P,SAAU,2BAH90B,IAIf,CC7BO,SAAS8P,GAAgBhO,GAC5B,QAAOA,IAASA,EAAMiO,SAAS,oBAC3BjO,EAAMiO,SAAS,sBACfjO,EAAMiO,SAAS,0BACvB,CCAO,SAASC,OACZ,MAAMtO,UAAEA,GAAc/C,KACfsR,EAAMC,GAAWlR,GAAS,GAUjC,OATAG,GAAU,KACDuC,GACDwO,GAAQ,KAKb,CAACxO,IAEIzB,EAAKkQ,EAAY,CAAEC,QAAQ,EAAMH,KAAMA,EAAMI,GAAIC,EAAUC,SAAS,EAAMC,MAAO,kCAAmCC,UAAW,cAAeC,QAAS,YAAa1Q,SAAUC,EAAK,MAAO,CAAEsI,MAAO,CAAEC,OAAQ,QAAUzI,UAAW,4BAA6BC,SAAUC,EAAK,MAAO,CAAEF,UAAW,iDAAkDC,SAAUC,EAAK,MAAO,CAAEF,UAAW,oCAAqCC,SAAUC,EAAK,MAAO,CAAEyE,IAAK,YAAa3E,UAAW,kDAC7d,CCXO,SAAS4Q,IAAc3Q,SAAEA,EAAQ8H,UAAEA,EAASC,SAAEA,IACjD,OAAQ9H,EAAK2Q,EAAe,CAAE5Q,SAAUC,EAAK4Q,EAAqB,CAAE7Q,SAAUF,EAAMgR,EAAe,CAAEC,aAAc,SAAUC,WAAY,gBAAiBhR,SAAU,CAACC,EAAK+P,GAAc,CAAA,GAAK/P,EAAK0H,GAAc,CAAEC,cAAe,WAAYE,UAAWA,EAAWC,SAAUA,IAAa9H,EAAKgR,EAAwB,CAAEjR,SAAUA,UACvU"}
1
+ {"version":3,"file":"vertesia-ui-shell.js","sources":["esm/shell/login/InviteAcceptModal.js","esm/shell/login/EnterpriseSigninButton.js","esm/shell/login/GitHubSignInButton.js","esm/shell/login/GoogleSignInButton.js","esm/shell/login/MicrosoftSigninButton.js","esm/shell/login/SignupForm.js","esm/shell/login/SigninScreen.js","esm/shell/login/TerminalLogin.js","esm/shell/login/SignInModal.js","esm/shell/login/UserInfo.js","esm/shell/login/UserSessionMenu.js","esm/shell/utils.js","esm/shell/SplashScreen.js","esm/shell/VertesiaShell.js","esm/shell/apps/CheckAppAccess.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, VModal, VModalBody, VModalTitle } from \"@vertesia/ui/core\";\nimport { useEffect, useState } from \"react\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nexport function InviteAcceptModal() {\n const session = useUserSession();\n const { client, account } = session;\n const [showModal, setShowModal] = useState(false);\n const [invites, setInvites] = useState([]);\n useEffect(() => {\n client.account.listInvites().then(invites => {\n if (invites.length > 0) {\n // Filter out legacy invites that do not have account data\n const notLegacyInvites = invites.filter(i => i.data.account);\n if (notLegacyInvites.length === 0) {\n console.log(\"No valid invites found, closing modal\");\n return;\n }\n // If we have valid invites, show the modal\n console.log(\"Found valid invites\", notLegacyInvites.length);\n setShowModal(true);\n setInvites(notLegacyInvites);\n }\n else {\n console.log(\"No invites found, closing modal\");\n setShowModal(false);\n }\n }).catch(err => {\n console.error(\"Error fetching invites\", err);\n });\n }, [account?.id]);\n const closeModal = () => setShowModal(false);\n const accept = async (invite) => {\n await client.account.acceptInvite(invite.id);\n await session.fetchAccounts();\n const remainingInvites = invites.filter(i => i.id !== invite.id);\n const notLegacyInvites = remainingInvites.filter(i => i.data.account);\n if (notLegacyInvites.length > 0) {\n setInvites(notLegacyInvites);\n }\n else {\n closeModal();\n }\n };\n const reject = async (invite) => {\n await client.account.rejectInvite(invite.id);\n const remainingInvites = invites.filter(i => i.id !== invite.id);\n setInvites(remainingInvites);\n if (remainingInvites.length === 0) {\n closeModal();\n }\n };\n const inviteList = invites.map(invite => {\n if (!invite.data.account) {\n console.warn(\"Invite has no account data\", invite);\n return null; // Skip rendering this invite\n }\n return (_jsxs(\"div\", { className: \"flex flex-row w-full justify-between border rounded-sm px-2 py-2 \", children: [_jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(\"div\", { className: \"w-full font-semibold\", children: invite.data.account.name ?? invite.data.account }), invite.data.project && _jsxs(\"div\", { className: \"w-full text-base\", children: [\"- \", invite.data.project.name] }), _jsxs(\"div\", { className: \"text-xs\", children: [\"Role: \", invite.data.role] }), _jsxs(\"div\", { className: \"text-xs\", children: [\"by \", invite.data.invitedBy.name] })] }), _jsxs(\"div\", { className: \"flex flex-col gap-4\", children: [_jsx(Button, { size: 'xs', onClick: () => accept(invite), children: \"Accept\" }), \" \", _jsx(Button, { size: 'xs', variant: \"secondary\", onClick: () => reject(invite), children: \"Reject\" })] })] }, invite.id));\n });\n return (_jsx(\"div\", { children: _jsxs(VModal, { isOpen: showModal, onClose: closeModal, children: [_jsx(VModalTitle, { children: \"Review Invites\" }), _jsxs(VModalBody, { children: [_jsx(\"div\", { className: \"text-sm pb-4\", children: \"You have received the following invites to join other accounts. Please review and accept or declined them.\" }), inviteList] })] }) }));\n}\n//# sourceMappingURL=InviteAcceptModal.js.map","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, Input, Spinner, useToast } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { getFirebaseAuth, setFirebaseTenant, useUXTracking } from \"@vertesia/ui/session\";\nimport { GoogleAuthProvider, OAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { useState } from \"react\";\nfunction getProvider(redirectTo) {\n const providerType = Env.firebase.providerType;\n switch (providerType) {\n case \"oidc\":\n return new OAuthProvider(\"oidc.main\");\n case \"google\": {\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new GoogleAuthProvider();\n provider.addScope('profile');\n provider.addScope('email');\n provider.setCustomParameters({\n prompt: 'select_account',\n redirect_uri: window.location.origin + redirectPath\n });\n return provider;\n }\n case \"microsoft\":\n return new OAuthProvider(\"microsoft.com\");\n case \"github\":\n return new OAuthProvider(\"github.com\");\n default:\n return new OAuthProvider(\"oidc.main\");\n }\n}\nexport default function EnterpriseSigninButton({ redirectTo }) {\n const [isLoading, setIsLoading] = useState(false);\n const { trackEvent } = useUXTracking();\n const [email, setEmail] = useState(\"\");\n const toast = useToast();\n const signIn = async () => {\n if (!email)\n return;\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(email)) {\n toast({\n title: \"Invalid email address\",\n status: \"error\",\n duration: 5000,\n });\n return;\n }\n // Env.firebase.tenantEmail = email;\n setIsLoading(true);\n setFirebaseTenant(email).then((data) => {\n if (!data) {\n toast({\n title: \"Tenant not found\",\n status: \"error\",\n duration: 5000,\n });\n setIsLoading(false);\n return;\n }\n localStorage.setItem(\"tenantName\", data.name ?? \"\");\n const provider = getProvider(redirectTo);\n trackEvent(\"enterprise_signin\", {\n firebaseTenantName: data.name,\n });\n Env.logger.info('Enterprise single sign-in', {\n vertesia: {\n email: email,\n firebaseTenantName: data.name,\n firebaseTenantId: data.firebaseTenantId,\n },\n });\n signInWithRedirect(getFirebaseAuth(), provider);\n setIsLoading(false);\n });\n };\n return (_jsxs(_Fragment, { children: [_jsx(Input, { value: email, onChange: setEmail, placeholder: \"Enter your enterprise email\", type: \"email\" }), isLoading ? (_jsx(\"div\", { className: \"w-full flex justify-center\", children: _jsx(Spinner, {}) })) : (_jsx(Button, { variant: \"outline\", onClick: signIn, className: \"w-full mt-2 py-4 flex rounded-lg hover:shadow-sm transition duration-150 text-center\", children: _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Enterprise SSO\" }) }))] }));\n}\n//# sourceMappingURL=EnterpriseSigninButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { GithubAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function GitHubSignInButton({}) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n //with github can only have one allowed redirect\n const baseUrl = \"https://dengenlabs.firebaseapp.com/__/auth/handler\";\n let redirectPath = baseUrl + window.location.pathname;\n if (redirectPath[0] !== \"/\") {\n redirectPath = \"/\" + redirectPath;\n }\n const provider = new GithubAuthProvider();\n provider.addScope(\"profile\");\n provider.addScope(\"email\");\n /*provider.setCustomParameters({\n redirect_uri: redirectPath,\n });*/\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center mb-2\", children: [_jsx(\"img\", { className: \"size-6 bg-white rounded-full\", src: \"https://www.svgrepo.com/show/503359/github.svg\", loading: \"lazy\", alt: \"github logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with GitHub\" })] }));\n}\n//# sourceMappingURL=GitHubSignInButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { GoogleAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function GoogleSignInButton({ redirectTo }) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new GoogleAuthProvider();\n provider.addScope('profile');\n provider.addScope('email');\n // always ask to select the google account\n //console.log('redirectPath', window.location.origin + redirectPath)\n provider.setCustomParameters({\n prompt: 'select_account',\n redirect_uri: window.location.origin + redirectPath\n });\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center mb-2\", children: [_jsx(\"img\", { className: \"size-6\", src: \"https://www.svgrepo.com/show/475656/google-color.svg\", loading: \"lazy\", alt: \"google logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Google\" })] }));\n}\n//# sourceMappingURL=GoogleSignInButton.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { OAuthProvider, signInWithRedirect } from \"firebase/auth\";\nimport { getFirebaseAuth } from \"@vertesia/ui/session\";\nimport { Button } from \"@vertesia/ui/core\";\nexport default function MicrosoftSignInButton({ redirectTo }) {\n const signIn = () => {\n localStorage.removeItem(\"tenantName\");\n let redirectPath = redirectTo || window.location.pathname || '/';\n if (redirectPath[0] !== '/') {\n redirectPath = '/' + redirectPath;\n }\n const provider = new OAuthProvider('microsoft.com');\n provider.addScope('profile');\n provider.addScope('email');\n signInWithRedirect(getFirebaseAuth(), provider);\n };\n return (_jsxs(Button, { variant: \"outline\", onClick: signIn, className: \"w-full py-5 flex rounded-lg hover:shadow-sm transition duration-150 text-center\", children: [_jsx(\"img\", { className: \"size-6\", src: \"https://learn.microsoft.com/en-us/entra/identity-platform/media/howto-add-branding-in-apps/ms-symbollockup_mssymbol_19.svg\", loading: \"lazy\", alt: \"microsoft logo\" }), _jsx(\"span\", { className: \"text-sm font-semibold\", children: \"Continue with Microsoft\" })] }));\n}\n//# sourceMappingURL=MicrosoftSigninButton.js.map","import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Button, Input, VSelectBox, SelectStack } from \"@vertesia/ui/core\";\nimport { getAuth } from \"firebase/auth\";\nimport { useEffect, useState } from \"react\";\nconst companySizeOptions = [\n { id: 1, label: \"1-10 employees\" },\n { id: 11, label: \"11-100 employees\" },\n { id: 101, label: \"101-1000 employees\" },\n { id: 1001, label: \"1001-5000 employees\" },\n { id: 5001, label: \"5000+ employees\" },\n];\nconst accountTypeOptions = [\n {\n id: \"personal\",\n label: \"Personal\",\n description: \"For personal use, or for a small team.\",\n },\n {\n id: \"company\",\n label: \"Company\",\n description: \"For a company or organization.\",\n },\n];\nconst projectMaturityOptions = [\n { id: \"testing\", label: \"Just Testing or Evaluating LLMs\" },\n { id: \"exploring\", label: \"Actively Exploring LLMs on a Project\" },\n { id: \"using\", label: \"Already Using LLMs in Production\" },\n { id: \"migrating\", label: \"Migrating to different LLMs\" },\n { id: \"other\", label: \"Other\" },\n];\nexport default function SignupForm({ onSignup, goBack }) {\n const [accountType, setAccountType] = useState(undefined);\n const [companySize, setCompanySize] = useState(undefined);\n const [companyName, setCompanyName] = useState(undefined);\n const [companyWebsite, setCompanyWebsite] = useState(undefined);\n const [projectMaturity, setProjectMaturity] = useState(undefined);\n const [fbUser, setFbUser] = useState(undefined);\n const [error, setError] = useState(undefined);\n const isCompany = accountType === \"company\";\n useEffect(() => {\n const user = getAuth().currentUser;\n if (!user) {\n console.error('No user found');\n return;\n }\n setFbUser(user);\n }, [fbUser]);\n const isValid = () => {\n if (!accountType) {\n setError(\"Please select an account type\");\n return false;\n }\n if (isCompany && !companyName) {\n setError(\"Please enter an organization name\");\n return false;\n }\n if (isCompany && !companySize) {\n setError(\"Please select a company size\");\n return false;\n }\n return true;\n };\n const onSubmit = async () => {\n if (!isValid())\n return;\n if (!accountType)\n return;\n const signupData = {\n accountType: accountType,\n companyName: companyName,\n companySize: companySize?.id,\n companyWebsite: companyWebsite,\n maturity: projectMaturity,\n };\n window.localStorage.setItem(\"composableSignupData\", JSON.stringify(signupData));\n const fbToken = await getAuth().currentUser?.getIdToken();\n console.log('Got firebase token', getAuth(), fbToken);\n if (!fbToken) {\n console.error('No firebase token found');\n return;\n }\n onSignup(signupData, fbToken);\n };\n return (_jsxs(\"div\", { className: \"flex flex-col space-y-2\", children: [_jsxs(\"div\", { className: \"prose\", children: [_jsxs(\"p\", { className: \"prose text-sm text-muted pt-4\", children: [\"Welcome to Vertesia, \", fbUser?.displayName, \" (\", fbUser?.email, \"). Please tell us a little bit about yourself and you'll be on your way. No credit card is required.\"] }), error &&\n _jsx(\"div\", { className: \"text-destructive\", children: error })] }), _jsx(FormItem, { label: \"Account Type\", children: _jsx(SelectStack, { options: accountTypeOptions, selected: accountTypeOptions.find((option) => option.id === accountType), onSelect: (option) => setAccountType(option.id) }) }), isCompany &&\n _jsxs(_Fragment, { children: [_jsx(FormItem, { label: \"Company Size\", children: _jsx(VSelectBox, { className: \"w-full border border-accent bg-muted\", value: companySize, options: companySizeOptions, onChange: setCompanySize, optionLabel: (option) => option?.label, placeholder: 'Select Company Size' }) }), _jsx(FormItem, { label: \"Company Name\", children: _jsx(Input, { value: companyName, onChange: setCompanyName, type: \"text\", required: true }) }), _jsx(FormItem, { label: \"Company Website\", children: _jsx(Input, { value: companyWebsite, onChange: setCompanyWebsite, type: \"text\" }) })] }), _jsx(FormItem, { label: \"Project Maturity\", children: _jsx(VSelectBox, { className: \"w-full border border-accent bg-muted\", options: projectMaturityOptions, value: projectMaturityOptions.find((option) => option.id === projectMaturity), optionLabel: (option) => option?.label, placeholder: 'Select Project Maturity', onChange: (option) => setProjectMaturity(option?.id) }) }), _jsxs(\"div\", { className: \"pt-8 flex flex-col\", children: [_jsx(Button, { variant: \"primary\", onClick: onSubmit, size: \"xl\", children: _jsx(\"span\", { className: \"text-lg\", children: \"Sign Up\" }) }), _jsx(Button, { variant: \"ghost\", size: \"xl\", className: \"mt-4\", onClick: goBack, children: _jsx(\"span\", { className: \"\", children: \"Wrong account, go back\" }) })] })] }));\n}\nfunction FormItem({ label, children }) {\n return (_jsxs(\"div\", { className: \"flex flex-col space-y-2 pt-4\", children: [_jsx(\"div\", { className: \"text-sm text-muted\", children: label }), children] }));\n}\n//# sourceMappingURL=SignupForm.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { Button, useSafeLayoutEffect } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { UserNotFoundError, useUserSession, useUXTracking } from \"@vertesia/ui/session\";\nimport clsx from \"clsx\";\nimport { useEffect, useState } from \"react\";\nimport EnterpriseSigninButton from \"./EnterpriseSigninButton\";\nimport GitHubSignInButton from \"./GitHubSignInButton\";\nimport GoogleSignInButton from \"./GoogleSignInButton\";\nimport MicrosoftSignInButton from \"./MicrosoftSigninButton\";\nimport SignupForm from \"./SignupForm\";\nexport function SigninScreen({ allowedPrefix, isNested = false, lightLogo, darkLogo }) {\n const [allow, setAllow] = useState(false);\n useSafeLayoutEffect(() => {\n allowedPrefix && setAllow(window.location.href.startsWith(allowedPrefix));\n }, []);\n return allow ? null : _jsx(SigninScreenImpl, { isNested: isNested, lightLogo: lightLogo, darkLogo: darkLogo });\n}\nfunction SigninScreenImpl({ isNested = false, lightLogo, darkLogo }) {\n const { isLoading, user, authError } = useUserSession();\n return !isLoading && !user ? (_jsx(\"div\", { style: { zIndex: 999998 }, className: (isNested ? \"absolute\" : \"fixed\") + \"overflow-y-auto \", children: _jsxs(\"div\", { className: clsx(\"flex flex-col items-center justify-center py-14 px-4\"), children: [_jsx(StandardSigninPanel, { authError: authError, lightLogo: lightLogo, darkLogo: darkLogo }), _jsxs(\"div\", { className: \"flex gap-x-6 mt-10 justify-center text-muted\", children: [_jsx(\"a\", { href: \"https://vertesiahq.com/privacy\", className: \"text-sm\", children: \"Privacy Policy\" }), _jsx(\"a\", { href: \"https://vertesiahq.com/terms\", className: \"text-sm\", children: \"Terms of Service\" })] })] }) })) : null;\n}\nfunction StandardSigninPanel({ authError, darkLogo, lightLogo }) {\n const [signupData, setSignupData] = useState(undefined);\n const [collectSignupData, setCollectSignupData] = useState(false);\n const { signOut } = useUserSession();\n const { trackEvent } = useUXTracking();\n history.replaceState({}, '', '/');\n const goBack = () => {\n console.log(\"Going back, signing out\");\n setSignupData(undefined);\n setCollectSignupData(false);\n signOut();\n };\n const goToSignup = () => {\n setSignupData(undefined);\n setCollectSignupData(true);\n };\n useEffect(() => {\n if (authError instanceof UserNotFoundError) {\n console.log(\"User not found, redirecting to signup\");\n goToSignup();\n }\n }, [authError]);\n const onSignup = (data, fbToken) => {\n console.log(\"Got Signup data\", data);\n setSignupData(data);\n const payload = {\n signupData: data,\n firebaseToken: fbToken,\n };\n fetch(Env.endpoints.studio + \"/auth/signup\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n }).then((res) => {\n console.log(\"Signup successful\", payload, res);\n trackEvent(\"sign_up\");\n window.location.href = \"/\";\n });\n };\n return (_jsxs(_Fragment, { children: [lightLogo && _jsx(\"img\", { src: lightLogo, alt: 'logo', className: 'h-15 block dark:hidden' }), darkLogo && _jsx(\"img\", { src: darkLogo, alt: 'logo', className: 'h-15 hidden dark:block' }), signupData && (_jsxs(\"div\", { className: \"my-6\", children: [\"Need to make a change?\", \" \", _jsx(Button, { onClick: goToSignup, children: \" Go back\" })] })), _jsx(\"div\", { className: \"flex flex-col space-y-2\", children: collectSignupData && !localStorage.getItem('tenantName') ? (_jsx(SignupForm, { onSignup: onSignup, goBack: goBack })) : (_jsxs(\"div\", { className: \"flex flex-col\", children: [_jsx(\"div\", { className: \"my-4\", children: _jsx(\"h2\", { className: \"text-2xl font-bold text-center\", children: \"Log in or Sign up\" }) }), _jsxs(\"div\", { className: \"max-w-2xl text-center my-2 px-2\", children: [\"First time here? No problem, it's free to try!\", _jsx(\"br\", {}), \"We'll just ask you a couple of questions next and you'll be on your way.\"] }), _jsxs(\"div\", { className: \"flex items-center flex-col\", children: [_jsxs(\"div\", { className: \"py-4 w-70\", children: [_jsx(GoogleSignInButton, {}), _jsx(GitHubSignInButton, {}), _jsx(MicrosoftSignInButton, {})] }), _jsxs(\"div\", { className: \"flex items-center flex-row w-70 text-muted\", children: [_jsx(\"hr\", { className: \"w-full\" }), _jsx(\"div\", { className: \"px-2 text-xs\", children: \"OR\" }), _jsx(\"hr\", { className: \"w-full\" })] }), _jsx(\"div\", { className: \"py-4 w-70\", children: _jsx(EnterpriseSigninButton, {}) })] }), authError && (_jsx(\"div\", { className: \"text-center\", children: _jsxs(\"div\", { className: \"\", children: [\"Sorry, we have not been able to sign you in.\", _jsx(\"br\", {}), \"Please try again or contact\", _jsx(\"a\", { className: 'text-info mx-1', href: \"mailto:support@vertesiahq.com\", children: \"support@vertesiahq.com\" }), \"if it persists.\", _jsxs(\"pre\", { className: \"mt-2\", children: [\"Error: \", authError.message] })] }) }))] })) })] }));\n}\n//# sourceMappingURL=SigninScreen.js.map","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { useState } from 'react';\nimport { Button, Center, ErrorBox, Input, SelectBox, Spinner, useFetch, useToast } from '@vertesia/ui/core';\nimport { Env } from \"@vertesia/ui/env\";\nimport { useLocation } from \"@vertesia/ui/router\";\nimport { fetchComposableTokenFromFirebaseToken, useUserSession } from '@vertesia/ui/session';\nfunction getClientInfo(location) {\n const params = new URLSearchParams(location.search);\n let redirect = params.get('redirect_uri');\n const code = params.get('code');\n if (!redirect || !code) {\n return null;\n }\n redirect = decodeURI(redirect);\n if (!redirect.startsWith('http://127.0.0.1:') && !redirect.startsWith('http://localhost:')) {\n return null;\n }\n const profile = params.get('profile') ?? \"default\";\n const project = params.get('project') ?? undefined;\n const account = params.get('account') ?? undefined;\n return { redirect, code, profile, project, account };\n}\nexport function TerminalLogin() {\n const [payload, setPayload] = useState();\n const [error, setError] = useState();\n const location = useLocation();\n const clientInfo = getClientInfo(location);\n const toast = useToast();\n const onAccept = async (data) => {\n if (!clientInfo)\n return;\n if (!data.profile) {\n toast({\n title: 'Profile is required',\n description: 'Please enter a profile name to save the client authorization',\n status: 'error',\n duration: 2000\n });\n return;\n }\n if (!data.account) {\n toast({\n title: 'Account is required',\n description: 'Please select an account to authorize the client to access the ComposablePrompts servers',\n status: 'error',\n duration: 2000\n });\n return;\n }\n if (!data.project) {\n toast({\n title: 'Project is required',\n description: 'Please select a project to authorize the client to access the ComposablePrompts servers',\n status: 'error',\n duration: 2000\n });\n return;\n }\n // expire in 1 day\n let payload;\n try {\n const token = await fetchComposableTokenFromFirebaseToken(data.account, data.project, 24 * 3600);\n if (token) {\n payload = {\n ...data,\n studio_server_url: Env.endpoints.studio,\n zeno_server_url: Env.endpoints.zeno,\n token,\n };\n await fetch(clientInfo.redirect, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload)\n });\n setPayload(payload);\n }\n else {\n toast({\n title: 'Failed to get composable token',\n status: 'error',\n duration: 5000\n });\n }\n }\n catch (err) {\n if (payload) {\n setError(err);\n setPayload(payload);\n }\n else {\n toast({\n title: 'Error authorizing client',\n description: err.message,\n status: 'error',\n duration: 5000\n });\n }\n }\n };\n const getPageContent = () => {\n if (!clientInfo) {\n return _jsx(ErrorBox, { title: 'Invalid request', children: \"This page should be called by a terminal client to authenticate against the ComposablePrompts servers\" });\n }\n return payload\n ? _jsx(AuthDoneScreen, { payload: payload, error: error })\n : _jsx(AuthAcceptScreen, { clientInfo: clientInfo, onAccept: onAccept });\n };\n const page = getPageContent();\n return (_jsx(\"div\", { className: \"w-full flex flex-col items-center gap-4 mt-24\", children: page }));\n}\nfunction AuthAcceptScreen({ onAccept, clientInfo }) {\n const { client, user } = useUserSession();\n const { data: allProjects, error } = useFetch(() => user ? client.projects.list() : Promise.resolve([]), [user]);\n if (error) {\n return _jsx(ErrorBox, { title: 'Error loading projects', children: error.message });\n }\n const getEnvironmentName = () => {\n if (Env.isLocalDev) {\n return \"Local Dev\";\n }\n else if (Env.isDev) {\n return \"Staging\";\n }\n return \"Production\";\n };\n const envName = getEnvironmentName();\n return user && allProjects ? (_jsxs(_Fragment, { children: [_jsxs(\"div\", { className: 'w-1/3', children: [_jsxs(\"div\", { className: \"mb-4 text-xl font-semibold text-gray-800\", children: [\"Authorizing client on \", envName, \" environment.\"] }), _jsxs(\"div\", { className: 'mb-2 text-md text-gray-800', children: [_jsx(\"div\", { children: \"A client app wants authorization to access the composable prompt servers in your name.\" }), _jsxs(\"div\", { children: [\"The client app code is \", _jsx(\"b\", { children: clientInfo.code }), \". You can check if the code is correct in the terminal.\"] })] }), _jsxs(\"div\", { className: 'mb-2 text-sm text-gray-600', children: [_jsx(\"div\", { children: \"You must choose the target account and project for the client to access.\" }), _jsx(\"div\", { children: \"Also, enter a profile name that will be used to save the authorization in your client configuration.\" })] })] }), _jsx(ProfileForm, { onAccept: onAccept, allProjects: allProjects, data: clientInfo })] })) : _jsx(Spinner, { size: 'lg' });\n}\nfunction AuthDoneScreen({ payload, error }) {\n const toast = useToast();\n const onCopy = () => {\n if (payload) {\n navigator.clipboard.writeText(JSON.stringify(payload));\n toast({\n title: 'Authentication Payload copied',\n description: error ? 'You can paste the authentication payload in the terminal to authenticate the client.' : 'You can close the page now.',\n status: 'success',\n duration: 5000\n });\n }\n };\n return (_jsxs(\"div\", { children: [error ?\n _jsxs(\"div\", { children: [_jsxs(ErrorBox, { title: 'Failed to send the authorization token to the cli tool', children: [\"This can happen due to security checks on Safari. The error is \\\"\", error.message, \"\\\"\"] }), _jsx(\"div\", { children: \"Don't worry, you can still authenticate the cli tool by pasting the authentication token in the terminal. You can close this page.\" })] })\n : _jsx(\"div\", { children: \"The client is authenticated. You can close this page.\" }), _jsx(Center, { className: \"mt-4\", children: _jsx(Button, { variant: 'secondary', onClick: onCopy, children: \"Copy the Authentication Payload\" }) })] }));\n}\nfunction ProfileForm({ allProjects, data, onAccept }) {\n const { accounts, account, project } = useUserSession();\n const [currentData, setCurrentData] = useState(() => ({\n profile: data.profile,\n account: data.account ?? account?.id,\n project: data.project ?? project?.id,\n }));\n const onChangeProfile = (value) => {\n setCurrentData({ ...currentData, profile: value });\n };\n const onChangeAccount = (value) => {\n setCurrentData({ ...currentData, account: value.id, project: undefined });\n };\n const onChangeProject = (value) => {\n setCurrentData({ ...currentData, project: value.id });\n };\n const projects = allProjects.filter(p => p.account === currentData.account);\n return (_jsxs(\"div\", { className: 'w-1/3', children: [_jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Profile Name\" }), _jsx(Input, { type: 'text', value: currentData.profile, onChange: onChangeProfile })] }), _jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Account\" }), _jsx(SelectAccount, { value: currentData.account, onChange: onChangeAccount, accounts: accounts || [] })] }), _jsxs(\"div\", { className: \"mb-4 flex flex-col gap-2\", children: [_jsx(\"span\", { className: \"font-semibold text-gray-600\", children: \"Project\" }), _jsx(SelectProject, { value: currentData.project, onChange: onChangeProject, projects: projects })] }), _jsx(\"div\", { className: \"pt-2\", children: _jsx(Button, { size: 'xl', onClick: () => onAccept(currentData), children: \"Authorize Client\" }) })] }));\n}\nfunction SelectAccount({ value, accounts, onChange }) {\n const _onChange = (value) => {\n onChange(value);\n };\n return _jsx(SelectBox, { options: accounts, value: accounts?.find(a => a.id === value), onChange: _onChange, by: \"id\", optionLabel: (option) => option.name, placeholder: 'Select Account' });\n}\nfunction SelectProject({ value, projects, onChange }) {\n const _onChange = (value) => {\n onChange(value);\n };\n return (_jsx(SelectBox, { by: \"id\", value: projects.find(p => p.id === value), options: projects, optionLabel: (option) => option.name, placeholder: 'Select Project', onChange: _onChange }));\n}\n//# sourceMappingURL=TerminalLogin.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Button, Modal, ModalBody, ModalFooter, ModalTitle } from \"@vertesia/ui/core\";\nimport GitHubSignInButton from \"./GitHubSignInButton\";\nimport GoogleSignInButton from \"./GoogleSignInButton\";\nimport MicrosoftSignInButton from \"./MicrosoftSigninButton\";\nexport default function SignInModal({ isOpen, onClose }) {\n return (_jsxs(Modal, { isOpen: isOpen, onClose: onClose, children: [_jsx(ModalTitle, { children: \"Sign In\" }), _jsxs(ModalBody, { className: \"flex justify-center\", children: [_jsx(GoogleSignInButton, {}), _jsx(GitHubSignInButton, {}), _jsx(MicrosoftSignInButton, {})] }), _jsx(ModalFooter, { justify: \"end\", children: _jsx(Button, { variant: \"ghost\", onClick: onClose, children: \"Cancel\" }) })] }));\n}\n//# sourceMappingURL=SignInModal.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { getTenantIdFromProject } from \"@vertesia/common\";\nimport { VTabs, VTabsBar, VTabsPanel, VTooltip } from \"@vertesia/ui/core\";\nimport { Env } from \"@vertesia/ui/env\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nimport { Check, CopyIcon } from \"lucide-react\";\nimport { useState } from \"react\";\nexport function InfoItems({ title, value }) {\n function copyToClipboard(value) {\n navigator.clipboard.writeText(value);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n const [isCopied, setIsCopied] = useState(false);\n return (_jsxs(\"div\", { className: \"w-full flex justify-between items-center mb-1\", children: [_jsxs(\"div\", { className: \"flex flex-col w-[calc(100%-3rem)]\", children: [_jsx(\"div\", { className: 'text-sm px-2 dark:text-slate-200', children: title }), _jsx(VTooltip, { description: value, size: \"xs\", placement: \"left\", children: _jsxs(\"div\", { className: 'text-xs truncate text-muted w-full text-left px-2', children: [value, \" \"] }) })] }), isCopied ?\n _jsx(Check, { className: \"size-4 cursor-pointer text-success\" })\n :\n _jsx(CopyIcon, { className: \"size-4 cursor-pointer text-gray-400 dark:text-slate-400\", onClick: () => copyToClipboard(value) })] }));\n}\nexport default function InfoList() {\n const session = useUserSession();\n const { account, project, client, authToken } = session;\n const server = new URL(client.baseUrl).hostname;\n const store = new URL(client.store.baseUrl).hostname;\n const tenantId = project ? getTenantIdFromProject(project) : '';\n const tabs = [\n {\n name: 'user',\n label: 'User',\n content: _jsxs(\"div\", { className: \"space-y-1 p-2\", children: [_jsx(InfoItems, { title: \"Organization ID\", value: account?.id ?? 'Unknown' }), _jsx(InfoItems, { title: \"Project ID\", value: project?.id ?? 'Unknown' }), _jsx(InfoItems, { title: \"User ID\", value: authToken?.sub ?? 'Unknown' }), _jsx(InfoItems, { title: \"Organization Roles\", value: authToken?.account_roles?.join(',') ?? 'Unknown' }), _jsx(InfoItems, { title: \"Project Roles\", value: authToken?.project_roles?.join(',') ?? 'Unknown' })] })\n },\n {\n name: 'environment',\n label: 'Environment',\n content: _jsxs(\"div\", { className: \"space-y-1 p-2\", children: [_jsx(InfoItems, { title: \"Tenant ID\", value: tenantId }), _jsx(InfoItems, { title: \"Environment\", value: Env.type }), _jsx(InfoItems, { title: \"Server\", value: server }), _jsx(InfoItems, { title: \"Store\", value: store }), _jsx(InfoItems, { title: \"App Version\", value: Env.version })] })\n }\n ];\n return (_jsx(\"div\", { className: \"w-full\", children: _jsxs(VTabs, { defaultValue: \"user\", tabs: tabs, fullWidth: true, children: [_jsx(VTabsBar, {}), _jsx(VTabsPanel, {})] }) }));\n}\n//# sourceMappingURL=UserInfo.js.map","import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Avatar, Button, MenuList, ModeToggle, Spinner } from \"@vertesia/ui/core\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nimport { Popover } from \"@vertesia/ui/widgets\";\nimport clsx from \"clsx\";\nimport { useState } from \"react\";\nimport SignInModal from \"./SignInModal\";\nimport InfoList from \"./UserInfo\";\nexport function UserSessionMenu({}) {\n const { user, isLoading } = useUserSession();\n const [showModal, setShowModal] = useState(false);\n if (isLoading) {\n return _jsx(Spinner, {});\n }\n else if (!user) {\n return _jsxs(_Fragment, { children: [_jsx(Button, { onClick: () => setShowModal(true), children: \"Sign In\" }), _jsx(SignInModal, { isOpen: showModal, onClose: () => setShowModal(false) })] });\n }\n else {\n return (_jsx(\"div\", { className: \"px-3\", children: _jsx(UserSessionPopup, { asMenuTrigger: true }) }));\n }\n}\nfunction UserSessionPopup({ className, asMenuTrigger = false }) {\n const session = useUserSession();\n const { user } = session;\n if (!session || !user)\n return null;\n return (_jsxs(Popover, { strategy: 'fixed', placement: 'bottom-start', zIndex: 100, children: [_jsx(Popover.Trigger, { click: true, children: _jsx(\"div\", { className: clsx(className, \"flex items-center justify-start\", asMenuTrigger && \"cursor-pointer\"), children: _jsx(Avatar, { size: 'sm', color: 'bg-amber-500', shape: 'circle', \n /*src={picture} */\n name: user?.name }) }) }), _jsx(Popover.Content, { className: \"w-[280px] mx-2 my-1\", children: _jsx(\"div\", { className: \"bg-white dark:bg-slate-900 shadow-lg rounded-md ring-1 ring-gray-200 dark:ring-slate-700\", children: _jsxs(\"div\", { className: 'divide-y divide-gray-200 dark:divide-slate-700', children: [_jsxs(\"div\", { className: 'py-2 pl-2', children: [_jsx(\"p\", { className: \"px-4 dark:text-white mb-1\", children: user?.name ?? 'Unknown' }), _jsx(\"p\", { className: \"px-4 text-xs text-gray-500\", children: user?.email ?? '' })] }), _jsx(\"div\", { className: \"w-full p-1\", children: _jsx(InfoList, {}) }), _jsx(\"div\", { className: 'py-2 pl-2', children: _jsx(ModeToggle, {}) }), _jsx(\"div\", { className: 'py-2', children: _jsx(MenuList, { children: _jsx(MenuList.Item, { className: 'px-2', onClick: () => session.logout(), children: \"Sign out\" }) }) })] }) }) })] }));\n}\n//# sourceMappingURL=UserSessionMenu.js.map","export function isVertesiaEmail(email) {\n return email ? (email.endsWith('@vertesiahq.com') ||\n email.endsWith('@becomposable.com') ||\n email.endsWith('@composableprompts.com')) : false;\n}\n//# sourceMappingURL=utils.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Transition } from \"@headlessui/react\";\nimport { Fragment, useEffect, useState } from \"react\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nexport function SplashScreen({ icon: Icon }) {\n const { isLoading } = useUserSession();\n const [show, setShow] = useState(true);\n useEffect(() => {\n if (!isLoading) {\n setShow(false);\n }\n // setTimeout(() => {\n // setShow(false)\n // }, 2000)\n }, [isLoading]);\n // 300 500 700 1000\n return (_jsx(Transition, { appear: true, show: show, as: Fragment, unmount: true, leave: \"transition ease-in duration-500\", leaveFrom: \"opacity-100\", leaveTo: \"opacity-0\", children: _jsx(\"div\", { style: { zIndex: 999999 }, className: 'fixed inset-x-0 inset-y-0', children: _jsx(\"div\", { className: \"flex w-full h-full items-center justify-center\", children: _jsx(\"div\", { className: \"animate-[spin_4s_linear_infinite]\", children: _jsx(\"div\", { className: 'animate-pulse rounded-full bg-transparent', children: Icon || _jsx(LoadingIcon, {}) }) }) }) }) }));\n}\nfunction LoadingIcon() {\n const stopColor1 = \"currentColor\";\n const stopColor2 = \"currentColor\";\n // const stopColor1 = \"#4F46E5\";\n // const stopColor2 = \"#4F46E5\";\n return (_jsxs(\"svg\", { className: \"w-8 h-8 text-indigo-600\", viewBox: \"0 0 50 50\", xmlns: \"http://www.w3.org/2000/svg\", children: [_jsx(\"defs\", { children: _jsxs(\"linearGradient\", { id: \"spinner-gradient\", x1: \"1\", y1: \"0\", x2: \"0\", y2: \"1\", children: [_jsx(\"stop\", { offset: \"0%\", stopColor: stopColor1, stopOpacity: \"1\" }), _jsx(\"stop\", { offset: \"100%\", stopColor: stopColor2, stopOpacity: \"0\" })] }) }), _jsx(\"circle\", { cx: \"25\", cy: \"25\", r: \"20\", stroke: \"url(#spinner-gradient)\", strokeWidth: \"5\", fill: \"none\", strokeLinecap: \"round\" })] }));\n}\n//# sourceMappingURL=SplashScreen.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { ThemeProvider, ToastProvider } from \"@vertesia/ui/core\";\nimport { UserPermissionProvider } from \"@vertesia/ui/features\";\nimport { UserSessionProvider } from \"@vertesia/ui/session\";\nimport { SplashScreen } from \"./SplashScreen\";\nimport { SigninScreen } from \"./login/SigninScreen\";\nexport function VertesiaShell({ children, lightLogo, darkLogo, loadingIcon }) {\n return (_jsx(ToastProvider, { children: _jsx(UserSessionProvider, { children: _jsxs(ThemeProvider, { defaultTheme: \"system\", storageKey: \"vite-ui-theme\", children: [_jsx(SplashScreen, { icon: loadingIcon }), _jsx(SigninScreen, { allowedPrefix: \"/shared/\", lightLogo: lightLogo, darkLogo: darkLogo }), _jsx(UserPermissionProvider, { children: children })] }) }) }));\n}\n//# sourceMappingURL=VertesiaShell.js.map","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { ErrorBox } from \"@vertesia/ui/core\";\nimport { useUserSession } from \"@vertesia/ui/session\";\nimport { useEffect, useState } from \"react\";\nexport function CheckAppAccess({ name, children }) {\n const [hasAccess, setHasAccess] = useState(null);\n const { authToken } = useUserSession();\n useEffect(() => {\n if (authToken) {\n setHasAccess(authToken.apps?.includes(name) || false);\n }\n }, [authToken]);\n if (hasAccess == null) {\n return null;\n }\n if (hasAccess) {\n return children;\n }\n else {\n return _jsx(ErrorBox, { title: \"Forbidden\", children: \"Access is not granted to this application\" });\n }\n}\n//# sourceMappingURL=CheckAppAccess.js.map"],"names":["InviteAcceptModal","session","useUserSession","client","account","showModal","setShowModal","useState","invites","setInvites","useEffect","listInvites","then","length","notLegacyInvites","filter","i","data","console","log","catch","err","error","id","closeModal","inviteList","map","invite","_jsxs","className","children","_jsx","name","project","role","invitedBy","Button","size","onClick","async","acceptInvite","fetchAccounts","accept","variant","rejectInvite","remainingInvites","reject","warn","VModal","isOpen","onClose","VModalTitle","VModalBody","EnterpriseSigninButton","redirectTo","isLoading","setIsLoading","trackEvent","useUXTracking","email","setEmail","toast","useToast","_Fragment","Input","value","onChange","placeholder","type","Spinner","test","setFirebaseTenant","title","status","duration","localStorage","setItem","provider","Env","firebase","providerType","OAuthProvider","redirectPath","window","location","pathname","GoogleAuthProvider","addScope","setCustomParameters","prompt","redirect_uri","origin","getProvider","firebaseTenantName","logger","info","vertesia","firebaseTenantId","signInWithRedirect","getFirebaseAuth","GitHubSignInButton","removeItem","GithubAuthProvider","src","loading","alt","GoogleSignInButton","MicrosoftSignInButton","companySizeOptions","label","accountTypeOptions","description","projectMaturityOptions","SignupForm","onSignup","goBack","accountType","setAccountType","undefined","companySize","setCompanySize","companyName","setCompanyName","companyWebsite","setCompanyWebsite","projectMaturity","setProjectMaturity","fbUser","setFbUser","setError","isCompany","user","getAuth","currentUser","displayName","FormItem","SelectStack","options","selected","find","option","onSelect","VSelectBox","optionLabel","required","signupData","maturity","JSON","stringify","fbToken","getIdToken","SigninScreen","allowedPrefix","isNested","lightLogo","darkLogo","allow","setAllow","useSafeLayoutEffect","href","startsWith","SigninScreenImpl","authError","style","zIndex","clsx","StandardSigninPanel","setSignupData","collectSignupData","setCollectSignupData","signOut","history","replaceState","goToSignup","UserNotFoundError","getItem","payload","firebaseToken","fetch","endpoints","studio","method","headers","body","res","message","TerminalLogin","setPayload","clientInfo","params","URLSearchParams","search","redirect","get","code","decodeURI","profile","getClientInfo","useLocation","onAccept","token","fetchComposableTokenFromFirebaseToken","studio_server_url","zeno_server_url","zeno","page","AuthDoneScreen","AuthAcceptScreen","ErrorBox","allProjects","useFetch","projects","list","Promise","resolve","envName","isLocalDev","isDev","ProfileForm","Center","navigator","clipboard","writeText","accounts","currentData","setCurrentData","p","SelectAccount","SelectProject","SelectBox","a","by","SignInModal","Modal","ModalTitle","ModalBody","ModalFooter","justify","InfoItems","isCopied","setIsCopied","VTooltip","placement","Check","CopyIcon","setTimeout","copyToClipboard","InfoList","authToken","server","URL","baseUrl","hostname","store","tenantId","getTenantIdFromProject","tabs","content","sub","account_roles","join","project_roles","version","VTabs","defaultValue","fullWidth","VTabsBar","VTabsPanel","UserSessionMenu","UserSessionPopup","asMenuTrigger","Popover","strategy","Trigger","click","Avatar","color","shape","Content","ModeToggle","MenuList","Item","logout","isVertesiaEmail","endsWith","SplashScreen","icon","Icon","show","setShow","Transition","appear","as","Fragment","unmount","leave","leaveFrom","leaveTo","LoadingIcon","viewBox","xmlns","x1","y1","x2","y2","offset","stopColor","stopOpacity","cx","cy","r","stroke","strokeWidth","fill","strokeLinecap","VertesiaShell","loadingIcon","ToastProvider","UserSessionProvider","ThemeProvider","defaultTheme","storageKey","UserPermissionProvider","CheckAppAccess","hasAccess","setHasAccess","apps","includes"],"mappings":"yvCAIO,SAASA,KACZ,MAAMC,EAAUC,KACVC,OAAEA,EAAMC,QAAEA,GAAYH,GACrBI,EAAWC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",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -58,9 +58,9 @@
58
58
  "remark-gfm": "^4.0.1",
59
59
  "tailwind-merge": "^3.3.0",
60
60
  "ts-md5": "^1.3.1",
61
- "@vertesia/client": "0.70.0",
62
- "@vertesia/common": "0.70.0",
63
- "@vertesia/json": "0.70.0"
61
+ "@vertesia/client": "0.72.0",
62
+ "@vertesia/json": "0.72.0",
63
+ "@vertesia/common": "0.72.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@eslint/js": "^9.27.0",
@@ -1,6 +1,6 @@
1
1
  import ModeToggle from './theme/ThemeSwitcher';
2
- import { ThemeProvider } from './theme/ThemeProvider';
3
- export { ModeToggle, ThemeProvider };
2
+ import { ThemeProvider, ThemeProviderContext } from './theme/ThemeProvider';
3
+ export { ModeToggle, ThemeProvider, ThemeProviderContext };
4
4
 
5
5
  export * from './button';
6
6
  export * from './card';
@@ -11,12 +11,14 @@ const TabsContext = React.createContext<{
11
11
  current?: string;
12
12
  setTab?: (name: string) => void;
13
13
  responsive?: boolean;
14
+ variant?: "tabs" | "pills";
14
15
  }>({
15
16
  size: undefined,
16
17
  tabs: undefined,
17
18
  current: undefined,
18
19
  setTab: undefined,
19
- responsive: false
20
+ responsive: false,
21
+ variant: "tabs"
20
22
  });
21
23
 
22
24
  interface TabsProps {
@@ -28,6 +30,7 @@ interface TabsProps {
28
30
  children?: React.ReactNode;
29
31
  onTabChange?: (tabName: string) => void;
30
32
  responsive?: boolean;
33
+ variant?: "tabs" | "pills";
31
34
  }
32
35
 
33
36
  const VTabs = ({
@@ -38,7 +41,8 @@ const VTabs = ({
38
41
  fullWidth,
39
42
  children,
40
43
  onTabChange,
41
- responsive = false
44
+ responsive = false,
45
+ variant = "tabs"
42
46
  }: TabsProps) => {
43
47
  const currentValue = typeof current === 'function' ? current() : current || defaultValue;
44
48
 
@@ -62,7 +66,7 @@ const VTabs = ({
62
66
  }, [handleValueChange]);
63
67
 
64
68
  return (
65
- <TabsContext.Provider value={{ tabs, size: fullWidth ? tabs.length : 0, current: value, setTab, responsive: responsive }}>
69
+ <TabsContext.Provider value={{ tabs, size: fullWidth ? tabs.length : 0, current: value, setTab, responsive: responsive, variant }}>
66
70
  <TabsPrimitive.Root
67
71
  defaultValue={tabs[0]?.name}
68
72
  value={value}
@@ -76,7 +80,7 @@ const VTabs = ({
76
80
  };
77
81
 
78
82
  const VTabsBar = ({ className }: { className?: string }) => {
79
- const { tabs, size, current, setTab, responsive } = React.useContext(TabsContext);
83
+ const { tabs, size, current, setTab, responsive, variant } = React.useContext(TabsContext);
80
84
 
81
85
  const fullWidth = size !== 0;
82
86
 
@@ -114,13 +118,14 @@ const VTabsBar = ({ className }: { className?: string }) => {
114
118
  />
115
119
  </div>
116
120
  )}
117
- <TabsList size={size} className={cn((fullWidth ? "w-full" : ""), className, (responsive ? "hidden lg:flex" : ""))}>
121
+ <TabsList size={size} variant={variant} className={cn((fullWidth ? "w-full" : ""), className, (responsive ? "hidden lg:flex" : ""))}>
118
122
  {tabs.map((tab) => (
119
123
  <TabsTrigger
120
124
  key={tab.name}
121
125
  value={tab.name}
122
126
  disabled={tab.disabled}
123
127
  href={tab.href}
128
+ variant={variant}
124
129
  onClick={() => handleTabChange(tab.name)}
125
130
  >
126
131
  {tab.label}
@@ -149,13 +154,15 @@ const VTabsPanel = () => {
149
154
 
150
155
  const TabsList = React.forwardRef<
151
156
  React.ElementRef<typeof TabsPrimitive.List>,
152
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & { size?: number }
153
- >(({ className, size, ...props }, ref) => (
154
- <TabsContext.Provider value={{ size }}>
157
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & { size?: number; variant?: "tabs" | "pills" }
158
+ >(({ className, size, variant = "tabs", ...props }, ref) => (
159
+ <TabsContext.Provider value={{ size, variant }}>
155
160
  <TabsPrimitive.List
156
161
  ref={ref}
157
162
  className={cn(
158
- "border-b -mb-px flex space-x-4",
163
+ variant === "tabs"
164
+ ? "border-b -mb-px flex space-x-4"
165
+ : "flex space-x-2 p-1 rounded-md",
159
166
  className
160
167
  )}
161
168
  {...props}
@@ -168,8 +175,9 @@ const TabsTrigger = React.forwardRef<
168
175
  React.ElementRef<typeof TabsPrimitive.Trigger>,
169
176
  React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
170
177
  href?: string;
178
+ variant?: "tabs" | "pills";
171
179
  }
172
- >(({ className, href, ...props }, ref) => {
180
+ >(({ className, href, variant = "tabs", ...props }, ref) => {
173
181
  const { size } = React.useContext(TabsContext);
174
182
 
175
183
  const handleClick = React.useCallback((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
@@ -186,10 +194,19 @@ const TabsTrigger = React.forwardRef<
186
194
  <TabsPrimitive.Trigger
187
195
  ref={ref}
188
196
  className={cn(
189
- "border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer",
190
- "border-transparent text-muted-foreground hover:border-border hover:text-foreground",
191
- "data-[state=active]:border-primary data-[state=active]:text-primary",
192
- "disabled:pointer-events-none disabled:opacity-50",
197
+ variant === "tabs"
198
+ ? cn(
199
+ "border-b-2 px-2 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer",
200
+ "border-transparent text-muted-foreground hover:border-border hover:text-foreground",
201
+ "data-[state=active]:border-primary data-[state=active]:text-primary",
202
+ "disabled:pointer-events-none disabled:opacity-50"
203
+ )
204
+ : cn(
205
+ "px-3 py-1.5 text-sm font-medium whitespace-nowrap cursor-pointer rounded-sm transition-colors",
206
+ "tborder border-input bg-muted shadow-xs hover:bg-muted ring-inset",
207
+ "data-[state=active]:bg-primary data-[state=active]:text-white data-[state=active]:shadow-sm",
208
+ "disabled:pointer-events-none disabled:opacity-50"
209
+ ),
193
210
  className,
194
211
  size ? `w-1/${size}` : ""
195
212
  )}
@@ -20,6 +20,8 @@ const initialState: ThemeProviderState = {
20
20
 
21
21
  const ThemeProviderContext = createContext<ThemeProviderState>(initialState)
22
22
 
23
+ export { ThemeProviderContext }
24
+
23
25
  export function ThemeProvider({
24
26
  children,
25
27
  defaultTheme = "system",
@@ -62,6 +62,7 @@ export class UserPermissions {
62
62
  }
63
63
 
64
64
  const UserPermissionsContext = createContext<UserPermissions | undefined>(undefined)
65
+ export { UserPermissionsContext }
65
66
 
66
67
  export function useUserPermissions() {
67
68
  const perms = useContext(UserPermissionsContext);
@@ -0,0 +1,73 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { useUserSession } from "@vertesia/ui/session";
3
+
4
+ interface TenantConfig {
5
+ tenantKey: string;
6
+ name: string;
7
+ domain: string[];
8
+ firebaseTenantId: string;
9
+ provider?: string;
10
+ logo?: string;
11
+ }
12
+
13
+ export function useCurrentTenant() {
14
+ const { user } = useUserSession();
15
+ const [currentTenant, setCurrentTenant] = useState<TenantConfig | null>(null);
16
+ const [isLoading, setIsLoading] = useState(true);
17
+ const [error, setError] = useState<string | null>(null);
18
+
19
+ useEffect(() => {
20
+ const loadCurrentTenant = async () => {
21
+ if (!user?.email) {
22
+ setCurrentTenant(null);
23
+ setIsLoading(false);
24
+ return;
25
+ }
26
+
27
+ try {
28
+ const response = await fetch('/api/resolve-tenant', {
29
+ method: 'POST',
30
+ headers: {
31
+ 'Content-Type': 'application/json',
32
+ },
33
+ body: JSON.stringify({
34
+ tenantEmail: user.email
35
+ })
36
+ });
37
+
38
+ if (response.ok) {
39
+ const tenantData = await response.json();
40
+ if (tenantData) {
41
+ // Convert the resolved tenant data to our TenantConfig format
42
+ setCurrentTenant({
43
+ tenantKey: tenantData.name || 'unknown',
44
+ name: tenantData.label || tenantData.name || 'Unknown',
45
+ domain: tenantData.domain || [],
46
+ firebaseTenantId: tenantData.firebaseTenantId,
47
+ provider: tenantData.provider,
48
+ logo: tenantData.logo
49
+ });
50
+ } else {
51
+ setCurrentTenant(null);
52
+ }
53
+ } else {
54
+ setCurrentTenant(null);
55
+ }
56
+ } catch (error) {
57
+ console.error('Error loading current tenant:', error);
58
+ setError('Failed to load tenant configuration');
59
+ setCurrentTenant(null);
60
+ } finally {
61
+ setIsLoading(false);
62
+ }
63
+ };
64
+
65
+ loadCurrentTenant();
66
+ }, [user?.email]);
67
+
68
+ return {
69
+ currentTenant,
70
+ isLoading,
71
+ error
72
+ };
73
+ }
@@ -1,4 +1,5 @@
1
1
  export * from "./auth/composable";
2
+ export * from "./auth/useCurrentTenant";
2
3
  export * from "./auth/firebase";
3
4
  export * from "./TypeRegistry";
4
5
  export * from "./UserSession";