@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/app/javascript/src/translations/en.json +2 -1
- package/dist/index.cjs.js +590 -447
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +575 -447
- package/dist/index.js.map +1 -1
- package/package.json +17 -14
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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__*/
|
|
115
|
-
client: queryClient
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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(
|
|
155
|
-
|
|
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(
|
|
162
|
-
|
|
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(
|
|
171
|
-
|
|
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(
|
|
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
|
|
283
|
+
var _typeof = {exports: {}};
|
|
219
284
|
|
|
220
|
-
_typeof
|
|
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
|
|
298
|
+
} (_typeof));
|
|
234
299
|
|
|
235
|
-
var _typeofExports = _typeof
|
|
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__*/
|
|
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
|
-
|
|
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__*/
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
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.
|
|
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__*/
|
|
783
|
+
return /*#__PURE__*/jsx(Pane, {
|
|
686
784
|
onClose: onClose,
|
|
687
785
|
isOpen: isPresent(deliveryId),
|
|
688
|
-
size: "large"
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
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__*/
|
|
733
|
-
className: "flex items-center gap-x-3"
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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__*/
|
|
751
|
-
className: "flex items-center justify-between space-x-1"
|
|
752
|
-
|
|
753
|
-
|
|
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__*/
|
|
764
|
-
className: "flex items-center"
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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__*/
|
|
831
|
-
return /*#__PURE__*/
|
|
832
|
-
className: "w-full"
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
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(
|
|
894
|
-
|
|
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
|
-
|
|
901
|
-
|
|
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(
|
|
911
|
-
|
|
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
|
-
|
|
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
|
-
|
|
935
|
-
|
|
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
|
-
|
|
945
|
-
|
|
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(
|
|
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__*/
|
|
1137
|
-
className: "flex items-center justify-between space-x-3"
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
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
|
-
|
|
1152
|
-
|
|
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__*/
|
|
1340
|
+
return /*#__PURE__*/jsxs(Pane, {
|
|
1255
1341
|
isOpen: isOpen,
|
|
1256
1342
|
onClose: onClose,
|
|
1257
|
-
initialFocusRef: endpointRef
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
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:
|
|
1354
|
+
href: WEBHOOK_HELP_URL
|
|
1312
1355
|
},
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
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
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
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
|
|
1355
|
-
var
|
|
1455
|
+
var Header = withT(function (_ref) {
|
|
1456
|
+
var t = _ref.t,
|
|
1457
|
+
breadcrumbs = _ref.breadcrumbs,
|
|
1356
1458
|
setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen;
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
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.
|
|
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__*/
|
|
1553
|
+
return /*#__PURE__*/jsx(PageLoader, {});
|
|
1442
1554
|
}
|
|
1443
|
-
return /*#__PURE__*/
|
|
1444
|
-
className: "w-full"
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
})
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
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__*/
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
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}}
|