aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/webhooks
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-03-22 15:15:15 -0300
committerSebastian <sebasjm@gmail.com>2024-03-26 16:57:58 -0300
commit5181d060cf09ffc7250c9f1069920da0724e0284 (patch)
tree477312c567976c63caa101202bc525490727c096 /packages/merchant-backoffice-ui/src/paths/instance/webhooks
parente2bfbced7ab027c901913e83ff7dd82240661990 (diff)
downloadwallet-core-5181d060cf09ffc7250c9f1069920da0724e0284.tar.xz
wip, doesn't compile. now merchant doesn't have it's own definition of types... it uses the one defined by taler-util
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/webhooks')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/CreatePage.tsx4
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/index.tsx6
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/ListPage.tsx8
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx9
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/index.tsx7
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/UpdatePage.tsx4
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx7
7 files changed, 19 insertions, 26 deletions
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 83604711e..8792aabea 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
@@ -29,9 +29,9 @@ import {
} from "../../../../components/form/FormProvider.js";
import { Input } from "../../../../components/form/Input.js";
import { InputSelector } from "../../../../components/form/InputSelector.js";
-import { MerchantBackend } from "../../../../declaration.js";
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
-type Entity = MerchantBackend.Webhooks.WebhookAddDetails;
+type Entity = TalerMerchantApi.WebhookAddDetails;
interface Props {
onCreate: (d: Entity) => Promise<void>;
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/index.tsx
index e1b8aa88e..42a432cf0 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/create/index.tsx
@@ -23,12 +23,12 @@ import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend } from "../../../../declaration.js";
import { useWebhookAPI } from "../../../../hooks/webhooks.js";
import { Notification } from "../../../../utils/types.js";
import { CreatePage } from "./CreatePage.js";
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
-export type Entity = MerchantBackend.Webhooks.WebhookAddDetails;
+export type Entity = TalerMerchantApi.WebhookAddDetails;
interface Props {
onBack?: () => void;
onConfirm: () => void;
@@ -44,7 +44,7 @@ export default function CreateWebhook({ onConfirm, onBack }: Props): VNode {
<NotificationCard notification={notif} />
<CreatePage
onBack={onBack}
- onCreate={(request: MerchantBackend.Webhooks.WebhookAddDetails) => {
+ onCreate={(request: TalerMerchantApi.WebhookAddDetails) => {
return createWebhook(request)
.then(() => onConfirm())
.catch((error) => {
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/ListPage.tsx
index be7c575a0..98bd61d8f 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/ListPage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/ListPage.tsx
@@ -20,17 +20,17 @@
*/
import { h, VNode } from "preact";
-import { MerchantBackend } from "../../../../declaration.js";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { CardTable } from "./Table.js";
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
export interface Props {
- webhooks: MerchantBackend.Webhooks.WebhookEntry[];
+ webhooks: TalerMerchantApi.WebhookEntry[];
onLoadMoreBefore?: () => void;
onLoadMoreAfter?: () => void;
onCreate: () => void;
- onDelete: (e: MerchantBackend.Webhooks.WebhookEntry) => void;
- onSelect: (e: MerchantBackend.Webhooks.WebhookEntry) => void;
+ onDelete: (e: TalerMerchantApi.WebhookEntry) => void;
+ onSelect: (e: TalerMerchantApi.WebhookEntry) => void;
}
export function ListPage({
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx
index debbd850b..2cafc7f9a 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/Table.tsx
@@ -19,12 +19,12 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
import { useTranslationContext } from "@gnu-taler/web-util/browser";
import { h, VNode } from "preact";
import { StateUpdater, useState } from "preact/hooks";
-import { MerchantBackend } from "../../../../declaration.js";
-type Entity = MerchantBackend.Webhooks.WebhookEntry;
+type Entity = TalerMerchantApi.WebhookEntry;
interface Props {
webhooks: Entity[];
@@ -109,11 +109,6 @@ interface TableProps {
onLoadMoreAfter?: () => void;
}
-function toggleSelected<T>(id: T): (prev: T[]) => T[] {
- return (prev: T[]): T[] =>
- prev.indexOf(id) == -1 ? [...prev, id] : prev.filter((e) => e != id);
-}
-
function Table({
instances,
onLoadMoreAfter,
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/index.tsx
index c4b773669..17e767337 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/list/index.tsx
@@ -28,18 +28,17 @@ import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend } from "../../../../declaration.js";
import {
useInstanceWebhooks,
useWebhookAPI,
} from "../../../../hooks/webhooks.js";
import { Notification } from "../../../../utils/types.js";
import { ListPage } from "./ListPage.js";
-import { HttpStatusCode } from "@gnu-taler/taler-util";
+import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util";
interface Props {
onUnauthorized: () => VNode;
- onLoadError: (error: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (error: HttpError<TalerErrorDetail>) => VNode;
onNotFound: () => VNode;
onCreate: () => void;
onSelect: (id: string) => void;
@@ -87,7 +86,7 @@ export default function ListWebhooks({
onSelect={(e) => {
onSelect(e.webhook_id);
}}
- onDelete={(e: MerchantBackend.Webhooks.WebhookEntry) =>
+ onDelete={(e: TalerMerchantApi.WebhookEntry) =>
deleteWebhook(e.webhook_id)
.then(() =>
setNotif({
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/UpdatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/UpdatePage.tsx
index be21629d5..6aca62582 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/UpdatePage.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/UpdatePage.tsx
@@ -28,9 +28,9 @@ import {
FormProvider,
} from "../../../../components/form/FormProvider.js";
import { Input } from "../../../../components/form/Input.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
+import { TalerMerchantApi } from "@gnu-taler/taler-util";
-type Entity = MerchantBackend.Webhooks.WebhookPatchDetails & WithId;
+type Entity = TalerMerchantApi.WebhookPatchDetails & WithId;
interface Props {
onUpdate: (d: Entity) => Promise<void>;
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx
index 12374d82a..97b4f44ba 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/webhooks/update/index.tsx
@@ -28,23 +28,22 @@ import { Fragment, h, VNode } from "preact";
import { useState } from "preact/hooks";
import { Loading } from "../../../../components/exception/loading.js";
import { NotificationCard } from "../../../../components/menu/index.js";
-import { MerchantBackend, WithId } from "../../../../declaration.js";
import {
useWebhookAPI,
useWebhookDetails,
} from "../../../../hooks/webhooks.js";
import { Notification } from "../../../../utils/types.js";
import { UpdatePage } from "./UpdatePage.js";
-import { HttpStatusCode } from "@gnu-taler/taler-util";
+import { HttpStatusCode, TalerErrorDetail, TalerMerchantApi } from "@gnu-taler/taler-util";
-export type Entity = MerchantBackend.Webhooks.WebhookPatchDetails & WithId;
+export type Entity = TalerMerchantApi.WebhookPatchDetails & WithId;
interface Props {
onBack?: () => void;
onConfirm: () => void;
onUnauthorized: () => VNode;
onNotFound: () => VNode;
- onLoadError: (e: HttpError<MerchantBackend.ErrorDetail>) => VNode;
+ onLoadError: (e: HttpError<TalerErrorDetail>) => VNode;
tid: string;
}
export default function UpdateWebhook({