- Please check in your about:config settings that you
- have IndexedDB enabled (check the preference name{" "}
- dom.indexedDB.enabled).
+
+ Please check in your about:config settings that you
+ have IndexedDB enabled (check the preference name{" "}
+ dom.indexedDB.enabled).
+
) : null}
{diagnostics.dbOutdated ? (
- Your wallet database is outdated. Currently automatic migration is
- not supported. Please go{" "}
- here to reset the
- wallet database.
+
+ Your wallet database is outdated. Currently automatic migration is
+ not supported. Please go{" "}
+
+ here
+ {" "}
+ to reset the wallet database.
+
) : null}
);
}
- return
Running diagnostics ...
;
+ return (
+
+ Running diagnostics ...
+
+ );
}
diff --git a/packages/taler-wallet-webextension/src/components/EditableText.tsx b/packages/taler-wallet-webextension/src/components/EditableText.tsx
index 72bfbe809..c5d6e397e 100644
--- a/packages/taler-wallet-webextension/src/components/EditableText.tsx
+++ b/packages/taler-wallet-webextension/src/components/EditableText.tsx
@@ -14,6 +14,7 @@
GNU Taler; see the file COPYING. If not, see
*/
+import { Translate } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useRef, useState } from "preact/hooks";
@@ -39,7 +40,9 @@ export function EditableText({
return (
{value}
-
+
);
};
@@ -54,7 +57,7 @@ export function EditableText({
onChange(ref.current.value).then(() => setEditing(false));
}}
>
- confirm
+ Confirm
);
diff --git a/packages/taler-wallet-webextension/src/components/ErrorMessage.tsx b/packages/taler-wallet-webextension/src/components/ErrorMessage.tsx
index 21f10eeef..085bf0b82 100644
--- a/packages/taler-wallet-webextension/src/components/ErrorMessage.tsx
+++ b/packages/taler-wallet-webextension/src/components/ErrorMessage.tsx
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License along with
GNU Taler; see the file COPYING. If not, see
*/
-import { VNode, h } from "preact";
+import { VNode, h, ComponentChildren } from "preact";
import { useState } from "preact/hooks";
import arrowDown from "../../static/img/chevron-down.svg";
import { ErrorBox } from "./styled";
@@ -22,11 +22,10 @@ export function ErrorMessage({
title,
description,
}: {
- title?: string | VNode;
+ title: VNode;
description?: string;
}): VNode | null {
const [showErrorDetail, setShowErrorDetail] = useState(false);
- if (!title) return null;
return (
diff --git a/packages/taler-wallet-webextension/src/components/ErrorTalerOperation.tsx b/packages/taler-wallet-webextension/src/components/ErrorTalerOperation.tsx
index a7b66ea3d..4852a71b1 100644
--- a/packages/taler-wallet-webextension/src/components/ErrorTalerOperation.tsx
+++ b/packages/taler-wallet-webextension/src/components/ErrorTalerOperation.tsx
@@ -24,7 +24,7 @@ export function ErrorTalerOperation({
title,
error,
}: {
- title?: string;
+ title?: VNode;
error?: TalerErrorDetails;
}): VNode | null {
const { devMode } = useDevContext();
diff --git a/packages/taler-wallet-webextension/src/components/Loading.tsx b/packages/taler-wallet-webextension/src/components/Loading.tsx
index 34edac551..ff6d21376 100644
--- a/packages/taler-wallet-webextension/src/components/Loading.tsx
+++ b/packages/taler-wallet-webextension/src/components/Loading.tsx
@@ -13,8 +13,13 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see
*/
+import { Translate } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
export function Loading(): VNode {
- return
+ Could not get the payment information for this order
+
+ }
error={payErrMsg?.operationError}
/>
@@ -130,15 +141,25 @@ export function DepositPage({ talerPayUri, goBack }: Props): VNode {
return (
-
{i18n.str`Digital cash payment`}
+
+ Digital cash payment
+
-
Could not get the payment information for this order
+
+
+ Could not get the payment information for this order
+
+
- {!payResult.contractTerms.fulfillment_message
- ? "You will now be sent back to the merchant you came from."
- : payResult.contractTerms.fulfillment_message}
+ {!payResult.contractTerms.fulfillment_message ? (
+
+ You will now be sent back to the merchant you came from.
+
+ ) : (
+ payResult.contractTerms.fulfillment_message
+ )}
)}
@@ -205,7 +238,7 @@ export function PaymentRequestView({
Amounts.isNonZero(totalFees) && (
Total to pay}
text={amountToPretty(
Amounts.parseOrThrow(payStatus.amountEffective),
)}
@@ -214,7 +247,7 @@ export function PaymentRequestView({
)}
Purchase amount}
text={amountToPretty(Amounts.parseOrThrow(payStatus.amountRaw))}
kind="neutral"
/>
@@ -222,21 +255,25 @@ export function PaymentRequestView({
Fee}
text={amountToPretty(totalFees)}
kind="negative"
/>
)}
Merchant}
text={contractTerms.merchant.name}
kind="neutral"
/>
-
+ Purchase}
+ text={contractTerms.summary}
+ kind="neutral"
+ />
{contractTerms.order_id && (
Receipt}
text={`#${contractTerms.order_id}`}
kind="neutral"
/>
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index 7f5f42e8d..7ed0d072f 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -37,10 +37,12 @@ import {
PreparePayResult,
PreparePayResultType,
Product,
+ Translate,
} from "@gnu-taler/taler-util";
import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
+import { ErrorMessage } from "../components/ErrorMessage";
import { Loading } from "../components/Loading";
import { LoadingError } from "../components/LoadingError";
import { LogoHeader } from "../components/LogoHeader";
@@ -106,7 +108,12 @@ export function PayPage({
}
if (hook.hasError) {
- return ;
+ return (
+ Could not load pay status}
+ error={hook}
+ />
+ );
}
const foundBalance = hook.response.balance.balances.find(
@@ -178,9 +185,13 @@ export function PaymentRequestView({
if (!contractTerms) {
return (
-
- Error: did not get contract terms from merchant or wallet backend.
-
+
+ Could not load contract terms from merchant or wallet backend.
+
+ }
+ />
);
}
@@ -192,13 +203,6 @@ export function PaymentRequestView({
totalFees = Amounts.sub(amountEffective, amountRaw).amount;
}
- // let merchantName: VNode;
- // if (contractTerms.merchant && contractTerms.merchant.name) {
- // merchantName = {contractTerms.merchant.name};
- // } else {
- // merchantName = (pub: {contractTerms.merchant_pub});
- // }
-
function Alternative(): VNode {
const [showQR, setShowQR] = useState(false);
const privateUri =
@@ -209,12 +213,21 @@ export function PaymentRequestView({
return (
setShowQR((qr) => !qr)}>
- {!showQR ? i18n.str`Pay with a mobile phone` : i18n.str`Hide QR`}
+ {!showQR ? (
+ Pay with a mobile phone
+ ) : (
+ Hide QR
+ )}
{showQR && (
)}
@@ -227,7 +240,9 @@ export function PaymentRequestView({
return (
-
Processing...
+
+ Processing...
+
);
@@ -239,7 +254,9 @@ export function PaymentRequestView({
- {i18n.str`Pay`} {amountToString(payStatus.amountEffective)}
+
+ Pay {amountToString(payStatus.amountEffective)}
+
@@ -252,18 +269,22 @@ export function PaymentRequestView({
{balance ? (
- Your balance of {amountToString(balance)} is not enough to pay
- for this purchase
+
+ Your balance of {amountToString(balance)} is not enough to pay
+ for this purchase
+
) : (
- Your balance is not enough to pay for this purchase.
+
+ Your balance is not enough to pay for this purchase.
+
)}
- {i18n.str`Withdraw digital cash`}
+ Withdraw digital cash
@@ -276,7 +297,7 @@ export function PaymentRequestView({
{payStatus.paid && contractTerms.fulfillment_message && (
Merchant message}
text={contractTerms.fulfillment_message}
kind="neutral"
/>
@@ -293,31 +314,48 @@ export function PaymentRequestView({
-
{i18n.str`Digital cash payment`}
+
+ Digital cash payment
+
{payStatus.status === PreparePayResultType.AlreadyConfirmed &&
(payStatus.paid ? (
payStatus.contractTerms.fulfillment_url ? (
- Already paid, you are going to be redirected to{" "}
-
- {payStatus.contractTerms.fulfillment_url}
-
+
+ Already paid, you are going to be redirected to{" "}
+
+ {payStatus.contractTerms.fulfillment_url}
+
+
) : (
- Already paid
+
+ Already paid
+
)
) : (
- Already claimed
+
+ Already claimed
+
))}
{payResult && payResult.type === ConfirmPayResultType.Done && (
-
Payment complete
+
+ Payment complete
+
- {!payResult.contractTerms.fulfillment_message
- ? payResult.contractTerms.fulfillment_url
- ? `You are going to be redirected to ${payResult.contractTerms.fulfillment_url}`
- : "You can close this page."
- : payResult.contractTerms.fulfillment_message}
+ {!payResult.contractTerms.fulfillment_message ? (
+ payResult.contractTerms.fulfillment_url ? (
+
+ You are going to be redirected to $
+ {payResult.contractTerms.fulfillment_url}
+
+ ) : (
+ You can close this page.
+ )
+ ) : (
+ payResult.contractTerms.fulfillment_message
+ )}
)}
@@ -326,14 +364,14 @@ export function PaymentRequestView({
Amounts.isNonZero(totalFees) && (
Total to pay}
text={amountToString(payStatus.amountEffective)}
kind="negative"
/>
)}
Purchase amount}
text={amountToString(payStatus.amountRaw)}
kind="neutral"
/>
@@ -341,21 +379,25 @@ export function PaymentRequestView({
Fee}
text={amountToString(totalFees)}
kind="negative"
/>
)}
Merchant}
text={contractTerms.merchant.name}
kind="neutral"
/>
-
+ Purchase}
+ text={contractTerms.summary}
+ kind="neutral"
+ />
{contractTerms.order_id && (
Receipt}
text={`#${contractTerms.order_id}`}
kind="neutral"
/>
@@ -373,7 +415,7 @@ function ProductList({ products }: { products: Product[] }): VNode {
return (
- List of products
+ List of products
diff --git a/packages/taler-wallet-webextension/src/cta/Refund.tsx b/packages/taler-wallet-webextension/src/cta/Refund.tsx
index cecd1ac00..ec32cc37a 100644
--- a/packages/taler-wallet-webextension/src/cta/Refund.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Refund.tsx
@@ -17,10 +17,10 @@
/**
* Page that shows refund status for purchases.
*
- * @author Florian Dold
+ * @author sebasjm
*/
-import { Amounts, ApplyRefundResponse } from "@gnu-taler/taler-util";
+import { Amounts, ApplyRefundResponse, Translate } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { AmountView } from "../renderHtml";
@@ -37,20 +37,28 @@ export function View({ applyResult }: ViewProps): VNode {
GNU Taler Wallet
-
Refund Status
+
+ Refund Status
+
- The product {applyResult.info.summary} has received a total
- effective refund of{" "}
+
+ The product {applyResult.info.summary} has received a total
+ effective refund of{" "}
+ .
- The refund amount of{" "}
- could not be
- applied.
+
+ The refund amount of{" "}
+ could not be
+ applied.
+
) : null}
@@ -82,15 +90,27 @@ export function RefundPage({ talerRefundUri }: Props): VNode {
console.log("rendering");
if (!talerRefundUri) {
- return missing taler refund uri;
+ return (
+
+ missing taler refund uri
+
+ );
}
if (errMsg) {
- return Error: {errMsg};
+ return (
+
+ Error: {errMsg}
+
+ );
}
if (!applyResult) {
- return Updating refund status;
+ return (
+
+ Updating refund status
+
+ );
}
return ;
diff --git a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
index 584da6d29..00f7bd211 100644
--- a/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
+++ b/packages/taler-wallet-webextension/src/cta/TermsOfServiceSection.tsx
@@ -1,4 +1,4 @@
-import { i18n } from "@gnu-taler/taler-util";
+import { i18n, Translate } from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
import { CheckboxOutlined } from "../components/CheckboxOutlined";
import { ExchangeXmlTos } from "../components/ExchangeToS";
@@ -34,7 +34,7 @@ export function TermsOfServiceSection({
{terms.status === "notfound" && (
- {i18n.str`Exchange doesn't have terms of service`}
+ Exchange doesn't have terms of service
)}
@@ -46,21 +46,21 @@ export function TermsOfServiceSection({
{terms.status === "notfound" && (
- {i18n.str`Exchange doesn't have terms of service`}
+ Exchange doesn't have terms of service
)}
{terms.status === "new" && (
onReview(true)}>
- {i18n.str`Review exchange terms of service`}
+ Review exchange terms of service
)}
{terms.status === "changed" && (
onReview(true)}>
- {i18n.str`Review new version of terms of service`}
+ Review new version of terms of service
)}
@@ -72,7 +72,7 @@ export function TermsOfServiceSection({
{onReview && (
onReview(true)}>
- {i18n.str`Show terms of service`}
+ Show terms of service
)}
@@ -80,7 +80,9 @@ export function TermsOfServiceSection({
I accept the exchange terms of service
+ }
onToggle={() => {
onAccept(!reviewed);
if (onReview) onReview(false);
@@ -95,7 +97,9 @@ export function TermsOfServiceSection({
{terms.status !== "notfound" && !terms.content && (
- The exchange reply with a empty terms of service
+
+ The exchange reply with a empty terms of service
+
)}
@@ -116,7 +120,7 @@ export function TermsOfServiceSection({
)}
{terms.content.type === "pdf" && (
- Download Terms of Service
+ Download Terms of Service
)}
@@ -124,7 +128,7 @@ export function TermsOfServiceSection({
{reviewed && onReview && (
onReview(false)}>
- {i18n.str`Hide terms of service`}
+ Hide terms of service
)}
@@ -133,7 +137,9 @@ export function TermsOfServiceSection({
I accept the exchange terms of service
+ }
onToggle={() => {
onAccept(!reviewed);
if (onReview) onReview(false);
diff --git a/packages/taler-wallet-webextension/src/cta/Tip.tsx b/packages/taler-wallet-webextension/src/cta/Tip.tsx
index 3f8b09bd1..9bb03b7ac 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Tip.tsx
@@ -17,10 +17,10 @@
/**
* Page shown to the user to accept or ignore a tip from a merchant.
*
- * @author Florian Dold
+ * @author sebasjm
*/
-import { PrepareTipResult } from "@gnu-taler/taler-util";
+import { PrepareTipResult, Translate } from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useEffect, useState } from "preact/hooks";
import { Loading } from "../components/Loading";
@@ -46,21 +46,29 @@ export function View({
{prepareTipResult.accepted ? (
- Tip from {prepareTipResult.merchantBaseUrl} accepted.
- Check your transactions list for more details.
+
+ Tip from {prepareTipResult.merchantBaseUrl} accepted.
+ Check your transactions list for more details.
+
) : (
- The merchant {prepareTipResult.merchantBaseUrl} is
- offering you a tip of{" "}
-
-
- {" "}
- via the exchange {prepareTipResult.exchangeBaseUrl}
+
+ The merchant {prepareTipResult.merchantBaseUrl} is
+ offering you a tip of{" "}
+
+
+ {" "}
+ via the exchange {prepareTipResult.exchangeBaseUrl}
+
-
-
+
+
)}
@@ -98,11 +106,19 @@ export function TipPage({ talerTipUri }: Props): VNode {
};
if (!talerTipUri) {
- return missing tip uri;
+ return (
+
+ missing tip uri
+
+ );
}
if (tipIgnored) {
- return You've ignored the tip.;
+ return (
+
+ You've ignored the tip.
+
+ );
}
if (!prepareTipResult) {
diff --git a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
index 8f45a047c..7d36a6084 100644
--- a/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Withdraw.tsx
@@ -18,7 +18,7 @@
* Page shown to the user to confirm creation
* of a reserve, usually requested by the bank.
*
- * @author Florian Dold
+ * @author sebasjm
*/
import {
@@ -26,6 +26,7 @@ import {
Amounts,
ExchangeListItem,
i18n,
+ Translate,
WithdrawUriInfoResponse,
} from "@gnu-taler/taler-util";
import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
@@ -117,37 +118,46 @@ export function View({
return (
-
{i18n.str`Digital cash withdrawal`}
+
+ Digital cash withdrawal
+
{withdrawError && (
Could not finish the withdrawal operation
+ }
error={withdrawError.operationError}
/>
)}
Total to withdraw}
text={amountToString(Amounts.sub(amount, withdrawalFee).amount)}
kind="positive"
/>
{Amounts.isNonZero(withdrawalFee) && (
Chosen amount}
text={amountToString(amount)}
kind="neutral"
/>
Exchange fee}
text={amountToString(withdrawalFee)}
kind="negative"
/>
)}
{exchangeBaseUrl && (
-
+ Exchange}
+ text={exchangeBaseUrl}
+ kind="neutral"
+ big
+ />
)}
{!reviewing && (
@@ -156,7 +166,7 @@ export function View({
Known exchanges}
list={exchanges}
value={nextExchange}
name="switchingExchange"
@@ -172,14 +182,16 @@ export function View({
setSwitchingExchange(false);
}}
>
- {nextExchange === undefined
- ? i18n.str`Cancel exchange selection`
- : i18n.str`Confirm exchange selection`}
+ {nextExchange === undefined ? (
+ Cancel exchange selection
+ ) : (
+ Confirm exchange selection
+ )}
) : (
setSwitchingExchange(true)}>
- {i18n.str`Switch exchange`}
+ Switch exchange
)}
@@ -198,7 +210,7 @@ export function View({
disabled={!exchangeBaseUrl || confirmDisabled}
onClick={doWithdrawAndCheckError}
>
- {i18n.str`Confirm withdrawal`}
+ Confirm withdrawal
)}
{terms.status === "notfound" && (
@@ -207,7 +219,7 @@ export function View({
disabled={!exchangeBaseUrl}
onClick={doWithdrawAndCheckError}
>
- {i18n.str`Withdraw anyway`}
+ Withdraw anyway
)}
@@ -270,7 +282,7 @@ export function WithdrawPageWithParsedURI({
if (detailsHook.hasError) {
return (
Could not load the withdrawal details}
error={detailsHook}
/>
);
@@ -293,9 +305,7 @@ export function WithdrawPageWithParsedURI({
const onWithdraw = async (): Promise => {
if (!exchange) return;
- console.log("accepting exchange", exchange);
const res = await wxApi.acceptWithdrawal(uri, exchange);
- console.log("accept withdrawal response", res);
if (res.confirmTransferUrl) {
document.location.href = res.confirmTransferUrl;
}
@@ -327,7 +337,7 @@ export function WithdrawPage({ talerWithdrawUri }: Props): VNode {
if (!talerWithdrawUri) {
return (
- missing withdraw uri
+ missing withdraw uri
);
}
@@ -337,7 +347,7 @@ export function WithdrawPage({ talerWithdrawUri }: Props): VNode {
if (uriInfoHook.hasError) {
return (
Could not get the info from the URI}
error={uriInfoHook}
/>
);
diff --git a/packages/taler-wallet-webextension/src/cta/payback.tsx b/packages/taler-wallet-webextension/src/cta/payback.tsx
deleted file mode 100644
index 1c81b48a0..000000000
--- a/packages/taler-wallet-webextension/src/cta/payback.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- This file is part of TALER
- (C) 2017 Inria
-
- 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.
-
- 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
- TALER; see the file COPYING. If not, see
- */
-
-import { h, VNode } from "preact";
-
-/**
- * View and edit auditors.
- *
- * @author Florian Dold
- */
-
-/**
- * Imports.
- */
-
-export function makePaybackPage(): VNode {
- return