@bigbinary/neeto-webhooks-frontend 1.6.25 → 1.7.0-beta1

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/dist/index.js CHANGED
@@ -7,18 +7,33 @@ import Container from '@bigbinary/neeto-molecules/Container';
7
7
  import Header$2 from '@bigbinary/neeto-molecules/Header';
8
8
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
9
9
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
10
- import { Typography, Tag, Tab, Pane, Button, Table, NoData, Spinner, Alert } from '@bigbinary/neetoui';
10
+ import NoData from '@bigbinary/neetoui/NoData';
11
+ import Table from '@bigbinary/neetoui/Table';
11
12
  import { useTranslation } from 'react-i18next';
12
- import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient, useMutation } from 'react-query';
13
- import { ReactQueryDevtools } from 'react-query/devtools';
13
+ import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
14
+ import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
15
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
14
16
  import axios from 'axios';
15
17
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
18
+ import Button from '@bigbinary/neetoui/Button';
19
+ import Pane from '@bigbinary/neetoui/Pane';
20
+ import Typography from '@bigbinary/neetoui/Typography';
21
+ import Tab from '@bigbinary/neetoui/Tab';
22
+ import Tag from '@bigbinary/neetoui/Tag';
16
23
  import { t as t$1 } from 'i18next';
17
24
  import { prop, pluck, assoc } from 'ramda';
