Entrega dashboard e correccoes transversais preservando Ofertas instalado
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-11-15 18:56:39 +02:00
parent 1349789226
commit fb076c174f
117 changed files with 10380 additions and 1905 deletions
+35
View File
@@ -0,0 +1,35 @@
export const normaliseChoice = (value: string) =>
value
.normalize('NFD')
.replace(/\p{Diacritic}/gu, '')
.toLocaleLowerCase('pt')
.trim();
export function matchesChoice(query: string, labels: string[]): boolean {
const needle = normaliseChoice(query);
return (
!needle ||
labels.some((label) => normaliseChoice(label).includes(needle))
);
}
/** The same ISO currency source already used by the simulator, with readable labels. */
export function currencyChoices(codes?: readonly string[]) {
const intl = Intl as unknown as {
supportedValuesOf?: (key: string) => string[];
};
const names = new Intl.DisplayNames(['pt-MZ'], { type: 'currency' });
return [
...new Set(
codes ??
intl.supportedValuesOf?.('currency') ?? [
'MZN',
'USD',
'EUR',
'ZAR',
],
),
].map((code) => ({
value: code,
label: `${names.of(code) ?? code} — ${code}`,
keywords: [code, names.of(code) ?? code],
}));
}