@orderly.network/affiliate 3.1.0 → 3.1.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +537 -339
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +538 -340
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { createContext, useState, useEffect, useRef, useMemo, useContext, useCal
|
|
|
2
2
|
import { useMutation, cleanStringStyle, useCheckReferralCode, useAccount, usePrivateQuery, noCacheConfig, useDaily, useMemoizedFn, useMediaQuery, useReferralRebateSummary, useLocalStorage, useRefereeRebateSummary, useRefereeInfo } from '@orderly.network/hooks';
|
|
3
3
|
import { useAppContext } from '@orderly.network/react-app';
|
|
4
4
|
import { AccountStatusEnum, EMPTY_LIST } from '@orderly.network/types';
|
|
5
|
-
import { registerSimpleDialog, registerSimpleSheet, modal, useModal, SimpleDialog, TextField, inputFormatter, Flex, Text, cn, toast, Dialog, DialogContent, DialogTitle, Divider, Input as Input$1, Button, formatAddress, Checkbox, Box, Slider, WarningIcon, Grid, Spinner, Collapsible, CollapsibleContent, Select, Tabs, TabPanel, useScreen, usePagination, DatePicker, TabsBase, TabsList, TabsTrigger, TabsContent, parseNumber, ListView, CopyIcon, DataTable, Statistic,
|
|
5
|
+
import { registerSimpleDialog, registerSimpleSheet, modal, useModal, SimpleDialog, TextField, inputFormatter, Flex, Text, cn, toast, Dialog, DialogContent, DialogTitle, Divider, Input as Input$1, Button, formatAddress, Checkbox, Box, Slider, WarningIcon, Tooltip, Grid, Spinner, Collapsible, CollapsibleContent, Select, Tabs, TabPanel, useScreen, usePagination, DatePicker, TabsBase, TabsList, TabsTrigger, TabsContent, parseNumber, ListView, CopyIcon, DataTable, Statistic, DialogTrigger, DialogHeader, DialogBody } from '@orderly.network/ui';
|
|
6
6
|
import { subDays, format, toDate } from 'date-fns';
|
|
7
7
|
import { Decimal, commify, commifyOptional } from '@orderly.network/utils';
|
|
8
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -89,23 +89,33 @@ var useMultiLevelReferralData = () => {
|
|
|
89
89
|
const isMultiLevelReferralUnlocked = volumePrerequisite && volumePrerequisite.current_volume >= volumePrerequisite.required_volume;
|
|
90
90
|
const isMultiLevelEnabled = !!maxRebateRateRes;
|
|
91
91
|
const maxRebateRate = maxRebateRateRes?.max_rebate_rate;
|
|
92
|
+
const bonusMaxRebateRate = maxRebateRateRes?.bonus_max_rebate_rate ?? maxRebateRate ?? 0;
|
|
93
|
+
const baseRebateRate = maxRebateRateRes?.base_rebate_rate ?? 0;
|
|
92
94
|
const multiLevelRebateInfo = useMemo(() => {
|
|
93
95
|
if (!multiLevelRebateInfoRes) return;
|
|
94
96
|
const {
|
|
95
97
|
default_referee_rebate_rate: referee_rebate_rate,
|
|
98
|
+
default_bonus_referee_rebate_rate,
|
|
99
|
+
bonus_max_rebate_rate,
|
|
96
100
|
max_rebate_rate
|
|
97
101
|
} = multiLevelRebateInfoRes;
|
|
98
|
-
const
|
|
102
|
+
const refereeBonusRebateRate = default_bonus_referee_rebate_rate ?? referee_rebate_rate ?? 0;
|
|
103
|
+
const referrer_rebate_rate = new Decimal(
|
|
104
|
+
bonus_max_rebate_rate ?? max_rebate_rate ?? 0
|
|
105
|
+
).sub(refereeBonusRebateRate).toNumber();
|
|
99
106
|
return {
|
|
100
107
|
...multiLevelRebateInfoRes,
|
|
101
|
-
referee_rebate_rate,
|
|
108
|
+
referee_rebate_rate: refereeBonusRebateRate,
|
|
102
109
|
referrer_rebate_rate
|
|
103
110
|
};
|
|
104
|
-
}, [multiLevelRebateInfoRes
|
|
111
|
+
}, [multiLevelRebateInfoRes]);
|
|
105
112
|
const isLoading = volumePrerequisiteLoading || maxRebateRateLoading || multiLevelRebateInfoLoading;
|
|
106
113
|
return {
|
|
107
114
|
volumePrerequisite,
|
|
108
115
|
maxRebateRate,
|
|
116
|
+
maxRebateRateInfo: maxRebateRateRes,
|
|
117
|
+
bonusMaxRebateRate,
|
|
118
|
+
baseRebateRate,
|
|
109
119
|
multiLevelRebateInfo,
|
|
110
120
|
isMultiLevelEnabled,
|
|
111
121
|
isMultiLevelReferralUnlocked,
|
|
@@ -159,6 +169,9 @@ var ReferralProvider = (props) => {
|
|
|
159
169
|
isMultiLevelReferralUnlocked,
|
|
160
170
|
multiLevelRebateInfoMutate,
|
|
161
171
|
maxRebateRate,
|
|
172
|
+
maxRebateRateInfo,
|
|
173
|
+
bonusMaxRebateRate,
|
|
174
|
+
baseRebateRate,
|
|
162
175
|
maxRebateRateMutate,
|
|
163
176
|
isLoading: isMultiLevelLoading
|
|
164
177
|
} = useMultiLevelReferralData();
|
|
@@ -272,6 +285,9 @@ var ReferralProvider = (props) => {
|
|
|
272
285
|
isMultiLevelReferralUnlocked,
|
|
273
286
|
multiLevelRebateInfoMutate,
|
|
274
287
|
maxRebateRate,
|
|
288
|
+
maxRebateRateInfo,
|
|
289
|
+
bonusMaxRebateRate,
|
|
290
|
+
baseRebateRate,
|
|
275
291
|
maxRebateRateMutate
|
|
276
292
|
};
|
|
277
293
|
}, [
|
|
@@ -303,6 +319,9 @@ var ReferralProvider = (props) => {
|
|
|
303
319
|
isMultiLevelReferralUnlocked,
|
|
304
320
|
multiLevelRebateInfoMutate,
|
|
305
321
|
maxRebateRate,
|
|
322
|
+
maxRebateRateInfo,
|
|
323
|
+
bonusMaxRebateRate,
|
|
324
|
+
baseRebateRate,
|
|
306
325
|
isMultiLevelLoading,
|
|
307
326
|
maxRebateRateMutate
|
|
308
327
|
]);
|
|
@@ -462,17 +481,23 @@ var useReferralCode = () => {
|
|
|
462
481
|
|
|
463
482
|
// src/pages/multiLevel/affiliate/referralCodeForm/referralCodeForm.script.ts
|
|
464
483
|
var useReferralCodeFormScript = (options) => {
|
|
465
|
-
const { type, referralCode,
|
|
484
|
+
const { type, referralCode, referrerRebateRate, accountId } = options;
|
|
466
485
|
const { t } = useTranslation();
|
|
467
486
|
const [newCode, setNewCode] = useState(referralCode || "");
|
|
468
487
|
const [isReview, setIsReview] = useState(false);
|
|
469
|
-
const
|
|
470
|
-
return new Decimal(maxRebateRate).mul(100).toNumber();
|
|
471
|
-
}, [maxRebateRate]);
|
|
488
|
+
const bonusMaxRebatePercentage = useMemo(() => {
|
|
489
|
+
return new Decimal(options.bonusMaxRebateRate ?? options.maxRebateRate ?? 0).mul(100).toNumber();
|
|
490
|
+
}, [options.bonusMaxRebateRate, options.maxRebateRate]);
|
|
491
|
+
const baseRebatePercentage = useMemo(() => {
|
|
492
|
+
return new Decimal(options.baseRebateRate ?? 0).mul(100).toNumber();
|
|
493
|
+
}, [options.baseRebateRate]);
|
|
494
|
+
const totalSplitPercentage = useMemo(() => {
|
|
495
|
+
return new Decimal(bonusMaxRebatePercentage).add(baseRebatePercentage).toNumber();
|
|
496
|
+
}, [bonusMaxRebatePercentage, baseRebatePercentage]);
|
|
472
497
|
const [referrerRebatePercentage, setReferrerRebatePercentage] = useState(
|
|
473
498
|
() => {
|
|
474
499
|
if (type === "create" /* Create */) {
|
|
475
|
-
return
|
|
500
|
+
return bonusMaxRebatePercentage;
|
|
476
501
|
}
|
|
477
502
|
if (referrerRebateRate) {
|
|
478
503
|
return new Decimal(referrerRebateRate).mul(100).toNumber();
|
|
@@ -487,12 +512,17 @@ var useReferralCodeFormScript = (options) => {
|
|
|
487
512
|
resetRebateRate,
|
|
488
513
|
isMutating
|
|
489
514
|
} = useReferralCode();
|
|
490
|
-
const
|
|
515
|
+
const refereeBonusRebatePercentage = useMemo(() => {
|
|
491
516
|
return Math.max(
|
|
492
517
|
0,
|
|
493
|
-
new Decimal(
|
|
518
|
+
new Decimal(bonusMaxRebatePercentage).sub(referrerRebatePercentage).toNumber()
|
|
494
519
|
);
|
|
495
|
-
}, [
|
|
520
|
+
}, [bonusMaxRebatePercentage, referrerRebatePercentage]);
|
|
521
|
+
const refereeRebatePercentage = useMemo(() => {
|
|
522
|
+
return new Decimal(baseRebatePercentage).add(refereeBonusRebatePercentage).toNumber();
|
|
523
|
+
}, [baseRebatePercentage, refereeBonusRebatePercentage]);
|
|
524
|
+
const directTradesPercentage = totalSplitPercentage;
|
|
525
|
+
const indirectTradesPercentage = referrerRebatePercentage;
|
|
496
526
|
const codeChanged = useMemo(() => {
|
|
497
527
|
return newCode !== referralCode;
|
|
498
528
|
}, [newCode, referralCode]);
|
|
@@ -524,7 +554,7 @@ var useReferralCodeFormScript = (options) => {
|
|
|
524
554
|
new_referral_code: newCode.toUpperCase().replace(/[^A-Z0-9]/g, "")
|
|
525
555
|
};
|
|
526
556
|
const updateRebateRateParams = {
|
|
527
|
-
referee_rebate_rate: new Decimal(
|
|
557
|
+
referee_rebate_rate: new Decimal(refereeBonusRebatePercentage).div(100).toNumber(),
|
|
528
558
|
account_ids: accountId ? [accountId] : void 0
|
|
529
559
|
};
|
|
530
560
|
try {
|
|
@@ -549,8 +579,9 @@ var useReferralCodeFormScript = (options) => {
|
|
|
549
579
|
};
|
|
550
580
|
const onCreate = async () => {
|
|
551
581
|
try {
|
|
552
|
-
const
|
|
553
|
-
|
|
582
|
+
const res = await createReferralCode({
|
|
583
|
+
referee_rebate_rate: new Decimal(refereeBonusRebatePercentage).div(100).toNumber()
|
|
584
|
+
});
|
|
554
585
|
if (res.success) {
|
|
555
586
|
toast.success(t("affiliate.referralCode.create.success"));
|
|
556
587
|
options.onSuccess?.();
|
|
@@ -573,10 +604,14 @@ var useReferralCodeFormScript = (options) => {
|
|
|
573
604
|
const onClick = () => {
|
|
574
605
|
switch (type) {
|
|
575
606
|
case "create" /* Create */:
|
|
576
|
-
|
|
607
|
+
if (isReview) {
|
|
608
|
+
onCreate();
|
|
609
|
+
} else {
|
|
610
|
+
setIsReview(true);
|
|
611
|
+
}
|
|
577
612
|
break;
|
|
578
613
|
case "edit" /* Edit */:
|
|
579
|
-
if (isReview) {
|
|
614
|
+
if (accountId || isReview) {
|
|
580
615
|
onEdit();
|
|
581
616
|
} else {
|
|
582
617
|
setIsReview(true);
|
|
@@ -587,15 +622,25 @@ var useReferralCodeFormScript = (options) => {
|
|
|
587
622
|
break;
|
|
588
623
|
}
|
|
589
624
|
};
|
|
590
|
-
const buttonDisabled =
|
|
625
|
+
const buttonDisabled = useMemo(() => {
|
|
626
|
+
if (type !== "edit" /* Edit */) {
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
return !codeChanged && !rateChanged;
|
|
630
|
+
}, [codeChanged, rateChanged, type]);
|
|
591
631
|
const confirmButtonLoading = isMutating;
|
|
592
632
|
return {
|
|
593
633
|
type,
|
|
594
634
|
onClick,
|
|
595
|
-
maxRebatePercentage,
|
|
635
|
+
maxRebatePercentage: bonusMaxRebatePercentage,
|
|
636
|
+
baseRebatePercentage,
|
|
637
|
+
totalSplitPercentage,
|
|
638
|
+
directTradesPercentage,
|
|
639
|
+
indirectTradesPercentage,
|
|
596
640
|
referrerRebatePercentage,
|
|
597
641
|
setReferrerRebatePercentage,
|
|
598
642
|
refereeRebatePercentage,
|
|
643
|
+
refereeBonusRebatePercentage,
|
|
599
644
|
confirmButtonLoading,
|
|
600
645
|
newCode,
|
|
601
646
|
setNewCode,
|
|
@@ -604,43 +649,6 @@ var useReferralCodeFormScript = (options) => {
|
|
|
604
649
|
onReset
|
|
605
650
|
};
|
|
606
651
|
};
|
|
607
|
-
var GiftIcon = (props) => {
|
|
608
|
-
const { size = 16, className, ...rest } = props;
|
|
609
|
-
return /* @__PURE__ */ jsx(
|
|
610
|
-
"svg",
|
|
611
|
-
{
|
|
612
|
-
width: size,
|
|
613
|
-
height: size,
|
|
614
|
-
viewBox: "0 0 16 16",
|
|
615
|
-
fill: "none",
|
|
616
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
617
|
-
className,
|
|
618
|
-
...rest,
|
|
619
|
-
children: /* @__PURE__ */ jsx(
|
|
620
|
-
"path",
|
|
621
|
-
{
|
|
622
|
-
d: "M5.99902 1.99377C4.52636 1.99377 3.33236 3.18777 3.33236 4.66044H2.66569C2.29769 4.66044 1.99902 4.9591 1.99902 5.3271C1.99902 5.66044 1.99902 7.66043 1.99902 7.99377C1.99902 8.36177 2.29769 8.66043 2.66569 8.66043V11.3271C2.66569 12.7998 3.85969 13.9938 5.33236 13.9938H10.6657C12.1384 13.9938 13.3324 12.7998 13.3324 11.3271V8.66043C13.7004 8.66043 13.999 8.36177 13.999 7.99377V5.3271C13.999 4.9591 13.7004 4.66044 13.3324 4.66044H12.6657C12.6657 3.18777 11.4717 1.99377 9.99902 1.99377C9.19169 1.99377 8.48836 2.36444 7.99902 2.93111C7.50969 2.36444 6.80636 1.99377 5.99902 1.99377ZM5.99902 3.32711C6.73569 3.32711 7.33236 3.92377 7.33236 4.66044H4.66569C4.66569 3.92377 5.26236 3.32711 5.99902 3.32711ZM9.99902 3.32711C10.7357 3.32711 11.3324 3.92377 11.3324 4.66044H8.66569C8.66569 3.92377 9.26236 3.32711 9.99902 3.32711ZM3.33236 5.99377H12.6657V7.3271H3.33236C3.33236 6.84777 3.33236 6.4731 3.33236 5.99377ZM3.99902 8.66043H7.33236V12.6604H5.33236C4.59569 12.6604 3.99902 12.0638 3.99902 11.3271V8.66043ZM8.66569 8.66043H11.999V11.3271C11.999 12.0638 11.4024 12.6604 10.6657 12.6604H8.66569V8.66043Z",
|
|
623
|
-
fill: "currentColor"
|
|
624
|
-
}
|
|
625
|
-
)
|
|
626
|
-
}
|
|
627
|
-
);
|
|
628
|
-
};
|
|
629
|
-
var WarningBox = (props) => /* @__PURE__ */ jsxs(
|
|
630
|
-
Flex,
|
|
631
|
-
{
|
|
632
|
-
className: "oui-bg-warning/10",
|
|
633
|
-
justify: "start",
|
|
634
|
-
itemAlign: "start",
|
|
635
|
-
gap: 1,
|
|
636
|
-
r: "lg",
|
|
637
|
-
p: 3,
|
|
638
|
-
children: [
|
|
639
|
-
/* @__PURE__ */ jsx(WarningIcon, { className: "oui-shrink-0 oui-text-warning" }),
|
|
640
|
-
typeof props.children === "string" ? /* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, className: "oui-text-warning", children: props.children }) : props.children
|
|
641
|
-
]
|
|
642
|
-
}
|
|
643
|
-
);
|
|
644
652
|
var ReferralCodeInput = (props) => {
|
|
645
653
|
const hasSetCursorToEnd = useRef(false);
|
|
646
654
|
return /* @__PURE__ */ jsx(
|
|
@@ -694,22 +702,22 @@ var ReferralCodeForm = (props) => {
|
|
|
694
702
|
const isReset = type === "reset" /* Reset */;
|
|
695
703
|
const hasBoundReferee = !!props.directInvites && props.directInvites > 0;
|
|
696
704
|
const isEditingRefereeRebateRate = !!props.accountId;
|
|
697
|
-
const noCommissionAvailable = props.
|
|
705
|
+
const noCommissionAvailable = props.maxRebatePercentage === 0;
|
|
698
706
|
const { title, description, buttonText } = useMemo(() => {
|
|
699
707
|
switch (type) {
|
|
700
708
|
case "create" /* Create */:
|
|
701
709
|
return {
|
|
702
|
-
title: t("affiliate.referralCode.create.modal.title"),
|
|
703
|
-
description:
|
|
704
|
-
buttonText: t("affiliate.
|
|
710
|
+
title: isReview ? t("affiliate.referralCode.review.modal.title") : t("affiliate.referralCode.create.modal.title"),
|
|
711
|
+
description: null,
|
|
712
|
+
buttonText: isReview ? t("common.save") : t("affiliate.review")
|
|
705
713
|
};
|
|
706
714
|
case "edit" /* Edit */:
|
|
707
715
|
return {
|
|
708
716
|
title: isEditingRefereeRebateRate ? t("affiliate.refereeRebateRate.modal.title", {
|
|
709
717
|
accountId: formatAddress(props.accountId)
|
|
710
|
-
}) : t("affiliate.referralCode.edit.modal.title"),
|
|
711
|
-
description:
|
|
712
|
-
buttonText: isReview ? t("
|
|
718
|
+
}) : isReview ? t("affiliate.referralCode.review.modal.title") : t("affiliate.referralCode.edit.modal.title"),
|
|
719
|
+
description: null,
|
|
720
|
+
buttonText: isEditingRefereeRebateRate ? t("common.save") : isReview ? t("common.save") : t("affiliate.review")
|
|
713
721
|
};
|
|
714
722
|
case "reset" /* Reset */:
|
|
715
723
|
return {
|
|
@@ -741,7 +749,6 @@ var ReferralCodeForm = (props) => {
|
|
|
741
749
|
]
|
|
742
750
|
}
|
|
743
751
|
);
|
|
744
|
-
const descriptionView = /* @__PURE__ */ jsx(WarningBox, { children: description });
|
|
745
752
|
const referralCodeInput = /* @__PURE__ */ jsx(
|
|
746
753
|
ReferralCodeInput,
|
|
747
754
|
{
|
|
@@ -752,41 +759,32 @@ var ReferralCodeForm = (props) => {
|
|
|
752
759
|
label: t("affiliate.referralCode.editCodeModal.label")
|
|
753
760
|
}
|
|
754
761
|
);
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
!isReview && /* @__PURE__ */ jsxs(Text, { size: "2xs", intensity: 54, children: [
|
|
758
|
-
t("affiliate.totalCommissionAvailable"),
|
|
759
|
-
":",
|
|
760
|
-
" ",
|
|
761
|
-
/* @__PURE__ */ jsxs(Text, { className: "oui-text-warning", children: [
|
|
762
|
-
props.maxRebatePercentage,
|
|
763
|
-
"%"
|
|
764
|
-
] })
|
|
765
|
-
] })
|
|
766
|
-
] });
|
|
767
|
-
const rebateRateSlider = /* @__PURE__ */ jsx(
|
|
768
|
-
RebateRateSlider,
|
|
762
|
+
const rateEditor = /* @__PURE__ */ jsx(
|
|
763
|
+
CommissionRatesCard,
|
|
769
764
|
{
|
|
770
|
-
|
|
771
|
-
|
|
765
|
+
directTradesRate: props.directTradesPercentage,
|
|
766
|
+
indirectTradesRate: props.indirectTradesPercentage,
|
|
767
|
+
totalSplitRate: props.totalSplitPercentage,
|
|
768
|
+
youKeepRate: props.referrerRebatePercentage,
|
|
769
|
+
refereeGetRate: props.refereeRebatePercentage,
|
|
770
|
+
baseRebateRate: props.baseRebatePercentage,
|
|
771
|
+
maxBonusRate: props.maxRebatePercentage,
|
|
772
772
|
onChange: props.setReferrerRebatePercentage,
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
noCommissionAvailable
|
|
773
|
+
showTradeRates: !isEditingRefereeRebateRate,
|
|
774
|
+
showSlider: !isReview && !isReset,
|
|
775
|
+
bordered: isEditingRefereeRebateRate ? false : true,
|
|
776
|
+
rightLabel: isEditingRefereeRebateRate ? t("affiliate.affiliateGet") : t("affiliate.directRefereesGet")
|
|
778
777
|
}
|
|
779
778
|
);
|
|
780
779
|
const refereeInfo = /* @__PURE__ */ jsxs(Flex, { width: "100%", justify: "between", gap: 2, children: [
|
|
781
|
-
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, children: t("affiliate.
|
|
780
|
+
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, children: t("affiliate.directReferee") }),
|
|
782
781
|
/* @__PURE__ */ jsx(Text.formatted, { rule: "address", size: "2xs", intensity: 98, children: props.accountId })
|
|
783
782
|
] });
|
|
784
|
-
const noCommissionAvailableWarning = noCommissionAvailable && /* @__PURE__ */ jsx(Text, { size: "2xs", className: "oui-text-warning", children: isEditingRefereeRebateRate ? t("affiliate.rebateRate.noCommissionRate") : t("affiliate.rebateRate.noCommissionAvailable") });
|
|
785
783
|
const resetRebateRateLabel = /* @__PURE__ */ jsxs(Text, { size: "2xs", intensity: 98, className: "oui-text-start", children: [
|
|
786
784
|
t("affiliate.resetRebateRate.rateAfterReset"),
|
|
787
785
|
":"
|
|
788
786
|
] });
|
|
789
|
-
const buttons = /* @__PURE__ */ jsxs(Flex, { direction: "row", gap:
|
|
787
|
+
const buttons = /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 3, width: "100%", mt: 0, pt: 2, children: [
|
|
790
788
|
/* @__PURE__ */ jsx(
|
|
791
789
|
Button,
|
|
792
790
|
{
|
|
@@ -815,26 +813,28 @@ var ReferralCodeForm = (props) => {
|
|
|
815
813
|
const renderContent = () => {
|
|
816
814
|
switch (type) {
|
|
817
815
|
case "create" /* Create */:
|
|
818
|
-
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap:
|
|
819
|
-
|
|
820
|
-
rebateRateSlider,
|
|
821
|
-
noCommissionAvailableWarning,
|
|
816
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
817
|
+
!noCommissionAvailable && rateEditor,
|
|
822
818
|
buttons
|
|
823
819
|
] });
|
|
824
820
|
case "edit" /* Edit */:
|
|
825
|
-
return /* @__PURE__ */ jsxs(
|
|
821
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
826
822
|
isEditingRefereeRebateRate ? refereeInfo : referralCodeInput,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
rebateRateSlider,
|
|
830
|
-
noCommissionAvailableWarning,
|
|
831
|
-
buttons
|
|
832
|
-
] })
|
|
823
|
+
!noCommissionAvailable && rateEditor,
|
|
824
|
+
buttons
|
|
833
825
|
] });
|
|
834
826
|
case "reset" /* Reset */:
|
|
835
|
-
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap:
|
|
827
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
828
|
+
description,
|
|
836
829
|
resetRebateRateLabel,
|
|
837
|
-
|
|
830
|
+
/* @__PURE__ */ jsx(
|
|
831
|
+
RateSplitValues,
|
|
832
|
+
{
|
|
833
|
+
youKeepRate: props.referrerRebatePercentage,
|
|
834
|
+
refereeGetRate: props.refereeRebatePercentage,
|
|
835
|
+
rightLabel: t("affiliate.directRefereesGet")
|
|
836
|
+
}
|
|
837
|
+
),
|
|
838
838
|
buttons
|
|
839
839
|
] });
|
|
840
840
|
default:
|
|
@@ -850,118 +850,188 @@ var ReferralCodeForm = (props) => {
|
|
|
850
850
|
className: "oui-affiliate-referralCodeForm oui-font-semibold",
|
|
851
851
|
children: [
|
|
852
852
|
titleView,
|
|
853
|
-
descriptionView,
|
|
854
853
|
renderContent()
|
|
855
854
|
]
|
|
856
855
|
}
|
|
857
856
|
);
|
|
858
857
|
};
|
|
859
|
-
var
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
if (!amount || amount <= 0) {
|
|
863
|
-
return null;
|
|
858
|
+
var formatPercent = (value) => {
|
|
859
|
+
if (Number.isInteger(value)) {
|
|
860
|
+
return `${value}%`;
|
|
864
861
|
}
|
|
862
|
+
return `${Number(value.toFixed(2))}%`;
|
|
863
|
+
};
|
|
864
|
+
var CommissionRatesCard = (props) => {
|
|
865
|
+
const { t } = useTranslation();
|
|
866
|
+
const selectablePercent = props.totalSplitRate > 0 ? Math.min(100, props.maxBonusRate / props.totalSplitRate * 100) : 100;
|
|
867
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 2, children: [
|
|
868
|
+
props.showTradeRates && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
869
|
+
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, children: t("affiliate.yourCommissionRates") }),
|
|
870
|
+
/* @__PURE__ */ jsx(
|
|
871
|
+
RateRow,
|
|
872
|
+
{
|
|
873
|
+
label: t("affiliate.directTrades"),
|
|
874
|
+
tooltip: t("affiliate.directTradesDescription"),
|
|
875
|
+
value: props.directTradesRate
|
|
876
|
+
}
|
|
877
|
+
)
|
|
878
|
+
] }),
|
|
879
|
+
/* @__PURE__ */ jsxs(
|
|
880
|
+
Flex,
|
|
881
|
+
{
|
|
882
|
+
width: "100%",
|
|
883
|
+
direction: "column",
|
|
884
|
+
itemAlign: "start",
|
|
885
|
+
gap: 2,
|
|
886
|
+
p: props.bordered ? 2 : 0,
|
|
887
|
+
r: "lg",
|
|
888
|
+
className: props.bordered ? "oui-border oui-border-line-6" : "",
|
|
889
|
+
children: [
|
|
890
|
+
props.showTradeRates && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
891
|
+
/* @__PURE__ */ jsx(
|
|
892
|
+
RateRow,
|
|
893
|
+
{
|
|
894
|
+
label: t("affiliate.indirectTrades"),
|
|
895
|
+
tooltip: t("affiliate.indirectTradesDescription"),
|
|
896
|
+
value: props.indirectTradesRate,
|
|
897
|
+
bordered: false
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
/* @__PURE__ */ jsx(Divider, { intensity: 8, className: "oui-w-full" })
|
|
901
|
+
] }),
|
|
902
|
+
/* @__PURE__ */ jsxs(Text, { size: "2xs", intensity: 54, className: "oui-w-full oui-text-start", children: [
|
|
903
|
+
t("affiliate.totalToSplit"),
|
|
904
|
+
":",
|
|
905
|
+
" ",
|
|
906
|
+
/* @__PURE__ */ jsx(Text, { as: "span", intensity: 98, children: formatPercent(props.totalSplitRate) })
|
|
907
|
+
] }),
|
|
908
|
+
props.showSlider && /* @__PURE__ */ jsxs(Box, { width: "100%", my: 1, className: "oui-relative", children: [
|
|
909
|
+
/* @__PURE__ */ jsx(
|
|
910
|
+
Slider,
|
|
911
|
+
{
|
|
912
|
+
min: 0,
|
|
913
|
+
max: props.totalSplitRate,
|
|
914
|
+
step: 1,
|
|
915
|
+
value: [props.youKeepRate],
|
|
916
|
+
onValueChange: (value) => {
|
|
917
|
+
const newValue = value[0];
|
|
918
|
+
const nextValue = Math.min(newValue, props.maxBonusRate);
|
|
919
|
+
props.onChange(nextValue);
|
|
920
|
+
},
|
|
921
|
+
classNames: {
|
|
922
|
+
range: "oui-bg-success-darken oui-h-2 oui-top-[0px]",
|
|
923
|
+
trackInner: "oui-h-2 oui-top-[0px] oui-bg-base-contrast-12",
|
|
924
|
+
thumb: "oui-border-[#d9d9d9] oui-bg-[#d9d9d9] oui-size-4"
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
),
|
|
928
|
+
selectablePercent < 100 && /* @__PURE__ */ jsx(
|
|
929
|
+
"div",
|
|
930
|
+
{
|
|
931
|
+
className: "oui-pointer-events-none oui-absolute oui-end-0 oui-top-1/2 oui-h-2 oui-translate-y-[-50%] oui-rounded-e-full oui-bg-[repeating-linear-gradient(45deg,rgba(255,255,255,0.08)_0,rgba(255,255,255,0.08)_4px,transparent_4px,transparent_8px)]",
|
|
932
|
+
style: { left: `${selectablePercent}%` }
|
|
933
|
+
}
|
|
934
|
+
)
|
|
935
|
+
] }),
|
|
936
|
+
/* @__PURE__ */ jsx(
|
|
937
|
+
RateSplitValues,
|
|
938
|
+
{
|
|
939
|
+
youKeepRate: props.youKeepRate,
|
|
940
|
+
refereeGetRate: props.refereeGetRate,
|
|
941
|
+
rightLabel: props.rightLabel
|
|
942
|
+
}
|
|
943
|
+
),
|
|
944
|
+
/* @__PURE__ */ jsx(PassDownHint, { amount: props.baseRebateRate })
|
|
945
|
+
]
|
|
946
|
+
}
|
|
947
|
+
)
|
|
948
|
+
] });
|
|
949
|
+
};
|
|
950
|
+
var RateRow = (props) => {
|
|
951
|
+
const label = /* @__PURE__ */ jsx(
|
|
952
|
+
Text,
|
|
953
|
+
{
|
|
954
|
+
size: "2xs",
|
|
955
|
+
intensity: 98,
|
|
956
|
+
className: "oui-cursor-pointer oui-underline oui-decoration-dotted oui-underline-offset-4",
|
|
957
|
+
children: props.label
|
|
958
|
+
}
|
|
959
|
+
);
|
|
865
960
|
return /* @__PURE__ */ jsxs(
|
|
866
961
|
Flex,
|
|
867
962
|
{
|
|
868
|
-
direction: "column",
|
|
869
|
-
gap: 2,
|
|
870
|
-
mt: 2,
|
|
871
963
|
width: "100%",
|
|
872
|
-
|
|
964
|
+
justify: "between",
|
|
965
|
+
itemAlign: "center",
|
|
966
|
+
gap: 2,
|
|
967
|
+
p: props.bordered === false ? 0 : 2,
|
|
873
968
|
r: "lg",
|
|
874
|
-
className: "oui-border oui-border-
|
|
969
|
+
className: props.bordered === false ? "" : "oui-border oui-border-line-6",
|
|
875
970
|
children: [
|
|
876
|
-
/* @__PURE__ */
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
] }),
|
|
887
|
-
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 98, className: "oui-leading-[15px]", children: t("affiliate.noCommissionCard.content", { amount }) })
|
|
971
|
+
props.tooltip ? /* @__PURE__ */ jsx(
|
|
972
|
+
Tooltip,
|
|
973
|
+
{
|
|
974
|
+
content: props.tooltip,
|
|
975
|
+
className: "oui-max-w-[200px] oui-bg-base-6",
|
|
976
|
+
arrow: { className: "oui-fill-base-6" },
|
|
977
|
+
children: label
|
|
978
|
+
}
|
|
979
|
+
) : label,
|
|
980
|
+
/* @__PURE__ */ jsx(Text, { size: "lg", className: "oui-text-success-darken", children: formatPercent(props.value) })
|
|
888
981
|
]
|
|
889
982
|
}
|
|
890
983
|
);
|
|
891
984
|
};
|
|
892
|
-
var
|
|
985
|
+
var RateSplitValues = (props) => {
|
|
893
986
|
const { t } = useTranslation();
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
Slider,
|
|
987
|
+
return /* @__PURE__ */ jsxs(Flex, { width: "100%", gap: 2, children: [
|
|
988
|
+
/* @__PURE__ */ jsxs(
|
|
989
|
+
Flex,
|
|
898
990
|
{
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
props.disabledIncrease ? Math.min(newValue, maxValue) : newValue
|
|
907
|
-
);
|
|
908
|
-
},
|
|
909
|
-
classNames: {
|
|
910
|
-
range: "oui-bg-success-darken oui-h-2 oui-top-[0px]",
|
|
911
|
-
trackInner: "oui-bg-success-darken/30 oui-h-2 oui-top-[0px]",
|
|
912
|
-
thumb: "oui-border-[#d9d9d9] oui-bg-[#d9d9d9] oui-size-4"
|
|
913
|
-
}
|
|
991
|
+
direction: "column",
|
|
992
|
+
itemAlign: "start",
|
|
993
|
+
className: "oui-min-w-0 oui-flex-1",
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, children: t("affiliate.youKeep") }),
|
|
996
|
+
/* @__PURE__ */ jsx(Text, { size: "lg", className: "oui-text-success-darken", children: formatPercent(props.youKeepRate) })
|
|
997
|
+
]
|
|
914
998
|
}
|
|
915
|
-
)
|
|
916
|
-
/* @__PURE__ */ jsxs(
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
props.
|
|
924
|
-
"
|
|
925
|
-
]
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
"%"
|
|
929
|
-
] })
|
|
930
|
-
] }),
|
|
931
|
-
props.noCommissionAvailable ? /* @__PURE__ */ jsx(
|
|
932
|
-
NoCommissionCard,
|
|
933
|
-
{
|
|
934
|
-
directBonusRebateRate: props.directBonusRebateRate
|
|
935
|
-
}
|
|
936
|
-
) : props.directBonusRebateRate != null && props.directBonusRebateRate > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 2, mt: 2, width: "100%", children: [
|
|
937
|
-
/* @__PURE__ */ jsx(
|
|
938
|
-
GiftIcon,
|
|
939
|
-
{
|
|
940
|
-
size: 16,
|
|
941
|
-
className: "oui-mt-px oui-text-base-contrast"
|
|
942
|
-
}
|
|
943
|
-
),
|
|
944
|
-
/* @__PURE__ */ jsx(
|
|
945
|
-
Text,
|
|
946
|
-
{
|
|
947
|
-
size: "sm",
|
|
948
|
-
intensity: 54,
|
|
949
|
-
as: "span",
|
|
950
|
-
className: "oui-inline-flex oui-items-center oui-gap-1 oui-tracking-[0.03em]",
|
|
951
|
-
children: /* @__PURE__ */ jsx(
|
|
952
|
-
Trans,
|
|
953
|
-
{
|
|
954
|
-
i18nKey: "affiliate.extraBonusOnDirectReferrals",
|
|
955
|
-
values: { amount: props.directBonusRebateRate },
|
|
956
|
-
components: [/* @__PURE__ */ jsx(Text, { as: "span", color: "primaryLight" }, "0")]
|
|
957
|
-
}
|
|
958
|
-
)
|
|
959
|
-
}
|
|
960
|
-
)
|
|
961
|
-
] })
|
|
962
|
-
] })
|
|
999
|
+
),
|
|
1000
|
+
/* @__PURE__ */ jsxs(
|
|
1001
|
+
Flex,
|
|
1002
|
+
{
|
|
1003
|
+
direction: "column",
|
|
1004
|
+
itemAlign: "end",
|
|
1005
|
+
className: "oui-min-w-0 oui-flex-1",
|
|
1006
|
+
children: [
|
|
1007
|
+
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, className: "oui-text-right", children: props.rightLabel }),
|
|
1008
|
+
/* @__PURE__ */ jsx(Text, { size: "lg", intensity: 54, className: "oui-text-right", children: formatPercent(props.refereeGetRate) })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
)
|
|
963
1012
|
] });
|
|
964
1013
|
};
|
|
1014
|
+
var PassDownHint = (props) => {
|
|
1015
|
+
const { t } = useTranslation();
|
|
1016
|
+
if (props.amount <= 0) {
|
|
1017
|
+
return null;
|
|
1018
|
+
}
|
|
1019
|
+
return /* @__PURE__ */ jsxs(
|
|
1020
|
+
Flex,
|
|
1021
|
+
{
|
|
1022
|
+
width: "100%",
|
|
1023
|
+
itemAlign: "center",
|
|
1024
|
+
gap: 2,
|
|
1025
|
+
className: "oui-overflow-hidden",
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ jsx("div", { className: "oui-h-3 oui-w-6 oui-shrink-0 oui-rounded-[2px] oui-border oui-border-line-6 oui-bg-[repeating-linear-gradient(45deg,rgba(255,255,255,0.08)_0,rgba(255,255,255,0.08)_4px,transparent_4px,transparent_8px)]" }),
|
|
1028
|
+
/* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 36, className: "oui-leading-[15px]", children: t("affiliate.atLeastPassesDown", {
|
|
1029
|
+
amount: formatPercent(props.amount)
|
|
1030
|
+
}) })
|
|
1031
|
+
]
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
};
|
|
965
1035
|
var ReferralCodeFormWidget = (props) => {
|
|
966
1036
|
const state = useReferralCodeFormScript(props);
|
|
967
1037
|
return /* @__PURE__ */ jsx(ReferralCodeForm, { ...state, ...props });
|
|
@@ -1044,6 +1114,21 @@ var useBindReferralCodeScript = (options) => {
|
|
|
1044
1114
|
onConfirm
|
|
1045
1115
|
};
|
|
1046
1116
|
};
|
|
1117
|
+
var WarningBox = (props) => /* @__PURE__ */ jsxs(
|
|
1118
|
+
Flex,
|
|
1119
|
+
{
|
|
1120
|
+
className: "oui-bg-warning/10",
|
|
1121
|
+
justify: "start",
|
|
1122
|
+
itemAlign: "start",
|
|
1123
|
+
gap: 1,
|
|
1124
|
+
r: "lg",
|
|
1125
|
+
p: 3,
|
|
1126
|
+
children: [
|
|
1127
|
+
/* @__PURE__ */ jsx(WarningIcon, { className: "oui-shrink-0 oui-text-warning" }),
|
|
1128
|
+
typeof props.children === "string" ? /* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, className: "oui-text-warning", children: props.children }) : props.children
|
|
1129
|
+
]
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1047
1132
|
var BindReferralCode = (props) => {
|
|
1048
1133
|
const { t } = useTranslation();
|
|
1049
1134
|
const bindCodeInvalid = !props.skipBinding && props.formattedBindCode.length >= 4 && !props.isBindCodeChecking && props.isBindCodeExist === false;
|
|
@@ -1264,10 +1349,12 @@ var TradingVolumeProgress = (props) => {
|
|
|
1264
1349
|
}
|
|
1265
1350
|
);
|
|
1266
1351
|
};
|
|
1267
|
-
function
|
|
1352
|
+
function parseMaxRebateRateInfoFromSettled(result) {
|
|
1268
1353
|
if (result.status !== "fulfilled") return void 0;
|
|
1269
|
-
|
|
1270
|
-
|
|
1354
|
+
if (typeof result.value !== "object" || result.value === null) {
|
|
1355
|
+
return void 0;
|
|
1356
|
+
}
|
|
1357
|
+
return result.value;
|
|
1271
1358
|
}
|
|
1272
1359
|
var Hero = () => {
|
|
1273
1360
|
const { t } = useTranslation();
|
|
@@ -1281,9 +1368,13 @@ var Hero = () => {
|
|
|
1281
1368
|
multiLevelRebateInfo,
|
|
1282
1369
|
multiLevelRebateInfoMutate,
|
|
1283
1370
|
maxRebateRate,
|
|
1371
|
+
maxRebateRateInfo,
|
|
1372
|
+
bonusMaxRebateRate,
|
|
1373
|
+
baseRebateRate,
|
|
1284
1374
|
maxRebateRateMutate,
|
|
1285
1375
|
mutate,
|
|
1286
|
-
referralInfo
|
|
1376
|
+
referralInfo,
|
|
1377
|
+
generateCode
|
|
1287
1378
|
} = useReferralContext();
|
|
1288
1379
|
const boundReferralCode = referralInfo?.referee_info?.referer_code?.trim() ?? "";
|
|
1289
1380
|
const openBindReferralOnlyModal = () => {
|
|
@@ -1294,10 +1385,14 @@ var Hero = () => {
|
|
|
1294
1385
|
}
|
|
1295
1386
|
});
|
|
1296
1387
|
};
|
|
1297
|
-
const showCreateReferralCodeModal = (
|
|
1388
|
+
const showCreateReferralCodeModal = (maxRateInfoOverride) => {
|
|
1389
|
+
const latestMaxRateInfo = maxRateInfoOverride ?? maxRebateRateInfo;
|
|
1298
1390
|
modal.show(ReferralCodeFormDialogId, {
|
|
1299
1391
|
type: "create" /* Create */,
|
|
1300
|
-
maxRebateRate:
|
|
1392
|
+
maxRebateRate: latestMaxRateInfo?.max_rebate_rate ?? maxRebateRate ?? 0,
|
|
1393
|
+
bonusMaxRebateRate: latestMaxRateInfo?.bonus_max_rebate_rate ?? bonusMaxRebateRate,
|
|
1394
|
+
baseRebateRate: latestMaxRateInfo?.base_rebate_rate ?? baseRebateRate,
|
|
1395
|
+
referralCode: generateCode?.code,
|
|
1301
1396
|
directBonusRebateRate: 0,
|
|
1302
1397
|
onSuccess: () => {
|
|
1303
1398
|
multiLevelRebateInfoMutate();
|
|
@@ -1317,8 +1412,10 @@ var Hero = () => {
|
|
|
1317
1412
|
multiLevelRebateInfoMutate(),
|
|
1318
1413
|
mutate()
|
|
1319
1414
|
]);
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1415
|
+
const latestMaxRebateRateInfo = parseMaxRebateRateInfoFromSettled(
|
|
1416
|
+
results[0]
|
|
1417
|
+
);
|
|
1418
|
+
showCreateReferralCodeModal(latestMaxRebateRateInfo);
|
|
1322
1419
|
}
|
|
1323
1420
|
});
|
|
1324
1421
|
return;
|
|
@@ -1810,12 +1907,18 @@ var useMultiLevelReferralScript = () => {
|
|
|
1810
1907
|
const {
|
|
1811
1908
|
isMultiLevelReferralUnlocked,
|
|
1812
1909
|
maxRebateRate,
|
|
1910
|
+
bonusMaxRebateRate,
|
|
1911
|
+
baseRebateRate,
|
|
1912
|
+
generateCode,
|
|
1813
1913
|
multiLevelRebateInfoMutate
|
|
1814
1914
|
} = useReferralContext();
|
|
1815
1915
|
const createReferralCode = () => {
|
|
1816
1916
|
modal.show(ReferralCodeFormDialogId, {
|
|
1817
1917
|
type: "create" /* Create */,
|
|
1818
1918
|
maxRebateRate,
|
|
1919
|
+
bonusMaxRebateRate,
|
|
1920
|
+
baseRebateRate,
|
|
1921
|
+
referralCode: generateCode?.code,
|
|
1819
1922
|
// because there is no multi level code, the /v1/referral/multi_level/rebate_info interface will throw an error, so here set to 0, and hide the extra bonus display when creating multi level code
|
|
1820
1923
|
directBonusRebateRate: 0,
|
|
1821
1924
|
onSuccess: () => {
|
|
@@ -1844,6 +1947,7 @@ var ReferralInfo = (props) => {
|
|
|
1844
1947
|
gap: 4,
|
|
1845
1948
|
p: 5,
|
|
1846
1949
|
direction: "column",
|
|
1950
|
+
itemAlign: "start",
|
|
1847
1951
|
intensity: 900,
|
|
1848
1952
|
className: "oui-affiliate-referralInfo oui-border oui-border-line-6",
|
|
1849
1953
|
children: [
|
|
@@ -1890,65 +1994,42 @@ var ReferralInfo = (props) => {
|
|
|
1890
1994
|
/* @__PURE__ */ jsx(Text, { size: "lg", color: "primaryLight", children: props.referralLink }),
|
|
1891
1995
|
/* @__PURE__ */ jsx(CopyButton, { value: props.referralLink })
|
|
1892
1996
|
] }),
|
|
1997
|
+
/* @__PURE__ */ jsx(
|
|
1998
|
+
Text,
|
|
1999
|
+
{
|
|
2000
|
+
size: "lg",
|
|
2001
|
+
intensity: 98,
|
|
2002
|
+
className: "oui-w-full oui-text-left oui-tracking-[0.03em]",
|
|
2003
|
+
children: t("affiliate.yourCommissionRates")
|
|
2004
|
+
}
|
|
2005
|
+
),
|
|
1893
2006
|
/* @__PURE__ */ jsxs(
|
|
1894
|
-
|
|
2007
|
+
Flex,
|
|
1895
2008
|
{
|
|
1896
2009
|
width: "100%",
|
|
1897
|
-
|
|
1898
|
-
|
|
2010
|
+
gap: 4,
|
|
2011
|
+
itemAlign: "stretch",
|
|
2012
|
+
direction: "row",
|
|
2013
|
+
className: "oui-affiliate-referralInfo-commissionRates",
|
|
1899
2014
|
children: [
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
/* @__PURE__ */ jsxs(Text.formatted, { size: "3xl", intensity: 80, children: [
|
|
1919
|
-
props.referrerRebateRate,
|
|
1920
|
-
"%"
|
|
1921
|
-
] }),
|
|
1922
|
-
/* @__PURE__ */ jsxs(Text.formatted, { size: "3xl", intensity: 36, children: [
|
|
1923
|
-
props.refereeRebateRate,
|
|
1924
|
-
"%"
|
|
1925
|
-
] })
|
|
1926
|
-
] }),
|
|
1927
|
-
props.directBonusRebateRate > 0 && /* @__PURE__ */ jsxs(Flex, { gap: 2, mt: 4, width: "100%", className: "oui-items-center", children: [
|
|
1928
|
-
/* @__PURE__ */ jsx(
|
|
1929
|
-
GiftIcon,
|
|
1930
|
-
{
|
|
1931
|
-
size: 16,
|
|
1932
|
-
className: "oui-shrink-0 oui-text-base-contrast oui-mt-[1px]"
|
|
1933
|
-
}
|
|
1934
|
-
),
|
|
1935
|
-
/* @__PURE__ */ jsx(
|
|
1936
|
-
Text,
|
|
1937
|
-
{
|
|
1938
|
-
intensity: 54,
|
|
1939
|
-
as: "span",
|
|
1940
|
-
className: "oui-flex-1 oui-min-w-0 oui-tracking-[0.03em]",
|
|
1941
|
-
children: /* @__PURE__ */ jsx(
|
|
1942
|
-
Trans,
|
|
1943
|
-
{
|
|
1944
|
-
i18nKey: "affiliate.extraBonusOnDirectReferrals",
|
|
1945
|
-
values: { amount: props.directBonusRebateRate },
|
|
1946
|
-
components: [/* @__PURE__ */ jsx(Text, { as: "span", color: "primaryLight" }, "0")]
|
|
1947
|
-
}
|
|
1948
|
-
)
|
|
1949
|
-
}
|
|
1950
|
-
)
|
|
1951
|
-
] })
|
|
2015
|
+
/* @__PURE__ */ jsx(
|
|
2016
|
+
CommissionRateCard,
|
|
2017
|
+
{
|
|
2018
|
+
title: t("affiliate.directTrades"),
|
|
2019
|
+
rate: props.directTradesRate,
|
|
2020
|
+
description: t("affiliate.directTradesDescription"),
|
|
2021
|
+
className: "oui-affiliate-referralInfo-directTrades"
|
|
2022
|
+
}
|
|
2023
|
+
),
|
|
2024
|
+
props.showIndirectTrades ? /* @__PURE__ */ jsx(
|
|
2025
|
+
CommissionRateCard,
|
|
2026
|
+
{
|
|
2027
|
+
title: t("affiliate.indirectTrades"),
|
|
2028
|
+
rate: props.indirectTradesRate,
|
|
2029
|
+
description: t("affiliate.indirectTradesDescription"),
|
|
2030
|
+
className: "oui-affiliate-referralInfo-indirectTrades"
|
|
2031
|
+
}
|
|
2032
|
+
) : null
|
|
1952
2033
|
]
|
|
1953
2034
|
}
|
|
1954
2035
|
)
|
|
@@ -1956,6 +2037,59 @@ var ReferralInfo = (props) => {
|
|
|
1956
2037
|
}
|
|
1957
2038
|
);
|
|
1958
2039
|
};
|
|
2040
|
+
var CommissionRateCard = (props) => {
|
|
2041
|
+
return /* @__PURE__ */ jsx(
|
|
2042
|
+
Flex,
|
|
2043
|
+
{
|
|
2044
|
+
r: "2xl",
|
|
2045
|
+
direction: "column",
|
|
2046
|
+
itemAlign: "start",
|
|
2047
|
+
justify: "center",
|
|
2048
|
+
p: 5,
|
|
2049
|
+
className: cn(
|
|
2050
|
+
"oui-min-w-0 oui-flex-1 oui-bg-base-contrast-4",
|
|
2051
|
+
props.className
|
|
2052
|
+
),
|
|
2053
|
+
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, width: "100%", itemAlign: "start", children: [
|
|
2054
|
+
/* @__PURE__ */ jsx(
|
|
2055
|
+
Text,
|
|
2056
|
+
{
|
|
2057
|
+
size: "sm",
|
|
2058
|
+
intensity: 98,
|
|
2059
|
+
weight: "semibold",
|
|
2060
|
+
className: "oui-w-full oui-tracking-[0.03em]",
|
|
2061
|
+
children: props.title
|
|
2062
|
+
}
|
|
2063
|
+
),
|
|
2064
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, width: "100%", itemAlign: "start", children: [
|
|
2065
|
+
/* @__PURE__ */ jsxs(
|
|
2066
|
+
Text,
|
|
2067
|
+
{
|
|
2068
|
+
size: "3xl",
|
|
2069
|
+
weight: "semibold",
|
|
2070
|
+
color: "success",
|
|
2071
|
+
className: "oui-leading-9 oui-tracking-[0.03em]",
|
|
2072
|
+
children: [
|
|
2073
|
+
props.rate,
|
|
2074
|
+
"%"
|
|
2075
|
+
]
|
|
2076
|
+
}
|
|
2077
|
+
),
|
|
2078
|
+
/* @__PURE__ */ jsx(
|
|
2079
|
+
Text,
|
|
2080
|
+
{
|
|
2081
|
+
size: "sm",
|
|
2082
|
+
intensity: 54,
|
|
2083
|
+
weight: "semibold",
|
|
2084
|
+
className: "oui-w-full oui-leading-5 oui-tracking-[0.03em]",
|
|
2085
|
+
children: props.description
|
|
2086
|
+
}
|
|
2087
|
+
)
|
|
2088
|
+
] })
|
|
2089
|
+
] })
|
|
2090
|
+
}
|
|
2091
|
+
);
|
|
2092
|
+
};
|
|
1959
2093
|
var Container = (props) => {
|
|
1960
2094
|
return /* @__PURE__ */ jsx(
|
|
1961
2095
|
Flex,
|
|
@@ -2026,11 +2160,14 @@ var useReferralInfoScript = () => {
|
|
|
2026
2160
|
if (!referralCode) return "";
|
|
2027
2161
|
return generateReferralLink(referralLinkUrl, referralCode);
|
|
2028
2162
|
}, [referralCode]);
|
|
2029
|
-
const
|
|
2030
|
-
return new Decimal(multiLevelRebateInfo?.
|
|
2163
|
+
const directTradesRate = useMemo(() => {
|
|
2164
|
+
return new Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).add(multiLevelRebateInfo?.base_rebate_rate ?? 0).mul(100).toNumber();
|
|
2165
|
+
}, [multiLevelRebateInfo]);
|
|
2166
|
+
const indirectTradesRate = useMemo(() => {
|
|
2167
|
+
return new Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).sub(multiLevelRebateInfo?.default_bonus_referee_rebate_rate ?? 0).mul(100).toNumber();
|
|
2031
2168
|
}, [multiLevelRebateInfo]);
|
|
2032
|
-
const
|
|
2033
|
-
return new Decimal(multiLevelRebateInfo?.
|
|
2169
|
+
const showIndirectTrades = useMemo(() => {
|
|
2170
|
+
return !new Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).eq(0);
|
|
2034
2171
|
}, [multiLevelRebateInfo]);
|
|
2035
2172
|
const directBonusRebateRate = useMemo(() => {
|
|
2036
2173
|
return new Decimal(multiLevelRebateInfo?.direct_bonus_rebate_rate ?? 0).mul(100).toNumber();
|
|
@@ -2041,6 +2178,9 @@ var useReferralInfoScript = () => {
|
|
|
2041
2178
|
focusField,
|
|
2042
2179
|
referralCode: multiLevelRebateInfo?.referral_code,
|
|
2043
2180
|
maxRebateRate,
|
|
2181
|
+
bonusMaxRebateRate: multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2182
|
+
baseRebateRate: multiLevelRebateInfo?.base_rebate_rate,
|
|
2183
|
+
defaultBonusRefereeRebateRate: multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2044
2184
|
referrerRebateRate: multiLevelRebateInfo?.referrer_rebate_rate,
|
|
2045
2185
|
directInvites: multiLevelRebateInfo?.direct_invites,
|
|
2046
2186
|
directBonusRebateRate,
|
|
@@ -2054,8 +2194,9 @@ var useReferralInfoScript = () => {
|
|
|
2054
2194
|
referralCode,
|
|
2055
2195
|
referralLink,
|
|
2056
2196
|
multiLevelRebateInfo,
|
|
2057
|
-
|
|
2058
|
-
|
|
2197
|
+
directTradesRate,
|
|
2198
|
+
indirectTradesRate,
|
|
2199
|
+
showIndirectTrades,
|
|
2059
2200
|
directBonusRebateRate
|
|
2060
2201
|
};
|
|
2061
2202
|
};
|
|
@@ -2225,13 +2366,7 @@ var BreakdownCell = ({ total, direct, indirect, directBonus, prefix, fix = 0, ti
|
|
|
2225
2366
|
"\u2022 ",
|
|
2226
2367
|
t("affiliate.direct"),
|
|
2227
2368
|
": ",
|
|
2228
|
-
format9(direct + directBonus)
|
|
2229
|
-
" ",
|
|
2230
|
-
/* @__PURE__ */ jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2231
|
-
"(",
|
|
2232
|
-
t("affiliate.directInclBonus", { amount: format9(directBonus) }),
|
|
2233
|
-
")"
|
|
2234
|
-
] })
|
|
2369
|
+
format9(direct + directBonus)
|
|
2235
2370
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2236
2371
|
"\u2022 ",
|
|
2237
2372
|
t("affiliate.direct"),
|
|
@@ -2488,6 +2623,12 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2488
2623
|
return refereesPaginationUtils.parsePagination(refereesMeta);
|
|
2489
2624
|
}, [refereesMeta, refereesPaginationUtils]);
|
|
2490
2625
|
const { multiLevelRebateInfo, maxRebateRate, multiLevelRebateInfoMutate } = useReferralContext();
|
|
2626
|
+
const showActionColumn = useMemo(() => {
|
|
2627
|
+
return !new Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).eq(0);
|
|
2628
|
+
}, [multiLevelRebateInfo]);
|
|
2629
|
+
const baseRebateRate = useMemo(() => {
|
|
2630
|
+
return multiLevelRebateInfo?.base_rebate_rate ?? 0;
|
|
2631
|
+
}, [multiLevelRebateInfo]);
|
|
2491
2632
|
const onEditReferee = useCallback(
|
|
2492
2633
|
(type, item) => {
|
|
2493
2634
|
const referrerRebateRate = type === "reset" /* Reset */ ? multiLevelRebateInfo?.referrer_rebate_rate : item.referral_rebate_rate;
|
|
@@ -2495,6 +2636,9 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2495
2636
|
type,
|
|
2496
2637
|
referralCode: multiLevelRebateInfo?.referral_code,
|
|
2497
2638
|
maxRebateRate,
|
|
2639
|
+
bonusMaxRebateRate: multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2640
|
+
baseRebateRate: multiLevelRebateInfo?.base_rebate_rate,
|
|
2641
|
+
defaultBonusRefereeRebateRate: multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2498
2642
|
referrerRebateRate,
|
|
2499
2643
|
onSuccess: () => {
|
|
2500
2644
|
multiLevelRebateInfoMutate();
|
|
@@ -2510,6 +2654,11 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2510
2654
|
},
|
|
2511
2655
|
[
|
|
2512
2656
|
maxRebateRate,
|
|
2657
|
+
multiLevelRebateInfo?.base_rebate_rate,
|
|
2658
|
+
multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2659
|
+
multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2660
|
+
multiLevelRebateInfo?.direct_bonus_rebate_rate,
|
|
2661
|
+
multiLevelRebateInfo?.direct_invites,
|
|
2513
2662
|
multiLevelRebateInfo?.referral_code,
|
|
2514
2663
|
multiLevelRebateInfo?.referrer_rebate_rate,
|
|
2515
2664
|
multiLevelRebateInfoMutate,
|
|
@@ -2550,12 +2699,17 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2550
2699
|
refereesPagination,
|
|
2551
2700
|
isRefereesLoading,
|
|
2552
2701
|
onEditReferee,
|
|
2553
|
-
onRefereesSort
|
|
2702
|
+
onRefereesSort,
|
|
2703
|
+
showActionColumn,
|
|
2704
|
+
baseRebateRate
|
|
2554
2705
|
};
|
|
2555
2706
|
};
|
|
2556
2707
|
var getRebateRateText = (rate) => {
|
|
2557
2708
|
return (rate * 100).toFixed(0) + "%";
|
|
2558
2709
|
};
|
|
2710
|
+
var getRefereeRebateRateText = (refereeRate, baseRebateRate) => {
|
|
2711
|
+
return new Decimal(refereeRate).add(baseRebateRate).mul(100).toFixed(0) + "%";
|
|
2712
|
+
};
|
|
2559
2713
|
var getRefereeType = (bindType) => {
|
|
2560
2714
|
const { t } = useTranslation();
|
|
2561
2715
|
if (bindType === "legacy") {
|
|
@@ -2569,7 +2723,7 @@ var getRefereeType = (bindType) => {
|
|
|
2569
2723
|
tooltip: t("affiliate.multiLevel.tooltip")
|
|
2570
2724
|
};
|
|
2571
2725
|
};
|
|
2572
|
-
var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
2726
|
+
var MobileRefereeItem = ({ item, onEditReferee, showActionColumn, baseRebateRate }) => {
|
|
2573
2727
|
const { t } = useTranslation();
|
|
2574
2728
|
const typeInfo = getRefereeType(item.bind_type);
|
|
2575
2729
|
return /* @__PURE__ */ jsxs(MobileCard, { children: [
|
|
@@ -2584,14 +2738,23 @@ var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
|
2584
2738
|
) }),
|
|
2585
2739
|
/* @__PURE__ */ jsx(MobileCell, { label: t("affiliate.boundAt"), align: "end", children: /* @__PURE__ */ jsx(Text, { size: "sm", children: formatYMDTime(item.code_binding_time) }) }),
|
|
2586
2740
|
/* @__PURE__ */ jsx(MobileCell, { label: t("affiliate.referralCodes"), children: /* @__PURE__ */ jsx(Text, { size: "sm", children: item.bind_code }) }),
|
|
2587
|
-
/* @__PURE__ */ jsx(
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
"
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2741
|
+
/* @__PURE__ */ jsx(
|
|
2742
|
+
MobileCell,
|
|
2743
|
+
{
|
|
2744
|
+
label: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2745
|
+
children: /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
|
|
2746
|
+
getRebateRateText(item.referral_rebate_rate) + "/",
|
|
2747
|
+
/* @__PURE__ */ jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2748
|
+
getRefereeRebateRateText(
|
|
2749
|
+
item.referee_rebate_rate,
|
|
2750
|
+
baseRebateRate
|
|
2751
|
+
),
|
|
2752
|
+
" "
|
|
2753
|
+
] }),
|
|
2754
|
+
!item.is_default_rate && /* @__PURE__ */ jsx("span", { className: "oui-text-primary-light", children: `(${t("affiliate.customized")})` })
|
|
2755
|
+
] })
|
|
2756
|
+
}
|
|
2757
|
+
),
|
|
2595
2758
|
/* @__PURE__ */ jsx(MobileCell, { label: t("affiliate.networkSize"), align: "end", children: /* @__PURE__ */ jsx(
|
|
2596
2759
|
BreakdownCell,
|
|
2597
2760
|
{
|
|
@@ -2624,7 +2787,7 @@ var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
|
2624
2787
|
title: t("affiliate.commission")
|
|
2625
2788
|
}
|
|
2626
2789
|
) }),
|
|
2627
|
-
/* @__PURE__ */ jsx(
|
|
2790
|
+
showActionColumn && /* @__PURE__ */ jsx(
|
|
2628
2791
|
MobileCell,
|
|
2629
2792
|
{
|
|
2630
2793
|
label: t("common.action"),
|
|
@@ -2689,12 +2852,16 @@ var RefereesTableUI = (props) => {
|
|
|
2689
2852
|
render: (value) => /* @__PURE__ */ jsx(Text, { children: value })
|
|
2690
2853
|
},
|
|
2691
2854
|
{
|
|
2692
|
-
title: t("affiliate.referralCodes.column.you&
|
|
2855
|
+
title: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2693
2856
|
dataIndex: "referee_rebate_rate",
|
|
2857
|
+
width: 175,
|
|
2694
2858
|
render: (_, record) => /* @__PURE__ */ jsxs(Text, { children: [
|
|
2695
2859
|
getRebateRateText(record.referral_rebate_rate) + "/",
|
|
2696
2860
|
/* @__PURE__ */ jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2697
|
-
|
|
2861
|
+
getRefereeRebateRateText(
|
|
2862
|
+
record.referee_rebate_rate,
|
|
2863
|
+
props.baseRebateRate
|
|
2864
|
+
),
|
|
2698
2865
|
" "
|
|
2699
2866
|
] }),
|
|
2700
2867
|
!record.is_default_rate && /* @__PURE__ */ jsx("span", { className: "oui-text-primary-light", children: `(${t("affiliate.customized")})` })
|
|
@@ -2748,30 +2915,35 @@ var RefereesTableUI = (props) => {
|
|
|
2748
2915
|
),
|
|
2749
2916
|
onSort: true
|
|
2750
2917
|
},
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2918
|
+
...props.showActionColumn ? [
|
|
2919
|
+
{
|
|
2920
|
+
title: t("common.action"),
|
|
2921
|
+
dataIndex: "action",
|
|
2922
|
+
render: (_, record) => record.bind_type !== "legacy" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2923
|
+
/* @__PURE__ */ jsx(
|
|
2924
|
+
Text,
|
|
2925
|
+
{
|
|
2926
|
+
className: "oui-refereesTable-edit-btn oui-cursor-pointer oui-text-primary-light",
|
|
2927
|
+
onClick: () => props.onEditReferee("edit" /* Edit */, record),
|
|
2928
|
+
children: t("common.edit")
|
|
2929
|
+
}
|
|
2930
|
+
),
|
|
2931
|
+
!record.is_default_rate && /* @__PURE__ */ jsx(
|
|
2932
|
+
Text,
|
|
2933
|
+
{
|
|
2934
|
+
className: "oui-refereesTable-reset-btn oui-ms-2 oui-cursor-pointer oui-text-primary-light",
|
|
2935
|
+
onClick: () => props.onEditReferee(
|
|
2936
|
+
"reset" /* Reset */,
|
|
2937
|
+
record
|
|
2938
|
+
),
|
|
2939
|
+
children: t("common.reset")
|
|
2940
|
+
}
|
|
2941
|
+
)
|
|
2942
|
+
] }) : null
|
|
2943
|
+
}
|
|
2944
|
+
] : []
|
|
2773
2945
|
];
|
|
2774
|
-
}, [t, props.onEditReferee]);
|
|
2946
|
+
}, [t, props.onEditReferee, props.showActionColumn, props.baseRebateRate]);
|
|
2775
2947
|
return /* @__PURE__ */ jsx(Fragment, { children: isMobile ? /* @__PURE__ */ jsx("div", { className: "oui-affiliate-refereesTable oui-flex oui-flex-col oui-px-4", children: /* @__PURE__ */ jsx(
|
|
2776
2948
|
ListView,
|
|
2777
2949
|
{
|
|
@@ -2782,7 +2954,9 @@ var RefereesTableUI = (props) => {
|
|
|
2782
2954
|
MobileRefereeItem,
|
|
2783
2955
|
{
|
|
2784
2956
|
item,
|
|
2785
|
-
onEditReferee: props.onEditReferee
|
|
2957
|
+
onEditReferee: props.onEditReferee,
|
|
2958
|
+
showActionColumn: props.showActionColumn,
|
|
2959
|
+
baseRebateRate: props.baseRebateRate
|
|
2786
2960
|
}
|
|
2787
2961
|
),
|
|
2788
2962
|
/* @__PURE__ */ jsx(Divider, { intensity: 8 })
|
|
@@ -2839,10 +3013,12 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2839
3013
|
const multiLevelReferralCode = multiLevelRebateInfo?.referral_code;
|
|
2840
3014
|
if (multiLevelRebateInfo?.referral_code) {
|
|
2841
3015
|
const maxRebateRate = multiLevelRebateInfo.max_rebate_rate ?? 0;
|
|
2842
|
-
const
|
|
3016
|
+
const bonusMaxRebateRate = multiLevelRebateInfo.bonus_max_rebate_rate ?? maxRebateRate;
|
|
3017
|
+
const baseRebateRate = multiLevelRebateInfo.base_rebate_rate ?? 0;
|
|
3018
|
+
const defaultRefereeRebateRate = multiLevelRebateInfo.default_bonus_referee_rebate_rate ?? multiLevelRebateInfo.default_referee_rebate_rate ?? 0;
|
|
2843
3019
|
const referrerRebateRate = Math.max(
|
|
2844
3020
|
0,
|
|
2845
|
-
|
|
3021
|
+
bonusMaxRebateRate - defaultRefereeRebateRate
|
|
2846
3022
|
);
|
|
2847
3023
|
const directInvites = multiLevelRebateInfo?.direct_invites ?? 0;
|
|
2848
3024
|
const indirectInvites = multiLevelRebateInfo?.indirect_invites ?? 0;
|
|
@@ -2861,6 +3037,7 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2861
3037
|
indirect_rebate: indirectRebate,
|
|
2862
3038
|
direct_bonus_rebate: directBonusRebate,
|
|
2863
3039
|
max_rebate_rate: maxRebateRate,
|
|
3040
|
+
base_rebate_rate: baseRebateRate,
|
|
2864
3041
|
referee_rebate_rate: defaultRefereeRebateRate,
|
|
2865
3042
|
referrer_rebate_rate: referrerRebateRate,
|
|
2866
3043
|
total_invites: directInvites + indirectInvites,
|
|
@@ -2889,6 +3066,7 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2889
3066
|
direct_rebate: totalRebate,
|
|
2890
3067
|
indirect_rebate: 0,
|
|
2891
3068
|
max_rebate_rate: item.max_rebate_rate ?? 0,
|
|
3069
|
+
base_rebate_rate: 0,
|
|
2892
3070
|
referee_rebate_rate: item.referee_rebate_rate ?? 0,
|
|
2893
3071
|
referrer_rebate_rate: item.referrer_rebate_rate ?? 0,
|
|
2894
3072
|
total_invites: totalInvites,
|
|
@@ -2954,6 +3132,9 @@ var useReferralCodesTableScript = (props = {}) => {
|
|
|
2954
3132
|
isLoading: enabled && !codes
|
|
2955
3133
|
};
|
|
2956
3134
|
};
|
|
3135
|
+
var getRefereeRebateRateText2 = (refereeRate, baseRebateRate) => {
|
|
3136
|
+
return new Decimal(refereeRate).add(baseRebateRate).mul(100).toFixed(0);
|
|
3137
|
+
};
|
|
2957
3138
|
var getReferralCodeType = (referralType) => {
|
|
2958
3139
|
const { t } = useTranslation();
|
|
2959
3140
|
if (referralType === "multi") {
|
|
@@ -2970,7 +3151,10 @@ var getReferralCodeType = (referralType) => {
|
|
|
2970
3151
|
var MobileReferralCodeItem = ({ item, copyCode }) => {
|
|
2971
3152
|
const { t } = useTranslation();
|
|
2972
3153
|
const referrerRate = new Decimal(item.referrer_rebate_rate ?? 0).mul(100).toFixed(0);
|
|
2973
|
-
const refereeRate =
|
|
3154
|
+
const refereeRate = getRefereeRebateRateText2(
|
|
3155
|
+
item.referee_rebate_rate ?? 0,
|
|
3156
|
+
item.base_rebate_rate ?? 0
|
|
3157
|
+
);
|
|
2974
3158
|
const typeInfo = getReferralCodeType(item.referral_type);
|
|
2975
3159
|
return /* @__PURE__ */ jsxs(MobileCard, { children: [
|
|
2976
3160
|
/* @__PURE__ */ jsx(MobileCell, { label: t("affiliate.referralCode"), children: /* @__PURE__ */ jsx(Text, { children: item.code || "" }) }),
|
|
@@ -2985,7 +3169,7 @@ var MobileReferralCodeItem = ({ item, copyCode }) => {
|
|
|
2985
3169
|
/* @__PURE__ */ jsx(
|
|
2986
3170
|
MobileCell,
|
|
2987
3171
|
{
|
|
2988
|
-
label: t("affiliate.referralCodes.column.you&
|
|
3172
|
+
label: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2989
3173
|
align: "end",
|
|
2990
3174
|
children: /* @__PURE__ */ jsxs(Text, { children: [
|
|
2991
3175
|
referrerRate,
|
|
@@ -3072,13 +3256,18 @@ var ReferralCodesTableUI = (props) => {
|
|
|
3072
3256
|
t("affiliate.referralCodes.column.defaultSplit"),
|
|
3073
3257
|
/* @__PURE__ */ jsx("br", {}),
|
|
3074
3258
|
"(",
|
|
3075
|
-
t("affiliate.referralCodes.column.you&
|
|
3259
|
+
t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
3076
3260
|
")"
|
|
3077
3261
|
] }),
|
|
3078
3262
|
dataIndex: "rate",
|
|
3263
|
+
width: 180,
|
|
3264
|
+
className: "!oui-whitespace-normal",
|
|
3079
3265
|
render: (_, record) => {
|
|
3080
3266
|
const referrerRate = new Decimal(record.referrer_rebate_rate ?? 0).mul(100).toFixed(0);
|
|
3081
|
-
const refereeRate =
|
|
3267
|
+
const refereeRate = getRefereeRebateRateText2(
|
|
3268
|
+
record.referee_rebate_rate ?? 0,
|
|
3269
|
+
record.base_rebate_rate ?? 0
|
|
3270
|
+
);
|
|
3082
3271
|
return /* @__PURE__ */ jsxs(Text, { children: [
|
|
3083
3272
|
referrerRate,
|
|
3084
3273
|
"%",
|
|
@@ -3271,35 +3460,44 @@ var Summary = (props) => {
|
|
|
3271
3460
|
}
|
|
3272
3461
|
}
|
|
3273
3462
|
),
|
|
3274
|
-
/* @__PURE__ */ jsxs(
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3463
|
+
/* @__PURE__ */ jsxs(
|
|
3464
|
+
Flex,
|
|
3465
|
+
{
|
|
3466
|
+
width: "100%",
|
|
3467
|
+
gap: 6,
|
|
3468
|
+
itemAlign: "stretch",
|
|
3469
|
+
className: "oui-flex-col md:oui-flex-row",
|
|
3470
|
+
children: [
|
|
3471
|
+
/* @__PURE__ */ jsx(
|
|
3472
|
+
SummaryItem,
|
|
3473
|
+
{
|
|
3474
|
+
prefix: "$",
|
|
3475
|
+
rule: "human",
|
|
3476
|
+
label: `${t("affiliate.referralVol")} (USDC)`,
|
|
3477
|
+
value: statistics.total_volume,
|
|
3478
|
+
direct: statistics.direct_volume,
|
|
3479
|
+
indirect: statistics.indirect_volume,
|
|
3480
|
+
classNames: {
|
|
3481
|
+
root: "oui-w-full md:oui-w-1/2 md:oui-h-full"
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
),
|
|
3485
|
+
/* @__PURE__ */ jsx(
|
|
3486
|
+
SummaryItem,
|
|
3487
|
+
{
|
|
3488
|
+
dp: 0,
|
|
3489
|
+
label: t("affiliate.referrals"),
|
|
3490
|
+
value: statistics.total_invites,
|
|
3491
|
+
direct: statistics.direct_invites,
|
|
3492
|
+
indirect: statistics.indirect_invites,
|
|
3493
|
+
classNames: {
|
|
3494
|
+
root: "oui-w-full md:oui-w-1/2 md:oui-h-full"
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
)
|
|
3498
|
+
]
|
|
3499
|
+
}
|
|
3500
|
+
)
|
|
3303
3501
|
]
|
|
3304
3502
|
}
|
|
3305
3503
|
);
|