From 0d3acb75f97970d049791712cf10a15d75e600d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Qui=C3=B1ones?= Date: Thu, 20 Jul 2023 18:24:09 +0900 Subject: [PATCH] Add descriptive validation to first and last names and business name fields in PO flow (#6795) Co-authored-by: Daniel Mallory --- .../fix-6783-specific-validation-text-po | 4 ++++ client/onboarding/strings.tsx | 21 +++++++++++++++++++ client/onboarding/test/validation.ts | 9 +++++--- 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 changelog/fix-6783-specific-validation-text-po diff --git a/changelog/fix-6783-specific-validation-text-po b/changelog/fix-6783-specific-validation-text-po new file mode 100644 index 00000000000..9bdbc74f0bf --- /dev/null +++ b/changelog/fix-6783-specific-validation-text-po @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Adding more descriptive error messages in gradual signup diff --git a/client/onboarding/strings.tsx b/client/onboarding/strings.tsx index 37bbacdc76b..63bcd6eba2d 100644 --- a/client/onboarding/strings.tsx +++ b/client/onboarding/strings.tsx @@ -122,12 +122,33 @@ export default { }, errors: { generic: __( 'Please provide a response', 'woocommerce-payments' ), + 'individual.first_name': __( + 'Please provide a first name', + 'woocommerce-payments' + ), + 'individual.last_name': __( + 'Please provide a last name', + 'woocommerce-payments' + ), email: __( 'Please provide a valid email', 'woocommerce-payments' ), phone: __( 'Please provide a valid phone number', 'woocommerce-payments' ), url: __( 'Please provide a valid website', 'woocommerce-payments' ), + business_name: __( + 'Please provide a business name', + 'woocommerce-payments' + ), + country: __( 'Please provide a country', 'woocommerce-payments' ), + business_type: __( + 'Please provide a business type', + 'woocommerce-payments' + ), + mcc: __( + 'Please provide a type of goods or services', + 'woocommerce-payments' + ), }, placeholders: { country: __( diff --git a/client/onboarding/test/validation.ts b/client/onboarding/test/validation.ts index 92f8fe9bf0a..f5d167e11da 100644 --- a/client/onboarding/test/validation.ts +++ b/client/onboarding/test/validation.ts @@ -33,9 +33,12 @@ describe( 'useValidation', () => { } ); it( 'uses a generic string for a non existing error', () => { - const { result } = renderHook( () => useValidation( 'country' ), { - wrapper: OnboardingContextProvider, - } ); + const { result } = renderHook( + () => useValidation( 'annual_revenue' ), + { + wrapper: OnboardingContextProvider, + } + ); act( () => result.current.validate() );