diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/forms/index.ts')
-rw-r--r-- | packages/aml-backoffice-ui/src/forms/index.ts | 174 |
1 files changed, 138 insertions, 36 deletions
diff --git a/packages/aml-backoffice-ui/src/forms/index.ts b/packages/aml-backoffice-ui/src/forms/index.ts index 32de4fbd3..dd1dae54d 100644 --- a/packages/aml-backoffice-ui/src/forms/index.ts +++ b/packages/aml-backoffice-ui/src/forms/index.ts @@ -1,139 +1,241 @@ -import { TranslatedString } from "@gnu-taler/taler-util"; +import type { AmountJson, TranslatedString } from "@gnu-taler/taler-util"; +import type { AmlExchangeBackend } from "../utils/types.js"; +import type { FlexibleForm, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { v1 as form_902_11e_v1 } from "./902_11e.js"; +import { v1 as form_902_12e_v1 } from "./902_12e.js"; +import { v1 as form_902_13e_v1 } from "./902_13e.js"; +import { v1 as form_902_15e_v1 } from "./902_15e.js"; +import { v1 as form_902_1e_v1 } from "./902_1e.js"; +import { v1 as form_902_4e_v1 } from "./902_4e.js"; +import { v1 as form_902_5e_v1 } from "./902_5e.js"; +import { v1 as form_902_9e_v1 } from "./902_9e.js"; +import { v1 as simplest } from "./simplest.js"; +import { DocumentDuplicateIcon } from "./icons.js"; +export interface BaseForm { + state: AmlExchangeBackend.AmlState; + threshold: AmountJson; +} -export const languageList = [ + +export type FormMetadata<T extends BaseForm> = { + label: TranslatedString, + id: string, + version: number, + icon: any; //h.JSX.Element, + impl: (current: T) => FlexibleForm<T> +} + + +const languages = (i18n: InternationalizationAPI) => [ { - label: "Mandarin Chinese" as TranslatedString, + label: i18n.str`Mandarin Chinese`, value: "cmn", }, { - label: "Spanish" as TranslatedString, + label: i18n.str`Spanish`, value: "spa", }, { - label: "English" as TranslatedString, + label: i18n.str`English`, value: "eng", }, { - label: "Hindi" as TranslatedString, + label: i18n.str`Hindi`, value: "hin", }, { - label: "Portuguese" as TranslatedString, + label: i18n.str`Portuguese`, value: "por", }, { - label: "Bengali" as TranslatedString, + label: i18n.str`Bengali`, value: "ben", }, { - label: "Russian" as TranslatedString, + label: i18n.str`Russian`, value: "rus", }, { - label: "Japanese" as TranslatedString, + label: i18n.str`Japanese`, value: "jpn", }, { - label: "Yue" as TranslatedString, + label: i18n.str`Yue`, value: "yue", }, { - label: "Vietnamese" as TranslatedString, + label: i18n.str`Vietnamese`, value: "vie", }, { - label: "Turkish" as TranslatedString, + label: i18n.str`Turkish`, value: "tur", }, { - label: "Wu" as TranslatedString, + label: i18n.str`Wu`, value: "wuu", }, { - label: "Marathi" as TranslatedString, + label: i18n.str`Marathi`, value: "mar", }, { - label: "Telugu" as TranslatedString, + label: i18n.str`Telugu`, value: "ten", }, { - label: "Korean" as TranslatedString, + label: i18n.str`Korean`, value: "kor", }, { - label: "French" as TranslatedString, + label: i18n.str`French`, value: "fra", }, { - label: "Tamil" as TranslatedString, + label: i18n.str`Tamil`, value: "tam", }, { - label: "Egyptian Arabic" as TranslatedString, + label: i18n.str`Egyptian Arabic`, value: "arz", }, { - label: "Standard German" as TranslatedString, + label: i18n.str`Standard German`, value: "deu", }, { - label: "Urdu" as TranslatedString, + label: i18n.str`Urdu`, value: "urd", }, { - label: "Javanese" as TranslatedString, + label: i18n.str`Javanese`, value: "jav", }, { - label: "Punjabi" as TranslatedString, + label: i18n.str`Punjabi`, value: "pan", }, { - label: "Italian" as TranslatedString, + label: i18n.str`Italian`, value: "ita", }, { - label: "Gujarati" as TranslatedString, + label: i18n.str`Gujarati`, value: "guj", }, { - label: "Iranian Persian" as TranslatedString, + label: i18n.str`Iranian Persian`, value: "pes", }, { - label: "Bhojpuri" as TranslatedString, + label: i18n.str`Bhojpuri`, value: "bho", }, { - label: "Hausa" as TranslatedString, + label: i18n.str`Hausa`, value: "hau", }, ]; -export const currencyList = [ + + +const forms: (i18n: InternationalizationAPI) => Array<FormMetadata<BaseForm>> = (i18n) => [ + { + label: i18n.str`Simple comment`, + id: "simple_comment", + version: 1, + icon: DocumentDuplicateIcon, + impl: simplest(i18n), + }, { + label: i18n.str`Identification form`, + id: "902.1e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_1e_v1(i18n), + }, { + label: i18n.str`Operational legal entity or partnership`, + id: "902.11e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_11e_v1(i18n), + }, { + label: i18n.str`Foundations`, + id: "902.12e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_12e_v1(i18n), + }, { + label: i18n.str`Declaration for trusts`, + id: "902.13e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_13e_v1(i18n), + }, { + label: i18n.str`Information on life insurance policies`, + id: "902.15e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_15e_v1(i18n), + }, { + label: i18n.str`Declaration of beneficial owner`, + id: "902.9e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_9e_v1(i18n), + }, { + label: i18n.str`Customer profile`, + id: "902.5e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_5e_v1(i18n), + }, { + label: i18n.str`Risk profile`, + id: "902.4e", + version: 1, + icon: DocumentDuplicateIcon, + impl: form_902_4e_v1(i18n), + }, +]; + + +const currencies = (i18n: InternationalizationAPI) => [ { - label: "United States dollar" as TranslatedString, + label: i18n.str`United States dollar`, value: "usd", }, { - label: "Euro" as TranslatedString, + label: i18n.str`Euro`, value: "eur", }, { - label: "Swiss franc" as TranslatedString, + label: i18n.str`Swiss franc`, value: "chf", }, { - label: "Argentine peso" as TranslatedString, + label: i18n.str`Argentine peso`, value: "ars", }, { - label: "Mexican peso" as TranslatedString, + label: i18n.str`Mexican peso`, value: "mxn", }, { - label: "Brazilian real" as TranslatedString, + label: i18n.str`Brazilian real`, value: "brl", }, ]; + +interface AmlExchangeBackoffice { + currencies: typeof currencies, + languages: typeof languages, + forms: typeof forms, +} +declare global { + interface Window { + amlExchangeBackoffice?: AmlExchangeBackoffice; + } +} + +if (typeof window !== "undefined" && !window.amlExchangeBackoffice) { + window.amlExchangeBackoffice = { currencies, languages, forms } +} |