feat: Affiliate program enrichment (Link Builder, Curated Collections, Smart Links)

This commit is contained in:
Dwindi Ramadhana
2026-06-03 14:04:17 +07:00
parent fd8eb38512
commit f8c733832e
22 changed files with 1348 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { api } from '@/lib/api/client';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Copy, CheckCircle, Activity, DollarSign, ChevronRight, Clock, Info, Wallet, CreditCard } from 'lucide-react';
import { Copy, CheckCircle, Activity, DollarSign, ChevronRight, Clock, Info, Wallet, CreditCard, Tag } from 'lucide-react';
import { toast } from 'sonner';
import { Link } from 'react-router-dom';
import { formatPrice, getCurrencySettings } from '@/lib/currency';
@@ -17,6 +17,7 @@ interface AffiliateProfile {
global_commission_rate: number;
total_earnings: number;
pending_earnings: number;
collections_enabled?: boolean;
}
interface PaginatedReferrals {
@@ -430,7 +431,25 @@ export default function AffiliateDashboard() {
{/* Referral Link */}
<div className="bg-white p-6 rounded-lg border">
<h3 className="text-lg font-semibold mb-4">Your Referral Link</h3>
<div className="flex items-center justify-between mb-4">
<h3 className="text-lg font-semibold">Your Referral Link</h3>
<div className="flex items-center gap-4">
{profile?.collections_enabled !== false && (
<Link
to="/my-account/affiliate/collections"
className="text-sm font-medium text-primary hover:opacity-80 flex items-center"
>
My Collections & Smart Links <ChevronRight className="w-4 h-4 ml-1" />
</Link>
)}
<Link
to="/my-account/affiliate/links"
className="text-sm font-medium text-primary hover:opacity-80 flex items-center"
>
Build Links <ChevronRight className="w-4 h-4 ml-1" />
</Link>
</div>
</div>
<div className="flex gap-2">
<Input
value={referralLink}
@@ -509,6 +528,12 @@ export default function AffiliateDashboard() {
})}
</span>
)}
{(ref.utm_campaign || ref.utm_source) && (
<span className="flex items-center gap-1 text-purple-600">
<Tag className="w-3 h-3" />
{[ref.utm_campaign, ref.utm_source].filter(Boolean).join(' / ')}
</span>
)}
</div>
</div>
<div className="text-right">