@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.
- 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 +16 -9
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +8 -4
- package/dist/cjs/v2/NeetoRulesForm.js.map +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-djZiAHat.js → index-D7d7coUX.js} +236 -220
- 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-zvsaUL1M.js → index-KEm6XVbK.js} +236 -220
- package/dist/index-KEm6XVbK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/v2/NeetoRulesBuilder.js +16 -9
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +8 -4
- package/dist/v2/NeetoRulesForm.js.map +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +13 -13
- package/types.d.ts +4 -0
- package/dist/index-HxpDd_fD.js.map +0 -1
- package/dist/index-YOuCSbmi.js.map +0 -1
- package/dist/index-djZiAHat.js.map +0 -1
- package/dist/index-zvsaUL1M.js.map +0 -1
|
@@ -5028,9 +5028,11 @@ var getSchemaForStrings = function getSchemaForStrings(element) {
|
|
|
5028
5028
|
is: function is() {
|
|
5029
5029
|
return required;
|
|
5030
5030
|
},
|
|
5031
|
-
then:
|
|
5032
|
-
entity
|
|
5033
|
-
|
|
5031
|
+
then: function then(schema) {
|
|
5032
|
+
return schema.concat(yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
|
|
5033
|
+
entity: label
|
|
5034
|
+
})));
|
|
5035
|
+
}
|
|
5034
5036
|
});
|
|
5035
5037
|
};
|
|
5036
5038
|
var getEventsSchema = function getEventsSchema(element) {
|
|
@@ -5042,11 +5044,13 @@ var getEventsSchema = function getEventsSchema(element) {
|
|
|
5042
5044
|
is: function is() {
|
|
5043
5045
|
return required;
|
|
5044
5046
|
},
|
|
5045
|
-
then:
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5047
|
+
then: function then(schema) {
|
|
5048
|
+
return schema.concat(yup__namespace.array().of(yup__namespace.object().shape({
|
|
5049
|
+
name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.entity", {
|
|
5050
|
+
entity: label
|
|
5051
|
+
}))
|
|
5052
|
+
})).min(1, i18next.t("neetoRules.validations.atLeastOneValue")));
|
|
5053
|
+
}
|
|
5050
5054
|
});
|
|
5051
5055
|
};
|
|
5052
5056
|
var getConditionsSchema = function getConditionsSchema(element) {
|
|
@@ -5058,83 +5062,85 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
5058
5062
|
is: function is() {
|
|
5059
5063
|
return required;
|
|
5060
5064
|
},
|
|
5061
|
-
then:
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
5079
|
-
});
|
|
5080
|
-
} else if ([constants.CONDITION_VALUE_TYPES.text, constants.CONDITION_VALUE_TYPES.regex].includes(type)) {
|
|
5081
|
-
return yup__namespace.object().shape({
|
|
5082
|
-
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
5083
|
-
return value === undefined || value.trim() !== "";
|
|
5084
|
-
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
5085
|
-
});
|
|
5086
|
-
} else if ([constants.CONDITION_VALUE_TYPES.multiSelect, constants.CONDITION_VALUE_TYPES.multiSelectCreate].includes(type)) {
|
|
5087
|
-
return yup__namespace.object().shape({
|
|
5088
|
-
values: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
5089
|
-
});
|
|
5090
|
-
} else if ([constants.CONDITION_VALUE_TYPES.email].includes(type)) {
|
|
5091
|
-
if (["is", "is_not"].includes(verb)) {
|
|
5065
|
+
then: function then(currentSchema) {
|
|
5066
|
+
return currentSchema.concat(yup__namespace.array().of(yup__namespace.object().shape({
|
|
5067
|
+
field: yup__namespace.string().required(i18next.t("neetoRules.validations.required.condition")),
|
|
5068
|
+
metadata: yup__namespace.mixed().when(["field", "verb"], function (field, verb, schema) {
|
|
5069
|
+
var _selectedCondition$no;
|
|
5070
|
+
var selectedCondition = neetoCist.findBy({
|
|
5071
|
+
value: field
|
|
5072
|
+
}, conditionOptions);
|
|
5073
|
+
var type = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.type;
|
|
5074
|
+
if (selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.additionalData) {
|
|
5075
|
+
var value = selectedCondition === null || selectedCondition === void 0 ? void 0 : selectedCondition.additionalData[verb];
|
|
5076
|
+
if (value) type = value;
|
|
5077
|
+
}
|
|
5078
|
+
if (selectedCondition !== null && selectedCondition !== void 0 && (_selectedCondition$no = selectedCondition.noValueForVerbs) !== null && _selectedCondition$no !== void 0 && _selectedCondition$no.includes(verb)) {
|
|
5079
|
+
return yup__namespace.object();
|
|
5080
|
+
}
|
|
5081
|
+
if ([constants.CONDITION_VALUE_TYPES.date, constants.CONDITION_VALUE_TYPES.radio, constants.CONDITION_VALUE_TYPES.dropdown, constants.CONDITION_VALUE_TYPES.select].includes(type)) {
|
|
5092
5082
|
return yup__namespace.object().shape({
|
|
5093
|
-
value: yup__namespace.string().
|
|
5083
|
+
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
5094
5084
|
});
|
|
5095
|
-
}
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5085
|
+
} else if ([constants.CONDITION_VALUE_TYPES.text, constants.CONDITION_VALUE_TYPES.regex].includes(type)) {
|
|
5086
|
+
return yup__namespace.object().shape({
|
|
5087
|
+
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
5088
|
+
return value === undefined || value.trim() !== "";
|
|
5089
|
+
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
5090
|
+
});
|
|
5091
|
+
} else if ([constants.CONDITION_VALUE_TYPES.multiSelect, constants.CONDITION_VALUE_TYPES.multiSelectCreate].includes(type)) {
|
|
5092
|
+
return yup__namespace.object().shape({
|
|
5093
|
+
values: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
5094
|
+
});
|
|
5095
|
+
} else if ([constants.CONDITION_VALUE_TYPES.email].includes(type)) {
|
|
5096
|
+
if (["is", "is_not"].includes(verb)) {
|
|
5097
|
+
return yup__namespace.object().shape({
|
|
5098
|
+
value: yup__namespace.string().email(i18next.t("neetoRules.validations.inValidEmail")).required(i18next.t("neetoRules.validations.required.email"))
|
|
5099
|
+
});
|
|
5100
|
+
}
|
|
5111
5101
|
return yup__namespace.object().shape({
|
|
5112
|
-
value: yup__namespace.string().
|
|
5102
|
+
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
5103
|
+
return value === undefined || value.trim() !== "";
|
|
5104
|
+
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
5105
|
+
});
|
|
5106
|
+
} else if ([constants.CONDITION_VALUE_TYPES.number].includes(type)) {
|
|
5107
|
+
var message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
|
|
5108
|
+
var regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
|
|
5109
|
+
return yup__namespace.object({
|
|
5110
|
+
value: yup__namespace.string().test("are-all-number", message, function (value) {
|
|
5111
|
+
return regex.test(value);
|
|
5112
|
+
})
|
|
5113
|
+
});
|
|
5114
|
+
} else if ([constants.CONDITION_VALUE_TYPES.url].includes(type)) {
|
|
5115
|
+
if (["is", "is_not"].includes(verb)) {
|
|
5116
|
+
return yup__namespace.object().shape({
|
|
5117
|
+
value: yup__namespace.string().url(i18next.t("neetoRules.validations.inValidURL")).required(i18next.t("neetoRules.validations.required.url"))
|
|
5118
|
+
});
|
|
5119
|
+
}
|
|
5120
|
+
return yup__namespace.object().shape({
|
|
5121
|
+
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
5122
|
+
return value === undefined || value.trim() !== "";
|
|
5123
|
+
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
5124
|
+
});
|
|
5125
|
+
} else if ([constants.CONDITION_VALUE_TYPES.decimal].includes(type)) {
|
|
5126
|
+
var _message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
|
|
5127
|
+
var _regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
|
|
5128
|
+
return yup__namespace.object({
|
|
5129
|
+
value: yup__namespace.string().test("are-all-number", _message, function (value) {
|
|
5130
|
+
return _regex.test(value);
|
|
5131
|
+
}).required(i18next.t("neetoRules.validations.required.decimal"))
|
|
5132
|
+
});
|
|
5133
|
+
} else if ([constants.CONDITION_VALUE_TYPES.textarea].includes(type)) {
|
|
5134
|
+
return yup__namespace.object({
|
|
5135
|
+
value: yup__namespace.string().test("text", i18next.t("neetoRules.validations.required.text"), function (value) {
|
|
5136
|
+
return !utils$2.isEditorEmpty(value);
|
|
5137
|
+
})
|
|
5113
5138
|
});
|
|
5114
5139
|
}
|
|
5115
|
-
return
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
});
|
|
5120
|
-
} else if ([constants.CONDITION_VALUE_TYPES.decimal].includes(type)) {
|
|
5121
|
-
var _message = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
|
|
5122
|
-
var _regex = selectedCondition !== null && selectedCondition !== void 0 && selectedCondition.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
|
|
5123
|
-
return yup__namespace.object({
|
|
5124
|
-
value: yup__namespace.string().test("are-all-number", _message, function (value) {
|
|
5125
|
-
return _regex.test(value);
|
|
5126
|
-
}).required(i18next.t("neetoRules.validations.required.decimal"))
|
|
5127
|
-
});
|
|
5128
|
-
} else if ([constants.CONDITION_VALUE_TYPES.textarea].includes(type)) {
|
|
5129
|
-
return yup__namespace.object({
|
|
5130
|
-
value: yup__namespace.string().test("text", i18next.t("neetoRules.validations.required.text"), function (value) {
|
|
5131
|
-
return !utils$2.isEditorEmpty(value);
|
|
5132
|
-
})
|
|
5133
|
-
});
|
|
5134
|
-
}
|
|
5135
|
-
return schema;
|
|
5136
|
-
})
|
|
5137
|
-
}))
|
|
5140
|
+
return schema;
|
|
5141
|
+
})
|
|
5142
|
+
})));
|
|
5143
|
+
}
|
|
5138
5144
|
});
|
|
5139
5145
|
};
|
|
5140
5146
|
var getActionsSchema = function getActionsSchema(element, customData) {
|
|
@@ -5146,132 +5152,134 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
5146
5152
|
is: function is() {
|
|
5147
5153
|
return required;
|
|
5148
5154
|
},
|
|
5149
|
-
then:
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
max
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
max
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5155
|
+
then: function then(currentSchema) {
|
|
5156
|
+
return currentSchema.concat(yup__namespace.array().of(yup__namespace.object().shape({
|
|
5157
|
+
name: yup__namespace.string().required(i18next.t("neetoRules.validations.required.action")),
|
|
5158
|
+
metadata: yup__namespace.mixed().when("name", function (field, schema) {
|
|
5159
|
+
var selectedAction = neetoCist.findBy({
|
|
5160
|
+
value: field
|
|
5161
|
+
}, actionOptions);
|
|
5162
|
+
if ([ACTION_TYPES.email, ACTION_TYPES.emailToIds, ACTION_TYPES.emailTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
5163
|
+
return yup__namespace.object({
|
|
5164
|
+
subject: !selectedAction.hideSubject ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.subject")) : schema,
|
|
5165
|
+
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", {
|
|
5166
|
+
is: function is() {
|
|
5167
|
+
return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
|
|
5168
|
+
},
|
|
5169
|
+
then: function then(schema) {
|
|
5170
|
+
return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumEmails", {
|
|
5171
|
+
max: selectedAction.maxLimit
|
|
5172
|
+
}));
|
|
5173
|
+
}
|
|
5174
|
+
}) : schema,
|
|
5175
|
+
body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
|
|
5176
|
+
return !utils$2.isEditorEmpty(value);
|
|
5177
|
+
}),
|
|
5178
|
+
value: selectedAction.type === ACTION_TYPES.emailTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
|
|
5179
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
5180
|
+
});
|
|
5181
|
+
} else if ([ACTION_TYPES.sms, ACTION_TYPES.smsToNumbers, ACTION_TYPES.smsTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
5182
|
+
return yup__namespace.object({
|
|
5183
|
+
phoneNumbers: selectedAction.type === ACTION_TYPES.smsToNumbers ? yup__namespace.array().required(i18next.t("neetoRules.validations.required.entity", {
|
|
5184
|
+
entity: i18next.t("neetoRules.common.phoneNumber")
|
|
5185
|
+
})).of(yup__namespace.string().test("testPhoneNumber", i18next.t("neetoRules.validations.invalidPhoneNumber"), function (value) {
|
|
5186
|
+
return PhoneNumber.isPhoneNumberValid(value);
|
|
5187
|
+
})).when("test", {
|
|
5188
|
+
is: function is() {
|
|
5189
|
+
return selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.maxLimit;
|
|
5190
|
+
},
|
|
5191
|
+
then: function then(schema) {
|
|
5192
|
+
return schema.max(selectedAction.maxLimit, i18next.t("neetoRules.validations.maximumPhoneNumbers", {
|
|
5193
|
+
max: selectedAction.maxLimit
|
|
5194
|
+
}));
|
|
5195
|
+
}
|
|
5196
|
+
}) : schema,
|
|
5197
|
+
body: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
|
|
5198
|
+
return !utils$2.isEditorEmpty(value);
|
|
5199
|
+
}),
|
|
5200
|
+
value: selectedAction.type === ACTION_TYPES.smsTo ? yup__namespace.string().required(i18next.t("neetoRules.validations.required.value")) : schema,
|
|
5201
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
5202
|
+
});
|
|
5203
|
+
} else if (ACTION_TYPES.sendToApi === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
5204
|
+
return yup__namespace.object({
|
|
5205
|
+
endpoint: yup__namespace.string().url(i18next.t("neetoRules.validations.invalidUrlEntity", {
|
|
5206
|
+
entity: i18next.t("neetoRules.labels.endpoint")
|
|
5207
|
+
})).required(i18next.t("neetoRules.validations.required.entity", {
|
|
5208
|
+
entity: i18next.t("neetoRules.labels.endpoint")
|
|
5209
|
+
})),
|
|
5210
|
+
body: yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
|
|
5211
|
+
entity: i18next.t("neetoRules.labels.body")
|
|
5212
|
+
})).test("is-valid-json-and-not-empty", function (value, context) {
|
|
5213
|
+
if (!value) return true;
|
|
5214
|
+
try {
|
|
5215
|
+
var parsedValue = JSON.parse(value);
|
|
5216
|
+
if (neetoCist.isNotPresent(parsedValue)) {
|
|
5217
|
+
return context.createError({
|
|
5218
|
+
message: i18next.t("neetoRules.validations.required.entity", {
|
|
5219
|
+
entity: i18next.t("neetoRules.labels.body")
|
|
5220
|
+
})
|
|
5221
|
+
});
|
|
5222
|
+
}
|
|
5223
|
+
return true;
|
|
5224
|
+
} catch (_unused) {
|
|
5210
5225
|
return context.createError({
|
|
5211
|
-
message: i18next.t("neetoRules.validations.
|
|
5212
|
-
entity: i18next.t("neetoRules.labels.body")
|
|
5213
|
-
})
|
|
5226
|
+
message: i18next.t("neetoRules.validations.invalidJsonBody")
|
|
5214
5227
|
});
|
|
5215
5228
|
}
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
})
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
return
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
5271
|
-
}
|
|
5272
|
-
return schema;
|
|
5273
|
-
})
|
|
5274
|
-
}))
|
|
5229
|
+
}),
|
|
5230
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
5231
|
+
});
|
|
5232
|
+
} else if (ACTION_TYPES.multiSelect === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
5233
|
+
return yup__namespace.object({
|
|
5234
|
+
value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
5235
|
+
});
|
|
5236
|
+
} else if (ACTION_TYPES.list === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
5237
|
+
return yup__namespace.object({
|
|
5238
|
+
value: yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue"))
|
|
5239
|
+
});
|
|
5240
|
+
} 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) {
|
|
5241
|
+
return yup__namespace.object({
|
|
5242
|
+
value: yup__namespace.string().test("body", i18next.t("neetoRules.validations.required.body"), function (value) {
|
|
5243
|
+
return !utils$2.isEditorEmpty(value);
|
|
5244
|
+
})
|
|
5245
|
+
});
|
|
5246
|
+
} 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) {
|
|
5247
|
+
return yup__namespace.object({
|
|
5248
|
+
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
5249
|
+
});
|
|
5250
|
+
} 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) {
|
|
5251
|
+
return yup__namespace.object({
|
|
5252
|
+
value: yup__namespace.string().trim().test("no-blank-spaces", i18next.t("neetoRules.validations.noBlankSpaces"), function (value) {
|
|
5253
|
+
return value === undefined || value.trim() !== "";
|
|
5254
|
+
}).required(i18next.t("neetoRules.validations.required.value"))
|
|
5255
|
+
});
|
|
5256
|
+
} else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.number) {
|
|
5257
|
+
var message = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveNumber") : i18next.t("neetoRules.validations.number");
|
|
5258
|
+
var regex = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_NUMBER_REGEX : NUMBER_REGEX;
|
|
5259
|
+
return yup__namespace.object({
|
|
5260
|
+
value: yup__namespace.string().test("are-all-number", message, function (value) {
|
|
5261
|
+
return regex.test(value);
|
|
5262
|
+
})
|
|
5263
|
+
});
|
|
5264
|
+
} else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.decimal) {
|
|
5265
|
+
var _message2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? i18next.t("neetoRules.validations.positiveDecimal") : i18next.t("neetoRules.validations.decimal");
|
|
5266
|
+
var _regex2 = selectedAction !== null && selectedAction !== void 0 && selectedAction.onlyPositive ? POSITIVE_DECIMAL_NUMBER_REGEX : DECIMAL_NUMBER_REGEX;
|
|
5267
|
+
return yup__namespace.object({
|
|
5268
|
+
value: yup__namespace.string().test("are-all-number", _message2, function (value) {
|
|
5269
|
+
return _regex2.test(value);
|
|
5270
|
+
}).required(i18next.t("neetoRules.validations.required.decimal"))
|
|
5271
|
+
});
|
|
5272
|
+
} else if ((selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type) === ACTION_TYPES.longText) {
|
|
5273
|
+
return yup__namespace.object({
|
|
5274
|
+
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.body"))
|
|
5275
|
+
});
|
|
5276
|
+
} else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
|
|
5277
|
+
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
5278
|
+
}
|
|
5279
|
+
return schema;
|
|
5280
|
+
})
|
|
5281
|
+
})));
|
|
5282
|
+
}
|
|
5275
5283
|
});
|
|
5276
5284
|
};
|
|
5277
5285
|
var getSchemaForArray = function getSchemaForArray(element) {
|
|
@@ -5282,7 +5290,9 @@ var getSchemaForArray = function getSchemaForArray(element) {
|
|
|
5282
5290
|
is: function is() {
|
|
5283
5291
|
return required;
|
|
5284
5292
|
},
|
|
5285
|
-
then:
|
|
5293
|
+
then: function then(schema) {
|
|
5294
|
+
return schema.concat(yup__namespace.array().min(1, i18next.t("neetoRules.validations.atLeastOneValue")).required(i18next.t("neetoRules.validations.atLeastOneValue")));
|
|
5295
|
+
}
|
|
5286
5296
|
});
|
|
5287
5297
|
};
|
|
5288
5298
|
var getSchemaForExecutionDelay = function getSchemaForExecutionDelay(_) {
|
|
@@ -5404,9 +5414,11 @@ var PANEL_TYPE_CONFIG_MAP = _defineProperty(_defineProperty(_defineProperty(_def
|
|
|
5404
5414
|
});
|
|
5405
5415
|
var TEMPLATE_NAME_VALIDATION_SCHEMA = yup__namespace.string().when("shouldSaveAsTemplate", {
|
|
5406
5416
|
is: true,
|
|
5407
|
-
then:
|
|
5408
|
-
|
|
5409
|
-
|
|
5417
|
+
then: function then(schema) {
|
|
5418
|
+
return schema.concat(yup__namespace.string().trim().required(i18next.t("neetoRules.validations.required.entity", {
|
|
5419
|
+
entity: i18next.t("neetoRules.labels.templateName")
|
|
5420
|
+
})));
|
|
5421
|
+
}
|
|
5410
5422
|
});
|
|
5411
5423
|
var POLL_RETRY_COUNT = 1000;
|
|
5412
5424
|
|
|
@@ -5594,4 +5606,4 @@ exports.getSlackChannelErrors = getSlackChannelErrors;
|
|
|
5594
5606
|
exports.getValidationSchema = getValidationSchema;
|
|
5595
5607
|
exports.getVerbOptions = getVerbOptions;
|
|
5596
5608
|
exports.usePollRuleName = usePollRuleName;
|
|
5597
|
-
//# sourceMappingURL=index-
|
|
5609
|
+
//# sourceMappingURL=index-B4lveJbi.js.map
|