diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src')
3 files changed, 25 insertions, 19 deletions
diff --git a/packages/taler-wallet-webextension/src/components/WalletActivity.tsx b/packages/taler-wallet-webextension/src/components/WalletActivity.tsx index 316596fb4..60839e1f0 100644 --- a/packages/taler-wallet-webextension/src/components/WalletActivity.tsx +++ b/packages/taler-wallet-webextension/src/components/WalletActivity.tsx @@ -33,14 +33,13 @@ import { useBackendContext } from "../context/backend.js"; import { useAsyncAsHook } from "../hooks/useAsyncAsHook.js"; import { useSettings } from "../hooks/useSettings.js"; import { Button } from "../mui/Button.js"; +import { WxApiType } from "../wxApi.js"; import { Modal } from "./Modal.js"; import { Time } from "./Time.js"; -import { WalletEvent, WxApiType } from "../wxApi.js"; interface Props extends JSX.HTMLAttributes { } - export function WalletActivity({ }: Props): VNode { const { i18n } = useTranslationContext() const [settings, updateSettings] = useSettings() diff --git a/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts b/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts index 1b9cbe397..5ae0aa8f4 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts +++ b/packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts @@ -16,13 +16,13 @@ import { ExchangeEntryStatus, OperationFailWithBody, OperationOk, TalerExchangeApi, TalerExchangeHttpClient, canonicalizeBaseUrl, opKnownFailureWithBody } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { BrowserHttpLib } from "@gnu-taler/web-util/browser"; import { useCallback, useEffect, useState } from "preact/hooks"; import { useBackendContext } from "../../context/backend.js"; import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; import { withSafe } from "../../mui/handlers.js"; import { RecursiveState } from "../../utils/index.js"; import { CheckExchangeErrors, Props, State } from "./index.js"; +import { BrowserFetchHttpLib } from "@gnu-taler/web-util/browser"; function urlFromInput(str: string): URL { let result: URL; @@ -65,7 +65,23 @@ export function useComponentState({ onBack, currency, noDebounce }: Props): Recu if (found !== -1) { return opKnownFailureWithBody<CheckExchangeErrors>("already-active", undefined); } - const api = new TalerExchangeHttpClient(baseUrl.href, new BrowserHttpLib() as any); + + /** + * FIXME: For some reason typescript doesn't like the next BrowserFetchHttpLib + * + * │ src/wallet/AddExchange/state.ts(68,63): error TS2345: Argument of type 'BrowserFetchHttpLib' is not assignable to parameter of ty + * │ Types of property 'fetch' are incompatible. + * │ Type '(requestUrl: string, options?: HttpRequestOptions | undefined) => Promise<HttpResponse>' is not assignable to type '(ur + * │ Types of parameters 'options' and 'opt' are incompatible. + * │ Type 'import("$PATH/wallet.git/packages/taler-util/lib/http-common", { wi + * │ Type 'import("$PATH/wallet.git/packages/taler-util/lib/http-common", { + * │ Types of property 'cancellationToken' are incompatible. + * │ Type 'import("$PATH/wallet.git/packages/taler-util/lib/Cancellation + * │ Type 'import("$PATH/wallet.git/packages/taler-util/lib/Cancellati + * │ Types have separate declarations of a private property '_isCancelled'. + * + */ + const api = new TalerExchangeHttpClient(baseUrl.href, new BrowserFetchHttpLib() as any); const config = await api.getConfig() if (!api.isCompatible(config.body.version)) { return opKnownFailureWithBody<CheckExchangeErrors>("invalid-version", config.body.version) diff --git a/packages/taler-wallet-webextension/src/wxBackend.ts b/packages/taler-wallet-webextension/src/wxBackend.ts index 195e05687..44e4c0d48 100644 --- a/packages/taler-wallet-webextension/src/wxBackend.ts +++ b/packages/taler-wallet-webextension/src/wxBackend.ts @@ -49,14 +49,11 @@ import { exportDb, importDb, } from "@gnu-taler/taler-wallet-core"; -import { - BrowserHttpLib, - ServiceWorkerHttpLib, -} from "@gnu-taler/web-util/browser"; import { MessageFromFrontend, MessageResponse } from "./platform/api.js"; import { platform } from "./platform/background.js"; import { ExtensionOperations } from "./taler-wallet-interaction-loader.js"; import { BackgroundOperations, WalletEvent } from "./wxApi.js"; +import { BrowserFetchHttpLib } from "@gnu-taler/web-util/browser"; /** * Currently active wallet instance. Might be unloaded and @@ -101,7 +98,7 @@ async function getNotifications(): Promise<WalletEvent[]> { } async function clearNotifications(): Promise<void> { - notifications.splice(0,notifications.length) + notifications.splice(0, notifications.length) } @@ -242,7 +239,7 @@ async function dispatch< error: makeErrorDetail( TalerErrorCode.WALLET_CORE_NOT_AVAILABLE, { lastError }, - `wallet core not available${!lastError ? "": `,last error: ${lastError.hint}`}`, + `wallet core not available${!lastError ? "" : `,last error: ${lastError.hint}`}`, ), }; } @@ -279,15 +276,9 @@ async function reinitWallet(): Promise<void> { let timer; const httpFactory = (): HttpRequestLibrary => { - if (platform.useServiceWorkerAsBackgroundProcess()) { - return new ServiceWorkerHttpLib({ - // enableThrottling: false, - }); - } else { - return new BrowserHttpLib({ - // enableThrottling: false, - }); - } + return new BrowserFetchHttpLib({ + // enableThrottling: false, + }); }; if (platform.useServiceWorkerAsBackgroundProcess()) { |