@bigbinary/neeto-rules-frontend 2.2.0 → 2.3.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 +10 -0
- package/app/javascript/src/translations/en.json +2 -1
- package/dist/NeetoRules.js +2 -10
- package/dist/NeetoRules.js.map +1 -1
- package/dist/NeetoRulesForm.js +38 -13
- package/dist/NeetoRulesForm.js.map +1 -1
- package/dist/RulePreview.js +7 -4
- package/dist/RulePreview.js.map +1 -1
- package/dist/cjs/NeetoRules.js +19 -27
- package/dist/cjs/NeetoRules.js.map +1 -1
- package/dist/cjs/NeetoRulesForm.js +146 -122
- package/dist/cjs/NeetoRulesForm.js.map +1 -1
- package/dist/cjs/RulePreview.js +10 -7
- package/dist/cjs/RulePreview.js.map +1 -1
- package/dist/cjs/index.js +2 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/{toConsumableArray-9f1f441a.js → toConsumableArray-71e2b184.js} +4 -4
- package/dist/{toConsumableArray-9f1f441a.js.map → toConsumableArray-71e2b184.js.map} +1 -1
- package/dist/{toConsumableArray-1215bc07.js → toConsumableArray-ee25f277.js} +2 -2
- package/dist/{toConsumableArray-1215bc07.js.map → toConsumableArray-ee25f277.js.map} +1 -1
- package/dist/{slicedToArray-2af6bc03.js → utils-249a1c9a.js} +23 -2
- package/dist/utils-249a1c9a.js.map +1 -0
- package/dist/{slicedToArray-cc928132.js → utils-ca50bfc9.js} +24 -1
- package/dist/utils-ca50bfc9.js.map +1 -0
- package/package.json +15 -15
- package/dist/slicedToArray-2af6bc03.js.map +0 -1
- package/dist/slicedToArray-cc928132.js.map +0 -1
package/dist/NeetoRulesForm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as _defineProperty, a as _slicedToArray, b as _arrayWithHoles,
|
|
2
|
-
import { _ as _objectWithoutProperties, b as _iterableToArray, a as _toConsumableArray, g as getDefaultExportFromCjs } from './toConsumableArray-
|
|
1
|
+
import { _ as _defineProperty, a as _slicedToArray, g as getSeparator, b as _arrayWithHoles, d as _unsupportedIterableToArray, e as _nonIterableRest, f as _typeof$1 } from './utils-249a1c9a.js';
|
|
2
|
+
import { _ as _objectWithoutProperties, b as _iterableToArray, a as _toConsumableArray, g as getDefaultExportFromCjs } from './toConsumableArray-ee25f277.js';
|
|
3
3
|
import { useEffect, useState, useRef, forwardRef, useMemo, memo, createElement, Fragment as Fragment$1 } from 'react';
|
|
4
4
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
5
5
|
import { isNotEmpty, isPresent, renameKeys, findBy, noop, nullSafe, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
@@ -9,7 +9,7 @@ import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
|
9
9
|
import Button from '@bigbinary/neetoui/Button';
|
|
10
10
|
import { useTranslation, Trans } from 'react-i18next';
|
|
11
11
|
import classNames from 'classnames';
|
|
12
|
-
import { joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
12
|
+
import { dayjs, joinHyphenCase, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
13
13
|
import Check from '@bigbinary/neeto-icons/Check';
|
|
14
14
|
import Search from '@bigbinary/neeto-icons/Search';
|
|
15
15
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
@@ -23,7 +23,6 @@ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
|
23
23
|
import { withT, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
24
24
|
import Label from '@bigbinary/neetoui/Label';
|
|
25
25
|
import Select from '@bigbinary/neetoui/Select';
|
|
26
|
-
import dayjs from 'dayjs';
|
|
27
26
|
import DatePicker from '@bigbinary/neetoui/DatePicker';
|
|
28
27
|
import { t as t$1 } from 'i18next';
|
|
29
28
|
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
@@ -687,7 +686,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(_ref2) {
|
|
|
687
686
|
var Menu$9 = Dropdown$1.Menu,
|
|
688
687
|
MenuItem$9 = Dropdown$1.MenuItem;
|
|
689
688
|
var DropdownField$1 = function DropdownField(_ref) {
|
|
690
|
-
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions,
|
|
689
|
+
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions, _defaultSelectedOptio;
|
|
691
690
|
var dropdownOptions = _ref.dropdownOptions,
|
|
692
691
|
name = _ref.name,
|
|
693
692
|
index = _ref.index,
|
|
@@ -718,7 +717,10 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
718
717
|
var defaultValue = ((_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value) || ((_actions$value$index = actions.value[index]) === null || _actions$value$index === void 0 ? void 0 : _actions$value$index.value);
|
|
719
718
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
720
719
|
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
721
|
-
var separator = (
|
|
720
|
+
var separator = getSeparator({
|
|
721
|
+
defaultSeparator: t("neetoRules.common.to"),
|
|
722
|
+
selectedField: selectedField
|
|
723
|
+
});
|
|
722
724
|
var handleClose = function handleClose() {
|
|
723
725
|
setIsActive(false);
|
|
724
726
|
setSearchTerm("");
|
|
@@ -887,12 +889,14 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
887
889
|
};
|
|
888
890
|
|
|
889
891
|
var EmailFields = function EmailFields(_ref) {
|
|
890
|
-
var _errors$actions, _touched$actions,
|
|
892
|
+
var _errors$actions, _touched$actions, _action$metadata;
|
|
891
893
|
var _ref$isEmailIdField = _ref.isEmailIdField,
|
|
892
894
|
isEmailIdField = _ref$isEmailIdField === void 0 ? false : _ref$isEmailIdField,
|
|
893
895
|
name = _ref.name,
|
|
894
896
|
action = _ref.action,
|
|
895
897
|
selectedField = _ref.selectedField,
|
|
898
|
+
_ref$separatorIndex = _ref.separatorIndex,
|
|
899
|
+
separatorIndex = _ref$separatorIndex === void 0 ? 0 : _ref$separatorIndex,
|
|
896
900
|
_ref$emails = _ref.emails,
|
|
897
901
|
emails = _ref$emails === void 0 ? [] : _ref$emails,
|
|
898
902
|
index = _ref.index;
|
|
@@ -912,7 +916,11 @@ var EmailFields = function EmailFields(_ref) {
|
|
|
912
916
|
return setShowPane(false);
|
|
913
917
|
});
|
|
914
918
|
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
915
|
-
var separator = (
|
|
919
|
+
var separator = getSeparator({
|
|
920
|
+
defaultSeparator: t("neetoRules.common.as"),
|
|
921
|
+
index: separatorIndex,
|
|
922
|
+
selectedField: selectedField
|
|
923
|
+
});
|
|
916
924
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || t("neetoRules.common.email");
|
|
917
925
|
var templates = selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates;
|
|
918
926
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
@@ -1792,12 +1800,14 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
|
|
|
1792
1800
|
};
|
|
1793
1801
|
|
|
1794
1802
|
var SmsFields = function SmsFields(_ref) {
|
|
1795
|
-
var _errors$actions, _touched$actions,
|
|
1803
|
+
var _errors$actions, _touched$actions, _action$metadata;
|
|
1796
1804
|
var name = _ref.name,
|
|
1797
1805
|
action = _ref.action,
|
|
1798
1806
|
selectedField = _ref.selectedField,
|
|
1799
1807
|
_ref$phoneNumbers = _ref.phoneNumbers,
|
|
1800
1808
|
phoneNumbers = _ref$phoneNumbers === void 0 ? [] : _ref$phoneNumbers,
|
|
1809
|
+
_ref$separatorIndex = _ref.separatorIndex,
|
|
1810
|
+
separatorIndex = _ref$separatorIndex === void 0 ? 0 : _ref$separatorIndex,
|
|
1801
1811
|
_ref$showPhoneNumberI = _ref.showPhoneNumberInput,
|
|
1802
1812
|
showPhoneNumberInput = _ref$showPhoneNumberI === void 0 ? false : _ref$showPhoneNumberI,
|
|
1803
1813
|
index = _ref.index;
|
|
@@ -1817,7 +1827,11 @@ var SmsFields = function SmsFields(_ref) {
|
|
|
1817
1827
|
return setShowPane(false);
|
|
1818
1828
|
});
|
|
1819
1829
|
var isValid = errors.actions && isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1820
|
-
var separator = (
|
|
1830
|
+
var separator = getSeparator({
|
|
1831
|
+
defaultSeparator: t("neetoRules.common.as"),
|
|
1832
|
+
index: separatorIndex,
|
|
1833
|
+
selectedField: selectedField
|
|
1834
|
+
});
|
|
1821
1835
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.smsPlaceholder) || t("neetoRules.common.sms");
|
|
1822
1836
|
var templates = selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates;
|
|
1823
1837
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
@@ -1941,7 +1955,8 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
1941
1955
|
index: index,
|
|
1942
1956
|
name: name,
|
|
1943
1957
|
selectedField: selectedField,
|
|
1944
|
-
key: name
|
|
1958
|
+
key: name,
|
|
1959
|
+
separatorIndex: 1
|
|
1945
1960
|
})]
|
|
1946
1961
|
});
|
|
1947
1962
|
}
|
|
@@ -1979,7 +1994,8 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
1979
1994
|
index: index,
|
|
1980
1995
|
name: name,
|
|
1981
1996
|
selectedField: selectedField,
|
|
1982
|
-
key: name
|
|
1997
|
+
key: name,
|
|
1998
|
+
separatorIndex: 1
|
|
1983
1999
|
})]
|
|
1984
2000
|
});
|
|
1985
2001
|
}
|
|
@@ -2209,7 +2225,16 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
2209
2225
|
if ([ACTION_TYPES.email, ACTION_TYPES.emailToIds, ACTION_TYPES.emailTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
2210
2226
|
return yup.object({
|
|
2211
2227
|
subject: !selectedAction.hideSubject ? yup.string().required(t$1("neetoRules.validations.required.subject")) : schema,
|
|
2212
|
-
emails: selectedAction.type === ACTION_TYPES.emailToIds ? yup.array().min(1, t$1("neetoRules.validations.required.emailId")).required(t$1("neetoRules.validations.required.emailId")).of(yup.string().email(t$1("neetoRules.validations.inValidEmail")))
|
|
2228
|
+
emails: selectedAction.type === ACTION_TYPES.emailToIds ? yup.array().min(1, t$1("neetoRules.validations.required.emailId")).required(t$1("neetoRules.validations.required.emailId")).of(yup.string().email(t$1("neetoRules.validations.inValidEmail"))).when("test", {
|
|
2229
|
+
is: function is() {
|
|
2230
|
+
return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
|
|
2231
|
+
},
|
|
2232
|
+
then: function then(schema) {
|
|
2233
|
+
return schema.max(selectedAction.maxLimit, t$1("neetoRules.validations.maximumEmails", {
|
|
2234
|
+
max: selectedAction.maxLimit
|
|
2235
|
+
}));
|
|
2236
|
+
}
|
|
2237
|
+
}) : schema,
|
|
2213
2238
|
body: yup.string().test("body", t$1("neetoRules.validations.required.body"), function (value) {
|
|
2214
2239
|
return !isEditorEmpty(value);
|
|
2215
2240
|
}),
|