25
+ import Alert from '@bigbinary/neetoui/Alert';
26
+ import { useMutationWithInvalidation, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
18
27
  import { Plus } from '@bigbinary/neeto-icons';
19
28
  import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
20
29
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
21
- import { Form, Textarea, Select, Input, Switch, ActionBlock } from '@bigbinary/neetoui/formik';
30
+ import Spinner from '@bigbinary/neetoui/Spinner';
31
+ import Input from '@bigbinary/neetoui/formik/Input';
32
+ import Form from '@bigbinary/neetoui/formik/Form';
33
+ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
34
+ import Select from '@bigbinary/neetoui/formik/Select';
35
+ import Switch from '@bigbinary/neetoui/formik/Switch';
36
+ import Textarea from '@bigbinary/neetoui/formik/Textarea';
22
37
  import * as yup from 'yup';
23
38
 
24
39
  var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
@@ -99,6 +114,47 @@ function _slicedToArray(arr, i) {
99
114
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
100
115
  }
101
116
 
117
+ function _typeof$1(o) {
118
+ "@babel/helpers - typeof";
119
+
120
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
121
+ return typeof o;
122
+ } : function (o) {
123
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
124
+ }, _typeof$1(o);
125
+ }
126
+
127
+ function _toPrimitive(input, hint) {
128
+ if (_typeof$1(input) !== "object" || input === null) return input;
129
+ var prim = input[Symbol.toPrimitive];
130
+ if (prim !== undefined) {
131
+ var res = prim.call(input, hint || "default");
132
+ if (_typeof$1(res) !== "object") return res;
133
+ throw new TypeError("@@toPrimitive must return a primitive value.");
134
+ }
135
+ return (hint === "string" ? String : Number)(input);
136
+ }
137
+
138
+ function _toPropertyKey(arg) {
139
+ var key = _toPrimitive(arg, "string");
140
+ return _typeof$1(key) === "symbol" ? key : String(key);
141
+ }
142
+
143
+ function _defineProperty(obj, key, value) {
144
+ key = _toPropertyKey(key);
145
+ if (key in obj) {
146
+ Object.defineProperty(obj, key, {
147
+ value: value,
148
+ enumerable: true,
149
+ configurable: true,
150
+ writable: true
151
+ });
152
+ } else {
153
+ obj[key] = value;
154
+ }
155
+ return obj;
156
+ }
157
+
102
158
  var queryClient = new QueryClient({
103
159
  queryCache: new QueryCache(),
104
160
  defaultOptions: {
@@ -108,15 +164,17 @@ var queryClient = new QueryClient({
108
164
  }
109
165
  });
110
166
 
111
- /* eslint-disable @bigbinary/neeto/file-name-and-export-name-standards */
167
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
168
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
112
169
  var withReactQuery = function withReactQuery(Component) {
113
170
  var QueryWrapper = function QueryWrapper(props) {
114
- return /*#__PURE__*/React.createElement(QueryClientProvider, {
115
- client: queryClient
116
- }, /*#__PURE__*/React.createElement(Component, props), /*#__PURE__*/React.createElement(ReactQueryDevtools, {
117
- initialIsOpen: false,
118
- position: "bottom-right"
119
- }));
171
+ return /*#__PURE__*/jsxs(QueryClientProvider, {
172
+ client: queryClient,
173
+ children: [/*#__PURE__*/jsx(Component, _objectSpread$2({}, props)), /*#__PURE__*/jsx(ReactQueryDevtools, {
174
+ initialIsOpen: false,
175
+ position: "bottom"
176
+ })]
177
+ });
120
178
  };
121
179
  return QueryWrapper;
122
180
  };
@@ -151,28 +209,35 @@ var WEBHOOK_STALE_TIME = 3200000; // 1 hour
151
209
  var POST_REDELIVERY_ON_SUCCESS_TIMEOUT = 5000; // 5 seconds
152
210
 
153
211
  var useFetchDeliveries = function useFetchDeliveries(webhookId, params) {
154
- return useQuery([QUERY_KEYS.DELIVERY_LIST, webhookId, params], function () {
155
- return deliveriesApi.fetch(webhookId, params);
156
- }, {
212
+ return useQuery({
213
+ queryKey: [QUERY_KEYS.DELIVERY_LIST, webhookId, params],
214
+ queryFn: function queryFn() {
215
+ return deliveriesApi.fetch(webhookId, params);
216
+ },
157
217
  staleTime: DELIVERY_STALE_TIME
158
218
  });
159
219
  };
160
220
  var useShowDelivery = function useShowDelivery(id, webhookId) {
161
- return useQuery([QUERY_KEYS.DELIVERY_DETAILS, id, webhookId], function () {
162
- return deliveriesApi.show(id, webhookId);
163
- }, {
221
+ return useQuery({
222
+ queryKey: [QUERY_KEYS.DELIVERY_DETAILS, id, webhookId],
223
+ queryFn: function queryFn() {
224
+ return deliveriesApi.show(id, webhookId);
225
+ },
164
226
  staleTime: DELIVERY_STALE_TIME,
165
227
  enabled: !!id
166
228
  });
167
229
  };
168
230
  var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
169
231
  var queryClient = useQueryClient();
170
- return useMutation(function () {
171
- return deliveriesApi.redeliver(deliveryId, webhookSid);
172
- }, {
232
+ return useMutation({
233
+ mutationFn: function mutationFn() {
234
+ return deliveriesApi.redeliver(deliveryId, webhookSid);
235
+ },
173
236
  onSuccess: function onSuccess() {
174
237
  setTimeout(function () {
175
- return queryClient.invalidateQueries(QUERY_KEYS.DELIVERY_LIST);
238
+ return queryClient.invalidateQueries({
239
+ queryKey: [QUERY_KEYS.DELIVERY_LIST]
240
+ });
176
241
  }, POST_REDELIVERY_ON_SUCCESS_TIMEOUT);
177
242
  }
178
243
  });
@@ -215,9 +280,9 @@ function getDefaultExportFromCjs (x) {
215
280
 
216
281
  var regeneratorRuntime$1 = {exports: {}};
217
282
 
218
- var _typeof$1 = {exports: {}};
283
+ var _typeof = {exports: {}};
219
284
 
220
- _typeof$1.exports;
285
+ _typeof.exports;
221
286
 
222
287
  (function (module) {
223
288
  function _typeof(o) {
@@ -230,9 +295,9 @@ _typeof$1.exports;
230
295
  }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
231
296
  }
232
297
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
233
- } (_typeof$1));
298
+ } (_typeof));
234
299
 
235
- var _typeofExports = _typeof$1.exports;
300
+ var _typeofExports = _typeof.exports;
236
301
 
237
302
  regeneratorRuntime$1.exports;
238
303
 
@@ -571,10 +636,11 @@ var Snippet = function Snippet(_ref) {
571
636
  var children = _ref.children,
572
637
  _ref$dataCy = _ref.dataCy,
573
638
  dataCy = _ref$dataCy === void 0 ? "" : _ref$dataCy;
574
- return /*#__PURE__*/React.createElement("div", {
639
+ return /*#__PURE__*/jsx("div", {
575
640
  className: "neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-gray-100 my-2 whitespace-pre-wrap break-all border p-4",
576
- "data-cy": dataCy
577
- }, children);
641
+ "data-cy": dataCy,
642
+ children: children
643
+ });
578
644
  };
579
645
 
580
646
  var TransactionDetails = function TransactionDetails(_ref) {
@@ -595,57 +661,89 @@ var TransactionDetails = function TransactionDetails(_ref) {
595
661
  return "";
596
662
  }
597
663
  };
598
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
599
- className: "neeto-ui-bg-white sticky top-0 mb-2 flex w-full flex-col"
600
- }, /*#__PURE__*/React.createElement("div", {
601
- className: "flex w-full flex-col space-y-2 pb-4"
602
- }, /*#__PURE__*/React.createElement("span", {
603
- className: "flex items-center space-x-1"
604
- }, t("neetoWebhooks.delivery.identifier"), ":", /*#__PURE__*/React.createElement(Typography, {
605
- className: "px-2 font-bold",
606
- "data-cy": "delivery-identifier",
607
- style: "body2"
608
- }, identifier)), /*#__PURE__*/React.createElement("span", {
609
- className: "flex items-center"
610
- }, t("neetoWebhooks.common.responseStatus"), ":", /*#__PURE__*/React.createElement(Typography, {
611
- className: "px-2 font-bold",
612
- "data-cy": "delivery-response-code",
613
- style: "body2"
614
- }, responseStatusCode), /*#__PURE__*/React.createElement(Tag, {
615
- style: status === "success" ? "success" : "warning"
616
- }, status))), /*#__PURE__*/React.createElement(Tab, null, /*#__PURE__*/React.createElement(Tab.Item, {
617
- active: activeHeader === DELIVERY_TAB.request,
618
- onClick: function onClick() {
619
- return setActiveHeader(DELIVERY_TAB.request);
620
- }
621
- }, t("neetoWebhooks.delivery.request")), /*#__PURE__*/React.createElement(Tab.Item, {
622
- active: activeHeader === DELIVERY_TAB.response,
623
- onClick: function onClick() {
624
- return setActiveHeader(DELIVERY_TAB.response);
625
- }
626
- }, t("neetoWebhooks.delivery.response")))), /*#__PURE__*/React.createElement("div", {
627
- className: "mt-2 w-full"
628
- }, activeHeader === DELIVERY_TAB.request ? /*#__PURE__*/React.createElement("div", {
629
- className: "space-y-4"
630
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
631
- style: "h5"
632
- }, t("neetoWebhooks.delivery.header")), /*#__PURE__*/React.createElement(Snippet, {
633
- dataCy: "delivery-request-header"
634
- }, delivery.requestHeader)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
635
- style: "h5"
636
- }, t("neetoWebhooks.delivery.payload")), /*#__PURE__*/React.createElement(Snippet, {
637
- dataCy: "delivery-request-payload"
638
- }, renderPayload()))) : /*#__PURE__*/React.createElement("div", {
639
- className: "space-y-4"
640
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
641
- style: "h5"
642
- }, t("neetoWebhooks.delivery.header")), /*#__PURE__*/React.createElement(Snippet, {
643
- dataCy: "delivery-response-header"
644
- }, delivery.responseHeader)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, {
645
- style: "h5"
646
- }, t("neetoWebhooks.delivery.body")), /*#__PURE__*/React.createElement(Snippet, {
647
- dataCy: "delivery-response-body"
648
- }, delivery.responseBody)))));
664
+ return /*#__PURE__*/jsxs(Fragment, {
665
+ children: [/*#__PURE__*/jsxs("div", {
666
+ className: "neeto-ui-bg-white sticky top-0 mb-2 flex w-full flex-col",
667
+ children: [/*#__PURE__*/jsxs("div", {
668
+ className: "flex w-full flex-col space-y-2 pb-4",
669
+ children: [/*#__PURE__*/jsxs("span", {
670
+ className: "flex items-center space-x-1",
671
+ children: [t("neetoWebhooks.delivery.identifier"), ":", /*#__PURE__*/jsx(Typography, {
672
+ className: "px-2 font-bold",
673
+ "data-cy": "delivery-identifier",
674
+ style: "body2",
675
+ children: identifier
676
+ })]
677
+ }), /*#__PURE__*/jsxs("span", {
678
+ className: "flex items-center",
679
+ children: [t("neetoWebhooks.common.responseStatus"), ":", /*#__PURE__*/jsx(Typography, {
680
+ className: "px-2 font-bold",
681
+ "data-cy": "delivery-response-code",
682
+ style: "body2",
683
+ children: responseStatusCode
684
+ }), /*#__PURE__*/jsx(Tag, {
685
+ style: status === "success" ? "success" : "warning",
686
+ children: status
687
+ })]
688
+ })]
689
+ }), /*#__PURE__*/jsxs(Tab, {
690
+ children: [/*#__PURE__*/jsx(Tab.Item, {
691
+ active: activeHeader === DELIVERY_TAB.request,
692
+ onClick: function onClick() {
693
+ return setActiveHeader(DELIVERY_TAB.request);
694
+ },
695
+ children: t("neetoWebhooks.delivery.request")
696
+ }), /*#__PURE__*/jsx(Tab.Item, {
697
+ active: activeHeader === DELIVERY_TAB.response,
698
+ onClick: function onClick() {
699
+ return setActiveHeader(DELIVERY_TAB.response);
700
+ },
701
+ children: t("neetoWebhooks.delivery.response")
702
+ })]
703
+ })]
704
+ }), /*#__PURE__*/jsx("div", {
705
+ className: "mt-2 w-full",
706
+ children: activeHeader === DELIVERY_TAB.request ? /*#__PURE__*/jsxs("div", {
707
+ className: "space-y-4",
708
+ children: [/*#__PURE__*/jsxs("div", {
709
+ children: [/*#__PURE__*/jsx(Typography, {
710
+ style: "h5",
711
+ children: t("neetoWebhooks.delivery.header")
712
+ }), /*#__PURE__*/jsx(Snippet, {
713
+ dataCy: "delivery-request-header",
714
+ children: delivery.requestHeader
715
+ })]
716
+ }), /*#__PURE__*/jsxs("div", {
717
+ children: [/*#__PURE__*/jsx(Typography, {
718
+ style: "h5",
719
+ children: t("neetoWebhooks.delivery.payload")
720
+ }), /*#__PURE__*/jsx(Snippet, {
721
+ dataCy: "delivery-request-payload",
722
+ children: renderPayload()
723
+ })]
724
+ })]
725
+ }) : /*#__PURE__*/jsxs("div", {
726
+ className: "space-y-4",
727
+ children: [/*#__PURE__*/jsxs("div", {
728
+ children: [/*#__PURE__*/jsx(Typography, {
729
+ style: "h5",
730
+ children: t("neetoWebhooks.delivery.header")
731
+ }), /*#__PURE__*/jsx(Snippet, {
732
+ dataCy: "delivery-response-header",
733
+ children: delivery.responseHeader
734
+ })]
735
+ }), /*#__PURE__*/jsxs("div", {
736
+ children: [/*#__PURE__*/jsx(Typography, {
737
+ style: "h5",
738
+ children: t("neetoWebhooks.delivery.body")
739
+ }), /*#__PURE__*/jsx(Snippet, {
740
+ dataCy: "delivery-response-body",
741
+ children: delivery.responseBody
742
+ })]
743
+ })]
744
+ })
745
+ })]
746
+ });
649
747
  };
