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.
commissionError
function
The rule both commission forms share, literally: a % is 1–100 with at most 2 decimals; an amount per item is a 2-dp money figure above 0. No exponents ("1e2"), no third decimal, no 0.5 %. Arabic-Indic digits are read as digits. Null when valid. labels: the copy to say it in (a component passes its merged copy, provider labels and all). options.limits replaces the bounds (the server's own, e.g. 0.01–50 % and EGP 0.01–10,000 per item); the message then names the range.
function commissionError(kind: CommissionKind, value: string, language: Lang, labels?: Partial<CommissionCopy> | undefined, options?: CommissionErrorOptions): string | nullProp
Type
Source: src/blocks/groups/CommissionInput.tsx (line 96)
commissionRateText
function
A rate in words with the given copy: "15%", "EGP 15 per item" (trailing zeros dropped); form="long" gives "15% of sale" (a copy without ratePercentLong keeps the short words).
function commissionRateText(kind: CommissionKind, value: string, currency: string, copy: Pick<CommissionCopy, "ratePercent" | "ratePerItem"> & Partial<Pick<CommissionCopy, "ratePercentLong">>, form?: CommissionRateForm): stringProp
Type
Source: src/blocks/groups/CommissionInput.tsx (line 122)
defaultableNumberError
function
A number setting's rule: a number (whole when step is whole) from min to max. Null when valid.
function defaultableNumberError(value: string, options2: { min?: number; max?: number; step?: number; }, language: Lang, labels?: Partial<DefaultableCopy> | undefined): string | nulloptions2: { min?: number; max?: number; step?: number; } (required)
Prop
Type
Source: src/blocks/settings-controls/DefaultableSetting.tsx (line 75)
giftCooldownError
function
The cooldown rule: while on, a whole number of days from 1 to max. Null when valid (or off).
function giftCooldownError(rules: GiftRules, language: Lang, max?: number, labels?: Partial<GiftRulesCopy> | undefined): string | nullProp
Type
Source: src/blocks/motivation/GiftRulesCard.tsx (line 65)
invitationActions
function
Pending invitations: Resend, Copy link (when the app has one) and Cancel invite (danger, confirmed).
function invitationActions(options: { onResend: () => void; onCopyLink?: () => void; onCancel: () => void; busy?: "resend" | "copyLink" | "cancel" | null; resendDisabledReason?: string | null; }): RowAction[]options: { onResend: () => void; onCopyLink?: () => void; onCancel: () => void; busy?: "resend" | "copyLink" | "cancel" | null; resendDisabledReason?: string | null; } (required)
Prop
Type
Source: src/blocks/rowactions/RowActions.tsx (line 86)
joinRequestActions
function
Join requests: Approve (primary) and Reject (danger; the app's reason dialog is its confirm, so no extra step).
function joinRequestActions(options: { onApprove: () => void; onReject: () => void; busy?: "approve" | "reject" | null; approveDisabledReason?: string | null; }): RowAction[]options: { onApprove: () => void; onReject: () => void; busy?: "approve" | "reject" | null; approveDisabledReason?: string | null; } (required)
Prop
Type
Source: src/blocks/rowactions/RowActions.tsx (line 71)
messageBody
function
The body in the page's language, else the other one (marked with its own lang, so it reads in its direction).
function messageBody(message: Pick<BrandMessage, "body_en" | "body_ar">, language: Lang): { text: string; lang: Lang; } | nullProp
Type
Source: src/blocks/messages/MessageHistoryItem.tsx (line 92)
topUpAmountError
function
The amount rule: a whole number from min to max (inclusive; Arabic-Indic digits read as digits). Null when valid.
function topUpAmountError(value: string, options2: { min?: number; max?: number; }, language: Lang, labels?: Partial<TopUpCopy> | undefined): string | nulloptions2: { min?: number; max?: number; } (required)
Prop
Type
Source: src/blocks/topup/TopUpAmountPicker.tsx (line 68)