diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/components')
4 files changed, 32 insertions, 16 deletions
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx index e9688da21..5d5dae092 100644 --- a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx +++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx @@ -19,13 +19,14 @@ import { NotificationType, Transaction, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { Fragment, h, JSX, VNode } from "preact"; import { useEffect } from "preact/hooks"; import { useTranslationContext } from "../context/translation.js"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; import { Avatar } from "../mui/Avatar.js"; import { Typography } from "../mui/Typography.js"; -import * as wxApi from "../wxApi.js"; +import { wxApi } from "../wxApi.js"; import Banner from "./Banner.js"; import { Time } from "./Time.js"; @@ -34,14 +35,14 @@ interface Props extends JSX.HTMLAttributes { } export function PendingTransactions({ goToTransaction }: Props): VNode { - const state = useAsyncAsHook(wxApi.getTransactions); + const state = useAsyncAsHook(() => + wxApi.wallet.call(WalletApiOperation.GetTransactions, {}), + ); useEffect(() => { - return wxApi.onUpdateNotification( + return wxApi.listener.onUpdateNotification( [NotificationType.WithdrawGroupFinished], - () => { - state?.retry(); - }, + state?.retry, ); }); diff --git a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx index 7c1d2c6fc..6461f76e3 100644 --- a/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx +++ b/packages/taler-wallet-webextension/src/components/ShowFullContractTermPopup.tsx @@ -14,7 +14,10 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ import { AbsoluteTime, Duration, Location } from "@gnu-taler/taler-util"; -import { WalletContractData } from "@gnu-taler/taler-wallet-core"; +import { + WalletApiOperation, + WalletContractData, +} from "@gnu-taler/taler-wallet-core"; import { styled } from "@linaria/react"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; @@ -26,9 +29,9 @@ import { useTranslationContext } from "../context/translation.js"; import { HookError, useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; import { ButtonHandler } from "../mui/handlers.js"; import { compose, StateViewMap } from "../utils/index.js"; -import * as wxApi from "../wxApi.js"; +import { wxApi } from "../wxApi.js"; import { Amount } from "./Amount.js"; -import { Link, LinkPrimary } from "./styled/index.js"; +import { Link } from "./styled/index.js"; const ContractTermsTable = styled.table` width: 100%; @@ -99,7 +102,9 @@ function useComponentState({ proposalId }: Props, api: typeof wxApi): State { const [show, setShow] = useState(false); const hook = useAsyncAsHook(async () => { if (!show) return undefined; - return await api.getContractTermsDetails(proposalId); + return await api.wallet.call(WalletApiOperation.GetContractTermsDetails, { + proposalId, + }); }, [show]); const hideHandler = { diff --git a/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts b/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts index 2c77e5d3c..79778a595 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/index.ts @@ -18,7 +18,7 @@ import { Loading } from "../../components/Loading.js"; import { HookError } from "../../hooks/useAsyncAsHook.js"; import { ToggleHandler } from "../../mui/handlers.js"; import { compose, StateViewMap } from "../../utils/index.js"; -import * as wxApi from "../../wxApi.js"; +import { wxApi } from "../../wxApi.js"; import { useComponentState } from "./state.js"; import { TermsState } from "./utils.js"; import { @@ -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 30322e139..3cad967ae 100644 --- a/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts +++ b/packages/taler-wallet-webextension/src/components/TermsOfService/state.ts @@ -14,9 +14,10 @@ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> */ +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { useState } from "preact/hooks"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; -import * as wxApi from "../../wxApi.js"; +import { wxApi } from "../../wxApi.js"; import { Props, State } from "./index.js"; import { buildTermsOfServiceState } from "./utils.js"; @@ -34,7 +35,10 @@ export function useComponentState( * For the exchange selected, bring the status of the terms of service */ const terms = useAsyncAsHook(async () => { - const exchangeTos = await api.getExchangeTos(exchangeUrl, ["text/xml"]); + const exchangeTos = await api.wallet.call(WalletApiOperation.GetExchangeTos, { + exchangeBaseUrl: exchangeUrl, + acceptedFormat: ["text/xml"] + }) const state = buildTermsOfServiceState(exchangeTos); @@ -72,10 +76,16 @@ export function useComponentState( try { if (accepted) { - await api.setExchangeTosAccepted(exchangeUrl, state.version); + api.wallet.call(WalletApiOperation.SetExchangeTosAccepted, { + exchangeBaseUrl: exchangeUrl, + etag: state.version + }) } else { // mark as not accepted - await api.setExchangeTosAccepted(exchangeUrl, undefined); + api.wallet.call(WalletApiOperation.SetExchangeTosAccepted, { + exchangeBaseUrl: exchangeUrl, + etag: undefined + }) } // setAccepted(accepted); if (!readOnly) onChange(accepted); //external update |