Members

Workspace members, their roles and pending invitations.

Builds and runs automations. Can't change workspace settings.

An invitation link works once, for 7 days.

Pending invitations

2

234 members

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/members

Usage

import type { Outcome } from "./ui/uicontext/components/domain/Outcome.ts"import { type Member, Members } from "./ui/uicontext/components/kit/Members.ts"
const Message = UiSchema.TaggedEnum({	RequestedMemberRole: { person: Schema.String, role: Schema.String },	RequestedRemoveMember: { person: Schema.String },	RequestedInviteMember: { email: Schema.String, role: Schema.String },})export const TeamMembers = (h: Html.H<typeof Message.Type>, people: ReadonlyArray<Member> | null, outcome: Outcome | null) =>	Members(h, {		props: {			people,			roles: [				{ value: "admin", label: "Admin" },				{ value: "member", label: "Member" },			],			me: "ana",			editable: people?.filter((p) => p.id !== "ana").map((p) => p.id) ?? [],			removable: people?.filter((p) => p.id !== "ana").map((p) => p.id) ?? [],			invite: { roles: ["member", "admin"] },			outcome,		},		onEmit: {			RequestedRole: ({ person, role }) => Message.RequestedMemberRole({ person, role }),			RequestedRemove: ({ person }) => Message.RequestedRemoveMember({ person }),			RequestedInvite: ({ email, role }) => Message.RequestedInviteMember({ email, role }),			RequestedResend: () => undefined,			RequestedRevoke: () => undefined,		},	})

Examples

As a member

Without editable, removable or invite, roles read as badges and nothing can change.

6 members

A refused change

A refusal shows under the row it is about, in the app's own words.

4 members

API reference

Props

Members props
NameTypeDefaultDescription
peoplerequiredMember[] | null—Null while loading
rolesrequiredMemberRole[]—Every role code people may have, with its label
mestring—The signed-in person's id: "(you)", and never removable from here
editablestring[]—People whose role the viewer may change
removablestring[]—People the viewer may remove
removeNotestring—Said in the remove confirm: "Their automations and connections go to you."
invitationsPendingInvitation[]—Invitations nobody has accepted yet; Resend and Revoke show when invite is given
invite{ roles, note }—The invite form; absent when the viewer can't invite
invitationRedacted | null—The link the app made for the last invitation, shown once
outcomeOutcome | null—The app's answer to the last request: its id is "invite" for RequestedInvite, the person's id for RequestedRole and RequestedRemove, and the invitation's id for RequestedResend and RequestedRevoke. Pending marks that row busy; a refusal shows its reason.
agentIdstringmembersThe id agents know this list by; members by default

Events

Members events
EventPayloadDescription
RequestedInvite{ email: string; role: string }Invite someone by email with a role
RequestedRole{ person: string; role: string }Change a member's role
RequestedRemove{ person: string }Remove a member from the workspace, after the person confirmed
RequestedResend{ invitation: string }Send a pending invitation again, with a fresh link
RequestedRevoke{ invitation: string }Cancel a pending invitation: its link stops working

Agent actions

What agents can do with Members
ActionDescription
UpdatedQuerySearch people by name, email or role; the snapshot lists who matches
ChangedEmailType the email an invitation is for (optional)
ChoseInviteRoleChoose the role an invitation gives (see inviteRoles)
SubmittedInviteasks firstMake an invitation link with the chosen email and role. Target: { email, role }
ChangedRoleasks firstChange a person's role, by id. Target: { person, role } as it is now
ConfirmedRemoveasks firstRemove a person, by id. Target: { person, name }
ClickedResendSend a pending invitation again, by id
ClickedRevokeasks firstRevoke a pending invitation, by id; its link stops working. Target: { invitation, email }

Accessibility

  • Roles are native selects named for the person they change.
  • Removing someone asks first, inline; the invite link is copied with a button that says whether it worked.
  • Refusals are announced, and agents must name the person they remove.

Source