import { useState, useCallback, useRef, useEffect } from 'react'; import { useParams } from 'react-router'; import { useQuery } from '@tanstack/react-query'; import { useTranslation } from 'react-i18next'; import { motion } from 'framer-motion'; import { QRCodeSVG } from 'qrcode.react'; import { landingApi } from '../api/landings'; import { copyToClipboard } from '../utils/clipboard'; import { cn } from '../lib/utils'; const MAX_POLL_MS = 10 * 60 * 1000; // 10 minutes // ============================================================ // Sub-components // ============================================================ function Spinner({ className }: { className?: string }) { return (
); } function PendingState() { const { t } = useTranslation(); return ({t('landing.awaitingPaymentDesc')}
{tariffName} — {periodDays} {t('landing.daysAccess')}
)} {contactValue && ({isGift ? t('landing.giftSentTo', { contact: contactValue }) : t('landing.keySentTo', { contact: contactValue })}
)}{t('landing.purchaseFailedDesc')}
{t( 'landing.pollTimedOutDesc', 'Payment processing is taking longer than usual. You can try checking again.', )}