@bigbinary/neeto-webhooks-frontend 2.2.9 → 2.2.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 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, {
@@ -808,7 +809,9 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
808
809
  isOpen = _ref.isOpen,
809
810
  onClose = _ref.onClose,
810
811
  onCreate = _ref.onCreate,
811
- webhooks = _ref.webhooks;
812
+ webhooks = _ref.webhooks,
813
+ webhooksHelpLink = _ref.webhooksHelpLink,
814
+ secretsHelpLink = _ref.secretsHelpLink;
812
815
  var _useTranslation = useTranslation(),
813
816
  t = _useTranslation.t;
814
817
  var _useState = useState(false),
@@ -888,7 +891,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
888
891
  }), /*#__PURE__*/jsx(HelpPopover, {
889
892
  description: t("neetoWebhooks.webhook.helpDescription"),
890
893
  helpLinkProps: {
891
- href: HELP_LINK_URLS.webhook
894
+ href: webhooksHelpLink
892
895
  },
893
896
  title: t("neetoWebhooks.webhook.title")
894
897
  })]
@@ -935,7 +938,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
935
938
  className: "flex items-center gap-x-2",
936
939
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
937
940
  helpLinkProps: {
938
- href: HELP_LINK_URLS.secrets
941
+ href: secretsHelpLink
939
942
  },
940
943
  popoverProps: {
941
944
  position: "bottom"
@@ -1011,7 +1014,8 @@ var Header = withT(function (_ref) {
1011
1014
  titleHelpPopoverProps = _ref.titleHelpPopoverProps,
1012
1015
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1013
1016
  headerSize = _ref.headerSize,
1014
- webhooks = _ref.webhooks;
1017
+ webhooks = _ref.webhooks,
1018
+ webhooksHelpLink = _ref.webhooksHelpLink;
1015
1019
  return /*#__PURE__*/jsxs(Fragment, {
1016
1020
  children: [/*#__PURE__*/jsx(Header$2, {
1017
1021
  breadcrumbs: breadcrumbs,
@@ -1027,7 +1031,7 @@ var Header = withT(function (_ref) {
1027
1031
  titleHelpPopoverProps: _objectSpread({
1028
1032
  description: t("neetoWebhooks.webhook.helpDescription"),
1029
1033
  helpLinkProps: {
1030
- href: HELP_LINK_URLS.webhook
1034
+ href: webhooksHelpLink
1031
1035
  },
1032
1036
  title: t("neetoWebhooks.webhook.title")
1033
1037
  }, titleHelpPopoverProps)
@@ -1055,7 +1059,9 @@ var Webhooks = function Webhooks(_ref) {
1055
1059
  onDelete = _ref.onDelete,
1056
1060
  headerSize = _ref.headerSize,
1057
1061
  _ref$containerClassNa = _ref.containerClassName,
1058
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1062
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1063
+ webhooksHelpLink = _ref.webhooksHelpLink,
1064
+ secretsHelpLink = _ref.secretsHelpLink;
1059
1065
  var _useState = useState(null),
1060
1066
  _useState2 = _slicedToArray(_useState, 2),
1061
1067
  editingWebhookId = _useState2[0],
@@ -1124,7 +1130,8 @@ var Webhooks = function Webhooks(_ref) {
1124
1130
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1125
1131
  title: title,
1126
1132
  titleHelpPopoverProps: titleHelpPopoverProps,
1127
- webhooks: webhooks
1133
+ webhooks: webhooks,
1134
+ webhooksHelpLink: webhooksHelpLink
1128
1135
  }), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
1129
1136
  hasPagination: totalCount > DEFAULT_PAGE_SIZE,
1130
1137
  children: /*#__PURE__*/jsx(Table, {
@@ -1145,7 +1152,7 @@ var Webhooks = function Webhooks(_ref) {
1145
1152
  children: /*#__PURE__*/jsx(NoData, {
1146
1153
  title: t("neetoWebhooks.webhook.empty"),
1147
1154
  helpText: /*#__PURE__*/jsx(Button, {
1148
- href: HELP_LINK_URLS.webhook,
1155
+ href: webhooksHelpLink,
1149
1156
  label: t("neetoWebhooks.webhook.emptyHelpText"),
1150
1157
  rel: "noreferrer",
1151
1158
  style: "link",
@@ -1163,7 +1170,9 @@ var Webhooks = function Webhooks(_ref) {
1163
1170
  entityId: entityId,
1164
1171
  entityType: entityType,
1165
1172
  onCreate: onCreate,
1173
+ secretsHelpLink: secretsHelpLink,
1166
1174
  webhooks: webhooks,
1175
+ webhooksHelpLink: webhooksHelpLink,
1167
1176
  isOpen: isAddWebhookPaneOpen,
1168
1177
  onClose: handlePaneClose
1169
1178
  }), /*#__PURE__*/jsx(Alert, {
@@ -1204,12 +1213,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1204
1213
  onCreate = _ref.onCreate,
1205
1214
  onDelete = _ref.onDelete,
1206
1215
  headerSize = _ref.headerSize,
1207
- containerClassName = _ref.containerClassName;
1216
+ containerClassName = _ref.containerClassName,
1217
+ _ref$helpLinkUrls = _ref.helpLinkUrls,
1218
+ helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls;
1208
1219
  var _useRouteMatch = useRouteMatch(),
1209
1220
  webhooksPath = _useRouteMatch.path,
1210
1221
  webhooksUrl = _useRouteMatch.url;
1211
1222
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1212
1223
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1224
+ var helpLinks = mergeRight(HELP_LINK_URLS, helpLinkUrls);
1213
1225
  return /*#__PURE__*/jsxs(Switch$1, {
1214
1226
  children: [/*#__PURE__*/jsx(Route, {
1215
1227
  exact: true,
@@ -1225,7 +1237,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1225
1237
  onCreate: onCreate,
1226
1238
  onDelete: onDelete,
1227
1239
  title: title,
1228
- titleHelpPopoverProps: titleHelpPopoverProps
1240
+ titleHelpPopoverProps: titleHelpPopoverProps,
1241
+ secretsHelpLink: helpLinks.secrets,
1242
+ webhooksHelpLink: helpLinks.webhooks
1229
1243
  });
1230
1244
  }
1231
1245
  }), /*#__PURE__*/jsx(Route, {
@@ -1234,7 +1248,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1234
1248
  render: function render() {
1235
1249
  return /*#__PURE__*/jsx(Deliveries$1, {
1236
1250
  breadcrumbs: breadcrumbs,
1237
- webhooksUrl: webhooksUrl
1251
+ webhooksUrl: webhooksUrl,
1252
+ helpLink: helpLinks.deliveries
1238
1253
  });
1239
1254
  }
1240
1255
  }), /*#__PURE__*/jsx(Route, {
@@ -1242,7 +1257,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1242
1257
  render: function render() {
1243
1258
  return /*#__PURE__*/jsx(Deliveries$1, {
1244
1259
  breadcrumbs: breadcrumbs,
1245
- webhooksUrl: webhooksUrl
1260
+ webhooksUrl: webhooksUrl,
1261
+ helpLink: helpLinks.deliveries
1246
1262
  });
1247
1263
  }
1248
1264
  })]