import { COUNTRY_CURRENCY, PRO_PRICE_BY_COUNTRY } from '@gruperly/shared' import { useTranslation } from 'react-i18next' import { useIntlLocale } from '../../i18n' import { formatPrice } from '../../lib/format' import { MessagePreview } from './MessagePreview' import { useOnboarding } from './OnboardingProvider' type PaymentReminderPreviewProps = { caption: string className?: string } /* Día de vencimiento y hora de la muestra: valores típicos, fijos para que la vista previa no cambie entre renders. */ const SAMPLE_DUE_DAY = 10 const SAMPLE_TIME = new Date(2026, 0, 5, 10, 0) /** * El recordatorio de pago semanal, con el mismo texto que arma el backend * (`whatsapp/lib/render-message.ts`) y un ejemplo en la moneda del país elegido. */ export function PaymentReminderPreview({ caption, className }: PaymentReminderPreviewProps) { const { t } = useTranslation('onboarding') const locale = useIntlLocale() const { country } = useOnboarding() const now = new Date() const dueDate = new Date(now.getFullYear(), now.getMonth() + (now.getDate() >= SAMPLE_DUE_DAY ? 1 : 0), SAMPLE_DUE_DAY) // El precio de ejemplo es el de Pro del país: un monto realista en su moneda. const amount = formatPrice(PRO_PRICE_BY_COUNTRY[country], COUNTRY_CURRENCY[country]) return ( {t('preview.reminder', { name: t('preview.sampleStudent'), group: t('preview.sampleGroup'), amount, date: new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long' }).format(dueDate), })}{' '} {t('preview.sampleLink')} ) }