feat(i18n): traducir WhatsApp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { Badge, Switch } from '../../../components/ui'
|
import { Badge, Switch } from '../../../components/ui'
|
||||||
import { hasPlanFeature, useBillingStatus } from '../../billing'
|
import { hasPlanFeature, useBillingStatus } from '../../billing'
|
||||||
import { cn } from '../../../lib/utils'
|
import { cn } from '../../../lib/utils'
|
||||||
import { automationBlockedReason, useWhatsappStatus, WEEKLY_SEND_LABEL } from '../../whatsapp'
|
import { automationBlockedReason, useWhatsappStatus, weeklySendLabel } from '../../whatsapp'
|
||||||
import { useGroupDetail } from './GroupDetailProvider'
|
import { useGroupDetail } from './GroupDetailProvider'
|
||||||
|
|
||||||
type Automation = {
|
type Automation = {
|
||||||
@@ -87,7 +87,7 @@ export function GroupAutomationsCard() {
|
|||||||
{expanded ? (
|
{expanded ? (
|
||||||
<div id="group-automations" className="border-t border-border">
|
<div id="group-automations" className="border-t border-border">
|
||||||
<p className="px-4 pt-3 text-xs text-foreground/50">
|
<p className="px-4 pt-3 text-xs text-foreground/50">
|
||||||
{WEEKLY_SEND_LABEL}
|
{weeklySendLabel()}
|
||||||
{includedInPlan ? null : (
|
{includedInPlan ? null : (
|
||||||
<>
|
<>
|
||||||
{' '}
|
{' '}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { cn } from '../../lib/utils'
|
|||||||
import { defaultLinkMethod, linksWithPairingCode, type WhatsappLinkMethod } from './copy'
|
import { defaultLinkMethod, linksWithPairingCode, type WhatsappLinkMethod } from './copy'
|
||||||
import { useWhatsappStatus } from './useWhatsappStatus'
|
import { useWhatsappStatus } from './useWhatsappStatus'
|
||||||
import { WhatsappPairingCodePanel } from './WhatsappPairingCodePanel'
|
import { WhatsappPairingCodePanel } from './WhatsappPairingCodePanel'
|
||||||
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
type WhatsappLinkModalProps = {
|
type WhatsappLinkModalProps = {
|
||||||
isOpen: boolean
|
isOpen: boolean
|
||||||
@@ -14,10 +15,10 @@ type WhatsappLinkModalProps = {
|
|||||||
initialQrCode: string | null
|
initialQrCode: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
const METHOD_LABELS: Record<WhatsappLinkMethod, string> = {
|
const METHOD_LABELS = { phone: 'link.methodPhone', qr: 'link.methodQr' } as const satisfies Record<
|
||||||
phone: 'Con tu número',
|
WhatsappLinkMethod,
|
||||||
qr: 'Con código QR',
|
string
|
||||||
}
|
>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vinculación de WhatsApp como "dispositivo vinculado", por QR o con el número
|
* Vinculación de WhatsApp como "dispositivo vinculado", por QR o con el número
|
||||||
@@ -29,6 +30,7 @@ const METHOD_LABELS: Record<WhatsappLinkMethod, string> = {
|
|||||||
*/
|
*/
|
||||||
export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLinkModalProps) {
|
export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLinkModalProps) {
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
const { t } = useTranslation('whatsapp')
|
||||||
const isMobile = useIsMobile()
|
const isMobile = useIsMobile()
|
||||||
const statusQuery = useWhatsappStatus({ enabled: isOpen })
|
const statusQuery = useWhatsappStatus({ enabled: isOpen })
|
||||||
const status = statusQuery.data?.status
|
const status = statusQuery.data?.status
|
||||||
@@ -43,10 +45,10 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isOpen) return
|
if (!isOpen) return
|
||||||
if (status === 'active') {
|
if (status === 'active') {
|
||||||
toast.success('¡Listo! Tu WhatsApp quedó vinculado.')
|
toast.success(t('link.linked'))
|
||||||
onClose()
|
onClose()
|
||||||
} else if (status === 'disconnected') {
|
} else if (status === 'disconnected') {
|
||||||
toast.error('La vinculación no se completó. Volvé a intentarlo.')
|
toast.error(t('link.failed'))
|
||||||
onClose()
|
onClose()
|
||||||
}
|
}
|
||||||
}, [isOpen, status, onClose, toast])
|
}, [isOpen, status, onClose, toast])
|
||||||
@@ -58,11 +60,11 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi
|
|||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
title="Vinculá tu WhatsApp"
|
title={t('link.title')}
|
||||||
description={
|
description={
|
||||||
activeMethod === 'phone'
|
activeMethod === 'phone'
|
||||||
? 'Te damos un código para ingresar en WhatsApp, en el teléfono donde lo usás.'
|
? t('link.phoneDescription')
|
||||||
: 'Escaneá el código con el teléfono donde usás WhatsApp.'
|
: t('link.qrDescription')
|
||||||
}
|
}
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
>
|
>
|
||||||
@@ -88,7 +90,7 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi
|
|||||||
) : (
|
) : (
|
||||||
<QrCode className="size-4" />
|
<QrCode className="size-4" />
|
||||||
)}
|
)}
|
||||||
{METHOD_LABELS[option]}
|
{t(METHOD_LABELS[option])}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@@ -100,26 +102,24 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi
|
|||||||
<>
|
<>
|
||||||
<div className="mx-auto flex size-64 items-center justify-center rounded-xl border border-border bg-white p-2">
|
<div className="mx-auto flex size-64 items-center justify-center rounded-xl border border-border bg-white p-2">
|
||||||
{qrCode ? (
|
{qrCode ? (
|
||||||
<img src={qrCode} alt="Código QR para vincular WhatsApp" className="size-full" />
|
<img src={qrCode} alt={t('link.qrAlt')} className="size-full" />
|
||||||
) : (
|
) : (
|
||||||
<Loader2 className="size-8 animate-spin text-foreground/40" />
|
<Loader2 className="size-8 animate-spin text-foreground/40" />
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ol className="space-y-1.5 text-sm text-foreground/70">
|
<ol className="space-y-1.5 text-sm text-foreground/70">
|
||||||
<li>1. Abrí WhatsApp en tu teléfono.</li>
|
<li>1. {t('link.qrStep1')}</li>
|
||||||
<li>
|
<li>
|
||||||
2. Tocá <span className="font-medium text-primary">Dispositivos vinculados</span> y
|
2. <Trans t={t} i18nKey="link.qrStep2" components={{ strong: <span className="font-medium text-primary" /> }} />
|
||||||
después <span className="font-medium text-primary">Vincular un dispositivo</span>.
|
|
||||||
</li>
|
</li>
|
||||||
<li>3. Apuntá la cámara a este código.</li>
|
<li>3. {t('link.qrStep3')}</li>
|
||||||
</ol>
|
</ol>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<p className="flex items-start gap-2 rounded-xl bg-primary-soft px-3 py-2 text-xs text-foreground/70">
|
<p className="flex items-start gap-2 rounded-xl bg-primary-soft px-3 py-2 text-xs text-foreground/70">
|
||||||
<Smartphone className="mt-0.5 size-4 shrink-0 text-accent" />
|
<Smartphone className="mt-0.5 size-4 shrink-0 text-accent" />
|
||||||
Los mensajes van a salir desde tu número. Podés desvincularlo cuando quieras desde
|
{t('link.footnote')}
|
||||||
Ajustes o desde tu teléfono.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { type FormEvent, useState } from 'react'
|
|||||||
import { Button, Input, Label } from '../../components/ui'
|
import { Button, Input, Label } from '../../components/ui'
|
||||||
import { formatPairingCode } from './copy'
|
import { formatPairingCode } from './copy'
|
||||||
import { useRequestWhatsappPairingCode } from './useRequestWhatsappPairingCode'
|
import { useRequestWhatsappPairingCode } from './useRequestWhatsappPairingCode'
|
||||||
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vinculación con el número de teléfono: el profesor escribe su número,
|
* Vinculación con el número de teléfono: el profesor escribe su número,
|
||||||
@@ -12,6 +13,7 @@ import { useRequestWhatsappPairingCode } from './useRequestWhatsappPairingCode'
|
|||||||
export function WhatsappPairingCodePanel() {
|
export function WhatsappPairingCodePanel() {
|
||||||
const { requestCode, pairingCode, isRequesting, error, reset } = useRequestWhatsappPairingCode()
|
const { requestCode, pairingCode, isRequesting, error, reset } = useRequestWhatsappPairingCode()
|
||||||
const [phoneNumber, setPhoneNumber] = useState('')
|
const [phoneNumber, setPhoneNumber] = useState('')
|
||||||
|
const { t } = useTranslation('whatsapp')
|
||||||
const [copied, setCopied] = useState(false)
|
const [copied, setCopied] = useState(false)
|
||||||
|
|
||||||
const handleSubmit = (event: FormEvent) => {
|
const handleSubmit = (event: FormEvent) => {
|
||||||
@@ -39,31 +41,26 @@ export function WhatsappPairingCodePanel() {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="sm"
|
size="sm"
|
||||||
aria-label="Copiar código"
|
aria-label={t('pairing.copy')}
|
||||||
onClick={() => void handleCopy(pairingCode)}
|
onClick={() => void handleCopy(pairingCode)}
|
||||||
>
|
>
|
||||||
{copied ? <Check className="size-4 text-success" /> : <Copy className="size-4" />}
|
{copied ? <Check className="size-4 text-success" /> : <Copy className="size-4" />}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<ol className="space-y-1.5 text-sm text-foreground/70">
|
<ol className="space-y-1.5 text-sm text-foreground/70">
|
||||||
|
<li>1. {t('pairing.step1')}</li>
|
||||||
<li>
|
<li>
|
||||||
1. Abrí WhatsApp. Te va a llegar una notificación para vincular un dispositivo:
|
2. <Trans t={t} i18nKey="pairing.step2" components={{ strong: <span className="font-medium text-primary" /> }} />
|
||||||
tocala.
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>3. {t('pairing.step3')}</li>
|
||||||
2. Si no te llega, tocá <span className="font-medium text-primary">Dispositivos vinculados</span>{' '}
|
|
||||||
→ <span className="font-medium text-primary">Vincular un dispositivo</span> →{' '}
|
|
||||||
<span className="font-medium text-primary">Vincular con el número de teléfono</span>.
|
|
||||||
</li>
|
|
||||||
<li>3. Ingresá este código. Esta pantalla se actualiza sola.</li>
|
|
||||||
</ol>
|
</ol>
|
||||||
<div className="flex items-center justify-between gap-3">
|
<div className="flex items-center justify-between gap-3">
|
||||||
<p className="flex items-center gap-2 text-xs text-foreground/50">
|
<p className="flex items-center gap-2 text-xs text-foreground/50">
|
||||||
<Loader2 className="size-3.5 animate-spin" />
|
<Loader2 className="size-3.5 animate-spin" />
|
||||||
Esperando el código…
|
{t('pairing.waiting')}
|
||||||
</p>
|
</p>
|
||||||
<Button variant="ghost" size="sm" onClick={reset}>
|
<Button variant="ghost" size="sm" onClick={reset}>
|
||||||
Usar otro número
|
{t('pairing.otherNumber')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,20 +70,20 @@ export function WhatsappPairingCodePanel() {
|
|||||||
return (
|
return (
|
||||||
<form className="space-y-3" onSubmit={handleSubmit}>
|
<form className="space-y-3" onSubmit={handleSubmit}>
|
||||||
<div>
|
<div>
|
||||||
<Label htmlFor="whatsapp-pairing-phone">Tu número de WhatsApp</Label>
|
<Label htmlFor="whatsapp-pairing-phone">{t('pairing.phone')}</Label>
|
||||||
<Input
|
<Input
|
||||||
id="whatsapp-pairing-phone"
|
id="whatsapp-pairing-phone"
|
||||||
type="tel"
|
type="tel"
|
||||||
inputMode="tel"
|
inputMode="tel"
|
||||||
autoComplete="tel"
|
autoComplete="tel"
|
||||||
autoFocus
|
autoFocus
|
||||||
placeholder="11 2345-6789"
|
placeholder={t('pairing.phonePlaceholder')}
|
||||||
value={phoneNumber}
|
value={phoneNumber}
|
||||||
invalid={Boolean(error)}
|
invalid={Boolean(error)}
|
||||||
onChange={(event) => setPhoneNumber(event.target.value)}
|
onChange={(event) => setPhoneNumber(event.target.value)}
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-foreground/50">
|
<p className="mt-1 text-xs text-foreground/50">
|
||||||
El del teléfono donde usás WhatsApp, con el código de área.
|
{t('pairing.phoneHint')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{error ? (
|
{error ? (
|
||||||
@@ -99,7 +96,7 @@ export function WhatsappPairingCodePanel() {
|
|||||||
disabled={isRequesting || !phoneNumber.trim()}
|
disabled={isRequesting || !phoneNumber.trim()}
|
||||||
>
|
>
|
||||||
{isRequesting ? <Loader2 className="size-4 animate-spin" /> : <KeyRound className="size-4" />}
|
{isRequesting ? <Loader2 className="size-4 animate-spin" /> : <KeyRound className="size-4" />}
|
||||||
{isRequesting ? 'Pidiendo código…' : 'Obtener código'}
|
{isRequesting ? t('pairing.requesting') : t('pairing.request')}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { formatMpConnectionDate } from '../mp'
|
|||||||
import {
|
import {
|
||||||
linksWithQr,
|
linksWithQr,
|
||||||
readinessLabel,
|
readinessLabel,
|
||||||
WEEKLY_SEND_LABEL,
|
weeklySendLabel,
|
||||||
whatsappStatusBadgeVariant,
|
whatsappStatusBadgeVariant,
|
||||||
whatsappStatusErrorMessage,
|
whatsappStatusErrorMessage,
|
||||||
whatsappStatusLabel,
|
whatsappStatusLabel,
|
||||||
@@ -15,6 +15,7 @@ import { useDisconnectWhatsapp } from './useDisconnectWhatsapp'
|
|||||||
import { useStartWhatsappConnection } from './useStartWhatsappConnection'
|
import { useStartWhatsappConnection } from './useStartWhatsappConnection'
|
||||||
import { useWhatsappStatus } from './useWhatsappStatus'
|
import { useWhatsappStatus } from './useWhatsappStatus'
|
||||||
import { WhatsappLinkModal } from './WhatsappLinkModal'
|
import { WhatsappLinkModal } from './WhatsappLinkModal'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WhatsApp en Ajustes: vincular el número desde el que salen los recordatorios
|
* WhatsApp en Ajustes: vincular el número desde el que salen los recordatorios
|
||||||
@@ -23,6 +24,7 @@ import { WhatsappLinkModal } from './WhatsappLinkModal'
|
|||||||
*/
|
*/
|
||||||
export function WhatsappStatusCard() {
|
export function WhatsappStatusCard() {
|
||||||
const statusQuery = useWhatsappStatus()
|
const statusQuery = useWhatsappStatus()
|
||||||
|
const { t } = useTranslation(['whatsapp', 'common'])
|
||||||
const connection = useStartWhatsappConnection()
|
const connection = useStartWhatsappConnection()
|
||||||
const { disconnectWhatsapp: disconnect, isDisconnecting } = useDisconnectWhatsapp()
|
const { disconnectWhatsapp: disconnect, isDisconnecting } = useDisconnectWhatsapp()
|
||||||
const [isConfirmingDisconnect, setIsConfirmingDisconnect] = useState(false)
|
const [isConfirmingDisconnect, setIsConfirmingDisconnect] = useState(false)
|
||||||
@@ -31,7 +33,7 @@ export function WhatsappStatusCard() {
|
|||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-3">
|
<div className="flex items-center gap-3 rounded-xl border border-border bg-surface px-4 py-3">
|
||||||
<Loader2 className="size-4 animate-spin text-foreground/40" />
|
<Loader2 className="size-4 animate-spin text-foreground/40" />
|
||||||
<p className="text-sm text-foreground/50">Consultando tu WhatsApp…</p>
|
<p className="text-sm text-foreground/50">{t('card.loading')}</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -63,7 +65,7 @@ export function WhatsappStatusCard() {
|
|||||||
<Badge variant={whatsappStatusBadgeVariant(status)}>{whatsappStatusLabel(status)}</Badge>
|
<Badge variant={whatsappStatusBadgeVariant(status)}>{whatsappStatusLabel(status)}</Badge>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-0.5 text-xs text-foreground/50">
|
<p className="mt-0.5 text-xs text-foreground/50">
|
||||||
Tu número para los recordatorios de pago y los mensajes de reenganche automáticos.
|
{t('card.description')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -75,10 +77,10 @@ export function WhatsappStatusCard() {
|
|||||||
</span>
|
</span>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="text-sm text-primary">
|
<p className="text-sm text-primary">
|
||||||
{data.displayPhoneNumber ?? 'Número vinculado'}
|
{data.displayPhoneNumber ?? t('card.linkedNumber')}
|
||||||
</p>
|
</p>
|
||||||
{connectedAt ? (
|
{connectedAt ? (
|
||||||
<p className="text-xs text-foreground/50">Vinculado el {connectedAt}</p>
|
<p className="text-xs text-foreground/50">{t('card.linkedOn', { date: connectedAt })}</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
@@ -92,20 +94,20 @@ export function WhatsappStatusCard() {
|
|||||||
) : (
|
) : (
|
||||||
<Unlink className="size-4" />
|
<Unlink className="size-4" />
|
||||||
)}
|
)}
|
||||||
Desvincular
|
{t('card.disconnect')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<dl className="space-y-1.5 px-4 py-3 text-sm">
|
<dl className="space-y-1.5 px-4 py-3 text-sm">
|
||||||
<div className="flex items-center justify-between gap-3">
|
<div className="flex items-center justify-between gap-3">
|
||||||
<dt className="text-foreground/60">Recordatorio de pago</dt>
|
<dt className="text-foreground/60">{t('card.paymentReminder')}</dt>
|
||||||
<dd className="text-primary">{readinessLabel(data.readiness.PAYMENT_REMINDER)}</dd>
|
<dd className="text-primary">{readinessLabel(data.readiness.PAYMENT_REMINDER)}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-between gap-3">
|
<div className="flex items-center justify-between gap-3">
|
||||||
<dt className="text-foreground/60">Mensaje de reenganche</dt>
|
<dt className="text-foreground/60">{t('card.reengagement')}</dt>
|
||||||
<dd className="text-primary">{readinessLabel(data.readiness.REENGAGEMENT)}</dd>
|
<dd className="text-primary">{readinessLabel(data.readiness.REENGAGEMENT)}</dd>
|
||||||
</div>
|
</div>
|
||||||
<p className="pt-1 text-xs text-foreground/50">
|
<p className="pt-1 text-xs text-foreground/50">
|
||||||
Los activás en cada grupo. {WEEKLY_SEND_LABEL}
|
{t('card.perGroup')} {weeklySendLabel()}
|
||||||
</p>
|
</p>
|
||||||
</dl>
|
</dl>
|
||||||
</>
|
</>
|
||||||
@@ -116,12 +118,12 @@ export function WhatsappStatusCard() {
|
|||||||
</span>
|
</span>
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<p className="text-sm text-primary">
|
<p className="text-sm text-primary">
|
||||||
{status === 'requires_reconnect' ? 'Volvé a vincular tu número' : 'Vinculá tu número'}
|
{status === 'requires_reconnect' ? t('card.relink') : t('card.linkNumber')}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-foreground/50">
|
<p className="text-xs text-foreground/50">
|
||||||
{linksWithQr(data.provider)
|
{linksWithQr(data.provider)
|
||||||
? 'Lo vinculás con tu número o con un código QR, como WhatsApp Web.'
|
? t('card.qrHint')
|
||||||
: 'Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.'}
|
: t('card.metaHint')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
@@ -135,7 +137,7 @@ export function WhatsappStatusCard() {
|
|||||||
) : (
|
) : (
|
||||||
<BadgeCheck className="size-4" />
|
<BadgeCheck className="size-4" />
|
||||||
)}
|
)}
|
||||||
{connection.isStarting ? 'Abriendo…' : 'Vincular'}
|
{connection.isStarting ? t('card.opening') : t('card.connect')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -154,13 +156,13 @@ export function WhatsappStatusCard() {
|
|||||||
<Modal
|
<Modal
|
||||||
isOpen={isConfirmingDisconnect}
|
isOpen={isConfirmingDisconnect}
|
||||||
onClose={() => setIsConfirmingDisconnect(false)}
|
onClose={() => setIsConfirmingDisconnect(false)}
|
||||||
title="Desvincular WhatsApp"
|
title={t('disconnect.title')}
|
||||||
description="Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular."
|
description={t('disconnect.description')}
|
||||||
maxWidth="sm"
|
maxWidth="sm"
|
||||||
>
|
>
|
||||||
<div className="flex justify-end gap-3">
|
<div className="flex justify-end gap-3">
|
||||||
<Button variant="outline" onClick={() => setIsConfirmingDisconnect(false)}>
|
<Button variant="outline" onClick={() => setIsConfirmingDisconnect(false)}>
|
||||||
Cancelar
|
{t('common:actions.cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
@@ -171,7 +173,7 @@ export function WhatsappStatusCard() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isDisconnecting ? <Loader2 className="size-4 animate-spin" /> : null}
|
{isDisconnecting ? <Loader2 className="size-4 animate-spin" /> : null}
|
||||||
Desvincular
|
{t('disconnect.confirm')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ import type {
|
|||||||
WhatsappReadiness,
|
WhatsappReadiness,
|
||||||
WhatsappStatusDto,
|
WhatsappStatusDto,
|
||||||
} from '@gruperly/shared'
|
} from '@gruperly/shared'
|
||||||
|
import { i18n } from '../../i18n/instance'
|
||||||
|
|
||||||
/* Copy de WhatsApp en un solo lugar: el paso del onboarding, la tarjeta de
|
/* Copy de WhatsApp en un solo lugar: el paso del onboarding, la tarjeta de
|
||||||
Ajustes y las automatizaciones del grupo dicen exactamente lo mismo. Las
|
Ajustes y las automatizaciones del grupo dicen exactamente lo mismo. Las
|
||||||
funciones son puras para cubrirlas con tests sin renderizar nada. */
|
funciones son puras para cubrirlas con tests sin renderizar nada. */
|
||||||
|
|
||||||
export const WHATSAPP_CONNECT_ERROR_MESSAGE =
|
export function whatsappConnectErrorMessage(): string {
|
||||||
'No pudimos empezar la vinculación. Revisá tu conexión e intentá de nuevo.'
|
return i18n.t('whatsapp:connectError')
|
||||||
|
}
|
||||||
|
|
||||||
export const WHATSAPP_UNAVAILABLE_MESSAGE =
|
export function whatsappUnavailableMessage(): string {
|
||||||
'La vinculación con WhatsApp no está disponible en este momento.'
|
return i18n.t('whatsapp:unavailable')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mensaje para un fallo al consultar el estado. Solo un 503 significa "WhatsApp
|
* Mensaje para un fallo al consultar el estado. Solo un 503 significa "WhatsApp
|
||||||
@@ -22,13 +25,16 @@ export const WHATSAPP_UNAVAILABLE_MESSAGE =
|
|||||||
* verdad y se muestra con su número para poder rastrearlo.
|
* verdad y se muestra con su número para poder rastrearlo.
|
||||||
*/
|
*/
|
||||||
export function whatsappStatusErrorMessage(httpStatus: number | null): string {
|
export function whatsappStatusErrorMessage(httpStatus: number | null): string {
|
||||||
if (httpStatus === 503) return WHATSAPP_UNAVAILABLE_MESSAGE
|
if (httpStatus === 503) return whatsappUnavailableMessage()
|
||||||
const code = httpStatus ? ` (error ${httpStatus})` : ''
|
return httpStatus
|
||||||
return `No pudimos consultar el estado de tu WhatsApp${code}. Intentá de nuevo en un rato.`
|
? i18n.t('whatsapp:statusErrorCode', { code: httpStatus })
|
||||||
|
: i18n.t('whatsapp:statusError')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Día y hora en que salen los mensajes automáticos (lo fija el job del backend). */
|
/** Día y hora en que salen los mensajes automáticos (lo fija el job del backend). */
|
||||||
export const WEEKLY_SEND_LABEL = 'Se envían los lunes a las 10:00 (hora de Argentina).'
|
export function weeklySendLabel(): string {
|
||||||
|
return i18n.t('whatsapp:weeklySend')
|
||||||
|
}
|
||||||
|
|
||||||
/** El resultado de una vinculación por redirect (Kapso), tal como vuelve en `?wa=`. */
|
/** El resultado de una vinculación por redirect (Kapso), tal como vuelve en `?wa=`. */
|
||||||
export type WhatsappCallbackFeedback =
|
export type WhatsappCallbackFeedback =
|
||||||
@@ -57,28 +63,19 @@ export function readWhatsappCallbackFeedback(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const REASON_MESSAGES: Record<WhatsappCallbackReason, string> = {
|
|
||||||
invalid_setup: 'La vinculación venció o ya se había usado. Volvé a intentarlo.',
|
|
||||||
setup_failed: 'No se pudo terminar la vinculación en Meta. Volvé a intentarlo.',
|
|
||||||
provider_error: 'WhatsApp no pudo completar la vinculación.',
|
|
||||||
number_in_use: 'Ese número de WhatsApp ya está vinculado a otro profesor.',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function whatsappCallbackErrorMessage(reason: WhatsappCallbackReason): string {
|
export function whatsappCallbackErrorMessage(reason: WhatsappCallbackReason): string {
|
||||||
return REASON_MESSAGES[reason]
|
return i18n.t(`whatsapp:reason.${reason}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function whatsappStatusLabel(status: WhatsappAccountStatus): string {
|
export function whatsappStatusLabel(status: WhatsappAccountStatus): string {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'active':
|
case 'active':
|
||||||
return 'Vinculado'
|
|
||||||
case 'pending':
|
case 'pending':
|
||||||
return 'Vinculando…'
|
|
||||||
case 'requires_reconnect':
|
case 'requires_reconnect':
|
||||||
return 'Necesita vincularse de nuevo'
|
return i18n.t(`whatsapp:status.${status}`)
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
case 'none':
|
case 'none':
|
||||||
return 'Sin vincular'
|
return i18n.t('whatsapp:status.none')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,11 +99,9 @@ export function whatsappStatusBadgeVariant(
|
|||||||
export function readinessLabel(readiness: WhatsappReadiness): string {
|
export function readinessLabel(readiness: WhatsappReadiness): string {
|
||||||
switch (readiness) {
|
switch (readiness) {
|
||||||
case 'ready':
|
case 'ready':
|
||||||
return 'Listo para enviar'
|
|
||||||
case 'pending':
|
case 'pending':
|
||||||
return 'En revisión por Meta'
|
|
||||||
case 'blocked':
|
case 'blocked':
|
||||||
return 'No disponible'
|
return i18n.t(`whatsapp:readiness.${readiness}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,14 +141,14 @@ export function automationBlockedReason(
|
|||||||
kind: 'PAYMENT_REMINDER' | 'REENGAGEMENT',
|
kind: 'PAYMENT_REMINDER' | 'REENGAGEMENT',
|
||||||
): string | null {
|
): string | null {
|
||||||
if (!status || status.status !== 'active') {
|
if (!status || status.status !== 'active') {
|
||||||
return 'Vinculá tu WhatsApp en Ajustes para activar los envíos automáticos.'
|
return i18n.t('whatsapp:blocked.notLinked')
|
||||||
}
|
}
|
||||||
switch (status.readiness[kind]) {
|
switch (status.readiness[kind]) {
|
||||||
case 'ready':
|
case 'ready':
|
||||||
return null
|
return null
|
||||||
case 'pending':
|
case 'pending':
|
||||||
return 'Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.'
|
return i18n.t('whatsapp:blocked.pending')
|
||||||
case 'blocked':
|
case 'blocked':
|
||||||
return 'Meta rechazó este mensaje. Escribinos para revisarlo.'
|
return i18n.t('whatsapp:blocked.rejected')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export {
|
|||||||
linksWithQr,
|
linksWithQr,
|
||||||
readinessLabel,
|
readinessLabel,
|
||||||
readWhatsappCallbackFeedback,
|
readWhatsappCallbackFeedback,
|
||||||
WEEKLY_SEND_LABEL,
|
weeklySendLabel,
|
||||||
type WhatsappLinkMethod,
|
type WhatsappLinkMethod,
|
||||||
type WhatsappCallbackFeedback,
|
type WhatsappCallbackFeedback,
|
||||||
whatsappCallbackErrorMessage,
|
whatsappCallbackErrorMessage,
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'
|
|||||||
import { useToast } from '../../components/ui'
|
import { useToast } from '../../components/ui'
|
||||||
import { disconnectWhatsapp } from '../../lib/api'
|
import { disconnectWhatsapp } from '../../lib/api'
|
||||||
import { whatsappStatusQueryKey } from './useWhatsappStatus'
|
import { whatsappStatusQueryKey } from './useWhatsappStatus'
|
||||||
|
import { errorMessage } from '../../i18n'
|
||||||
|
import { i18n } from '../../i18n/instance'
|
||||||
|
|
||||||
export function useDisconnectWhatsapp() {
|
export function useDisconnectWhatsapp() {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
@@ -11,13 +13,13 @@ export function useDisconnectWhatsapp() {
|
|||||||
mutationFn: disconnectWhatsapp,
|
mutationFn: disconnectWhatsapp,
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
if (result.disconnected) {
|
if (result.disconnected) {
|
||||||
toast.success('Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.')
|
toast.success(i18n.t('whatsapp:disconnect.done'))
|
||||||
}
|
}
|
||||||
void queryClient.invalidateQueries({ queryKey: whatsappStatusQueryKey })
|
void queryClient.invalidateQueries({ queryKey: whatsappStatusQueryKey })
|
||||||
void queryClient.invalidateQueries({ queryKey: ['onboarding', 'status'] })
|
void queryClient.invalidateQueries({ queryKey: ['onboarding', 'status'] })
|
||||||
},
|
},
|
||||||
onError: (error: Error) => {
|
onError: (error: Error) => {
|
||||||
toast.error(error.message || 'No pudimos desvincular tu WhatsApp.')
|
toast.error(errorMessage(error, i18n.t('whatsapp:disconnect.error')))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { useMutation } from '@tanstack/react-query'
|
import { useMutation } from '@tanstack/react-query'
|
||||||
import { requestWhatsappPairingCode } from '../../lib/api'
|
import { requestWhatsappPairingCode } from '../../lib/api'
|
||||||
|
import { errorMessage } from '../../i18n'
|
||||||
|
import { i18n } from '../../i18n/instance'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pide el código para vincular con el número de teléfono. La vinculación ya
|
* Pide el código para vincular con el número de teléfono. La vinculación ya
|
||||||
@@ -13,7 +15,7 @@ export function useRequestWhatsappPairingCode() {
|
|||||||
requestCode: (phoneNumber: string) => mutation.mutate(phoneNumber),
|
requestCode: (phoneNumber: string) => mutation.mutate(phoneNumber),
|
||||||
pairingCode: mutation.data?.pairingCode ?? null,
|
pairingCode: mutation.data?.pairingCode ?? null,
|
||||||
isRequesting: mutation.isPending,
|
isRequesting: mutation.isPending,
|
||||||
error: mutation.error ? mutation.error.message || 'No pudimos pedir el código.' : null,
|
error: mutation.error ? errorMessage(mutation.error, i18n.t('whatsapp:pairing.error')) : null,
|
||||||
reset: mutation.reset,
|
reset: mutation.reset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { WhatsappReturnTo } from '@gruperly/shared'
|
|||||||
import { useQueryClient } from '@tanstack/react-query'
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { ApiError, startWhatsappConnection } from '../../lib/api'
|
import { ApiError, startWhatsappConnection } from '../../lib/api'
|
||||||
import { WHATSAPP_CONNECT_ERROR_MESSAGE, WHATSAPP_UNAVAILABLE_MESSAGE } from './copy'
|
import { whatsappConnectErrorMessage, whatsappUnavailableMessage } from './copy'
|
||||||
import { whatsappStatusQueryKey } from './useWhatsappStatus'
|
import { whatsappStatusQueryKey } from './useWhatsappStatus'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,8 +36,8 @@ export function useStartWhatsappConnection() {
|
|||||||
} catch (caught) {
|
} catch (caught) {
|
||||||
setError(
|
setError(
|
||||||
caught instanceof ApiError && caught.status === 503
|
caught instanceof ApiError && caught.status === 503
|
||||||
? WHATSAPP_UNAVAILABLE_MESSAGE
|
? whatsappUnavailableMessage()
|
||||||
: WHATSAPP_CONNECT_ERROR_MESSAGE,
|
: whatsappConnectErrorMessage(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
setIsStarting(false)
|
setIsStarting(false)
|
||||||
|
|||||||
2
apps/web/src/i18n/i18next.d.ts
vendored
2
apps/web/src/i18n/i18next.d.ts
vendored
@@ -16,6 +16,7 @@ import type classAttendance from './locales/es-AR/classAttendance.json'
|
|||||||
import type payments from './locales/es-AR/payments.json'
|
import type payments from './locales/es-AR/payments.json'
|
||||||
import type billing from './locales/es-AR/billing.json'
|
import type billing from './locales/es-AR/billing.json'
|
||||||
import type mp from './locales/es-AR/mp.json'
|
import type mp from './locales/es-AR/mp.json'
|
||||||
|
import type whatsapp from './locales/es-AR/whatsapp.json'
|
||||||
import type validation from './locales/es-AR/validation.json'
|
import type validation from './locales/es-AR/validation.json'
|
||||||
|
|
||||||
// es-AR es la fuente: una clave que no exista ahí rompe el typecheck.
|
// es-AR es la fuente: una clave que no exista ahí rompe el typecheck.
|
||||||
@@ -30,6 +31,7 @@ declare module 'i18next' {
|
|||||||
pwa: typeof pwa
|
pwa: typeof pwa
|
||||||
settings: typeof settings
|
settings: typeof settings
|
||||||
validation: typeof validation
|
validation: typeof validation
|
||||||
|
'whatsapp': typeof whatsapp
|
||||||
'mp': typeof mp
|
'mp': typeof mp
|
||||||
'billing': typeof billing
|
'billing': typeof billing
|
||||||
'payments': typeof payments
|
'payments': typeof payments
|
||||||
|
|||||||
80
apps/web/src/i18n/locales/en/whatsapp.json
Normal file
80
apps/web/src/i18n/locales/en/whatsapp.json
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"connectError": "We couldn't start linking. Check your connection and try again.",
|
||||||
|
"unavailable": "Linking with WhatsApp isn't available right now.",
|
||||||
|
"statusError": "We couldn't check your WhatsApp status. Try again in a bit.",
|
||||||
|
"statusErrorCode": "We couldn't check your WhatsApp status (error {{code}}). Try again in a bit.",
|
||||||
|
"weeklySend": "They're sent on Mondays at 10:00 (Argentina time).",
|
||||||
|
"reason": {
|
||||||
|
"invalid_setup": "The link request expired or was already used. Please try again.",
|
||||||
|
"setup_failed": "We couldn't finish linking on Meta. Please try again.",
|
||||||
|
"provider_error": "WhatsApp couldn't finish linking.",
|
||||||
|
"number_in_use": "That WhatsApp number is already linked to another teacher."
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"active": "Linked",
|
||||||
|
"pending": "Linking…",
|
||||||
|
"requires_reconnect": "Needs relinking",
|
||||||
|
"none": "Not linked"
|
||||||
|
},
|
||||||
|
"readiness": {
|
||||||
|
"ready": "Ready to send",
|
||||||
|
"pending": "Under review by Meta",
|
||||||
|
"blocked": "Unavailable"
|
||||||
|
},
|
||||||
|
"blocked": {
|
||||||
|
"notLinked": "Link your WhatsApp in Settings to turn on automatic messages.",
|
||||||
|
"pending": "Meta is still reviewing the message. It usually takes up to 24 hours.",
|
||||||
|
"rejected": "Meta rejected this message. Contact us so we can review it."
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"done": "Your WhatsApp was unlinked. Automatic messages are paused.",
|
||||||
|
"error": "We couldn't unlink your WhatsApp.",
|
||||||
|
"title": "Unlink WhatsApp",
|
||||||
|
"description": "Automatic reminders and re-engagement messages stop until you link it again.",
|
||||||
|
"confirm": "Unlink"
|
||||||
|
},
|
||||||
|
"pairing": {
|
||||||
|
"error": "We couldn't get the code.",
|
||||||
|
"copy": "Copy code",
|
||||||
|
"step1": "Open WhatsApp. You'll get a notification to link a device: tap it.",
|
||||||
|
"step2": "If it doesn't arrive, tap <strong>Linked devices</strong> → <strong>Link a device</strong> → <strong>Link with phone number instead</strong>.",
|
||||||
|
"step3": "Enter this code. This screen updates on its own.",
|
||||||
|
"waiting": "Waiting for the code…",
|
||||||
|
"otherNumber": "Use another number",
|
||||||
|
"phone": "Your WhatsApp number",
|
||||||
|
"phonePlaceholder": "555 123 4567",
|
||||||
|
"phoneHint": "The one on the phone where you use WhatsApp, with the area code.",
|
||||||
|
"requesting": "Getting code…",
|
||||||
|
"request": "Get code"
|
||||||
|
},
|
||||||
|
"link": {
|
||||||
|
"linked": "All set! Your WhatsApp is linked.",
|
||||||
|
"failed": "Linking didn't finish. Please try again.",
|
||||||
|
"title": "Link your WhatsApp",
|
||||||
|
"phoneDescription": "We'll give you a code to enter in WhatsApp, on the phone where you use it.",
|
||||||
|
"qrDescription": "Scan the code with the phone where you use WhatsApp.",
|
||||||
|
"methodPhone": "With your number",
|
||||||
|
"methodQr": "With a QR code",
|
||||||
|
"qrAlt": "QR code to link WhatsApp",
|
||||||
|
"qrStep1": "Open WhatsApp on your phone.",
|
||||||
|
"qrStep2": "Tap <strong>Linked devices</strong> and then <strong>Link a device</strong>.",
|
||||||
|
"qrStep3": "Point the camera at this code.",
|
||||||
|
"footnote": "Messages will be sent from your number. You can unlink it anytime from Settings or your phone."
|
||||||
|
},
|
||||||
|
"card": {
|
||||||
|
"loading": "Checking your WhatsApp…",
|
||||||
|
"description": "Your number for payment reminders and automatic re-engagement messages.",
|
||||||
|
"linkedNumber": "Linked number",
|
||||||
|
"linkedOn": "Linked on {{date}}",
|
||||||
|
"disconnect": "Unlink",
|
||||||
|
"paymentReminder": "Payment reminder",
|
||||||
|
"reengagement": "Re-engagement message",
|
||||||
|
"perGroup": "You turn them on in each group.",
|
||||||
|
"relink": "Link your number again",
|
||||||
|
"linkNumber": "Link your number",
|
||||||
|
"qrHint": "Link it with your number or a QR code, like WhatsApp Web.",
|
||||||
|
"metaHint": "We'll take you to Meta to connect your WhatsApp Business account.",
|
||||||
|
"opening": "Opening…",
|
||||||
|
"connect": "Link"
|
||||||
|
}
|
||||||
|
}
|
||||||
80
apps/web/src/i18n/locales/es-419/whatsapp.json
Normal file
80
apps/web/src/i18n/locales/es-419/whatsapp.json
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"connectError": "No pudimos empezar la vinculación. Revisa tu conexión e inténtalo de nuevo.",
|
||||||
|
"unavailable": "La vinculación con WhatsApp no está disponible en este momento.",
|
||||||
|
"statusError": "No pudimos consultar el estado de tu WhatsApp. Inténtalo de nuevo en un rato.",
|
||||||
|
"statusErrorCode": "No pudimos consultar el estado de tu WhatsApp (error {{code}}). Inténtalo de nuevo en un rato.",
|
||||||
|
"weeklySend": "Se envían los lunes a las 10:00 (hora de Argentina).",
|
||||||
|
"reason": {
|
||||||
|
"invalid_setup": "La vinculación venció o ya se había usado. Vuelve a intentarlo.",
|
||||||
|
"setup_failed": "No se pudo terminar la vinculación en Meta. Vuelve a intentarlo.",
|
||||||
|
"provider_error": "WhatsApp no pudo completar la vinculación.",
|
||||||
|
"number_in_use": "Ese número de WhatsApp ya está vinculado a otro profesor."
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"active": "Vinculado",
|
||||||
|
"pending": "Vinculando…",
|
||||||
|
"requires_reconnect": "Necesita vincularse de nuevo",
|
||||||
|
"none": "Sin vincular"
|
||||||
|
},
|
||||||
|
"readiness": {
|
||||||
|
"ready": "Listo para enviar",
|
||||||
|
"pending": "En revisión por Meta",
|
||||||
|
"blocked": "No disponible"
|
||||||
|
},
|
||||||
|
"blocked": {
|
||||||
|
"notLinked": "Vincula tu WhatsApp en Ajustes para activar los envíos automáticos.",
|
||||||
|
"pending": "Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.",
|
||||||
|
"rejected": "Meta rechazó este mensaje. Escríbenos para revisarlo."
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"done": "Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.",
|
||||||
|
"error": "No pudimos desvincular tu WhatsApp.",
|
||||||
|
"title": "Desvincular WhatsApp",
|
||||||
|
"description": "Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular.",
|
||||||
|
"confirm": "Desvincular"
|
||||||
|
},
|
||||||
|
"pairing": {
|
||||||
|
"error": "No pudimos pedir el código.",
|
||||||
|
"copy": "Copiar código",
|
||||||
|
"step1": "Abre WhatsApp. Te llegará una notificación para vincular un dispositivo: tócala.",
|
||||||
|
"step2": "Si no te llega, toca <strong>Dispositivos vinculados</strong> → <strong>Vincular un dispositivo</strong> → <strong>Vincular con el número de teléfono</strong>.",
|
||||||
|
"step3": "Ingresa este código. Esta pantalla se actualiza sola.",
|
||||||
|
"waiting": "Esperando el código…",
|
||||||
|
"otherNumber": "Usar otro número",
|
||||||
|
"phone": "Tu número de WhatsApp",
|
||||||
|
"phonePlaceholder": "55 1234 5678",
|
||||||
|
"phoneHint": "El del teléfono donde usas WhatsApp, con la lada.",
|
||||||
|
"requesting": "Pidiendo código…",
|
||||||
|
"request": "Obtener código"
|
||||||
|
},
|
||||||
|
"link": {
|
||||||
|
"linked": "¡Listo! Tu WhatsApp quedó vinculado.",
|
||||||
|
"failed": "La vinculación no se completó. Vuelve a intentarlo.",
|
||||||
|
"title": "Vincula tu WhatsApp",
|
||||||
|
"phoneDescription": "Te damos un código para ingresar en WhatsApp, en el teléfono donde lo usas.",
|
||||||
|
"qrDescription": "Escanea el código con el teléfono donde usas WhatsApp.",
|
||||||
|
"methodPhone": "Con tu número",
|
||||||
|
"methodQr": "Con código QR",
|
||||||
|
"qrAlt": "Código QR para vincular WhatsApp",
|
||||||
|
"qrStep1": "Abre WhatsApp en tu teléfono.",
|
||||||
|
"qrStep2": "Toca <strong>Dispositivos vinculados</strong> y después <strong>Vincular un dispositivo</strong>.",
|
||||||
|
"qrStep3": "Apunta la cámara a este código.",
|
||||||
|
"footnote": "Los mensajes saldrán desde tu número. Puedes desvincularlo cuando quieras desde Ajustes o desde tu teléfono."
|
||||||
|
},
|
||||||
|
"card": {
|
||||||
|
"loading": "Consultando tu WhatsApp…",
|
||||||
|
"description": "Tu número para los recordatorios de pago y los mensajes de reenganche automáticos.",
|
||||||
|
"linkedNumber": "Número vinculado",
|
||||||
|
"linkedOn": "Vinculado el {{date}}",
|
||||||
|
"disconnect": "Desvincular",
|
||||||
|
"paymentReminder": "Recordatorio de pago",
|
||||||
|
"reengagement": "Mensaje de reenganche",
|
||||||
|
"perGroup": "Los activas en cada grupo.",
|
||||||
|
"relink": "Vuelve a vincular tu número",
|
||||||
|
"linkNumber": "Vincula tu número",
|
||||||
|
"qrHint": "Lo vinculas con tu número o con un código QR, como WhatsApp Web.",
|
||||||
|
"metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.",
|
||||||
|
"opening": "Abriendo…",
|
||||||
|
"connect": "Vincular"
|
||||||
|
}
|
||||||
|
}
|
||||||
80
apps/web/src/i18n/locales/es-AR/whatsapp.json
Normal file
80
apps/web/src/i18n/locales/es-AR/whatsapp.json
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"connectError": "No pudimos empezar la vinculación. Revisá tu conexión e intentá de nuevo.",
|
||||||
|
"unavailable": "La vinculación con WhatsApp no está disponible en este momento.",
|
||||||
|
"statusError": "No pudimos consultar el estado de tu WhatsApp. Intentá de nuevo en un rato.",
|
||||||
|
"statusErrorCode": "No pudimos consultar el estado de tu WhatsApp (error {{code}}). Intentá de nuevo en un rato.",
|
||||||
|
"weeklySend": "Se envían los lunes a las 10:00 (hora de Argentina).",
|
||||||
|
"reason": {
|
||||||
|
"invalid_setup": "La vinculación venció o ya se había usado. Volvé a intentarlo.",
|
||||||
|
"setup_failed": "No se pudo terminar la vinculación en Meta. Volvé a intentarlo.",
|
||||||
|
"provider_error": "WhatsApp no pudo completar la vinculación.",
|
||||||
|
"number_in_use": "Ese número de WhatsApp ya está vinculado a otro profesor."
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"active": "Vinculado",
|
||||||
|
"pending": "Vinculando…",
|
||||||
|
"requires_reconnect": "Necesita vincularse de nuevo",
|
||||||
|
"none": "Sin vincular"
|
||||||
|
},
|
||||||
|
"readiness": {
|
||||||
|
"ready": "Listo para enviar",
|
||||||
|
"pending": "En revisión por Meta",
|
||||||
|
"blocked": "No disponible"
|
||||||
|
},
|
||||||
|
"blocked": {
|
||||||
|
"notLinked": "Vinculá tu WhatsApp en Ajustes para activar los envíos automáticos.",
|
||||||
|
"pending": "Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.",
|
||||||
|
"rejected": "Meta rechazó este mensaje. Escribinos para revisarlo."
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"done": "Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.",
|
||||||
|
"error": "No pudimos desvincular tu WhatsApp.",
|
||||||
|
"title": "Desvincular WhatsApp",
|
||||||
|
"description": "Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular.",
|
||||||
|
"confirm": "Desvincular"
|
||||||
|
},
|
||||||
|
"pairing": {
|
||||||
|
"error": "No pudimos pedir el código.",
|
||||||
|
"copy": "Copiar código",
|
||||||
|
"step1": "Abrí WhatsApp. Te va a llegar una notificación para vincular un dispositivo: tocala.",
|
||||||
|
"step2": "Si no te llega, tocá <strong>Dispositivos vinculados</strong> → <strong>Vincular un dispositivo</strong> → <strong>Vincular con el número de teléfono</strong>.",
|
||||||
|
"step3": "Ingresá este código. Esta pantalla se actualiza sola.",
|
||||||
|
"waiting": "Esperando el código…",
|
||||||
|
"otherNumber": "Usar otro número",
|
||||||
|
"phone": "Tu número de WhatsApp",
|
||||||
|
"phonePlaceholder": "11 2345-6789",
|
||||||
|
"phoneHint": "El del teléfono donde usás WhatsApp, con el código de área.",
|
||||||
|
"requesting": "Pidiendo código…",
|
||||||
|
"request": "Obtener código"
|
||||||
|
},
|
||||||
|
"link": {
|
||||||
|
"linked": "¡Listo! Tu WhatsApp quedó vinculado.",
|
||||||
|
"failed": "La vinculación no se completó. Volvé a intentarlo.",
|
||||||
|
"title": "Vinculá tu WhatsApp",
|
||||||
|
"phoneDescription": "Te damos un código para ingresar en WhatsApp, en el teléfono donde lo usás.",
|
||||||
|
"qrDescription": "Escaneá el código con el teléfono donde usás WhatsApp.",
|
||||||
|
"methodPhone": "Con tu número",
|
||||||
|
"methodQr": "Con código QR",
|
||||||
|
"qrAlt": "Código QR para vincular WhatsApp",
|
||||||
|
"qrStep1": "Abrí WhatsApp en tu teléfono.",
|
||||||
|
"qrStep2": "Tocá <strong>Dispositivos vinculados</strong> y después <strong>Vincular un dispositivo</strong>.",
|
||||||
|
"qrStep3": "Apuntá la cámara a este código.",
|
||||||
|
"footnote": "Los mensajes van a salir desde tu número. Podés desvincularlo cuando quieras desde Ajustes o desde tu teléfono."
|
||||||
|
},
|
||||||
|
"card": {
|
||||||
|
"loading": "Consultando tu WhatsApp…",
|
||||||
|
"description": "Tu número para los recordatorios de pago y los mensajes de reenganche automáticos.",
|
||||||
|
"linkedNumber": "Número vinculado",
|
||||||
|
"linkedOn": "Vinculado el {{date}}",
|
||||||
|
"disconnect": "Desvincular",
|
||||||
|
"paymentReminder": "Recordatorio de pago",
|
||||||
|
"reengagement": "Mensaje de reenganche",
|
||||||
|
"perGroup": "Los activás en cada grupo.",
|
||||||
|
"relink": "Volvé a vincular tu número",
|
||||||
|
"linkNumber": "Vinculá tu número",
|
||||||
|
"qrHint": "Lo vinculás con tu número o con un código QR, como WhatsApp Web.",
|
||||||
|
"metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.",
|
||||||
|
"opening": "Abriendo…",
|
||||||
|
"connect": "Vincular"
|
||||||
|
}
|
||||||
|
}
|
||||||
80
apps/web/src/i18n/locales/pt-BR/whatsapp.json
Normal file
80
apps/web/src/i18n/locales/pt-BR/whatsapp.json
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"connectError": "Não conseguimos iniciar a vinculação. Verifique sua conexão e tente novamente.",
|
||||||
|
"unavailable": "A vinculação com o WhatsApp não está disponível no momento.",
|
||||||
|
"statusError": "Não conseguimos consultar o status do seu WhatsApp. Tente novamente daqui a pouco.",
|
||||||
|
"statusErrorCode": "Não conseguimos consultar o status do seu WhatsApp (erro {{code}}). Tente novamente daqui a pouco.",
|
||||||
|
"weeklySend": "São enviadas às segundas-feiras às 10:00 (horário da Argentina).",
|
||||||
|
"reason": {
|
||||||
|
"invalid_setup": "A vinculação expirou ou já tinha sido usada. Tente novamente.",
|
||||||
|
"setup_failed": "Não foi possível concluir a vinculação na Meta. Tente novamente.",
|
||||||
|
"provider_error": "O WhatsApp não conseguiu concluir a vinculação.",
|
||||||
|
"number_in_use": "Esse número de WhatsApp já está vinculado a outro professor."
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"active": "Vinculado",
|
||||||
|
"pending": "Vinculando…",
|
||||||
|
"requires_reconnect": "Precisa vincular de novo",
|
||||||
|
"none": "Não vinculado"
|
||||||
|
},
|
||||||
|
"readiness": {
|
||||||
|
"ready": "Pronto para enviar",
|
||||||
|
"pending": "Em análise pela Meta",
|
||||||
|
"blocked": "Indisponível"
|
||||||
|
},
|
||||||
|
"blocked": {
|
||||||
|
"notLinked": "Vincule seu WhatsApp em Ajustes para ativar os envios automáticos.",
|
||||||
|
"pending": "A Meta ainda está analisando a mensagem. Costuma levar até 24 horas.",
|
||||||
|
"rejected": "A Meta recusou esta mensagem. Fale com a gente para revisá-la."
|
||||||
|
},
|
||||||
|
"disconnect": {
|
||||||
|
"done": "Desvinculamos seu WhatsApp. Os envios automáticos ficam pausados.",
|
||||||
|
"error": "Não conseguimos desvincular seu WhatsApp.",
|
||||||
|
"title": "Desvincular WhatsApp",
|
||||||
|
"description": "Os lembretes e as mensagens de reengajamento automáticas deixam de ser enviados até você vincular de novo.",
|
||||||
|
"confirm": "Desvincular"
|
||||||
|
},
|
||||||
|
"pairing": {
|
||||||
|
"error": "Não conseguimos pedir o código.",
|
||||||
|
"copy": "Copiar código",
|
||||||
|
"step1": "Abra o WhatsApp. Você vai receber uma notificação para vincular um dispositivo: toque nela.",
|
||||||
|
"step2": "Se não chegar, toque em <strong>Dispositivos conectados</strong> → <strong>Conectar um dispositivo</strong> → <strong>Conectar com número de telefone</strong>.",
|
||||||
|
"step3": "Digite este código. Esta tela se atualiza sozinha.",
|
||||||
|
"waiting": "Aguardando o código…",
|
||||||
|
"otherNumber": "Usar outro número",
|
||||||
|
"phone": "Seu número de WhatsApp",
|
||||||
|
"phonePlaceholder": "11 91234-5678",
|
||||||
|
"phoneHint": "O do celular onde você usa o WhatsApp, com DDD.",
|
||||||
|
"requesting": "Pedindo código…",
|
||||||
|
"request": "Obter código"
|
||||||
|
},
|
||||||
|
"link": {
|
||||||
|
"linked": "Pronto! Seu WhatsApp foi vinculado.",
|
||||||
|
"failed": "A vinculação não foi concluída. Tente novamente.",
|
||||||
|
"title": "Vincule seu WhatsApp",
|
||||||
|
"phoneDescription": "Damos um código para você digitar no WhatsApp, no celular onde você usa.",
|
||||||
|
"qrDescription": "Escaneie o código com o celular onde você usa o WhatsApp.",
|
||||||
|
"methodPhone": "Com seu número",
|
||||||
|
"methodQr": "Com QR code",
|
||||||
|
"qrAlt": "QR code para vincular o WhatsApp",
|
||||||
|
"qrStep1": "Abra o WhatsApp no seu celular.",
|
||||||
|
"qrStep2": "Toque em <strong>Dispositivos conectados</strong> e depois em <strong>Conectar um dispositivo</strong>.",
|
||||||
|
"qrStep3": "Aponte a câmera para este código.",
|
||||||
|
"footnote": "As mensagens vão sair do seu número. Você pode desvincular quando quiser em Ajustes ou pelo celular."
|
||||||
|
},
|
||||||
|
"card": {
|
||||||
|
"loading": "Consultando seu WhatsApp…",
|
||||||
|
"description": "Seu número para os lembretes de pagamento e as mensagens automáticas de reengajamento.",
|
||||||
|
"linkedNumber": "Número vinculado",
|
||||||
|
"linkedOn": "Vinculado em {{date}}",
|
||||||
|
"disconnect": "Desvincular",
|
||||||
|
"paymentReminder": "Lembrete de pagamento",
|
||||||
|
"reengagement": "Mensagem de reengajamento",
|
||||||
|
"perGroup": "Você ativa em cada grupo.",
|
||||||
|
"relink": "Vincule seu número de novo",
|
||||||
|
"linkNumber": "Vincule seu número",
|
||||||
|
"qrHint": "Você vincula com seu número ou com um QR code, como no WhatsApp Web.",
|
||||||
|
"metaHint": "Vamos te levar à Meta para conectar sua conta do WhatsApp Business.",
|
||||||
|
"opening": "Abrindo…",
|
||||||
|
"connect": "Vincular"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
readinessLabel,
|
readinessLabel,
|
||||||
readWhatsappCallbackFeedback,
|
readWhatsappCallbackFeedback,
|
||||||
whatsappCallbackErrorMessage,
|
whatsappCallbackErrorMessage,
|
||||||
WHATSAPP_UNAVAILABLE_MESSAGE,
|
whatsappUnavailableMessage,
|
||||||
whatsappStatusBadgeVariant,
|
whatsappStatusBadgeVariant,
|
||||||
whatsappStatusErrorMessage,
|
whatsappStatusErrorMessage,
|
||||||
whatsappStatusLabel,
|
whatsappStatusLabel,
|
||||||
@@ -85,7 +85,7 @@ describe('automationBlockedReason', () => {
|
|||||||
|
|
||||||
describe('whatsappStatusErrorMessage', () => {
|
describe('whatsappStatusErrorMessage', () => {
|
||||||
test('solo un 503 dice que no está disponible', () => {
|
test('solo un 503 dice que no está disponible', () => {
|
||||||
expect(whatsappStatusErrorMessage(503)).toBe(WHATSAPP_UNAVAILABLE_MESSAGE)
|
expect(whatsappStatusErrorMessage(503)).toBe(whatsappUnavailableMessage())
|
||||||
})
|
})
|
||||||
|
|
||||||
test('otro error muestra su código', () => {
|
test('otro error muestra su código', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user