@bigbinary/neeto-rules-frontend 0.8.0-beta1 → 0.8.1
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 +61 -0
- package/app/javascript/src/translations/en.json +19 -1
- package/dist/index.cjs.js +676 -189
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +667 -189
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import { withImmutableActions, withT, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
1
|
+
import { withImmutableActions, withT, useMutationWithInvalidation, useQueryParams, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
2
2
|
import { create as create$1 } from 'zustand';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
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';
|
|
5
|
-
import { findBy, isNotEmpty, noop as noop$4,
|
|
5
|
+
import { findBy, isNotEmpty, noop as noop$4, isPresent, renameKeys, nullSafe, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
6
6
|
import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
7
7
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
8
8
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
9
9
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
10
10
|
import { Down, Up, Reorder, Delete, Check, Search, Close, Plus, Refresh, Eye } from '@bigbinary/neeto-icons';
|
|
11
11
|
import Button from '@bigbinary/neetoui/Button';
|
|
12
|
-
import { pluck, equals, clone, isNil,
|
|
12
|
+
import { pluck, isNotNil, isEmpty, equals, clone as clone$1, isNil, whereAny, useWith, path, split, assocPath, toLower, without, append as append$1, pipe, filter, uniq, join, map, assoc, mergeLeft, includes, test, partition } from 'ramda';
|
|
13
13
|
import { useTranslation, Trans } from 'react-i18next';
|
|
14
14
|
import { jsxs, Fragment, jsx as jsx$1 } from 'react/jsx-runtime';
|
|
15
15
|
import { t as t$5 } from 'i18next';
|
|
16
|
+
import { DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
|
|
17
|
+
import SubHeader from '@bigbinary/neeto-molecules/SubHeader';
|
|
18
|
+
import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
|
|
19
|
+
import Alert from '@bigbinary/neetoui/Alert';
|
|
20
|
+
import NoData from '@bigbinary/neetoui/NoData';
|
|
21
|
+
import Table from '@bigbinary/neetoui/Table';
|
|
22
|
+
import { useQuery } from 'react-query';
|
|
23
|
+
import axios from 'axios';
|
|
24
|
+
import { buildUrl, joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
25
|
+
import Switch from '@bigbinary/neetoui/Switch';
|
|
26
|
+
import { Link, withRouter } from 'react-router-dom';
|
|
16
27
|
import ReactDOM, { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
17
28
|
import Pagination from '@bigbinary/neetoui/Pagination';
|
|
18
|
-
import { withRouter } from 'react-router-dom';
|
|
19
29
|
import { shallow } from 'zustand/shallow';
|
|
20
30
|
import classNames$1 from 'classnames';
|
|
21
31
|
import { useFormikContext, Formik, Form, useField, FieldArray, ErrorMessage } from 'formik';
|
|
22
32
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
23
33
|
import { isPhoneNumberValid } from '@bigbinary/neeto-molecules/PhoneNumber';
|
|
24
34
|
import * as yup from 'yup';
|
|
25
|
-
import { isEditorEmpty
|
|
26
|
-
import { joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
35
|
+
import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
|
|
27
36
|
import Dropdown$1 from '@bigbinary/neetoui/Dropdown';
|
|
28
37
|
import Input$2 from '@bigbinary/neetoui/Input';
|
|
29
38
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
@@ -31,6 +40,7 @@ import Label from '@bigbinary/neetoui/Label';
|
|
|
31
40
|
import Select$1 from '@bigbinary/neetoui/Select';
|
|
32
41
|
import dayjs from 'dayjs';
|
|
33
42
|
import DatePicker from '@bigbinary/neetoui/DatePicker';
|
|
43
|
+
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
34
44
|
import MultiEmailInput from '@bigbinary/neetoui/formik/MultiEmailInput';
|
|
35
45
|
import Input$3 from '@bigbinary/neetoui/formik/Input';
|
|
36
46
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
@@ -160,6 +170,24 @@ var Title = function Title(_ref) {
|
|
|
160
170
|
});
|
|
161
171
|
};
|
|
162
172
|
|
|
173
|
+
var PREVIEW_CONDITION_LIMIT = 3;
|
|
174
|
+
var ACTION_TYPE = {
|
|
175
|
+
TEXT: "text",
|
|
176
|
+
NUMBER: "number",
|
|
177
|
+
DECIMAL: "decimal",
|
|
178
|
+
REGEX: "regex",
|
|
179
|
+
DATE: "date",
|
|
180
|
+
EMAIL: "email",
|
|
181
|
+
EMAIL_TO: "emailTo",
|
|
182
|
+
EMAIL_TO_IDS: "emailToIds",
|
|
183
|
+
SMS_TO_NUMBERS: "smsToNumbers",
|
|
184
|
+
MULTI_SELECT: "multiSelect",
|
|
185
|
+
SEND_TO_API: "sendToApi",
|
|
186
|
+
DROPDOWN: "dropdown",
|
|
187
|
+
MULTISELECT: "multiSelect"
|
|
188
|
+
};
|
|
189
|
+
var TEXT_FIELDS = [ACTION_TYPE.TEXT, ACTION_TYPE.NUMBER, ACTION_TYPE.DECIMAL, ACTION_TYPE.REGEX, ACTION_TYPE.DATE];
|
|
190
|
+
|
|
163
191
|
var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
164
192
|
var separator = _ref.separator,
|
|
165
193
|
values = _ref.values;
|
|
@@ -188,6 +216,48 @@ var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOptio
|
|
|
188
216
|
value: entitiy.metadata.value
|
|
189
217
|
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
190
218
|
};
|
|
219
|
+
var getActionDisplayValue = function getActionDisplayValue(action, actionOption) {
|
|
220
|
+
var displayValueData = {
|
|
221
|
+
displayValue: null,
|
|
222
|
+
isBulk: false
|
|
223
|
+
};
|
|
224
|
+
if (TEXT_FIELDS.includes(actionOption.type)) {
|
|
225
|
+
var _action$metadata$valu;
|
|
226
|
+
displayValueData.displayValue = (_action$metadata$valu = action.metadata.value) === null || _action$metadata$valu === void 0 ? void 0 : _action$metadata$valu.toLowerCase();
|
|
227
|
+
return displayValueData;
|
|
228
|
+
}
|
|
229
|
+
switch (actionOption.type) {
|
|
230
|
+
case ACTION_TYPE.DROPDOWN:
|
|
231
|
+
{
|
|
232
|
+
displayValueData.displayValue = getEntityDisplayValue(action, actionOption);
|
|
233
|
+
return displayValueData;
|
|
234
|
+
}
|
|
235
|
+
case ACTION_TYPE.EMAIL_TO_IDS:
|
|
236
|
+
{
|
|
237
|
+
displayValueData.isBulk = true;
|
|
238
|
+
displayValueData.displayValue = action.metadata.emails;
|
|
239
|
+
return displayValueData;
|
|
240
|
+
}
|
|
241
|
+
case ACTION_TYPE.EMAIL_TO:
|
|
242
|
+
{
|
|
243
|
+
displayValueData.displayValue = action.displayValue;
|
|
244
|
+
return displayValueData;
|
|
245
|
+
}
|
|
246
|
+
case ACTION_TYPE.SMS_TO_NUMBERS:
|
|
247
|
+
{
|
|
248
|
+
displayValueData.isBulk = true;
|
|
249
|
+
displayValueData.displayValue = action.metadata.phoneNumbers;
|
|
250
|
+
return displayValueData;
|
|
251
|
+
}
|
|
252
|
+
case ACTION_TYPE.SEND_TO_API:
|
|
253
|
+
{
|
|
254
|
+
displayValueData.displayValue = action.metadata.endpoint;
|
|
255
|
+
return displayValueData;
|
|
256
|
+
}
|
|
257
|
+
default:
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
};
|
|
191
261
|
|
|
192
262
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
193
263
|
var actions = _ref.actions;
|
|
@@ -205,9 +275,26 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
205
275
|
}) : t("neetoRules.common.then");
|
|
206
276
|
};
|
|
207
277
|
var renderActionValues = function renderActionValues(action, actionOption) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
278
|
+
var _actionOption$separat, _getActionDisplayValu;
|
|
279
|
+
var commonSeperator = actionOption.type === ACTION_TYPE.SEND_TO_API ? t("neetoRules.common.at") : t("neetoRules.common.to");
|
|
280
|
+
var separator = (actionOption === null || actionOption === void 0 || (_actionOption$separat = actionOption.separator) === null || _actionOption$separat === void 0 ? void 0 : _actionOption$separat.toLowerCase()) || commonSeperator;
|
|
281
|
+
var _ref2 = (_getActionDisplayValu = getActionDisplayValue(action, actionOption)) !== null && _getActionDisplayValu !== void 0 ? _getActionDisplayValu : {},
|
|
282
|
+
displayValue = _ref2.displayValue,
|
|
283
|
+
isBulk = _ref2.isBulk;
|
|
284
|
+
if (actionOption.type === ACTION_TYPE.MULTISELECT) {
|
|
285
|
+
var values = pluck("label", actionOption.dropdownOptions.filter(function (_ref3) {
|
|
286
|
+
var value = _ref3.value;
|
|
287
|
+
return action.metadata.value.includes(value);
|
|
288
|
+
}));
|
|
289
|
+
return /*#__PURE__*/jsx$1(MultiSelectValues, {
|
|
290
|
+
values: values,
|
|
291
|
+
separator: t("neetoRules.common.and", {
|
|
292
|
+
what: ""
|
|
293
|
+
})
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
if (!displayValue) return null;
|
|
297
|
+
if (!isBulk) {
|
|
211
298
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
212
299
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
213
300
|
className: "neeto-ui-text-gray-700",
|
|
@@ -218,23 +305,20 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
218
305
|
className: "neeto-ui-text-gray-800",
|
|
219
306
|
style: "h5",
|
|
220
307
|
weight: "semibold",
|
|
221
|
-
children:
|
|
308
|
+
children: displayValue === null || displayValue === void 0 ? void 0 : displayValue.toLowerCase()
|
|
222
309
|
})]
|
|
223
310
|
});
|
|
224
311
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
312
|
+
return displayValue.map(function (value, index) {
|
|
313
|
+
return /*#__PURE__*/jsxs("div", {
|
|
314
|
+
className: "mr-1 flex",
|
|
315
|
+
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
316
|
+
style: "h5",
|
|
317
|
+
weight: "semibold",
|
|
318
|
+
children: value
|
|
319
|
+
}, index), index !== displayValue.length - 1 && ", "]
|
|
320
|
+
}, index);
|
|
321
|
+
});
|
|
238
322
|
};
|
|
239
323
|
var renderAction = function renderAction(action) {
|
|
240
324
|
var actionOption = findBy({
|
|
@@ -255,6 +339,7 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
255
339
|
children: [allActions.map(function (action, index) {
|
|
256
340
|
return /*#__PURE__*/jsxs("div", {
|
|
257
341
|
className: "mb-2 flex flex-wrap gap-x-1 gap-y-2",
|
|
342
|
+
"data-cy": "then-action-events",
|
|
258
343
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
259
344
|
className: "neeto-ui-text-gray-700",
|
|
260
345
|
style: "h5",
|
|
@@ -279,10 +364,68 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
279
364
|
});
|
|
280
365
|
};
|
|
281
366
|
|
|
367
|
+
var OPERATORS$1 = {
|
|
368
|
+
or: "or_operator",
|
|
369
|
+
and: "and_operator"
|
|
370
|
+
};
|
|
371
|
+
var OPERATOR_LABELS = {
|
|
372
|
+
or_operator: t$5("neetoRules.operators.or"),
|
|
373
|
+
and_operator: t$5("neetoRules.operators.and")
|
|
374
|
+
};
|
|
375
|
+
var VERB_LABELS = {
|
|
376
|
+
is: t$5("neetoRules.conditionVerbs.is"),
|
|
377
|
+
is_not: t$5("neetoRules.conditionVerbs.isNot"),
|
|
378
|
+
contains: t$5("neetoRules.conditionVerbs.contains"),
|
|
379
|
+
does_not_contain: t$5("neetoRules.conditionVerbs.doesNotContain"),
|
|
380
|
+
contains_any_of: t$5("neetoRules.conditionVerbs.containsAnyOf"),
|
|
381
|
+
contains_all_of: t$5("neetoRules.conditionVerbs.containsAllOf"),
|
|
382
|
+
contains_none_of: t$5("neetoRules.conditionVerbs.containsNoneOf"),
|
|
383
|
+
starts_with: t$5("neetoRules.conditionVerbs.startsWith"),
|
|
384
|
+
ends_with: t$5("neetoRules.conditionVerbs.endsWith"),
|
|
385
|
+
less_than: t$5("neetoRules.conditionVerbs.lessThan"),
|
|
386
|
+
greater_than: t$5("neetoRules.conditionVerbs.greaterThan"),
|
|
387
|
+
any_time: t$5("neetoRules.conditionVerbs.anyTime"),
|
|
388
|
+
during: t$5("neetoRules.conditionVerbs.during"),
|
|
389
|
+
not_during: t$5("neetoRules.conditionVerbs.notDuring"),
|
|
390
|
+
any_of: t$5("neetoRules.conditionVerbs.anyOf"),
|
|
391
|
+
none_of: t$5("neetoRules.conditionVerbs.noneOf"),
|
|
392
|
+
is_before: t$5("neetoRules.conditionVerbs.isBefore"),
|
|
393
|
+
is_after: t$5("neetoRules.conditionVerbs.isAfter")
|
|
394
|
+
};
|
|
395
|
+
var CONDITION_VALUE_TYPES = {
|
|
396
|
+
text: "text",
|
|
397
|
+
number: "number",
|
|
398
|
+
decimal: "decimal",
|
|
399
|
+
url: "url",
|
|
400
|
+
email: "email",
|
|
401
|
+
dropdown: "dropdown",
|
|
402
|
+
multiSelect: "multi-select",
|
|
403
|
+
multiSelectCreate: "multi-select-create",
|
|
404
|
+
date: "date",
|
|
405
|
+
regex: "regex",
|
|
406
|
+
textarea: "textarea"
|
|
407
|
+
};
|
|
408
|
+
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
409
|
+
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
410
|
+
|
|
411
|
+
function ownKeys$u(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; }
|
|
412
|
+
function _objectSpread$s(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$u(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$u(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
282
413
|
var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
283
414
|
var conditions = _ref.conditions,
|
|
284
415
|
conditionOptions = _ref.conditionOptions,
|
|
285
|
-
conditionVerbs = _ref.conditionVerbs
|
|
416
|
+
_ref$conditionVerbs = _ref.conditionVerbs,
|
|
417
|
+
conditionVerbs = _ref$conditionVerbs === void 0 ? {} : _ref$conditionVerbs,
|
|
418
|
+
_ref$hasEvent = _ref.hasEvent,
|
|
419
|
+
hasEvent = _ref$hasEvent === void 0 ? true : _ref$hasEvent;
|
|
420
|
+
var _useState = useState(false),
|
|
421
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
422
|
+
viewMore = _useState2[0],
|
|
423
|
+
setViewMore = _useState2[1];
|
|
424
|
+
var _useTranslation = useTranslation(),
|
|
425
|
+
t = _useTranslation.t;
|
|
426
|
+
var conditionsList = conditions.value;
|
|
427
|
+
var allConditions = viewMore && conditionsList.length > PREVIEW_CONDITION_LIMIT ? conditionsList : conditionsList.slice(0, PREVIEW_CONDITION_LIMIT);
|
|
428
|
+
var allConditionVerbs = _objectSpread$s(_objectSpread$s({}, VERB_LABELS), conditionVerbs);
|
|
286
429
|
var getLogicOperator = function getLogicOperator(joinType) {
|
|
287
430
|
return joinType === "or_operator" ? "or" : "and";
|
|
288
431
|
};
|
|
@@ -303,7 +446,7 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
303
446
|
}));
|
|
304
447
|
return /*#__PURE__*/jsx$1(MultiSelectValues, {
|
|
305
448
|
values: values,
|
|
306
|
-
separator: t
|
|
449
|
+
separator: t("neetoRules.common.or")
|
|
307
450
|
});
|
|
308
451
|
}
|
|
309
452
|
if (conditionOption.type === "dropdown") {
|
|
@@ -317,12 +460,12 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
317
460
|
return null;
|
|
318
461
|
};
|
|
319
462
|
var renderCondition = function renderCondition(condition) {
|
|
320
|
-
var
|
|
463
|
+
var _allConditionVerbs$co;
|
|
321
464
|
var conditionOption = findBy({
|
|
322
465
|
value: condition.field
|
|
323
466
|
}, conditionOptions);
|
|
324
467
|
if (!conditionOption) return null;
|
|
325
|
-
var conditionVerb = (
|
|
468
|
+
var conditionVerb = (_allConditionVerbs$co = allConditionVerbs[condition.verb]) === null || _allConditionVerbs$co === void 0 ? void 0 : _allConditionVerbs$co.toLowerCase();
|
|
326
469
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
327
470
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
328
471
|
className: "neeto-ui-text-gray-800",
|
|
@@ -337,31 +480,46 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
337
480
|
}), renderConditionValues(condition, conditionOption)]
|
|
338
481
|
});
|
|
339
482
|
};
|
|
340
|
-
return /*#__PURE__*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
483
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
484
|
+
children: [/*#__PURE__*/jsx$1("div", {
|
|
485
|
+
className: "mt-2",
|
|
486
|
+
children: allConditions.map(function (condition, index) {
|
|
487
|
+
return /*#__PURE__*/jsxs("div", {
|
|
488
|
+
className: "mb-2 flex flex-wrap gap-x-2 gap-y-2",
|
|
489
|
+
children: [!index && hasEvent && /*#__PURE__*/jsx$1(Typography, {
|
|
490
|
+
className: "neeto-ui-text-gray-700",
|
|
491
|
+
style: "h5",
|
|
492
|
+
weight: "normal",
|
|
493
|
+
children: t("neetoRules.common.and", {
|
|
494
|
+
what: ""
|
|
495
|
+
})
|
|
496
|
+
}), !!index && /*#__PURE__*/jsx$1(Typography, {
|
|
497
|
+
className: "neeto-ui-text-gray-800",
|
|
498
|
+
style: "h5",
|
|
499
|
+
weight: "semibold",
|
|
500
|
+
children: getLogicOperator(condition.joinType)
|
|
501
|
+
}), /*#__PURE__*/jsx$1(Typography, {
|
|
502
|
+
className: "neeto-ui-text-gray-700",
|
|
503
|
+
style: "h5",
|
|
504
|
+
weight: "normal",
|
|
505
|
+
children: t("neetoRules.common.when")
|
|
506
|
+
}), renderCondition(condition)]
|
|
507
|
+
}, condition.id);
|
|
508
|
+
})
|
|
509
|
+
}), conditionsList.length > 3 && /*#__PURE__*/jsx$1("div", {
|
|
510
|
+
className: "mt-3 w-full",
|
|
511
|
+
children: /*#__PURE__*/jsx$1(Button, {
|
|
512
|
+
icon: !viewMore ? Down : Up,
|
|
513
|
+
size: "small",
|
|
514
|
+
style: "link",
|
|
515
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
516
|
+
onClick: function onClick() {
|
|
517
|
+
return setViewMore(function (prevState) {
|
|
518
|
+
return !prevState;
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
})
|
|
522
|
+
})]
|
|
365
523
|
});
|
|
366
524
|
};
|
|
367
525
|
|
|
@@ -370,23 +528,20 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
370
528
|
var events = _ref.events,
|
|
371
529
|
performer = _ref.performer,
|
|
372
530
|
conditions = _ref.conditions;
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
viewMore = _useState2[0],
|
|
376
|
-
setViewMore = _useState2[1];
|
|
531
|
+
var _useTranslation = useTranslation(),
|
|
532
|
+
t = _useTranslation.t;
|
|
377
533
|
var eventNames = pluck("name", events.value);
|
|
378
534
|
var allEvents = events.eventOptions.filter(function (event) {
|
|
379
535
|
return eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(event.value);
|
|
380
536
|
});
|
|
381
|
-
var conditionsList = conditions.value;
|
|
382
|
-
var allConditions = viewMore && conditionsList.length > 3 ? conditionsList : conditionsList.slice(0, 3);
|
|
383
537
|
var currentPerformer = findBy({
|
|
384
538
|
value: performer.value
|
|
385
539
|
}, performer.options);
|
|
386
540
|
return /*#__PURE__*/jsxs(Title, {
|
|
387
|
-
title: t
|
|
541
|
+
title: t("neetoRules.common.when"),
|
|
388
542
|
children: [/*#__PURE__*/jsxs("div", {
|
|
389
543
|
className: "flex flex-wrap gap-x-2 gap-y-2",
|
|
544
|
+
"data-cy": "when-condition-events",
|
|
390
545
|
children: [allEvents.map(function (event, index) {
|
|
391
546
|
return /*#__PURE__*/jsxs("div", {
|
|
392
547
|
className: "flex gap-x-2",
|
|
@@ -394,12 +549,12 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
394
549
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
395
550
|
style: "h5",
|
|
396
551
|
weight: "normal",
|
|
397
|
-
children: t
|
|
552
|
+
children: t("neetoRules.common.when")
|
|
398
553
|
}), !!index && /*#__PURE__*/jsx$1(Typography, {
|
|
399
554
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
400
555
|
style: "h5",
|
|
401
556
|
weight: "normal",
|
|
402
|
-
children: t
|
|
557
|
+
children: t("neetoRules.common.or")
|
|
403
558
|
}), /*#__PURE__*/jsx$1(Typography, {
|
|
404
559
|
className: "neeto-ui-text-gray-800",
|
|
405
560
|
style: "h5",
|
|
@@ -411,7 +566,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
411
566
|
className: "neeto-ui-text-gray-700",
|
|
412
567
|
style: "h5",
|
|
413
568
|
weight: "normal",
|
|
414
|
-
children: t
|
|
569
|
+
children: t("neetoRules.common.by")
|
|
415
570
|
}), /*#__PURE__*/jsx$1(Typography, {
|
|
416
571
|
className: "neeto-ui-text-gray-800",
|
|
417
572
|
style: "h5",
|
|
@@ -419,30 +574,18 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
419
574
|
children: currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase()
|
|
420
575
|
})]
|
|
421
576
|
}), /*#__PURE__*/jsx$1(ConditionsDetail, {
|
|
577
|
+
conditions: conditions,
|
|
422
578
|
conditionOptions: conditions.conditionOptions,
|
|
423
|
-
conditionVerbs: conditions.verbs
|
|
424
|
-
conditions: allConditions
|
|
425
|
-
}), conditionsList.length > 3 && /*#__PURE__*/jsx$1("div", {
|
|
426
|
-
className: "mt-3 w-full",
|
|
427
|
-
children: /*#__PURE__*/jsx$1(Button, {
|
|
428
|
-
icon: !viewMore ? Down : Up,
|
|
429
|
-
size: "small",
|
|
430
|
-
style: "link",
|
|
431
|
-
label: !viewMore ? t$5("neetoRules.common.viewMore") : t$5("neetoRules.common.viewLess"),
|
|
432
|
-
onClick: function onClick() {
|
|
433
|
-
return setViewMore(function (prevState) {
|
|
434
|
-
return !prevState;
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
})
|
|
579
|
+
conditionVerbs: conditions.verbs
|
|
438
580
|
})]
|
|
439
581
|
});
|
|
440
582
|
};
|
|
441
583
|
|
|
442
|
-
function ownKeys$
|
|
443
|
-
function _objectSpread$
|
|
444
|
-
var RulePreview = function
|
|
445
|
-
var
|
|
584
|
+
function ownKeys$t(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; }
|
|
585
|
+
function _objectSpread$r(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$t(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$t(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
586
|
+
var RulePreview = withT(function (_ref) {
|
|
587
|
+
var t = _ref.t,
|
|
588
|
+
isLoading = _ref.isLoading,
|
|
446
589
|
ruleDetails = _ref.ruleDetails,
|
|
447
590
|
isOpen = _ref.isOpen,
|
|
448
591
|
onClose = _ref.onClose,
|
|
@@ -460,7 +603,7 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
460
603
|
style: "h4",
|
|
461
604
|
weight: "semibold",
|
|
462
605
|
children: ruleDetails.name.value
|
|
463
|
-
}), isNotEmpty(moreDropdownProps) && /*#__PURE__*/jsx$1(MoreDropdown, _objectSpread$
|
|
606
|
+
}), isNotEmpty(moreDropdownProps) && /*#__PURE__*/jsx$1(MoreDropdown, _objectSpread$r({}, moreDropdownProps))]
|
|
464
607
|
})
|
|
465
608
|
}), /*#__PURE__*/jsx$1(Pane.Body, {
|
|
466
609
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -485,10 +628,18 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
485
628
|
children: ruleDetails.entity.value
|
|
486
629
|
})]
|
|
487
630
|
})]
|
|
488
|
-
}), /*#__PURE__*/jsx$1(EventsDetail, {
|
|
631
|
+
}), ruleDetails.events && isNotEmpty(ruleDetails.events) ? /*#__PURE__*/jsx$1(EventsDetail, {
|
|
489
632
|
conditions: ruleDetails.conditions,
|
|
490
633
|
events: ruleDetails.events,
|
|
491
634
|
performer: ruleDetails.performer
|
|
635
|
+
}) : /*#__PURE__*/jsx$1(Title, {
|
|
636
|
+
title: t("neetoRules.common.when"),
|
|
637
|
+
children: /*#__PURE__*/jsx$1(ConditionsDetail, {
|
|
638
|
+
conditionOptions: ruleDetails.conditions.conditionOptions,
|
|
639
|
+
conditionVerbs: ruleDetails.conditions.verbs,
|
|
640
|
+
conditions: ruleDetails.conditions,
|
|
641
|
+
hasEvent: false
|
|
642
|
+
})
|
|
492
643
|
}), /*#__PURE__*/jsx$1(ActionsDetail, {
|
|
493
644
|
actions: ruleDetails.actions
|
|
494
645
|
})]
|
|
@@ -496,6 +647,419 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
496
647
|
})]
|
|
497
648
|
})
|
|
498
649
|
});
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
function _objectWithoutPropertiesLoose$2(source, excluded) {
|
|
653
|
+
if (source == null) return {};
|
|
654
|
+
var target = {};
|
|
655
|
+
var sourceKeys = Object.keys(source);
|
|
656
|
+
var key, i;
|
|
657
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
658
|
+
key = sourceKeys[i];
|
|
659
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
660
|
+
target[key] = source[key];
|
|
661
|
+
}
|
|
662
|
+
return target;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
function _objectWithoutProperties$1(source, excluded) {
|
|
666
|
+
if (source == null) return {};
|
|
667
|
+
var target = _objectWithoutPropertiesLoose$2(source, excluded);
|
|
668
|
+
var key, i;
|
|
669
|
+
if (Object.getOwnPropertySymbols) {
|
|
670
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
671
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
672
|
+
key = sourceSymbolKeys[i];
|
|
673
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
674
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
675
|
+
target[key] = source[key];
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return target;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
var _excluded$k = ["url"];
|
|
682
|
+
var fetch = function fetch(_ref) {
|
|
683
|
+
var url = _ref.url,
|
|
684
|
+
params = _objectWithoutProperties$1(_ref, _excluded$k);
|
|
685
|
+
return axios.get(url, {
|
|
686
|
+
params: params
|
|
687
|
+
});
|
|
688
|
+
};
|
|
689
|
+
var update$1 = function update(_ref2) {
|
|
690
|
+
var url = _ref2.url,
|
|
691
|
+
id = _ref2.id,
|
|
692
|
+
payload = _ref2.payload;
|
|
693
|
+
return axios.patch("".concat(url, "/").concat(id), payload);
|
|
694
|
+
};
|
|
695
|
+
var clone = function clone(_ref3) {
|
|
696
|
+
var url = _ref3.url,
|
|
697
|
+
id = _ref3.id;
|
|
698
|
+
return axios.post("".concat(url, "/").concat(id, "/clone"));
|
|
699
|
+
};
|
|
700
|
+
var destroy = function destroy(_ref4) {
|
|
701
|
+
var url = _ref4.url,
|
|
702
|
+
id = _ref4.id;
|
|
703
|
+
return axios["delete"]("".concat(url, "/").concat(id));
|
|
704
|
+
};
|
|
705
|
+
var automationRulesApi = {
|
|
706
|
+
fetch: fetch,
|
|
707
|
+
update: update$1,
|
|
708
|
+
clone: clone,
|
|
709
|
+
destroy: destroy
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
//TODO: Remove if not used
|
|
713
|
+
var AUTOMATION_RULES = "automation-rules";
|
|
714
|
+
var STALE_TIME = 3200000;
|
|
715
|
+
|
|
716
|
+
function ownKeys$s(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; }
|
|
717
|
+
function _objectSpread$q(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$s(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$s(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
718
|
+
var useFetchAutomationRules = function useFetchAutomationRules(params) {
|
|
719
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
720
|
+
return useQuery([AUTOMATION_RULES, params], function () {
|
|
721
|
+
return automationRulesApi.fetch(params);
|
|
722
|
+
}, _objectSpread$q({
|
|
723
|
+
staleTime: STALE_TIME,
|
|
724
|
+
select: function select(response) {
|
|
725
|
+
return response.data || response;
|
|
726
|
+
},
|
|
727
|
+
keepPreviousData: true
|
|
728
|
+
}, options));
|
|
729
|
+
};
|
|
730
|
+
var useUpdateAutomationRule = function useUpdateAutomationRule() {
|
|
731
|
+
return useMutationWithInvalidation(automationRulesApi.update, {
|
|
732
|
+
keysToInvalidate: [AUTOMATION_RULES]
|
|
733
|
+
});
|
|
734
|
+
};
|
|
735
|
+
var useCloneAutomationRule = function useCloneAutomationRule() {
|
|
736
|
+
return useMutationWithInvalidation(automationRulesApi.clone, {
|
|
737
|
+
keysToInvalidate: [AUTOMATION_RULES]
|
|
738
|
+
});
|
|
739
|
+
};
|
|
740
|
+
var useDeleteAutomationRule = function useDeleteAutomationRule() {
|
|
741
|
+
return useMutationWithInvalidation(automationRulesApi.destroy, {
|
|
742
|
+
keysToInvalidate: [AUTOMATION_RULES]
|
|
743
|
+
});
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
var createRoutes = function createRoutes(basePath) {
|
|
747
|
+
return {
|
|
748
|
+
index: basePath,
|
|
749
|
+
"new": "".concat(basePath, "/new"),
|
|
750
|
+
edit: "".concat(basePath, "/:ruleId/edit")
|
|
751
|
+
};
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
var STATUS_KEYS = {
|
|
755
|
+
ENABLED: "enabled",
|
|
756
|
+
DISABLED: "disabled"
|
|
757
|
+
};
|
|
758
|
+
var DEFAULT_INIT_PAGE = 1;
|
|
759
|
+
|
|
760
|
+
function _arrayWithoutHoles$1(arr) {
|
|
761
|
+
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function _iterableToArray$1(iter) {
|
|
765
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function _nonIterableSpread$1() {
|
|
769
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function _toConsumableArray$1(arr) {
|
|
773
|
+
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
var DisableMessage = withT(function (_ref) {
|
|
777
|
+
var t = _ref.t,
|
|
778
|
+
disabledReason = _ref.disabledReason;
|
|
779
|
+
return isNotNil(disabledReason) && /*#__PURE__*/jsx$1("div", {
|
|
780
|
+
children: /*#__PURE__*/jsx$1(Typography, {
|
|
781
|
+
"class": "text-red-600",
|
|
782
|
+
component: "span",
|
|
783
|
+
style: "body2",
|
|
784
|
+
children: t(disabledReason)
|
|
785
|
+
})
|
|
786
|
+
});
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
var _excluded$j = ["onClick"],
|
|
790
|
+
_excluded2 = ["handleChangeStatus", "additionalColumns", "onPreview"];
|
|
791
|
+
function ownKeys$r(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; }
|
|
792
|
+
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$r(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$r(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
793
|
+
var buildActionDropdownMenuItems = function buildActionDropdownMenuItems(_ref) {
|
|
794
|
+
var rule = _ref.rule,
|
|
795
|
+
onClone = _ref.onClone,
|
|
796
|
+
onDelete = _ref.onDelete,
|
|
797
|
+
_ref$moreDropdownItem = _ref.moreDropdownItems,
|
|
798
|
+
moreDropdownItems = _ref$moreDropdownItem === void 0 ? [] : _ref$moreDropdownItem,
|
|
799
|
+
automationRulesPath = _ref.automationRulesPath;
|
|
800
|
+
return [].concat(_toConsumableArray$1(moreDropdownItems.map(function (_ref2) {
|
|
801
|
+
var _onClick = _ref2.onClick,
|
|
802
|
+
others = _objectWithoutProperties$1(_ref2, _excluded$j);
|
|
803
|
+
return _objectSpread$p(_objectSpread$p({}, others), {}, {
|
|
804
|
+
onClick: function onClick() {
|
|
805
|
+
return _onClick(rule);
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
})), [{
|
|
809
|
+
key: "edit",
|
|
810
|
+
className: "neeto-ui-btn",
|
|
811
|
+
"data-test-id": "automation-rules-edit-link",
|
|
812
|
+
label: t$5("neetoRules.button.edit"),
|
|
813
|
+
to: buildUrl(createRoutes(automationRulesPath).edit, {
|
|
814
|
+
ruleId: rule.id
|
|
815
|
+
})
|
|
816
|
+
}, {
|
|
817
|
+
key: "clone",
|
|
818
|
+
"data-test-id": "automation-rules-clone-link",
|
|
819
|
+
label: t$5("neetoRules.button.clone"),
|
|
820
|
+
onClick: function onClick() {
|
|
821
|
+
return onClone(rule.id);
|
|
822
|
+
}
|
|
823
|
+
}, {
|
|
824
|
+
key: "delete",
|
|
825
|
+
"data-test-id": "automation-rules-delete-link",
|
|
826
|
+
label: t$5("neetoRules.button.delete"),
|
|
827
|
+
onClick: function onClick() {
|
|
828
|
+
return onDelete(rule);
|
|
829
|
+
}
|
|
830
|
+
}]);
|
|
831
|
+
};
|
|
832
|
+
var getColumnData = function getColumnData(_ref3) {
|
|
833
|
+
var handleChangeStatus = _ref3.handleChangeStatus,
|
|
834
|
+
_ref3$additionalColum = _ref3.additionalColumns,
|
|
835
|
+
additionalColumns = _ref3$additionalColum === void 0 ? [] : _ref3$additionalColum,
|
|
836
|
+
onPreview = _ref3.onPreview,
|
|
837
|
+
otherProps = _objectWithoutProperties$1(_ref3, _excluded2);
|
|
838
|
+
return [{
|
|
839
|
+
title: t$5("neetoRules.labels.name"),
|
|
840
|
+
dataIndex: "name",
|
|
841
|
+
key: "name",
|
|
842
|
+
ellipsis: true,
|
|
843
|
+
width: 440,
|
|
844
|
+
render: function render(name, rule) {
|
|
845
|
+
return /*#__PURE__*/jsxs("div", {
|
|
846
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
847
|
+
className: "flex items-center justify-between gap-x-3",
|
|
848
|
+
children: [/*#__PURE__*/jsx$1(Button, {
|
|
849
|
+
className: "whitespace-pre-line break-words text-left",
|
|
850
|
+
style: "link",
|
|
851
|
+
onClick: function onClick() {
|
|
852
|
+
return onPreview(rule.id);
|
|
853
|
+
},
|
|
854
|
+
children: name
|
|
855
|
+
}), /*#__PURE__*/jsx$1(MoreDropdown, {
|
|
856
|
+
dropdownProps: {
|
|
857
|
+
strategy: "fixed"
|
|
858
|
+
},
|
|
859
|
+
menuItems: buildActionDropdownMenuItems(_objectSpread$p({
|
|
860
|
+
rule: rule
|
|
861
|
+
}, otherProps))
|
|
862
|
+
})]
|
|
863
|
+
}), /*#__PURE__*/jsx$1(DisableMessage, {
|
|
864
|
+
disabledReason: rule.disabledReason
|
|
865
|
+
})]
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}, {
|
|
869
|
+
title: t$5("neetoRules.labels.description"),
|
|
870
|
+
dataIndex: "description",
|
|
871
|
+
key: "description",
|
|
872
|
+
width: 390,
|
|
873
|
+
render: function render(description) {
|
|
874
|
+
return /*#__PURE__*/jsx$1(Typography, {
|
|
875
|
+
className: "whitespace-pre-line break-words",
|
|
876
|
+
style: "body2",
|
|
877
|
+
children: description
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
}, {
|
|
881
|
+
title: t$5("neetoRules.labels.active"),
|
|
882
|
+
key: "active",
|
|
883
|
+
width: 100,
|
|
884
|
+
align: "center",
|
|
885
|
+
render: function render(_, rule) {
|
|
886
|
+
return /*#__PURE__*/jsx$1("div", {
|
|
887
|
+
className: "flex justify-center",
|
|
888
|
+
children: /*#__PURE__*/jsx$1(Switch, {
|
|
889
|
+
checked: rule.status === STATUS_KEYS.ENABLED,
|
|
890
|
+
"data-test-id": "automation-rules-state-switch-row",
|
|
891
|
+
disabled: !!rule.disabledReason,
|
|
892
|
+
onChange: function onChange(e) {
|
|
893
|
+
handleChangeStatus(e, rule.id);
|
|
894
|
+
}
|
|
895
|
+
})
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
}].concat(_toConsumableArray$1(additionalColumns));
|
|
899
|
+
};
|
|
900
|
+
var renderNoDataHelpText = function renderNoDataHelpText(helpDocUrl) {
|
|
901
|
+
return /*#__PURE__*/jsx$1(Trans, {
|
|
902
|
+
i18nKey: "neetoRules.noData.helpText",
|
|
903
|
+
components: {
|
|
904
|
+
a: /*#__PURE__*/jsx$1(Link, {
|
|
905
|
+
className: "neeto-ui-text-primary-600 underline",
|
|
906
|
+
target: "_blank",
|
|
907
|
+
to: {
|
|
908
|
+
pathname: helpDocUrl
|
|
909
|
+
}
|
|
910
|
+
})
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
function ownKeys$q(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; }
|
|
916
|
+
function _objectSpread$o(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$q(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$q(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
917
|
+
var RulesTable = function RulesTable(_ref) {
|
|
918
|
+
var url = _ref.automationRulesEndpoint,
|
|
919
|
+
additionalColumns = _ref.additionalColumns,
|
|
920
|
+
_ref$automationRulesP = _ref.automationRulesPath,
|
|
921
|
+
automationRulesPath = _ref$automationRulesP === void 0 ? "/" : _ref$automationRulesP,
|
|
922
|
+
onPreview = _ref.onPreview,
|
|
923
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
924
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? null : _ref$helpDocUrl,
|
|
925
|
+
_ref$moreDropdownItem = _ref.moreDropdownItems,
|
|
926
|
+
moreDropdownItems = _ref$moreDropdownItem === void 0 ? [] : _ref$moreDropdownItem;
|
|
927
|
+
var _useState = useState(null),
|
|
928
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
929
|
+
selectedRule = _useState2[0],
|
|
930
|
+
setSelectedRule = _useState2[1];
|
|
931
|
+
var _useState3 = useState(DEFAULT_INIT_PAGE),
|
|
932
|
+
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
933
|
+
page = _useState4[0],
|
|
934
|
+
setPage = _useState4[1];
|
|
935
|
+
var _useTranslation = useTranslation(),
|
|
936
|
+
t = _useTranslation.t;
|
|
937
|
+
var _useQueryParams = useQueryParams(),
|
|
938
|
+
_useQueryParams$searc = _useQueryParams.searchTerm,
|
|
939
|
+
searchTerm = _useQueryParams$searc === void 0 ? "" : _useQueryParams$searc;
|
|
940
|
+
var _useFetchAutomationRu = useFetchAutomationRules({
|
|
941
|
+
url: url,
|
|
942
|
+
page: page,
|
|
943
|
+
pageSize: DEFAULT_PAGE_SIZE,
|
|
944
|
+
searchTerm: searchTerm
|
|
945
|
+
}),
|
|
946
|
+
_useFetchAutomationRu2 = _useFetchAutomationRu.data,
|
|
947
|
+
_useFetchAutomationRu3 = _useFetchAutomationRu2 === void 0 ? {} : _useFetchAutomationRu2,
|
|
948
|
+
_useFetchAutomationRu4 = _useFetchAutomationRu3.rules,
|
|
949
|
+
rules = _useFetchAutomationRu4 === void 0 ? [] : _useFetchAutomationRu4,
|
|
950
|
+
_useFetchAutomationRu5 = _useFetchAutomationRu3.totalCount,
|
|
951
|
+
totalCount = _useFetchAutomationRu5 === void 0 ? 0 : _useFetchAutomationRu5,
|
|
952
|
+
isLoading = _useFetchAutomationRu.isLoading;
|
|
953
|
+
var _useUpdateAutomationR = useUpdateAutomationRule(),
|
|
954
|
+
updateRule = _useUpdateAutomationR.mutate,
|
|
955
|
+
isUpdating = _useUpdateAutomationR.isLoading;
|
|
956
|
+
var _useCloneAutomationRu = useCloneAutomationRule(),
|
|
957
|
+
cloneRule = _useCloneAutomationRu.mutate,
|
|
958
|
+
isCloning = _useCloneAutomationRu.isLoading;
|
|
959
|
+
var _useDeleteAutomationR = useDeleteAutomationRule(),
|
|
960
|
+
deleteRule = _useDeleteAutomationR.mutate,
|
|
961
|
+
isDeleting = _useDeleteAutomationR.isLoading;
|
|
962
|
+
var handleChangeStatus = function handleChangeStatus(event, id) {
|
|
963
|
+
var status = event.target.checked ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED;
|
|
964
|
+
var payload = {
|
|
965
|
+
rule: {
|
|
966
|
+
status: status
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
updateRule({
|
|
970
|
+
id: id,
|
|
971
|
+
url: url,
|
|
972
|
+
payload: payload
|
|
973
|
+
});
|
|
974
|
+
};
|
|
975
|
+
var columnData = getColumnData({
|
|
976
|
+
handleChangeStatus: handleChangeStatus,
|
|
977
|
+
additionalColumns: additionalColumns,
|
|
978
|
+
onClone: function onClone(id) {
|
|
979
|
+
return cloneRule({
|
|
980
|
+
id: id,
|
|
981
|
+
url: url
|
|
982
|
+
});
|
|
983
|
+
},
|
|
984
|
+
onDelete: setSelectedRule,
|
|
985
|
+
onPreview: onPreview,
|
|
986
|
+
automationRulesPath: automationRulesPath,
|
|
987
|
+
moreDropdownItems: moreDropdownItems
|
|
988
|
+
});
|
|
989
|
+
if (isLoading) {
|
|
990
|
+
return /*#__PURE__*/jsx$1(PageLoader, {});
|
|
991
|
+
}
|
|
992
|
+
if (isEmpty(rules)) {
|
|
993
|
+
return /*#__PURE__*/jsx$1("div", {
|
|
994
|
+
className: "flex h-full w-full items-center justify-center",
|
|
995
|
+
children: /*#__PURE__*/jsx$1(NoData, _objectSpread$o({
|
|
996
|
+
title: t("neetoRules.noData.title")
|
|
997
|
+
}, isEmpty(searchTerm) && {
|
|
998
|
+
helpText: helpDocUrl ? renderNoDataHelpText(helpDocUrl) : null,
|
|
999
|
+
primaryButtonProps: {
|
|
1000
|
+
label: t("neetoRules.button.addNew"),
|
|
1001
|
+
to: createRoutes(automationRulesPath)["new"]
|
|
1002
|
+
}
|
|
1003
|
+
}))
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
1007
|
+
children: [/*#__PURE__*/jsx$1(SubHeader, {
|
|
1008
|
+
leftActionBlock: /*#__PURE__*/jsx$1(Typography, {
|
|
1009
|
+
className: "mr-4 font-semibold",
|
|
1010
|
+
style: "h4",
|
|
1011
|
+
children: t("neetoRules.common.automationRuleWithCount", {
|
|
1012
|
+
count: totalCount
|
|
1013
|
+
})
|
|
1014
|
+
})
|
|
1015
|
+
}), /*#__PURE__*/jsx$1(TableWrapper, {
|
|
1016
|
+
hasPagination: totalCount > DEFAULT_PAGE_SIZE,
|
|
1017
|
+
children: /*#__PURE__*/jsx$1(Table, {
|
|
1018
|
+
columnData: columnData,
|
|
1019
|
+
totalCount: totalCount,
|
|
1020
|
+
fixedHeight: true,
|
|
1021
|
+
allowClick: false,
|
|
1022
|
+
currentPageNumber: page,
|
|
1023
|
+
defaultPageSize: DEFAULT_PAGE_SIZE,
|
|
1024
|
+
handlePageChange: setPage,
|
|
1025
|
+
loading: isUpdating || isLoading || isCloning || isDeleting,
|
|
1026
|
+
rowData: rules.map(function (item) {
|
|
1027
|
+
return _objectSpread$o({
|
|
1028
|
+
key: item.id
|
|
1029
|
+
}, item);
|
|
1030
|
+
}),
|
|
1031
|
+
rowSelection: false,
|
|
1032
|
+
scroll: {
|
|
1033
|
+
x: 0
|
|
1034
|
+
},
|
|
1035
|
+
tableLayout: "fixed"
|
|
1036
|
+
})
|
|
1037
|
+
}), /*#__PURE__*/jsx$1(Alert, {
|
|
1038
|
+
isOpen: !!selectedRule,
|
|
1039
|
+
isSubmitting: isDeleting,
|
|
1040
|
+
submitButtonLabel: t("neetoRules.button.delete"),
|
|
1041
|
+
title: t("neetoRules.deleteAlert.title"),
|
|
1042
|
+
message: /*#__PURE__*/jsx$1(Trans, {
|
|
1043
|
+
i18nKey: "neetoRules.deleteAlert.message",
|
|
1044
|
+
values: {
|
|
1045
|
+
name: selectedRule === null || selectedRule === void 0 ? void 0 : selectedRule.name
|
|
1046
|
+
}
|
|
1047
|
+
}),
|
|
1048
|
+
onClose: function onClose() {
|
|
1049
|
+
return setSelectedRule(null);
|
|
1050
|
+
},
|
|
1051
|
+
onSubmit: function onSubmit() {
|
|
1052
|
+
return deleteRule({
|
|
1053
|
+
id: selectedRule === null || selectedRule === void 0 ? void 0 : selectedRule.id,
|
|
1054
|
+
url: url
|
|
1055
|
+
}, {
|
|
1056
|
+
onSuccess: function onSuccess() {
|
|
1057
|
+
return setSelectedRule(null);
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
})]
|
|
1062
|
+
});
|
|
499
1063
|
};
|
|
500
1064
|
|
|
501
1065
|
function _typeof$2(o) {
|
|
@@ -1096,7 +1660,7 @@ function _extends$2() {
|
|
|
1096
1660
|
}, _extends$2.apply(null, arguments);
|
|
1097
1661
|
}
|
|
1098
1662
|
|
|
1099
|
-
function _objectWithoutPropertiesLoose$
|
|
1663
|
+
function _objectWithoutPropertiesLoose$1(r, e) {
|
|
1100
1664
|
if (null == r) return {};
|
|
1101
1665
|
var t = {};
|
|
1102
1666
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
@@ -1330,7 +1894,7 @@ function finalPropsSelectorFactory(dispatch, _ref) {
|
|
|
1330
1894
|
initMapDispatchToProps,
|
|
1331
1895
|
initMergeProps
|
|
1332
1896
|
} = _ref,
|
|
1333
|
-
options = _objectWithoutPropertiesLoose$
|
|
1897
|
+
options = _objectWithoutPropertiesLoose$1(_ref, _excluded$i);
|
|
1334
1898
|
|
|
1335
1899
|
const mapStateToProps = initMapStateToProps(dispatch, options);
|
|
1336
1900
|
const mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
|
@@ -1845,7 +2409,7 @@ function connect(mapStateToProps, mapDispatchToProps, mergeProps, {
|
|
|
1845
2409
|
const {
|
|
1846
2410
|
reactReduxForwardedRef
|
|
1847
2411
|
} = props,
|
|
1848
|
-
wrapperProps = _objectWithoutPropertiesLoose$
|
|
2412
|
+
wrapperProps = _objectWithoutPropertiesLoose$1(props, _excluded$h);
|
|
1849
2413
|
|
|
1850
2414
|
return [props.context, reactReduxForwardedRef, wrapperProps];
|
|
1851
2415
|
}, [props]);
|
|
@@ -9628,7 +10192,7 @@ var RulesReorder = function RulesReorder(_ref) {
|
|
|
9628
10192
|
if (!result.destination || result.source.index === result.destination.index) {
|
|
9629
10193
|
return;
|
|
9630
10194
|
}
|
|
9631
|
-
var originalRules = clone(initialRules);
|
|
10195
|
+
var originalRules = clone$1(initialRules);
|
|
9632
10196
|
var items = reorderList(originalRules, result.source.index, result.destination.index);
|
|
9633
10197
|
items = items.map(function (item, index) {
|
|
9634
10198
|
return _objectSpread$l(_objectSpread$l({}, item), {}, {
|
|
@@ -9712,35 +10276,6 @@ function _objectDestructuringEmpty(obj) {
|
|
|
9712
10276
|
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
9713
10277
|
}
|
|
9714
10278
|
|
|
9715
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
9716
|
-
if (source == null) return {};
|
|
9717
|
-
var target = {};
|
|
9718
|
-
var sourceKeys = Object.keys(source);
|
|
9719
|
-
var key, i;
|
|
9720
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
9721
|
-
key = sourceKeys[i];
|
|
9722
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
9723
|
-
target[key] = source[key];
|
|
9724
|
-
}
|
|
9725
|
-
return target;
|
|
9726
|
-
}
|
|
9727
|
-
|
|
9728
|
-
function _objectWithoutProperties$1(source, excluded) {
|
|
9729
|
-
if (source == null) return {};
|
|
9730
|
-
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
9731
|
-
var key, i;
|
|
9732
|
-
if (Object.getOwnPropertySymbols) {
|
|
9733
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
9734
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
9735
|
-
key = sourceSymbolKeys[i];
|
|
9736
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
9737
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
9738
|
-
target[key] = source[key];
|
|
9739
|
-
}
|
|
9740
|
-
}
|
|
9741
|
-
return target;
|
|
9742
|
-
}
|
|
9743
|
-
|
|
9744
10279
|
var propTypes = {exports: {}};
|
|
9745
10280
|
|
|
9746
10281
|
/**
|
|
@@ -9832,22 +10367,6 @@ var factoryWithThrowingShims = function() {
|
|
|
9832
10367
|
var propTypesExports = propTypes.exports;
|
|
9833
10368
|
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
9834
10369
|
|
|
9835
|
-
function _arrayWithoutHoles$1(arr) {
|
|
9836
|
-
if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
|
|
9837
|
-
}
|
|
9838
|
-
|
|
9839
|
-
function _iterableToArray$1(iter) {
|
|
9840
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
9841
|
-
}
|
|
9842
|
-
|
|
9843
|
-
function _nonIterableSpread$1() {
|
|
9844
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9845
|
-
}
|
|
9846
|
-
|
|
9847
|
-
function _toConsumableArray$1(arr) {
|
|
9848
|
-
return _arrayWithoutHoles$1(arr) || _iterableToArray$1(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$1();
|
|
9849
|
-
}
|
|
9850
|
-
|
|
9851
10370
|
var ACTION_TYPES = {
|
|
9852
10371
|
emailToIds: "emailToIds",
|
|
9853
10372
|
email: "email",
|
|
@@ -9886,52 +10405,8 @@ var DEFAULT_RULE_ACTION = {
|
|
|
9886
10405
|
};
|
|
9887
10406
|
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
9888
10407
|
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9889
|
-
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
9890
|
-
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9891
|
-
|
|
9892
|
-
var OPERATORS$1 = {
|
|
9893
|
-
or: "or_operator",
|
|
9894
|
-
and: "and_operator"
|
|
9895
|
-
};
|
|
9896
|
-
var OPERATOR_LABELS = {
|
|
9897
|
-
or_operator: t$5("neetoRules.operators.or"),
|
|
9898
|
-
and_operator: t$5("neetoRules.operators.and")
|
|
9899
|
-
};
|
|
9900
|
-
var VERB_LABELS = {
|
|
9901
|
-
is: t$5("neetoRules.conditionVerbs.is"),
|
|
9902
|
-
is_not: t$5("neetoRules.conditionVerbs.isNot"),
|
|
9903
|
-
contains: t$5("neetoRules.conditionVerbs.contains"),
|
|
9904
|
-
does_not_contain: t$5("neetoRules.conditionVerbs.doesNotContain"),
|
|
9905
|
-
contains_any_of: t$5("neetoRules.conditionVerbs.containsAnyOf"),
|
|
9906
|
-
contains_all_of: t$5("neetoRules.conditionVerbs.containsAllOf"),
|
|
9907
|
-
contains_none_of: t$5("neetoRules.conditionVerbs.containsNoneOf"),
|
|
9908
|
-
starts_with: t$5("neetoRules.conditionVerbs.startsWith"),
|
|
9909
|
-
ends_with: t$5("neetoRules.conditionVerbs.endsWith"),
|
|
9910
|
-
less_than: t$5("neetoRules.conditionVerbs.lessThan"),
|
|
9911
|
-
greater_than: t$5("neetoRules.conditionVerbs.greaterThan"),
|
|
9912
|
-
any_time: t$5("neetoRules.conditionVerbs.anyTime"),
|
|
9913
|
-
during: t$5("neetoRules.conditionVerbs.during"),
|
|
9914
|
-
not_during: t$5("neetoRules.conditionVerbs.notDuring"),
|
|
9915
|
-
any_of: t$5("neetoRules.conditionVerbs.anyOf"),
|
|
9916
|
-
none_of: t$5("neetoRules.conditionVerbs.noneOf"),
|
|
9917
|
-
is_before: t$5("neetoRules.conditionVerbs.isBefore"),
|
|
9918
|
-
is_after: t$5("neetoRules.conditionVerbs.isAfter")
|
|
9919
|
-
};
|
|
9920
|
-
var CONDITION_VALUE_TYPES = {
|
|
9921
|
-
text: "text",
|
|
9922
|
-
number: "number",
|
|
9923
|
-
decimal: "decimal",
|
|
9924
|
-
url: "url",
|
|
9925
|
-
email: "email",
|
|
9926
|
-
dropdown: "dropdown",
|
|
9927
|
-
multiSelect: "multi-select",
|
|
9928
|
-
multiSelectCreate: "multi-select-create",
|
|
9929
|
-
date: "date",
|
|
9930
|
-
regex: "regex",
|
|
9931
|
-
textarea: "textarea"
|
|
9932
|
-
};
|
|
9933
|
-
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
9934
10408
|
var MAXIMUM_OPTION_LENGTH$2 = 7;
|
|
10409
|
+
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9935
10410
|
|
|
9936
10411
|
function ownKeys$l(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; }
|
|
9937
10412
|
function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$l(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$l(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -10533,6 +11008,9 @@ var setEditorContent = function setEditorContent(ref, content) {
|
|
|
10533
11008
|
|
|
10534
11009
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
10535
11010
|
var dotPath = useWith(path, [split(".")]);
|
|
11011
|
+
var formatAdditionalData = function formatAdditionalData(additionalData) {
|
|
11012
|
+
return isPresent(additionalData) ? additionalData : [ADDITIONAL_DATA_INITIAL_VALUE];
|
|
11013
|
+
};
|
|
10536
11014
|
|
|
10537
11015
|
var KeyValuePairsField = withT(function (_ref) {
|
|
10538
11016
|
var t = _ref.t,
|
|
@@ -10646,7 +11124,7 @@ var ApiFields = function ApiFields(_ref) {
|
|
|
10646
11124
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
10647
11125
|
var handleTemplateChange = function handleTemplateChange(template) {
|
|
10648
11126
|
setFieldValue("".concat(name, ".endpoint"), template.endpoint);
|
|
10649
|
-
setFieldValue("".concat(name, ".additionalData"), template.additionalData);
|
|
11127
|
+
setFieldValue("".concat(name, ".additionalData"), formatAdditionalData(template.additionalData));
|
|
10650
11128
|
};
|
|
10651
11129
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
10652
11130
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
@@ -11015,7 +11493,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11015
11493
|
onClose: handleClose,
|
|
11016
11494
|
children: /*#__PURE__*/jsxs(Menu$a, {
|
|
11017
11495
|
className: "max-h-60 max-w-2xl p-3",
|
|
11018
|
-
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11496
|
+
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsx$1(Input$2, {
|
|
11019
11497
|
autoFocus: true,
|
|
11020
11498
|
className: "mb-1",
|
|
11021
11499
|
"data-cy": "search-text-field",
|
|
@@ -11029,7 +11507,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11029
11507
|
return e.stopPropagation();
|
|
11030
11508
|
}
|
|
11031
11509
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
11032
|
-
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11510
|
+
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11033
11511
|
children: searchedOptions.map(function (option, idx) {
|
|
11034
11512
|
return /*#__PURE__*/jsx$1(MenuItem$9.Button, {
|
|
11035
11513
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -11663,7 +12141,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11663
12141
|
onClose: handleClose,
|
|
11664
12142
|
children: /*#__PURE__*/jsxs(Menu$9, {
|
|
11665
12143
|
className: "max-h-60 max-w-2xl p-3",
|
|
11666
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
12144
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsx$1(Input$2, {
|
|
11667
12145
|
autoFocus: true,
|
|
11668
12146
|
className: "mb-1",
|
|
11669
12147
|
"data-cy": "search-text-field",
|
|
@@ -11674,7 +12152,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11674
12152
|
return setSearchTerm(e.target.value);
|
|
11675
12153
|
}
|
|
11676
12154
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
11677
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
12155
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11678
12156
|
children: searchedOptions.map(function (option, idx) {
|
|
11679
12157
|
return /*#__PURE__*/jsx$1(MenuItem$8.Button, {
|
|
11680
12158
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20358,7 +20836,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20358
20836
|
onClose: handleClose,
|
|
20359
20837
|
children: /*#__PURE__*/jsxs(Menu$6, {
|
|
20360
20838
|
className: "max-h-60 max-w-2xl p-3",
|
|
20361
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20839
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20362
20840
|
autoFocus: true,
|
|
20363
20841
|
className: "mb-1",
|
|
20364
20842
|
"data-cy": "search-text-field",
|
|
@@ -20372,7 +20850,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20372
20850
|
return e.stopPropagation();
|
|
20373
20851
|
}
|
|
20374
20852
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20375
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20853
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20376
20854
|
children: searchedOptions.map(function (option, idx) {
|
|
20377
20855
|
return /*#__PURE__*/jsx$1(MenuItem$6.Button, {
|
|
20378
20856
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20480,7 +20958,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20480
20958
|
onClose: handleClose,
|
|
20481
20959
|
children: /*#__PURE__*/jsxs(Menu$5, {
|
|
20482
20960
|
className: "max-h-60 max-w-2xl p-3",
|
|
20483
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20961
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20484
20962
|
autoFocus: true,
|
|
20485
20963
|
className: "mb-1",
|
|
20486
20964
|
"data-cy": "search-text-field",
|
|
@@ -20494,7 +20972,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20494
20972
|
return e.stopPropagation();
|
|
20495
20973
|
}
|
|
20496
20974
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20497
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20975
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20498
20976
|
children: searchedOptions.map(function (option, idx) {
|
|
20499
20977
|
return /*#__PURE__*/jsx$1(MenuItem$5.Button, {
|
|
20500
20978
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20654,7 +21132,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20654
21132
|
onClose: handleClose,
|
|
20655
21133
|
children: /*#__PURE__*/jsxs(Menu$4, {
|
|
20656
21134
|
className: "max-h-60 max-w-2xl p-3",
|
|
20657
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
21135
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20658
21136
|
autoFocus: true,
|
|
20659
21137
|
className: "mb-1",
|
|
20660
21138
|
"data-cy": "search-text-field",
|
|
@@ -20665,7 +21143,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20665
21143
|
return setSearchTerm(e.target.value);
|
|
20666
21144
|
}
|
|
20667
21145
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20668
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
21146
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20669
21147
|
children: searchedOptions.map(function (option, idx) {
|
|
20670
21148
|
return /*#__PURE__*/jsx$1(MenuItem$4.Button, {
|
|
20671
21149
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -22529,5 +23007,5 @@ NeetoRules.Card = Card;
|
|
|
22529
23007
|
NeetoRules.MultiSelectField = MultiSelectField;
|
|
22530
23008
|
NeetoRules.EventConditions = EventConditions;
|
|
22531
23009
|
|
|
22532
|
-
export { NeetoRules as NeetoRulesForm, RulePreview, RulesReorder, useCustomDataStore };
|
|
23010
|
+
export { NeetoRules as NeetoRulesForm, RulePreview, RulesReorder, RulesTable, useCustomDataStore };
|
|
22533
23011
|
//# sourceMappingURL=index.js.map
|