@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.
@@ -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, {
@@ -711,10 +712,12 @@ var getMenuItems = function getMenuItems(_ref) {
711
712
  return [{
712
713
  key: MENU_ITEMS.EDIT,
713
714
  label: i18next.t("neetoWebhooks.buttons.edit"),
715
+ "data-cy": "neeto-webhooks-edit-button",
714
716
  onClick: onEdit
715
717
  }, {
716
718
  key: MENU_ITEMS.DELETE,
717
719
  label: i18next.t("neetoWebhooks.buttons.delete"),
720
+ "data-cy": "neeto-webhooks-delete-button",
718
721
  onClick: onDelete
719
722
  }];
720
723
  };
@@ -827,7 +830,9 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
827
830
  isOpen = _ref.isOpen,
828
831
  onClose = _ref.onClose,
829
832
  onCreate = _ref.onCreate,
830
- webhooks = _ref.webhooks;
833
+ webhooks = _ref.webhooks,
834
+ webhooksHelpLink = _ref.webhooksHelpLink,
835
+ secretsHelpLink = _ref.secretsHelpLink;
831
836
  var _useTranslation = reactI18next.useTranslation(),
832
837
  t = _useTranslation.t;
833
838
  var _useState = react.useState(false),
@@ -907,7 +912,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
907
912
  }), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
908
913
  description: t("neetoWebhooks.webhook.helpDescription"),
909
914
  helpLinkProps: {
910
- href: HELP_LINK_URLS.webhook
915
+ href: webhooksHelpLink
911
916
  },
912
917
  title: t("neetoWebhooks.webhook.title")
913
918
  })]
@@ -954,7 +959,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
954
959
  className: "flex items-center gap-x-2",
955
960
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
956
961
  helpLinkProps: {
957
- href: HELP_LINK_URLS.secrets
962
+ href: secretsHelpLink
958
963
  },
959
964
  popoverProps: {
960
965
  position: "bottom"
@@ -1030,7 +1035,8 @@ var Header = reactUtils.withT(function (_ref) {
1030
1035
  titleHelpPopoverProps = _ref.titleHelpPopoverProps,
1031
1036
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1032
1037
  headerSize = _ref.headerSize,
1033
- webhooks = _ref.webhooks;
1038
+ webhooks = _ref.webhooks,
1039
+ webhooksHelpLink = _ref.webhooksHelpLink;
1034
1040
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1035
1041
  children: [/*#__PURE__*/jsxRuntime.jsx(Header$2, {
1036
1042
  breadcrumbs: breadcrumbs,
@@ -1046,7 +1052,7 @@ var Header = reactUtils.withT(function (_ref) {
1046
1052
  titleHelpPopoverProps: _objectSpread({
1047
1053
  description: t("neetoWebhooks.webhook.helpDescription"),
1048
1054
  helpLinkProps: {
1049
- href: HELP_LINK_URLS.webhook
1055
+ href: webhooksHelpLink
1050
1056
  },
1051
1057
  title: t("neetoWebhooks.webhook.title")
1052
1058
  }, titleHelpPopoverProps)
@@ -1074,7 +1080,9 @@ var Webhooks = function Webhooks(_ref) {
1074
1080
  onDelete = _ref.onDelete,
1075
1081
  headerSize = _ref.headerSize,
1076
1082
  _ref$containerClassNa = _ref.containerClassName,
1077
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1083
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1084
+ webhooksHelpLink = _ref.webhooksHelpLink,
1085
+ secretsHelpLink = _ref.secretsHelpLink;
1078
1086
  var _useState = react.useState(null),
1079
1087
  _useState2 = _slicedToArray(_useState, 2),
1080
1088
  editingWebhookId = _useState2[0],
@@ -1143,7 +1151,8 @@ var Webhooks = function Webhooks(_ref) {
1143
1151
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1144
1152
  title: title,
1145
1153
  titleHelpPopoverProps: titleHelpPopoverProps,
1146
- webhooks: webhooks
1154
+ webhooks: webhooks,
1155
+ webhooksHelpLink: webhooksHelpLink
1147
1156
  }), neetoCist.isNotEmpty(webhooks) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
1148
1157
  hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
1149
1158
  children: /*#__PURE__*/jsxRuntime.jsx(Table, {
@@ -1182,7 +1191,9 @@ var Webhooks = function Webhooks(_ref) {
1182
1191
  entityId: entityId,
1183
1192
  entityType: entityType,
1184
1193
  onCreate: onCreate,
1194
+ secretsHelpLink: secretsHelpLink,
1185
1195
  webhooks: webhooks,
1196
+ webhooksHelpLink: webhooksHelpLink,
1186
1197
  isOpen: isAddWebhookPaneOpen,
1187
1198
  onClose: handlePaneClose
1188
1199
  }), /*#__PURE__*/jsxRuntime.jsx(Alert, {
@@ -1223,12 +1234,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1223
1234
  onCreate = _ref.onCreate,
1224
1235
  onDelete = _ref.onDelete,
1225
1236
  headerSize = _ref.headerSize,
1226
- containerClassName = _ref.containerClassName;
1237
+ containerClassName = _ref.containerClassName,
1238
+ _ref$helpLinkUrls = _ref.helpLinkUrls,
1239
+ helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls;
1227
1240
  var _useRouteMatch = reactRouterDom.useRouteMatch(),
1228
1241
  webhooksPath = _useRouteMatch.path,
1229
1242
  webhooksUrl = _useRouteMatch.url;
1230
1243
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1231
1244
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1245
+ var helpLinks = ramda.mergeRight(HELP_LINK_URLS, helpLinkUrls);
1232
1246
  return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
1233
1247
  children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1234
1248
  exact: true,
@@ -1244,7 +1258,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1244
1258
  onCreate: onCreate,
1245
1259
  onDelete: onDelete,
1246
1260
  title: title,
1247
- titleHelpPopoverProps: titleHelpPopoverProps
1261
+ titleHelpPopoverProps: titleHelpPopoverProps,
1262
+ secretsHelpLink: helpLinks.secrets,
1263
+ webhooksHelpLink: helpLinks.webhooks
1248
1264
  });
1249
1265
  }
1250
1266
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
@@ -1253,7 +1269,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1253
1269
  render: function render() {
1254
1270
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1255
1271
  breadcrumbs: breadcrumbs,
1256
- webhooksUrl: webhooksUrl
1272
+ webhooksUrl: webhooksUrl,
1273
+ helpLink: helpLinks.deliveries
1257
1274
  });
1258
1275
  }
1259
1276
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
@@ -1261,7 +1278,8 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1261
1278
  render: function render() {
1262
1279
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1263
1280
  breadcrumbs: breadcrumbs,
1264
- webhooksUrl: webhooksUrl
1281
+ webhooksUrl: webhooksUrl,
1282
+ helpLink: helpLinks.deliveries
1265
1283
  });
1266
1284
  }
1267
1285
  })]