taler-typescript-core

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

commit 8b20b46960067edf8c12616d026e3f93fbe70c5c
parent 76720cfcd903fed9bb2ef4f43929a7c2f0769077
Author: Sebastian <sebasjm@gmail.com>
Date:   Tue, 28 Jan 2025 16:45:17 -0300

fix gls form and imports

Diffstat:
Mpackages/web-util/src/components/Button.tsx | 10+---------
Mpackages/web-util/src/forms/gana/GLS_Onboarding.ts | 225+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Mpackages/web-util/src/forms/gana/VQF_902_1.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_11.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_12.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_13.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_14.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_15.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_4.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_5.ts | 2+-
Mpackages/web-util/src/forms/gana/VQF_902_9.ts | 2+-
Mpackages/web-util/src/forms/gana/taler_form_attributes.ts | 38++++++++++++++++++++++++++++++++------
Mpackages/web-util/src/hooks/useForm.ts | 5++---
13 files changed, 248 insertions(+), 48 deletions(-)

diff --git a/packages/web-util/src/components/Button.tsx b/packages/web-util/src/components/Button.tsx @@ -15,23 +15,15 @@ */ import { - AbsoluteTime, OperationAlternative, OperationFail, OperationOk, OperationResult, - TalerError, TranslatedString, } from "@gnu-taler/taler-util"; -// import { NotificationMessage, notifyInfo } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { HTMLAttributes, useState } from "preact/compat"; -import { - NotificationMessage, - buildUnifiedRequestErrorMessage, - notifyInfo, - useTranslationContext, -} from "../index.browser.js"; +import { useTranslationContext } from "../index.browser.js"; // import { useBankCoreApiContext } from "../context/config.js"; // function errorMap<T extends OperationFail<unknown>>(resp: T, map: (d: T["case"]) => TranslatedString): void { diff --git a/packages/web-util/src/forms/gana/GLS_Onboarding.ts b/packages/web-util/src/forms/gana/GLS_Onboarding.ts @@ -1,9 +1,9 @@ import { + DoubleColumnFormDesign, InternationalizationAPI, UIHandlerId, - SelectUiChoice, - DoubleColumnFormDesign, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; +import { countryList } from "./VQF_902_1.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function GLS_Onboarding( @@ -17,7 +17,7 @@ export function GLS_Onboarding( fields: [ { id: "PERSON_FULL_NAME" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, - label: i18n.str`Fullname`, + label: i18n.str`Full name`, // gana_type: "String", type: "text", }, @@ -29,31 +29,34 @@ export function GLS_Onboarding( required: true, }, { - id: "PERSON_LAST_NAME" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, - label: i18n.str`Last name`, + id: "PERSON_NATIONAL_ID" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`National ID Number`, // gana_type: "String", type: "text", required: true, }, { - id: "PERSON_NATIONAL_ID" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, - label: i18n.str`National ID Number`, - // gana_type: "String", - type: "text", + id: "PERSON_NATIONAL_ID_SCAN" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`National ID Photo`, + // gana_type: "File", + type: "file", required: true, }, { id: "PERSON_DATE_OF_BIRTH" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, label: i18n.str`Date of birth`, - // gana_type: "String", - type: "text", + // gana_type: "AbsoluteDate", + type: "absoluteTimeText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", required: true, }, { - id: "PERSON_NATIONAL_ID_SCAN" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, - label: i18n.str`National ID Photo`, - // gana_type: "File", - type: "file", + id: "PERSON_NATIONALITY" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Nationality`, + // gana_type: "CountryCode", + type: "selectOne", + choices: countryList(i18n), required: true, }, ], @@ -68,6 +71,104 @@ export function GLS_Onboarding( type: "text", required: true, }, + { + id: "BUSINESS_TYPE" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Business type`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "BUSINESS_REGISTRATION_ID" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Registration ID`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "BUSINESS_LEGAL_JURISDICTION" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Legal jurisdiction`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "BUSINESS_REGISTRATION_DATE" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Registration date`, + // gana_type: "AbsoluteDate", + type: "absoluteTimeText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", + required: true, + }, + { + id: "BUSINESS_IS_NON_PROFIT" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Is non profit?`, + // gana_type: "Boolean", + type: "toggle", + required: true, + }, + { + id: "BUSINESS_INDUSTRY" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Industry`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "BUSINESS_LEGAL_REPRESENTATIVES" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Legal representatives`, + // gana_type: "GLS_BusinessRepresentative[]", + type: "array", + labelFieldId: "asd" as UIHandlerId, + fields: [ + { + id: "GLS_REPRESENTATIVE_FULL_NAME" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`Full name`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "GLS_REPRESENTATIVE_LAST_NAME" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`Last name`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "GLS_REPRESENTATIVE_DATE_OF_BIRTH" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`Date of birth`, + // gana_type: "AbsoluteDate", + type: "absoluteTimeText", + placeholder: "dd/MM/yyyy", + pattern: "dd/MM/yyyy", + required: true, + }, + { + id: "GLS_REPRESENTATIVE_NATIONALITY" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`Nationality`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "GLS_REPRESENTATIVE_NATIONAL_ID" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`National ID number`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "GLS_REPRESENTATIVE_NATIONAL_ID_SCAN" satisfies keyof TalerFormAttributes.GLS_BusinessRepresentative as UIHandlerId, + label: i18n.str`National ID photo`, + // gana_type: "File", + type: "file", + required: true, + }, + ], + required: true, + }, ], }, { @@ -83,14 +184,14 @@ export function GLS_Onboarding( { id: "CONTACT_WEB_DOMAIN" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, label: i18n.str`Web site`, - // gana_type: "Hostname", + // gana_type: "HttpHostnamePath", type: "text", required: true, }, { id: "CONTACT_EMAIL" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, label: i18n.str`Email`, - // gana_type: "Hostname", + // gana_type: "Email", type: "text", required: true, }, @@ -109,13 +210,70 @@ export function GLS_Onboarding( { id: "ADDRESS_COUNTRY" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, label: i18n.str`Country`, + // gana_type: "CountryCode", + type: "selectOne", + choices: countryList(i18n), + required: true, + }, + { + id: "ADDRESS_COUNTRY_SUBDIVISION" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Country subdivision`, // gana_type: "Hostname", type: "text", required: true, }, { id: "ADDRESS_STREET_NAME" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, - label: i18n.str`Street`, + label: i18n.str`Street name`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "ADDRESS_STREET_NUMBER" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Street number`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "ADDRESS_LINES" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Street lines`, + // gana_type: "String", + type: "textArea", + required: true, + }, + { + id: "ADDRESS_BUILDING_NAME" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Building name`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "ADDRESS_BUILDING_NUMBER" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Building number`, + // gana_type: "String", + type: "text", + required: true, + }, + { + id: "ADDRESS_ZIPCODE" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Zipcode`, + // gana_type: "Hostname", + type: "text", + required: true, + }, + { + id: "ADDRESS_TOWN_LOCATION" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Town location`, + // gana_type: "Hostname", + type: "text", + required: true, + }, + { + id: "ADDRESS_TOWN_DISTRICT" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`Town district`, // gana_type: "Hostname", type: "text", required: true, @@ -128,8 +286,9 @@ export function GLS_Onboarding( { id: "TAX_COUNTRY" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, label: i18n.str`Country`, - // gana_type: "Hostname", - type: "text", + // gana_type: "CountryCode", + type: "selectOne", + choices: countryList(i18n), required: true, }, { @@ -139,6 +298,30 @@ export function GLS_Onboarding( type: "text", required: true, }, + { + id: "TAX_IS_USA_LAW" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`under USA law?`, + help: i18n.str`wurde die gesellschaft in den USA oder nach US-Recht gergrudent`, + // gana_type: "Boolean", + type: "toggle", + required: true, + }, + { + id: "TAX_IS_ACTIVE" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`is economically active?`, + help: i18n.str`wirtschaftlich aktiv oder passiv`, + // gana_type: "Boolean", + type: "toggle", + required: true, + }, + { + id: "TAX_IS_DEDUCTED" satisfies keyof TalerFormAttributes.GLS_Onboarding as UIHandlerId, + label: i18n.str`entitled to deduct tax?`, + help: i18n.str`sind sie vorsteuerabzugsberechtigt`, + // gana_type: "Boolean", + type: "toggle", + required: true, + }, ], }, ], diff --git a/packages/web-util/src/forms/gana/VQF_902_1.ts b/packages/web-util/src/forms/gana/VQF_902_1.ts @@ -3,7 +3,7 @@ import { UIHandlerId, SelectUiChoice, DoubleColumnFormDesign, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function countryList(i18n: InternationalizationAPI): SelectUiChoice[] { diff --git a/packages/web-util/src/forms/gana/VQF_902_11.ts b/packages/web-util/src/forms/gana/VQF_902_11.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function VQF_902_11( diff --git a/packages/web-util/src/forms/gana/VQF_902_12.ts b/packages/web-util/src/forms/gana/VQF_902_12.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; import { countryList } from "./VQF_902_1.js"; diff --git a/packages/web-util/src/forms/gana/VQF_902_13.ts b/packages/web-util/src/forms/gana/VQF_902_13.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; import { countryList } from "./VQF_902_1.js"; diff --git a/packages/web-util/src/forms/gana/VQF_902_14.ts b/packages/web-util/src/forms/gana/VQF_902_14.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function VQF_902_14( diff --git a/packages/web-util/src/forms/gana/VQF_902_15.ts b/packages/web-util/src/forms/gana/VQF_902_15.ts @@ -2,7 +2,7 @@ import { DoubleColumnFormDesign, InternationalizationAPI, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; import { countryList } from "./VQF_902_1.js"; diff --git a/packages/web-util/src/forms/gana/VQF_902_4.ts b/packages/web-util/src/forms/gana/VQF_902_4.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function VQF_902_4( diff --git a/packages/web-util/src/forms/gana/VQF_902_5.ts b/packages/web-util/src/forms/gana/VQF_902_5.ts @@ -2,7 +2,7 @@ import { DoubleColumnFormDesign, InternationalizationAPI, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; export function VQF_902_5( diff --git a/packages/web-util/src/forms/gana/VQF_902_9.ts b/packages/web-util/src/forms/gana/VQF_902_9.ts @@ -2,7 +2,7 @@ import { InternationalizationAPI, DoubleColumnFormDesign, UIHandlerId, -} from "@gnu-taler/web-util/browser"; +} from "../../index.browser.js"; import { TalerFormAttributes } from "./taler_form_attributes.js"; import { countryList } from "./VQF_902_1.js"; diff --git a/packages/web-util/src/forms/gana/taler_form_attributes.ts b/packages/web-util/src/forms/gana/taler_form_attributes.ts @@ -1258,11 +1258,6 @@ export namespace TalerFormAttributes { */ CONTACT_WEB_DOMAIN?: HttpHostnamePath; /** - * List of natural persons that are legal representatives or shareholders. - * Required: false - */ - PERSON_BUSINESS_REPRESENTATIVE_TYPE?: GLS_BusinessRepresentative[]; - /** * Date of birth of an individual. Format is YYYY-MM-DD. * Required: false */ @@ -1318,7 +1313,38 @@ export namespace TalerFormAttributes { */ TAX_IS_USA_LAW?: Boolean; } - export interface GLS_BusinessRepresentative {} + export interface GLS_BusinessRepresentative { + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_DATE_OF_BIRTH?: AbsoluteDate; + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_FULL_NAME?: String; + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_LAST_NAME?: String; + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_NATIONALITY?: CountryCode; + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_NATIONAL_ID?: String; + /** + * + * Required: false + */ + GLS_REPRESENTATIVE_NATIONAL_ID_SCAN?: File; + } export interface AccountProperties { /** * Business domain of the account owner. diff --git a/packages/web-util/src/hooks/useForm.ts b/packages/web-util/src/hooks/useForm.ts @@ -21,13 +21,12 @@ import { TalerExchangeApi, TranslatedString, } from "@gnu-taler/taler-util"; +import { useState } from "preact/hooks"; import { FormDesign, UIFieldHandler, UIFormElementConfig, - UIHandlerId, -} from "@gnu-taler/web-util/browser"; -import { useEffect, useState } from "preact/hooks"; +} from "../index.browser.js"; export type FormHandler<T> = { [k in keyof T]?: T[k] extends string