@webiny/webhooks 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.a4f3e4ea8b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/WebhookRoutes.js +7 -13
- package/admin/WebhookRoutes.js.map +1 -1
- package/admin/Webhooks.js +0 -3
- package/admin/Webhooks.js.map +1 -1
- package/admin/features/ListWebhooks/ListWebhooksGateway.js +8 -2
- package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -1
- package/admin/features/ListWebhooks/abstractions.d.ts +1 -0
- package/admin/features/ListWebhooks/abstractions.js.map +1 -1
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.d.ts +2 -3
- package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/WebhookDeliveriesDataSource.js +5 -7
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesDataSource.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.d.ts +9 -5
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js +67 -40
- package/admin/presentation/WebhookDeliveriesPage/WebhookDeliveriesPagePresenter.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/abstractions.d.ts +6 -3
- package/admin/presentation/WebhookDeliveriesPage/abstractions.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryAccordionRow.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +50 -18
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js +24 -8
- package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.d.ts +2 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js +16 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js.map +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +26 -17
- package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -0
- package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.js.map +1 -0
- package/admin/presentation/WebhookForm/WebhookFormPresenter.d.ts +1 -4
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js +8 -12
- package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -1
- package/admin/presentation/WebhookForm/abstractions.d.ts +1 -4
- package/admin/presentation/WebhookForm/abstractions.js.map +1 -1
- package/admin/presentation/WebhookForm/components/WebhookFormView.js +34 -36
- package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -1
- package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +7 -8
- package/admin/presentation/WebhookList/WebhookListDataSource.js +23 -50
- package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.d.ts +2 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js +16 -0
- package/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js.map +1 -0
- package/admin/presentation/WebhookList/components/WebhookListContent.js +20 -8
- package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js +4 -1
- package/admin/presentation/WebhookList/components/WebhookListView.js.map +1 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js +3 -1
- package/admin/presentation/WebhookSettings/WebhookSettingsPresenter.js.map +1 -1
- package/admin/routes.d.ts +3 -1
- package/admin/routes.js +4 -1
- package/admin/routes.js.map +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.d.ts +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.js +1 -1
- package/api/features/SendWebhookTask/SendWebhookTask.js.map +1 -1
- package/api/graphql/WebhookCrudSchema.js +11 -0
- package/api/graphql/WebhookCrudSchema.js.map +1 -1
- package/api/index.js +5 -1
- package/api/index.js.map +1 -1
- package/api/models/WebhookDeliveryModel.d.ts +1 -1
- package/api/models/WebhookDeliveryModel.js +3 -4
- package/api/models/WebhookDeliveryModel.js.map +1 -1
- package/api/models/WebhookModel.d.ts +1 -1
- package/api/models/WebhookModel.js +4 -5
- package/api/models/WebhookModel.js.map +1 -1
- package/api/models/WebhookSettingsModel.d.ts +1 -1
- package/api/models/WebhookSettingsModel.js +3 -4
- package/api/models/WebhookSettingsModel.js.map +1 -1
- package/package.json +22 -22
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesDataSource.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.d.ts +0 -21
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js +0 -57
- package/admin/presentation/WebhookDeliveries/WebhookDeliveriesPresenter.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/abstractions.d.ts +0 -18
- package/admin/presentation/WebhookDeliveries/abstractions.js +0 -5
- package/admin/presentation/WebhookDeliveries/abstractions.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryAccordionRow.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.d.ts +0 -11
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js +0 -32
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetail.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailContent.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.d.ts +0 -9
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js +0 -22
- package/admin/presentation/WebhookDeliveries/components/DeliveryDetailPanel.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.d.ts +0 -8
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js +0 -119
- package/admin/presentation/WebhookDeliveries/components/WebhookDeliveriesDrawer.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.d.ts +0 -1
- package/admin/presentation/WebhookDeliveries/components/statusVariant.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/feature.d.ts +0 -3
- package/admin/presentation/WebhookDeliveries/feature.js +0 -17
- package/admin/presentation/WebhookDeliveries/feature.js.map +0 -1
- package/admin/presentation/WebhookDeliveries/index.d.ts +0 -2
- package/admin/presentation/WebhookDeliveries/index.js +0 -2
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryAccordionRow.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.d.ts +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/DeliveryDetailContent.js +0 -0
- /package/admin/presentation/{WebhookDeliveries → WebhookDeliveriesPage}/components/statusVariant.js +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import react, { useEffect, useMemo } from "react";
|
|
1
|
+
import react, { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
3
|
import { DiContainerProvider, useContainer, useFeature, useRoute } from "@webiny/app";
|
|
4
|
-
import { FormErrors, useFieldRenderers, useRouter } from "@webiny/app-admin";
|
|
5
|
-
import { Button,
|
|
6
|
-
import { FormView } from "@webiny/app-admin/features/formModel/FormView.js";
|
|
4
|
+
import { FormErrors, FormView, SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader, useFieldRenderers, useRouter } from "@webiny/app-admin";
|
|
5
|
+
import { Button, OverlayLoader, useToast } from "@webiny/admin-ui";
|
|
7
6
|
import { WebhookFormPresenterFeature } from "../feature.js";
|
|
8
7
|
import { GetWebhookFeature } from "../../../features/getWebhook/feature.js";
|
|
9
8
|
import { CreateWebhookFeature } from "../../../features/createWebhook/feature.js";
|
|
@@ -14,14 +13,14 @@ import { WebhookPermissionsFeature } from "../../../features/permissions/feature
|
|
|
14
13
|
import { Routes } from "../../../routes.js";
|
|
15
14
|
import { SigningSecret } from "./SigningSecret.js";
|
|
16
15
|
import { HasPermission } from "../../security/HasPermission.js";
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
level: 6
|
|
16
|
+
const SectionHeading = ({ field })=>/*#__PURE__*/ react.createElement("span", {
|
|
17
|
+
className: "text-md font-semibold"
|
|
20
18
|
}, String(field.label ?? ""));
|
|
21
19
|
const WebhookFormView_WebhookFormViewInner = observer(function() {
|
|
22
20
|
const { presenter } = useFeature(WebhookFormPresenterFeature);
|
|
23
21
|
const { goToRoute } = useRouter();
|
|
24
22
|
const { route } = useRoute(Routes.Form);
|
|
23
|
+
const toast = useToast();
|
|
25
24
|
const id = route.params.id;
|
|
26
25
|
const defaultRenderers = useFieldRenderers();
|
|
27
26
|
const renderers = useMemo(()=>({
|
|
@@ -36,20 +35,33 @@ const WebhookFormView_WebhookFormViewInner = observer(function() {
|
|
|
36
35
|
presenter,
|
|
37
36
|
id
|
|
38
37
|
]);
|
|
38
|
+
const saveForm = useCallback(async ()=>{
|
|
39
|
+
const res = await presenter.save();
|
|
40
|
+
if (res) toast.showSuccessToast({
|
|
41
|
+
title: "Webhook saved successfully!"
|
|
42
|
+
});
|
|
43
|
+
}, [
|
|
44
|
+
presenter
|
|
45
|
+
]);
|
|
39
46
|
const { vm } = presenter;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
return /*#__PURE__*/ react.createElement(SimpleForm, null, vm.loading ? /*#__PURE__*/ react.createElement(OverlayLoader, {
|
|
48
|
+
text: "Loading..."
|
|
49
|
+
}) : null, vm.saving ? /*#__PURE__*/ react.createElement(OverlayLoader, {
|
|
50
|
+
text: "Saving..."
|
|
51
|
+
}) : null, /*#__PURE__*/ react.createElement(FormErrors, {
|
|
52
|
+
form: vm.form,
|
|
53
|
+
className: "mb-lg"
|
|
54
|
+
}), /*#__PURE__*/ react.createElement(SimpleFormHeader, {
|
|
55
|
+
title: vm.isNew ? "Create Webhook" : vm.webhook?.name ?? "Edit Webhook"
|
|
56
|
+
}), /*#__PURE__*/ react.createElement(SimpleFormContent, null, /*#__PURE__*/ react.createElement(FormView, {
|
|
57
|
+
name: "Webhook",
|
|
58
|
+
form: vm.form,
|
|
59
|
+
renderers: renderers
|
|
60
|
+
}), /*#__PURE__*/ react.createElement(SigningSecret, {
|
|
61
|
+
presenter: presenter
|
|
62
|
+
})), /*#__PURE__*/ react.createElement(SimpleFormFooter, {
|
|
63
|
+
className: "border-t-sm border-t-neutral-dimmed pt-lg"
|
|
64
|
+
}, /*#__PURE__*/ react.createElement(Button, {
|
|
53
65
|
variant: "secondary",
|
|
54
66
|
onClick: ()=>goToRoute(Routes.List)
|
|
55
67
|
}, "Cancel"), /*#__PURE__*/ react.createElement(HasPermission, {
|
|
@@ -57,23 +69,9 @@ const WebhookFormView_WebhookFormViewInner = observer(function() {
|
|
|
57
69
|
action: "edit"
|
|
58
70
|
}, /*#__PURE__*/ react.createElement(Button, {
|
|
59
71
|
variant: "primary",
|
|
60
|
-
onClick:
|
|
72
|
+
onClick: saveForm,
|
|
61
73
|
disabled: vm.saving
|
|
62
|
-
}, vm.saving ? "Saving..." : "Save"))))
|
|
63
|
-
className: "p-lg"
|
|
64
|
-
}, /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(FormErrors, {
|
|
65
|
-
form: vm.form
|
|
66
|
-
}), /*#__PURE__*/ react.createElement(FormView, {
|
|
67
|
-
name: "Webhook",
|
|
68
|
-
form: vm.form,
|
|
69
|
-
renderers: renderers
|
|
70
|
-
}), /*#__PURE__*/ react.createElement(SigningSecret, {
|
|
71
|
-
presenter: presenter
|
|
72
|
-
})))), vm.showDeliveries && vm.webhook ? /*#__PURE__*/ react.createElement(WebhookDeliveriesDrawer, {
|
|
73
|
-
webhookId: vm.webhook.id,
|
|
74
|
-
open: vm.showDeliveries,
|
|
75
|
-
onClose: ()=>presenter.closeDeliveries()
|
|
76
|
-
}) : null);
|
|
74
|
+
}, vm.saving ? "Saving..." : "Save"))));
|
|
77
75
|
});
|
|
78
76
|
const WebhookFormView = ()=>{
|
|
79
77
|
const container = useContainer();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookForm/components/WebhookFormView.js","sources":["../../../../../src/admin/presentation/WebhookForm/components/WebhookFormView.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature, useRoute } from \"@webiny/app\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookForm/components/WebhookFormView.js","sources":["../../../../../src/admin/presentation/WebhookForm/components/WebhookFormView.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useCallback } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature, useRoute } from \"@webiny/app\";\nimport {\n FormErrors,\n useRouter,\n useFieldRenderers,\n SimpleForm,\n SimpleFormHeader,\n SimpleFormContent,\n SimpleFormFooter,\n FormView\n} from \"@webiny/app-admin\";\nimport { Button, OverlayLoader } from \"@webiny/admin-ui\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { WebhookFormPresenterFeature } from \"../feature.js\";\nimport { GetWebhookFeature } from \"~/admin/features/getWebhook/feature.js\";\nimport { CreateWebhookFeature } from \"~/admin/features/createWebhook/feature.js\";\nimport { UpdateWebhookFeature } from \"~/admin/features/updateWebhook/feature.js\";\nimport { DeleteWebhookFeature } from \"~/admin/features/deleteWebhook/feature.js\";\nimport { ListAvailableEventsFeature } from \"~/admin/features/listAvailableEvents/feature.js\";\nimport { WebhookPermissionsFeature } from \"~/admin/features/permissions/feature.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport { SigningSecret } from \"./SigningSecret.js\";\nimport { HasPermission } from \"~/admin/presentation/security/HasPermission.js\";\n\nconst SectionHeading = ({ field }: { field: any }) => {\n return <span className=\"text-md font-semibold\">{String(field.label ?? \"\")}</span>;\n};\n\nconst WebhookFormViewInner = observer(function WebhookFormViewInner() {\n const { presenter } = useFeature(WebhookFormPresenterFeature);\n const { goToRoute } = useRouter();\n const { route } = useRoute(Routes.Form);\n const toast = useToast();\n const id = route.params.id;\n const defaultRenderers = useFieldRenderers();\n\n const renderers = useMemo(() => {\n return {\n ...defaultRenderers,\n \"element:sectionHeading\": SectionHeading\n };\n }, [defaultRenderers]);\n\n useEffect(() => {\n void presenter.init(id);\n }, [presenter, id]);\n\n const saveForm = useCallback(async () => {\n const res = await presenter.save();\n if (res) {\n toast.showSuccessToast({ title: \"Webhook saved successfully!\" });\n }\n }, [presenter]);\n\n const { vm } = presenter;\n\n return (\n <SimpleForm>\n {vm.loading ? <OverlayLoader text={\"Loading...\"} /> : null}\n {vm.saving ? <OverlayLoader text={\"Saving...\"} /> : null}\n <FormErrors form={vm.form} className={\"mb-lg\"} />\n <SimpleFormHeader\n title={vm.isNew ? \"Create Webhook\" : (vm.webhook?.name ?? \"Edit Webhook\")}\n />\n <SimpleFormContent>\n <FormView name=\"Webhook\" form={vm.form} renderers={renderers} />\n <SigningSecret presenter={presenter} />\n </SimpleFormContent>\n <SimpleFormFooter className={\"border-t-sm border-t-neutral-dimmed pt-lg\"}>\n <Button variant=\"secondary\" onClick={() => goToRoute(Routes.List)}>\n Cancel\n </Button>\n <HasPermission entity=\"webhook\" action=\"edit\">\n <Button variant=\"primary\" onClick={saveForm} disabled={vm.saving}>\n {vm.saving ? \"Saving...\" : \"Save\"}\n </Button>\n </HasPermission>\n </SimpleFormFooter>\n </SimpleForm>\n );\n});\n\nexport const WebhookFormView = () => {\n const container = useContainer();\n\n const scopedContainer = useMemo(() => {\n const child = container.createChildContainer();\n GetWebhookFeature.register(child);\n CreateWebhookFeature.register(child);\n UpdateWebhookFeature.register(child);\n DeleteWebhookFeature.register(child);\n ListAvailableEventsFeature.register(child);\n WebhookPermissionsFeature.register(child);\n WebhookFormPresenterFeature.register(child);\n return child;\n }, []);\n\n return (\n <DiContainerProvider container={scopedContainer}>\n <WebhookFormViewInner />\n </DiContainerProvider>\n );\n};\n"],"names":["SectionHeading","field","String","WebhookFormViewInner","observer","presenter","useFeature","WebhookFormPresenterFeature","goToRoute","useRouter","route","useRoute","Routes","toast","useToast","id","defaultRenderers","useFieldRenderers","renderers","useMemo","useEffect","saveForm","useCallback","res","vm","SimpleForm","OverlayLoader","FormErrors","SimpleFormHeader","SimpleFormContent","FormView","SigningSecret","SimpleFormFooter","Button","HasPermission","WebhookFormView","container","useContainer","scopedContainer","child","GetWebhookFeature","CreateWebhookFeature","UpdateWebhookFeature","DeleteWebhookFeature","ListAvailableEventsFeature","WebhookPermissionsFeature","DiContainerProvider"],"mappings":";;;;;;;;;;;;;;;AA0BA,MAAMA,iBAAiB,CAAC,EAAEC,KAAK,EAAkB,GACtC,WAAP,GAAO,oBAAC;QAAK,WAAU;OAAyBC,OAAOD,MAAM,KAAK,IAAI;AAG1E,MAAME,uCAAuBC,SAAS;IAClC,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAM,EAAEC,KAAK,EAAE,GAAGC,SAASC,OAAO,IAAI;IACtC,MAAMC,QAAQC;IACd,MAAMC,KAAKL,MAAM,MAAM,CAAC,EAAE;IAC1B,MAAMM,mBAAmBC;IAEzB,MAAMC,YAAYC,QAAQ,IACf;YACH,GAAGH,gBAAgB;YACnB,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,qBAAqB,QAAQ,CAACH;QAC9BI,qBAAqB,QAAQ,CAACJ;QAC9BK,2BAA2B,QAAQ,CAACL;QACpCM,0BAA0B,QAAQ,CAACN;QACnChC,4BAA4B,QAAQ,CAACgC;QACrC,OAAOA;IACX,GAAG,EAAE;IAEL,OAAO,WAAP,GACI,oBAACO,qBAAmBA;QAAC,WAAWR;qBAC5B,oBAACnC,sCAAoBA;AAGjC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { SimpleDataSource } from "@webiny/app-admin/presentation/listPresenter/SimpleDataSource.js";
|
|
2
|
+
import type { FetchResult } from "@webiny/app-admin/presentation/listPresenter/FolderAwareDataSource.js";
|
|
3
|
+
import type { IDataSourceQuery } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
|
|
2
4
|
import type { Webhook } from "../../../admin/shared/types.js";
|
|
3
5
|
import type { IListWebhooksUseCase } from "../../../admin/features/ListWebhooks/abstractions.js";
|
|
4
|
-
export declare class WebhookListDataSource
|
|
6
|
+
export declare class WebhookListDataSource extends SimpleDataSource<Webhook> {
|
|
5
7
|
private readonly listWebhooksUseCase;
|
|
6
8
|
private _rows;
|
|
7
|
-
private _meta;
|
|
8
|
-
private _loading;
|
|
9
9
|
constructor(listWebhooksUseCase: IListWebhooksUseCase);
|
|
10
10
|
get rows(): Webhook[];
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
loadMore(params: IDataSourceQuery): Promise<void>;
|
|
11
|
+
fetch(params: IDataSourceQuery): Promise<FetchResult<Webhook>>;
|
|
12
|
+
onQueryResult(data: Webhook[]): void;
|
|
13
|
+
onLoadMoreResult(data: Webhook[]): void;
|
|
15
14
|
}
|
|
@@ -1,65 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { makeObservable, observable } from "mobx";
|
|
2
|
+
import { SimpleDataSource } from "@webiny/app-admin/presentation/listPresenter/SimpleDataSource.js";
|
|
3
|
+
class WebhookListDataSource extends SimpleDataSource {
|
|
3
4
|
constructor(listWebhooksUseCase){
|
|
4
|
-
this.listWebhooksUseCase = listWebhooksUseCase;
|
|
5
|
-
this
|
|
6
|
-
|
|
7
|
-
cursor: null,
|
|
8
|
-
hasMoreItems: false,
|
|
9
|
-
totalCount: 0
|
|
10
|
-
};
|
|
11
|
-
this._loading = false;
|
|
12
|
-
makeAutoObservable(this, {
|
|
13
|
-
listWebhooksUseCase: false,
|
|
14
|
-
rows: computed
|
|
5
|
+
super(), this.listWebhooksUseCase = listWebhooksUseCase, this._rows = [];
|
|
6
|
+
makeObservable(this, {
|
|
7
|
+
_rows: observable
|
|
15
8
|
});
|
|
16
9
|
}
|
|
17
10
|
get rows() {
|
|
18
11
|
return this._rows;
|
|
19
12
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return this._loading;
|
|
25
|
-
}
|
|
26
|
-
async query(params) {
|
|
27
|
-
this._loading = true;
|
|
13
|
+
async fetch(params) {
|
|
14
|
+
const sort = params.sort ? [
|
|
15
|
+
`${params.sort.field}_${params.sort.direction}`
|
|
16
|
+
] : void 0;
|
|
28
17
|
const result = await this.listWebhooksUseCase.execute({
|
|
29
18
|
where: params.filters,
|
|
19
|
+
sort,
|
|
30
20
|
limit: params.limit,
|
|
31
21
|
after: params.cursor
|
|
32
22
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
hasMoreItems: result.meta.hasMoreItems,
|
|
38
|
-
totalCount: result.meta.totalCount
|
|
39
|
-
};
|
|
40
|
-
this._loading = false;
|
|
41
|
-
});
|
|
23
|
+
return {
|
|
24
|
+
data: result.items,
|
|
25
|
+
meta: result.meta
|
|
26
|
+
};
|
|
42
27
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
runInAction(()=>{
|
|
52
|
-
this._rows = [
|
|
53
|
-
...this._rows,
|
|
54
|
-
...result.items
|
|
55
|
-
];
|
|
56
|
-
this._meta = {
|
|
57
|
-
cursor: result.meta.cursor,
|
|
58
|
-
hasMoreItems: result.meta.hasMoreItems,
|
|
59
|
-
totalCount: result.meta.totalCount
|
|
60
|
-
};
|
|
61
|
-
this._loading = false;
|
|
62
|
-
});
|
|
28
|
+
onQueryResult(data) {
|
|
29
|
+
this._rows = data;
|
|
30
|
+
}
|
|
31
|
+
onLoadMoreResult(data) {
|
|
32
|
+
this._rows = [
|
|
33
|
+
...this._rows,
|
|
34
|
+
...data
|
|
35
|
+
];
|
|
63
36
|
}
|
|
64
37
|
}
|
|
65
38
|
export { WebhookListDataSource };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookList/WebhookListDataSource.js","sources":["../../../../src/admin/presentation/WebhookList/WebhookListDataSource.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookList/WebhookListDataSource.js","sources":["../../../../src/admin/presentation/WebhookList/WebhookListDataSource.ts"],"sourcesContent":["import { makeObservable, observable } from \"mobx\";\nimport { SimpleDataSource } from \"@webiny/app-admin/presentation/listPresenter/SimpleDataSource.js\";\nimport type { FetchResult } from \"@webiny/app-admin/presentation/listPresenter/FolderAwareDataSource.js\";\nimport type { IDataSourceQuery } from \"@webiny/app-admin/presentation/listPresenter/abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\nimport type { IListWebhooksUseCase } from \"~/admin/features/ListWebhooks/abstractions.js\";\n\nexport class WebhookListDataSource extends SimpleDataSource<Webhook> {\n private _rows: Webhook[] = [];\n\n constructor(private readonly listWebhooksUseCase: IListWebhooksUseCase) {\n super();\n makeObservable<WebhookListDataSource, \"_rows\">(this, {\n _rows: observable\n });\n }\n\n get rows(): Webhook[] {\n return this._rows;\n }\n\n async fetch(params: IDataSourceQuery): Promise<FetchResult<Webhook>> {\n const sort = params.sort ? [`${params.sort.field}_${params.sort.direction}`] : undefined;\n const result = await this.listWebhooksUseCase.execute({\n where: params.filters as { enabled?: boolean } | undefined,\n sort,\n limit: params.limit,\n after: params.cursor\n });\n return { data: result.items, meta: result.meta };\n }\n\n override onQueryResult(data: Webhook[]): void {\n this._rows = data;\n }\n\n override onLoadMoreResult(data: Webhook[]): void {\n this._rows = [...this._rows, ...data];\n }\n}\n"],"names":["WebhookListDataSource","SimpleDataSource","listWebhooksUseCase","makeObservable","observable","params","sort","undefined","result","data"],"mappings":";;AAOO,MAAMA,8BAA8BC;IAGvC,YAA6BC,mBAAyC,CAAE;QACpE,KAAK,SADoBA,mBAAmB,GAAnBA,qBAAAA,IAAAA,CAFrB,KAAK,GAAc,EAAE;QAIzBC,eAA+C,IAAI,EAAE;YACjD,OAAOC;QACX;IACJ;IAEA,IAAI,OAAkB;QAClB,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,MAAM,MAAMC,MAAwB,EAAiC;QACjE,MAAMC,OAAOD,OAAO,IAAI,GAAG;YAAC,GAAGA,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAEA,OAAO,IAAI,CAAC,SAAS,EAAE;SAAC,GAAGE;QAC/E,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAClD,OAAOH,OAAO,OAAO;YACrBC;YACA,OAAOD,OAAO,KAAK;YACnB,OAAOA,OAAO,MAAM;QACxB;QACA,OAAO;YAAE,MAAMG,OAAO,KAAK;YAAE,MAAMA,OAAO,IAAI;QAAC;IACnD;IAES,cAAcC,IAAe,EAAQ;QAC1C,IAAI,CAAC,KAAK,GAAGA;IACjB;IAES,iBAAiBA,IAAe,EAAQ;QAC7C,IAAI,CAAC,KAAK,GAAG;eAAI,IAAI,CAAC,KAAK;eAAKA;SAAK;IACzC;AACJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { useRouter } from "@webiny/app-admin";
|
|
3
|
+
import { Button } from "@webiny/admin-ui";
|
|
4
|
+
import { ReactComponent } from "@webiny/icons/list.svg";
|
|
5
|
+
import { Routes } from "../../../routes.js";
|
|
6
|
+
const WebhookDeliveriesButton = ()=>{
|
|
7
|
+
const { goToRoute } = useRouter();
|
|
8
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
9
|
+
variant: "secondary",
|
|
10
|
+
onClick: ()=>goToRoute(Routes.Deliveries),
|
|
11
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
12
|
+
}, "All Deliveries");
|
|
13
|
+
};
|
|
14
|
+
export { WebhookDeliveriesButton };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=WebhookDeliveriesButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookList/components/WebhookDeliveriesButton.js","sources":["../../../../../src/admin/presentation/WebhookList/components/WebhookDeliveriesButton.tsx"],"sourcesContent":["import React from \"react\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { Button } from \"@webiny/admin-ui\";\nimport { ReactComponent as ListIcon } from \"@webiny/icons/list.svg\";\nimport { Routes } from \"~/admin/routes.js\";\n\nexport const WebhookDeliveriesButton = () => {\n const { goToRoute } = useRouter();\n\n return (\n <Button\n variant=\"secondary\"\n onClick={() => goToRoute(Routes.Deliveries)}\n icon={<ListIcon />}\n >\n All Deliveries\n </Button>\n );\n};\n"],"names":["WebhookDeliveriesButton","goToRoute","useRouter","Button","Routes","ListIcon"],"mappings":";;;;;AAMO,MAAMA,0BAA0B;IACnC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IAEtB,OAAO,WAAP,GACI,oBAACC,QAAMA;QACH,SAAQ;QACR,SAAS,IAAMF,UAAUG,OAAO,UAAU;QAC1C,oBAAM,oBAACC,gBAAQA;OAClB;AAIT"}
|
|
@@ -2,8 +2,8 @@ import react, { useCallback, useMemo } from "react";
|
|
|
2
2
|
import debounce from "lodash/debounce.js";
|
|
3
3
|
import { observer } from "mobx-react-lite";
|
|
4
4
|
import { useRouter } from "@webiny/app-admin";
|
|
5
|
-
import { DataTable, DropdownMenu, IconButton, Scrollbar, Tag, Text, TimeAgo } from "@webiny/admin-ui";
|
|
6
|
-
import { useConfirmationDialog
|
|
5
|
+
import { Button, DataTable, DropdownMenu, IconButton, Scrollbar, Tag, Text, TimeAgo, useToast } from "@webiny/admin-ui";
|
|
6
|
+
import { useConfirmationDialog } from "@webiny/app-admin/hooks/index.js";
|
|
7
7
|
import { HasPermission } from "../../security/HasPermission.js";
|
|
8
8
|
import { ReactComponent } from "@webiny/icons/more_vert.svg";
|
|
9
9
|
import { ReactComponent as edit_svg_ReactComponent } from "@webiny/icons/edit.svg";
|
|
@@ -14,7 +14,7 @@ import { Routes } from "../../../routes.js";
|
|
|
14
14
|
const WebhookListContent_WebhookListContent = observer(function({ presenter }) {
|
|
15
15
|
const { vm } = presenter;
|
|
16
16
|
const { goToRoute } = useRouter();
|
|
17
|
-
const
|
|
17
|
+
const toast = useToast();
|
|
18
18
|
const { showConfirmation: showDeleteConfirmation } = useConfirmationDialog({
|
|
19
19
|
title: "Delete Webhook",
|
|
20
20
|
message: "Are you sure you want to delete this webhook?"
|
|
@@ -84,6 +84,18 @@ const WebhookListContent_WebhookListContent = observer(function({ presenter }) {
|
|
|
84
84
|
enableSorting: true,
|
|
85
85
|
size: 120
|
|
86
86
|
},
|
|
87
|
+
deliveries: {
|
|
88
|
+
header: "Deliveries",
|
|
89
|
+
truncate: false,
|
|
90
|
+
cell: (row)=>/*#__PURE__*/ react.createElement(Button, {
|
|
91
|
+
variant: "secondary",
|
|
92
|
+
onClick: ()=>{
|
|
93
|
+
goToRoute(Routes.Deliveries, {
|
|
94
|
+
webhookId: row.id
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}, "Deliveries")
|
|
98
|
+
},
|
|
87
99
|
actions: {
|
|
88
100
|
header: " ",
|
|
89
101
|
cell: (row)=>/*#__PURE__*/ react.createElement(DropdownMenu, {
|
|
@@ -106,7 +118,9 @@ const WebhookListContent_WebhookListContent = observer(function({ presenter }) {
|
|
|
106
118
|
icon: /*#__PURE__*/ react.createElement(webhook_svg_ReactComponent, null),
|
|
107
119
|
onClick: ()=>{
|
|
108
120
|
presenter.triggerWebhook(row.id).then(()=>{
|
|
109
|
-
|
|
121
|
+
toast.showSuccessToast({
|
|
122
|
+
title: "Test event triggered!"
|
|
123
|
+
});
|
|
110
124
|
});
|
|
111
125
|
},
|
|
112
126
|
text: "Trigger Test"
|
|
@@ -114,6 +128,7 @@ const WebhookListContent_WebhookListContent = observer(function({ presenter }) {
|
|
|
114
128
|
entity: "webhook",
|
|
115
129
|
action: "delete"
|
|
116
130
|
}, /*#__PURE__*/ react.createElement(DropdownMenu.Separator, null), /*#__PURE__*/ react.createElement(DropdownMenu.Item, {
|
|
131
|
+
variant: "destructive",
|
|
117
132
|
onClick: ()=>{
|
|
118
133
|
showDeleteConfirmation(()=>presenter.deleteWebhook(row.id));
|
|
119
134
|
},
|
|
@@ -126,10 +141,7 @@ const WebhookListContent_WebhookListContent = observer(function({ presenter }) {
|
|
|
126
141
|
enableResizing: false
|
|
127
142
|
}
|
|
128
143
|
}), [
|
|
129
|
-
presenter
|
|
130
|
-
goToRoute,
|
|
131
|
-
showDeleteConfirmation,
|
|
132
|
-
showSnackbar
|
|
144
|
+
presenter
|
|
133
145
|
]);
|
|
134
146
|
if (!vm.list.pagination.loading && 0 === vm.list.rows.length) return /*#__PURE__*/ react.createElement("div", {
|
|
135
147
|
className: "flex-1 overflow-hidden"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookList/components/WebhookListContent.js","sources":["../../../../../src/admin/presentation/WebhookList/components/WebhookListContent.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport type { DataTableSorting, OnDataTableSortingChange } from \"@webiny/admin-ui\";\nimport {\n DataTable,\n DropdownMenu,\n IconButton,\n Scrollbar,\n Tag,\n Text,\n TimeAgo\n} from \"@webiny/admin-ui\";\nimport { useConfirmationDialog, useSnackbar } from \"@webiny/app-admin/hooks/index.js\";\nimport { HasPermission } from \"~/admin/presentation/security/HasPermission.js\";\nimport { ReactComponent as MoreVerticalIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as Edit } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as Delete } from \"@webiny/icons/delete.svg\";\nimport { ReactComponent as WebhookIcon } from \"@webiny/icons/webhook.svg\";\nimport { CreateWebhookButton } from \"./CreateWebhookButton.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport type { IWebhookListPresenter } from \"../abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\ninterface WebhookListContentProps {\n presenter: IWebhookListPresenter;\n}\n\nexport const WebhookListContent = observer(function WebhookListContent({\n presenter\n}: WebhookListContentProps) {\n const { vm } = presenter;\n const { goToRoute } = useRouter();\n const { showSnackbar } = useSnackbar();\n\n const { showConfirmation: showDeleteConfirmation } = useConfirmationDialog({\n title: \"Delete Webhook\",\n message: \"Are you sure you want to delete this webhook?\"\n });\n\n const loadMoreOnScroll = useMemo(\n () =>\n debounce(async ({ scrollFrame }: { scrollFrame: { top: number } }) => {\n if (scrollFrame.top > 0.8) {\n await presenter.loadMore();\n }\n }, 200),\n [presenter]\n );\n\n const sorting: DataTableSorting = useMemo(() => {\n const sort = vm.list.sort;\n if (!sort || !sort.field) {\n return [];\n }\n return [{ id: sort.field, desc: sort.direction === \"DESC\" }];\n }, [vm.list.sort]);\n\n const onSortingChange: OnDataTableSortingChange = useCallback(\n updater => {\n const next = typeof updater === \"function\" ? updater(sorting) : updater;\n if (next.length > 0) {\n const { id, desc } = next[0];\n presenter.sort.set(id, desc ? \"DESC\" : \"ASC\");\n }\n },\n [sorting, presenter.sort]\n );\n\n const columns = useMemo(\n () => ({\n name: {\n header: \"Name\",\n cell: (row: Webhook) => (\n <Text\n className=\"cursor-pointer text-primary hover:underline\"\n onClick={() => goToRoute(Routes.Form, { id: row.id })}\n >\n {row.name}\n </Text>\n ),\n enableSorting: true,\n size: 200\n },\n endpointUrl: {\n header: \"Endpoint\",\n cell: (row: Webhook) => (\n <Text className=\"font-mono text-sm truncate\">{row.endpointUrl}</Text>\n ),\n size: 250\n },\n enabled: {\n header: \"Status\",\n cell: (row: Webhook) => (\n <Tag\n variant={row.enabled ? \"success\" : \"neutral-muted\"}\n content={row.enabled ? \"Active\" : \"Disabled\"}\n />\n ),\n enableSorting: true,\n size: 100\n },\n createdOn: {\n header: \"Created\",\n cell: (row: Webhook) =>\n row.createdOn ? <TimeAgo datetime={row.createdOn} /> : <Text size=\"sm\">—</Text>,\n enableSorting: true,\n size: 120\n },\n actions: {\n header: \" \",\n cell: (row: Webhook) => (\n <DropdownMenu\n trigger={\n <IconButton\n icon={<MoreVerticalIcon />}\n variant=\"ghost\"\n size=\"sm\"\n aria-label=\"Actions\"\n />\n }\n >\n <DropdownMenu.Item\n icon={<Edit />}\n onClick={() => goToRoute(Routes.Form, { id: row.id })}\n text={\"Edit\"}\n />\n <HasPermission entity=\"webhook\" action=\"edit\">\n <DropdownMenu.Item\n icon={<WebhookIcon />}\n onClick={() => {\n void presenter.triggerWebhook(row.id).then(() => {\n showSnackbar(\"Test event triggered.\");\n });\n }}\n text={\"Trigger Test\"}\n />\n </HasPermission>\n <HasPermission entity=\"webhook\" action=\"delete\">\n <DropdownMenu.Separator />\n <DropdownMenu.Item\n onClick={() => {\n showDeleteConfirmation(() => presenter.deleteWebhook(row.id));\n }}\n icon={<Delete />}\n text={\"Delete\"}\n />\n </HasPermission>\n </DropdownMenu>\n ),\n size: 56,\n enableSorting: false,\n enableHiding: false,\n enableResizing: false\n }\n }),\n [presenter, goToRoute, showDeleteConfirmation, showSnackbar]\n );\n\n if (!vm.list.pagination.loading && vm.list.rows.length === 0) {\n return (\n <div className=\"flex-1 overflow-hidden\">\n <div className=\"flex flex-col items-center justify-center h-full gap-md\">\n <Text className=\"text-neutral-strong\">No webhooks found.</Text>\n <CreateWebhookButton />\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex-1 overflow-hidden\">\n <Scrollbar onScrollFrame={scrollFrame => loadMoreOnScroll({ scrollFrame })}>\n <DataTable<Webhook>\n columns={columns}\n data={vm.list.rows}\n loading={vm.list.pagination.loading}\n sorting={sorting}\n onSortingChange={onSortingChange}\n stickyHeader\n />\n </Scrollbar>\n </div>\n );\n});\n"],"names":["WebhookListContent","observer","presenter","vm","goToRoute","useRouter","showSnackbar","useSnackbar","showDeleteConfirmation","useConfirmationDialog","loadMoreOnScroll","useMemo","debounce","scrollFrame","sorting","sort","onSortingChange","useCallback","updater","next","id","desc","columns","row","Text","Routes","Tag","TimeAgo","DropdownMenu","IconButton","MoreVerticalIcon","Edit","HasPermission","WebhookIcon","Delete","CreateWebhookButton","Scrollbar","DataTable"],"mappings":";;;;;;;;;;;;;AA6BO,MAAMA,wCAAqBC,SAAS,SAA4B,EACnEC,SAAS,EACa;IACtB,MAAM,EAAEC,EAAE,EAAE,GAAGD;IACf,MAAM,EAAEE,SAAS,EAAE,GAAGC;IACtB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAM,EAAE,kBAAkBC,sBAAsB,EAAE,GAAGC,sBAAsB;QACvE,OAAO;QACP,SAAS;IACb;IAEA,MAAMC,mBAAmBC,QACrB,IACIC,SAAS,OAAO,EAAEC,WAAW,EAAoC;YAC7D,IAAIA,YAAY,GAAG,GAAG,KAClB,MAAMX,UAAU,QAAQ;QAEhC,GAAG,MACP;QAACA;KAAU;IAGf,MAAMY,UAA4BH,QAAQ;QACtC,MAAMI,OAAOZ,GAAG,IAAI,CAAC,IAAI;QACzB,IAAI,CAACY,QAAQ,CAACA,KAAK,KAAK,EACpB,OAAO,EAAE;QAEb,OAAO;YAAC;gBAAE,IAAIA,KAAK,KAAK;gBAAE,MAAMA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AI;QAClB,SAASA,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO;QACnC,SAASW;QACT,iBAAiBE;QACjB;;AAKpB"}
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookList/components/WebhookListContent.js","sources":["../../../../../src/admin/presentation/WebhookList/components/WebhookListContent.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport type { DataTableSorting, OnDataTableSortingChange } from \"@webiny/admin-ui\";\nimport {\n Button,\n DataTable,\n DropdownMenu,\n IconButton,\n Scrollbar,\n Tag,\n Text,\n TimeAgo\n} from \"@webiny/admin-ui\";\nimport { useToast } from \"@webiny/admin-ui\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/index.js\";\nimport { HasPermission } from \"~/admin/presentation/security/HasPermission.js\";\nimport { ReactComponent as MoreVerticalIcon } from \"@webiny/icons/more_vert.svg\";\nimport { ReactComponent as Edit } from \"@webiny/icons/edit.svg\";\nimport { ReactComponent as Delete } from \"@webiny/icons/delete.svg\";\nimport { ReactComponent as WebhookIcon } from \"@webiny/icons/webhook.svg\";\nimport { CreateWebhookButton } from \"./CreateWebhookButton.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport type { IWebhookListPresenter } from \"../abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\ninterface WebhookListContentProps {\n presenter: IWebhookListPresenter;\n}\n\nexport const WebhookListContent = observer(function WebhookListContent({\n presenter\n}: WebhookListContentProps) {\n const { vm } = presenter;\n const { goToRoute } = useRouter();\n const toast = useToast();\n\n const { showConfirmation: showDeleteConfirmation } = useConfirmationDialog({\n title: \"Delete Webhook\",\n message: \"Are you sure you want to delete this webhook?\"\n });\n\n const loadMoreOnScroll = useMemo(\n () =>\n debounce(async ({ scrollFrame }: { scrollFrame: { top: number } }) => {\n if (scrollFrame.top > 0.8) {\n await presenter.loadMore();\n }\n }, 200),\n [presenter]\n );\n\n const sorting: DataTableSorting = useMemo(() => {\n const sort = vm.list.sort;\n if (!sort || !sort.field) {\n return [];\n }\n return [{ id: sort.field, desc: sort.direction === \"DESC\" }];\n }, [vm.list.sort]);\n\n const onSortingChange: OnDataTableSortingChange = useCallback(\n updater => {\n const next = typeof updater === \"function\" ? updater(sorting) : updater;\n if (next.length > 0) {\n const { id, desc } = next[0];\n presenter.sort.set(id, desc ? \"DESC\" : \"ASC\");\n }\n },\n [sorting, presenter.sort]\n );\n\n const columns = useMemo(\n () => ({\n name: {\n header: \"Name\",\n cell: (row: Webhook) => (\n <Text\n className=\"cursor-pointer text-primary hover:underline\"\n onClick={() => goToRoute(Routes.Form, { id: row.id })}\n >\n {row.name}\n </Text>\n ),\n enableSorting: true,\n size: 200\n },\n endpointUrl: {\n header: \"Endpoint\",\n cell: (row: Webhook) => (\n <Text className=\"font-mono text-sm truncate\">{row.endpointUrl}</Text>\n ),\n size: 250\n },\n enabled: {\n header: \"Status\",\n cell: (row: Webhook) => (\n <Tag\n variant={row.enabled ? \"success\" : \"neutral-muted\"}\n content={row.enabled ? \"Active\" : \"Disabled\"}\n />\n ),\n enableSorting: true,\n size: 100\n },\n createdOn: {\n header: \"Created\",\n cell: (row: Webhook) =>\n row.createdOn ? <TimeAgo datetime={row.createdOn} /> : <Text size=\"sm\">—</Text>,\n enableSorting: true,\n size: 120\n },\n deliveries: {\n header: \"Deliveries\",\n truncate: false,\n cell: (row: Webhook) => {\n return (\n <Button\n variant={\"secondary\"}\n onClick={() => {\n goToRoute(Routes.Deliveries, { webhookId: row.id });\n }}\n >\n Deliveries\n </Button>\n );\n }\n },\n actions: {\n header: \" \",\n cell: (row: Webhook) => (\n <DropdownMenu\n trigger={\n <IconButton\n icon={<MoreVerticalIcon />}\n variant=\"ghost\"\n size=\"sm\"\n aria-label=\"Actions\"\n />\n }\n >\n <DropdownMenu.Item\n icon={<Edit />}\n onClick={() => goToRoute(Routes.Form, { id: row.id })}\n text={\"Edit\"}\n />\n <HasPermission entity=\"webhook\" action=\"edit\">\n <DropdownMenu.Item\n icon={<WebhookIcon />}\n onClick={() => {\n void presenter.triggerWebhook(row.id).then(() => {\n toast.showSuccessToast({ title: \"Test event triggered!\" });\n });\n }}\n text={\"Trigger Test\"}\n />\n </HasPermission>\n <HasPermission entity=\"webhook\" action=\"delete\">\n <DropdownMenu.Separator />\n <DropdownMenu.Item\n variant={\"destructive\"}\n onClick={() => {\n showDeleteConfirmation(() => presenter.deleteWebhook(row.id));\n }}\n icon={<Delete />}\n text={\"Delete\"}\n />\n </HasPermission>\n </DropdownMenu>\n ),\n size: 56,\n enableSorting: false,\n enableHiding: false,\n enableResizing: false\n }\n }),\n [presenter]\n );\n\n if (!vm.list.pagination.loading && vm.list.rows.length === 0) {\n return (\n <div className=\"flex-1 overflow-hidden\">\n <div className=\"flex flex-col items-center justify-center h-full gap-md\">\n <Text className=\"text-neutral-strong\">No webhooks found.</Text>\n <CreateWebhookButton />\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex-1 overflow-hidden\">\n <Scrollbar onScrollFrame={scrollFrame => loadMoreOnScroll({ scrollFrame })}>\n <DataTable<Webhook>\n columns={columns}\n data={vm.list.rows}\n loading={vm.list.pagination.loading}\n sorting={sorting}\n onSortingChange={onSortingChange}\n stickyHeader\n />\n </Scrollbar>\n </div>\n );\n});\n"],"names":["WebhookListContent","observer","presenter","vm","goToRoute","useRouter","toast","useToast","showDeleteConfirmation","useConfirmationDialog","loadMoreOnScroll","useMemo","debounce","scrollFrame","sorting","sort","onSortingChange","useCallback","updater","next","id","desc","columns","row","Text","Routes","Tag","TimeAgo","Button","DropdownMenu","IconButton","MoreVerticalIcon","Edit","HasPermission","WebhookIcon","Delete","CreateWebhookButton","Scrollbar","DataTable"],"mappings":";;;;;;;;;;;;;AA+BO,MAAMA,wCAAqBC,SAAS,SAA4B,EACnEC,SAAS,EACa;IACtB,MAAM,EAAEC,EAAE,EAAE,GAAGD;IACf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QAAO;wBAAU,QAAO;qCACnC,oBAACJ,aAAa,SAAS,uBACvB,oBAACA,aAAa,IAAI;wBACd,SAAS;wBACT,SAAS;4BACLrB,uBAAuB,IAAMN,UAAU,aAAa,CAACqB,IAAI,EAAE;wBAC/D;wBACA,oBAAM,oBAACY,2BAAMA;wBACb,MAAM;;gBAKtB,MAAM;gBACN,eAAe;gBACf,cAAc;gBACd,gBAAgB;YACpB;QACJ,IACA;QAACjC;KAAU;IAGf,IAAI,CAACC,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,IAAIA,AAAwB,MAAxBA,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAClD,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACqB,MAAIA;QAAC,WAAU;OAAsB,qCACtC,oBAACY,qBAAmBA;IAMpC,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,WAASA;QAAC,eAAexB,CAAAA,cAAeH,iBAAiB;gBAAEG;YAAY;qBACpE,oBAACyB,WAASA;QACN,SAAShB;QACT,MAAMnB,GAAG,IAAI,CAAC,IAAI;QAClB,SAASA,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO;QACnC,SAASW;QACT,iBAAiBE;QACjB;;AAKpB"}
|
|
@@ -9,6 +9,7 @@ import { TriggerWebhookFeature } from "../../../features/triggerWebhook/feature.
|
|
|
9
9
|
import { WebhookPermissionsFeature } from "../../../features/permissions/feature.js";
|
|
10
10
|
import { CreateWebhookButton } from "./CreateWebhookButton.js";
|
|
11
11
|
import { WebhookListContent } from "./WebhookListContent.js";
|
|
12
|
+
import { WebhookDeliveriesButton } from "./WebhookDeliveriesButton.js";
|
|
12
13
|
const WebhookListView_WebhookListViewInner = observer(function() {
|
|
13
14
|
const { presenter } = useFeature(WebhookListPresenterFeature);
|
|
14
15
|
useEffect(()=>{
|
|
@@ -22,7 +23,9 @@ const WebhookListView_WebhookListViewInner = observer(function() {
|
|
|
22
23
|
className: "flex items-center justify-between py-sm px-md"
|
|
23
24
|
}, /*#__PURE__*/ react.createElement(Heading, {
|
|
24
25
|
level: 5
|
|
25
|
-
}, "Webhooks"), /*#__PURE__*/ react.createElement(
|
|
26
|
+
}, "Webhooks"), /*#__PURE__*/ react.createElement("div", {
|
|
27
|
+
className: "flex gap-sm"
|
|
28
|
+
}, /*#__PURE__*/ react.createElement(WebhookDeliveriesButton, null), /*#__PURE__*/ react.createElement(CreateWebhookButton, null))), /*#__PURE__*/ react.createElement(Separator, null), /*#__PURE__*/ react.createElement(WebhookListContent, {
|
|
26
29
|
presenter: presenter
|
|
27
30
|
}));
|
|
28
31
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookList/components/WebhookListView.js","sources":["../../../../../src/admin/presentation/WebhookList/components/WebhookListView.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature } from \"@webiny/app\";\nimport { Heading, Separator } from \"@webiny/admin-ui\";\nimport { WebhookListPresenterFeature } from \"../feature.js\";\nimport { ListWebhooksFeature } from \"~/admin/features/ListWebhooks/feature.js\";\nimport { DeleteWebhookFeature } from \"~/admin/features/deleteWebhook/feature.js\";\nimport { TriggerWebhookFeature } from \"~/admin/features/triggerWebhook/feature.js\";\nimport { WebhookPermissionsFeature } from \"~/admin/features/permissions/feature.js\";\nimport { CreateWebhookButton } from \"./CreateWebhookButton.js\";\nimport { WebhookListContent } from \"./WebhookListContent.js\";\n\nconst WebhookListViewInner = observer(function WebhookListViewInner() {\n const { presenter } = useFeature(WebhookListPresenterFeature);\n\n useEffect(() => {\n presenter.init();\n }, [presenter]);\n\n return (\n <div className=\"flex flex-col h-main-content\">\n <div className=\"flex items-center justify-between py-sm px-md\">\n <Heading level={5}>Webhooks</Heading>\n <CreateWebhookButton />\n </div>\n <Separator />\n <WebhookListContent presenter={presenter} />\n </div>\n );\n});\n\nexport const WebhookListView = () => {\n const container = useContainer();\n\n const scopedContainer = useMemo(() => {\n const child = container.createChildContainer();\n ListWebhooksFeature.register(child);\n DeleteWebhookFeature.register(child);\n TriggerWebhookFeature.register(child);\n WebhookPermissionsFeature.register(child);\n WebhookListPresenterFeature.register(child);\n return child;\n }, []);\n\n return (\n <DiContainerProvider container={scopedContainer}>\n <WebhookListViewInner />\n </DiContainerProvider>\n );\n};\n"],"names":["WebhookListViewInner","observer","presenter","useFeature","WebhookListPresenterFeature","useEffect","Heading","CreateWebhookButton","Separator","WebhookListContent","WebhookListView","container","useContainer","scopedContainer","useMemo","child","ListWebhooksFeature","DeleteWebhookFeature","TriggerWebhookFeature","WebhookPermissionsFeature","DiContainerProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookList/components/WebhookListView.js","sources":["../../../../../src/admin/presentation/WebhookList/components/WebhookListView.tsx"],"sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature } from \"@webiny/app\";\nimport { Heading, Separator } from \"@webiny/admin-ui\";\nimport { WebhookListPresenterFeature } from \"../feature.js\";\nimport { ListWebhooksFeature } from \"~/admin/features/ListWebhooks/feature.js\";\nimport { DeleteWebhookFeature } from \"~/admin/features/deleteWebhook/feature.js\";\nimport { TriggerWebhookFeature } from \"~/admin/features/triggerWebhook/feature.js\";\nimport { WebhookPermissionsFeature } from \"~/admin/features/permissions/feature.js\";\nimport { CreateWebhookButton } from \"./CreateWebhookButton.js\";\nimport { WebhookListContent } from \"./WebhookListContent.js\";\nimport { WebhookDeliveriesButton } from \"~/admin/presentation/WebhookList/components/WebhookDeliveriesButton.js\";\n\nconst WebhookListViewInner = observer(function WebhookListViewInner() {\n const { presenter } = useFeature(WebhookListPresenterFeature);\n\n useEffect(() => {\n presenter.init();\n }, [presenter]);\n\n return (\n <div className=\"flex flex-col h-main-content\">\n <div className=\"flex items-center justify-between py-sm px-md\">\n <Heading level={5}>Webhooks</Heading>\n <div className={\"flex gap-sm\"}>\n <WebhookDeliveriesButton />\n <CreateWebhookButton />\n </div>\n </div>\n <Separator />\n <WebhookListContent presenter={presenter} />\n </div>\n );\n});\n\nexport const WebhookListView = () => {\n const container = useContainer();\n\n const scopedContainer = useMemo(() => {\n const child = container.createChildContainer();\n ListWebhooksFeature.register(child);\n DeleteWebhookFeature.register(child);\n TriggerWebhookFeature.register(child);\n WebhookPermissionsFeature.register(child);\n WebhookListPresenterFeature.register(child);\n return child;\n }, []);\n\n return (\n <DiContainerProvider container={scopedContainer}>\n <WebhookListViewInner />\n </DiContainerProvider>\n );\n};\n"],"names":["WebhookListViewInner","observer","presenter","useFeature","WebhookListPresenterFeature","useEffect","Heading","WebhookDeliveriesButton","CreateWebhookButton","Separator","WebhookListContent","WebhookListView","container","useContainer","scopedContainer","useMemo","child","ListWebhooksFeature","DeleteWebhookFeature","TriggerWebhookFeature","WebhookPermissionsFeature","DiContainerProvider"],"mappings":";;;;;;;;;;;;AAaA,MAAMA,uCAAuBC,SAAS;IAClC,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IAEjCC,UAAU;QACNH,UAAU,IAAI;IAClB,GAAG;QAACA;KAAU;IAEd,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACI,SAAOA;QAAC,OAAO;OAAG,2BACnB,oBAAC;QAAI,WAAW;qBACZ,oBAACC,yBAAuBA,OAAAA,WAAAA,GACxB,oBAACC,qBAAmBA,SAAAA,WAAAA,GAG5B,oBAACC,WAASA,OAAAA,WAAAA,GACV,oBAACC,oBAAkBA;QAAC,WAAWR;;AAG3C;AAEO,MAAMS,kBAAkB;IAC3B,MAAMC,YAAYC;IAElB,MAAMC,kBAAkBC,QAAQ;QAC5B,MAAMC,QAAQJ,UAAU,oBAAoB;QAC5CK,oBAAoB,QAAQ,CAACD;QAC7BE,qBAAqB,QAAQ,CAACF;QAC9BG,sBAAsB,QAAQ,CAACH;QAC/BI,0BAA0B,QAAQ,CAACJ;QACnCZ,4BAA4B,QAAQ,CAACY;QACrC,OAAOA;IACX,GAAG,EAAE;IAEL,OAAO,WAAP,GACI,oBAACK,qBAAmBA;QAAC,WAAWP;qBAC5B,oBAACd,sCAAoBA;AAGjC"}
|
|
@@ -38,7 +38,9 @@ class WebhookSettingsPresenterImpl {
|
|
|
38
38
|
async save() {
|
|
39
39
|
const data = await this._form.submit();
|
|
40
40
|
if (false === data) return false;
|
|
41
|
-
|
|
41
|
+
runInAction(()=>{
|
|
42
|
+
this._saving = true;
|
|
43
|
+
});
|
|
42
44
|
try {
|
|
43
45
|
const settings = await this.updateWebhookSettingsUseCase.execute({
|
|
44
46
|
signingSecret: data.signingSecret || void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookSettings/WebhookSettingsPresenter.js","sources":["../../../../src/admin/presentation/WebhookSettings/WebhookSettingsPresenter.ts"],"sourcesContent":["import { computed, makeAutoObservable, runInAction } from \"mobx\";\nimport {\n WebhookSettingsPresenter as Abstraction,\n type IWebhookSettingsPresenter,\n type IWebhookSettingsViewModel\n} from \"./abstractions.js\";\nimport { GetWebhookSettingsUseCase } from \"~/admin/features/getWebhookSettings/abstractions.js\";\nimport { UpdateWebhookSettingsUseCase } from \"~/admin/features/updateWebhookSettings/abstractions.js\";\nimport {\n FormModelFactory,\n type IFormModel\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { WEBHOOK_DELIVERY_MAX_RETENTION_DAYS } from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsPresenterImpl implements IWebhookSettingsPresenter {\n private _loading = false;\n private _saving = false;\n private _form: IFormModel;\n\n public get vm(): IWebhookSettingsViewModel {\n return {\n loading: this._loading,\n saving: this._saving,\n form: this._form.vm\n };\n }\n\n public constructor(\n private readonly formModelFactory: FormModelFactory.Interface,\n private readonly getWebhookSettingsUseCase: GetWebhookSettingsUseCase.Interface,\n private readonly updateWebhookSettingsUseCase: UpdateWebhookSettingsUseCase.Interface\n ) {\n this._form = this.buildForm();\n\n makeAutoObservable(this, { vm: computed });\n }\n\n private buildForm(): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n signingSecret: fields\n .text()\n .label(\"Signing Secret\")\n .placeholder(\"Enter a signing secret for webhook payloads\")\n .description(\n \"Used to sign webhook payloads so receivers can verify authenticity.\"\n ),\n deliveryRetentionDays: fields\n .number()\n .label(\"Delivery Retention (days)\")\n .placeholder(String(WEBHOOK_DELIVERY_MAX_RETENTION_DAYS))\n .description(\n `How long to keep delivery logs. 0 = delete immediately. Max ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS} days.`\n )\n }),\n layout: layout => [layout.row(\"signingSecret\"), layout.row(\"deliveryRetentionDays\")]\n });\n }\n\n public async save(): Promise<boolean> {\n const data = await this._form.submit<Record<string, string>>();\n if (data === false) {\n return false;\n }\n\n this._saving = true;\n\n try {\n const settings = await this.updateWebhookSettingsUseCase.execute({\n signingSecret: data.signingSecret || undefined,\n deliveryRetentionDays:\n data.deliveryRetentionDays != null\n ? Number(data.deliveryRetentionDays)\n : undefined\n });\n\n runInAction(() => {\n this._form.setData({\n signingSecret: settings.signingSecret ?? \"\",\n deliveryRetentionDays: settings.deliveryRetentionDays ?? \"\"\n });\n });\n } finally {\n runInAction(() => {\n this._saving = false;\n });\n }\n return true;\n }\n\n public async init(): Promise<void> {\n this._loading = true;\n\n try {\n const settings = await this.getWebhookSettingsUseCase.execute();\n\n runInAction(() => {\n this._form = this.buildForm();\n this._form.setData({\n signingSecret: settings.signingSecret ?? \"\",\n deliveryRetentionDays: settings.deliveryRetentionDays ?? \"\"\n });\n this._loading = false;\n });\n } catch {\n runInAction(() => {\n this._loading = false;\n });\n }\n }\n}\n\nexport const WebhookSettingsPresenter = Abstraction.createImplementation({\n implementation: WebhookSettingsPresenterImpl,\n dependencies: [FormModelFactory, GetWebhookSettingsUseCase, UpdateWebhookSettingsUseCase]\n});\n"],"names":["WebhookSettingsPresenterImpl","formModelFactory","getWebhookSettingsUseCase","updateWebhookSettingsUseCase","makeAutoObservable","computed","fields","String","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","layout","data","settings","undefined","Number","
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookSettings/WebhookSettingsPresenter.js","sources":["../../../../src/admin/presentation/WebhookSettings/WebhookSettingsPresenter.ts"],"sourcesContent":["import { computed, makeAutoObservable, runInAction } from \"mobx\";\nimport {\n WebhookSettingsPresenter as Abstraction,\n type IWebhookSettingsPresenter,\n type IWebhookSettingsViewModel\n} from \"./abstractions.js\";\nimport { GetWebhookSettingsUseCase } from \"~/admin/features/getWebhookSettings/abstractions.js\";\nimport { UpdateWebhookSettingsUseCase } from \"~/admin/features/updateWebhookSettings/abstractions.js\";\nimport {\n FormModelFactory,\n type IFormModel\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\nimport { WEBHOOK_DELIVERY_MAX_RETENTION_DAYS } from \"~/api/domain/constants.js\";\n\nclass WebhookSettingsPresenterImpl implements IWebhookSettingsPresenter {\n private _loading = false;\n private _saving = false;\n private _form: IFormModel;\n\n public get vm(): IWebhookSettingsViewModel {\n return {\n loading: this._loading,\n saving: this._saving,\n form: this._form.vm\n };\n }\n\n public constructor(\n private readonly formModelFactory: FormModelFactory.Interface,\n private readonly getWebhookSettingsUseCase: GetWebhookSettingsUseCase.Interface,\n private readonly updateWebhookSettingsUseCase: UpdateWebhookSettingsUseCase.Interface\n ) {\n this._form = this.buildForm();\n\n makeAutoObservable(this, { vm: computed });\n }\n\n private buildForm(): IFormModel {\n return this.formModelFactory.create({\n fields: fields => ({\n signingSecret: fields\n .text()\n .label(\"Signing Secret\")\n .placeholder(\"Enter a signing secret for webhook payloads\")\n .description(\n \"Used to sign webhook payloads so receivers can verify authenticity.\"\n ),\n deliveryRetentionDays: fields\n .number()\n .label(\"Delivery Retention (days)\")\n .placeholder(String(WEBHOOK_DELIVERY_MAX_RETENTION_DAYS))\n .description(\n `How long to keep delivery logs. 0 = delete immediately. Max ${WEBHOOK_DELIVERY_MAX_RETENTION_DAYS} days.`\n )\n }),\n layout: layout => [layout.row(\"signingSecret\"), layout.row(\"deliveryRetentionDays\")]\n });\n }\n\n public async save(): Promise<boolean> {\n const data = await this._form.submit<Record<string, string>>();\n if (data === false) {\n return false;\n }\n\n runInAction(() => {\n this._saving = true;\n });\n\n try {\n const settings = await this.updateWebhookSettingsUseCase.execute({\n signingSecret: data.signingSecret || undefined,\n deliveryRetentionDays:\n data.deliveryRetentionDays != null\n ? Number(data.deliveryRetentionDays)\n : undefined\n });\n\n runInAction(() => {\n this._form.setData({\n signingSecret: settings.signingSecret ?? \"\",\n deliveryRetentionDays: settings.deliveryRetentionDays ?? \"\"\n });\n });\n } finally {\n runInAction(() => {\n this._saving = false;\n });\n }\n return true;\n }\n\n public async init(): Promise<void> {\n this._loading = true;\n\n try {\n const settings = await this.getWebhookSettingsUseCase.execute();\n\n runInAction(() => {\n this._form = this.buildForm();\n this._form.setData({\n signingSecret: settings.signingSecret ?? \"\",\n deliveryRetentionDays: settings.deliveryRetentionDays ?? \"\"\n });\n this._loading = false;\n });\n } catch {\n runInAction(() => {\n this._loading = false;\n });\n }\n }\n}\n\nexport const WebhookSettingsPresenter = Abstraction.createImplementation({\n implementation: WebhookSettingsPresenterImpl,\n dependencies: [FormModelFactory, GetWebhookSettingsUseCase, UpdateWebhookSettingsUseCase]\n});\n"],"names":["WebhookSettingsPresenterImpl","formModelFactory","getWebhookSettingsUseCase","updateWebhookSettingsUseCase","makeAutoObservable","computed","fields","String","WEBHOOK_DELIVERY_MAX_RETENTION_DAYS","layout","data","runInAction","settings","undefined","Number","WebhookSettingsPresenter","Abstraction","FormModelFactory","GetWebhookSettingsUseCase","UpdateWebhookSettingsUseCase"],"mappings":";;;;;;AAcA,MAAMA;IAKF,IAAW,KAAgC;QACvC,OAAO;YACH,SAAS,IAAI,CAAC,QAAQ;YACtB,QAAQ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;gBAC7D;YACJ;QACJ,SAAU;YACND,YAAY;gBACR,IAAI,CAAC,OAAO,GAAG;YACnB;QACJ;QACA,OAAO;IACX;IAEA,MAAa,OAAsB;QAC/B,IAAI,CAAC,QAAQ,GAAG;QAEhB,IAAI;YACA,MAAMC,WAAW,MAAM,IAAI,CAAC,yBAAyB,CAAC,OAAO;YAE7DD,YAAY;gBACR,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS;gBAC3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;oBACf,eAAeC,SAAS,aAAa,IAAI;oBACzC,uBAAuBA,SAAS,qBAAqB,IAAI;gBAC7D;gBACA,IAAI,CAAC,QAAQ,GAAG;YACpB;QACJ,EAAE,OAAM;YACJD,YAAY;gBACR,IAAI,CAAC,QAAQ,GAAG;YACpB;QACJ;IACJ;AACJ;AAEO,MAAMI,oDAA2BC,yBAAAA,oBAAgC,CAAC;IACrE,gBAAgBhB;IAChB,cAAc;QAACiB;QAAkBC;QAA2BC;KAA6B;AAC7F"}
|
package/admin/routes.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Route } from "@webiny/app-admin";
|
|
2
2
|
export declare const Routes: {
|
|
3
3
|
List: Route<undefined>;
|
|
4
|
-
Deliveries: Route<
|
|
4
|
+
Deliveries: Route<{
|
|
5
|
+
webhookId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
+
}>;
|
|
5
7
|
Settings: Route<undefined>;
|
|
6
8
|
Form: Route<{
|
|
7
9
|
id: import("zod").ZodString;
|
package/admin/routes.js
CHANGED
|
@@ -6,7 +6,10 @@ const Routes = {
|
|
|
6
6
|
}),
|
|
7
7
|
Deliveries: new Route({
|
|
8
8
|
name: "Webhooks/Deliveries",
|
|
9
|
-
path: "/webhooks/deliveries"
|
|
9
|
+
path: "/webhooks/deliveries",
|
|
10
|
+
params: (zod)=>({
|
|
11
|
+
webhookId: zod.string().optional()
|
|
12
|
+
})
|
|
10
13
|
}),
|
|
11
14
|
Settings: new Route({
|
|
12
15
|
name: "Webhooks/Settings",
|
package/admin/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/routes.js","sources":["../../src/admin/routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n List: new Route({\n name: \"Webhooks/List\",\n path: \"/webhooks\"\n }),\n Deliveries: new Route({\n name: \"Webhooks/Deliveries\",\n path: \"/webhooks/deliveries\"\n }),\n Settings: new Route({\n name: \"Webhooks/Settings\",\n path: \"/webhooks/settings\"\n }),\n Form: new Route({\n name: \"Webhooks/Form\",\n path: \"/webhooks/:id\",\n params: zod => ({\n id: zod.string()\n })\n })\n};\n"],"names":["Routes","Route","zod"],"mappings":";AAEO,MAAMA,SAAS;IAClB,MAAM,IAAIC,MAAM;QACZ,MAAM;QACN,MAAM;IACV;IACA,YAAY,IAAIA,MAAM;QAClB,MAAM;QACN,MAAM;
|
|
1
|
+
{"version":3,"file":"admin/routes.js","sources":["../../src/admin/routes.ts"],"sourcesContent":["import { Route } from \"@webiny/app-admin\";\n\nexport const Routes = {\n List: new Route({\n name: \"Webhooks/List\",\n path: \"/webhooks\"\n }),\n Deliveries: new Route({\n name: \"Webhooks/Deliveries\",\n path: \"/webhooks/deliveries\",\n params: zod => ({\n webhookId: zod.string().optional()\n })\n }),\n Settings: new Route({\n name: \"Webhooks/Settings\",\n path: \"/webhooks/settings\"\n }),\n Form: new Route({\n name: \"Webhooks/Form\",\n path: \"/webhooks/:id\",\n params: zod => ({\n id: zod.string()\n })\n })\n};\n"],"names":["Routes","Route","zod"],"mappings":";AAEO,MAAMA,SAAS;IAClB,MAAM,IAAIC,MAAM;QACZ,MAAM;QACN,MAAM;IACV;IACA,YAAY,IAAIA,MAAM;QAClB,MAAM;QACN,MAAM;QACN,QAAQC,CAAAA,MAAQ;gBACZ,WAAWA,IAAI,MAAM,GAAG,QAAQ;YACpC;IACJ;IACA,UAAU,IAAID,MAAM;QAChB,MAAM;QACN,MAAM;IACV;IACA,MAAM,IAAIA,MAAM;QACZ,MAAM;QACN,MAAM;QACN,QAAQC,CAAAA,MAAQ;gBACZ,IAAIA,IAAI,MAAM;YAClB;IACJ;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@webiny/tasks/types.js";
|
|
1
|
+
import "@webiny/background-tasks/api/types.js";
|
|
2
2
|
import { TaskDefinition } from "@webiny/api-core/exports/api/tasks.js";
|
|
3
3
|
import { TenantContext } from "@webiny/api-core/exports/api/tenancy.js";
|
|
4
4
|
import { WebhookSignPayload } from "@webiny/api-core/features/webhooks/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "@webiny/tasks/types.js";
|
|
1
|
+
import "@webiny/background-tasks/api/types.js";
|
|
2
2
|
import { TaskDefinition } from "@webiny/api-core/exports/api/tasks.js";
|
|
3
3
|
import { TenantContext } from "@webiny/api-core/exports/api/tenancy.js";
|
|
4
4
|
import { WebhookSignPayload } from "@webiny/api-core/features/webhooks/index.js";
|