@webiny/webhooks 6.4.11 → 6.6.0-alpha.1

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.
Files changed (51) hide show
  1. package/admin/WebhookRoutes.js +20 -4
  2. package/admin/WebhookRoutes.js.map +1 -1
  3. package/admin/features/ListWebhooks/ListWebhooksGateway.js +8 -2
  4. package/admin/features/ListWebhooks/ListWebhooksGateway.js.map +1 -1
  5. package/admin/features/ListWebhooks/abstractions.d.ts +1 -0
  6. package/admin/features/ListWebhooks/abstractions.js.map +1 -1
  7. package/admin/features/permissions/feature.d.ts +1 -1
  8. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryBottomInfoBar.d.ts +2 -2
  9. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.d.ts +2 -2
  10. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js +37 -24
  11. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js.map +1 -1
  12. package/admin/presentation/WebhookDeliveriesPage/components/DeliveryList.d.ts +2 -2
  13. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js +3 -3
  14. package/admin/presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js.map +1 -1
  15. package/admin/presentation/WebhookDeliveriesPage/components/statusVariant.d.ts +1 -1
  16. package/admin/presentation/WebhookForm/WebhookFormPresenter.js +1 -1
  17. package/admin/presentation/WebhookForm/WebhookFormPresenter.js.map +1 -1
  18. package/admin/presentation/WebhookForm/components/SigningSecret.d.ts +2 -2
  19. package/admin/presentation/WebhookForm/components/WebhookFormView.js +3 -4
  20. package/admin/presentation/WebhookForm/components/WebhookFormView.js.map +1 -1
  21. package/admin/presentation/WebhookList/WebhookListDataSource.d.ts +7 -8
  22. package/admin/presentation/WebhookList/WebhookListDataSource.js +23 -50
  23. package/admin/presentation/WebhookList/WebhookListDataSource.js.map +1 -1
  24. package/admin/presentation/WebhookList/components/WebhookListContent.d.ts +2 -2
  25. package/admin/presentation/WebhookList/components/WebhookListContent.js +1 -1
  26. package/admin/presentation/WebhookList/components/WebhookListContent.js.map +1 -1
  27. package/api/features/DeleteWebhook/DeleteWebhookRepository.js +1 -2
  28. package/api/features/DeleteWebhook/DeleteWebhookRepository.js.map +1 -1
  29. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js +4 -7
  30. package/api/features/ListWebhookDeliveries/ListWebhookDeliveriesRepository.js.map +1 -1
  31. package/api/features/ListWebhooks/ListWebhooksRepository.js +4 -7
  32. package/api/features/ListWebhooks/ListWebhooksRepository.js.map +1 -1
  33. package/api/graphql/WebhookCrudSchema.d.ts +2 -2
  34. package/api/graphql/WebhookCrudSchema.js +13 -2
  35. package/api/graphql/WebhookCrudSchema.js.map +1 -1
  36. package/api/graphql/WebhookDeliverySchema.d.ts +2 -2
  37. package/api/graphql/WebhookDeliverySchema.js +2 -2
  38. package/api/graphql/WebhookDeliverySchema.js.map +1 -1
  39. package/api/graphql/WebhookEventSchema.d.ts +2 -2
  40. package/api/graphql/WebhookEventSchema.js +2 -2
  41. package/api/graphql/WebhookEventSchema.js.map +1 -1
  42. package/api/graphql/WebhookSettingsSchema.d.ts +2 -2
  43. package/api/graphql/WebhookSettingsSchema.js +2 -2
  44. package/api/graphql/WebhookSettingsSchema.js.map +1 -1
  45. package/api/graphql/WebhookTriggerSchema.d.ts +2 -2
  46. package/api/graphql/WebhookTriggerSchema.js +2 -2
  47. package/api/graphql/WebhookTriggerSchema.js.map +1 -1
  48. package/api/index.d.ts +3 -0
  49. package/api/index.js +6 -2
  50. package/api/index.js.map +1 -1
  51. package/package.json +24 -23
@@ -11,6 +11,13 @@ const { Menu: Menu, Route: Route } = AdminConfig;
11
11
  const beta = /*#__PURE__*/ react.createElement(Menu.Link.Badge, {
12
12
  text: "BETA"
13
13
  });
