refactor(email): remove frontend invite email; be-crm sends it now

Per AppShell, email delivery lives in the domain API. Delete the frontend
/api/email/invite route + invite-email template, and the team-management email
wiring. be-crm now emails invitees on create/resend. Copy link stays as a
fallback (invite token still returned in the pending-invite list).
This commit is contained in:
tanweer919
2026-07-14 15:38:53 +05:30
parent 1a2043eaae
commit 9eb234935d
4 changed files with 11 additions and 175 deletions
+7 -16
View File
@@ -48,10 +48,10 @@ export interface TeamData {
setMemberRoles: (id: string, roleIds: string[]) => Promise<void>;
updateMember: (id: string, patch: { title?: string; roleIds?: string[] }) => Promise<void>;
removeMember: (id: string) => Promise<void>;
/** Create an invite; resolves with the accept token so the caller can email the link. */
invite: (email: string, roleIds: string[]) => Promise<{ token?: string }>;
/** Resend an invite (regenerates the token); resolves with the fresh token. */
resendInvite: (id: string) => Promise<{ token?: string }>;
/** Create an invite. be-crm emails the invitee automatically. */
invite: (email: string, roleIds: string[]) => Promise<void>;
/** Resend an invite (regenerates the token + re-emails it). */
resendInvite: (id: string) => Promise<void>;
revokeInvite: (id: string) => Promise<void>;
setPermission: (roleId: string, permId: string, granted: boolean) => Promise<void>;
refetch: () => void;
@@ -117,9 +117,8 @@ function useMockTeam(): TeamData {
const removeMember = useCallback(async (id: string) => { setMembers((l) => l.filter((m) => m.id !== id)); }, []);
const invite = useCallback(async (email: string, roleIds: string[]) => {
setInvites((l) => [{ id: `inv_${Date.now()}`, email, roleIds, invitedBy: "James Carter", sentAt: "Just now" }, ...l]);
return {};
}, []);
const resendInvite = useCallback(async () => ({}), []);
const resendInvite = useCallback(async () => {}, []);
const revokeInvite = useCallback(async (id: string) => { setInvites((l) => l.filter((i) => i.id !== id)); }, []);
const setPermission = useCallback(async (roleId: string, permId: string, granted: boolean) => {
setRoles((l) => l.map((r) => (r.id !== roleId ? r : {
@@ -191,16 +190,8 @@ function useLiveTeam(): TeamData {
id, ...(patch.title !== undefined ? { jobTitle: patch.title } : {}), ...(patch.roleIds ? { roleIds: patch.roleIds } : {}),
}),
removeMember: (id) => cmd("crm.team.member.remove", { id }),
invite: async (email, roleIds) => {
const dto = (await sdk.command("crm.team.invitation.create", { email, roleIds })) as { token?: string } | undefined;
refetch();
return { token: dto?.token };
},
resendInvite: async (id) => {
const res = (await sdk.command("crm.team.invitation.resend", { id })) as { token?: string } | undefined;
refetch();
return { token: res?.token };
},
invite: (email, roleIds) => cmd("crm.team.invitation.create", { email, roleIds }),
resendInvite: (id) => cmd("crm.team.invitation.resend", { id }),
revokeInvite: (id) => cmd("crm.team.invitation.revoke", { id }),
setPermission: (roleId, permId, granted) =>
cmd(granted ? "crm.team.role.addPermission" : "crm.team.role.removePermission", { id: roleId, permissionId: permId }),