gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: fix #8358


From: gnunet
Subject: [taler-wallet-core] branch master updated: fix #8358
Date: Fri, 29 Mar 2024 21:26:12 +0100

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

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

The following commit(s) were added to refs/heads/master by this push:
     new fdce0509a fix #8358
fdce0509a is described below

commit fdce0509a0f78d18fe5296cd1dda4a63b15daf5d
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Fri Mar 29 17:26:04 2024 -0300

    fix #8358
---
 packages/merchant-backoffice-ui/src/Routing.tsx    | 82 ++++++++++++++++------
 .../merchant-backoffice-ui/src/hooks/preference.ts |  3 +
 .../src/paths/admin/create/CreatePage.tsx          |  2 +-
 .../src/paths/settings/index.tsx                   |  1 +
 4 files changed, 64 insertions(+), 24 deletions(-)

diff --git a/packages/merchant-backoffice-ui/src/Routing.tsx 
b/packages/merchant-backoffice-ui/src/Routing.tsx
index c30b1912a..06701b513 100644
--- a/packages/merchant-backoffice-ui/src/Routing.tsx
+++ b/packages/merchant-backoffice-ui/src/Routing.tsx
@@ -122,7 +122,7 @@ export enum InstancePaths {
 }
 
 // eslint-disable-next-line @typescript-eslint/no-empty-function
