From cf1c82b2bd351119b642af39ece720fec7539048 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 2 May 2025 16:57:46 -0400 Subject: [PATCH 1/4] chore: Rely on API-based errors for en-US messaging --- packages/localizations/src/en-US.ts | 55 +++++++++++++---------------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/packages/localizations/src/en-US.ts b/packages/localizations/src/en-US.ts index f4bbe058a71..0fb4a8fca5d 100644 --- a/packages/localizations/src/en-US.ts +++ b/packages/localizations/src/en-US.ts @@ -589,45 +589,40 @@ export const enUS: LocalizationResource = { socialButtonsBlockButtonManyInView: '{{provider|titleize}}', unstable__errors: { already_a_member_in_organization: '{{email}} is already a member of the organization.', - captcha_invalid: - 'Sign up unsuccessful due to failed security validations. Please try using a different browser or disabling browser extensions. If issues persist, contact support for assistance.', + captcha_invalid: undefined, captcha_unavailable: 'Sign up unsuccessful due to failed bot validation. Please refresh the page to try again or reach out to support for more assistance.', form_code_incorrect: undefined, - form_identifier_exists__email_address: 'This email address is taken. Please try another.', - form_identifier_exists__phone_number: 'This phone number is taken. Please try another.', - form_identifier_exists__username: 'This username is taken. Please try another.', - form_identifier_not_found: "We couldn't find an account with those details.", - form_param_format_invalid: 'The value entered is in an invalid format. Please check and correct it.', - form_param_format_invalid__email_address: 'Email address must be a valid email address.', - form_param_format_invalid__phone_number: 'Phone number must be in a valid international format.', - form_param_max_length_exceeded__first_name: 'First name should not exceed 256 characters.', - form_param_max_length_exceeded__last_name: 'Last name should not exceed 256 characters.', - form_param_max_length_exceeded__name: 'Name should not exceed 256 characters.', - form_param_nil: 'This field is required and cannot be empty.', - form_param_value_invalid: 'The value entered is invalid. Please correct it.', - form_password_incorrect: 'The password you entered is incorrect. Please try again.', + form_identifier_exists__email_address: undefined, + form_identifier_exists__phone_number: undefined, + form_identifier_exists__username: undefined, + form_identifier_not_found: undefined, + form_param_format_invalid: undefined, + form_param_format_invalid__email_address: undefined, + form_param_format_invalid__phone_number: undefined, + form_param_max_length_exceeded__first_name: undefined, + form_param_max_length_exceeded__last_name: undefined, + form_param_max_length_exceeded__name: undefined, + form_param_nil: undefined, + form_param_value_invalid: undefined, + form_password_incorrect: undefined, form_password_length_too_short: 'Your password is too short. It must be at least 8 characters long.', form_password_not_strong_enough: 'Your password is not strong enough.', form_password_pwned: 'This password has been found as part of a breach and can not be used, please try another password instead.', form_password_pwned__sign_in: 'This password has been found as part of a breach and can not be used, please reset your password.', - form_password_size_in_bytes_exceeded: - 'Your password has exceeded the maximum number of bytes allowed, please shorten it or remove some special characters.', - form_password_validation_failed: 'Incorrect Password', - form_username_invalid_character: - 'Your username contains invalid characters. Please use only letters, numbers, and underscores.', + form_password_size_in_bytes_exceeded: undefined, + form_password_validation_failed: undefined, + form_username_invalid_character: undefined, form_username_invalid_length: 'Your username must be between {{min_length}} and {{max_length}} characters long.', - identification_deletion_failed: 'You cannot delete your last identification.', + identification_deletion_failed: undefined, not_allowed_access: undefined, - organization_domain_blocked: 'This is a blocked email provider domain. Please use a different one.', - organization_domain_common: 'This is a common email provider domain. Please use a different one.', - organization_domain_exists_for_enterprise_connection: 'This domain is already used for your organization’s SSO', - organization_membership_quota_exceeded: - 'You have reached your limit of organization memberships, including outstanding invitations.', - organization_minimum_permissions_needed: - 'There has to be at least one organization member with the minimum required permissions.', + organization_domain_blocked: undefined, + organization_domain_common: undefined, + organization_domain_exists_for_enterprise_connection: undefined, + organization_membership_quota_exceeded: undefined, + organization_minimum_permissions_needed: undefined, passkey_already_exists: 'A passkey is already registered with this device.', passkey_not_supported: 'Passkeys are not supported on this device.', passkey_pa_not_supported: 'Registration requires a platform authenticator but the device does not support it.', @@ -642,8 +637,8 @@ export const enUS: LocalizationResource = { requireUppercase: 'an uppercase letter', sentencePrefix: 'Your password must contain', }, - phone_number_exists: 'This phone number is taken. Please try another.', - session_exists: "You're already signed in.", + phone_number_exists: undefined, + session_exists: undefined, web3_missing_identifier: 'A Web3 Wallet extension cannot be found. Please install one to continue.', zxcvbn: { couldBeStronger: 'Your password works, but could be stronger. Try adding more characters.', From 106f9b8562fb6c3b4e6c7b3de2b619e84e78ba12 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 2 May 2025 17:01:53 -0400 Subject: [PATCH 2/4] chore: Add changeset --- .changeset/soft-snakes-roll.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/soft-snakes-roll.md diff --git a/.changeset/soft-snakes-roll.md b/.changeset/soft-snakes-roll.md new file mode 100644 index 00000000000..b989cacc97e --- /dev/null +++ b/.changeset/soft-snakes-roll.md @@ -0,0 +1,5 @@ +--- +'@clerk/localizations': minor +--- + +Rely on API-based error messaging for `en-US` localizations From 5ec2015ad32ef67c68aaf8112c40c3d5ccce6ced Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Fri, 2 May 2025 18:16:42 -0400 Subject: [PATCH 3/4] fix: Fix tests --- integration/tests/sign-in-flow.test.ts | 4 ++-- integration/tests/sign-in-or-up-flow.test.ts | 4 ++-- .../ui/components/SignUp/__tests__/SignUpContinue.test.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/integration/tests/sign-in-flow.test.ts b/integration/tests/sign-in-flow.test.ts index 84e01e62fed..bd794f5e819 100644 --- a/integration/tests/sign-in-flow.test.ts +++ b/integration/tests/sign-in-flow.test.ts @@ -128,7 +128,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('sign in f await u.po.signIn.continue(); await u.po.signIn.setPassword('wrong-password'); await u.po.signIn.continue(); - await expect(u.page.getByText(/password you entered is incorrect/i)).toBeVisible(); + await expect(u.page.getByText(/password is incorrect/i)).toBeVisible(); await u.po.expect.toBeSignedOut(); }); @@ -142,7 +142,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('sign in f await u.po.signIn.setPassword('wrong-password'); await u.po.signIn.continue(); - await expect(u.page.getByText(/password you entered is incorrect/i)).toBeVisible(); + await expect(u.page.getByText(/password is incorrect/i)).toBeVisible(); await u.po.signIn.getUseAnotherMethodLink().click(); await u.po.signIn.getAltMethodsEmailCodeButton().click(); diff --git a/integration/tests/sign-in-or-up-flow.test.ts b/integration/tests/sign-in-or-up-flow.test.ts index eac74cc6379..c814201be65 100644 --- a/integration/tests/sign-in-or-up-flow.test.ts +++ b/integration/tests/sign-in-or-up-flow.test.ts @@ -142,7 +142,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSignInOrUpFlow] })('sign- await u.po.signIn.continue(); await u.po.signIn.setPassword('wrong-password'); await u.po.signIn.continue(); - await expect(u.page.getByText(/password you entered is incorrect/i)).toBeVisible(); + await expect(u.page.getByText(/password is incorrect/i)).toBeVisible(); await u.po.expect.toBeSignedOut(); }); @@ -156,7 +156,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSignInOrUpFlow] })('sign- await u.po.signIn.setPassword('wrong-password'); await u.po.signIn.continue(); - await expect(u.page.getByText(/password you entered is incorrect/i)).toBeVisible(); + await expect(u.page.getByText(/password is incorrect/i)).toBeVisible(); await u.po.signIn.getUseAnotherMethodLink().click(); await u.po.signIn.getAltMethodsEmailCodeButton().click(); diff --git a/packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpContinue.test.tsx b/packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpContinue.test.tsx index a471ef15bdc..a2a10c6f187 100644 --- a/packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpContinue.test.tsx +++ b/packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpContinue.test.tsx @@ -191,7 +191,7 @@ describe('SignUpContinue', () => { data: [ { code: 'form_identifier_exists', - long_message: 'some server error', + long_message: 'This username is taken. Please try another.', message: 'some server error', meta: { param_name: 'username' }, }, From a764aaab205025eba36942ecb1ae1ca89bb350b9 Mon Sep 17 00:00:00 2001 From: Tom Milewski Date: Mon, 5 May 2025 09:42:54 -0400 Subject: [PATCH 4/4] fix: Update e2e test to server-based verbiage --- integration/tests/sign-in-or-up-restricted-mode.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration/tests/sign-in-or-up-restricted-mode.test.ts b/integration/tests/sign-in-or-up-restricted-mode.test.ts index fd80cd50fed..429127b9e70 100644 --- a/integration/tests/sign-in-or-up-restricted-mode.test.ts +++ b/integration/tests/sign-in-or-up-restricted-mode.test.ts @@ -32,6 +32,6 @@ test.describe('sign-in-or-up restricted mode @nextjs', () => { await expect(u.page.getByText(/continue to/i)).toBeHidden(); await u.po.signIn.getIdentifierInput().fill(fakeUser.email); await u.po.signIn.continue(); - await expect(u.page.getByText(/We couldn't find an account with those details/i)).toBeVisible(); + await expect(u.page.getByText(/Couldn't find your account\./i)).toBeVisible(); }); });