650
748
 
651
749
  var Details = function Details(_ref) {
@@ -655,7 +753,7 @@ var Details = function Details(_ref) {
655
753
  var _useTranslation = useTranslation(),
656
754
  t = _useTranslation.t;
657
755
  var _useRedeliverWebhook = useRedeliverWebhook(deliveryId, webhookSid),
658
- isRedelivering = _useRedeliverWebhook.isLoading,
756
+ isRedelivering = _useRedeliverWebhook.isPending,
659
757
  redeliverWebhook = _useRedeliverWebhook.mutateAsync;
660
758
  var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
661
759
  isLoading = _useShowDelivery.isLoading,
@@ -682,43 +780,57 @@ var Details = function Details(_ref) {
682
780
  if (isNotPresent(delivery)) {
683
781
  return null;
684
782
  }
685
- return /*#__PURE__*/React.createElement(Pane, {
783
+ return /*#__PURE__*/jsx(Pane, {
686
784
  onClose: onClose,
687
785
  isOpen: isPresent(deliveryId),
688
- size: "large"
689
- }, /*#__PURE__*/React.createElement(React.Fragment, null, isLoading ? /*#__PURE__*/React.createElement(PageLoader, null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DateFormat.Date, {
690
- date: delivery.createdAt,
691
- tooltipProps: {
692
- disabled: true
693
- },
694
- typographyProps: {
695
- style: "h2",
696
- weight: "semibold"
697
- }
698
- }), /*#__PURE__*/React.createElement("span", null, " \u2022 "), /*#__PURE__*/React.createElement(DateFormat.Time, {
699
- date: delivery.createdAt,
700
- tooltipProps: {
701
- disabled: true
702
- },
703
- typographyProps: {
704
- style: "h2",
705
- weight: "normal"
706
- }
707
- }))), /*#__PURE__*/React.createElement(Pane.Body, null, isPresent(delivery) && /*#__PURE__*/React.createElement(TransactionDetails, {
708
- delivery: delivery
709
- })), /*#__PURE__*/React.createElement(Pane.Footer, {
710
- className: "gap-x-2"
711
- }, event && /*#__PURE__*/React.createElement(Button, {
712
- disabled: isRedelivering,
713
- label: t("neetoWebhooks.delivery.redeliver"),
714
- loading: isRedelivering,
715
- style: "primary",
716
- onClick: handleRedeliverClick
717
- }), /*#__PURE__*/React.createElement(Button, {
718
- label: t("neetoWebhooks.buttons.cancel"),
719
- style: "text",
720
- onClick: onClose
721
- })))));
786
+ size: "large",
787
+ children: /*#__PURE__*/jsx(Fragment, {
788
+ children: isLoading ? /*#__PURE__*/jsx(PageLoader, {}) : /*#__PURE__*/jsxs(Fragment, {
789
+ children: [/*#__PURE__*/jsx(Pane.Header, {
790
+ children: /*#__PURE__*/jsxs(Fragment, {
791
+ children: [/*#__PURE__*/jsx(DateFormat.Date, {
792
+ date: delivery.createdAt,
793
+ tooltipProps: {
794
+ disabled: true
795
+ },
796
+ typographyProps: {
797
+ style: "h2",
798
+ weight: "semibold"
799
+ }
800
+ }), /*#__PURE__*/jsx("span", {
801
+ children: " \u2022 "
802
+ }), /*#__PURE__*/jsx(DateFormat.Time, {
803
+ date: delivery.createdAt,
804
+ tooltipProps: {
805
+ disabled: true
806
+ },
807
+ typographyProps: {
808
+ style: "h2",
809
+ weight: "normal"
810
+ }
811
+ })]
812
+ })
813
+ }), /*#__PURE__*/jsx(Pane.Body, {
814
+ children: isPresent(delivery) && /*#__PURE__*/jsx(TransactionDetails, {
815
+ delivery: delivery
816
+ })
817
+ }), /*#__PURE__*/jsxs(Pane.Footer, {
818
+ className: "gap-x-2",
819
+ children: [event && /*#__PURE__*/jsx(Button, {
820
+ disabled: isRedelivering,
821
+ label: t("neetoWebhooks.delivery.redeliver"),
822
+ loading: isRedelivering,
823
+ style: "primary",
824
+ onClick: handleRedeliverClick
825
+ }), /*#__PURE__*/jsx(Button, {
826
+ label: t("neetoWebhooks.buttons.cancel"),
827
+ style: "text",
828
+ onClick: onClose
829
+ })]
830
+ })]
831
+ })
832
+ })
833
+ });
722
834
  };
723
835
 
