Skip to content

Commit

Permalink
fix: export MP Validation fields too (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyEPhipps authored Jul 18, 2024
1 parent caad510 commit f375111
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const buildValidationSchema = overrideOptions => {

const phoneRegex = /^(((((\+44)|(0044))\s?\d{4}|\(?0\d{4}\)?)\s?\d{3}\s?\d{3})|((((\+44)|(0044))\s?\d{3}|\(?0\d{3}\)?)\s?\d{3}\s?\d{4})|((((\+44)|(0044))\s?\d{2}|\(?0\d{2}\)?)\s?\d{4}\s?\d{4}))(\s?\\#(\d{4}|\d{3}))?$/;

const mpValidationSchema = yup.object({
const mpValidationFields = {
mp_email: yup.string()
.when('mp_permissionEmail', {
is: val => (!(mpValidationOptions.mp_permissionEmail.disableOption)
Expand Down Expand Up @@ -125,11 +125,15 @@ const buildValidationSchema = overrideOptions => {

mp_address3: yup.string()
.max(50, 'Please enter a maximum of 50 characters')
});
};

const mpValidationSchema = yup.object(mpValidationFields);

return {
mpValidationSchema,
mpValidationOptions
mpValidationOptions,
// Return the raw fields object too, to make for easier schema-combining:
mpValidationFields
};
};

Expand Down

0 comments on commit f375111

Please sign in to comment.