diff options
author | Sebastian <sebasjm@gmail.com> | 2024-01-03 14:52:00 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-01-03 14:52:00 -0300 |
commit | 1a71cd5ba2e9afb0ba7ef22760ecbe8b44aad953 (patch) | |
tree | 7d73293db6dca3ce0ac89d36a52472bd75fa8aa4 /packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx | |
parent | 609ad091e332e4150b4d472284e5a9518cbe7571 (diff) | |
download | wallet-core-1a71cd5ba2e9afb0ba7ef22760ecbe8b44aad953.tar.xz |
split forms js
Diffstat (limited to 'packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx')
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx | 101 |
1 files changed, 5 insertions, 96 deletions
diff --git a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx index ede8c9955..07ef0481a 100644 --- a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx +++ b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx @@ -1,22 +1,14 @@ import { AbsoluteTime, AmountJson, Amounts, Codec, OperationResult, buildCodecForObject, codecForNumber, codecForString, codecOptional } from "@gnu-taler/taler-util"; +import { DefaultForm, useTranslationContext } from "@gnu-taler/web-util/browser"; import { h } from "preact"; -import { v1 as form_902_11e_v1 } from "../forms/902_11e.js"; -import { v1 as form_902_12e_v1 } from "../forms/902_12e.js"; -import { v1 as form_902_13e_v1 } from "../forms/902_13e.js"; -import { v1 as form_902_15e_v1 } from "../forms/902_15e.js"; -import { v1 as form_902_1e_v1 } from "../forms/902_1e.js"; -import { v1 as form_902_4e_v1 } from "../forms/902_4e.js"; -import { v1 as form_902_5e_v1 } from "../forms/902_5e.js"; -import { v1 as form_902_9e_v1 } from "../forms/902_9e.js"; -import { v1 as simplest } from "../forms/simplest.js"; -import { Pages } from "../pages.js"; -import { AmlExchangeBackend } from "../types.js"; import { useExchangeApiContext } from "../context/config.js"; -import { DefaultForm, FlexibleForm, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { FormMetadata } from "../forms/index.js"; +import { Pages } from "../pages.js"; +import { AmlExchangeBackend } from "../utils/types.js"; export function AntiMoneyLaunderingForm({ account, formId, onSubmit }: { account: string, formId: string, onSubmit: (justification: Justification, state: AmlExchangeBackend.AmlState, threshold: AmountJson) => Promise<void>; }) { const { i18n } = useTranslationContext() - const theForm = allForms.find((v) => v.id === formId) + const theForm = window.amlExchangeBackoffice!.forms(i18n).find((v) => v.id === formId) if (!theForm) { return <div>form with id {formId} not found</div> } @@ -66,24 +58,6 @@ export function AntiMoneyLaunderingForm({ account, formId, onSubmit }: { account ); } -export interface BaseForm { - state: AmlExchangeBackend.AmlState; - threshold: AmountJson; -} - -const DocumentDuplicateIcon = <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> - <path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 01-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 011.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 00-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 01-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 00-3.375-3.375h-1.5a1.125 1.125 0 01-1.125-1.125v-1.5a3.375 3.375 0 00-3.375-3.375H9.75" /> -</svg> - - -export type FormMetadata<T extends BaseForm> = { - label: string, - id: string, - version: number, - icon: h.JSX.Element, - impl: (current: BaseForm) => FlexibleForm<T> -} - export type Justification<T = any> = { // form values value: T; @@ -155,68 +129,3 @@ export function parseJustification(s: string, listOfAllKnownForms: FormMetadata< } -export const allForms: Array<FormMetadata<BaseForm>> = [ - { - label: "Simple comment", - id: "simple_comment", - version: 1, - icon: DocumentDuplicateIcon, - impl: simplest, - }, - { - label: "Identification form", - id: "902.1e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_1e_v1, - }, - { - label: "Operational legal entity or partnership", - id: "902.11e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_11e_v1, - }, - { - label: "Foundations", - id: "902.12e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_12e_v1, - }, - { - label: "Declaration for trusts", - id: "902.13e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_13e_v1, - }, - { - label: "Information on life insurance policies", - id: "902.15e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_15e_v1, - }, - { - label: "Declaration of beneficial owner", - id: "902.9e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_9e_v1, - }, - { - label: "Customer profile", - id: "902.5e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_5e_v1, - }, - { - label: "Risk profile", - id: "902.4e", - version: 1, - icon: DocumentDuplicateIcon, - impl: form_902_4e_v1, - }, -]; |