feat: cloud and ee (#805)

* stripe init
git submodules for enterprise modules

* * Cloud billing UI - WIP
* Proxy websockets in dev mode
* Separate workspace login and creation for cloud
* Other fixes

* feat: billing (cloud)

* * add domain service
* prepare links from workspace hostname

* WIP

* Add exchange token generation
* Validate JWT token type during verification

* domain service

* add SkipTransform decorator

* * updates (server)
* add new packages
* new sso migration file

* WIP

* Fix hostname generation

* WIP

* WIP

* Reduce input error font-size
* set max password length

* jwt package

* license page - WIP

* * License management UI
* Move license key store to db

* add reflector

* SSO enforcement

* * Add default plan
* Add usePlan hook

* * Fix auth container margin in mobile
* Redirect login and home to select page in cloud

* update .gitignore

* Default to yearly

* * Trial messaging
* Handle ended trials

* Don't set to readonly on collab disconnect (Cloud)

* Refine trial (UI)
* Fix bug caused by using jotai optics atom in AppHeader component

* configurable database maximum pool

* Close SSO form on save

* wip

* sync

* Only show sign-in in cloud

* exclude base api part from workspaceId check

* close db connection beforeApplicationShutdown

* Add health/live endpoint

* clear cookie on hostname change

* reset currentUser atom

* Change text

* return 401 if workspace does not match

* feat: show user workspace list in cloud login page

* sync

* Add home path

* Prefetch to speed up queries

* * Add robots.txt
* Disallow login and forgot password routes

* wildcard user-agent

* Fix space query cache

* fix

* fix

* use space uuid for recent pages

* prefetch billing plans

* enhance license page

* sync
This commit is contained in:
Philip Okugbe
2025-03-06 13:38:37 +00:00
committed by GitHub
parent 91596be70e
commit b81c9ee10c
148 changed files with 8947 additions and 3458 deletions

View File

@ -11,6 +11,7 @@ import { notifications } from "@mantine/notifications";
import { useClipboard } from "@mantine/hooks";
import { getInviteLink } from "@/features/workspace/services/workspace-service.ts";
import useUserRole from "@/hooks/use-user-role.tsx";
import { isCloud } from "@/lib/config.ts";
interface Props {
invitationId: string;
@ -76,13 +77,16 @@ export default function InviteActionMenu({ invitationId }: Props) {
</Menu.Target>
<Menu.Dropdown>
<Menu.Item
onClick={() => handleCopyLink(invitationId)}
leftSection={<IconCopy size={16} />}
disabled={!isAdmin}
>
{t("Copy link")}
</Menu.Item>
{!isCloud() && (
<Menu.Item
onClick={() => handleCopyLink(invitationId)}
leftSection={<IconCopy size={16} />}
disabled={!isAdmin}
>
{t("Copy link")}
</Menu.Item>
)}
<Menu.Item
onClick={onResend}
leftSection={<IconSend size={16} />}

View File

@ -9,12 +9,13 @@ export default function WorkspaceInviteSection() {
const [currentUser] = useAtom(currentUserAtom);
const [inviteLink, setInviteLink] = useState<string>("");
/*
useEffect(() => {
setInviteLink(
`${window.location.origin}/invite/${currentUser.workspace.inviteCode}`,
);
}, [currentUser.workspace.inviteCode]);
*/
return (
<>
<div>

View File

@ -1,8 +1,7 @@
import { currentUserAtom } from "@/features/user/atoms/current-user-atom.ts";
import { workspaceAtom } from "@/features/user/atoms/current-user-atom.ts";
import { useAtom } from "jotai";
import * as z from "zod";
import { useState } from "react";
import { focusAtom } from "jotai-optics";
import { updateWorkspace } from "@/features/workspace/services/workspace-service.ts";
import { IWorkspace } from "@/features/workspace/types/workspace.types.ts";
import { TextInput, Button } from "@mantine/core";
@ -17,21 +16,16 @@ const formSchema = z.object({
type FormValues = z.infer<typeof formSchema>;
const workspaceAtom = focusAtom(currentUserAtom, (optic) =>
optic.prop("workspace"),
);
export default function WorkspaceNameForm() {
const { t } = useTranslation();
const [isLoading, setIsLoading] = useState(false);
const [currentUser] = useAtom(currentUserAtom);
const [, setWorkspace] = useAtom(workspaceAtom);
const [workspace, setWorkspace] = useAtom(workspaceAtom);
const { isAdmin } = useUserRole();
const form = useForm<FormValues>({
validate: zodResolver(formSchema),
initialValues: {
name: currentUser?.workspace?.name,
name: workspace?.name,
},
});
@ -39,7 +33,7 @@ export default function WorkspaceNameForm() {
setIsLoading(true);
try {
const updatedWorkspace = await updateWorkspace(data);
const updatedWorkspace = await updateWorkspace({ name: data.name });
setWorkspace(updatedWorkspace);
notifications.show({ message: t("Updated successfully") });
} catch (err) {

View File

@ -21,6 +21,7 @@ import { notifications } from "@mantine/notifications";
import {
ICreateInvite,
IInvitation,
IPublicWorkspace,
IWorkspace,
} from "@/features/workspace/types/workspace.types.ts";
import { IUser } from "@/features/user/types/user.types.ts";
@ -34,7 +35,7 @@ export function useWorkspaceQuery(): UseQueryResult<IWorkspace, Error> {
}
export function useWorkspacePublicDataQuery(): UseQueryResult<
IWorkspace,
IPublicWorkspace,
Error
> {
return useQuery({

View File

@ -5,17 +5,26 @@ import {
IInvitation,
IWorkspace,
IAcceptInvite,
IPublicWorkspace,
IInvitationLink,
} from "../types/workspace.types";
import { IPagination, QueryParams } from "@/lib/types.ts";
import { ISetupWorkspace } from "@/features/auth/types/auth.types.ts";
export async function getWorkspace(): Promise<IWorkspace> {
const req = await api.post<IWorkspace>("/workspace/info");
return req.data;
}
export async function getWorkspacePublicData(): Promise<IWorkspace> {
const req = await api.post<IWorkspace>("/workspace/public");
export async function getWorkspacePublicData(): Promise<IPublicWorkspace> {
const req = await api.post<IPublicWorkspace>("/workspace/public");
return req.data;
}
export async function getCheckHostname(
hostname: string,
): Promise<{ hostname: string }> {
const req = await api.post("/workspace/check-hostname", { hostname });
return req.data;
}
@ -81,6 +90,13 @@ export async function getInvitationById(data: {
return req.data;
}
export async function createWorkspace(
data: ISetupWorkspace,
): Promise<{ workspace: IWorkspace } & { exchangeToken: string }> {
const req = await api.post("/workspace/create", data);
return req.data;
}
export async function uploadLogo(file: File) {
const formData = new FormData();
formData.append("type", "workspace-logo");

View File

@ -1,3 +1,5 @@
import { IAuthProvider } from "@/ee/security/types/security.types.ts";
export interface IWorkspace {
id: string;
name: string;
@ -7,10 +9,17 @@ export interface IWorkspace {
defaultSpaceId: string;
customDomain: string;
enableInvite: boolean;
inviteCode: string;
settings: any;
status: string;
enforceSso: boolean;
billingEmail: string;
trialEndAt: Date;
createdAt: Date;
updatedAt: Date;
emailDomains: string[];
memberCount?: number;
plan?: string;
hasLicenseKey?: boolean;
}
export interface ICreateInvite {
@ -38,3 +47,13 @@ export interface IAcceptInvite {
password: string;
token: string;
}
export interface IPublicWorkspace {
id: string;
name: string;
logo: string;
hostname: string;
enforceSso: boolean;
authProviders: IAuthProvider[];
hasLicenseKey?: boolean;
}