-const noop = () => {};
+const noop = () => { };
 
 export enum AdminPaths {
   list_instances = "/instances",
@@ -130,7 +130,7 @@ export enum AdminPaths {
   update_instance = "/instance/:id/update",
 }
 
-export interface Props {}
+export interface Props { }
 
 export const privatePages = {
   home: urlPattern(/\/home/, () => "#/home"),
@@ -153,11 +153,17 @@ export function Routing(_p: Props): VNode {
     useState<GlobalNotifState>(undefined);
 
   const [error] = useErrorBoundary();
+  const [preference] = usePreference();
+
+  const now = AbsoluteTime.now();
 
   const instance = useInstanceBankAccounts();
   const accounts = !instance.ok ? undefined : instance.data.accounts;
   const shouldWarnAboutMissingBankAccounts =
-    !state.isAdmin && accounts !== undefined && accounts.length < 1;
+    !state.isAdmin && accounts !== undefined && accounts.length < 1 &&
+    (AbsoluteTime.isNever(preference.hideMissingAccountUntil) ||
+      AbsoluteTime.cmp(now, preference.hideMissingAccountUntil) > 1);
+  ;
   const shouldLogin =
     state.status === "loggedOut" || state.status === "expired";
 
@@ -245,14 +251,10 @@ export function Routing(_p: Props): VNode {
     return (
       <Fragment>
         <Menu />
-        <NotificationCard
-          notification={{
-            type: "INFO",
-            message: i18n.str`You need to associate a bank account to receive 
revenue.`,
-            description: i18n.str`Without this the merchant backend will 
refuse to create new orders.`,
-          }}
-        />
-        <BankAccountCreatePage onConfirm={() => {}} />
+        <BankAccountBanner />
+        <BankAccountCreatePage onConfirm={() => {
+          route(InstancePaths.bank_list);
+        }} />
       </Fragment>
     );
   }
@@ -682,20 +684,20 @@ function AdminInstanceUpdatePage({
           const notif =
             error.type === ErrorType.TIMEOUT
               ? {
-                  message: i18n.str`The request to the backend take too long 
and was cancelled`,
-                  description: i18n.str`Diagnostic from ${error.info.url} is 
'${error.message}'`,
-                  type: "ERROR" as const,
-                }
+                message: i18n.str`The request to the backend take too long and 
was cancelled`,
+                description: i18n.str`Diagnostic from ${error.info.url} is 
'${error.message}'`,
+                type: "ERROR" as const,
+              }
               : {
-                  message: i18n.str`The backend reported a problem: HTTP 
status #${error.status}`,
-                  description: i18n.str`Diagnostic from ${error.info.url} is 
'${error.message}'`,
-                  details:
-                    error.type === ErrorType.CLIENT ||
+                message: i18n.str`The backend reported a problem: HTTP status 
#${error.status}`,
+                description: i18n.str`Diagnostic from ${error.info.url} is 
'${error.message}'`,
+                details:
+                  error.type === ErrorType.CLIENT ||
                     error.type === ErrorType.SERVER
-                      ? error.payload.hint
-                      : undefined,
-                  type: "ERROR" as const,
-                };
+                    ? error.payload.hint
+                    : undefined,
+                type: "ERROR" as const,
+              };
           return (
             <Fragment>
               <NotificationCard notification={notif} />
@@ -722,6 +724,40 @@ function AdminInstanceUpdatePage({
   );
 }
 
+function BankAccountBanner(): VNode {
+  const { i18n } = useTranslationContext();
+
+  const [_, updatePref] = usePreference();
+  const now = AbsoluteTime.now();
+  const oneDay = { d_ms: 1000 * 60 * 60 * 24 };
+  const tomorrow = AbsoluteTime.addDuration(now, oneDay);
+
+  return (
+    <NotificationCard
+      notification={{
+        type: "INFO",
+        message: i18n.str`You need to associate a bank account to receive 
revenue.`,
+        description: (
+          <div>
+            <p>
+              <i18n.Translate>Without this the merchant backend will refuse to 
create new orders.</i18n.Translate>
+            </p>
+            <div class="buttons is-right">
+              <button
+                class="button"
+                onClick={() => updatePref("hideMissingAccountUntil", tomorrow)}
+              >
+                <i18n.Translate>Hide for today</i18n.Translate>
+              </button>
+            </div>
+          </div>
+        ),
+      }}
+    />
+  )
+}
+
+
 function KycBanner(): VNode {
   const kycStatus = useInstanceKYCDetails();
   const { i18n } = useTranslationContext();
diff --git a/packages/merchant-backoffice-ui/src/hooks/preference.ts 
b/packages/merchant-backoffice-ui/src/hooks/preference.ts
index 5a50eb378..a21d2921c 100644
--- a/packages/merchant-backoffice-ui/src/hooks/preference.ts
+++ b/packages/merchant-backoffice-ui/src/hooks/preference.ts
@@ -28,12 +28,14 @@ import { buildStorageKey, useLocalStorage } from 
"@gnu-taler/web-util/browser";
 export interface Preferences {
   advanceOrderMode: boolean;
   hideKycUntil: AbsoluteTime;
+  hideMissingAccountUntil: AbsoluteTime;
   dateFormat: "ymd" | "dmy" | "mdy";
 }
 
 const defaultSettings: Preferences = {
   advanceOrderMode: false,
   hideKycUntil: AbsoluteTime.never(),
+  hideMissingAccountUntil: AbsoluteTime.never(),
   dateFormat: "ymd",
 };
 
@@ -41,6 +43,7 @@ export const codecForPreferences = (): Codec<Preferences> =>
   buildCodecForObject<Preferences>()
     .property("advanceOrderMode", codecForBoolean())
     .property("hideKycUntil", codecForAbsoluteTime)
+    .property("hideMissingAccountUntil", codecForAbsoluteTime)
     .property(
       "dateFormat",
       codecForEither(
diff --git 
a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx 
b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx
index d53d93e8b..731ea8939 100644
--- a/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/admin/create/CreatePage.tsx
@@ -123,7 +123,7 @@ export function CreatePage({ onCreate, onBack, forceId }: 
Props): VNode {
     newValue.auth_token = undefined;
     newValue.auth = newToken === null || newToken === undefined
       ? { method: "external" }
-      : { method: "token", token: newToken };
+      : { method: "token", token: `secret-token:${newToken}` };
     if (!newValue.address) newValue.address = {};
     if (!newValue.jurisdiction) newValue.jurisdiction = {};
     // remove above use conversion
diff --git a/packages/merchant-backoffice-ui/src/paths/settings/index.tsx 
b/packages/merchant-backoffice-ui/src/paths/settings/index.tsx
index 6290f48e6..0c4b9dd1a 100644
--- a/packages/merchant-backoffice-ui/src/paths/settings/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/settings/index.tsx
@@ -45,6 +45,7 @@ export function Settings({ onClose }: { onClose?: () => void 
}): VNode {
     const next = s(value);
     const v: Preferences = {
       advanceOrderMode: next.advanceOrderMode ?? false,
+      hideMissingAccountUntil: next.hideMissingAccountUntil ?? 
AbsoluteTime.never(),
       hideKycUntil: next.hideKycUntil ?? AbsoluteTime.never(),
       dateFormat: next.dateFormat ?? "ymd",
     };

-- 
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]