API reference

Account, team and help

Security, pricing, team, profile and help center rules.

Everything in utils/ is a pure function: it takes data and returns data, with no Vue and no global state. Pass the current date as now so results are deterministic. Each file has its unit tests in tests/unit/.

securityChecks()

The checks of the security tab: password age, 2FA, sign-in alerts and recovery phone.

utils/account.ts
securityChecks(security: SecuritySettings, now: Date): { id: SecurityCheckId; ok: boolean; }[]

securityLevel()

A level from the checks.

utils/account.ts
securityLevel(checks: { ok: boolean }[]): "strong" | "good" | "weak"

recoveryCodesLeft()

Unused recovery codes (a code with usedAt no longer works).

utils/account.ts
recoveryCodesLeft(codes: RecoveryCode[]): number

isRecoveryCodesLow()

Whether the unused codes reached RECOVERY_CODES_LOW.

utils/account.ts
isRecoveryCodesLow(codes: RecoveryCode[]): boolean

generateRecoveryCodes()

A new set of XXXX-XXXX codes; pass random for deterministic tests.

utils/account.ts
generateRecoveryCodes(count = RECOVERY_CODE_COUNT, random = Math.random): RecoveryCode[]

passwordAgeDays()

Days since the password changed.

utils/account.ts
passwordAgeDays(security: Pick<SecuritySettings, 'passwordChangedAt'>, now: Date): number

PLAN_ORDER

Plans from lowest to highest.

utils/account.ts
const PLAN_ORDER: PlanId[]

yearlySeatPrice()

Monthly seat price with the yearly discount.

utils/account.ts
yearlySeatPrice(monthlyPrice: number, discount: number): number

yearlySavings()

What a seat saves per year.

utils/account.ts
yearlySavings(monthlyPrice: number, discount: number): number

recommendedPlan()

The next plan up.

utils/account.ts
recommendedPlan(current: PlanId): PlanId | undefined

isDowngrade()

Whether a change is a downgrade.

utils/account.ts
isDowngrade(target: PlanId, current: PlanId): boolean

periodCharge()

The charge of the billing period.

utils/account.ts
periodCharge(seatPrice: number, seats: number, period: Subscription['period']): number

prorationCredit()

The credit left in the current period.

utils/account.ts
prorationCredit(subscription: Pick<Subscription, 'period' | 'renewsAt'>, charge: number, now: Date): number

downgradeImpact()

What a downgrade removes and whether the team fits.

utils/account.ts
downgradeImpact(plan: Pick<PlanModel, 'seatLimit' | 'projectLimit'>, usage: { seatsUsed: number; projects: number; customRoles: number }, options: { credit: number; keepsCustomRoles: boolean }): DowngradeImpact
ReturnsremovedMembersreadOnlyProjectsremovedRolescreditblocked

memberState()

Active, invited or inactive.

utils/team.ts
memberState(member: Pick<TeamMember, 'status' | 'lastActiveAt'>, now: Date): TeamMemberState

memberInviteDaysLeft()

Days before an invitation expires.

utils/team.ts
memberInviteDaysLeft(member: Pick<TeamMember, 'invitedAt'>, now: Date): number

seatUsage()

Seats used and free.

utils/team.ts
seatUsage(members: Pick<TeamMember, 'status'>[], seats: number): { active: number; invited: number; used: number; free: number; }
Returnsactiveinvitedusedfree

membersWithoutTwoFactor()

Active members without 2FA.

utils/team.ts
membersWithoutTwoFactor(members: Pick<TeamMember, 'status' | 'twoFactor'>[]): number

matchesTeamView()

Whether a member belongs to a view.

utils/team.ts
matchesTeamView(state: TeamMemberState, view: TeamView): boolean

teamViewCounts()

The count of every team view.

utils/team.ts
teamViewCounts(states: TeamMemberState[]): Record<TeamView, number>

togglePermission()

Toggles one permission; any action implies View of the module.

utils/team.ts
togglePermission(permissions: Permission[], module: PermissionModule, action: PermissionAction): ("dashboard.view" | "dashboard.create" | "dashboard.update" | "dashboard.delete" | "orders.view" | "orders.create" | "orders.update" | "orders.delete" | "customers.view" | ... 22 …

togglePermissionModule()

Toggles every action of a module.

utils/team.ts
togglePermissionModule(permissions: Permission[], module: PermissionModule, enabled: boolean): ("dashboard.view" | "dashboard.create" | "dashboard.update" | "dashboard.delete" | "orders.view" | "orders.create" | "orders.update" | "orders.delete" | "customers.view" | ... 22 …

togglePermissionColumn()

Toggles one action in every module.

utils/team.ts
togglePermissionColumn(permissions: Permission[], action: PermissionAction, enabled: boolean): ("dashboard.view" | "dashboard.create" | "dashboard.update" | "dashboard.delete" | "orders.view" | "orders.create" | "orders.update" | "orders.delete" | "customers.view" | ... 22 …

permissionSummary()

A readable summary of a set of permissions.

utils/team.ts
permissionSummary(permissions: Permission[]): Record<"view" | "create" | "update" | "delete", number>

profileWork()

Open tasks, cards and events of the user for the profile tiles.

utils/profile.ts
profileWork({ tasks, board, events, me, today }: ProfileWorkSources): { open: number; dueToday: number; overdue: number; done: number; assigned: number; cards: number; cardsDueSoon: number; boardName: string; meetings: number; nextMeeting: CalendarE…
ReturnsopendueTodayoverduedoneassignedcardscardsDueSoonboardNamemeetingsnextMeeting

profileAgenda()

Today’s meetings and due tasks.

utils/profile.ts
profileAgenda({ tasks, events, me, today }: Omit<ProfileWorkSources, 'board'>): { meetings: CalendarEvent[]; due: TodoTask[]; }
Returnsmeetingsdue

profileCollaborators()

The people the user works with most.

utils/profile.ts
profileCollaborators({ tasks, board, me }: Pick<ProfileWorkSources, 'tasks' | 'board' | 'me'>, limit: number): { name: string; color: string; count: number; }[]

profileCompletion()

Profile completion from its checklist.

utils/profile.ts
profileCompletion(items: { done: boolean }[]): number

snippet()

An excerpt around the search term.

utils/help.ts
snippet(text: string, term: string, radius = SNIPPET_RADIUS): string

rankByOverlap()

Ranks items by word overlap with a query, for suggestions.

utils/help.ts
rankByOverlap(query: string, items: T[], text: (item: T) => string, limit = 3): T[]

adjacent()

The previous and next items of a list.

utils/help.ts
adjacent(items: T[], isCurrent: (item: T) => boolean): { previous: T | undefined; next: T | undefined; }
Returnspreviousnext

uptimePercent()

Uptime percentage of a list of days.

utils/help.ts
uptimePercent(days: UptimeDay[]): number
© 2026 melsami UI.
Developer documentation for melsami UI.