@bigbinary/neeto-rules-frontend 2.2.0 → 2.3.0

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 CHANGED
@@ -604,6 +604,7 @@ const initialProps = {
604
604
  type: "emailToIds",
605
605
  separator: "as",
606
606
  hideSubject: true, // Hide subject field if this prop is true
607
+ maxLimit: 5, // Adds validation to limit up to specified number of email addresses
607
608
  },
608
609
  {
609
610
  value: "send_sms",
@@ -205,7 +205,8 @@
205
205
  "errorInIntegration": "Could not connect to Slack! Please verify the integration settings or remove this action to ensure the automation rule functions correctly.<br/><br/>Go to <button>Slack Integration</button>."
206
206
  },
207
207
  "invalidPhoneNumber": "Phone number is invalid",
208
- "invalidUrlEntity": "{{entity}} must be a valid URL"
208
+ "invalidUrlEntity": "{{entity}} must be a valid URL",
209
+ "maximumEmails": "Only up to {{max}} email addresses are allowed"
209
210
  },
210
211
  "conditionVerbs": {
211
212
  "is": "Is",
@@ -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';
@@ -2209,7 +2208,16 @@ var getActionsSchema = function getActionsSchema(element, customData) {
2209
2208
  if ([ACTION_TYPES.email, ACTION_TYPES.emailToIds, ACTION_TYPES.emailTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
2210
2209
  return yup.object({
2211
2210
  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"))) : schema,
2211
+ 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", {
2212
+ is: function is() {
2213
+ return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
2214
+ },
2215
+ then: function then(schema) {
2216
+ return schema.max(selectedAction.maxLimit, t$1("neetoRules.validations.maximumEmails", {
2217
+ max: selectedAction.maxLimit
2218
+ }));
2219
+ }
2220
+ }) : schema,
2213
2221
  body: yup.string().test("body", t$1("neetoRules.validations.required.body"), function (value) {
2214
2222
  return !isEditorEmpty(value);
2215
2223
  }),