@bigbinary/neeto-rules-frontend 2.5.28 → 2.5.30
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/NeetoRulesForm.js +253 -115
- package/dist/NeetoRulesForm.js.map +1 -1
- package/dist/RulePreview.js +1 -1
- package/dist/cjs/NeetoRulesForm.js +250 -112
- package/dist/cjs/NeetoRulesForm.js.map +1 -1
- package/dist/cjs/RulePreview.js +1 -1
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/{constants-CCwwHsAM.js → constants-BjXYr8nk.js} +3 -1
- package/dist/{constants-DvCsjJGj.js.map → constants-BjXYr8nk.js.map} +1 -1
- package/dist/{constants-DvCsjJGj.js → constants-C_bfl8XZ.js} +3 -2
- package/dist/{constants-CCwwHsAM.js.map → constants-C_bfl8XZ.js.map} +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
- package/types.d.ts +2 -1
package/dist/NeetoRulesForm.js
CHANGED
|
@@ -3,28 +3,30 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import { shallow } from 'zustand/shallow';
|
|
6
|
-
import { useRef, useEffect, createElement, useCallback, forwardRef,
|
|
6
|
+
import { useRef, useEffect, useState, createElement, useCallback, forwardRef, useMemo, memo, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
8
|
-
import { findBy,
|
|
8
|
+
import { findBy, isNotEmpty, noop, isPresent, hyphenate, renameKeys, notEqualsDeep, nullSafe, toLabelAndValue, removeBy, isNotPresent, isNot } from '@bigbinary/neeto-cist';
|
|
9
9
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
10
10
|
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
11
|
-
import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
12
11
|
import Button from '@bigbinary/neetoui/Button';
|
|
13
12
|
import { useTranslation, Trans } from 'react-i18next';
|
|
14
13
|
import { u as useUtilityStore, g as getSeparator, d as dotPath$1, b as getDateTimeValue, a as getDateTimeFormattedValue, D as DATE_TIME_TYPES, e as DATE_TIME_FORMAT, f as DATE_FORMAT, T as TIME_FORMAT } from './useUtilityStore-6TPs8A8Q.js';
|
|
15
14
|
import classNames from 'classnames';
|
|
16
15
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
17
|
-
import { assocPath, pluck, identity, isEmpty, mergeDeepLeft, isNotNil, whereAny, reject, equals, unless, path, omit, useWith, split, when, is, trim, eqBy, F, values, isNil, without, append, pipe, filter, uniq, join, map, assoc, mergeLeft, includes, test } from 'ramda';
|
|
16
|
+
import { assocPath, toLower, pluck, identity, isEmpty, mergeDeepLeft, isNotNil, whereAny, reject, equals, unless, path, omit, useWith, split, when, is, trim, eqBy, F, values, isNil, without, append, pipe, filter, uniq, join, map, assoc, mergeLeft, includes, test } from 'ramda';
|
|
18
17
|
import { t as t$1 } from 'i18next';
|
|
19
18
|
import * as yup from 'yup';
|
|
19
|
+
import Search from '@bigbinary/neeto-icons/Search';
|
|
20
|
+
import Input$1 from '@bigbinary/neetoui/Input';
|
|
20
21
|
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
21
22
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
22
23
|
import { manager } from '@bigbinary/neetoui/managers';
|
|
23
24
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
24
25
|
import Collapse from '@bigbinary/neeto-icons/Collapse';
|
|
26
|
+
import Callout from '@bigbinary/neetoui/Callout';
|
|
25
27
|
import Left from '@bigbinary/neeto-icons/Left';
|
|
26
28
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
27
|
-
import Input$
|
|
29
|
+
import Input$2 from '@bigbinary/neetoui/formik/Input';
|
|
28
30
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
29
31
|
import { withT, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
30
32
|
import Editor from '@monaco-editor/react';
|
|
@@ -36,19 +38,19 @@ import { dayjs, joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-front
|
|
|
36
38
|
import DatePicker from '@bigbinary/neetoui/DatePicker';
|
|
37
39
|
import MultiEmailInput from '@bigbinary/neetoui/formik/MultiEmailInput';
|
|
38
40
|
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
41
|
+
import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
39
42
|
import Select$1 from '@bigbinary/neetoui/formik/Select';
|
|
40
43
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
41
44
|
import Check from '@bigbinary/neeto-icons/Check';
|
|
42
45
|
import Close from '@bigbinary/neeto-icons/Close';
|
|
43
|
-
import Input$2 from '@bigbinary/neetoui/Input';
|
|
44
46
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
45
47
|
import CreatableSelect from 'react-select/creatable';
|
|
46
48
|
import _toArray from '@babel/runtime/helpers/toArray';
|
|
47
49
|
import { isPhoneNumberValid } from '@bigbinary/neeto-molecules/PhoneNumber';
|
|
48
50
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
49
51
|
import { components } from 'react-select';
|
|
52
|
+
import { O as OPERATORS$1, V as VERB_LABELS, M as MAXIMUM_OPTION_LENGTH$2, I as INPUT_FIELD_TYPES, C as CONDITION_VALUE_TYPES, F as FIELDS_WITH_OPTIONS$1 } from './constants-C_bfl8XZ.js';
|
|
50
53
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
51
|
-
import { O as OPERATORS$1, V as VERB_LABELS, I as INPUT_FIELD_TYPES, C as CONDITION_VALUE_TYPES, F as FIELDS_WITH_OPTIONS$1 } from './constants-DvCsjJGj.js';
|
|
52
54
|
import Radio$1 from '@bigbinary/neetoui/Radio';
|
|
53
55
|
import TimePicker from '@bigbinary/neetoui/TimePicker';
|
|
54
56
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
@@ -148,7 +150,7 @@ var Footer = function Footer(_ref) {
|
|
|
148
150
|
className = _ref.className;
|
|
149
151
|
return /*#__PURE__*/jsx("div", {
|
|
150
152
|
"data-cy": "pane-footer",
|
|
151
|
-
className: classNames("neeto-rules-side-panel__footer neeto-ui-border-gray-
|
|
153
|
+
className: classNames("neeto-rules-side-panel__footer neeto-ui-border-gray-200 flex items-center justify-between border-t p-6", className),
|
|
152
154
|
children: children
|
|
153
155
|
});
|
|
154
156
|
};
|
|
@@ -166,7 +168,7 @@ var Header = function Header(_ref) {
|
|
|
166
168
|
t = _useTranslation.t;
|
|
167
169
|
return /*#__PURE__*/jsxs("div", {
|
|
168
170
|
"data-cy": "pane-header",
|
|
169
|
-
className: classNames("neeto-rules-side-panel__header neeto-ui-border-gray-
|
|
171
|
+
className: classNames("neeto-rules-side-panel__header neeto-ui-border-gray-200 flex items-start justify-between border-b p-6", _defineProperty({}, className, className)),
|
|
170
172
|
children: [/*#__PURE__*/jsx("div", {
|
|
171
173
|
className: "flex min-w-0 flex-grow",
|
|
172
174
|
children: children
|
|
@@ -216,7 +218,7 @@ var Panel = function Panel() {
|
|
|
216
218
|
large: "neeto-rules-side-panel--large"
|
|
217
219
|
}[panelState.size] || "neeto-rules-side-panel--small";
|
|
218
220
|
return /*#__PURE__*/jsx("div", _objectSpread$u(_objectSpread$u({
|
|
219
|
-
className: classNames("neeto-rules-side-panel neeto-ui-border-gray-
|
|
221
|
+
className: classNames("neeto-rules-side-panel neeto-ui-border-gray-200 transition-width neeto-ui-bg-white ml-auto flex h-screen max-h-full flex-col overflow-y-auto border-l duration-300 ease-in-out", _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, panelSize, isOpen), "w-0 overflow-hidden", !isOpen), "absolute", hasOverlays), "right-0", hasOverlays))
|
|
220
222
|
}, paneProps), {}, {
|
|
221
223
|
children: /*#__PURE__*/jsx(Component, _objectSpread$u(_objectSpread$u({}, data), {}, {
|
|
222
224
|
onClose: resetPanelState
|
|
@@ -227,15 +229,11 @@ Panel.Header = Header;
|
|
|
227
229
|
Panel.Body = Body;
|
|
228
230
|
Panel.Footer = Footer;
|
|
229
231
|
|
|
230
|
-
var
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return /*#__PURE__*/jsx(Typography, {
|
|
236
|
-
className: "neeto-ui-text-white neeto-ui-bg-error-500 neeto-ui-rounded-sm -mx-4 w-full p-3",
|
|
237
|
-
style: "h5",
|
|
238
|
-
children: message
|
|
232
|
+
var StickySidebarHeader = function StickySidebarHeader(_ref) {
|
|
233
|
+
var children = _ref.children;
|
|
234
|
+
return /*#__PURE__*/jsx("div", {
|
|
235
|
+
className: "sticky top-0 neeto-ui-bg-white py-6 flex flex-col gap-3",
|
|
236
|
+
children: children
|
|
239
237
|
});
|
|
240
238
|
};
|
|
241
239
|
|
|
@@ -281,6 +279,7 @@ var DEFAULT_RULE_ACTION = {
|
|
|
281
279
|
};
|
|
282
280
|
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
283
281
|
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
282
|
+
var MAXIMUM_OPTION_LENGTH$1 = 7;
|
|
284
283
|
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
285
284
|
var DEFAULT_HELP_POPOVER_PROPS = {
|
|
286
285
|
helpLinkProps: {
|
|
@@ -288,6 +287,18 @@ var DEFAULT_HELP_POPOVER_PROPS = {
|
|
|
288
287
|
}
|
|
289
288
|
};
|
|
290
289
|
|
|
290
|
+
var ErrorCallout = function ErrorCallout(_ref) {
|
|
291
|
+
var message = _ref.message,
|
|
292
|
+
selectedField = _ref.selectedField;
|
|
293
|
+
if (!message) return null;
|
|
294
|
+
if (typeof message === "function") return message(selectedField);
|
|
295
|
+
return /*#__PURE__*/jsx(Callout, {
|
|
296
|
+
className: "block",
|
|
297
|
+
style: "danger",
|
|
298
|
+
children: message
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
|
|
291
302
|
var getFieldDetails$1 = function getFieldDetails(fieldValue) {
|
|
292
303
|
var actionOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
293
304
|
return findBy({
|
|
@@ -316,6 +327,12 @@ var getDetailsByValue = function getDetailsByValue(value, options) {
|
|
|
316
327
|
value: value
|
|
317
328
|
}, options);
|
|
318
329
|
};
|
|
330
|
+
var getSearchedOptions$2 = function getSearchedOptions(dropdownOptions, searchTerm) {
|
|
331
|
+
return dropdownOptions.filter(function (_ref) {
|
|
332
|
+
var label = _ref.label;
|
|
333
|
+
return toLower(label).includes(toLower(searchTerm.trim()));
|
|
334
|
+
});
|
|
335
|
+
};
|
|
319
336
|
var getSelectedOptions = function getSelectedOptions(options) {
|
|
320
337
|
return options.filter(identity).length ? options : [];
|
|
321
338
|
};
|
|
@@ -368,6 +385,10 @@ var getPanelSize = function getPanelSize(selectedField) {
|
|
|
368
385
|
var ActionPanel = function ActionPanel() {
|
|
369
386
|
var _useTranslation = useTranslation(),
|
|
370
387
|
t = _useTranslation.t;
|
|
388
|
+
var _useState = useState(""),
|
|
389
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
390
|
+
searchTerm = _useState2[0],
|
|
391
|
+
setSearchTerm = _useState2[1];
|
|
371
392
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
372
393
|
return {
|
|
373
394
|
setPanelState: store["setPanelState"],
|
|
@@ -407,6 +428,8 @@ var ActionPanel = function ActionPanel() {
|
|
|
407
428
|
ref = _useActiveField.ref,
|
|
408
429
|
setFieldActive = _useActiveField.setFieldActive;
|
|
409
430
|
var label = index ? t("neetoRules.common.andThen") : t("neetoRules.common.then");
|
|
431
|
+
var isSearchable = actionOptions.length > MAXIMUM_OPTION_LENGTH$1;
|
|
432
|
+
var searchedOptions = getSearchedOptions$2(actionOptions, searchTerm);
|
|
410
433
|
var setFieldValueAndUntouch = function setFieldValueAndUntouch(field, value) {
|
|
411
434
|
setFieldValue(field, value);
|
|
412
435
|
setFieldTouched(field, false);
|
|
@@ -447,26 +470,45 @@ var ActionPanel = function ActionPanel() {
|
|
|
447
470
|
})]
|
|
448
471
|
})
|
|
449
472
|
}), /*#__PURE__*/jsxs(Panel.Body, {
|
|
450
|
-
className: "space-y-4",
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
473
|
+
className: classNames("space-y-4", {
|
|
474
|
+
"pt-0": isSearchable || errorMessage
|
|
475
|
+
}),
|
|
476
|
+
children: [(isSearchable || errorMessage) && /*#__PURE__*/jsxs(StickySidebarHeader, {
|
|
477
|
+
children: [isSearchable && /*#__PURE__*/jsx(Input$1, {
|
|
478
|
+
"data-cy": "search-text-field",
|
|
479
|
+
placeholder: t("neetoRules.common.search"),
|
|
480
|
+
prefix: /*#__PURE__*/jsx(Search, {}),
|
|
481
|
+
value: searchTerm,
|
|
482
|
+
onChange: function onChange(e) {
|
|
483
|
+
return setSearchTerm(e.target.value);
|
|
484
|
+
},
|
|
485
|
+
onClick: function onClick(e) {
|
|
486
|
+
return e.stopPropagation();
|
|
487
|
+
}
|
|
488
|
+
}), /*#__PURE__*/jsx(ErrorCallout, {
|
|
489
|
+
selectedField: selectedField,
|
|
490
|
+
message: errorMessage
|
|
491
|
+
})]
|
|
492
|
+
}), isNotEmpty(searchedOptions) ? /*#__PURE__*/jsx(Radio, {
|
|
455
493
|
ref: ref,
|
|
456
494
|
stacked: true,
|
|
457
495
|
name: "".concat(name, ".name"),
|
|
458
496
|
value: selectedField === null || selectedField === void 0 ? void 0 : selectedField.value,
|
|
459
497
|
onChange: handleSelectOption,
|
|
460
|
-
children:
|
|
498
|
+
children: searchedOptions.map(function (_ref2) {
|
|
461
499
|
var label = _ref2.label,
|
|
462
500
|
value = _ref2.value;
|
|
463
501
|
return /*#__PURE__*/createElement(Radio.Item, {
|
|
464
502
|
label: label,
|
|
465
503
|
value: value,
|
|
466
|
-
key:
|
|
504
|
+
key: value,
|
|
467
505
|
onFocus: setFieldActive
|
|
468
506
|
});
|
|
469
507
|
})
|
|
508
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
509
|
+
className: "py-1 text-sm",
|
|
510
|
+
"data-cy": "no-options-menu-item",
|
|
511
|
+
children: t("neetoRules.common.noOptions")
|
|
470
512
|
})]
|
|
471
513
|
}), /*#__PURE__*/jsx(Panel.Footer, {
|
|
472
514
|
children: /*#__PURE__*/jsx(Button, {
|
|
@@ -721,13 +763,13 @@ var KeyValuePairsField = withT(function (_ref) {
|
|
|
721
763
|
children: [data.map(function (_, index) {
|
|
722
764
|
return /*#__PURE__*/jsxs("div", {
|
|
723
765
|
className: "flex h-8 space-x-3",
|
|
724
|
-
children: [/*#__PURE__*/jsx(Input$
|
|
766
|
+
children: [/*#__PURE__*/jsx(Input$2, {
|
|
725
767
|
onFocus: onFocus,
|
|
726
768
|
className: "w-1/3",
|
|
727
769
|
name: "".concat(name, ".").concat(index, ".key"),
|
|
728
770
|
placeholder: t("neetoRules.labels.key"),
|
|
729
771
|
type: "text"
|
|
730
|
-
}), /*#__PURE__*/jsx(Input$
|
|
772
|
+
}), /*#__PURE__*/jsx(Input$2, {
|
|
731
773
|
onFocus: onFocus,
|
|
732
774
|
className: "w-2/3",
|
|
733
775
|
name: "".concat(name, ".").concat(index, ".value"),
|
|
@@ -964,7 +1006,7 @@ var SaveAsTemplate = function SaveAsTemplate(_ref) {
|
|
|
964
1006
|
label: t("neetoRules.labels.saveAsTemplate"),
|
|
965
1007
|
name: switchName,
|
|
966
1008
|
onChange: handleChange
|
|
967
|
-
}), shouldSaveAsTemplate && /*#__PURE__*/jsx(Input$
|
|
1009
|
+
}), shouldSaveAsTemplate && /*#__PURE__*/jsx(Input$2, {
|
|
968
1010
|
autoFocus: true,
|
|
969
1011
|
required: true,
|
|
970
1012
|
label: t("neetoRules.labels.templateName"),
|
|
@@ -1140,7 +1182,7 @@ var ApiFields = function ApiFields(_ref2) {
|
|
|
1140
1182
|
initialFocusRef: ref,
|
|
1141
1183
|
onChange: handleTemplateChange,
|
|
1142
1184
|
onFocus: setFieldActive
|
|
1143
|
-
}), /*#__PURE__*/jsx(Input$
|
|
1185
|
+
}), /*#__PURE__*/jsx(Input$2, {
|
|
1144
1186
|
required: true,
|
|
1145
1187
|
className: "mb-4",
|
|
1146
1188
|
"data-cy": "api-action-endpoint-text-field",
|
|
@@ -1380,7 +1422,7 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
1380
1422
|
}, otherProps));
|
|
1381
1423
|
};
|
|
1382
1424
|
|
|
1383
|
-
var _excluded$d = ["dropdownOptions", "name", "selectedField", "shouldAutoFocus", "className", "required"];
|
|
1425
|
+
var _excluded$d = ["dropdownOptions", "name", "selectedField", "shouldAutoFocus", "className", "required", "handleSlackChannelRefresh", "action"];
|
|
1384
1426
|
function ownKeys$p(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; }
|
|
1385
1427
|
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$p(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$p(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1386
1428
|
var Target$g = function Target(_ref) {
|
|
@@ -1444,6 +1486,8 @@ var SelectField$2 = function SelectField(_ref2) {
|
|
|
1444
1486
|
className = _ref2.className,
|
|
1445
1487
|
_ref2$required = _ref2.required,
|
|
1446
1488
|
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
1489
|
+
handleSlackChannelRefresh = _ref2.handleSlackChannelRefresh,
|
|
1490
|
+
action = _ref2.action,
|
|
1447
1491
|
otherProps = _objectWithoutProperties(_ref2, _excluded$d);
|
|
1448
1492
|
var _useTranslation2 = useTranslation(),
|
|
1449
1493
|
t = _useTranslation2.t;
|
|
@@ -1475,18 +1519,32 @@ var SelectField$2 = function SelectField(_ref2) {
|
|
|
1475
1519
|
setValue((_option$value = option === null || option === void 0 ? void 0 : option.value) !== null && _option$value !== void 0 ? _option$value : null);
|
|
1476
1520
|
setTouched(true);
|
|
1477
1521
|
};
|
|
1478
|
-
return /*#__PURE__*/
|
|
1479
|
-
className:
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1522
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1523
|
+
className: "flex items-start gap-2",
|
|
1524
|
+
children: [/*#__PURE__*/jsx(Select$1, _objectSpread$p(_objectSpread$p({}, _objectSpread$p({
|
|
1525
|
+
className: className,
|
|
1526
|
+
name: name,
|
|
1527
|
+
required: required
|
|
1528
|
+
}, otherProps)), {}, {
|
|
1529
|
+
innerRef: ref,
|
|
1530
|
+
label: defaultLabel,
|
|
1531
|
+
options: dropdownOptions,
|
|
1532
|
+
value: selectedOption,
|
|
1533
|
+
onChange: handleSelectOption,
|
|
1534
|
+
onFocus: setFieldActive
|
|
1535
|
+
})), handleSlackChannelRefresh && action.name === "message_to_slack" && /*#__PURE__*/jsx(Button, {
|
|
1536
|
+
className: "mt-[22px]",
|
|
1537
|
+
"data-cy": "refresh-slack-button",
|
|
1538
|
+
icon: Refresh,
|
|
1539
|
+
size: "medium",
|
|
1540
|
+
style: "secondary",
|
|
1541
|
+
tooltipProps: {
|
|
1542
|
+
content: t("neetoRules.slack.refreshChannelList"),
|
|
1543
|
+
position: "top"
|
|
1544
|
+
},
|
|
1545
|
+
onClick: handleSlackChannelRefresh
|
|
1546
|
+
})]
|
|
1547
|
+
});
|
|
1490
1548
|
};
|
|
1491
1549
|
SelectField$2.Target = Target$g;
|
|
1492
1550
|
|
|
@@ -1623,7 +1681,7 @@ var EmailFields = function EmailFields(_ref2) {
|
|
|
1623
1681
|
name: "".concat(name, ".emails"),
|
|
1624
1682
|
initialFocusRef: isFirstFieldInForm("emails") ? initialFocusRef : null,
|
|
1625
1683
|
onFocus: setFieldActive
|
|
1626
|
-
}), !selectedField.hideSubject && /*#__PURE__*/jsx(Input$
|
|
1684
|
+
}), !selectedField.hideSubject && /*#__PURE__*/jsx(Input$2, {
|
|
1627
1685
|
required: true,
|
|
1628
1686
|
className: "mb-4",
|
|
1629
1687
|
"data-cy": "email-action-subject-text-field",
|
|
@@ -1703,7 +1761,7 @@ var Input = function Input(_ref2) {
|
|
|
1703
1761
|
}),
|
|
1704
1762
|
ref = _useActiveField2.ref,
|
|
1705
1763
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
1706
|
-
return /*#__PURE__*/jsx(Input$
|
|
1764
|
+
return /*#__PURE__*/jsx(Input$2, {
|
|
1707
1765
|
ref: ref,
|
|
1708
1766
|
required: required,
|
|
1709
1767
|
className: "my-auto",
|
|
@@ -1785,7 +1843,7 @@ var InlineInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1785
1843
|
return /*#__PURE__*/jsx("div", {
|
|
1786
1844
|
className: classNames("flex flex-grow", _defineProperty({}, className, className)),
|
|
1787
1845
|
ref: inputWrapperRef,
|
|
1788
|
-
children: /*#__PURE__*/jsx(Input$
|
|
1846
|
+
children: /*#__PURE__*/jsx(Input$1, _objectSpread$n(_objectSpread$n({
|
|
1789
1847
|
autoFocus: true,
|
|
1790
1848
|
required: true,
|
|
1791
1849
|
className: "neeto-planner-inline-input",
|
|
@@ -2199,7 +2257,6 @@ var MultiSelectCheckbox$1 = function MultiSelectCheckbox(_ref2) {
|
|
|
2199
2257
|
}) : /*#__PURE__*/jsx(Select$1, {
|
|
2200
2258
|
name: name,
|
|
2201
2259
|
innerRef: ref,
|
|
2202
|
-
label: defaultLabel,
|
|
2203
2260
|
options: dropdownOptions,
|
|
2204
2261
|
onFocus: setFieldActive
|
|
2205
2262
|
})]
|
|
@@ -2809,7 +2866,8 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2809
2866
|
isTarget = _ref$isTarget === void 0 ? false : _ref$isTarget,
|
|
2810
2867
|
errorMessage = _ref.errorMessage,
|
|
2811
2868
|
_ref$openPanel = _ref.openPanel,
|
|
2812
|
-
openPanel = _ref$openPanel === void 0 ? noop : _ref$openPanel
|
|
2869
|
+
openPanel = _ref$openPanel === void 0 ? noop : _ref$openPanel,
|
|
2870
|
+
handleSlackChannelRefresh = _ref.handleSlackChannelRefresh;
|
|
2813
2871
|
var _useTranslation = useTranslation(),
|
|
2814
2872
|
t = _useTranslation.t;
|
|
2815
2873
|
var hasError = !!errorMessage;
|
|
@@ -3006,6 +3064,8 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
3006
3064
|
return openPanel("small");
|
|
3007
3065
|
}
|
|
3008
3066
|
}) : /*#__PURE__*/jsx(SelectField$2, {
|
|
3067
|
+
action: action,
|
|
3068
|
+
handleSlackChannelRefresh: handleSlackChannelRefresh,
|
|
3009
3069
|
index: index,
|
|
3010
3070
|
selectedField: selectedField,
|
|
3011
3071
|
required: true,
|
|
@@ -3178,14 +3238,15 @@ var ActionSubItemPanel = function ActionSubItemPanel() {
|
|
|
3178
3238
|
setPanelState = _useUtilityStore.setPanelState,
|
|
3179
3239
|
resetPanelState = _useUtilityStore.resetPanelState;
|
|
3180
3240
|
var _useUtilityStore2 = useUtilityStore(function (store) {
|
|
3181
|
-
var _store$panelState, _store$panelState2, _store$panelState3, _store$panelState4, _store$panelState5, _store$panelState6;
|
|
3241
|
+
var _store$panelState, _store$panelState2, _store$panelState3, _store$panelState4, _store$panelState5, _store$panelState6, _store$panelState7;
|
|
3182
3242
|
return {
|
|
3183
3243
|
name: (_store$panelState = store["panelState"]) === null || _store$panelState === void 0 || (_store$panelState = _store$panelState["data"]) === null || _store$panelState === void 0 ? void 0 : _store$panelState["name"],
|
|
3184
3244
|
index: (_store$panelState2 = store["panelState"]) === null || _store$panelState2 === void 0 || (_store$panelState2 = _store$panelState2["data"]) === null || _store$panelState2 === void 0 ? void 0 : _store$panelState2["index"],
|
|
3185
3245
|
action: (_store$panelState3 = store["panelState"]) === null || _store$panelState3 === void 0 || (_store$panelState3 = _store$panelState3["data"]) === null || _store$panelState3 === void 0 ? void 0 : _store$panelState3["action"],
|
|
3186
3246
|
valueOptions: (_store$panelState4 = store["panelState"]) === null || _store$panelState4 === void 0 || (_store$panelState4 = _store$panelState4["data"]) === null || _store$panelState4 === void 0 ? void 0 : _store$panelState4["valueOptions"],
|
|
3187
3247
|
selectedField: (_store$panelState5 = store["panelState"]) === null || _store$panelState5 === void 0 || (_store$panelState5 = _store$panelState5["data"]) === null || _store$panelState5 === void 0 ? void 0 : _store$panelState5["selectedField"],
|
|
3188
|
-
errorMessage: (_store$panelState6 = store["panelState"]) === null || _store$panelState6 === void 0 || (_store$panelState6 = _store$panelState6["data"]) === null || _store$panelState6 === void 0 ? void 0 : _store$panelState6["errorMessage"]
|
|
3248
|
+
errorMessage: (_store$panelState6 = store["panelState"]) === null || _store$panelState6 === void 0 || (_store$panelState6 = _store$panelState6["data"]) === null || _store$panelState6 === void 0 ? void 0 : _store$panelState6["errorMessage"],
|
|
3249
|
+
handleSlackChannelRefresh: (_store$panelState7 = store["panelState"]) === null || _store$panelState7 === void 0 || (_store$panelState7 = _store$panelState7["data"]) === null || _store$panelState7 === void 0 ? void 0 : _store$panelState7["handleSlackChannelRefresh"]
|
|
3189
3250
|
};
|
|
3190
3251
|
}, shallow),
|
|
3191
3252
|
name = _useUtilityStore2.name,
|
|
@@ -3193,7 +3254,8 @@ var ActionSubItemPanel = function ActionSubItemPanel() {
|
|
|
3193
3254
|
action = _useUtilityStore2.action,
|
|
3194
3255
|
valueOptions = _useUtilityStore2.valueOptions,
|
|
3195
3256
|
selectedField = _useUtilityStore2.selectedField,
|
|
3196
|
-
errorMessage = _useUtilityStore2.errorMessage
|
|
3257
|
+
errorMessage = _useUtilityStore2.errorMessage,
|
|
3258
|
+
handleSlackChannelRefresh = _useUtilityStore2.handleSlackChannelRefresh;
|
|
3197
3259
|
var _useFormikContext = useFormikContext(),
|
|
3198
3260
|
setFieldTouched = _useFormikContext.setFieldTouched;
|
|
3199
3261
|
var _useField = useField("".concat(name, ".metadata")),
|
|
@@ -3249,12 +3311,17 @@ var ActionSubItemPanel = function ActionSubItemPanel() {
|
|
|
3249
3311
|
})]
|
|
3250
3312
|
})
|
|
3251
3313
|
}), /*#__PURE__*/jsxs(Panel.Body, {
|
|
3252
|
-
className: "space-y-4",
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3314
|
+
className: classNames("space-y-4", {
|
|
3315
|
+
"pt-0": errorMessage
|
|
3316
|
+
}),
|
|
3317
|
+
children: [errorMessage && /*#__PURE__*/jsx(StickySidebarHeader, {
|
|
3318
|
+
children: /*#__PURE__*/jsx(ErrorCallout, {
|
|
3319
|
+
selectedField: selectedField,
|
|
3320
|
+
message: errorMessage
|
|
3321
|
+
})
|
|
3256
3322
|
}), /*#__PURE__*/jsx(ActionSubItem$1, {
|
|
3257
3323
|
action: action,
|
|
3324
|
+
handleSlackChannelRefresh: handleSlackChannelRefresh,
|
|
3258
3325
|
index: index,
|
|
3259
3326
|
selectedField: selectedField,
|
|
3260
3327
|
valueOptions: valueOptions,
|
|
@@ -3422,7 +3489,7 @@ var InputField$1 = function InputField(_ref2) {
|
|
|
3422
3489
|
}),
|
|
3423
3490
|
ref = _useActiveField2.ref,
|
|
3424
3491
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
3425
|
-
return /*#__PURE__*/jsx(Input$
|
|
3492
|
+
return /*#__PURE__*/jsx(Input$2, {
|
|
3426
3493
|
name: name,
|
|
3427
3494
|
placeholder: placeholder,
|
|
3428
3495
|
ref: ref,
|
|
@@ -3682,6 +3749,12 @@ var getVerbOptions = function getVerbOptions() {
|
|
|
3682
3749
|
};
|
|
3683
3750
|
});
|
|
3684
3751
|
};
|
|
3752
|
+
var getSearchedOptions$1 = function getSearchedOptions(dropdownOptions, searchTerm) {
|
|
3753
|
+
return dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.filter(function (_ref) {
|
|
3754
|
+
var label = _ref.label;
|
|
3755
|
+
return toLower(label).includes(toLower(searchTerm.trim()));
|
|
3756
|
+
});
|
|
3757
|
+
};
|
|
3685
3758
|
var getAllOptions = function getAllOptions(options) {
|
|
3686
3759
|
return Array.isArray(options) ? options.map(function (option) {
|
|
3687
3760
|
return {
|
|
@@ -3799,7 +3872,7 @@ var MultiSelectCreate = function MultiSelectCreate(_ref2) {
|
|
|
3799
3872
|
MultiSelectCreate.Target = Target$3;
|
|
3800
3873
|
|
|
3801
3874
|
var _excluded$7 = ["name", "options", "placeholder", "onClick"],
|
|
3802
|
-
_excluded2 = ["name", "options", "handleOnChange", "shouldAutoFocus", "showLabel", "required"];
|
|
3875
|
+
_excluded2 = ["name", "options", "handleOnChange", "shouldAutoFocus", "showLabel", "required", "isSearchable"];
|
|
3803
3876
|
function ownKeys$h(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; }
|
|
3804
3877
|
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3805
3878
|
var Target$2 = function Target(_ref) {
|
|
@@ -3854,9 +3927,15 @@ var RadioField$1 = function RadioField(_ref2) {
|
|
|
3854
3927
|
showLabel = _ref2$showLabel === void 0 ? true : _ref2$showLabel,
|
|
3855
3928
|
_ref2$required = _ref2.required,
|
|
3856
3929
|
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
3930
|
+
_ref2$isSearchable = _ref2.isSearchable,
|
|
3931
|
+
isSearchable = _ref2$isSearchable === void 0 ? false : _ref2$isSearchable,
|
|
3857
3932
|
otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
3858
3933
|
var _useTranslation2 = useTranslation(),
|
|
3859
3934
|
t = _useTranslation2.t;
|
|
3935
|
+
var _useState = useState(""),
|
|
3936
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3937
|
+
searchTerm = _useState2[0],
|
|
3938
|
+
setSearchTerm = _useState2[1];
|
|
3860
3939
|
var _useField3 = useField(name),
|
|
3861
3940
|
_useField4 = _slicedToArray(_useField3, 3),
|
|
3862
3941
|
field = _useField4[0],
|
|
@@ -3871,6 +3950,7 @@ var RadioField$1 = function RadioField(_ref2) {
|
|
|
3871
3950
|
var selectedOption = findBy({
|
|
3872
3951
|
value: field.value
|
|
3873
3952
|
}, options);
|
|
3953
|
+
var searchedOptions = getSearchedOptions$1(options, searchTerm);
|
|
3874
3954
|
var handleRadioChange = function handleRadioChange(_ref3) {
|
|
3875
3955
|
var value = _ref3.target.value;
|
|
3876
3956
|
var selectedOption = findBy({
|
|
@@ -3879,25 +3959,45 @@ var RadioField$1 = function RadioField(_ref2) {
|
|
|
3879
3959
|
handleOnChange ? handleOnChange(selectedOption) : setValue(value);
|
|
3880
3960
|
setTouched(true);
|
|
3881
3961
|
};
|
|
3882
|
-
return /*#__PURE__*/
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3962
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3963
|
+
className: "w-full",
|
|
3964
|
+
children: [isSearchable && /*#__PURE__*/jsx(StickySidebarHeader, {
|
|
3965
|
+
children: /*#__PURE__*/jsx(Input$1, {
|
|
3966
|
+
"data-cy": "search-text-field",
|
|
3967
|
+
placeholder: t("neetoRules.common.search"),
|
|
3968
|
+
prefix: /*#__PURE__*/jsx(Search, {}),
|
|
3969
|
+
value: searchTerm,
|
|
3970
|
+
onChange: function onChange(e) {
|
|
3971
|
+
return setSearchTerm(e.target.value);
|
|
3972
|
+
},
|
|
3973
|
+
onClick: function onClick(e) {
|
|
3974
|
+
return e.stopPropagation();
|
|
3975
|
+
}
|
|
3976
|
+
})
|
|
3977
|
+
}), isNotEmpty(searchedOptions) ? /*#__PURE__*/jsx(Radio$1, _objectSpread$h(_objectSpread$h({
|
|
3978
|
+
ref: ref,
|
|
3979
|
+
required: required,
|
|
3980
|
+
stacked: true,
|
|
3981
|
+
label: showLabel && t("neetoRules.labels.selectValue"),
|
|
3982
|
+
value: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value,
|
|
3983
|
+
onChange: handleRadioChange,
|
|
3984
|
+
onFocus: setFieldActive
|
|
3985
|
+
}, otherProps), {}, {
|
|
3986
|
+
children: searchedOptions.map(function (_ref4) {
|
|
3987
|
+
var label = _ref4.label,
|
|
3988
|
+
value = _ref4.value;
|
|
3989
|
+
return /*#__PURE__*/createElement(Radio$1.Item, {
|
|
3990
|
+
label: label,
|
|
3991
|
+
value: value,
|
|
3992
|
+
key: value
|
|
3993
|
+
});
|
|
3994
|
+
})
|
|
3995
|
+
})) : /*#__PURE__*/jsx("div", {
|
|
3996
|
+
className: "py-1 text-sm",
|
|
3997
|
+
"data-cy": "no-options-menu-item",
|
|
3998
|
+
children: t("neetoRules.common.noOptions")
|
|
3999
|
+
})]
|
|
4000
|
+
});
|
|
3901
4001
|
};
|
|
3902
4002
|
RadioField$1.Target = Target$2;
|
|
3903
4003
|
|
|
@@ -4122,6 +4222,7 @@ var FieldPanel = function FieldPanel() {
|
|
|
4122
4222
|
var _useField3 = useField("".concat(name, ".joinType")),
|
|
4123
4223
|
_useField4 = _slicedToArray(_useField3, 1),
|
|
4124
4224
|
logicalOperator = _useField4[0];
|
|
4225
|
+
var isSearchable = conditionOptions.length > MAXIMUM_OPTION_LENGTH$2;
|
|
4125
4226
|
var handleContinue = function handleContinue() {
|
|
4126
4227
|
!meta.error && setPanelState(mergeDeepLeft({
|
|
4127
4228
|
type: PANEL_TYPES.VERB_AND_VALUE,
|
|
@@ -4149,7 +4250,11 @@ var FieldPanel = function FieldPanel() {
|
|
|
4149
4250
|
})]
|
|
4150
4251
|
})
|
|
4151
4252
|
}), /*#__PURE__*/jsx(Panel.Body, {
|
|
4253
|
+
className: classNames({
|
|
4254
|
+
"pt-0": isSearchable
|
|
4255
|
+
}),
|
|
4152
4256
|
children: /*#__PURE__*/jsx(RadioField$1, {
|
|
4257
|
+
isSearchable: isSearchable,
|
|
4153
4258
|
shouldAutoFocus: true,
|
|
4154
4259
|
handleOnChange: handleFieldChange,
|
|
4155
4260
|
name: "".concat(name, ".field"),
|
|
@@ -4415,6 +4520,7 @@ var VerbAndValuePanel = function VerbAndValuePanel() {
|
|
|
4415
4520
|
});
|
|
4416
4521
|
};
|
|
4417
4522
|
|
|
4523
|
+
var MAXIMUM_OPTION_LENGTH = 7;
|
|
4418
4524
|
var OPERATORS = {
|
|
4419
4525
|
or: "or_operator",
|
|
4420
4526
|
and: "and_operator"
|
|
@@ -4477,7 +4583,7 @@ var DelayPanel = function DelayPanel() {
|
|
|
4477
4583
|
}), /*#__PURE__*/jsx(Panel.Body, {
|
|
4478
4584
|
children: /*#__PURE__*/jsxs("div", {
|
|
4479
4585
|
className: "flex gap-x-2",
|
|
4480
|
-
children: [/*#__PURE__*/jsx(Input$
|
|
4586
|
+
children: [/*#__PURE__*/jsx(Input$2, {
|
|
4481
4587
|
className: "w-44",
|
|
4482
4588
|
max: 15,
|
|
4483
4589
|
min: 1,
|
|
@@ -4511,11 +4617,27 @@ var DelayPanel = function DelayPanel() {
|
|
|
4511
4617
|
});
|
|
4512
4618
|
};
|
|
4513
4619
|
|
|
4620
|
+
var getAllEvents = function getAllEvents(events, dropdownOptions) {
|
|
4621
|
+
return dropdownOptions.filter(function (option) {
|
|
4622
|
+
return events.includes(option.value);
|
|
4623
|
+
});
|
|
4624
|
+
};
|
|
4625
|
+
var getSearchedOptions = function getSearchedOptions(dropdownOptions, searchTerm) {
|
|
4626
|
+
return dropdownOptions === null || dropdownOptions === void 0 ? void 0 : dropdownOptions.filter(function (_ref) {
|
|
4627
|
+
var label = _ref.label;
|
|
4628
|
+
return toLower(label).includes(toLower(searchTerm.trim()));
|
|
4629
|
+
});
|
|
4630
|
+
};
|
|
4631
|
+
|
|
4514
4632
|
function ownKeys$f(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; }
|
|
4515
4633
|
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4516
4634
|
var EventsPanel = function EventsPanel() {
|
|
4517
4635
|
var _useTranslation = useTranslation(),
|
|
4518
4636
|
t = _useTranslation.t;
|
|
4637
|
+
var _useState = useState(""),
|
|
4638
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4639
|
+
searchTerm = _useState2[0],
|
|
4640
|
+
setSearchTerm = _useState2[1];
|
|
4519
4641
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
4520
4642
|
return {
|
|
4521
4643
|
setPanelState: store["setPanelState"]
|
|
@@ -4557,6 +4679,8 @@ var EventsPanel = function EventsPanel() {
|
|
|
4557
4679
|
var defaultData = elementProps.defaultData;
|
|
4558
4680
|
var eventNames = pluck("name", events);
|
|
4559
4681
|
var dropdownOptions = elementProps.eventOptions;
|
|
4682
|
+
var searchedOptions = getSearchedOptions(dropdownOptions, searchTerm);
|
|
4683
|
+
var isSearchable = dropdownOptions.length > MAXIMUM_OPTION_LENGTH;
|
|
4560
4684
|
var handleDefaultData = /*#__PURE__*/function () {
|
|
4561
4685
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
4562
4686
|
var _values$name;
|
|
@@ -4659,10 +4783,26 @@ var EventsPanel = function EventsPanel() {
|
|
|
4659
4783
|
children: t("neetoRules.form.addEventDescription")
|
|
4660
4784
|
})]
|
|
4661
4785
|
})
|
|
4662
|
-
}), /*#__PURE__*/
|
|
4663
|
-
|
|
4786
|
+
}), /*#__PURE__*/jsxs(Panel.Body, {
|
|
4787
|
+
className: classNames({
|
|
4788
|
+
"pt-0": isSearchable
|
|
4789
|
+
}),
|
|
4790
|
+
children: [isSearchable && /*#__PURE__*/jsx(StickySidebarHeader, {
|
|
4791
|
+
children: /*#__PURE__*/jsx(Input$1, {
|
|
4792
|
+
"data-cy": "search-text-field",
|
|
4793
|
+
placeholder: t("neetoRules.common.search"),
|
|
4794
|
+
prefix: /*#__PURE__*/jsx(Search, {}),
|
|
4795
|
+
value: searchTerm,
|
|
4796
|
+
onChange: function onChange(e) {
|
|
4797
|
+
return setSearchTerm(e.target.value);
|
|
4798
|
+
},
|
|
4799
|
+
onClick: function onClick(e) {
|
|
4800
|
+
return e.stopPropagation();
|
|
4801
|
+
}
|
|
4802
|
+
})
|
|
4803
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
4664
4804
|
className: "space-y-3",
|
|
4665
|
-
children: [isNotEmpty(
|
|
4805
|
+
children: [isNotEmpty(searchedOptions) ? searchedOptions.map(function (option) {
|
|
4666
4806
|
return /*#__PURE__*/createElement(Checkbox, {
|
|
4667
4807
|
ref: ref,
|
|
4668
4808
|
checked: eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(option.value),
|
|
@@ -4683,7 +4823,7 @@ var EventsPanel = function EventsPanel() {
|
|
|
4683
4823
|
className: "neeto-ui-input__error",
|
|
4684
4824
|
children: error
|
|
4685
4825
|
})]
|
|
4686
|
-
})
|
|
4826
|
+
})]
|
|
4687
4827
|
}), /*#__PURE__*/jsx(Panel.Footer, {
|
|
4688
4828
|
children: /*#__PURE__*/jsx(Button, {
|
|
4689
4829
|
"data-cy": "continue-button",
|
|
@@ -5114,10 +5254,13 @@ var getSchemaForExecutionDelay = function getSchemaForExecutionDelay(_) {
|
|
|
5114
5254
|
var getSchemaForElement = function getSchemaForElement(element, customData) {
|
|
5115
5255
|
return VALIDATION_SCHEMA[element.type](element, customData);
|
|
5116
5256
|
};
|
|
5117
|
-
var getValidationSchema = function getValidationSchema(
|
|
5257
|
+
var getValidationSchema = function getValidationSchema(_ref) {
|
|
5258
|
+
var data = _ref.data,
|
|
5259
|
+
customData = _ref.customData,
|
|
5260
|
+
isNameGenerationDisabled = _ref.isNameGenerationDisabled;
|
|
5118
5261
|
var fieldKeys = Object.keys(data);
|
|
5119
5262
|
var schema = fieldKeys.reduce(function (acc, key) {
|
|
5120
|
-
if (key === "name") return acc;
|
|
5263
|
+
if (key === "name" && !isNameGenerationDisabled) return acc;
|
|
5121
5264
|
return _objectSpread$e(_objectSpread$e({}, acc), {}, _defineProperty({}, key, yup.object({
|
|
5122
5265
|
value: getSchemaForElement(data[key], customData)
|
|
5123
5266
|
})));
|
|
@@ -5208,7 +5351,8 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
5208
5351
|
selectedActionOptions = _ref.selectedActionOptions,
|
|
5209
5352
|
routeToSlackIntegration = _ref.routeToSlackIntegration,
|
|
5210
5353
|
shouldOpenPanel = _ref.shouldOpenPanel,
|
|
5211
|
-
setShouldOpenPanel = _ref.setShouldOpenPanel
|
|
5354
|
+
setShouldOpenPanel = _ref.setShouldOpenPanel,
|
|
5355
|
+
handleSlackChannelRefresh = _ref.handleSlackChannelRefresh;
|
|
5212
5356
|
var _useTranslation = useTranslation(),
|
|
5213
5357
|
t = _useTranslation.t;
|
|
5214
5358
|
var _useFormikContext = useFormikContext(),
|
|
@@ -5283,7 +5427,8 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
5283
5427
|
selectedField: selectedField,
|
|
5284
5428
|
onSelectAction: onSelectAction,
|
|
5285
5429
|
valueOptions: getSelectedFieldOptions(),
|
|
5286
|
-
errorMessage: errorMessage
|
|
5430
|
+
errorMessage: errorMessage,
|
|
5431
|
+
handleSlackChannelRefresh: handleSlackChannelRefresh
|
|
5287
5432
|
};
|
|
5288
5433
|
var _openPanel = function openPanel(type, panelSize) {
|
|
5289
5434
|
setPanelState({
|
|
@@ -5311,9 +5456,10 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
5311
5456
|
})
|
|
5312
5457
|
});
|
|
5313
5458
|
});
|
|
5314
|
-
}, [selectedField]);
|
|
5459
|
+
}, [selectedField === null || selectedField === void 0 ? void 0 : selectedField.value]);
|
|
5460
|
+
var hasError = !!errorMessage;
|
|
5315
5461
|
useEffect(function () {
|
|
5316
|
-
if (
|
|
5462
|
+
if (hasError) {
|
|
5317
5463
|
setErrorFields(function (prev) {
|
|
5318
5464
|
return prev.includes(name) ? prev : [].concat(_toConsumableArray(prev), [name]);
|
|
5319
5465
|
});
|
|
@@ -5327,7 +5473,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
5327
5473
|
return prev.filter(isNot(name));
|
|
5328
5474
|
});
|
|
5329
5475
|
};
|
|
5330
|
-
}, [
|
|
5476
|
+
}, [hasError, name, setErrorFields]);
|
|
5331
5477
|
return /*#__PURE__*/jsx("div", {
|
|
5332
5478
|
className: "flex flex-grow min-w-0 flex-wrap gap-x-1 gap-y-3",
|
|
5333
5479
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -5446,6 +5592,7 @@ var Actions = function Actions(_ref) {
|
|
|
5446
5592
|
children: [/*#__PURE__*/jsx(ActionItem$1, {
|
|
5447
5593
|
action: action,
|
|
5448
5594
|
elementProps: elementProps,
|
|
5595
|
+
handleSlackChannelRefresh: handleSlackChannelRefresh,
|
|
5449
5596
|
index: index,
|
|
5450
5597
|
onSelectAction: onSelectAction,
|
|
5451
5598
|
routeToSlackIntegration: routeToSlackIntegration,
|
|
@@ -5456,18 +5603,7 @@ var Actions = function Actions(_ref) {
|
|
|
5456
5603
|
parentName: name
|
|
5457
5604
|
}), /*#__PURE__*/jsxs("div", {
|
|
5458
5605
|
className: "flex flex-wrap flex-shrink-0 self-center",
|
|
5459
|
-
children: [
|
|
5460
|
-
"data-cy": "refresh-slack-button",
|
|
5461
|
-
icon: Refresh,
|
|
5462
|
-
size: "medium",
|
|
5463
|
-
tooltipProps: {
|
|
5464
|
-
content: t("neetoRules.slack.refreshChannelList"),
|
|
5465
|
-
position: "top"
|
|
5466
|
-
},
|
|
5467
|
-
onClick: function onClick() {
|
|
5468
|
-
return handleSlackChannelRefresh();
|
|
5469
|
-
}
|
|
5470
|
-
}), showButton && index === actions.length - 1 && /*#__PURE__*/jsx(Button, {
|
|
5606
|
+
children: [showButton && index === actions.length - 1 && /*#__PURE__*/jsx(Button, {
|
|
5471
5607
|
"data-cy": "add-action-button",
|
|
5472
5608
|
icon: Plus,
|
|
5473
5609
|
size: "medium",
|
|
@@ -5648,7 +5784,7 @@ var ConditionItem = function ConditionItem(_ref) {
|
|
|
5648
5784
|
})
|
|
5649
5785
|
});
|
|
5650
5786
|
});
|
|
5651
|
-
}, [selectedField, condition.verb]);
|
|
5787
|
+
}, [selectedField === null || selectedField === void 0 ? void 0 : selectedField.value, condition.verb]);
|
|
5652
5788
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
5653
5789
|
children: [!!index && /*#__PURE__*/jsx(LogicalOperator, {
|
|
5654
5790
|
handleGroupJoinType: handleGroupJoinType,
|
|
@@ -6012,12 +6148,6 @@ var Performer = function Performer(_ref) {
|
|
|
6012
6148
|
});
|
|
6013
6149
|
};
|
|
6014
6150
|
|
|
6015
|
-
var getAllEvents = function getAllEvents(events, dropdownOptions) {
|
|
6016
|
-
return dropdownOptions.filter(function (option) {
|
|
6017
|
-
return events.includes(option.value);
|
|
6018
|
-
});
|
|
6019
|
-
};
|
|
6020
|
-
|
|
6021
6151
|
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; }
|
|
6022
6152
|
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; }
|
|
6023
6153
|
var Events = function Events(_ref) {
|
|
@@ -6242,7 +6372,7 @@ var InputField = function InputField(_ref) {
|
|
|
6242
6372
|
_useDebouncedUpdate2 = _slicedToArray(_useDebouncedUpdate, 2),
|
|
6243
6373
|
text = _useDebouncedUpdate2[0],
|
|
6244
6374
|
setText = _useDebouncedUpdate2[1];
|
|
6245
|
-
return /*#__PURE__*/jsx(Input$
|
|
6375
|
+
return /*#__PURE__*/jsx(Input$2, _objectSpread$7(_objectSpread$7({
|
|
6246
6376
|
className: "mb-4",
|
|
6247
6377
|
label: label || (elementProps === null || elementProps === void 0 ? void 0 : elementProps.label)
|
|
6248
6378
|
}, field), {}, {
|
|
@@ -6370,7 +6500,8 @@ var TextareaField = function TextareaField(_ref) {
|
|
|
6370
6500
|
var usePollRuleName = function usePollRuleName(_ref) {
|
|
6371
6501
|
var url = _ref.url,
|
|
6372
6502
|
formikRef = _ref.formikRef,
|
|
6373
|
-
payloadKey = _ref.payloadKey
|
|
6503
|
+
payloadKey = _ref.payloadKey,
|
|
6504
|
+
isNameGenerationDisabled = _ref.isNameGenerationDisabled;
|
|
6374
6505
|
var resolverRef = useRef(noop);
|
|
6375
6506
|
var _useState = useState(null),
|
|
6376
6507
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -6394,7 +6525,7 @@ var usePollRuleName = function usePollRuleName(_ref) {
|
|
|
6394
6525
|
url: url,
|
|
6395
6526
|
id: rule === null || rule === void 0 ? void 0 : rule.id
|
|
6396
6527
|
}, {
|
|
6397
|
-
enabled: !!(rule !== null && rule !== void 0 && rule.id) && !isCancelledNameGeneration,
|
|
6528
|
+
enabled: !!(rule !== null && rule !== void 0 && rule.id) && !isCancelledNameGeneration && !isNameGenerationDisabled,
|
|
6398
6529
|
refetchInterval: function refetchInterval(query) {
|
|
6399
6530
|
var _query$state$data;
|
|
6400
6531
|
return (_query$state$data = query.state.data) !== null && _query$state$data !== void 0 && (_query$state$data = _query$state$data[payloadKey]) !== null && _query$state$data !== void 0 && _query$state$data.isDefaultName ? POLL_RETRY_COUNT : false;
|
|
@@ -6412,7 +6543,7 @@ var usePollRuleName = function usePollRuleName(_ref) {
|
|
|
6412
6543
|
}, 1000);
|
|
6413
6544
|
}, [ruleNameStatus === null || ruleNameStatus === void 0 ? void 0 : ruleNameStatus.isDefaultName]);
|
|
6414
6545
|
var waitForGeneratedRuleName = useCallback(function (rule) {
|
|
6415
|
-
if (!rule || !(rule !== null && rule !== void 0 && rule.isDefaultName)) return rule;
|
|
6546
|
+
if (!rule || !(rule !== null && rule !== void 0 && rule.isDefaultName) || isNameGenerationDisabled) return rule;
|
|
6416
6547
|
setRule(rule);
|
|
6417
6548
|
setIsGeneratingName(true);
|
|
6418
6549
|
setIsCancelledNameGeneration(false);
|
|
@@ -6616,7 +6747,9 @@ var Form = function Form(_ref) {
|
|
|
6616
6747
|
_ref$showStatusSwitch = _ref.showStatusSwitch,
|
|
6617
6748
|
showStatusSwitch = _ref$showStatusSwitch === void 0 ? true : _ref$showStatusSwitch,
|
|
6618
6749
|
_ref$payloadKey = _ref.payloadKey,
|
|
6619
|
-
payloadKey = _ref$payloadKey === void 0 ? "rule" : _ref$payloadKey
|
|
6750
|
+
payloadKey = _ref$payloadKey === void 0 ? "rule" : _ref$payloadKey,
|
|
6751
|
+
_ref$isNameGeneration = _ref.isNameGenerationDisabled,
|
|
6752
|
+
isNameGenerationDisabled = _ref$isNameGeneration === void 0 ? false : _ref$isNameGeneration;
|
|
6620
6753
|
var _useTranslation = useTranslation(),
|
|
6621
6754
|
t = _useTranslation.t;
|
|
6622
6755
|
var formikRef = useRef(null);
|
|
@@ -6641,7 +6774,8 @@ var Form = function Form(_ref) {
|
|
|
6641
6774
|
var _usePollRuleName = usePollRuleName({
|
|
6642
6775
|
url: url,
|
|
6643
6776
|
formikRef: formikRef,
|
|
6644
|
-
payloadKey: payloadKey
|
|
6777
|
+
payloadKey: payloadKey,
|
|
6778
|
+
isNameGenerationDisabled: isNameGenerationDisabled
|
|
6645
6779
|
}),
|
|
6646
6780
|
waitForGeneratedRuleName = _usePollRuleName.waitForGeneratedRuleName,
|
|
6647
6781
|
handleCancelNameGeneration = _usePollRuleName.handleCancelNameGeneration,
|
|
@@ -6670,7 +6804,11 @@ var Form = function Form(_ref) {
|
|
|
6670
6804
|
enableReinitialize: true,
|
|
6671
6805
|
initialValues: _objectSpread$1(_objectSpread$1({}, DEFAULT_INITIAL_VALUE), initialValues),
|
|
6672
6806
|
innerRef: formikRef,
|
|
6673
|
-
validationSchema: getValidationSchema(
|
|
6807
|
+
validationSchema: getValidationSchema({
|
|
6808
|
+
data: data,
|
|
6809
|
+
customData: customData,
|
|
6810
|
+
isNameGenerationDisabled: isNameGenerationDisabled
|
|
6811
|
+
}),
|
|
6674
6812
|
onSubmit: submitForm,
|
|
6675
6813
|
children: function children(_ref2) {
|
|
6676
6814
|
var dirty = _ref2.dirty,
|
|
@@ -6697,7 +6835,7 @@ var Form = function Form(_ref) {
|
|
|
6697
6835
|
data: initialValues,
|
|
6698
6836
|
label: t("neetoRules.common.name"),
|
|
6699
6837
|
name: "name",
|
|
6700
|
-
placeholder: t("neetoRules.placeholders.autoGenerateName")
|
|
6838
|
+
placeholder: isNameGenerationDisabled ? "" : t("neetoRules.placeholders.autoGenerateName")
|
|
6701
6839
|
}), isGeneratingName && /*#__PURE__*/jsxs(Fragment, {
|
|
6702
6840
|
children: [/*#__PURE__*/jsx(Tooltip, {
|
|
6703
6841
|
content: t("neetoRules.form.aiGeneratedName"),
|