@bigbinary/neeto-rules-frontend 2.9.0 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -781,7 +781,8 @@ var CustomHeaders = function CustomHeaders(_ref) {
781
781
  var name = _ref.name,
782
782
  onFocus = _ref.onFocus,
783
783
  _ref$helpPopoverProps = _ref.helpPopoverProps,
784
- helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps;
784
+ helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps,
785
+ dataTestid = _ref.dataTestid;
785
786
  var _useFormikContext = formik.useFormikContext(),
786
787
  values = _useFormikContext.values,
787
788
  setFieldValue = _useFormikContext.setFieldValue;
@@ -801,8 +802,8 @@ var CustomHeaders = function CustomHeaders(_ref) {
801
802
  children: [/*#__PURE__*/jsxRuntime.jsx(formik$1.Switch, _objectSpread$g({
802
803
  label: label,
803
804
  onFocus: onFocus,
804
- "data-testid": "neeto-rules-api-fields-".concat(neetoCist.hyphenate(label), "-switch"),
805
805
  name: switchName,
806
+ "data-testid": dataTestid || "neeto-rules-api-fields-".concat(neetoCist.hyphenate(label), "-switch"),
806
807
  onCheckedChange: handleCheckedChange
807
808
  }, withHelpPopover(helpPopoverProps))), isCustomHeadersEnabled && /*#__PURE__*/jsxRuntime.jsx(KeyValuePairsField, {
808
809
  onFocus: onFocus,
@@ -1160,6 +1161,7 @@ var ApiFields = function ApiFields(_ref2) {
1160
1161
  onFocus: setFieldActive
1161
1162
  }), /*#__PURE__*/jsxRuntime.jsx(CustomHeaders, {
1162
1163
  name: name,
1164
+ dataTestid: "neeto-rules-api-fields-include-headers-switch",
1163
1165
  helpPopoverProps: customHeadersHelpPopoverProps,
1164
1166
  onFocus: setFieldActive
1165
1167
  }), /*#__PURE__*/jsxRuntime.jsx(JsonEditor, {
@@ -1202,13 +1204,13 @@ var Target$i = function Target(_ref) {
1202
1204
  variant: "body1",
1203
1205
  children: separator
1204
1206
  }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
1205
- "data-testid": "custom-action-button-".concat(neetoCist.hyphenate(defaultLabel)),
1206
1207
  label: defaultLabel.toLowerCase(),
1207
1208
  variant: "link",
1208
1209
  className: classNames("text-base text-foreground font-semibold underline", {
1209
1210
  "text-primary": isFieldActive,
1210
1211
  "text-destructive": isFieldInvalid && !isFieldActive
1211
1212
  }),
1213
+ "data-testid": (selectedField === null || selectedField === void 0 ? void 0 : selectedField.dataTestid) || "custom-action-button-".concat(neetoCist.hyphenate(defaultLabel)),
1212
1214
  onClick: handleOnClick
1213
1215
  })]
1214
1216
  });
@@ -2148,10 +2150,10 @@ var MultiSelectCheckbox$1 = function MultiSelectCheckbox(_ref2) {
2148
2150
  return /*#__PURE__*/react.createElement(neetoAtoms.Checkbox, {
2149
2151
  ref: ref,
2150
2152
  checked: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value),
2151
- "data-testid": "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
2152
2153
  id: option.value,
2153
2154
  key: option.value,
2154
2155
  label: option.label,
2156
+ "data-testid": option.dataTestid || "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
2155
2157
  onChange: function onChange() {
2156
2158
  return handleSelectOption(option.value);
2157
2159
  },
@@ -2462,7 +2464,7 @@ var CUSTOM_COMPONENTS = {
2462
2464
  ClearIndicator: ClearIndicator
2463
2465
  };
2464
2466
 
2465
- var _excluded$3 = ["value", "onChange", "error", "onBlur", "onFocus"];
2467
+ var _excluded$3 = ["value", "onChange", "error", "onBlur", "onFocus", "dataTestid"];
2466
2468
  function ownKeys$8(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; }
2467
2469
  function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2468
2470
  var MultiPhoneNumberInput = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
@@ -2476,6 +2478,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
2476
2478
  onBlur = _ref$onBlur === void 0 ? neetoCist.noop : _ref$onBlur,
2477
2479
  _ref$onFocus = _ref.onFocus,
2478
2480
  _onFocus = _ref$onFocus === void 0 ? neetoCist.noop : _ref$onFocus,
2481
+ dataTestid = _ref.dataTestid,
2479
2482
  otherProps = _objectWithoutProperties(_ref, _excluded$3);
2480
2483
  var _useTranslation = reactI18next.useTranslation(),
2481
2484
  t = _useTranslation.t;
@@ -2522,7 +2525,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
2522
2525
  children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Label, {
2523
2526
  required: true,
2524
2527
  className: "neeto-ui-email-input__label",
2525
- "data-testid": "".concat(dasherize(label), "-input-label"),
2528
+ "data-testid": "".concat(dataTestid || dasherize(label), "-input-label"),
2526
2529
  children: label
2527
2530
  })
2528
2531
  }), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$8({
@@ -2558,7 +2561,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
2558
2561
  value: value
2559
2562
  }, otherProps))), !!error && /*#__PURE__*/jsxRuntime.jsxs("p", {
2560
2563
  className: "text-destructive text-xs",
2561
- "data-testid": "".concat(dasherize(label), "-input-error"),
2564
+ "data-testid": "".concat(dataTestid || dasherize(label), "-input-error"),
2562
2565
  children: [formatErrorMessage(error), isFilterPhoneNumbersLinkVisible && /*#__PURE__*/jsxRuntime.jsxs("span", {
2563
2566
  className: "font-semibold cursor-pointer",
2564
2567
  onClick: handleFilterPhoneNumbers,
@@ -2566,7 +2569,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/react.forwardRef(function (_ref, ref) {
2566
2569
  })]
2567
2570
  }), /*#__PURE__*/jsxRuntime.jsx("p", {
2568
2571
  className: "text-muted-foreground text-xs",
2569
- "data-testid": "".concat(dasherize(label), "-input-help"),
2572
+ "data-testid": "".concat(dataTestid || dasherize(label), "-input-help"),
2570
2573
  children: t("neetoRules.helpTexts.phoneNumber")
2571
2574
  })]
2572
2575
  });