14
+ const WebhooksBreadcrumbsRoot = ()=>/*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
15
+ name: "webhooks",
16
+ label: "Webhooks",
17
+ to: {
18
+ route: Routes.List
19
+ }
20
+ });
14
21
  const WebhookRoutes = ()=>{
15
22
  const { getLink } = useRouter();
16
23
  return /*#__PURE__*/ react.createElement(AdminConfig, null, /*#__PURE__*/ react.createElement(HasPermission, {
@@ -19,22 +26,31 @@ const WebhookRoutes = ()=>{
19
26
  route: Routes.List,
20
27
  element: /*#__PURE__*/ react.createElement(AdminLayout, {
21
28
  title: "Webhooks"
22
- }, /*#__PURE__*/ react.createElement(WebhookListView, null))
29
+ }, /*#__PURE__*/ react.createElement(WebhooksBreadcrumbsRoot, null), /*#__PURE__*/ react.createElement(WebhookListView, null))
23
30
  }), /*#__PURE__*/ react.createElement(Route, {
24
31
  route: Routes.Deliveries,
25
32
  element: /*#__PURE__*/ react.createElement(AdminLayout, {
26
33
  title: "Delivery Log"
27
- }, /*#__PURE__*/ react.createElement(WebhookDeliveriesPage, null))
34
+ }, /*#__PURE__*/ react.createElement(WebhooksBreadcrumbsRoot, null), /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
35
+ name: "webhooks.deliveries",
36
+ label: "Delivery Log"
37
+ }), /*#__PURE__*/ react.createElement(WebhookDeliveriesPage, null))
28
38
  }), /*#__PURE__*/ react.createElement(Route, {
29
39
  route: Routes.Settings,
30
40
  element: /*#__PURE__*/ react.createElement(AdminLayout, {
31
41
  title: "Webhook Settings"
32
- }, /*#__PURE__*/ react.createElement(WebhookSettingsView, null))
42
+ }, /*#__PURE__*/ react.createElement(WebhooksBreadcrumbsRoot, null), /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
43
+ name: "webhooks.settings",
44
+ label: "Settings"
45
+ }), /*#__PURE__*/ react.createElement(WebhookSettingsView, null))
33
46
  }), /*#__PURE__*/ react.createElement(Route, {
34
47
  route: Routes.Form,
35
48
  element: /*#__PURE__*/ react.createElement(AdminLayout, {
36
49
  title: "Webhooks"
37
- }, /*#__PURE__*/ react.createElement(WebhookFormView, null))
50
+ }, /*#__PURE__*/ react.createElement(WebhooksBreadcrumbsRoot, null), /*#__PURE__*/ react.createElement(AdminConfig.Breadcrumb, {
51
+ name: "webhooks.form",
52
+ label: "Webhook"
53
+ }), /*#__PURE__*/ react.createElement(WebhookFormView, null))
38
54
  }), /*#__PURE__*/ react.createElement(Menu, {
39
55
  name: "webhooks.deliveries",
40
56
  parent: "dev-tools",
@@ -1 +1 @@
1
- {"version":3,"file":"admin/WebhookRoutes.js","sources":["../../src/admin/WebhookRoutes.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { AdminLayout } from \"@webiny/app-admin\";\nimport { ReactComponent as WebhookDeliveryIcon } from \"@webiny/icons/webhook.svg\";\nimport { HasPermission } from \"./presentation/security/HasPermission.js\";\nimport { WebhookListView } from \"./presentation/WebhookList/components/WebhookListView.js\";\nimport { WebhookFormView } from \"./presentation/WebhookForm/components/WebhookFormView.js\";\nimport { WebhookSettingsView } from \"./presentation/WebhookSettings/components/WebhookSettingsView.js\";\nimport { WebhookDeliveriesPage } from \"./presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst beta = <Menu.Link.Badge text=\"BETA\" />;\n\nexport const WebhookRoutes = () => {\n const { getLink } = useRouter();\n\n return (\n <AdminConfig>\n <HasPermission entity=\"webhook\">\n <Route\n route={Routes.List}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhookListView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Deliveries}\n element={\n <AdminLayout title=\"Delivery Log\">\n <WebhookDeliveriesPage />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Settings}\n element={\n <AdminLayout title=\"Webhook Settings\">\n <WebhookSettingsView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Form}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhookFormView />\n </AdminLayout>\n }\n />\n <Menu\n name=\"webhooks.deliveries\"\n parent=\"dev-tools\"\n element={\n <Menu.Link\n text=\"Webhooks\"\n badge={beta}\n to={getLink(Routes.Deliveries)}\n icon={\n <Menu.Link.Icon\n label=\"Webhooks\"\n element={<WebhookDeliveryIcon />}\n />\n }\n />\n }\n />\n <Menu\n name=\"webhooks.settings\"\n parent=\"settings.system\"\n element={\n <Menu.Link badge={beta} text=\"Webhooks\" to={getLink(Routes.Settings)} />\n }\n />\n </HasPermission>\n </AdminConfig>\n );\n};\n"],"names":["Menu","Route","AdminConfig","beta","WebhookRoutes","getLink","useRouter","HasPermission","Routes","AdminLayout","WebhookListView","WebhookDeliveriesPage","WebhookSettingsView","WebhookFormView","WebhookDeliveryIcon"],"mappings":";;;;;;;;;AAYA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAExB,MAAMC,OAAO,WAAHA,GAAG,oBAACH,KAAK,IAAI,CAAC,KAAK;IAAC,MAAK;;AAE5B,MAAMI,gBAAgB;IACzB,MAAM,EAAEC,OAAO,EAAE,GAAGC;IAEpB,OAAO,WAAP,GACI,oBAACJ,aAAWA,MAAAA,WAAAA,GACR,oBAACK,eAAaA;QAAC,QAAO;qBAClB,oBAACN,OAAKA;QACF,OAAOO,OAAO,IAAI;QAClB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACC,iBAAeA;sBAI5B,oBAACT,OAAKA;QACF,OAAOO,OAAO,UAAU;QACxB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACE,uBAAqBA;sBAIlC,oBAACV,OAAKA;QACF,OAAOO,OAAO,QAAQ;QACtB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACG,qBAAmBA;sBAIhC,oBAACX,OAAKA;QACF,OAAOO,OAAO,IAAI;QAClB,uBACI,oBAACC,aAAWA;YAAC,OAAM;yBACf,oBAACI,iBAAeA;sBAI5B,oBAACb,MAAIA;QACD,MAAK;QACL,QAAO;QACP,uBACI,oBAACA,KAAK,IAAI;YACN,MAAK;YACL,OAAOG;YACP,IAAIE,QAAQG,OAAO,UAAU;YAC7B,oBACI,oBAACR,KAAK,IAAI,CAAC,IAAI;gBACX,OAAM;gBACN,uBAAS,oBAACc,gBAAmBA;;;sBAMjD,oBAACd,MAAIA;QACD,MAAK;QACL,QAAO;QACP,uBACI,oBAACA,KAAK,IAAI;YAAC,OAAOG;YAAM,MAAK;YAAW,IAAIE,QAAQG,OAAO,QAAQ;;;AAM3F"}
1
+ {"version":3,"file":"admin/WebhookRoutes.js","sources":["../../src/admin/WebhookRoutes.tsx"],"sourcesContent":["import React from \"react\";\nimport { AdminConfig } from \"@webiny/app-admin\";\nimport { useRouter } from \"@webiny/app-admin\";\nimport { AdminLayout } from \"@webiny/app-admin\";\nimport { ReactComponent as WebhookDeliveryIcon } from \"@webiny/icons/webhook.svg\";\nimport { HasPermission } from \"./presentation/security/HasPermission.js\";\nimport { WebhookListView } from \"./presentation/WebhookList/components/WebhookListView.js\";\nimport { WebhookFormView } from \"./presentation/WebhookForm/components/WebhookFormView.js\";\nimport { WebhookSettingsView } from \"./presentation/WebhookSettings/components/WebhookSettingsView.js\";\nimport { WebhookDeliveriesPage } from \"./presentation/WebhookDeliveriesPage/components/WebhookDeliveriesPage.js\";\nimport { Routes } from \"./routes.js\";\n\nconst { Menu, Route } = AdminConfig;\n\nconst beta = <Menu.Link.Badge text=\"BETA\" />;\n\n// Shared leading breadcrumb for all webhook routes.\nconst WebhooksBreadcrumbsRoot = () => (\n <AdminConfig.Breadcrumb name=\"webhooks\" label=\"Webhooks\" to={{ route: Routes.List }} />\n);\n\nexport const WebhookRoutes = () => {\n const { getLink } = useRouter();\n\n return (\n <AdminConfig>\n <HasPermission entity=\"webhook\">\n <Route\n route={Routes.List}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhooksBreadcrumbsRoot />\n <WebhookListView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Deliveries}\n element={\n <AdminLayout title=\"Delivery Log\">\n <WebhooksBreadcrumbsRoot />\n <AdminConfig.Breadcrumb\n name=\"webhooks.deliveries\"\n label=\"Delivery Log\"\n />\n <WebhookDeliveriesPage />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Settings}\n element={\n <AdminLayout title=\"Webhook Settings\">\n <WebhooksBreadcrumbsRoot />\n <AdminConfig.Breadcrumb name=\"webhooks.settings\" label=\"Settings\" />\n <WebhookSettingsView />\n </AdminLayout>\n }\n />\n <Route\n route={Routes.Form}\n element={\n <AdminLayout title=\"Webhooks\">\n <WebhooksBreadcrumbsRoot />\n <AdminConfig.Breadcrumb name=\"webhooks.form\" label=\"Webhook\" />\n <WebhookFormView />\n </AdminLayout>\n }\n />\n <Menu\n name=\"webhooks.deliveries\"\n parent=\"dev-tools\"\n element={\n <Menu.Link\n text=\"Webhooks\"\n badge={beta}\n to={getLink(Routes.Deliveries)}\n icon={\n <Menu.Link.Icon\n label=\"Webhooks\"\n element={<WebhookDeliveryIcon />}\n />\n }\n />\n }\n />\n <Menu\n name=\"webhooks.settings\"\n parent=\"settings.system\"\n element={\n <Menu.Link badge={beta} text=\"Webhooks\" to={getLink(Routes.Settings)} />\n }\n />\n </HasPermission>\n </AdminConfig>\n );\n};\n"],"names":["Menu","Route","AdminConfig","beta","WebhooksBreadcrumbsRoot","Routes","WebhookRoutes","getLink","useRouter","HasPermission","AdminLayout","WebhookListView","WebhookDeliveriesPage","WebhookSettingsView","WebhookFormView","WebhookDeliveryIcon"],"mappings":";;;;;;;;;AAYA,MAAM,EAAEA,MAAAA,IAAI,EAAEC,OAAAA,KAAK,EAAE,GAAGC;AAExB,MAAMC,OAAO,WAAHA,GAAG,oBAACH,KAAK,IAAI,CAAC,KAAK;IAAC,MAAK;;AAGnC,MAAMI,0BAA0B,kBAC5B,oBAACF,YAAY,UAAU;QAAC,MAAK;QAAW,OAAM;QAAW,IAAI;YAAE,OAAOG,OAAO,IAAI;QAAC;;AAG/E,MAAMC,gBAAgB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14 @@
1
1
  import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import { ListWebhooksGateway } from "./abstractions.js";
3
3
  const LIST_WEBHOOKS = `
4
- query ListWebhooks($where: ListWebhooksWhereInput, $limit: Int, $after: String) {
4
+ query ListWebhooks(
5
+ $where: ListWebhooksWhereInput
6
+ $sort: [ListWebhooksSort!]
7
+ $limit: Int
8
+ $after: String
9
+ ) {
5
10
  webhooks {
6
- listWebhooks(where: $where, limit: $limit, after: $after) {
11
+ listWebhooks(where: $where, sort: $sort, limit: $limit, after: $after) {
7
12
  data {
8
13
  id
9
14
  name
@@ -39,6 +44,7 @@ class ListWebhooksGraphQLGateway {
39
44
  query: LIST_WEBHOOKS,
40
45
  variables: {
41
46
  where: input.where,
47
+ sort: input.sort,
42
48
  limit: input.limit,
43
49
  after: input.after
44
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/ListWebhooks/ListWebhooksGateway.js","sources":["../../../../src/admin/features/ListWebhooks/ListWebhooksGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n ListWebhooksGateway as GatewayAbstraction,\n type IListWebhooksInput,\n type IListWebhooksOutput\n} from \"./abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nconst LIST_WEBHOOKS = /* GraphQL */ `\n query ListWebhooks($where: ListWebhooksWhereInput, $limit: Int, $after: String) {\n webhooks {\n listWebhooks(where: $where, limit: $limit, after: $after) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype ListWebhooksResponse = {\n webhooks: {\n listWebhooks:\n | {\n data: Webhook[];\n meta: { cursor: string | null; hasMoreItems: boolean; totalCount: number };\n error: null;\n }\n | {\n data: null;\n meta: null;\n error: { code: string; message: string; data: unknown };\n };\n };\n};\n\nclass ListWebhooksGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(input: IListWebhooksInput): Promise<IListWebhooksOutput> {\n const response = await this.client.execute<ListWebhooksResponse>({\n query: LIST_WEBHOOKS,\n variables: {\n where: input.where,\n limit: input.limit,\n after: input.after\n }\n });\n\n const envelope = response.webhooks.listWebhooks;\n if (envelope.error) {\n throw new Error(envelope.error.message);\n }\n\n return {\n items: envelope.data,\n meta: envelope.meta\n };\n }\n}\n\nexport const ListWebhooksGateway = GatewayAbstraction.createImplementation({\n implementation: ListWebhooksGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_WEBHOOKS","ListWebhooksGraphQLGateway","client","input","response","envelope","Error","ListWebhooksGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAQA,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BrC,CAAC;AAkBD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,KAAyB,EAAgC;QACnE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuB;YAC7D,OAAOJ;YACP,WAAW;gBACP,OAAOG,MAAM,KAAK;gBAClB,OAAOA,MAAM,KAAK;gBAClB,OAAOA,MAAM,KAAK;YACtB;QACJ;QAEA,MAAME,WAAWD,SAAS,QAAQ,CAAC,YAAY;QAC/C,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,MAAMD,SAAS,KAAK,CAAC,OAAO;QAG1C,OAAO;YACH,OAAOA,SAAS,IAAI;YACpB,MAAMA,SAAS,IAAI;QACvB;IACJ;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAAuC,CAAC;IACvE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
1
+ {"version":3,"file":"admin/features/ListWebhooks/ListWebhooksGateway.js","sources":["../../../../src/admin/features/ListWebhooks/ListWebhooksGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n ListWebhooksGateway as GatewayAbstraction,\n type IListWebhooksInput,\n type IListWebhooksOutput\n} from \"./abstractions.js\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nconst LIST_WEBHOOKS = /* GraphQL */ `\n query ListWebhooks(\n $where: ListWebhooksWhereInput\n $sort: [ListWebhooksSort!]\n $limit: Int\n $after: String\n ) {\n webhooks {\n listWebhooks(where: $where, sort: $sort, limit: $limit, after: $after) {\n data {\n id\n name\n slug\n endpointUrl\n description\n enabled\n events\n signingSecret\n createdOn\n modifiedOn\n }\n meta {\n cursor\n hasMoreItems\n totalCount\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype ListWebhooksResponse = {\n webhooks: {\n listWebhooks:\n | {\n data: Webhook[];\n meta: { cursor: string | null; hasMoreItems: boolean; totalCount: number };\n error: null;\n }\n | {\n data: null;\n meta: null;\n error: { code: string; message: string; data: unknown };\n };\n };\n};\n\nclass ListWebhooksGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(input: IListWebhooksInput): Promise<IListWebhooksOutput> {\n const response = await this.client.execute<ListWebhooksResponse>({\n query: LIST_WEBHOOKS,\n variables: {\n where: input.where,\n sort: input.sort,\n limit: input.limit,\n after: input.after\n }\n });\n\n const envelope = response.webhooks.listWebhooks;\n if (envelope.error) {\n throw new Error(envelope.error.message);\n }\n\n return {\n items: envelope.data,\n meta: envelope.meta\n };\n }\n}\n\nexport const ListWebhooksGateway = GatewayAbstraction.createImplementation({\n implementation: ListWebhooksGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_WEBHOOKS","ListWebhooksGraphQLGateway","client","input","response","envelope","Error","ListWebhooksGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAQA,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCrC,CAAC;AAkBD,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,KAAyB,EAAgC;QACnE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuB;YAC7D,OAAOJ;YACP,WAAW;gBACP,OAAOG,MAAM,KAAK;gBAClB,MAAMA,MAAM,IAAI;gBAChB,OAAOA,MAAM,KAAK;gBAClB,OAAOA,MAAM,KAAK;YACtB;QACJ;QAEA,MAAME,WAAWD,SAAS,QAAQ,CAAC,YAAY;QAC/C,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,MAAMD,SAAS,KAAK,CAAC,OAAO;QAG1C,OAAO;YACH,OAAOA,SAAS,IAAI;YACpB,MAAMA,SAAS,IAAI;QACvB;IACJ;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAAuC,CAAC;IACvE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -1,6 +1,7 @@
1
1
  import type { Webhook } from "../../../admin/shared/types.js";
2
2
  export interface IListWebhooksInput {
3
3
  where?: Record<string, unknown>;
4
+ sort?: string[];
4
5
  limit?: number;
5
6
  after?: string;
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/ListWebhooks/abstractions.js","sources":["../../../../src/admin/features/ListWebhooks/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nexport interface IListWebhooksInput {\n where?: Record<string, unknown>;\n limit?: number;\n after?: string;\n}\n\nexport interface IListWebhooksMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\nexport interface IListWebhooksOutput {\n items: Webhook[];\n meta: IListWebhooksMeta;\n}\n\nexport interface IListWebhooksGateway {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksGateway = createAbstraction<IListWebhooksGateway>(\"ListWebhooksGateway\");\n\nexport namespace ListWebhooksGateway {\n export type Interface = IListWebhooksGateway;\n}\n\nexport interface IListWebhooksRepository {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksRepository =\n createAbstraction<IListWebhooksRepository>(\"ListWebhooksRepository\");\n\nexport namespace ListWebhooksRepository {\n export type Interface = IListWebhooksRepository;\n}\n\nexport interface IListWebhooksUseCase {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksUseCase = createAbstraction<IListWebhooksUseCase>(\"ListWebhooksUseCase\");\n\nexport namespace ListWebhooksUseCase {\n export type Interface = IListWebhooksUseCase;\n}\n"],"names":["ListWebhooksGateway","createAbstraction","ListWebhooksRepository","ListWebhooksUseCase"],"mappings":";AAwBO,MAAMA,sBAAsBC,kBAAwC;AAUpE,MAAMC,yBACTD,kBAA2C;AAUxC,MAAME,sBAAsBF,kBAAwC"}
1
+ {"version":3,"file":"admin/features/ListWebhooks/abstractions.js","sources":["../../../../src/admin/features/ListWebhooks/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { Webhook } from \"~/admin/shared/types.js\";\n\nexport interface IListWebhooksInput {\n where?: Record<string, unknown>;\n sort?: string[];\n limit?: number;\n after?: string;\n}\n\nexport interface IListWebhooksMeta {\n cursor: string | null;\n hasMoreItems: boolean;\n totalCount: number;\n}\n\nexport interface IListWebhooksOutput {\n items: Webhook[];\n meta: IListWebhooksMeta;\n}\n\nexport interface IListWebhooksGateway {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksGateway = createAbstraction<IListWebhooksGateway>(\"ListWebhooksGateway\");\n\nexport namespace ListWebhooksGateway {\n export type Interface = IListWebhooksGateway;\n}\n\nexport interface IListWebhooksRepository {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksRepository =\n createAbstraction<IListWebhooksRepository>(\"ListWebhooksRepository\");\n\nexport namespace ListWebhooksRepository {\n export type Interface = IListWebhooksRepository;\n}\n\nexport interface IListWebhooksUseCase {\n execute(input: IListWebhooksInput): Promise<IListWebhooksOutput>;\n}\n\nexport const ListWebhooksUseCase = createAbstraction<IListWebhooksUseCase>(\"ListWebhooksUseCase\");\n\nexport namespace ListWebhooksUseCase {\n export type Interface = IListWebhooksUseCase;\n}\n"],"names":["ListWebhooksGateway","createAbstraction","ListWebhooksRepository","ListWebhooksUseCase"],"mappings":";AAyBO,MAAMA,sBAAsBC,kBAAwC;AAUpE,MAAMC,yBACTD,kBAA2C;AAUxC,MAAME,sBAAsBF,kBAAwC"}
@@ -1,4 +1,4 @@
1
- export declare const WebhookPermissionsFeature: import("@webiny/feature/admin").FeatureDefinition<{
1
+ export declare const WebhookPermissionsFeature: import("@webiny/feature/admin/createFeature.js").FeatureDefinition<{
2
2
  permissions: {
3
3
  canAccess: (entityId: "webhook") => boolean;
4
4
  canAction: (action: string, entityId: "webhook") => boolean;
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
3
3
  interface DeliveryBottomInfoBarProps {
4
4
  presenter: IWebhookDeliveriesPagePresenter;
5
5
  }
6
- export declare const DeliveryBottomInfoBar: (({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null) & {
7
- displayName: string;
6
+ export declare const DeliveryBottomInfoBar: (({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null) & React.NamedExoticComponent<DeliveryBottomInfoBarProps> & {
7
+ readonly type: ({ presenter }: DeliveryBottomInfoBarProps) => React.JSX.Element | null;
8
8
  };
9
9
  export {};
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
3
3
  interface DeliveryFiltersProps {
4
4
  presenter: IWebhookDeliveriesPagePresenter;
5
5
  }
6
- export declare const DeliveryFilters: (({ presenter }: DeliveryFiltersProps) => React.JSX.Element) & {
7
- displayName: string;
6
+ export declare const DeliveryFilters: (({ presenter }: DeliveryFiltersProps) => React.JSX.Element) & React.NamedExoticComponent<DeliveryFiltersProps> & {
7
+ readonly type: ({ presenter }: DeliveryFiltersProps) => React.JSX.Element;
8
8
  };
9
9
  export {};
@@ -1,6 +1,7 @@
1
- import react from "react";
1
+ import react, { useState } from "react";
2
2
  import { observer } from "mobx-react-lite";
3
- import { Button, Grid, MultiSelect, Select } from "@webiny/admin-ui";
3
+ import { Drawer, IconButton, MultiSelect, Select } from "@webiny/admin-ui";
4
+ import { ReactComponent } from "@webiny/icons/filter_list.svg";
4
5
  const STATUS_OPTIONS = [
5
6
  {
6
7
  value: "pending",
@@ -21,30 +22,51 @@ const STATUS_OPTIONS = [
21
22
  ];
22
23
  const DeliveryFilters = observer(({ presenter })=>{
23
24
  const { vm } = presenter;
24
- return /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
25
- span: 2
25
+ const [open, setOpen] = useState(false);
26
+ return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(IconButton, {
27
+ variant: vm.hasFilters ? "primary" : "ghost",
28
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null),
29
+ onClick: ()=>setOpen(true),
30
+ "data-testid": "webhooks.toggle-filters"
31
+ }), /*#__PURE__*/ react.createElement(Drawer, {
32
+ open: open,
33
+ onClose: ()=>setOpen(false),
34
+ modal: true,
35
+ width: 360,
36
+ title: "Filters",
37
+ headerSeparator: true,
38
+ footerSeparator: true,
39
+ bodyPadding: false,
40
+ actions: /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Drawer.CancelButton, {
41
+ text: "Clear all",
42
+ onClick: ()=>presenter.clearFilters()
43
+ }), /*#__PURE__*/ react.createElement(Drawer.ConfirmButton, {
44
+ text: "Apply filters",
45
+ onClick: ()=>setOpen(false)
46
+ }))
47
+ }, /*#__PURE__*/ react.createElement("div", {
48
+ className: "flex flex-col gap-lg p-lg"
26
49
  }, /*#__PURE__*/ react.createElement(Select, {
27
50
  size: "md",
51
+ label: "Webhook",
28
52
  placeholder: "All webhooks",
29
53
  value: vm.filters.webhookId ?? "",
30
54
  options: vm.availableWebhooks,
31
55
  onChange: (value)=>presenter.setWebhookFilter(value || null),
32
56
  displayResetAction: true,
33
57
  onValueReset: ()=>presenter.setWebhookFilter(null)
34
- })), /*#__PURE__*/ react.createElement(Grid.Column, {
35
- span: 2
36
- }, /*#__PURE__*/ react.createElement(Select, {
58
+ }), /*#__PURE__*/ react.createElement(Select, {
37
59
  size: "md",
60
+ label: "Application",
38
61
  placeholder: "All apps",
39
62
  value: vm.filters.app ?? "",
40
63
  options: vm.availableApps,
41
64
  onChange: (value)=>presenter.setAppFilter(value || null),
42
65
  displayResetAction: true,
43
66
  onValueReset: ()=>presenter.setAppFilter(null)
44
- })), /*#__PURE__*/ react.createElement(Grid.Column, {
45
- span: 2
46
- }, /*#__PURE__*/ react.createElement(Select, {
67
+ }), /*#__PURE__*/ react.createElement(Select, {
47
68
  size: "md",
69
+ label: "Entity",
48
70
  placeholder: "All entities",
49
71
  value: vm.filters.entity ?? "",
50
72
  options: vm.availableEntities,
@@ -52,10 +74,9 @@ const DeliveryFilters = observer(({ presenter })=>{
52
74
  disabled: !vm.filters.app,
53
75
  displayResetAction: true,
54
76
  onValueReset: ()=>presenter.setEntityFilter(null)
55
- })), /*#__PURE__*/ react.createElement(Grid.Column, {
56
- span: 2
57
- }, /*#__PURE__*/ react.createElement(Select, {
77
+ }), /*#__PURE__*/ react.createElement(Select, {
58
78
  size: "md",
79
+ label: "Event",
59
80
  placeholder: "All events",
60
81
  value: vm.filters.eventName ?? "",
61
82
  options: vm.availableEventNames,
@@ -63,22 +84,14 @@ const DeliveryFilters = observer(({ presenter })=>{
63
84
  disabled: !vm.filters.app,
64
85
  displayResetAction: true,
65
86
  onValueReset: ()=>presenter.setEventFilter(null)
66
- })), /*#__PURE__*/ react.createElement(Grid.Column, {
67
- span: 2
68
- }, /*#__PURE__*/ react.createElement(MultiSelect, {
87
+ }), /*#__PURE__*/ react.createElement(MultiSelect, {
69
88
  size: "md",
89
+ label: "Status",
70
90
  placeholder: "All statuses",
71
91
  value: vm.filters.status,
72
92
  options: STATUS_OPTIONS,
73
93
  onChange: (values)=>presenter.setStatusFilter(values)
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")));
94
+ }))));
82
95
  });
83
96
  export { DeliveryFilters };
84
97
 
@@ -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\";\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,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AA,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
+ {"version":3,"file":"admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.js","sources":["../../../../../src/admin/presentation/WebhookDeliveriesPage/components/DeliveryFilters.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { Drawer, IconButton, MultiSelect, Select } from \"@webiny/admin-ui\";\nimport { ReactComponent as FilterIcon } from \"@webiny/icons/filter_list.svg\";\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(({ presenter }: DeliveryFiltersProps) => {\n const { vm } = presenter;\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <IconButton\n variant={vm.hasFilters ? \"primary\" : \"ghost\"}\n icon={<FilterIcon />}\n onClick={() => setOpen(true)}\n data-testid=\"webhooks.toggle-filters\"\n />\n <Drawer\n open={open}\n onClose={() => setOpen(false)}\n modal={true}\n width={360}\n title=\"Filters\"\n headerSeparator={true}\n footerSeparator={true}\n bodyPadding={false}\n actions={\n <>\n <Drawer.CancelButton\n text=\"Clear all\"\n onClick={() => presenter.clearFilters()}\n />\n <Drawer.ConfirmButton text=\"Apply filters\" onClick={() => setOpen(false)} />\n </>\n }\n >\n <div className=\"flex flex-col gap-lg p-lg\">\n <Select\n size={\"md\"}\n label=\"Webhook\"\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 <Select\n size={\"md\"}\n label=\"Application\"\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 <Select\n size={\"md\"}\n label=\"Entity\"\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 <Select\n size={\"md\"}\n label=\"Event\"\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 <MultiSelect\n size={\"md\"}\n label=\"Status\"\n placeholder=\"All statuses\"\n value={vm.filters.status}\n options={STATUS_OPTIONS}\n onChange={values => presenter.setStatusFilter(values)}\n />\n </div>\n </Drawer>\n </>\n );\n});\n"],"names":["STATUS_OPTIONS","DeliveryFilters","observer","presenter","vm","open","setOpen","useState","IconButton","FilterIcon","Drawer","Select","value","MultiSelect","values"],"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,MAAM,CAACE,MAAMC,QAAQ,GAAGC,SAAS;IAEjC,OAAO,WAAP,GACI,wDACI,oBAACC,YAAUA;QACP,SA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IAAI;QAC/B,SAASA,GAAG,mBAAmB;QAC/B,UAAUQ,CAAAA,QAAST,UAAU,cAAc,CAACS,SAAS;QACrD,UAAU,CAACR,GAAG,OAAO,CAAC,GAAG;QACzB,oBAAoB;QACpB,cAAc,IAAMD,UAAU,cAAc,CAAC;sBAEjD,oBAACU,aAAWA;QACR,MAAM;QACN,OAAM;QACN,aAAY;QACZ,OAAOT,GAAG,OAAO,CAAC,MAAM;QACxB,SAASJ;QACT,UAAUc,CAAAA,SAAUX,UAAU,eAAe,CAACW;;AAMtE"}
@@ -3,7 +3,7 @@ import type { IWebhookDeliveriesPagePresenter } from "../abstractions.js";
3
3
  interface DeliveryListProps {
4
4
  presenter: IWebhookDeliveriesPagePresenter;
5
5
  }
6
- export declare const DeliveryList: (({ presenter }: DeliveryListProps) => React.JSX.Element) & {
7
- displayName: string;
6
+ export declare const DeliveryList: (({ presenter }: DeliveryListProps) => React.JSX.Element) & React.NamedExoticComponent<DeliveryListProps> & {
7
+ readonly type: ({ presenter }: DeliveryListProps) => React.JSX.Element;
8
8
  };
9
9
  export {};
@@ -43,11 +43,11 @@ const WebhookDeliveriesPage_WebhookDeliveriesPageInner = observer(function() {
43
43
  className: "flex items-center justify-between py-sm px-md"
44
44
  }, /*#__PURE__*/ react.createElement(Heading, {
45
45
  level: 5
46
- }, "Webhook Deliveries"), /*#__PURE__*/ react.createElement(WebhookDefinitionsButton, null)), /*#__PURE__*/ react.createElement(Separator, null), /*#__PURE__*/ react.createElement("div", {
47
- className: "p-sm"
46
+ }, "Webhook Deliveries"), /*#__PURE__*/ react.createElement("div", {
47
+ className: "flex items-center gap-sm"
48
48
  }, /*#__PURE__*/ react.createElement(DeliveryFilters, {
49
49
  presenter: presenter
50
- })), /*#__PURE__*/ react.createElement(Separator, null), vm.loading ? /*#__PURE__*/ react.createElement(Loader, null) : /*#__PURE__*/ react.createElement(DeliveryList, {
50
+ }), /*#__PURE__*/ react.createElement(WebhookDefinitionsButton, null))), /*#__PURE__*/ react.createElement(Separator, null), vm.loading ? /*#__PURE__*/ react.createElement(Loader, null) : /*#__PURE__*/ react.createElement(DeliveryList, {
51
51
  presenter: presenter
52
52
  }));
53
53
  });
@@ -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, 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"}
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 <div className=\"flex items-center gap-sm\">\n <DeliveryFilters presenter={presenter} />\n <WebhookDefinitionsButton />\n </div>\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","DeliveryFilters","WebhookDefinitionsButton","Separator","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,oBAAC;QAAI,WAAU;qBACX,oBAACC,iBAAeA;QAAC,WAAWZ;sBAC5B,oBAACa,0BAAwBA,SAAAA,WAAAA,GAGjC,oBAACC,WAASA,OACTN,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"}
@@ -1 +1 @@
1
- export declare const statusVariant: (status: string) => "success" | "warning" | "destructive";
1
+ export declare const statusVariant: (status: string) => "destructive" | "success" | "warning";
@@ -46,7 +46,7 @@ class WebhookFormPresenterImpl {
46
46
  return this.formModelFactory.create({
47
47
  fields: (fields)=>({
48
48
  name: fields.text().label("Name").required("Name is required"),
49
- slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty((form)=>{
49
+ slug: fields.text().label("Slug").required("Slug is required").computedUntilDirty(({ form })=>{
50
50
  const name = String(form.field("name").getValue() ?? "");
51
51
  return name.trim().toLowerCase().replace(/[^a-z0-9\s-]/g, "").replace(/\s+/g, "-");
52
52
  }).schema(z.string().min(3, "Slug must be at least 3 characters long")),
@@ -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 { 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,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,GA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ACf,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"}
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,WA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,CAAC,SAAS;gBAC3B,IAAI,CAAC,cAAc,CAACtB;gBACpB,IAAI,CAAC,QAAQ,GAAG;YACpB;QACJ,OA7BkB;YACd,MAAM,CAAC6B,SAAS7B,OAAO,GAAG,MAAM8B,QAAQ,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"}
@@ -3,7 +3,7 @@ import type { IWebhookFormPresenter } from "../abstractions.js";
3
3
  interface SigningSecretProps {
4
4
  presenter: IWebhookFormPresenter;
5
5
  }
6
- export declare const SigningSecret: (({ presenter }: SigningSecretProps) => React.JSX.Element | null) & {
7
- displayName: string;
6
+ export declare const SigningSecret: (({ presenter }: SigningSecretProps) => React.JSX.Element | null) & React.NamedExoticComponent<SigningSecretProps> & {
7
+ readonly type: ({ presenter }: SigningSecretProps) => React.JSX.Element | null;
8
8
  };
9
9
  export {};
@@ -48,11 +48,10 @@ const WebhookFormView_WebhookFormViewInner = observer(function() {
48
48
  text: "Loading..."
49
49
  }) : null, vm.saving ? /*#__PURE__*/ react.createElement(OverlayLoader, {
50
50
  text: "Saving..."
51
- }) : null, vm.form.errors.length > 0 ? /*#__PURE__*/ react.createElement("div", {
51
+ }) : null, /*#__PURE__*/ react.createElement(FormErrors, {
52
+ form: vm.form,
52
53
  className: "mb-lg"
53
- }, /*#__PURE__*/ react.createElement(FormErrors, {
54
- form: vm.form
55
- })) : null, /*#__PURE__*/ react.createElement(SimpleFormHeader, {
54
+ }), /*#__PURE__*/ react.createElement(SimpleFormHeader, {
56
55
  title: vm.isNew ? "Create Webhook" : vm.webhook?.name ?? "Edit Webhook"
57
56
  }), /*#__PURE__*/ react.createElement(SimpleFormContent, null, /*#__PURE__*/ react.createElement(FormView, {
58
57
  name: "Webhook",
@@ -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, 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 {vm.form.errors.length > 0 ? (\n <div className={\"mb-lg\"}>\n <FormErrors form={vm.form} />\n </div>\n ) : null}\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,0BAA0BhB;QAC9B,IACD;QAACgB;KAAiB;IAErBI,UAAU;QACDf,UAAU,IAAI,CAACU;IACxB,GAAG;QAACV;QAAWU;KAAG;IAElB,MAAMM,WAAWC,YAAY;QACzB,MAAMC,MAAM,M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,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
+ {"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,0BAA0BhB;QAC9B,IACD;QAACgB;KAAiB;IAErBI,UAAU;QACDf,UAAU,IAAI,CAACU;IACxB,GAAG;QAACV;QAAWU;KAAG;IAElB,MAAMM,WAAWC,YAAY;QACzB,MAAMC,MAAM,MAAMlB,UAAU,IAAI;QAChC,IAAIkB,KACAV,MAAM,gBAAgB,CAAC;YAAE,OAAO;QAA8B;IAEtE,GAAG;QAACR;KAAU;IAEd,MAAM,EAAEmB,EAAE,EAAE,GAAGnB;IAEf,OAAO,WAAP,GACI,oBAACoB,YAAUA,MACND,GAAG,OAAO,GAAG,WAAH,GAAG,oBAACE,eAAaA;QAAC,MAAM;SAAmB,MACrDF,GAAG,MAAM,GAAG,WAAH,GAAG,oBAACE,eAAaA;QAAC,MAAM;SAAkB,oBACpD,oBAACC,YAAUA;QAAC,MAAMH,GAAG,IAAI;QAAE,WAAW;sBACtC,oBAACI,kBAAgBA;QACb,OAAOJ,GAAG,KAAK,GAAG,mBAAoBA,GAAG,OAAO,EAAE,QAAQ;sBAE9D,oBAACK,mBAAiBA,MAAAA,WAAAA,GACd,oBAACC,UAAQA;QAAC,MAAK;QAAU,MAAMN,GAAG,IAAI;QAAE,WAAWN;sBACnD,oBAACa,eAAaA;QAAC,WAAW1B;uBAE9B,oBAAC2B,kBAAgBA;QAAC,WAAW;qBACzB,oBAACC,QAAMA;QAAC,SAAQ;QAAY,SAAS,IAAMzB,UAAUI,OAAO,IAAI;OAAG,yBAGnE,oBAACsB,eAAaA;QAAC,QAAO;QAAU,QAAO;qBACnC,oBAACD,QAAMA;QAAC,SAAQ;QAAU,SAASZ;QAAU,UAAUG,GAAG,MAAM;OAC3DA,GAAG,MAAM,GAAG,cAAc;AAMnD;AAEO,MAAMW,kBAAkB;IAC3B,MAAMC,YAAYC;IAElB,MAAMC,kBAAkBnB,QAAQ;QAC5B,MAAMoB,QAAQH,UAAU,oBAAoB;QAC5CI,kBAAkB,QAAQ,CAACD;QAC3BE,qBAAqB,QAAQ,CAACF;QAC9BG,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 type { IDataSource, IDataSourceQuery, IDataSourceMeta } from "@webiny/app-admin/presentation/listPresenter/abstractions.js";
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 implements IDataSource<Webhook> {
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
- get meta(): IDataSourceMeta;
12
- get loading(): boolean;
13
- query(params: IDataSourceQuery): Promise<void>;
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
  }