diff --git a/src/pages/GiftResult.tsx b/src/pages/GiftResult.tsx index 8425b5e..44c9126 100644 --- a/src/pages/GiftResult.tsx +++ b/src/pages/GiftResult.tsx @@ -9,10 +9,6 @@ import { AnimatedCheckmark } from '@/components/ui/AnimatedCheckmark'; import { AnimatedCrossmark } from '@/components/ui/AnimatedCrossmark'; import { cn } from '@/lib/utils'; -function formatGiftCode(token: string): string { - return `GIFT-${token.slice(0, 12)}`; -} - const MAX_POLL_MS = 10 * 60 * 1000; // 10 minutes const KNOWN_WARNINGS = new Set(['telegram_unresolvable']); @@ -56,12 +52,11 @@ function CodeOnlySuccessState({ const navigate = useNavigate(); const [copied, setCopied] = useState(false); - const giftCode = formatGiftCode(purchaseToken); + const shortCode = purchaseToken.slice(0, 12); + const giftCode = `GIFT-${shortCode}`; const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined; - const botLink = botUsername - ? `https://t.me/${botUsername}?start=GIFTCODE_${purchaseToken}` - : null; - const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${purchaseToken}`; + const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${shortCode}` : null; + const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${shortCode}`; const fullMessage = [ t('gift.shareText', 'I have a gift for you! Activate it here:'), diff --git a/src/pages/GiftSubscription.tsx b/src/pages/GiftSubscription.tsx index 33b089f..3cd4bbe 100644 --- a/src/pages/GiftSubscription.tsx +++ b/src/pages/GiftSubscription.tsx @@ -982,9 +982,10 @@ function ShareModal({ gift, onClose }: { gift: SentGift; onClose: () => void }) }; }, [onClose]); + const shortCode = gift.token.slice(0, 12); const botUsername = import.meta.env.VITE_TELEGRAM_BOT_USERNAME as string | undefined; - const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${gift.token}` : null; - const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${gift.token}`; + const botLink = botUsername ? `https://t.me/${botUsername}?start=GIFTCODE_${shortCode}` : null; + const cabinetLink = `${window.location.origin}/gift?tab=activate&code=${shortCode}`; const fullMessage = [ t('gift.shareText'),