taler-typescript-core

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

commit 137c5e38721c84c45f3fb0a7b60b764bd937a44c
parent 026b03cad5ed2443d96dc9400b003a1550485c76
Author: Sebastian <sebasjm@gmail.com>
Date:   Mon, 25 Aug 2025 09:32:58 -0300

fix #10247

Diffstat:
Mpackages/taler-wallet-webextension/src/cta/Withdraw/state.ts | 29+++++++++++++++++------------
Mpackages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx | 26++++++++++++++++++++++++++
Mpackages/taler-wallet-webextension/src/wallet/Transaction.tsx | 10+++++++---
3 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts b/packages/taler-wallet-webextension/src/cta/Withdraw/state.ts @@ -73,12 +73,9 @@ export function useComponentStateFromParams({ ex = info.exchange; } - const exchanges = await api.wallet.call( - WalletApiOperation.ListExchanges, - { - filterByScope: scope - }, - ); + const exchanges = await api.wallet.call(WalletApiOperation.ListExchanges, { + filterByScope: scope, + }); const chosenAmount = !uri || !uri.amount ? undefined : Amounts.parse(uri.amount); @@ -281,10 +278,7 @@ export function useComponentStateFromURI({ }; } - if ( - uriInfoHook.response.txInfo && - uriInfoHook.response.status !== "pending" - ) { + if (uriInfoHook.response.status !== "pending") { const info = uriInfoHook.response.txInfo; const anotherWallet = info.txState.major === TransactionMajorState.Aborted && @@ -298,8 +292,19 @@ export function useComponentStateFromURI({ error: undefined, }; } + if ( + uriInfoHook.response.txInfo.txState.major === TransactionMajorState.Failed + ) { + return { + status: "already-completed", + thisWallet: true, + redirectToTx: () => onSuccess(uriInfoHook.response.txInfo.transactionId), + error: undefined, + operationState: "aborted", + }; + } - const exchangeScope:ScopeInfo = { + const exchangeScope: ScopeInfo = { type: ScopeType.Global, currency: bwi.currency, }; @@ -320,7 +325,7 @@ export function useComponentStateFromURI({ exchangeList: bwi.possibleExchanges, }, setUpdatedExchangeByUser, - exchangeScope + exchangeScope, ); }, []); } diff --git a/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/wallet/DeveloperPage.tsx @@ -290,6 +290,7 @@ export function DeveloperPage(): VNode { { time: Date; content: string } | undefined >(undefined); const [tagName, setTagName] = useState(""); + const [experiment, setExperiment] = useState(""); const [logLevel, setLogLevel] = useState("info"); const api = useBackendContext(); const fileRef = useRef<HTMLInputElement>(null); @@ -533,6 +534,31 @@ export function DeveloperPage(): VNode { </Button> </Paper> + <Paper style={{ padding: 10, margin: 10 }}> + <h3>Dev Experiment</h3> + <div> + <TextField + label="Experiment name" + placeholder="taler://dev-experiment" + variant="filled" + // error={subject.error} + required + value={experiment} + onChange={setExperiment} + /> + </div> + <Button + variant="contained" + onClick={async () => { + await api.wallet.call(WalletApiOperation.ApplyDevExperiment, { + devExperimentUri: `taler://dev-experiment/${experiment}`, + }); + }} + > + Apply + </Button> + </Paper> + <br /> <p> <i18n.Translate>Coins</i18n.Translate>: diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -346,9 +346,13 @@ function TransactionTemplate({ </InfoBox> )} {transaction.txState.major === TransactionMajorState.Failed && ( - <ErrorBox> - <i18n.Translate>This transaction failed.</i18n.Translate> - </ErrorBox> + <ErrorAlertView + error={alertFromError( + i18n, + i18n.str`This transaction failed.`, + transaction.error!, + )} + /> )} {confirmBeforeForget ? ( <Overlay>