@bigbinary/neeto-rules-frontend 2.0.0 → 2.0.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 +1 -1
- package/app/javascript/src/translations/en.json +1 -1
- package/dist/index.cjs.js +36 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +36 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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,
|
|
3
|
+
import { isNotEmpty, isPresent, removeBy, 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';
|
|
@@ -30,6 +30,7 @@ import { t as t$5 } from 'i18next';
|
|
|
30
30
|
import { buildUrl, joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
31
31
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
32
32
|
import Switch from '@bigbinary/neetoui/Switch';
|
|
33
|
+
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
33
34
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
34
35
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
35
36
|
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
@@ -56,7 +57,6 @@ import Tag from '@bigbinary/neetoui/Tag';
|
|
|
56
57
|
import * as yup from 'yup';
|
|
57
58
|
import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
|
|
58
59
|
import Eye from '@bigbinary/neeto-icons/Eye';
|
|
59
|
-
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
60
60
|
import Select$2 from '@bigbinary/neetoui/formik/Select';
|
|
61
61
|
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
62
62
|
import Help from '@bigbinary/neeto-icons/Help';
|
|
@@ -233,7 +233,7 @@ function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t
|
|
|
233
233
|
var useFetchAutomationRules = function useFetchAutomationRules(params) {
|
|
234
234
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
235
235
|
return useQuery(_objectSpread$t({
|
|
236
|
-
queryKey: [AUTOMATION_RULES, params],
|
|
236
|
+
queryKey: [AUTOMATION_RULES, params.url, params],
|
|
237
237
|
queryFn: function queryFn() {
|
|
238
238
|
return automationRulesApi.fetch(params);
|
|
239
239
|
},
|
|
@@ -244,24 +244,24 @@ var useFetchAutomationRules = function useFetchAutomationRules(params) {
|
|
|
244
244
|
placeholderData: keepPreviousData
|
|
245
245
|
}, options));
|
|
246
246
|
};
|
|
247
|
-
var useUpdateAutomationRule = function useUpdateAutomationRule() {
|
|
247
|
+
var useUpdateAutomationRule = function useUpdateAutomationRule(url) {
|
|
248
248
|
return useMutationWithInvalidation(automationRulesApi.update, {
|
|
249
|
-
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
249
|
+
keysToInvalidate: [[AUTOMATION_RULES, url]]
|
|
250
250
|
});
|
|
251
251
|
};
|
|
252
|
-
var useCloneAutomationRule = function useCloneAutomationRule() {
|
|
252
|
+
var useCloneAutomationRule = function useCloneAutomationRule(url) {
|
|
253
253
|
return useMutationWithInvalidation(automationRulesApi.clone, {
|
|
254
|
-
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
254
|
+
keysToInvalidate: [[AUTOMATION_RULES, url]]
|
|
255
255
|
});
|
|
256
256
|
};
|
|
257
|
-
var useDeleteAutomationRule = function useDeleteAutomationRule() {
|
|
257
|
+
var useDeleteAutomationRule = function useDeleteAutomationRule(url) {
|
|
258
258
|
return useMutationWithInvalidation(automationRulesApi.destroy, {
|
|
259
|
-
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
259
|
+
keysToInvalidate: [[AUTOMATION_RULES, url]]
|
|
260
260
|
});
|
|
261
261
|
};
|
|
262
|
-
var useReorderAutomationRules = function useReorderAutomationRules() {
|
|
262
|
+
var useReorderAutomationRules = function useReorderAutomationRules(url) {
|
|
263
263
|
return useMutationWithInvalidation(automationRulesApi.reorder, {
|
|
264
|
-
keysToInvalidate: [[AUTOMATION_RULES]]
|
|
264
|
+
keysToInvalidate: [[AUTOMATION_RULES, url]]
|
|
265
265
|
});
|
|
266
266
|
};
|
|
267
267
|
|
|
@@ -282,13 +282,14 @@ var Header = function Header(_ref) {
|
|
|
282
282
|
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
|
|
283
283
|
setIsReorderPaneOpen = _ref.setIsReorderPaneOpen,
|
|
284
284
|
hasUnfilteredRules = _ref.hasUnfilteredRules,
|
|
285
|
-
allowReordering = _ref.allowReordering
|
|
285
|
+
allowReordering = _ref.allowReordering,
|
|
286
|
+
headerProps = _ref.headerProps;
|
|
286
287
|
var _useQueryParams = useQueryParams(),
|
|
287
288
|
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
288
289
|
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
289
290
|
var _useTranslation = useTranslation(),
|
|
290
291
|
t = _useTranslation.t;
|
|
291
|
-
return /*#__PURE__*/jsx$1(NeetoHeader, {
|
|
292
|
+
return /*#__PURE__*/jsx$1(NeetoHeader, _objectSpread$s({
|
|
292
293
|
breadcrumbs: breadcrumbs,
|
|
293
294
|
actionBlock: /*#__PURE__*/jsxs(Fragment, {
|
|
294
295
|
children: [hasUnfilteredRules && allowReordering && /*#__PURE__*/jsx$1(Button, {
|
|
@@ -319,7 +320,7 @@ var Header = function Header(_ref) {
|
|
|
319
320
|
title: t("neetoRules.common.title")
|
|
320
321
|
}, helpPopoverProps))]
|
|
321
322
|
})
|
|
322
|
-
});
|
|
323
|
+
}, headerProps));
|
|
323
324
|
};
|
|
324
325
|
var Header$1 = /*#__PURE__*/React__default.memo(Header);
|
|
325
326
|
|
|
@@ -9448,7 +9449,7 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9448
9449
|
setInitialRules = _useState2[1];
|
|
9449
9450
|
var _useTranslation = useTranslation(),
|
|
9450
9451
|
t = _useTranslation.t;
|
|
9451
|
-
var _useReorderAutomation = useReorderAutomationRules(),
|
|
9452
|
+
var _useReorderAutomation = useReorderAutomationRules(url),
|
|
9452
9453
|
reOrder = _useReorderAutomation.mutate,
|
|
9453
9454
|
isPending = _useReorderAutomation.isPending;
|
|
9454
9455
|
var handleReorderSave = function handleReorderSave(rules) {
|
|
@@ -9650,6 +9651,9 @@ var buildActionDropdownMenuItems = function buildActionDropdownMenuItems(_ref) {
|
|
|
9650
9651
|
onClick: function onClick() {
|
|
9651
9652
|
return onClone(rule.id);
|
|
9652
9653
|
}
|
|
9654
|
+
}, {
|
|
9655
|
+
key: "divider",
|
|
9656
|
+
type: "divider"
|
|
9653
9657
|
}, {
|
|
9654
9658
|
key: "delete",
|
|
9655
9659
|
"data-test-id": "automation-rules-delete-link",
|
|
@@ -9716,10 +9720,17 @@ var getColumnData = function getColumnData(_ref3) {
|
|
|
9716
9720
|
key: "description",
|
|
9717
9721
|
width: 390,
|
|
9718
9722
|
render: function render(description) {
|
|
9719
|
-
return /*#__PURE__*/jsx$1(
|
|
9720
|
-
|
|
9723
|
+
return isPresent(description) ? /*#__PURE__*/jsx$1(Tooltip, {
|
|
9724
|
+
content: description,
|
|
9725
|
+
position: "bottom",
|
|
9726
|
+
children: /*#__PURE__*/jsx$1(Typography, {
|
|
9727
|
+
className: "line-clamp-2 whitespace-pre-line",
|
|
9728
|
+
style: "body2",
|
|
9729
|
+
children: description
|
|
9730
|
+
})
|
|
9731
|
+
}) : /*#__PURE__*/jsx$1(Typography, {
|
|
9721
9732
|
style: "body2",
|
|
9722
|
-
children:
|
|
9733
|
+
children: "-"
|
|
9723
9734
|
});
|
|
9724
9735
|
}
|
|
9725
9736
|
}, {
|
|
@@ -9794,13 +9805,13 @@ var RulesTable = function RulesTable(_ref) {
|
|
|
9794
9805
|
hidePreviewPane = _useUtilityStore.hidePreviewPane;
|
|
9795
9806
|
var _useTranslation = useTranslation(),
|
|
9796
9807
|
t = _useTranslation.t;
|
|
9797
|
-
var _useUpdateAutomationR = useUpdateAutomationRule(),
|
|
9808
|
+
var _useUpdateAutomationR = useUpdateAutomationRule(url),
|
|
9798
9809
|
updateRule = _useUpdateAutomationR.mutate,
|
|
9799
9810
|
isUpdating = _useUpdateAutomationR.isPending;
|
|
9800
|
-
var _useCloneAutomationRu = useCloneAutomationRule(),
|
|
9811
|
+
var _useCloneAutomationRu = useCloneAutomationRule(url),
|
|
9801
9812
|
cloneRule = _useCloneAutomationRu.mutate,
|
|
9802
9813
|
isCloning = _useCloneAutomationRu.isPending;
|
|
9803
|
-
var _useDeleteAutomationR = useDeleteAutomationRule(),
|
|
9814
|
+
var _useDeleteAutomationR = useDeleteAutomationRule(url),
|
|
9804
9815
|
deleteRule = _useDeleteAutomationR.mutate,
|
|
9805
9816
|
isDeleting = _useDeleteAutomationR.isPending;
|
|
9806
9817
|
var handleChangeStatus = function handleChangeStatus(event, id) {
|
|
@@ -9936,7 +9947,9 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9936
9947
|
deleteRule = _ref.deleteRule,
|
|
9937
9948
|
cloneRule = _ref.cloneRule,
|
|
9938
9949
|
updateRule = _ref.updateRule,
|
|
9939
|
-
reorderRules = _ref.reorderRules
|
|
9950
|
+
reorderRules = _ref.reorderRules,
|
|
9951
|
+
_ref$headerProps = _ref.headerProps,
|
|
9952
|
+
headerProps = _ref$headerProps === void 0 ? {} : _ref$headerProps;
|
|
9940
9953
|
var _useState = useState(false),
|
|
9941
9954
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
9942
9955
|
isReorderPaneOpen = _useState2[0],
|
|
@@ -9970,6 +9983,7 @@ var NeetoRules = function NeetoRules(_ref) {
|
|
|
9970
9983
|
automationRulesPath: automationRulesPath,
|
|
9971
9984
|
breadcrumbs: breadcrumbs,
|
|
9972
9985
|
hasUnfilteredRules: hasUnfilteredRules,
|
|
9986
|
+
headerProps: headerProps,
|
|
9973
9987
|
helpPopoverProps: helpPopoverProps,
|
|
9974
9988
|
setIsReorderPaneOpen: setIsReorderPaneOpen
|
|
9975
9989
|
}), /*#__PURE__*/jsx$1(RulesTable, _objectSpread$m(_objectSpread$m({}, _objectSpread$m({
|