@@ -2594,6 +2597,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
2594
2597
  children: /*#__PURE__*/jsxRuntime.jsx(MultiPhoneNumberInput, {
2595
2598
  name: name,
2596
2599
  onFocus: onFocus,
2600
+ dataTestid: "phone-numbers",
2597
2601
  error: meta.touched ? meta.error : "",
2598
2602
  label: t("neetoRules.common.phoneNumbers"),
2599
2603
  placeholder: t("neetoRules.placeholders.phoneNumberField"),
@@ -3605,10 +3609,10 @@ var MultiSelectCheckbox = function MultiSelectCheckbox(_ref2) {
3605
3609
  return /*#__PURE__*/react.createElement(neetoAtoms.Checkbox, _objectSpread$5({
3606
3610
  ref: ref,
3607
3611
  checked: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value),
3608
- "data-testid": "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
3609
3612
  id: option.value,
3610
3613
  key: option.value,
3611
3614
  label: option.label,
3615
+ "data-testid": option.dataTestid || "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
3612
3616
  onChange: function onChange() {
3613
3617
  return handleMultiSelectOption(option.value);
3614
3618
  },
@@ -4732,10 +4736,10 @@ var EventsPanel = function EventsPanel() {
4732
4736
  ref: ref,
4733
4737
  onFocus: setFieldActive
4734
4738
  } : {}), {}, {
4735
- "data-testid": "".concat(utils.joinHyphenCase(option.label), "-radio"),
4736
4739
  key: option.value,
4737
4740
  label: option.label,
4738
- value: option.value
4741
+ value: option.value,
4742
+ "data-testid": option.dataTestid || "".concat(utils.joinHyphenCase(option.label), "-radio")
4739
4743
  }));
4740
4744
  })
