diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/pages/CaseDetails.tsx')
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/CaseDetails.tsx | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx index e5fb8eaba..d02d8b395 100644 --- a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx +++ b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx @@ -1,11 +1,5 @@ import { Fragment, VNode, h } from "preact"; import { - AmlDecisionDetail, - AmlDecisionDetails, - AmlState, - KycDetail, -} from "../types.js"; -import { AbsoluteTime, AmountJson, Amounts, @@ -18,8 +12,9 @@ import { NiceForm } from "../NiceForm.js"; import { FlexibleForm } from "../forms/index.js"; import { UIFormField } from "../handlers/forms.js"; import { Pages } from "../pages.js"; +import { AmlExchangeBackend } from "../types.js"; -const response: AmlDecisionDetails = { +const response: AmlExchangeBackend.AmlDecisionDetails = { aml_history: [ { justification: "Lack of documentation", @@ -81,7 +76,7 @@ type AmlFormEvent = { type: "aml-form"; when: AbsoluteTime; title: TranslatedString; - state: AmlState; + state: AmlExchangeBackend.AmlState; threshold: AmountJson; }; type KycCollectionEvent = { @@ -105,8 +100,8 @@ function selectSooner(a: WithTime, b: WithTime) { } function getEventsFromAmlHistory( - aml: AmlDecisionDetail[], - kyc: KycDetail[], + aml: AmlExchangeBackend.AmlDecisionDetail[], + kyc: AmlExchangeBackend.KycDetail[], ): AmlEvent[] { const ae: AmlEvent[] = aml.map((a) => { return { @@ -187,7 +182,7 @@ export function CaseDetails({ account }: { account?: string }) { switch (e.type) { case "aml-form": { switch (e.state) { - case AmlState.normal: { + case AmlExchangeBackend.AmlState.normal: { return ( <div> <span class="inline-flex items-center rounded-md bg-green-50 px-2 py-1 text-xs font-medium text-green-700 ring-1 ring-inset ring-green-600/20"> @@ -200,7 +195,7 @@ export function CaseDetails({ account }: { account?: string }) { </div> ); } - case AmlState.pending: { + case AmlExchangeBackend.AmlState.pending: { return ( <div> <span class="inline-flex items-center rounded-md bg-yellow-50 px-2 py-1 text-xs font-medium text-yellow-700 ring-1 ring-inset ring-green-600/20"> @@ -213,7 +208,7 @@ export function CaseDetails({ account }: { account?: string }) { </div> ); } - case AmlState.frozen: { + case AmlExchangeBackend.AmlState.frozen: { return ( <div> <span class="inline-flex items-center rounded-md bg-red-50 px-2 py-1 text-xs font-medium text-red-700 ring-1 ring-inset ring-green-600/20"> @@ -304,15 +299,15 @@ function ShowConsolidated({ choices: [ { label: "Frozen" as TranslatedString, - value: AmlState.frozen, + value: AmlExchangeBackend.AmlState.frozen, }, { label: "Pending" as TranslatedString, - value: AmlState.pending, + value: AmlExchangeBackend.AmlState.pending, }, { label: "Normal" as TranslatedString, - value: AmlState.normal, + value: AmlExchangeBackend.AmlState.normal, }, ], }, @@ -361,7 +356,7 @@ function ShowConsolidated({ interface Consolidated { aml: { - state?: AmlState; + state?: AmlExchangeBackend.AmlState; threshold?: AmountJson; since: AbsoluteTime; }; @@ -421,26 +416,26 @@ export const amlStateConverter = { fromStringUI: parseAmlState, }; -function stringifyAmlState(s: AmlState | undefined): string { +function stringifyAmlState(s: AmlExchangeBackend.AmlState | undefined): string { if (s === undefined) return ""; switch (s) { - case AmlState.normal: + case AmlExchangeBackend.AmlState.normal: return "normal"; - case AmlState.pending: + case AmlExchangeBackend.AmlState.pending: return "pending"; - case AmlState.frozen: + case AmlExchangeBackend.AmlState.frozen: return "frozen"; } } -function parseAmlState(s: string | undefined): AmlState { +function parseAmlState(s: string | undefined): AmlExchangeBackend.AmlState { switch (s) { case "normal": - return AmlState.normal; + return AmlExchangeBackend.AmlState.normal; case "pending": - return AmlState.pending; + return AmlExchangeBackend.AmlState.pending; case "frozen": - return AmlState.frozen; + return AmlExchangeBackend.AmlState.frozen; default: throw Error(`unknown AML state: ${s}`); } |