Refresh HiveGrid Cloud reference snapshot

This commit is contained in:
david committed 2026-08-03 15:31:14 +02:00
1 parent 5e99e14772
commit 7f88026f79
5955 files changed
+1177325 -188362

No files matched your search

@@ -20,6 +20,7 @@ function inputRow(overrides: Partial<MembersListInputRow> = {}): MembersListInpu
status: "active",
mfaEnabled: true,
roles: [{ id: "r1", name: "Monteur", description: "" }],
seatType: "field",
...overrides,
};
}
@@ -85,6 +86,15 @@ describe("buildMembersListVM", () => {
expect(row.phone).toBeNull();
expect(row.statusLabelKey).toBe("settings.members.status.invited");
});
it("maps the effective seat type to its badge label key", () => {
const vm = buildVM([inputRow({ seatType: "office" }), inputRow({ tenantUserId: "tu2", userId: "u2", seatType: "field" })]);
const [office, field] = vm.data!.rows;
expect(office.seatType).toBe("office");
expect(office.seatLabelKey).toBe("settings.members.seat.office");
expect(field.seatType).toBe("field");
expect(field.seatLabelKey).toBe("settings.members.seat.field");
});
});
describe("filterMembersRows", () => {
@@ -1,3 +1,4 @@
import type { SeatType } from "@hivegrid/entitlements";
import type { VMState } from "../index.js";
/**
@@ -34,6 +35,10 @@ export type MembersListRow = {
readonly mfaEnabled: boolean;
/** Roles assigned in this tenant (screen resolves display labels). */
readonly roles: readonly MemberRoleRef[];
/** Effective seat type (office vs field, Fundament C) — display only. */
readonly seatType: SeatType;
/** i18n key for the seat-type badge label. */
readonly seatLabelKey: string;
readonly isSelf: boolean;
/** Row menu capability: deactivate (M03) — active members that are not you. */
readonly canDeactivate: boolean;
@@ -90,6 +95,8 @@ export interface MembersListInputRow {
readonly status: MemberStatus;
readonly mfaEnabled: boolean;
readonly roles: readonly MemberRoleRef[];
/** Effective seat type derived by the loader (deriveSeatType from @hivegrid/entitlements). */
readonly seatType: SeatType;
}
export interface BuildMembersListVMInput {
@@ -108,6 +115,11 @@ const STATUS_LABEL_KEYS: Readonly<Record<MemberStatus, string>> = {
invited: "settings.members.status.invited",
};
const SEAT_LABEL_KEYS: Readonly<Record<SeatType, string>> = {
office: "settings.members.seat.office",
field: "settings.members.seat.field",
};
export function deriveMemberName(firstName: string | null, lastName: string | null, email: string): string {
const name = [firstName, lastName]
.map((part) => (part ?? "").trim())
@@ -135,6 +147,8 @@ export function buildMembersListVM(input: BuildMembersListVMInput): MembersListV
statusLabelKey: STATUS_LABEL_KEYS[row.status],
mfaEnabled: row.mfaEnabled,
roles: row.roles,
seatType: row.seatType,
seatLabelKey: SEAT_LABEL_KEYS[row.seatType],
isSelf,
// Server enforces the last-admin guard again (V01) — these flags only shape the menu.
canDeactivate: input.canManageMembers && row.status === "active" && !isSelf,
@@ -184,6 +198,7 @@ export interface MembersListModelRow {
readonly name: string;
readonly email: string;
readonly statusLabelKey: string;
readonly seatLabelKey: string;
readonly mfaEnabled: boolean;
readonly roleNames: readonly string[];
readonly canDeactivate: boolean;
@@ -210,6 +225,7 @@ export function toMembersListModel(data: MembersListData): MembersListModel {
name: row.name,
email: row.email,
statusLabelKey: row.statusLabelKey,
seatLabelKey: row.seatLabelKey,
mfaEnabled: row.mfaEnabled,
roleNames: row.roles.map((role) => role.name),
canDeactivate: row.canDeactivate,