4741
4745
  }) : searchedOptions.map(function (option, index) {
@@ -4743,10 +4747,10 @@ var EventsPanel = function EventsPanel() {
4743
4747
  ref: ref
4744
4748
  } : {}), {}, {
4745
4749
  checked: eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(option.value),
4746
- "data-testid": "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
4747
4750
  id: option.value,
4748
4751
  key: option.value,
4749
4752
  label: option.label,
4753
+ "data-testid": option.dataTestid || "".concat(utils.joinHyphenCase(option.label), "-checkbox"),
4750
4754
  onCheckedChange: function onCheckedChange() {
4751
4755
  return handleMultiSelectOption(option);
4752
4756
  },
@@ -4906,9 +4910,11 @@ var getSchemaForStrings = function getSchemaForStrings(element) {
4906
4910
  is: function is() {
4907
4911
  return required;
4908
4912
  },
4909
- then: yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
4910
- entity: label
4911
- }))
4913
+ then: function then(schema) {
4914
+ return schema.concat(yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
4915
+ entity: label
4916
+ })));
4917
+ }
4912
4918
  });
4913
4919
  };
4914
4920
  var getEventsSchema = function getEventsSchema(element) {
@@ -4920,11 +4926,13 @@ var getEventsSchema = function getEventsSchema(element) {
4920
4926
  is: function is() {
4921
4927
  return required;
4922
4928
  },
4923
- then: yup__namespace.array().of(yup__namespace.object().shape({
4924
- name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
4925
- entity: label
4926
- }))
4927
- })).min(1, i18next.t("neetoRules.validations.atLeastOneValue"))
4929
+ then: function then(schema) {
4930
+ return schema.concat(yup__namespace.array().of(yup__namespace.object().shape({
4931
+ name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
4932
+ entity: label
4933
+ }))
4934
+ })).min(1, i18next.t("neetoRules.validations.atLeastOneValue")));
4935
+ }
4928
4936
  });
4929
4937
  };
