@bigbinary/neeto-approvals-frontend 1.0.0 → 1.1.0

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import React, { useState, useEffect, useRef, createElement, useMemo } from 'react';
1
+ import { useState, useEffect, memo, useRef, createElement, useMemo } from 'react';
2
2
  import { useMutationWithInvalidation, useDebounce, withT, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
3
3
  import Container from '@bigbinary/neeto-molecules/Container';
4
- import { Link, useLocation, useHistory, Switch, Route, Redirect, useParams } from 'react-router-dom';
4
+ import { useLocation, useHistory, Switch, Route, Redirect, useParams } from 'react-router-dom';
5
5
  import i18next, { t as t$1 } from 'i18next';
6
6
  import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE, PLURAL, SINGULAR } from '@bigbinary/neeto-commons-frontend/constants';
7
7
  import Button from '@bigbinary/neetoui/Button';
@@ -13,8 +13,8 @@ import { isEmpty, keys } from 'ramda';
13
13
  import { useTranslation, Trans } from 'react-i18next';
14
14
  import { useQuery, keepPreviousData } from '@tanstack/react-query';
15
15
  import axios from 'axios';
16
- import Tag from '@bigbinary/neetoui/Tag';
17
16
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
17
+ import Tag from '@bigbinary/neetoui/Tag';
18
18
  import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
19
19
  import * as yup from 'yup';
20
20
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -408,7 +408,7 @@ var getApprovalFilter = function getApprovalFilter() {
408
408
  };
409
409
  };
410
410
 
