Helpers and constants
Functions, constants and classes that have no page of their own.
Functions, constants and classes exported from @ergasti/bricks that have no page of their own. Components and hooks each have a page.
CONSOLE_STATUSES
constant
deprecated
Deprecated
Since 0.2.0: use TRNDR_STATUSES (the same table) or the BricksProvider's statuses. Removed in 1.0.
Every status word a console list shows, with the mock's own tone and EN / AR label: the TRNDR preset's table (preset/trndr.ts). StatusPill reads the provider's statuses; this export stays for code that reads the table.
const CONSOLE_STATUSES: { readonly active: { readonly tone: "ok"; readonly en: "Active"; readonly ar: "نشط"; }; readonly live: { readonly tone: "ok"; readonly en: "Live"; readonly ar: "شغّال"; }; readonly accepted: { readonly tone: "ok"; readonly en: "Accepted"; readonly ar: "اتقبلت"; }; readonly approved: { readonly tone: "ok"; readonly en: "Approved"; readonly ar: "اتوافق عليه"; }; readonly paid: { readonly tone: "ok"; readonly en: "Paid"; readonly ar: "اتدفع"; }; readonly delivered: { readonly tone: "ok"; readonly en: "Delivered"; readonly ar: "اتسلّم"; }; readonly paused: { readonly tone: "warn"; readonly en: "Pa …Source: src/lib/status.ts (line 31)
creatorStatus
function
is_active = membership (false = Removed); on_hold = the creator's review hold.
function creatorStatus(row: { is_active?: boolean; on_hold?: boolean; }): CreatorStatusProp
Type
Source: src/lib/status.ts (line 8)
creatorStatusLabel
function
The label for a creator's state (Active, Removed, On hold) in the given language, from the is_active and on_hold flags a creator row carries.
function creatorStatusLabel(row: { is_active?: boolean; on_hold?: boolean; }, language: Lang): stringProp
Type
Source: src/lib/status.ts (line 19)
isAccessStatus
function
The statuses whose meaning beats whatever the body says: the session, the permission, the rate limit.
function isAccessStatus(status: number): booleanProp
Type
Source: src/lib/format.ts (line 189)
isConsoleStatus
function
deprecated
Deprecated
Since 0.2.0: use key in TRNDR_STATUSES, or the provider's statuses. Removed in 1.0.
A type guard: true when a string is one of the keys of CONSOLE_STATUSES (the TRNDR preset's status table).
function isConsoleStatus(value: string): booleanProp
Type
Source: src/lib/status.ts (line 37)
MONEY_DISPLAY_DEFAULT
constant
The preset default every slot starts from: the currency word, 2 decimals, not compact, a sign on money out only.
const MONEY_DISPLAY_DEFAULT: Readonly<Required<MoneyDisplay>>Source: src/lib/moneyDisplay.ts (line 7)
pageWindow
function
The page numbers a pager shows for a current page and a last page: all of them up to 7 pages, else a fixed window of numbers with '…' gaps. A single hidden page is shown instead of an ellipsis. Pager uses it.
function pageWindow(currentPage: number, lastPage: number): (number | "…")[]Prop
Type
Source: src/lib/pageWindow.ts (line 7)
safeHref
function
A URL from props or data, made safe for href (or a form's action): http(s), mailto, tel and relative URLs (/path, #anchor, ?query, //host/…) come back as they are; any other scheme gives undefined, so the element renders without an href and nothing runs on click. The scheme is read the way a browser reads it: leading spaces and control characters, and tabs or newlines anywhere, are ignored (" java\tscript:" is still javascript:).
Every component in this library passes prop-derived hrefs through it (guards/SafeHrefGuard.test.ts checks); use it for your own links built from API data too.
function safeHref(url: string | null | undefined): string | undefinedProp
Type
Source: src/lib/safeHref.ts (line 13)
WALLET_HEALTHS
constant
The four wallet health states, in order: 'ok', 'low', 'negative' and 'paused'. WalletHealthCard and WalletHealthPill take one of them.
const WALLET_HEALTHS: readonly WalletHealth[]Source: src/lib/walletHealth.ts (line 11)