From b173b3ac0f1a04ef39d82477251dbf4418feb403 Mon Sep 17 00:00:00 2001
From: Sebastian
Date: Mon, 9 Oct 2023 15:42:20 -0300
Subject: fix: take into account dd48 when adding exchanges
---
.../src/wallet/ExchangeSetUrl.tsx | 209 ---------------------
1 file changed, 209 deletions(-)
delete mode 100644 packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
(limited to 'packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx')
diff --git a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx b/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
deleted file mode 100644
index 4fea3bc98..000000000
--- a/packages/taler-wallet-webextension/src/wallet/ExchangeSetUrl.tsx
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2022 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see
- */
-import {
- canonicalizeBaseUrl,
- TalerConfigResponse,
-} from "@gnu-taler/taler-util";
-import { Fragment, h, VNode } from "preact";
-import { useEffect, useState } from "preact/hooks";
-import { ErrorMessage } from "../components/ErrorMessage.js";
-import {
- Input,
- LightText,
- SubTitle,
- Title,
- WarningBox,
-} from "../components/styled/index.js";
-import { useTranslationContext } from "@gnu-taler/web-util/browser";
-import { Button } from "../mui/Button.js";
-
-export interface Props {
- initialValue?: string;
- expectedCurrency?: string;
- onCancel: () => Promise;
- onVerify: (s: string) => Promise;
- onConfirm: (url: string) => Promise;
- withError?: string;
-}
-
-function useEndpointStatus(
- endpoint: string,
- onVerify: (e: string) => Promise,
-): {
- loading: boolean;
- error?: string;
- endpoint: string;
- result: T | undefined;
- updateEndpoint: (s: string) => void;
-} {
- const [value, setValue] = useState(endpoint);
- const [dirty, setDirty] = useState(false);
- const [loading, setLoading] = useState(false);
- const [result, setResult] = useState(undefined);
- const [error, setError] = useState(undefined);
-
- const [handler, setHandler] = useState(undefined);
-
- useEffect(() => {
- if (!value) return;
- window.clearTimeout(handler);
- const h = window.setTimeout(async () => {
- setDirty(true);
- setLoading(true);
- try {
- const url = canonicalizeBaseUrl(value);
- const result = await onVerify(url);
- setResult(result);
- setError(undefined);
- setLoading(false);
- } catch (e) {
- const errorMessage =
- e instanceof Error ? e.message : `unknown error: ${e}`;
- setError(errorMessage);
- setLoading(false);
- setResult(undefined);
- }
- }, 500);
- setHandler(h);
- }, [value, setHandler, onVerify]);
-
- return {
- error: dirty ? error : undefined,
- loading: loading,
- result: result,
- endpoint: value,
- updateEndpoint: setValue,
- };
-}
-
-export function ExchangeSetUrlPage({
- initialValue,
- expectedCurrency,
- onCancel,
- onVerify,
- onConfirm,
-}: Props): VNode {
- const { i18n } = useTranslationContext();
- const { loading, result, endpoint, updateEndpoint, error } =
- useEndpointStatus(initialValue ?? "", onVerify);
-
- const [confirmationError, setConfirmationError] = useState<
- string | undefined
- >(undefined);
-
- return (
-
-
-
-
-
- );
-}
--
cgit v1.2.3