@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
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ The engine is used to manage webhooks across neeto products.
|
|
|
47
47
|
4. Run the following command to copy the migrations from the engine to the host
|
|
48
48
|
application:
|
|
49
49
|
```zsh
|
|
50
|
-
|
|
50
|
+
rails g neeto_webhooks_engine:install
|
|
51
51
|
```
|
|
52
52
|
5. Add the migrations to the database:
|
|
53
53
|
```zsh
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
"event_one": "Event",
|
|
5
5
|
"event_other": "Events",
|
|
6
6
|
"endpoint": "Endpoint",
|
|
7
|
-
"responseStatus": "Response status"
|
|
7
|
+
"responseStatus": "Response status",
|
|
8
|
+
"webhookWithCount": "{{count}} Webhook",
|
|
9
|
+
"webhookWithCount_other": "{{count}} Webhooks"
|
|
8
10
|
},
|
|
9
11
|
"entity": {
|
|
10
12
|
"webhook": "webhook",
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
"edit": "Edit",
|
|
18
20
|
"viewDetails": "View details",
|
|
19
21
|
"regenerate": "Regenerate",
|
|
20
|
-
"
|
|
22
|
+
"generateSecretKey": "Generate secret key"
|
|
21
23
|
},
|
|
22
24
|
"errors": {
|
|
23
25
|
"webhook": {
|
|
@@ -62,14 +64,15 @@
|
|
|
62
64
|
"secret": "Secret key (optional)",
|
|
63
65
|
"secretkeyHelpTitle": "Securing webhook requests",
|
|
64
66
|
"secretkeyHelpDescription": "Adding a secret key will help you to verify that the webhook request was actually sent from neeto.",
|
|
65
|
-
|
|
66
67
|
"secretPlaceholder": "Enter secret key",
|
|
67
68
|
"edit": "Edit Webhook",
|
|
68
69
|
"active": "Active",
|
|
69
70
|
"activeStatuses": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
}
|
|
71
|
+
"active": "Active",
|
|
72
|
+
"inactive": "Inactive"
|
|
73
|
+
},
|
|
74
|
+
"statusActiveHelpDescription": "The webhook is currently active. Toggle to make it inactive.",
|
|
75
|
+
"statusInactiveHelpDescription": "The webhook is currently inactive. Toggle to make it active."
|
|
73
76
|
},
|
|
74
77
|
"operation": {
|
|
75
78
|
"edit": "Edit",
|
package/dist/NeetoWebhooks.js
CHANGED
|
@@ -3,6 +3,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
3
3
|
import { isPresent, removeBy, isNotEmpty, removeById, findBy } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { DEFAULT_STALE_TIME, SINGULAR, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
|
|
5
5
|
import { useQueryParams, useMutationWithInvalidation, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
6
7
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
7
8
|
import Header$2 from '@bigbinary/neeto-molecules/Header';
|
|
8
9
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
@@ -28,7 +29,6 @@ import Typography from '@bigbinary/neetoui/Typography';
|
|
|
28
29
|
import Tab from '@bigbinary/neetoui/Tab';
|
|
29
30
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
30
31
|
import { t as t$1 } from 'i18next';
|
|
31
|
-
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
32
32
|
import { prop, pluck, assoc } from 'ramda';
|
|
33
33
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
34
34
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
@@ -40,6 +40,7 @@ import Select from '@bigbinary/neetoui/formik/Select';
|
|
|
40
40
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
41
41
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
42
42
|
import * as yup from 'yup';
|
|
43
|
+
import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
|
|
43
44
|
|
|
44
45
|
var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
|
|
45
46
|
return "".concat(webhooksPath, "/:webhookId/deliveries");
|
|
@@ -358,7 +359,8 @@ var Details = function Details(_ref) {
|
|
|
358
359
|
};
|
|
359
360
|
|
|
360
361
|
var buildColumns$1 = function buildColumns(_ref) {
|
|
361
|
-
var deliveryDetailsPath = _ref.deliveryDetailsPath
|
|
362
|
+
var deliveryDetailsPath = _ref.deliveryDetailsPath,
|
|
363
|
+
page = _ref.page;
|
|
362
364
|
return [{
|
|
363
365
|
title: t$1("neetoWebhooks.delivery.deliveryId"),
|
|
364
366
|
key: "identifier",
|
|
@@ -370,7 +372,8 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
370
372
|
children: [/*#__PURE__*/jsx(Button, {
|
|
371
373
|
style: "link",
|
|
372
374
|
to: buildUrl(deliveryDetailsPath, {
|
|
373
|
-
deliveryId: delivery.sid
|
|
375
|
+
deliveryId: delivery.sid,
|
|
376
|
+
page: page
|
|
374
377
|
}),
|
|
375
378
|
weight: "semibold",
|
|
376
379
|
children: delivery.identifier
|
|
@@ -437,6 +440,7 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
437
440
|
var _useQueryParams = useQueryParams(),
|
|
438
441
|
_useQueryParams$page = _useQueryParams.page,
|
|
439
442
|
page = _useQueryParams$page === void 0 ? DEFAULT_PAGE_INDEX : _useQueryParams$page;
|
|
443
|
+
var deliveriesPath = getDeliveriesPath(webhooksUrl);
|
|
440
444
|
var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesUrl);
|
|
441
445
|
var _useFetchDeliveries = useFetchDeliveries(webhookId, {
|
|
442
446
|
page: page,
|
|
@@ -486,7 +490,8 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
486
490
|
totalCount: totalCount,
|
|
487
491
|
fixedHeight: true,
|
|
488
492
|
columnData: buildColumns$1({
|
|
489
|
-
deliveryDetailsPath: deliveryDetailsPath
|
|
493
|
+
deliveryDetailsPath: deliveryDetailsPath,
|
|
494
|
+
page: page
|
|
490
495
|
}),
|
|
491
496
|
currentPageNumber: page,
|
|
492
497
|
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
@@ -503,7 +508,10 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
503
508
|
deliveryId: deliveryId,
|
|
504
509
|
webhookSid: webhookId,
|
|
505
510
|
onClose: function onClose() {
|
|
506
|
-
return history.
|
|
511
|
+
return history.replace(buildUrl(deliveriesPath, {
|
|
512
|
+
webhookId: webhookId,
|
|
513
|
+
page: page
|
|
514
|
+
}));
|
|
507
515
|
}
|
|
508
516
|
})]
|
|
509
517
|
});
|
|
@@ -554,7 +562,7 @@ var useCreateWebhook = function useCreateWebhook(options) {
|
|
|
554
562
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
555
563
|
onSuccess: function onSuccess() {
|
|
556
564
|
var _options$onSuccess;
|
|
557
|
-
options === null || options === void 0
|
|
565
|
+
options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
|
|
558
566
|
}
|
|
559
567
|
});
|
|
560
568
|
};
|
|
@@ -577,7 +585,7 @@ var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
|
577
585
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
|
|
578
586
|
onSuccess: function onSuccess() {
|
|
579
587
|
var _options$onSuccess2;
|
|
580
|
-
options === null || options === void 0
|
|
588
|
+
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
581
589
|
}
|
|
582
590
|
});
|
|
583
591
|
};
|
|
@@ -586,7 +594,7 @@ var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
|
586
594
|
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST]],
|
|
587
595
|
onSuccess: function onSuccess() {
|
|
588
596
|
var _options$onSuccess3;
|
|
589
|
-
options === null || options === void 0
|
|
597
|
+
options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
|
|
590
598
|
}
|
|
591
599
|
});
|
|
592
600
|
};
|
|
@@ -738,7 +746,7 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
738
746
|
title: t$1("neetoWebhooks.common.endpoint"),
|
|
739
747
|
key: "endpoint",
|
|
740
748
|
dataIndex: "endpoint",
|
|
741
|
-
width:
|
|
749
|
+
width: 700,
|
|
742
750
|
render: function render(endpoint, webhook) {
|
|
743
751
|
return /*#__PURE__*/jsxs("div", {
|
|
744
752
|
className: "flex items-center justify-between space-x-3",
|
|
@@ -768,16 +776,23 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
768
776
|
key: "isActive",
|
|
769
777
|
dataIndex: "isActive",
|
|
770
778
|
render: function render(isActive) {
|
|
771
|
-
return isActive ?
|
|
779
|
+
return isActive ? /*#__PURE__*/jsx(Tag, {
|
|
780
|
+
label: t$1("neetoWebhooks.webhook.activeStatuses.active"),
|
|
781
|
+
style: "primary"
|
|
782
|
+
}) : /*#__PURE__*/jsx(Tag, {
|
|
783
|
+
label: t$1("neetoWebhooks.webhook.activeStatuses.inactive"),
|
|
784
|
+
style: "danger"
|
|
785
|
+
});
|
|
772
786
|
},
|
|
773
|
-
width:
|
|
787
|
+
width: 150
|
|
774
788
|
}, {
|
|
775
789
|
title: t$1("neetoWebhooks.common.event", PLURAL),
|
|
776
790
|
dataIndex: "events",
|
|
777
791
|
key: "events",
|
|
778
792
|
render: function render(events) {
|
|
779
793
|
return pluck("label", events).sort().join(", ");
|
|
780
|
-
}
|
|
794
|
+
},
|
|
795
|
+
width: 300
|
|
781
796
|
}];
|
|
782
797
|
};
|
|
783
798
|
var generateRandomSecret = function generateRandomSecret() {
|
|
@@ -803,7 +818,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
803
818
|
var _useCreateWebhook = useCreateWebhook({
|
|
804
819
|
onSuccess: function onSuccess() {
|
|
805
820
|
onClose();
|
|
806
|
-
onCreate === null || onCreate === void 0
|
|
821
|
+
onCreate === null || onCreate === void 0 || onCreate();
|
|
807
822
|
}
|
|
808
823
|
}),
|
|
809
824
|
createWebhook = _useCreateWebhook.mutate;
|
|
@@ -887,14 +902,16 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
887
902
|
}
|
|
888
903
|
},
|
|
889
904
|
children: function children(_ref2) {
|
|
890
|
-
var setFieldValue = _ref2.setFieldValue
|
|
905
|
+
var setFieldValue = _ref2.setFieldValue,
|
|
906
|
+
values = _ref2.values;
|
|
891
907
|
return isLoading ? /*#__PURE__*/jsx("div", {
|
|
892
908
|
className: "flex items-center justify-center",
|
|
893
909
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
894
910
|
}) : /*#__PURE__*/jsxs(Fragment, {
|
|
895
911
|
children: [/*#__PURE__*/jsx(Pane.Body, {
|
|
912
|
+
className: "pb-6",
|
|
896
913
|
children: /*#__PURE__*/jsxs("div", {
|
|
897
|
-
className: "w-full space-y-4",
|
|
914
|
+
className: "w-full space-y-4 md:space-y-6",
|
|
898
915
|
children: [/*#__PURE__*/jsx(Textarea, {
|
|
899
916
|
required: true,
|
|
900
917
|
"data-cy": "endpoint-input-field",
|
|
@@ -912,25 +929,27 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
912
929
|
name: "events",
|
|
913
930
|
options: events,
|
|
914
931
|
placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
|
|
915
|
-
}),
|
|
916
|
-
className: "
|
|
917
|
-
children: [/*#__PURE__*/
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
932
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
933
|
+
className: "space-y-2",
|
|
934
|
+
children: [/*#__PURE__*/jsxs("span", {
|
|
935
|
+
className: "flex items-center gap-x-2",
|
|
936
|
+
children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
|
|
937
|
+
helpLinkProps: {
|
|
938
|
+
href: HELP_LINK_URLS.secrets
|
|
939
|
+
},
|
|
940
|
+
popoverProps: {
|
|
941
|
+
position: "bottom"
|
|
942
|
+
},
|
|
943
|
+
title: t("neetoWebhooks.webhook.secretkeyHelpTitle"),
|
|
944
|
+
description: t("neetoWebhooks.webhook.secretkeyHelpDescription")
|
|
945
|
+
})]
|
|
946
|
+
}), isSecretInputFieldVisible ? /*#__PURE__*/jsxs("div", {
|
|
947
|
+
className: "flex items-center justify-between space-x-2",
|
|
948
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
949
|
+
"data-cy": "secret-key-input-field",
|
|
950
|
+
name: "secret",
|
|
951
|
+
placeholder: t("neetoWebhooks.webhook.secretPlaceholder")
|
|
952
|
+
}), /*#__PURE__*/jsx(MoreDropdown, {
|
|
934
953
|
menuItems: [{
|
|
935
954
|
key: "regenerate-secret",
|
|
936
955
|
label: t("neetoWebhooks.buttons.regenerate"),
|
|
@@ -946,19 +965,28 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
946
965
|
return handleDelete(setFieldValue);
|
|
947
966
|
}
|
|
948
967
|
}]
|
|
949
|
-
})
|
|
968
|
+
})]
|
|
969
|
+
}) : /*#__PURE__*/jsx(Button, {
|
|
970
|
+
"data-cy": "add-secret-key",
|
|
971
|
+
icon: Plus,
|
|
972
|
+
iconPosition: "left",
|
|
973
|
+
label: t("neetoWebhooks.buttons.generateSecretKey"),
|
|
974
|
+
style: "link",
|
|
975
|
+
onClick: function onClick() {
|
|
976
|
+
return handleClick(setFieldValue);
|
|
977
|
+
}
|
|
978
|
+
})]
|
|
979
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
980
|
+
className: "flex gap-2",
|
|
981
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
982
|
+
label: t("neetoWebhooks.webhook.active"),
|
|
983
|
+
name: "isActive"
|
|
984
|
+
}), /*#__PURE__*/jsx(HelpPopover, {
|
|
985
|
+
popoverProps: {
|
|
986
|
+
position: "bottom"
|
|
987
|
+
},
|
|
988
|
+
description: values.isActive ? t("neetoWebhooks.webhook.statusActiveHelpDescription") : t("neetoWebhooks.webhook.statusInactiveHelpDescription")
|
|
950
989
|
})]
|
|
951
|
-
}), /*#__PURE__*/jsx(Switch, {
|
|
952
|
-
label: t("neetoWebhooks.webhook.active"),
|
|
953
|
-
name: "isActive"
|
|
954
|
-
}), !isSecretInputFieldVisible && /*#__PURE__*/jsx(Button, {
|
|
955
|
-
"data-cy": "add-secret-key",
|
|
956
|
-
icon: Plus,
|
|
957
|
-
label: t("neetoWebhooks.buttons.addSecretKey"),
|
|
958
|
-
style: "text",
|
|
959
|
-
onClick: function onClick() {
|
|
960
|
-
return handleClick(setFieldValue);
|
|
961
|
-
}
|
|
962
990
|
})]
|
|
963
991
|
})
|
|
964
992
|
}), /*#__PURE__*/jsx(Pane.Footer, {
|
|
@@ -979,7 +1007,8 @@ var Header = withT(function (_ref) {
|
|
|
979
1007
|
breadcrumbs = _ref.breadcrumbs,
|
|
980
1008
|
title = _ref.title,
|
|
981
1009
|
setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
|
|
982
|
-
headerSize = _ref.headerSize
|
|
1010
|
+
headerSize = _ref.headerSize,
|
|
1011
|
+
webhooks = _ref.webhooks;
|
|
983
1012
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
984
1013
|
children: [/*#__PURE__*/jsx(Header$2, {
|
|
985
1014
|
breadcrumbs: breadcrumbs,
|
|
@@ -1001,12 +1030,14 @@ var Header = withT(function (_ref) {
|
|
|
1001
1030
|
title: t("neetoWebhooks.webhook.title")
|
|
1002
1031
|
})]
|
|
1003
1032
|
})
|
|
1004
|
-
}), /*#__PURE__*/jsx(
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1033
|
+
}), isNotEmpty(webhooks) && /*#__PURE__*/jsx(SubHeader, {
|
|
1034
|
+
leftActionBlock: /*#__PURE__*/jsx(Typography, {
|
|
1035
|
+
component: "h4",
|
|
1036
|
+
style: "h4",
|
|
1037
|
+
children: t("neetoWebhooks.common.webhookWithCount", {
|
|
1038
|
+
count: webhooks.length
|
|
1039
|
+
})
|
|
1040
|
+
})
|
|
1010
1041
|
})]
|
|
1011
1042
|
});
|
|
1012
1043
|
});
|
|
@@ -1060,7 +1091,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1060
1091
|
var _useDestroyWebhook = useDestroyWebhook({
|
|
1061
1092
|
onSuccess: function onSuccess() {
|
|
1062
1093
|
setIsDeleteAlertOpen(false);
|
|
1063
|
-
onDelete === null || onDelete === void 0
|
|
1094
|
+
onDelete === null || onDelete === void 0 || onDelete();
|
|
1064
1095
|
}
|
|
1065
1096
|
}),
|
|
1066
1097
|
isDeleting = _useDestroyWebhook.isPending,
|
|
@@ -1089,7 +1120,8 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1089
1120
|
breadcrumbs: breadcrumbs,
|
|
1090
1121
|
headerSize: headerSize,
|
|
1091
1122
|
setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
|
|
1092
|
-
title: title
|
|
1123
|
+
title: title,
|
|
1124
|
+
webhooks: webhooks
|
|
1093
1125
|
}), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
|
|
1094
1126
|
hasPagination: totalCount > DEFAULT_PAGE_SIZE,
|
|
1095
1127
|
children: /*#__PURE__*/jsx(Table, {
|