@bigbinary/neeto-webhooks-frontend 2.2.8 → 2.2.10

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 CHANGED
@@ -116,6 +116,10 @@ This component is used to manage webhooks in your web application.
116
116
  ##### Optional Props
117
117
 
118
118
  - `breadcrumbs`: An array of objects that specify breadcrumbs for navigation.
119
+ - `helpLinkUrls`: An object that specifies the URLs for the help links.
120
+ - `webhooks`: The URL for the webhooks help link.
121
+ - `secrets`: The URL for the secrets help link.
122
+ - `deliveries`: The URL for the deliveries help link.
119
123
 
120
124
  ##### Usage
121
125
 
@@ -144,6 +148,14 @@ const Main = () => (
144
148
  },
145
149
  { text: "Webhook" },
146
150
  ]}
151
+ helpLinkUrls={{
152
+ webhooks:
153
+ "https://help.neetokb.com/articles/creating-a-webhook",
154
+ secrets:
155
+ "https://help.neetokb.com/articles/securing-webhook-requests",
156
+ deliveries:
157
+ "https://help.neetokb.com/articles/managing-webhook-deliveries",
158
+ }}
147
159
  />
148
160
  )}
149
161
  />
@@ -1,4 +1,6 @@
1
+ import { prop, pluck, assoc, mergeRight } from 'ramda';
1
2
  import { useRouteMatch, useHistory, useParams, Switch as Switch$1, Route } from 'react-router-dom';
3
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
2
4
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
5
  import { isPresent, removeBy, isNotEmpty, removeById, findBy } from '@bigbinary/neeto-cist';
4
6
  import { DEFAULT_STALE_TIME, SINGULAR, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
@@ -16,7 +18,6 @@ import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient,
16
18
  import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
17
19
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
18
20
  import axios from 'axios';
19
- import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
20
21
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
21
22
  import _regeneratorRuntime from '@babel/runtime/regenerator';
22
23
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
@@ -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 { prop, pluck, assoc } from 'ramda';
32
32
  import Alert from '@bigbinary/neetoui/Alert';
33
33
  import Plus from '@bigbinary/neeto-icons/Plus';
34
34
  import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
@@ -42,6 +42,12 @@ import Textarea from '@bigbinary/neetoui/formik/Textarea';
42
42
  import * as yup from 'yup';
43
43
  import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
44
44
 
45
+ var HELP_LINK_URLS = {
46
+ webhooks: "https://help.".concat(globalProps.appName, ".com/articles/creating-a-webhook"),
47
+ secrets: "https://help.".concat(globalProps.appName, ".com/articles/securing-webhook-requests"),
48
+ deliveries: "https://help.".concat(globalProps.appName, ".com/articles/managing-webhook-deliveries")
49
+ };
50
+
45
51
  var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
46
52
  return "".concat(webhooksPath, "/:webhookId/deliveries");
47
53
  };
@@ -137,12 +143,6 @@ var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
137
143
  });
138
144
  };
139
145
 
