@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
  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
- import { isNotPresent, isPresent, removeBy, isNotEmpty, removeById, findBy } from '@bigbinary/neeto-cist';
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';
6
5
  import { useQueryParams, useMutationWithInvalidation, withT } from '@bigbinary/neeto-commons-frontend/react-utils';
7
6
  import Container from '@bigbinary/neeto-molecules/Container';
@@ -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);
@@ -771,7 +772,7 @@ var Details = function Details(_ref) {
771
772
  isRedelivering = _useRedeliverWebhook.isPending,
772
773
  redeliverWebhook = _useRedeliverWebhook.mutateAsync;
773
774
  var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
774
- isLoading = _useShowDelivery.isLoading,
775
+ isLoading = _useShowDelivery.isPending,
775
776
  _useShowDelivery$data = _useShowDelivery.data,
776
777
  _useShowDelivery$data2 = _useShowDelivery$data === void 0 ? {} : _useShowDelivery$data,
777
778
  delivery = _useShowDelivery$data2.delivery;
@@ -792,9 +793,6 @@ var Details = function Details(_ref) {
792
793
  return _ref2.apply(this, arguments);
793
794
  };
794
795
  }();
795
- if (isNotPresent(delivery)) {
796
- return null;
797
- }
798
796
  return /*#__PURE__*/jsx(Pane, {
799
797
  onClose: onClose,
800
798
  isOpen: isPresent(deliveryId),
@@ -916,8 +914,7 @@ var buildColumns$1 = function buildColumns(_ref) {
916
914
 
917
915
  var Deliveries = function Deliveries(_ref) {
918
916
  var webhooksUrl = _ref.webhooksUrl,
919
- hostBreadcrumbs = _ref.breadcrumbs,
920
- helpLink = _ref.helpLink;
917
+ hostBreadcrumbs = _ref.breadcrumbs;
921
918
  var _useRouteMatch = useRouteMatch(),
922
919
  deliveriesUrl = _useRouteMatch.url;
923
920
  var history = useHistory();
@@ -962,7 +959,7 @@ var Deliveries = function Deliveries(_ref) {
962
959
  children: [t("neetoWebhooks.delivery.title"), /*#__PURE__*/jsx(HelpPopover, {
963
960
  description: t("neetoWebhooks.delivery.helpDescription"),
964
961
  helpLinkProps: {
965
- href: helpLink
962
+ href: HELP_LINK_URLS.deliveries
966
963
  },
967
964
  title: t("neetoWebhooks.delivery.title")
968
965
  })]
@@ -1282,9 +1279,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1282
1279
  isOpen = _ref.isOpen,
1283
1280
  onClose = _ref.onClose,
1284
1281
  onCreate = _ref.onCreate,
1285
- webhooks = _ref.webhooks,
1286
- webhookHelpLink = _ref.webhookHelpLink,
1287
- secretsHelpLink = _ref.secretsHelpLink;
1282
+ webhooks = _ref.webhooks;
1288
1283
  var _useTranslation = useTranslation(),
1289
1284
  t = _useTranslation.t;
1290
1285
  var _useState = useState(false),
@@ -1364,7 +1359,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1364
1359
  }), /*#__PURE__*/jsx(HelpPopover, {
1365
1360
  description: t("neetoWebhooks.webhook.helpDescription"),
1366
1361
  helpLinkProps: {
1367
- href: webhookHelpLink
1362
+ href: HELP_LINK_URLS.webhook
1368
1363
  },
1369
1364
  title: t("neetoWebhooks.webhook.title")
1370
1365
  })]
@@ -1412,7 +1407,7 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
1412
1407
  className: "flex items-center gap-x-2",
1413
1408
  children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsx(HelpPopover, {
1414
1409
  helpLinkProps: {
1415
- href: secretsHelpLink
1410
+ href: HELP_LINK_URLS.secrets
1416
1411
  },
1417
1412
  description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
1418
1413
  title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
@@ -1470,8 +1465,7 @@ var Header = withT(function (_ref) {
1470
1465
  breadcrumbs = _ref.breadcrumbs,
1471
1466
  title = _ref.title,
1472
1467
  setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen,
1473
- headerSize = _ref.headerSize,
1474
- webhookHelpLink = _ref.webhookHelpLink;
1468
+ headerSize = _ref.headerSize;
1475
1469
  return /*#__PURE__*/jsxs(Fragment, {
1476
1470
  children: [/*#__PURE__*/jsx(Header$2, {
1477
1471
  breadcrumbs: breadcrumbs,
@@ -1488,7 +1482,7 @@ var Header = withT(function (_ref) {
1488
1482
  children: [t("neetoWebhooks.webhook.title"), /*#__PURE__*/jsx(HelpPopover, {
1489
1483
  description: t("neetoWebhooks.webhook.helpDescription"),
1490
1484
  helpLinkProps: {
1491
- href: webhookHelpLink
1485
+ href: HELP_LINK_URLS.webhook
1492
1486
  },
1493
1487
  title: t("neetoWebhooks.webhook.title")
1494
1488
  })]
@@ -1514,9 +1508,7 @@ var Webhooks = function Webhooks(_ref) {
1514
1508
  onDelete = _ref.onDelete,
1515
1509
  headerSize = _ref.headerSize,
1516
1510
  _ref$containerClassNa = _ref.containerClassName,
1517
- containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa,
1518
- webhookHelpLink = _ref.webhookHelpLink,
1519
- secretsHelpLink = _ref.secretsHelpLink;
1511
+ containerClassName = _ref$containerClassNa === void 0 ? "" : _ref$containerClassNa;
1520
1512
  var _useState = useState(null),
1521
1513
  _useState2 = _slicedToArray(_useState, 2),
1522
1514
  editingWebhookId = _useState2[0],
@@ -1580,8 +1572,7 @@ var Webhooks = function Webhooks(_ref) {
1580
1572
  breadcrumbs: breadcrumbs,
1581
1573
  headerSize: headerSize,
1582
1574
  setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen,
1583
- title: title,
1584
- webhookHelpLink: webhookHelpLink
1575
+ title: title
1585
1576
  }), isNotEmpty(webhooks) ? /*#__PURE__*/jsx(TableWrapper, {
1586
1577
  hasPagination: totalCount > DEFAULT_PAGE_SIZE,
1587
1578
  children: /*#__PURE__*/jsx(Table, {
@@ -1620,8 +1611,6 @@ var Webhooks = function Webhooks(_ref) {
1620
1611
  entityId: entityId,
1621
1612
  entityType: entityType,
1622
1613
  onCreate: onCreate,
1623
- secretsHelpLink: secretsHelpLink,
1624
- webhookHelpLink: webhookHelpLink,
1625
1614
  webhooks: webhooks,
1626
1615
  isOpen: isAddWebhookPaneOpen,
1627
1616
  onClose: handlePaneClose
@@ -1662,15 +1651,12 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1662
1651
  onCreate = _ref.onCreate,
1663
1652
  onDelete = _ref.onDelete,
1664
1653
  headerSize = _ref.headerSize,
1665
- _ref$helpLinkUrls = _ref.helpLinkUrls,
1666
- helpLinkUrls = _ref$helpLinkUrls === void 0 ? {} : _ref$helpLinkUrls,
1667
1654
  containerClassName = _ref.containerClassName;
1668
1655
  var _useRouteMatch = useRouteMatch(),
1669
1656
  webhooksPath = _useRouteMatch.path,
1670
1657
  webhooksUrl = _useRouteMatch.url;
1671
1658
  var deliveriesPath = getDeliveriesPath(webhooksUrl);
1672
1659
  var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
1673
- var helpLinks = mergeRight(HELP_LINK_URLS, helpLinkUrls);
1674
1660
  return /*#__PURE__*/jsxs(Switch$1, {
1675
1661
  children: [/*#__PURE__*/jsx(Route, {
1676
1662
  exact: true,
@@ -1685,9 +1671,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1685
1671
  headerSize: headerSize,
1686
1672
  onCreate: onCreate,
1687
1673
  onDelete: onDelete,
1688
- title: title,
1689
- secretsHelpLink: helpLinks.secrets,
1690
- webhookHelpLink: helpLinks.webhook
1674
+ title: title
1691
1675
  });
1692
1676
  }
1693
1677
  }), /*#__PURE__*/jsx(Route, {
@@ -1696,17 +1680,15 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
1696
1680
  render: function render() {
1697
1681
  return /*#__PURE__*/jsx(Deliveries$1, {
1698
1682
  breadcrumbs: breadcrumbs,
1699
- webhooksUrl: webhooksUrl,
1700
- helpLink: helpLinks.deliveries
1683
+ webhooksUrl: webhooksUrl
1701
1684
  });
1702
1685
  }
1703
1686
  }), /*#__PURE__*/jsx(Route, {
1704
1687
  path: deliveriesPath,
1705
- component: function component() {
1688
+ render: function render() {
1706
1689
  return /*#__PURE__*/jsx(Deliveries$1, {
1707
1690
  breadcrumbs: breadcrumbs,
1708
- webhooksUrl: webhooksUrl,
1709
- helpLink: helpLinks.deliveries
1691
+ webhooksUrl: webhooksUrl
1710
1692
  });
1711
1693
  }
1712
1694
  })]