export type UserCanMap = Record; export interface UserRole { roleId: string; tenantId: string | null; productId: number | null; name: string; description?: string | null; productVersionId?: string | null; isProductRole?: boolean; isSystemWide?: boolean; } export interface UserApiResponse { name: string; firstName: string; familyName: string; jobTitle: string | null; email: string; mobile: string | null; phone: string | null; location: string | null; userId: string; externalUUID: string; isUnitySystemAdmin: boolean; roles: UserRole[]; permissions: unknown[]; can: UserCanMap; defaultTenantId: string; currentTenantId: string; statusCode?: number; } /** * Canonical User model. * * - Construct from the new API response (preferred) * - Or rehydrate from a previously-serialized User instance * * NOTE: This model intentionally does NOT read from storage or config. */ export declare class User { // --- Canonical fields (new API) --- readonly userId: string; readonly externalUUID: string; readonly name: string; readonly firstName: string; readonly familyName: string; readonly jobTitle: string | null; readonly email: string; readonly mobile: string | null; readonly phone: string | null; readonly location: string | null; readonly isUnitySystemAdmin: boolean; readonly roles: UserRole[]; readonly permissions: unknown[]; readonly can: UserCanMap; readonly defaultTenantId: string; readonly currentTenantId: string; /** * @deprecated Do not use `user.accessToken`. * This value is not reliably refreshed/updated when the session is refreshed. * Use token acquisition helpers instead. */ readonly accessToken?: string; /** @deprecated Legacy/unused. use the TenantProvider i.e. * `const tenant = useTenant()` to get TenantContext * `tenant.activeTenant` to get the current tenant, and * `tenant.activeTenant.products` for the product list. */ readonly products?: object[]; /** @deprecated Legacy/unused. Prefer TenantProvider i.e. * `const tenant = useTenant()` to get TenantContext * `tenant.tenantsList` for the full list of tenants available to the user. */ readonly tenantIds?: string[]; /** @deprecated Legacy/unused. Do not use User model to store arbitrary data */ readonly additionalProperties?: unknown; /** @deprecated Legacy/unused. Prefer HTTP status handling outside the model */ readonly statusCode?: number; // Overloads ("two constructors") constructor(api: UserApiResponse, currentTenantIdParam?: string); constructor(userLike: Partial); // --- Deprecated legacy accessors (derived) --- /** @deprecated Prefer `userId` */ get id(): string; /** @deprecated Prefer `userId` */ get unityId(): string; /** @deprecated Prefer `externalUUID` */ get aadId(): string; /** @deprecated Prefer `roles` */ get roleIds(): string[]; /** @deprecated Prefer `roles` */ get roleNames(): string[]; hasRole(roleId: string): boolean; toJSON(): Record; } /** * @deprecated Prefer `new User(apiResponse)`. * This wrapper exists to reduce migration churn. */ export declare function createUser(userInfo: UserApiResponse): User; /** * @deprecated Prefer `new User(userLike)`. * This wrapper exists to reduce migration churn. */ export declare function createUserFromUserObject(userObject: Partial): User; //# sourceMappingURL=user.d.ts.map