From c19c893d1dacc6807f87aba328c31cd604136cf3 Mon Sep 17 00:00:00 2001 From: Maanil Verma Date: Mon, 14 Sep 2026 16:25:35 +0530 Subject: [PATCH 01/75] refactor(account): make hosts the single source of auth copy The account package stops shipping localized auth strings and ships only the classification + resolution rules. Each host resolves auth copy from its own i18n. - Package: delete AUTH_ERROR_MESSAGES/AUTH_ERROR_COPY, UNAUTHORIZED_DOMAIN_MESSAGES, unauthorizedDomainMessage, AUTH_TOAST_SUMMARIES, AuthCopyLocale, and TURNSTILE_MESSAGES; authErrorMessage now resolves against a host-supplied AuthErrorCopy only. Replace SESSION_ERROR_MESSAGES (values) with SESSION_ERROR_CODES (keys only, exhaustive by type). - Website: resolve auth-error, turnstile, unauthorized-domain and toast-summary copy from apps/website i18n; add those strings to translations.ts. - Cloud: workspaceAuthStore narrows codes via SESSION_ERROR_CODES; useAuthActions already resolved from vue-i18n. - Fold in the non-enumerating sign-up / provider copy from #17562 (which this supersedes) into the host sources, not the deleted package tables. - Delete the two value-pin tests now that no host pins to package strings. Fixes FE-2188 --- apps/website/e2e/auth-live-errors.spec.ts | 5 +- .../src/components/auth/AuthEmailForm.vue | 11 +- .../components/auth/AuthForgotPassword.vue | 3 +- .../src/components/auth/AuthSignIn.test.ts | 8 +- .../auth/useAuthSignInController.ts | 4 +- .../src/config/auth-sign-in-state.test.ts | 75 +++++--- apps/website/src/config/auth-sign-in-state.ts | 47 +++-- apps/website/src/i18n/translations.ts | 116 +++++++++++++ .../tests/cloudOnboardingAuthErrors.spec.ts | 5 +- .../dialogs/signInDialogAuthErrors.spec.ts | 4 +- packages/account/src/core/session.test.ts | 19 +-- packages/account/src/core/session.ts | 22 ++- .../account/src/firebaseAuthError.test.ts | 161 ++++-------------- packages/account/src/firebaseAuthError.ts | 160 ++--------------- packages/account/src/turnstile.test.ts | 22 +-- packages/account/src/turnstile.ts | 31 ---- src/locales/.source-manifest.json | 2 +- src/locales/ar/main.json | 4 +- src/locales/authCopy.package.test.ts | 52 ------ src/locales/de/main.json | 4 +- src/locales/en/main.json | 4 +- src/locales/es/main.json | 4 +- src/locales/fa/main.json | 4 +- src/locales/fr/main.json | 4 +- src/locales/he/main.json | 4 +- src/locales/it/main.json | 4 +- src/locales/ja/main.json | 4 +- src/locales/ko/main.json | 4 +- src/locales/pt-BR/main.json | 4 +- src/locales/ru/main.json | 4 +- src/locales/tr/main.json | 4 +- src/locales/zh-TW/main.json | 4 +- src/locales/zh/main.json | 4 +- .../stores/workspaceAuthStore.copy.test.ts | 29 ---- .../workspace/stores/workspaceAuthStore.ts | 4 +- 35 files changed, 319 insertions(+), 521 deletions(-) delete mode 100644 src/locales/authCopy.package.test.ts delete mode 100644 src/platform/workspace/stores/workspaceAuthStore.copy.test.ts diff --git a/apps/website/e2e/auth-live-errors.spec.ts b/apps/website/e2e/auth-live-errors.spec.ts index dc1052aef17..c7cfc781d67 100644 --- a/apps/website/e2e/auth-live-errors.spec.ts +++ b/apps/website/e2e/auth-live-errors.spec.ts @@ -1,6 +1,7 @@ import { expect } from '@playwright/test' import type { Page, Route } from '@playwright/test' +import { t } from '../src/i18n/translations' import { test } from './fixtures/blockExternalMedia' import { WORKSHOP_EMAIL, @@ -147,9 +148,7 @@ test.describe('Live sign-up error codes and password checklist', () => { await page.getByRole('button', { name: 'Sign up', exact: true }).click() await expect( - page.getByText( - 'An account with this email already exists. Try signing in instead.' - ) + page.getByText(t('auth.errors.auth/email-already-in-use', 'en')) ).toBeVisible() await expect(page).toHaveURL(/\/signup\//) }) diff --git a/apps/website/src/components/auth/AuthEmailForm.vue b/apps/website/src/components/auth/AuthEmailForm.vue index 2d70a9df6e7..f3eac820811 100644 --- a/apps/website/src/components/auth/AuthEmailForm.vue +++ b/apps/website/src/components/auth/AuthEmailForm.vue @@ -2,10 +2,7 @@ import { cn } from '@comfyorg/tailwind-utils' import { computed, ref, useTemplateRef } from 'vue' -import { - TURNSTILE_MESSAGES, - isTurnstileEnabled -} from '@comfyorg/account/turnstile' +import { isTurnstileEnabled } from '@comfyorg/account/turnstile' import { PasswordRules, TurnstileWidget, @@ -259,8 +256,8 @@ defineExpose({ resetTurnstile }) v-model:unavailable="unavailable" :site-key="WORKSHOP_TURNSTILE_SITE_KEY" theme="dark" - :expired-message="TURNSTILE_MESSAGES[locale].expired" - :failed-message="TURNSTILE_MESSAGES[locale].failed" + :expired-message="t('auth.turnstile.expired', locale)" + :failed-message="t('auth.turnstile.failed', locale)" error-class="text-red-500" /> - {{ TURNSTILE_MESSAGES[locale].submitBlockedHint }} + {{ t('auth.turnstile.submitBlockedHint', locale) }}