411
- var MemoizedEditorContent$1 = /*#__PURE__*/React.memo(EditorContent);
411
+ var MemoizedEditorContent$1 = /*#__PURE__*/memo(EditorContent);
412
412
  var RequestDetailsPane = function RequestDetailsPane(_ref) {
413
413
  var _window$globalProps, _window$globalProps2;
414
414
  var isOpen = _ref.isOpen,
@@ -539,7 +539,8 @@ var RequestDetailsPane = function RequestDetailsPane(_ref) {
539
539
  function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
540
540
  function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
541
541
  var History = function History(_ref) {
542
- var requestUrl = _ref.requestUrl;
542
+ var helpDocUrl = _ref.helpDocUrl,
543
+ requestUrl = _ref.requestUrl;
543
544
  var _useState = useState(DEFAULT_FILTER_VALUES),
544
545
  _useState2 = _slicedToArray(_useState, 2),
545
546
  filters = _useState2[0],
@@ -607,6 +608,22 @@ var History = function History(_ref) {
607
608
  }) : /*#__PURE__*/jsx("div", {
608
609
  className: "flex h-full w-full flex-grow items-center justify-center",
609
610
  children: /*#__PURE__*/jsx(NoData, {
611
+ helpText: /*#__PURE__*/jsx(Trans, {
612
+ i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
613
+ style: "link",
614
+ values: {
615
+ entity: t("neetoApprovals.common.history")
616
+ },
617
+ components: {
618
+ a: /*#__PURE__*/jsx(Button, {
619
+ style: "link",
620
+ target: "_blank",
621
+ to: {
622
+ pathname: helpDocUrl
623
+ }
624
+ })
625
+ }
626
+ }),
610
627
  title: t("neetoApprovals.common.notFound_", {
611
628
  what: t("neetoApprovals.common.record", PLURAL)
612
629
  })
@@ -628,7 +645,8 @@ var PENDING_TABLE_COLUMNS = removeBy({
628
645
  function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
629
646
  function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
630
647
  var PendingRequests = function PendingRequests(_ref) {
631
- var requestUrl = _ref.requestUrl;
648
+ var helpDocUrl = _ref.helpDocUrl,
649
+ requestUrl = _ref.requestUrl;
632
650
  var _useState = useState(DEFAULT_FILTER_VALUES),
633
651
  _useState2 = _slicedToArray(_useState, 2),
634
652
  filters = _useState2[0],
@@ -690,6 +708,22 @@ var PendingRequests = function PendingRequests(_ref) {
690
708
  }) : /*#__PURE__*/jsx("div", {
691
709
  className: "flex h-full w-full flex-grow items-center justify-center",
692
710
  children: /*#__PURE__*/jsx(NoData, {
711
+ helpText: /*#__PURE__*/jsx(Trans, {
712
+ i18nKey: "neetoApprovals.common.noDataHelpTextLearnMore",
713
+ style: "link",
714
+ components: {
715
+ a: /*#__PURE__*/jsx(Button, {
716
+ style: "link",
717
+ target: "_blank",
718
+ to: {
719
+ pathname: helpDocUrl
720
+ }
721
+ })
722
+ },
723
+ values: {
724
+ entity: t("neetoApprovals.common.pendingApproval", PLURAL)
725
+ }
726
+ }),
693
727
  title: t("neetoApprovals.common.notFound_", {
694
728
  what: t("neetoApprovals.common.pendingApproval", PLURAL)
695
729
  })
@@ -1041,9 +1075,9 @@ var Field = function Field(_ref) {
1041
1075
  })]
1042
1076
  });
1043
1077
  };
1044
- var Field$1 = /*#__PURE__*/React.memo(Field);
1078
+ var Field$1 = /*#__PURE__*/memo(Field);
1045
1079
 
1046
- var MemoizedEditorContent = /*#__PURE__*/React.memo(EditorContent);
1080
+ var MemoizedEditorContent = /*#__PURE__*/memo(EditorContent);
1047
1081
  var TemplateDetails = function TemplateDetails(_ref) {
1048
1082
  var isOpen = _ref.isOpen,
1049
1083
  onClose = _ref.onClose,
@@ -1089,12 +1123,13 @@ var renderNoDataHelpText = function renderNoDataHelpText(_ref) {
1089
1123
  url = _ref.url;
1090
1124
  return /*#__PURE__*/jsx(Trans, {
1091
1125
  i18nKey: "neetoApprovals.common.noDataHelpText",
1126
+ style: "link",
1092
1127
  values: {
1093
- entity: entity
1128
+ entity: entity.toLocaleLowerCase()
1094
1129
  },
1095
1130
  components: {
1096
- a: /*#__PURE__*/jsx(Link, {
1097
- className: "neeto-ui-text-primary-600 underline",
1131
+ a: /*#__PURE__*/jsx(Button, {
1132
+ style: "link",
1098
1133
  target: "_blank",
1099
1134
  to: {
1100
1135
  pathname: url
@@ -1108,7 +1143,6 @@ var _excluded$1 = ["entity", "columnData", "rowData", "totalCount", "filters", "
1108
1143
  function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1109
1144
  function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1110
1145
  var Table = function Table(_ref) {
1111
- var _t;
1112
1146
  var entity = _ref.entity,
1113
1147
  columnData = _ref.columnData,
1114
1148
  rowData = _ref.rowData,
@@ -1136,7 +1170,7 @@ var Table = function Table(_ref) {
1136
1170
  var noDataProps = {
1137
1171
  primaryButtonProps: {
1138
1172
  label: t("neetoApprovals.common.addNew_", {
1139
- what: (_t = t("neetoApprovals.common.template", SINGULAR)) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
1173
+ what: t("neetoApprovals.common.template", SINGULAR)
1140
1174
  }),
1141
1175
  onClick: function onClick() {
1142
1176
  return setIsPaneOpen(true);
@@ -1386,11 +1420,10 @@ var createRoutes = function createRoutes(_ref) {
1386
1420
  },
1387
1421
  path: "".concat(config.approvalsPath).concat(routes.templates.index),
1388
1422
  actionBlock: function actionBlock() {
1389
- var _t;
1390
1423
  return /*#__PURE__*/jsx(Button, {
1391
1424
  "data-cy": "neeto-approvals-templates-add-new-button",
1392
1425
  label: t$1("neetoApprovals.common.addNew_", {
1393
- what: (_t = t$1("neetoApprovals.common.template", SINGULAR)) === null || _t === void 0 ? void 0 : _t.toLocaleLowerCase()
1426
+ what: t$1("neetoApprovals.common.template", SINGULAR)
1394
1427
  }),
1395
1428
  onClick: function onClick() {
1396
1429
  return setIsNewTemplatePaneOpen(true);
@@ -1398,7 +1431,7 @@ var createRoutes = function createRoutes(_ref) {
1398
1431
  });
1399
1432
  },
1400
1433
  searchPlaceholder: t$1("neetoApprovals.inputs.placeholders.search_", {
1401
- what: t$1("neetoApprovals.common.template", PLURAL).toLocaleLowerCase()
1434
+ what: t$1("neetoApprovals.common.template", PLURAL)
1402
1435
  })
1403
1436
  }, {
1404
1437
  component: function component() {
@@ -1425,12 +1458,12 @@ var Header = function Header(_ref) {
1425
1458
  path: pathname
1426
1459
  }, appRoutes);
1427
1460
  return /*#__PURE__*/jsx(NeetoHeader, {
1461
+ breadcrumbs: breadcrumbs,
1428
1462
  actionBlock: currentTab === null || currentTab === void 0 || (_currentTab$actionBlo = currentTab.actionBlock) === null || _currentTab$actionBlo === void 0 ? void 0 : _currentTab$actionBlo.call(currentTab),
1429
1463
  title: t("neetoApprovals.common.approval", PLURAL),
1430
1464
  searchProps: (currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder) && {
1431
1465
  placeholder: currentTab === null || currentTab === void 0 ? void 0 : currentTab.searchPlaceholder
1432
- },
1433
- breadcrumbs: breadcrumbs
1466
+ }
1434
1467
  });
1435
1468
  };
1436
1469
 
@@ -1518,9 +1551,9 @@ var Approvals = function Approvals(_ref) {
1518
1551
  var path = _ref2.path,
1519
1552
  component = _ref2.component;
1520
1553
  return /*#__PURE__*/createElement(Route, {
1521
- exact: true,
1522
1554
  component: component,
1523
1555
  path: path,
1556
+ exact: true,
1524
1557
  key: path
1525
1558
  });
1526
1559
  }), /*#__PURE__*/jsx(Redirect, {