import { AbsoluteTime, AmountJson, Amounts } from "@gnu-taler/taler-util"; import { useTranslationContext } from "@gnu-taler/web-util/browser"; import { h } from "preact"; import { NiceForm } from "../NiceForm.js"; 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"; export type Justification = { // form index in the list of forms index: number; // form name name: string; // form values value: any; } export function AntiMoneyLaunderingForm({ account, selectedForm, onSubmit }: { account: string, selectedForm: number, onSubmit: (justification: Justification, state: AmlExchangeBackend.AmlState, threshold: AmountJson) => Promise; }) { const { i18n } = useTranslationContext() const showingFrom = allForms[selectedForm].impl; const formName = allForms[selectedForm].name const initial = { fullName: "loggedIn_user_fullname", when: AbsoluteTime.now(), state: AmlExchangeBackend.AmlState.pending, threshold: Amounts.parseOrThrow("KUDOS:1000"), }; return ( { }} onSubmit={(formValue) => { if (formValue.state === undefined || formValue.threshold === undefined) return; const st = formValue.state; const amount = formValue.threshold; const justification = { index: selectedForm, name: formName, value: formValue } onSubmit(justification, st, amount); }} >
Cancel
); } export interface State { state: AmlExchangeBackend.AmlState; threshold: AmountJson; } const DocumentDuplicateIcon = export const allForms = [ { name: "Simple comment", icon: DocumentDuplicateIcon, impl: simplest, }, { name: "Identification form (902.1e)", icon: DocumentDuplicateIcon, impl: form_902_1e_v1, }, { name: "Operational legal entity or partnership (902.11e)", icon: DocumentDuplicateIcon, impl: form_902_11e_v1, }, { name: "Foundations (902.12e)", icon: DocumentDuplicateIcon, impl: form_902_12e_v1, }, { name: "Declaration for trusts (902.13e)", icon: DocumentDuplicateIcon, impl: form_902_13e_v1, }, { name: "Information on life insurance policies (902.15e)", icon: DocumentDuplicateIcon, impl: form_902_15e_v1, }, { name: "Declaration of beneficial owner (902.9e)", icon: DocumentDuplicateIcon, impl: form_902_9e_v1, }, { name: "Customer profile (902.5e)", icon: DocumentDuplicateIcon, impl: form_902_5e_v1, }, { name: "Risk profile (902.4e)", icon: DocumentDuplicateIcon, impl: form_902_4e_v1, }, ];