gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated (ac60a055 -> e2639070)


From: gnunet
Subject: [taler-wallet-core] branch master updated (ac60a055 -> e2639070)
Date: Wed, 19 Jan 2022 17:52:14 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a change to branch master
in repository wallet-core.

    from ac60a055 forcing update when querying the terms, and fixing bug in 
request header parsing
     new a01ad475 header rendering
     new e2639070 fix #4880

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 packages/taler-wallet-webextension/package.json    |   4 +--
 .../src/NavigationBar.tsx                          |  27 ++++++----------
 .../src/cta/Pay.stories.tsx                        |  36 +++++++++++++++++++++
 packages/taler-wallet-webextension/src/cta/Pay.tsx |  31 ++++++++++++++++++
 .../src/popupEntryPoint.tsx                        |  14 +++++---
 .../src/walletEntryPoint.tsx                       |  15 +++++++--
 .../taler-wallet-webextension/static-dev/beer.png  | Bin 0 -> 52778 bytes
 pnpm-lock.yaml                                     |   2 +-
 8 files changed, 102 insertions(+), 27 deletions(-)
 create mode 100644 packages/taler-wallet-webextension/static-dev/beer.png

diff --git a/packages/taler-wallet-webextension/package.json 
b/packages/taler-wallet-webextension/package.json
index 9b02eee2..900fb2ab 100644
--- a/packages/taler-wallet-webextension/package.json
+++ b/packages/taler-wallet-webextension/package.json
@@ -23,7 +23,7 @@
     "date-fns": "^2.28.0",
     "history": "4.10.1",
     "preact": "^10.5.13",
-    "preact-router": "^3.2.1",
+    "preact-router": "3.2.1",
     "qrcode-generator": "^1.4.4",
     "tslib": "^2.3.1"
   },
@@ -74,4 +74,4 @@
     ],
     "exclude": []
   }
-}
+}
\ No newline at end of file
diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx 
b/packages/taler-wallet-webextension/src/NavigationBar.tsx
index 44e8af78..a2579085 100644
--- a/packages/taler-wallet-webextension/src/NavigationBar.tsx
+++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx
@@ -26,21 +26,20 @@
  */
 import { i18n } from "@gnu-taler/taler-util";
 import { ComponentChildren, h, VNode } from "preact";
-import Match from "preact-router/match";
 import { PopupNavigation } from "./components/styled";
 
 export enum Pages {
   welcome = "/welcome",
   balance = "/balance",
   balance_history = "/balance/history/:currency",
-  manual_withdraw = "/manual-withdraw/:currency?",
-  deposit = "/deposit/:currency",
+  manual_withdraw = "/balance/manual-withdraw/:currency?",
+  deposit = "/balance/deposit/:currency",
+  transaction = "/balance/transaction/:tid",
   settings = "/settings",
   dev = "/dev",
   cta = "/cta/:action",
   backup = "/backup",
   last_activity = "/last-activity",
-  transaction = "/transaction/:tid",
   provider_detail = "/provider/:pid",
   provider_add = "/provider/add",
   exchange_add = "/exchange/add",
@@ -73,7 +72,13 @@ function Tab(props: TabProps): VNode {
   );
 }
 
