@bigbinary/neeto-webhooks-frontend 2.2.3 → 2.2.5
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 +1 -1
- package/app/javascript/src/translations/en.json +9 -6
- package/dist/NeetoWebhooks.js +87 -55
- package/dist/NeetoWebhooks.js.map +1 -1
- package/dist/cjs/NeetoWebhooks.js +87 -55
- package/dist/cjs/NeetoWebhooks.js.map +1 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +54 -51
|
@@ -5,6 +5,7 @@ var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
|
5
5
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
6
6
|
var constants = require('@bigbinary/neeto-commons-frontend/constants');
|
|
7
7
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
8
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
8
9
|
var Container = require('@bigbinary/neeto-molecules/Container');
|
|
9
10
|
var Header$2 = require('@bigbinary/neeto-molecules/Header');
|
|
10
11
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
@@ -30,7 +31,6 @@ var Typography = require('@bigbinary/neetoui/Typography');
|
|
|
30
31
|
var Tab = require('@bigbinary/neetoui/Tab');
|
|
31
32
|
var Tag = require('@bigbinary/neetoui/Tag');
|
|
32
33
|
var i18next = require('i18next');
|
|
33
|
-
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
34
34
|
var ramda = require('ramda');
|
|
35
35
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
36
36
|
var Plus = require('@bigbinary/neeto-icons/Plus');
|
|
@@ -42,6 +42,7 @@ var Select = require('@bigbinary/neetoui/formik/Select');
|
|
|
42
42
|
var Switch = require('@bigbinary/neetoui/formik/Switch');
|
|
43
43
|
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
44
44
|
var yup = require('yup');
|
|
45
|
+
var SubHeader = require('@bigbinary/neeto-molecules/SubHeader');
|
|
45
46
|
|
|
46
47
|
function _interopNamespaceDefault(e) {
|
|
47
48
|
var n = Object.create(null);
|
|
@@ -379,7 +380,8 @@ var Details = function Details(_ref) {
|
|
|
379
380
|
};
|
|
380
381
|
|
|
381
382
|
var buildColumns$1 = function buildColumns(_ref) {
|
|
382
|
-
var deliveryDetailsPath = _ref.deliveryDetailsPath
|
|
383
|
+
var deliveryDetailsPath = _ref.deliveryDetailsPath,
|
|
384
|
+
page = _ref.page;
|
|
383
385
|
return [{
|
|
384
386
|
title: i18next.t("neetoWebhooks.delivery.deliveryId"),
|
|
385
387
|
key: "identifier",
|
|
@@ -391,7 +393,8 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
391
393
|
children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
392
394
|
style: "link",
|
|
393
395
|
to: utils.buildUrl(deliveryDetailsPath, {
|
|
394
|
-
deliveryId: delivery.sid
|
|
396
|
+
deliveryId: delivery.sid,
|
|
397
|
+
page: page
|
|
395
398
|
}),
|
|
396
399
|
weight: "semibold",
|
|
397
400
|
children: delivery.identifier
|
|
@@ -458,6 +461,7 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
458
461
|
var _useQueryParams = reactUtils.useQueryParams(),
|
|
459
462
|
_useQueryParams$page = _useQueryParams.page,
|
|
460
463
|
page = _useQueryParams$page === void 0 ? constants.DEFAULT_PAGE_INDEX : _useQueryParams$page;
|
|
464
|
+
var deliveriesPath = getDeliveriesPath(webhooksUrl);
|
|
461
465
|
var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesUrl);
|
|
462
466
|
var _useFetchDeliveries = useFetchDeliveries(webhookId, {
|
|
463
467
|
page: page,
|
|
@@ -507,7 +511,8 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
507
511
|
totalCount: totalCount,
|
|
508
512
|
fixedHeight: true,
|
|
509
513
|
columnData: buildColumns$1({
|
|
510
|
-
deliveryDetailsPath: deliveryDetailsPath
|
|
514
|
+
deliveryDetailsPath: deliveryDetailsPath,
|
|
515
|
+
page: page
|
|
511
516
|
}),
|
|
512
517
|
currentPageNumber: page,
|
|
513
518
|
defaultPageSize: constants.DEFAULT_PAGE_SIZE,
|
|
@@ -524,7 +529,10 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
524
529
|
deliveryId: deliveryId,
|
|
525
530
|
webhookSid: webhookId,
|
|
526
531
|
onClose: function onClose() {
|
|
527
|
-
return history.
|
|
532
|
+
return history.replace(utils.buildUrl(deliveriesPath, {
|
|
533
|
+
webhookId: webhookId,
|
|
534
|
+
page: page
|
|
535
|
+
}));
|
|
528
536
|
}
|
|
529
537
|
})]
|
|
530
538
|
});
|
|
@@ -575,7 +583,7 @@ var useCreateWebhook = function useCreateWebhook(options) {
|
|
|
575
583
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
576
584
|
onSuccess: function onSuccess() {
|
|
577
585
|
var _options$onSuccess;
|
|
578
|
-
options === null || options === void 0
|
|
586
|
+
options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
|
|
579
587
|
}
|
|
580
588
|
});
|
|
581
589
|
};
|
|
@@ -598,7 +606,7 @@ var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
|
598
606
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
|
|
599
607
|
onSuccess: function onSuccess() {
|
|
600
608
|
var _options$onSuccess2;
|
|
601
|
-
options === null || options === void 0
|
|
609
|
+
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
602
610
|
}
|
|
603
611
|
});
|
|
604
612
|
};
|
|
@@ -607,7 +615,7 @@ var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
|
607
615
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
608
616
|
onSuccess: function onSuccess() {
|
|
609
617
|
var _options$onSuccess3;
|
|
610
|
-
options === null || options === void 0
|
|
618
|
+
options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
|
|
611
619
|
}
|
|
612
620
|
});
|
|
613
621
|
};
|
|
@@ -759,7 +767,7 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
759
767
|
title: i18next.t("neetoWebhooks.common.endpoint"),
|
|
760
768
|
key: "endpoint",
|
|
761
769
|
dataIndex: "endpoint",
|
|
762
|
-
width:
|
|
770
|
+
width: 700,
|
|
763
771
|
render: function render(endpoint, webhook) {
|
|
764
772
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
765
773
|
className: "flex items-center justify-between space-x-3",
|
|
@@ -789,16 +797,23 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
789
797
|
key: "isActive",
|
|
790
798
|
dataIndex: "isActive",
|
|
791
799
|
render: function render(isActive) {
|
|
792
|
-
return isActive ?
|
|
800
|
+
return isActive ? /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
801
|
+
label: i18next.t("neetoWebhooks.webhook.activeStatuses.active"),
|
|
802
|
+
style: "primary"
|
|
803
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
804
|
+
label: i18next.t("neetoWebhooks.webhook.activeStatuses.inactive"),
|
|
805
|
+
style: "danger"
|
|
806
|
+
});
|
|
793
807
|
},
|
|
794
|
-
width:
|
|
808
|
+
width: 150
|
|
795
809
|
}, {
|
|
796
810
|
title: i18next.t("neetoWebhooks.common.event", constants.PLURAL),
|
|
797
811
|
dataIndex: "events",
|
|
798
812
|
key: "events",
|
|
799
813
|
render: function render(events) {
|
|
800
814
|
return ramda.pluck("label", events).sort().join(", ");
|
|
801
|
-
}
|
|
815
|
+
},
|
|
816
|
+
width: 300
|
|
802
817
|
}];
|
|
803
818
|
};
|
|
804
819
|
var generateRandomSecret = function generateRandomSecret() {
|
|
@@ -824,7 +839,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
824
839
|
var _useCreateWebhook = useCreateWebhook({
|
|
825
840
|
onSuccess: function onSuccess() {
|
|
826
841
|
onClose();
|
|
827
|
-
onCreate === null || onCreate === void 0
|
|
842
|
+
onCreate === null || onCreate === void 0 || onCreate();
|
|
828
843
|
}
|
|
829
844
|
}),
|
|
830
845
|
createWebhook = _useCreateWebhook.mutate;
|
|
@@ -908,14 +923,16 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
908
923
|
}
|
|
909
924
|
},
|
|
910
925
|
children: function children(_ref2) {
|
|
911
|
-
var setFieldValue = _ref2.setFieldValue
|
|
926
|
+
var setFieldValue = _ref2.setFieldValue,
|
|
927
|
+
values = _ref2.values;
|
|
912
928
|
return isLoading ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
913
929
|
className: "flex items-center justify-center",
|
|
914
930
|
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
915
931
|
}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
916
932
|
children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Body, {
|
|
933
|
+
className: "pb-6",
|
|
917
934
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
918
|
-
className: "w-full space-y-4",
|
|
935
|
+
className: "w-full space-y-4 md:space-y-6",
|
|
919
936
|
children: [/*#__PURE__*/jsxRuntime.jsx(Textarea, {
|
|
920
937
|
required: true,
|
|
921
938
|
"data-cy": "endpoint-input-field",
|
|
@@ -933,25 +950,27 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
933
950
|
name: "events",
|
|
934
951
|
options: events,
|
|
935
952
|
placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
|
|
936
|
-
}),
|
|
937
|
-
className: "
|
|
938
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
953
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
954
|
+
className: "space-y-2",
|
|
955
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
956
|
+
className: "flex items-center gap-x-2",
|
|
957
|
+
children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
|
|
958
|
+
helpLinkProps: {
|
|
959
|
+
href: HELP_LINK_URLS.secrets
|
|
960
|
+
},
|
|
961
|
+
popoverProps: {
|
|
962
|
+
position: "bottom"
|
|
963
|
+
},
|
|
964
|
+
title: t("neetoWebhooks.webhook.secretkeyHelpTitle"),
|
|
965
|
+
description: t("neetoWebhooks.webhook.secretkeyHelpDescription")
|
|
966
|
+
})]
|
|
967
|
+
}), isSecretInputFieldVisible ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
968
|
+
className: "flex items-center justify-between space-x-2",
|
|
969
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
970
|
+
"data-cy": "secret-key-input-field",
|
|
971
|
+
name: "secret",
|
|
972
|
+
placeholder: t("neetoWebhooks.webhook.secretPlaceholder")
|
|
973
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
|
|
955
974
|
menuItems: [{
|
|
956
975
|
key: "regenerate-secret",
|
|
957
976
|
label: t("neetoWebhooks.buttons.regenerate"),
|
|
@@ -967,19 +986,28 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
967
986
|
return handleDelete(setFieldValue);
|
|
968
987
|
}
|
|
969
988
|
}]
|
|
970
|
-
})
|
|
989
|
+
})]
|
|
990
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
991
|
+
"data-cy": "add-secret-key",
|
|
992
|
+
icon: Plus,
|
|
993
|
+
iconPosition: "left",
|
|
994
|
+
label: t("neetoWebhooks.buttons.generateSecretKey"),
|
|
995
|
+
style: "link",
|
|
996
|
+
onClick: function onClick() {
|
|
997
|
+
return handleClick(setFieldValue);
|
|
998
|
+
}
|
|
999
|
+
})]
|
|
1000
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1001
|
+
className: "flex gap-2",
|
|
1002
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1003
|
+
label: t("neetoWebhooks.webhook.active"),
|
|
1004
|
+
name: "isActive"
|
|
1005
|
+
}), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
|
|
1006
|
+
popoverProps: {
|
|
1007
|
+
position: "bottom"
|
|
1008
|
+
},
|
|
1009
|
+
description: values.isActive ? t("neetoWebhooks.webhook.statusActiveHelpDescription") : t("neetoWebhooks.webhook.statusInactiveHelpDescription")
|
|
971
1010
|
})]
|
|
972
|
-
}), /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
973
|
-
label: t("neetoWebhooks.webhook.active"),
|
|
974
|
-
name: "isActive"
|
|
975
|
-
}), !isSecretInputFieldVisible && /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
976
|
-
"data-cy": "add-secret-key",
|
|
977
|
-
icon: Plus,
|
|
978
|
-
label: t("neetoWebhooks.buttons.addSecretKey"),
|
|
979
|
-
style: "text",
|
|
980
|
-
onClick: function onClick() {
|
|
981
|
-
return handleClick(setFieldValue);
|
|
982
|
-
}
|
|
983
1011
|
})]
|
|
984
1012
|
})
|
|
985
1013
|
}), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
|
|
@@ -1000,7 +1028,8 @@ var Header = reactUtils.withT(function (_ref) {
|
|
|
1000
1028
|
breadcrumbs = _ref.breadcrumbs,
|
|
1001
1029
|
title = _ref.title,
|
|
1002
1030
|
setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
|
|
1003
|
-
headerSize = _ref.headerSize
|
|
1031
|
+
headerSize = _ref.headerSize,
|
|
1032
|
+
webhooks = _ref.webhooks;
|
|
1004
1033
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1005
1034
|
children: [/*#__PURE__*/jsxRuntime.jsx(Header$2, {
|
|
1006
1035
|
breadcrumbs: breadcrumbs,
|
|
@@ -1022,12 +1051,14 @@ var Header = reactUtils.withT(function (_ref) {
|
|
|
1022
1051
|
title: t("neetoWebhooks.webhook.title")
|
|
1023
1052
|
})]
|
|
1024
1053
|
})
|
|
1025
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1054
|
+
}), neetoCist.isNotEmpty(webhooks) && /*#__PURE__*/jsxRuntime.jsx(SubHeader, {
|
|
1055
|
+
leftActionBlock: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1056
|
+
component: "h4",
|
|
1057
|
+
style: "h4",
|
|
1058
|
+
children: t("neetoWebhooks.common.webhookWithCount", {
|
|
1059
|
+
count: webhooks.length
|
|
1060
|
+
})
|
|
1061
|
+
})
|
|
1031
1062
|
})]
|
|
1032
1063
|
});
|
|
1033
1064
|
});
|
|
@@ -1081,7 +1112,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1081
1112
|
var _useDestroyWebhook = useDestroyWebhook({
|
|
1082
1113
|
onSuccess: function onSuccess() {
|
|
1083
1114
|
setIsDeleteAlertOpen(false);
|
|
1084
|
-
onDelete === null || onDelete === void 0
|
|
1115
|
+
onDelete === null || onDelete === void 0 || onDelete();
|
|
1085
1116
|
}
|
|
1086
1117
|
}),
|
|
1087
1118
|
isDeleting = _useDestroyWebhook.isPending,
|
|
@@ -1110,7 +1141,8 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1110
1141
|
breadcrumbs: breadcrumbs,
|
|
1111
1142
|
headerSize: headerSize,
|
|
1112
1143
|
setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
|
|
1113
|
-
title: title
|
|
1144
|
+
title: title,
|
|
1145
|
+
webhooks: webhooks
|
|
1114
1146
|
}), neetoCist.isNotEmpty(webhooks) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
|
|
1115
1147
|
hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
|
|
1116
1148
|
children: /*#__PURE__*/jsxRuntime.jsx(Table, {
|