@webiny/webhooks 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.9f53ea597d
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 +26 -7
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryDetailContent.tsx"],"sourcesContent":["import React from \"react\";\nimport { Separator, Tabs } from \"@webiny/admin-ui\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\n\ninterface DeliveryDetailContentProps {\n delivery: WebhookDelivery;\n}\n\nconst formatJson = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"—\";\n }\n if (typeof value === \"string\") {\n try {\n return JSON.stringify(JSON.parse(value), null, 2);\n } catch {\n return value;\n }\n }\n return JSON.stringify(value, null, 2);\n};\n\nconst getContentType = (responseHeaders: unknown): string | null => {\n if (!responseHeaders || typeof responseHeaders !== \"object\") {\n return null;\n }\n const headers = responseHeaders as Record<string, string>;\n const key = Object.keys(headers).find(k => k.toLowerCase() === \"content-type\");\n if (!key) {\n return null;\n }\n return headers[key].split(\";\")[0].trim().toLowerCase();\n};\n\nconst getContentTypeLabel = (contentType: string | null): string | null => {\n if (!contentType) {\n return null;\n }\n if (contentType.includes(\"json\")) {\n return \"JSON\";\n }\n if (contentType.includes(\"html\")) {\n return \"HTML\";\n }\n if (contentType.includes(\"xml\")) {\n return \"XML\";\n }\n if (contentType.includes(\"plain\")) {\n return \"TEXT\";\n }\n return null;\n};\n\nconst renderResponseBody = (body: string | null, contentType: string | null): string => {\n if (body === null) {\n return \"—\";\n }\n if (!contentType || contentType.includes(\"json\")) {\n return formatJson(body);\n }\n return body;\n};\n\nexport const DeliveryDetailContent = ({ delivery }: DeliveryDetailContentProps) => {\n const contentType = getContentType(delivery.responseHeaders);\n const contentTypeLabel = getContentTypeLabel(contentType);\n\n return (\n <div className=\"flex flex-col gap-md\">\n <Separator />\n <Tabs\n tabs={[\n <Tabs.Tab\n key=\"payload\"\n value=\"payload\"\n trigger=\"Payload\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[250px]\">\n {formatJson(delivery.payload)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"req-headers\"\n value=\"req-headers\"\n trigger=\"Request Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.requestHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-headers\"\n value=\"resp-headers\"\n trigger=\"Response Headers\"\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {formatJson(delivery.responseHeaders)}\n </pre>\n }\n />,\n <Tabs.Tab\n key=\"resp-body\"\n value=\"resp-body\"\n trigger={\n contentTypeLabel\n ? `Response Body (${contentTypeLabel})`\n : \"Response Body\"\n }\n content={\n <pre className=\"bg-neutral-light rounded-sm p-sm text-xs overflow-auto max-h-[200px]\">\n {renderResponseBody(delivery.responseBody, contentType)}\n </pre>\n }\n />\n ]}\n />\n </div>\n );\n};\n"],"names":["formatJson","value","JSON","getContentType","responseHeaders","headers","key","Object","k","getContentTypeLabel","contentType","renderResponseBody","body","DeliveryDetailContent","delivery","contentTypeLabel","Separator","Tabs"],"mappings":";;AAQA,MAAMA,aAAa,CAACC;IAChB,IAAIA,QAAAA,OACA,OAAO;IAEX,IAAI,AAAiB,YAAjB,OAAOA,OACP,IAAI;QACA,OAAOC,KAAK,SAAS,CAACA,KAAK,KAAK,CAACD,QAAQ,MAAM;IACnD,EAAE,OAAM;QACJ,OAAOA;IACX;IAEJ,OAAOC,KAAK,SAAS,CAACD,OAAO,MAAM;AACvC;AAEA,MAAME,iBAAiB,CAACC;IACpB,IAAI,CAACA,mBAAmB,AAA2B,YAA3B,OAAOA,iBAC3B,OAAO;IAEX,MAAMC,UAAUD;IAChB,MAAME,MAAMC,OAAO,IAAI,CAACF,SAAS,IAAI,CAACG,CAAAA,IAAKA,AAAoB,mBAApBA,EAAE,WAAW;IACxD,IAAI,CAACF,KACD,OAAO;IAEX,OAAOD,OAAO,CAACC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,WAAW;AACxD;AAEA,MAAMG,sBAAsB,CAACC;IACzB,IAAI,CAACA,aACD,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,SACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,QACrB,OAAO;IAEX,IAAIA,YAAY,QAAQ,CAAC,UACrB,OAAO;IAEX,OAAO;AACX;AAEA,MAAMC,qBAAqB,CAACC,MAAqBF;IAC7C,IAAIE,AAAS,SAATA,MACA,OAAO;IAEX,IAAI,CAACF,eAAeA,YAAY,QAAQ,CAAC,SACrC,OAAOV,WAAWY;IAEtB,OAAOA;AACX;AAEO,MAAMC,wBAAwB,CAAC,EAAEC,QAAQ,EAA8B;IAC1E,MAAMJ,cAAcP,eAAeW,SAAS,eAAe;IAC3D,MAAMC,mBAAmBN,oBAAoBC;IAE7C,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACM,WAASA,OAAAA,WAAAA,GACV,oBAACC,MAAIA;QACD,MAAM;0BACF,oBAACA,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,OAAO;;0BAIxC,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,cAAc;;0BAI/C,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SAAQ;gBACR,uBACI,oBAAC;oBAAI,WAAU;mBACVjB,WAAWc,SAAS,eAAe;;0BAIhD,oBAACG,KAAK,GAAG;gBACL,KAAI;gBACJ,OAAM;gBACN,SACIF,mBACM,CAAC,eAAe,EAAEA,iBAAiB,CAAC,CAAC,GACrC;gBAEV,uBACI,oBAAC;oBAAI,WAAU;mBACVJ,mBAAmBG,SAAS,YAAY,EAAEJ;;SAI1D;;AAIjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { Grid, MultiSelect, Select } from "@webiny/admin-ui";
|
|
3
|
+
import { Button, Grid, MultiSelect, Select } from "@webiny/admin-ui";
|
|
4
4
|
const STATUS_OPTIONS = [
|
|
5
5
|
{
|
|
6
6
|
value: "pending",
|
|
@@ -19,13 +19,22 @@ const STATUS_OPTIONS = [
|
|
|
19
19
|
label: "Failed"
|
|
20
20
|
}
|
|
21
21
|
];
|
|
22
|
-
const
|
|
22
|
+
const DeliveryFilters = observer(({ presenter })=>{
|
|
23
23
|
const { vm } = presenter;
|
|
24
|
-
return /*#__PURE__*/ react.createElement(Grid, {
|
|
25
|
-
className: "py-sm"
|
|
26
|
-
}, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
24
|
+
return /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
27
25
|
span: 2
|
|
28
26
|
}, /*#__PURE__*/ react.createElement(Select, {
|
|
27
|
+
size: "md",
|
|
28
|
+
placeholder: "All webhooks",
|
|
29
|
+
value: vm.filters.webhookId ?? "",
|
|
30
|
+
options: vm.availableWebhooks,
|
|
31
|
+
onChange: (value)=>presenter.setWebhookFilter(value || null),
|
|
32
|
+
displayResetAction: true,
|
|
33
|
+
onValueReset: ()=>presenter.setWebhookFilter(null)
|
|
34
|
+
})), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
35
|
+
span: 2
|
|
36
|
+
}, /*#__PURE__*/ react.createElement(Select, {
|
|
37
|
+
size: "md",
|
|
29
38
|
placeholder: "All apps",
|
|
30
39
|
value: vm.filters.app ?? "",
|
|
31
40
|
options: vm.availableApps,
|
|
@@ -35,6 +44,7 @@ const DeliveryFilters_DeliveryFilters = observer(function({ presenter }) {
|
|
|
35
44
|
})), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
36
45
|
span: 2
|
|
37
46
|
}, /*#__PURE__*/ react.createElement(Select, {
|
|
47
|
+
size: "md",
|
|
38
48
|
placeholder: "All entities",
|
|
39
49
|
value: vm.filters.entity ?? "",
|
|
40
50
|
options: vm.availableEntities,
|
|
@@ -45,6 +55,7 @@ const DeliveryFilters_DeliveryFilters = observer(function({ presenter }) {
|
|
|
45
55
|
})), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
46
56
|
span: 2
|
|
47
57
|
}, /*#__PURE__*/ react.createElement(Select, {
|
|
58
|
+
size: "md",
|
|
48
59
|
placeholder: "All events",
|
|
49
60
|
value: vm.filters.eventName ?? "",
|
|
50
61
|
options: vm.availableEventNames,
|
|
@@ -55,12 +66,20 @@ const DeliveryFilters_DeliveryFilters = observer(function({ presenter }) {
|
|
|
55
66
|
})), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
56
67
|
span: 2
|
|
57
68
|
}, /*#__PURE__*/ react.createElement(MultiSelect, {
|
|
69
|
+
size: "md",
|
|
58
70
|
placeholder: "All statuses",
|
|
59
71
|
value: vm.filters.status,
|
|
60
72
|
options: STATUS_OPTIONS,
|
|
61
73
|
onChange: (values)=>presenter.setStatusFilter(values)
|
|
62
|
-
}))
|
|
74
|
+
})), /*#__PURE__*/ react.createElement(Grid.Column, {
|
|
75
|
+
span: 2
|
|
76
|
+
}, /*#__PURE__*/ react.createElement(Button, {
|
|
77
|
+
variant: "tertiary",
|
|
78
|
+
size: "md",
|
|
79
|
+
onClick: ()=>presenter.clearFilters(),
|
|
80
|
+
disabled: !vm.hasFilters
|
|
81
|
+
}, "Clear filters")));
|
|
63
82
|
});
|
|
64
|
-
export {
|
|
83
|
+
export { DeliveryFilters };
|
|
65
84
|
|
|
66
85
|
//# sourceMappingURL=DeliveryFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Grid, MultiSelect, Select } from \"@webiny/admin-ui\";\nimport type { IWebhookDeliveriesPagePresenter } from \"../abstractions.js\";\n\ninterface DeliveryFiltersProps {\n presenter: IWebhookDeliveriesPagePresenter;\n}\n\nconst STATUS_OPTIONS = [\n { value: \"pending\", label: \"Pending\" },\n { value: \"delivering\", label: \"Delivering\" },\n { value: \"delivered\", label: \"Delivered\" },\n { value: \"failed\", label: \"Failed\" }\n];\n\nexport const DeliveryFilters = observer(
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.tsx"],"sourcesContent":["import React from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Grid, MultiSelect, Select } from \"@webiny/admin-ui\";\nimport type { IWebhookDeliveriesPagePresenter } from \"../abstractions.js\";\nimport { Button } from \"@webiny/admin-ui\";\n\ninterface DeliveryFiltersProps {\n presenter: IWebhookDeliveriesPagePresenter;\n}\n\nconst STATUS_OPTIONS = [\n { value: \"pending\", label: \"Pending\" },\n { value: \"delivering\", label: \"Delivering\" },\n { value: \"delivered\", label: \"Delivered\" },\n { value: \"failed\", label: \"Failed\" }\n];\n\nexport const DeliveryFilters = observer(({ presenter }: DeliveryFiltersProps) => {\n const { vm } = presenter;\n return (\n <Grid>\n <Grid.Column span={2}>\n <Select\n size={\"md\"}\n placeholder=\"All webhooks\"\n value={vm.filters.webhookId ?? \"\"}\n options={vm.availableWebhooks}\n onChange={value => presenter.setWebhookFilter(value || null)}\n displayResetAction={true}\n onValueReset={() => presenter.setWebhookFilter(null)}\n />\n </Grid.Column>\n <Grid.Column span={2}>\n <Select\n size={\"md\"}\n placeholder=\"All apps\"\n value={vm.filters.app ?? \"\"}\n options={vm.availableApps}\n onChange={value => presenter.setAppFilter(value || null)}\n displayResetAction={true}\n onValueReset={() => presenter.setAppFilter(null)}\n />\n </Grid.Column>\n <Grid.Column span={2}>\n <Select\n size={\"md\"}\n placeholder=\"All entities\"\n value={vm.filters.entity ?? \"\"}\n options={vm.availableEntities}\n onChange={value => presenter.setEntityFilter(value || null)}\n disabled={!vm.filters.app}\n displayResetAction={true}\n onValueReset={() => presenter.setEntityFilter(null)}\n />\n </Grid.Column>\n <Grid.Column span={2}>\n <Select\n size={\"md\"}\n placeholder=\"All events\"\n value={vm.filters.eventName ?? \"\"}\n options={vm.availableEventNames}\n onChange={value => presenter.setEventFilter(value || null)}\n disabled={!vm.filters.app}\n displayResetAction={true}\n onValueReset={() => presenter.setEventFilter(null)}\n />\n </Grid.Column>\n <Grid.Column span={2}>\n <MultiSelect\n size={\"md\"}\n placeholder=\"All statuses\"\n value={vm.filters.status}\n options={STATUS_OPTIONS}\n onChange={values => presenter.setStatusFilter(values)}\n />\n </Grid.Column>\n <Grid.Column span={2}>\n <Button\n variant=\"tertiary\"\n size=\"md\"\n onClick={() => presenter.clearFilters()}\n disabled={!vm.hasFilters}\n >\n Clear filters\n </Button>\n </Grid.Column>\n </Grid>\n );\n});\n"],"names":["STATUS_OPTIONS","DeliveryFilters","observer","presenter","vm","Grid","Select","value","MultiSelect","values","Button"],"mappings":";;;AAUA,MAAMA,iBAAiB;IACnB;QAAE,OAAO;QAAW,OAAO;IAAU;IACrC;QAAE,OAAO;QAAc,OAAO;IAAa;IAC3C;QAAE,OAAO;QAAa,OAAO;IAAY;IACzC;QAAE,OAAO;QAAU,OAAO;IAAS;CACtC;AAEM,MAAMC,kBAAkBC,SAAS,CAAC,EAAEC,SAAS,EAAwB;IACxE,MAAM,EAAEC,EAAE,EAAE,GAAGD;IACf,OAAO,WAAP,GACI,oBAACE,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,QAAMA;QACH,MAAM;QACN,aAAY;QACZ,OAAOF,GAAG,OAAO,CAAC,SAAS,IAAI;QAC/B,SAASA,GAAG,iBAAiB;QAC7B,UAAUG,CAAAA,QAASJ,UAAU,gBAAgB,CAACI,SAAS;QACvD,oBAAoB;QACpB,cAAc,IAAMJ,UAAU,gBAAgB,CAAC;uBAGvD,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,QAAMA;QACH,MAAM;QACN,aAAY;QACZ,OAAOF,GAAG,OAAO,CAAC,GAAG,IAAI;QACzB,SAASA,GAAG,aAAa;QACzB,UAAUG,CAAAA,QAASJ,UAAU,YAAY,CAACI,SAAS;QACnD,oBAAoB;QACpB,cAAc,IAAMJ,UAAU,YAAY,CAAC;uBAGnD,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,QAAMA;QACH,MAAM;QACN,aAAY;QACZ,OAAOF,GAAG,OAAO,CAAC,MAAM,IAAI;QAC5B,SAASA,GAAG,iBAAiB;QAC7B,UAAUG,CAAAA,QAASJ,UAAU,eAAe,CAACI,SAAS;QACtD,UAAU,CAACH,GAAG,OAAO,CAAC,GAAG;QACzB,oBAAoB;QACpB,cAAc,IAAMD,UAAU,eAAe,CAAC;uBAGtD,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,QAAMA;QACH,MAAM;QACN,aAAY;QACZ,OAAOF,GAAG,OAAO,CAAC,SAAS,IAAI;QAC/B,SAASA,GAAG,mBAAmB;QAC/B,UAAUG,CAAAA,QAASJ,UAAU,cAAc,CAACI,SAAS;QACrD,UAAU,CAACH,GAAG,OAAO,CAAC,GAAG;QACzB,oBAAoB;QACpB,cAAc,IAAMD,UAAU,cAAc,CAAC;uBAGrD,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACG,aAAWA;QACR,MAAM;QACN,aAAY;QACZ,OAAOJ,GAAG,OAAO,CAAC,MAAM;QACxB,SAASJ;QACT,UAAUS,CAAAA,SAAUN,UAAU,eAAe,CAACM;uBAGtD,oBAACJ,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACK,QAAMA;QACH,SAAQ;QACR,MAAK;QACL,SAAS,IAAMP,UAAU,YAAY;QACrC,UAAU,CAACC,GAAG,UAAU;OAC3B;AAMjB"}
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
import react, { useMemo } from "react";
|
|
1
|
+
import react, { useMemo, useState } from "react";
|
|
2
2
|
import debounce from "lodash/debounce.js";
|
|
3
3
|
import { observer } from "mobx-react-lite";
|
|
4
|
-
import { Accordion, Scrollbar, Text } from "@webiny/admin-ui";
|
|
4
|
+
import { Accordion, Scrollbar, Skeleton, Text } from "@webiny/admin-ui";
|
|
5
5
|
import { useConfirmationDialog } from "@webiny/app-admin/hooks/index.js";
|
|
6
|
-
import { DeliveryAccordionRow } from "
|
|
6
|
+
import { DeliveryAccordionRow } from "./DeliveryAccordionRow.js";
|
|
7
7
|
import { DeliveryBottomInfoBar } from "./DeliveryBottomInfoBar.js";
|
|
8
|
-
|
|
8
|
+
function useExpandedState() {
|
|
9
|
+
const [expandedId, setExpandedId] = useState(null);
|
|
10
|
+
return {
|
|
11
|
+
expandedId,
|
|
12
|
+
toggle (id) {
|
|
13
|
+
setExpandedId((prev)=>prev === id ? null : id);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const DeliveryList = observer(({ presenter })=>{
|
|
9
18
|
const { vm } = presenter;
|
|
19
|
+
const expanded = useExpandedState();
|
|
10
20
|
const { showConfirmation: showResendConfirmation } = useConfirmationDialog({
|
|
11
21
|
title: "Resend Delivery",
|
|
12
22
|
message: "Are you sure you want to resend this delivery?"
|
|
@@ -32,14 +42,20 @@ const DeliveryList_DeliveryList = observer(function({ presenter }) {
|
|
|
32
42
|
}, vm.list.rows.map((delivery)=>/*#__PURE__*/ react.createElement(DeliveryAccordionRow, {
|
|
33
43
|
key: delivery.id,
|
|
34
44
|
delivery: delivery,
|
|
35
|
-
open:
|
|
45
|
+
open: expanded.expandedId === delivery.id,
|
|
36
46
|
resending: vm.resendingIds.has(delivery.id),
|
|
37
|
-
onOpenChange: (
|
|
47
|
+
onOpenChange: ()=>expanded.toggle(delivery.id),
|
|
38
48
|
onResend: (id)=>showResendConfirmation(()=>presenter.resend(id))
|
|
39
|
-
})))
|
|
49
|
+
}))), vm.list.pagination.loadingMore ? /*#__PURE__*/ react.createElement("div", {
|
|
50
|
+
className: "flex flex-col gap-sm p-md"
|
|
51
|
+
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
52
|
+
className: "h-8 w-full"
|
|
53
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
54
|
+
className: "h-8 w-full"
|
|
55
|
+
})) : null), /*#__PURE__*/ react.createElement(DeliveryBottomInfoBar, {
|
|
40
56
|
presenter: presenter
|
|
41
57
|
}));
|
|
42
58
|
});
|
|
43
|
-
export {
|
|
59
|
+
export { DeliveryList };
|
|
44
60
|
|
|
45
61
|
//# sourceMappingURL=DeliveryList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { Accordion, Scrollbar, Text } from \"@webiny/admin-ui\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/index.js\";\nimport { DeliveryAccordionRow } from \"
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryList.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport debounce from \"lodash/debounce.js\";\nimport { observer } from \"mobx-react-lite\";\nimport { Accordion, Scrollbar, Skeleton, Text } from \"@webiny/admin-ui\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/index.js\";\nimport { DeliveryAccordionRow } from \"./DeliveryAccordionRow.js\";\nimport { DeliveryBottomInfoBar } from \"./DeliveryBottomInfoBar.js\";\nimport type { IWebhookDeliveriesPagePresenter } from \"../abstractions.js\";\nimport type { WebhookDelivery } from \"~/admin/shared/types.js\";\n\ninterface ExpandedState {\n expandedId: string | null;\n toggle(id: string): void;\n}\n\nfunction useExpandedState(): ExpandedState {\n const [expandedId, setExpandedId] = useState<string | null>(null);\n return {\n expandedId,\n toggle(id: string) {\n setExpandedId(prev => (prev === id ? null : id));\n }\n };\n}\n\ninterface DeliveryListProps {\n presenter: IWebhookDeliveriesPagePresenter;\n}\n\nexport const DeliveryList = observer(({ presenter }: DeliveryListProps) => {\n const { vm } = presenter;\n const expanded = useExpandedState();\n\n const { showConfirmation: showResendConfirmation } = useConfirmationDialog({\n title: \"Resend Delivery\",\n message: \"Are you sure you want to resend this delivery?\"\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 if (vm.list.rows.length === 0 && !vm.loading) {\n return (\n <div className=\"flex justify-center py-xl\">\n <Text className=\"text-neutral-strong\">No deliveries found.</Text>\n </div>\n );\n }\n\n return (\n <div className=\"flex-1 overflow-hidden relative\">\n <Scrollbar onScrollFrame={scrollFrame => loadMoreOnScroll({ scrollFrame })}>\n <Accordion variant=\"underline\">\n {vm.list.rows.map((delivery: WebhookDelivery) => (\n <DeliveryAccordionRow\n key={delivery.id}\n delivery={delivery}\n open={expanded.expandedId === delivery.id}\n resending={vm.resendingIds.has(delivery.id)}\n onOpenChange={() => expanded.toggle(delivery.id)}\n onResend={id => showResendConfirmation(() => presenter.resend(id))}\n />\n ))}\n </Accordion>\n {vm.list.pagination.loadingMore ? (\n <div className=\"flex flex-col gap-sm p-md\">\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n </div>\n ) : null}\n </Scrollbar>\n <DeliveryBottomInfoBar presenter={presenter} />\n </div>\n );\n});\n"],"names":["useExpandedState","expandedId","setExpandedId","useState","id","prev","DeliveryList","observer","presenter","vm","expanded","showResendConfirmation","useConfirmationDialog","loadMoreOnScroll","useMemo","debounce","scrollFrame","Text","Scrollbar","Accordion","delivery","DeliveryAccordionRow","Skeleton","DeliveryBottomInfoBar"],"mappings":";;;;;;;AAeA,SAASA;IACL,MAAM,CAACC,YAAYC,cAAc,GAAGC,SAAwB;IAC5D,OAAO;QACHF;QACA,QAAOG,EAAU;YACbF,cAAcG,CAAAA,OAASA,SAASD,KAAK,OAAOA;QAChD;IACJ;AACJ;AAMO,MAAME,eAAeC,SAAS,CAAC,EAAEC,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
+
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 WebhookDefinitionsButton = ()=>{
|
|
7
|
+
const { goToRoute } = useRouter();
|
|
8
|
+
return /*#__PURE__*/ react.createElement(Button, {
|
|
9
|
+
variant: "secondary",
|
|
10
|
+
onClick: ()=>goToRoute(Routes.List),
|
|
11
|
+
icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
|
|
12
|
+
}, "Webhooks");
|
|
13
|
+
};
|
|
14
|
+
export { WebhookDefinitionsButton };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=WebhookDefinitionsButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.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 WebhookDefinitionsButton = () => {\n const { goToRoute } = useRouter();\n\n return (\n <Button variant=\"secondary\" onClick={() => goToRoute(Routes.List)} icon={<ListIcon />}>\n Webhooks\n </Button>\n );\n};\n"],"names":["WebhookDefinitionsButton","goToRoute","useRouter","Button","Routes","ListIcon"],"mappings":";;;;;AAMO,MAAMA,2BAA2B;IACpC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IAEtB,OAAO,WAAP,GACI,oBAACC,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAMF,UAAUG,OAAO,IAAI;QAAG,oBAAM,oBAACC,gBAAQA;OAAK;AAI/F"}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
import react, { useEffect, useMemo } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { DiContainerProvider, useContainer, useFeature } from "@webiny/app";
|
|
4
|
-
import { Button, Heading, Skeleton, Text } from "@webiny/admin-ui";
|
|
3
|
+
import { DiContainerProvider, useContainer, useFeature, useRoute } from "@webiny/app";
|
|
4
|
+
import { Button, Heading, Separator, Skeleton, Text } from "@webiny/admin-ui";
|
|
5
5
|
import { ListWebhookDeliveriesFeature } from "../../../features/listWebhookDeliveries/feature.js";
|
|
6
6
|
import { ListAvailableEventsFeature } from "../../../features/listAvailableEvents/feature.js";
|
|
7
7
|
import { ResendWebhookDeliveryFeature } from "../../../features/resendWebhookDelivery/feature.js";
|
|
8
|
+
import { ListWebhooksFeature } from "../../../features/ListWebhooks/feature.js";
|
|
8
9
|
import { WebhookDeliveriesPagePresenterFeature } from "../feature.js";
|
|
10
|
+
import { Routes } from "../../../routes.js";
|
|
9
11
|
import { DeliveryFilters } from "./DeliveryFilters.js";
|
|
10
12
|
import { DeliveryList } from "./DeliveryList.js";
|
|
13
|
+
import { WebhookDefinitionsButton } from "./WebhookDefinitionsButton.js";
|
|
14
|
+
const Loader = ()=>/*#__PURE__*/ react.createElement("div", {
|
|
15
|
+
className: "flex flex-col gap-sm p-md"
|
|
16
|
+
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
17
|
+
className: "h-8 w-full"
|
|
18
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
19
|
+
className: "h-8 w-full"
|
|
20
|
+
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
21
|
+
className: "h-8 w-full"
|
|
22
|
+
}));
|
|
11
23
|
const WebhookDeliveriesPage_WebhookDeliveriesPageInner = observer(function() {
|
|
12
24
|
const { presenter } = useFeature(WebhookDeliveriesPagePresenterFeature);
|
|
25
|
+
const { route } = useRoute(Routes.Deliveries);
|
|
26
|
+
const webhookId = route?.params?.webhookId;
|
|
13
27
|
useEffect(()=>{
|
|
14
|
-
presenter.init();
|
|
28
|
+
presenter.init(webhookId);
|
|
15
29
|
}, [
|
|
16
|
-
presenter
|
|
30
|
+
presenter,
|
|
31
|
+
webhookId
|
|
17
32
|
]);
|
|
18
33
|
const { vm } = presenter;
|
|
19
|
-
if (vm.loading && 0 === vm.list.rows.length) return /*#__PURE__*/ react.createElement("div", {
|
|
20
|
-
className: "flex flex-col gap-sm p-md"
|
|
21
|
-
}, /*#__PURE__*/ react.createElement(Skeleton, {
|
|
22
|
-
className: "h-10 w-full"
|
|
23
|
-
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
24
|
-
className: "h-10 w-full"
|
|
25
|
-
}), /*#__PURE__*/ react.createElement(Skeleton, {
|
|
26
|
-
className: "h-10 w-full"
|
|
27
|
-
}));
|
|
28
34
|
if (vm.error) return /*#__PURE__*/ react.createElement("div", {
|
|
29
35
|
className: "flex flex-col items-center gap-sm p-md"
|
|
30
36
|
}, /*#__PURE__*/ react.createElement(Text, null, vm.error), /*#__PURE__*/ react.createElement(Button, {
|
|
@@ -34,12 +40,14 @@ const WebhookDeliveriesPage_WebhookDeliveriesPageInner = observer(function() {
|
|
|
34
40
|
return /*#__PURE__*/ react.createElement("div", {
|
|
35
41
|
className: "flex flex-col h-main-content"
|
|
36
42
|
}, /*#__PURE__*/ react.createElement("div", {
|
|
37
|
-
className: "
|
|
43
|
+
className: "flex items-center justify-between py-sm px-md"
|
|
38
44
|
}, /*#__PURE__*/ react.createElement(Heading, {
|
|
39
|
-
level:
|
|
40
|
-
}, "
|
|
45
|
+
level: 5
|
|
46
|
+
}, "Webhook Deliveries"), /*#__PURE__*/ react.createElement(WebhookDefinitionsButton, null)), /*#__PURE__*/ react.createElement(Separator, null), /*#__PURE__*/ react.createElement("div", {
|
|
47
|
+
className: "p-sm"
|
|
48
|
+
}, /*#__PURE__*/ react.createElement(DeliveryFilters, {
|
|
41
49
|
presenter: presenter
|
|
42
|
-
})), /*#__PURE__*/ react.createElement(DeliveryList, {
|
|
50
|
+
})), /*#__PURE__*/ react.createElement(Separator, null), vm.loading ? /*#__PURE__*/ react.createElement(Loader, null) : /*#__PURE__*/ react.createElement(DeliveryList, {
|
|
43
51
|
presenter: presenter
|
|
44
52
|
}));
|
|
45
53
|
});
|
|
@@ -50,6 +58,7 @@ const WebhookDeliveriesPage = ()=>{
|
|
|
50
58
|
ListWebhookDeliveriesFeature.register(child);
|
|
51
59
|
ListAvailableEventsFeature.register(child);
|
|
52
60
|
ResendWebhookDeliveryFeature.register(child);
|
|
61
|
+
ListWebhooksFeature.register(child);
|
|
53
62
|
WebhookDeliveriesPagePresenterFeature.register(child);
|
|
54
63
|
return child;
|
|
55
64
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature } from \"@webiny/app\";\nimport { Button, Heading,
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.tsx"],"sourcesContent":["import React, { useMemo, useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { DiContainerProvider, useContainer, useFeature, useRoute } from \"@webiny/app\";\nimport { Separator } from \"@webiny/admin-ui\";\nimport { Skeleton } from \"@webiny/admin-ui\";\nimport { Button, Heading, Text } from \"@webiny/admin-ui\";\nimport { ListWebhookDeliveriesFeature } from \"~/admin/features/listWebhookDeliveries/feature.js\";\nimport { ListAvailableEventsFeature } from \"~/admin/features/listAvailableEvents/feature.js\";\nimport { ResendWebhookDeliveryFeature } from \"~/admin/features/resendWebhookDelivery/feature.js\";\nimport { ListWebhooksFeature } from \"~/admin/features/ListWebhooks/feature.js\";\nimport { WebhookDeliveriesPagePresenterFeature } from \"../feature.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport { DeliveryFilters } from \"./DeliveryFilters.js\";\nimport { DeliveryList } from \"./DeliveryList.js\";\nimport { WebhookDefinitionsButton } from \"~/admin/presentation/WebhookDeliveriesPage/components/WebhookDefinitionsButton.js\";\n\nconst Loader = () => {\n return (\n <div className=\"flex flex-col gap-sm p-md\">\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n <Skeleton className=\"h-8 w-full\" />\n </div>\n );\n};\n\nconst WebhookDeliveriesPageInner = observer(function WebhookDeliveriesPageInner() {\n const { presenter } = useFeature(WebhookDeliveriesPagePresenterFeature);\n const { route } = useRoute(Routes.Deliveries);\n const webhookId = route?.params?.webhookId;\n\n useEffect(() => {\n void presenter.init(webhookId);\n }, [presenter, webhookId]);\n\n const { vm } = presenter;\n\n if (vm.error) {\n return (\n <div className=\"flex flex-col items-center gap-sm p-md\">\n <Text>{vm.error}</Text>\n <Button variant=\"secondary\" onClick={() => void presenter.init()}>\n Retry\n </Button>\n </div>\n );\n }\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}>Webhook Deliveries</Heading>\n <WebhookDefinitionsButton />\n </div>\n <Separator />\n <div className={\"p-sm\"}>\n <DeliveryFilters presenter={presenter} />\n </div>\n <Separator />\n {vm.loading ? <Loader /> : <DeliveryList presenter={presenter} />}\n </div>\n );\n});\n\nexport const WebhookDeliveriesPage = () => {\n const container = useContainer();\n\n const scopedContainer = useMemo(() => {\n const child = container.createChildContainer();\n ListWebhookDeliveriesFeature.register(child);\n ListAvailableEventsFeature.register(child);\n ResendWebhookDeliveryFeature.register(child);\n ListWebhooksFeature.register(child);\n WebhookDeliveriesPagePresenterFeature.register(child);\n return child;\n }, [container]);\n\n return (\n <DiContainerProvider container={scopedContainer}>\n <WebhookDeliveriesPageInner />\n </DiContainerProvider>\n );\n};\n"],"names":["Loader","Skeleton","WebhookDeliveriesPageInner","observer","presenter","useFeature","WebhookDeliveriesPagePresenterFeature","route","useRoute","Routes","webhookId","useEffect","vm","Text","Button","Heading","WebhookDefinitionsButton","Separator","DeliveryFilters","DeliveryList","WebhookDeliveriesPage","container","useContainer","scopedContainer","useMemo","child","ListWebhookDeliveriesFeature","ListAvailableEventsFeature","ResendWebhookDeliveryFeature","ListWebhooksFeature","DiContainerProvider"],"mappings":";;;;;;;;;;;;;AAgBA,MAAMA,SAAS,IACJ,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,UAAQA;QAAC,WAAU;sBACpB,oBAACA,UAAQA;QAAC,WAAU;sBACpB,oBAACA,UAAQA;QAAC,WAAU;;AAKhC,MAAMC,mDAA6BC,SAAS;IACxC,MAAM,EAAEC,SAAS,EAAE,GAAGC,WAAWC;IACjC,MAAM,EAAEC,KAAK,EAAE,GAAGC,SAASC,OAAO,UAAU;IAC5C,MAAMC,YAAYH,OAAO,QAAQ;IAEjCI,UAAU;QACDP,UAAU,IAAI,CAACM;IACxB,GAAG;QAACN;QAAWM;KAAU;IAEzB,MAAM,EAAEE,EAAE,EAAE,GAAGR;IAEf,IAAIQ,GAAG,KAAK,EACR,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAACC,MAAIA,MAAED,GAAG,KAAK,iBACf,oBAACE,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAM,KAAKV,UAAU,IAAI;OAAI;IAO9E,OAAO,WAAP,GACI,oBAAC;QAAI,WAAU;qBACX,oBAAC;QAAI,WAAU;qBACX,oBAACW,SAAOA;QAAC,OAAO;OAAG,qCACnB,oBAACC,0BAAwBA,QAAAA,WAAAA,GAE7B,oBAACC,WAASA,OAAAA,WAAAA,GACV,oBAAC;QAAI,WAAW;qBACZ,oBAACC,iBAAeA;QAAC,WAAWd;uBAEhC,oBAACa,WAASA,OACTL,GAAG,OAAO,GAAG,WAAH,GAAG,oBAACZ,QAAMA,QAAAA,WAAAA,GAAM,oBAACmB,cAAYA;QAAC,WAAWf;;AAGhE;AAEO,MAAMgB,wBAAwB;IACjC,MAAMC,YAAYC;IAElB,MAAMC,kBAAkBC,QAAQ;QAC5B,MAAMC,QAAQJ,UAAU,oBAAoB;QAC5CK,6BAA6B,QAAQ,CAACD;QACtCE,2BAA2B,QAAQ,CAACF;QACpCG,6BAA6B,QAAQ,CAACH;QACtCI,oBAAoB,QAAQ,CAACJ;QAC7BnB,sCAAsC,QAAQ,CAACmB;QAC/C,OAAOA;IACX,GAAG;QAACJ;KAAU;IAEd,OAAO,WAAP,GACI,oBAACS,qBAAmBA;QAAC,WAAWP;qBAC5B,oBAACrB,kDAA0BA;AAGvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const statusVariant: (status: string) => "destructive" | "success" | "warning";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/statusVariant.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/statusVariant.ts"],"sourcesContent":["export const statusVariant = (status: string) => {\n switch (status) {\n case \"delivered\":\n return \"success\" as const;\n case \"failed\":\n return \"destructive\" as const;\n default:\n return \"warning\" as const;\n }\n};\n"],"names":["statusVariant","status"],"mappings":"AAAO,MAAMA,gBAAgB,CAACC;IAC1B,OAAQA;QACJ,KAAK;YACD,OAAO;QACX,KAAK;YACD,OAAO;QACX;YACI,OAAO;IACf;AACJ"}
|
|
@@ -18,7 +18,6 @@ declare class WebhookFormPresenterImpl implements IWebhookFormPresenter {
|
|
|
18
18
|
private _saving;
|
|
19
19
|
private _isNew;
|
|
20
20
|
private _webhook;
|
|
21
|
-
private _showDeliveries;
|
|
22
21
|
private _webhookId;
|
|
23
22
|
private _form;
|
|
24
23
|
private _entityFieldNames;
|
|
@@ -30,10 +29,8 @@ declare class WebhookFormPresenterImpl implements IWebhookFormPresenter {
|
|
|
30
29
|
private addEventFields;
|
|
31
30
|
private collectEvents;
|
|
32
31
|
private distributeEvents;
|
|
33
|
-
save(): Promise<
|
|
32
|
+
save(): Promise<boolean>;
|
|
34
33
|
deleteWebhook(): Promise<void>;
|
|
35
|
-
openDeliveries(): void;
|
|
36
|
-
closeDeliveries(): void;
|
|
37
34
|
init(id: string): Promise<void>;
|
|
38
35
|
}
|
|
39
36
|
export declare const WebhookFormPresenter: typeof WebhookFormPresenterImpl & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed, makeAutoObservable, runInAction } from "mobx";
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { WebhookFormPresenter } from "./abstractions.js";
|
|
3
4
|
import { GetWebhookUseCase } from "../../features/getWebhook/abstractions.js";
|
|
4
5
|
import { CreateWebhookUseCase } from "../../features/createWebhook/abstractions.js";
|
|
@@ -14,7 +15,6 @@ class WebhookFormPresenterImpl {
|
|
|
14
15
|
saving: this._saving,
|
|
15
16
|
isNew: this._isNew,
|
|
16
17
|
webhook: this._webhook,
|
|
17
|
-
showDeliveries: this._showDeliveries,
|
|
18
18
|
permissions: {
|
|
19
19
|
canEdit: this.permissions.canEdit("webhook"),
|
|
20
20
|
canDelete: this.permissions.canDelete("webhook")
|
|
@@ -34,7 +34,6 @@ class WebhookFormPresenterImpl {
|
|
|
34
34
|
this._saving = false;
|
|
35
35
|
this._isNew = false;
|
|
36
36
|
this._webhook = null;
|
|
37
|
-
this._showDeliveries = false;
|
|
38
37
|
this._webhookId = null;
|
|
39
38
|
this._entityFieldNames = [];
|
|
40
39
|
this._entityGroups = new Map();
|
|
@@ -47,10 +46,10 @@ class WebhookFormPresenterImpl {
|
|
|
47
46
|
return this.formModelFactory.create({
|
|
48
47
|
fields: (fields)=>({
|
|
49
48
|
name: fields.text().label("Name").required("Name is required"),
|
|
50
|
-
slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty((form)=>{
|
|
49
|
+
slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty(({ form })=>{
|
|
51
50
|
const name = String(form.field("name").getValue() ?? "");
|
|
52
51
|
return name.trim().toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-");
|
|
53
|
-
}),
|
|
52
|
+
}).schema(z.string().min(3, "Slug must be at least 3 characters long")),
|
|
54
53
|
endpointUrl: fields.text().label("Endpoint URL").required("Endpoint URL is required").placeholder("https://"),
|
|
55
54
|
description: fields.text().label("Description").renderer("textarea"),
|
|
56
55
|
enabled: fields.boolean().label("Enabled").defaultValue(false)
|
|
@@ -159,8 +158,10 @@ class WebhookFormPresenterImpl {
|
|
|
159
158
|
}
|
|
160
159
|
async save() {
|
|
161
160
|
const data = await this._form.submit();
|
|
162
|
-
if (false === data) return;
|
|
163
|
-
|
|
161
|
+
if (false === data) return false;
|
|
162
|
+
runInAction(()=>{
|
|
163
|
+
this._saving = true;
|
|
164
|
+
});
|
|
164
165
|
try {
|
|
165
166
|
const merged = {
|
|
166
167
|
name: data.name,
|
|
@@ -189,17 +190,12 @@ class WebhookFormPresenterImpl {
|
|
|
189
190
|
this._saving = false;
|
|
190
191
|
});
|
|
191
192
|
}
|
|
193
|
+
return true;
|
|
192
194
|
}
|
|
193
195
|
async deleteWebhook() {
|
|
194
196
|
if (!this._webhookId || this._isNew) return;
|
|
195
197
|
await this.deleteWebhookUseCase.execute(this._webhookId);
|
|
196
198
|
}
|
|
197
|
-
openDeliveries() {
|
|
198
|
-
this._showDeliveries = true;
|
|
199
|
-
}
|
|
200
|
-
closeDeliveries() {
|
|
201
|
-
this._showDeliveries = false;
|
|
202
|
-
}
|
|
203
199
|
async init(id) {
|
|
204
200
|
this._loading = true;
|
|
205
201
|
this._isNew = "new" === id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookForm/WebhookFormPresenter.js","sources":["../../../../src/admin/presentation/WebhookForm/WebhookFormPresenter.ts"],"sourcesContent":["import { computed, makeAutoObservable, runInAction } from \"mobx\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\nimport type { WebhookEvent } from \"~/admin/shared/types.js\";\nimport {\n WebhookFormPresenter as Abstraction,\n type IWebhookFormPresenter,\n type IWebhookFormViewModel\n} from \"./abstractions.js\";\nimport { GetWebhookUseCase } from \"~/admin/features/getWebhook/abstractions.js\";\nimport { CreateWebhookUseCase } from \"~/admin/features/createWebhook/abstractions.js\";\nimport { UpdateWebhookUseCase } from \"~/admin/features/updateWebhook/abstractions.js\";\nimport { DeleteWebhookUseCase } from \"~/admin/features/deleteWebhook/abstractions.js\";\nimport { ListAvailableEventsUseCase } from \"~/admin/features/listAvailableEvents/abstractions.js\";\nimport { WebhookPermissions } from \"~/admin/features/permissions/abstractions.js\";\nimport {\n FormModelFactory,\n type IFormModel,\n type ILayoutNodeBuilder\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nclass WebhookFormPresenterImpl implements IWebhookFormPresenter {\n private _loading = false;\n private _saving = false;\n private _isNew = false;\n private _webhook: Webhook | null = null;\n private _showDeliveries = false;\n private _webhookId: string | null = null;\n private _form: IFormModel;\n private _entityFieldNames: string[] = [];\n private _entityGroups: Map<string, Map<string, WebhookEvent[]>> = new Map();\n\n public get vm(): IWebhookFormViewModel {\n return {\n loading: this._loading,\n saving: this._saving,\n isNew: this._isNew,\n webhook: this._webhook,\n showDeliveries: this._showDeliveries,\n permissions: {\n canEdit: this.permissions.canEdit(\"webhook\"),\n canDelete: this.permissions.canDelete(\"webhook\")\n },\n form: this._form.vm\n };\n }\n\n public constructor(\n private readonly formModelFactory: FormModelFactory.Interface,\n private readonly getWebhookUseCase: GetWebhookUseCase.Interface,\n private readonly createWebhookUseCase: CreateWebhookUseCase.Interface,\n private readonly updateWebhookUseCase: UpdateWebhookUseCase.Interface,\n private readonly deleteWebhookUseCase: DeleteWebhookUseCase.Interface,\n private readonly listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface,\n private readonly permissions: WebhookPermissions.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 name: fields.text().label(\"Name\").required(\"Name is required\"),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Slug is required\")\n .computedUntilDirty(form => {\n const name = String(form.field(\"name\").getValue() ?? \"\");\n return name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .replace(/\\s+/g, \"-\");\n }),\n endpointUrl: fields\n .text()\n .label(\"Endpoint URL\")\n .required(\"Endpoint URL is required\")\n .placeholder(\"https://\"),\n description: fields.text().label(\"Description\").renderer(\"textarea\"),\n enabled: fields.boolean().label(\"Enabled\").defaultValue(false)\n }),\n layout: layout => [\n layout.row(\"name\", \"slug\"),\n layout.row(\"endpointUrl\"),\n layout.row(\"description\"),\n layout.row(\"enabled\")\n ]\n });\n }\n\n private entityFieldName(appLabel: string, entityLabel: string): string {\n const slug = `${appLabel}_${entityLabel}`\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return `events_${slug}`;\n }\n\n private addEventFields(events: WebhookEvent[]): void {\n const grouped = new Map<string, Map<string, WebhookEvent[]>>();\n for (const event of events) {\n let appMap = grouped.get(event.appLabel);\n if (!appMap) {\n appMap = new Map();\n grouped.set(event.appLabel, appMap);\n }\n const existing = appMap.get(event.entityLabel) ?? [];\n existing.push(event);\n appMap.set(event.entityLabel, existing);\n }\n\n this._entityGroups = grouped;\n this._entityFieldNames = [];\n\n this._form.fields(fields => {\n const result: Record<string, ReturnType<typeof fields.object>> = {};\n\n for (const [appLabel, entities] of grouped) {\n for (const [entityLabel, entityEvents] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n this._entityFieldNames.push(fieldName);\n\n result[fieldName] = fields\n .object()\n .label(entityLabel)\n .renderer(\"objectAccordionSingle\", { open: false })\n .fields(f => {\n return {\n selected: f\n .text()\n .list()\n .options(\n entityEvents.map(e => ({\n label: e.label,\n value: e.eventName\n }))\n )\n .renderer(\"checkboxes\")\n };\n });\n }\n }\n\n return result;\n });\n\n this._form.setLayout(layout => {\n const rows: ILayoutNodeBuilder[] = [\n layout.row(\"name\", \"slug\"),\n layout.row(\"endpointUrl\"),\n layout.row(\"description\"),\n layout.row(\"enabled\")\n ];\n\n for (const [appLabel, entities] of grouped) {\n rows.push(layout.separator());\n rows.push(layout.element(\"sectionHeading\", { label: appLabel }));\n\n for (const [entityLabel] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n rows.push(layout.object(fieldName, inner => [inner.row(\"selected\")]));\n }\n }\n\n return rows;\n });\n\n this._form.addRule(form => {\n if (this._entityFieldNames.length === 0) {\n return [];\n }\n for (const fieldName of this._entityFieldNames) {\n const objectField = form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n const values = selectedField.getValue<string[]>();\n if (values && values.length > 0) {\n return [];\n }\n }\n\n return [{ path: \"Events\", message: \"At least one event must be selected.\" }];\n });\n }\n\n private collectEvents(): string[] {\n const allEvents: string[] = [];\n\n for (const fieldName of this._entityFieldNames) {\n const objectField = this._form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n const values = selectedField.getValue<string[]>();\n if (values && values.length > 0) {\n allEvents.push(...values);\n }\n }\n\n return allEvents;\n }\n\n private distributeEvents(webhookEvents: string[]): void {\n const eventSet = new Set(webhookEvents);\n\n for (const [appLabel, entities] of this._entityGroups) {\n for (const [entityLabel, entityEvents] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n const objectField = this._form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n\n const selected = entityEvents\n .filter(e => eventSet.has(e.eventName))\n .map(e => e.eventName);\n selectedField.setValue(selected);\n }\n }\n }\n\n public async save(): Promise<void> {\n const data = await this._form.submit<Record<string, unknown>>();\n if (data === false) {\n return;\n }\n\n this._saving = true;\n\n try {\n const merged = {\n name: data.name as string,\n slug: data.slug as string,\n endpointUrl: data.endpointUrl as string,\n description: (data.description as string) || undefined,\n enabled: data.enabled as boolean,\n events: this.collectEvents()\n };\n\n if (this._isNew) {\n const created = await this.createWebhookUseCase.execute(merged);\n\n runInAction(() => {\n this._webhook = created;\n this._webhookId = created.id;\n this._isNew = false;\n this._form.field(\"slug\").setDisabled(true);\n });\n } else {\n const updated = await this.updateWebhookUseCase.execute(this._webhookId!, merged);\n\n runInAction(() => {\n this._webhook = updated;\n });\n }\n } finally {\n runInAction(() => {\n this._saving = false;\n });\n }\n }\n\n public async deleteWebhook(): Promise<void> {\n if (!this._webhookId || this._isNew) {\n return;\n }\n await this.deleteWebhookUseCase.execute(this._webhookId);\n }\n\n public openDeliveries(): void {\n this._showDeliveries = true;\n }\n\n public closeDeliveries(): void {\n this._showDeliveries = false;\n }\n\n public async init(id: string): Promise<void> {\n this._loading = true;\n this._isNew = id === \"new\";\n this._webhookId = id === \"new\" ? null : id;\n\n const eventsPromise = this.listAvailableEventsUseCase.execute();\n\n if (!this._isNew) {\n const [webhook, events] = await Promise.all([\n this.getWebhookUseCase.execute(id),\n eventsPromise\n ]);\n\n runInAction(() => {\n this._webhook = webhook;\n this._form = this.buildForm();\n this.addEventFields(events);\n this._form.setData({\n name: webhook.name,\n slug: webhook.slug,\n endpointUrl: webhook.endpointUrl,\n description: webhook.description ?? \"\",\n enabled: webhook.enabled\n });\n this._form.field(\"slug\").setDisabled(true);\n this.distributeEvents(webhook.events);\n this._loading = false;\n });\n } else {\n const events = await eventsPromise;\n\n runInAction(() => {\n this._form = this.buildForm();\n this.addEventFields(events);\n this._loading = false;\n });\n }\n }\n}\n\nexport const WebhookFormPresenter = Abstraction.createImplementation({\n implementation: WebhookFormPresenterImpl,\n dependencies: [\n FormModelFactory,\n GetWebhookUseCase,\n CreateWebhookUseCase,\n UpdateWebhookUseCase,\n DeleteWebhookUseCase,\n ListAvailableEventsUseCase,\n WebhookPermissions\n ]\n});\n"],"names":["WebhookFormPresenterImpl","formModelFactory","getWebhookUseCase","createWebhookUseCase","updateWebhookUseCase","deleteWebhookUseCase","listAvailableEventsUseCase","permissions","Map","makeAutoObservable","computed","fields","form","name","String","layout","appLabel","entityLabel","slug","events","grouped","event","appMap","existing","result","entities","entityEvents","fieldName","f","e","rows","inner","objectField","selectedField","values","allEvents","webhookEvents","eventSet","Set","selected","data","merged","undefined","created","runInAction","updated","id","eventsPromise","webhook","Promise","WebhookFormPresenter","Abstraction","FormModelFactory","GetWebhookUseCase","CreateWebhookUseCase","UpdateWebhookUseCase","DeleteWebhookUseCase","ListAvailableEventsUseCase","WebhookPermissions"],"mappings":";;;;;;;;;AAoBA,MAAMA;IAWF,IAAW,KAA4B;QACnC,OAAO;YACH,SAAS,IAAI,CAAC,QAAQ;YACtB,QAAQ,IAAI,CAAC,OAAO;YACpB,OAAO,IAAI,CAAC,MAAM;YAClB,SAAS,IAAI,CAAC,QAAQ;YACtB,gBAAgB,IAAI,CAAC,eAAe;YACpC,aAAa;gBACT,SAAS,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBAClC,WAAW,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;YAC1C;YACA,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE;QACvB;IACJ;IAEA,YACqBC,gBAA4C,EAC5CC,iBAA8C,EAC9CC,oBAAoD,EACpDC,oBAAoD,EACpDC,oBAAoD,EACpDC,0BAAgE,EAChEC,WAAyC,CAC5D;aAPmBN,gBAAgB,GAAhBA;aACAC,iBAAiB,GAAjBA;aACAC,oBAAoB,GAApBA;aACAC,oBAAoB,GAApBA;aACAC,oBAAoB,GAApBA;aACAC,0BAA0B,GAA1BA;aACAC,WAAW,GAAXA;aAhCb,QAAQ,GAAG;aACX,OAAO,GAAG;aACV,MAAM,GAAG;aACT,QAAQ,GAAmB;aAC3B,eAAe,GAAG;aAClB,UAAU,GAAkB;aAE5B,iBAAiB,GAAa,EAAE;aAChC,aAAa,GAA6C,IAAIC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I,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,WAAW,CAAC;gBACrC,IAAI,CAAC,gBAAgB,CAACA,QAAQ,MAAM;gBACpC,IAAI,CAAC,QAAQ,GAAG;YACpB;QACJ;IASJ;AACJ;AAEO,MAAME,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBnD;IAChB,cAAc;QACVoD;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookForm/WebhookFormPresenter.js","sources":["../../../../src/admin/presentation/WebhookForm/WebhookFormPresenter.ts"],"sourcesContent":["import { computed, makeAutoObservable, runInAction } from \"mobx\";\nimport { z } from \"zod\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\nimport type { WebhookEvent } from \"~/admin/shared/types.js\";\nimport {\n WebhookFormPresenter as Abstraction,\n type IWebhookFormPresenter,\n type IWebhookFormViewModel\n} from \"./abstractions.js\";\nimport { GetWebhookUseCase } from \"~/admin/features/getWebhook/abstractions.js\";\nimport { CreateWebhookUseCase } from \"~/admin/features/createWebhook/abstractions.js\";\nimport { UpdateWebhookUseCase } from \"~/admin/features/updateWebhook/abstractions.js\";\nimport { DeleteWebhookUseCase } from \"~/admin/features/deleteWebhook/abstractions.js\";\nimport { ListAvailableEventsUseCase } from \"~/admin/features/listAvailableEvents/abstractions.js\";\nimport { WebhookPermissions } from \"~/admin/features/permissions/abstractions.js\";\nimport {\n FormModelFactory,\n type IFormModel,\n type ILayoutNodeBuilder\n} from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nclass WebhookFormPresenterImpl implements IWebhookFormPresenter {\n private _loading = false;\n private _saving = false;\n private _isNew = false;\n private _webhook: Webhook | null = null;\n private _webhookId: string | null = null;\n private _form: IFormModel;\n private _entityFieldNames: string[] = [];\n private _entityGroups: Map<string, Map<string, WebhookEvent[]>> = new Map();\n\n public get vm(): IWebhookFormViewModel {\n return {\n loading: this._loading,\n saving: this._saving,\n isNew: this._isNew,\n webhook: this._webhook,\n permissions: {\n canEdit: this.permissions.canEdit(\"webhook\"),\n canDelete: this.permissions.canDelete(\"webhook\")\n },\n form: this._form.vm\n };\n }\n\n public constructor(\n private readonly formModelFactory: FormModelFactory.Interface,\n private readonly getWebhookUseCase: GetWebhookUseCase.Interface,\n private readonly createWebhookUseCase: CreateWebhookUseCase.Interface,\n private readonly updateWebhookUseCase: UpdateWebhookUseCase.Interface,\n private readonly deleteWebhookUseCase: DeleteWebhookUseCase.Interface,\n private readonly listAvailableEventsUseCase: ListAvailableEventsUseCase.Interface,\n private readonly permissions: WebhookPermissions.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 name: fields.text().label(\"Name\").required(\"Name is required\"),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Slug is required\")\n .computedUntilDirty(({ form }) => {\n const name = String(form.field(\"name\").getValue() ?? \"\");\n return name\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9\\s-]/g, \"\")\n .replace(/\\s+/g, \"-\");\n })\n .schema(z.string().min(3, \"Slug must be at least 3 characters long\")),\n endpointUrl: fields\n .text()\n .label(\"Endpoint URL\")\n .required(\"Endpoint URL is required\")\n .placeholder(\"https://\"),\n description: fields.text().label(\"Description\").renderer(\"textarea\"),\n enabled: fields.boolean().label(\"Enabled\").defaultValue(false)\n }),\n layout: layout => [\n layout.row(\"name\", \"slug\"),\n layout.row(\"endpointUrl\"),\n layout.row(\"description\"),\n layout.row(\"enabled\")\n ]\n });\n }\n\n private entityFieldName(appLabel: string, entityLabel: string): string {\n const slug = `${appLabel}_${entityLabel}`\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return `events_${slug}`;\n }\n\n private addEventFields(events: WebhookEvent[]): void {\n const grouped = new Map<string, Map<string, WebhookEvent[]>>();\n for (const event of events) {\n let appMap = grouped.get(event.appLabel);\n if (!appMap) {\n appMap = new Map();\n grouped.set(event.appLabel, appMap);\n }\n const existing = appMap.get(event.entityLabel) ?? [];\n existing.push(event);\n appMap.set(event.entityLabel, existing);\n }\n\n this._entityGroups = grouped;\n this._entityFieldNames = [];\n\n this._form.fields(fields => {\n const result: Record<string, ReturnType<typeof fields.object>> = {};\n\n for (const [appLabel, entities] of grouped) {\n for (const [entityLabel, entityEvents] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n this._entityFieldNames.push(fieldName);\n\n result[fieldName] = fields\n .object()\n .label(entityLabel)\n .renderer(\"objectAccordionSingle\", { open: false })\n .fields(f => {\n return {\n selected: f\n .text()\n .list()\n .options(\n entityEvents.map(e => ({\n label: e.label,\n value: e.eventName\n }))\n )\n .renderer(\"checkboxes\")\n };\n });\n }\n }\n\n return result;\n });\n\n this._form.setLayout(layout => {\n const rows: ILayoutNodeBuilder[] = [\n layout.row(\"name\", \"slug\"),\n layout.row(\"endpointUrl\"),\n layout.row(\"description\"),\n layout.row(\"enabled\")\n ];\n\n for (const [appLabel, entities] of grouped) {\n rows.push(layout.separator());\n rows.push(layout.element(\"sectionHeading\", { label: appLabel }));\n\n for (const [entityLabel] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n rows.push(layout.object(fieldName, inner => [inner.row(\"selected\")]));\n }\n }\n\n return rows;\n });\n\n this._form.addRule(form => {\n if (this._entityFieldNames.length === 0) {\n return [];\n }\n for (const fieldName of this._entityFieldNames) {\n const objectField = form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n const values = selectedField.getValue<string[]>();\n if (values && values.length > 0) {\n return [];\n }\n }\n\n return [{ path: \"Events\", message: \"At least one event must be selected.\" }];\n });\n }\n\n private collectEvents(): string[] {\n const allEvents: string[] = [];\n\n for (const fieldName of this._entityFieldNames) {\n const objectField = this._form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n const values = selectedField.getValue<string[]>();\n if (values && values.length > 0) {\n allEvents.push(...values);\n }\n }\n\n return allEvents;\n }\n\n private distributeEvents(webhookEvents: string[]): void {\n const eventSet = new Set(webhookEvents);\n\n for (const [appLabel, entities] of this._entityGroups) {\n for (const [entityLabel, entityEvents] of entities) {\n const fieldName = this.entityFieldName(appLabel, entityLabel);\n const objectField = this._form.field(fieldName).as(\"object\");\n const selectedField = objectField.children.get(\"selected\");\n if (!selectedField) {\n continue;\n }\n\n const selected = entityEvents\n .filter(e => eventSet.has(e.eventName))\n .map(e => e.eventName);\n selectedField.setValue(selected);\n }\n }\n }\n\n public async save(): Promise<boolean> {\n const data = await this._form.submit<Record<string, unknown>>();\n if (data === false) {\n return false;\n }\n\n runInAction(() => {\n this._saving = true;\n });\n\n try {\n const merged = {\n name: data.name as string,\n slug: data.slug as string,\n endpointUrl: data.endpointUrl as string,\n description: (data.description as string) || undefined,\n enabled: data.enabled as boolean,\n events: this.collectEvents()\n };\n\n if (this._isNew) {\n const created = await this.createWebhookUseCase.execute(merged);\n\n runInAction(() => {\n this._webhook = created;\n this._webhookId = created.id;\n this._isNew = false;\n this._form.field(\"slug\").setDisabled(true);\n });\n } else {\n const updated = await this.updateWebhookUseCase.execute(this._webhookId!, merged);\n\n runInAction(() => {\n this._webhook = updated;\n });\n }\n } finally {\n runInAction(() => {\n this._saving = false;\n });\n }\n\n return true;\n }\n\n public async deleteWebhook(): Promise<void> {\n if (!this._webhookId || this._isNew) {\n return;\n }\n await this.deleteWebhookUseCase.execute(this._webhookId);\n }\n\n public async init(id: string): Promise<void> {\n this._loading = true;\n this._isNew = id === \"new\";\n this._webhookId = id === \"new\" ? null : id;\n\n const eventsPromise = this.listAvailableEventsUseCase.execute();\n\n if (!this._isNew) {\n const [webhook, events] = await Promise.all([\n this.getWebhookUseCase.execute(id),\n eventsPromise\n ]);\n\n runInAction(() => {\n this._webhook = webhook;\n this._form = this.buildForm();\n this.addEventFields(events);\n this._form.setData({\n name: webhook.name,\n slug: webhook.slug,\n endpointUrl: webhook.endpointUrl,\n description: webhook.description ?? \"\",\n enabled: webhook.enabled\n });\n this._form.field(\"slug\").setDisabled(true);\n this.distributeEvents(webhook.events);\n this._loading = false;\n });\n } else {\n const events = await eventsPromise;\n\n runInAction(() => {\n this._form = this.buildForm();\n this.addEventFields(events);\n this._loading = false;\n });\n }\n }\n}\n\nexport const WebhookFormPresenter = Abstraction.createImplementation({\n implementation: WebhookFormPresenterImpl,\n dependencies: [\n FormModelFactory,\n GetWebhookUseCase,\n CreateWebhookUseCase,\n UpdateWebhookUseCase,\n DeleteWebhookUseCase,\n ListAvailableEventsUseCase,\n WebhookPermissions\n ]\n});\n"],"names":["WebhookFormPresenterImpl","formModelFactory","getWebhookUseCase","createWebhookUseCase","updateWebhookUseCase","deleteWebhookUseCase","listAvailableEventsUseCase","permissions","Map","makeAutoObservable","computed","fields","form","name","String","z","layout","appLabel","entityLabel","slug","events","grouped","event","appMap","existing","result","entities","entityEvents","fieldName","f","e","rows","inner","objectField","selectedField","values","allEvents","webhookEvents","eventSet","Set","selected","data","runInAction","merged","undefined","created","updated","id","eventsPromise","webhook","Promise","WebhookFormPresenter","Abstraction","FormModelFactory","GetWebhookUseCase","CreateWebhookUseCase","UpdateWebhookUseCase","DeleteWebhookUseCase","ListAvailableEventsUseCase","WebhookPermissions"],"mappings":";;;;;;;;;;AAqBA,MAAMA;IAUF,IAAW,KAA4B;QACnC,OAAO;YACH,SAAS,IAAI,CAAC,QAAQ;YACtB,QAAQ,IAAI,CAAC,OAAO;YACpB,OAAO,IAAI,CAAC,MAAM;YAClB,SAAS,IAAI,CAAC,QAAQ;YACtB,aAAa;gBACT,SAAS,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;gBAClC,WAAW,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC;YAC1C;YACA,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE;QACvB;IACJ;IAEA,YACqBC,gBAA4C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Q,GAAG,CAAC;gBACxC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACH;gBAC/BC;aACH;YAEDN,YAAY;gBACR,IAAI,CAAC,QAAQ,GAAGO;gBAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS;gBAC3B,IAAI,CAAC,cAAc,CAAC7B;gBACpB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;oBACf,MAAM6B,QAAQ,IAAI;oBAClB,MAAMA,QAAQ,IAAI;oBAClB,aAAaA,QAAQ,WAAW;oBAChC,aAAaA,QAAQ,WAAW,IAAI;oBACpC,SAASA,QAAQ,OAAO;gBAC5B;gBACA,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,WAAW,CAAC;gBACrC,IAAI,CAAC,gBAAgB,CAACA,QAAQ,MAAM;gBACpC,IAAI,CAAC,QAAQ,GAAG;YACpB;QACJ;IASJ;AACJ;AAEO,MAAME,4CAAuBC,qBAAAA,oBAAgC,CAAC;IACjE,gBAAgBpD;IAChB,cAAc;QACVqD;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -5,7 +5,6 @@ export interface IWebhookFormViewModel {
|
|
|
5
5
|
saving: boolean;
|
|
6
6
|
isNew: boolean;
|
|
7
7
|
webhook: Webhook | null;
|
|
8
|
-
showDeliveries: boolean;
|
|
9
8
|
permissions: {
|
|
10
9
|
canEdit: boolean;
|
|
11
10
|
canDelete: boolean;
|
|
@@ -15,10 +14,8 @@ export interface IWebhookFormViewModel {
|
|
|
15
14
|
export interface IWebhookFormPresenter {
|
|
16
15
|
vm: IWebhookFormViewModel;
|
|
17
16
|
init(id: string): void;
|
|
18
|
-
save(): Promise<
|
|
17
|
+
save(): Promise<boolean>;
|
|
19
18
|
deleteWebhook(): Promise<void>;
|
|
20
|
-
openDeliveries(): void;
|
|
21
|
-
closeDeliveries(): void;
|
|
22
19
|
}
|
|
23
20
|
export declare const WebhookFormPresenter: import("@webiny/di").Abstraction<IWebhookFormPresenter>;
|
|
24
21
|
export declare namespace WebhookFormPresenter {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/presentation/WebhookForm/abstractions.js","sources":["../../../../src/admin/presentation/WebhookForm/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\nimport type { IFormVM } from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nexport interface IWebhookFormViewModel {\n loading: boolean;\n saving: boolean;\n isNew: boolean;\n webhook: Webhook | null;\n
|
|
1
|
+
{"version":3,"file":"admin/presentation/WebhookForm/abstractions.js","sources":["../../../../src/admin/presentation/WebhookForm/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\nimport type { IFormVM } from \"@webiny/app-admin/features/formModel/abstractions.js\";\n\nexport interface IWebhookFormViewModel {\n loading: boolean;\n saving: boolean;\n isNew: boolean;\n webhook: Webhook | null;\n permissions: {\n canEdit: boolean;\n canDelete: boolean;\n };\n form: IFormVM;\n}\n\nexport interface IWebhookFormPresenter {\n vm: IWebhookFormViewModel;\n init(id: string): void;\n save(): Promise<boolean>;\n deleteWebhook(): Promise<void>;\n}\n\nexport const WebhookFormPresenter =\n createAbstraction<IWebhookFormPresenter>(\"WebhookFormPresenter\");\n\nexport namespace WebhookFormPresenter {\n export type Interface = IWebhookFormPresenter;\n export type ViewModel = IWebhookFormViewModel;\n}\n"],"names":["WebhookFormPresenter","createAbstraction"],"mappings":";AAuBO,MAAMA,uBACTC,kBAAyC"}
|