@bigbinary/neeto-webhooks-frontend 2.2.9 → 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.
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ var ramda = require('ramda');
3
4
  var reactRouterDom = require('react-router-dom');
5
+ var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
4
6
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
5
7
  var neetoCist = require('@bigbinary/neeto-cist');
6
8
  var constants = require('@bigbinary/neeto-commons-frontend/constants');
@@ -18,7 +20,6 @@ var reactQuery = require('@tanstack/react-query');
18
20
  var reactQueryDevtools = require('@tanstack/react-query-devtools');
19
21
  var jsxRuntime = require('react/jsx-runtime');
20
22
  var axios = require('axios');
21
- var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
22
23
  var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
23
24
  var _regeneratorRuntime = require('@babel/runtime/regenerator');
24
25
  var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
@@ -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 ramda = require('ramda');
34
34
  var Alert = require('@bigbinary/neetoui/Alert');
35
35
  var Plus = require('@bigbinary/neeto-icons/Plus');
36
36
  var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
@@ -63,6 +63,12 @@ function _interopNamespaceDefault(e) {
63
63
 
64
64
  var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
65
65
 
66
+ var HELP_LINK_URLS = {
67
+ webhooks: "https://help.".concat(initializers.globalProps.appName, ".com/articles/creating-a-webhook"),
68
+ secrets: "https://help.".concat(initializers.globalProps.appName, ".com/articles/securing-webhook-requests"),
69
+ deliveries: "https://help.".concat(initializers.globalProps.appName, ".com/articles/managing-webhook-deliveries")
70
+ };
71
+
66
72
  var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
67
73
  return "".concat(webhooksPath, "/:webhookId/deliveries");
68
74
  };
@@ -158,12 +164,6 @@ var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
158
164
  });
159
165
  };
160
166
 
161
- var HELP_LINK_URLS = {
162
- webhook: "https://help.".concat(initializers.globalProps.appName, ".com/articles/creating-a-webhook"),
163
- secrets: "https://help.".concat(initializers.globalProps.appName, ".com/articles/securing-webhook-requests"),
164
- deliveries: "https://help.".concat(initializers.globalProps.appName, ".com/articles/managing-webhook-deliveries")
165
- };
166
-
167
167
  var DELIVERY_TAB = {
168
168
  response: "response",
169
169
  request: "request"
@@ -449,7 +449,8 @@ var buildColumns$1 = function buildColumns(_ref) {
449
449
 
450
450
  var Deliveries = function Deliveries(_ref) {
451
451
  var webhooksUrl = _ref.webhooksUrl,
452
- hostBreadcrumbs = _ref.breadcrumbs;
452
+ hostBreadcrumbs = _ref.breadcrumbs,
453
+ helpLink = _ref.helpLink;
453
454
  var _useRouteMatch = reactRouterDom.useRouteMatch(),
454
455
  deliveriesUrl = _useRouteMatch.url;
455
456
  var history = reactRouterDom.useHistory();
@@ -500,7 +501,7 @@ var Deliveries = function Deliveries(_ref) {
500
501
  title: t("neetoWebhooks.delivery.title"),
501
502
  description: t("neetoWebhooks.delivery.helpDescription"),
502
503
  helpLinkProps: {
503
- href: HELP_LINK_URLS.deliveries
504
+ href: helpLink
504
505
  }
505
506
  }
506
507
  }), neetoCist.isNotEmpty(deliveries) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
@@ -829,7 +830,9 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
829
830
  isOpen = _ref.isOpen,
830
831
  onClose = _ref.onClose,
831
832
  onCreate = _ref.onCreate,
832
- webhooks = _ref.webhooks;
833
+ webhooks = _ref.webhooks,
834
+ webhooksHelpLink = _ref.webhooksHelpLink,
835
+ secretsHelpLink = _ref.secretsHelpLink;
833
836
  var _useTranslation = reactI18next.useTranslation(),
834
837
  t = _useTranslation.t;
835
838
  var _useState = react.useState(false),
@@ -909,7 +912,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
909
912
  }), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
910
913
  description: t("neetoWebhooks.webhook.helpDescription"),
911
914
  helpLinkProps: {
912
- href: HELP_LINK_URLS.webhook
915
+ href: webhooksHelpLink
913
916
  },
914
917
  title: t("neetoWebhooks.webhook.title")
915
918
  })]
@@ -956,7 +959,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
956
959
  className: "flex items-center gap-x-2",
957
960
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
958
961
  helpLinkProps: {
959
- href: HELP_LINK_URLS.secrets
962
+ href: secretsHelpLink
960
963
  },
