Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions components/Referral/ReferralFriendRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ interface StagePresentation {
interface ReferralFriendRowProps {
item: ReferralRewardListItem;
index: number;
/** Program-level targets, for rows the API sends without their own bar. */
spendTargetUsd: number;
merchantTarget: number;
/** Called when a countdown reaches zero, so the screen can re-fetch. */
Expand All @@ -157,10 +158,15 @@ interface ReferralFriendRowProps {
export default function ReferralFriendRow({
item,
index,
spendTargetUsd,
merchantTarget,
spendTargetUsd: programSpendTargetUsd,
merchantTarget: programMerchantTarget,
onPayoutDue,
}: ReferralFriendRowProps) {
// The row's own bar when the API sends one: a friend who qualified before the
// target moved is measured against the bar they cleared, not today's.
const spendTargetUsd = item.spendTargetUsd ?? programSpendTargetUsd;
const merchantTarget = item.merchantTarget ?? programMerchantTarget;

const countdown = useReferralCountdown(
item.stage === ReferralFriendStage.REWARD_UNLOCKING ? item.payoutEtaAt : null,
);
Expand Down
9 changes: 9 additions & 0 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3034,6 +3034,15 @@ export interface ReferralRewardListItem {
paidAt?: string;
spendUsd: number;
merchantCount: number;
/**
* The bar this row is measured against. For a friend who has qualified it is
* the bar they cleared, which can be lower than today's — the target moved
* from $75 to $150 while rewards were still in their payout delay, and
* "$80/$150 spent" next to "Qualified" reads as a mistake. Absent on backends
* that predate it, where the program-level target applies.
*/
spendTargetUsd?: number;
merchantTarget?: number;
hasActiveCard: boolean;
rewardUsd: number;
/**
Expand Down
Loading