gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated (b1f29d764 -> 79e934513)


From: gnunet
Subject: [taler-wallet-core] branch master updated (b1f29d764 -> 79e934513)
Date: Tue, 21 Nov 2023 04:40:12 +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 b1f29d764 merge ui props and state
     new 0f7a3337a merchant fixes
     new 79e934513 sane default for pay deadline and wire transfer and webhook 
docs

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:
 .../merchant-backoffice-ui/src/Application.tsx     |  4 +-
 .../merchant-backoffice-ui/src/InstanceRoutes.tsx  | 34 +++++-----
 .../src/components/form/InputPaytoForm.tsx         |  9 +--
 .../src/components/form/InputWithAddon.tsx         | 11 ++--
 .../src/components/menu/SideBar.tsx                |  4 +-
 .../src/components/menu/index.tsx                  | 12 ++--
 packages/merchant-backoffice-ui/src/hooks/otp.ts   |  2 +-
 .../src/paths/instance/accounts/list/index.tsx     |  2 +-
 .../instance/accounts/update/Update.stories.tsx    |  2 +-
 .../paths/instance/orders/create/CreatePage.tsx    | 74 ++++++++++++++++------
 .../paths/instance/orders/details/DetailPage.tsx   | 16 +++--
 .../create/Create.stories.tsx                      |  2 +-
 .../create/CreatePage.tsx                          | 44 ++++---------
 .../create/CreatedSuccessfully.tsx                 |  0
 .../{validators => otp_devices}/create/index.tsx   |  0
 .../list/List.stories.tsx                          |  2 +-
 .../{validators => otp_devices}/list/ListPage.tsx  |  0
 .../{validators => otp_devices}/list/Table.tsx     |  0
 .../{validators => otp_devices}/list/index.tsx     |  2 +-
 .../update/Update.stories.tsx                      |  2 +-
 .../update/UpdatePage.tsx                          | 44 +++++--------
 .../{validators => otp_devices}/update/index.tsx   |  0
 .../paths/instance/webhooks/create/CreatePage.tsx  | 46 +++++++++++---
 23 files changed, 173 insertions(+), 139 deletions(-)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/create/Create.stories.tsx (96%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/create/CreatePage.tsx (81%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/create/CreatedSuccessfully.tsx (100%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/create/index.tsx (100%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/list/List.stories.tsx (96%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/list/ListPage.tsx (100%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/list/Table.tsx (100%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/list/index.tsx (98%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/update/Update.stories.tsx (96%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/update/UpdatePage.tsx (80%)
 rename packages/merchant-backoffice-ui/src/paths/instance/{validators => 
otp_devices}/update/index.tsx (100%)

diff --git a/packages/merchant-backoffice-ui/src/Application.tsx 
b/packages/merchant-backoffice-ui/src/Application.tsx
index 82329974f..e832d3107 100644
--- a/packages/merchant-backoffice-ui/src/Application.tsx
+++ b/packages/merchant-backoffice-ui/src/Application.tsx
@@ -34,13 +34,11 @@ import {
   NotificationCard
 } from "./components/menu/index.js";
 import {
-  BackendContextProvider,
-  useBackendContext,
+  BackendContextProvider
 } from "./context/backend.js";
 import { ConfigContextProvider } from "./context/config.js";
 import { useBackendConfig } from "./hooks/backend.js";
 import { strings } from "./i18n/strings.js";
-import { LoginPage } from "./paths/login/index.js";
 
 export function Application(): VNode {
   return (
diff --git a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx 
b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
index 5d33655ff..dcb3e21ea 100644
--- a/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
+++ b/packages/merchant-backoffice-ui/src/InstanceRoutes.tsx
@@ -62,9 +62,9 @@ import TemplateUpdatePage from 
"./paths/instance/templates/update/index.js";
 import WebhookCreatePage from "./paths/instance/webhooks/create/index.js";
 import WebhookListPage from "./paths/instance/webhooks/list/index.js";
 import WebhookUpdatePage from "./paths/instance/webhooks/update/index.js";
-import ValidatorCreatePage from "./paths/instance/validators/create/index.js";
-import ValidatorListPage from "./paths/instance/validators/list/index.js";
-import ValidatorUpdatePage from "./paths/instance/validators/update/index.js";
+import ValidatorCreatePage from "./paths/instance/otp_devices/create/index.js";
+import ValidatorListPage from "./paths/instance/otp_devices/list/index.js";
+import ValidatorUpdatePage from "./paths/instance/otp_devices/update/index.js";
 import TransferCreatePage from "./paths/instance/transfers/create/index.js";
 import TransferListPage from "./paths/instance/transfers/list/index.js";
 import InstanceUpdatePage, {
@@ -114,9 +114,9 @@ export enum InstancePaths {
   webhooks_update = "/webhooks/:tid/update",
   webhooks_new = "/webhooks/new",
 
-  validators_list = "/validators",
-  validators_update = "/validators/:vid/update",
-  validators_new = "/validators/new",
+  otp_devices_list = "/otp-devices",
+  otp_devices_update = "/otp-devices/:vid/update",
+  otp_devices_new = "/otp-devices/new",
 
   interface = "/interface",
 }
@@ -526,39 +526,39 @@ export function InstanceRoutes({
          * Validator pages
          */}
         <Route
-          path={InstancePaths.validators_list}
+          path={InstancePaths.otp_devices_list}
           component={ValidatorListPage}
           onUnauthorized={LoginPageAccessDenied}
           onNotFound={IfAdminCreateDefaultOr(NotFoundPage)}
           onLoadError={ServerErrorRedirectTo(InstancePaths.settings)}
           onCreate={() => {
-            route(InstancePaths.validators_new);
+            route(InstancePaths.otp_devices_new);
           }}
           onSelect={(id: string) => {
-            route(InstancePaths.validators_update.replace(":vid", id));
+            route(InstancePaths.otp_devices_update.replace(":vid", id));
           }}
         />
         <Route
-          path={InstancePaths.validators_update}
+          path={InstancePaths.otp_devices_update}
           component={ValidatorUpdatePage}
           onConfirm={() => {
-            route(InstancePaths.validators_list);
+            route(InstancePaths.otp_devices_list);
           }}
           onUnauthorized={LoginPageAccessDenied}
-          onLoadError={ServerErrorRedirectTo(InstancePaths.validators_list)}
+          onLoadError={ServerErrorRedirectTo(InstancePaths.otp_devices_list)}
           onNotFound={IfAdminCreateDefaultOr(NotFoundPage)}
           onBack={() => {
-            route(InstancePaths.validators_list);
+            route(InstancePaths.otp_devices_list);
           }}
         />
         <Route
-          path={InstancePaths.validators_new}
+          path={InstancePaths.otp_devices_new}
           component={ValidatorCreatePage}
           onConfirm={() => {
-            route(InstancePaths.validators_list);
+            route(InstancePaths.otp_devices_list);
           }}
           onBack={() => {
-            route(InstancePaths.validators_list);
+            route(InstancePaths.otp_devices_list);
           }}
         />
         {/**
@@ -667,7 +667,7 @@ export function InstanceRoutes({
           }}
         />
         <Route path={InstancePaths.kyc} component={ListKYCPage} />
-        <Route path={InstancePaths.settings} component={Settings} />
+        <Route path={InstancePaths.interface} component={Settings} />
         {/**
          * Example pages
          */}
diff --git 
a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx 
b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
index 5cd69a0b3..0362310b9 100644
--- a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
+++ b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
@@ -306,8 +306,9 @@ export function InputPaytoForm<T>({
           <Fragment>
             <Input<Entity>
               name="path1"
-              label={i18n.str`Account`}
-              tooltip={i18n.str`Bank Account Number.`}
+              label={i18n.str`IBAN`}
+              tooltip={i18n.str`International Bank Account Number.`}
+              placeholder="DE1231231231"
               inputExtra={{ style: { textTransform: "uppercase" } }}
             />
           </Fragment>
@@ -371,8 +372,8 @@ export function InputPaytoForm<T>({
           <Fragment>
             <Input
               name="params.receiver-name"
-              label={i18n.str`Name`}
-              tooltip={i18n.str`Bank account owner's name.`}
+              label={i18n.str`Owner's name`}
+              tooltip={i18n.str`Legal name of the person holding the account.`}
             />
           </Fragment>
         )}
diff --git 
a/packages/merchant-backoffice-ui/src/components/form/InputWithAddon.tsx 
b/packages/merchant-backoffice-ui/src/components/form/InputWithAddon.tsx
index d7b490a5d..e9fd88770 100644
--- a/packages/merchant-backoffice-ui/src/components/form/InputWithAddon.tsx
+++ b/packages/merchant-backoffice-ui/src/components/form/InputWithAddon.tsx
@@ -26,6 +26,7 @@ export interface Props<T> extends InputProps<T> {
   inputType?: "text" | "number" | "password";
   addonBefore?: ComponentChildren;
   addonAfter?: ComponentChildren;
+  addonAfterAction?: () => void;
   toStr?: (v?: any) => string;
   fromStr?: (s: string) => any;
   inputExtra?: any;
@@ -50,6 +51,7 @@ export function InputWithAddon<T>({
   inputExtra,
   side,
   addonAfter,
+  addonAfterAction,
   toStr = defaultToString,
   fromStr = defaultFromString,
 }: Props<keyof T>): VNode {
@@ -76,9 +78,8 @@ export function InputWithAddon<T>({
               </div>
             )}
             <p
-              class={`control${expand ? " is-expanded" : ""}${
-                required ? " has-icons-right" : ""
-              }`}
+              class={`control${expand ? " is-expanded" : ""}${required ? " 
has-icons-right" : ""
+                }`}
             >
               <input
                 {...(inputExtra || {})}
@@ -99,7 +100,7 @@ export function InputWithAddon<T>({
               {children}
             </p>
             {addonAfter && (
-              <div class="control">
+              <div class="control" onClick={addonAfterAction} style={{ cursor: 
addonAfterAction ? "pointer" : undefined }}>
                 <a class="button is-static">{addonAfter}</a>
               </div>
             )}
@@ -109,7 +110,7 @@ export function InputWithAddon<T>({
         </div>
         {expand ? <div>{side}</div> : side}
       </div>
-      
+
     </div>
   );
 }
diff --git a/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx 
b/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx
index d6c4ce4b2..8aac5f543 100644
--- a/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx
+++ b/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx
@@ -149,12 +149,12 @@ export function Sidebar({
                 </a>
               </li>
               <li>
-                <a href={"/validators"} class="has-icon">
+                <a href={"/otp-devices"} class="has-icon">
                   <span class="icon">
                     <i class="mdi mdi-lock" />
                   </span>
                   <span class="menu-item-label">
-                    <i18n.Translate>Validators</i18n.Translate>
+                    <i18n.Translate>OTP Devices</i18n.Translate>
                   </span>
                 </a>
               </li>
diff --git a/packages/merchant-backoffice-ui/src/components/menu/index.tsx 
b/packages/merchant-backoffice-ui/src/components/menu/index.tsx
index 0e881d7a5..7bb7c0c00 100644
--- a/packages/merchant-backoffice-ui/src/components/menu/index.tsx
+++ b/packages/merchant-backoffice-ui/src/components/menu/index.tsx
@@ -50,12 +50,12 @@ function getInstanceTitle(path: string, id: string): string 
{
       return `${id}: New webhook`;
     case InstancePaths.webhooks_update:
       return `${id}: Update webhook`;
-    case InstancePaths.validators_list:
-      return `${id}: Validators`;
-    case InstancePaths.validators_new:
-      return `${id}: New validator`;
-    case InstancePaths.validators_update:
-      return `${id}: Update validators`;
+    case InstancePaths.otp_devices_list:
+      return `${id}: otp devices`;
+    case InstancePaths.otp_devices_new:
+      return `${id}: New otp devices`;
+    case InstancePaths.otp_devices_update:
+      return `${id}: Update otp devices`;
     case InstancePaths.templates_new:
       return `${id}: New template`;
     case InstancePaths.templates_update:
diff --git a/packages/merchant-backoffice-ui/src/hooks/otp.ts 
b/packages/merchant-backoffice-ui/src/hooks/otp.ts
index 93eefeea5..b045e365a 100644
--- a/packages/merchant-backoffice-ui/src/hooks/otp.ts
+++ b/packages/merchant-backoffice-ui/src/hooks/otp.ts
@@ -158,7 +158,7 @@ export function useInstanceOtpDevices(
   // if the query returns less that we ask, then we have reach the end or 
beginning
   const isReachingEnd =
     afterData && afterData.data.otp_devices.length < totalAfter;
-  const isReachingStart = false;
+  const isReachingStart = true;
 
   const pagination = {
     isReachingEnd,
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx 
b/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx
index 9788ce0ec..100241e22 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/accounts/list/index.tsx
@@ -43,7 +43,7 @@ interface Props {
   onSelect: (id: string) => void;
 }
 
-export default function ListValidators({
+export default function ListOtpDevices({
   onUnauthorized,
   onLoadError,
   onCreate,
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/Update.stories.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/Update.stories.tsx
index fcb77b820..d6b1d65e0 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/Update.stories.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/accounts/update/Update.stories.tsx
@@ -23,7 +23,7 @@ import { h, VNode, FunctionalComponent } from "preact";
 import { UpdatePage as TestedComponent } from "./UpdatePage.js";
 
 export default {
-  title: "Pages/Validators/Update",
+  title: "Pages/OtpDevices/Update",
   component: TestedComponent,
   argTypes: {
     onUpdate: { action: "onUpdate" },
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
index ea2cf849a..52ee9d351 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx
@@ -143,7 +143,7 @@ export function CreatePage({
   const instance_default = with_defaults(instanceConfig, config.currency)
   const [value, valueHandler] = useState(instance_default);
   const zero = Amounts.zeroOfCurrency(config.currency);
-  const [settings] = useSettings()
+  const [settings, updateSettings] = useSettings()
   const inventoryList = Object.values(value.inventoryProducts || {});
   const productList = Object.values(value.products || {});
 
@@ -184,7 +184,7 @@ export function CreatePage({
               ? i18n.str`wire transfer deadline cannot be before refund 
deadline`
               : undefined,
       pay_deadline: !value.payments?.pay_deadline
-        ? undefined
+        ? i18n.str`required`
         : !isFuture(value.payments.pay_deadline)
           ? i18n.str`should be in the future`
           : value.payments.wire_transfer_deadline &&
@@ -194,6 +194,11 @@ export function CreatePage({
             )
             ? i18n.str`wire transfer deadline cannot be before pay deadline`
             : undefined,
+      wire_transfer_deadline: !value.payments?.wire_transfer_deadline
+        ? i18n.str`required`
+        : !isFuture(value.payments.wire_transfer_deadline)
+          ? i18n.str`should be in the future`
+          : undefined,
       auto_refund_deadline: !value.payments?.auto_refund_deadline
         ? undefined
         : !isFuture(value.payments.auto_refund_deadline)
@@ -354,9 +359,39 @@ export function CreatePage({
       !prev.minimum_age || cur > prev.minimum_age ? cur : prev.minimum_age,
     0,
   );
+
+  const noDefault_payDeadline = !instance_default.payments || 
!instance_default.payments.pay_deadline
+  const noDefault_wireDeadline = !instance_default.payments || 
!instance_default.payments.wire_transfer_deadline
+  const requiresSomeTalerOptions = noDefault_payDeadline || 
noDefault_wireDeadline
+
   return (
     <div>
+
       <section class="section is-main-section">
+        <div class="tabs is-toggle is-fullwidth is-small">
+          <ul>
+            <li class={!settings.advanceOrderMode ? "is-active" : ""} 
onClick={() => {
+              updateSettings({
+                ...settings,
+                advanceOrderMode: false
+              })
+            }}>
+              <a >
+                <span><i18n.Translate>Simple</i18n.Translate></span>
+              </a>
+            </li>
+            <li class={settings.advanceOrderMode ? "is-active" : ""} 
onClick={() => {
+              updateSettings({
+                ...settings,
+                advanceOrderMode: true
+              })
+            }}>
+              <a >
+                <span><i18n.Translate>Advanced</i18n.Translate></span>
+              </a>
+            </li>
+          </ul>
+        </div>
         <div class="columns">
           <div class="column" />
           <div class="column is-four-fifths">
@@ -481,33 +516,34 @@ export function CreatePage({
                 </InputGroup>
               }
 
-              {settings.advanceOrderMode &&
+              {(settings.advanceOrderMode || requiresSomeTalerOptions) &&
                 <InputGroup
                   name="payments"
                   label={i18n.str`Taler payment options`}
                   tooltip={i18n.str`Override default Taler payment settings 
for this order`}
                 >
-                  <InputDate
+                  {(settings.advanceOrderMode || noDefault_payDeadline) && 
<InputDate
                     name="payments.pay_deadline"
                     label={i18n.str`Payment deadline`}
                     tooltip={i18n.str`Deadline for the customer to pay for the 
offer before it expires. Inventory products will be reserved until this 
deadline.`}
                     side={
                       <span>
                         <button class="button" onClick={() => {
-                          valueHandler({
+                          const c = {
                             ...value,
                             payments: {
                               ...(value.payments ?? {}),
                               pay_deadline: 
instance_default.payments?.pay_deadline
                             }
-                          })
+                          }
+                          valueHandler(c)
                         }}>
                           <i18n.Translate>default</i18n.Translate>
                         </button>
                       </span>
                     }
-                  />
-                  <InputDate
+                  />}
+                  {settings.advanceOrderMode && <InputDate
                     name="payments.refund_deadline"
                     label={i18n.str`Refund deadline`}
                     tooltip={i18n.str`Time until which the order can be 
refunded by the merchant.`}
@@ -526,8 +562,8 @@ export function CreatePage({
                         </button>
                       </span>
                     }
-                  />
-                  <InputDate
+                  />}
+                  {(settings.advanceOrderMode || noDefault_wireDeadline) && 
<InputDate
                     name="payments.wire_transfer_deadline"
                     label={i18n.str`Wire transfer deadline`}
                     tooltip={i18n.str`Deadline for the exchange to make the 
wire transfer.`}
@@ -546,24 +582,24 @@ export function CreatePage({
                         </button>
                       </span>
                     }
-                  />
-                  <InputDate
+                  />}
+                  {settings.advanceOrderMode && <InputDate
                     name="payments.auto_refund_deadline"
                     label={i18n.str`Auto-refund deadline`}
                     tooltip={i18n.str`Time until which the wallet will 
automatically check for refunds without user interaction.`}
-                  />
+                  />}
 
-                  <InputCurrency
+                  {settings.advanceOrderMode && <InputCurrency
                     name="payments.max_fee"
                     label={i18n.str`Maximum fee`}
                     tooltip={i18n.str`Maximum fees the merchant is willing to 
cover for this order. Higher deposit fees must be covered in full by the 
consumer.`}
-                  />
-                  <InputToggle
+                  />}
+                  {settings.advanceOrderMode && <InputToggle
                     name="payments.createToken"
                     label={i18n.str`Create token`}
                     tooltip={i18n.str`If the order ID is easy to guess the 
token will prevent user to steal orders from others.`}
-                  />
-                  <InputNumber
+                  />}
+                  {settings.advanceOrderMode && <InputNumber
                     name="payments.minimum_age"
                     label={i18n.str`Minimum age required`}
                     tooltip={i18n.str`Any value greater than 0 will limit the 
coins able be used to pay this contract. If empty the age restriction will be 
defined by the products`}
@@ -572,7 +608,7 @@ export function CreatePage({
                         ? i18n.str`Min age defined by the producs is 
${minAgeByProducts}`
                         : i18n.str`No product with age restriction in this 
order`
                     }
-                  />
+                  />}
                 </InputGroup>
               }
 
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx
index 1cfbec29b..5ff76e37a 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/orders/details/DetailPage.tsx
@@ -503,13 +503,15 @@ function PaidPage({
                           textOverflow: "ellipsis",
                         }}
                       >
-                        <p>
-                          <i18n.Translate>Next event in </i18n.Translate> 
{formatDistance(
-                            nextEvent!.when,
-                            new Date(),
-                            // "yyyy/MM/dd HH:mm:ss",
-                          )}
-                        </p>
+                        {nextEvent &&
+                          <p>
+                            <i18n.Translate>Next event in </i18n.Translate> 
{formatDistance(
+                              nextEvent.when,
+                              new Date(),
+                              // "yyyy/MM/dd HH:mm:ss",
+                            )}
+                          </p>
+                        }
                       </div>
                     </div>
                   </div>
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/Create.stories.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/Create.stories.tsx
similarity index 96%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/create/Create.stories.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/Create.stories.tsx
index 56762db7b..26f851cc8 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/Create.stories.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/Create.stories.tsx
@@ -23,6 +23,6 @@ import { h, VNode, FunctionalComponent } from "preact";
 import { CreatePage as TestedComponent } from "./CreatePage.js";
 
 export default {
-  title: "Pages/Validators/Create",
+  title: "Pages/OtpDevices/Create",
   component: TestedComponent,
 };
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/CreatePage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatePage.tsx
similarity index 81%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/create/CreatePage.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatePage.tsx
index 4e813d777..5f1ae26a3 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/CreatePage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatePage.tsx
@@ -70,7 +70,7 @@ export function CreatePage({ onCreate, onBack }: Props): 
VNode {
         : state.otp_key.length !== 32
           ? i18n.str`size of the key should be 32`
           : undefined,
-          otp_device_description: !state.otp_device_description ? 
i18n.str`required`
+    otp_device_description: !state.otp_device_description ? i18n.str`required`
       : !/[a-zA-Z0-9]*/.test(state.otp_device_description)
         ? i18n.str`no valid. only characters and numbers`
         : undefined,
@@ -125,8 +125,11 @@ export function CreatePage({ onCreate, onBack }: Props): 
VNode {
                     help="Be sure to be very hard to guess or use the random 
generator"
                     tooltip={i18n.str`Your device need to have exactly the 
same value`}
                     fromStr={(v) => v.toUpperCase()}
+                    addonAfterAction={() => {
+                      setShowKey(!showKey);
+                    }}
                     addonAfter={
-                      <span class="icon">
+                      <span class="icon" >
                         {showKey ? (
                           <i class="mdi mdi-eye" />
                         ) : (
@@ -135,34 +138,15 @@ export function CreatePage({ onCreate, onBack }: Props): 
VNode {
                       </span>
                     }
                     side={
-                      <span style={{ display: "flex" }}>
-                        <button
-                          data-tooltip={i18n.str`generate random secret key`}
-                          class="button is-info mr-3"
-                          onClick={(e) => {
-                            setState((s) => ({ ...s, otp_key: 
randomBase32Key() }));
-                          }}
-                        >
-                          <i18n.Translate>random</i18n.Translate>
-                        </button>
-                        <button
-                          data-tooltip={
-                            showKey
-                              ? i18n.str`show secret key`
-                              : i18n.str`hide secret key`
-                          }
-                          class="button is-info mr-3"
-                          onClick={(e) => {
-                            setShowKey(!showKey);
-                          }}
-                        >
-                          {showKey ? (
-                            <i18n.Translate>hide</i18n.Translate>
-                          ) : (
-                            <i18n.Translate>show</i18n.Translate>
-                          )}
-                        </button>
-                      </span>
+                      <button
+                        data-tooltip={i18n.str`generate random secret key`}
+                        class="button is-info mr-3"
+                        onClick={(e) => {
+                          setState((s) => ({ ...s, otp_key: randomBase32Key() 
}));
+                        }}
+                      >
+                        <i18n.Translate>random</i18n.Translate>
+                      </button>
                     }
                   />
                 </Fragment>
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/CreatedSuccessfully.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx
similarity index 100%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/create/CreatedSuccessfully.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/CreatedSuccessfully.tsx
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/create/index.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/index.tsx
similarity index 100%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/create/index.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/create/index.tsx
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/List.stories.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/List.stories.tsx
similarity index 96%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/list/List.stories.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/List.stories.tsx
index 3aa491c53..b18049674 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/List.stories.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/List.stories.tsx
@@ -23,6 +23,6 @@ import { FunctionalComponent, h } from "preact";
 import { ListPage as TestedComponent } from "./ListPage.js";
 
 export default {
-  title: "Pages/Validators/List",
+  title: "Pages/OtpDevices/List",
   component: TestedComponent,
 };
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/ListPage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/ListPage.tsx
similarity index 100%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/list/ListPage.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/ListPage.tsx
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/Table.tsx 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx
similarity index 100%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/list/Table.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/Table.tsx
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/index.tsx 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/index.tsx
similarity index 98%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/list/index.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/index.tsx
index 8837c848b..2aae8738a 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/list/index.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/list/index.tsx
@@ -42,7 +42,7 @@ interface Props {
   onSelect: (id: string) => void;
 }
 
-export default function ListValidators({
+export default function ListOtpDevices({
   onUnauthorized,
   onLoadError,
   onCreate,
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/update/Update.stories.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/Update.stories.tsx
similarity index 96%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/update/Update.stories.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/Update.stories.tsx
index fcb77b820..d6b1d65e0 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/update/Update.stories.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/Update.stories.tsx
@@ -23,7 +23,7 @@ import { h, VNode, FunctionalComponent } from "preact";
 import { UpdatePage as TestedComponent } from "./UpdatePage.js";
 
 export default {
-  title: "Pages/Validators/Update",
+  title: "Pages/OtpDevices/Update",
   component: TestedComponent,
   argTypes: {
     onUpdate: { action: "onUpdate" },
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/update/UpdatePage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/UpdatePage.tsx
similarity index 80%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/update/UpdatePage.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/UpdatePage.tsx
index 79be9802f..1164aed5a 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/update/UpdatePage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/UpdatePage.tsx
@@ -109,8 +109,13 @@ export function UpdatePage({ device, onUpdate, onBack }: 
Props): VNode {
                       help={state.otp_key === undefined ? "Not modified" : "Be 
sure to be very hard to guess or use the random generator"}
                       tooltip={i18n.str`Your device need to have exactly the 
same value`}
                       fromStr={(v) => v.toUpperCase()}
+                      addonAfterAction={() => {
+                        setShowKey(!showKey);
+                      }}
                       addonAfter={
-                        <span class="icon">
+                        <span class="icon" onClick={() => {
+                          setShowKey(!showKey);
+                        }}>
                           {showKey ? (
                             <i class="mdi mdi-eye" />
                           ) : (
@@ -125,34 +130,15 @@ export function UpdatePage({ device, onUpdate, onBack }: 
Props): VNode {
                             setState((s) => ({ ...s, otp_key: "" }));
                           }}
                           class="button">change key</button> :
-                          <span style={{ display: "flex" }}>
-                            <button
-                              data-tooltip={i18n.str`generate random secret 
key`}
-                              class="button is-info mr-3"
-                              onClick={(e) => {
-                                setState((s) => ({ ...s, otp_key: 
randomBase32Key() }));
-                              }}
-                            >
-                              <i18n.Translate>random</i18n.Translate>
-                            </button>
-                            <button
-                              data-tooltip={
-                                showKey
-                                  ? i18n.str`show secret key`
-                                  : i18n.str`hide secret key`
-                              }
-                              class="button is-info mr-3"
-                              onClick={(e) => {
-                                setShowKey(!showKey);
-                              }}
-                            >
-                              {showKey ? (
-                                <i18n.Translate>hide</i18n.Translate>
-                              ) : (
-                                <i18n.Translate>show</i18n.Translate>
-                              )}
-                            </button>
-                          </span>
+                          <button
+                            data-tooltip={i18n.str`generate random secret key`}
+                            class="button is-info mr-3"
+                            onClick={(e) => {
+                              setState((s) => ({ ...s, otp_key: 
randomBase32Key() }));
+                            }}
+                          >
+                            <i18n.Translate>random</i18n.Translate>
+                          </button>
                       }
                     />
                   </Fragment>
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/validators/update/index.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx
similarity index 100%
rename from 
packages/merchant-backoffice-ui/src/paths/instance/validators/update/index.tsx
rename to 
packages/merchant-backoffice-ui/src/paths/instance/otp_devices/update/index.tsx
diff --git 
a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/CreatePage.tsx
 
b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/CreatePage.tsx
index 7b07e689e..434d69412 100644
--- 
a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/CreatePage.tsx
+++ 
b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/CreatePage.tsx
@@ -20,7 +20,7 @@
  */
 
 import { useTranslationContext } from "@gnu-taler/web-util/browser";
-import { h, VNode } from "preact";
+import { Fragment, h, VNode } from "preact";
 import { useState } from "preact/hooks";
 import { AsyncButton } from "../../../../components/exception/AsyncButton.js";
 import {
@@ -51,14 +51,14 @@ export function CreatePage({ onCreate, onBack }: Props): 
VNode {
 
   const errors: FormErrors<Entity> = {
     webhook_id: !state.webhook_id ? i18n.str`required` : undefined,
-    event_type: !state.event_type ? i18n.str`required` 
-    : state.event_type !== "pay" && state.event_type !== "refund" ? 
i18n.str`it should be "pay" or "refund"`
-    : undefined,
+    event_type: !state.event_type ? i18n.str`required`
+      : state.event_type !== "pay" && state.event_type !== "refund" ? 
i18n.str`it should be "pay" or "refund"`
+        : undefined,
     http_method: !state.http_method
       ? i18n.str`required`
       : !validMethod.includes(state.http_method)
-      ? i18n.str`should be one of '${validMethod.join(", ")}'`
-      : undefined,
+        ? i18n.str`should be one of '${validMethod.join(", ")}'`
+        : undefined,
     url: !state.url ? i18n.str`required` : undefined,
   };
 
@@ -116,16 +116,42 @@ export function CreatePage({ onCreate, onBack }: Props): 
VNode {
                 label={i18n.str`URL`}
                 tooltip={i18n.str`URL of the webhook where the customer will 
be redirected`}
               />
-              <Input<Entity>
+
+              <p>
+                The text below support <a target="_blank" rel="noreferrer" 
href="https://mustache.github.io/mustache.5.html";>mustache</a> template engine. 
Any string
+                between <pre style={{ display: "inline", padding: 0 
}}>&#123;&#123;</pre> and <pre style={{ display: "inline", padding: 0 
}}>&#125;&#125;</pre> will
+                be replaced with replaced with the value of the correspoding 
variable.
+              </p>
+              <p>
+                For example <pre style={{ display: "inline", padding: 0 
}}>&#123;&#123;contract_terms.amount&#125;&#125;</pre> will be replaced
+                with the the order's price
+              </p>
+              <p>
+                The short list of variables are:
+              </p>
+              <div class="menu">
+
+                <ul class="menu-list" style={{ listStyleType: "disc", 
marginLeft: 20 }}>
+                  <li><b>contract_terms.summary:</b> order's description </li>
+                  <li><b>contract_terms.amount:</b> order's price </li>
+                  <li><b>order_id:</b> order's unique identification </li>
+                  {state.event_type === "refund" && <Fragment>
+                    <li><b>refund_amout:</b> the amount that was being 
refunded</li>
+                    <li><b>reason:</b> the reason entered by the merchant 
staff for granting the refund</li>
+                    <li><b>timestamp:</b> time of the refund in nanoseconds 
since 1970</li>
+                  </Fragment>}
+                </ul>
+              </div>
+              {/* <Input<Entity>
                 name="header_template"
-                label={i18n.str`Header`}
+                label={i18n.str`Http header`}
                 inputType="multiline"
                 tooltip={i18n.str`Header template of the webhook`}
-              />
+              /> */}
               <Input<Entity>
                 name="body_template"
                 inputType="multiline"
-                label={i18n.str`Body`}
+                label={i18n.str`Http body`}
                 tooltip={i18n.str`Body template by the webhook`}
               />
             </FormProvider>

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