taler-typescript-core

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

commit 968bc83366f04fc18b4ff3cabed30fa161ddc2cc
parent 7ea1b7fe706aa3d9f40e317bcdfd6e633163bdd5
Author: Florian Dold <florian@dold.me>
Date:   Sun, 25 May 2025 19:28:17 +0200

forms: gls wallet confirmation form

Diffstat:
Mpackages/aml-backoffice-ui/src/forms/index.ts | 17++++-------------
Mpackages/kyc-ui/src/forms/index.ts | 11++++-------
Mpackages/taler-util/src/taler-form-attributes.ts | 14+++++++++++++-
Dpackages/web-util/src/forms/gana/GLS_Onboarding.stories.tsx | 44--------------------------------------------
Dpackages/web-util/src/forms/gana/GLS_Onboarding.ts | 348-------------------------------------------------------------------------------
Apackages/web-util/src/forms/gana/gls_merchant_onboarding.stories.tsx | 44++++++++++++++++++++++++++++++++++++++++++++
Apackages/web-util/src/forms/gana/gls_merchant_onboarding.ts | 371+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apackages/web-util/src/forms/gana/gls_wallet_confirmation.stories.tsx | 44++++++++++++++++++++++++++++++++++++++++++++
Apackages/web-util/src/forms/gana/gls_wallet_confirmation.ts | 49+++++++++++++++++++++++++++++++++++++++++++++++++
Mpackages/web-util/src/forms/gana/index.stories.ts | 5++++-
Mpackages/web-util/src/forms/index.ts | 5++++-
11 files changed, 537 insertions(+), 415 deletions(-)

