taler-typescript-core

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

commit 73cd938013310a6e607df8368205e935140e5a8b
parent 66f5f5b3eddee664421e39d38e239bd12efaca45
Author: Florian Dold <dold@taler.net>
Date:   Mon, 24 Aug 2026 02:30:29 +0200

bank web UI: remove obsolete scaffolding and assets

Diffstat:
Dpackages/libeufin-bank-webui/src/assets/logo-2021.svg | 10----------
Dpackages/libeufin-bank-webui/src/assets/logo-white.svg | 45---------------------------------------------
Dpackages/libeufin-bank-webui/src/components/Cashouts/Cashouts.test.ts | 69---------------------------------------------------------------------
Dpackages/libeufin-bank-webui/src/components/EmptyComponentExample/EmptyComponentExample.test.ts | 29-----------------------------
Dpackages/libeufin-bank-webui/src/components/EmptyComponentExample/index.ts | 57---------------------------------------------------------
Dpackages/libeufin-bank-webui/src/components/EmptyComponentExample/state.ts | 25-------------------------
Dpackages/libeufin-bank-webui/src/components/EmptyComponentExample/stories.tsx | 29-----------------------------
Dpackages/libeufin-bank-webui/src/components/EmptyComponentExample/views.tsx | 25-------------------------
Dpackages/libeufin-bank-webui/src/components/Transactions/Transactions.test.ts | 203-------------------------------------------------------------------------------
Dpackages/libeufin-bank-webui/src/context/wallet-integration.ts | 84-------------------------------------------------------------------------------
Dpackages/libeufin-bank-webui/src/manifest.json | 21---------------------
11 files changed, 0 insertions(+), 597 deletions(-)

