@bigbinary/neeto-webhooks-frontend 1.6.30 → 2.0.0
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.cjs.js +43 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +42 -34
- package/dist/index.js.map +1 -1
- package/package.json +5 -3
package/dist/index.cjs.js
CHANGED
|
@@ -14,8 +14,8 @@ var TableWrapper = require('@bigbinary/neeto-molecules/TableWrapper');
|
|
|
14
14
|
var NoData = require('@bigbinary/neetoui/NoData');
|
|
15
15
|
var Table = require('@bigbinary/neetoui/Table');
|
|
16
16
|
var reactI18next = require('react-i18next');
|
|
17
|
-
var reactQuery = require('react-query');
|
|
18
|
-
var
|
|
17
|
+
var reactQuery = require('@tanstack/react-query');
|
|
18
|
+
var reactQueryDevtools = require('@tanstack/react-query-devtools');
|
|
19
19
|
var jsxRuntime = require('react/jsx-runtime');
|
|
20
20
|
var axios = require('axios');
|
|
21
21
|
var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
|
|
@@ -27,6 +27,7 @@ var Tag = require('@bigbinary/neetoui/Tag');
|
|
|
27
27
|
var i18next = require('i18next');
|
|
28
28
|
var ramda = require('ramda');
|
|
29
29
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
30
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
30
31
|
var Plus = require('@bigbinary/neeto-icons/Plus');
|
|
31
32
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
32
33
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
@@ -38,7 +39,6 @@ var Select = require('@bigbinary/neetoui/formik/Select');
|
|
|
38
39
|
var Switch = require('@bigbinary/neetoui/formik/Switch');
|
|
39
40
|
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
40
41
|
var yup = require('yup');
|
|
41
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
42
42
|
|
|
43
43
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
44
44
|
|
|
@@ -221,9 +221,9 @@ var withReactQuery = function withReactQuery(Component) {
|
|
|
221
221
|
var QueryWrapper = function QueryWrapper(props) {
|
|
222
222
|
return /*#__PURE__*/jsxRuntime.jsxs(reactQuery.QueryClientProvider, {
|
|
223
223
|
client: queryClient,
|
|
224
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$2({}, props)), /*#__PURE__*/jsxRuntime.jsx(
|
|
224
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$2({}, props)), /*#__PURE__*/jsxRuntime.jsx(reactQueryDevtools.ReactQueryDevtools, {
|
|
225
225
|
initialIsOpen: false,
|
|
226
|
-
position: "bottom
|
|
226
|
+
position: "bottom"
|
|
227
227
|
})]
|
|
228
228
|
});
|
|
229
229
|
};
|
|
@@ -260,28 +260,35 @@ var WEBHOOK_STALE_TIME = 3200000; // 1 hour
|
|
|
260
260
|
var POST_REDELIVERY_ON_SUCCESS_TIMEOUT = 5000; // 5 seconds
|
|
261
261
|
|
|
262
262
|
var useFetchDeliveries = function useFetchDeliveries(webhookId, params) {
|
|
263
|
-
return reactQuery.useQuery(
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
return reactQuery.useQuery({
|
|
264
|
+
queryKey: [QUERY_KEYS.DELIVERY_LIST, webhookId, params],
|
|
265
|
+
queryFn: function queryFn() {
|
|
266
|
+
return deliveriesApi.fetch(webhookId, params);
|
|
267
|
+
},
|
|
266
268
|
staleTime: DELIVERY_STALE_TIME
|
|
267
269
|
});
|
|
268
270
|
};
|
|
269
271
|
var useShowDelivery = function useShowDelivery(id, webhookId) {
|
|
270
|
-
return reactQuery.useQuery(
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
return reactQuery.useQuery({
|
|
273
|
+
queryKey: [QUERY_KEYS.DELIVERY_DETAILS, id, webhookId],
|
|
274
|
+
queryFn: function queryFn() {
|
|
275
|
+
return deliveriesApi.show(id, webhookId);
|
|
276
|
+
},
|
|
273
277
|
staleTime: DELIVERY_STALE_TIME,
|
|
274
278
|
enabled: !!id
|
|
275
279
|
});
|
|
276
280
|
};
|
|
277
281
|
var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
|
|
278
282
|
var queryClient = reactQuery.useQueryClient();
|
|
279
|
-
return reactQuery.useMutation(
|
|
280
|
-
|
|
281
|
-
|
|
283
|
+
return reactQuery.useMutation({
|
|
284
|
+
mutationFn: function mutationFn() {
|
|
285
|
+
return deliveriesApi.redeliver(deliveryId, webhookSid);
|
|
286
|
+
},
|
|
282
287
|
onSuccess: function onSuccess() {
|
|
283
288
|
setTimeout(function () {
|
|
284
|
-
return queryClient.invalidateQueries(
|
|
289
|
+
return queryClient.invalidateQueries({
|
|
290
|
+
queryKey: [QUERY_KEYS.DELIVERY_LIST]
|
|
291
|
+
});
|
|
285
292
|
}, POST_REDELIVERY_ON_SUCCESS_TIMEOUT);
|
|
286
293
|
}
|
|
287
294
|
});
|
|
@@ -806,7 +813,7 @@ var Details = function Details(_ref) {
|
|
|
806
813
|
var _useTranslation = reactI18next.useTranslation(),
|
|
807
814
|
t = _useTranslation.t;
|
|
808
815
|
var _useRedeliverWebhook = useRedeliverWebhook(deliveryId, webhookSid),
|
|
809
|
-
isRedelivering = _useRedeliverWebhook.
|
|
816
|
+
isRedelivering = _useRedeliverWebhook.isPending,
|
|
810
817
|
redeliverWebhook = _useRedeliverWebhook.mutateAsync;
|
|
811
818
|
var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
|
|
812
819
|
isLoading = _useShowDelivery.isLoading,
|
|
@@ -1062,52 +1069,51 @@ var webhooksApi = {
|
|
|
1062
1069
|
};
|
|
1063
1070
|
|
|
1064
1071
|
var useFetchWebhooks = function useFetchWebhooks(params) {
|
|
1065
|
-
return reactQuery.useQuery(
|
|
1066
|
-
|
|
1067
|
-
|
|
1072
|
+
return reactQuery.useQuery({
|
|
1073
|
+
queryKey: [QUERY_KEYS.WEBHOOK_LIST, params],
|
|
1074
|
+
queryFn: function queryFn() {
|
|
1075
|
+
return webhooksApi.fetch(params);
|
|
1076
|
+
},
|
|
1068
1077
|
staleTime: WEBHOOK_STALE_TIME
|
|
1069
1078
|
});
|
|
1070
1079
|
};
|
|
1071
1080
|
var useCreateWebhook = function useCreateWebhook(options) {
|
|
1072
|
-
|
|
1073
|
-
|
|
1081
|
+
return reactUtils.useMutationWithInvalidation(webhooksApi.create, {
|
|
1082
|
+
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
1074
1083
|
onSuccess: function onSuccess() {
|
|
1075
1084
|
var _options$onSuccess;
|
|
1076
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
1077
1085
|
options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
|
|
1078
1086
|
}
|
|
1079
1087
|
});
|
|
1080
1088
|
};
|
|
1081
1089
|
var useShowWebhook = function useShowWebhook(id) {
|
|
1082
|
-
return reactQuery.useQuery(
|
|
1083
|
-
|
|
1084
|
-
|
|
1090
|
+
return reactQuery.useQuery({
|
|
1091
|
+
queryKey: [QUERY_KEYS.WEBHOOK_DETAILS, id],
|
|
1092
|
+
queryFn: function queryFn() {
|
|
1093
|
+
return webhooksApi.show(id);
|
|
1094
|
+
},
|
|
1085
1095
|
enabled: !!id,
|
|
1086
1096
|
staleTime: WEBHOOK_STALE_TIME
|
|
1087
1097
|
});
|
|
1088
1098
|
};
|
|
1089
1099
|
var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
1090
|
-
|
|
1091
|
-
return reactQuery.useMutation(function (_ref) {
|
|
1100
|
+
return reactUtils.useMutationWithInvalidation(function (_ref) {
|
|
1092
1101
|
var id = _ref.id,
|
|
1093
1102
|
payload = _ref.payload;
|
|
1094
1103
|
return webhooksApi.update(id, payload);
|
|
1095
1104
|
}, {
|
|
1105
|
+
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
|
|
1096
1106
|
onSuccess: function onSuccess() {
|
|
1097
1107
|
var _options$onSuccess2;
|
|
1098
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
1099
|
-
queryClient.invalidateQueries([QUERY_KEYS.WEBHOOK_DETAILS, id]);
|
|
1100
|
-
queryClient.invalidateQueries([QUERY_KEYS.DELIVERY_LIST, id]);
|
|
1101
1108
|
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
1102
1109
|
}
|
|
1103
1110
|
});
|
|
1104
1111
|
};
|
|
1105
1112
|
var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
1106
|
-
|
|
1107
|
-
|
|
1113
|
+
return reactUtils.useMutationWithInvalidation(webhooksApi.destroy, {
|
|
1114
|
+
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
1108
1115
|
onSuccess: function onSuccess() {
|
|
1109
1116
|
var _options$onSuccess3;
|
|
1110
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
1111
1117
|
options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
|
|
1112
1118
|
}
|
|
1113
1119
|
});
|
|
@@ -1125,7 +1131,9 @@ var eventsApi = {
|
|
|
1125
1131
|
};
|
|
1126
1132
|
|
|
1127
1133
|
var useFetchEvents = function useFetchEvents() {
|
|
1128
|
-
return reactQuery.useQuery(
|
|
1134
|
+
return reactQuery.useQuery({
|
|
1135
|
+
queryKey: [QUERY_KEYS.EVENTS_LIST],
|
|
1136
|
+
queryFn: eventsApi.all,
|
|
1129
1137
|
staleTime: WEBHOOK_STALE_TIME
|
|
1130
1138
|
});
|
|
1131
1139
|
};
|
|
@@ -1589,7 +1597,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1589
1597
|
onDelete === null || onDelete === void 0 || onDelete();
|
|
1590
1598
|
}
|
|
1591
1599
|
}),
|
|
1592
|
-
isDeleting = _useDestroyWebhook.
|
|
1600
|
+
isDeleting = _useDestroyWebhook.isPending,
|
|
1593
1601
|
destroyWebhook = _useDestroyWebhook.mutate;
|
|
1594
1602
|
var handlePaneClose = function handlePaneClose() {
|
|
1595
1603
|
setEditingWebhookId(null);
|