From 021d508337490d25f6d7293bf0deadbb5f298f8c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 13 Oct 2021 09:54:18 -0300 Subject: [PATCH] fix cta navbar and added an withdrawal button when the wallet didnt find a tos (with a warning) --- .../src/NavigationBar.tsx | 1 + .../src/components/ExchangeToS.tsx | 5 ++++- .../src/cta/Withdraw.tsx | 12 ++++++++++-- .../src/popup/TalerActionFound.tsx | 4 ++-- .../src/popupEntryPoint.tsx | 18 +++++++++--------- 5 files changed, 26 insertions(+), 14 deletions(-) diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx index 7039808d4..9edd8ca67 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -36,6 +36,7 @@ export enum Pages { manual_withdraw = '/manual-withdraw', settings = '/settings', dev = '/dev', + cta = '/cta', backup = '/backup', history = '/history', transaction = '/transaction/:tid', diff --git a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx index b7b0d2fd9..cfa20280f 100644 --- a/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx +++ b/packages/taler-wallet-webextension/src/components/ExchangeToS.tsx @@ -21,7 +21,10 @@ import { h } from 'preact'; export function ExchangeXmlTos({ doc }: { doc: Document }) { const termsNode = doc.querySelector('[ids=terms-of-service]') if (!termsNode) { - return
not found
+ return
+

The exchange send us an xml but there is no node with 'ids=terms-of-service'. This is the content:

+
{new XMLSerializer().serializeToString(doc)}
+
} return {Array.from(termsNode.children).map(renderChild)} diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx index 94f217fc7..5ae1e86ec 100644 --- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx +++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx @@ -214,10 +214,18 @@ export function View({ details, knownExchanges, amount, onWithdraw, onSwitchExch {i18n.str`Confirm withdrawal`} } - {terms.status === 'notfound' && - + {terms.status === 'notfound' && + {i18n.str`Exchange doesn't have terms of service`} + + {i18n.str`Withdraw anyway`} + + } diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx index 4e3c71682..ef0ec341c 100644 --- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx +++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx @@ -3,7 +3,7 @@ import { ButtonPrimary, ButtonSuccess, PopupBox } from "../components/styled/ind export interface Props { url: string; - onDismiss: (s: boolean) => void; + onDismiss: () => void; } export function TalerActionFound({ url, onDismiss }: Props) { @@ -49,7 +49,7 @@ export function TalerActionFound({ url, onDismiss }: Props) {
- onDismiss(true)}> Dismiss + onDismiss()}> Dismiss
; diff --git a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx index 33a462142..070df554c 100644 --- a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx +++ b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx @@ -66,14 +66,9 @@ if (document.readyState === "loading") { function Application() { const [talerActionUrl, setDismissed] = useTalerActionURL() - if (talerActionUrl) { - return
- -
- -
-
- } + useEffect(() => { + if (talerActionUrl) route(Pages.cta) + },[talerActionUrl]) return (
@@ -81,11 +76,16 @@ function Application() {
+ + goToWalletPage(Pages.manual_withdraw)} /> - + { + setDismissed(true) + route(Pages.balance) + }} />} /> goToWalletPage(Pages.transaction.replace(':tid', tid))}