feat(web): currency becomes a closed select (ALL / EUR / USD)
Build desktop / desktop (push) Successful in 4m13s
Build & push images / images (push) Successful in 2m51s
CI / check (push) Successful in 41s

Currency was free text in the tariff editor (composer page + lab draft
modal — shared form) and the subscription plan editor; a typo could
publish an unknown code onto immutable versions. Both now offer a closed
select from lib/currencies.ts. An out-of-set code already stored on an
old record is appended as an extra option so it displays + round-trips
unchanged. Blank tariff form defaults to ALL (was EUR) — the site's
actual currency.

Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
2026-07-05 15:23:29 +02:00
parent 1de209be48
commit d5ff2097bd
3 changed files with 24 additions and 3 deletions
+11
View File
@@ -0,0 +1,11 @@
// The currencies the booth can price in (ISO 4217). Money is always stored as
// integer minor units + one of these codes; the UI offers a closed select rather
// than free text so a typo can never publish an unknown currency.
export const CURRENCIES = ["ALL", "EUR", "USD"] as const;
/** The select options: the known set, plus the current value when it's some
* historical code outside it (so an old record still displays + round-trips). */
export function currencyOptions(current: string): string[] {
const cur = current.trim().toUpperCase();
return cur && !CURRENCIES.includes(cur as (typeof CURRENCIES)[number]) ? [...CURRENCIES, cur] : [...CURRENCIES];
}