diff options
Diffstat (limited to 'src/webex')
-rw-r--r-- | src/webex/notify.ts | 14 | ||||
-rw-r--r-- | src/webex/pages/add-auditor.tsx | 4 | ||||
-rw-r--r-- | src/webex/pages/auditors.tsx | 6 | ||||
-rw-r--r-- | src/webex/pages/confirm-contract.tsx | 4 | ||||
-rw-r--r-- | src/webex/pages/logs.tsx | 6 | ||||
-rw-r--r-- | src/webex/pages/payback.tsx | 6 | ||||
-rw-r--r-- | src/webex/pages/return-coins.tsx | 6 | ||||
-rw-r--r-- | src/webex/pages/tree.tsx | 6 | ||||
-rw-r--r-- | src/webex/wxBackend.ts | 3 |
9 files changed, 25 insertions, 30 deletions
diff --git a/src/webex/notify.ts b/src/webex/notify.ts index 0531717b8..1da8af1cd 100644 --- a/src/webex/notify.ts +++ b/src/webex/notify.ts @@ -49,7 +49,7 @@ if (document.documentElement.getAttribute("data-taler-nojs")) { interface Handler { type: string; - listener: (e: CustomEvent) => void|Promise<void>; + listener: (e: Event) => void|Promise<void>; } const handlers: Handler[] = []; @@ -230,13 +230,6 @@ async function processProposal(proposal: any) { return; } - let merchantName = "(unknown)"; - try { - merchantName = proposal.data.merchant.name; - } catch (e) { - // bad contract / name not included - } - const proposalId = await wxApi.saveProposal({ contractTerms: proposal.data, contractTermsHash: proposal.hash, @@ -400,7 +393,10 @@ function registerHandlers() { * handles adding sequence numbers to responses. */ function addHandler(type: string, handler: HandlerFn) { - const handlerWrap = (e: CustomEvent) => { + const handlerWrap = (e: Event) => { + if (!(e instanceof CustomEvent)) { + throw Error(`invariant violated`); + } if (e.type !== type) { throw Error(`invariant violated`); } diff --git a/src/webex/pages/add-auditor.tsx b/src/webex/pages/add-auditor.tsx index dbe761a5f..4b898b13c 100644 --- a/src/webex/pages/add-auditor.tsx +++ b/src/webex/pages/add-auditor.tsx @@ -44,8 +44,8 @@ interface ConfirmAuditorProps { class ConfirmAuditor extends ImplicitStateComponent<ConfirmAuditorProps> { private addDone: StateHolder<boolean> = this.makeState(false); - constructor() { - super(); + constructor(props: ConfirmAuditorProps) { + super(props); } async add() { diff --git a/src/webex/pages/auditors.tsx b/src/webex/pages/auditors.tsx index 8850cdd87..9d57218ad 100644 --- a/src/webex/pages/auditors.tsx +++ b/src/webex/pages/auditors.tsx @@ -39,9 +39,9 @@ interface CurrencyListState { currencies?: CurrencyRecord[]; } -class CurrencyList extends React.Component<any, CurrencyListState> { - constructor() { - super(); +class CurrencyList extends React.Component<{}, CurrencyListState> { + constructor(props: {}) { + super(props); const port = chrome.runtime.connect(); port.onMessage.addListener((msg: any) => { if (msg.notify) { diff --git a/src/webex/pages/confirm-contract.tsx b/src/webex/pages/confirm-contract.tsx index f2e22bec4..e41b0a1df 100644 --- a/src/webex/pages/confirm-contract.tsx +++ b/src/webex/pages/confirm-contract.tsx @@ -118,8 +118,8 @@ interface ContractPromptState { } class ContractPrompt extends React.Component<ContractPromptProps, ContractPromptState> { - constructor() { - super(); + constructor(props: ContractPromptProps) { + super(props); this.state = { alreadyPaid: false, error: null, diff --git a/src/webex/pages/logs.tsx b/src/webex/pages/logs.tsx index 2853b2a06..c4fe670a2 100644 --- a/src/webex/pages/logs.tsx +++ b/src/webex/pages/logs.tsx @@ -55,9 +55,9 @@ interface LogsState { logs: LogEntry[]|undefined; } -class Logs extends React.Component<any, LogsState> { - constructor() { - super(); +class Logs extends React.Component<{}, LogsState> { + constructor(props: {}) { + super({}); this.update(); this.state = {} as any; } diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx index c2a092460..a380a33d0 100644 --- a/src/webex/pages/payback.tsx +++ b/src/webex/pages/payback.tsx @@ -38,10 +38,10 @@ import { import * as React from "react"; import * as ReactDOM from "react-dom"; -class Payback extends ImplicitStateComponent<any> { +class Payback extends ImplicitStateComponent<{}> { private reserves: StateHolder<ReserveRecord[]|null> = this.makeState(null); - constructor() { - super(); + constructor(props: {}) { + super(props); const port = chrome.runtime.connect(); port.onMessage.addListener((msg: any) => { if (msg.notify) { diff --git a/src/webex/pages/return-coins.tsx b/src/webex/pages/return-coins.tsx index 453ae4784..5bcb2252a 100644 --- a/src/webex/pages/return-coins.tsx +++ b/src/webex/pages/return-coins.tsx @@ -189,9 +189,9 @@ interface ReturnCoinsState { lastConfirmedDetail: SelectedDetail | undefined; } -class ReturnCoins extends React.Component<any, ReturnCoinsState> { - constructor() { - super(); +class ReturnCoins extends React.Component<{}, ReturnCoinsState> { + constructor(props: {}) { + super(props); const port = chrome.runtime.connect(); port.onMessage.addListener((msg: any) => { if (msg.notify) { diff --git a/src/webex/pages/tree.tsx b/src/webex/pages/tree.tsx index c8035c597..2ac0b8631 100644 --- a/src/webex/pages/tree.tsx +++ b/src/webex/pages/tree.tsx @@ -360,9 +360,9 @@ interface ExchangesListState { exchanges?: ExchangeRecord[]; } -class ExchangesList extends React.Component<any, ExchangesListState> { - constructor() { - super(); +class ExchangesList extends React.Component<{}, ExchangesListState> { + constructor(props: {}) { + super(props); const port = chrome.runtime.connect(); port.onMessage.addListener((msg: any) => { if (msg.notify) { diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts index a17f516a8..fd5df7e47 100644 --- a/src/webex/wxBackend.ts +++ b/src/webex/wxBackend.ts @@ -497,9 +497,8 @@ function handleBankRequest(wallet: Wallet, headerList: chrome.webRequest.HttpHea console.log("202 not understood (X-Taler-Callback-Url missing)"); return; } - let amountParsed; try { - amountParsed = JSON.parse(amount); + JSON.parse(amount); } catch (e) { const errUri = new URI(chrome.extension.getURL("/src/webex/pages/error.html")); const p = { |