@bigbinary/neeto-webhooks-frontend 2.1.0 → 2.1.2

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,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var ramda = require('ramda');
5
4
  var reactRouterDom = require('react-router-dom');
6
5
  var neetoCist = require('@bigbinary/neeto-cist');
7
6
  var constants = require('@bigbinary/neeto-commons-frontend/constants');
@@ -18,6 +17,7 @@ var reactQuery = require('@tanstack/react-query');
18
17
  var reactQueryDevtools = require('@tanstack/react-query-devtools');
19
18
  var jsxRuntime = require('react/jsx-runtime');
20
19
  var axios = require('axios');
20
+ var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
21
21
  var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
22
22
  var Button = require('@bigbinary/neetoui/Button');
23
23
  var Pane = require('@bigbinary/neetoui/Pane');
@@ -26,6 +26,7 @@ var Tab = require('@bigbinary/neetoui/Tab');
26
26
  var Tag = require('@bigbinary/neetoui/Tag');
27
27
  var i18next = require('i18next');
28
28
  var utils = require('@bigbinary/neeto-commons-frontend/utils');
29
+ var ramda = require('ramda');
29
30
  var Alert = require('@bigbinary/neetoui/Alert');
30
31
  var Plus = require('@bigbinary/neeto-icons/Plus');
31
32
  var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
@@ -85,12 +86,6 @@ var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
85
86
  var Textarea__default = /*#__PURE__*/_interopDefaultLegacy(Textarea);
86
87
  var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
87
88
 
88
- var HELP_LINK_URLS = {
89
- webhook: "https://neetocalhelp.neetokb.com/p/a-4bb6c2a2",
90
- secrets: "https://neetocalhelp.neetokb.com/p/a-80de90bd",
91
- deliveries: "https://help.neetocal.com/articles/managing-webhook-deliveries"
92
- };
93
-
94
89
  var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
95
90
  return "".concat(webhooksPath, "/:webhookId/deliveries");
96
91
  };
@@ -258,6 +253,12 @@ var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
258
253
  });
259
254
  };
260
255
 
256
+ var HELP_LINK_URLS = {
257
+ webhook: "https://help.".concat(initializers.globalProps.appName, ".com/articles/creating-a-webhook"),
258
+ secrets: "https://help.".concat(initializers.globalProps.appName, ".com/articles/securing-webhook-requests"),
259
+ deliveries: "https://help.".concat(initializers.globalProps.appName, ".com/articles/managing-webhook-deliveries")
260
+ };
261
+
261
262
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
262
263
  try {
263
264
  var info = gen[key](arg);
@@ -820,7 +821,7 @@ var Details = function Details(_ref) {
820
821
  isRedelivering = _useRedeliverWebhook.isPending,
821
822
  redeliverWebhook = _useRedeliverWebhook.mutateAsync;
822
823
  var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
823
- isLoading = _useShowDelivery.isLoading,
824
+ isLoading = _useShowDelivery.isPending,
824
825
  _useShowDelivery$data = _useShowDelivery.data,
825
826
  _useShowDelivery$data2 = _useShowDelivery$data === void 0 ? {} : _useShowDelivery$data,
826
827
  delivery = _useShowDelivery$data2.delivery;
@@ -841,9 +842,6 @@ var Details = function Details(_ref) {
841
842
  return _ref2.apply(this, arguments);
842
843
  };
843
844
  }();
844
- if (neetoCist.isNotPresent(delivery)) {
845
- return null;
846
- }
847
845
  return /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"], {
848
846
  onClose: onClose,
849
847
  isOpen: neetoCist.isPresent(deliveryId),
@@ -965,8 +963,7 @@ var buildColumns$1 = function buildColumns(_ref) {
965
963
 
966
964
  var Deliveries = function Deliveries(_ref) {
967
965
  var webhooksUrl = _ref.webhooksUrl,
968
- hostBreadcrumbs = _ref.breadcrumbs,
969
- helpLink = _ref.helpLink;
966
+ hostBreadcrumbs = _ref.breadcrumbs;
970
967
  var _useRouteMatch = reactRouterDom.useRouteMatch(),
971
968
  deliveriesUrl = _useRouteMatch.url;
972
969
  var history = reactRouterDom.useHistory();
@@ -1011,7 +1008,7 @@ var Deliveries = function Deliveries(_ref) {
1011
1008
  children: [t("neetoWebhooks.delivery.title"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
1012
1009
  description: t("neetoWebhooks.delivery.helpDescription"),
1013
1010
  helpLinkProps: {
1014
- href: helpLink
1011
+ href: HELP_LINK_URLS.deliveries
1015
1012
  },
1016
1013
  title: t("neetoWebhooks.delivery.title")
1017
1014
  })]
@@ -1331,9 +1328,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1331
1328
  isOpen = _ref.isOpen,
1332
1329
  onClose = _ref.onClose,
1333
1330
  onCreate = _ref.onCreate,
1334
- webhooks = _ref.webhooks,
1335
- webhookHelpLink = _ref.webhookHelpLink,
1336
- secretsHelpLink = _ref.secretsHelpLink;
1331
+ webhooks = _ref.webhooks;
1337
1332
  var _useTranslation = reactI18next.useTranslation(),
1338
1333
  t = _useTranslation.t;
1339
1334
  var _useState = React.useState(false),
@@ -1413,7 +1408,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1413
1408
  }), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
1414
1409
  description: t("neetoWebhooks.webhook.helpDescription"),
1415
1410
  helpLinkProps: {
1416
- href: webhookHelpLink
1411
+ href: HELP_LINK_URLS.webhook
1417
1412
  },
1418
1413
  title: t("neetoWebhooks.webhook.title")
1419
1414
  })]