724
836
  var buildColumns$1 = function buildColumns(_ref) {
@@ -729,17 +841,20 @@ var buildColumns$1 = function buildColumns(_ref) {
729
841
  dataIndex: "identifier",
730
842
  width: 390,
731
843
  render: function render(_, delivery) {
732
- return /*#__PURE__*/React.createElement("div", {
733
- className: "flex items-center gap-x-3"
734
- }, /*#__PURE__*/React.createElement(Button, {
735
- style: "link",
736
- weight: "semibold",
737
- onClick: function onClick() {
738
- return handleDetailsClick(delivery.sid);
739
- }
740
- }, delivery.identifier), delivery.redelivery && /*#__PURE__*/React.createElement(Tag, {
741
- style: "info"
742
- }, t$1("neetoWebhooks.delivery.redelivery")));
844
+ return /*#__PURE__*/jsxs("div", {
845
+ className: "flex items-center gap-x-3",
846
+ children: [/*#__PURE__*/jsx(Button, {
847
+ style: "link",
848
+ weight: "semibold",
849
+ onClick: function onClick() {
850
+ return handleDetailsClick(delivery.sid);
851
+ },
852
+ children: delivery.identifier
853
+ }), delivery.redelivery && /*#__PURE__*/jsx(Tag, {
854
+ style: "info",
855
+ children: t$1("neetoWebhooks.delivery.redelivery")
856
+ })]
857
+ });
743
858
  }
744
859
  }, {
745
860
  title: t$1("neetoWebhooks.tableHeaders.createdAt"),
@@ -747,11 +862,14 @@ var buildColumns$1 = function buildColumns(_ref) {
747
862
  dataIndex: "createdAt",
748
863
  width: 280,
749
864
  render: function render(createdAt) {
750
- return /*#__PURE__*/React.createElement("div", {
751
- className: "flex items-center justify-between space-x-1"
752
- }, /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement(DateFormat.DateTime, {
753
- date: createdAt
754
- })));
865
+ return /*#__PURE__*/jsx("div", {
866
+ className: "flex items-center justify-between space-x-1",
867
+ children: /*#__PURE__*/jsx(Typography, {
868
+ children: /*#__PURE__*/jsx(DateFormat.DateTime, {
869
+ date: createdAt
870
+ })
871
+ })
872
+ });
755
873
  }
756
874
  }, {
757
875
  title: t$1("neetoWebhooks.common.responseStatus"),
@@ -760,14 +878,17 @@ var buildColumns$1 = function buildColumns(_ref) {
760
878
  render: function render(_ref2) {
761
879
  var responseStatusCode = _ref2.responseStatusCode,
762
880
  status = _ref2.status;
763
- return /*#__PURE__*/React.createElement("span", {
764
- className: "flex items-center"
765
- }, /*#__PURE__*/React.createElement(Typography, {
766
- className: "px-2",
767
- style: "body2"
768
- }, responseStatusCode), /*#__PURE__*/React.createElement(Tag, {
769
- style: status === "success" ? "success" : "warning"
770
- }, status));
881
+ return /*#__PURE__*/jsxs("span", {
882
+ className: "flex items-center",
883
+ children: [/*#__PURE__*/jsx(Typography, {
884
+ className: "px-2",
885
+ style: "body2",
886
+ children: responseStatusCode
887
+ }), /*#__PURE__*/jsx(Tag, {
888
+ style: status === "success" ? "success" : "warning",
889
+ children: status
890
+ })]
891
+ });
771
892
  }
772
893
  }, {
773
894
  title: t$1("neetoWebhooks.common.event", SINGULAR),
@@ -827,35 +948,38 @@ var Deliveries = function Deliveries(_ref) {
827
948
  webhookId: webhookId
828
949
  }));
829
950
  };
830
- if (isLoading) return /*#__PURE__*/React.createElement(PageLoader, null);
831
- return /*#__PURE__*/React.createElement(Container, {
832
- className: "w-full"
833
- }, /*#__PURE__*/React.createElement(Header$2, {
834
- breadcrumbs: breadcrumbs,
835
- title: t("neetoWebhooks.delivery.title")
836
- }), isNotEmpty(deliveries) ? /*#__PURE__*/React.createElement(TableWrapper, {
837
- hasPagination: totalCount > DEFAULT_PAGE_SIZE
838
- }, /*#__PURE__*/React.createElement(Table, {
839
- totalCount: totalCount,
840
- fixedHeight: true,
841
- columnData: buildColumns$1({
842
- handleDetailsClick: handleDetailsClick
843
- }),
844
- currentPageNumber: pageNumber,
845
- defaultPageSize: DEFAULT_PAGE_SIZE,
846
- handlePageChange: setPageNumber,
847
- loading: isFetching,
848
- rowData: deliveries
849
- })) : /*#__PURE__*/React.createElement("div", {
850
- className: "flex h-full w-full items-center justify-center"
851
- }, /*#__PURE__*/React.createElement(NoData, {
852
- description: t("neetoWebhooks.delivery.empty.description"),
853
- title: t("neetoWebhooks.delivery.empty.title")
854
- })), /*#__PURE__*/React.createElement(Details, {
855
- deliveryId: deliveryId,
856
- webhookSid: webhookId,
857
- onClose: handleClose
858
- }));
951
+ if (isLoading) return /*#__PURE__*/jsx(PageLoader, {});
952
+ return /*#__PURE__*/jsxs(Container, {
953
+ className: "w-full",
954
+ children: [/*#__PURE__*/jsx(Header$2, {
955
+ breadcrumbs: breadcrumbs,
956
+ title: t("neetoWebhooks.delivery.title")
957
+ }), isNotEmpty(deliveries) ? /*#__PURE__*/jsx(TableWrapper, {
958
+ hasPagination: totalCount > DEFAULT_PAGE_SIZE,
959
+ children: /*#__PURE__*/jsx(Table, {
960
+ totalCount: totalCount,
961
+ fixedHeight: true,
962
+ columnData: buildColumns$1({
963
+ handleDetailsClick: handleDetailsClick
964
+ }),
965
+ currentPageNumber: pageNumber,
966
+ defaultPageSize: DEFAULT_PAGE_SIZE,
967
+ handlePageChange: setPageNumber,
968
+ loading: isFetching,
969
+ rowData: deliveries
970
+ })
971
+ }) : /*#__PURE__*/jsx("div", {
972
+ className: "flex h-full w-full items-center justify-center",
973
+ children: /*#__PURE__*/jsx(NoData, {
974
+ description: t("neetoWebhooks.delivery.empty.description"),
975
+ title: t("neetoWebhooks.delivery.empty.title")
976
+ })
977
+ }), /*#__PURE__*/jsx(Details, {
978
+ deliveryId: deliveryId,
979
+ webhookSid: webhookId,
980
+ onClose: handleClose
981
+ })]
982
+ });
859
983
  };
860
984
  var Deliveries$1 = withReactQuery(Deliveries);
861
985
 
@@ -890,97 +1014,58 @@ var webhooksApi = {
890
1014
  };
891
1015
 
