taler-typescript-core

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

commit f9685d70ad671e5dd6031c7d7ab864ab34e39dff
parent 1af7fbfb2d583984e4808f6cc52ad39ea8ef5c3d
Author: Sebastian <sebasjm@gmail.com>
Date:   Wed, 28 Aug 2024 22:12:29 -0300

fix #9132

Diffstat:
Mpackages/aml-backoffice-ui/src/App.tsx | 1-
Mpackages/kyc-ui/src/app.tsx | 5++---
Mpackages/taler-util/src/http-client/exchange.ts | 1-
Mpackages/web-util/src/forms/forms.ts | 52+++++++++++++++++++++++++++++-----------------------
4 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/packages/aml-backoffice-ui/src/App.tsx b/packages/aml-backoffice-ui/src/App.tsx @@ -155,7 +155,6 @@ const evictExchangeSwrCache: CacheEvictor<TalerExchangeCacheEviction> = { await revalidateAccountInformation(); return; } - case TalerExchangeCacheEviction.CREATE_DESCISION: case TalerExchangeCacheEviction.UPLOAD_KYC_FORM: { return; } diff --git a/packages/kyc-ui/src/app.tsx b/packages/kyc-ui/src/app.tsx @@ -154,12 +154,11 @@ function getInitialBackendBaseURL( const evictExchangeSwrCache: CacheEvictor<TalerExchangeCacheEviction> = { async notifySuccess(op) { switch (op) { - case TalerExchangeCacheEviction.CREATE_DESCISION: { - await revalidateKycInfo(); + case TalerExchangeCacheEviction.MAKE_AML_DECISION: { return; } - case TalerExchangeCacheEviction.MAKE_AML_DECISION: case TalerExchangeCacheEviction.UPLOAD_KYC_FORM: { + await revalidateKycInfo(); return; } default: { diff --git a/packages/taler-util/src/http-client/exchange.ts b/packages/taler-util/src/http-client/exchange.ts @@ -77,7 +77,6 @@ export type TalerExchangeErrorsByMethod< > = FailCasesByMethod<TalerExchangeHttpClient, prop>; export enum TalerExchangeCacheEviction { - CREATE_DESCISION, UPLOAD_KYC_FORM, MAKE_AML_DECISION, } diff --git a/packages/web-util/src/forms/forms.ts b/packages/web-util/src/forms/forms.ts @@ -14,9 +14,12 @@ import { InputText } from "./InputText.js"; import { InputTextArea } from "./InputTextArea.js"; import { InputToggle } from "./InputToggle.js"; import { Addon, StringConverter, UIFieldHandler } from "./FormProvider.js"; -import { InternationalizationAPI, UIFieldElementDescription } from "../index.browser.js"; +import { + InternationalizationAPI, + UIFieldElementDescription, +} from "../index.browser.js"; import { assertUnreachable, TranslatedString } from "@gnu-taler/taler-util"; -import {UIFormFieldBaseConfig, UIFormElementConfig} from "./ui-form.js"; +import { UIFormFieldBaseConfig, UIFormElementConfig } from "./ui-form.js"; /** * Constrain the type with the ui props */ @@ -117,7 +120,7 @@ export function RenderAllFieldsByUiConfig({ const Component = UIFormConfiguration[ field.type ] as FieldComponentFunction<any>; - return Component(field); + return Component(field.properties); }), ); } @@ -148,11 +151,11 @@ export function RenderAllFieldsByUiConfig({ /** * convert field configuration to render function - * - * @param i18n_ - * @param fieldConfig - * @param form - * @returns + * + * @param i18n_ + * @param fieldConfig + * @param form + * @returns */ export function convertUiField( i18n_: InternationalizationAPI, @@ -175,7 +178,12 @@ export function convertUiField( type: config.type, properties: { ...converBaseFieldsProps(i18n_, config), - fields: convertUiField(i18n_, config.fields, form, getConverterById), + fields: convertUiField( + i18n_, + config.fields, + form, + getConverterById, + ), }, }; return resp; @@ -190,7 +198,12 @@ export function convertUiField( ...converBaseFieldsProps(i18n_, config), ...converInputFieldsProps(form, config, getConverterById), labelField: config.labelFieldId, - fields: convertUiField(i18n_, config.fields, form, getConverterById), + fields: convertUiField( + i18n_, + config.fields, + form, + getConverterById, + ), }, } as UIFormField; } @@ -208,8 +221,8 @@ export function convertUiField( type: "amount", properties: { ...converBaseFieldsProps(i18n_, config), - ...converInputFieldsProps(form, config, getConverterById), - currency: config.currency, + ...converInputFieldsProps(form, config, getConverterById), + currency: config.currency, }, } as UIFormField; } @@ -230,11 +243,10 @@ export function convertUiField( ...converBaseFieldsProps(i18n_, config), ...converInputFieldsProps(form, config, getConverterById), choices: config.choices, - }, - }as UIFormField; + } as UIFormField; } - case "file":{ + case "file": { return { type: "file", properties: { @@ -245,7 +257,7 @@ export function convertUiField( }, } as UIFormField; } - case "integer":{ + case "integer": { return { type: "integer", properties: { @@ -254,7 +266,7 @@ export function convertUiField( }, } as UIFormField; } - case "selectMultiple":{ + case "selectMultiple": { return { type: "selectMultiple", properties: { @@ -308,19 +320,15 @@ export function convertUiField( }); } - - function getAddonById(_id: string | undefined): Addon { return undefined!; } - type GetConverterById = ( id: string | undefined, config: unknown, ) => StringConverter<unknown>; - function converInputFieldsProps( form: object, p: UIFormFieldBaseConfig, @@ -368,5 +376,3 @@ export function getValueDeeper2( } return getValueDeeper2(object[head], rest); } - -