Tip Received!
-
You received a tip of {renderAmount(ts.tip.amount)} from {this.props.merchantDomain}.
+
You received a tip of {renderAmount(ts.tip.amount)} from
+ {this.props.merchantDomain}.
{ts.tip.accepted
?
You've accepted this tip! Go back to merchant
: this.renderButtons()
@@ -134,10 +141,10 @@ async function main() {
try {
const url = new URI(document.location.href);
const query: any = URI.parseQuery(url.query());
-
- let merchantDomain = query.merchant_domain;
- let tipId = query.tip_id;
- let props: TipDisplayProps = { tipId, merchantDomain };
+
+ const merchantDomain = query.merchant_domain;
+ const tipId = query.tip_id;
+ const props: TipDisplayProps = { tipId, merchantDomain };
ReactDOM.render(
,
document.getElementById("container")!);
diff --git a/src/webex/pages/tree.tsx b/src/webex/pages/tree.tsx
index 2ac0b8631..67e58a1df 100644
--- a/src/webex/pages/tree.tsx
+++ b/src/webex/pages/tree.tsx
@@ -22,6 +22,7 @@
import { getTalerStampDate } from "../../helpers";
+
import {
CoinRecord,
CoinStatus,
@@ -29,7 +30,7 @@ import {
ExchangeRecord,
PreCoinRecord,
ReserveRecord,
-} from "../../types";
+} from "../../dbTypes";
import { ImplicitStateComponent, StateHolder } from "../components";
import {
diff --git a/src/webex/renderHtml.tsx b/src/webex/renderHtml.tsx
index d225cef0c..2e21932b0 100644
--- a/src/webex/renderHtml.tsx
+++ b/src/webex/renderHtml.tsx
@@ -24,12 +24,16 @@
/**
* Imports.
*/
+import { AmountJson } from "../amounts";
+import * as Amounts from "../amounts";
+
import {
- AmountJson,
- Amounts,
DenominationRecord,
+} from "../dbTypes";
+import {
ReserveCreationInfo,
-} from "../types";
+} from "../walletTypes";
+
import { ImplicitStateComponent } from "./components";
@@ -239,7 +243,9 @@ function FeeDetailsView(props: {rci: ReserveCreationInfo|null}): JSX.Element {
);
}
-
+/**
+ * Shows details about a withdraw request.
+ */
export function WithdrawDetailView(props: {rci: ReserveCreationInfo | null}): JSX.Element {
const rci = props.rci;
return (
@@ -259,6 +265,9 @@ interface ExpanderTextProps {
text: string;
}
+/**
+ * Show a heading with a toggle to show/hide the expandable content.
+ */
export class ExpanderText extends ImplicitStateComponent
{
private expanded = this.makeState(false);
private textArea: any = undefined;
diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts
index 2575eec90..2f7a13c48 100644
--- a/src/webex/wxApi.ts
+++ b/src/webex/wxApi.ts
@@ -22,26 +22,31 @@
/**
* Imports.
*/
+import { AmountJson } from "../amounts";
import {
- AmountJson,
- CheckPayResult,
CoinRecord,
- ConfirmPayResult,
CurrencyRecord,
DenominationRecord,
ExchangeRecord,
PreCoinRecord,
PurchaseRecord,
- QueryPaymentResult,
- RefundPermission,
- ReserveCreationInfo,
ReserveRecord,
+} from "../dbTypes";
+import {
+ CheckPayResult,
+ ConfirmPayResult,
+ QueryPaymentResult,
+ ReserveCreationInfo,
SenderWireInfos,
- TipResponse,
- TipPlanchetDetail,
TipStatus,
WalletBalance,
-} from "../types";
+} from "../walletTypes";
+
+import {
+ RefundPermission,
+ TipPlanchetDetail,
+ TipResponse,
+} from "../talerTypes";
import { MessageMap, MessageType } from "./messages";
@@ -366,22 +371,39 @@ export function getFullRefundFees(args: { refundPermissions: RefundPermission[]
/**
* Get or generate planchets to give the merchant that wants to tip us.
*/
-export function getTipPlanchets(merchantDomain: string, tipId: string, amount: AmountJson, deadline: number, exchangeUrl: string, nextUrl: string): Promise {
+export function getTipPlanchets(merchantDomain: string,
+ tipId: string,
+ amount: AmountJson,
+ deadline: number,
+ exchangeUrl: string,
+ nextUrl: string): Promise {
return callBackend("get-tip-planchets", { merchantDomain, tipId, amount, deadline, exchangeUrl, nextUrl });
}
+/**
+ * Get the status of processing a tip.
+ */
export function getTipStatus(merchantDomain: string, tipId: string): Promise {
return callBackend("get-tip-status", { merchantDomain, tipId });
}
+/**
+ * Mark a tip as accepted by the user.
+ */
export function acceptTip(merchantDomain: string, tipId: string): Promise {
return callBackend("accept-tip", { merchantDomain, tipId });
}
+/**
+ * Process a response from the merchant for a tip request.
+ */
export function processTipResponse(merchantDomain: string, tipId: string, tipResponse: TipResponse): Promise {
return callBackend("process-tip-response", { merchantDomain, tipId, tipResponse });
}
+/**
+ * Clear notifications that the wallet shows to the user.
+ */
export function clearNotification(): Promise {
return callBackend("clear-notification", { });
}
diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts
index 213d234d4..a8ce5eebc 100644
--- a/src/webex/wxBackend.ts
+++ b/src/webex/wxBackend.ts
@@ -30,18 +30,21 @@ import {
Index,
Store,
} from "../query";
+
+import { AmountJson } from "../amounts";
+
+import { ProposalRecord } from "../dbTypes";
import {
AcceptTipRequest,
- AmountJson,
ConfirmReserveRequest,
CreateReserveRequest,
GetTipPlanchetsRequest,
Notifier,
ProcessTipResponseRequest,
- ProposalRecord,
ReturnCoinsRequest,
TipStatusRequest,
-} from "../types";
+} from "../walletTypes";
+
import {
Stores,
WALLET_DB_VERSION,
@@ -335,7 +338,12 @@ function handleMessage(sender: MessageSender,
}
case "get-tip-planchets": {
const req = GetTipPlanchetsRequest.checked(detail);
- return needsWallet().getTipPlanchets(req.merchantDomain, req.tipId, req.amount, req.deadline, req.exchangeUrl, req.nextUrl);
+ return needsWallet().getTipPlanchets(req.merchantDomain,
+ req.tipId,
+ req.amount,
+ req.deadline,
+ req.exchangeUrl,
+ req.nextUrl);
}
case "clear-notification": {
return needsWallet().clearNotification();
@@ -702,11 +710,10 @@ export async function wxMain() {
});
-
// Clear notifications both when the popop opens,
// as well when it closes.
chrome.runtime.onConnect.addListener((port) => {
- if (port.name == "popup") {
+ if (port.name === "popup") {
if (currentWallet) {
currentWallet.clearNotification();
}
diff --git a/tooling/pogen/dumpTree.ts b/tooling/pogen/dumpTree.ts
index 958c79416..af25caf32 100644
--- a/tooling/pogen/dumpTree.ts
+++ b/tooling/pogen/dumpTree.ts
@@ -21,12 +21,10 @@
* @author Florian Dold
*/
-///
-
"use strict";
-import {readFileSync} from "fs";
-import {execSync} from "child_process";
+import { readFileSync } from "fs";
+import { execSync } from "child_process";
import * as ts from "typescript";
diff --git a/tsconfig.json b/tsconfig.json
index d2a7f5526..ae77fb27c 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,4 +1,5 @@
{
+ "compileOnSave": true,
"compilerOptions": {
"target": "es6",
"jsx": "react",
@@ -7,8 +8,8 @@
"module": "commonjs",
"sourceMap": true,
"lib": [
- "ES6",
- "DOM"
+ "es6",
+ "dom"
],
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
@@ -23,6 +24,7 @@
"decl/chrome/chrome.d.ts",
"decl/jed.d.ts",
"decl/urijs.d.ts",
+ "src/amounts.ts",
"src/checkable.ts",
"src/crypto/cryptoApi-test.ts",
"src/crypto/cryptoApi.ts",
@@ -34,6 +36,7 @@
"src/crypto/nodeWorker.ts",
"src/crypto/nodeWorkerEntry.ts",
"src/crypto/startWorker.js",
+ "src/dbTypes.ts",
"src/helpers-test.ts",
"src/helpers.ts",
"src/http.ts",
@@ -42,18 +45,13 @@
"src/libtoolVersion-test.ts",
"src/libtoolVersion.ts",
"src/logging.ts",
- "src/memidb/aatree-test.ts",
- "src/memidb/aatree.ts",
- "src/memidb/memidb-test.ts",
- "src/memidb/memidb.ts",
- "src/memidb/w3c-wpt/abort-in-initial-upgradeneeded-test.ts",
- "src/memidb/w3c-wpt/support.ts",
"src/query.ts",
+ "src/talerTypes.ts",
"src/timer.ts",
"src/types-test.ts",
- "src/types.ts",
"src/wallet-test.ts",
"src/wallet.ts",
+ "src/walletTypes.ts",
"src/webex/background.ts",
"src/webex/chromeBadge.ts",
"src/webex/components.ts",
diff --git a/tslint.json b/tslint.json
index fbd1975b7..a56b56a94 100644
--- a/tslint.json
+++ b/tslint.json
@@ -5,6 +5,7 @@
],
"jsRules": {},
"rules": {
+ "arrow-parens": false,
"max-line-length": {
"options": [120]
},