taler-typescript-core

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

commit 72391ed8f4b829b84ad6d5ba8c040ecbf5d35f02
parent 4417dedaed2532b755f575c796bff4d63fb4caea
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  9 May 2025 18:32:03 -0300

fix #9759

Diffstat:
Mpackages/taler-wallet-webextension/src/wallet/Application.tsx | 42++++++++++++++++++++++++++----------------
Mpackages/taler-wallet-webextension/src/wallet/Transaction.tsx | 10+++-------
2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -302,16 +302,16 @@ export function Application(): VNode { redirectTo( Pages.ctaDeposit({ scope: encodeCrockForURI(stringifyScopeInfoShort(s)), - account: encodeCrockForURI( - account, - ), + account: encodeCrockForURI(account), }), ) } onCancel={() => { redirectTo( Pages.balanceHistory({ - scope: encodeCrockForURI(stringifyScopeInfoShort(s)), + scope: !scope + ? undefined + : encodeCrockForURI(stringifyScopeInfoShort(s)), }), ); }} @@ -378,12 +378,12 @@ export function Application(): VNode { <WalletTemplate path="balance" goToURL={redirectToURL}> <TransactionPage tid={tid} - goToWalletHistory={(scope: ScopeInfo) => + goToWalletHistory={(scope?: ScopeInfo) => redirectTo( Pages.balanceHistory({ - scope: encodeCrockForURI( - stringifyScopeInfoShort(scope), - ), + scope: !scope + ? undefined + : encodeCrockForURI(stringifyScopeInfoShort(scope)), }), ) } @@ -592,7 +592,9 @@ export function Application(): VNode { component={({ talerUri }: { talerUri: string }) => ( <CallToActionTemplate title={i18n.str`Digital cash withdrawal`}> <WithdrawPageFromURI - talerWithdrawUri={!talerUri ? undefined : decodeCrockFromURI(talerUri)} + talerWithdrawUri={ + !talerUri ? undefined : decodeCrockFromURI(talerUri) + } cancel={() => redirectTo(Pages.balance)} onSuccess={(tid: string) => redirectTo(Pages.balanceTransaction({ tid })) @@ -616,7 +618,9 @@ export function Application(): VNode { <CallToActionTemplate title={i18n.str`Digital cash withdrawal`}> <WithdrawPageFromParams scope={undefined} - talerExchangeWithdrawUri={!talerUri ? undefined : decodeCrockFromURI(talerUri)} + talerExchangeWithdrawUri={ + !talerUri ? undefined : decodeCrockFromURI(talerUri) + } amount={Amounts.parse(amount)} cancel={() => redirectTo(Pages.balance)} onSuccess={(tid: string) => @@ -718,7 +722,7 @@ export function Application(): VNode { <Route path={Pages.ctaInvoicePay} component={({ talerUri }: { talerUri: string }) => { - const uri = (decodeCrockFromURI(talerUri)); + const uri = decodeCrockFromURI(talerUri); if (!uri) { return <div>missing taler uri</div>; } @@ -737,13 +741,13 @@ export function Application(): VNode { } /> </CallToActionTemplate> - ) + ); }} /> <Route path={Pages.ctaTransferPickup} component={({ talerUri }: { talerUri: string }) => { - const uri = (decodeCrockFromURI(talerUri)); + const uri = decodeCrockFromURI(talerUri); if (!uri) { return <div>missing taler uri</div>; } @@ -758,7 +762,7 @@ export function Application(): VNode { } /> </CallToActionTemplate> - ) + ); }} /> <Route @@ -766,7 +770,11 @@ export function Application(): VNode { component={({ talerRecoveryUri }: { talerRecoveryUri: string }) => ( <CallToActionTemplate title={i18n.str`Digital cash recovery`}> <RecoveryPage - talerRecoveryUri={!talerRecoveryUri ? undefined : decodeCrockFromURI(talerRecoveryUri)} + talerRecoveryUri={ + !talerRecoveryUri + ? undefined + : decodeCrockFromURI(talerRecoveryUri) + } onCancel={() => redirectTo(Pages.balance)} onSuccess={() => redirectTo(Pages.backup)} /> @@ -778,7 +786,9 @@ export function Application(): VNode { component={({ talerUri }: { talerUri: string }) => ( <CallToActionTemplate title={i18n.str`Development experiment`}> <DevExperimentPage - talerExperimentUri={!talerUri ? undefined : decodeCrockFromURI(talerUri)} + talerExperimentUri={ + !talerUri ? undefined : decodeCrockFromURI(talerUri) + } onCancel={() => redirectTo(Pages.balanceHistory({}))} onSuccess={() => redirectTo(Pages.balanceHistory({}))} /> diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -42,7 +42,7 @@ import { TransactionWithdrawal, TranslatedString, WithdrawalType, - assertUnreachable + assertUnreachable, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { @@ -84,7 +84,7 @@ import refreshIcon from "../svg/refresh_24px.inline.svg"; interface Props { tid: string; - goToWalletHistory: (scope: ScopeInfo) => Promise<void>; + goToWalletHistory: (scope?: ScopeInfo) => Promise<void>; } export function TransactionPage({ tid, goToWalletHistory }: Props): VNode { @@ -122,12 +122,8 @@ export function TransactionPage({ tid, goToWalletHistory }: Props): VNode { ); } - const currency = Amounts.parse(state.response.amountEffective)!.currency; const txScope = !state.response.scopes.length - ? { - type: ScopeType.Global as const, - currency, - } + ? undefined : state.response.scopes[0]; return (