diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src')
25 files changed, 717 insertions, 700 deletions
diff --git a/packages/aml-backoffice-ui/src/Dashboard.tsx b/packages/aml-backoffice-ui/src/Dashboard.tsx index f791906b9..0fcea3ee9 100644 --- a/packages/aml-backoffice-ui/src/Dashboard.tsx +++ b/packages/aml-backoffice-ui/src/Dashboard.tsx @@ -105,7 +105,8 @@ export function ExchangeAmlFrame({ } else { notifyError(i18n.str`Internal error, please report.`, String(error) as TranslatedString) } - resetError() + console.log(error) + // resetError() } }, [error]) diff --git a/packages/aml-backoffice-ui/src/declaration.d.ts b/packages/aml-backoffice-ui/src/declaration.d.ts index 11a10860d..6af72042c 100644 --- a/packages/aml-backoffice-ui/src/declaration.d.ts +++ b/packages/aml-backoffice-ui/src/declaration.d.ts @@ -1,3 +1,4 @@ + declare const __VERSION__: string; declare const __GIT_HASH__: string; diff --git a/packages/aml-backoffice-ui/src/forms/902_11e.ts b/packages/aml-backoffice-ui/src/forms/902_11e.ts index 932971ef2..258f75135 100644 --- a/packages/aml-backoffice-ui/src/forms/902_11e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_11e.ts @@ -1,21 +1,21 @@ -import { TranslatedString } from "@gnu-taler/taler-util"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; +import type { TranslatedString } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; import { resolutionSection } from "./simplest.js"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ design: [ { title: - "Establishing of the controlling person of operating legal entities and partnerships both not quoted on the stock exchange" as TranslatedString, + i18n.str`Establishing of the controlling person of operating legal entities and partnerships both not quoted on the stock exchange`, description: - "for operating legal entities and partnership that are contracting partner as well as analogously for operating legal entities and partnership that are beneficial owners." as TranslatedString, + i18n.str`for operating legal entities and partnership that are contracting partner as well as analogously for operating legal entities and partnership that are beneficial owners.`, fields: [ { type: "textArea", props: { name: "contractingPartner", - label: "Contracting partner" as TranslatedString, + label: i18n.str`Contracting partner`, }, }, { @@ -23,22 +23,22 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ props: { name: "declares", label: - "The contracting partner hereby declares that" as TranslatedString, + i18n.str`The contracting partner hereby declares that`, required: true, choices: [ { label: - "the person(s) listed below is/are holding 25% or more of the contracting partner's shares (capital shares or voting rights)" as TranslatedString, + i18n.str`the person(s) listed below is/are holding 25% or more of the contracting partner's shares (capital shares or voting rights)`, value: "25-or-more", }, { label: - "if the capital shares or voting rights cannot be determined or in case there are no capital shares or voting rights 25% or more, the contracting partner hereby declares that the person(s) listed below is/are controlling the contracting partner in other ways" as TranslatedString, + i18n.str`if the capital shares or voting rights cannot be determined or in case there are no capital shares or voting rights 25% or more, the contracting partner hereby declares that the person(s) listed below is/are controlling the contracting partner in other ways`, value: "controlling-in-other-ways", }, { label: - "in case this/these person(s) cannot be determined or this/these person(s) does/do not exist, the contracting partner hereby declares that the person(s) listed below is/are the managing director(s)" as TranslatedString, + i18n.str`in case this/these person(s) cannot be determined or this/these person(s) does/do not exist, the contracting partner hereby declares that the person(s) listed below is/are the managing director(s)`, value: "managing-director", }, ], @@ -48,15 +48,15 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ type: "array", props: { name: "people", - label: "People" as TranslatedString, + label: i18n.str`People`, required: true, - placeholder: "this is the placeholder" as TranslatedString, + placeholder: i18n.str`this is the placeholder`, fields: [ { type: "text", props: { name: "lastName", - label: "Last name(s)" as TranslatedString, + label: i18n.str`Last name(s)`, required: true, }, }, @@ -64,7 +64,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ type: "text", props: { name: "firstName", - label: "First name(s)" as TranslatedString, + label: i18n.str`First name(s)`, required: true, }, }, @@ -72,7 +72,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ type: "text", props: { name: "address", - label: "Actual address of domicile" as TranslatedString, + label: i18n.str`Actual address of domicile`, required: true, }, }, @@ -84,26 +84,26 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_11.Form> => ({ type: "choiceStacked", props: { name: "fiduciaryAssets", - label: "Fiduciary holding assets" as TranslatedString, - help: "Is a third person the beneficial owner of the assets held in the account/securities account?" as TranslatedString, + label: i18n.str`Fiduciary holding assets`, + help: i18n.str`Is a third person the beneficial owner of the assets held in the account/securities account?`, required: true, choices: [ { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", description: - "The relevant information regarding the beneficial owner has to be obtained by filling in a separate VQF doc. No. 902.9" as TranslatedString, + i18n.str`The relevant information regarding the beneficial owner has to be obtained by filling in a separate VQF doc. No. 902.9`, }, ], }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_11.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_12e.ts b/packages/aml-backoffice-ui/src/forms/902_12e.ts index 7adeb6988..5a6b80772 100644 --- a/packages/aml-backoffice-ui/src/forms/902_12e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_12e.ts @@ -1,18 +1,18 @@ -import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; +import type { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; import { resolutionSection } from "./simplest.js"; +import { BaseForm } from "./index.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ design: [ { - title: "Foundations" as TranslatedString, + title: i18n.str`Foundations`, fields: [ { type: "textArea", props: { name: "contractingPartner", - label: "Contracting partner" as TranslatedString, + label: i18n.str`Contracting partner`, }, }, { @@ -20,7 +20,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "knownAs", label: - "The undersigned hereby declare(s) that as board member of the foundation, or of the highest supervisory body of an underlying company of a foundation, known as" as TranslatedString, + i18n.str`The undersigned hereby declare(s) that as board member of the foundation, or of the highest supervisory body of an underlying company of a foundation, known as`, }, }, { @@ -28,21 +28,21 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "foundation.name", label: - "Name and information pertaining to the foundation" as TranslatedString, + i18n.str`Name and information pertaining to the foundation`, }, }, { type: "choiceStacked", props: { name: "foundation.type", - label: "Type of foundation" as TranslatedString, + label: i18n.str`Type of foundation`, choices: [ { - label: "Discretionary foundation" as TranslatedString, + label: i18n.str`Discretionary foundation`, value: "discretionary", }, { - label: "Non-discretionary foundation" as TranslatedString, + label: i18n.str`Non-discretionary foundation`, value: "non-discretionary", }, ], @@ -52,14 +52,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "choiceStacked", props: { name: "foundation.revocability", - label: "Revocability" as TranslatedString, + label: i18n.str`Revocability`, choices: [ { - label: "Revocable foundation" as TranslatedString, + label: i18n.str`Revocable foundation`, value: "revocable", }, { - label: "Irrevocable foundation" as TranslatedString, + label: i18n.str`Irrevocable foundation`, value: "irrevocable", }, ], @@ -69,7 +69,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "array", props: { label: - "Information pertaining to the (ultimate economic, not fiduciary) founder (individual(s) or entity/ies)" as TranslatedString, + i18n.str`Information pertaining to the (ultimate economic, not fiduciary) founder (individual(s) or entity/ies)`, labelField: "fullName", name: "founders", fields: [ @@ -78,7 +78,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -86,36 +86,36 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { type: "text", props: { name: "dateOfDeath", - label: "Date of death" as TranslatedString, - help: "if deceased" as TranslatedString, + label: i18n.str`Date of death`, + help: i18n.str`if deceased`, }, }, { @@ -124,14 +124,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ name: "rightToRevoke", required: true, label: - "Does the founder have the right to revoke the foundation?" as TranslatedString, + i18n.str`Does the founder have the right to revoke the foundation?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -144,7 +144,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "array", props: { label: - "If the foundation results from the restructuring of pre-existing foundation (re-settlement) or the merger of pre-existing foundations, the following information pertaining to the (actual) founder(s) of the pre-existing foundation(s) has to be given" as TranslatedString, + i18n.str`If the foundation results from the restructuring of pre-existing foundation (re-settlement) or the merger of pre-existing foundations, the following information pertaining to the (actual) founder(s) of the pre-existing foundation(s) has to be given`, labelField: "fullName", name: "preExistingFounders", fields: [ @@ -153,7 +153,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -161,36 +161,36 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { type: "text", props: { name: "dateOfDeath", - label: "Date of death" as TranslatedString, - help: "if deceased" as TranslatedString, + label: i18n.str`Date of death`, + help: i18n.str`if deceased`, }, }, ], @@ -200,7 +200,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "array", props: { label: - "Pertaining to the beneficiary/-ies at the time of the signing of this form" as TranslatedString, + i18n.str`Pertaining to the beneficiary/-ies at the time of the signing of this form`, labelField: "fullName", name: "beneficiaryWhenSigning", fields: [ @@ -209,7 +209,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -217,28 +217,28 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { @@ -246,14 +246,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "rightToClaim", label: - "Has the beneficiary an actual right to claim distribution?" as TranslatedString, + i18n.str`Has the beneficiary an actual right to claim distribution?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -263,7 +263,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "textArea", props: { label: - "in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the founder) known at the time of the signing of this form" as TranslatedString, + i18n.str`in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the founder) known at the time of the signing of this form`, name: "beneficiaryExtra", }, }, @@ -274,7 +274,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "array", props: { label: - "Information pertaining to further persons having the right to determine or nominate representatives (e.g.) members of the foundation board), if these representatives may dispose over the assets or have the right to change the distribution of the assets or the nomination of beneficiaries" as TranslatedString, + i18n.str`Information pertaining to further persons having the right to determine or nominate representatives (e.g.) members of the foundation board), if these representatives may dispose over the assets or have the right to change the distribution of the assets or the nomination of beneficiaries`, labelField: "fullName", name: "withRightToNominate", fields: [ @@ -283,7 +283,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -291,28 +291,28 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { @@ -320,14 +320,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ props: { name: "rightToClaim", label: - "has the person the right to revoke the foundation?" as TranslatedString, + i18n.str`has the person the right to revoke the foundation?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -337,7 +337,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "textArea", props: { label: - "in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the founder) known at the time of the signing of this form" as TranslatedString, + i18n.str`in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the founder) known at the time of the signing of this form`, name: "beneficiaryExtra", }, }, @@ -348,12 +348,12 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_12.Form> => ({ type: "text", props: { name: "signature", - label: "Signature" as TranslatedString, + label: i18n.str`Signature`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_12.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_13e.ts b/packages/aml-backoffice-ui/src/forms/902_13e.ts index 83ce88624..dce81bc5e 100644 --- a/packages/aml-backoffice-ui/src/forms/902_13e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_13e.ts @@ -1,18 +1,18 @@ -import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -import { BaseForm, } from "../pages/AntiMoneyLaunderingForm.js"; +import type { AbsoluteTime } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; import { resolutionSection } from "./simplest.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ design: [ { - title: "Declaration for trusts" as TranslatedString, + title: i18n.str`Declaration for trusts`, fields: [ { type: "textArea", props: { name: "contractingPartner", - label: "Contracting partner" as TranslatedString, + label: i18n.str`Contracting partner`, }, }, { @@ -20,7 +20,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "knownAs", label: - "The undersigned hereby declare(s) that as trustee or a member of highest supervisory body of an underlying company of a trust known as" as TranslatedString, + i18n.str`The undersigned hereby declare(s) that as trustee or a member of highest supervisory body of an underlying company of a trust known as`, }, }, { @@ -28,21 +28,21 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "trust.name", label: - "Name and information pertaining to the trust" as TranslatedString, + i18n.str`Name and information pertaining to the trust`, }, }, { type: "choiceStacked", props: { name: "trust.type", - label: "Type of trust" as TranslatedString, + label: i18n.str`Type of trust`, choices: [ { - label: "Discretionary trust" as TranslatedString, + label: i18n.str`Discretionary trust`, value: "discretionary", }, { - label: "Non-discretionary trust" as TranslatedString, + label: i18n.str`Non-discretionary trust`, value: "non-discretionary", }, ], @@ -52,14 +52,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "choiceStacked", props: { name: "trust.revocability", - label: "Revocability" as TranslatedString, + label: i18n.str`Revocability`, choices: [ { - label: "Revocable foundation" as TranslatedString, + label: i18n.str`Revocable foundation`, value: "revocable", }, { - label: "Irrevocable foundation" as TranslatedString, + label: i18n.str`Irrevocable foundation`, value: "irrevocable", }, ], @@ -69,7 +69,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "Information pertaining to the (ultimate economic, not fiduciary) settlor of the trust (individual(s) or entity/ies)" as TranslatedString, + i18n.str`Information pertaining to the (ultimate economic, not fiduciary) settlor of the trust (individual(s) or entity/ies)`, labelField: "fullName", name: "settlors", fields: [ @@ -78,7 +78,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -86,40 +86,40 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "absoluteTime", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { type: "absoluteTime", props: { name: "dateOfDeath", - label: "Date of death" as TranslatedString, + label: i18n.str`Date of death`, pattern: "dd/MM/yyyy", - // help: "if deceased. format 'dd/MM/yyyy'" as TranslatedString, - help: "if deceased'" as TranslatedString, + // help: i18n.str`if deceased. format 'dd/MM/yyyy'`, + help: i18n.str`if deceased'`, }, }, { @@ -128,14 +128,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ name: "rightToRevoke", required: true, label: - "Does the founder have the right to revoke the trust?" as TranslatedString, + i18n.str`Does the founder have the right to revoke the trust?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -148,7 +148,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "If the trust results from the restructuring of pre-existing trust (re-settlement) or the merger of pre-existing trusts, the following information pertaining to the (actual) settlor of the pre-existing trust(s) has to be given" as TranslatedString, + i18n.str`If the trust results from the restructuring of pre-existing trust (re-settlement) or the merger of pre-existing trusts, the following information pertaining to the (actual) settlor of the pre-existing trust(s) has to be given`, labelField: "fullName", name: "preExistingSettlors", fields: [ @@ -157,7 +157,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -165,40 +165,40 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "absoluteTime", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { type: "absoluteTime", props: { name: "dateOfDeath", - label: "Date of death" as TranslatedString, + label: i18n.str`Date of death`, pattern: "dd/MM/yyyy", - help: "if deceased." as TranslatedString, - // help: "if deceased. format 'dd/MM/yyyy'" as TranslatedString, + help: i18n.str`if deceased.`, + // help: i18n.str`if deceased. format 'dd/MM/yyyy'`, }, }, ], @@ -208,7 +208,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "Pertaining to the beneficiary/-ies at the time of the signing of this form" as TranslatedString, + i18n.str`Pertaining to the beneficiary/-ies at the time of the signing of this form`, labelField: "fullName", name: "beneficiaryWhenSigning", fields: [ @@ -217,7 +217,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -225,30 +225,30 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "absoluteTime", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { @@ -256,14 +256,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "rightToClaim", label: - "Has the beneficiary an actual right to claim distribution?" as TranslatedString, + i18n.str`Has the beneficiary an actual right to claim distribution?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -273,7 +273,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "textArea", props: { label: - "in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the settlor) known at the time of the signing of this form" as TranslatedString, + i18n.str`in addition to certain beneficiaries or if there is/are no defined beneficiary/ies pertaining to (a) group(s) of beneficiaries (e.g. descendants of the settlor) known at the time of the signing of this form`, name: "beneficiaryExtra", }, }, @@ -284,7 +284,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "Information pertaining to the protector(s) as well as (a) further person(s) having the right to revoke the trust (in case of revocable trusts) or to appoint the trustee of a trust" as TranslatedString, + i18n.str`Information pertaining to the protector(s) as well as (a) further person(s) having the right to revoke the trust (in case of revocable trusts) or to appoint the trustee of a trust`, labelField: "asd", name: "nothing", fields: [], @@ -295,7 +295,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "Information pertaining to the protectors" as TranslatedString, + i18n.str`Information pertaining to the protectors`, labelField: "fullName", name: "protectors", fields: [ @@ -304,7 +304,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -312,28 +312,28 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { @@ -341,14 +341,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "rightToClaim", label: - "Does the protector have the right to revoke the trust?" as TranslatedString, + i18n.str`Does the protector have the right to revoke the trust?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -361,7 +361,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "array", props: { label: - "Information pertaining to further persons" as TranslatedString, + i18n.str`Information pertaining to further persons`, labelField: "fullName", name: "furtherPersons", fields: [ @@ -370,7 +370,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -378,28 +378,28 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "address", label: - "Actual address of domicile/registered office" as TranslatedString, + i18n.str`Actual address of domicile/registered office`, }, }, { type: "text", props: { name: "country", - label: "Country" as TranslatedString, + label: i18n.str`Country`, }, }, { type: "text", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { @@ -407,14 +407,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ props: { name: "rightToClaim", label: - "Has this further person the right to revoke the trust?" as TranslatedString, + i18n.str`Has this further person the right to revoke the trust?`, choices: [ { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, value: "yes", }, { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, ], @@ -427,12 +427,12 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_13.Form> => ({ type: "text", props: { name: "signature", - label: "Signature" as TranslatedString, + label: i18n.str`Signature`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_13.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_15e.ts b/packages/aml-backoffice-ui/src/forms/902_15e.ts index 88bf769ef..98609852b 100644 --- a/packages/aml-backoffice-ui/src/forms/902_15e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_15e.ts @@ -1,19 +1,19 @@ -import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm } from "@gnu-taler/web-util/browser"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; +import type { AbsoluteTime } from "@gnu-taler/taler-util"; +import type { FlexibleForm, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; import { resolutionSection } from "./simplest.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ design: [ { title: - "Information on life insurance policies with separately managed accounts/securities accounts" as TranslatedString, + i18n.str`Information on life insurance policies with separately managed accounts/securities accounts`, fields: [ { type: "textArea", props: { name: "contractingPartner", - label: "Contracting partner" as TranslatedString, + label: i18n.str`Contracting partner`, }, }, { @@ -21,41 +21,41 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ props: { name: "contractualRelationship", label: - "Name or number of the contractual relationship between the contracting party and the financial intermediary" as TranslatedString, + i18n.str`Name or number of the contractual relationship between the contracting party and the financial intermediary`, }, }, { type: "text", props: { name: "insurancePolicy", - label: "Insurance policy" as TranslatedString, + label: i18n.str`Insurance policy`, }, }, { type: "caption", props: { label: - "The contracting partner confirms in accordance with Art. 41a SRO Regulations that it is a licensed and state-supervised insurance company and that it has entered into the above-mentioned contractual relationship the assets connected to the life insurance policy also mentioned above." as TranslatedString, + i18n.str`The contracting partner confirms in accordance with Art. 41a SRO Regulations that it is a licensed and state-supervised insurance company and that it has entered into the above-mentioned contractual relationship the assets connected to the life insurance policy also mentioned above.`, }, }, { type: "caption", props: { label: - "In relation with the above insurance policy, the contracting partner gives the following further details" as TranslatedString, + i18n.str`In relation with the above insurance policy, the contracting partner gives the following further details`, }, }, { type: "group", props: { - before: "Policy holder" as TranslatedString, + before: i18n.str`Policy holder`, fields: [ { type: "text", props: { name: "holder.fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -63,23 +63,23 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ props: { name: "holder.address", label: - "Actual address of domicile/registered office (incl. country)" as TranslatedString, + i18n.str`Actual address of domicile/registered office (incl. country)`, }, }, { type: "absoluteTime", props: { name: "holder.dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "holder.nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, ], @@ -89,14 +89,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ type: "group", props: { before: - "Person actually (not in a fiduciary capacity) paying the premiums (to be filled in if not identical with point 1 above)" as TranslatedString, + i18n.str`Person actually (not in a fiduciary capacity) paying the premiums (to be filled in if not identical with point 1 above)`, fields: [ { type: "text", props: { name: "premiumPayer.fullName", label: - "Last name(s), first name(s)/entity" as TranslatedString, + i18n.str`Last name(s), first name(s)/entity`, }, }, { @@ -104,23 +104,23 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ props: { name: "premiumPayer.address", label: - "Actual address of domicile/registered office (incl. country)" as TranslatedString, + i18n.str`Actual address of domicile/registered office (incl. country)`, }, }, { type: "absoluteTime", props: { name: "premiumPayer.dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "premiumPayer.nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, ], @@ -130,26 +130,26 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_15.Form> => ({ type: "caption", props: { label: - "The contracting partner hereby undertakes to automatically inform the financial intermediary of any changes. The contracting partner hereby also declares having been given permission by the above individuals and/or entities to transmit their data to the financial intermediary" as TranslatedString, + i18n.str`The contracting partner hereby undertakes to automatically inform the financial intermediary of any changes. The contracting partner hereby also declares having been given permission by the above individuals and/or entities to transmit their data to the financial intermediary`, }, }, { type: "text", props: { name: "signature", - label: "Signature" as TranslatedString, + label: i18n.str`Signature`, }, }, { type: "caption", props: { label: - "It is a criminal offense to deliberately provide false information on this form (article 251 of the Swiss Criminal Code, document forgery)" as TranslatedString, + i18n.str`It is a criminal offense to deliberately provide false information on this form (article 251 of the Swiss Criminal Code, document forgery)`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], }); diff --git a/packages/aml-backoffice-ui/src/forms/902_1e.ts b/packages/aml-backoffice-ui/src/forms/902_1e.ts index f146cde63..2db6f1b7e 100644 --- a/packages/aml-backoffice-ui/src/forms/902_1e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_1e.ts @@ -1,29 +1,28 @@ -import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; -import { languageList } from "./index.js"; +import type { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; import { resolutionSection } from "./simplest.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ design: [ { - title: "Information on customer" as TranslatedString, + title: i18n.str`Information on customer`, description: - "The customer is the person with whom the member concludes the contract with regard to the financial service provided (civil law). Does the member act as director of a domiciliary company, this domiciliary company is the customer." as TranslatedString, + i18n.str`The customer is the person with whom the member concludes the contract with regard to the financial service provided (civil law). Does the member act as director of a domiciliary company, this domiciliary company is the customer.`, fields: [ { type: "choiceStacked", props: { name: "customerType", - label: "Type of customer" as TranslatedString, + label: i18n.str`Type of customer`, required: true, choices: [ { - label: "Natural person" as TranslatedString, + label: i18n.str`Natural person`, value: "natural", }, { - label: "Legal entity" as TranslatedString, + label: i18n.str`Legal entity`, value: "legal", }, ], @@ -33,7 +32,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "naturalCustomer.fullName", - label: "Full name" as TranslatedString, + label: i18n.str`Full name`, required: true, }, }, @@ -41,7 +40,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "naturalCustomer.address", - label: "Residential address" as TranslatedString, + label: i18n.str`Residential address`, required: true, }, }, @@ -49,30 +48,30 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "integer", props: { name: "naturalCustomer.telephone", - label: "Telephone" as TranslatedString, + label: i18n.str`Telephone`, }, }, { type: "text", props: { name: "naturalCustomer.email", - label: "E-mail" as TranslatedString, + label: i18n.str`E-mail`, }, }, { type: "absoluteTime", props: { name: "naturalCustomer.dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, required: true, - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "naturalCustomer.nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, required: true, }, }, @@ -80,7 +79,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "naturalCustomer.document", - label: "Identification document" as TranslatedString, + label: i18n.str`Identification document`, required: true, }, }, @@ -88,50 +87,50 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "file", props: { name: "naturalCustomer.documentAttachment", - label: "Document attachment" as TranslatedString, + label: i18n.str`Document attachment`, required: true, maxBites: 2 * 1024 * 1024, accept: ".png", - help: "Max size of 2 mega bytes" as TranslatedString, + help: i18n.str`Max size of 2 mega bytes`, }, }, { type: "text", props: { name: "naturalCustomer.companyName", - label: "Company name" as TranslatedString, + label: i18n.str`Company name`, }, }, { type: "text", props: { name: "naturalCustomer.office", - label: "Registered office" as TranslatedString, + label: i18n.str`Registered office`, }, }, { type: "text", props: { name: "naturalCustomer.companyDocument", - label: "Company identification document" as TranslatedString, + label: i18n.str`Company identification document`, }, }, { type: "file", props: { name: "naturalCustomer.companyDocumentAttachment", - label: "Document attachment" as TranslatedString, + label: i18n.str`Document attachment`, required: true, maxBites: 2 * 1024 * 1024, accept: ".png", - help: "Max size of 2 mega bytes" as TranslatedString, + help: i18n.str`Max size of 2 mega bytes`, }, }, { type: "text", props: { name: "legalCustomer.companyName", - label: "Company name" as TranslatedString, + label: i18n.str`Company name`, required: true, }, }, @@ -139,7 +138,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "legalCustomer.domicile", - label: "Domicile" as TranslatedString, + label: i18n.str`Domicile`, required: true, }, }, @@ -147,63 +146,63 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "legalCustomer.contactPerson", - label: "Contact person" as TranslatedString, + label: i18n.str`Contact person`, }, }, { type: "text", props: { name: "legalCustomer.telephone", - label: "Telephone" as TranslatedString, + label: i18n.str`Telephone`, }, }, { type: "text", props: { name: "legalCustomer.email", - label: "E-mail" as TranslatedString, + label: i18n.str`E-mail`, }, }, { type: "text", props: { name: "legalCustomer.document", - label: "Identification document" as TranslatedString, - help: "Not older than 12 month" as TranslatedString, + label: i18n.str`Identification document`, + help: i18n.str`Not older than 12 month`, }, }, { type: "file", props: { name: "legalCustomer.documentAttachment", - label: "Document attachment" as TranslatedString, + label: i18n.str`Document attachment`, required: true, maxBites: 2 * 1024 * 1024, accept: ".png", - help: "Max size of 2 mega bytes" as TranslatedString, + help: i18n.str`Max size of 2 mega bytes`, }, }, ], }, { title: - "Information on the natural persons who establish the business relationship for legal entities and partnerships" as TranslatedString, + i18n.str`Information on the natural persons who establish the business relationship for legal entities and partnerships`, description: - "For legal entities and partnerships the identity of the natural persons who establish the business relationship must be verified." as TranslatedString, + i18n.str`For legal entities and partnerships the identity of the natural persons who establish the business relationship must be verified.`, fields: [ { type: "array", props: { name: "businessEstablisher", - label: "Persons" as TranslatedString, + label: i18n.str`Persons`, required: true, - placeholder: "this is the placeholder" as TranslatedString, + placeholder: i18n.str`this is the placeholder`, fields: [ { type: "text", props: { name: "fullName", - label: "Full name" as TranslatedString, + label: i18n.str`Full name`, required: true, }, }, @@ -211,7 +210,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "address", - label: "Residential address" as TranslatedString, + label: i18n.str`Residential address`, required: true, }, }, @@ -219,16 +218,16 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "absoluteTime", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, required: true, - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, required: true, }, }, @@ -237,7 +236,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ props: { name: "typeOfAuthorization", label: - "Type of authorization (signatory of representation)" as TranslatedString, + i18n.str`Type of authorization (signatory of representation)`, required: true, }, }, @@ -246,30 +245,30 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ props: { name: "documentAttachment", label: - "Identification document attachment" as TranslatedString, + i18n.str`Identification document attachment`, required: true, maxBites: 2 * 1024 * 1024, accept: ".png", - help: "Max size of 2 mega bytes" as TranslatedString, + help: i18n.str`Max size of 2 mega bytes`, }, }, { type: "choiceStacked", props: { name: "powerOfAttorneyArrangements", - label: "Power of attorney arrangements" as TranslatedString, + label: i18n.str`Power of attorney arrangements`, required: true, choices: [ { - label: "CR extract" as TranslatedString, + label: i18n.str`CR extract`, value: "cr", }, { - label: "Mandate" as TranslatedString, + label: i18n.str`Mandate`, value: "mandate", }, { - label: "Other" as TranslatedString, + label: i18n.str`Other`, value: "other", }, ], @@ -279,7 +278,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "powerOfAttorneyArrangementsOther", - label: "Power of attorney arrangements" as TranslatedString, + label: i18n.str`Power of attorney arrangements`, required: true, }, }, @@ -290,36 +289,36 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ ], }, { - title: "Acceptance of business relationship" as TranslatedString, + title: i18n.str`Acceptance of business relationship`, fields: [ { type: "absoluteTime", props: { name: "acceptance.when", pattern: "dd/MM/yyyy", - label: "Date (conclusion of contract)" as TranslatedString, - // help: "format 'dd/MM/yyyy'" as TranslatedString, + label: i18n.str`Date (conclusion of contract)`, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "choiceStacked", props: { name: "acceptance.acceptedBy", - label: "Accepted by" as TranslatedString, + label: i18n.str`Accepted by`, required: true, choices: [ { - label: "Face-to-face meeting with customer" as TranslatedString, + label: i18n.str`Face-to-face meeting with customer`, value: "face-to-face", }, { label: - "Correspondence: authenticated copy of identification document obtained" as TranslatedString, + i18n.str`Correspondence: authenticated copy of identification document obtained`, value: "correspondence-document", }, { label: - "Correspondence: residential address validated" as TranslatedString, + i18n.str`Correspondence: residential address validated`, value: "correspondence-address", }, ], @@ -329,22 +328,22 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "choiceStacked", props: { name: "acceptance.typeOfCorrespondence", - label: "Type of correspondence service" as TranslatedString, + label: i18n.str`Type of correspondence service`, choices: [ { - label: "to the customer" as TranslatedString, + label: i18n.str`to the customer`, value: "customer", }, { - label: "hold at bank" as TranslatedString, + label: i18n.str`hold at bank`, value: "bank", }, { - label: "to the member" as TranslatedString, + label: i18n.str`to the member`, value: "member", }, { - label: "to a third party" as TranslatedString, + label: i18n.str`to a third party`, value: "third-party", }, ], @@ -354,7 +353,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "acceptance.thirdPartyFullName", - label: "Third party full name" as TranslatedString, + label: i18n.str`Third party full name`, required: true, }, }, @@ -362,7 +361,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "text", props: { name: "acceptance.thirdPartyAddress", - label: "Third party address" as TranslatedString, + label: i18n.str`Third party address`, required: true, }, }, @@ -370,8 +369,8 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "selectMultiple", props: { name: "acceptance.language", - label: "Languages" as TranslatedString, - choices: languageList, + label: i18n.str`Languages`, + choices: window.amlExchangeBackoffice!.currencies(i18n), unique: true, }, }, @@ -379,46 +378,46 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ type: "textArea", props: { name: "acceptance.furtherInformation", - label: "Further information" as TranslatedString, + label: i18n.str`Further information`, }, }, ], }, { title: - "Information on the beneficial owner of the assets and/or controlling person" as TranslatedString, + i18n.str`Information on the beneficial owner of the assets and/or controlling person`, description: - "Establishment of the beneficial owner of the assets and/or controlling person" as TranslatedString, + i18n.str`Establishment of the beneficial owner of the assets and/or controlling person`, fields: [ { type: "choiceStacked", props: { name: "establishment", - label: "The customer is" as TranslatedString, + label: i18n.str`The customer is`, required: true, choices: [ { label: - "a natural person and there are no doubts that this person is the sole beneficial owner of the assets" as TranslatedString, + i18n.str`a natural person and there are no doubts that this person is the sole beneficial owner of the assets`, value: "natural", }, { label: - "a foundation (or a similar construct; incl. underlying companies)" as TranslatedString, + i18n.str`a foundation (or a similar construct; incl. underlying companies)`, value: "foundation", }, { label: - "a trust (incl. underlying companies)" as TranslatedString, + i18n.str`a trust (incl. underlying companies)`, value: "trust", }, { label: - "a life insurance policy with separately managed accounts/securities accounts" as TranslatedString, + i18n.str`a life insurance policy with separately managed accounts/securities accounts`, value: "insurance-wrapper", }, { - label: "all other cases" as TranslatedString, + label: i18n.str`all other cases`, value: "other", }, ], @@ -428,43 +427,43 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ }, { title: - "Evaluation with regard to embargo procedures/terrorism lists on establishing the business relationship" as TranslatedString, + i18n.str`Evaluation with regard to embargo procedures/terrorism lists on establishing the business relationship`, description: - "Verification whether the customer, beneficial owners of the assets, controlling persons, authorized representatives or other involved persons are listed on an embargo/terrorism list (date of verification/result)" as TranslatedString, + i18n.str`Verification whether the customer, beneficial owners of the assets, controlling persons, authorized representatives or other involved persons are listed on an embargo/terrorism list (date of verification/result)`, fields: [ { type: "textArea", props: { name: "embargoEvaluation", - help: "The evaluation must be made at the beginning of the business relationship and has to be repeated in the case of permanent business relationship every time the according lists are updated." as TranslatedString, - label: "Evaluation" as TranslatedString, + help: i18n.str`The evaluation must be made at the beginning of the business relationship and has to be repeated in the case of permanent business relationship every time the according lists are updated.`, + label: i18n.str`Evaluation`, }, }, ], }, { title: - "In the case of cash transactions/occasional customers: Information on type and purpose of business relationship" as TranslatedString, + i18n.str`In the case of cash transactions/occasional customers: Information on type and purpose of business relationship`, description: - "These details are only necessary for occasional customers, i.e. money exchange, money and asset transfer or other cash transactions provided that no customer profile (VQF doc. No. 902.5) is created" as TranslatedString, + i18n.str`These details are only necessary for occasional customers, i.e. money exchange, money and asset transfer or other cash transactions provided that no customer profile (VQF doc. No. 902.5) is created`, fields: [ { type: "choiceStacked", props: { name: "cashTransactions.typeOfBusiness", - label: "Type of business relationship" as TranslatedString, + label: i18n.str`Type of business relationship`, choices: [ { - label: "Money exchange" as TranslatedString, + label: i18n.str`Money exchange`, value: "money-exchange", }, { - label: "Money and asset transfer" as TranslatedString, + label: i18n.str`Money and asset transfer`, value: "money-and-asset-transfer", }, { label: - "Other cash transactions. Specify below" as TranslatedString, + i18n.str`Other cash transactions. Specify below`, value: "other", }, ], @@ -475,7 +474,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ props: { name: "cashTransactions.otherTypeOfBusiness", required: true, - label: "Specify other cash transactions:" as TranslatedString, + label: i18n.str`Specify other cash transactions:`, }, }, { @@ -483,12 +482,12 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_1.Form> => ({ props: { name: "cashTransactions.purpose", label: - "Purpose of the business relationship (purpose of service requested)" as TranslatedString, + i18n.str`Purpose of the business relationship (purpose of service requested)`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_1.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_4e.ts b/packages/aml-backoffice-ui/src/forms/902_4e.ts index 6c6e55886..e6d15eae3 100644 --- a/packages/aml-backoffice-ui/src/forms/902_4e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_4e.ts @@ -1,22 +1,22 @@ -import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; +import type { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; import { h as create } from "preact"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; -import { ArrowRightIcon, ChevronRightIcon } from "../pages/Cases.js"; import { resolutionSection } from "./simplest.js"; +import { BaseForm } from "./index.js"; +import { ArrowRightIcon, ChevronRightIcon } from "./icons.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ design: [ { - title: "Risk Profile AMLA" as TranslatedString, + title: i18n.str`Risk Profile AMLA`, description: - "Evaluation of business relationship with increased risk and definition of criteria for transaction monitoring." as TranslatedString, + i18n.str`Evaluation of business relationship with increased risk and definition of criteria for transaction monitoring.`, fields: [ { type: "caption", props: { label: - "The member performs additional clarifications if the business relationship or the transaction is classified as increased risk (Art. 56 SRO Regulations)" as TranslatedString, + i18n.str`The member performs additional clarifications if the business relationship or the transaction is classified as increased risk (Art. 56 SRO Regulations)`, before: create(ArrowRightIcon, { class: "h-6 w-6" }), }, }, @@ -24,41 +24,41 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "text", props: { name: "customer", - label: "Customer" as TranslatedString, - help: "Pursuant identification form (VQF doc. Nr. 902.1) numeral 1" as TranslatedString, + label: i18n.str`Customer`, + help: i18n.str`Pursuant identification form (VQF doc. Nr. 902.1) numeral 1`, }, }, ], }, { title: - "Evaluation of politically exposed persons (PEP-Check)" as TranslatedString, + i18n.str`Evaluation of politically exposed persons (PEP-Check)`, fields: [ { type: "caption", props: { label: - "This evaluation has to be completed by all members for every business relationship" as TranslatedString, + i18n.str`This evaluation has to be completed by all members for every business relationship`, before: create(ArrowRightIcon, { class: "h-6 w-6" }), }, }, { type: "choiceStacked", props: { - label: "Foreign PEP" as TranslatedString, + label: i18n.str`Foreign PEP`, // tooltip: - // "Definition see Art. 7 lit. g numeral 1 SRO Regulations" as TranslatedString, - help: "Is the customer, the beneficial owner or the controlling person or authorized representative a foreign PEP or closely related to such a person?" as TranslatedString, + // i18n.str`Definition see Art. 7 lit. g numeral 1 SRO Regulations`, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorized representative a foreign PEP or closely related to such a person?`, name: "pep.foreign", choices: [ { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, description: - "The business relationship is compulsory classified as increased risk" as TranslatedString, + i18n.str`The business relationship is compulsory classified as increased risk`, value: "yes", }, ], @@ -68,26 +68,26 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "choiceStacked", props: { label: - "Domestic PEP and PEP of International Organizations" as TranslatedString, + i18n.str`Domestic PEP and PEP of International Organizations`, // tooltip: - // "Definition see Art. 7 lit. g numeral 2 and 3 SRO Regulations " as TranslatedString, - help: "Is the customer, the beneficial owner or the controlling person or authorized representative a domestic PEP or PEP in International Organizations or closely related to such a person?" as TranslatedString, + // i18n.str`Definition see Art. 7 lit. g numeral 2 and 3 SRO Regulations `, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorized representative a domestic PEP or PEP in International Organizations or closely related to such a person?`, name: "pep.domestic", choices: [ { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, { label: - "Yes, but NOT risk criterion pursuant to numeral 3 subsequently increased." as TranslatedString, + i18n.str`Yes, but NOT risk criterion pursuant to numeral 3 subsequently increased.`, value: "yes-but-no-risk", }, { label: - "Yes, AND a risk criterion pursuant to numeral 3 subsequently increased." as TranslatedString, + i18n.str`Yes, AND a risk criterion pursuant to numeral 3 subsequently increased.`, description: - "Classification of the business relationship as increased risk is compulsory" as TranslatedString, + i18n.str`Classification of the business relationship as increased risk is compulsory`, value: "yes", }, ], @@ -97,10 +97,10 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "absoluteTime", props: { label: - "The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on" as TranslatedString, + i18n.str`The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on`, name: "pep.when", pattern: "dd/MM/yyyy", - // placeholder: "dd/MM/yyyy" as TranslatedString, + // placeholder: i18n.str`dd/MM/yyyy`, }, }, ], @@ -113,7 +113,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "caption", props: { label: - "This evaluation has to be completed by all members for every business relationship" as TranslatedString, + i18n.str`This evaluation has to be completed by all members for every business relationship`, before: create(ArrowRightIcon, { class: "h-6 w-6" }), }, }, @@ -125,13 +125,13 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ name: "highRisk.evaluation", choices: [ { - label: "No" as TranslatedString, + label: i18n.str`No`, value: "no", }, { - label: "Yes" as TranslatedString, + label: i18n.str`Yes`, description: - "considered as business relationship with increased risk" as TranslatedString, + i18n.str`considered as business relationship with increased risk`, value: "yes", }, ], @@ -141,47 +141,47 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "absoluteTime", props: { label: - "The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on" as TranslatedString, + i18n.str`The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on`, name: "highRisk.when", pattern: "dd/MM/yyyy", - // placeholder: "dd/MM/yyyy" as TranslatedString, + // placeholder: i18n.str`dd/MM/yyyy`, }, }, ], }, { - title: "Evaluation of business relationship risk" as TranslatedString, + title: i18n.str`Evaluation of business relationship risk`, fields: [ { type: "caption", props: { label: - "This evaluation has to be completed by all members who have in total more than 20 customers for every business relationship. At least two risk categories have to be chosen and assessed" as TranslatedString, + i18n.str`This evaluation has to be completed by all members who have in total more than 20 customers for every business relationship. At least two risk categories have to be chosen and assessed`, before: create(ArrowRightIcon, { class: "h-6 w-6" }), }, }, { type: "group", props: { - before: "a) Country risk (nationality)" as TranslatedString, + before: i18n.str`a) Country risk (nationality)`, fields: [ { type: "choiceStacked", props: { - label: "Domicile/residential address" as TranslatedString, + label: i18n.str`Domicile/residential address`, name: "evaluation.nationality.address", choices: [ { - label: "Customer" as TranslatedString, + label: i18n.str`Customer`, value: "customer", }, { label: - "Beneficial owner of the assets" as TranslatedString, + i18n.str`Beneficial owner of the assets`, value: "owner", }, { - label: "Controlling person" as TranslatedString, + label: i18n.str`Controlling person`, value: "controlling", }, ], @@ -190,16 +190,16 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "choiceStacked", props: { - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, name: "evaluation.nationality.nationality", choices: [ { - label: "Customer" as TranslatedString, + label: i18n.str`Customer`, value: "customer", }, { label: - "Beneficial owner of the assets" as TranslatedString, + i18n.str`Beneficial owner of the assets`, value: "owner", }, ], @@ -208,22 +208,22 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.nationality.risk", choices: [ { label: - "Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "low", }, { label: - "Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "medium", }, { label: - "Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "high", }, ], @@ -235,21 +235,21 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "b) Country risk (business activity)" as TranslatedString, + before: i18n.str`b) Country risk (business activity)`, fields: [ { type: "choiceStacked", props: { - label: "Place of business activity" as TranslatedString, + label: i18n.str`Place of business activity`, name: "evaluation.business.place", choices: [ { - label: "Customer" as TranslatedString, + label: i18n.str`Customer`, value: "customer", }, { label: - "Beneficial owner of the assets" as TranslatedString, + i18n.str`Beneficial owner of the assets`, value: "owner", }, ], @@ -258,22 +258,22 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.business.risk", choices: [ { label: - "Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "low", }, { label: - "Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "medium", }, { label: - "Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "high", }, ], @@ -285,34 +285,34 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "c) Country risk (payments)" as TranslatedString, + before: i18n.str`c) Country risk (payments)`, fields: [ { type: "caption", props: { label: - "Country of origin and destination of frequent payments (if known)" as TranslatedString, + i18n.str`Country of origin and destination of frequent payments (if known)`, }, }, { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.payments.risk", choices: [ { label: - "Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 0 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "low", }, { label: - "Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 1 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "medium", }, { label: - "Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)" as TranslatedString, + i18n.str`Risk 2 acc. to VQF country list (VQF doc. no. 902.4.1)`, value: "high", }, ], @@ -324,22 +324,22 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "d) Industry risk" as TranslatedString, + before: i18n.str`d) Industry risk`, fields: [ { type: "choiceStacked", props: { label: - "Nature of customer's business activity" as TranslatedString, + i18n.str`Nature of customer's business activity`, name: "evaluation.industry.nature", choices: [ { - label: "Customer" as TranslatedString, + label: i18n.str`Customer`, value: "customer", }, { label: - "Beneficial owner of the assets" as TranslatedString, + i18n.str`Beneficial owner of the assets`, value: "owner", }, ], @@ -348,32 +348,32 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.payments.risk", choices: [ { label: - "Clearly defined, transparent, easily comprehensible business activity well known to the member" as TranslatedString, + i18n.str`Clearly defined, transparent, easily comprehensible business activity well known to the member`, value: "low", }, { label: - "Business activity with a high level of cash transactions" as TranslatedString, + i18n.str`Business activity with a high level of cash transactions`, value: "medium-cash", }, { label: - "Business activity not well known to the member" as TranslatedString, + i18n.str`Business activity not well known to the member`, value: "medium-unknown", }, { label: - "Trade in munitions/arms, raw gem stones/diamonds, jewelry, international trade in exotic animals, casino and lottery business, trade in erotic wares" as TranslatedString, + i18n.str`Trade in munitions/arms, raw gem stones/diamonds, jewelry, international trade in exotic animals, casino and lottery business, trade in erotic wares`, value: "high-restricted", }, { label: - "Member has no personal knowledge of the customer's industry" as TranslatedString, + i18n.str`Member has no personal knowledge of the customer's industry`, value: "high-unknown", }, ], @@ -385,34 +385,34 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "e) Contact risk" as TranslatedString, + before: i18n.str`e) Contact risk`, fields: [ { type: "caption", props: { label: - "Types of contact to the customer/ beneficial owner of the assets" as TranslatedString, + i18n.str`Types of contact to the customer/ beneficial owner of the assets`, }, }, { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.contact.risk", choices: [ { label: - "Personal acquaintance between member and customer/beneficial owner of the assets over several years (at least 2) prior to entering into the business relationship" as TranslatedString, + i18n.str`Personal acquaintance between member and customer/beneficial owner of the assets over several years (at least 2) prior to entering into the business relationship`, value: "low", }, { label: - "The customer/beneficial owner was not personally known to the member for several years (at least 2) prior to entering into the business relationship; however (a) no business was entered into in the absence of the customer/beneficial owner, or (b) the customer was at least introduced/brokered by a trusted third party" as TranslatedString, + i18n.str`The customer/beneficial owner was not personally known to the member for several years (at least 2) prior to entering into the business relationship; however (a) no business was entered into in the absence of the customer/beneficial owner, or (b) the customer was at least introduced/brokered by a trusted third party`, value: "medium", }, { label: - "The customer/beneficial owner was not personally known to the member and business was entered into in the absence of the former (relationship by correspondence) and the customer was not introduced/brokered by a trusted third party" as TranslatedString, + i18n.str`The customer/beneficial owner was not personally known to the member and business was entered into in the absence of the former (relationship by correspondence) and the customer was not introduced/brokered by a trusted third party`, value: "high", }, ], @@ -424,54 +424,54 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "f) Product risk" as TranslatedString, + before: i18n.str`f) Product risk`, fields: [ { type: "caption", props: { label: - "Nature of services and products requested by the customer" as TranslatedString, + i18n.str`Nature of services and products requested by the customer`, }, }, { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.product.risk", choices: [ { label: - "Easy to understand, transparent services and products whose financial background is easy to comprehend and verify" as TranslatedString, + i18n.str`Easy to understand, transparent services and products whose financial background is easy to comprehend and verify`, value: "low", }, { label: - "More sophisticated services/products whose financial background is not readily easy to comprehend and verify" as TranslatedString, + i18n.str`More sophisticated services/products whose financial background is not readily easy to comprehend and verify`, value: "medium", }, { label: - "Main focus on offshore business (especially: relationships with domiciliary companies or other such offshore organisations)" as TranslatedString, + i18n.str`Main focus on offshore business (especially: relationships with domiciliary companies or other such offshore organisations)`, value: "high-offshore", }, { label: - "Complex structures in particular by using a domiciliary company with fiduciary shareholders in a non-transparent jurisdiction, without comprehensible reason or for the purpose of short-term asset placement" as TranslatedString, + i18n.str`Complex structures in particular by using a domiciliary company with fiduciary shareholders in a non-transparent jurisdiction, without comprehensible reason or for the purpose of short-term asset placement`, value: "high-structure", }, { label: - "The customer or beneficial owner of the assets has a large number of accounts with pass-through transactions (pass-through accounts)" as TranslatedString, + i18n.str`The customer or beneficial owner of the assets has a large number of accounts with pass-through transactions (pass-through accounts)`, value: "high-accounts", }, { label: - "Complex services/products whose financial background can’t be understood or verified with considerable effort" as TranslatedString, + i18n.str`Complex services/products whose financial background can’t be understood or verified with considerable effort`, value: "high-service", }, { label: - "Frequent transactions with increased risks" as TranslatedString, + i18n.str`Frequent transactions with increased risks`, value: "high-freq-tx", }, ], @@ -483,31 +483,31 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ { type: "group", props: { - before: "g) Criteria defined by the member" as TranslatedString, + before: i18n.str`g) Criteria defined by the member`, fields: [ { type: "text", props: { - label: "Criteria definition" as TranslatedString, + label: i18n.str`Criteria definition`, name: "evaluation.custom.definition", }, }, { type: "choiceStacked", props: { - label: "Risk level" as TranslatedString, + label: i18n.str`Risk level`, name: "evaluation.custom.risk", choices: [ { - label: "Low" as TranslatedString, + label: i18n.str`Low`, value: "low", }, { - label: "Medium" as TranslatedString, + label: i18n.str`Medium`, value: "medium", }, { - label: "High" as TranslatedString, + label: i18n.str`High`, value: "high", }, ], @@ -520,20 +520,20 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "caption", props: { label: - "Overall assessment of the business relationship" as TranslatedString, + i18n.str`Overall assessment of the business relationship`, }, }, { type: "group", props: { before: - "A business relationship is classified as increased risk if:" as TranslatedString, + i18n.str`A business relationship is classified as increased risk if:`, fields: [ { type: "caption", props: { label: - "Business relationship with PEP pursuant to numeral 1 (no exception possible)" as TranslatedString, + i18n.str`Business relationship with PEP pursuant to numeral 1 (no exception possible)`, before: create(ChevronRightIcon, { class: "h-6 w-6" }), }, }, @@ -549,7 +549,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "caption", props: { label: - "Min. one criterion pursuant to numeral 3 was assessed with risk 2 or min. two criteria pursuant to numeral 3 were assessed with risk 1 (exception: justification by the member below why the business relationship overall does not have to be classified as increased risk despite the fact that individual risk criteria are increased)" as TranslatedString, + i18n.str`Min. one criterion pursuant to numeral 3 was assessed with risk 2 or min. two criteria pursuant to numeral 3 were assessed with risk 1 (exception: justification by the member below why the business relationship overall does not have to be classified as increased risk despite the fact that individual risk criteria are increased)`, before: create(ChevronRightIcon, { class: "h-6 w-6" }), }, }, @@ -560,24 +560,24 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "textArea", props: { label: - "Justification for differing risk assessment" as TranslatedString, + i18n.str`Justification for differing risk assessment`, name: "evaluation.overall.justification", }, }, { type: "choiceStacked", props: { - label: "Risk classified" as TranslatedString, + label: i18n.str`Risk classified`, name: "evaluation.overall.risk", choices: [ { label: - "Business relationship _without_ increased risk" as TranslatedString, + i18n.str`Business relationship _without_ increased risk`, value: "without", }, { label: - "Business relationship __with__ increased risk" as TranslatedString, + i18n.str`Business relationship __with__ increased risk`, value: "with", }, ], @@ -587,28 +587,28 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "absoluteTime", props: { label: - "The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on" as TranslatedString, + i18n.str`The decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtained on`, name: "evaluation.when", pattern: "dd/MM/yyyy", - // placeholder: "dd/MM/yyyy" as TranslatedString, + // placeholder: i18n.str`dd/MM/yyyy`, }, }, ], }, { title: - "Criteria for identification of increased risk transactions (transaction monitoring)" as TranslatedString, + i18n.str`Criteria for identification of increased risk transactions (transaction monitoring)`, fields: [ { type: "group", props: { - before: "Criteria" as TranslatedString, + before: i18n.str`Criteria`, fields: [ { type: "caption", props: { label: - "Classification as as increased risk is compulsory if" as TranslatedString, + i18n.str`Classification as as increased risk is compulsory if`, }, }, { @@ -616,7 +616,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ props: { before: create(ChevronRightIcon, { class: "w-6 h-6" }), label: - "Transactions for which assets with an equivalent value of CHF 100'000.- or more are physically introduced at the beginning of the business relationship, either at once or in a staggered manner" as TranslatedString, + i18n.str`Transactions for which assets with an equivalent value of CHF 100'000.- or more are physically introduced at the beginning of the business relationship, either at once or in a staggered manner`, }, }, { @@ -642,20 +642,20 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "group", props: { before: - "Additional criteria defined by the member" as TranslatedString, + i18n.str`Additional criteria defined by the member`, fields: [ { type: "caption", props: { before: create(ArrowRightIcon, { class: "w-6 h-6" }), label: - "All members have to define min. 1 additional criterion for every business relationship to identify unusual transactions" as TranslatedString, + i18n.str`All members have to define min. 1 additional criterion for every business relationship to identify unusual transactions`, }, }, { type: "textArea", props: { - label: "Description" as TranslatedString, + label: i18n.str`Description`, name: "criteria.additional", }, }, @@ -663,14 +663,14 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ type: "group", props: { before: - "Possible criteria (Art. 59 para. 2 SRO Regulations)" as TranslatedString, + i18n.str`Possible criteria (Art. 59 para. 2 SRO Regulations)`, fields: [ { type: "caption", props: { before: create(ChevronRightIcon, { class: "w-4 h-4" }), label: - "the amount of inflowing and outflowing assets" as TranslatedString, + i18n.str`the amount of inflowing and outflowing assets`, }, }, { @@ -678,7 +678,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ props: { before: create(ChevronRightIcon, { class: "w-4 h-4" }), label: - "type, volume and frequency of transactions usual to the business relationship (considerable variance would be unusual)" as TranslatedString, + i18n.str`type, volume and frequency of transactions usual to the business relationship (considerable variance would be unusual)`, }, }, { @@ -686,7 +686,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ props: { before: create(ChevronRightIcon, { class: "w-4 h-4" }), label: - "type, volume and frequency of transactions usual to comparable business relationships (considerable variance would be unusual)" as TranslatedString, + i18n.str`type, volume and frequency of transactions usual to comparable business relationships (considerable variance would be unusual)`, }, }, { @@ -694,7 +694,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ props: { before: create(ChevronRightIcon, { class: "w-4 h-4" }), label: - "description of expected transaction patterns which the client notify the member of (considerable variance would be unusual)" as TranslatedString, + i18n.str`description of expected transaction patterns which the client notify the member of (considerable variance would be unusual)`, }, }, { @@ -713,7 +713,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_4.Form> => ({ }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_4.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_5e.ts b/packages/aml-backoffice-ui/src/forms/902_5e.ts index 8eafb506e..f8dc82b7c 100644 --- a/packages/aml-backoffice-ui/src/forms/902_5e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_5e.ts @@ -1,98 +1,97 @@ -import { TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; -import { currencyList } from "./index.js"; +import type { TranslatedString } from "@gnu-taler/taler-util"; +import type { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; import { resolutionSection } from "./simplest.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ design: [ { - title: "Customer Profile" as TranslatedString, + title: i18n.str`Customer Profile`, description: - "The information below has to refer to the persons from whom the assets originate ultimately (e.g. beneficial owner of the assets, founder/creator of a trust or foundation). Is the customer an operational legal entity or partnership the information may refer to the entity itself (not to the controlling person), unless the entity holds the assets in trust for a third party." as TranslatedString, + i18n.str`The information below has to refer to the persons from whom the assets originate ultimately (e.g. beneficial owner of the assets, founder/creator of a trust or foundation). Is the customer an operational legal entity or partnership the information may refer to the entity itself (not to the controlling person), unless the entity holds the assets in trust for a third party.`, fields: [ { type: "text", props: { name: "customer", - label: "Customer" as TranslatedString, - help: "Pursuant Identification Form (VQF doc. No. 902.1) numeral 1" as TranslatedString, + label: i18n.str`Customer`, + help: i18n.str`Pursuant Identification Form (VQF doc. No. 902.1) numeral 1`, }, }, ], }, { - title: "Business activity" as TranslatedString, + title: i18n.str`Business activity`, fields: [ { type: "textArea", props: { - label: "Profession, business activities" as TranslatedString, + label: i18n.str`Profession, business activities`, name: "businessActivity", - help: "former, current, potentially planned" as TranslatedString, + help: i18n.str`former, current, potentially planned`, }, }, ], }, { - title: "Financial circumstances" as TranslatedString, + title: i18n.str`Financial circumstances`, fields: [ { type: "textArea", props: { - label: "Income and assets, liabilities" as TranslatedString, + label: i18n.str`Income and assets, liabilities`, name: "financial", - help: "estimated" as TranslatedString, + help: i18n.str`estimated`, }, }, ], }, { - title: "Origin of the deposited assets involved" as TranslatedString, + title: i18n.str`Origin of the deposited assets involved`, fields: [ { type: "text", props: { - label: "Nature" as TranslatedString, + label: i18n.str`Nature`, name: "originOfAssets.nature", - help: "nature of the involved assets" as TranslatedString, + help: i18n.str`nature of the involved assets`, }, }, { type: "selectOne", props: { name: "originOfAssets.currency", - label: "Currency" as TranslatedString, - choices: currencyList, + label: i18n.str`Currency`, + choices: window.amlExchangeBackoffice!.currencies(i18n), }, }, { type: "integer", props: { - label: "Amount" as TranslatedString, + label: i18n.str`Amount`, name: "originOfAssets.amount", }, }, { type: "choiceStacked", props: { - label: "Category" as TranslatedString, + label: i18n.str`Category`, name: "originOfAssets.category", choices: [ { - label: "Savings" as TranslatedString, + label: i18n.str`Savings`, value: "savings", }, { - label: "Own business operations" as TranslatedString, + label: i18n.str`Own business operations`, value: "own-business", }, { - label: "Inheritance" as TranslatedString, + label: i18n.str`Inheritance`, value: "inheritance", }, { - label: "Other, what?" as TranslatedString, + label: i18n.str`Other, what?`, value: "other", }, ], @@ -101,7 +100,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ { type: "text", props: { - label: "Other category" as TranslatedString, + label: i18n.str`Other category`, name: "originOfAssets.categoryOther", required: true, }, @@ -110,7 +109,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ type: "textArea", props: { label: - "Detailed description of the origins/economical background of the assets involved in the business relationship" as TranslatedString, + i18n.str`Detailed description of the origins/economical background of the assets involved in the business relationship`, name: "originOfAssets.details", }, }, @@ -118,21 +117,21 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ }, { title: - "Nature and purpose of the business relationship" as TranslatedString, + i18n.str`Nature and purpose of the business relationship`, fields: [ { type: "textArea", props: { - label: "Purpose of the business relationship" as TranslatedString, + label: i18n.str`Purpose of the business relationship`, name: "nature.purpose", - help: "nature of the involved assets" as TranslatedString, + help: i18n.str`nature of the involved assets`, }, }, { type: "textArea", props: { label: - "Information on the planned development of the business relationship and the assets" as TranslatedString, + i18n.str`Information on the planned development of the business relationship and the assets`, name: "nature.plan", }, }, @@ -140,20 +139,20 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ type: "textArea", props: { label: - "Especially in the case of cash or money and asset transfer transactions with regular customers: Details on usual business volume, Information on the beneficiaries, (Full name, address, bank account)" as TranslatedString, + i18n.str`Especially in the case of cash or money and asset transfer transactions with regular customers: Details on usual business volume, Information on the beneficiaries, (Full name, address, bank account)`, name: "nature.cashOrMoneyTransfer", }, }, ], }, { - title: "Relationship with third parties" as TranslatedString, + title: i18n.str`Relationship with third parties`, fields: [ { type: "textArea", props: { label: - "Relation of the customer to the beneficial owner involved in the business relationship" as TranslatedString, + i18n.str`Relation of the customer to the beneficial owner involved in the business relationship`, name: "relations.beneficialOwners", }, }, @@ -161,7 +160,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ type: "textArea", props: { label: - "Relation of the customer to the controlling persons involved in the business relationship" as TranslatedString, + i18n.str`Relation of the customer to the controlling persons involved in the business relationship`, name: "relations.controllingPersons", }, }, @@ -169,7 +168,7 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ type: "textArea", props: { label: - "Relation of the customer to the authorized signatories involved in the business relationship" as TranslatedString, + i18n.str`Relation of the customer to the authorized signatories involved in the business relationship`, name: "relations.authorizedSignatories", }, }, @@ -177,39 +176,39 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_5.Form> => ({ type: "textArea", props: { label: - "Relation of the customer to other persons involved in the business relationship" as TranslatedString, + i18n.str`Relation of the customer to other persons involved in the business relationship`, name: "relations.otherPersons", }, }, { type: "textArea", props: { - label: "Relation to other AMLA-Files" as TranslatedString, + label: i18n.str`Relation to other AMLA-Files`, name: "relations.withOtherAmlaFiles", }, }, { type: "textArea", props: { - label: "Introducer / agents / references" as TranslatedString, + label: i18n.str`Introducer / agents / references`, name: "relations.references", }, }, ], }, { - title: "Further information" as TranslatedString, + title: i18n.str`Further information`, fields: [ { type: "textArea", props: { - label: "Other relevant information" as TranslatedString, + label: i18n.str`Other relevant information`, name: "furtherInformation", }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_5.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/902_9e.ts b/packages/aml-backoffice-ui/src/forms/902_9e.ts index 323a5a057..274d76445 100644 --- a/packages/aml-backoffice-ui/src/forms/902_9e.ts +++ b/packages/aml-backoffice-ui/src/forms/902_9e.ts @@ -1,32 +1,32 @@ import { AbsoluteTime, TranslatedString } from "@gnu-taler/taler-util"; -import { FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; +import { FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; import { resolutionSection } from "./simplest.js"; +import { BaseForm } from "./index.js"; -export const v1 = (current: BaseForm): FlexibleForm<Form902_9.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Form902_9.Form> => ({ design: [ { title: - "Declaration of identity of the beneficial owner" as TranslatedString, + i18n.str`Declaration of identity of the beneficial owner`, fields: [ { type: "textArea", props: { name: "contractingPartner", - label: "Contracting partner" as TranslatedString, + label: i18n.str`Contracting partner`, }, }, { type: "caption", props: { label: - "The contracting partner hereby declares that the person(s) listed below is/are the beneficial owner(s) of the assets involved in the business relationship. If the contracting partner is also the sole beneficial owner of the assets, the contracting partner's detail must be set out below" as TranslatedString, + i18n.str`The contracting partner hereby declares that the person(s) listed below is/are the beneficial owner(s) of the assets involved in the business relationship. If the contracting partner is also the sole beneficial owner of the assets, the contracting partner's detail must be set out below`, }, }, { type: "array", props: { - label: "Persons" as TranslatedString, + label: i18n.str`Persons`, labelField: "surname", name: "persons", fields: [ @@ -34,37 +34,37 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_9.Form> => ({ type: "text", props: { name: "surname", - label: "Surname(s)" as TranslatedString, + label: i18n.str`Surname(s)`, }, }, { type: "text", props: { name: "firstName", - label: "First name(s)" as TranslatedString, + label: i18n.str`First name(s)`, }, }, { type: "absoluteTime", props: { name: "dateOfBirth", - label: "Date of birth" as TranslatedString, + label: i18n.str`Date of birth`, pattern: "dd/MM/yyyy", - // help: "format 'dd/MM/yyyy'" as TranslatedString, + // help: i18n.str`format 'dd/MM/yyyy'`, }, }, { type: "text", props: { name: "nationality", - label: "Nationality" as TranslatedString, + label: i18n.str`Nationality`, }, }, { type: "text", props: { name: "address", - label: "Actual address of domicile" as TranslatedString, + label: i18n.str`Actual address of domicile`, }, }, ], @@ -74,26 +74,26 @@ export const v1 = (current: BaseForm): FlexibleForm<Form902_9.Form> => ({ type: "caption", props: { label: - "The contracting partner hereby undertakes to inform automatically of any changes to the information contained herein" as TranslatedString, + i18n.str`The contracting partner hereby undertakes to inform automatically of any changes to the information contained herein`, }, }, { type: "text", props: { name: "signature", - label: "Signature" as TranslatedString, + label: i18n.str`Signature`, }, }, { type: "caption", props: { label: - "It is a criminal offense to deliberately provide false information on this form (article 251 of the Swiss Criminal Code, document forgery)" as TranslatedString, + i18n.str`It is a criminal offense to deliberately provide false information on this form (article 251 of the Swiss Criminal Code, document forgery)`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Form902_9.Form>, diff --git a/packages/aml-backoffice-ui/src/forms/icons.tsx b/packages/aml-backoffice-ui/src/forms/icons.tsx new file mode 100644 index 000000000..a4eaac640 --- /dev/null +++ b/packages/aml-backoffice-ui/src/forms/icons.tsx @@ -0,0 +1,15 @@ +import { h } from "preact"; + +export const DocumentDuplicateIcon = <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" /> +</svg> + + +export const ChevronRightIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /> +</svg> + + +export const ArrowRightIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> + <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" /> +</svg> 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 } +} diff --git a/packages/aml-backoffice-ui/src/forms/simplest.ts b/packages/aml-backoffice-ui/src/forms/simplest.ts index 99d109da9..1561076df 100644 --- a/packages/aml-backoffice-ui/src/forms/simplest.ts +++ b/packages/aml-backoffice-ui/src/forms/simplest.ts @@ -1,30 +1,27 @@ -import { - AbsoluteTime, - AmountJson, - Amounts, - TranslatedString, +import type { + TranslatedString } from "@gnu-taler/taler-util"; -import { BaseForm } from "../pages/AntiMoneyLaunderingForm.js"; -import { AmlExchangeBackend } from "../types.js"; -import { amlStateConverter } from "../pages/ShowConsolidated.js"; -import { DoubleColumnFormSection, FlexibleForm, FormState } from "@gnu-taler/web-util/browser"; +import type { DoubleColumnFormSection, FlexibleForm, FormState, InternationalizationAPI } from "@gnu-taler/web-util/browser"; +import { BaseForm } from "./index.js"; +import { amlStateConverter } from "../utils/converter.js"; +import { AmlExchangeBackend } from "../utils/types.js"; -export const v1 = (current: BaseForm): FlexibleForm<Simplest.Form> => ({ +export const v1 = (i18n: InternationalizationAPI) => (current: BaseForm): FlexibleForm<Simplest.Form> => ({ design: [ { - title: "Simple form" as TranslatedString, + title: i18n.str`Simple form`, fields: [ { type: "textArea", props: { name: "comment", - label: "Comments" as TranslatedString, + label: i18n.str`Comments`, }, }, ], }, - resolutionSection(current), + resolutionSection(current, i18n), ], behavior: function formBehavior( v: Partial<Simplest.Form>, @@ -47,33 +44,31 @@ export namespace Simplest { } } -export function resolutionSection(current: BaseForm): DoubleColumnFormSection { +export function resolutionSection(current: BaseForm, i18n: InternationalizationAPI): DoubleColumnFormSection { return { - title: "Resolution" as TranslatedString, + title: i18n.str`Resolution`, description: `Current state is ${amlStateConverter.toStringUI( current.state, - )} and threshold at ${Amounts.stringifyValue( - current.threshold, - )}` as TranslatedString, + )} and threshold at ` as TranslatedString, fields: [ { type: "choiceHorizontal", props: { name: "state", - label: "New state" as TranslatedString, + label: i18n.str`New state`, converter: amlStateConverter, choices: [ { value: AmlExchangeBackend.AmlState.frozen, - label: "Frozen" as TranslatedString, + label: i18n.str`Frozen`, }, { value: AmlExchangeBackend.AmlState.pending, - label: "Pending" as TranslatedString, + label: i18n.str`Pending`, }, { value: AmlExchangeBackend.AmlState.normal, - label: "Normal" as TranslatedString, + label: i18n.str`Normal`, }, ], }, @@ -82,7 +77,7 @@ export function resolutionSection(current: BaseForm): DoubleColumnFormSection { type: "amount", props: { name: "threshold", - label: "New threshold" as TranslatedString, + label: i18n.str`New threshold`, }, }, ], diff --git a/packages/aml-backoffice-ui/src/hooks/useCases.ts b/packages/aml-backoffice-ui/src/hooks/useCases.ts index 81ca2755a..1cd16a6f6 100644 --- a/packages/aml-backoffice-ui/src/hooks/useCases.ts +++ b/packages/aml-backoffice-ui/src/hooks/useCases.ts @@ -1,14 +1,11 @@ import { useState } from "preact/hooks"; -import { - HttpResponsePaginated -} from "@gnu-taler/web-util/browser"; -import { AmlExchangeBackend } from "../types.js"; // FIX default import https://github.com/microsoft/TypeScript/issues/49189 import { AmountString, OfficerAccount, OperationFail, TalerExchangeApi, TalerExchangeResultByMethod, TalerHttpError } from "@gnu-taler/taler-util"; import _useSWR, { SWRHook } from "swr"; import { useExchangeApiContext } from "../context/config.js"; import { useOfficer } from "./useOfficer.js"; +import { AmlExchangeBackend } from "../utils/types.js"; const useSWR = _useSWR as unknown as SWRHook; const PAGE_SIZE = 10; diff --git a/packages/aml-backoffice-ui/src/index.html b/packages/aml-backoffice-ui/src/index.html index 703d31da1..08cf507da 100644 --- a/packages/aml-backoffice-ui/src/index.html +++ b/packages/aml-backoffice-ui/src/index.html @@ -17,26 +17,28 @@ --> <!DOCTYPE html> <html lang="en"> - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <meta charset="utf-8" /> - <meta name="viewport" content="width=device-width,initial-scale=1" /> - <meta name="taler-support" content="uri"> - <meta name="mobile-web-app-capable" content="yes" /> - <meta name="apple-mobile-web-app-capable" content="yes" /> - <link - rel="icon" - href="data:;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////////////7//v38//78/P/+/fz//vz7///+/v/+/f3//vz7///+/v/+/fz//v38///////////////////////+/v3///7+/////////////////////////////////////////////////////////v3//v79///////+/v3///////r28v/ct5//06SG/9Gffv/Xqo7/7N/V/9e2nf/bsJb/6uDW/9Sskf/euKH/+/j2///////+/v3//////+3azv+/eE3/2rWd/9Kkhv/Vr5T/48i2/8J+VP/Qn3//3ryn/795Tf/WrpP/2LCW/8B6T//w4Nb///////Pn4P+/d0v/9u3n/+7d0v/EhV7//v///+HDr//fxLD/zph2/+TJt//8/Pv/woBX//Lm3f/y5dz/v3hN//bu6f/JjGn/4sW0///////Df1j/8OLZ//v6+P+/elH/+vj1//jy7f+/elL//////+zYzP/Eg13//////967p//MlHT/wn5X///////v4Nb/yY1s///////jw7H/06KG////////////z5t9/+fNvf//////x4pn//Pp4v/8+vn/w39X/8WEX///////5s/A/9CbfP//////27Oc/9y2n////////////9itlf/gu6f//////86Vdf/r2Mz//////8SCXP/Df1j//////+7d0v/KkG7//////+HBrf/VpYr////////////RnoH/5sq6///////Ii2n/8ubf//39/P/Cf1j/xohk/+bNvv//////wn5W//Tq4//58/D/wHxV//7+/f/59fH/v3xU//39/P/w4Nf/xIFb///////hw7H/yo9t/+/f1f/AeU3/+/n2/+nSxP/FhmD//////9qzm//Upon/4MSx/96+qf//////xINc/+3bz//48e3/v3hN//Pn3///////6M+//752S//gw6//06aK/8J+VP/kzLr/zZd1/8OCWv/q18r/17KZ/9Ooi//fv6r/v3dK/+vWyP///////v39///////27un/1aeK/9Opjv/m1cf/1KCC/9a0nP/n08T/0Jx8/82YdP/QnHz/16yR//jx7P///////v39///////+/f3///7+///////+//7//v7+///////+/v7//v/+/////////////////////////v7//v79///////////////////+/v/+/Pv//v39///+/v/+/Pv///7+//7+/f/+/Pv//v39//79/P/+/Pv///7+////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" - /> - <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" /> - <title>Exchange Backoffice</title> - <!-- Optional customization script. --> - <script src="exchange-backofice-ui-settings.js"></script> - <!-- Entry point for the SPA. --> - <script type="module" src="index.js"></script> - <link rel="stylesheet" href="index.css" /> - </head> - <body> - <div id="app"></div> - </body> -</html> + +<head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width,initial-scale=1" /> + <meta name="taler-support" content="uri"> + <meta name="mobile-web-app-capable" content="yes" /> + <meta name="apple-mobile-web-app-capable" content="yes" /> + <link rel="icon" + href="data:;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////////////////7//v38//78/P/+/fz//vz7///+/v/+/f3//vz7///+/v/+/fz//v38///////////////////////+/v3///7+/////////////////////////////////////////////////////////v3//v79///////+/v3///////r28v/ct5//06SG/9Gffv/Xqo7/7N/V/9e2nf/bsJb/6uDW/9Sskf/euKH/+/j2///////+/v3//////+3azv+/eE3/2rWd/9Kkhv/Vr5T/48i2/8J+VP/Qn3//3ryn/795Tf/WrpP/2LCW/8B6T//w4Nb///////Pn4P+/d0v/9u3n/+7d0v/EhV7//v///+HDr//fxLD/zph2/+TJt//8/Pv/woBX//Lm3f/y5dz/v3hN//bu6f/JjGn/4sW0///////Df1j/8OLZ//v6+P+/elH/+vj1//jy7f+/elL//////+zYzP/Eg13//////967p//MlHT/wn5X///////v4Nb/yY1s///////jw7H/06KG////////////z5t9/+fNvf//////x4pn//Pp4v/8+vn/w39X/8WEX///////5s/A/9CbfP//////27Oc/9y2n////////////9itlf/gu6f//////86Vdf/r2Mz//////8SCXP/Df1j//////+7d0v/KkG7//////+HBrf/VpYr////////////RnoH/5sq6///////Ii2n/8ubf//39/P/Cf1j/xohk/+bNvv//////wn5W//Tq4//58/D/wHxV//7+/f/59fH/v3xU//39/P/w4Nf/xIFb///////hw7H/yo9t/+/f1f/AeU3/+/n2/+nSxP/FhmD//////9qzm//Upon/4MSx/96+qf//////xINc/+3bz//48e3/v3hN//Pn3///////6M+//752S//gw6//06aK/8J+VP/kzLr/zZd1/8OCWv/q18r/17KZ/9Ooi//fv6r/v3dK/+vWyP///////v39///////27un/1aeK/9Opjv/m1cf/1KCC/9a0nP/n08T/0Jx8/82YdP/QnHz/16yR//jx7P///////v39///////+/f3///7+///////+//7//v7+///////+/v7//v/+/////////////////////////v7//v79///////////////////+/v/+/Pv//v39///+/v/+/Pv///7+//7+/f/+/Pv//v39//79/P/+/Pv///7+////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==" /> + <link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" /> + <title>Exchange Backoffice</title> + <!-- Optional customization script. --> + <script src="exchange-backofice-ui-settings.js"></script> + <!-- Entry point for the SPA. --> + <script type="module" src="forms/index.js"></script> + <script type="module" src="index.js"></script> + <link rel="stylesheet" href="index.css" /> +</head> + +<body> + <div id="app"></div> +</body> + +</html>
\ No newline at end of file diff --git a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx index ede8c9955..07ef0481a 100644 --- a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx +++ b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx @@ -1,22 +1,14 @@ import { AbsoluteTime, AmountJson, Amounts, Codec, OperationResult, buildCodecForObject, codecForNumber, codecForString, codecOptional } from "@gnu-taler/taler-util"; +import { DefaultForm, useTranslationContext } from "@gnu-taler/web-util/browser"; import { h } from "preact"; -import { v1 as form_902_11e_v1 } from "../forms/902_11e.js"; -import { v1 as form_902_12e_v1 } from "../forms/902_12e.js"; -import { v1 as form_902_13e_v1 } from "../forms/902_13e.js"; -import { v1 as form_902_15e_v1 } from "../forms/902_15e.js"; -import { v1 as form_902_1e_v1 } from "../forms/902_1e.js"; -import { v1 as form_902_4e_v1 } from "../forms/902_4e.js"; -import { v1 as form_902_5e_v1 } from "../forms/902_5e.js"; -import { v1 as form_902_9e_v1 } from "../forms/902_9e.js"; -import { v1 as simplest } from "../forms/simplest.js"; -import { Pages } from "../pages.js"; -import { AmlExchangeBackend } from "../types.js"; import { useExchangeApiContext } from "../context/config.js"; -import { DefaultForm, FlexibleForm, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { FormMetadata } from "../forms/index.js"; +import { Pages } from "../pages.js"; +import { AmlExchangeBackend } from "../utils/types.js"; export function AntiMoneyLaunderingForm({ account, formId, onSubmit }: { account: string, formId: string, onSubmit: (justification: Justification, state: AmlExchangeBackend.AmlState, threshold: AmountJson) => Promise<void>; }) { const { i18n } = useTranslationContext() - const theForm = allForms.find((v) => v.id === formId) + const theForm = window.amlExchangeBackoffice!.forms(i18n).find((v) => v.id === formId) if (!theForm) { return <div>form with id {formId} not found</div> } @@ -66,24 +58,6 @@ export function AntiMoneyLaunderingForm({ account, formId, onSubmit }: { account ); } -export interface BaseForm { - state: AmlExchangeBackend.AmlState; - threshold: AmountJson; -} - -const DocumentDuplicateIcon = <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> - <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" /> -</svg> - - -export type FormMetadata<T extends BaseForm> = { - label: string, - id: string, - version: number, - icon: h.JSX.Element, - impl: (current: BaseForm) => FlexibleForm<T> -} - export type Justification<T = any> = { // form values value: T; @@ -155,68 +129,3 @@ export function parseJustification(s: string, listOfAllKnownForms: FormMetadata< } -export const allForms: Array<FormMetadata<BaseForm>> = [ - { - label: "Simple comment", - id: "simple_comment", - version: 1, - icon: DocumentDuplicateIcon, - impl: simplest, - }, - { - label: "Identification form", - id: "902.1e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_1e_v1, - }, - { - label: "Operational legal entity or partnership", - id: "902.11e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_11e_v1, - }, - { - label: "Foundations", - id: "902.12e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_12e_v1, - }, - { - label: "Declaration for trusts", - id: "902.13e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_13e_v1, - }, - { - label: "Information on life insurance policies", - id: "902.15e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_15e_v1, - }, - { - label: "Declaration of beneficial owner", - id: "902.9e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_9e_v1, - }, - { - label: "Customer profile", - id: "902.5e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_5e_v1, - }, - { - label: "Risk profile", - id: "902.4e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_4e_v1, - }, -]; diff --git a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx index 0a2680b1b..409124121 100644 --- a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx +++ b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx @@ -6,15 +6,16 @@ import { TranslatedString, assertUnreachable } from "@gnu-taler/taler-util"; -import { DefaultForm, ErrorLoading, Loading, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { DefaultForm, ErrorLoading, InternationalizationAPI, Loading, useTranslationContext } from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { useState } from "preact/hooks"; +import { FormMetadata } from "../forms/index.js"; import { useCaseDetails } from "../hooks/useCaseDetails.js"; import { Pages } from "../pages.js"; -import { AmlExchangeBackend } from "../types.js"; -import { FormMetadata, Justification, allForms, parseJustification } from "./AntiMoneyLaunderingForm.js"; +import { Justification, parseJustification } from "./AntiMoneyLaunderingForm.js"; import { ShowConsolidated } from "./ShowConsolidated.js"; +import { AmlExchangeBackend } from "../utils/types.js"; export type AmlEvent = AmlFormEvent | AmlFormEventError | KycCollectionEvent | KycExpirationEvent; type AmlFormEvent = { @@ -55,7 +56,7 @@ function selectSooner(a: WithTime, b: WithTime) { return AbsoluteTime.cmp(a.when, b.when); } -function titleForJustification(op: ReturnType<typeof parseJustification>): TranslatedString { +function titleForJustification(op: ReturnType<typeof parseJustification>, i18n: InternationalizationAPI): TranslatedString { if (op.type === "ok") { return op.body.justification.label as TranslatedString; } @@ -72,13 +73,15 @@ export function getEventsFromAmlHistory( aml: AmlExchangeBackend.AmlDecisionDetail[], kyc: AmlExchangeBackend.KycDetail[], ): AmlEvent[] { + const { i18n } = useTranslationContext() const ae: AmlEvent[] = aml.map((a) => { - const just = parseJustification(a.justification, allForms) + + const just = parseJustification(a.justification, window.amlExchangeBackoffice!.forms(i18n)) return { type: just.type === "ok" ? "aml-form" : "aml-form-error", state: a.new_state, threshold: Amounts.parseOrThrow(a.new_threshold), - title: titleForJustification(just), + title: titleForJustification(just, i18n), metadata: just.type === "ok" ? just.body.metadata : undefined, justification: just.type === "ok" ? just.body.justification : undefined, when: { @@ -92,14 +95,14 @@ export function getEventsFromAmlHistory( const ke = kyc.reduce((prev, k) => { prev.push({ type: "kyc-collection", - title: "collection" as TranslatedString, + title: i18n.str`collection`, when: AbsoluteTime.fromProtocolTimestamp(k.collection_time), values: !k.attributes ? {} : k.attributes, provider: k.provider_section, }); prev.push({ type: "kyc-expiration", - title: "expiration" as TranslatedString, + title: i18n.str`expiration`, when: AbsoluteTime.fromProtocolTimestamp(k.expiration_time), fields: !k.attributes ? [] : Object.keys(k.attributes), }); diff --git a/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx b/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx index 0355d5a31..3b9c8dacf 100644 --- a/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx +++ b/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx @@ -20,11 +20,11 @@ */ import * as tests from "@gnu-taler/web-util/testing"; -import { AmlExchangeBackend } from "../types.js"; import { CasesUI as TestedComponent, } from "./Cases.js"; import { AmountString } from "@gnu-taler/taler-util"; +import { AmlExchangeBackend } from "../utils/types.js"; export default { title: "cases", diff --git a/packages/aml-backoffice-ui/src/pages/Cases.tsx b/packages/aml-backoffice-ui/src/pages/Cases.tsx index 7161e4086..24f78f2d2 100644 --- a/packages/aml-backoffice-ui/src/pages/Cases.tsx +++ b/packages/aml-backoffice-ui/src/pages/Cases.tsx @@ -4,10 +4,10 @@ import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { useCases } from "../hooks/useCases.js"; import { Pages } from "../pages.js"; -import { AmlExchangeBackend } from "../types.js"; import { Officer } from "./Officer.js"; -import { amlStateConverter } from "./ShowConsolidated.js"; +import { amlStateConverter } from "../utils/converter.js"; +import { AmlExchangeBackend } from "../utils/types.js"; export function CasesUI({ records, filter, onChangeFilter, onFirstPage, onNext }: { onFirstPage?: () => void, onNext?: () => void, filter: AmlExchangeBackend.AmlState, onChangeFilter: (f: AmlExchangeBackend.AmlState) => void, records: TalerExchangeApi.AmlRecord[] }): VNode { const { i18n } = useTranslationContext(); @@ -42,15 +42,15 @@ export function CasesUI({ records, filter, onChangeFilter, onFirstPage, onNext } converter={amlStateConverter} choices={[ { - label: "Pending" as TranslatedString, + label: i18n.str`Pending`, value: AmlExchangeBackend.AmlState.pending, }, { - label: "Frozen" as TranslatedString, + label: i18n.str`Frozen`, value: AmlExchangeBackend.AmlState.frozen, }, { - label: "Normal" as TranslatedString, + label: i18n.str`Normal`, value: AmlExchangeBackend.AmlState.normal, }, ]} @@ -193,17 +193,6 @@ export const HomeIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none <path stroke-linecap="round" stroke-linejoin="round" d="M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" /> </svg> - -export const ChevronRightIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> - <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 4.5l7.5 7.5-7.5 7.5" /> -</svg> - - -export const ArrowRightIcon = () => <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> - <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" /> -</svg> - - function Pagination({ onFirstPage, onNext }: { onFirstPage?: () => void, onNext?: () => void, }) { const { i18n } = useTranslationContext() return ( diff --git a/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx b/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx index cd4f2d923..603813f8e 100644 --- a/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx +++ b/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx @@ -60,7 +60,7 @@ export function CreateAccount({ const error = s?.password?.error ?? s?.repeat?.error; if (error) { notifyError( - "Can't create account" as TranslatedString, + i18n.str`Can't create account`, error as TranslatedString, ); } else { @@ -70,7 +70,7 @@ export function CreateAccount({ > <div class="mb-4"> <Form.InputLine - label={"Password" as TranslatedString} + label={i18n.str`Password`} name="password" type="password" help={ @@ -83,7 +83,7 @@ export function CreateAccount({ </div> <div class="mb-4"> <Form.InputLine - label={"Repeat password" as TranslatedString} + label={i18n.str`Repeat password`} name="repeat" type="password" required diff --git a/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx b/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx index d53ac27c1..fe82df089 100644 --- a/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx +++ b/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx @@ -4,7 +4,7 @@ import { Fragment, VNode, h } from "preact"; import { useExchangeApiContext } from "../context/config.js"; import { useOfficer } from "../hooks/useOfficer.js"; import { Pages } from "../pages.js"; -import { AntiMoneyLaunderingForm, allForms } from "./AntiMoneyLaunderingForm.js"; +import { AntiMoneyLaunderingForm } from "./AntiMoneyLaunderingForm.js"; import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; export function NewFormEntry({ @@ -80,10 +80,11 @@ export function NewFormEntry({ } function SelectForm({ account }: { account: string }) { + const { i18n } = useTranslationContext() return ( <div> <pre>New form for account: {account.substring(0, 16)}...</pre> - {allForms.map((form, idx) => { + {window.amlExchangeBackoffice!.forms(i18n).map((form, idx) => { return ( <a href={Pages.newFormEntry.url({ account, type: form.id })} diff --git a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx index f59f8d41f..ad350c0e6 100644 --- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx +++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx @@ -1,9 +1,10 @@ import { AbsoluteTime, AmountJson, TranslatedString } from "@gnu-taler/taler-util"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; -import { AmlExchangeBackend } from "../types.js"; import { AmlEvent } from "./CaseDetails.js"; -import { DefaultForm, FlexibleForm, UIFormField } from "@gnu-taler/web-util/browser"; +import { DefaultForm, FlexibleForm, UIFormField, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { amlStateConverter } from "../utils/converter.js"; +import { AmlExchangeBackend } from "../utils/types.js"; export function ShowConsolidated({ history, @@ -12,6 +13,8 @@ export function ShowConsolidated({ history: AmlEvent[]; until: AbsoluteTime; }): VNode { + const { i18n } = useTranslationContext(); + const cons = getConsolidated(history, until); const form: FlexibleForm<Consolidated> = { @@ -32,32 +35,32 @@ export function ShowConsolidated({ }, design: [ { - title: "AML" as TranslatedString, + title: i18n.str`AML`, fields: [ { type: "amount", props: { - label: "Threshold" as TranslatedString, + label: i18n.str`Threshold`, name: "aml.threshold", }, }, { type: "choiceHorizontal", props: { - label: "State" as TranslatedString, + label: i18n.str`State`, name: "aml.state", converter: amlStateConverter, choices: [ { - label: "Frozen" as TranslatedString, + label: i18n.str`Frozen`, value: AmlExchangeBackend.AmlState.frozen, }, { - label: "Pending" as TranslatedString, + label: i18n.str`Pending`, value: AmlExchangeBackend.AmlState.pending, }, { - label: "Normal" as TranslatedString, + label: i18n.str`Normal`, value: AmlExchangeBackend.AmlState.normal, }, ], @@ -67,7 +70,7 @@ export function ShowConsolidated({ }, Object.entries(cons.kyc).length > 0 ? { - title: "KYC" as TranslatedString, + title: i18n.str`KYC`, fields: Object.entries(cons.kyc).map(([key, field]) => { const result: UIFormField = { type: "text", @@ -167,34 +170,4 @@ function getConsolidated( } return prev; }, initial); -} - -export const amlStateConverter = { - toStringUI: stringifyAmlState, - fromStringUI: parseAmlState, -}; - -function stringifyAmlState(s: AmlExchangeBackend.AmlState | undefined): string { - if (s === undefined) return ""; - switch (s) { - case AmlExchangeBackend.AmlState.normal: - return "normal"; - case AmlExchangeBackend.AmlState.pending: - return "pending"; - case AmlExchangeBackend.AmlState.frozen: - return "frozen"; - } -} - -function parseAmlState(s: string | undefined): AmlExchangeBackend.AmlState { - switch (s) { - case "normal": - return AmlExchangeBackend.AmlState.normal; - case "pending": - return AmlExchangeBackend.AmlState.pending; - case "frozen": - return AmlExchangeBackend.AmlState.frozen; - default: - throw Error(`unknown AML state: ${s}`); - } -} +}
\ No newline at end of file diff --git a/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx index cd801256a..1b0342b12 100644 --- a/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx +++ b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx @@ -32,7 +32,7 @@ export function UnlockAccount({ onSubmit={async (v) => { try { await onAccountUnlocked(v.password!); - notifyInfo("Account unlocked" as TranslatedString); + notifyInfo(i18n.str`Account unlocked`); } catch (e) { if (e instanceof UnwrapKeyError) { notifyError( @@ -47,7 +47,7 @@ export function UnlockAccount({ > <div class="mb-4"> <Form.InputLine - label={"Password" as TranslatedString} + label={i18n.str`Password`} name="password" type="password" required diff --git a/packages/aml-backoffice-ui/src/utils/converter.ts b/packages/aml-backoffice-ui/src/utils/converter.ts new file mode 100644 index 000000000..d2f05ed84 --- /dev/null +++ b/packages/aml-backoffice-ui/src/utils/converter.ts @@ -0,0 +1,31 @@ +import { AmlExchangeBackend } from "./types.js"; + +export const amlStateConverter = { + toStringUI: stringifyAmlState, + fromStringUI: parseAmlState, +}; + +function stringifyAmlState(s: AmlExchangeBackend.AmlState | undefined): string { + if (s === undefined) return ""; + switch (s) { + case AmlExchangeBackend.AmlState.normal: + return "normal"; + case AmlExchangeBackend.AmlState.pending: + return "pending"; + case AmlExchangeBackend.AmlState.frozen: + return "frozen"; + } +} + +function parseAmlState(s: string | undefined): AmlExchangeBackend.AmlState { + switch (s) { + case "normal": + return AmlExchangeBackend.AmlState.normal; + case "pending": + return AmlExchangeBackend.AmlState.pending; + case "frozen": + return AmlExchangeBackend.AmlState.frozen; + default: + throw Error(`unknown AML state: ${s}`); + } +} diff --git a/packages/aml-backoffice-ui/src/types.ts b/packages/aml-backoffice-ui/src/utils/types.ts index 429b538e7..fd70d4e4d 100644 --- a/packages/aml-backoffice-ui/src/types.ts +++ b/packages/aml-backoffice-ui/src/utils/types.ts @@ -89,36 +89,36 @@ export namespace AmlExchangeBackend { frozen = 2, } - + export interface AmlDecision { // Human-readable justification for the decision. justification: string; - + // At what monthly transaction volume should the // decision be automatically reviewed? new_threshold: Amount; - + // Which payto-address is the decision about? // Identifies a GNU Taler wallet or an affected bank account. h_payto: PaytoHash; - + // What is the new AML state (e.g. frozen, unfrozen, etc.) // Numerical values are defined in AmlDecisionState. new_state: Integer; - + // Signature by the AML officer over a // TALER_MasterAmlOfficerStatusPS. // Must have purpose TALER_SIGNATURE_MASTER_AML_KEY. officer_sig: EddsaSignature; - + // When was the decision made? decision_time: Timestamp; - + // Optional argument to impose new KYC requirements // that the customer has to satisfy to unblock transactions. kyc_requirements?: string[]; } - + } |