@bigbinary/neeto-rules-frontend 1.1.0 → 1.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.
- package/README.md +5 -4
- package/dist/index.cjs.js +84 -50
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +33 -10
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useRef, useEffect, useContext, useLayoutEffect as useLayoutEffect$1, createElement, useMemo as useMemo$1, forwardRef, createContext, useCallback as useCallback$1, Component, Fragment as Fragment$1, memo } from 'react';
|
|
3
|
-
import { isNotEmpty, isPresent, renameKeys, findBy, noop as noop$4, nullSafe, toLabelAndValue
|
|
3
|
+
import { isNotEmpty, removeBy, isPresent, renameKeys, findBy, noop as noop$4, nullSafe, toLabelAndValue } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
5
5
|
import { useMutationWithInvalidation, useQueryParams, withImmutableActions, withT, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
6
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
@@ -12,7 +12,7 @@ import Button from '@bigbinary/neetoui/Button';
|
|
|
12
12
|
import { useTranslation, Trans } from 'react-i18next';
|
|
13
13
|
import { jsx as jsx$1, jsxs, Fragment } from 'react/jsx-runtime';
|
|
14
14
|
import ReactDOM, { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
15
|
-
import
|
|
15
|
+
import Reorder from '@bigbinary/neeto-icons/Reorder';
|
|
16
16
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
17
17
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
18
18
|
import Pagination from '@bigbinary/neetoui/Pagination';
|
|
@@ -31,7 +31,12 @@ import { buildUrl, joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-fr
|
|
|
31
31
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
32
32
|
import Switch from '@bigbinary/neetoui/Switch';
|
|
33
33
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
34
|
+
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
35
|
+
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
36
|
+
import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
34
37
|
import classNames$1 from 'classnames';
|
|
38
|
+
import Check from '@bigbinary/neeto-icons/Check';
|
|
39
|
+
import Search from '@bigbinary/neeto-icons/Search';
|
|
35
40
|
import Dropdown$1 from '@bigbinary/neetoui/Dropdown';
|
|
36
41
|
import Input$2 from '@bigbinary/neetoui/Input';
|
|
37
42
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
@@ -44,14 +49,19 @@ import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
|
44
49
|
import MultiEmailInput from '@bigbinary/neetoui/formik/MultiEmailInput';
|
|
45
50
|
import Input$3 from '@bigbinary/neetoui/formik/Input';
|
|
46
51
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
52
|
+
import Close from '@bigbinary/neeto-icons/Close';
|
|
47
53
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
48
54
|
import { isPhoneNumberValid } from '@bigbinary/neeto-molecules/PhoneNumber';
|
|
49
55
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
50
56
|
import * as yup from 'yup';
|
|
51
57
|
import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
|
|
58
|
+
import Eye from '@bigbinary/neeto-icons/Eye';
|
|
52
59
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
53
60
|
import Select$2 from '@bigbinary/neetoui/formik/Select';
|
|
54
61
|
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
62
|
+
import Help from '@bigbinary/neeto-icons/Help';
|
|
63
|
+
import Down from '@bigbinary/neeto-icons/Down';
|
|
64
|
+
import Up from '@bigbinary/neeto-icons/Up';
|
|
55
65
|
|
|
56
66
|
function _typeof$3(o) {
|
|
57
67
|
"@babel/helpers - typeof";
|
|
@@ -9613,8 +9623,9 @@ var buildActionDropdownMenuItems = function buildActionDropdownMenuItems(_ref) {
|
|
|
9613
9623
|
onDelete = _ref.onDelete,
|
|
9614
9624
|
_ref$moreDropdownItem = _ref.moreDropdownItems,
|
|
9615
9625
|
moreDropdownItems = _ref$moreDropdownItem === void 0 ? [] : _ref$moreDropdownItem,
|
|
9616
|
-
automationRulesPath = _ref.automationRulesPath
|
|
9617
|
-
|
|
9626
|
+
automationRulesPath = _ref.automationRulesPath,
|
|
9627
|
+
allowCloning = _ref.allowCloning;
|
|
9628
|
+
var defaultOptions = [].concat(_toConsumableArray$1(moreDropdownItems.map(function (_ref2) {
|
|
9618
9629
|
var _onClick = _ref2.onClick,
|
|
9619
9630
|
others = _objectWithoutProperties$1(_ref2, _excluded$h);
|
|
9620
9631
|
return _objectSpread$o(_objectSpread$o({}, others), {}, {
|
|
@@ -9645,6 +9656,12 @@ var buildActionDropdownMenuItems = function buildActionDropdownMenuItems(_ref) {
|
|
|
9645
9656
|
return onDelete(rule);
|
|
9646
9657
|
}
|
|
9647
9658
|
}]);
|
|
9659
|
+
if (!allowCloning) {
|
|
9660
|
+
return removeBy({
|
|
9661
|
+
key: "clone"
|
|
9662
|
+
}, defaultOptions);
|
|
9663
|
+
}
|
|
9664
|
+
return defaultOptions;
|
|
9648
9665
|
};
|
|
9649
9666
|
var getColumnData = function getColumnData(_ref3) {
|
|
9650
9667
|
var handleChangeStatus = _ref3.handleChangeStatus,
|
|
@@ -9757,7 +9774,9 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9757
9774
|
onCloneSuccess = _ref.onCloneSuccess,
|
|
9758
9775
|
onUpdateSuccess = _ref.onUpdateSuccess,
|
|
9759
9776
|
page = _ref.page,
|
|
9760
|
-
setPage = _ref.setPage
|
|
9777
|
+
setPage = _ref.setPage,
|
|
9778
|
+
_ref$allowCloning = _ref.allowCloning,
|
|
9779
|
+
allowCloning = _ref$allowCloning === void 0 ? true : _ref$allowCloning;
|
|
9761
9780
|
var _useQueryParams = useQueryParams(),
|
|
9762
9781
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
9763
9782
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
@@ -9794,15 +9813,17 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9794
9813
|
url: url,
|
|
9795
9814
|
payload: payload
|
|
9796
9815
|
}, {
|
|
9797
|
-
onSuccess:
|
|
9816
|
+
onSuccess: function onSuccess() {
|
|
9817
|
+
return onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess();
|
|
9818
|
+
}
|
|
9798
9819
|
});
|
|
9799
9820
|
};
|
|
9800
9821
|
var handleCloneSuccess = function handleCloneSuccess() {
|
|
9801
|
-
onCloneSuccess();
|
|
9822
|
+
onCloneSuccess === null || onCloneSuccess === void 0 || onCloneSuccess();
|
|
9802
9823
|
hidePreviewPane();
|
|
9803
9824
|
};
|
|
9804
9825
|
var handleDeleteSuccess = function handleDeleteSuccess() {
|
|
9805
|
-
onDeleteSuccess();
|
|
9826
|
+
onDeleteSuccess === null || onDeleteSuccess === void 0 || onDeleteSuccess();
|
|
9806
9827
|
hidePreviewPane();
|
|
9807
9828
|
setSelectedRule(null);
|
|
9808
9829
|
};
|
|
@@ -9820,7 +9841,8 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9820
9841
|
onDelete: setSelectedRule,
|
|
9821
9842
|
onPreview: onPreview,
|
|
9822
9843
|
automationRulesPath: automationRulesPath,
|
|
9823
|
-
moreDropdownItems: moreDropdownItems
|
|
9844
|
+
moreDropdownItems: moreDropdownItems,
|
|
9845
|
+
allowCloning: allowCloning
|
|
9824
9846
|
});
|
|
9825
9847
|
if (isLoading && isEmpty(rules)) {
|
|
9826
9848
|
return /*#__PURE__*/jsx$1(PageLoader, {});
|
|
@@ -9899,7 +9921,7 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9899
9921
|
function ownKeys$n(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; }
|
|
9900
9922
|
function _objectSpread$m(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$n(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$n(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9901
9923
|
var NeetoRules = function NeetoRules(_ref) {
|
|
9902
|
-
var _helpPopoverProps$hel, _cloneRule$onSuccess, _deleteRule$onSuccess, _updateRule$onSuccess, _reorderRules$onSucce;
|
|
9924
|
+
var _helpPopoverProps$hel, _cloneRule$allowed, _cloneRule$onSuccess, _deleteRule$onSuccess, _updateRule$onSuccess, _reorderRules$onSucce;
|
|
9903
9925
|
var breadcrumbs = _ref.breadcrumbs,
|
|
9904
9926
|
automationRulesPath = _ref.automationRulesPath,
|
|
9905
9927
|
url = _ref.automationRulesEndpoint,
|
|
@@ -9957,6 +9979,7 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9957
9979
|
totalCount: totalCount,
|
|
9958
9980
|
url: url
|
|
9959
9981
|
}, rulesTableProps)), {}, {
|
|
9982
|
+
allowCloning: (_cloneRule$allowed = cloneRule === null || cloneRule === void 0 ? void 0 : cloneRule.allowed) !== null && _cloneRule$allowed !== void 0 ? _cloneRule$allowed : true,
|
|
9960
9983
|
isLoading: isLoading || isFetching,
|
|
9961
9984
|
onCloneSuccess: cloneRule === null || cloneRule === void 0 || (_cloneRule$onSuccess = cloneRule.onSuccess) === null || _cloneRule$onSuccess === void 0 ? void 0 : _cloneRule$onSuccess.callback,
|
|
9962
9985
|
onDeleteSuccess: deleteRule === null || deleteRule === void 0 || (_deleteRule$onSuccess = deleteRule.onSuccess) === null || _deleteRule$onSuccess === void 0 ? void 0 : _deleteRule$onSuccess.callback,
|