From 1a63d56bfdd091cc7aefdf1e25f3a074bfdf5e0e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 16 Nov 2022 16:04:52 -0300 Subject: fix #7411, also making the backup payment visible --- .../src/components/QR.stories.tsx | 31 ++++++++++++++++++++++ .../src/components/QR.tsx | 2 +- .../src/components/TermsOfService/index.ts | 2 +- .../src/components/TermsOfService/state.ts | 19 +++++++------ .../src/components/index.stories.tsx | 3 ++- 5 files changed, 46 insertions(+), 11 deletions(-) create mode 100644 packages/taler-wallet-webextension/src/components/QR.stories.tsx (limited to 'packages/taler-wallet-webextension/src/components') diff --git a/packages/taler-wallet-webextension/src/components/QR.stories.tsx b/packages/taler-wallet-webextension/src/components/QR.stories.tsx new file mode 100644 index 000000000..890cd1941 --- /dev/null +++ b/packages/taler-wallet-webextension/src/components/QR.stories.tsx @@ -0,0 +1,31 @@ +/* + This file is part of GNU Taler + (C) 2022 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 + */ + +/** + * + * @author Sebastian Javier Marchano (sebasjm) + */ + +import { createExample } from "../test-utils.js"; +import { QR } from "./QR.js"; + +export default { + title: "wallet/qr", +}; + +export const Restore = createExample(QR, { + text: "taler://restore/6J0RZTJC6AV21WXK87BTE67WTHE9P2QSHF2BZXTP7PDZY2ARYBPG@sync1.demo.taler.net,sync2.demo.taler.net,sync1.demo.taler.net,sync3.demo.taler.net", +}); diff --git a/packages/taler-wallet-webextension/src/components/QR.tsx b/packages/taler-wallet-webextension/src/components/QR.tsx index b2257d24d..60710ab15 100644 --- a/packages/taler-wallet-webextension/src/components/QR.tsx +++ b/packages/taler-wallet-webextension/src/components/QR.tsx @@ -22,7 +22,7 @@ export function QR({ text }: { text: string }): VNode { const divRef = useRef(null); useEffect(() => { if (!divRef.current) return; - const qr = qrcode(0, "L"); + const qr = qrcode(0, "H"); qr.addData(text); qr.make(); divRef.current.innerHTML = qr.createSvgTag({ diff --git a/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts b/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts index 79778a595..4d2c4346e 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts @@ -26,7 +26,7 @@ import { LoadingUriView, ShowButtonsAcceptedTosView, ShowButtonsNonAcceptedTosView, - ShowTosContentView + ShowTosContentView, } from "./views.js"; export interface Props { diff --git a/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts b/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts index 3cad967ae..c5be71ef0 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts @@ -35,10 +35,13 @@ export function useComponentState( * For the exchange selected, bring the status of the terms of service */ const terms = useAsyncAsHook(async () => { - const exchangeTos = await api.wallet.call(WalletApiOperation.GetExchangeTos, { - exchangeBaseUrl: exchangeUrl, - acceptedFormat: ["text/xml"] - }) + const exchangeTos = await api.wallet.call( + WalletApiOperation.GetExchangeTos, + { + exchangeBaseUrl: exchangeUrl, + acceptedFormat: ["text/xml"], + }, + ); const state = buildTermsOfServiceState(exchangeTos); @@ -78,14 +81,14 @@ export function useComponentState( if (accepted) { api.wallet.call(WalletApiOperation.SetExchangeTosAccepted, { exchangeBaseUrl: exchangeUrl, - etag: state.version - }) + etag: state.version, + }); } else { // mark as not accepted api.wallet.call(WalletApiOperation.SetExchangeTosAccepted, { exchangeBaseUrl: exchangeUrl, - etag: undefined - }) + etag: undefined, + }); } // setAccepted(accepted); if (!readOnly) onChange(accepted); //external update diff --git a/packages/taler-wallet-webextension/src/components/index.stories.tsx b/packages/taler-wallet-webextension/src/components/index.stories.tsx index 0e1bc22b2..d71adf689 100644 --- a/packages/taler-wallet-webextension/src/components/index.stories.tsx +++ b/packages/taler-wallet-webextension/src/components/index.stories.tsx @@ -24,5 +24,6 @@ import * as a2 from "./PendingTransactions.stories.js"; import * as a3 from "./Amount.stories.js"; import * as a4 from "./ShowFullContractTermPopup.stories.js"; import * as a5 from "./TermsOfService/stories.js"; +import * as a6 from "./QR.stories"; -export default [a1, a2, a3, a4, a5]; +export default [a1, a2, a3, a4, a5, a6]; -- cgit v1.2.3