taler-typescript-core

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

commit c44c6cd28ce8c8ba9c6d1e8fbe5a685685e4bec2
parent e64c5ed603c02ef3b5afb42daaca89c0c9f674eb
Author: Florian Dold <florian@dold.me>
Date:   Tue, 15 Apr 2025 18:08:42 +0200

forms: split vqf_902_11

Diffstat:
Mpackages/kyc-ui/src/forms/index.ts | 6++++--
Mpackages/web-util/src/forms/forms-ui.tsx | 17+++++++++++------
Dpackages/web-util/src/forms/gana/VQF_902_11.stories.tsx | 35-----------------------------------
Dpackages/web-util/src/forms/gana/VQF_902_11.ts | 171-------------------------------------------------------------------------------
Mpackages/web-util/src/forms/gana/index.stories.ts | 23++++++++++++-----------
Mpackages/web-util/src/forms/index.ts | 3++-
6 files changed, 29 insertions(+), 226 deletions(-)

diff --git a/packages/kyc-ui/src/forms/index.ts b/packages/kyc-ui/src/forms/index.ts @@ -18,7 +18,8 @@ import { AcceptTermOfServiceContext, acceptTos, form_generic_note, - form_vqf_902_11, + form_vqf_902_11_customer, + form_vqf_902_11_officer, form_vqf_902_14, form_vqf_902_1_customer, form_vqf_902_1_officer, @@ -65,7 +66,8 @@ export const preloadedForms: ( form_vqf_902_4(i18n), form_vqf_902_5(i18n), form_vqf_902_9(i18n), - form_vqf_902_11(i18n), + form_vqf_902_11_customer(i18n), + form_vqf_902_11_officer(i18n), form_vqf_902_14(i18n), form_generic_note(i18n), ]; diff --git a/packages/web-util/src/forms/forms-ui.tsx b/packages/web-util/src/forms/forms-ui.tsx @@ -25,7 +25,7 @@ export function DefaultForm<T>({ initial, disabled, }: { - disabled?: boolean, + disabled?: boolean; design: FormDesign; initial: object; }): VNode { @@ -121,7 +121,7 @@ export function FormUI<T>({ model={model} focus={focus} disabled={disabled} - /> + /> ); }); return ( @@ -208,7 +208,11 @@ export function DoubleColumnFormSectionUI<T>({ <div class="bg-white shadow-sm ring-1 ring-gray-900/5 rounded-md md:col-span-2"> <div class="p-3"> <div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> - <RenderAllFieldsByUiConfig key="fields" fields={fs} focus={focus} disabled={disabled} + <RenderAllFieldsByUiConfig + key="fields" + fields={fs} + focus={focus} + disabled={disabled} /> </div> </div> @@ -242,7 +246,6 @@ export function SingleColumnFormSectionUI<T>({ fields={convertFormConfigToUiField(i18n, `root`, fields, model)} focus={focus} disabled={disabled} - /> </div> </div> @@ -268,13 +271,15 @@ export function RenderAllFieldsByUiConfig({ const Component = UIFormConfiguration[ field.type ] as FieldComponentFunction<any>; - const p = { + const p: Record<string, any> = { ...field.properties, focus: !!focus && i === 0, hidden: hidden || ("hidden" in field.properties && field.properties.hidden), - disabled: disabled, }; + if (disabled != null) { + p.disabled = disabled; + } return <Component key={i} {...p} />; }), diff --git a/packages/web-util/src/forms/gana/VQF_902_11.stories.tsx b/packages/web-util/src/forms/gana/VQF_902_11.stories.tsx @@ -1,35 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { i18n, setupI18n } from "@gnu-taler/taler-util"; -import * as tests from "../../tests/hook.js"; -import { DefaultForm as TestedComponent } from "../forms-ui.js"; -import { VQF_902_11 } from "./VQF_902_11.js"; -export default { - title: "vqf_902_11", -}; - -setupI18n("en", {}); - -export const EmptyForm = tests.createExample(TestedComponent, { - initial: {}, - design: VQF_902_11(i18n), -}); diff --git a/packages/web-util/src/forms/gana/VQF_902_11.ts b/packages/web-util/src/forms/gana/VQF_902_11.ts @@ -1,171 +0,0 @@ -import { TalerFormAttributes } from "@gnu-taler/taler-util"; -import { - DoubleColumnFormDesign, - FormMetadata, - InternationalizationAPI, -} from "../../index.browser.js"; - -export const form_vqf_902_11 = ( - i18n: InternationalizationAPI, -): FormMetadata => ({ - label: i18n.str`Establishing of the controlling person of operating legal entities and partnerships both not quoted on the stock exchange (K)`, - description: i18n.str`for operating legal entities and partnerships that are contracting partner as well as analogously for operating legal entities and partnership that are beneficial owners`, - id: "vqf_902_11", - version: 1, - config: VQF_902_11(i18n), -}); - -export function VQF_902_11( - i18n: InternationalizationAPI, -): DoubleColumnFormDesign { - return { - type: "double-column", - title: i18n.str`Establishment of the controlling person`, - sections: [ - { - title: "Information about submitter", - fields: [ - { - id: TalerFormAttributes.SUBMITTED_BY, - label: i18n.str`Who is filling out the form?`, - type: "choiceHorizontal", - required: true, - choices: [ - { - label: "Taler Operations staff", - value: "AML_OFFICER", - }, - { - label: "The customer", - value: "CUSTOMER", - }, - ], - }, - ], - }, - { - title: "Identity of the contracting partner", - fields: [ - { - id: TalerFormAttributes.IDENTITY_CONTRACTING_PARTNER, - label: i18n.str`Contracting partner`, - type: "textArea", - required: true, - }, - ], - }, - { - title: i18n.str`Controlling person(s)`, - fields: [ - { - id: TalerFormAttributes.CONTROL_REASON, - label: i18n.str`Reason for control`, - type: "choiceStacked", - choices: [ - { - value: "HAS_25_MORE_RIGHTS", - label: i18n.str`Holding 25% or more`, - description: 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: "OTHER_WAY", - label: i18n.str`Other way`, - description: 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: "DIRECTOR", - label: i18n.str`Managing director`, - description: 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)`, - }, - ], - required: true, - }, - { - id: TalerFormAttributes.IDENTITY_LIST, - label: i18n.str`Controlling person(s)`, - type: "array", - validator(persons) { - if (!persons || persons.length < 1) { - return i18n.str`Can't be empty`; - } - return undefined; - }, - labelFieldId: TalerFormAttributes.FULL_NAME, - fields: [ - { - id: TalerFormAttributes.FULL_NAME, - label: i18n.str`Full name`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.DOMICILE_ADDRESS, - label: i18n.str`Actual address of domicile`, - type: "textArea", - required: true, - }, - ], - }, - ], - }, - { - title: i18n.str`Fiduciary holding assets`, - fields: [ - { - id: TalerFormAttributes.CONTROLLING_ENTITY_THIRD_PERSON, - label: i18n.str`Is a third person the beneficial owner of the assets held in the account/securities account?`, - type: "toggle", - required: true, - }, - ], - }, - { - title: i18n.str`Signature(s)`, - description: i18n.str`It is a criminal offence to deliberately provide false information on this form (article 251 of the Swiss Criminal Code, documents forgery)`, - hide(root) { - return root[TalerFormAttributes.SUBMITTED_BY] != "CUSTOMER"; - }, - fields: [ - { - type: "caption", - label: i18n.str`The contracting partner hereby undertakes to inform automatically of any changes to the information contained herein.`, - }, - { - id: TalerFormAttributes.SIGNATURE, - label: i18n.str`Signature(s)`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.SIGN_DATE, - label: i18n.str`Date`, - type: "absoluteTimeText", - placeholder: "dd/MM/yyyy", - pattern: "dd/MM/yyyy", - required: true, - }, - ], - }, - { - title: i18n.str`Signed Declaration`, - description: i18n.str`Signed declaration by the customer`, - hide(root) { - return root[TalerFormAttributes.SUBMITTED_BY] != "AML_OFFICER"; - }, - fields: [ - { - type: "caption", - label: i18n.str`The uploaded document must contain the customer's signature on the beneficial owner declaration.`, - }, - { - id: TalerFormAttributes.ATTACHMENT_SIGNED_DOCUMENT, - label: i18n.str`Signed Document`, - type: "file", - accept: "application/pdf", - required: true, - }, - ], - }, - ], - }; -} diff --git a/packages/web-util/src/forms/gana/index.stories.ts b/packages/web-util/src/forms/gana/index.stories.ts @@ -1,11 +1,12 @@ -export * as a01 from "./GLS_Onboarding.stories.js"; -export * as a02 from "./VQF_902_1_customer.stories.js"; -export * as a03 from "./VQF_902_1_officer.stories.js"; -export * as a04 from "./VQF_902_11.stories.js"; -export * as a05 from "./VQF_902_14.stories.js"; -export * as a06 from "./VQF_902_4.stories.js"; -export * as a07 from "./VQF_902_5.stories.js"; -export * as a08 from "./VQF_902_9.stories.js"; -export * as a09 from "./generic_note.stories.js"; -export * as a10 from "./generic_upload.stories.js"; -export * as a11 from "./accept-tos.stories.js"; +export * as accept_tops_stories from "./accept-tos.stories.js"; +export * as generic_note_stories from "./generic_note.stories.js"; +export * as generic_upload_stories from "./generic_upload.stories.js"; +export * as gls_onboarding_stories from "./GLS_Onboarding.stories.js"; +export * as vqf_902_11_customer_stories from "./VQF_902_11_customer.stories.js"; +export * as vqf_902_11_officer_stories from "./VQF_902_11_officer.stories.js"; +export * as vqf_902_14_stories from "./VQF_902_14.stories.js"; +export * as vqf_902_1_customer_stories from "./VQF_902_1_customer.stories.js"; +export * as vqf_902_1_officer_stories from "./VQF_902_1_officer.stories.js"; +export * as vqf_902_4_stories from "./VQF_902_4.stories.js"; +export * as vqf_902_5_stories from "./VQF_902_5.stories.js"; +export * as vqf_902_9_stories from "./VQF_902_9.stories.js"; diff --git a/packages/web-util/src/forms/index.ts b/packages/web-util/src/forms/index.ts @@ -23,7 +23,8 @@ export * from "./forms-ui.js"; export * from "./gana/accept-tos.js"; export * from "./gana/generic_note.js"; export * from "./gana/GLS_Onboarding.js"; -export * from "./gana/VQF_902_11.js"; +export * from "./gana/VQF_902_11_customer.js"; +export * from "./gana/VQF_902_11_officer.js"; export * from "./gana/VQF_902_14.js"; export * from "./gana/VQF_902_1_customer.js"; export * from "./gana/VQF_902_1_officer.js";