4930
4938
  var getConditionsSchema = function getConditionsSchema(element) {
@@ -4936,83 +4944,85 @@ var getConditionsSchema = function getConditionsSchema(element) {
4936
4944
  is: function is() {
4937
4945
  return required;
4938
4946
  },
4939
- then: yup__namespace.array().of(yup__namespace.object().shape({
4940
- field: yup__namespace.string().required(i18next.t("neetoRules.validations.required.condition")),
4941
- metadata: yup__namespace.mixed().when(["field", "verb"], function (field, verb, schema) {
4942
- var _selectedCondition$no;
4943
- var selectedCondition = neetoCist.findBy({
4944
- value: field
4945
- }, conditionOptions);
4946
- var type = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.type;
4947
- if (selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.additionalData) {
4948
- var value = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.additionalData[verb];
4949
- if (value) type = value;
4950
- }
4951
- if (selectedCondition !== null && selectedCondition !== void 0 && (_selectedCondition$no = selectedCondition.noValueForVerbs) !== null && _selectedCondition$no !== void 0 && _selectedCondition$no.includes(verb)) {
4952
- return yup__namespace.object();
4953
- }
4954
- if ([constants.CONDITION_VALUE_TYPES.date, constants.CONDITION_VALUE_TYPES.radio, constants.CONDITION_VALUE_TYPES.dropdown, constants.CONDITION_VALUE_TYPES.select].includes(type)) {
4955
- return yup__namespace.object().shape({
4956
- value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
4957
- });
4958
- } else if ([constants.CONDITION_VALUE_TYPES.text, constants.CONDITION_VALUE_TYPES.regex].includes(type)) {
4959
- return yup__namespace.object().shape({
4960
- value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
4961
- return value === undefined || value.trim() !== "";
4962
- }).required(i18next.t("neetoRules.validations.required.value"))
4963
- });
4964
- } else if ([constants.CONDITION_VALUE_TYPES.multiSelect, constants.CONDITION_VALUE_TYPES.multiSelectCreate].includes(type)) {
4965
- return yup__namespace.object().shape({
4966
- values: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
4967
- });
4968
- } else if ([constants.CONDITION_VALUE_TYPES.email].includes(type)) {
4969
- if (["is", "is_not"].includes(verb)) {
4947
+ then: function then(currentSchema) {
4948
+ return currentSchema.concat(yup__namespace.array().of(yup__namespace.object().shape({
4949
+ field: yup__namespace.string().required(i18next.t("neetoRules.validations.required.condition")),
4950
+ metadata: yup__namespace.mixed().when(["field", "verb"], function (field, verb, schema) {
4951
+ var _selectedCondition$no;
4952
+ var selectedCondition = neetoCist.findBy({
4953
+ value: field
4954
+ }, conditionOptions);
4955
+ var type = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.type;
4956
+ if (selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.additionalData) {
4957
+ var value = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.additionalData[verb];
4958
+ if (value) type = value;
4959
+ }
4960
+ if (selectedCondition !== null && selectedCondition !== void 0 && (_selectedCondition$no = selectedCondition.noValueForVerbs) !== null && _selectedCondition$no !== void 0 && _selectedCondition$no.includes(verb)) {
4961
+ return yup__namespace.object();
4962
+ }
4963
+ if ([constants.CONDITION_VALUE_TYPES.date, constants.CONDITION_VALUE_TYPES.radio, constants.CONDITION_VALUE_TYPES.dropdown, constants.CONDITION_VALUE_TYPES.select].includes(type)) {
4970
4964
  return yup__namespace.object().shape({
4971
- value: yup__namespace.string().email(i18next.t("neetoRules.validations.inValidEmail")).required(i18next.t("neetoRules.validations.required.email"))
4965
+ value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
4972
4966
  });
4973
- }
4974
- return yup__namespace.object().shape({
4975
- value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
4976
- return value === undefined || value.trim() !== "";
4977
- }).required(i18next.t("neetoRules.validations.required.value"))
4978
- });
4979
- } else if ([constants.CONDITION_VALUE_TYPES.number].includes(type)) {
4980
- var message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
4981
- var regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
4982
- return yup__namespace.object({
4983
- value: yup__namespace.string().test("are-all-number", message, function (value) {
4984
- return regex.test(value);
4985
- })
4986
- });
4987
- } else if ([constants.CONDITION_VALUE_TYPES.url].includes(type)) {
4988
- if (["is", "is_not"].includes(verb)) {
4967
+ } else if ([constants.CONDITION_VALUE_TYPES.text, constants.CONDITION_VALUE_TYPES.regex].includes(type)) {
4968
+ return yup__namespace.object().shape({
4969
+ value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
4970
+ return value === undefined || value.trim() !== "";
4971
+ }).required(i18next.t("neetoRules.validations.required.value"))
4972
+ });
4973
+ } else if ([constants.CONDITION_VALUE_TYPES.multiSelect, constants.CONDITION_VALUE_TYPES.multiSelectCreate].includes(type)) {
4974
+ return yup__namespace.object().shape({
4975
+ values: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
4976
+ });
4977
+ } else if ([constants.CONDITION_VALUE_TYPES.email].includes(type)) {
4978
+ if (["is", "is_not"].includes(verb)) {
4979
+ return yup__namespace.object().shape({
4980
+ value: yup__namespace.string().email(i18next.t("neetoRules.validations.inValidEmail")).required(i18next.t("neetoRules.validations.required.email"))
4981
+ });
4982
+ }
4989
4983
  return yup__namespace.object().shape({
4990
- value: yup__namespace.string().url(i18next.t("neetoRules.validations.inValidURL")).required(i18next.t("neetoRules.validations.required.url"))
4984
+ value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
4985
+ return value === undefined || value.trim() !== "";
4986
+ }).required(i18next.t("neetoRules.validations.required.value"))
4987
+ });
4988
+ } else if ([constants.CONDITION_VALUE_TYPES.number].includes(type)) {
4989
+ var message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
4990
+ var regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
4991
+ return yup__namespace.object({
4992
+ value: yup__namespace.string().test("are-all-number", message, function (value) {
4993
+ return regex.test(value);
4994
+ })
4995
+ });
4996
+ } else if ([constants.CONDITION_VALUE_TYPES.url].includes(type)) {
4997
+ if (["is", "is_not"].includes(verb)) {
4998
+ return yup__namespace.object().shape({
4999
+ value: yup__namespace.string().url(i18next.t("neetoRules.validations.inValidURL")).required(i18next.t("neetoRules.validations.required.url"))
5000
+ });
5001
+ }
5002
+ return yup__namespace.object().shape({
5003
+ value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
5004
+ return value === undefined || value.trim() !== "";
5005
+ }).required(i18next.t("neetoRules.validations.required.value"))
5006
+ });
5007
+ } else if ([constants.CONDITION_VALUE_TYPES.decimal].includes(type)) {
5008
+ var _message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
5009
+ var _regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
5010
+ return yup__namespace.object({
5011
+ value: yup__namespace.string().test("are-all-number", _message, function (value) {
5012
+ return _regex.test(value);
5013
+ }).required(i18next.t("neetoRules.validations.required.decimal"))
5014
+ });
5015
+ } else if ([constants.CONDITION_VALUE_TYPES.textarea].includes(type)) {
5016
+ return yup__namespace.object({
5017
+ value: yup__namespace.string().test("text", i18next.t("neetoRules.validations.required.text"), function (value) {
5018
+ return !utils$2.isEditorEmpty(value);
5019
+ })
4991
5020
  });
4992
5021
  }
4993
- return yup__namespace.object().shape({
4994
- value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
4995
- return value === undefined || value.trim() !== "";
4996
- }).required(i18next.t("neetoRules.validations.required.value"))
4997
- });
4998
- } else if ([constants.CONDITION_VALUE_TYPES.decimal].includes(type)) {
4999
- var _message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
5000
- var _regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
5001
- return yup__namespace.object({
5002
- value: yup__namespace.string().test("are-all-number", _message, function (value) {
5003
- return _regex.test(value);
5004
- }).required(i18next.t("neetoRules.validations.required.decimal"))
5005
- });
5006
- } else if ([constants.CONDITION_VALUE_TYPES.textarea].includes(type)) {
5007
- return yup__namespace.object({
5008
- value: yup__namespace.string().test("text", i18next.t("neetoRules.validations.required.text"), function (value) {
5009
- return !utils$2.isEditorEmpty(value);
5010
- })
5011
- });
5012
- }
5013
- return schema;
5014
- })
5015
- }))
5022
+ return schema;
5023
+ })
5024
+ })));
5025
+ }
5016
5026
  });
