summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/popup
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-05-02 09:56:44 -0300
committerSebastian <sebasjm@gmail.com>2023-05-02 09:57:12 -0300
commita957e61a9ca05c35e6f40697a343f8c815b6edea (patch)
tree54f8a83831c6949aabbc785c455c7264d8c086b4 /packages/taler-wallet-webextension/src/popup
parent23fca6d8677a1e88dad426691fbe1033595f16a3 (diff)
downloadwallet-core-a957e61a9ca05c35e6f40697a343f8c815b6edea.tar.gz
wallet-core-a957e61a9ca05c35e6f40697a343f8c815b6edea.tar.bz2
wallet-core-a957e61a9ca05c35e6f40697a343f8c815b6edea.zip
fix #7828
Diffstat (limited to 'packages/taler-wallet-webextension/src/popup')
-rw-r--r--packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx61
1 files changed, 31 insertions, 30 deletions
diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx
index b7984e4b8..ffd883098 100644
--- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx
+++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx
@@ -19,10 +19,10 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
-import { classifyTalerUri, TalerUriType } from "@gnu-taler/taler-util";
+import { parseTalerUri, TalerUri, TalerUriAction } from "@gnu-taler/taler-util";
+import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
import { Fragment, h, VNode } from "preact";
import { Title } from "../components/styled/index.js";
-import { useTranslationContext } from "@gnu-taler/web-util/lib/index.browser";
import { Button } from "../mui/Button.js";
import { platform } from "../platform/foreground.js";
@@ -32,15 +32,15 @@ export interface Props {
}
function ContentByUriType({
- type,
+ uri,
onConfirm,
}: {
- type: TalerUriType;
+ uri: TalerUri;
onConfirm: () => Promise<void>;
}) {
const { i18n } = useTranslationContext();
- switch (type) {
- case TalerUriType.TalerWithdraw:
+ switch (uri.type) {
+ case TalerUriAction.Withdraw:
return (
<div>
<p>
@@ -52,8 +52,8 @@ function ContentByUriType({
</div>
);
- case TalerUriType.TalerPayTemplate:
- case TalerUriType.TalerPay:
+ case TalerUriAction.PayTemplate:
+ case TalerUriAction.Pay:
return (
<div>
<p>
@@ -64,7 +64,7 @@ function ContentByUriType({
</Button>
</div>
);
- case TalerUriType.TalerTip:
+ case TalerUriAction.Tip:
return (
<div>
<p>
@@ -76,7 +76,7 @@ function ContentByUriType({
</div>
);
- case TalerUriType.TalerRefund:
+ case TalerUriAction.Refund:
return (
<div>
<p>
@@ -88,34 +88,25 @@ function ContentByUriType({
</div>
);
- case TalerUriType.TalerDevExperiment:
- case TalerUriType.TalerTemplate:
- case TalerUriType.TalerPayPull:
- case TalerUriType.TalerPayPush:
- case TalerUriType.TalerRecovery:
- case TalerUriType.Unknown:
- return (
- <div>
- <p>
- <i18n.Translate>
- This page has a malformed taler uri.
- </i18n.Translate>
- </p>
- </div>
- );
-
+ case TalerUriAction.DevExperiment:
+ case TalerUriAction.PayPull:
+ case TalerUriAction.PayPush:
+ case TalerUriAction.Restore:
+ case TalerUriAction.Auditor:
+ case TalerUriAction.Exchange:
+ return null;
default: {
- const error: never = type;
+ const error: never = uri;
return null;
}
}
}
export function TalerActionFound({ url, onDismiss }: Props): VNode {
- const uriType = classifyTalerUri(url);
+ const talerUri = parseTalerUri(url);
const { i18n } = useTranslationContext();
async function redirectToWallet(): Promise<void> {
- platform.openWalletURIFromPopup(url);
+ platform.openWalletURIFromPopup(talerUri!);
}
return (
<Fragment>
@@ -123,7 +114,17 @@ export function TalerActionFound({ url, onDismiss }: Props): VNode {
<Title>
<i18n.Translate>Taler Action</i18n.Translate>
</Title>
- <ContentByUriType type={uriType} onConfirm={redirectToWallet} />
+ {!talerUri ? (
+ <div>
+ <p>
+ <i18n.Translate>
+ This page has a malformed taler uri.
+ </i18n.Translate>
+ </p>
+ </div>
+ ) : (
+ <ContentByUriType uri={talerUri} onConfirm={redirectToWallet} />
+ )}
</section>
<footer>
<div />