-export function NavBar({ devMode, path }: { path: string; devMode: boolean }) {
+export function NavBar({
+  devMode,
+  path,
+}: {
+  path: string;
+  devMode: boolean;
+}): VNode {
   return (
     <PopupNavigation devMode={devMode}>
       <div>
@@ -89,15 +94,3 @@ export function NavBar({ devMode, path }: { path: string; 
devMode: boolean }) {
     </PopupNavigation>
   );
 }
-
-export function WalletNavBar({ devMode }: { devMode: boolean }) {
-  // const { devMode } = useDevContext();
-  return (
-    <Match>
-      {({ path }: any) => {
-        console.log("path", path);
-        return <NavBar devMode={devMode} path={path} />;
-      }}
-    </Match>
-  );
-}
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx 
b/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
index a1288c33..20c3b717 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.stories.tsx
@@ -106,6 +106,42 @@ export const PaymentPossibleWithFee = 
createExample(TestedComponent, {
   },
 });
 
+import beer from "../../static-dev/beer.png";
+
+export const TicketWithAProductList = createExample(TestedComponent, {
+  uri: 
"taler://pay/merchant-backend.taler/2021.242-01G2X4275RBWG/?c=66BE594PDZR24744J6EQK52XM0",
+  payStatus: {
+    status: PreparePayResultType.PaymentPossible,
+    amountEffective: "USD:10",
+    amountRaw: "USD:10",
+    noncePriv: "",
+    contractTerms: {
+      nonce: "123213123",
+      merchant: {
+        name: "someone",
+      },
+      amount: "USD:10",
+      products: [
+        {
+          description: "beer",
+          price: "USD:1",
+          quantity: 10,
+          image: beer,
+        },
+        {
+          description: "brown beer",
+          price: "USD:2",
+          quantity: 10,
+          image: beer,
+        },
+      ],
+      summary: "some beers",
+    } as Partial<ContractTerms> as any,
+    contractTermsHash: "123456",
+    proposalId: "proposal1234",
+  },
+});
+
 export const AlreadyConfirmedWithFullfilment = createExample(TestedComponent, {
   payStatus: {
     status: PreparePayResultType.AlreadyConfirmed,
diff --git a/packages/taler-wallet-webextension/src/cta/Pay.tsx 
b/packages/taler-wallet-webextension/src/cta/Pay.tsx
index e61d3a9d..6e73b556 100644
--- a/packages/taler-wallet-webextension/src/cta/Pay.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Pay.tsx
@@ -36,6 +36,7 @@ import {
   NotificationType,
   PreparePayResult,
   PreparePayResultType,
+  Product,
 } from "@gnu-taler/taler-util";
 import { OperationFailedError } from "@gnu-taler/taler-wallet-core";
 import { Fragment, h, VNode } from "preact";
@@ -48,6 +49,7 @@ import {
   ButtonSuccess,
   ErrorBox,
   LinkSuccess,
+  SmallLightText,
   SuccessBox,
   WalletAction,
   WarningBox,
@@ -240,6 +242,7 @@ export function PaymentRequestView({
       payStatus.status !== PreparePayResultType.AlreadyConfirmed
         ? `${uri}&n=${payStatus.noncePriv}`
         : uri;
+    if (!uri) return <Fragment />;
     return (
       <section>
         <LinkSuccess upperCased onClick={() => setShowQR((qr) => !qr)}>
@@ -383,12 +386,40 @@ export function PaymentRequestView({
             kind="neutral"
           />
         )}
+        {contractTerms.products && (
+          <ProductList products={contractTerms.products} />
+        )}
       </section>
       <ButtonsSection />
     </WalletAction>
   );
 }
 
+function ProductList({ products }: { products: Product[] }): VNode {
+  return (
+    <Fragment>
+      <SmallLightText style={{ margin: ".5em" }}>
+        List of products
+      </SmallLightText>
+      <dl>
+        {products.map((p, i) => (
+          <div key={i} style={{ display: "flex", textAlign: "left" }}>
+            <div>
+              <img src={p.image} style={{ width: 32, height: 32 }} />
+            </div>
+            <div>
+              <dt>{p.description}</dt>
+              <dd>
+                {p.price} x {p.quantity} {p.unit ? `(${p.unit})` : ``}
+              </dd>
+            </div>
+          </div>
+        ))}
+      </dl>
+    </Fragment>
+  );
+}
+
 function amountToString(text: AmountLike): string {
   const aj = Amounts.jsonifyAmount(text);
   const amount = Amounts.stringifyValue(aj, 2);
diff --git a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx 
b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
index 5cd68b9b..ecb49b01 100644
--- a/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
+++ b/packages/taler-wallet-webextension/src/popupEntryPoint.tsx
@@ -29,7 +29,7 @@ import { PopupBox } from "./components/styled";
 import { DevContextProvider } from "./context/devContext";
 import { useTalerActionURL } from "./hooks/useTalerActionURL";
 import { strings } from "./i18n/strings";
-import { Pages, WalletNavBar } from "./NavigationBar";
+import { NavBar, Pages } from "./NavigationBar";
 import { BackupPage } from "./wallet/BackupPage";
 import { BalancePage } from "./popup/BalancePage";
 import { DeveloperPage } from "./popup/DeveloperPage";
@@ -40,6 +40,7 @@ import { TalerActionFound } from "./popup/TalerActionFound";
 import { ExchangeAddPage } from "./wallet/ExchangeAddPage";
 import { IoCProviderForRuntime } from "./context/iocContext";
 import { LastActivityPage } from "./wallet/LastActivityPage";
+import { Match } from "preact-router/match";
 
 function main(): void {
   try {
@@ -75,16 +76,21 @@ function CheckTalerActionComponent(): VNode {
   return <Fragment />;
 }
 
-function Application() {
+function Application(): VNode {
+  const hash_history = createHashHistory();
   return (
     // <div>
     <DevContextProvider>
       {({ devMode }: { devMode: boolean }) => (
         <IoCProviderForRuntime>
-          <WalletNavBar devMode={devMode} />
+          <Match>
+            {({ path }: { path: string }) => (
+              <NavBar devMode={devMode} path={path} />
+            )}
+          </Match>
           <CheckTalerActionComponent />
           <PopupBox devMode={devMode}>
-            <Router history={createHashHistory()}>
+            <Router history={hash_history}>
               <Route path={Pages.dev} component={DeveloperPage} />
 
               <Route
diff --git a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx 
b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
index b54d49de..978d6fde 100644
--- a/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
+++ b/packages/taler-wallet-webextension/src/walletEntryPoint.tsx
@@ -24,6 +24,7 @@ import { setupI18n } from "@gnu-taler/taler-util";
 import { createHashHistory } from "history";
 import { h, render, VNode } from "preact";
 import Router, { route, Route } from "preact-router";
+import Match from "preact-router/match";
 import { useEffect, useState } from "preact/hooks";
 import { LogoHeader } from "./components/LogoHeader";
 import { SuccessBox, WalletBox } from "./components/styled";
@@ -34,7 +35,7 @@ import { RefundPage } from "./cta/Refund";
 import { TipPage } from "./cta/Tip";
 import { WithdrawPage } from "./cta/Withdraw";
 import { strings } from "./i18n/strings";
-import { Pages, WalletNavBar } from "./NavigationBar";
+import { NavBar, Pages } from "./NavigationBar";
 import { DeveloperPage } from "./popup/DeveloperPage";
 import { BackupPage } from "./wallet/BackupPage";
 import { BalancePage } from "./wallet/BalancePage";
@@ -76,20 +77,28 @@ function Application(): VNode {
   const [globalNotification, setGlobalNotification] = useState<
     string | undefined
   >(undefined);
+  const hash_history = createHashHistory();
   return (
     <div>
       <DevContextProvider>
         {({ devMode }: { devMode: boolean }) => (
           <IoCProviderForRuntime>
             <LogoHeader />
-            <WalletNavBar devMode={devMode} />
+            {/* <Match/> won't work in the first render if <Router /> is not 
called first */}
+            {/* https://github.com/preactjs/preact-router/issues/415 */}
+            <Router history={hash_history} />
+            <Match>
+              {({ path }: { path: string }) => (
+                <NavBar devMode={devMode} path={path} />
+              )}
+            </Match>
             <WalletBox>
               {globalNotification && (
                 <SuccessBox onClick={() => setGlobalNotification(undefined)}>
                   <div>{globalNotification}</div>
                 </SuccessBox>
               )}
-              <Router history={createHashHistory()}>
+              <Router history={hash_history}>
                 <Route path={Pages.welcome} component={WelcomePage} />
 
                 <Route
diff --git a/packages/taler-wallet-webextension/static-dev/beer.png 
b/packages/taler-wallet-webextension/static-dev/beer.png
new file mode 100644
index 00000000..1116db7e
Binary files /dev/null and 
b/packages/taler-wallet-webextension/static-dev/beer.png differ
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c3931343..7a2682d7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -352,7 +352,7 @@ importers:
       preact: ^10.5.13
       preact-cli: ^3.0.5
       preact-render-to-string: ^5.1.19
-      preact-router: ^3.2.1
+      preact-router: 3.2.1
       qrcode-generator: ^1.4.4
       rimraf: ^3.0.2
       rollup: ^2.63.0

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]