@@ -1461,7 +1456,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1461
1456
  className: "flex items-center gap-x-2",
1462
1457
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
1463
1458
  helpLinkProps: {
1464
- href: secretsHelpLink
1459
+ href: HELP_LINK_URLS.secrets
1465
1460
  },
1466
1461
  description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
1467
1462
  title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
@@ -1519,8 +1514,7 @@ var Header = reactUtils.withT(function (_ref) {
1519
1514
  breadcrumbs = _ref.breadcrumbs,
1520
1515
  title = _ref.title,
1521
1516
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1522
- headerSize = _ref.headerSize,
1523
- webhookHelpLink = _ref.webhookHelpLink;
1517
+ headerSize = _ref.headerSize;
1524
1518
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1525
1519
  children: [/*#__PURE__*/jsxRuntime.jsx(Header__default["default"], {
1526
1520
  breadcrumbs: breadcrumbs,
@@ -1537,7 +1531,7 @@ var Header = reactUtils.withT(function (_ref) {
1537
1531
  children: [t("neetoWebhooks.webhook.title"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
1538
1532
  description: t("neetoWebhooks.webhook.helpDescription"),
1539
1533
  helpLinkProps: {
1540
- href: webhookHelpLink
1534
+ href: HELP_LINK_URLS.webhook
1541
1535
  },
1542
1536
  title: t("neetoWebhooks.webhook.title")
1543
1537
  })]
@@ -1563,9 +1557,7 @@ var Webhooks = function Webhooks(_ref) {
1563
1557
  onDelete = _ref.onDelete,
1564
1558
  headerSize = _ref.headerSize,
1565
1559
  _ref$containerClassNa = _ref.containerClassName,
1566
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1567
- webhookHelpLink = _ref.webhookHelpLink,
1568
- secretsHelpLink = _ref.secretsHelpLink;
1560
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1569
1561
  var _useState = React.useState(null),
1570
1562
  _useState2 = _slicedToArray(_useState, 2),
1571
1563
  editingWebhookId = _useState2[0],
@@ -1629,8 +1621,7 @@ var Webhooks = function Webhooks(_ref) {
1629
1621
  breadcrumbs: breadcrumbs,
1630
1622
  headerSize: headerSize,
1631
1623
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1632
- title: title,
1633
- webhookHelpLink: webhookHelpLink
1624
+ title: title
1634
1625
  }), neetoCist.isNotEmpty(webhooks) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
1635
1626
  hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
1636
1627
  children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
@@ -1669,8 +1660,6 @@ var Webhooks = function Webhooks(_ref) {
1669
1660
  entityId: entityId,
1670
1661
  entityType: entityType,
1671
1662
  onCreate: onCreate,
1672
- secretsHelpLink: secretsHelpLink,
1673
- webhookHelpLink: webhookHelpLink,
1674
1663
  webhooks: webhooks,
1675
1664
  isOpen: isAddWebhookPaneOpen,
1676
1665
  onClose: handlePaneClose
@@ -1711,15 +1700,12 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1711
1700
  onCreate = _ref.onCreate,
1712
1701
  onDelete = _ref.onDelete,
1713
1702
  headerSize = _ref.headerSize,
1714
- _ref$helpLinkUrls = _ref.helpLinkUrls,
1715
- helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls,
1716
1703
  containerClassName = _ref.containerClassName;
1717
1704
  var _useRouteMatch = reactRouterDom.useRouteMatch(),
1718
1705
  webhooksPath = _useRouteMatch.path,
1719
1706
  webhooksUrl = _useRouteMatch.url;
1720
1707
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1721
1708
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1722
- var helpLinks = ramda.mergeRight(HELP_LINK_URLS, helpLinkUrls);
1723
1709
  return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
1724
1710
  children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1725
1711
  exact: true,
@@ -1734,9 +1720,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1734
1720
  headerSize: headerSize,
1735
1721
  onCreate: onCreate,
1736
1722
  onDelete: onDelete,
1737
- title: title,
1738
- secretsHelpLink: helpLinks.secrets,
1739
- webhookHelpLink: helpLinks.webhook
1723
+ title: title
1740
1724
  });
1741
1725
  }
1742
1726
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
@@ -1745,17 +1729,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1745
1729
  render: function render() {
1746
1730
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1747
1731
  breadcrumbs: breadcrumbs,
1748
- webhooksUrl: webhooksUrl,
1749
- helpLink: helpLinks.deliveries
1732
+ webhooksUrl: webhooksUrl
1750
1733
  });
1751
1734
  }
1752
1735
  }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1753
1736
  path: deliveriesPath,
1754
- component: function component() {
1737
+ render: function render() {
1755
1738
  return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
1756
1739
  breadcrumbs: breadcrumbs,
1757
- webhooksUrl: webhooksUrl,
1758
- helpLink: helpLinks.deliveries
1740
+ webhooksUrl: webhooksUrl
1759
1741
  });
1760
1742
  }
1761
1743
  })]