diff options
Diffstat (limited to 'packages/bank-ui')
33 files changed, 427 insertions, 268 deletions
diff --git a/packages/bank-ui/src/Routing.tsx b/packages/bank-ui/src/Routing.tsx index 3ec5f0c77..38833283e 100644 --- a/packages/bank-ui/src/Routing.tsx +++ b/packages/bank-ui/src/Routing.tsx @@ -113,11 +113,13 @@ function PublicRounting({ async function doAutomaticLogin(username: string, password: string) { await handleError(async () => { - const resp = await lib.auth(username).createAccessTokenBasic(username, password, { - scope: "readwrite", - duration: { d_us: "forever" }, - refreshable: true, - }); + const resp = await lib + .auth(username) + .createAccessTokenBasic(username, password, { + scope: "readwrite", + duration: { d_us: "forever" }, + refreshable: true, + }); if (resp.type === "ok") { onLoggedUser(username, resp.body.access_token); } else { diff --git a/packages/bank-ui/src/app.tsx b/packages/bank-ui/src/app.tsx index 434c132ed..a2aa6ec37 100644 --- a/packages/bank-ui/src/app.tsx +++ b/packages/bank-ui/src/app.tsx @@ -23,7 +23,13 @@ import { getGlobalLogLevel, setGlobalLogLevelFromString, } from "@gnu-taler/taler-util"; -import { BankApiProvider, BrowserHashNavigationProvider, Loading, TalerWalletIntegrationBrowserProvider, TranslationProvider } from "@gnu-taler/web-util/browser"; +import { + BankApiProvider, + BrowserHashNavigationProvider, + Loading, + TalerWalletIntegrationBrowserProvider, + TranslationProvider, +} from "@gnu-taler/web-util/browser"; import { h } from "preact"; import { useEffect, useState } from "preact/hooks"; import { SWRConfig } from "swr"; @@ -35,8 +41,16 @@ import { SettingsProvider } from "./context/settings.js"; import { strings } from "./i18n/strings.js"; import { BankFrame } from "./pages/BankFrame.js"; import { BankUiSettings, fetchSettings } from "./settings.js"; -import { revalidateAccountDetails, revalidatePublicAccounts, revalidateTransactions } from "./hooks/account.js"; -import { revalidateBusinessAccounts, revalidateCashouts, revalidateConversionInfo } from "./hooks/regional.js"; +import { + revalidateAccountDetails, + revalidatePublicAccounts, + revalidateTransactions, +} from "./hooks/account.js"; +import { + revalidateBusinessAccounts, + revalidateCashouts, + revalidateConversionInfo, +} from "./hooks/regional.js"; const WITH_LOCAL_STORAGE_CACHE = false; export function App() { @@ -56,10 +70,14 @@ export function App() { de: strings["de"].completeness, }} > - <BankApiProvider baseUrl={new URL("/", baseUrl)} frameOnError={BankFrame} evictors={{ - bank: evictBankSwrCache, - conversion: evictConversionSwrCache, - }}> + <BankApiProvider + baseUrl={new URL("/", baseUrl)} + frameOnError={BankFrame} + evictors={{ + bank: evictBankSwrCache, + conversion: evictConversionSwrCache, + }} + > <SWRConfig value={{ provider: WITH_LOCAL_STORAGE_CACHE @@ -145,7 +163,6 @@ function getInitialBackendBaseURL( } } - const evictBankSwrCache: CacheEvictor<TalerCoreBankCacheEviction> = { async notifySuccess(op) { switch (op) { @@ -203,15 +220,15 @@ const evictBankSwrCache: CacheEvictor<TalerCoreBankCacheEviction> = { }; const evictConversionSwrCache: CacheEvictor<TalerBankConversionCacheEviction> = -{ - async notifySuccess(op) { - switch (op) { - case TalerBankConversionCacheEviction.UPDATE_RATE: { - await revalidateConversionInfo(); - return; + { + async notifySuccess(op) { + switch (op) { + case TalerBankConversionCacheEviction.UPDATE_RATE: { + await revalidateConversionInfo(); + return; + } + default: + assertUnreachable(op); } - default: - assertUnreachable(op); - } - }, -}; + }, + }; diff --git a/packages/bank-ui/src/components/Transactions/index.ts b/packages/bank-ui/src/components/Transactions/index.ts index 2f68b2ded..6fccfcd79 100644 --- a/packages/bank-ui/src/components/Transactions/index.ts +++ b/packages/bank-ui/src/components/Transactions/index.ts @@ -24,12 +24,12 @@ import { RouteDefinition } from "@gnu-taler/web-util/browser"; export interface Props { account: string; routeCreateWireTransfer: - | RouteDefinition<{ - account?: string; - subject?: string; - amount?: string; - }> - | undefined; + | RouteDefinition<{ + account?: string; + subject?: string; + amount?: string; + }> + | undefined; } export type State = State.Loading | State.LoadingUriError | State.Ready; @@ -52,12 +52,12 @@ export namespace State { status: "ready"; error: undefined; routeCreateWireTransfer: - | RouteDefinition<{ - account?: string; - subject?: string; - amount?: string; - }> - | undefined; + | RouteDefinition<{ + account?: string; + subject?: string; + amount?: string; + }> + | undefined; transactions: Transaction[]; onGoStart?: () => void; onGoNext?: () => void; diff --git a/packages/bank-ui/src/components/Transactions/views.tsx b/packages/bank-ui/src/components/Transactions/views.tsx index ebce00a2a..10d63e6af 100644 --- a/packages/bank-ui/src/components/Transactions/views.tsx +++ b/packages/bank-ui/src/components/Transactions/views.tsx @@ -14,7 +14,11 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ -import { Attention, useBankCoreApiContext, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { + Attention, + useBankCoreApiContext, + useTranslationContext, +} from "@gnu-taler/web-util/browser"; import { format } from "date-fns"; import { Fragment, VNode, h } from "preact"; import { RenderAmount } from "../../pages/PaytoWireTransferForm.js"; @@ -119,7 +123,7 @@ export function ReadyView({ <Time format="HH:mm:ss" timestamp={item.when} - // relative={Duration.fromSpec({ days: 1 })} + // relative={Duration.fromSpec({ days: 1 })} /> </div> <dl class="font-normal sm:hidden"> diff --git a/packages/bank-ui/src/context/config.ts b/packages/bank-ui/src/context/config.ts index 86b6df5f3..9522c72bc 100644 --- a/packages/bank-ui/src/context/config.ts +++ b/packages/bank-ui/src/context/config.ts @@ -304,15 +304,15 @@ const evictBankSwrCache: CacheEvictor<TalerCoreBankCacheEviction> = { }; const evictConversionSwrCache: CacheEvictor<TalerBankConversionCacheEviction> = -{ - async notifySuccess(op) { - switch (op) { - case TalerBankConversionCacheEviction.UPDATE_RATE: { - await revalidateConversionInfo(); - return; + { + async notifySuccess(op) { + switch (op) { + case TalerBankConversionCacheEviction.UPDATE_RATE: { + await revalidateConversionInfo(); + return; + } + default: + assertUnreachable(op); } - default: - assertUnreachable(op); - } - }, -}; + }, + }; diff --git a/packages/bank-ui/src/hooks/account.ts b/packages/bank-ui/src/hooks/account.ts index 543c49aed..e1cd423de 100644 --- a/packages/bank-ui/src/hooks/account.ts +++ b/packages/bank-ui/src/hooks/account.ts @@ -45,7 +45,9 @@ export function revalidateAccountDetails() { export function useAccountDetails(account: string) { const { state: credentials } = useSessionState(); - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); async function fetcher([username, token]: [string, AccessToken]) { return await api.getAccount({ username, token }); @@ -71,7 +73,9 @@ export function revalidateWithdrawalDetails() { } export function useWithdrawalDetails(wid: string) { - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [latestStatus, setLatestStatus] = useState<WithdrawalOperationStatus>(); async function fetcher([wid, old_state]: [ @@ -124,7 +128,9 @@ export function useTransactionDetails(account: string, tid: number) { const { state: credentials } = useSessionState(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); async function fetcher([username, token, txid]: [ string, @@ -167,7 +173,9 @@ export function usePublicAccounts( ) { const [offset, setOffset] = useState<number | undefined>(initial); - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); async function fetcher([account, txid]: [ string | undefined, @@ -203,18 +211,27 @@ export function usePublicAccounts( // if (data.type !== "ok") return data; //TODO: row_id should not be optional - return buildPaginatedResult(data.body.public_accounts, offset, setOffset, (d) => d.row_id ?? 0) + return buildPaginatedResult( + data.body.public_accounts, + offset, + setOffset, + (d) => d.row_id ?? 0, + ); } - type PaginatedResult<T> = OperationOk<T> & { isLastPage: boolean; isFirstPage: boolean; loadNext(): void; loadFirst(): void; -} +}; //TODO: consider sending this to web-util -export function buildPaginatedResult<DataType, OffsetId>(data: DataType[], offset: OffsetId | undefined, setOffset: (o: OffsetId | undefined) => void, getId: (r: DataType) => OffsetId): PaginatedResult<DataType[]> { +export function buildPaginatedResult<DataType, OffsetId>( + data: DataType[], + offset: OffsetId | undefined, + setOffset: (o: OffsetId | undefined) => void, + getId: (r: DataType) => OffsetId, +): PaginatedResult<DataType[]> { const isLastPage = data.length <= PAGE_SIZE; const isFirstPage = offset === undefined; @@ -229,7 +246,7 @@ export function buildPaginatedResult<DataType, OffsetId>(data: DataType[], offse isFirstPage, loadNext: () => { if (!result.length) return; - const id = getId(result[result.length - 1]) + const id = getId(result[result.length - 1]); setOffset(id); }, loadFirst: () => { @@ -251,7 +268,9 @@ export function useTransactions(account: string, initial?: number) { credentials.status !== "loggedIn" ? undefined : credentials.token; const [offset, setOffset] = useState<number | undefined>(initial); - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); async function fetcher([username, token, txid]: [ string, @@ -284,6 +303,10 @@ export function useTransactions(account: string, initial?: number) { if (data === undefined) return undefined; if (data.type !== "ok") return data; - return buildPaginatedResult(data.body.transactions, offset, setOffset, (d) => d.row_id) - + return buildPaginatedResult( + data.body.transactions, + offset, + setOffset, + (d) => d.row_id, + ); } diff --git a/packages/bank-ui/src/hooks/regional.ts b/packages/bank-ui/src/hooks/regional.ts index e9aa9a6be..909bcfcec 100644 --- a/packages/bank-ui/src/hooks/regional.ts +++ b/packages/bank-ui/src/hooks/regional.ts @@ -42,10 +42,10 @@ const useSWR = _useSWR as unknown as SWRHook; export type TransferCalculation = | { - debit: AmountJson; - credit: AmountJson; - beforeFee: AmountJson; - } + debit: AmountJson; + credit: AmountJson; + beforeFee: AmountJson; + } | "amount-is-too-small"; type EstimatorFunction = ( amount: AmountJson, @@ -64,7 +64,10 @@ export function revalidateConversionInfo() { ); } export function useConversionInfo() { - const { lib: { conversion }, config } = useBankCoreApiContext(); + const { + lib: { conversion }, + config, + } = useBankCoreApiContext(); async function fetcher() { return await conversion.getConfig(); @@ -90,7 +93,9 @@ export function useConversionInfo() { } export function useCashinEstimator(): ConversionEstimators { - const { lib: { conversion } } = useBankCoreApiContext(); + const { + lib: { conversion }, + } = useBankCoreApiContext(); return { estimateByCredit: async (fiatAmount, fee) => { const resp = await conversion.getCashinRate({ @@ -146,7 +151,9 @@ export function useCashinEstimator(): ConversionEstimators { } export function useCashoutEstimator(): ConversionEstimators { - const { lib: { conversion } } = useBankCoreApiContext(); + const { + lib: { conversion }, + } = useBankCoreApiContext(); return { estimateByCredit: async (fiatAmount, fee) => { const resp = await conversion.getCashoutRate({ @@ -219,7 +226,9 @@ export function useBusinessAccounts() { const { state: credentials } = useSessionState(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [offset, setOffset] = useState<number | undefined>(); @@ -256,8 +265,12 @@ export function useBusinessAccounts() { if (data.type !== "ok") return data; //TODO: row_id should not be optional - return buildPaginatedResult(data.body.accounts, offset, setOffset, (d) => d.row_id ?? 0) - + return buildPaginatedResult( + data.body.accounts, + offset, + setOffset, + (d) => d.row_id ?? 0, + ); } type CashoutWithId = TalerCorebankApi.CashoutStatusResponse & { id: number }; @@ -274,7 +287,10 @@ export function revalidateOnePendingCashouts() { } export function useOnePendingCashouts(account: string) { const { state: credentials } = useSessionState(); - const { lib: { bank: api }, config } = useBankCoreApiContext(); + const { + lib: { bank: api }, + config, + } = useBankCoreApiContext(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; @@ -334,7 +350,10 @@ export function revalidateCashouts() { } export function useCashouts(account: string) { const { state: credentials } = useSessionState(); - const { lib: { bank: api }, config } = useBankCoreApiContext(); + const { + lib: { bank: api }, + config, + } = useBankCoreApiContext(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; @@ -390,7 +409,9 @@ export function revalidateCashoutDetails() { export function useCashoutDetails(cashoutId: number | undefined) { const { state: credentials } = useSessionState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); async function fetcher([username, token, id]: [string, AccessToken, number]) { return api.getCashoutById({ username, token }, id); @@ -443,7 +464,9 @@ export function useLastMonitorInfo( previousMoment: AbsoluteTime, timeframe: TalerCorebankApi.MonitorTimeframeParam, ) { - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const { state: credentials } = useSessionState(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; diff --git a/packages/bank-ui/src/hooks/session.ts b/packages/bank-ui/src/hooks/session.ts index 661d64415..4520d0e4a 100644 --- a/packages/bank-ui/src/hooks/session.ts +++ b/packages/bank-ui/src/hooks/session.ts @@ -86,7 +86,10 @@ export interface SessionStateHandler { logIn(info: { username: string; token: AccessToken }): void; } -const SESSION_STATE_KEY = buildStorageKey("bank-session", codecForSessionState()); +const SESSION_STATE_KEY = buildStorageKey( + "bank-session", + codecForSessionState(), +); /** * Return getters and setters for diff --git a/packages/bank-ui/src/pages/BankFrame.tsx b/packages/bank-ui/src/pages/BankFrame.tsx index 6eb7d1b7e..30f143828 100644 --- a/packages/bank-ui/src/pages/BankFrame.tsx +++ b/packages/bank-ui/src/pages/BankFrame.tsx @@ -102,9 +102,9 @@ export function BankFrame({ session.state.status !== "loggedIn" ? undefined : () => { - session.logOut(); - resetBankState(); - } + session.logOut(); + resetBankState(); + } } sites={ !settings.topNavSites ? [] : Object.entries(settings.topNavSites) diff --git a/packages/bank-ui/src/pages/LoginForm.tsx b/packages/bank-ui/src/pages/LoginForm.tsx index 7eed0cd9e..2f967895c 100644 --- a/packages/bank-ui/src/pages/LoginForm.tsx +++ b/packages/bank-ui/src/pages/LoginForm.tsx @@ -52,7 +52,9 @@ export function LoginForm({ ); const [password, setPassword] = useState<string | undefined>(); const { i18n } = useTranslationContext(); - const { lib: { auth: authenticator } } = useBankCoreApiContext(); + const { + lib: { auth: authenticator }, + } = useBankCoreApiContext(); const [notification, withErrorHandler] = useLocalNotificationHandler(); const { config } = useBankCoreApiContext(); @@ -78,24 +80,24 @@ export function LoginForm({ !username || !password ? undefined : withErrorHandler( - async () => - authenticator(username).createAccessTokenBasic(username, password, { - scope: "readwrite", - duration: { d_us: "forever" }, - refreshable: true, - }), - (result) => { - session.logIn({ username, token: result.body.access_token }); - }, - (fail) => { - switch (fail.case) { - case HttpStatusCode.Unauthorized: - return i18n.str`Wrong credentials for "${username}"`; - case HttpStatusCode.NotFound: - return i18n.str`Account not found`; - } - }, - ); + async () => + authenticator(username).createAccessTokenBasic(username, password, { + scope: "readwrite", + duration: { d_us: "forever" }, + refreshable: true, + }), + (result) => { + session.logIn({ username, token: result.body.access_token }); + }, + (fail) => { + switch (fail.case) { + case HttpStatusCode.Unauthorized: + return i18n.str`Wrong credentials for "${username}"`; + case HttpStatusCode.NotFound: + return i18n.str`Account not found`; + } + }, + ); return ( <div class="flex min-h-full flex-col justify-center "> diff --git a/packages/bank-ui/src/pages/OperationState/index.ts b/packages/bank-ui/src/pages/OperationState/index.ts index 4a7888ee3..38f698a04 100644 --- a/packages/bank-ui/src/pages/OperationState/index.ts +++ b/packages/bank-ui/src/pages/OperationState/index.ts @@ -106,15 +106,15 @@ export namespace State { account: string; routeHere: RouteDefinition<{ wopid: string }>; onAbort: - | undefined - | (() => Promise< - TalerCoreBankErrorsByMethod<"abortWithdrawalById"> | undefined - >); + | undefined + | (() => Promise< + TalerCoreBankErrorsByMethod<"abortWithdrawalById"> | undefined + >); onConfirm: - | undefined - | (() => Promise< - TalerCoreBankErrorsByMethod<"confirmWithdrawalById"> | undefined - >); + | undefined + | (() => Promise< + TalerCoreBankErrorsByMethod<"confirmWithdrawalById"> | undefined + >); error: undefined; id: string; } diff --git a/packages/bank-ui/src/pages/OperationState/state.ts b/packages/bank-ui/src/pages/OperationState/state.ts index a0cbc66b9..19c097d18 100644 --- a/packages/bank-ui/src/pages/OperationState/state.ts +++ b/packages/bank-ui/src/pages/OperationState/state.ts @@ -45,7 +45,9 @@ export function useComponentState({ const [bankState, updateBankState] = useBankState(); const { state: credentials } = useSessionState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; - const { lib: { bank } } = useBankCoreApiContext(); + const { + lib: { bank }, + } = useBankCoreApiContext(); const [failure, setFailure] = useState< TalerCoreBankErrorsByMethod<"createWithdrawal"> | undefined @@ -191,9 +193,9 @@ export function useComponentState({ routeClose, onAbort: !creds ? async () => { - onAbort(); - return undefined; - } + onAbort(); + return undefined; + } : doAbort, }; } diff --git a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx index 22db739b1..41956b84b 100644 --- a/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx +++ b/packages/bank-ui/src/pages/PaytoWireTransferForm.tsx @@ -82,7 +82,11 @@ export function PaytoWireTransferForm({ const isRawPayto = inputType !== "form"; const { state: credentials } = useSessionState(); - const { lib: { bank: api }, config, url } = useBankCoreApiContext(); + const { + lib: { bank: api }, + config, + url, + } = useBankCoreApiContext(); const sendingToFixedAccount = withAccount !== undefined; @@ -214,8 +218,9 @@ export function PaytoWireTransferForm({ case TalerErrorCode.BANK_UNKNOWN_CREDITOR: return notify({ type: "error", - title: i18n.str`The destination account "${acName ?? puri - }" was not found.`, + title: i18n.str`The destination account "${ + acName ?? puri + }" was not found.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, when: AbsoluteTime.now(), @@ -770,13 +775,13 @@ export function InputAmount( if ( sep_pos !== -1 && l - sep_pos - 1 > - config.currency_specification.num_fractional_input_digits + config.currency_specification.num_fractional_input_digits ) { e.currentTarget.value = e.currentTarget.value.substring( 0, sep_pos + - config.currency_specification.num_fractional_input_digits + - 1, + config.currency_specification.num_fractional_input_digits + + 1, ); } onChange(e.currentTarget.value); diff --git a/packages/bank-ui/src/pages/ProfileNavigation.tsx b/packages/bank-ui/src/pages/ProfileNavigation.tsx index 1cf357ceb..3e81e307c 100644 --- a/packages/bank-ui/src/pages/ProfileNavigation.tsx +++ b/packages/bank-ui/src/pages/ProfileNavigation.tsx @@ -14,7 +14,10 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ import { assertUnreachable } from "@gnu-taler/taler-util"; -import { useNavigationContext, useTranslationContext } from "@gnu-taler/web-util/browser"; +import { + useNavigationContext, + useTranslationContext, +} from "@gnu-taler/web-util/browser"; import { Fragment, VNode, h } from "preact"; import { useBankCoreApiContext } from "@gnu-taler/web-util/browser"; import { useSessionState } from "../hooks/session.js"; diff --git a/packages/bank-ui/src/pages/PublicHistoriesPage.tsx b/packages/bank-ui/src/pages/PublicHistoriesPage.tsx index 1810bd5dd..80ae28dde 100644 --- a/packages/bank-ui/src/pages/PublicHistoriesPage.tsx +++ b/packages/bank-ui/src/pages/PublicHistoriesPage.tsx @@ -30,9 +30,7 @@ export function PublicHistoriesPage(): VNode { // TODO: implemented filter by account name const result = usePublicAccounts(undefined); const firstAccount = - result && - !(result instanceof TalerError) && - result.body.length > 0 + result && !(result instanceof TalerError) && result.body.length > 0 ? result.body[0].username : undefined; diff --git a/packages/bank-ui/src/pages/QrCodeSection.tsx b/packages/bank-ui/src/pages/QrCodeSection.tsx index 156c18f48..359d4c18f 100644 --- a/packages/bank-ui/src/pages/QrCodeSection.tsx +++ b/packages/bank-ui/src/pages/QrCodeSection.tsx @@ -51,7 +51,9 @@ export function QrCodeSection({ const [notification, handleError] = useLocalNotificationHandler(); - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const onAbortHandler = handleError( async () => { diff --git a/packages/bank-ui/src/pages/RegistrationPage.tsx b/packages/bank-ui/src/pages/RegistrationPage.tsx index dc08ce0fa..18f926e00 100644 --- a/packages/bank-ui/src/pages/RegistrationPage.tsx +++ b/packages/bank-ui/src/pages/RegistrationPage.tsx @@ -78,7 +78,9 @@ function RegistrationForm({ const [notification, , handleError] = useLocalNotification(); const settings = useSettingsContext(); - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); // const { register } = useTestingAPI(); const { i18n } = useTranslationContext(); diff --git a/packages/bank-ui/src/pages/SolveChallengePage.tsx b/packages/bank-ui/src/pages/SolveChallengePage.tsx index 48d62f1de..eae5bfb5f 100644 --- a/packages/bank-ui/src/pages/SolveChallengePage.tsx +++ b/packages/bank-ui/src/pages/SolveChallengePage.tsx @@ -58,7 +58,9 @@ export function SolveChallengePage({ onChallengeCompleted: () => void; routeClose: RouteDefinition; }): VNode { - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const { i18n } = useTranslationContext(); const [bankState, updateBankState] = useBankState(); const [code, setCode] = useState<string | undefined>(undefined); diff --git a/packages/bank-ui/src/pages/WalletWithdrawForm.tsx b/packages/bank-ui/src/pages/WalletWithdrawForm.tsx index b95b109d5..a9c652643 100644 --- a/packages/bank-ui/src/pages/WalletWithdrawForm.tsx +++ b/packages/bank-ui/src/pages/WalletWithdrawForm.tsx @@ -70,7 +70,10 @@ function OldWithdrawalForm({ // const { navigateTo } = useNavigationContext(); const [bankState, updateBankState] = useBankState(); - const { lib: { bank: api }, config } = useBankCoreApiContext(); + const { + lib: { bank: api }, + config, + } = useBankCoreApiContext(); const { state: credentials } = useSessionState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; @@ -105,12 +108,12 @@ function OldWithdrawalForm({ class="font-semibold text-yellow-700 hover:text-yellow-600" name="complete operation" href={url} - // onClick={(e) => { - // e.preventDefault() - // walletInegrationApi.publishTalerAction(uri, () => { - // navigateTo(url) - // }) - // }} + // onClick={(e) => { + // e.preventDefault() + // walletInegrationApi.publishTalerAction(uri, () => { + // navigateTo(url) + // }) + // }} > <i18n.Translate>this page</i18n.Translate> </a> @@ -392,7 +395,7 @@ export function WalletWithdrawForm({ routeClose={routeCancel} routeHere={routeOperationDetails} onAbort={onOperationAborted} - // route={routeCancel} + // route={routeCancel} /> )} </div> diff --git a/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx b/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx index 1eec8bfc2..853dd7bae 100644 --- a/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx +++ b/packages/bank-ui/src/pages/WithdrawalConfirmationQuestion.tsx @@ -74,7 +74,10 @@ export function WithdrawalConfirmationQuestion({ const [notification, notify, handleError] = useLocalNotification(); - const { config, lib: { bank: api } } = useBankCoreApiContext(); + const { + config, + lib: { bank: api }, + } = useBankCoreApiContext(); async function doTransfer() { await handleError(async () => { @@ -223,20 +226,23 @@ export function WithdrawalConfirmationQuestion({ <dl class="divide-y divide-gray-100"> {((): VNode => { if (!details.account.isKnown) { - return <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> - <dt class="text-sm font-medium leading-6 text-gray-900"> - <i18n.Translate> - Payment provider's account - </i18n.Translate> - </dt> - <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"> - {details.account.targetPath} - </dd> - </div> + return ( + <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> + <dt class="text-sm font-medium leading-6 text-gray-900"> + <i18n.Translate> + Payment provider's account + </i18n.Translate> + </dt> + <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"> + {details.account.targetPath} + </dd> + </div> + ); } switch (details.account.targetType) { case "iban": { - const name = details.account.params["receiver-name"]; + const name = + details.account.params["receiver-name"]; return ( <Fragment> <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> @@ -265,13 +271,15 @@ export function WithdrawalConfirmationQuestion({ ); } case "x-taler-bank": { - const name = details.account.params["receiver-name"]; + const name = + details.account.params["receiver-name"]; return ( <Fragment> <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> <dt class="text-sm font-medium leading-6 text-gray-900"> <i18n.Translate> - Payment provider's account bank hostname + Payment provider's account bank + hostname </i18n.Translate> </dt> <dd class="mt-1 text-sm leading-6 text-gray-700 sm:col-span-2 sm:mt-0"> @@ -304,7 +312,8 @@ export function WithdrawalConfirmationQuestion({ ); } case "bitcoin": { - const name = details.account.params["receiver-name"]; + const name = + details.account.params["receiver-name"]; return ( <Fragment> <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> @@ -333,9 +342,8 @@ export function WithdrawalConfirmationQuestion({ ); } default: { - assertUnreachable(details.account) + assertUnreachable(details.account); } - } })()} <div class="px-4 py-2 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-0"> diff --git a/packages/bank-ui/src/pages/WithdrawalOperationPage.tsx b/packages/bank-ui/src/pages/WithdrawalOperationPage.tsx index 9dee1403a..c0c55f14b 100644 --- a/packages/bank-ui/src/pages/WithdrawalOperationPage.tsx +++ b/packages/bank-ui/src/pages/WithdrawalOperationPage.tsx @@ -36,7 +36,9 @@ export function WithdrawalOperationPage({ routeClose: RouteDefinition; routeWithdrawalDetails: RouteDefinition<{ wopid: string }>; }): VNode { - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const uri = stringifyWithdrawUri({ bankIntegrationApiBaseUrl: api.getIntegrationAPI().href, withdrawalOperationId: operationId, diff --git a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx index bd3961bb7..c071a838a 100644 --- a/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx +++ b/packages/bank-ui/src/pages/account/ShowAccountDetails.tsx @@ -70,7 +70,9 @@ export function ShowAccountDetails({ const { i18n } = useTranslationContext(); const { state: credentials } = useSessionState(); const creds = credentials.status !== "loggedIn" ? undefined : credentials; - const { lib: { bank } } = useBankCoreApiContext(); + const { + lib: { bank }, + } = useBankCoreApiContext(); const accountIsTheCurrentUser = credentials.status === "loggedIn" ? credentials.username === account @@ -189,8 +191,7 @@ export function ShowAccountDetails({ }); } - - const url = bank.getRevenueAPI(account) + const url = bank.getRevenueAPI(account); url.username = account; const baseURL = url.href; @@ -291,15 +292,16 @@ export function ShowAccountDetails({ </h2> <p class="mt-2 text-sm text-gray-500"> <i18n.Translate> - Use this information to link your Taler Merchant Backoffice account - with the current bank account. You can start by copying the values, - then go to your merchant backoffice service provider, login into - your account and look for the "import" button in the "bank account" section. + Use this information to link your Taler Merchant Backoffice + account with the current bank account. You can start by copying + the values, then go to your merchant backoffice service provider, + login into your account and look for the "import" button in the + "bank account" section. </i18n.Translate> </p> </div> - {payto !== undefined && + {payto !== undefined && ( <div class="bg-white shadow-sm ring-1 ring-gray-900/5 sm:rounded-xl md:col-span-2"> <div class="px-4 py-6 sm:p-8"> <div class="grid max-w-2xl grid-cols-1 gap-x-6 gap-y-8 sm:grid-cols-6"> @@ -322,82 +324,96 @@ export function ShowAccountDetails({ /> </div> <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>Method to use for wire transfer.</i18n.Translate> + <i18n.Translate> + Method to use for wire transfer. + </i18n.Translate> </p> </div> {((payto) => { switch (payto.targetType) { case "iban": { - return <div class="sm:col-span-5"> - <label - class="block text-sm font-medium leading-6 text-gray-900" - for="iban" - > - {i18n.str`IBAN`} - </label> - <div class="mt-2"> - <input - type="text" - class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" - name="iban" - id="iban" - disabled={true} - value={payto.iban} - autocomplete="off" - /> + return ( + <div class="sm:col-span-5"> + <label + class="block text-sm font-medium leading-6 text-gray-900" + for="iban" + > + {i18n.str`IBAN`} + </label> + <div class="mt-2"> + <input + type="text" + class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + name="iban" + id="iban" + disabled={true} + value={payto.iban} + autocomplete="off" + /> + </div> + <p class="mt-2 text-sm text-gray-500"> + <i18n.Translate> + International Bank Account Number. + </i18n.Translate> + </p> </div> - <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>International Bank Account Number.</i18n.Translate> - </p> - </div> + ); } case "x-taler-bank": { - return <div class="sm:col-span-5"> - <label - class="block text-sm font-medium leading-6 text-gray-900" - for="iban" - > - {i18n.str`IBAN`} - </label> - <div class="mt-2"> - <input - type="text" - class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" - name="iban" - id="iban" - disabled={true} - value={payto.account} - autocomplete="off" - /> + return ( + <div class="sm:col-span-5"> + <label + class="block text-sm font-medium leading-6 text-gray-900" + for="iban" + > + {i18n.str`IBAN`} + </label> + <div class="mt-2"> + <input + type="text" + class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + name="iban" + id="iban" + disabled={true} + value={payto.account} + autocomplete="off" + /> + </div> + <p class="mt-2 text-sm text-gray-500"> + <i18n.Translate> + International Bank Account Number. + </i18n.Translate> + </p> </div> - <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>International Bank Account Number.</i18n.Translate> - </p> - </div> + ); } case "bitcoin": { - return <div class="sm:col-span-5"> - <label - class="block text-sm font-medium leading-6 text-gray-900" - for="iban" - > - {i18n.str`Address`} - </label> - <div class="mt-2"> - <input - type="text" - class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" - name="iban" - id="iban" - disabled={true} - value={"DE1231231231"} - autocomplete="off" - /> + return ( + <div class="sm:col-span-5"> + <label + class="block text-sm font-medium leading-6 text-gray-900" + for="iban" + > + {i18n.str`Address`} + </label> + <div class="mt-2"> + <input + type="text" + class="block w-full disabled:bg-gray-100 rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 data-[error=true]:ring-red-500 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" + name="iban" + id="iban" + disabled={true} + value={"DE1231231231"} + autocomplete="off" + /> + </div> + <p class="mt-2 text-sm text-gray-500"> + <i18n.Translate> + International Bank Account Number. + </i18n.Translate> + </p> </div> - <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>International Bank Account Number.</i18n.Translate> - </p> - </div> + ); } } })(payto)} @@ -421,7 +437,9 @@ export function ShowAccountDetails({ /> </div> <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>Legal name of the person holding the account.</i18n.Translate> + <i18n.Translate> + Legal name of the person holding the account. + </i18n.Translate> </p> </div> <div class="sm:col-span-5"> @@ -443,7 +461,10 @@ export function ShowAccountDetails({ /> </div> <p class="mt-2 text-sm text-gray-500"> - <i18n.Translate>From where the merchant can download information about incoming wire transfers to this account.</i18n.Translate> + <i18n.Translate> + From where the merchant can download information about + incoming wire transfers to this account. + </i18n.Translate> </p> </div> </div> @@ -458,15 +479,14 @@ export function ShowAccountDetails({ </a> <CopyButton getContent={() => accountLetter ?? ""} - class="flex text-center disabled:opacity-50 disabled:cursor-default cursor-pointer rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> + class="flex text-center disabled:opacity-50 disabled:cursor-default cursor-pointer rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" + > <i18n.Translate>Copy</i18n.Translate> </CopyButton> </div> </div> - } - + )} </div> - </Fragment> ); } diff --git a/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx b/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx index 58010ecb3..2724fba11 100644 --- a/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx +++ b/packages/bank-ui/src/pages/account/UpdateAccountPassword.tsx @@ -66,7 +66,9 @@ export function UpdateAccountPassword({ const { state: credentials } = useSessionState(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [current, setCurrent] = useState<string | undefined>(); const [password, setPassword] = useState<string | undefined>(); diff --git a/packages/bank-ui/src/pages/admin/AccountForm.tsx b/packages/bank-ui/src/pages/admin/AccountForm.tsx index 026f6e9b3..c8195ddb0 100644 --- a/packages/bank-ui/src/pages/admin/AccountForm.tsx +++ b/packages/bank-ui/src/pages/admin/AccountForm.tsx @@ -512,9 +512,9 @@ export function AccountForm<PurposeType extends keyof ChangeByPurposeType>({ !editableThreshold ? undefined : (e) => { - form.debit_threshold = e as AmountString; - updateForm(structuredClone(form)); - } + form.debit_threshold = e as AmountString; + updateForm(structuredClone(form)); + } } /> <ShowInputErrorLabel diff --git a/packages/bank-ui/src/pages/admin/AdminHome.tsx b/packages/bank-ui/src/pages/admin/AdminHome.tsx index 636563243..7cdbdb450 100644 --- a/packages/bank-ui/src/pages/admin/AdminHome.tsx +++ b/packages/bank-ui/src/pages/admin/AdminHome.tsx @@ -126,28 +126,48 @@ export function getTimeframesForDate( switch (timeframe) { case TalerCorebankApi.MonitorTimeframeParam.hour: return { - current: AbsoluteTime.fromMilliseconds(sub(time, { hours: 1 }).getTime()), - previous: AbsoluteTime.fromMilliseconds(sub(time, { hours: 2 }).getTime()), + current: AbsoluteTime.fromMilliseconds( + sub(time, { hours: 1 }).getTime(), + ), + previous: AbsoluteTime.fromMilliseconds( + sub(time, { hours: 2 }).getTime(), + ), }; case TalerCorebankApi.MonitorTimeframeParam.day: return { - current: AbsoluteTime.fromMilliseconds(sub(time, { days: 1 }).getTime()), - previous: AbsoluteTime.fromMilliseconds(sub(time, { days: 4 }).getTime()), + current: AbsoluteTime.fromMilliseconds( + sub(time, { days: 1 }).getTime(), + ), + previous: AbsoluteTime.fromMilliseconds( + sub(time, { days: 4 }).getTime(), + ), }; case TalerCorebankApi.MonitorTimeframeParam.month: return { - current: AbsoluteTime.fromMilliseconds(sub(time, { months: 1 }).getTime()), - previous: AbsoluteTime.fromMilliseconds(sub(time, { months: 2 }).getTime()), + current: AbsoluteTime.fromMilliseconds( + sub(time, { months: 1 }).getTime(), + ), + previous: AbsoluteTime.fromMilliseconds( + sub(time, { months: 2 }).getTime(), + ), }; case TalerCorebankApi.MonitorTimeframeParam.year: return { - current: AbsoluteTime.fromMilliseconds(sub(time, { years: 1 }).getTime()), - previous: AbsoluteTime.fromMilliseconds(sub(time, { years: 2 }).getTime()), + current: AbsoluteTime.fromMilliseconds( + sub(time, { years: 1 }).getTime(), + ), + previous: AbsoluteTime.fromMilliseconds( + sub(time, { years: 2 }).getTime(), + ), }; case TalerCorebankApi.MonitorTimeframeParam.decade: return { - current: AbsoluteTime.fromMilliseconds(sub(time, { years: 10 }).getTime()), - previous: AbsoluteTime.fromMilliseconds(sub(time, { years: 20 }).getTime()), + current: AbsoluteTime.fromMilliseconds( + sub(time, { years: 10 }).getTime(), + ), + previous: AbsoluteTime.fromMilliseconds( + sub(time, { years: 20 }).getTime(), + ), }; default: assertUnreachable(timeframe); diff --git a/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx b/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx index ecbb18b57..7d2d449b0 100644 --- a/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx +++ b/packages/bank-ui/src/pages/admin/CreateNewAccount.tsx @@ -46,7 +46,9 @@ export function CreateNewAccount({ const { state: credentials } = useSessionState(); const token = credentials.status !== "loggedIn" ? undefined : credentials.token; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [submitAccount, setSubmitAccount] = useState< TalerCorebankApi.RegisterAccountRequest | undefined diff --git a/packages/bank-ui/src/pages/admin/DownloadStats.tsx b/packages/bank-ui/src/pages/admin/DownloadStats.tsx index 49798c2c6..8f6bb7c23 100644 --- a/packages/bank-ui/src/pages/admin/DownloadStats.tsx +++ b/packages/bank-ui/src/pages/admin/DownloadStats.tsx @@ -59,7 +59,9 @@ export function DownloadStats({ routeCancel }: Props): VNode { credentials.status !== "loggedIn" || !credentials.isUserAdministrator ? undefined : credentials; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [options, setOptions] = useState<Options>({ compareWithPrevious: true, @@ -460,9 +462,9 @@ async function fetchAllStatus( // await delay() const previous = options.compareWithPrevious ? await api.getMonitor(token, { - timeframe: frame.timeframe, - date: frame.moment.previous, - }) + timeframe: frame.timeframe, + date: frame.moment.previous, + }) : undefined; if (previous && previous.type === "fail" && options.endOnFirstFail) { diff --git a/packages/bank-ui/src/pages/admin/RemoveAccount.tsx b/packages/bank-ui/src/pages/admin/RemoveAccount.tsx index f9c23ea72..dbeebf719 100644 --- a/packages/bank-ui/src/pages/admin/RemoveAccount.tsx +++ b/packages/bank-ui/src/pages/admin/RemoveAccount.tsx @@ -64,7 +64,9 @@ export function RemoveAccount({ const { state } = useSessionState(); const token = state.status !== "loggedIn" ? undefined : state.token; - const { lib: { bank: api } } = useBankCoreApiContext(); + const { + lib: { bank: api }, + } = useBankCoreApiContext(); const [notification, notify, handleError] = useLocalNotification(); const [, updateBankState] = useBankState(); diff --git a/packages/bank-ui/src/pages/regional/ConversionConfig.tsx b/packages/bank-ui/src/pages/regional/ConversionConfig.tsx index 7527290d0..485ef5490 100644 --- a/packages/bank-ui/src/pages/regional/ConversionConfig.tsx +++ b/packages/bank-ui/src/pages/regional/ConversionConfig.tsx @@ -104,7 +104,9 @@ function useComponentState({ return function afterComponentLoads() { const { i18n } = useTranslationContext(); - const { lib: { conversion } } = useBankCoreApiContext(); + const { + lib: { conversion }, + } = useBankCoreApiContext(); const [notification, notify, handleError] = useLocalNotification(); @@ -519,8 +521,8 @@ function useComponentState({ </div> {cashoutCalc && - status.status === "ok" && - Amounts.cmp(status.result.amount, cashoutCalc.credit) < + status.status === "ok" && + Amounts.cmp(status.result.amount, cashoutCalc.credit) < 0 ? ( <div class="p-4"> <Attention diff --git a/packages/bank-ui/src/pages/regional/CreateCashout.tsx b/packages/bank-ui/src/pages/regional/CreateCashout.tsx index 393240dee..8e54bbd4e 100644 --- a/packages/bank-ui/src/pages/regional/CreateCashout.tsx +++ b/packages/bank-ui/src/pages/regional/CreateCashout.tsx @@ -90,7 +90,11 @@ export function CreateCashout({ const creds = credentials.status !== "loggedIn" ? undefined : credentials; const [, updateBankState] = useBankState(); - const { lib: { bank: api }, config, hints } = useBankCoreApiContext(); + const { + lib: { bank: api }, + config, + hints, + } = useBankCoreApiContext(); const [form, setForm] = useState<Partial<FormType>>({ isDebit: true }); const [notification, notify, handleError] = useLocalNotification(); const info = useConversionInfo(); @@ -196,7 +200,8 @@ export function CreateCashout({ * depending on the isDebit flag */ const inputAmount = Amounts.parseOrThrow( - `${form.isDebit ? regional_currency : fiat_currency}:${!form.amount ? "0" : form.amount + `${form.isDebit ? regional_currency : fiat_currency}:${ + !form.amount ? "0" : form.amount }`, ); @@ -237,11 +242,12 @@ export function CreateCashout({ : Amounts.cmp(limit, calc.debit) === -1 ? i18n.str`Balance is not enough` : form.isDebit && - Amounts.cmp(inputAmount, conversionInfo.cashout_min_amount) < 1 - ? i18n.str`Needs to be higher than ${Amounts.stringifyValueWithSpec( - Amounts.parseOrThrow(conversionInfo.cashout_min_amount), - regional_currency_specification, - ).normal + Amounts.cmp(inputAmount, conversionInfo.cashout_min_amount) < 1 + ? i18n.str`Needs to be higher than ${ + Amounts.stringifyValueWithSpec( + Amounts.parseOrThrow(conversionInfo.cashout_min_amount), + regional_currency_specification, + ).normal }` : calculationResult === "amount-is-too-small" ? i18n.str`Amount needs to be higher` @@ -255,8 +261,8 @@ export function CreateCashout({ const request_uid = encodeCrock(getRandomBytes(32)); await handleError(async () => { // new cashout api doesn't require channel - const validChannel = config.supported_tan_channels.length === 0 || - form.channel; + const validChannel = + config.supported_tan_channels.length === 0 || form.channel; if (!creds || !form.subject || !validChannel) return; const request = { @@ -606,9 +612,9 @@ export function CreateCashout({ cashoutDisabled ? undefined : (value) => { - form.amount = value; - updateForm(structuredClone(form)); - } + form.amount = value; + updateForm(structuredClone(form)); + } } /> <ShowInputErrorLabel @@ -649,7 +655,7 @@ export function CreateCashout({ </dd> </div> {Amounts.isZero(sellFee) || - Amounts.isZero(calc.beforeFee) ? undefined : ( + Amounts.isZero(calc.beforeFee) ? undefined : ( <div class="flex items-center justify-between border-t-2 afu pt-4"> <dt class="flex items-center text-sm text-gray-600"> <span> @@ -679,7 +685,6 @@ export function CreateCashout({ </dl> </div> )} - </div> </div> diff --git a/packages/bank-ui/src/pages/regional/ShowCashoutDetails.tsx b/packages/bank-ui/src/pages/regional/ShowCashoutDetails.tsx index eaefeab12..aba00ad7a 100644 --- a/packages/bank-ui/src/pages/regional/ShowCashoutDetails.tsx +++ b/packages/bank-ui/src/pages/regional/ShowCashoutDetails.tsx @@ -138,7 +138,7 @@ export function ShowCashoutDetails({ id, routeClose }: Props): VNode { timestamp={AbsoluteTime.fromProtocolTimestamp( result.body.creation_time, )} - // relative={Duration.fromSpec({ days: 1 })} + // relative={Duration.fromSpec({ days: 1 })} /> </dd> </div> diff --git a/packages/bank-ui/src/settings.ts b/packages/bank-ui/src/settings.ts index 49c8408ce..968fe6248 100644 --- a/packages/bank-ui/src/settings.ts +++ b/packages/bank-ui/src/settings.ts @@ -104,9 +104,9 @@ function buildDefaultBackendBaseURL(): string | undefined { ).href; /** * By default, bank backend serves the html content - * from the /webui root. + * from the /webui root. */ return canonicalizeBaseUrl(currentLocation.replace("/webui", "")); } - throw Error("No default URL") + throw Error("No default URL"); } diff --git a/packages/bank-ui/src/stories.test.ts b/packages/bank-ui/src/stories.test.ts index 2f3988e9a..921f9f9ea 100644 --- a/packages/bank-ui/src/stories.test.ts +++ b/packages/bank-ui/src/stories.test.ts @@ -23,7 +23,10 @@ import { TalerCorebankApi, setupI18n, } from "@gnu-taler/taler-util"; -import { BankApiProviderTesting, parseGroupImport } from "@gnu-taler/web-util/browser"; +import { + BankApiProviderTesting, + parseGroupImport, +} from "@gnu-taler/web-util/browser"; import * as tests from "@gnu-taler/web-util/testing"; import * as components from "./components/index.examples.js"; import * as pages from "./pages/index.stories.js"; |