@comicrelief/component-library 7.48.4 → 7.48.5
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.
|
@@ -66,7 +66,7 @@ const buildValidationSchema = overrideOptions => {
|
|
|
66
66
|
// Override with any custom options supplied
|
|
67
67
|
const mpValidationOptions = (0, _merge2.default)(defaultOptions, overrideOptions);
|
|
68
68
|
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}))?$/;
|
|
69
|
-
const
|
|
69
|
+
const mpValidationFields = {
|
|
70
70
|
mp_email: yup.string().when('mp_permissionEmail', {
|
|
71
71
|
is: val => !mpValidationOptions.mp_permissionEmail.disableOption && mpValidationOptions.mp_permissionEmail[val],
|
|
72
72
|
then: yup.string().required('Please enter your email address').email('Please enter a valid email address')
|
|
@@ -98,10 +98,13 @@ const buildValidationSchema = overrideOptions => {
|
|
|
98
98
|
/* Non-required fields */
|
|
99
99
|
mp_address2: yup.string().max(50, 'Please enter a maximum of 50 characters'),
|
|
100
100
|
mp_address3: yup.string().max(50, 'Please enter a maximum of 50 characters')
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
|
+
const mpValidationSchema = yup.object(mpValidationFields);
|
|
102
103
|
return {
|
|
103
104
|
mpValidationSchema,
|
|
104
|
-
mpValidationOptions
|
|
105
|
+
mpValidationOptions,
|
|
106
|
+
// Return the raw fields object too, to make for easier schema-combining:
|
|
107
|
+
mpValidationFields
|
|
105
108
|
};
|
|
106
109
|
};
|
|
107
110
|
exports.buildValidationSchema = buildValidationSchema;
|
package/package.json
CHANGED
|
@@ -63,7 +63,7 @@ const buildValidationSchema = overrideOptions => {
|
|
|
63
63
|
|
|
64
64
|
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}))?$/;
|
|
65
65
|
|
|
66
|
-
const
|
|
66
|
+
const mpValidationFields = {
|
|
67
67
|
mp_email: yup.string()
|
|
68
68
|
.when('mp_permissionEmail', {
|
|
69
69
|
is: val => (!(mpValidationOptions.mp_permissionEmail.disableOption)
|
|
@@ -125,11 +125,15 @@ const buildValidationSchema = overrideOptions => {
|
|
|
125
125
|
|
|
126
126
|
mp_address3: yup.string()
|
|
127
127
|
.max(50, 'Please enter a maximum of 50 characters')
|
|
128
|
-
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const mpValidationSchema = yup.object(mpValidationFields);
|
|
129
131
|
|
|
130
132
|
return {
|
|
131
133
|
mpValidationSchema,
|
|
132
|
-
mpValidationOptions
|
|
134
|
+
mpValidationOptions,
|
|
135
|
+
// Return the raw fields object too, to make for easier schema-combining:
|
|
136
|
+
mpValidationFields
|
|
133
137
|
};
|
|
134
138
|
};
|
|
135
139
|
|