@vertesia/ui 0.79.3 → 0.79.4

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 (77) hide show
  1. package/lib/esm/core/components/MenuList.js +2 -5
  2. package/lib/esm/core/components/MenuList.js.map +1 -1
  3. package/lib/esm/core/components/shadcn/dialog.js +16 -2
  4. package/lib/esm/core/components/shadcn/dialog.js.map +1 -1
  5. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js +6 -9
  6. package/lib/esm/core/components/shadcn/filters/filter/SelectFilter.js.map +1 -1
  7. package/lib/esm/core/components/shadcn/filters/filterBar.js +1 -1
  8. package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
  9. package/lib/esm/core/components/shadcn/selectBox.js +1 -1
  10. package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
  11. package/lib/esm/env/index.js +4 -1
  12. package/lib/esm/env/index.js.map +1 -1
  13. package/lib/esm/features/facets/CollectionsFacetsNav.js +5 -1
  14. package/lib/esm/features/facets/CollectionsFacetsNav.js.map +1 -1
  15. package/lib/esm/features/layout/GenericPageNavHeader.js +5 -2
  16. package/lib/esm/features/layout/GenericPageNavHeader.js.map +1 -1
  17. package/lib/esm/features/store/collections/EditCollectionView.js +1 -1
  18. package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
  19. package/lib/esm/features/store/objects/DocumentSearchResults.js +2 -1
  20. package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
  21. package/lib/esm/router/HistoryNavigator.js +22 -2
  22. package/lib/esm/router/HistoryNavigator.js.map +1 -1
  23. package/lib/esm/shell/login/UserInfo.js +2 -1
  24. package/lib/esm/shell/login/UserInfo.js.map +1 -1
  25. package/lib/esm/shell/login/UserSessionMenu.js +7 -1
  26. package/lib/esm/shell/login/UserSessionMenu.js.map +1 -1
  27. package/lib/esm/widgets/form/Form.js +5 -1
  28. package/lib/esm/widgets/form/Form.js.map +1 -1
  29. package/lib/esm/widgets/schema-editor/ManagedSchema.js +0 -3
  30. package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -1
  31. package/lib/esm/widgets/schema-editor/json-schema4-utils.js +1 -1
  32. package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -1
  33. package/lib/tsconfig.tsbuildinfo +1 -1
  34. package/lib/types/core/components/shadcn/dialog.d.ts +2 -1
  35. package/lib/types/core/components/shadcn/dialog.d.ts.map +1 -1
  36. package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
  37. package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
  38. package/lib/types/env/index.d.ts +3 -1
  39. package/lib/types/env/index.d.ts.map +1 -1
  40. package/lib/types/features/facets/CollectionsFacetsNav.d.ts.map +1 -1
  41. package/lib/types/features/layout/GenericPageNavHeader.d.ts.map +1 -1
  42. package/lib/types/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  43. package/lib/types/router/HistoryNavigator.d.ts +3 -0
  44. package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
  45. package/lib/types/shell/login/UserInfo.d.ts.map +1 -1
  46. package/lib/types/shell/login/UserSessionMenu.d.ts.map +1 -1
  47. package/lib/types/widgets/form/Form.d.ts.map +1 -1
  48. package/lib/types/widgets/schema-editor/ManagedSchema.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-env.js +1 -1
  52. package/lib/vertesia-ui-env.js.map +1 -1
  53. package/lib/vertesia-ui-features.js +1 -1
  54. package/lib/vertesia-ui-features.js.map +1 -1
  55. package/lib/vertesia-ui-router.js +1 -1
  56. package/lib/vertesia-ui-router.js.map +1 -1
  57. package/lib/vertesia-ui-shell.js +1 -1
  58. package/lib/vertesia-ui-shell.js.map +1 -1
  59. package/lib/vertesia-ui-widgets.js +1 -1
  60. package/lib/vertesia-ui-widgets.js.map +1 -1
  61. package/package.json +7 -7
  62. package/src/core/components/MenuList.tsx +3 -6
  63. package/src/core/components/shadcn/dialog.tsx +19 -1
  64. package/src/core/components/shadcn/filters/filter/SelectFilter.tsx +31 -31
  65. package/src/core/components/shadcn/filters/filterBar.tsx +1 -0
  66. package/src/core/components/shadcn/selectBox.tsx +1 -0
  67. package/src/env/index.ts +7 -2
  68. package/src/features/facets/CollectionsFacetsNav.tsx +5 -1
  69. package/src/features/layout/GenericPageNavHeader.tsx +5 -2
  70. package/src/features/store/collections/EditCollectionView.tsx +2 -2
  71. package/src/features/store/objects/DocumentSearchResults.tsx +2 -1
  72. package/src/router/HistoryNavigator.ts +30 -2
  73. package/src/shell/login/UserInfo.tsx +2 -0
  74. package/src/shell/login/UserSessionMenu.tsx +12 -1
  75. package/src/widgets/form/Form.tsx +6 -1
  76. package/src/widgets/schema-editor/ManagedSchema.ts +0 -3
  77. package/src/widgets/schema-editor/json-schema4-utils.ts +1 -1