140
- var HELP_LINK_URLS = {
141
- webhook: "https://help.".concat(globalProps.appName, ".com/articles/creating-a-webhook"),
142
- secrets: "https://help.".concat(globalProps.appName, ".com/articles/securing-webhook-requests"),
143
- deliveries: "https://help.".concat(globalProps.appName, ".com/articles/managing-webhook-deliveries")
144
- };
145
-
146
146
  var DELIVERY_TAB = {
147
147
  response: "response",
148
148
  request: "request"
@@ -428,7 +428,8 @@ var buildColumns$1 = function buildColumns(_ref) {
428
428
 
429
429
  var Deliveries = function Deliveries(_ref) {
430
430
  var webhooksUrl = _ref.webhooksUrl,
431
- hostBreadcrumbs = _ref.breadcrumbs;
431
+ hostBreadcrumbs = _ref.breadcrumbs,
432
+ helpLink = _ref.helpLink;
432
433
  var _useRouteMatch = useRouteMatch(),
433
434
  deliveriesUrl = _useRouteMatch.url;
434
435
  var history = useHistory();
@@ -479,7 +480,7 @@ var Deliveries = function Deliveries(_ref) {
479
480
  title: t("neetoWebhooks.delivery.title"),
480
481
  description: t("neetoWebhooks.delivery.helpDescription"),
481
482
  helpLinkProps: {
482
- href: HELP_LINK_URLS.deliveries
483
+ href: helpLink
483
484
  }
484
485
  }
485
486
  }), isNotEmpty(deliveries) ? /*#__PURE__*/jsx(TableWrapper, {
@@ -690,10 +691,12 @@ var getMenuItems = function getMenuItems(_ref) {
690
691
  return [{
691
692
  key: MENU_ITEMS.EDIT,
692
693
  label: t$1("neetoWebhooks.buttons.edit"),
694
+ "data-cy": "neeto-webhooks-edit-button",
693
695
  onClick: onEdit
694
696
  }, {
695
697
  key: MENU_ITEMS.DELETE,
696
698
  label: t$1("neetoWebhooks.buttons.delete"),
699
+ "data-cy": "neeto-webhooks-delete-button",
697
700
  onClick: onDelete
698
701
  }];
699
702
  };
@@ -806,7 +809,9 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
806
809
  isOpen = _ref.isOpen,
807
810
  onClose = _ref.onClose,
808
811
  onCreate = _ref.onCreate,
809
- webhooks = _ref.webhooks;
812
+ webhooks = _ref.webhooks,
813
+ webhooksHelpLink = _ref.webhooksHelpLink,
814
+ secretsHelpLink = _ref.secretsHelpLink;
810
815
  var _useTranslation = useTranslation(),
811
816
  t = _useTranslation.t;
812
817
  var _useState = useState(false),
@@ -886,7 +891,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
886
891
  }), /*#__PURE__*/jsx(HelpPopover, {
887
892
  description: t("neetoWebhooks.webhook.helpDescription"),
888
893
  helpLinkProps: {
889
- href: HELP_LINK_URLS.webhook
894
+ href: webhooksHelpLink
890
895
  },
891
896
  title: t("neetoWebhooks.webhook.title")
892
897
  })]
@@ -933,7 +938,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
933
938
  className: "flex items-center gap-x-2",
934
939
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
935
940
  helpLinkProps: {
936
- href: HELP_LINK_URLS.secrets
941
+ href: secretsHelpLink
937
942
  },
