@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
|
@@ -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:
|
|
4910
|
-
entity
|
|
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:
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
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:
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
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().
|
|
4965
|
+
value: yup__namespace.string().required(i18next.t("neetoRules.validations.required.value"))
|
|
4972
4966
|
});
|
|
4973
|
-
}
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
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().
|
|
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
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
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:
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
max
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
max
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
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.
|
|
5090
|
-
entity: i18next.t("neetoRules.labels.body")
|
|
5091
|
-
})
|
|
5108
|
+
message: i18next.t("neetoRules.validations.invalidJsonBody")
|
|
5092
5109
|
});
|
|
5093
5110
|
}
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
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
|
-
return
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
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:
|
|
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:
|
|
5286
|
-
|
|
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-
|
|
5499
|
+
//# sourceMappingURL=index-D7d7coUX.js.map
|