/** * Narrow API-surface interfaces for the shared TeamSettingsPage / * DomainsSettingsPage composers. * * Apps pass in the @startsimpli/api `api` instance and these interfaces * structurally describe the slice the pages actually use. Keeping the slice * shape inline here means @startsimpli/ui does NOT depend on @startsimpli/api * directly. startsim-o7s. */ import type { InvitationLite, MemberRow, TeamRole, DomainClaimLite, } from '../types' /** A page-level `member` row hits the API as-is — keep the shape thin. */ export interface ApiMember { id: string userId: string teamId: string role: TeamRole joinedAt: string user?: MemberRow['user'] } /** Paginated wrapper used by @startsimpli/api list endpoints. */ export interface ApiPaginated { count?: number next?: string | null previous?: string | null results: T[] } /** A team membership row from /team-members/my-teams/. */ export interface ApiMyTeamMembership { id: string userId: string teamId: string role: TeamRole joinedAt: string team?: { id: string slug: string name: string companyId: string } } /** A team row from /teams/{idOrSlug}/. */ export interface ApiTeam { id: string slug: string name: string companyId: string } /** A company row from /companies/{idOrSlug}/. */ export interface ApiCompany { id: string slug: string name: string } /** An invitation row from /team-invitations/. */ export interface ApiInvitation extends InvitationLite { createdAt: string } /** A domain-claim row from /team-domain-claims/. */ export interface ApiDomainClaim extends DomainClaimLite {} /** * Minimum API surface the TeamSettingsPage composer needs. The real * @startsimpli/api `api` instance satisfies this structurally. */ export interface TeamSettingsApi { teams: { myTeams: () => Promise retrieve: (idOrSlug: string) => Promise members: (idOrSlug: string) => Promise updateRole: ( idOrSlug: string, userId: string, role: TeamRole, ) => Promise removeMember: (idOrSlug: string, userId: string) => Promise bulkInvite: ( idOrSlug: string, invitations: Array<{ email: string; role: TeamRole }>, ) => Promise<{ invited: ApiInvitation[] skipped?: Array<{ email: string; reason: string }> }> } teamInvitations: { list: (params: { teamId: string }) => Promise> create: (input: { email: string teamId: string role: TeamRole }) => Promise revoke: (id: string) => Promise } companies: { retrieve: (idOrSlug: string) => Promise } } /** * Minimum API surface the DomainsSettingsPage composer needs. The real * @startsimpli/api `api` instance satisfies this structurally. */ export interface DomainsSettingsApi { domainClaims: { list: (params: { companyId: string }) => Promise> create: (input: { companyId: string domain: string }) => Promise verifyDns: (id: string) => Promise verifyEmailInitiate: (id: string) => Promise<{ detail: string }> verifyEmailCode: (id: string, code: string) => Promise revoke: (id: string) => Promise } /** Used to pick the default companyId when the prop is omitted. */ teams: { myTeams: () => Promise retrieve: (idOrSlug: string) => Promise } companies: { retrieve: (idOrSlug: string) => Promise } }