aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i18n/de.po10
-rw-r--r--src/i18n/en-US.po10
-rw-r--r--src/i18n/fr.po10
-rw-r--r--src/i18n/it.po10
-rw-r--r--src/i18n/sv.po10
-rw-r--r--src/i18n/taler-wallet-webex.pot10
-rw-r--r--src/talerTypes.ts10
-rw-r--r--src/taleruri-test.ts56
-rw-r--r--src/taleruri.ts27
-rw-r--r--src/types-test.ts3
-rw-r--r--src/wallet.ts53
-rw-r--r--src/walletTypes.ts4
-rw-r--r--src/webex/background.ts2
-rw-r--r--src/webex/pages/pay.tsx14
-rw-r--r--src/webex/pages/tip.tsx2
-rw-r--r--src/webex/wxApi.ts1
-rw-r--r--src/webex/wxBackend.ts19
17 files changed, 181 insertions, 70 deletions
diff --git a/src/i18n/de.po b/src/i18n/de.po
index 7358c5507..0181420ae 100644
--- a/src/i18n/de.po
+++ b/src/i18n/de.po
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, fuzzy, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr "Der Händler %1$s möchte einen Vertrag über %2$s mit Ihnen abschließen."
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr ""
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, c-format
msgid "The total price is %1$s."
msgstr ""
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, fuzzy, c-format
msgid "Confirm payment"
msgstr "Bezahlung bestätigen"
diff --git a/src/i18n/en-US.po b/src/i18n/en-US.po
index 508a1f1f9..fd4a9c983 100644
--- a/src/i18n/en-US.po
+++ b/src/i18n/en-US.po
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr ""
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr ""
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, c-format
msgid "The total price is %1$s."
msgstr ""
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, c-format
msgid "Confirm payment"
msgstr ""
diff --git a/src/i18n/fr.po b/src/i18n/fr.po
index 56eee1dd4..bbc02869a 100644
--- a/src/i18n/fr.po
+++ b/src/i18n/fr.po
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr ""
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr ""
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, c-format
msgid "The total price is %1$s."
msgstr ""
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, c-format
msgid "Confirm payment"
msgstr ""
diff --git a/src/i18n/it.po b/src/i18n/it.po
index 56eee1dd4..bbc02869a 100644
--- a/src/i18n/it.po
+++ b/src/i18n/it.po
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr ""
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr ""
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, c-format
msgid "The total price is %1$s."
msgstr ""
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, c-format
msgid "Confirm payment"
msgstr ""
diff --git a/src/i18n/sv.po b/src/i18n/sv.po
index c1c0d4560..dd546b77c 100644
--- a/src/i18n/sv.po
+++ b/src/i18n/sv.po
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, fuzzy, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr "Säljaren %1$s erbjuder följande:"
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, fuzzy, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr "Det totala priset är %1$s (plus %2$s avgifter).\n"
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, fuzzy, c-format
msgid "The total price is %1$s."
msgstr "Det totala priset är %1$s."
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, c-format
msgid "Confirm payment"
msgstr "Godkän betalning"
diff --git a/src/i18n/taler-wallet-webex.pot b/src/i18n/taler-wallet-webex.pot
index 56eee1dd4..bbc02869a 100644
--- a/src/i18n/taler-wallet-webex.pot
+++ b/src/i18n/taler-wallet-webex.pot
@@ -37,27 +37,27 @@ msgstr ""
msgid "time (ms/op)"
msgstr ""
-#: src/webex/pages/pay.tsx:113
+#: src/webex/pages/pay.tsx:118
#, c-format
msgid "The merchant %1$s offers you to purchase:"
msgstr ""
-#: src/webex/pages/pay.tsx:119
+#: src/webex/pages/pay.tsx:124
#, c-format
msgid "The total price is %1$s (plus %2$s fees)."
msgstr ""
-#: src/webex/pages/pay.tsx:124
+#: src/webex/pages/pay.tsx:129
#, c-format
msgid "The total price is %1$s."
msgstr ""
-#: src/webex/pages/pay.tsx:138
+#: src/webex/pages/pay.tsx:149
#, c-format
msgid "Retry"
msgstr ""
-#: src/webex/pages/pay.tsx:146
+#: src/webex/pages/pay.tsx:158
#, c-format
msgid "Confirm payment"
msgstr ""
diff --git a/src/talerTypes.ts b/src/talerTypes.ts
index 73b97c93d..ebb13f4a5 100644
--- a/src/talerTypes.ts
+++ b/src/talerTypes.ts
@@ -388,6 +388,12 @@ export class ContractTerms {
@Checkable.String(timestampCheck)
refund_deadline: string;
+ /**
+ * Deadline for the wire transfer.
+ */
+ @Checkable.String(timestampCheck)
+ wire_transfer_deadline: string;
+
/**
* Time when the contract was generated by the merchant.
*/
@@ -402,10 +408,10 @@ export class ContractTerms {
order_id: string;
/**
- * URL to post the payment to.
+ * Base URL of the merchant's backend.
*/
@Checkable.String()
- pay_url: string;
+ merchant_base_url: string;
/**
* Fulfillment URL to view the product or
diff --git a/src/taleruri-test.ts b/src/taleruri-test.ts
index bf4e9d493..360f565f7 100644
--- a/src/taleruri-test.ts
+++ b/src/taleruri-test.ts
@@ -15,7 +15,7 @@
*/
import test from "ava";
-import { parsePayUri, parseWithdrawUri } from "./taleruri";
+import { parsePayUri, parseWithdrawUri, parseRefundUri, parseTipUri } from "./taleruri";
test("taler pay url parsing: http(s)", (t) => {
const url1 = "https://example.com/bar?spam=eggs";
@@ -150,3 +150,57 @@ test("taler withdraw uri parsing", (t) => {
}
t.is(r1.statusUrl, "https://bank.example.com/api/withdraw-operation/12345");
});
+
+
+test("taler refund uri parsing", (t) => {
+ const url1 = "taler://refund/merchant.example.com/-/-/1234";
+ const r1 = parseRefundUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.refundUrl, "https://merchant.example.com/public/refund?order_id=1234");
+});
+
+
+test("taler refund uri parsing with instance", (t) => {
+ const url1 = "taler://refund/merchant.example.com/-/myinst/1234";
+ const r1 = parseRefundUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.refundUrl, "https://merchant.example.com/public/instances/myinst/refund?order_id=1234");
+});
+
+test("taler tip pickup uri", (t) => {
+ const url1 = "taler://tip/merchant.example.com/-/-/tipid";
+ const r1 = parseTipUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.tipPickupUrl, "https://merchant.example.com/public/tip-pickup?tip_id=tipid");
+});
+
+
+test("taler tip pickup uri with instance", (t) => {
+ const url1 = "taler://tip/merchant.example.com/-/tipm/tipid";
+ const r1 = parseTipUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.tipPickupUrl, "https://merchant.example.com/public/instances/tipm/tip-pickup?tip_id=tipid");
+});
+
+
+test("taler tip pickup uri with instance and prefix", (t) => {
+ const url1 = "taler://tip/merchant.example.com/my%2fpfx/tipm/tipid";
+ const r1 = parseTipUri(url1);
+ if (!r1) {
+ t.fail();
+ return;
+ }
+ t.is(r1.tipPickupUrl, "https://merchant.example.com/my/pfx/instances/tipm/tip-pickup?tip_id=tipid");
+});
diff --git a/src/taleruri.ts b/src/taleruri.ts
index 0af5c4c95..c810def29 100644
--- a/src/taleruri.ts
+++ b/src/taleruri.ts
@@ -147,17 +147,18 @@ export function parseTipUri(s: string): TipUriResult | undefined {
}
if (maybePath === "-") {
- maybePath = "public/tip-pickup";
+ maybePath = "public/";
} else {
- maybePath = decodeURIComponent(maybePath);
+ maybePath = decodeURIComponent(maybePath) + "/";
}
- if (maybeInstance === "-") {
- maybeInstance = "default";
+ let maybeInstancePath = "";
+ if (maybeInstance !== "-") {
+ maybeInstancePath = `instances/${maybeInstance}/`;
}
const tipPickupUrl = new URI(
- "https://" + host + "/" + decodeURIComponent(maybePath),
- ).href();
+ "https://" + host + "/" + maybePath + maybeInstancePath + "tip-pickup",
+ ).addQuery({ tip_id: tipId }).href();
return {
tipPickupUrl,
@@ -197,20 +198,20 @@ export function parseRefundUri(s: string): RefundUriResult | undefined {
}
if (maybePath === "-") {
- maybePath = "public/refund";
+ maybePath = "public/";
} else {
- maybePath = decodeURIComponent(maybePath);
+ maybePath = decodeURIComponent(maybePath) + "/";
}
- if (maybeInstance === "-") {
- maybeInstance = "default";
+ let maybeInstancePath = "";
+ if (maybeInstance !== "-") {
+ maybeInstancePath = `instances/${maybeInstance}/`;
}
const refundUrl = new URI(
- "https://" + host + "/" + decodeURIComponent(maybePath),
+ "https://" + host + "/" + maybePath + maybeInstancePath + "refund",
)
- .addQuery({ instance: maybeInstance, order_id: orderId })
+ .addQuery({ order_id: orderId })
.href();
-
return {
refundUrl,
};
diff --git a/src/types-test.ts b/src/types-test.ts
index 51c4d69c7..56a826441 100644
--- a/src/types-test.ts
+++ b/src/types-test.ts
@@ -115,7 +115,8 @@ test("contract terms validation", (t) => {
merchant_pub: "12345",
order_id: "test_order",
pay_deadline: "Date(12346)",
- pay_url: "https://example.com/pay",
+ wire_transfer_deadline: "Date(12346)",
+ merchant_base_url: "https://example.com/pay",
products: [],
refund_deadline: "Date(12345)",
summary: "hello",
diff --git a/src/wallet.ts b/src/wallet.ts
index 25857870c..c73af9062 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -114,6 +114,7 @@ import {
parseTipUri,
parseRefundUri,
} from "./taleruri";
+import { isFirefox } from "./webex/compat";
interface SpeculativePayData {
payCoinInfo: PayCoinInfo;
@@ -965,15 +966,19 @@ export class Wallet {
let resp;
const payReq = { ...purchase.payReq, session_id: sessionId };
+ const payUrl = new URI("pay")
+ .absoluteTo(purchase.contractTerms.merchant_base_url)
+ .href();
+
try {
- resp = await this.http.postJson(purchase.contractTerms.pay_url, payReq);
+ resp = await this.http.postJson(payUrl, payReq);
} catch (e) {
// Gives the user the option to retry / abort and refresh
console.log("payment failed", e);
throw e;
}
const merchantResp = resp.responseJson;
- console.log("got success from pay_url");
+ console.log("got success from pay URL");
const merchantPub = purchase.contractTerms.merchant_pub;
const valid: boolean = await this.cryptoApi.isValidPaymentSignature(
@@ -1923,10 +1928,16 @@ export class Wallet {
!versionMatch.compatible &&
versionMatch.currentCmp === -1
) {
- console.log("wallet version might be outdated, checking for updates");
- chrome.runtime.requestUpdateCheck((status, details) => {
- console.log("update check status:", status);
- });
+ console.warn(
+ `wallet version ${WALLET_PROTOCOL_VERSION} might be outdated (exchange has ${exchangeInfo.protocolVersion}), checking for updates`,
+ );
+ if (isFirefox()) {
+ console.log("skipping update check on Firefox")
+ } else {
+ chrome.runtime.requestUpdateCheck((status, details) => {
+ console.log("update check status:", status);
+ });
+ }
}
}
@@ -2213,6 +2224,9 @@ export class Wallet {
paybackAmount: z,
pendingIncoming: z,
pendingPayment: z,
+ pendingIncomingDirty: z,
+ pendingIncomingRefresh: z,
+ pendingIncomingWithdraw: z,
};
let entryCurr = balance.byCurrency[amount.currency];
if (!entryCurr) {
@@ -2238,6 +2252,7 @@ export class Wallet {
}
if (c.status === CoinStatus.Dirty) {
addTo(balance, "pendingIncoming", c.currentAmount, c.exchangeBaseUrl);
+ addTo(balance, "pendingIncomingDirty", c.currentAmount, c.exchangeBaseUrl);
return balance;
}
return balance;
@@ -2257,6 +2272,7 @@ export class Wallet {
amount = Amounts.add(amount, r.precoin_amount).amount;
if (Amounts.cmp(smallestWithdraw[r.exchange_base_url], amount) < 0) {
addTo(balance, "pendingIncoming", amount, r.exchange_base_url);
+ addTo(balance, "pendingIncomingWithdraw", amount, r.exchange_base_url);
}
return balance;
}
@@ -2284,6 +2300,7 @@ export class Wallet {
return balance;
}
addTo(balance, "pendingIncoming", r.valueOutput, r.exchangeBaseUrl);
+ addTo(balance, "pendingIncomingRefresh", r.valueOutput, r.exchangeBaseUrl);
return balance;
}
@@ -2338,6 +2355,7 @@ export class Wallet {
tx.iter(Stores.reserves).fold(collectPaybacks, balanceStore);
tx.iter(Stores.purchases).fold(collectPayments, balanceStore);
await tx.finish();
+ console.log("computed balances:", balanceStore)
return balanceStore;
}
@@ -2441,9 +2459,12 @@ export class Wallet {
.iter(Stores.refresh)
.toArray();
for (const session of oldRefreshSessions) {
+ if (session.finished) {
+ continue;
+ }
Wallet.enableTracing &&
- console.log("got old refresh session for", oldCoinPub, session);
- return this.continueRefreshSession(session);
+ console.log("waiting for unfinished old refresh session for", oldCoinPub, session);
+ await this.continueRefreshSession(session);
}
const coin = await this.q().get(Stores.coins, oldCoinPub);
if (!coin) {
@@ -2454,6 +2475,7 @@ export class Wallet {
coin.status === CoinStatus.Useless ||
coin.status === CoinStatus.Fresh
) {
+ Wallet.enableTracing && console.log("not refreshing due to coin status", CoinStatus[coin.status])
return;
}
const refreshSession = await this.createRefreshSession(oldCoinPub);
@@ -3032,8 +3054,9 @@ export class Wallet {
merchant: {},
merchant_pub: pub,
order_id: "none",
- pay_deadline: `/Date(${stampSecNow + 60 * 5})/`,
- pay_url: "",
+ pay_deadline: `/Date(${stampSecNow + 30 * 5})/`,
+ wire_transfer_deadline: `/Date(${stampSecNow + 60 * 5})/`,
+ merchant_base_url: "taler://return-to-account",
products: [],
refund_deadline: `/Date(${stampSecNow + 60 * 5})/`,
timestamp: `/Date(${stampSecNow})/`,
@@ -3466,9 +3489,7 @@ export class Wallet {
throw Error("invalid taler://tip URI");
}
- const tipStatusUrl = new URI(res.tipPickupUrl)
- .addQuery({ tip_id: res.tipId })
- .href();
+ const tipStatusUrl = new URI(res.tipPickupUrl).href();
console.log("checking tip status from", tipStatusUrl);
const merchantResp = await this.http.get(tipStatusUrl);
console.log("resp:", merchantResp.responseJson);
@@ -3552,8 +3573,12 @@ export class Wallet {
const abortReq = { ...purchase.payReq, mode: "abort-refund" };
+ const payUrl = new URI("pay")
+ .absoluteTo(purchase.contractTerms.merchant_base_url)
+ .href();
+
try {
- resp = await this.http.postJson(purchase.contractTerms.pay_url, abortReq);
+ resp = await this.http.postJson(payUrl, abortReq);
} catch (e) {
// Gives the user the option to retry / abort and refresh
console.log("aborting payment failed", e);
diff --git a/src/walletTypes.ts b/src/walletTypes.ts
index d29e3812e..fddf05680 100644
--- a/src/walletTypes.ts
+++ b/src/walletTypes.ts
@@ -187,6 +187,10 @@ export interface WalletBalanceEntry {
* Amount that was paid back and we could withdraw again.
*/
paybackAmount: AmountJson;
+
+ pendingIncomingWithdraw: AmountJson;
+ pendingIncomingRefresh: AmountJson;
+ pendingIncomingDirty: AmountJson;
}
/**
diff --git a/src/webex/background.ts b/src/webex/background.ts
index 3c63f323e..dbc540df4 100644
--- a/src/webex/background.ts
+++ b/src/webex/background.ts
@@ -23,7 +23,7 @@
/**
* Imports.
*/
-import {wxMain} from "./wxBackend";
+import { wxMain } from "./wxBackend";
window.addEventListener("load", () => {
wxMain();
diff --git a/src/webex/pages/pay.tsx b/src/webex/pages/pay.tsx
index 579688db3..7f2a174b7 100644
--- a/src/webex/pages/pay.tsx
+++ b/src/webex/pages/pay.tsx
@@ -53,6 +53,11 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
return <span>Loading payment information ...</span>;
}
+ let insufficientBalance = false;
+ if (payStatus.status == "insufficient-balance") {
+ insufficientBalance = true;
+ }
+
if (payStatus.status === "error") {
return <span>Error: {payStatus.error}</span>;
}
@@ -93,7 +98,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
const doPayment = async () => {
if (payStatus.status !== "payment-possible") {
- throw Error("invalid state");
+ throw Error(`invalid state: ${payStatus.status}`);
}
const proposalId = payStatus.proposalId;
setNumTries(numTries + 1);
@@ -128,6 +133,12 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
)}
</p>
+ {insufficientBalance ? (
+ <div>
+ <p style={{color: "red", fontWeight: "bold"}}>Unable to pay: Your balance is insufficient.</p>
+ </div>
+ ) : null}
+
{payErrMsg ? (
<div>
<p>Payment failed: {payErrMsg}</p>
@@ -142,6 +153,7 @@ function TalerPayDialog({ talerPayUri }: { talerPayUri: string }) {
<div>
<ProgressButton
loading={loading}
+ disabled={insufficientBalance}
onClick={() => doPayment()}>
{i18n.str`Confirm payment`}
</ProgressButton>
diff --git a/src/webex/pages/tip.tsx b/src/webex/pages/tip.tsx
index 0a066053b..148b8203c 100644
--- a/src/webex/pages/tip.tsx
+++ b/src/webex/pages/tip.tsx
@@ -88,7 +88,7 @@ function TipDisplay(props: { talerTipUri: string }) {
</p>
<form className="pure-form">
<ProgressButton loading={loading} onClick={() => accept()}>
- AcceptTip
+ Accept Tip
</ProgressButton>
{" "}
<button className="pure-button" type="button" onClick={() => discard()}>
diff --git a/src/webex/wxApi.ts b/src/webex/wxApi.ts
index 65c14ac48..39c31ca51 100644
--- a/src/webex/wxApi.ts
+++ b/src/webex/wxApi.ts
@@ -86,6 +86,7 @@ async function callBackend<T extends MessageType>(
return new Promise<MessageMap[T]["response"]>((resolve, reject) => {
chrome.runtime.sendMessage({ type, detail }, (resp) => {
if (typeof resp === "object" && resp && resp.error) {
+ console.warn("response error:", resp)
const e = new WalletApiError(resp.error.message, resp.error);
reject(e);
} else {
diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts
index 564ee24f0..16cd2a78c 100644
--- a/src/webex/wxBackend.ts
+++ b/src/webex/wxBackend.ts
@@ -547,19 +547,26 @@ function injectScript(
});
}
-/**
- * Main function to run for the WebExtension backend.
- *
- * Sets up all event handlers and other machinery.
- */
-export async function wxMain() {
+try {
+ // This needs to be outside of main, as Firefox won't fire the event if
+ // the listener isn't created synchronously on loading the backend.
chrome.runtime.onInstalled.addListener(details => {
+ console.log("onInstalled with reason", details.reason);
if (details.reason === "install") {
const url = chrome.extension.getURL("/src/webex/pages/welcome.html");
chrome.tabs.create({ active: true, url: url });
}
});
+} catch (e) {
+ console.error(e);
+}
+/**
+ * Main function to run for the WebExtension backend.
+ *
+ * Sets up all event handlers and other machinery.
+ */
+export async function wxMain() {
// Explicitly unload the extension page as soon as an update is available,
// so the update gets installed as soon as possible.
chrome.runtime.onUpdateAvailable.addListener(details => {