diff options
Diffstat (limited to 'packages/aml-backoffice-ui/src/pages')
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.stories.tsx | 2 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx | 20 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/CaseDetails.tsx | 6 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/CaseUpdate.tsx (renamed from packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx) | 30 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/Cases.stories.tsx | 2 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/Cases.tsx | 6 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/CreateAccount.tsx | 8 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx | 4 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/Officer.tsx | 27 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/ShowConsolidated.stories.tsx | 2 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx | 2 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx | 2 | ||||
-rw-r--r-- | packages/aml-backoffice-ui/src/pages/index.stories.ts | 2 |
13 files changed, 62 insertions, 51 deletions
diff --git a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.stories.tsx b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.stories.tsx index 0b055f682..0c82a4a0e 100644 --- a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.stories.tsx +++ b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.stories.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx index 77d4b8167..db034c996 100644 --- a/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx +++ b/packages/aml-backoffice-ui/src/pages/AntiMoneyLaunderingForm.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -24,17 +24,17 @@ import { buildCodecForObject, codecForNumber, codecForString, - codecOptional + codecOptional, } from "@gnu-taler/taler-util"; import { DefaultForm, + useExchangeApiContext, useTranslationContext, } from "@gnu-taler/web-util/browser"; import { h } from "preact"; -import { useExchangeApiContext } from "../context/config.js"; import { BaseForm, FormMetadata, uiForms } from "../forms/declaration.js"; -import { Pages } from "../pages.js"; import { AmlExchangeBackend } from "../utils/types.js"; +import { privatePages } from "../Routing.js"; export function AntiMoneyLaunderingForm({ account, @@ -68,7 +68,10 @@ export function AntiMoneyLaunderingForm({ form={theForm.impl(initial)} onUpdate={() => {}} onSubmit={(formValue) => { - if (formValue.state === undefined || formValue.threshold === undefined) { + if ( + formValue.state === undefined || + formValue.threshold === undefined + ) { return; } const validatedForm = formValue as BaseForm; @@ -87,7 +90,7 @@ export function AntiMoneyLaunderingForm({ > <div class="mt-6 flex items-center justify-end gap-x-6"> <a - href={Pages.account.url({ account })} + href={privatePages.caseDetails.url({ cid: account })} class="text-sm font-semibold leading-6 text-gray-900" > <i18n.Translate>Cancel</i18n.Translate> @@ -133,7 +136,10 @@ export function parseJustification( s: string, listOfAllKnownForms: FormMetadata<BaseForm>[], ): - | OperationOk<{ justification: Justification; metadata: FormMetadata<BaseForm> }> + | OperationOk<{ + justification: Justification; + metadata: FormMetadata<BaseForm>; + }> | OperationFail<ParseJustificationFail> { try { const justification = JSON.parse(s); diff --git a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx index a91f3d107..576cdbbb9 100644 --- a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx +++ b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -34,13 +34,13 @@ import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { BaseForm, FormMetadata, uiForms } from "../forms/declaration.js"; import { useCaseDetails } from "../hooks/useCaseDetails.js"; -import { Pages } from "../pages.js"; import { AmlExchangeBackend } from "../utils/types.js"; import { Justification, parseJustification, } from "./AntiMoneyLaunderingForm.js"; import { ShowConsolidated } from "./ShowConsolidated.js"; +import { privatePages } from "../Routing.js"; export type AmlEvent = | AmlFormEvent @@ -201,7 +201,7 @@ export function CaseDetails({ account }: { account: string }) { return ( <div> <a - href={Pages.newFormEntry.url({ account })} + href={privatePages.caseNew.url({ cid: account })} class="m-4 block rounded-md w-fit border-0 px-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-700" > <i18n.Translate>New AML form</i18n.Translate> diff --git a/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx b/packages/aml-backoffice-ui/src/pages/CaseUpdate.tsx index 7c10132fa..c4bff1f9f 100644 --- a/packages/aml-backoffice-ui/src/pages/NewFormEntry.tsx +++ b/packages/aml-backoffice-ui/src/pages/CaseUpdate.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -23,35 +23,31 @@ import { } from "@gnu-taler/taler-util"; import { LocalNotificationBanner, + useExchangeApiContext, useLocalNotification, useTranslationContext, } from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; -import { useExchangeApiContext } from "../context/config.js"; +import { privatePages } from "../Routing.js"; import { uiForms } from "../forms/declaration.js"; -import { useOfficer } from "../hooks/useOfficer.js"; -import { Pages } from "../pages.js"; +import { useOfficer } from "../hooks/officer.js"; import { AntiMoneyLaunderingForm } from "./AntiMoneyLaunderingForm.js"; import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; -export function NewFormEntry({ +export function CaseUpdate({ account, type, }: { - account?: string; - type?: string; + account: string; + type: string; }): VNode { const { i18n } = useTranslationContext(); const officer = useOfficer(); - const { api } = useExchangeApiContext(); + const { + lib: { exchange: api }, + } = useExchangeApiContext(); const [notification, notify, handleError] = useLocalNotification(); - if (!account) { - return <div>no account</div>; - } - if (!type) { - return <SelectForm account={account} />; - } if (officer.state !== "ready") { return <HandleAccountNotReady officer={officer} />; } @@ -78,7 +74,7 @@ export function NewFormEntry({ decision, ); if (resp.type === "ok") { - window.location.href = Pages.cases.url; + window.location.href = privatePages.cases.url({}); return; } switch (resp.case) { @@ -115,7 +111,7 @@ export function NewFormEntry({ ); } -function SelectForm({ account }: { account: string }) { +export function SelectForm({ account }: { account: string }) { const { i18n } = useTranslationContext(); return ( <div> @@ -124,7 +120,7 @@ function SelectForm({ account }: { account: string }) { return ( <a key={form.id} - href={Pages.newFormEntry.url({ account, type: form.id })} + href={privatePages.caseUpdate.url({ cid: account, type: form.id })} class="m-4 block rounded-md w-fit border-0 p-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-600" > {form.label} diff --git a/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx b/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx index 223cbbb84..dcbd366a4 100644 --- a/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx +++ b/packages/aml-backoffice-ui/src/pages/Cases.stories.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/packages/aml-backoffice-ui/src/pages/Cases.tsx b/packages/aml-backoffice-ui/src/pages/Cases.tsx index 7ecc85e44..e928b831f 100644 --- a/packages/aml-backoffice-ui/src/pages/Cases.tsx +++ b/packages/aml-backoffice-ui/src/pages/Cases.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,11 +28,11 @@ import { import { VNode, h } from "preact"; import { useState } from "preact/hooks"; import { useCases } from "../hooks/useCases.js"; -import { Pages } from "../pages.js"; import { amlStateConverter } from "../utils/converter.js"; import { AmlExchangeBackend } from "../utils/types.js"; import { Officer } from "./Officer.js"; +import { privatePages } from "../Routing.js"; export function CasesUI({ records, @@ -130,7 +130,7 @@ export function CasesUI({ <td class="whitespace-nowrap px-3 py-5 text-sm text-gray-500 "> <div class="text-gray-900"> <a - href={Pages.account.url({ account: r.h_payto })} + href={privatePages.caseDetails.url({ cid: r.h_payto })} class="text-indigo-600 hover:text-indigo-900" > {r.h_payto.substring(0, 16)}... diff --git a/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx b/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx index 568ec81fa..9afd0d212 100644 --- a/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx +++ b/packages/aml-backoffice-ui/src/pages/CreateAccount.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -20,7 +20,7 @@ import { useTranslationContext, } from "@gnu-taler/web-util/browser"; import { VNode, h } from "preact"; -import { useSettings } from "../hooks/useSettings.js"; +import { usePreferences } from "../hooks/preferences.js"; export function CreateAccount({ onNewAccount, @@ -32,8 +32,8 @@ export function CreateAccount({ password: string; repeat: string; }>(); - const [settings] = useSettings(); - + const [settings] = usePreferences(); + return ( <div class="flex min-h-full flex-col "> <div class="sm:mx-auto sm:w-full sm:max-w-md"> diff --git a/packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx b/packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx index c86906929..b23798172 100644 --- a/packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx +++ b/packages/aml-backoffice-ui/src/pages/HandleAccountNotReady.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -15,7 +15,7 @@ */ import { assertUnreachable } from "@gnu-taler/taler-util"; import { VNode, h } from "preact"; -import { OfficerNotReady } from "../hooks/useOfficer.js"; +import { OfficerNotReady } from "../hooks/officer.js"; import { CreateAccount } from "./CreateAccount.js"; import { UnlockAccount } from "./UnlockAccount.js"; diff --git a/packages/aml-backoffice-ui/src/pages/Officer.tsx b/packages/aml-backoffice-ui/src/pages/Officer.tsx index eaa961b90..ad8ae1ed3 100644 --- a/packages/aml-backoffice-ui/src/pages/Officer.tsx +++ b/packages/aml-backoffice-ui/src/pages/Officer.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -13,22 +13,27 @@ You should have received a copy of the GNU General Public License along with GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { useTranslationContext } from "@gnu-taler/web-util/browser"; +import { + useExchangeApiContext, + useTranslationContext, +} from "@gnu-taler/web-util/browser"; import { h } from "preact"; -import { getInitialBackendBaseURL } from "../hooks/useBackend.js"; -import { useOfficer } from "../hooks/useOfficer.js"; -import { uiSettings } from "../settings.js"; +import { useOfficer } from "../hooks/officer.js"; import { HandleAccountNotReady } from "./HandleAccountNotReady.js"; +import { useSettingsContext } from "../context/settings.js"; export function Officer() { const officer = useOfficer(); - const { i18n } = useTranslationContext() + const settings = useSettingsContext(); + const { lib } = useExchangeApiContext(); + + const { i18n } = useTranslationContext(); if (officer.state !== "ready") { return <HandleAccountNotReady officer={officer} />; } - const url = new URL(getInitialBackendBaseURL()) - const signupEmail = uiSettings.signupEmail ?? `aml-signup@${url.hostname}` + const url = new URL("./", lib.exchange.baseUrl); + const signupEmail = settings.signupEmail ?? `aml-signup@${url.hostname}`; return ( <div> @@ -40,7 +45,11 @@ export function Officer() { </div> <p> <a - href={`mailto:${signupEmail}?subject=${encodeURIComponent("Request AML signup")}&body=${encodeURIComponent(`I want my AML account\n\n\nPubKey: ${officer.account.id}`)}`} + href={`mailto:${signupEmail}?subject=${encodeURIComponent( + "Request AML signup", + )}&body=${encodeURIComponent( + `I want my AML account\n\n\nPubKey: ${officer.account.id}`, + )}`} target="_blank" rel="noreferrer" class="m-4 block rounded-md w-fit border-0 px-3 py-2 text-center text-sm bg-indigo-700 text-white shadow-sm hover:bg-indigo-700" diff --git a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.stories.tsx b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.stories.tsx index fa88277ec..1cb50efd2 100644 --- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.stories.tsx +++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.stories.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx index 15b109bee..c1f7e02cb 100644 --- a/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx +++ b/packages/aml-backoffice-ui/src/pages/ShowConsolidated.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx index 8066155ac..de634c9e0 100644 --- a/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx +++ b/packages/aml-backoffice-ui/src/pages/UnlockAccount.tsx @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/packages/aml-backoffice-ui/src/pages/index.stories.ts b/packages/aml-backoffice-ui/src/pages/index.stories.ts index 22435178b..b2cbf485e 100644 --- a/packages/aml-backoffice-ui/src/pages/index.stories.ts +++ b/packages/aml-backoffice-ui/src/pages/index.stories.ts @@ -1,6 +1,6 @@ /* This file is part of GNU Taler - (C) 2022 Taler Systems S.A. + (C) 2022-2024 Taler Systems S.A. GNU Taler is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software |