/** * Directory entity monogram (tenant / sales-point / org list thumbs). * * Single shared algorithm for customer directory surfaces and admin * list/table fallbacks when no branding image is available. * * Do **not** use `CatalogImagePlaceholder` as a directory entity fallback — * that component is catalog/product (and donation) media chrome only. * Broken or missing directory images cascade to this monogram instead. * * Admin call sites (migrated — consume `resolveDirectoryMonogram` / label helpers): * - `admin-app/.../DevDashboard/devDashboardTenantList.ts` → `resolveTenantDirectoryMonogram` * - `admin-app/.../DevDashboard/DevDashboardTenantTable.tsx` * - `admin-app/.../SalesPointAvatar/SalesPointAvatar.tsx` (table + list-card fallback) * * Related but out of directory branding scope (do not blindly replace): * - `shared/src/ui/Avatar/Avatar.tsx` → `initialsFromName` (CMP-0025 user avatar) * - `admin-app/.../PickupPointListCard.tsx` → local `initialsFromName` * - `admin-app/.../DevCustomerTable.tsx` → `customerMonogram` * - `rpapp-customer/.../headerAccountBadge.ts` → account badge text */ export interface DirectoryMonogramInput { /** Stable numeric entity id (tenantId, salesPointId, etc.). */ readonly id: number; /** Preferred display name (name-first). */ readonly displayName: string; /** Fallback when displayName yields no graphemes (tenant code, slug, etc.). */ readonly code?: string | null; } export interface DirectoryMonogramColors { /** Background fill as `#RRGGBB`. */ readonly backgroundColor: string; /** Foreground text as `#RRGGBB` meeting WCAG AA ≥ 4.5:1 vs background. */ readonly textColor: string; } export interface DirectoryMonogram extends DirectoryMonogramColors { /** 1–2 uppercase graphemes for the thumb label. */ readonly label: string; } interface Rgb { readonly r: number; readonly g: number; readonly b: number; } /** * 1–2 graphemes from display name; falls back to code (whitespace, then * hyphen/underscore/dot segments, then raw graphemes). Empty → `"?"`. */ export declare function directoryMonogramLabel(displayName: string, code?: string | null): string; /** Stable 32-bit mix of a numeric id (deterministic across runtimes). */ export declare function hashDirectoryMonogramId(id: number): number; /** * Stable monogram seed from a string key (e.g. tenantCode when tenantId unknown). * Same key → same color across cards; never use per-row ids (transactionId). */ export declare function hashDirectoryMonogramKey(key: string): number; /** * Prefer numeric tenantId; otherwise hash tenantCode so the same org shares one color. */ export declare function resolveDirectoryMonogramEntityId(input: { readonly tenantId?: number | null; readonly tenantCode?: string | null; }): number; /** WCAG 2.x contrast ratio between two sRGB colors. */ export declare function contrastRatio(a: Rgb, b: Rgb): number; /** * Background from stable id hash; text color chosen for WCAG AA ≥ 4.5:1. * Lightness is nudged when needed so at least one of white/dark text passes. */ export declare function directoryMonogramColors(id: number): DirectoryMonogramColors; /** Full directory monogram: label + WCAG AA color pair from stable numeric id. */ export declare function resolveDirectoryMonogram(input: DirectoryMonogramInput): DirectoryMonogram; export {}; //# sourceMappingURL=directoryMonogram.d.ts.map