@bigbinary/neeto-rules-frontend 2.9.1 → 2.9.3-beta1
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/.ready +1 -1
- package/dist/NeetoRulesBuilder.js +1 -1
- package/dist/NeetoRulesForm.js +1 -1
- package/dist/cjs/NeetoRulesBuilder.js +1 -1
- package/dist/cjs/NeetoRulesForm.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/v2/NeetoRulesBuilder.js +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +1 -1
- package/dist/cjs/v2/index.js +1 -1
- package/dist/{index-HxpDd_fD.js → index-B4lveJbi.js} +220 -208
- package/dist/index-B4lveJbi.js.map +1 -0
- package/dist/{index-fOTfZZ-u.js → index-D7d7coUX.js} +220 -208
- package/dist/index-D7d7coUX.js.map +1 -0
- package/dist/{index-YOuCSbmi.js → index-DlfJmU4e.js} +220 -208
- package/dist/index-DlfJmU4e.js.map +1 -0
- package/dist/{index-C0MlXbjP.js → index-KEm6XVbK.js} +220 -208
- package/dist/index-KEm6XVbK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/v2/NeetoRulesBuilder.js +1 -1
- package/dist/v2/NeetoRulesForm.js +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +9 -9
- package/dist/index-C0MlXbjP.js.map +0 -1
- package/dist/index-HxpDd_fD.js.map +0 -1
- package/dist/index-YOuCSbmi.js.map +0 -1
- package/dist/index-fOTfZZ-u.js.map +0 -1
|
@@ -4910,9 +4910,11 @@ var getSchemaForStrings = function getSchemaForStrings(element) {
|
|
|
4910
4910
|
is: function is() {
|
|
4911
4911
|
return required;
|
|
4912
4912
|
},
|
|
4913
|
-
then:
|
|
4914
|
-
entity
|
|
4915
|
-
|
|
4913
|
+
then: function then(schema) {
|
|
4914
|
+
return schema.concat(yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
|
|
4915
|
+
entity: label
|
|
4916
|
+
})));
|
|
4917
|
+
}
|
|
4916
4918
|
});
|
|
4917
4919
|
};
|
|
4918
4920
|
var getEventsSchema = function getEventsSchema(element) {
|
|
@@ -4924,11 +4926,13 @@ var getEventsSchema = function getEventsSchema(element) {
|
|
|
4924
4926
|
is: function is() {
|
|
4925
4927
|
return required;
|
|
4926
4928
|
},
|
|
4927
|
-
then:
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
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
|
+
}
|
|
4932
4936
|
});
|
|
4933
4937
|
};
|
|
4934
4938
|
var getConditionsSchema = function getConditionsSchema(element) {
|
|
@@ -4940,83 +4944,85 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
4940
4944
|
is: function is() {
|
|
4941
4945
|
return required;
|
|
4942
4946
|
},
|
|
4943
|
-
then:
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
4961
|
-
});
|
|
4962
|
-
} else if ([constants.CONDITION_VALUE_TYPES.text, constants.CONDITION_VALUE_TYPES.regex].includes(type)) {
|
|
4963
|
-
return yup__namespace.object().shape({
|
|
4964
|
-
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
4965
|
-
return value === undefined || value.trim() !== "";
|
|
4966
|
-
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
4967
|
-
});
|
|
4968
|
-
} else if ([constants.CONDITION_VALUE_TYPES.multiSelect, constants.CONDITION_VALUE_TYPES.multiSelectCreate].includes(type)) {
|
|
4969
|
-
return yup__namespace.object().shape({
|
|
4970
|
-
values: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
4971
|
-
});
|
|
4972
|
-
} else if ([constants.CONDITION_VALUE_TYPES.email].includes(type)) {
|
|
4973
|
-
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)) {
|
|
4974
4964
|
return yup__namespace.object().shape({
|
|
4975
|
-
value: yup__namespace.string().
|
|
4965
|
+
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
4976
4966
|
});
|
|
4977
|
-
}
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
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
|
+
}
|
|
4993
4983
|
return yup__namespace.object().shape({
|
|
4994
|
-
value: yup__namespace.string().
|
|
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
|
+
})
|
|
4995
5020
|
});
|
|
4996
5021
|
}
|
|
4997
|
-
return
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
});
|
|
5002
|
-
} else if ([constants.CONDITION_VALUE_TYPES.decimal].includes(type)) {
|
|
5003
|
-
var _message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
|
|
5004
|
-
var _regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
|
|
5005
|
-
return yup__namespace.object({
|
|
5006
|
-
value: yup__namespace.string().test("are-all-number", _message, function (value) {
|
|
5007
|
-
return _regex.test(value);
|
|
5008
|
-
}).required(i18next.t("neetoRules.validations.required.decimal"))
|
|
5009
|
-
});
|
|
5010
|
-
} else if ([constants.CONDITION_VALUE_TYPES.textarea].includes(type)) {
|
|
5011
|
-
return yup__namespace.object({
|
|
5012
|
-
value: yup__namespace.string().test("text", i18next.t("neetoRules.validations.required.text"), function (value) {
|
|
5013
|
-
return !utils$2.isEditorEmpty(value);
|
|
5014
|
-
})
|
|
5015
|
-
});
|
|
5016
|
-
}
|
|
5017
|
-
return schema;
|
|
5018
|
-
})
|
|
5019
|
-
}))
|
|
5022
|
+
return schema;
|
|
5023
|
+
})
|
|
5024
|
+
})));
|
|
5025
|
+
}
|
|
5020
5026
|
});
|
|
5021
5027
|
};
|
|
5022
5028
|
var getActionsSchema = function getActionsSchema(element, customData) {
|
|
@@ -5028,132 +5034,134 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
5028
5034
|
is: function is() {
|
|
5029
5035
|
return required;
|
|
5030
5036
|
},
|
|
5031
|
-
then:
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
max
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
max
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
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) {
|
|
5092
5107
|
return context.createError({
|
|
5093
|
-
message: i18next.t("neetoRules.validations.
|
|
5094
|
-
entity: i18next.t("neetoRules.labels.body")
|
|
5095
|
-
})
|
|
5108
|
+
message: i18next.t("neetoRules.validations.invalidJsonBody")
|
|
5096
5109
|
});
|
|
5097
5110
|
}
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
})
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
return
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
5153
|
-
}
|
|
5154
|
-
return schema;
|
|
5155
|
-
})
|
|
5156
|
-
}))
|
|
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
|
+
}
|
|
5157
5165
|
});
|
|
5158
5166
|
};
|
|
5159
5167
|
var getSchemaForArray = function getSchemaForArray(element) {
|
|
@@ -5164,7 +5172,9 @@ var getSchemaForArray = function getSchemaForArray(element) {
|
|
|
5164
5172
|
is: function is() {
|
|
5165
5173
|
return required;
|
|
5166
5174
|
},
|
|
5167
|
-
then:
|
|
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
|
+
}
|
|
5168
5178
|
});
|
|
5169
5179
|
};
|
|
5170
5180
|
var getSchemaForExecutionDelay = function getSchemaForExecutionDelay(_) {
|
|
@@ -5286,9 +5296,11 @@ var PANEL_TYPE_CONFIG_MAP = _defineProperty(_defineProperty(_defineProperty(_def
|
|
|
5286
5296
|
});
|
|
5287
5297
|
var TEMPLATE_NAME_VALIDATION_SCHEMA = yup__namespace.string().when("shouldSaveAsTemplate", {
|
|
5288
5298
|
is: true,
|
|
5289
|
-
then:
|
|
5290
|
-
|
|
5291
|
-
|
|
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
|
+
}
|
|
5292
5304
|
});
|
|
5293
5305
|
var POLL_RETRY_COUNT = 1000;
|
|
5294
5306
|
|
|
@@ -5484,4 +5496,4 @@ exports.setEditorContent = setEditorContent;
|
|
|
5484
5496
|
exports.useHasFieldChanged = useHasFieldChanged;
|
|
5485
5497
|
exports.usePollRuleName = usePollRuleName;
|
|
5486
5498
|
exports.useResetSaveAsTemplateOnHide = useResetSaveAsTemplateOnHide;
|
|
5487
|
-
//# sourceMappingURL=index-
|
|
5499
|
+
//# sourceMappingURL=index-D7d7coUX.js.map
|