@@ -60,44 +60,48 @@ export const createCustomProfileFieldsLibrary = (queries: Queries) => {
60
60
const validateCustomProfileField = ( data : CreateCustomProfileFieldData ) => {
61
61
switch ( data . type ) {
62
62
case CustomProfileFieldType . Text : {
63
- const { minLength, maxLength } = textProfileFieldGuard . parse ( data ) ;
63
+ const {
64
+ config : { minLength, maxLength } ,
65
+ } = textProfileFieldGuard . parse ( data ) ;
64
66
assertThat (
65
67
minLength && maxLength && minLength <= maxLength ,
66
68
'custom_profile_fields.invalid_min_max_input'
67
69
) ;
68
70
break ;
69
71
}
70
72
case CustomProfileFieldType . Number : {
71
- const { minValue, maxValue } = numberProfileFieldGuard . parse ( data ) ;
73
+ const {
74
+ config : { minValue, maxValue } ,
75
+ } = numberProfileFieldGuard . parse ( data ) ;
72
76
assertThat (
73
77
minValue && maxValue && minValue <= maxValue ,
74
78
'custom_profile_fields.invalid_min_max_input'
75
79
) ;
76
80
break ;
77
81
}
78
82
case CustomProfileFieldType . Checkbox : {
79
- const { options } = checkboxProfileFieldGuard . parse ( data ) ;
80
- assertThat ( options . length > 0 , 'custom_profile_fields.invalid_options' ) ;
83
+ const { config } = checkboxProfileFieldGuard . parse ( data ) ;
84
+ assertThat ( config . options . length > 0 , 'custom_profile_fields.invalid_options' ) ;
81
85
break ;
82
86
}
83
87
case CustomProfileFieldType . Select : {
84
- const { options } = selectProfileFieldGuard . parse ( data ) ;
85
- assertThat ( options . length > 0 , 'custom_profile_fields.invalid_options' ) ;
88
+ const { config } = selectProfileFieldGuard . parse ( data ) ;
89
+ assertThat ( config . options . length > 0 , 'custom_profile_fields.invalid_options' ) ;
86
90
break ;
87
91
}
88
92
case CustomProfileFieldType . Regex : {
89
- const { format } = regexProfileFieldGuard . parse ( data ) ;
90
- assertThat ( isValidRegEx ( format ) , 'custom_profile_fields.invalid_regex_format' ) ;
93
+ const { config } = regexProfileFieldGuard . parse ( data ) ;
94
+ assertThat ( isValidRegEx ( config . format ) , 'custom_profile_fields.invalid_regex_format' ) ;
91
95
break ;
92
96
}
93
97
case CustomProfileFieldType . Address : {
94
- const { parts } = addressProfileFieldGuard . parse ( data ) ;
95
- assertThat ( parts . length > 0 , 'custom_profile_fields.invalid_address_parts' ) ;
98
+ const { config } = addressProfileFieldGuard . parse ( data ) ;
99
+ assertThat ( config . parts . length > 0 , 'custom_profile_fields.invalid_address_parts' ) ;
96
100
break ;
97
101
}
98
102
case CustomProfileFieldType . Fullname : {
99
- const { parts } = fullnameProfileFieldGuard . parse ( data ) ;
100
- assertThat ( parts . length > 0 , 'custom_profile_fields.invalid_fullname_parts' ) ;
103
+ const { config } = fullnameProfileFieldGuard . parse ( data ) ;
104
+ assertThat ( config . parts . length > 0 , 'custom_profile_fields.invalid_fullname_parts' ) ;
101
105
break ;
102
106
}
103
107
case CustomProfileFieldType . Url : {
0 commit comments