5017
5027
  };
5018
5028
  var getActionsSchema = function getActionsSchema(element, customData) {
@@ -5024,132 +5034,134 @@ var getActionsSchema = function getActionsSchema(element, customData) {
5024
5034
  is: function is() {
5025
5035
  return required;
5026
5036
  },
5027
- then: yup__namespace.array().of(yup__namespace.object().shape({
5028
- name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.action")),
5029
- metadata: yup__namespace.mixed().when("name", function (field, schema) {
5030
- var selectedAction = neetoCist.findBy({
5031
- value: field
5032
- }, actionOptions);
5033
- if ([ACTION_TYPES.email, ACTION_TYPES.emailToIds, ACTION_TYPES.emailTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5034
- return yup__namespace.object({
5035
- subject: !selectedAction.hideSubject ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.subject")) : schema,
5036
- emails: selectedAction.type === ACTION_TYPES.emailToIds ? yup__namespace.array().min(1, i18next.t("neetoRules.validations.required.emailId")).required(i18next.t("neetoRules.validations.required.emailId")).of(yup__namespace.string().email(i18next.t("neetoRules.validations.inValidEmail"))).when("test", {
5037
- is: function is() {
5038
- return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
5039
- },
5040
- then: function then(schema) {
5041
- return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumEmails", {
5042
- max: selectedAction.maxLimit
5043
- }));
5044
- }
5045
- }) : schema,
5046
- body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5047
- return !utils$2.isEditorEmpty(value);
5048
- }),
5049
- value: selectedAction.type === ACTION_TYPES.emailTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
5050
- templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5051
- });
5052
- } else if ([ACTION_TYPES.sms, ACTION_TYPES.smsToNumbers, ACTION_TYPES.smsTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5053
- return yup__namespace.object({
5054
- phoneNumbers: selectedAction.type === ACTION_TYPES.smsToNumbers ? yup__namespace.array().required(i18next.t("neetoRules.validations.required.entity", {
5055
- entity: i18next.t("neetoRules.common.phoneNumber")
5056
- })).of(yup__namespace.string().test("testPhoneNumber", i18next.t("neetoRules.validations.invalidPhoneNumber"), function (value) {
5057
- return PhoneNumber.isPhoneNumberValid(value);
5058
- })).when("test", {
5059
- is: function is() {
5060
- return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
5061
- },
5062
- then: function then(schema) {
5063
- return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumPhoneNumbers", {
5064
- max: selectedAction.maxLimit
5065
- }));
5066
- }
5067
- }) : schema,
5068
- body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5069
- return !utils$2.isEditorEmpty(value);
5070
- }),
5071
- value: selectedAction.type === ACTION_TYPES.smsTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
5072
- templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5073
- });
5074
- } else if (ACTION_TYPES.sendToApi === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5075
- return yup__namespace.object({
5076
- endpoint: yup__namespace.string().url(i18next.t("neetoRules.validations.invalidUrlEntity", {
5077
- entity: i18next.t("neetoRules.labels.endpoint")
5078
- })).required(i18next.t("neetoRules.validations.required.entity", {
5079
- entity: i18next.t("neetoRules.labels.endpoint")
5080
- })),
5081
- body: yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
5082
- entity: i18next.t("neetoRules.labels.body")
5083
- })).test("is-valid-json-and-not-empty", function (value, context) {
5084
- if (!value) return true;
5085
- try {
5086
- var parsedValue = JSON.parse(value);
5087
- if (neetoCist.isNotPresent(parsedValue)) {
5037
+ then: function then(currentSchema) {
5038
+ return currentSchema.concat(yup__namespace.array().of(yup__namespace.object().shape({
5039
+ name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.action")),
5040
+ metadata: yup__namespace.mixed().when("name", function (field, schema) {
5041
+ var selectedAction = neetoCist.findBy({
5042
+ value: field
5043
+ }, actionOptions);
5044
+ if ([ACTION_TYPES.email, ACTION_TYPES.emailToIds, ACTION_TYPES.emailTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5045
+ return yup__namespace.object({
5046
+ subject: !selectedAction.hideSubject ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.subject")) : schema,
5047
+ emails: selectedAction.type === ACTION_TYPES.emailToIds ? yup__namespace.array().min(1, i18next.t("neetoRules.validations.required.emailId")).required(i18next.t("neetoRules.validations.required.emailId")).of(yup__namespace.string().email(i18next.t("neetoRules.validations.inValidEmail"))).when("test", {
5048
+ is: function is() {
5049
+ return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
5050
+ },
5051
+ then: function then(schema) {
5052
+ return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumEmails", {
5053
+ max: selectedAction.maxLimit
5054
+ }));
5055
+ }
5056
+ }) : schema,
5057
+ body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5058
+ return !utils$2.isEditorEmpty(value);
5059
+ }),
5060
+ value: selectedAction.type === ACTION_TYPES.emailTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
5061
+ templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5062
+ });
5063
+ } else if ([ACTION_TYPES.sms, ACTION_TYPES.smsToNumbers, ACTION_TYPES.smsTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5064
+ return yup__namespace.object({
5065
+ phoneNumbers: selectedAction.type === ACTION_TYPES.smsToNumbers ? yup__namespace.array().required(i18next.t("neetoRules.validations.required.entity", {
5066
+ entity: i18next.t("neetoRules.common.phoneNumber")
5067
+ })).of(yup__namespace.string().test("testPhoneNumber", i18next.t("neetoRules.validations.invalidPhoneNumber"), function (value) {
5068
+ return PhoneNumber.isPhoneNumberValid(value);
5069
+ })).when("test", {
5070
+ is: function is() {
5071
+ return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
5072
+ },
5073
+ then: function then(schema) {
5074
+ return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumPhoneNumbers", {
5075
+ max: selectedAction.maxLimit
5076
+ }));
5077
+ }
5078
+ }) : schema,
5079
+ body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5080
+ return !utils$2.isEditorEmpty(value);
5081
+ }),
5082
+ value: selectedAction.type === ACTION_TYPES.smsTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
5083
+ templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5084
+ });
5085
+ } else if (ACTION_TYPES.sendToApi === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5086
+ return yup__namespace.object({
5087
+ endpoint: yup__namespace.string().url(i18next.t("neetoRules.validations.invalidUrlEntity", {
5088
+ entity: i18next.t("neetoRules.labels.endpoint")
5089
+ })).required(i18next.t("neetoRules.validations.required.entity", {
5090
+ entity: i18next.t("neetoRules.labels.endpoint")
5091
+ })),
5092
+ body: yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
5093
+ entity: i18next.t("neetoRules.labels.body")
5094
+ })).test("is-valid-json-and-not-empty", function (value, context) {
5095
+ if (!value) return true;
5096
+ try {
5097
+ var parsedValue = JSON.parse(value);
5098
+ if (neetoCist.isNotPresent(parsedValue)) {
5099
+ return context.createError({
5100
+ message: i18next.t("neetoRules.validations.required.entity", {
5101
+ entity: i18next.t("neetoRules.labels.body")
5102
+ })
5103
+ });
5104
+ }
5105
+ return true;
5106
+ } catch (_unused) {
5088
5107
  return context.createError({
5089
- message: i18next.t("neetoRules.validations.required.entity", {
5090
- entity: i18next.t("neetoRules.labels.body")
5091
- })
5108
+ message: i18next.t("neetoRules.validations.invalidJsonBody")
5092
5109
  });
5093
5110
  }
5094
- return true;
5095
- } catch (_unused) {
5096
- return context.createError({
5097
- message: i18next.t("neetoRules.validations.invalidJsonBody")
5098
- });
5099
- }
5100
- }),
5101
- templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5102
- });
5103
- } else if (ACTION_TYPES.multiSelect === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5104
- return yup__namespace.object({
5105
- value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
5106
- });
5107
- } else if (ACTION_TYPES.list === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5108
- return yup__namespace.object({
5109
- value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
5110
- });
5111
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.note || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.textarea) {
5112
- return yup__namespace.object({
5113
- value: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5114
- return !utils$2.isEditorEmpty(value);
5115
- })
5116
- });
5117
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.dropdown || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.date) {
5118
- return yup__namespace.object({
5119
- value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
5120
- });
5121
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.text || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.regex) {
5122
- return yup__namespace.object({
5123
- value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
5124
- return value === undefined || value.trim() !== "";
5125
- }).required(i18next.t("neetoRules.validations.required.value"))
5126
- });
5127
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.number) {
5128
- var message = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
5129
- var regex = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
5130
- return yup__namespace.object({
5131
- value: yup__namespace.string().test("are-all-number", message, function (value) {
5132
- return regex.test(value);
5133
- })
5134
- });
5135
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.decimal) {
5136
- var _message2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
5137
- var _regex2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
5138
- return yup__namespace.object({
5139
- value: yup__namespace.string().test("are-all-number", _message2, function (value) {
5140
- return _regex2.test(value);
5141
- }).required(i18next.t("neetoRules.validations.required.decimal"))
5142
- });
5143
- } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.longText) {
5144
- return yup__namespace.object({
5145
- value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.body"))
5146
- });
5147
- } else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
5148
- return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
5149
- }
5150
- return schema;
5151
- })
5152
- }))
5111
+ }),
5112
+ templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
5113
+ });
5114
+ } else if (ACTION_TYPES.multiSelect === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5115
+ return yup__namespace.object({
5116
+ value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
5117
+ });
5118
+ } else if (ACTION_TYPES.list === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
5119
+ return yup__namespace.object({
5120
+ value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
5121
+ });
5122
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.note || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.textarea) {
5123
+ return yup__namespace.object({
5124
+ value: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
5125
+ return !utils$2.isEditorEmpty(value);
5126
+ })
5127
+ });
5128
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.dropdown || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.date) {
5129
+ return yup__namespace.object({
5130
+ value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
5131
+ });
5132
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.text || (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.regex) {
5133
+ return yup__namespace.object({
5134
+ value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
5135
+ return value === undefined || value.trim() !== "";
5136
+ }).required(i18next.t("neetoRules.validations.required.value"))
5137
+ });
5138
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.number) {
5139
+ var message = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
5140
+ var regex = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
5141
+ return yup__namespace.object({
5142
+ value: yup__namespace.string().test("are-all-number", message, function (value) {
5143
+ return regex.test(value);
5144
+ })
5145
+ });
5146
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.decimal) {
5147
+ var _message2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
5148
+ var _regex2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
5149
+ return yup__namespace.object({
5150
+ value: yup__namespace.string().test("are-all-number", _message2, function (value) {
5151
+ return _regex2.test(value);
5152
+ }).required(i18next.t("neetoRules.validations.required.decimal"))
5153
+ });
5154
+ } else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.longText) {
5155
+ return yup__namespace.object({
5156
+ value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.body"))
5157
+ });
5158
+ } else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
5159
+ return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
5160
+ }
5161
+ return schema;
5162
+ })
5163
+ })));
5164
+ }
5153
5165
  });
