some fixes

This commit is contained in:
Sebastian 2023-04-13 15:04:31 -03:00
parent 9ef5a4931e
commit 30c01185fc
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 10 additions and 3 deletions

View File

@ -23,6 +23,9 @@
], ],
"web_accessible_resources": [ "web_accessible_resources": [
"static/wallet.html", "static/wallet.html",
"dist/taler-wallet-interaction-loader.js.map",
"dist/taler-wallet-interaction-loader.js",
"dist/taler-wallet-interaction-support.js.map",
"dist/taler-wallet-interaction-support.js" "dist/taler-wallet-interaction-support.js"
], ],
"optional_permissions": [ "optional_permissions": [

View File

@ -38,6 +38,9 @@
{ {
"resources": [ "resources": [
"static/wallet.html", "static/wallet.html",
"dist/taler-wallet-interaction-loader.js.map",
"dist/taler-wallet-interaction-loader.js",
"dist/taler-wallet-interaction-support.js.map",
"dist/taler-wallet-interaction-support.js" "dist/taler-wallet-interaction-support.js"
], ],
"matches": [ "matches": [

View File

@ -62,7 +62,7 @@ interface API {
} }
interface TalerSupport { interface TalerSupport {
info: Readonly<Info>; info: Readonly<Info>;
api: API; __internal: API;
} }
function buildApi(config: Readonly<Info>): API { function buildApi(config: Readonly<Info>): API {
@ -161,6 +161,7 @@ function buildApi(config: Readonly<Info>): API {
function start() { function start() {
if (shouldNotRun) return; if (shouldNotRun) return;
// FIXME: we can remove this if the script caller send information we need
if (!(document.currentScript instanceof HTMLScriptElement)) return; if (!(document.currentScript instanceof HTMLScriptElement)) return;
const url = new URL(document.currentScript.src); const url = new URL(document.currentScript.src);
@ -178,14 +179,14 @@ function start() {
}); });
const taler: TalerSupport = { const taler: TalerSupport = {
info, info,
api: buildApi(info), __internal: buildApi(info),
}; };
//@ts-ignore //@ts-ignore
window.taler = taler; window.taler = taler;
//default behavior: register on install //default behavior: register on install
taler.api.registerProtocolHandler(); taler.__internal.registerProtocolHandler();
} }
// utils functions // utils functions