fix(gift): cabinet GiftResult shows claim link for directed gifts + review fixes

Pairs with the backend cabinet-unification. Directed cabinet gifts now stay
PAID/claimable, so the buyer's GiftResult must show the share link for them too.

- GiftResult.tsx: render the share state (and stop polling) for ANY claimable
  paid gift via is_claimable, not just is_code_only.
- api/gift.ts: GiftPurchaseStatus gains is_claimable.
- GiftClaim.tsx: explicit failed/expired state (was falling into the 'almost
  ready' spinner forever).
- PurchaseSuccess.tsx: a paid gift is always claimable — stop polling and show
  the share block on `paid && is_gift` (don't gate on is_claimable, which could
  strand the buyer on a spinner).
- i18n: landing.giftClaim.failedTitle/failedDesc in ru/en/zh/fa.
This commit is contained in:
c0mrade
2026-06-03 14:34:19 +03:00
parent db31d395cd
commit b9521f1aa7
8 changed files with 43 additions and 17 deletions

View File

@@ -476,8 +476,9 @@ export default function GiftResult() {
const s = d?.status;
if (s === 'delivered' || s === 'failed' || s === 'pending_activation' || s === 'expired')
return false;
// Code-only gifts stay in 'paid' status — stop polling
if (s === 'paid' && d?.is_code_only) return false;
// Claimable gifts (code-only AND directed) stay in 'paid' until claimed —
// stop polling; the buyer shares the link.
if (s === 'paid' && d?.is_claimable) return false;
// Check poll timeout
if (Date.now() - pollStart.current > MAX_POLL_MS) {
@@ -511,8 +512,8 @@ export default function GiftResult() {
);
}
const isCodeOnlyPaid =
status?.status === 'paid' && status?.is_code_only && status?.purchase_token != null;
const isClaimablePaid =
status?.status === 'paid' && status?.is_claimable && status?.purchase_token != null;
const isDelivered = status?.status === 'delivered';
const isPendingActivation = status?.status === 'pending_activation';
const isFailed = status?.status === 'failed' || status?.status === 'expired';
@@ -531,7 +532,7 @@ export default function GiftResult() {
>
{isError ? (
<PollErrorState />
) : isCodeOnlyPaid ? (
) : isClaimablePaid ? (
<CodeOnlySuccessState
purchaseToken={status.purchase_token!}
tariffName={status.tariff_name}