892
1016
  var useFetchWebhooks = function useFetchWebhooks(params) {
893
- return useQuery([QUERY_KEYS.WEBHOOK_LIST, params], function () {
894
- return webhooksApi.fetch(params);
895
- }, {
1017
+ return useQuery({
1018
+ queryKey: [QUERY_KEYS.WEBHOOK_LIST, params],
1019
+ queryFn: function queryFn() {
1020
+ return webhooksApi.fetch(params);
1021
+ },
896
1022
  staleTime: WEBHOOK_STALE_TIME
897
1023
  });
898
1024
  };
899
1025
  var useCreateWebhook = function useCreateWebhook(options) {
900
- var queryClient = useQueryClient();
901
- return useMutation(webhooksApi.create, {
1026
+ return useMutationWithInvalidation(webhooksApi.create, {
1027
+ keysToInvalidate: [QUERY_KEYS.WEBHOOK_LIST],
902
1028
  onSuccess: function onSuccess() {
903
1029
  var _options$onSuccess;
904
- queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
905
1030
  options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
906
1031
  }
907
1032
  });
908
1033
  };
909
1034
  var useShowWebhook = function useShowWebhook(id) {
910
- return useQuery([QUERY_KEYS.WEBHOOK_DETAILS, id], function () {
911
- return webhooksApi.show(id);
912
- }, {
1035
+ return useQuery({
1036
+ queryKey: [QUERY_KEYS.WEBHOOK_DETAILS, id],
1037
+ queryFn: function queryFn() {
1038
+ return webhooksApi.show(id);
1039
+ },
913
1040
  enabled: !!id,
914
1041
  staleTime: WEBHOOK_STALE_TIME
915
1042
  });
916
1043
  };
917
1044
  var useUpdateWebhook = function useUpdateWebhook(id, options) {
918
- var queryClient = useQueryClient();
919
- return useMutation(function (_ref) {
1045
+ return useMutationWithInvalidation(function (_ref) {
920
1046
  var id = _ref.id,
921
1047
  payload = _ref.payload;
922
1048
  return webhooksApi.update(id, payload);
923
1049
  }, {
1050
+ keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
924
1051
  onSuccess: function onSuccess() {
925
1052
  var _options$onSuccess2;
926
- queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
927
- queryClient.invalidateQueries([QUERY_KEYS.WEBHOOK_DETAILS, id]);
928
- queryClient.invalidateQueries([QUERY_KEYS.DELIVERY_LIST, id]);
929
1053
  options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
930
1054
  }
931
1055
  });
932
1056
  };
933
1057
  var useDestroyWebhook = function useDestroyWebhook(options) {
934
- var queryClient = useQueryClient();
935
- return useMutation(webhooksApi.destroy, {
1058
+ return useMutationWithInvalidation(webhooksApi.destroy, {
1059
+ keysToInvalidate: [QUERY_KEYS.WEBHOOK_LIST],
936
1060
  onSuccess: function onSuccess() {
937
1061
  var _options$onSuccess3;
938
- queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
939
1062
  options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
940
1063
  }
941
1064
  });
942
1065
  };
943
1066
 
944
- function _typeof(o) {
945
- "@babel/helpers - typeof";
946
-
947
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
948
- return typeof o;
949
- } : function (o) {
950
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
951
- }, _typeof(o);
952
- }
953
-
954
- function _toPrimitive(input, hint) {
955
- if (_typeof(input) !== "object" || input === null) return input;
956
- var prim = input[Symbol.toPrimitive];
957
- if (prim !== undefined) {
958
- var res = prim.call(input, hint || "default");
959
- if (_typeof(res) !== "object") return res;
960
- throw new TypeError("@@toPrimitive must return a primitive value.");
961
- }
962
- return (hint === "string" ? String : Number)(input);
963
- }
964
-
965
- function _toPropertyKey(arg) {
966
- var key = _toPrimitive(arg, "string");
967
- return _typeof(key) === "symbol" ? key : String(key);
968
- }
969
-
970
- function _defineProperty(obj, key, value) {
971
- key = _toPropertyKey(key);
972
- if (key in obj) {
973
- Object.defineProperty(obj, key, {
974
- value: value,
975
- enumerable: true,
976
- configurable: true,
977
- writable: true
978
- });
979
- } else {
980
- obj[key] = value;
981
- }
982
- return obj;
983
- }
1067
+ var WEBHOOK_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-4bb6c2a2";
1068
+ var WEBHOOK_SECRETS_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-80de90bd";
984
1069
 
985
1070
  var baseUrl = "/webhooks/events/all";
986
1071
  var all = function all() {
@@ -991,14 +1076,13 @@ var eventsApi = {
991
1076
  };
992
1077
 
993
1078
  var useFetchEvents = function useFetchEvents() {
994
- return useQuery([QUERY_KEYS.EVENTS_LIST], eventsApi.all, {
1079
+ return useQuery({
1080
+ queryKey: [QUERY_KEYS.EVENTS_LIST],
1081
+ queryFn: eventsApi.all,
995
1082
  staleTime: WEBHOOK_STALE_TIME
996
1083
  });
997
1084
  };
998
1085
 
999
- var WEBHOOK_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-4bb6c2a2";
1000
- var WEBHOOK_SECRETS_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-80de90bd";
1001
-
1002
1086
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
1003
1087
  // require the crypto API and do not support built-in fallback to lower quality random number
1004
1088
  // generators (like Math.random()).
@@ -1133,26 +1217,28 @@ var buildColumns = function buildColumns(_ref6) {
1133
1217
  dataIndex: "endpoint",
1134
1218
  width: 830,
1135
1219
  render: function render(endpoint, webhook) {
1136
- return /*#__PURE__*/React.createElement("div", {
1137
- className: "flex items-center justify-between space-x-3"
1138
- }, /*#__PURE__*/React.createElement(Button, {
1139
- style: "link",
1140
- to: buildUrl(deliveriesPath, {
1141
- webhookId: webhook.sid
1142
- })
1143
- }, endpoint), /*#__PURE__*/React.createElement(MoreDropdown, {
1144
- dropdownProps: {
1145
- strategy: "fixed"
1146
- },
1147
- menuItems: getMenuItems({
1148
- onEdit: function onEdit() {
1149
- return handleEdit(webhook.id);
1220
+ return /*#__PURE__*/jsxs("div", {
1221
+ className: "flex items-center justify-between space-x-3",
1222
+ children: [/*#__PURE__*/jsx(Button, {
1223
+ style: "link",
1224
+ to: buildUrl(deliveriesPath, {
1225
+ webhookId: webhook.sid
1226
+ }),
1227
+ children: endpoint
1228
+ }), /*#__PURE__*/jsx(MoreDropdown, {
1229
+ dropdownProps: {
1230
+ strategy: "fixed"
1150
1231
  },
1151
- onDelete: function onDelete() {
1152
- return handleDelete(webhook.id);
1153
- }
1154
- })
1155
- }));
1232
+ menuItems: getMenuItems({
1233
+ onEdit: function onEdit() {
1234
+ return handleEdit(webhook.id);
1235
+ },
1236
+ onDelete: function onDelete() {
1237
+ return handleDelete(webhook.id);
1238
+ }
1239
+ })
1240
+ })]
1241
+ });
1156
1242
  }
1157
1243
  }, {
1158
1244
  title: t$1("neetoWebhooks.webhook.active"),
@@ -1251,128 +1337,154 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1251
1337
  setIsSecretInputFieldVisible(true);
1252
1338
  }
1253
1339
  }, [webhook]);
1254
- return /*#__PURE__*/React.createElement(Pane, {
1340
+ return /*#__PURE__*/jsxs(Pane, {
1255
1341
  isOpen: isOpen,
1256
1342
  onClose: onClose,
1257
- initialFocusRef: endpointRef
1258
- }, /*#__PURE__*/React.createElement(Pane.Header, {
1259
- className: "flex items-center gap-x-2"
1260
- }, /*#__PURE__*/React.createElement(Typography, {
1261
- "data-cy": "add-new-webhook-pane-header",
1262
- style: "h2",
1263
- weight: "semibold"
1264
- }, editingWebhookId ? t("neetoWebhooks.webhook.edit") : t("neetoWebhooks.webhook.add")), /*#__PURE__*/React.createElement(HelpPopover, {
1265
- description: t("neetoWebhooks.webhook.helpDescription"),
1266
- helpLinkProps: {
1267
- href: WEBHOOK_HELP_URL
1268
- },
1269
- title: t("neetoWebhooks.webhook.title")
1270
- })), /*#__PURE__*/React.createElement(Form, {
1271
- formikProps: {
1272
- enableReinitialize: true,
1273
- validationSchema: getValidationSchema(webhooks),
1274
- initialValues: initialValues,
1275
- onSubmit: function onSubmit(values) {
1276
- return handleSubmit(getValidationSchema().cast(values));
1277
- }
1278
- }
1279
- }, function (_ref2) {
1280
- var setFieldValue = _ref2.setFieldValue;
1281
- return isLoading ? /*#__PURE__*/React.createElement("div", {
1282
- className: "flex items-center justify-center"
1283
- }, /*#__PURE__*/React.createElement(Spinner, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement("div", {
1284
- className: "w-full space-y-4"
1285
- }, /*#__PURE__*/React.createElement(Textarea, {
1286
- required: true,
1287
- "data-cy": "endpoint-input-field",
1288
- label: t("neetoWebhooks.webhook.endpoint"),
1289
- name: "endpoint",
1290
- placeholder: t("neetoWebhooks.webhook.endpointPlaceholder"),
1291
- ref: endpointRef,
1292
- rows: 1
1293
- }), !isLoading && /*#__PURE__*/React.createElement(Select, {
1294
- isMulti: true,
1295
- required: true,
1296
- getOptionLabel: prop("label"),
1297
- getOptionValue: prop("identifier"),
1298
- label: t("neetoWebhooks.common.event", PLURAL),
1299
- name: "events",
1300
- options: events,
1301
- placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
1302
- }), isSecretInputFieldVisible && /*#__PURE__*/React.createElement("div", {
1303
- className: "flex items-center justify-between space-x-3"
1304
- }, /*#__PURE__*/React.createElement(Input, {
1305
- "data-cy": "secret-key-input-field",
1306
- name: "secret",
1307
- label: /*#__PURE__*/React.createElement("span", {
1308
- className: "flex items-center gap-x-2"
1309
- }, t("neetoWebhooks.webhook.secret"), /*#__PURE__*/React.createElement(HelpPopover, {
1343
+ initialFocusRef: endpointRef,
1344
+ children: [/*#__PURE__*/jsxs(Pane.Header, {
1345
+ className: "flex items-center gap-x-2",
1346
+ children: [/*#__PURE__*/jsx(Typography, {
1347
+ "data-cy": "add-new-webhook-pane-header",
1348
+ style: "h2",
1349
+ weight: "semibold",
1350
+ children: editingWebhookId ? t("neetoWebhooks.webhook.edit") : t("neetoWebhooks.webhook.add")
1351
+ }), /*#__PURE__*/jsx(HelpPopover, {
1352
+ description: t("neetoWebhooks.webhook.helpDescription"),
1310
1353
  helpLinkProps: {
1311
- href: WEBHOOK_SECRETS_HELP_URL
1354
+ href: WEBHOOK_HELP_URL
1312
1355
  },
1313
- description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
1314
- title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
1315
- })),
1316
- placeholder: t("neetoWebhooks.webhook.secretPlaceholder")
1317
- }), /*#__PURE__*/React.createElement("div", {
1318
- className: "mt-6"
1319
- }, /*#__PURE__*/React.createElement(MoreDropdown, {
1320
- menuItems: [{
1321
- key: "regenerate-secret",
1322
- label: t("neetoWebhooks.buttons.regenerate"),
1323
- "data-cy": "regenerate-secret",
1324
- onClick: function onClick() {
1325
- return handleRegenerate(setFieldValue);
1356
+ title: t("neetoWebhooks.webhook.title")
1357
+ })]
1358
+ }), /*#__PURE__*/jsx(Form, {
1359
+ formikProps: {
1360
+ enableReinitialize: true,
1361
+ validationSchema: getValidationSchema(webhooks),
1362
+ initialValues: initialValues,
1363
+ onSubmit: function onSubmit(values) {
1364
+ return handleSubmit(getValidationSchema().cast(values));
1326
1365
  }
1327
- }, {
1328
- key: "delete-secret",
1329
- label: t("neetoWebhooks.buttons.delete"),
1330
- "data-cy": "delete-secret",
1331
- onClick: function onClick() {
1332
- return handleDelete(setFieldValue);
1333
- }
1334
- }]
1335
- }))), /*#__PURE__*/React.createElement(Switch, {
1336
- label: t("neetoWebhooks.webhook.active"),
1337
- name: "isActive"
1338
- }), !isSecretInputFieldVisible && /*#__PURE__*/React.createElement(Button, {
1339
- "data-cy": "add-secret-key",
1340
- icon: Plus,
1341
- label: t("neetoWebhooks.buttons.addSecretKey"),
1342
- style: "text",
1343
- onClick: function onClick() {
1344
- return handleClick(setFieldValue);
1345
- }
1346
- }))), /*#__PURE__*/React.createElement(Pane.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
1347
- cancelButtonProps: {
1348
- onClick: onClose
1366
+ },
1367
+ children: function children(_ref2) {
1368
+ var setFieldValue = _ref2.setFieldValue;
1369
+ return isLoading ? /*#__PURE__*/jsx("div", {
1370
+ className: "flex items-center justify-center",
1371
+ children: /*#__PURE__*/jsx(Spinner, {})
1372
+ }) : /*#__PURE__*/jsxs(Fragment, {
1373
+ children: [/*#__PURE__*/jsx(Pane.Body, {
1374
+ children: /*#__PURE__*/jsxs("div", {
1375
+ className: "w-full space-y-4",
1376
+ children: [/*#__PURE__*/jsx(Textarea, {
1377
+ required: true,
1378
+ "data-cy": "endpoint-input-field",
1379
+ label: t("neetoWebhooks.webhook.endpoint"),
1380
+ name: "endpoint",
1381
+ placeholder: t("neetoWebhooks.webhook.endpointPlaceholder"),
1382
+ ref: endpointRef,
1383
+ rows: 1
1384
+ }), !isLoading && /*#__PURE__*/jsx(Select, {
1385
+ isMulti: true,
1386
+ required: true,
1387
+ getOptionLabel: prop("label"),
1388
+ getOptionValue: prop("identifier"),
1389
+ label: t("neetoWebhooks.common.event", PLURAL),
1390
+ name: "events",
1391
+ options: events,
1392
+ placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
1393
+ }), isSecretInputFieldVisible && /*#__PURE__*/jsxs("div", {
1394
+ className: "flex items-center justify-between space-x-3",
1395
+ children: [/*#__PURE__*/jsx(Input, {
1396
+ "data-cy": "secret-key-input-field",
1397
+ name: "secret",
1398
+ label: /*#__PURE__*/jsxs("span", {
1399
+ className: "flex items-center gap-x-2",
1400
+ children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
1401
+ helpLinkProps: {
1402
+ href: WEBHOOK_SECRETS_HELP_URL
1403
+ },
1404
+ description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
1405
+ title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
1406
+ })]
1407
+ }),
1408
+ placeholder: t("neetoWebhooks.webhook.secretPlaceholder")
1409
+ }), /*#__PURE__*/jsx("div", {
1410
+ className: "mt-6",
1411
+ children: /*#__PURE__*/jsx(MoreDropdown, {
1412
+ menuItems: [{
1413
+ key: "regenerate-secret",
1414
+ label: t("neetoWebhooks.buttons.regenerate"),
1415
+ "data-cy": "regenerate-secret",
1416
+ onClick: function onClick() {
1417
+ return handleRegenerate(setFieldValue);
1418
+ }
1419
+ }, {
1420
+ key: "delete-secret",
1421
+ label: t("neetoWebhooks.buttons.delete"),
1422
+ "data-cy": "delete-secret",
1423
+ onClick: function onClick() {
1424
+ return handleDelete(setFieldValue);
1425
+ }
1426
+ }]
1427
+ })
1428
+ })]
1429
+ }), /*#__PURE__*/jsx(Switch, {
1430
+ label: t("neetoWebhooks.webhook.active"),
1431
+ name: "isActive"
1432
+ }), !isSecretInputFieldVisible && /*#__PURE__*/jsx(Button, {
1433
+ "data-cy": "add-secret-key",
1434
+ icon: Plus,
1435
+ label: t("neetoWebhooks.buttons.addSecretKey"),
1436
+ style: "text",
1437
+ onClick: function onClick() {
1438
+ return handleClick(setFieldValue);
1439
+ }
1440
+ })]
1441
+ })
1442
+ }), /*#__PURE__*/jsx(Pane.Footer, {
1443
+ children: /*#__PURE__*/jsx(ActionBlock, {
1444
+ cancelButtonProps: {
1445
+ onClick: onClose
1446
+ }
1447
+ })
1448
+ })]
1449
+ });
1349
1450
  }
1350
- })));
1351
- }));
1451
+ })]
1452
+ });
1352
1453
  };
1353
1454
 
1354
- var Header = function Header(_ref) {
1355
- var breadcrumbs = _ref.breadcrumbs,
1455
+ var Header = withT(function (_ref) {
1456
+ var t = _ref.t,
1457
+ breadcrumbs = _ref.breadcrumbs,
1356
1458
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen;
1357
- var _useTranslation = useTranslation(),
1358
- t = _useTranslation.t;
1359
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header$2, {
1360
- breadcrumbs: breadcrumbs,
1361
- title: t("neetoWebhooks.webhook.title"),
1362
- actionBlock: /*#__PURE__*/React.createElement(Button, {
1363
- "data-cy": "add-new-webhook-button",
1364
- label: t("neetoWebhooks.webhook.add"),
1365
- onClick: function onClick() {
1366
- return setIsAddWebhookPaneOpen(true);
1367
- }
1368
- })
1369
- }), /*#__PURE__*/React.createElement(Typography, {
1370
- className: "mb-3",
1371
- "data-cy": "webhook-description-header",
1372
- style: "h5",
1373
- weight: "normal"
1374
- }, t("neetoWebhooks.webhook.description")));
1375
- };
1459
+ return /*#__PURE__*/jsxs(Fragment, {
1460
+ children: [/*#__PURE__*/jsx(Header$2, {
1461
+ breadcrumbs: breadcrumbs,
1462
+ actionBlock: /*#__PURE__*/jsx(Button, {
1463
+ "data-cy": "add-new-webhook-button",
1464
+ label: t("neetoWebhooks.webhook.add"),
1465
+ onClick: function onClick() {
1466
+ return setIsAddWebhookPaneOpen(true);
1467
+ }
1468
+ }),
1469
+ title: /*#__PURE__*/jsxs("div", {
1470
+ className: "flex items-center gap-x-2",
1471
+ children: [t("neetoWebhooks.webhook.title"), /*#__PURE__*/jsx(HelpPopover, {
1472
+ description: t("neetoWebhooks.webhook.helpDescription"),
1473
+ helpLinkProps: {
1474
+ href: WEBHOOK_HELP_URL
1475
+ },
1476
+ title: t("neetoWebhooks.webhook.title")
1477
+ })]
1478
+ })
1479
+ }), /*#__PURE__*/jsx(Typography, {
1480
+ className: "mb-3",
1481
+ "data-cy": "webhook-description-header",
1482
+ style: "h5",
1483
+ weight: "normal",
1484
+ children: t("neetoWebhooks.webhook.description")
1485
+ })]
1486
+ });
1487
+ });
1376
1488
  var Header$1 = /*#__PURE__*/React.memo(Header);
1377
1489
 
1378
1490
  var Webhooks = function Webhooks(_ref) {
@@ -1423,7 +1535,7 @@ var Webhooks = function Webhooks(_ref) {
1423
1535
  onDelete === null || onDelete === void 0 || onDelete();
1424
1536
  }
1425
1537
  }),
1426
- isDeleting = _useDestroyWebhook.isLoading,
1538
+ isDeleting = _useDestroyWebhook.isPending,
1427
1539
  destroyWebhook = _useDestroyWebhook.mutate;
1428
1540
  var handlePaneClose = function handlePaneClose() {
1429
1541
  setEditingWebhookId(null);
@@ -1438,61 +1550,75 @@ var Webhooks = function Webhooks(_ref) {
1438
1550
  setIsDeleteAlertOpen(true);
1439
1551
  }, []);
1440
1552
  if (isLoading) {
1441
- return /*#__PURE__*/React.createElement(PageLoader, null);
1553
+ return /*#__PURE__*/jsx(PageLoader, {});
1442
1554
  }
1443
- return /*#__PURE__*/React.createElement(Container, {
1444
- className: "w-full"
1445
- }, /*#__PURE__*/React.createElement(Header$1, {
1446
- breadcrumbs: breadcrumbs,
1447
- setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen
1448
- }), isNotEmpty(webhooks) ? /*#__PURE__*/React.createElement(TableWrapper, {
1449
- hasPagination: totalCount > DEFAULT_PAGE_SIZE
1450
- }, /*#__PURE__*/React.createElement(Table, {
1451
- totalCount: totalCount,
1452
- fixedHeight: true,
1453
- currentPageNumber: pageNumber,
1454
- defaultPageSize: DEFAULT_PAGE_SIZE,
1455
- handlePageChange: function handlePageChange(page) {
1456
- return setPageNumber(page);
1457
- },
1458
- loading: isFetching,
1459
- rowData: webhooks,
1460
- columnData: buildColumns({
1461
- handleDelete: handleDelete,
1462
- handleEdit: handleEdit,
1463
- deliveriesPath: deliveriesPath
1464
- })
1465
- })) : /*#__PURE__*/React.createElement("div", {
1466
- className: "flex h-full w-full items-center justify-center"
1467
- }, /*#__PURE__*/React.createElement(NoData, {
1468
- title: t("neetoWebhooks.webhook.empty")
1469
- })), /*#__PURE__*/React.createElement(AddWebhookPane, {
1470
- editingWebhookId: editingWebhookId,
1471
- entityId: entityId,
1472
- entityType: entityType,
1473
- onCreate: onCreate,
1474
- webhooks: webhooks,
1475
- isOpen: isAddWebhookPaneOpen,
1476
- onClose: handlePaneClose
1477
- }), /*#__PURE__*/React.createElement(Alert, {
1478
- isOpen: isDeleteAlertOpen,
1479
- isSubmitting: isDeleting,
1480
- submitButtonLabel: t("neetoWebhooks.buttons.delete"),
1481
- message: t("neetoWebhooks.alert.delete.message", {
1482
- entity: t("neetoWebhooks.entity.webhook")
1483
- }),
1484
- title: t("neetoWebhooks.alert.delete.title", {
1485
- entity: t("neetoWebhooks.entity.webhook")
1486
- }),
1487
- onClose: function onClose() {
1488
- return setIsDeleteAlertOpen(false);
1489
- },
1490
- onSubmit: function onSubmit() {
1491
- return destroyWebhook(deletingWebhookId, {
1492
- entityId: entityId
1493
- });
1494
- }
1495
- }));
1555
+ return /*#__PURE__*/jsxs(Container, {
1556
+ className: "w-full",
1557
+ children: [/*#__PURE__*/jsx(Header$1, {
1558
+ breadcrumbs: breadcrumbs,
1559
+ setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen
1560
+ }), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
1561
+ hasPagination: totalCount > DEFAULT_PAGE_SIZE,
1562
+ children: /*#__PURE__*/jsx(Table, {
1563
+ totalCount: totalCount,
1564
+ fixedHeight: true,
1565
+ currentPageNumber: pageNumber,
1566
+ defaultPageSize: DEFAULT_PAGE_SIZE,
1567
+ handlePageChange: setPageNumber,
1568
+ loading: isFetching,
1569
+ rowData: webhooks,
1570
+ columnData: buildColumns({
1571
+ handleDelete: handleDelete,
1572
+ handleEdit: handleEdit,
1573
+ deliveriesPath: deliveriesPath
1574
+ })
1575
+ })
1576
+ }) : /*#__PURE__*/jsx("div", {
1577
+ className: "flex h-full w-full items-center justify-center",
1578
+ children: /*#__PURE__*/jsx(NoData, {
1579
+ title: t("neetoWebhooks.webhook.empty"),
1580
+ helpText: /*#__PURE__*/jsx("a", {
1581
+ className: "neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium",
1582
+ href: WEBHOOK_HELP_URL,
1583
+ rel: "noreferrer",
1584
+ target: "_blank",
1585
+ children: t("neetoWebhooks.webhook.emptyHelpText")
1586
+ }),
1587
+ primaryButtonProps: {
1588
+ label: t("neetoWebhooks.webhook.add"),
1589
+ onClick: function onClick() {
1590
+ return setIsAddWebhookPaneOpen(true);
1591
+ }
1592
+ }
1593
+ })
1594
+ }), /*#__PURE__*/jsx(AddWebhookPane, {
1595
+ editingWebhookId: editingWebhookId,
1596
+ entityId: entityId,
1597
+ entityType: entityType,
1598
+ onCreate: onCreate,
1599
+ webhooks: webhooks,
1600
+ isOpen: isAddWebhookPaneOpen,
1601
+ onClose: handlePaneClose
1602
+ }), /*#__PURE__*/jsx(Alert, {
1603
+ isOpen: isDeleteAlertOpen,
1604
+ isSubmitting: isDeleting,
1605
+ submitButtonLabel: t("neetoWebhooks.buttons.delete"),
1606
+ message: t("neetoWebhooks.alert.delete.message", {
1607
+ entity: t("neetoWebhooks.entity.webhook")
1608
+ }),
1609
+ title: t("neetoWebhooks.alert.delete.title", {
1610
+ entity: t("neetoWebhooks.entity.webhook")
1611
+ }),
1612
+ onClose: function onClose() {
1613
+ return setIsDeleteAlertOpen(false);
1614
+ },
1615
+ onSubmit: function onSubmit() {
1616
+ return destroyWebhook(deletingWebhookId, {
1617
+ entityId: entityId
1618
+ });
1619
+ }
1620
+ })]
1621
+ });
1496
1622
  };
1497
1623
  var Webhooks$1 = withReactQuery(Webhooks);
1498
1624
 
@@ -1508,37 +1634,39 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1508
1634
  webhooksUrl = _useRouteMatch.url;
1509
1635
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1510
1636
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1511
- return /*#__PURE__*/React.createElement(Switch$1, null, /*#__PURE__*/React.createElement(Route, {
1512
- exact: true,
1513
- path: webhooksPath,
1514
- component: function component() {
1515
- return /*#__PURE__*/React.createElement(Webhooks$1, {
1516
- breadcrumbs: breadcrumbs,
1517
- deliveriesPath: deliveriesPath,
1518
- entityId: entityId,
1519
- entityType: entityType,
1520
- onCreate: onCreate,
1521
- onDelete: onDelete
1522
- });
1523
- }
1524
- }), /*#__PURE__*/React.createElement(Route, {
1525
- exact: true,
1526
- path: deliveryDetailsPath,
1527
- render: function render() {
1528
- return /*#__PURE__*/React.createElement(Deliveries$1, {
1529
- breadcrumbs: breadcrumbs,
1530
- webhooksUrl: webhooksUrl
1531
- });
1532
- }
1533
- }), /*#__PURE__*/React.createElement(Route, {
1534
- component: function component() {
1535
- return /*#__PURE__*/React.createElement(Deliveries$1, {
1536
- breadcrumbs: breadcrumbs,
1537
- webhooksUrl: webhooksUrl
1538
- });
1539
- },
1540
- path: deliveriesPath
1541
- }));
1637
+ return /*#__PURE__*/jsxs(Switch$1, {
1638
+ children: [/*#__PURE__*/jsx(Route, {
1639
+ exact: true,
1640
+ path: webhooksPath,
1641
+ component: function component() {
1642
+ return /*#__PURE__*/jsx(Webhooks$1, {
1643
+ breadcrumbs: breadcrumbs,
1644
+ deliveriesPath: deliveriesPath,
1645
+ entityId: entityId,
1646
+ entityType: entityType,
1647
+ onCreate: onCreate,
1648
+ onDelete: onDelete
1649
+ });
1650
+ }
1651
+ }), /*#__PURE__*/jsx(Route, {
1652
+ exact: true,
1653
+ path: deliveryDetailsPath,
1654
+ render: function render() {
1655
+ return /*#__PURE__*/jsx(Deliveries$1, {
1656
+ breadcrumbs: breadcrumbs,
1657
+ webhooksUrl: webhooksUrl
1658
+ });
1659
+ }
1660
+ }), /*#__PURE__*/jsx(Route, {
1661
+ component: function component() {
1662
+ return /*#__PURE__*/jsx(Deliveries$1, {
1663
+ breadcrumbs: breadcrumbs,
1664
+ webhooksUrl: webhooksUrl
1665
+ });
1666
+ },
1667
+ path: deliveriesPath
1668
+ })]
1669
+ });
1542
1670
  };
1543
1671
 
1544
1672
  var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}