938
943
  popoverProps: {
939
944
  position: "bottom"
@@ -1009,7 +1014,8 @@ var Header = withT(function (_ref) {
1009
1014
  titleHelpPopoverProps = _ref.titleHelpPopoverProps,
1010
1015
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1011
1016
  headerSize = _ref.headerSize,
1012
- webhooks = _ref.webhooks;
1017
+ webhooks = _ref.webhooks,
1018
+ webhooksHelpLink = _ref.webhooksHelpLink;
1013
1019
  return /*#__PURE__*/jsxs(Fragment, {
1014
1020
  children: [/*#__PURE__*/jsx(Header$2, {
1015
1021
  breadcrumbs: breadcrumbs,
@@ -1025,7 +1031,7 @@ var Header = withT(function (_ref) {
1025
1031
  titleHelpPopoverProps: _objectSpread({
1026
1032
  description: t("neetoWebhooks.webhook.helpDescription"),
1027
1033
  helpLinkProps: {
1028
- href: HELP_LINK_URLS.webhook
1034
+ href: webhooksHelpLink
1029
1035
  },
1030
1036
  title: t("neetoWebhooks.webhook.title")
1031
1037
  }, titleHelpPopoverProps)
@@ -1053,7 +1059,9 @@ var Webhooks = function Webhooks(_ref) {
1053
1059
  onDelete = _ref.onDelete,
1054
1060
  headerSize = _ref.headerSize,
1055
1061
  _ref$containerClassNa = _ref.containerClassName,
1056
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1062
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1063
+ webhooksHelpLink = _ref.webhooksHelpLink,
1064
+ secretsHelpLink = _ref.secretsHelpLink;
1057
1065
  var _useState = useState(null),
1058
1066
  _useState2 = _slicedToArray(_useState, 2),
1059
1067
  editingWebhookId = _useState2[0],
@@ -1122,7 +1130,8 @@ var Webhooks = function Webhooks(_ref) {
1122
1130
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1123
1131
  title: title,
1124
1132
  titleHelpPopoverProps: titleHelpPopoverProps,
1125
- webhooks: webhooks
1133
+ webhooks: webhooks,
1134
+ webhooksHelpLink: webhooksHelpLink
1126
1135
  }), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
1127
1136
  hasPagination: totalCount > DEFAULT_PAGE_SIZE,
1128
1137
  children: /*#__PURE__*/jsx(Table, {
@@ -1161,7 +1170,9 @@ var Webhooks = function Webhooks(_ref) {
1161
1170
  entityId: entityId,
1162
1171
  entityType: entityType,
1163
1172
  onCreate: onCreate,
1173
+ secretsHelpLink: secretsHelpLink,
1164
1174
  webhooks: webhooks,
1175
+ webhooksHelpLink: webhooksHelpLink,
1165
1176
  isOpen: isAddWebhookPaneOpen,
1166
1177
  onClose: handlePaneClose
1167
1178
  }), /*#__PURE__*/jsx(Alert, {
@@ -1202,12 +1213,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1202
1213
  onCreate = _ref.onCreate,
1203
1214
  onDelete = _ref.onDelete,
1204
1215
  headerSize = _ref.headerSize,
1205
- containerClassName = _ref.containerClassName;
1216
+ containerClassName = _ref.containerClassName,
1217
+ _ref$helpLinkUrls = _ref.helpLinkUrls,
1218
+ helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls;
1206
1219
  var _useRouteMatch = useRouteMatch(),
1207
1220
  webhooksPath = _useRouteMatch.path,
1208
1221
  webhooksUrl = _useRouteMatch.url;
1209
1222
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1210
1223
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1224
+ var helpLinks = mergeRight(HELP_LINK_URLS, helpLinkUrls);
1211
1225
  return /*#__PURE__*/jsxs(Switch$1, {
1212
1226
  children: [/*#__PURE__*/jsx(Route, {
1213
1227
  exact: true,
@@ -1223,7 +1237,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1223
1237
  onCreate: onCreate,
1224
1238
  onDelete: onDelete,
1225
1239
  title: title,
1226
- titleHelpPopoverProps: titleHelpPopoverProps
1240
+ titleHelpPopoverProps: titleHelpPopoverProps,
1241
+ secretsHelpLink: helpLinks.secrets,
1242
+ webhooksHelpLink: helpLinks.webhooks
1227
1243
  });
1228
1244
  }
1229
1245
  }), /*#__PURE__*/jsx(Route, {
@@ -1232,7 +1248,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1232
1248
  render: function render() {
1233
1249
  return /*#__PURE__*/jsx(Deliveries$1, {
1234
1250
  breadcrumbs: breadcrumbs,
1235
- webhooksUrl: webhooksUrl
1251
+ webhooksUrl: webhooksUrl,
1252
+ helpLink: helpLinks.deliveries
1236
1253
  });
1237
1254
  }
1238
1255
  }), /*#__PURE__*/jsx(Route, {
@@ -1240,7 +1257,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1240
1257
  render: function render() {
1241
1258
  return /*#__PURE__*/jsx(Deliveries$1, {
1242
1259
  breadcrumbs: breadcrumbs,
1243
- webhooksUrl: webhooksUrl
1260
+ webhooksUrl: webhooksUrl,
1261
+ helpLink: helpLinks.deliveries
1244
1262
  });
1245
1263
  }
1246
1264
  })]