summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-03-08 15:36:50 -0300
committerSebastian <sebasjm@gmail.com>2024-03-08 15:39:59 -0300
commite92440e257b4df4a232a28701143a4f9db730458 (patch)
tree85c8bc084cf0089de9b7034de6f9db82d58e308e /packages/taler-wallet-webextension
parent8dea5ac8f41e1d17163a08ba203f15ec372cd442 (diff)
downloadwallet-core-e92440e257b4df4a232a28701143a4f9db730458.tar.gz
wallet-core-e92440e257b4df4a232a28701143a4f9db730458.tar.bz2
wallet-core-e92440e257b4df4a232a28701143a4f9db730458.zip
fix #8489
Diffstat (limited to 'packages/taler-wallet-webextension')
-rw-r--r--packages/taler-wallet-webextension/src/components/WalletActivity.tsx3
-rw-r--r--packages/taler-wallet-webextension/src/wallet/AddExchange/state.ts20
-rw-r--r--packages/taler-wallet-webextension/src/wxBackend.ts21
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()) {