From 2779086a32a62d6d16b7813c2ca4944dc02c4d93 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Mon, 26 Jun 2023 14:23:32 -0300
Subject: support for exchange-withdraw call to action, pending use case when
 the user need to specify the amount

---
 packages/taler-wallet-webextension/src/NavigationBar.tsx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'packages/taler-wallet-webextension/src/NavigationBar.tsx')

diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index dd2d31c3d..231418861 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -84,7 +84,7 @@ function pageDefinition<T extends object>(pattern: string): PageLocation<T> {
     return { ...prev, [name]: cur };
   }, {} as Record<string, string>);
 
-  const f = (values: T): string => replaceAll(pattern, vars, values);
+  const f = (values: T): string => replaceAll(pattern, vars, values ?? {});
   f.pattern = pattern;
   return f;
 }
@@ -152,6 +152,7 @@ const talerUriActionToPageName: {
   [TalerUriAction.PayPush]: "ctaTransferPickup",
   [TalerUriAction.Restore]: "ctaRecovery",
   [TalerUriAction.PayTemplate]: "ctaPayTemplate",
+  [TalerUriAction.WithdrawExchange]: "ctaWithdrawManual",
   [TalerUriAction.DevExperiment]: undefined,
   [TalerUriAction.Exchange]: undefined,
   [TalerUriAction.Auditor]: undefined,
@@ -166,7 +167,11 @@ export function getPathnameForTalerURI(talerUri: string): string | undefined {
   if (!pageName) {
     return undefined;
   }
-  return `${Pages[pageName]}?talerUri=${encodeURIComponent(talerUri)}`;
+  const pageString: string =
+    typeof Pages[pageName] === "function"
+      ? (Pages[pageName] as any)()
+      : Pages[pageName];
+  return `${pageString}?talerUri=${encodeURIComponent(talerUri)}`;
 }
 
 export type PopupNavBarOptions = "balance" | "backup" | "dev";
-- 
cgit v1.2.3

