@bigbinary/neeto-webhooks-frontend 2.1.1 → 2.1.3

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,5 +1,4 @@
1
1
  import React, { useState, useRef, useEffect, useCallback } from 'react';
2
- import { prop, pluck, assoc, mergeRight } from 'ramda';
3
2
  import { useRouteMatch, useHistory, useParams, Switch as Switch$1, Route } from 'react-router-dom';
4
3
  import { isPresent, removeBy, isNotEmpty, removeById, findBy } from '@bigbinary/neeto-cist';
5
4
  import { DEFAULT_STALE_TIME, SINGULAR, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_INDEX, PLURAL } from '@bigbinary/neeto-commons-frontend/constants';
@@ -16,6 +15,7 @@ import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient,
16
15
  import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
17
16
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
18
17
  import axios from 'axios';
18
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
19
19
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
20
20
  import Button from '@bigbinary/neetoui/Button';
21
21
  import Pane from '@bigbinary/neetoui/Pane';
@@ -24,6 +24,7 @@ import Tab from '@bigbinary/neetoui/Tab';
24
24
  import Tag from '@bigbinary/neetoui/Tag';
25
25
  import { t as t$1 } from 'i18next';
26
26
  import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
27
+ import { prop, pluck, assoc } from 'ramda';
27
28
  import Alert from '@bigbinary/neetoui/Alert';
28
29
  import Plus from '@bigbinary/neeto-icons/Plus';
29
30
  import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
@@ -36,12 +37,6 @@ import Switch from '@bigbinary/neetoui/formik/Switch';
36
37
  import Textarea from '@bigbinary/neetoui/formik/Textarea';
37
38
  import * as yup from 'yup';
38
39
 
39
- var HELP_LINK_URLS = {
40
- webhook: "https://neetocalhelp.neetokb.com/p/a-4bb6c2a2",
41
- secrets: "https://neetocalhelp.neetokb.com/p/a-80de90bd",
42
- deliveries: "https://help.neetocal.com/articles/managing-webhook-deliveries"
43
- };
44
-
45
40
  var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
46
41
  return "".concat(webhooksPath, "/:webhookId/deliveries");
47
42
  };
@@ -209,6 +204,12 @@ var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
209
204
  });
210
205
  };
211
206
 