diff --git a/packages/libeufin-bank-webui/src/assets/logo-2021.svg b/packages/libeufin-bank-webui/src/assets/logo-2021.svg @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 201 90"> - <g fill="#0042b3" fill-rule="evenodd" stroke-width=".3"> - <path d="M86.7 1.1c15.6 0 29 9.4 36 23.2h-5.9A35.1 35.1 0 0086.7 6.5C67 6.5 51 23.6 51 44.7c0 10.4 3.8 19.7 10 26.6a31.4 31.4 0 01-4.2 3A45.2 45.2 0 0146 44.7c0-24 18.2-43.6 40.7-43.6zm35.8 64.3a40.4 40.4 0 01-39 22.8c3-1.5 6-3.5 8.6-5.7a35.6 35.6 0 0024.6-17.1z" /> - <path d="M64.2 1.1l3.1.1c-3 1.6-5.9 3.5-8.5 5.8a37.5 37.5 0 00-30.2 37.7c0 14.3 7.3 26.7 18 33.3a29.6 29.6 0 01-8.5.2c-9-8-14.6-20-14.6-33.5 0-24 18.2-43.6 40.7-43.6zm5.4 81.4a35.6 35.6 0 0024.6-17.1h5.9a40.4 40.4 0 01-39 22.8c3-1.5 5.9-3.5 8.5-5.7zm24.8-58.2a37 37 0 00-12.6-12.8 29.6 29.6 0 018.5-.2c4 3.6 7.4 8 9.9 13z" /> - <path d="M41.8 1.1c1 0 2 0 3.1.2-3 1.5-5.9 3.4-8.5 5.6A37.5 37.5 0 006.1 44.7c0 21.1 16 38.3 35.7 38.3 12.6 0 23.6-7 30-17.6h5.8a40.4 40.4 0 01-35.8 23C19.3 88.4 1 68.8 1 44.7c0-24 18.2-43.6 40.7-43.6zm30.1 23.2a38.1 38.1 0 00-4.5-6.1c1.3-1.2 2.7-2.2 4.3-3 2.3 2.7 4.4 5.8 6 9.1z" /> - </g> - <path d="M76.1 34.4h9.2v-5H61.9v5H71v26h5.1zM92.6 52.9h13.7l3 7.4h5.3l-12.7-31.2h-4.7L84.5 60.3h5.2zm11.8-4.9h-9.9l5-12.4zM123.8 29.4h-4.6v31h20.6v-5h-16zM166.5 29.4H145v31h21.6v-5H150v-8.3h14.5v-4.9h-14.5v-8h16.4zM191.2 39.5c0 1.6-.5 2.8-1.6 3.8s-2.6 1.4-4.4 1.4h-7.4V34.3h7.4c1.9 0 3.4.4 4.4 1.3 1 .9 1.6 2.2 1.6 3.9zm6 20.8l-7.7-11.7c1-.3 1.9-.7 2.7-1.3a8.8 8.8 0 003.6-4.6c.4-1 .5-2.2.5-3.5 0-1.5-.2-2.9-.7-4.1a8.4 8.4 0 00-2.1-3.1c-1-.8-2-1.5-3.4-2-1.3-.4-2.8-.6-4.5-.6h-12.9v31h5V49.4h6.5l7 10.8z" /> -</svg> -\ No newline at end of file diff --git a/packages/libeufin-bank-webui/src/assets/logo-white.svg b/packages/libeufin-bank-webui/src/assets/logo-white.svg @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<svg - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - width="670" - height="300" - viewBox="0 0 201 90" - version="1.1" - id="svg8"> - <g - id="logo"> - <g - id="circles" - style="fill:#FFF;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.327943"> - <path - d="m 86.662153,1.1211936 c 15.589697,0 29.129227,9.4011664 35.961027,23.2018054 h -5.81736 C 110.4866,13.623304 99.349002,6.5180852 86.662153,6.5180852 c -19.690571,0 -35.652876,17.1120008 -35.652876,38.2205688 0,10.331797 3.825597,19.704678 10.03957,26.582945 -1.342357,1.120912 -2.771532,2.127905 -4.275488,3.006754 C 50.071485,66.553412 45.974857,56.15992 45.974857,44.738654 c 0,-24.089211 18.216325,-43.6174604 40.687296,-43.6174604 z M 122.51416,65.375898 c -6.86645,13.680134 -20.34561,22.980218 -35.852007,22.980218 -1.052702,0 -2.096093,-0.04291 -3.128683,-0.127026 3.052192,-1.561167 5.913582,-3.480387 8.538307,-5.707305 10.320963,-1.684389 19.185983,-8.113638 24.601813,-17.145887 z" - id="path2350" /> - <path - d="m 64.212372,1.1211936 c 1.052607,0 2.095998,0.042919 3.128684,0.1270583 C 64.288864,2.8094199 61.427378,4.728606 58.802653,6.9555572 41.679542,9.7498571 28.559494,25.601563 28.559494,44.738654 c 0,14.264563 7.29059,26.702023 18.093843,33.268925 -1.593656,0.26719 -3.226966,0.406948 -4.890748,0.406948 -1.239545,0 -2.46151,-0.07952 -3.663522,-0.229364 C 29.191129,70.184015 23.525076,58.171633 23.525076,44.738654 23.525076,20.649443 41.7414,1.1211936 64.212372,1.1211936 Z M 69.62209,82.521785 C 79.943207,80.837396 88.808164,74.407841 94.224059,65.375422 h 5.840511 c -6.866354,13.680305 -20.345548,22.980694 -35.852198,22.980694 -1.052703,0 -2.095999,-0.04291 -3.128684,-0.127026 3.052002,-1.561371 5.913836,-3.480218 8.538402,-5.707305 z M 94.355885,24.322999 c -3.13939,-5.314721 -7.467551,-9.74275 -12.584511,-12.853269 1.593656,-0.26719 3.226904,-0.406948 4.890779,-0.406948 1.239451,0 2.461512,0.07952 3.663524,0.229364 4.016018,3.607242 7.373195,8.030111 9.849053,13.030853 z" - id="path2352" /> - <path - d="m 41.762589,1.1211936 c 1.064296,0 2.118804,0.044379 3.162607,0.1302161 -3.046523,1.558961 -5.903162,3.4745139 -8.52358,5.6968133 C 19.254624,9.7205882 6.1097128,25.583465 6.1097128,44.738654 c 0,21.108568 15.9624012,38.22057 35.6528762,38.22057 12.599746,0 23.672446,-7.007056 30.013748,-17.583802 h 5.838515 C 70.748498,79.055727 57.26924,88.356116 41.762589,88.356116 c -22.470907,0 -40.6871998,-19.52825 -40.6871998,-43.617462 0,-24.089211 18.2162928,-43.6174604 40.6871998,-43.6174604 z M 71.905375,24.322999 c -1.31192,-2.220567 -2.830984,-4.287049 -4.528877,-6.166508 1.342452,-1.120945 2.771374,-2.128381 4.275139,-3.00723 2.372984,2.753011 4.418875,5.834636 6.072489,9.173738 z" - id="path2354" /> - </g> - <g - id="letters" - style="fill:#FFF"> - <path - d="m 76.135411,34.409066 h 9.161042 V 29.36588 H 61.857537 v 5.043186 h 9.161137 v 25.92317 h 5.116737 z" - id="path2346" /> - <path - d="m 92.647571,52.856334 h 13.659009 l 2.93009,7.476072 h 5.36461 L 101.89122,29.144903 H 97.187186 L 84.477089,60.332406 h 5.199533 z m 11.802109,-4.822276 h -9.944771 l 4.951718,-12.386462 z" - id="path2362" /> - <path - d="m 123.80641,29.366084 h -4.58038 v 30.966322 h 20.54728 v -4.910253 c -5.32227,0 -10.64463,0 -15.9669,0 z" - id="path2356" /> - <path - d="m 166.4722,29.366084 h -21.37564 v 30.966322 h 21.58203 v -4.910253 h -16.54771 v -8.27275 h 14.48439 V 42.23925 h -14.48439 v -7.962811 h 16.34132 z" - id="path2360" /> - <path - d="m 191.19035,39.474593 c 0,1.59947 -0.53646,2.87535 -1.61628,3.818883 -1.07281,0.95124 -2.52409,1.422837 -4.34678,1.422837 h -7.44851 V 34.276439 h 7.4073 c 1.9051,0 3.38376,0.435027 4.42939,1.312178 1.05226,0.870258 1.57488,2.167734 1.57488,3.885976 z m 6.06602,20.857813 -7.79911,-11.723191 c 1.01771,-0.294794 1.94631,-0.714813 2.78553,-1.260566 0.83885,-0.545619 1.56122,-1.209263 2.16629,-1.990627 0.60541,-0.781738 1.07981,-1.681096 1.42369,-2.698345 0.34378,-1.017553 0.51561,-2.175238 0.51561,-3.472883 0,-1.50409 -0.24743,-2.867948 -0.74267,-4.092048 -0.49515,-1.223794 -1.20344,-2.256186 -2.12499,-3.096734 -0.92173,-0.840446 -2.04957,-1.489252 -3.38375,-1.946452 -1.33447,-0.457267 -2.82692,-0.685476 -4.4774,-0.685476 h -12.87512 v 30.966322 h 5.03433 V 49.538522 h 6.37569 l 7.11829,10.793884 z" - id="path2358" /> - </g> - </g> -</svg> diff --git a/packages/libeufin-bank-webui/src/components/Cashouts/Cashouts.test.ts b/packages/libeufin-bank-webui/src/components/Cashouts/Cashouts.test.ts @@ -1,69 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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 { describe, it } from "node:test"; -import * as tests from "@gnu-taler/web-util/testing"; -import { SwrMockEnvironment } from "@gnu-taler/web-util/testing"; -import { expect } from "chai"; -import { Props } from "./index.js"; -import { useComponentState } from "./state.js"; -import { buildNullRoutDefinition } from "@gnu-taler/web-util/browser"; - -describe("Cashout states", () => { - it.skip("should query backend and render transactions", async () => { - const env = new SwrMockEnvironment(); - - const props: Props = { - account: "123", - routeCashoutDetails: buildNullRoutDefinition(), - }; - - // env.addRequestExpectation(CASHOUT_API_EXAMPLE.LIST_FIRST_PAGE, { - // response: { - // cashouts: [], - // }, - // }); - - // env.addRequestExpectation(CASHOUT_API_EXAMPLE.MULTI_GET_EMPTY_FIRST_PAGE, { - // response: [], - // }); - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - ({ status, error }) => { - expect(status).equals("ready"); - expect(error).undefined; - }, - ], - env.buildTestingContext(), - ); - - expect(hookBehavior).deep.eq({ result: "ok" }); - - expect(env.assertJustExpectedRequestWereMade()).deep.eq({ result: "ok" }); - }); -}); diff --git a/packages/libeufin-bank-webui/src/components/EmptyComponentExample/EmptyComponentExample.test.ts b/packages/libeufin-bank-webui/src/components/EmptyComponentExample/EmptyComponentExample.test.ts @@ -1,29 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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 { describe, it } from "node:test"; -import { expect } from "chai"; - -describe("test description", () => { - it("should assert", () => { - expect([]).deep.equals([]); - }); -}); diff --git a/packages/libeufin-bank-webui/src/components/EmptyComponentExample/index.ts b/packages/libeufin-bank-webui/src/components/EmptyComponentExample/index.ts @@ -1,57 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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/> - */ - -import { HookError, Loading, utils } from "@gnu-taler/web-util/browser"; -import { VNode } from "preact"; -import { useComponentState } from "./state.js"; -import { LoadingUriView, ReadyView } from "./views.js"; - -export interface Props { - p: string; -} - -export type State = State.Loading | State.LoadingUriError | State.Ready; - -export namespace State { - export interface Loading { - status: "loading"; - error: undefined; - } - - export interface LoadingUriError { - status: "loading-error"; - error: HookError; - } - - export interface BaseInfo { - error: undefined; - } - export interface Ready extends BaseInfo { - status: "ready"; - error: undefined; - } -} - -const viewMapping: utils.StateViewMap<State> = { - loading: Loading, - "loading-error": LoadingUriView, - ready: ReadyView, -}; - -export const ComponentName: (p: Props) => VNode = utils.compose( - (p: Props) => useComponentState(p), - viewMapping, -); diff --git a/packages/libeufin-bank-webui/src/components/EmptyComponentExample/state.ts b/packages/libeufin-bank-webui/src/components/EmptyComponentExample/state.ts @@ -1,25 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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/> - */ - -// import { wxApi } from "../../wxApi.js"; -import { Props, State } from "./index.js"; - -export function useComponentState({ p: _p }: Props): State { - return { - status: "ready", - error: undefined, - }; -} diff --git a/packages/libeufin-bank-webui/src/components/EmptyComponentExample/stories.tsx b/packages/libeufin-bank-webui/src/components/EmptyComponentExample/stories.tsx @@ -1,29 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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 * as tests from "@gnu-taler/web-util/testing"; -import { ReadyView } from "./views.js"; - -export default { - title: "example", -}; - -export const Ready = tests.createExample(ReadyView, {}); diff --git a/packages/libeufin-bank-webui/src/components/EmptyComponentExample/views.tsx b/packages/libeufin-bank-webui/src/components/EmptyComponentExample/views.tsx @@ -1,25 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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/> - */ - -import { h, VNode } from "preact"; - -export function LoadingUriView(): VNode { - return <div></div>; -} - -export function ReadyView(): VNode { - return <div />; -} diff --git a/packages/libeufin-bank-webui/src/components/Transactions/Transactions.test.ts b/packages/libeufin-bank-webui/src/components/Transactions/Transactions.test.ts @@ -1,203 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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 { describe, it } from "node:test"; -import { TalerErrorCode } from "@gnu-taler/taler-util"; -import * as tests from "@gnu-taler/web-util/testing"; -import { SwrMockEnvironment } from "@gnu-taler/web-util/testing"; -import { expect } from "chai"; -import { Props } from "./index.js"; -import { useComponentState } from "./state.js"; - -describe("Transaction states", () => { - it.skip("should query backend and render transactions", async () => { - const env = new SwrMockEnvironment(); - - const props: Props = { - account: "myAccount", - routeCreateWireTransfer: undefined, - }; - - // env.addRequestExpectation(TRANSACTION_API_EXAMPLE.LIST_FIRST_PAGE, { - // response: { - // data: { - // transactions: [ - // { - // creditorIban: "DE159593", - // creditorBic: "SANDBOXX", - // creditorName: "exchange company", - // debtorIban: "DE118695", - // debtorBic: "SANDBOXX", - // debtorName: "Name unknown", - // amount: "1", - // currency: "KUDOS", - // subject: - // "Taler Withdrawal N588V8XE9TR49HKAXFQ20P0EQ0EYW2AC9NNANV8ZP5P59N6N0410", - // date: "2022-12-12Z", - // uid: "8PPFR9EM", - // direction: "DBIT", - // pmtInfId: null, - // msgId: null, - // }, - // { - // creditorIban: "DE159593", - // creditorBic: "SANDBOXX", - // creditorName: "exchange company", - // debtorIban: "DE118695", - // debtorBic: "SANDBOXX", - // debtorName: "Name unknown", - // amount: "5.00", - // currency: "KUDOS", - // subject: "HNEWWT679TQC5P1BVXJS48FX9NW18FWM6PTK2N80Z8GVT0ACGNK0", - // date: "2022-12-07Z", - // uid: "7FZJC3RJ", - // direction: "DBIT", - // pmtInfId: null, - // msgId: null, - // }, - // { - // creditorIban: "DE118695", - // creditorBic: "SANDBOXX", - // creditorName: "Name unknown", - // debtorIban: "DE579516", - // debtorBic: "SANDBOXX", - // debtorName: "The Bank", - // amount: "100", - // currency: "KUDOS", - // subject: "Sign-up bonus", - // date: "2022-12-07Z", - // uid: "I31A06J8", - // direction: "CRDT", - // pmtInfId: null, - // msgId: null, - // }, - // ], - // }, - // }, - // }); - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - ({ status, error }) => { - expect(status).equals("ready"); - expect(error).undefined; - }, - ], - env.buildTestingContext(), - ); - - expect(hookBehavior).deep.eq({ result: "ok" }); - - expect(env.assertJustExpectedRequestWereMade()).deep.eq({ result: "ok" }); - }); - - // it("should show error message on not found", async () => { - // const env = new SwrMockEnvironment(); - - // const props: Props = { - // account: "myAccount", - // }; - - // env.addRequestExpectation(TRANSACTION_API_EXAMPLE.LIST_NOT_FOUND, { - // response: { - // error: { - // description: "Transaction page 0 could not be retrieved.", - // }, - // }, - // }); - - // const hookBehavior = await tests.hookBehaveLikeThis( - // useComponentState, - // props, - // [ - // ({ status, error }) => { - // expect(status).equals("loading"); - // expect(error).undefined; - // }, - // ({ status, error }) => { - // expect(status).equals("loading-error"); - // if (error === undefined || error.type !== ErrorType.CLIENT) { - // throw Error("not the expected error"); - // } - // expect(error.payload).deep.equal({ - // error: { - // description: "Transaction page 0 could not be retrieved.", - // }, - // }); - // }, - // ], - // env.buildTestingContext(), - // ); - - // expect(hookBehavior).deep.eq({ result: "ok" }); - // expect(env.assertJustExpectedRequestWereMade()).deep.eq({ result: "ok" }); - // }); - - it.skip("should show error message on server error", async () => { - const env = new SwrMockEnvironment(); - - const props: Props = { - account: "myAccount", - routeCreateWireTransfer: undefined, - }; - - // env.addRequestExpectation(TRANSACTION_API_EXAMPLE.LIST_ERROR, { - // response: { - // error: { - // code: TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED, - // }, - // }, - // }); - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - ({ status, error }) => { - expect(status).equals("loading-error"); - if ( - error === undefined || - !error.hasErrorCode(TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED) - ) { - throw Error("not the expected error"); - } - expect(error.errorDetail.code).deep.equal( - TalerErrorCode.WALLET_HTTP_REQUEST_THROTTLED, - ); - }, - ], - env.buildTestingContext(), - ); - - expect(hookBehavior).deep.eq({ result: "ok" }); - expect(env.assertJustExpectedRequestWereMade()).deep.eq({ result: "ok" }); - }); -}); diff --git a/packages/libeufin-bank-webui/src/context/wallet-integration.ts b/packages/libeufin-bank-webui/src/context/wallet-integration.ts @@ -1,84 +0,0 @@ -/* - This file is part of GNU Taler - (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 - 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/> - */ - -import { TalerUris } from "@gnu-taler/taler-util"; -import { TalerUri } from "@gnu-taler/taler-util"; -import { ComponentChildren, createContext, h, VNode } from "preact"; -import { useContext } from "preact/hooks"; - -/** - * https://docs.taler.net/design-documents/039-taler-browser-integration.html - * - * @param uri - */ -function createHeadMetaTag(uri: TalerUri, onNotFound?: () => void) { - const meta = document.createElement("meta"); - meta.setAttribute("name", "taler-uri"); - meta.setAttribute("content", TalerUris.stringify(uri)); - - document.head.appendChild(meta); - - let walletFound = false; - window.addEventListener("beforeunload", () => { - walletFound = true; - }); - setTimeout(() => { - if (!walletFound && onNotFound) { - onNotFound(); - } - }, 10); //very short timeout -} -interface Type { - /** - * Tell the active wallet that an action is found - * - * @param uri - * @returns - */ - publishTalerAction: (uri: TalerUri, onNotFound?: () => void) => void; -} - -// @ts-expect-error default value to undefined, should it be another thing? -const Context = createContext<Type>(undefined); - -export const useTalerWalletIntegrationAPI = (): Type => useContext(Context); - -export const TalerWalletIntegrationBrowserProvider = ({ - children, -}: { - children: ComponentChildren; -}): VNode => { - const value: Type = { - publishTalerAction: createHeadMetaTag, - }; - return h(Context.Provider, { - value, - children, - }); -}; - -export const TalerWalletIntegrationTestingProvider = ({ - children, - value, -}: { - children: ComponentChildren; - value: Type; -}): VNode => { - return h(Context.Provider, { - value, - children, - }); -}; diff --git a/packages/libeufin-bank-webui/src/manifest.json b/packages/libeufin-bank-webui/src/manifest.json @@ -1,21 +0,0 @@ -{ - "name": "taler-bank", - "short_name": "taler-bank", - "start_url": "/", - "display": "standalone", - "orientation": "portrait", - "background_color": "#fff", - "theme_color": "#673ab8", - "icons": [ - { - "src": "/assets/icons/android-chrome-192x192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "/assets/icons/android-chrome-512x512.png", - "type": "image/png", - "sizes": "512x512" - } - ] -}