@bigbinary/neeto-webhooks-frontend 1.6.4 → 1.6.6
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 +1 -1
- package/dist/index.cjs.js +56 -62
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +71 -78
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6,17 +6,18 @@ import Container from '@bigbinary/neeto-molecules/Container';
|
|
|
6
6
|
import Header$2 from '@bigbinary/neeto-molecules/Header';
|
|
7
7
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
8
8
|
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
9
|
-
import { Spinner, Typography, Tag, Tab, Pane, Button, Table, NoData,
|
|
9
|
+
import { Spinner, Typography, Tag, Tab, Pane, Button, Table, NoData, Alert } from '@bigbinary/neetoui';
|
|
10
10
|
import { useTranslation, Trans } from 'react-i18next';
|
|
11
11
|
import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient, useMutation } from 'react-query';
|
|
12
12
|
import { ReactQueryDevtools } from 'react-query/devtools';
|
|
13
13
|
import axios from 'axios';
|
|
14
14
|
import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
|
|
15
|
-
import { t
|
|
15
|
+
import { t } from 'i18next';
|
|
16
16
|
import { prop, pluck, assoc } from 'ramda';
|
|
17
|
-
import {
|
|
17
|
+
import { Info } from '@bigbinary/neeto-icons';
|
|
18
18
|
import { Form, Textarea, Select, Input, Switch, ActionBlock } from '@bigbinary/neetoui/formik';
|
|
19
19
|
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
20
|
+
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
20
21
|
import * as yup from 'yup';
|
|
21
22
|
|
|
22
23
|
var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
|
|
@@ -666,12 +667,18 @@ var Details = function Details(_ref) {
|
|
|
666
667
|
onClose: onClose
|
|
667
668
|
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DateFormat.Date, {
|
|
668
669
|
date: createdAt,
|
|
670
|
+
tooltipProps: {
|
|
671
|
+
disabled: true
|
|
672
|
+
},
|
|
669
673
|
typographyProps: {
|
|
670
674
|
style: "h2",
|
|
671
675
|
weight: "semibold"
|
|
672
676
|
}
|
|
673
677
|
}), /*#__PURE__*/React.createElement("span", null, " \u2022 "), /*#__PURE__*/React.createElement(DateFormat.Time, {
|
|
674
678
|
date: createdAt,
|
|
679
|
+
tooltipProps: {
|
|
680
|
+
disabled: true
|
|
681
|
+
},
|
|
675
682
|
typographyProps: {
|
|
676
683
|
style: "h2",
|
|
677
684
|
weight: "normal"
|
|
@@ -696,73 +703,60 @@ var Details = function Details(_ref) {
|
|
|
696
703
|
var buildColumns$1 = function buildColumns(_ref) {
|
|
697
704
|
var handleDetailsClick = _ref.handleDetailsClick;
|
|
698
705
|
return [{
|
|
699
|
-
title: t
|
|
706
|
+
title: t("neetoWebhooks.delivery.identifier", SINGULAR),
|
|
700
707
|
key: "identifier",
|
|
701
|
-
width:
|
|
708
|
+
width: "35%",
|
|
702
709
|
render: function render(_ref2) {
|
|
703
710
|
var identifier = _ref2.identifier,
|
|
704
711
|
redelivery = _ref2.redelivery;
|
|
705
712
|
return /*#__PURE__*/React.createElement("div", {
|
|
706
|
-
className: "flex
|
|
713
|
+
className: "flex items-center gap-x-3"
|
|
707
714
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
708
|
-
className: "px-2",
|
|
709
715
|
style: "body2",
|
|
710
716
|
weight: "semibold"
|
|
711
717
|
}, identifier), redelivery && /*#__PURE__*/React.createElement(Tag, {
|
|
712
718
|
style: "info"
|
|
713
|
-
}, t
|
|
719
|
+
}, t("neetoWebhooks.delivery.redelivery")));
|
|
714
720
|
}
|
|
715
721
|
}, {
|
|
716
|
-
title: t
|
|
722
|
+
title: t("neetoWebhooks.tableHeaders.createdAt"),
|
|
717
723
|
key: "createdAt",
|
|
718
724
|
dataIndex: "createdAt",
|
|
719
|
-
width: 300,
|
|
720
725
|
render: function render(createdAt) {
|
|
721
726
|
return /*#__PURE__*/React.createElement("div", {
|
|
722
727
|
className: "flex items-center justify-between space-x-1"
|
|
723
|
-
}, /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement(DateFormat.
|
|
724
|
-
date: createdAt
|
|
725
|
-
typographyProps: {
|
|
726
|
-
style: "body1",
|
|
727
|
-
weight: "semibold"
|
|
728
|
-
}
|
|
729
|
-
}), /*#__PURE__*/React.createElement("span", null, " \u2022 "), /*#__PURE__*/React.createElement(DateFormat.Time, {
|
|
730
|
-
date: createdAt,
|
|
731
|
-
typographyProps: {
|
|
732
|
-
style: "body1"
|
|
733
|
-
}
|
|
728
|
+
}, /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement(DateFormat.DateTime, {
|
|
729
|
+
date: createdAt
|
|
734
730
|
})));
|
|
735
731
|
}
|
|
736
732
|
}, {
|
|
737
|
-
title: t
|
|
733
|
+
title: t("neetoWebhooks.common.responseStatus"),
|
|
738
734
|
key: "responseStatusCode",
|
|
739
|
-
width:
|
|
735
|
+
width: "15%",
|
|
740
736
|
render: function render(_ref3) {
|
|
741
737
|
var responseStatusCode = _ref3.responseStatusCode,
|
|
742
738
|
status = _ref3.status;
|
|
743
739
|
return /*#__PURE__*/React.createElement("span", {
|
|
744
740
|
className: "flex items-center"
|
|
745
741
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
746
|
-
className: "px-2
|
|
742
|
+
className: "px-2",
|
|
747
743
|
style: "body2"
|
|
748
744
|
}, responseStatusCode), /*#__PURE__*/React.createElement(Tag, {
|
|
749
745
|
style: status === "success" ? "success" : "warning"
|
|
750
746
|
}, status));
|
|
751
747
|
}
|
|
752
748
|
}, {
|
|
753
|
-
title: t
|
|
749
|
+
title: t("neetoWebhooks.common.event", SINGULAR),
|
|
754
750
|
key: "event",
|
|
755
751
|
dataIndex: "event",
|
|
756
|
-
width: 100,
|
|
757
752
|
render: prop("label")
|
|
758
753
|
}, {
|
|
759
|
-
title: t
|
|
754
|
+
title: t("neetoWebhooks.tableHeaders.details"),
|
|
760
755
|
key: "details",
|
|
761
756
|
dataIndex: "details",
|
|
762
|
-
width: 150,
|
|
763
757
|
render: function render(_, delivery) {
|
|
764
758
|
return /*#__PURE__*/React.createElement(Button, {
|
|
765
|
-
label: t
|
|
759
|
+
label: t("neetoWebhooks.buttons.viewDetails"),
|
|
766
760
|
size: "small",
|
|
767
761
|
onClick: function onClick() {
|
|
768
762
|
return handleDetailsClick(delivery);
|
|
@@ -984,43 +978,42 @@ var useFetchEvents = function useFetchEvents() {
|
|
|
984
978
|
|
|
985
979
|
var WEBHOOK_HELP_URL = "https://help.neetocal.com/articles/webhook";
|
|
986
980
|
|
|
987
|
-
var
|
|
988
|
-
|
|
989
|
-
|
|
981
|
+
var MENU_ITEMS = {
|
|
982
|
+
EDIT: "edit",
|
|
983
|
+
DELETE: "delete"
|
|
984
|
+
};
|
|
985
|
+
|
|
986
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
987
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
988
|
+
var getMenuItems = function getMenuItems(_ref) {
|
|
990
989
|
var onEdit = _ref.onEdit,
|
|
991
990
|
onDelete = _ref.onDelete;
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
buttonStyle: "text",
|
|
996
|
-
icon: MenuHorizontal,
|
|
997
|
-
strategy: "fixed"
|
|
998
|
-
}, /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem.Button, {
|
|
991
|
+
return [{
|
|
992
|
+
key: MENU_ITEMS.EDIT,
|
|
993
|
+
label: t("neetoWebhooks.buttons.edit"),
|
|
999
994
|
onClick: onEdit
|
|
1000
|
-
},
|
|
1001
|
-
|
|
995
|
+
}, {
|
|
996
|
+
key: MENU_ITEMS.DELETE,
|
|
997
|
+
label: t("neetoWebhooks.buttons.delete"),
|
|
1002
998
|
onClick: onDelete
|
|
1003
|
-
}
|
|
999
|
+
}];
|
|
1004
1000
|
};
|
|
1005
|
-
|
|
1006
|
-
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1007
|
-
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1008
1001
|
var getValidationSchema = function getValidationSchema(webhooks) {
|
|
1009
1002
|
return yup.object().shape({
|
|
1010
|
-
endpoint: yup.string().trim().matches(/^(https?):\/\//i, t
|
|
1003
|
+
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) {
|
|
1011
1004
|
return !pluck("endpoint", removeById(ctx.parent.id, webhooks)).includes(endpoint === null || endpoint === void 0 ? void 0 : endpoint.trim());
|
|
1012
1005
|
}),
|
|
1013
|
-
events: yup.array().min(1, t
|
|
1006
|
+
events: yup.array().min(1, t("neetoWebhooks.errors.webhook.events.required")),
|
|
1014
1007
|
secret: yup.string().trim().nullable()
|
|
1015
1008
|
});
|
|
1016
1009
|
};
|
|
1017
|
-
var buildPayload = function buildPayload(
|
|
1010
|
+
var buildPayload = function buildPayload(_ref2) {
|
|
1018
1011
|
var _initialValues$events;
|
|
1019
|
-
var isEditing =
|
|
1020
|
-
values =
|
|
1021
|
-
initialValues =
|
|
1022
|
-
var events = values.events.map(function (
|
|
1023
|
-
var identifier =
|
|
1012
|
+
var isEditing = _ref2.isEditing,
|
|
1013
|
+
values = _ref2.values,
|
|
1014
|
+
initialValues = _ref2.initialValues;
|
|
1015
|
+
var events = values.events.map(function (_ref3) {
|
|
1016
|
+
var identifier = _ref3.identifier;
|
|
1024
1017
|
return {
|
|
1025
1018
|
identifier: identifier
|
|
1026
1019
|
};
|
|
@@ -1028,14 +1021,14 @@ var buildPayload = function buildPayload(_ref) {
|
|
|
1028
1021
|
if (!isEditing) return _objectSpread$1(_objectSpread$1({}, values), {}, {
|
|
1029
1022
|
eventsAttributes: events
|
|
1030
1023
|
});
|
|
1031
|
-
var deletable = ((_initialValues$events = initialValues.events) !== null && _initialValues$events !== void 0 ? _initialValues$events : []).filter(function (
|
|
1032
|
-
var identifier =
|
|
1024
|
+
var deletable = ((_initialValues$events = initialValues.events) !== null && _initialValues$events !== void 0 ? _initialValues$events : []).filter(function (_ref4) {
|
|
1025
|
+
var identifier = _ref4.identifier;
|
|
1033
1026
|
return !findBy({
|
|
1034
1027
|
identifier: identifier
|
|
1035
1028
|
}, values.events);
|
|
1036
1029
|
}).map(assoc("_destroy", true));
|
|
1037
|
-
var creatable = values.events.filter(function (
|
|
1038
|
-
var identifier =
|
|
1030
|
+
var creatable = values.events.filter(function (_ref5) {
|
|
1031
|
+
var identifier = _ref5.identifier;
|
|
1039
1032
|
return !findBy({
|
|
1040
1033
|
identifier: identifier
|
|
1041
1034
|
}, initialValues.events);
|
|
@@ -1044,12 +1037,12 @@ var buildPayload = function buildPayload(_ref) {
|
|
|
1044
1037
|
eventsAttributes: [].concat(_toConsumableArray(creatable), _toConsumableArray(deletable))
|
|
1045
1038
|
});
|
|
1046
1039
|
};
|
|
1047
|
-
var buildColumns = function buildColumns(
|
|
1048
|
-
var handleDelete =
|
|
1049
|
-
handleEdit =
|
|
1050
|
-
deliveriesPath =
|
|
1040
|
+
var buildColumns = function buildColumns(_ref6) {
|
|
1041
|
+
var handleDelete = _ref6.handleDelete,
|
|
1042
|
+
handleEdit = _ref6.handleEdit,
|
|
1043
|
+
deliveriesPath = _ref6.deliveriesPath;
|
|
1051
1044
|
return [{
|
|
1052
|
-
title: t
|
|
1045
|
+
title: t("neetoWebhooks.common.endpoint"),
|
|
1053
1046
|
key: "endpoint",
|
|
1054
1047
|
dataIndex: "endpoint",
|
|
1055
1048
|
render: function render(endpoint, webhook) {
|
|
@@ -1060,31 +1053,36 @@ var buildColumns = function buildColumns(_ref5) {
|
|
|
1060
1053
|
to: buildUrl(deliveriesPath, {
|
|
1061
1054
|
webhookId: webhook.id
|
|
1062
1055
|
})
|
|
1063
|
-
}, endpoint), /*#__PURE__*/React.createElement(
|
|
1064
|
-
|
|
1065
|
-
|
|
1056
|
+
}, endpoint), /*#__PURE__*/React.createElement(MoreDropdown, {
|
|
1057
|
+
dropdownProps: {
|
|
1058
|
+
strategy: "fixed"
|
|
1066
1059
|
},
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1060
|
+
menuItems: getMenuItems({
|
|
1061
|
+
onEdit: function onEdit() {
|
|
1062
|
+
return handleEdit(webhook.id);
|
|
1063
|
+
},
|
|
1064
|
+
onDelete: function onDelete() {
|
|
1065
|
+
return handleDelete(webhook.id);
|
|
1066
|
+
}
|
|
1067
|
+
})
|
|
1070
1068
|
}));
|
|
1071
1069
|
}
|
|
1072
1070
|
}, {
|
|
1073
|
-
title: t
|
|
1071
|
+
title: t("neetoWebhooks.webhook.active"),
|
|
1074
1072
|
key: "isActive",
|
|
1075
1073
|
dataIndex: "isActive",
|
|
1076
1074
|
render: function render(isActive) {
|
|
1077
|
-
return isActive ? t
|
|
1075
|
+
return isActive ? t("neetoWebhooks.webhook.activeStatuses.yes") : t("neetoWebhooks.webhook.activeStatuses.no");
|
|
1078
1076
|
},
|
|
1079
1077
|
width: 100
|
|
1080
1078
|
}, {
|
|
1081
|
-
title: t
|
|
1079
|
+
title: t("neetoWebhooks.common.event", PLURAL),
|
|
1082
1080
|
dataIndex: "events",
|
|
1083
1081
|
key: "events",
|
|
1084
1082
|
render: function render(events) {
|
|
1085
1083
|
return pluck("label", events).sort().join(", ");
|
|
1086
1084
|
},
|
|
1087
|
-
width:
|
|
1085
|
+
width: 400
|
|
1088
1086
|
}];
|
|
1089
1087
|
};
|
|
1090
1088
|
|
|
@@ -1246,7 +1244,7 @@ var Header = function Header(_ref) {
|
|
|
1246
1244
|
}
|
|
1247
1245
|
})
|
|
1248
1246
|
}), /*#__PURE__*/React.createElement(Typography, {
|
|
1249
|
-
className: "
|
|
1247
|
+
className: "mb-3",
|
|
1250
1248
|
"data-cy": "webhook-description-header",
|
|
1251
1249
|
style: "h5",
|
|
1252
1250
|
weight: "normal"
|
|
@@ -1400,10 +1398,5 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
1400
1398
|
}));
|
|
1401
1399
|
};
|
|
1402
1400
|
|
|
1403
|
-
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}}
|
|
1404
|
-
|
|
1405
|
-
var css = ".deliveries__list,.webhooks__list{height:calc(100vh - 200px);overflow-y:auto}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL193ZWJob29rLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvbWFpbi5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGtDQUNFLDBCQUFBLENBQ0EsZUNNRiIsInNvdXJjZXNDb250ZW50IjpbIi53ZWJob29rc19fbGlzdCB7XG4gIGhlaWdodDogY2FsYygxMDB2aCAtIDIwMHB4KTtcbiAgb3ZlcmZsb3cteTogYXV0bztcbn1cbiIsIi5kZWxpdmVyaWVzX19saXN0IHtcbiAgaGVpZ2h0OiBjYWxjKDEwMHZoIC0gMjAwcHgpO1xuICBvdmVyZmxvdy15OiBhdXRvO1xufVxuXG4ud2ViaG9va3NfX2xpc3Qge1xuICBoZWlnaHQ6IGNhbGMoMTAwdmggLSAyMDBweCk7XG4gIG92ZXJmbG93LXk6IGF1dG87XG59Il19 */";
|
|
1406
|
-
n(css,{});
|
|
1407
|
-
|
|
1408
1401
|
export { NeetoWebhooks };
|
|
1409
1402
|
//# sourceMappingURL=index.js.map
|