After changing about commission dispatch2
This commit is contained in:
parent
88f567e3ed
commit
09038f0af2
@ -7,6 +7,7 @@ import type { ReferralCommissionPayoutRow, ReferralProgramSettings } from '../re
|
||||
import * as bonusPoolRepository from '../repositories/bonusPoolRepository';
|
||||
import * as ledgerRepository from '../repositories/ledgerRepository';
|
||||
import * as userRepository from '../repositories/userRepository';
|
||||
import * as walletRepository from '../repositories/walletRepository';
|
||||
import * as auditLogRepository from '../repositories/auditLogRepository';
|
||||
import { query } from '../db/connection';
|
||||
import { queueUserAdminStatsRefresh } from './userAdminStatsService';
|
||||
@ -1388,7 +1389,15 @@ export async function getUserReferralInfo(userId: string): Promise<{
|
||||
export async function getProgramSettingsForAdmin() {
|
||||
const settings = await referralRepository.getSettings();
|
||||
const levels = await referralRepository.listLevels();
|
||||
const pools = await bonusPoolRepository.listPools();
|
||||
const [pools, walletTypes] = await Promise.all([
|
||||
bonusPoolRepository.listPools(),
|
||||
walletRepository.getWalletTypes(),
|
||||
]);
|
||||
const walletTypeById = new Map(walletTypes.map((wt) => [wt.id, wt]));
|
||||
|
||||
const formatWalletLabel = (wt: { code: string; name: string; network: string }) =>
|
||||
`${wt.name} (${wt.code}${wt.network ? ` · ${wt.network}` : ''})`;
|
||||
|
||||
return {
|
||||
settings: {
|
||||
enabled: settings.enabled,
|
||||
@ -1421,9 +1430,23 @@ export async function getProgramSettingsForAdmin() {
|
||||
monthlyMaxAmountRaw: l.monthly_max_amount_raw,
|
||||
monthlyMaxCount: l.monthly_max_count,
|
||||
})),
|
||||
pools: pools.map((p) => ({
|
||||
walletTypeId: p.wallet_type_id,
|
||||
availableBalance: p.available_balance,
|
||||
walletTypes: walletTypes.map((wt) => ({
|
||||
id: wt.id,
|
||||
code: wt.code,
|
||||
name: wt.name,
|
||||
network: wt.network,
|
||||
label: formatWalletLabel(wt),
|
||||
})),
|
||||
pools: pools.map((p) => {
|
||||
const wt = walletTypeById.get(p.wallet_type_id);
|
||||
return {
|
||||
walletTypeId: p.wallet_type_id,
|
||||
availableBalance: p.available_balance,
|
||||
code: wt?.code ?? null,
|
||||
name: wt?.name ?? null,
|
||||
network: wt?.network ?? null,
|
||||
label: wt ? formatWalletLabel(wt) : `Wallet #${p.wallet_type_id}`,
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
@ -8,7 +8,11 @@ import {
|
||||
Card,
|
||||
CardContent,
|
||||
Chip,
|
||||
FormControl,
|
||||
FormControlLabel,
|
||||
InputLabel,
|
||||
MenuItem,
|
||||
Select,
|
||||
Stack,
|
||||
Switch,
|
||||
Table,
|
||||
@ -22,11 +26,19 @@ import {
|
||||
import GroupAddRoundedIcon from '@mui/icons-material/GroupAddRounded';
|
||||
import { Link as RouterLink } from 'react-router-dom';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { api } from '../../shared/services/api';
|
||||
import { ScrollableTable } from '../../shared/components/ScrollableTable';
|
||||
|
||||
type WalletTypeOption = {
|
||||
id: number;
|
||||
code: string;
|
||||
name: string;
|
||||
network: string;
|
||||
label: string;
|
||||
};
|
||||
|
||||
type ReferralConfig = {
|
||||
settings: {
|
||||
enabled: boolean;
|
||||
@ -58,7 +70,15 @@ type ReferralConfig = {
|
||||
monthlyMaxAmountRaw: string;
|
||||
monthlyMaxCount: number;
|
||||
}>;
|
||||
pools: Array<{ walletTypeId: number; availableBalance: string }>;
|
||||
walletTypes: WalletTypeOption[];
|
||||
pools: Array<{
|
||||
walletTypeId: number;
|
||||
availableBalance: string;
|
||||
code: string | null;
|
||||
name: string | null;
|
||||
network: string | null;
|
||||
label: string;
|
||||
}>;
|
||||
};
|
||||
|
||||
type ReferralStats = {
|
||||
@ -99,7 +119,7 @@ export function ReferralAdminPage() {
|
||||
monthlyMaxAmountRaw: '0',
|
||||
monthlyMaxCount: '0',
|
||||
});
|
||||
const [fundForm, setFundForm] = useState({ walletTypeId: '2', amountDisplay: '' });
|
||||
const [fundForm, setFundForm] = useState({ walletTypeId: '', amountDisplay: '' });
|
||||
const [settingsForm, setSettingsForm] = useState<ReferralConfig['settings'] | null>(null);
|
||||
const [rejectReasons, setRejectReasons] = useState<Record<string, string>>({});
|
||||
const [fundPendingMsg, setFundPendingMsg] = useState<string | null>(null);
|
||||
@ -113,6 +133,19 @@ export function ReferralAdminPage() {
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!configQ.data) return;
|
||||
setFundForm((f) => {
|
||||
if (f.walletTypeId) return f;
|
||||
const cfg = configQ.data;
|
||||
const preferred =
|
||||
cfg.settings.commissionWalletTypeId ||
|
||||
cfg.pools[0]?.walletTypeId ||
|
||||
cfg.walletTypes[0]?.id;
|
||||
return preferred ? { ...f, walletTypeId: String(preferred) } : f;
|
||||
});
|
||||
}, [configQ.data]);
|
||||
|
||||
const statsQ = useQuery({
|
||||
queryKey: ['admin-referral-stats'],
|
||||
queryFn: async () => {
|
||||
@ -225,6 +258,11 @@ export function ReferralAdminPage() {
|
||||
const config = configQ.data;
|
||||
const stats = statsQ.data;
|
||||
const s = settingsForm ?? config?.settings;
|
||||
const walletTypeOptions = config?.walletTypes ?? [];
|
||||
const predictionOn = Boolean(s?.predictionCommissionsEnabled);
|
||||
const depositOn = Boolean(s?.depositCommissionsEnabled);
|
||||
const withdrawalOn = Boolean(s?.withdrawalCommissionsEnabled);
|
||||
const anyCommissionMode = predictionOn || depositOn || withdrawalOn;
|
||||
|
||||
return (
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
@ -304,35 +342,7 @@ export function ReferralAdminPage() {
|
||||
}
|
||||
label={t('admin.referralAdmin.referredVerified')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.commissionHold')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionHoldDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, commissionHoldDays: Number(e.target.value) || 0 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.commissionHoldHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.minPredictions')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.minReferredPredictions}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, minReferredPredictions: Number(e.target.value) || 0 })
|
||||
}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxPendingDays')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionMaxPendingDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, commissionMaxPendingDays: Number(e.target.value) || 1 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.maxPendingHelper')}
|
||||
/>
|
||||
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 1 }}>
|
||||
{t('admin.referralAdmin.commissionModes')}
|
||||
</Typography>
|
||||
@ -372,88 +382,263 @@ export function ReferralAdminPage() {
|
||||
}
|
||||
label={t('admin.referralAdmin.withdrawalCommissions')}
|
||||
/>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 1 }}>
|
||||
{t('admin.referralAdmin.slackAlerts')}
|
||||
</Typography>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={s.slackAlertsEnabled ?? true}
|
||||
|
||||
{!anyCommissionMode && (
|
||||
<Alert severity="info">{t('admin.referralAdmin.noModeSelected')}</Alert>
|
||||
)}
|
||||
|
||||
{predictionOn && (
|
||||
<Box
|
||||
sx={{
|
||||
p: 2,
|
||||
borderRadius: 2,
|
||||
border: '1px solid',
|
||||
borderColor: 'divider',
|
||||
bgcolor: 'action.hover',
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 800, mb: 0.5 }}>
|
||||
{t('admin.referralAdmin.predictionSectionTitle')}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t('admin.referralAdmin.predictionSectionHelper')}
|
||||
</Typography>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{depositOn && (
|
||||
<Box
|
||||
sx={{
|
||||
p: 2,
|
||||
borderRadius: 2,
|
||||
border: '1px solid',
|
||||
borderColor: 'divider',
|
||||
bgcolor: 'action.hover',
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 800, mb: 1.5 }}>
|
||||
{t('admin.referralAdmin.depositSectionTitle')}
|
||||
</Typography>
|
||||
<Stack spacing={2}>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t('admin.referralAdmin.depositSectionHelper')}
|
||||
</Typography>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.minFirstDeposit')}
|
||||
fullWidth
|
||||
value={s.minFirstDepositRaw}
|
||||
onChange={(e) => setSettingsForm({ ...s, minFirstDepositRaw: e.target.value })}
|
||||
helperText={t('admin.referralAdmin.minFirstDepositHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.commissionHold')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionHoldDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, commissionHoldDays: Number(e.target.value) || 0 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.commissionHoldHelperDeposit')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.minPredictions')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.minReferredPredictions}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
minReferredPredictions: Number(e.target.value) || 0,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.minPredictionsHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxPendingDays')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionMaxPendingDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
commissionMaxPendingDays: Number(e.target.value) || 1,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.maxPendingHelper')}
|
||||
/>
|
||||
</Stack>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{withdrawalOn && (
|
||||
<Box
|
||||
sx={{
|
||||
p: 2,
|
||||
borderRadius: 2,
|
||||
border: '1px solid',
|
||||
borderColor: 'divider',
|
||||
bgcolor: 'action.hover',
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 800, mb: 1.5 }}>
|
||||
{t('admin.referralAdmin.withdrawalSectionTitle')}
|
||||
</Typography>
|
||||
<Stack spacing={2}>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t('admin.referralAdmin.withdrawalSectionHelper')}
|
||||
</Typography>
|
||||
{!depositOn && (
|
||||
<>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.commissionHold')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionHoldDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
commissionHoldDays: Number(e.target.value) || 0,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.commissionHoldHelperWithdrawal')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.minPredictions')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.minReferredPredictions}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
minReferredPredictions: Number(e.target.value) || 0,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.minPredictionsHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxPendingDays')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionMaxPendingDays}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
commissionMaxPendingDays: Number(e.target.value) || 1,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.maxPendingHelper')}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{depositOn && (
|
||||
<Alert severity="info" sx={{ py: 0.5 }}>
|
||||
{t('admin.referralAdmin.legacySharedWithDeposit')}
|
||||
</Alert>
|
||||
)}
|
||||
</Stack>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{anyCommissionMode && (
|
||||
<>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 1 }}>
|
||||
{t('admin.referralAdmin.sharedPayoutRules')}
|
||||
</Typography>
|
||||
<Typography variant="caption" color="text.secondary" sx={{ display: 'block', mt: -0.5 }}>
|
||||
{t('admin.referralAdmin.sharedPayoutRulesHelper')}
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 0.5 }}>
|
||||
{t('admin.referralAdmin.slackAlerts')}
|
||||
</Typography>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={s.slackAlertsEnabled ?? true}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, slackAlertsEnabled: e.target.checked })
|
||||
}
|
||||
/>
|
||||
}
|
||||
label={t('admin.referralAdmin.slackEnabled')}
|
||||
/>
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="text.secondary"
|
||||
sx={{ display: 'block', mt: -1, mb: 1 }}
|
||||
>
|
||||
{t('admin.referralAdmin.slackHint')}
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 1 }}>
|
||||
{t('admin.referralAdmin.sybilSection')}
|
||||
</Typography>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={s.sybilDetectionEnabled}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, sybilDetectionEnabled: e.target.checked })
|
||||
}
|
||||
/>
|
||||
}
|
||||
label={t('admin.referralAdmin.sybilEnabled')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.sybilReview')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.sybilReviewThreshold}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, slackAlertsEnabled: e.target.checked })
|
||||
setSettingsForm({ ...s, sybilReviewThreshold: Number(e.target.value) || 0 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.sybilReviewHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.sybilBlock')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.sybilBlockThreshold}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, sybilBlockThreshold: Number(e.target.value) || 1 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.sybilBlockHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxAmountMonth')}
|
||||
fullWidth
|
||||
value={s.maxCommissionAmountPerReferrerMonthRaw}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
maxCommissionAmountPerReferrerMonthRaw: e.target.value,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.maxAmountHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxCountMonth')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.maxCommissionsPerReferrerMonth}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
maxCommissionsPerReferrerMonth: Number(e.target.value) || 0,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.unlimitedHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxReferralsDay')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.maxReferralsPerDay}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, maxReferralsPerDay: Number(e.target.value) || 1 })
|
||||
}
|
||||
/>
|
||||
}
|
||||
label={t('admin.referralAdmin.slackEnabled')}
|
||||
/>
|
||||
<Typography variant="caption" color="text.secondary" sx={{ display: 'block', mt: -1, mb: 1 }}>
|
||||
{t('admin.referralAdmin.slackHint')}
|
||||
</Typography>
|
||||
<Typography variant="subtitle2" sx={{ fontWeight: 700, pt: 1 }}>
|
||||
{t('admin.referralAdmin.sybilSection')}
|
||||
</Typography>
|
||||
<FormControlLabel
|
||||
control={
|
||||
<Switch
|
||||
checked={s.sybilDetectionEnabled}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, sybilDetectionEnabled: e.target.checked })
|
||||
}
|
||||
/>
|
||||
}
|
||||
label={t('admin.referralAdmin.sybilEnabled')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.sybilReview')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.sybilReviewThreshold}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, sybilReviewThreshold: Number(e.target.value) || 0 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.sybilReviewHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.sybilBlock')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.sybilBlockThreshold}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, sybilBlockThreshold: Number(e.target.value) || 1 })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.sybilBlockHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxAmountMonth')}
|
||||
fullWidth
|
||||
value={s.maxCommissionAmountPerReferrerMonthRaw}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, maxCommissionAmountPerReferrerMonthRaw: e.target.value })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.maxAmountHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxCountMonth')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.maxCommissionsPerReferrerMonth}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
maxCommissionsPerReferrerMonth: Number(e.target.value) || 0,
|
||||
})
|
||||
}
|
||||
helperText={t('admin.referralAdmin.unlimitedHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.maxReferralsDay')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.maxReferralsPerDay}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, maxReferralsPerDay: Number(e.target.value) || 1 })
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.defaultReferrer')}
|
||||
fullWidth
|
||||
@ -463,22 +648,31 @@ export function ReferralAdminPage() {
|
||||
}
|
||||
helperText={t('admin.referralAdmin.defaultReferrerHelper')}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.minFirstDeposit')}
|
||||
fullWidth
|
||||
value={s.minFirstDepositRaw}
|
||||
onChange={(e) => setSettingsForm({ ...s, minFirstDepositRaw: e.target.value })}
|
||||
/>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.commissionWalletType')}
|
||||
type="number"
|
||||
fullWidth
|
||||
value={s.commissionWalletTypeId}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({ ...s, commissionWalletTypeId: Number(e.target.value) })
|
||||
}
|
||||
helperText={t('admin.referralAdmin.commissionWalletHelper')}
|
||||
/>
|
||||
<FormControl fullWidth>
|
||||
<InputLabel id="commission-wallet-type-label">
|
||||
{t('admin.referralAdmin.commissionWalletType')}
|
||||
</InputLabel>
|
||||
<Select
|
||||
labelId="commission-wallet-type-label"
|
||||
label={t('admin.referralAdmin.commissionWalletType')}
|
||||
value={s.commissionWalletTypeId || ''}
|
||||
onChange={(e) =>
|
||||
setSettingsForm({
|
||||
...s,
|
||||
commissionWalletTypeId: Number(e.target.value),
|
||||
})
|
||||
}
|
||||
>
|
||||
{walletTypeOptions.map((wt) => (
|
||||
<MenuItem key={wt.id} value={wt.id}>
|
||||
{wt.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
<Typography variant="caption" color="text.secondary" sx={{ mt: 0.5, display: 'block' }}>
|
||||
{t('admin.referralAdmin.commissionWalletHelper')}
|
||||
</Typography>
|
||||
</FormControl>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => saveSettingsMut.mutate(s)}
|
||||
@ -603,24 +797,43 @@ export function ReferralAdminPage() {
|
||||
<Stack spacing={1} sx={{ mb: 2 }}>
|
||||
{(config?.pools ?? []).map((p) => (
|
||||
<Typography key={p.walletTypeId} variant="body2">
|
||||
{t('admin.referralAdmin.walletTypeBalance', { id: p.walletTypeId, balance: p.availableBalance })}
|
||||
{t('admin.referralAdmin.walletTypeBalance', {
|
||||
label: p.label,
|
||||
balance: p.availableBalance,
|
||||
})}
|
||||
</Typography>
|
||||
))}
|
||||
</Stack>
|
||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={1}>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.walletTypeId')}
|
||||
value={fundForm.walletTypeId}
|
||||
onChange={(e) => setFundForm((f) => ({ ...f, walletTypeId: e.target.value }))}
|
||||
sx={{ flex: 1 }}
|
||||
/>
|
||||
<Stack direction={{ xs: 'column', sm: 'row' }} spacing={1} sx={{ alignItems: { sm: 'flex-start' } }}>
|
||||
<FormControl sx={{ flex: 1, minWidth: 220 }}>
|
||||
<InputLabel id="fund-wallet-type-label">
|
||||
{t('admin.referralAdmin.walletType')}
|
||||
</InputLabel>
|
||||
<Select
|
||||
labelId="fund-wallet-type-label"
|
||||
label={t('admin.referralAdmin.walletType')}
|
||||
value={fundForm.walletTypeId}
|
||||
onChange={(e) => setFundForm((f) => ({ ...f, walletTypeId: String(e.target.value) }))}
|
||||
>
|
||||
{walletTypeOptions.map((wt) => (
|
||||
<MenuItem key={wt.id} value={String(wt.id)}>
|
||||
{wt.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<TextField
|
||||
label={t('admin.referralAdmin.amountDisplay')}
|
||||
value={fundForm.amountDisplay}
|
||||
onChange={(e) => setFundForm((f) => ({ ...f, amountDisplay: e.target.value }))}
|
||||
sx={{ flex: 1 }}
|
||||
/>
|
||||
<Button variant="contained" onClick={() => fundMut.mutate()} disabled={fundMut.isPending}>
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => fundMut.mutate()}
|
||||
disabled={fundMut.isPending || !fundForm.walletTypeId}
|
||||
sx={{ whiteSpace: 'nowrap' }}
|
||||
>
|
||||
{t('admin.referralAdmin.fundPool')}
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
@ -1695,10 +1695,33 @@ export const en = {
|
||||
maxPendingHelper: 'Expire unpaid commissions if eligibility is still not met',
|
||||
commissionModes: 'Commission modes',
|
||||
commissionModesHelper:
|
||||
'Level percentages apply to the referred user’s stake on each validated prediction (main/bonus). Test stakes are excluded.',
|
||||
'Enable one or more modes. Mode-specific settings appear below only when that mode is on. You can switch modes anytime without reimplementing logic.',
|
||||
noModeSelected:
|
||||
'No commission mode is enabled. Turn on Prediction, Deposit, and/or Withdrawal to configure payouts.',
|
||||
predictionCommissions: 'Prediction commissions (on stake at place)',
|
||||
depositCommissions: 'Deposit commissions (legacy — first deposit of referred users)',
|
||||
withdrawalCommissions: 'Withdrawal commissions (legacy — prediction gains from main account only)',
|
||||
predictionSectionTitle: 'Prediction mode settings',
|
||||
predictionSectionHelper:
|
||||
'Commission = % of the referred user’s stake at place (main/bonus). Paid immediately to the referrer bonus wallet after Sybil / caps / pool checks. Test stakes are excluded. Win/lose/refund do not change the amount. Hold days and min predictions do not apply.',
|
||||
depositSectionTitle: 'Deposit mode settings',
|
||||
depositSectionHelper:
|
||||
'Commission = % of the referred user’s first qualifying deposit. Held until eligibility (predictions + hold days), then paid to the referrer bonus wallet.',
|
||||
withdrawalSectionTitle: 'Withdrawal mode settings',
|
||||
withdrawalSectionHelper:
|
||||
'Commission = % of commissionable prediction gains withdrawn from the main account (not deposited principal). Held until eligibility, then paid to the referrer bonus wallet.',
|
||||
legacySharedWithDeposit:
|
||||
'Hold days, min predictions, and max pending days are shared with Deposit mode (same fields above).',
|
||||
sharedPayoutRules: 'Shared rules (all enabled modes)',
|
||||
sharedPayoutRulesHelper:
|
||||
'Sybil, monthly caps, and Slack apply to every enabled commission mode.',
|
||||
minFirstDepositHelper: 'Raw units (6 decimals). Example: 1000000 = 1 USDT. 0 = no minimum.',
|
||||
commissionHoldHelperDeposit:
|
||||
'Days to wait after the first deposit before the commission can be paid.',
|
||||
commissionHoldHelperWithdrawal:
|
||||
'Days to wait after the withdrawal before the commission can be paid.',
|
||||
minPredictionsHelper:
|
||||
'Minimum settled real-money predictions by the referred user before a held commission can be paid.',
|
||||
slackAlerts: 'Slack alerts',
|
||||
slackEnabled: 'Slack alerts enabled (referral channel: cap blocks, clawbacks, Sybil review)',
|
||||
slackHint:
|
||||
@ -1717,8 +1740,8 @@ export const en = {
|
||||
defaultReferrer: 'Default referrer user ID (admin UUID)',
|
||||
defaultReferrerHelper: 'Used when no referral code is provided at signup',
|
||||
minFirstDeposit: 'Min first deposit (raw units)',
|
||||
commissionWalletType: 'Commission wallet type ID',
|
||||
commissionWalletHelper: '2 = USDT_TRC20 by default',
|
||||
commissionWalletType: 'Commission wallet',
|
||||
commissionWalletHelper: 'Asset used for referral commission credits (e.g. USDT TRC20)',
|
||||
saveSettings: 'Save settings',
|
||||
levelsTitle: 'Commission levels',
|
||||
level: 'Level',
|
||||
@ -1735,8 +1758,9 @@ export const en = {
|
||||
maxCountField: 'Max count / month (0=global)',
|
||||
addUpdateLevel: 'Add / update level',
|
||||
bonusPoolTitle: 'Bonus pool (treasury for referral payouts)',
|
||||
walletTypeBalance: 'Wallet type {{id}}: {{balance}} raw units',
|
||||
walletTypeBalance: '{{label}}: {{balance}} raw units',
|
||||
walletTypeId: 'Wallet type ID',
|
||||
walletType: 'Wallet',
|
||||
amountDisplay: 'Amount (display)',
|
||||
fundPool: 'Fund pool',
|
||||
reviewTitle: 'Manual review queue',
|
||||
|
||||
@ -1709,10 +1709,33 @@ export const fr = {
|
||||
maxPendingHelper: 'Expirer les commissions impayées si l’éligibilité n’est toujours pas atteinte',
|
||||
commissionModes: 'Modes de commission',
|
||||
commissionModesHelper:
|
||||
'Les pourcentages de niveau s’appliquent à la mise du filleul à chaque prédiction validée (principal/bonus). Les mises test sont exclues.',
|
||||
'Activez un ou plusieurs modes. Les paramètres propres à un mode n’apparaissent que s’il est activé. Vous pouvez changer de mode à tout moment.',
|
||||
noModeSelected:
|
||||
'Aucun mode de commission n’est activé. Activez Prédiction, Dépôt et/ou Retrait pour configurer les paiements.',
|
||||
predictionCommissions: 'Commissions sur prédiction (sur la mise à la place)',
|
||||
depositCommissions: 'Commissions sur dépôt (legacy — premier dépôt des filleuls)',
|
||||
withdrawalCommissions: 'Commissions sur retrait (legacy — gains prédictions compte principal uniquement)',
|
||||
predictionSectionTitle: 'Paramètres du mode prédiction',
|
||||
predictionSectionHelper:
|
||||
'Commission = % de la mise du filleul à la place (principal/bonus). Crédit immédiat sur le wallet bonus du parrain après contrôles Sybil / plafonds / pool. Les mises test sont exclues. Win/lose/refund ne changent pas le montant. Délai de rétention et min. prédictions ne s’appliquent pas.',
|
||||
depositSectionTitle: 'Paramètres du mode dépôt',
|
||||
depositSectionHelper:
|
||||
'Commission = % du premier dépôt éligible du filleul. Mise en attente jusqu’à éligibilité (prédictions + délai), puis crédit sur le wallet bonus du parrain.',
|
||||
withdrawalSectionTitle: 'Paramètres du mode retrait',
|
||||
withdrawalSectionHelper:
|
||||
'Commission = % des gains de prédiction commissionables retirés du compte principal (pas le capital déposé). Mise en attente jusqu’à éligibilité, puis crédit sur le wallet bonus du parrain.',
|
||||
legacySharedWithDeposit:
|
||||
'Délai de rétention, prédictions min. et jours max en attente sont partagés avec le mode Dépôt (champs ci-dessus).',
|
||||
sharedPayoutRules: 'Règles partagées (tous les modes actifs)',
|
||||
sharedPayoutRulesHelper:
|
||||
'Sybil, plafonds mensuels et Slack s’appliquent à chaque mode de commission activé.',
|
||||
minFirstDepositHelper: 'Unités brutes (6 décimales). Exemple : 1000000 = 1 USDT. 0 = pas de minimum.',
|
||||
commissionHoldHelperDeposit:
|
||||
'Jours d’attente après le premier dépôt avant paiement de la commission.',
|
||||
commissionHoldHelperWithdrawal:
|
||||
'Jours d’attente après le retrait avant paiement de la commission.',
|
||||
minPredictionsHelper:
|
||||
'Nombre minimum de prédictions argent réel réglées du filleul avant paiement d’une commission en attente.',
|
||||
slackAlerts: 'Alertes Slack',
|
||||
slackEnabled: 'Alertes Slack activées (canal parrainage : plafonds, clawbacks, revue Sybil)',
|
||||
slackHint:
|
||||
@ -1731,8 +1754,8 @@ export const fr = {
|
||||
defaultReferrer: 'ID parrain par défaut (UUID admin)',
|
||||
defaultReferrerHelper: 'Utilisé quand aucun code parrain n’est fourni à l’inscription',
|
||||
minFirstDeposit: 'Premier dépôt min (unités brutes)',
|
||||
commissionWalletType: 'ID type wallet commission',
|
||||
commissionWalletHelper: '2 = USDT_TRC20 par défaut',
|
||||
commissionWalletType: 'Wallet de commission',
|
||||
commissionWalletHelper: 'Actif utilisé pour créditer les commissions (ex. USDT TRC20)',
|
||||
saveSettings: 'Enregistrer les paramètres',
|
||||
levelsTitle: 'Niveaux de commission',
|
||||
level: 'Niveau',
|
||||
@ -1749,8 +1772,9 @@ export const fr = {
|
||||
maxCountField: 'Nombre max / mois (0=global)',
|
||||
addUpdateLevel: 'Ajouter / mettre à jour le niveau',
|
||||
bonusPoolTitle: 'Pool bonus (trésorerie pour paiements parrainage)',
|
||||
walletTypeBalance: 'Type wallet {{id}} : {{balance}} unités brutes',
|
||||
walletTypeBalance: '{{label}} : {{balance}} unités brutes',
|
||||
walletTypeId: 'ID type wallet',
|
||||
walletType: 'Wallet',
|
||||
amountDisplay: 'Montant (affiché)',
|
||||
fundPool: 'Alimenter le pool',
|
||||
reviewTitle: 'File de revue manuelle',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user