taler-typescript-core

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

commit cd358984ccc2f1efcd7970a7f63c2ad6e65a6774
parent 9dd937f3a0b5e3bb87c669d8e9dda757b2982c17
Author: Sebastian <sebasjm@gmail.com>
Date:   Tue,  9 Jul 2024 13:37:07 -0300

fix typo, removed unused files

Diffstat:
Dpackages/merchant-backoffice-ui/src/paths/instance/accounts/list/List.stories.tsx | 28----------------------------
Dpackages/merchant-backoffice-ui/src/paths/instance/accounts/list/ListPage.tsx | 60------------------------------------------------------------
Mpackages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx | 65+++++++++++++++++++++++++++++++++++------------------------------
Mpackages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx | 7+------
Dpackages/merchant-backoffice-ui/src/paths/instance/templates/list/List.stories.tsx | 28----------------------------
Dpackages/merchant-backoffice-ui/src/paths/instance/templates/list/ListPage.tsx | 63---------------------------------------------------------------
Mpackages/merchant-backoffice-ui/src/paths/instance/templates/list/index.tsx | 15++++++---------
Mpackages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx | 23-----------------------
Mpackages/merchant-backoffice-ui/src/paths/instance/templates/qr/index.tsx | 31+++++++++++++++----------------
Mpackages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/index.tsx | 2+-
Mpackages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/update/index.tsx | 2+-
Dpackages/merchant-backoffice-ui/src/paths/instance/transfers/update/index.tsx | 26--------------------------
12 files changed, 59 insertions(+), 291 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/List.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/List.stories.tsx @@ -1,28 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021-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 - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { FunctionalComponent, h } from "preact"; -import { ListPage as TestedComponent } from "./ListPage.js"; - -export default { - title: "Pages/Accounts/List", - component: TestedComponent, -}; diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/ListPage.tsx @@ -1,60 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021-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 - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { TalerMerchantApi } from "@gnu-taler/taler-util"; -import { h, VNode } from "preact"; -import { CardTable } from "./Table.js"; - -export interface Props { - devices: TalerMerchantApi.BankAccountEntry[]; - // onLoadMoreBefore?: () => void; - // onLoadMoreAfter?: () => void; - onCreate: () => void; - onDelete: (e: TalerMerchantApi.BankAccountEntry) => void; - onSelect: (e: TalerMerchantApi.BankAccountEntry) => void; -} - -export function ListPage({ - devices, - onCreate, - onDelete, - onSelect, - // onLoadMoreBefore, - // onLoadMoreAfter, -}: Props): VNode { - return ( - <section class="section is-main-section"> - <CardTable - accounts={devices.map((o) => ({ - ...o, - id: String(o.h_wire), - }))} - onCreate={onCreate} - onDelete={onDelete} - onSelect={onSelect} - // onLoadMoreBefore={onLoadMoreBefore} - // hasMoreBefore={!onLoadMoreBefore} - // onLoadMoreAfter={onLoadMoreAfter} - // hasMoreAfter={!onLoadMoreAfter} - /> - </section> - ); -} diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx @@ -36,7 +36,7 @@ import { useInstanceBankAccounts } from "../../../../hooks/bank.js"; import { Notification } from "../../../../utils/types.js"; import { LoginPage } from "../../../login/index.js"; import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; -import { ListPage } from "./ListPage.js"; +import { CardTable } from "./Table.js"; interface Props { onCreate: () => void; @@ -79,38 +79,43 @@ export default function ListOtpDevices({ onCreate, onSelect }: Props): VNode { }} /> )} - <ListPage - devices={result.body.accounts} - onCreate={onCreate} - onSelect={(e) => { - onSelect(e.h_wire); - }} - onDelete={async (e: TalerMerchantApi.BankAccountEntry) => { - return lib.instance - .deleteBankAccount(state.token, e.h_wire) - .then((resp) => { - if (resp.type === "ok") { - setNotif({ - message: i18n.str`bank account delete successfully`, - type: "SUCCESS", - }); - } else { + <section class="section is-main-section"> + <CardTable + accounts={result.body.accounts.map((o) => ({ + ...o, + id: String(o.h_wire), + }))} + onCreate={onCreate} + onSelect={(e) => { + onSelect(e.h_wire); + }} + onDelete={async (e: TalerMerchantApi.BankAccountEntry) => { + return lib.instance + .deleteBankAccount(state.token, e.h_wire) + .then((resp) => { + if (resp.type === "ok") { + setNotif({ + message: i18n.str`bank account delete successfully`, + type: "SUCCESS", + }); + } else { + setNotif({ + message: i18n.str`could not delete the bank account`, + type: "ERROR", + description: resp.detail.hint, + }); + } + }) + .catch((error) => setNotif({ message: i18n.str`could not delete the bank account`, type: "ERROR", - description: resp.detail.hint, - }); - } - }) - .catch((error) => - setNotif({ - message: i18n.str`could not delete the bank account`, - type: "ERROR", - description: error.message, - }), - ); - }} - /> + description: error.message, + }), + ); + }} + /> + </section> </Fragment> ); } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/index.tsx @@ -45,12 +45,7 @@ export default function ListKYC(_p: Props): VNode { return <div /> } case HttpStatusCode.BadGateway: { - const status = result.body; - - if (!status) { - return <div>no kyc required</div>; - } - return <ListPage status={status} />; + return <ListPage status={result.body} />; } case HttpStatusCode.ServiceUnavailable: { diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/list/List.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/list/List.stories.tsx @@ -1,28 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021-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 - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { FunctionalComponent, h } from "preact"; -import { ListPage as TestedComponent } from "./ListPage.js"; - -export default { - title: "Pages/Templates/List", - component: TestedComponent, -}; diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/list/ListPage.tsx @@ -1,63 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021-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 - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { TalerMerchantApi } from "@gnu-taler/taler-util"; -import { h, VNode } from "preact"; -import { CardTable } from "./Table.js"; - -export interface Props { - templates: TalerMerchantApi.TemplateEntry[]; - onLoadMoreBefore?: () => void; - onLoadMoreAfter?: () => void; - onCreate: () => void; - onDelete: (e: TalerMerchantApi.TemplateEntry) => void; - onSelect: (e: TalerMerchantApi.TemplateEntry) => void; - onNewOrder: (e: TalerMerchantApi.TemplateEntry) => void; - onQR: (e: TalerMerchantApi.TemplateEntry) => void; -} - -export function ListPage({ - templates, - onCreate, - onDelete, - onSelect, - onNewOrder, - onQR, - onLoadMoreBefore, - onLoadMoreAfter, -}: Props): VNode { - - return ( - <CardTable - templates={templates.map((o) => ({ - ...o, - id: String(o.template_id), - }))} - onQR={onQR} - onCreate={onCreate} - onDelete={onDelete} - onSelect={onSelect} - onNewOrder={onNewOrder} - onLoadMoreBefore={onLoadMoreBefore} - onLoadMoreAfter={onLoadMoreAfter} - /> - ); -} diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/list/index.tsx @@ -38,7 +38,7 @@ import { useInstanceTemplates } from "../../../../hooks/templates.js"; import { Notification } from "../../../../utils/types.js"; import { LoginPage } from "../../../login/index.js"; import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; -import { ListPage } from "./ListPage.js"; +import { CardTable } from "./Table.js"; interface Props { onCreate: () => void; @@ -92,14 +92,11 @@ export default function ListTemplates({ placeholder={i18n.str`template id`} /> - <ListPage - // templates={result.body} - // onLoadMoreBefore={ - // result.isFirstPage ? undefined: result.loadFirst - // } - // onLoadMoreAfter={result.isLastPage ? undefined : result.loadNext} - - templates={result.body.templates} + <CardTable + templates={result.body.templates.map((o) => ({ + ...o, + id: String(o.template_id), + }))} onLoadMoreBefore={undefined} onLoadMoreAfter={undefined} onCreate={onCreate} diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/QrPage.tsx @@ -42,29 +42,6 @@ export function QrPage({ id: templateId, onBack }: Props): VNode { const { i18n } = useTranslationContext(); const { state } = useSessionContext(); - // const [state, setState] = useState<Partial<Entity>>({ - // amount: contract.amount, - // summary: contract.summary, - // }); - - // const errors: FormErrors<Entity> = {}; - - // const fixedAmount = !!contract.amount; - // const fixedSummary = !!contract.summary; - - // const templateParams: Record<string, string> = {}; - // if (!fixedAmount) { - // if (state.amount) { - // templateParams.amount = state.amount; - // } else { - // templateParams.amount = config.currency; - // } - // } - - // if (!fixedSummary) { - // templateParams.summary = state.summary ?? ""; - // } - const merchantBaseUrl = state.backendUrl.href; const payTemplateUri = stringifyPayTemplateUri({ diff --git a/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/templates/qr/index.tsx @@ -19,13 +19,16 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { HttpStatusCode, TalerError, TalerMerchantApi, assertUnreachable } from "@gnu-taler/taler-util"; +import { + HttpStatusCode, + TalerError, + TalerMerchantApi, + assertUnreachable, +} from "@gnu-taler/taler-util"; import { VNode, h } from "preact"; import { ErrorLoadingMerchant } from "../../../../components/ErrorLoadingMerchant.js"; import { Loading } from "../../../../components/exception/loading.js"; -import { - useTemplateDetails -} from "../../../../hooks/templates.js"; +import { useTemplateDetails } from "../../../../hooks/templates.js"; import { NotFoundPageOrAdminCreate } from "../../../notfound/index.js"; import { QrPage } from "./QrPage.js"; import { LoginPage } from "../../../login/index.js"; @@ -36,31 +39,27 @@ interface Props { tid: string; } -export default function TemplateQrPage({ - tid, - onBack, -}: Props): VNode { +export default function TemplateQrPage({ tid, onBack }: Props): VNode { const result = useTemplateDetails(tid); - if (!result) return <Loading /> + if (!result) return <Loading />; if (result instanceof TalerError) { - return <ErrorLoadingMerchant error={result} /> + return <ErrorLoadingMerchant error={result} />; } if (result.type === "fail") { - switch(result.case) { + switch (result.case) { case HttpStatusCode.NotFound: { - return <NotFoundPageOrAdminCreate /> + return <NotFoundPageOrAdminCreate />; } case HttpStatusCode.Unauthorized: { - return <LoginPage /> + return <LoginPage />; } default: { - assertUnreachable(result) + assertUnreachable(result); } } } - return ( - <QrPage contract={result.body.template_contract} id={tid} onBack={onBack} /> + <QrPage contract={result.body.template_contract} id={tid} onBack={onBack} /> ); } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/create/index.tsx @@ -48,7 +48,7 @@ export default function CreateTokenFamily({ onConfirm, onBack }: Props): VNode { .then((resp) => { if (resp.type === "ok") { setNotif({ - message: i18n.str`token familty created succesfully`, + message: i18n.str`token familty created successfully`, type: "SUCCESS", }); onConfirm(); diff --git a/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/tokenfamilies/update/index.tsx @@ -97,7 +97,7 @@ export default function UpdateTokenFamily({ .then((resp) => { if (resp.type === "ok") { setNotif({ - message: i18n.str`Token familty updated succesfully`, + message: i18n.str`Token familty updated successfully`, type: "SUCCESS", }); onConfirm(); diff --git a/packages/merchant-backoffice-ui/src/paths/instance/transfers/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/transfers/update/index.tsx @@ -1,26 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2021-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 - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - 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/> - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { h, VNode } from "preact"; - -export default function UpdateTransfer(): VNode { - return <div>order transfer page</div>; -}