diff --git a/packages/aml-backoffice-ui/src/forms/index.ts b/packages/aml-backoffice-ui/src/forms/index.ts @@ -15,6 +15,7 @@ */ import { form_generic_note, + form_gls_merchant_onboarding, form_vqf_902_11_customer, form_vqf_902_11_officer, form_vqf_902_14, @@ -24,10 +25,10 @@ import { form_vqf_902_5, form_vqf_902_9_customer, form_vqf_902_9_officer, - GLS_Onboarding, type FormMetadata, type InternationalizationAPI, } from "@gnu-taler/web-util/browser"; +import { form_gls_wallet_confirmation } from "../../../web-util/src/forms/gana/gls_wallet_confirmation.js"; export const preloadedForms: ( i18n: InternationalizationAPI, @@ -42,16 +43,6 @@ export const preloadedForms: ( form_vqf_902_9_customer(i18n), form_vqf_902_9_officer(i18n), form_generic_note(i18n), - // { - // label: i18n.str`Terms of Service`, - // id: "accept-tos", - // version: 1, - // config: acceptTos(i18n, context as AcceptTermOfServiceContext), - // }, - { - label: i18n.str`GLS onboarding`, - id: "gls-onboarding", - version: 1, - config: GLS_Onboarding(i18n), - }, + form_gls_merchant_onboarding(i18n), + form_gls_wallet_confirmation(i18n), ]; diff --git a/packages/kyc-ui/src/forms/index.ts b/packages/kyc-ui/src/forms/index.ts @@ -18,6 +18,8 @@ import { AcceptTermOfServiceContext, acceptTos, form_generic_note, + form_gls_merchant_onboarding, + form_gls_wallet_confirmation, form_vqf_902_11_customer, form_vqf_902_11_officer, form_vqf_902_14, @@ -28,7 +30,6 @@ import { form_vqf_902_9_customer, form_vqf_902_9_officer, FormMetadata, - GLS_Onboarding, InternationalizationAPI, } from "@gnu-taler/web-util/browser"; import { nameAndDob } from "./nameAndBirthdate.js"; @@ -51,12 +52,6 @@ export const preloadedForms: ( config: acceptTos(i18n, context as AcceptTermOfServiceContext), }, { - label: i18n.str`GLS onboarding`, - id: "gls-onboarding", - version: 1, - config: GLS_Onboarding(i18n), - }, - { label: i18n.str`Name and birthdate`, id: "name_and_dob", version: 1, @@ -72,4 +67,6 @@ export const preloadedForms: ( form_vqf_902_11_officer(i18n), form_vqf_902_14(i18n), form_generic_note(i18n), + form_gls_merchant_onboarding(i18n), + form_gls_wallet_confirmation(i18n), ]; diff --git a/packages/taler-util/src/taler-form-attributes.ts b/packages/taler-util/src/taler-form-attributes.ts @@ -501,18 +501,30 @@ export const TalerFormAttributes = { */ PERSON_NATIONALITY: "PERSON_NATIONALITY" as const, /** + * Description: Confirmation that the wallet user is a private customer, not a business. + * + * GANA Type: Boolean + */ + WALLET_USER_IS_PRIVATE_CUSTOMER: "WALLET_USER_IS_PRIVATE_CUSTOMER" as const, + /** * Description: Name of the company or business. * * GANA Type: String */ BUSINESS_DISPLAY_NAME: "BUSINESS_DISPLAY_NAME" as const, /** - * Description: Type of company form or business (limited liability company, general partnership, limited partnership, corporations, etc... ). + * Description: Type of company form or business (selection from fixed list). * * GANA Type: String */ BUSINESS_TYPE: "BUSINESS_TYPE" as const, /** + * Description: Type of company form or business (free-form entry for OTHER). + * + * GANA Type: String + */ + BUSINESS_TYPE_OTHER: "BUSINESS_TYPE_OTHER" as const, + /** * Description: Registration id on legal entity of the company or business. * * GANA Type: String diff --git a/packages/web-util/src/forms/gana/GLS_Onboarding.stories.tsx b/packages/web-util/src/forms/gana/GLS_Onboarding.stories.tsx @@ -1,44 +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 { GLS_Onboarding } from "./GLS_Onboarding.js"; - -export default { - title: "GLS_Onboarding", -}; - -export namespace Simplest { - export interface Form { - comment: string; - } -} - -setupI18n("en", {}); -type TargetObject = {}; -const initial: TargetObject = {}; - -export const SimpleUsage = tests.createExample(TestedComponent, { - initial, - design: GLS_Onboarding(i18n), -}); diff --git a/packages/web-util/src/forms/gana/GLS_Onboarding.ts b/packages/web-util/src/forms/gana/GLS_Onboarding.ts @@ -1,348 +0,0 @@ -import { TalerFormAttributes } from "@gnu-taler/taler-util"; -import { intervalToDuration, isFuture, isValid, parse } from "date-fns"; -import { - DoubleColumnFormDesign, - InternationalizationAPI, -} from "../../index.browser.js"; -import { - countryNameList, - countryNationalityList, -} from "../../utils/select-ui-lists.js"; - -export function GLS_Onboarding( - i18n: InternationalizationAPI, - context?: any, -): DoubleColumnFormDesign { - return { - type: "double-column", - title: "Merchant Onboarding Information", - sections: [ - { - title: i18n.str`Personal Information`, - description: i18n.str`Personal information of the acting person`, - fields: [ - { - id: TalerFormAttributes.PERSON_FIRST_NAMES, - label: i18n.str`First name(s)`, - help: i18n.str`As on your ID document`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.PERSON_LAST_NAME, - label: i18n.str`Last name`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.DATE_OF_BIRTH, - label: i18n.str`Date of birth`, - type: "isoDateText", - placeholder: "dd/MM/yyyy", - pattern: "dd/MM/yyyy", - required: true, - validator(text, form) { - //FIXME: why returning in this format even if pattern is in another? - const time = parse(text, "yyyy-MM-dd", new Date()); - if (!isValid(time)) { - return i18n.str`invalid format`; - } - if (isFuture(time)) { - return i18n.str`it can't be in the future`; - } - const { years } = intervalToDuration({ - start: time, - end: new Date(), - }); - if ( years && years > 120) { - return i18n.str`it can't be greater than 120 years`; - } - return undefined; - }, - }, - { - id: TalerFormAttributes.PERSON_NATIONALITY, - label: i18n.str`Nationality`, - type: "selectOne", - choices: countryNationalityList(i18n), - required: true, - }, - { - id: TalerFormAttributes.CONTACT_PHONE, - label: i18n.str`Phone number`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.CONTACT_EMAIL, - label: i18n.str`E-Mail`, - type: "text", - required: true, - }, - ], - }, - { - title: i18n.str`Terms of Service`, - fields: [ - { - type: "external-link", - id: TalerFormAttributes.DOWNLOADED_TERMS_OF_SERVICE, - required: true, - url: "https://google.com", - label: i18n.str`Download the term of service`, - media: "text/plain", - }, - { - type: "caption", - label: - "You need to download the terms of service before you can accept them.", - hide(value, root) { - console.log( - `hide caption: ${root["DOWNLOADED_TERMS_OF_SERVICE"] === true}`, - ); - return root["DOWNLOADED_TERMS_OF_SERVICE"] === true; - }, - }, - { - type: "toggle", - id: TalerFormAttributes.ACCEPTED_TERMS_OF_SERVICE, - required: true, - label: i18n.str`Do you accept the terms of service?`, - validator(v) { - return !v - ? i18n.str`Can't continue without accepting term of service.` - : undefined; - }, - hide(value, root) { - return !root["DOWNLOADED_TERMS_OF_SERVICE"]; - }, - }, - ], - }, - { - title: i18n.str`Company information`, - fields: [ - { - id: TalerFormAttributes.BUSINESS_DISPLAY_NAME, - label: i18n.str`Name of the company`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.BUSINESS_TYPE, - label: i18n.str`Legal form`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.COMMERCIAL_REGISTER_NUMBER, - label: i18n.str`Commercial register number`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.REGISTER_COURT_LOCATION, - label: i18n.str`Seat of the register court`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.FOUNDING_DATE, - label: i18n.str`Founding date`, - type: "isoDateText", - placeholder: "dd/MM/yyyy", - pattern: "dd/MM/yyyy", - required: true, - validator(text, form) { - //FIXME: why returning in this format even if pattern is in another? - const time = parse(text, "yyyy-MM-dd", new Date()); - if (!isValid(time)) { - return i18n.str`invalid format`; - } - if (isFuture(time)) { - return i18n.str`it can't be in the future`; - } - const { years } = intervalToDuration({ - start: time, - end: new Date(), - }); - if ( years && years > 120) { - return i18n.str`it can't be greater than 120 years`; - } - return undefined; - }, - }, - { - id: TalerFormAttributes.BUSINESS_IS_NON_PROFIT, - label: i18n.str`Is the company a non-profit organization?`, - required: true, - type: "choiceHorizontal", - choices: [ - { - label: "Yes", - value: true, - }, - { - label: "No", - value: false, - }, - ], - }, - { - id: TalerFormAttributes.BUSINESS_INDUSTRY, - type: "choiceHorizontal", - choices: [{ - value: "OTHER", - label: "Other (free-form selection)" - }], - label: i18n.str`Industry (choose from list)` - }, - { - id: TalerFormAttributes.BUSINESS_INDUSTRY_OTHER, - label: i18n.str`Industry (free-form entry for other)`, - type: "text", - required: true, - }, - ], - }, - { - title: i18n.str`Company address`, - fields: [ - { - id: TalerFormAttributes.DOMICILE_ADDRESS, - label: i18n.str`Address`, - type: "textArea", - required: true, - }, - { - id: TalerFormAttributes.ADDRESS_COUNTRY, - label: i18n.str`Country`, - type: "selectOne", - choices: countryNameList(i18n), - required: true, - }, - ], - }, - { - title: i18n.str`Tax information`, - fields: [ - { - id: TalerFormAttributes.DE_BUSINESS_OR_TAX_ID, - label: i18n.str`Business identification number or tax number`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.TAX_IS_USA_LAW, - label: i18n.str`Was the company incorporated in the USA or under US law?`, - required: true, - type: "choiceHorizontal", - choices: [ - { - label: "Yes", - value: true, - }, - { - label: "No", - value: false, - }, - ], - }, - { - id: TalerFormAttributes.TAX_IS_ACTIVE, - label: i18n.str`Economically active or inactive?`, - type: "choiceHorizontal", - choices: [ - { - label: "Active", - value: "ACTIVE", - }, - { - label: "Inactive", - value: "INACTIVE", - }, - ], - required: true, - }, - { - id: TalerFormAttributes.TAX_IS_DEDUCTED, - label: i18n.str`Eligible for input tax deduction`, - type: "choiceHorizontal", - choices: [ - { - label: "Yes", - value: true, - }, - { - label: "No", - value: false, - }, - ], - required: true, - }, - ], - }, - { - title: i18n.str`Persons`, - description: i18n.str`Please list all legal representatives, shareholders/partners, and authorized signatories.`, - fields: [ - { - id: TalerFormAttributes.BUSINESS_PERSONS, - label: i18n.str`Legal representatives / shareholders / partners / authorized signatories`, - type: "array", - labelFieldId: TalerFormAttributes.PERSON_LAST_NAME, - fields: [ - { - id: TalerFormAttributes.PERSON_FIRST_NAMES, - label: i18n.str`First name(s)`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.PERSON_LAST_NAME, - label: i18n.str`Last name`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.DATE_OF_BIRTH, - label: i18n.str`Date of birth`, - type: "isoDateText", - placeholder: "dd/MM/yyyy", - pattern: "dd/MM/yyyy", - required: true, - }, - { - id: TalerFormAttributes.NATIONALITY, - label: i18n.str`Nationality`, - type: "text", - required: true, - }, - { - id: TalerFormAttributes.REPRESENTATIVE_TYPE, - label: i18n.str`Type of representative`, - type: "choiceStacked", - choices: [ - { - label: "Shareholder (at least 25% of shares)", - value: "SHAREHOLDER_GT_25_PERCENT", - }, - { - label: "Legal representative", - value: "LEGAL_REPRESENTATIVE", - }, - { - label: "Authorized employee with account access", - value: "AUTHORIZED_EMPLOYEE", - }, - ], - - } - ], - required: true, - }, - ], - }, - ], - }; -} diff --git a/packages/web-util/src/forms/gana/gls_merchant_onboarding.stories.tsx b/packages/web-util/src/forms/gana/gls_merchant_onboarding.stories.tsx @@ -0,0 +1,44 @@ +/* + 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 { gls_merchant_onboarding } from "./gls_merchant_onboarding.js"; + +export default { + title: "GLS_Onboarding", +}; + +export namespace Simplest { + export interface Form { + comment: string; + } +} + +setupI18n("en", {}); +type TargetObject = {}; +const initial: TargetObject = {}; + +export const SimpleUsage = tests.createExample(TestedComponent, { + initial, + design: gls_merchant_onboarding(i18n), +}); diff --git a/packages/web-util/src/forms/gana/gls_merchant_onboarding.ts b/packages/web-util/src/forms/gana/gls_merchant_onboarding.ts @@ -0,0 +1,371 @@ +import { TalerFormAttributes } from "@gnu-taler/taler-util"; +import { intervalToDuration, isFuture, isValid, parse } from "date-fns"; +import { + DoubleColumnFormDesign, + FormMetadata, + InternationalizationAPI, +} from "../../index.browser.js"; +import { + countryNameList, + countryNationalityList, +} from "../../utils/select-ui-lists.js"; + +export const form_gls_merchant_onboarding = ( + i18n: InternationalizationAPI, +): FormMetadata => ({ + config: gls_merchant_onboarding(i18n, {}), + id: "gls-merchant-onboarding", + label: "GLS Merchant Onboarding", + version: 1, +}); + +export function gls_merchant_onboarding( + i18n: InternationalizationAPI, + context?: any, +): DoubleColumnFormDesign { + return { + type: "double-column", + title: "Merchant Onboarding Information", + sections: [ + { + title: i18n.str`Personal Information`, + description: i18n.str`Personal information of the acting person`, + fields: [ + { + id: TalerFormAttributes.PERSON_FIRST_NAMES, + label: i18n.str`First name(s)`, + help: i18n.str`As on your ID document`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.PERSON_LAST_NAME, + label: i18n.str`Last name`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.DATE_OF_BIRTH, + label: i18n.str`Date of birth`, + type: "isoDateText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", + required: true, + validator(text, form) { + //FIXME: why returning in this format even if pattern is in another? + const time = parse(text, "yyyy-MM-dd", new Date()); + if (!isValid(time)) { + return i18n.str`invalid format`; + } + if (isFuture(time)) { + return i18n.str`it can't be in the future`; + } + const { years } = intervalToDuration({ + start: time, + end: new Date(), + }); + if (years && years > 120) { + return i18n.str`it can't be greater than 120 years`; + } + return undefined; + }, + }, + { + id: TalerFormAttributes.PERSON_NATIONALITY, + label: i18n.str`Nationality`, + type: "selectOne", + choices: countryNationalityList(i18n), + required: true, + }, + { + id: TalerFormAttributes.CONTACT_PHONE, + label: i18n.str`Phone number`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.CONTACT_EMAIL, + label: i18n.str`E-Mail`, + type: "text", + required: true, + }, + ], + }, + { + title: i18n.str`Terms of Service`, + fields: [ + { + type: "external-link", + id: TalerFormAttributes.DOWNLOADED_TERMS_OF_SERVICE, + required: true, + url: "https://google.com", + label: i18n.str`Download the term of service`, + media: "text/plain", + }, + { + type: "caption", + label: + "You need to download the terms of service before you can accept them.", + hide(value, root) { + console.log( + `hide caption: ${root["DOWNLOADED_TERMS_OF_SERVICE"] === true}`, + ); + return root["DOWNLOADED_TERMS_OF_SERVICE"] === true; + }, + }, + { + type: "toggle", + id: TalerFormAttributes.ACCEPTED_TERMS_OF_SERVICE, + required: true, + label: i18n.str`Do you accept the terms of service?`, + validator(v) { + return !v + ? i18n.str`Can't continue without accepting term of service.` + : undefined; + }, + hide(value, root) { + return !root["DOWNLOADED_TERMS_OF_SERVICE"]; + }, + }, + ], + }, + { + title: i18n.str`Company information`, + fields: [ + { + id: TalerFormAttributes.BUSINESS_DISPLAY_NAME, + label: i18n.str`Name of the company`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.BUSINESS_TYPE, + label: i18n.str`Legal form`, + required: true, + type: "choiceHorizontal", + choices: [ + { + value: "OTHER", + label: "Other (free-form selection)", + }, + ], + }, + { + id: TalerFormAttributes.BUSINESS_TYPE_OTHER, + label: i18n.str`Legal form (free-form entry for other)`, + required: true, + type: "text", + }, + { + id: TalerFormAttributes.COMMERCIAL_REGISTER_NUMBER, + label: i18n.str`Commercial register number`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.REGISTER_COURT_LOCATION, + label: i18n.str`Seat of the register court`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.FOUNDING_DATE, + label: i18n.str`Founding date`, + type: "isoDateText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", + required: true, + validator(text, form) { + //FIXME: why returning in this format even if pattern is in another? + const time = parse(text, "yyyy-MM-dd", new Date()); + if (!isValid(time)) { + return i18n.str`invalid format`; + } + if (isFuture(time)) { + return i18n.str`it can't be in the future`; + } + const { years } = intervalToDuration({ + start: time, + end: new Date(), + }); + if (years && years > 120) { + return i18n.str`it can't be greater than 120 years`; + } + return undefined; + }, + }, + { + id: TalerFormAttributes.BUSINESS_IS_NON_PROFIT, + label: i18n.str`Is the company a non-profit organization?`, + required: true, + type: "choiceHorizontal", + choices: [ + { + label: "Yes", + value: true, + }, + { + label: "No", + value: false, + }, + ], + }, + { + id: TalerFormAttributes.BUSINESS_INDUSTRY, + type: "choiceHorizontal", + choices: [ + { + value: "OTHER", + label: "Other (free-form selection)", + }, + ], + label: i18n.str`Industry (choose from list)`, + }, + { + id: TalerFormAttributes.BUSINESS_INDUSTRY_OTHER, + label: i18n.str`Industry (free-form entry for other)`, + type: "text", + required: true, + }, + ], + }, + { + title: i18n.str`Company address`, + fields: [ + { + id: TalerFormAttributes.DOMICILE_ADDRESS, + label: i18n.str`Address`, + type: "textArea", + required: true, + }, + { + id: TalerFormAttributes.ADDRESS_COUNTRY, + label: i18n.str`Country`, + type: "selectOne", + choices: countryNameList(i18n), + required: true, + }, + ], + }, + { + title: i18n.str`Tax information`, + fields: [ + { + id: TalerFormAttributes.DE_BUSINESS_OR_TAX_ID, + label: i18n.str`Business identification number or tax number`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.TAX_IS_USA_LAW, + label: i18n.str`Was the company incorporated in the USA or under US law?`, + required: true, + type: "choiceHorizontal", + choices: [ + { + label: "Yes", + value: true, + }, + { + label: "No", + value: false, + }, + ], + }, + { + id: TalerFormAttributes.TAX_IS_ACTIVE, + label: i18n.str`Economically active or inactive?`, + type: "choiceHorizontal", + choices: [ + { + label: "Active", + value: "ACTIVE", + }, + { + label: "Inactive", + value: "INACTIVE", + }, + ], + required: true, + }, + { + id: TalerFormAttributes.TAX_IS_DEDUCTED, + label: i18n.str`Eligible for input tax deduction`, + type: "choiceHorizontal", + choices: [ + { + label: "Yes", + value: true, + }, + { + label: "No", + value: false, + }, + ], + required: true, + }, + ], + }, + { + title: i18n.str`Persons`, + description: i18n.str`Please list all legal representatives, shareholders/partners, and authorized signatories.`, + fields: [ + { + id: TalerFormAttributes.BUSINESS_PERSONS, + label: i18n.str`Legal representatives / shareholders / partners / authorized signatories`, + type: "array", + labelFieldId: TalerFormAttributes.PERSON_LAST_NAME, + fields: [ + { + id: TalerFormAttributes.PERSON_FIRST_NAMES, + label: i18n.str`First name(s)`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.PERSON_LAST_NAME, + label: i18n.str`Last name`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.DATE_OF_BIRTH, + label: i18n.str`Date of birth`, + type: "isoDateText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", + required: true, + }, + { + id: TalerFormAttributes.NATIONALITY, + label: i18n.str`Nationality`, + type: "text", + required: true, + }, + { + id: TalerFormAttributes.REPRESENTATIVE_TYPE, + label: i18n.str`Type of representative`, + type: "choiceStacked", + choices: [ + { + label: "Shareholder (at least 25% of shares)", + value: "SHAREHOLDER_GT_25_PERCENT", + }, + { + label: "Legal representative", + value: "LEGAL_REPRESENTATIVE", + }, + { + label: "Authorized employee with account access", + value: "AUTHORIZED_EMPLOYEE", + }, + ], + }, + ], + required: true, + }, + ], + }, + ], + }; +} diff --git a/packages/web-util/src/forms/gana/gls_wallet_confirmation.stories.tsx b/packages/web-util/src/forms/gana/gls_wallet_confirmation.stories.tsx @@ -0,0 +1,44 @@ +/* + 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 { gls_wallet_confirmation } from "./gls_wallet_confirmation.js"; + +export default { + title: "gls_wallet_confirmation", +}; + +export namespace Simplest { + export interface Form { + comment: string; + } +} + +setupI18n("en", {}); +type TargetObject = {}; +const initial: TargetObject = {}; + +export const SimpleUsage = tests.createExample(TestedComponent, { + initial, + design: gls_wallet_confirmation(i18n), +}); diff --git a/packages/web-util/src/forms/gana/gls_wallet_confirmation.ts b/packages/web-util/src/forms/gana/gls_wallet_confirmation.ts @@ -0,0 +1,49 @@ +import { TalerFormAttributes } from "@gnu-taler/taler-util"; +import { + DoubleColumnFormDesign, + FormMetadata, + InternationalizationAPI, +} from "../../index.browser.js"; + +export const form_gls_wallet_confirmation = ( + i18n: InternationalizationAPI, +): FormMetadata => ({ + config: gls_wallet_confirmation(i18n, {}), + id: "gls-wallet-confirmation", + label: "GLS Wallet Confirmation", + version: 1, +}); + +export function gls_wallet_confirmation( + i18n: InternationalizationAPI, + context?: any, +): DoubleColumnFormDesign { + return { + type: "double-column", + title: "GLS Wallet Confirmation", + sections: [ + { + title: i18n.str`Confirmation`, + description: i18n.str`Confirmation of private customer / wallet.`, + fields: [ + { + id: TalerFormAttributes.WALLET_USER_IS_PRIVATE_CUSTOMER, + label: i18n.str`Please confirm that you are a private customer that wants to redeem their wallet balance.`, + type: "choiceHorizontal", + required: true, + choices: [ + { + label: "Yes", + value: true, + }, + { + label: "No", + value: false, + }, + ], + }, + ], + }, + ], + }; +} diff --git a/packages/web-util/src/forms/gana/index.stories.ts b/packages/web-util/src/forms/gana/index.stories.ts @@ -1,7 +1,10 @@ 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 gls_onboarding_stories from "./gls_merchant_onboarding.stories.js"; +export * as gls_wallet_confirmation_stories from "./gls_wallet_confirmation.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"; diff --git a/packages/web-util/src/forms/index.ts b/packages/web-util/src/forms/index.ts @@ -22,7 +22,10 @@ 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/gls_merchant_onboarding.js"; +export * from "./gana/gls_wallet_confirmation.js"; + export * from "./gana/VQF_902_11_customer.js"; export * from "./gana/VQF_902_11_officer.js"; export * from "./gana/VQF_902_14.js";