🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(auth): show deleted-account signup cooldown (#21296)
YuTengjing7183f98ff90d
diff --git a/locales/ar/authError.json b/locales/ar/authError.jsonindex 39804584813..d62c81a4988 100644--- a/locales/ar/authError.json+++ b/locales/ar/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "هذا الحساب مرتبط بالفعل بمستخدم آخر","codes.ACCOUNT_NOT_FOUND": "لم يتم العثور على الحساب","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "حساب بيانات الاعتماد غير موجود",- "codes.DELETED_ACCOUNT_EMAIL": "تم ربط هذا البريد الإلكتروني بحساب محذوف ولا يمكن استخدامه للتسجيل","codes.EMAIL_CAN_NOT_BE_UPDATED": "لا يمكن تحديث البريد الإلكتروني لهذا الحساب","codes.EMAIL_NOT_ALLOWED": "هذا البريد الإلكتروني غير مسموح به للتسجيل","codes.EMAIL_NOT_FOUND": "لا يوجد بريد إلكتروني مرتبط بهذا الحساب. يرجى التحقق مما إذا كان حسابك مرتبطًا ببريد إلكتروني.",diff --git a/locales/bg-BG/authError.json b/locales/bg-BG/authError.jsonindex a37ce411257..a7887bfa13e 100644--- a/locales/bg-BG/authError.json+++ b/locales/bg-BG/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Този акаунт вече е свързан с друг потребител","codes.ACCOUNT_NOT_FOUND": "Акаунтът не е намерен","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Акаунтът с тези идентификационни данни не съществува",- "codes.DELETED_ACCOUNT_EMAIL": "Този имейл е свързан с изтрит акаунт и не може да бъде използван за регистрация","codes.EMAIL_CAN_NOT_BE_UPDATED": "Имейлът не може да бъде променен за този акаунт","codes.EMAIL_NOT_ALLOWED": "Имейл адресът не е разрешен за регистрация","codes.EMAIL_NOT_FOUND": "Няма имейл, свързан с този акаунт. Моля, проверете дали акаунтът ви има свързан имейл.",diff --git a/locales/de-DE/authError.json b/locales/de-DE/authError.jsonindex 90ad2c9b0d5..2f57d93480d 100644--- a/locales/de-DE/authError.json+++ b/locales/de-DE/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Dieses Konto ist bereits mit einem anderen Benutzer verknüpft","codes.ACCOUNT_NOT_FOUND": "Konto nicht gefunden","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Anmeldekonto existiert nicht",- "codes.DELETED_ACCOUNT_EMAIL": "Diese E-Mail-Adresse ist mit einem gelöschten Konto verknüpft und kann nicht für die Registrierung verwendet werden","codes.EMAIL_CAN_NOT_BE_UPDATED": "E-Mail-Adresse kann für dieses Konto nicht aktualisiert werden","codes.EMAIL_NOT_ALLOWED": "Diese E-Mail-Adresse ist für die Registrierung nicht zugelassen","codes.EMAIL_NOT_FOUND": "Keine E-Mail mit diesem Konto verknüpft. Bitte überprüfen Sie, ob Ihrem Konto eine E-Mail-Adresse zugeordnet ist.",diff --git a/locales/en-US/authError.json b/locales/en-US/authError.jsonindex 7028ddff11b..058196ee0e1 100644--- a/locales/en-US/authError.json+++ b/locales/en-US/authError.json@@ -5,7 +5,9 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "This account is already linked to another user","codes.ACCOUNT_NOT_FOUND": "Account not found","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Credential account does not exist",- "codes.DELETED_ACCOUNT_EMAIL": "This email has been associated with a deleted account and cannot be used for registration",+ "codes.DELETED_ACCOUNT_EMAIL": "This email is still in the account deletion cooldown period. You can sign up again 31 days after deletion is complete.",+ "codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS_one": "This email is still in the account deletion cooldown period. You can sign up again in about {{count}} day.",+ "codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS_other": "This email is still in the account deletion cooldown period. You can sign up again in about {{count}} days.","codes.EMAIL_CAN_NOT_BE_UPDATED": "Email cannot be updated for this account","codes.EMAIL_NOT_ALLOWED": "Email not allowed for registration","codes.EMAIL_NOT_FOUND": "No email associated with this account. Please check if your account has an email bound.",diff --git a/locales/es-ES/authError.json b/locales/es-ES/authError.jsonindex f0770f7b8d5..bb44624b9b1 100644--- a/locales/es-ES/authError.json+++ b/locales/es-ES/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Esta cuenta ya está vinculada a otro usuario","codes.ACCOUNT_NOT_FOUND": "Cuenta no encontrada","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "La cuenta de credenciales no existe",- "codes.DELETED_ACCOUNT_EMAIL": "Este correo electrónico está asociado a una cuenta eliminada y no puede utilizarse para registrarse","codes.EMAIL_CAN_NOT_BE_UPDATED": "No se puede actualizar el correo electrónico de esta cuenta","codes.EMAIL_NOT_ALLOWED": "Correo electrónico no permitido para el registro","codes.EMAIL_NOT_FOUND": "No hay ningún correo electrónico asociado a esta cuenta. Por favor, verifica si tu cuenta tiene un correo electrónico vinculado.",diff --git a/locales/fa-IR/authError.json b/locales/fa-IR/authError.jsonindex 6b1e0d7c9fd..cdf99d6e3fa 100644--- a/locales/fa-IR/authError.json+++ b/locales/fa-IR/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "این حساب قبلاً به کاربر دیگری متصل شده است","codes.ACCOUNT_NOT_FOUND": "حساب کاربری یافت نشد","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "حساب کاربری با این اطلاعات وجود ندارد",- "codes.DELETED_ACCOUNT_EMAIL": "این ایمیل به یک حساب حذفشده مرتبط است و نمیتوان از آن برای ثبتنام استفاده کرد","codes.EMAIL_CAN_NOT_BE_UPDATED": "امکان بهروزرسانی ایمیل برای این حساب وجود ندارد","codes.EMAIL_NOT_ALLOWED": "استفاده از این ایمیل برای ثبتنام مجاز نیست","codes.EMAIL_NOT_FOUND": "هیچ ایمیلی با این حساب کاربری مرتبط نیست. لطفاً بررسی کنید که آیا حساب شما به یک ایمیل متصل شده است یا خیر.",diff --git a/locales/fr-FR/authError.json b/locales/fr-FR/authError.jsonindex e71d0684af1..952b1bf524d 100644--- a/locales/fr-FR/authError.json+++ b/locales/fr-FR/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Ce compte est déjà lié à un autre utilisateur","codes.ACCOUNT_NOT_FOUND": "Compte introuvable","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Le compte d'identifiants n'existe pas",- "codes.DELETED_ACCOUNT_EMAIL": "Cet e-mail est associé à un compte supprimé et ne peut pas être utilisé pour l'inscription","codes.EMAIL_CAN_NOT_BE_UPDATED": "L'adresse e-mail ne peut pas être mise à jour pour ce compte","codes.EMAIL_NOT_ALLOWED": "Adresse e-mail non autorisée pour l'inscription","codes.EMAIL_NOT_FOUND": "Aucune adresse e-mail n’est associée à ce compte. Veuillez vérifier si une adresse e-mail y est liée.",diff --git a/locales/it-IT/authError.json b/locales/it-IT/authError.jsonindex ad2e64ad3fd..1efe4993d5a 100644--- a/locales/it-IT/authError.json+++ b/locales/it-IT/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Questo account è già collegato a un altro utente","codes.ACCOUNT_NOT_FOUND": "Account non trovato","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "L'account delle credenziali non esiste",- "codes.DELETED_ACCOUNT_EMAIL": "Questa email è associata a un account eliminato e non può essere utilizzata per la registrazione","codes.EMAIL_CAN_NOT_BE_UPDATED": "L'email non può essere aggiornata per questo account","codes.EMAIL_NOT_ALLOWED": "Email non consentita per la registrazione","codes.EMAIL_NOT_FOUND": "Nessuna email associata a questo account. Verifica se al tuo account è collegata un'email.",diff --git a/locales/ja-JP/authError.json b/locales/ja-JP/authError.jsonindex ea4aae0be04..87b14b583b9 100644--- a/locales/ja-JP/authError.json+++ b/locales/ja-JP/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "このアカウントは他のユーザーにすでにリンクされています","codes.ACCOUNT_NOT_FOUND": "該当するアカウントが見つかりません","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "認証情報のアカウントが存在しません",- "codes.DELETED_ACCOUNT_EMAIL": "このメールアドレスは削除されたアカウントに関連付けられており、登録には使用できません","codes.EMAIL_CAN_NOT_BE_UPDATED": "このアカウントのメールアドレスは変更できません","codes.EMAIL_NOT_ALLOWED": "このメールアドレスでは登録できません","codes.EMAIL_NOT_FOUND": "このアカウントにはメールアドレスが登録されていません。アカウントにメールアドレスが紐付けられているかご確認ください。",diff --git a/locales/ko-KR/authError.json b/locales/ko-KR/authError.jsonindex f7bad731b24..0249ba2c9c9 100644--- a/locales/ko-KR/authError.json+++ b/locales/ko-KR/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "해당 계정은 이미 다른 사용자와 연결되어 있습니다","codes.ACCOUNT_NOT_FOUND": "해당 계정을 찾을 수 없습니다","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "자격 증명 계정을 찾을 수 없습니다",- "codes.DELETED_ACCOUNT_EMAIL": "이 이메일은 삭제된 계정과 연결되어 있어 회원가입에 사용할 수 없습니다","codes.EMAIL_CAN_NOT_BE_UPDATED": "현재 계정의 이메일은 수정할 수 없습니다","codes.EMAIL_NOT_ALLOWED": "이 이메일은 회원가입에 사용할 수 없습니다","codes.EMAIL_NOT_FOUND": "이 계정에 연결된 이메일이 없습니다. 계정에 이메일이 등록되어 있는지 확인해 주세요.",diff --git a/locales/nl-NL/authError.json b/locales/nl-NL/authError.jsonindex fa218afbcfa..71f7b6a2d1a 100644--- a/locales/nl-NL/authError.json+++ b/locales/nl-NL/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Dit account is al gekoppeld aan een andere gebruiker","codes.ACCOUNT_NOT_FOUND": "Account niet gevonden","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Inloggegevensaccount bestaat niet",- "codes.DELETED_ACCOUNT_EMAIL": "Dit e-mailadres is gekoppeld aan een verwijderd account en kan niet worden gebruikt voor registratie","codes.EMAIL_CAN_NOT_BE_UPDATED": "E-mailadres kan niet worden bijgewerkt voor dit account","codes.EMAIL_NOT_ALLOWED": "E-mailadres niet toegestaan voor registratie","codes.EMAIL_NOT_FOUND": "Geen e-mailadres gekoppeld aan dit account. Controleer of er een e-mailadres aan je account is gekoppeld.",diff --git a/locales/pl-PL/authError.json b/locales/pl-PL/authError.jsonindex ed1d826685a..396ceff61d7 100644--- a/locales/pl-PL/authError.json+++ b/locales/pl-PL/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "To konto jest już powiązane z innym użytkownikiem","codes.ACCOUNT_NOT_FOUND": "Nie znaleziono konta","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Konto uwierzytelniające nie istnieje",- "codes.DELETED_ACCOUNT_EMAIL": "Ten adres e-mail jest powiązany z usuniętym kontem i nie może być użyty do rejestracji","codes.EMAIL_CAN_NOT_BE_UPDATED": "Nie można zaktualizować adresu e-mail dla tego konta","codes.EMAIL_NOT_ALLOWED": "Rejestracja z tym adresem e-mail jest niedozwolona","codes.EMAIL_NOT_FOUND": "Brak adresu e-mail powiązanego z tym kontem. Sprawdź, czy Twoje konto ma przypisany adres e-mail.",diff --git a/locales/pt-BR/authError.json b/locales/pt-BR/authError.jsonindex 4ac9da24d39..f6d34204fd0 100644--- a/locales/pt-BR/authError.json+++ b/locales/pt-BR/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Esta conta já está vinculada a outro usuário","codes.ACCOUNT_NOT_FOUND": "Conta não encontrada","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Conta de credencial não existe",- "codes.DELETED_ACCOUNT_EMAIL": "Este e-mail está associado a uma conta excluída e não pode ser usado para registro","codes.EMAIL_CAN_NOT_BE_UPDATED": "O e-mail não pode ser atualizado para esta conta","codes.EMAIL_NOT_ALLOWED": "E-mail não permitido para registro","codes.EMAIL_NOT_FOUND": "Nenhum e-mail associado a esta conta. Verifique se sua conta possui um e-mail vinculado.",diff --git a/locales/ru-RU/authError.json b/locales/ru-RU/authError.jsonindex f907c97152d..4aacb3b8626 100644--- a/locales/ru-RU/authError.json+++ b/locales/ru-RU/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Эта учетная запись уже привязана к другому пользователю","codes.ACCOUNT_NOT_FOUND": "Учетная запись не найдена","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Учетная запись с такими учетными данными не существует",- "codes.DELETED_ACCOUNT_EMAIL": "Этот адрес электронной почты связан с удалённой учётной записью и не может быть использован для регистрации","codes.EMAIL_CAN_NOT_BE_UPDATED": "Невозможно обновить адрес электронной почты для этой учетной записи","codes.EMAIL_NOT_ALLOWED": "Регистрация с этим адресом электронной почты недоступна","codes.EMAIL_NOT_FOUND": "С этим аккаунтом не связан ни один адрес электронной почты. Пожалуйста, проверьте, привязана ли электронная почта к вашему аккаунту.",diff --git a/locales/tr-TR/authError.json b/locales/tr-TR/authError.jsonindex dcf808030a4..b07dd732930 100644--- a/locales/tr-TR/authError.json+++ b/locales/tr-TR/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Bu hesap zaten başka bir kullanıcıya bağlı","codes.ACCOUNT_NOT_FOUND": "Hesap bulunamadı","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Kimlik bilgisi hesabı mevcut değil",- "codes.DELETED_ACCOUNT_EMAIL": "Bu e-posta silinmiş bir hesapla ilişkilendirilmiş ve kayıt için kullanılamaz","codes.EMAIL_CAN_NOT_BE_UPDATED": "Bu hesabın e-posta adresi güncellenemez","codes.EMAIL_NOT_ALLOWED": "Bu e-posta adresi kayıt için uygun değil","codes.EMAIL_NOT_FOUND": "Bu hesaba bağlı bir e-posta bulunamadı. Lütfen hesabınıza bir e-posta adresi bağlı olup olmadığını kontrol edin.",diff --git a/locales/vi-VN/authError.json b/locales/vi-VN/authError.jsonindex f5df2c5cd71..c6559c2ac17 100644--- a/locales/vi-VN/authError.json+++ b/locales/vi-VN/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "Tài khoản này đã được liên kết với người dùng khác","codes.ACCOUNT_NOT_FOUND": "Không tìm thấy tài khoản","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "Tài khoản xác thực không tồn tại",- "codes.DELETED_ACCOUNT_EMAIL": "Email này đã được liên kết với một tài khoản đã bị xóa và không thể sử dụng để đăng ký","codes.EMAIL_CAN_NOT_BE_UPDATED": "Không thể cập nhật email cho tài khoản này","codes.EMAIL_NOT_ALLOWED": "Email này không được phép sử dụng để đăng ký","codes.EMAIL_NOT_FOUND": "Không tìm thấy email liên kết với tài khoản này. Vui lòng kiểm tra xem tài khoản của bạn đã được liên kết với email chưa.",diff --git a/locales/zh-CN/authError.json b/locales/zh-CN/authError.jsonindex e97064ce721..0aabc9f2b12 100644--- a/locales/zh-CN/authError.json+++ b/locales/zh-CN/authError.json@@ -5,7 +5,8 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "这个账号已绑定到其他用户,请使用其他方式登录","codes.ACCOUNT_NOT_FOUND": "没有找到对应账号,请检查登录方式或注册新账号","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "凭证账号不存在,请重新授权或联系支持",- "codes.DELETED_ACCOUNT_EMAIL": "该邮箱已关联至已删除的账户,无法用于注册",+ "codes.DELETED_ACCOUNT_EMAIL": "该邮箱仍在账号注销冷却期。注销完成满 31 天后可重新注册。",+ "codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS": "该邮箱仍在账号注销冷却期,预计 {{count}} 天后可重新注册。","codes.EMAIL_CAN_NOT_BE_UPDATED": "当前邮箱无法修改,如需更换,请联系支持","codes.EMAIL_NOT_ALLOWED": "该邮箱不允许用于注册","codes.EMAIL_NOT_FOUND": "登录账号未关联邮箱,请检查账号是否已绑定邮箱",diff --git a/locales/zh-TW/authError.json b/locales/zh-TW/authError.jsonindex 0f68a3271f6..28e947fb6ba 100644--- a/locales/zh-TW/authError.json+++ b/locales/zh-TW/authError.json@@ -5,7 +5,6 @@"codes.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_USER": "該帳號已綁定至其他使用者","codes.ACCOUNT_NOT_FOUND": "找不到對應帳號","codes.CREDENTIAL_ACCOUNT_NOT_FOUND": "憑證帳號不存在",- "codes.DELETED_ACCOUNT_EMAIL": "此電子郵件已與已刪除的帳戶相關聯,無法用於註冊","codes.EMAIL_CAN_NOT_BE_UPDATED": "目前帳號的電子郵件無法修改","codes.EMAIL_NOT_ALLOWED": "此電子郵件不允許用於註冊","codes.EMAIL_NOT_FOUND": "此帳戶未綁定電子郵件。請確認您的帳戶是否已綁定電子郵件。",diff --git a/packages/locales/src/default/authError.ts b/packages/locales/src/default/authError.tsindex 31d3d352722..aca5de8ab5a 100644--- a/packages/locales/src/default/authError.ts+++ b/packages/locales/src/default/authError.ts@@ -7,7 +7,11 @@ export default {'codes.ACCOUNT_NOT_FOUND': 'Account not found','codes.CREDENTIAL_ACCOUNT_NOT_FOUND': 'Credential account does not exist','codes.DELETED_ACCOUNT_EMAIL':- 'This email has been associated with a deleted account and cannot be used for registration',+ 'This email is still in the account deletion cooldown period. You can sign up again 31 days after deletion is complete.',+ 'codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS_one':+ 'This email is still in the account deletion cooldown period. You can sign up again in about {{count}} day.',+ 'codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS_other':+ 'This email is still in the account deletion cooldown period. You can sign up again in about {{count}} days.','codes.EMAIL_CAN_NOT_BE_UPDATED': 'Email cannot be updated for this account','codes.EMAIL_NOT_ALLOWED': 'Email not allowed for registration','codes.EMAIL_NOT_FOUND':diff --git a/src/features/Auth/SignUp/useSignUp.test.ts b/src/features/Auth/SignUp/useSignUp.test.tsindex a639eb9c0f9..d5db75d6ba2 100644--- a/src/features/Auth/SignUp/useSignUp.test.ts+++ b/src/features/Auth/SignUp/useSignUp.test.ts@@ -9,6 +9,7 @@ const mockMessageError = vi.hoisted(() => vi.fn());const mockSignUpEmail = vi.hoisted(() => vi.fn());const mockGetCaptchaTokenOnError = vi.hoisted(() => vi.fn());const mockPreSocialSignupCheck = vi.hoisted(() => vi.fn(async () => true));+const mockTranslate = vi.hoisted(() => vi.fn());vi.mock('react-router', () => ({useNavigate: () => mockNavigate,@@ -38,6 +39,12 @@ vi.mock('@/business/client/hooks/useBusinessSignup', () => ({}),}));+vi.mock('react-i18next', () => ({+ useTranslation: () => ({+ t: mockTranslate,+ }),+}));+let mockEnableEmailVerification = false;let mockEnableBusinessFeatures = false;vi.mock('@/features/AuthShell/AuthServerConfigProvider', () => ({@@ -58,6 +65,14 @@ describe('useSignUp', () => {mockSearchParamsGet.mockReturnValue(null);mockGetCaptchaTokenOnError.mockResolvedValue(undefined);mockPreSocialSignupCheck.mockResolvedValue(true);+ mockTranslate.mockImplementation((key: string, options?: Record<string, unknown>) => {+ if (key === 'authError:codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS') {+ return `Retry within ${options?.count} days`;+ }+ if (key === 'authError:codes.DELETED_ACCOUNT_EMAIL') return 'Static cooldown';++ return typeof options?.defaultValue === 'string' ? options.defaultValue : key;+ });mockEnableBusinessFeatures = false;mockEnableEmailVerification = false;Object.defineProperty(window, 'location', {@@ -234,6 +249,67 @@ describe('useSignUp', () => {expect(window.location.href).toBe('');});+ it('should show the rounded remaining cooldown in days', async () => {+ mockSignUpEmail.mockResolvedValue({+ error: {+ code: 'DELETED_ACCOUNT_EMAIL',+ message: 'DELETED_ACCOUNT_EMAIL',+ retryAfterDays: 4,+ },+ });++ const { result } = renderHook(() => useSignUp());++ await act(async () => {+ await result.current.onSubmit(validValues);+ });++ expect(mockMessageError).toHaveBeenCalledWith('Retry within 4 days');+ });++ it.each([0, -1, 1.5, '4', Number.POSITIVE_INFINITY])(+ 'should ignore an invalid retry-after day value: %s',+ async (retryAfterDays) => {+ mockSignUpEmail.mockResolvedValue({+ error: {+ code: 'DELETED_ACCOUNT_EMAIL',+ message: 'DELETED_ACCOUNT_EMAIL',+ retryAfterDays,+ },+ });++ const { result } = renderHook(() => useSignUp());++ await act(async () => {+ await result.current.onSubmit(validValues);+ });++ expect(mockMessageError).toHaveBeenCalledWith('Static cooldown');+ },+ );++ it('should fall back to the static error copy when the dynamic key is unavailable', async () => {+ mockTranslate.mockImplementation((key: string, options?: Record<string, unknown>) => {+ if (key === 'authError:codes.DELETED_ACCOUNT_EMAIL') return 'Static cooldown';+ return typeof options?.defaultValue === 'string' ? options.defaultValue : key;+ });+ mockSignUpEmail.mockResolvedValue({+ error: {+ code: 'DELETED_ACCOUNT_EMAIL',+ message: 'DELETED_ACCOUNT_EMAIL',+ retryAfterDays: 4,+ },+ });++ const { result } = renderHook(() => useSignUp());++ await act(async () => {+ await result.current.onSubmit(validValues);+ });++ expect(mockMessageError).toHaveBeenCalledWith('Static cooldown');+ });+it('should retry sign up with captcha token when captcha is required', async () => {mockGetCaptchaTokenOnError.mockResolvedValue('captcha-token');mockSignUpEmaildiff --git a/src/features/Auth/SignUp/useSignUp.ts b/src/features/Auth/SignUp/useSignUp.tsindex d03c48604ba..3e4aca9a925 100644--- a/src/features/Auth/SignUp/useSignUp.ts+++ b/src/features/Auth/SignUp/useSignUp.ts@@ -26,6 +26,7 @@ interface SignUpErrorLike {};};message?: string;+ retryAfterDays?: number;}export const useSignUp = () => {@@ -102,9 +103,20 @@ export const useSignUp = () => {return;}- const translated = signUpError.code- ? t(`authError:codes.${signUpError.code}`, { defaultValue: '' })- : '';+ const retryAfterDays = signUpError.retryAfterDays;+ const retryAfterTranslated =+ signUpError.code &&+ typeof retryAfterDays === 'number' &&+ Number.isSafeInteger(retryAfterDays) &&+ retryAfterDays > 0+ ? t(`authError:codes.${signUpError.code}_WITH_RETRY_AFTER_DAYS`, {+ count: retryAfterDays,+ defaultValue: '',+ })+ : '';+ const translated =+ retryAfterTranslated ||+ (signUpError.code ? t(`authError:codes.${signUpError.code}`, { defaultValue: '' }) : '');toast.error(translated || signUpError.message || t('betterAuth.signup.error'));return;}diff --git a/src/features/AuthShell/createAuthI18n.test.ts b/src/features/AuthShell/createAuthI18n.test.tsnew file mode 100644index 00000000000..fdbfcc7fe2d--- /dev/null+++ b/src/features/AuthShell/createAuthI18n.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from 'vitest';++import { createAuthI18n } from './createAuthI18n';++describe('createAuthI18n', () => {+ it.each([+ [+ 'en-US',+ 'This email is still in the account deletion cooldown period. You can sign up again in about 4 days.',+ ],+ ['zh-CN', '该邮箱仍在账号注销冷却期,预计 4 天后可重新注册。'],+ ])('loads the deleted-account retry copy for %s', async (locale, expected) => {+ const { init, instance } = createAuthI18n(locale);++ await init({ initAsync: false });+ await instance.loadNamespaces('authError');++ expect(+ instance.t('codes.DELETED_ACCOUNT_EMAIL_WITH_RETRY_AFTER_DAYS', {+ count: 4,+ ns: 'authError',+ }),+ ).toBe(expected);+ });+});