961
964
  popoverProps: {
962
965
  position: "bottom"
@@ -1032,7 +1035,8 @@ var Header = reactUtils.withT(function (_ref) {
1032
1035
  titleHelpPopoverProps = _ref.titleHelpPopoverProps,
1033
1036
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1034
1037
  headerSize = _ref.headerSize,
1035
- webhooks = _ref.webhooks;
1038
+ webhooks = _ref.webhooks,
1039
+ webhooksHelpLink = _ref.webhooksHelpLink;
1036
1040
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1037
1041
  children: [/*#__PURE__*/jsxRuntime.jsx(Header$2, {
1038
1042
  breadcrumbs: breadcrumbs,
@@ -1048,7 +1052,7 @@ var Header = reactUtils.withT(function (_ref) {
1048
1052
  titleHelpPopoverProps: _objectSpread({
1049
1053
  description: t("neetoWebhooks.webhook.helpDescription"),
1050
1054
  helpLinkProps: {
1051
- href: HELP_LINK_URLS.webhook
1055
+ href: webhooksHelpLink
1052
1056
  },
1053
1057
  title: t("neetoWebhooks.webhook.title")
1054
1058
  }, titleHelpPopoverProps)
@@ -1076,7 +1080,9 @@ var Webhooks = function Webhooks(_ref) {
1076
1080
  onDelete = _ref.onDelete,
1077
1081
  headerSize = _ref.headerSize,
1078
1082
  _ref$containerClassNa = _ref.containerClassName,
1079
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1083
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1084
+ webhooksHelpLink = _ref.webhooksHelpLink,
1085
+ secretsHelpLink = _ref.secretsHelpLink;
1080
1086
  var _useState = react.useState(null),
1081
1087
  _useState2 = _slicedToArray(_useState, 2),
1082
1088
  editingWebhookId = _useState2[0],
@@ -1145,7 +1151,8 @@ var Webhooks = function Webhooks(_ref) {
1145
1151
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1146
1152
  title: title,
1147
1153
  titleHelpPopoverProps: titleHelpPopoverProps,
1148
- webhooks: webhooks
1154
+ webhooks: webhooks,
1155
+ webhooksHelpLink: webhooksHelpLink
1149
1156
  }), neetoCist.isNotEmpty(webhooks) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
1150
1157
  hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
1151
1158
  children: /*#__PURE__*/jsxRuntime.jsx(Table, {
@@ -1184,7 +1191,9 @@ var Webhooks = function Webhooks(_ref) {
1184
1191
  entityId: entityId,
1185
1192
  entityType: entityType,
1186
1193
  onCreate: onCreate,
1194
+ secretsHelpLink: secretsHelpLink,
1187
1195
  webhooks: webhooks,
1196
+ webhooksHelpLink: webhooksHelpLink,
1188
1197
  isOpen: isAddWebhookPaneOpen,
1189
1198
  onClose: handlePaneClose
1190
1199
  }), /*#__PURE__*/jsxRuntime.jsx(Alert, {
@@ -1225,12 +1234,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1225
1234
  onCreate = _ref.onCreate,
1226
1235
  onDelete = _ref.onDelete,
1227
1236
  headerSize = _ref.headerSize,
1228
- containerClassName = _ref.containerClassName;
1237
+ containerClassName = _ref.containerClassName,
1238
+ _ref$helpLinkUrls = _ref.helpLinkUrls,
1239
+ helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls;
1229
1240
  var _useRouteMatch = reactRouterDom.useRouteMatch(),
1230
1241
  webhooksPath = _useRouteMatch.path,
1231
1242
  webhooksUrl = _useRouteMatch.url;
1232
1243
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1233
1244
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1245
+ var helpLinks = ramda.mergeRight(HELP_LINK_URLS, helpLinkUrls);
1234
1246
  return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
1235
1247
  children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1236
1248
  exact: true,
@@ -1246,7 +1258,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1246
1258
  onCreate: onCreate,
1247
1259
  onDelete: onDelete,
1248
1260
  title: title,
1249
- titleHelpPopoverProps: titleHelpPopoverProps
1261
+ titleHelpPopoverProps: titleHelpPopoverProps,
1262
+ secretsHelpLink: helpLinks.secrets,
1263
+ webhooksHelpLink: helpLinks.webhooks
1250
1264
  });
1251
1265
  }
1252
1266
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
@@ -1255,7 +1269,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1255
1269
  render: function render() {
1256
1270
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1257
1271
  breadcrumbs: breadcrumbs,
1258
- webhooksUrl: webhooksUrl
1272
+ webhooksUrl: webhooksUrl,
1273
+ helpLink: helpLinks.deliveries
1259
1274
  });
1260
1275
  }
1261
1276
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
@@ -1263,7 +1278,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1263
1278
  render: function render() {
1264
1279
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1265
1280
  breadcrumbs: breadcrumbs,
1266
- webhooksUrl: webhooksUrl
1281
+ webhooksUrl: webhooksUrl,
1282
+ helpLink: helpLinks.deliveries
1267
1283
  });
1268
1284
  }
1269
1285
  })]