207
+ var HELP_LINK_URLS = {
208
+ webhook: "https://help.".concat(globalProps.appName, ".com/articles/creating-a-webhook"),
209
+ secrets: "https://help.".concat(globalProps.appName, ".com/articles/securing-webhook-requests"),
210
+ deliveries: "https://help.".concat(globalProps.appName, ".com/articles/managing-webhook-deliveries")
211
+ };
212
+
212
213
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
213
214
  try {
214
215
  var info = gen[key](arg);
@@ -913,8 +914,7 @@ var buildColumns$1 = function buildColumns(_ref) {
913
914
 
914
915
  var Deliveries = function Deliveries(_ref) {
915
916
  var webhooksUrl = _ref.webhooksUrl,
916
- hostBreadcrumbs = _ref.breadcrumbs,
917
- helpLink = _ref.helpLink;
917
+ hostBreadcrumbs = _ref.breadcrumbs;
918
918
  var _useRouteMatch = useRouteMatch(),
919
919
  deliveriesUrl = _useRouteMatch.url;
920
920
  var history = useHistory();
@@ -959,7 +959,7 @@ var Deliveries = function Deliveries(_ref) {
959
959
  children: [t("neetoWebhooks.delivery.title"), /*#__PURE__*/jsx(HelpPopover, {
960
960
  description: t("neetoWebhooks.delivery.helpDescription"),
961
961
  helpLinkProps: {
962
- href: helpLink
962
+ href: HELP_LINK_URLS.deliveries
963
963
  },
964
964
  title: t("neetoWebhooks.delivery.title")
965
965
  })]
@@ -1279,9 +1279,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1279
1279
  isOpen = _ref.isOpen,
1280
1280
  onClose = _ref.onClose,
1281
1281
  onCreate = _ref.onCreate,
1282
- webhooks = _ref.webhooks,
1283
- webhookHelpLink = _ref.webhookHelpLink,
1284
- secretsHelpLink = _ref.secretsHelpLink;
1282
+ webhooks = _ref.webhooks;
1285
1283
  var _useTranslation = useTranslation(),
1286
1284
  t = _useTranslation.t;
1287
1285
  var _useState = useState(false),
@@ -1361,7 +1359,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1361
1359
  }), /*#__PURE__*/jsx(HelpPopover, {
1362
1360
  description: t("neetoWebhooks.webhook.helpDescription"),
1363
1361
  helpLinkProps: {
1364
- href: webhookHelpLink
1362
+ href: HELP_LINK_URLS.webhook
1365
1363
  },
1366
1364
  title: t("neetoWebhooks.webhook.title")
1367
1365
  })]
@@ -1409,7 +1407,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1409
1407
  className: "flex items-center gap-x-2",
1410
1408
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
1411
1409
  helpLinkProps: {
1412
- href: secretsHelpLink
1410
+ href: HELP_LINK_URLS.secrets
1413
1411
  },
1414
1412
  description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
1415
1413
  title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
@@ -1467,8 +1465,7 @@ var Header = withT(function (_ref) {
1467
1465
  breadcrumbs = _ref.breadcrumbs,
1468
1466
  title = _ref.title,
1469
1467
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1470
- headerSize = _ref.headerSize,
1471
- webhookHelpLink = _ref.webhookHelpLink;
1468
+ headerSize = _ref.headerSize;
1472
1469
  return /*#__PURE__*/jsxs(Fragment, {
1473
1470
  children: [/*#__PURE__*/jsx(Header$2, {
1474
1471
  breadcrumbs: breadcrumbs,
@@ -1485,7 +1482,7 @@ var Header = withT(function (_ref) {
1485
1482
  children: [t("neetoWebhooks.webhook.title"), /*#__PURE__*/jsx(HelpPopover, {
1486
1483
  description: t("neetoWebhooks.webhook.helpDescription"),
1487
1484
  helpLinkProps: {
1488
- href: webhookHelpLink
1485
+ href: HELP_LINK_URLS.webhook
1489
1486
  },
1490
1487
  title: t("neetoWebhooks.webhook.title")
1491
1488
  })]
@@ -1511,9 +1508,7 @@ var Webhooks = function Webhooks(_ref) {
1511
1508
  onDelete = _ref.onDelete,
1512
1509
  headerSize = _ref.headerSize,
1513
1510
  _ref$containerClassNa = _ref.containerClassName,
1514
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1515
- webhookHelpLink = _ref.webhookHelpLink,
1516
- secretsHelpLink = _ref.secretsHelpLink;
1511
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1517
1512
  var _useState = useState(null),
1518
1513
  _useState2 = _slicedToArray(_useState, 2),
1519
1514
  editingWebhookId = _useState2[0],
@@ -1577,8 +1572,7 @@ var Webhooks = function Webhooks(_ref) {
1577
1572
  breadcrumbs: breadcrumbs,
1578
1573
  headerSize: headerSize,
1579
1574
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1580
- title: title,
1581
- webhookHelpLink: webhookHelpLink
1575
+ title: title
1582
1576
  }), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
1583
1577
  hasPagination: totalCount > DEFAULT_PAGE_SIZE,
1584
1578
  children: /*#__PURE__*/jsx(Table, {
@@ -1599,7 +1593,7 @@ var Webhooks = function Webhooks(_ref) {
1599
1593
  children: /*#__PURE__*/jsx(NoData, {
1600
1594
  title: t("neetoWebhooks.webhook.empty"),
1601
1595
  helpText: /*#__PURE__*/jsx(Button, {
1602
- href: webhookHelpLink,
1596
+ href: HELP_LINK_URLS.webhook,
1603
1597
  label: t("neetoWebhooks.webhook.emptyHelpText"),
1604
1598
  rel: "noreferrer",
1605
1599
  style: "link",
@@ -1617,8 +1611,6 @@ var Webhooks = function Webhooks(_ref) {
1617
1611
  entityId: entityId,
1618
1612
  entityType: entityType,
1619
1613
  onCreate: onCreate,
1620
- secretsHelpLink: secretsHelpLink,
1621
- webhookHelpLink: webhookHelpLink,
1622
1614
  webhooks: webhooks,
1623
1615
  isOpen: isAddWebhookPaneOpen,
1624
1616
  onClose: handlePaneClose
@@ -1659,15 +1651,12 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1659
1651
  onCreate = _ref.onCreate,
1660
1652
  onDelete = _ref.onDelete,
1661
1653
  headerSize = _ref.headerSize,
1662
- _ref$helpLinkUrls = _ref.helpLinkUrls,
1663
- helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls,
1664
1654
  containerClassName = _ref.containerClassName;
1665
1655
  var _useRouteMatch = useRouteMatch(),
1666
1656
  webhooksPath = _useRouteMatch.path,
1667
1657
  webhooksUrl = _useRouteMatch.url;
1668
1658
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1669
1659
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1670
- var helpLinks = mergeRight(HELP_LINK_URLS, helpLinkUrls);
1671
1660
  return /*#__PURE__*/jsxs(Switch$1, {
1672
1661
  children: [/*#__PURE__*/jsx(Route, {
1673
1662
  exact: true,
@@ -1682,9 +1671,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1682
1671
  headerSize: headerSize,
1683
1672
  onCreate: onCreate,
1684
1673
  onDelete: onDelete,
1685
- title: title,
1686
- secretsHelpLink: helpLinks.secrets,
1687
- webhookHelpLink: helpLinks.webhook
1674
+ title: title
1688
1675
  });
1689
1676
  }
1690
1677
  }), /*#__PURE__*/jsx(Route, {
@@ -1693,8 +1680,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1693
1680
  render: function render() {
1694
1681
  return /*#__PURE__*/jsx(Deliveries$1, {
1695
1682
  breadcrumbs: breadcrumbs,
1696
- webhooksUrl: webhooksUrl,
1697
- helpLink: helpLinks.deliveries
1683
+ webhooksUrl: webhooksUrl
1698
1684
  });
1699
1685
  }
1700
1686
  }), /*#__PURE__*/jsx(Route, {
@@ -1702,8 +1688,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1702
1688
  render: function render() {
1703
1689
  return /*#__PURE__*/jsx(Deliveries$1, {
1704
1690
  breadcrumbs: breadcrumbs,
1705
- webhooksUrl: webhooksUrl,
1706
- helpLink: helpLinks.deliveries
1691
+ webhooksUrl: webhooksUrl
1707
1692
  });
1708
1693
  }
1709
1694
  })]