taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit ab1441f8cd850d5b7309720799ba0071cbb307f8
parent 49a63f2102a3f5fa5f6be51c371e63fc62d2c27e
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon,  3 Feb 2025 16:07:48 -0300

fix toggle update vqf forms

Diffstat:
Mpackages/web-util/src/forms/fields/InputToggle.stories.tsx | 18++++++++++++++++++
Mpackages/web-util/src/forms/fields/InputToggle.tsx | 16++--------------
Mpackages/web-util/src/forms/gana/VQF_902_1.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_11.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_12.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_13.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_14.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_15.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_4.ts | 350+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mpackages/web-util/src/forms/gana/VQF_902_5.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/VQF_902_9.ts | 46+++++++++++++++++++++++-----------------------
Mpackages/web-util/src/forms/gana/taler_form_attributes.ts | 67++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
Mpackages/web-util/src/hooks/useForm.ts | 11+++++++++--
13 files changed, 497 insertions(+), 333 deletions(-)

diff --git a/packages/web-util/src/forms/fields/InputToggle.stories.tsx b/packages/web-util/src/forms/fields/InputToggle.stories.tsx @@ -70,3 +70,21 @@ export const WithThreeState = tests.createExample(TestedComponent, { ], }, }); + +export const StartUndefinedOnlyTwoStates = tests.createExample( + TestedComponent, + { + initial: {}, + design: { + type: "single-column", + fields: [ + { + type: "toggle", + label: "do you accept?" as TranslatedString, + required: true, + id: "accept" as UIHandlerId, + }, + ], + }, + }, +); diff --git a/packages/web-util/src/forms/fields/InputToggle.tsx b/packages/web-util/src/forms/fields/InputToggle.tsx @@ -32,13 +32,7 @@ export function InputToggle<T extends object, K extends keyof T>( /> <button type="button" - data-state={ - isOn - ? "on" - : threeState && value === undefined - ? "undefined" - : "off" - } + data-state={isOn ? "on" : value === undefined ? "undefined" : "off"} class="bg-indigo-600 data-[state=off]:bg-gray-200 data-[state=undefined]:bg-gray-200 relative inline-flex h-6 w-12 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2" role="switch" aria-labelledby="availability-label" @@ -52,13 +46,7 @@ export function InputToggle<T extends object, K extends keyof T>( }} > <span - data-state={ - isOn - ? "on" - : threeState && value === undefined - ? "undefined" - : "off" - } + data-state={isOn ? "on" : value === undefined ? "undefined" : "off"} class="translate-x-6 data-[state=off]:translate-x-0 data-[state=undefined]:translate-x-3 pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out" ></span> </button> diff --git a/packages/web-util/src/forms/gana/VQF_902_1.ts b/packages/web-util/src/forms/gana/VQF_902_1.ts @@ -20,29 +20,29 @@ export function VQF_902_1( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Information on customer`, description: 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.`, diff --git a/packages/web-util/src/forms/gana/VQF_902_11.ts b/packages/web-util/src/forms/gana/VQF_902_11.ts @@ -11,29 +11,29 @@ export function VQF_902_11( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_11 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_11 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_11 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_11 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Contracting partner`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_12.ts b/packages/web-util/src/forms/gana/VQF_902_12.ts @@ -12,29 +12,29 @@ export function VQF_902_12( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_12 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_12 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_12 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_12 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Contracing partner`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_13.ts b/packages/web-util/src/forms/gana/VQF_902_13.ts @@ -12,29 +12,29 @@ export function VQF_902_13( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_13 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_13 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_13 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_13 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Contracing partner`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_14.ts b/packages/web-util/src/forms/gana/VQF_902_14.ts @@ -11,29 +11,29 @@ export function VQF_902_14( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_14 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_14 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_14 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_14 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Reason for special clarifications`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_15.ts b/packages/web-util/src/forms/gana/VQF_902_15.ts @@ -12,29 +12,29 @@ export function VQF_902_15( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_15 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_15 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_15 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_15 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Contracting partner`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_4.ts b/packages/web-util/src/forms/gana/VQF_902_4.ts @@ -11,63 +11,67 @@ export function VQF_902_4( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_1 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Evaluation of politically exposed persons (PEP-Check)`, description: i18n.str`This evaluation has to be completed by all members for every business relationship.`, fields: [ { - id: "PEP_ACCEPTANCE_DATE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: false, - }, - { - id: "PEP_DOMESTIC" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + id: "PEP_FOREIGN" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Foreign PEP`, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorised representative a foreign PEP or closely related to such a person?`, // gana_type: "Boolean", type: "toggle", required: true, }, { - id: "PEP_FOREIGN" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + id: "PEP_DOMESTIC" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Domestic PEP`, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorised representative a domestic PEP or closely related to such a person?`, // gana_type: "Boolean", type: "toggle", required: true, }, { id: "PEP_INTERNATIONAL_ORGANIZATION" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + label: i18n.str`PEP of International Organisatons`, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorised representative a PEP in International Organizations or closely related to such a person?`, // gana_type: "Boolean", type: "toggle", required: true, }, + { + id: "PEP_ACCEPTANCE_DATE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Acceptance date`, + help: i18n.str`When the decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtain on.`, + // gana_type: "AbsoluteDateTime", + type: "absoluteTimeText", + placeholder: "dd/MM/yyyy HH:mm:ss", + pattern: "dd/MM/yyyy HH:mm:ss", + required: false, + }, ], }, { @@ -75,21 +79,23 @@ export function VQF_902_4( description: i18n.str`This evaluation has to be completed by all members for every business relationship.`, fields: [ { + id: "HIGH_RISK_COUNTRY" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`High-risk or non-cooperative country`, + help: i18n.str`Is the customer, the beneficial owner or the controlling person or authorised representative in a country considered by the FATF as high-risk or non-cooperative and for which FATF requires increased diligence?`, + // gana_type: "Boolean", + type: "toggle", + required: true, + }, + { id: "HIGH_RISK_ACCEPTANCE_DATE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + label: i18n.str`Acceptance date`, + help: i18n.str`When the decision of the Senior executive body on the acceptance of a business relationship with a PEP was obtain on.`, // gana_type: "AbsoluteDateTime", type: "absoluteTimeText", placeholder: "dd/MM/yyyy HH:mm:ss", pattern: "dd/MM/yyyy HH:mm:ss", required: false, }, - { - id: "HIGH_RISK_COUNTRY" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, - // gana_type: "Boolean", - type: "toggle", - required: true, - }, ], }, { @@ -97,35 +103,11 @@ export function VQF_902_4( description: 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.`, fields: [ { - id: "CONTACT_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`Contact risk level`, - // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", - choices: [ - { label: i18n.str`Low`, value: "LOW" }, - { label: i18n.str`Medium`, value: "MEDIUM" }, - { label: i18n.str`High`, value: "HIGH" }, - ], - type: "choiceHorizontal", - required: false, - }, - { - id: "COUNTRY_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`Country risk level`, + id: "COUNTRY_RISK_NATIONALITY_TYPE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Country risk type (nationality)`, + help: i18n.str``, // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", choices: [ - { label: i18n.str`Low`, value: "LOW" }, - { label: i18n.str`Medium`, value: "MEDIUM" }, - { label: i18n.str`High`, value: "HIGH" }, - ], - type: "choiceHorizontal", - required: false, - }, - { - id: "COUNTRY_RISK_TYPE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`Country risk type`, - // gana_type: - // "'NATIONALITY_CUSTOMER' | 'NATIONALITY_OWNER' | 'DOMICILE_CUSTOMER' | 'DOMICILE_OWNER' | 'DOMICILE_CONTROLLING' | 'BUSINESS_ACTIVITY' | 'PAYMENTS'", - choices: [ { label: i18n.str`Nationality customer`, value: "NATIONALITY_CUSTOMER", @@ -143,51 +125,104 @@ export function VQF_902_4( label: i18n.str`Domicile controlling`, value: "DOMICILE_CONTROLLING", }, - { - label: i18n.str`Business activity`, - value: "BUSINESS_ACTIVITY", - }, - { label: i18n.str`Payments`, value: "PAYMENTS" }, ], - type: "choiceStacked", + type: "choiceHorizontal", required: false, }, { - id: "EXTRA_CRITERA_1_RISK_DEFINITION" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`1. Extra criteria risk`, - // gana_type: "String", - type: "textArea", + id: "COUNTRY_RISK_NATIONALITY_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Country risk level (nationality)`, + help: i18n.str``, + // gana_type: + // "'NATIONALITY_CUSTOMER' | 'NATIONALITY_OWNER' | 'DOMICILE_CUSTOMER' | 'DOMICILE_OWNER' | 'DOMICILE_CONTROLLING' | 'BUSINESS_ACTIVITY' | 'PAYMENTS'", + choices: [ + { label: i18n.str`Low`, value: "LOW" }, + { label: i18n.str`Medium`, value: "MEDIUM" }, + { label: i18n.str`High`, value: "HIGH" }, + ], + // choices: [ + // { + // label: i18n.str`Nationality customer`, + // value: "NATIONALITY_CUSTOMER", + // }, + // { + // label: i18n.str`Nationality owner`, + // value: "NATIONALITY_OWNER", + // }, + // { + // label: i18n.str`Domicile cusomter`, + // value: "DOMICILE_CUSTOMER", + // }, + // { label: i18n.str`Domicile owner`, value: "DOMICILE_OWNER" }, + // { + // label: i18n.str`Domicile controlling`, + // value: "DOMICILE_CONTROLLING", + // }, + // { + // label: i18n.str`Business activity`, + // value: "BUSINESS_ACTIVITY", + // }, + // { label: i18n.str`Payments`, value: "PAYMENTS" }, + // ], + type: "choiceStacked", required: false, }, { - id: "EXTRA_CRITERA_1_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`1. Extra criteria level`, + id: "COUNTRY_RISK_BUSINESS_TYPE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Country risk type (business activity)`, + help: i18n.str``, // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", choices: [ - { label: i18n.str`Low`, value: "LOW" }, - { label: i18n.str`Medium`, value: "MEDIUM" }, - { label: i18n.str`High`, value: "HIGH" }, + { + label: i18n.str`Customer`, + value: "CUSTOMER", + }, + { + label: i18n.str`Beneficial owner`, + value: "OWNER", + }, ], type: "choiceHorizontal", required: false, }, { - id: "EXTRA_CRITERA_2_RISK_DEFINITION" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`2. Extra criteria risk`, - // gana_type: "String", - type: "textArea", + id: "COUNTRY_RISK_BUSINESS_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Country risk level (business activity)`, + help: i18n.str``, + // gana_type: + // "'NATIONALITY_CUSTOMER' | 'NATIONALITY_OWNER' | 'DOMICILE_CUSTOMER' | 'DOMICILE_OWNER' | 'DOMICILE_CONTROLLING' | 'BUSINESS_ACTIVITY' | 'PAYMENTS'", + choices: [ + { label: i18n.str`Low`, value: "LOW" }, + { label: i18n.str`Medium`, value: "MEDIUM" }, + { label: i18n.str`High`, value: "HIGH" }, + ], + type: "choiceStacked", required: false, }, { - id: "EXTRA_CRITERA_2_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`2. Extra criteria level`, - // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", + id: "COUNTRY_RISK_PAYMENTS_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Country risk level (payments)`, + help: i18n.str`Contry of origin ad destination of the frequent payments (if known)`, + // gana_type: + // "'NATIONALITY_CUSTOMER' | 'NATIONALITY_OWNER' | 'DOMICILE_CUSTOMER' | 'DOMICILE_OWNER' | 'DOMICILE_CONTROLLING' | 'BUSINESS_ACTIVITY' | 'PAYMENTS'", choices: [ { label: i18n.str`Low`, value: "LOW" }, { label: i18n.str`Medium`, value: "MEDIUM" }, { label: i18n.str`High`, value: "HIGH" }, ], + type: "choiceStacked", + required: false, + }, + { + id: "INDUSTRY_RISK_TYPE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Industry risk type`, + help: i18n.str`Nature of customer's business activity`, + // gana_type: "'CUSTOMER' | 'OWNER'", type: "choiceHorizontal", + choices: [ + { label: i18n.str`Owner`, value: "OWNER" }, + { label: i18n.str`Customer`, value: "CUSTOMER" }, + ], required: false, }, { @@ -195,59 +230,141 @@ export function VQF_902_4( label: i18n.str`Industry risk level`, // gana_type: // "'TRANSPARENT' | 'HIGH_CASH_TRANSACTION' | 'NOT_WELL_KNOWN' | 'HIGH_RISK_TRADE' | 'UNKNOWN_INDUSTRY'", - type: "selectOne", + type: "choiceStacked", choices: [ - { label: i18n.str`Transparent`, value: "TRANSPARENT" }, { - label: i18n.str`High cash transaction`, + label: i18n.str`Clearly defined, transparent and easily comprehensible.`, + value: "TRANSPARENT", + }, + { + label: i18n.str`High level of cash transactions.`, value: "HIGH_CASH_TRANSACTION", }, - { label: i18n.str`Not well known`, value: "NOT_WELL_KNOWN" }, - { label: i18n.str`High risk trade`, value: "HIGH_RISK_TRADE" }, - { label: i18n.str`Unkown industry`, value: "UNKNOWN_INDUSTRY" }, + { + label: i18n.str`Not well known to the member.`, + value: "NOT_WELL_KNOWN", + }, + { + label: i18n.str`Trade in munitios/arms, raw gem stones, jewellery, exotic animals, casino and lottery business, erotic wares.`, + value: "HIGH_RISK_TRADE", + }, + { + label: i18n.str`No personal knowledge of the customer's industry.`, + value: "UNKNOWN_INDUSTRY", + }, ], required: false, }, { - id: "INDUSTRY_RISK_TYPE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str`Industry risk type`, - // gana_type: "'CUSTOMER' | 'OWNER'", - type: "choiceHorizontal", + id: "CONTACT_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`Contact risk level`, + help: i18n.str`Type of contact to the customer/benefcial owner of the assets.`, + // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", choices: [ - { label: i18n.str`Owner`, value: "OWNER" }, - { label: i18n.str`Customer`, value: "CUSTOMER" }, + { + label: i18n.str`Personal acquaintance between member and customer/beneficial owner of the assets over several years (at least 2)`, + value: "LOW", + }, + { + label: i18n.str`Not personally known to the member for several years (at least 2) however (a) no business was entered or (b) was introduced by trusted third party.`, + value: "MEDIUM", + }, + { + label: i18n.str`Not known to the member and the customer was not introduced by a trsuted third party. `, + value: "HIGH", + }, ], + type: "choiceStacked", required: false, }, + { id: "PRODUCT_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, label: i18n.str`Product risk level`, + help: i18n.str`Nature of services and products requested by the customer.`, // gana_type: // "'EASY' | 'SOPHISTICATED' | 'OFFSHORE' | 'COMPLEX_STRUCTURE' | 'LARGE_NUMBER_OF_ACCOUNTS' | 'COMPLEX_SERVICE' | 'FREQ_TRANS_WITH_HIGH_RISK'", - type: "selectOne", + type: "choiceStacked", choices: [ - { label: i18n.str`Easy`, value: "EASY" }, - { label: i18n.str`Sophisticated`, value: "SOPHISTICATED" }, - { label: i18n.str`Offshore`, value: "OFFSHORE" }, { - label: i18n.str`Complex structure`, + label: i18n.str`Easy to understand, transparent services and products whose financial background is easy to verify.`, + value: "EASY", + }, + { + label: i18n.str`Sophisticated services or products whose financial background is not easy to verify.`, + value: "SOPHISTICATED", + }, + { + label: i18n.str`Main focus on offshore business`, + value: "OFFSHORE", + }, + { + label: i18n.str`Complex structure in particular by using a domicialliary complany with fiduciary shareholders in a non transparent juridisction.`, value: "COMPLEX_STRUCTURE", }, { - label: i18n.str`Large number of accounts`, + label: i18n.str`Large number of accounts with pass-through transactions`, value: "LARGE_NUMBER_OF_ACCOUNTS", }, - { label: i18n.str`Complex service`, value: "COMPLEX_SERVICE" }, { - label: i18n.str`Frequent transactions with high risk`, + label: i18n.str`Complex services or products whose financial background can be verified with considerable effort.`, + value: "COMPLEX_SERVICE", + }, + { + label: i18n.str`Frequent transactions with high risk.`, value: "FREQ_TRANS_WITH_HIGH_RISK", }, ], required: false, }, + + { + id: "EXTRA_CRITERA_1_RISK_DEFINITION" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`1. Extra criteria risk`, + help: i18n.str`Criteria defined by the member.`, + // gana_type: "String", + type: "textArea", + required: false, + }, + { + id: "EXTRA_CRITERA_1_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`1. Extra criteria level`, + help: i18n.str``, + // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", + choices: [ + { label: i18n.str`Low`, value: "LOW" }, + { label: i18n.str`Medium`, value: "MEDIUM" }, + { label: i18n.str`High`, value: "HIGH" }, + ], + type: "choiceHorizontal", + required: false, + }, + { + id: "EXTRA_CRITERA_2_RISK_DEFINITION" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`2. Extra criteria risk`, + help: i18n.str`Criteria defined by the member.`, + // gana_type: "String", + type: "textArea", + required: false, + }, + { + id: "EXTRA_CRITERA_2_RISK_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, + label: i18n.str`2. Extra criteria level`, + help: i18n.str``, + // gana_type: "'LOW' | 'MEDIUM' | 'HIGH'", + choices: [ + { label: i18n.str`Low`, value: "LOW" }, + { label: i18n.str`Medium`, value: "MEDIUM" }, + { label: i18n.str`High`, value: "HIGH" }, + ], + type: "choiceHorizontal", + required: false, + }, + { id: "RISK_CLASIFICATION_ACCEPTANCE_DATE" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + label: i18n.str`Acceptance date`, + help: i18n.str`When the decision of the Senior executive body on the acceptance of a business relationship with increased risk was obtain on.`, // gana_type: "AbsoluteDateTime", type: "absoluteTimeText", placeholder: "dd/MM/yyyy HH:mm:ss", @@ -256,7 +373,8 @@ export function VQF_902_4( }, { id: "RISK_CLASIFICATION_LEVEL" satisfies keyof TalerFormAttributes.VQF_902_4 as UIHandlerId, - label: i18n.str``, + label: i18n.str`Risk clasification`, + help: i18n.str`Conclusion whether the business relationship is with or without increased risk.`, // gana_type: "'WITH' | 'WITHOUT'", choices: [ { label: i18n.str`WITH`, value: "WITH" }, diff --git a/packages/web-util/src/forms/gana/VQF_902_5.ts b/packages/web-util/src/forms/gana/VQF_902_5.ts @@ -11,29 +11,29 @@ export function VQF_902_5( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_5 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_5 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_5 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_5 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Business activity`, fields: [ diff --git a/packages/web-util/src/forms/gana/VQF_902_9.ts b/packages/web-util/src/forms/gana/VQF_902_9.ts @@ -12,29 +12,29 @@ export function VQF_902_9( return { type: "double-column", sections: [ - { - title: i18n.str`This form was completed by`, - fields: [ - { - id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_9 as UIHandlerId, - label: i18n.str`Date`, - // gana_type: "AbsoluteDateTime", - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy HH:mm:ss", - pattern: "dd/MM/yyyy HH:mm:ss", - required: true, - disabled: true, - }, - { - id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_9 as UIHandlerId, - label: i18n.str`Customer`, - // gana_type: "String", - type: "text", - required: true, - disabled: true, - }, - ], - }, + // { + // title: i18n.str`This form was completed by`, + // fields: [ + // { + // id: "FORM_FILLING_DATE" satisfies keyof TalerFormAttributes.VQF_902_9 as UIHandlerId, + // label: i18n.str`Date`, + // // gana_type: "AbsoluteDateTime", + // type: "absoluteTimeText", + // placeholder: "dd/MM/yyyy HH:mm:ss", + // pattern: "dd/MM/yyyy HH:mm:ss", + // required: true, + // disabled: true, + // }, + // { + // id: "CUSTOMER_ID" satisfies keyof TalerFormAttributes.VQF_902_9 as UIHandlerId, + // label: i18n.str`Customer`, + // // gana_type: "String", + // type: "text", + // required: true, + // disabled: true, + // }, + // ], + // }, { title: i18n.str`Contracting partner`, fields: [ diff --git a/packages/web-util/src/forms/gana/taler_form_attributes.ts b/packages/web-util/src/forms/gana/taler_form_attributes.ts @@ -885,19 +885,32 @@ export namespace TalerFormAttributes { * Based on 902.4.1 country list * Required: false */ - COUNTRY_RISK_LEVEL?: "LOW" | "MEDIUM" | "HIGH"; + COUNTRY_RISK_BUSINESS_LEVEL?: "LOW" | "MEDIUM" | "HIGH"; /** * * Required: false */ - COUNTRY_RISK_TYPE?: + COUNTRY_RISK_BUSINESS_TYPE?: "CUSTOMER" | "OWNER"; + /** + * Based on 902.4.1 country list + * Required: false + */ + COUNTRY_RISK_NATIONALITY_LEVEL?: "LOW" | "MEDIUM" | "HIGH"; + /** + * + * Required: false + */ + COUNTRY_RISK_NATIONALITY_TYPE?: | "NATIONALITY_CUSTOMER" | "NATIONALITY_OWNER" | "DOMICILE_CUSTOMER" | "DOMICILE_OWNER" - | "DOMICILE_CONTROLLING" - | "BUSINESS_ACTIVITY" - | "PAYMENTS"; + | "DOMICILE_CONTROLLING"; + /** + * Based on 902.4.1 country list + * Required: false + */ + COUNTRY_RISK_PAYMENTS_LEVEL?: "LOW" | "MEDIUM" | "HIGH"; /** * Customer system ID required to correlate different AML forms. * Required: true @@ -1347,34 +1360,54 @@ export namespace TalerFormAttributes { } export interface AccountProperties { /** - * Business domain of the account owner. + * True if deposit limit changed from zero to greater than zero. + * Required: false + */ + AML_ACCOUNT_ACTIVE_DEPOSIT?: Boolean; + /** + * True if this is an account controlled by domestic PEP. + * Required: false + */ + AML_DOMESTIC_PEP?: Boolean; + /** + * True if this is an account controlled by foreign PEP. + * Required: false + */ + AML_FOREIGN_PEP?: Boolean; + /** + * True if this is an account of a high-rish business. + * Required: false + */ + AML_HIGH_RISK_BUSINESS?: Boolean; + /** + * True if this is an account controlled by person from high-risk country. * Required: false */ - ACCOUNT_BUSINESS_DOMAIN?: String; + AML_HIGH_RISK_COUNTRY?: String; /** - * Is the client's account currently frozen? + * True if account is involved in proceedings for which Art 6 GwG, and completed. * Required: false */ - ACCOUNT_FROZEN?: Boolean; + AML_INVESTIGATION_ART6_COMPLETED?: Boolean; /** - * True if this is a high-risk account. + * True if account is involved in proceedings for which Art 6 GwG, but failed. * Required: false */ - ACCOUNT_HIGH_RISK?: Boolean; + AML_INVESTIGATION_ART6_FAILED?: Boolean; /** - * True if this is a politically exposed account. + * True if this account is going to be reported by right to do so (based on Art 305ter Abs. 2 StGB). * Required: false */ - ACCOUNT_PEP?: Boolean; + AML_MROS_REPORTED_ART305?: Boolean; /** - * Was the client's account reported to the authorities? + * True if this account is going to be reported by obligation to do so (based on Art 9 Abs. 1 GwG). * Required: false */ - ACCOUNT_REPORTED?: Boolean; + AML_MROS_REPORTED_ART9?: Boolean; /** - * True if this is a sanctioned account. + * True if the account made no operaton during a period of time. * Required: false */ - ACCOUNT_SANCTIONED?: Boolean; + AML_NO_OPERATION_DURING_PERIOD?: Boolean; } } diff --git a/packages/web-util/src/hooks/useForm.ts b/packages/web-util/src/hooks/useForm.ts @@ -21,7 +21,7 @@ import { TalerExchangeApi, TranslatedString, } from "@gnu-taler/taler-util"; -import { useState } from "preact/hooks"; +import { useEffect, useState } from "preact/hooks"; import { FormDesign, UIFieldHandler, @@ -79,6 +79,7 @@ export type FormStatus<T> = export type FormState<T> = { handler: FormHandler<T>; status: FormStatus<T>; + update: (f: FormValues<T>) => void; }; function checkAllRequirements<T>( @@ -133,7 +134,13 @@ export function useForm<T>( status?.errors, ); - return { handler, status }; + return { + handler, + status, + update: (f) => { + formUpdateHandler(f as any); + }, + }; } interface Tree<T> extends Record<string, Tree<T> | T> {}