@@ -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","esm/shell/apps/AppInstallationProvider.js","esm/shell/apps/AppProjectSelector.js","esm/shell/apps/StandaloneApp.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] }), invite.data.invited_by && _jsxs(\"div\", { className: \"text-xs\", children: [\"by \", invite.data.invited_by.name ?? invite.data.invited_by] })] }), _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 if (!Env.firebase) {\n throw new Error(\"Firebase configuration is not available in the environment\");\n }\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, updateHash: false, 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 { createContext, useContext } from \"react\";\nexport const AppInstallationContext = createContext(null);\nexport function AppInstallationProvider({ installation, children }) {\n return (_jsx(AppInstallationContext.Provider, { value: installation, children: children }));\n}\n/**\n * Get the current app installation obejct when called in an app context otheriwse returns null\n */\nexport function useAppInstallation() {\n return useContext(AppInstallationContext);\n}\n//# sourceMappingURL=AppInstallationProvider.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { SelectBox, useFetch } from \"@vertesia/ui/core\";\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, useUserSession } from \"@vertesia/ui/session\";\nimport { useState } from \"react\";\nexport function AppProjectSelector({ app, onChange, placeholder }) {\n const { client, project } = useUserSession();\n const { data: projects, error } = useFetch(() => {\n return client.apps.getAppInstallationProjects(app);\n }, [app.id, app.name]);\n const _onChange = (project) => {\n if (onChange) {\n if (!onChange(project)) {\n // if onChange returns true then the defualt on change is called\n return;\n }\n }\n // default on change\n localStorage.setItem(LastSelectedAccountId_KEY, project.account);\n localStorage.setItem(LastSelectedProjectId_KEY + '-' + project.account, project.id);\n window.location.reload();\n };\n if (error) {\n return _jsxs(\"span\", { className: 'text-red-600', children: [\"Error: failed to fetch projects: \", error.message] });\n }\n return _jsx(SelectProject, { placeholder: placeholder, initialValue: project?.id, projects: projects || [], onChange: _onChange });\n}\nfunction SelectProject({ initialValue, projects, onChange, placeholder = \"Select Project\" }) {\n const [value, setValue] = useState();\n const _onChange = (value) => {\n setValue(value);\n onChange(value);\n };\n let actualValue = !value && initialValue ? projects.find(p => p.id === initialValue) : value;\n return (_jsx(SelectBox, { by: \"id\", value: actualValue, options: projects, optionLabel: (option) => option.name, placeholder: placeholder, onChange: _onChange }));\n}\n//# sourceMappingURL=AppProjectSelector.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Center } from \"@vertesia/ui/core\";\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, useUserSession } from \"@vertesia/ui/session\";\nimport { LockIcon } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { AppInstallationProvider } from \"./AppInstallationProvider\";\nimport { AppProjectSelector } from \"./AppProjectSelector\";\nexport function StandaloneApp({ name, AccessDenied = AccessDeniedMessage, children }) {\n return name ? (_jsx(StandaloneAppImpl, { name: name, AccessDenied: AccessDenied, children: children })) : (_jsx(UnknownAppName, {}));\n}\nexport function StandaloneAppImpl({ name, AccessDenied = AccessDeniedMessage, children }) {\n const { authToken, client } = useUserSession();\n const [installation, setInstallation] = useState(null);\n const [state, setState] = useState(\"loading\");\n useEffect(() => {\n if (!authToken) {\n setState(\"loading\");\n }\n else {\n const isAppVisible = authToken.apps.includes(name);\n if (isAppVisible) {\n client.apps.getAppInstallationByName(name).then(inst => {\n if (!inst) {\n console.log(`App ${name} not found!`);\n setState(\"error\");\n }\n else {\n setState(\"loaded\");\n setInstallation(inst);\n }\n });\n }\n else {\n setState(\"error\");\n }\n }\n }, [name, authToken]);\n if (state === \"loading\") {\n return null;\n }\n else if (state === \"error\") {\n return _jsx(AccessDenied, { name: name });\n }\n else if (installation) {\n return _jsx(AppInstallationProvider, { installation: installation, children: children });\n }\n}\nfunction AccessDeniedMessage({ name }) {\n const { project } = useUserSession();\n const onChange = (project) => {\n localStorage.setItem(LastSelectedAccountId_KEY, project.account);\n localStorage.setItem(LastSelectedProjectId_KEY + '-' + project.account, project.id);\n window.location.reload();\n };\n return (_jsxs(Center, { className: \"pt-10 flex flex-col items-center text-center text-gray-700\", children: [_jsx(LockIcon, { className: \"w-10 h-10 mb-4 text-gray-500\" }), _jsx(\"div\", { className: \"text-xl font-semibold\", children: \"Access Denied\" }), _jsxs(\"div\", { className: \"mt-2 text-sm text-gray-500\", children: [\"You don't have permission to view the \", _jsx(\"span\", { className: \"font-semibold\", children: name }), \" app in project: \", _jsxs(\"span\", { className: \"font-semibold\", children: [\"\\u00AB\", project?.name, \"\\u00BB\"] }), \".\"] }), _jsx(\"div\", { className: \"mt-4\", children: _jsx(AppProjectSelector, { app: { name }, onChange: onChange }) })] }));\n}\nfunction UnknownAppName() {\n return (_jsxs(Center, { className: \"pt-10 flex flex-col items-center text-center text-gray-700\", children: [_jsx(LockIcon, { className: \"w-10 h-10 mb-4 text-gray-500\" }), _jsx(\"div\", { className: \"text-xl font-semibold\", children: \"Application not registered\" }), _jsxs(\"div\", { className: \"mt-2 text-sm text-gray-500\", children: [\"Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.\", _jsx(\"p\", {}), \"Then use the created app name as a parameter to \", _jsx(\"code\", { children: \"<StandaloneApp name=\\\"your-app-name\\\">\" }), \" in the \", _jsx(\"code\", { children: \"src/main.tsx\" }), \" file.\"] })] }));\n}\n//# sourceMappingURL=StandaloneApp.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","invited_by","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","Error","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","updateHash","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","AppInstallationContext","createContext","AppInstallationProvider","installation","Provider","useAppInstallation","useContext","AppProjectSelector","app","apps","getAppInstallationProjects","initialValue","LastSelectedAccountId_KEY","LastSelectedProjectId_KEY","reload","setValue","actualValue","StandaloneApp","AccessDenied","AccessDeniedMessage","StandaloneAppImpl","UnknownAppName","setInstallation","state","setState","includes","getAppInstallationByName","inst","LockIcon"],"mappings":"62CAIO,SAASA,KACZ,MAAMC,EAAUC,KACVC,OAAEA,EAAMC,QAAEA,GAAYH,GACrBI,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAAcF,EAAS,IACvCG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oDA,EAAK,OAAQ,CAAED,SAAU,yCAA6C,WAAYC,EAAK,OAAQ,CAAED,SAAU,iBAAmB,cACxqB"}
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/AppInstallationProvider.js","esm/shell/apps/AppProjectSelector.js","esm/shell/apps/StandaloneApp.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] }), invite.data.invited_by && _jsxs(\"div\", { className: \"text-xs\", children: [\"by \", invite.data.invited_by.name ?? invite.data.invited_by] })] }), _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 if (!Env.firebase) {\n throw new Error(\"Firebase configuration is not available in the environment\");\n }\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\";\n// Package version is now passed as prop from the consuming application\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 }), _jsx(InfoItems, { title: \"SDK Version\", value: Env.sdkVersion || 'unknown' })] })\n }\n ];\n return (_jsx(\"div\", { className: \"w-full\", children: _jsxs(VTabs, { defaultValue: \"user\", tabs: tabs, fullWidth: true, updateHash: false, 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 { Permission } from \"@vertesia/common\";\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\";\nimport { useNavigate } from \"@vertesia/ui/router\";\nimport { useUserPermissions } from \"@vertesia/ui/features\";\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 navigate = useNavigate();\n const perms = useUserPermissions();\n const { user } = session;\n if (!session || !user)\n return null;\n const isProjectManager = perms.hasPermission(Permission.project_admin);\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: _jsxs(MenuList, { children: [isProjectManager && (_jsx(MenuList.Item, { className: 'px-2', onClick: () => navigate('/settings', { replace: true }), children: \"Settings\" })), _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 { createContext, useContext } from \"react\";\nexport const AppInstallationContext = createContext(null);\nexport function AppInstallationProvider({ installation, children }) {\n return (_jsx(AppInstallationContext.Provider, { value: installation, children: children }));\n}\n/**\n * Get the current app installation obejct when called in an app context otheriwse returns null\n */\nexport function useAppInstallation() {\n return useContext(AppInstallationContext);\n}\n//# sourceMappingURL=AppInstallationProvider.js.map","import { jsxs as _jsxs, jsx as _jsx } from \"react/jsx-runtime\";\nimport { SelectBox, useFetch } from \"@vertesia/ui/core\";\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, useUserSession } from \"@vertesia/ui/session\";\nimport { useState } from \"react\";\nexport function AppProjectSelector({ app, onChange, placeholder }) {\n const { client, project } = useUserSession();\n const { data: projects, error } = useFetch(() => {\n return client.apps.getAppInstallationProjects(app);\n }, [app.id, app.name]);\n const _onChange = (project) => {\n if (onChange) {\n if (!onChange(project)) {\n // if onChange returns true then the defualt on change is called\n return;\n }\n }\n // default on change\n localStorage.setItem(LastSelectedAccountId_KEY, project.account);\n localStorage.setItem(LastSelectedProjectId_KEY + '-' + project.account, project.id);\n window.location.reload();\n };\n if (error) {\n return _jsxs(\"span\", { className: 'text-red-600', children: [\"Error: failed to fetch projects: \", error.message] });\n }\n return _jsx(SelectProject, { placeholder: placeholder, initialValue: project?.id, projects: projects || [], onChange: _onChange });\n}\nfunction SelectProject({ initialValue, projects, onChange, placeholder = \"Select Project\" }) {\n const [value, setValue] = useState();\n const _onChange = (value) => {\n setValue(value);\n onChange(value);\n };\n let actualValue = !value && initialValue ? projects.find(p => p.id === initialValue) : value;\n return (_jsx(SelectBox, { by: \"id\", value: actualValue, options: projects, optionLabel: (option) => option.name, placeholder: placeholder, onChange: _onChange }));\n}\n//# sourceMappingURL=AppProjectSelector.js.map","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { Center } from \"@vertesia/ui/core\";\nimport { LastSelectedAccountId_KEY, LastSelectedProjectId_KEY, useUserSession } from \"@vertesia/ui/session\";\nimport { LockIcon } from \"lucide-react\";\nimport { useEffect, useState } from \"react\";\nimport { AppInstallationProvider } from \"./AppInstallationProvider\";\nimport { AppProjectSelector } from \"./AppProjectSelector\";\nexport function StandaloneApp({ name, AccessDenied = AccessDeniedMessage, children }) {\n return name ? (_jsx(StandaloneAppImpl, { name: name, AccessDenied: AccessDenied, children: children })) : (_jsx(UnknownAppName, {}));\n}\nexport function StandaloneAppImpl({ name, AccessDenied = AccessDeniedMessage, children }) {\n const { authToken, client } = useUserSession();\n const [installation, setInstallation] = useState(null);\n const [state, setState] = useState(\"loading\");\n useEffect(() => {\n if (!authToken) {\n setState(\"loading\");\n }\n else {\n const isAppVisible = authToken.apps.includes(name);\n if (isAppVisible) {\n client.apps.getAppInstallationByName(name).then(inst => {\n if (!inst) {\n console.log(`App ${name} not found!`);\n setState(\"error\");\n }\n else {\n setState(\"loaded\");\n setInstallation(inst);\n }\n });\n }\n else {\n setState(\"error\");\n }\n }\n }, [name, authToken]);\n if (state === \"loading\") {\n return null;\n }\n else if (state === \"error\") {\n return _jsx(AccessDenied, { name: name });\n }\n else if (installation) {\n return _jsx(AppInstallationProvider, { installation: installation, children: children });\n }\n}\nfunction AccessDeniedMessage({ name }) {\n const { project } = useUserSession();\n const onChange = (project) => {\n localStorage.setItem(LastSelectedAccountId_KEY, project.account);\n localStorage.setItem(LastSelectedProjectId_KEY + '-' + project.account, project.id);\n window.location.reload();\n };\n return (_jsxs(Center, { className: \"pt-10 flex flex-col items-center text-center text-gray-700\", children: [_jsx(LockIcon, { className: \"w-10 h-10 mb-4 text-gray-500\" }), _jsx(\"div\", { className: \"text-xl font-semibold\", children: \"Access Denied\" }), _jsxs(\"div\", { className: \"mt-2 text-sm text-gray-500\", children: [\"You don't have permission to view the \", _jsx(\"span\", { className: \"font-semibold\", children: name }), \" app in project: \", _jsxs(\"span\", { className: \"font-semibold\", children: [\"\\u00AB\", project?.name, \"\\u00BB\"] }), \".\"] }), _jsx(\"div\", { className: \"mt-4\", children: _jsx(AppProjectSelector, { app: { name }, onChange: onChange }) })] }));\n}\nfunction UnknownAppName() {\n return (_jsxs(Center, { className: \"pt-10 flex flex-col items-center text-center text-gray-700\", children: [_jsx(LockIcon, { className: \"w-10 h-10 mb-4 text-gray-500\" }), _jsx(\"div\", { className: \"text-xl font-semibold\", children: \"Application not registered\" }), _jsxs(\"div\", { className: \"mt-2 text-sm text-gray-500\", children: [\"Before starting to code a Vertesia application you must register an application manifest in Vertesia Studio then install it in one or more projects.\", _jsx(\"p\", {}), \"Then use the created app name as a parameter to \", _jsx(\"code\", { children: \"<StandaloneApp name=\\\"your-app-name\\\">\" }), \" in the \", _jsx(\"code\", { children: \"src/main.tsx\" }), \" file.\"] })] }));\n}\n//# sourceMappingURL=StandaloneApp.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","invited_by","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","Error","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","sdkVersion","VTabs","defaultValue","fullWidth","updateHash","VTabsBar","VTabsPanel","UserSessionMenu","UserSessionPopup","asMenuTrigger","navigate","useNavigate","perms","useUserPermissions","isProjectManager","hasPermission","Permission","project_admin","Popover","strategy","Trigger","click","Avatar","color","shape","Content","ModeToggle","MenuList","Item","replace","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","AppInstallationContext","createContext","AppInstallationProvider","installation","Provider","useAppInstallation","useContext","AppProjectSelector","app","apps","getAppInstallationProjects","initialValue","LastSelectedAccountId_KEY","LastSelectedProjectId_KEY","reload","setValue","actualValue","StandaloneApp","AccessDenied","AccessDeniedMessage","StandaloneAppImpl","UnknownAppName","setInstallation","state","setState","includes","getAppInstallationByName","inst","LockIcon"],"mappings":"y6CAIO,SAASA,KACZ,MAAMC,EAAUC,KACVC,OAAEA,EAAMC,QAAEA,GAAYH,GACrBI,EAAWC,GAAgBC,GAAS,IACpCC,EAASC,GAAcF,EAAS,IACvCG,GAAU,KACNP,EAAOC,QAAQO,cAAcC,MAAKJ,IAC9B,GAAIA,EAAQK,OAAS,EAAG,CAEpB,MAAMC,EAAmBN,EAAQO,QAAO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