5154
5166
  };
5155
5167
  var getSchemaForArray = function getSchemaForArray(element) {
@@ -5160,7 +5172,9 @@ var getSchemaForArray = function getSchemaForArray(element) {
5160
5172
  is: function is() {
5161
5173
  return required;
5162
5174
  },
5163
- then: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
5175
+ then: function then(schema) {
5176
+ return schema.concat(yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue")));
5177
+ }
5164
5178
  });
5165
5179
  };
5166
5180
  var getSchemaForExecutionDelay = function getSchemaForExecutionDelay(_) {
@@ -5282,9 +5296,11 @@ var PANEL_TYPE_CONFIG_MAP = _defineProperty(_defineProperty(_defineProperty(_def
5282
5296
  });
5283
5297
  var TEMPLATE_NAME_VALIDATION_SCHEMA = yup__namespace.string().when("shouldSaveAsTemplate", {
5284
5298
  is: true,
5285
- then: yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
5286
- entity: i18next.t("neetoRules.labels.templateName")
5287
- }))
5299
+ then: function then(schema) {
5300
+ return schema.concat(yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
5301
+ entity: i18next.t("neetoRules.labels.templateName")
5302
+ })));
5303
+ }
5288
5304
  });
5289
5305
  var POLL_RETRY_COUNT = 1000;
5290
5306
 
@@ -5480,4 +5496,4 @@ exports.setEditorContent = setEditorContent;
5480
5496
  exports.useHasFieldChanged = useHasFieldChanged;
5481
5497
  exports.usePollRuleName = usePollRuleName;
5482
5498
  exports.useResetSaveAsTemplateOnHide = useResetSaveAsTemplateOnHide;
5483
- //# sourceMappingURL=index-djZiAHat.js.map
5499
+ //# sourceMappingURL=index-D7d7coUX.js.map