feat(admin): mail preview field with sandboxed HTML and test send

- Add MailPreviewField (POST /mail/preview + /mail/test-send, empty sandbox iframe)
- Register mailpreview as valueless/group-labelled; SettingsFormView FORM_VALUES/FORM_LOCALE
- Smoke tests for srcdoc, sequence guard, 422 keep-last, and 429 Retry-After

Plan 35-03, task 1

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 13:14:22 +01:00
parent 9ea3159ba2
commit 52204e171d
9 changed files with 603 additions and 8 deletions

View File

@@ -5,11 +5,11 @@ import { ArrowLeft } from '@lucide/vue'
import { api } from '../api/client'
import type { AdminRecord, FormField, FormView } from '../api/types'
import { shortcutHint } from '../app/hotkeys'
import { t } from '../app/i18n'
import { currentLocale, t } from '../app/i18n'
import FormErrorBanner from '../components/form/FormErrorBanner.vue'
import FormGrid from '../components/form/FormGrid.vue'
import FormTabs from '../components/form/FormTabs.vue'
import { SETTINGS_SECRETS } from '../components/form/formContext'
import { FORM_LOCALE, FORM_VALUES, SETTINGS_SECRETS } from '../components/form/formContext'
import {
DEFAULT_TAB,
contextAllows,
@@ -52,6 +52,9 @@ const busy = ref(false)
const activeTab = ref(DEFAULT_TAB)
provide(SETTINGS_SECRETS, computed(() => secrets.value))
// Phase 35: mailpreview on Branding reads the unsaved draft (UI-SPEC C8).
provide(FORM_VALUES, computed(() => values.value))
provide(FORM_LOCALE, computed(() => schema.value?.meta.locale || currentLocale.value))
const fields = computed(() => (schema.value?.fields ?? []).filter((field) => contextAllows(field, 'update')))
const fieldNames = computed(() => fields.value.map((field) => field.name))