@bigbinary/neeto-webhooks-frontend 3.0.10 → 3.0.12
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/README.md +0 -1
- package/app/javascript/src/translations/hu.json +113 -0
- package/dist/.ready +1 -0
- package/dist/NeetoWebhooks.js +40 -294
- package/dist/NeetoWebhooks.js.map +1 -1
- package/dist/cjs/NeetoWebhooks.js +26 -280
- package/dist/cjs/NeetoWebhooks.js.map +1 -1
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/v2/NeetoWebhooks.js +1205 -0
- package/dist/cjs/v2/NeetoWebhooks.js.map +1 -0
- package/dist/cjs/v2/index.js +42 -0
- package/dist/cjs/v2/index.js.map +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/main-B8V9tERH.js +279 -0
- package/dist/main-B8V9tERH.js.map +1 -0
- package/dist/main-CfvmjDDj.js +264 -0
- package/dist/main-CfvmjDDj.js.map +1 -0
- package/dist/v2/NeetoWebhooks.js +1184 -0
- package/dist/v2/NeetoWebhooks.js.map +1 -0
- package/dist/v2/index.js +36 -0
- package/dist/v2/index.js.map +1 -0
- package/package.json +43 -32
package/dist/NeetoWebhooks.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { prop, pluck, assoc, mergeRight } from 'ramda';
|
|
2
2
|
import { useRouteMatch, useHistory, useParams, Switch as Switch$1, Route } from 'react-router-dom';
|
|
3
|
-
import {
|
|
3
|
+
import { q as queryClient, u as useRedeliverWebhook, a as useShowDelivery, b as useFetchDeliveries, g as getDeliveriesPath, c as getDeliveryDetailsPath, d as useUpdateWebhook, v as v4, e as useCreateWebhook, f as useShowWebhook, h as useFetchEvents, i as useFetchWebhooks, j as useDestroyWebhook, H as HELP_LINK_URLS } from './main-CfvmjDDj.js';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
5
|
import { isPresent, removeBy, isNotEmpty, findIndexBy, removeById, findBy } from '@bigbinary/neeto-cist';
|
|
6
|
-
import {
|
|
7
|
-
import { useQueryParams,
|
|
6
|
+
import { SINGULAR, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
7
|
+
import { useQueryParams, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
8
|
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
9
9
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
10
10
|
import Header$2 from '@bigbinary/neeto-molecules/Header';
|
|
@@ -14,10 +14,9 @@ import Spinner from '@bigbinary/neetoui/Spinner';
|
|
|
14
14
|
import Table from '@bigbinary/neetoui/Table';
|
|
15
15
|
import { useTranslation } from 'react-i18next';
|
|
16
16
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
17
|
-
import {
|
|
17
|
+
import { QueryClientProvider } from '@tanstack/react-query';
|
|
18
18
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
19
19
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
20
|
-
import axios from 'axios';
|
|
21
20
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
22
21
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
23
22
|
import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
|
|
@@ -28,7 +27,7 @@ import { useState, useRef, useMemo, useEffect, memo, useCallback } from 'react';
|
|
|
28
27
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
29
28
|
import Tab from '@bigbinary/neetoui/Tab';
|
|
30
29
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
31
|
-
import { t
|
|
30
|
+
import { t } from 'i18next';
|
|
32
31
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
33
32
|
import { FieldArray, ErrorMessage } from 'formik';
|
|
34
33
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
@@ -43,31 +42,11 @@ import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
|
43
42
|
import * as yup from 'yup';
|
|
44
43
|
import Switch from '@bigbinary/neetoui/Switch';
|
|
45
44
|
import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
webhooks: "https://help.".concat(globalProps.appName, ".com/articles/creating-a-webhook"),
|
|
49
|
-
secrets: "https://help.".concat(globalProps.appName, ".com/articles/securing-webhook-requests"),
|
|
50
|
-
deliveries: "https://help.".concat(globalProps.appName, ".com/articles/managing-webhook-deliveries")
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
|
|
54
|
-
return "".concat(webhooksPath, "/:webhookId/deliveries");
|
|
55
|
-
};
|
|
56
|
-
var getDeliveryDetailsPath = function getDeliveryDetailsPath(deliveriesPath) {
|
|
57
|
-
return "".concat(deliveriesPath, "/:deliveryId/");
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
var queryClient = new QueryClient({
|
|
61
|
-
queryCache: new QueryCache(),
|
|
62
|
-
defaultOptions: {
|
|
63
|
-
queries: {
|
|
64
|
-
staleTime: DEFAULT_STALE_TIME
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|
|
45
|
+
import '@bigbinary/neeto-commons-frontend/initializers';
|
|
46
|
+
import 'axios';
|
|
68
47
|
|
|
69
48
|
function ownKeys$3(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; }
|
|
70
|
-
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t),
|
|
49
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
71
50
|
var withReactQuery = function withReactQuery(Component) {
|
|
72
51
|
var QueryWrapper = function QueryWrapper(props) {
|
|
73
52
|
return /*#__PURE__*/jsxs(QueryClientProvider, {
|
|
@@ -81,70 +60,6 @@ var withReactQuery = function withReactQuery(Component) {
|
|
|
81
60
|
return QueryWrapper;
|
|
82
61
|
};
|
|
83
62
|
|
|
84
|
-
var baseUrl$2 = "/neeto_webhooks";
|
|
85
|
-
var fetch$1 = function fetch(webhookId, params) {
|
|
86
|
-
return axios.get("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries"), {
|
|
87
|
-
params: params
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
var show$1 = function show(id, webhookId) {
|
|
91
|
-
return axios.get("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries/").concat(id));
|
|
92
|
-
};
|
|
93
|
-
var redeliver = function redeliver(delivery_id, webhookId) {
|
|
94
|
-
return axios.post("".concat(baseUrl$2, "/webhooks/").concat(webhookId, "/deliveries/").concat(delivery_id, "/redeliver"));
|
|
95
|
-
};
|
|
96
|
-
var deliveriesApi = {
|
|
97
|
-
fetch: fetch$1,
|
|
98
|
-
show: show$1,
|
|
99
|
-
redeliver: redeliver
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
var QUERY_KEYS = {
|
|
103
|
-
DELIVERY_LIST: "delivery-list",
|
|
104
|
-
DELIVERY_DETAILS: "delivery-details",
|
|
105
|
-
WEBHOOK_LIST: "webhook-list",
|
|
106
|
-
WEBHOOK_DETAILS: "webhook-details",
|
|
107
|
-
EVENTS_LIST: "events-list"
|
|
108
|
-
};
|
|
109
|
-
var DELIVERY_STALE_TIME = 3200000; // 1 hour
|
|
110
|
-
var WEBHOOK_STALE_TIME = 3200000; // 1 hour
|
|
111
|
-
var POST_REDELIVERY_ON_SUCCESS_TIMEOUT = 5000; // 5 seconds
|
|
112
|
-
|
|
113
|
-
var useFetchDeliveries = function useFetchDeliveries(webhookId, params) {
|
|
114
|
-
return useQuery({
|
|
115
|
-
queryKey: [QUERY_KEYS.DELIVERY_LIST, webhookId, params],
|
|
116
|
-
queryFn: function queryFn() {
|
|
117
|
-
return deliveriesApi.fetch(webhookId, params);
|
|
118
|
-
},
|
|
119
|
-
staleTime: DELIVERY_STALE_TIME
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
var useShowDelivery = function useShowDelivery(id, webhookId) {
|
|
123
|
-
return useQuery({
|
|
124
|
-
queryKey: [QUERY_KEYS.DELIVERY_DETAILS, id, webhookId],
|
|
125
|
-
queryFn: function queryFn() {
|
|
126
|
-
return deliveriesApi.show(id, webhookId);
|
|
127
|
-
},
|
|
128
|
-
staleTime: DELIVERY_STALE_TIME,
|
|
129
|
-
enabled: !!id
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
|
|
133
|
-
var queryClient = useQueryClient();
|
|
134
|
-
return useMutation({
|
|
135
|
-
mutationFn: function mutationFn() {
|
|
136
|
-
return deliveriesApi.redeliver(deliveryId, webhookSid);
|
|
137
|
-
},
|
|
138
|
-
onSuccess: function onSuccess() {
|
|
139
|
-
setTimeout(function () {
|
|
140
|
-
return queryClient.invalidateQueries({
|
|
141
|
-
queryKey: [QUERY_KEYS.DELIVERY_LIST]
|
|
142
|
-
});
|
|
143
|
-
}, POST_REDELIVERY_ON_SUCCESS_TIMEOUT);
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
|
|
148
63
|
var DELIVERY_TAB = {
|
|
149
64
|
response: "response",
|
|
150
65
|
request: "request"
|
|
@@ -365,7 +280,7 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
365
280
|
var deliveryDetailsPath = _ref.deliveryDetailsPath,
|
|
366
281
|
page = _ref.page;
|
|
367
282
|
return [{
|
|
368
|
-
title: t
|
|
283
|
+
title: t("neetoWebhooks.delivery.deliveryId"),
|
|
369
284
|
key: "identifier",
|
|
370
285
|
dataIndex: "identifier",
|
|
371
286
|
width: 390,
|
|
@@ -382,12 +297,12 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
382
297
|
children: delivery.identifier
|
|
383
298
|
}), delivery.redelivery && /*#__PURE__*/jsx(Tag, {
|
|
384
299
|
style: "info",
|
|
385
|
-
children: t
|
|
300
|
+
children: t("neetoWebhooks.delivery.redelivery")
|
|
386
301
|
})]
|
|
387
302
|
});
|
|
388
303
|
}
|
|
389
304
|
}, {
|
|
390
|
-
title: t
|
|
305
|
+
title: t("neetoWebhooks.tableHeaders.createdAt"),
|
|
391
306
|
key: "createdAt",
|
|
392
307
|
dataIndex: "createdAt",
|
|
393
308
|
width: 280,
|
|
@@ -402,7 +317,7 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
402
317
|
});
|
|
403
318
|
}
|
|
404
319
|
}, {
|
|
405
|
-
title: t
|
|
320
|
+
title: t("neetoWebhooks.common.responseStatus"),
|
|
406
321
|
key: "responseStatusCode",
|
|
407
322
|
width: 250,
|
|
408
323
|
render: function render(_ref2) {
|
|
@@ -421,7 +336,7 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
421
336
|
});
|
|
422
337
|
}
|
|
423
338
|
}, {
|
|
424
|
-
title: t
|
|
339
|
+
title: t("neetoWebhooks.common.event", SINGULAR),
|
|
425
340
|
key: "event",
|
|
426
341
|
dataIndex: "event",
|
|
427
342
|
width: 270,
|
|
@@ -429,7 +344,7 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
429
344
|
}];
|
|
430
345
|
};
|
|
431
346
|
|
|
432
|
-
var Deliveries = function Deliveries(_ref) {
|
|
347
|
+
var Deliveries$1 = function Deliveries(_ref) {
|
|
433
348
|
var webhooksUrl = _ref.webhooksUrl,
|
|
434
349
|
hostBreadcrumbs = _ref.breadcrumbs,
|
|
435
350
|
helpLink = _ref.helpLink;
|
|
@@ -517,108 +432,7 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
517
432
|
})]
|
|
518
433
|
});
|
|
519
434
|
};
|
|
520
|
-
var Deliveries
|
|
521
|
-
|
|
522
|
-
var baseUrl$1 = "/neeto_webhooks/webhooks";
|
|
523
|
-
var fetch = function fetch(params) {
|
|
524
|
-
return axios.get(baseUrl$1, {
|
|
525
|
-
params: params
|
|
526
|
-
});
|
|
527
|
-
};
|
|
528
|
-
var create = function create(payload) {
|
|
529
|
-
return axios.post(baseUrl$1, {
|
|
530
|
-
webhook: payload
|
|
531
|
-
});
|
|
532
|
-
};
|
|
533
|
-
var show = function show(id) {
|
|
534
|
-
return axios.get("".concat(baseUrl$1, "/").concat(id));
|
|
535
|
-
};
|
|
536
|
-
var update = function update(id, payload) {
|
|
537
|
-
return axios.put("".concat(baseUrl$1, "/").concat(id), {
|
|
538
|
-
webhook: payload
|
|
539
|
-
});
|
|
540
|
-
};
|
|
541
|
-
var destroy = function destroy(id) {
|
|
542
|
-
return axios["delete"]("".concat(baseUrl$1, "/").concat(id));
|
|
543
|
-
};
|
|
544
|
-
var webhooksApi = {
|
|
545
|
-
fetch: fetch,
|
|
546
|
-
create: create,
|
|
547
|
-
show: show,
|
|
548
|
-
update: update,
|
|
549
|
-
destroy: destroy
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
var useFetchWebhooks = function useFetchWebhooks(params) {
|
|
553
|
-
return useQuery({
|
|
554
|
-
queryKey: [QUERY_KEYS.WEBHOOK_LIST, params],
|
|
555
|
-
queryFn: function queryFn() {
|
|
556
|
-
return webhooksApi.fetch(params);
|
|
557
|
-
},
|
|
558
|
-
staleTime: WEBHOOK_STALE_TIME
|
|
559
|
-
});
|
|
560
|
-
};
|
|
561
|
-
var useCreateWebhook = function useCreateWebhook(options) {
|
|
562
|
-
return useMutationWithInvalidation(webhooksApi.create, {
|
|
563
|
-
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
564
|
-
onSuccess: function onSuccess() {
|
|
565
|
-
var _options$onSuccess;
|
|
566
|
-
options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
};
|
|
570
|
-
var useShowWebhook = function useShowWebhook(id) {
|
|
571
|
-
return useQuery({
|
|
572
|
-
queryKey: [QUERY_KEYS.WEBHOOK_DETAILS, id],
|
|
573
|
-
queryFn: function queryFn() {
|
|
574
|
-
return webhooksApi.show(id);
|
|
575
|
-
},
|
|
576
|
-
enabled: !!id,
|
|
577
|
-
staleTime: WEBHOOK_STALE_TIME
|
|
578
|
-
});
|
|
579
|
-
};
|
|
580
|
-
var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
581
|
-
return useMutationWithInvalidation(function (_ref) {
|
|
582
|
-
var id = _ref.id,
|
|
583
|
-
payload = _ref.payload;
|
|
584
|
-
return webhooksApi.update(id, payload);
|
|
585
|
-
}, {
|
|
586
|
-
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
|
|
587
|
-
onSuccess: function onSuccess() {
|
|
588
|
-
var _options$onSuccess2;
|
|
589
|
-
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
590
|
-
},
|
|
591
|
-
onError: function onError(error) {
|
|
592
|
-
var _options$onError;
|
|
593
|
-
options === null || options === void 0 || (_options$onError = options.onError) === null || _options$onError === void 0 || _options$onError.call(options, error);
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
};
|
|
597
|
-
var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
598
|
-
return useMutationWithInvalidation(webhooksApi.destroy, {
|
|
599
|
-
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
600
|
-
onSuccess: function onSuccess() {
|
|
601
|
-
var _options$onSuccess3;
|
|
602
|
-
options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
var baseUrl = "/neeto_webhooks/events/all";
|
|
608
|
-
var all = function all() {
|
|
609
|
-
return axios.get(baseUrl);
|
|
610
|
-
};
|
|
611
|
-
var eventsApi = {
|
|
612
|
-
all: all
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
var useFetchEvents = function useFetchEvents() {
|
|
616
|
-
return useQuery({
|
|
617
|
-
queryKey: [QUERY_KEYS.EVENTS_LIST],
|
|
618
|
-
queryFn: eventsApi.all,
|
|
619
|
-
staleTime: WEBHOOK_STALE_TIME
|
|
620
|
-
});
|
|
621
|
-
};
|
|
435
|
+
var Deliveries = withReactQuery(Deliveries$1);
|
|
622
436
|
|
|
623
437
|
var MENU_ITEMS = {
|
|
624
438
|
EDIT: "edit",
|
|
@@ -646,7 +460,8 @@ var EventCheckbox = function EventCheckbox(_ref) {
|
|
|
646
460
|
};
|
|
647
461
|
return /*#__PURE__*/jsx("div", {
|
|
648
462
|
children: events.map(function (event) {
|
|
649
|
-
var
|
|
463
|
+
var _values$events;
|
|
464
|
+
var index = findIndexBy(event, (_values$events = values.events) !== null && _values$events !== void 0 ? _values$events : []);
|
|
650
465
|
var isSelected = index > -1;
|
|
651
466
|
return /*#__PURE__*/jsx(Checkbox, {
|
|
652
467
|
checked: isSelected,
|
|
@@ -660,70 +475,6 @@ var EventCheckbox = function EventCheckbox(_ref) {
|
|
|
660
475
|
});
|
|
661
476
|
};
|
|
662
477
|
|
|
663
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
664
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
665
|
-
// generators (like Math.random()).
|
|
666
|
-
var getRandomValues;
|
|
667
|
-
var rnds8 = new Uint8Array(16);
|
|
668
|
-
function rng() {
|
|
669
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
670
|
-
if (!getRandomValues) {
|
|
671
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
|
|
672
|
-
// find the complete implementation of crypto (msCrypto) on IE11.
|
|
673
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
|
|
674
|
-
|
|
675
|
-
if (!getRandomValues) {
|
|
676
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
return getRandomValues(rnds8);
|
|
681
|
-
}
|
|
682
|
-
|
|
683
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
684
|
-
|
|
685
|
-
function validate(uuid) {
|
|
686
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
691
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
692
|
-
*/
|
|
693
|
-
|
|
694
|
-
var byteToHex = [];
|
|
695
|
-
|
|
696
|
-
for (var i = 0; i < 256; ++i) {
|
|
697
|
-
byteToHex.push((i + 0x100).toString(16).substr(1));
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
function stringify(arr) {
|
|
701
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
702
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
703
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
704
|
-
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
705
|
-
// of the following:
|
|
706
|
-
// - One or more input array values don't map to a hex octet (leading to
|
|
707
|
-
// "undefined" in the uuid)
|
|
708
|
-
// - Invalid input values for the RFC `version` or `variant` fields
|
|
709
|
-
|
|
710
|
-
if (!validate(uuid)) {
|
|
711
|
-
throw TypeError('Stringified UUID is invalid');
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
return uuid;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
function v4(options, buf, offset) {
|
|
718
|
-
options = options || {};
|
|
719
|
-
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
720
|
-
|
|
721
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
722
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
723
|
-
|
|
724
|
-
return stringify(rnds);
|
|
725
|
-
}
|
|
726
|
-
|
|
727
478
|
var ToggleActiveSwitch = function ToggleActiveSwitch(_ref) {
|
|
728
479
|
var isActive = _ref.isActive,
|
|
729
480
|
webhookId = _ref.webhookId;
|
|
@@ -762,28 +513,28 @@ var ToggleActiveSwitch = function ToggleActiveSwitch(_ref) {
|
|
|
762
513
|
};
|
|
763
514
|
|
|
764
515
|
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; }
|
|
765
|
-
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),
|
|
516
|
+
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), true).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; }
|
|
766
517
|
var getMenuItems = function getMenuItems(_ref) {
|
|
767
518
|
var onEdit = _ref.onEdit,
|
|
768
519
|
onDelete = _ref.onDelete;
|
|
769
520
|
return [{
|
|
770
521
|
key: MENU_ITEMS.EDIT,
|
|
771
|
-
label: t
|
|
522
|
+
label: t("neetoWebhooks.buttons.edit"),
|
|
772
523
|
"data-testid": "neeto-webhooks-edit-button",
|
|
773
524
|
onClick: onEdit
|
|
774
525
|
}, {
|
|
775
526
|
key: MENU_ITEMS.DELETE,
|
|
776
|
-
label: t
|
|
527
|
+
label: t("neetoWebhooks.buttons.delete"),
|
|
777
528
|
"data-testid": "neeto-webhooks-delete-button",
|
|
778
529
|
onClick: onDelete
|
|
779
530
|
}];
|
|
780
531
|
};
|
|
781
532
|
var getValidationSchema = function getValidationSchema(webhooks) {
|
|
782
533
|
return yup.object().shape({
|
|
783
|
-
endpoint: yup.string().trim().matches(/^(https?):\/\//i, t
|
|
534
|
+
endpoint: yup.string().trim().matches(/^(https?):\/\//i, t("neetoWebhooks.errors.webhook.invalidUrlProtocol")).url(t("neetoWebhooks.errors.webhook.invalidUrl")).required(t("neetoWebhooks.errors.webhook.required")).test("Is endpoint unique", t("neetoWebhooks.errors.webhook.urlNotUnique"), function (endpoint, ctx) {
|
|
784
535
|
return !pluck("endpoint", removeById(ctx.parent.id, webhooks)).includes(endpoint === null || endpoint === void 0 ? void 0 : endpoint.trim());
|
|
785
536
|
}),
|
|
786
|
-
events: yup.array()["default"]([]).min(1, t
|
|
537
|
+
events: yup.array()["default"]([]).min(1, t("neetoWebhooks.errors.webhook.events.required")),
|
|
787
538
|
secret: yup.string().trim().nullable()
|
|
788
539
|
});
|
|
789
540
|
};
|
|
@@ -826,13 +577,13 @@ var formatTimeUntilExpiration = function formatTimeUntilExpiration(expiresAt) {
|
|
|
826
577
|
var diffHours = Math.floor(diffMs / (1000 * 60 * 60));
|
|
827
578
|
var diffDays = Math.floor(diffHours / 24);
|
|
828
579
|
if (diffDays > 0) {
|
|
829
|
-
return t
|
|
580
|
+
return t("neetoWebhooks.webhook.versionStatus.expiresIn.days", {
|
|
830
581
|
count: diffDays
|
|
831
582
|
});
|
|
832
583
|
}
|
|
833
584
|
var remainingHours = diffHours;
|
|
834
585
|
var remainingMinutes = Math.floor(diffMs % (1000 * 60 * 60) / (1000 * 60));
|
|
835
|
-
return t
|
|
586
|
+
return t("neetoWebhooks.webhook.versionStatus.expiresIn.hoursAndMinutes", {
|
|
836
587
|
hours: remainingHours,
|
|
837
588
|
hoursPlural: remainingHours !== 1 ? "s" : "",
|
|
838
589
|
minutes: remainingMinutes,
|
|
@@ -842,7 +593,7 @@ var formatTimeUntilExpiration = function formatTimeUntilExpiration(expiresAt) {
|
|
|
842
593
|
var formatExpiredDate = function formatExpiredDate(expiresAt) {
|
|
843
594
|
if (!expiresAt) return null;
|
|
844
595
|
var expiry = new Date(expiresAt);
|
|
845
|
-
return t
|
|
596
|
+
return t("neetoWebhooks.webhook.versionStatus.expiredOn", {
|
|
846
597
|
date: expiry.toLocaleDateString()
|
|
847
598
|
});
|
|
848
599
|
};
|
|
@@ -851,7 +602,7 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
851
602
|
handleEdit = _ref6.handleEdit,
|
|
852
603
|
deliveriesPath = _ref6.deliveriesPath;
|
|
853
604
|
return [{
|
|
854
|
-
title: t
|
|
605
|
+
title: t("neetoWebhooks.common.endpoint"),
|
|
855
606
|
key: "endpoint",
|
|
856
607
|
dataIndex: "endpoint",
|
|
857
608
|
width: 700,
|
|
@@ -886,7 +637,7 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
886
637
|
});
|
|
887
638
|
}
|
|
888
639
|
}, {
|
|
889
|
-
title: t
|
|
640
|
+
title: t("neetoWebhooks.webhook.active"),
|
|
890
641
|
key: "isActive",
|
|
891
642
|
dataIndex: "isActive",
|
|
892
643
|
render: function render(isActive, webhook) {
|
|
@@ -897,7 +648,7 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
897
648
|
},
|
|
898
649
|
width: 150
|
|
899
650
|
}, {
|
|
900
|
-
title: t
|
|
651
|
+
title: t("neetoWebhooks.webhook.version"),
|
|
901
652
|
dataIndex: "version",
|
|
902
653
|
key: "version",
|
|
903
654
|
render: function render(version, webhook) {
|
|
@@ -922,14 +673,14 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
922
673
|
href: webhook.defaultVersionPayloadDocUrl,
|
|
923
674
|
rel: "noopener noreferrer",
|
|
924
675
|
target: "_blank",
|
|
925
|
-
children: t
|
|
676
|
+
children: t("neetoWebhooks.webhook.versionStatus.moreDetails")
|
|
926
677
|
}), "."]
|
|
927
678
|
})]
|
|
928
679
|
});
|
|
929
680
|
},
|
|
930
681
|
width: 200
|
|
931
682
|
}, {
|
|
932
|
-
title: t
|
|
683
|
+
title: t("neetoWebhooks.common.event", PLURAL),
|
|
933
684
|
dataIndex: "events",
|
|
934
685
|
key: "events",
|
|
935
686
|
render: function render(events) {
|
|
@@ -946,7 +697,7 @@ var generateRandomSecret = function generateRandomSecret() {
|
|
|
946
697
|
};
|
|
947
698
|
|
|
948
699
|
function ownKeys$1(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; }
|
|
949
|
-
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t),
|
|
700
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
950
701
|
var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
951
702
|
var editingWebhookId = _ref.editingWebhookId,
|
|
952
703
|
entityId = _ref.entityId,
|
|
@@ -1175,8 +926,8 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
1175
926
|
};
|
|
1176
927
|
|
|
1177
928
|
function ownKeys(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; }
|
|
1178
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t),
|
|
1179
|
-
var Header = withT(function (_ref) {
|
|
929
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
930
|
+
var Header$1 = withT(function (_ref) {
|
|
1180
931
|
var t = _ref.t,
|
|
1181
932
|
breadcrumbs = _ref.breadcrumbs,
|
|
1182
933
|
title = _ref.title,
|
|
@@ -1215,9 +966,9 @@ var Header = withT(function (_ref) {
|
|
|
1215
966
|
})]
|
|
1216
967
|
});
|
|
1217
968
|
});
|
|
1218
|
-
var Header
|
|
969
|
+
var Header = /*#__PURE__*/memo(Header$1);
|
|
1219
970
|
|
|
1220
|
-
var Webhooks = function Webhooks(_ref) {
|
|
971
|
+
var Webhooks$1 = function Webhooks(_ref) {
|
|
1221
972
|
var deliveriesPath = _ref.deliveriesPath,
|
|
1222
973
|
entityType = _ref.entityType,
|
|
1223
974
|
breadcrumbs = _ref.breadcrumbs,
|
|
@@ -1293,7 +1044,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1293
1044
|
}
|
|
1294
1045
|
return /*#__PURE__*/jsxs(Container, {
|
|
1295
1046
|
className: containerClassName,
|
|
1296
|
-
children: [/*#__PURE__*/jsx(Header
|
|
1047
|
+
children: [/*#__PURE__*/jsx(Header, {
|
|
1297
1048
|
breadcrumbs: breadcrumbs,
|
|
1298
1049
|
headerSize: headerSize,
|
|
1299
1050
|
setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
|
|
@@ -1365,12 +1116,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1365
1116
|
})]
|
|
1366
1117
|
});
|
|
1367
1118
|
};
|
|
1368
|
-
var Webhooks
|
|
1369
|
-
|
|
1370
|
-
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}}
|
|
1371
|
-
|
|
1372
|
-
var css = ".neeto-molecules-header .neeto-molecules-header__breadcrumbs-wrap{flex-wrap:wrap}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9tYWluLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxrRUFDRSxjQUNGIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLW1vbGVjdWxlcy1oZWFkZXIgLm5lZXRvLW1vbGVjdWxlcy1oZWFkZXJfX2JyZWFkY3J1bWJzLXdyYXAge1xuICBmbGV4LXdyYXA6IHdyYXA7XG59XG4iXX0= */";
|
|
1373
|
-
n(css,{});
|
|
1119
|
+
var Webhooks = withReactQuery(Webhooks$1);
|
|
1374
1120
|
|
|
1375
1121
|
var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
1376
1122
|
var entityType = _ref.entityType,
|
|
@@ -1396,7 +1142,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
1396
1142
|
exact: true,
|
|
1397
1143
|
path: webhooksPath,
|
|
1398
1144
|
component: function component() {
|
|
1399
|
-
return /*#__PURE__*/jsx(Webhooks
|
|
1145
|
+
return /*#__PURE__*/jsx(Webhooks, {
|
|
1400
1146
|
breadcrumbs: breadcrumbs,
|
|
1401
1147
|
containerClassName: containerClassName,
|
|
1402
1148
|
deliveriesPath: deliveriesPath,
|
|
@@ -1415,7 +1161,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
1415
1161
|
exact: true,
|
|
1416
1162
|
path: deliveryDetailsPath,
|
|
1417
1163
|
render: function render() {
|
|
1418
|
-
return /*#__PURE__*/jsx(Deliveries
|
|
1164
|
+
return /*#__PURE__*/jsx(Deliveries, {
|
|
1419
1165
|
breadcrumbs: breadcrumbs,
|
|
1420
1166
|
webhooksUrl: webhooksUrl,
|
|
1421
1167
|
helpLink: helpLinks.deliveries
|
|
@@ -1424,7 +1170,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
1424
1170
|
}), /*#__PURE__*/jsx(Route, {
|
|
1425
1171
|
path: deliveriesPath,
|
|
1426
1172
|
render: function render() {
|
|
1427
|
-
return /*#__PURE__*/jsx(Deliveries
|
|
1173
|
+
return /*#__PURE__*/jsx(Deliveries, {
|
|
1428
1174
|
breadcrumbs: breadcrumbs,
|
|
1429
1175
|
webhooksUrl: webhooksUrl,
|
|
1430
1176
|
helpLink: helpLinks.deliveries
|