@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.js
CHANGED
|
@@ -91,23 +91,33 @@ var useMultiLevelReferralData = () => {
|
|
|
91
91
|
const isMultiLevelReferralUnlocked = volumePrerequisite && volumePrerequisite.current_volume >= volumePrerequisite.required_volume;
|
|
92
92
|
const isMultiLevelEnabled = !!maxRebateRateRes;
|
|
93
93
|
const maxRebateRate = maxRebateRateRes?.max_rebate_rate;
|
|
94
|
+
const bonusMaxRebateRate = maxRebateRateRes?.bonus_max_rebate_rate ?? maxRebateRate ?? 0;
|
|
95
|
+
const baseRebateRate = maxRebateRateRes?.base_rebate_rate ?? 0;
|
|
94
96
|
const multiLevelRebateInfo = react.useMemo(() => {
|
|
95
97
|
if (!multiLevelRebateInfoRes) return;
|
|
96
98
|
const {
|
|
97
99
|
default_referee_rebate_rate: referee_rebate_rate,
|
|
100
|
+
default_bonus_referee_rebate_rate,
|
|
101
|
+
bonus_max_rebate_rate,
|
|
98
102
|
max_rebate_rate
|
|
99
103
|
} = multiLevelRebateInfoRes;
|
|
100
|
-
const
|
|
104
|
+
const refereeBonusRebateRate = default_bonus_referee_rebate_rate ?? referee_rebate_rate ?? 0;
|
|
105
|
+
const referrer_rebate_rate = new utils.Decimal(
|
|
106
|
+
bonus_max_rebate_rate ?? max_rebate_rate ?? 0
|
|
107
|
+
).sub(refereeBonusRebateRate).toNumber();
|
|
101
108
|
return {
|
|
102
109
|
...multiLevelRebateInfoRes,
|
|
103
|
-
referee_rebate_rate,
|
|
110
|
+
referee_rebate_rate: refereeBonusRebateRate,
|
|
104
111
|
referrer_rebate_rate
|
|
105
112
|
};
|
|
106
|
-
}, [multiLevelRebateInfoRes
|
|
113
|
+
}, [multiLevelRebateInfoRes]);
|
|
107
114
|
const isLoading = volumePrerequisiteLoading || maxRebateRateLoading || multiLevelRebateInfoLoading;
|
|
108
115
|
return {
|
|
109
116
|
volumePrerequisite,
|
|
110
117
|
maxRebateRate,
|
|
118
|
+
maxRebateRateInfo: maxRebateRateRes,
|
|
119
|
+
bonusMaxRebateRate,
|
|
120
|
+
baseRebateRate,
|
|
111
121
|
multiLevelRebateInfo,
|
|
112
122
|
isMultiLevelEnabled,
|
|
113
123
|
isMultiLevelReferralUnlocked,
|
|
@@ -161,6 +171,9 @@ var ReferralProvider = (props) => {
|
|
|
161
171
|
isMultiLevelReferralUnlocked,
|
|
162
172
|
multiLevelRebateInfoMutate,
|
|
163
173
|
maxRebateRate,
|
|
174
|
+
maxRebateRateInfo,
|
|
175
|
+
bonusMaxRebateRate,
|
|
176
|
+
baseRebateRate,
|
|
164
177
|
maxRebateRateMutate,
|
|
165
178
|
isLoading: isMultiLevelLoading
|
|
166
179
|
} = useMultiLevelReferralData();
|
|
@@ -274,6 +287,9 @@ var ReferralProvider = (props) => {
|
|
|
274
287
|
isMultiLevelReferralUnlocked,
|
|
275
288
|
multiLevelRebateInfoMutate,
|
|
276
289
|
maxRebateRate,
|
|
290
|
+
maxRebateRateInfo,
|
|
291
|
+
bonusMaxRebateRate,
|
|
292
|
+
baseRebateRate,
|
|
277
293
|
maxRebateRateMutate
|
|
278
294
|
};
|
|
279
295
|
}, [
|
|
@@ -305,6 +321,9 @@ var ReferralProvider = (props) => {
|
|
|
305
321
|
isMultiLevelReferralUnlocked,
|
|
306
322
|
multiLevelRebateInfoMutate,
|
|
307
323
|
maxRebateRate,
|
|
324
|
+
maxRebateRateInfo,
|
|
325
|
+
bonusMaxRebateRate,
|
|
326
|
+
baseRebateRate,
|
|
308
327
|
isMultiLevelLoading,
|
|
309
328
|
maxRebateRateMutate
|
|
310
329
|
]);
|
|
@@ -464,17 +483,23 @@ var useReferralCode = () => {
|
|
|
464
483
|
|
|
465
484
|
// src/pages/multiLevel/affiliate/referralCodeForm/referralCodeForm.script.ts
|
|
466
485
|
var useReferralCodeFormScript = (options) => {
|
|
467
|
-
const { type, referralCode,
|
|
486
|
+
const { type, referralCode, referrerRebateRate, accountId } = options;
|
|
468
487
|
const { t } = i18n.useTranslation();
|
|
469
488
|
const [newCode, setNewCode] = react.useState(referralCode || "");
|
|
470
489
|
const [isReview, setIsReview] = react.useState(false);
|
|
471
|
-
const
|
|
472
|
-
return new utils.Decimal(maxRebateRate).mul(100).toNumber();
|
|
473
|
-
}, [maxRebateRate]);
|
|
490
|
+
const bonusMaxRebatePercentage = react.useMemo(() => {
|
|
491
|
+
return new utils.Decimal(options.bonusMaxRebateRate ?? options.maxRebateRate ?? 0).mul(100).toNumber();
|
|
492
|
+
}, [options.bonusMaxRebateRate, options.maxRebateRate]);
|
|
493
|
+
const baseRebatePercentage = react.useMemo(() => {
|
|
494
|
+
return new utils.Decimal(options.baseRebateRate ?? 0).mul(100).toNumber();
|
|
495
|
+
}, [options.baseRebateRate]);
|
|
496
|
+
const totalSplitPercentage = react.useMemo(() => {
|
|
497
|
+
return new utils.Decimal(bonusMaxRebatePercentage).add(baseRebatePercentage).toNumber();
|
|
498
|
+
}, [bonusMaxRebatePercentage, baseRebatePercentage]);
|
|
474
499
|
const [referrerRebatePercentage, setReferrerRebatePercentage] = react.useState(
|
|
475
500
|
() => {
|
|
476
501
|
if (type === "create" /* Create */) {
|
|
477
|
-
return
|
|
502
|
+
return bonusMaxRebatePercentage;
|
|
478
503
|
}
|
|
479
504
|
if (referrerRebateRate) {
|
|
480
505
|
return new utils.Decimal(referrerRebateRate).mul(100).toNumber();
|
|
@@ -489,12 +514,17 @@ var useReferralCodeFormScript = (options) => {
|
|
|
489
514
|
resetRebateRate,
|
|
490
515
|
isMutating
|
|
491
516
|
} = useReferralCode();
|
|
492
|
-
const
|
|
517
|
+
const refereeBonusRebatePercentage = react.useMemo(() => {
|
|
493
518
|
return Math.max(
|
|
494
519
|
0,
|
|
495
|
-
new utils.Decimal(
|
|
520
|
+
new utils.Decimal(bonusMaxRebatePercentage).sub(referrerRebatePercentage).toNumber()
|
|
496
521
|
);
|
|
497
|
-
}, [
|
|
522
|
+
}, [bonusMaxRebatePercentage, referrerRebatePercentage]);
|
|
523
|
+
const refereeRebatePercentage = react.useMemo(() => {
|
|
524
|
+
return new utils.Decimal(baseRebatePercentage).add(refereeBonusRebatePercentage).toNumber();
|
|
525
|
+
}, [baseRebatePercentage, refereeBonusRebatePercentage]);
|
|
526
|
+
const directTradesPercentage = totalSplitPercentage;
|
|
527
|
+
const indirectTradesPercentage = referrerRebatePercentage;
|
|
498
528
|
const codeChanged = react.useMemo(() => {
|
|
499
529
|
return newCode !== referralCode;
|
|
500
530
|
}, [newCode, referralCode]);
|
|
@@ -526,7 +556,7 @@ var useReferralCodeFormScript = (options) => {
|
|
|
526
556
|
new_referral_code: newCode.toUpperCase().replace(/[^A-Z0-9]/g, "")
|
|
527
557
|
};
|
|
528
558
|
const updateRebateRateParams = {
|
|
529
|
-
referee_rebate_rate: new utils.Decimal(
|
|
559
|
+
referee_rebate_rate: new utils.Decimal(refereeBonusRebatePercentage).div(100).toNumber(),
|
|
530
560
|
account_ids: accountId ? [accountId] : void 0
|
|
531
561
|
};
|
|
532
562
|
try {
|
|
@@ -551,8 +581,9 @@ var useReferralCodeFormScript = (options) => {
|
|
|
551
581
|
};
|
|
552
582
|
const onCreate = async () => {
|
|
553
583
|
try {
|
|
554
|
-
const
|
|
555
|
-
|
|
584
|
+
const res = await createReferralCode({
|
|
585
|
+
referee_rebate_rate: new utils.Decimal(refereeBonusRebatePercentage).div(100).toNumber()
|
|
586
|
+
});
|
|
556
587
|
if (res.success) {
|
|
557
588
|
ui.toast.success(t("affiliate.referralCode.create.success"));
|
|
558
589
|
options.onSuccess?.();
|
|
@@ -575,10 +606,14 @@ var useReferralCodeFormScript = (options) => {
|
|
|
575
606
|
const onClick = () => {
|
|
576
607
|
switch (type) {
|
|
577
608
|
case "create" /* Create */:
|
|
578
|
-
|
|
609
|
+
if (isReview) {
|
|
610
|
+
onCreate();
|
|
611
|
+
} else {
|
|
612
|
+
setIsReview(true);
|
|
613
|
+
}
|
|
579
614
|
break;
|
|
580
615
|
case "edit" /* Edit */:
|
|
581
|
-
if (isReview) {
|
|
616
|
+
if (accountId || isReview) {
|
|
582
617
|
onEdit();
|
|
583
618
|
} else {
|
|
584
619
|
setIsReview(true);
|
|
@@ -589,15 +624,25 @@ var useReferralCodeFormScript = (options) => {
|
|
|
589
624
|
break;
|
|
590
625
|
}
|
|
591
626
|
};
|
|
592
|
-
const buttonDisabled =
|
|
627
|
+
const buttonDisabled = react.useMemo(() => {
|
|
628
|
+
if (type !== "edit" /* Edit */) {
|
|
629
|
+
return false;
|
|
630
|
+
}
|
|
631
|
+
return !codeChanged && !rateChanged;
|
|
632
|
+
}, [codeChanged, rateChanged, type]);
|
|
593
633
|
const confirmButtonLoading = isMutating;
|
|
594
634
|
return {
|
|
595
635
|
type,
|
|
596
636
|
onClick,
|
|
597
|
-
maxRebatePercentage,
|
|
637
|
+
maxRebatePercentage: bonusMaxRebatePercentage,
|
|
638
|
+
baseRebatePercentage,
|
|
639
|
+
totalSplitPercentage,
|
|
640
|
+
directTradesPercentage,
|
|
641
|
+
indirectTradesPercentage,
|
|
598
642
|
referrerRebatePercentage,
|
|
599
643
|
setReferrerRebatePercentage,
|
|
600
644
|
refereeRebatePercentage,
|
|
645
|
+
refereeBonusRebatePercentage,
|
|
601
646
|
confirmButtonLoading,
|
|
602
647
|
newCode,
|
|
603
648
|
setNewCode,
|
|
@@ -606,43 +651,6 @@ var useReferralCodeFormScript = (options) => {
|
|
|
606
651
|
onReset
|
|
607
652
|
};
|
|
608
653
|
};
|
|
609
|
-
var GiftIcon = (props) => {
|
|
610
|
-
const { size = 16, className, ...rest } = props;
|
|
611
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
612
|
-
"svg",
|
|
613
|
-
{
|
|
614
|
-
width: size,
|
|
615
|
-
height: size,
|
|
616
|
-
viewBox: "0 0 16 16",
|
|
617
|
-
fill: "none",
|
|
618
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
619
|
-
className,
|
|
620
|
-
...rest,
|
|
621
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
622
|
-
"path",
|
|
623
|
-
{
|
|
624
|
-
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",
|
|
625
|
-
fill: "currentColor"
|
|
626
|
-
}
|
|
627
|
-
)
|
|
628
|
-
}
|
|
629
|
-
);
|
|
630
|
-
};
|
|
631
|
-
var WarningBox = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
632
|
-
ui.Flex,
|
|
633
|
-
{
|
|
634
|
-
className: "oui-bg-warning/10",
|
|
635
|
-
justify: "start",
|
|
636
|
-
itemAlign: "start",
|
|
637
|
-
gap: 1,
|
|
638
|
-
r: "lg",
|
|
639
|
-
p: 3,
|
|
640
|
-
children: [
|
|
641
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.WarningIcon, { className: "oui-shrink-0 oui-text-warning" }),
|
|
642
|
-
typeof props.children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, className: "oui-text-warning", children: props.children }) : props.children
|
|
643
|
-
]
|
|
644
|
-
}
|
|
645
|
-
);
|
|
646
654
|
var ReferralCodeInput = (props) => {
|
|
647
655
|
const hasSetCursorToEnd = react.useRef(false);
|
|
648
656
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -696,22 +704,22 @@ var ReferralCodeForm = (props) => {
|
|
|
696
704
|
const isReset = type === "reset" /* Reset */;
|
|
697
705
|
const hasBoundReferee = !!props.directInvites && props.directInvites > 0;
|
|
698
706
|
const isEditingRefereeRebateRate = !!props.accountId;
|
|
699
|
-
const noCommissionAvailable = props.
|
|
707
|
+
const noCommissionAvailable = props.maxRebatePercentage === 0;
|
|
700
708
|
const { title, description, buttonText } = react.useMemo(() => {
|
|
701
709
|
switch (type) {
|
|
702
710
|
case "create" /* Create */:
|
|
703
711
|
return {
|
|
704
|
-
title: t("affiliate.referralCode.create.modal.title"),
|
|
705
|
-
description:
|
|
706
|
-
buttonText: t("affiliate.
|
|
712
|
+
title: isReview ? t("affiliate.referralCode.review.modal.title") : t("affiliate.referralCode.create.modal.title"),
|
|
713
|
+
description: null,
|
|
714
|
+
buttonText: isReview ? t("common.save") : t("affiliate.review")
|
|
707
715
|
};
|
|
708
716
|
case "edit" /* Edit */:
|
|
709
717
|
return {
|
|
710
718
|
title: isEditingRefereeRebateRate ? t("affiliate.refereeRebateRate.modal.title", {
|
|
711
719
|
accountId: ui.formatAddress(props.accountId)
|
|
712
|
-
}) : t("affiliate.referralCode.edit.modal.title"),
|
|
713
|
-
description:
|
|
714
|
-
buttonText: isReview ? t("
|
|
720
|
+
}) : isReview ? t("affiliate.referralCode.review.modal.title") : t("affiliate.referralCode.edit.modal.title"),
|
|
721
|
+
description: null,
|
|
722
|
+
buttonText: isEditingRefereeRebateRate ? t("common.save") : isReview ? t("common.save") : t("affiliate.review")
|
|
715
723
|
};
|
|
716
724
|
case "reset" /* Reset */:
|
|
717
725
|
return {
|
|
@@ -743,7 +751,6 @@ var ReferralCodeForm = (props) => {
|
|
|
743
751
|
]
|
|
744
752
|
}
|
|
745
753
|
);
|
|
746
|
-
const descriptionView = /* @__PURE__ */ jsxRuntime.jsx(WarningBox, { children: description });
|
|
747
754
|
const referralCodeInput = /* @__PURE__ */ jsxRuntime.jsx(
|
|
748
755
|
ReferralCodeInput,
|
|
749
756
|
{
|
|
@@ -754,41 +761,32 @@ var ReferralCodeForm = (props) => {
|
|
|
754
761
|
label: t("affiliate.referralCode.editCodeModal.label")
|
|
755
762
|
}
|
|
756
763
|
);
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
!isReview && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "2xs", intensity: 54, children: [
|
|
760
|
-
t("affiliate.totalCommissionAvailable"),
|
|
761
|
-
":",
|
|
762
|
-
" ",
|
|
763
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "oui-text-warning", children: [
|
|
764
|
-
props.maxRebatePercentage,
|
|
765
|
-
"%"
|
|
766
|
-
] })
|
|
767
|
-
] })
|
|
768
|
-
] });
|
|
769
|
-
const rebateRateSlider = /* @__PURE__ */ jsxRuntime.jsx(
|
|
770
|
-
RebateRateSlider,
|
|
764
|
+
const rateEditor = /* @__PURE__ */ jsxRuntime.jsx(
|
|
765
|
+
CommissionRatesCard,
|
|
771
766
|
{
|
|
772
|
-
|
|
773
|
-
|
|
767
|
+
directTradesRate: props.directTradesPercentage,
|
|
768
|
+
indirectTradesRate: props.indirectTradesPercentage,
|
|
769
|
+
totalSplitRate: props.totalSplitPercentage,
|
|
770
|
+
youKeepRate: props.referrerRebatePercentage,
|
|
771
|
+
refereeGetRate: props.refereeRebatePercentage,
|
|
772
|
+
baseRebateRate: props.baseRebatePercentage,
|
|
773
|
+
maxBonusRate: props.maxRebatePercentage,
|
|
774
774
|
onChange: props.setReferrerRebatePercentage,
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
noCommissionAvailable
|
|
775
|
+
showTradeRates: !isEditingRefereeRebateRate,
|
|
776
|
+
showSlider: !isReview && !isReset,
|
|
777
|
+
bordered: isEditingRefereeRebateRate ? false : true,
|
|
778
|
+
rightLabel: isEditingRefereeRebateRate ? t("affiliate.affiliateGet") : t("affiliate.directRefereesGet")
|
|
780
779
|
}
|
|
781
780
|
);
|
|
782
781
|
const refereeInfo = /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", justify: "between", gap: 2, children: [
|
|
783
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, children: t("affiliate.
|
|
782
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, children: t("affiliate.directReferee") }),
|
|
784
783
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text.formatted, { rule: "address", size: "2xs", intensity: 98, children: props.accountId })
|
|
785
784
|
] });
|
|
786
|
-
const noCommissionAvailableWarning = noCommissionAvailable && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", className: "oui-text-warning", children: isEditingRefereeRebateRate ? t("affiliate.rebateRate.noCommissionRate") : t("affiliate.rebateRate.noCommissionAvailable") });
|
|
787
785
|
const resetRebateRateLabel = /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "2xs", intensity: 98, className: "oui-text-start", children: [
|
|
788
786
|
t("affiliate.resetRebateRate.rateAfterReset"),
|
|
789
787
|
":"
|
|
790
788
|
] });
|
|
791
|
-
const buttons = /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "row", gap:
|
|
789
|
+
const buttons = /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "row", gap: 3, width: "100%", mt: 0, pt: 2, children: [
|
|
792
790
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
793
791
|
ui.Button,
|
|
794
792
|
{
|
|
@@ -817,26 +815,28 @@ var ReferralCodeForm = (props) => {
|
|
|
817
815
|
const renderContent = () => {
|
|
818
816
|
switch (type) {
|
|
819
817
|
case "create" /* Create */:
|
|
820
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap:
|
|
821
|
-
|
|
822
|
-
rebateRateSlider,
|
|
823
|
-
noCommissionAvailableWarning,
|
|
818
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
819
|
+
!noCommissionAvailable && rateEditor,
|
|
824
820
|
buttons
|
|
825
821
|
] });
|
|
826
822
|
case "edit" /* Edit */:
|
|
827
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
823
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
828
824
|
isEditingRefereeRebateRate ? refereeInfo : referralCodeInput,
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
rebateRateSlider,
|
|
832
|
-
noCommissionAvailableWarning,
|
|
833
|
-
buttons
|
|
834
|
-
] })
|
|
825
|
+
!noCommissionAvailable && rateEditor,
|
|
826
|
+
buttons
|
|
835
827
|
] });
|
|
836
828
|
case "reset" /* Reset */:
|
|
837
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap:
|
|
829
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 6, children: [
|
|
830
|
+
description,
|
|
838
831
|
resetRebateRateLabel,
|
|
839
|
-
|
|
832
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
833
|
+
RateSplitValues,
|
|
834
|
+
{
|
|
835
|
+
youKeepRate: props.referrerRebatePercentage,
|
|
836
|
+
refereeGetRate: props.refereeRebatePercentage,
|
|
837
|
+
rightLabel: t("affiliate.directRefereesGet")
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
840
|
buttons
|
|
841
841
|
] });
|
|
842
842
|
default:
|
|
@@ -852,118 +852,188 @@ var ReferralCodeForm = (props) => {
|
|
|
852
852
|
className: "oui-affiliate-referralCodeForm oui-font-semibold",
|
|
853
853
|
children: [
|
|
854
854
|
titleView,
|
|
855
|
-
descriptionView,
|
|
856
855
|
renderContent()
|
|
857
856
|
]
|
|
858
857
|
}
|
|
859
858
|
);
|
|
860
859
|
};
|
|
861
|
-
var
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
if (!amount || amount <= 0) {
|
|
865
|
-
return null;
|
|
860
|
+
var formatPercent = (value) => {
|
|
861
|
+
if (Number.isInteger(value)) {
|
|
862
|
+
return `${value}%`;
|
|
866
863
|
}
|
|
864
|
+
return `${Number(value.toFixed(2))}%`;
|
|
865
|
+
};
|
|
866
|
+
var CommissionRatesCard = (props) => {
|
|
867
|
+
const { t } = i18n.useTranslation();
|
|
868
|
+
const selectablePercent = props.totalSplitRate > 0 ? Math.min(100, props.maxBonusRate / props.totalSplitRate * 100) : 100;
|
|
869
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 2, children: [
|
|
870
|
+
props.showTradeRates && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
871
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, children: t("affiliate.yourCommissionRates") }),
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
873
|
+
RateRow,
|
|
874
|
+
{
|
|
875
|
+
label: t("affiliate.directTrades"),
|
|
876
|
+
tooltip: t("affiliate.directTradesDescription"),
|
|
877
|
+
value: props.directTradesRate
|
|
878
|
+
}
|
|
879
|
+
)
|
|
880
|
+
] }),
|
|
881
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
882
|
+
ui.Flex,
|
|
883
|
+
{
|
|
884
|
+
width: "100%",
|
|
885
|
+
direction: "column",
|
|
886
|
+
itemAlign: "start",
|
|
887
|
+
gap: 2,
|
|
888
|
+
p: props.bordered ? 2 : 0,
|
|
889
|
+
r: "lg",
|
|
890
|
+
className: props.bordered ? "oui-border oui-border-line-6" : "",
|
|
891
|
+
children: [
|
|
892
|
+
props.showTradeRates && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
893
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
894
|
+
RateRow,
|
|
895
|
+
{
|
|
896
|
+
label: t("affiliate.indirectTrades"),
|
|
897
|
+
tooltip: t("affiliate.indirectTradesDescription"),
|
|
898
|
+
value: props.indirectTradesRate,
|
|
899
|
+
bordered: false
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { intensity: 8, className: "oui-w-full" })
|
|
903
|
+
] }),
|
|
904
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "2xs", intensity: 54, className: "oui-w-full oui-text-start", children: [
|
|
905
|
+
t("affiliate.totalToSplit"),
|
|
906
|
+
":",
|
|
907
|
+
" ",
|
|
908
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", intensity: 98, children: formatPercent(props.totalSplitRate) })
|
|
909
|
+
] }),
|
|
910
|
+
props.showSlider && /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { width: "100%", my: 1, className: "oui-relative", children: [
|
|
911
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
912
|
+
ui.Slider,
|
|
913
|
+
{
|
|
914
|
+
min: 0,
|
|
915
|
+
max: props.totalSplitRate,
|
|
916
|
+
step: 1,
|
|
917
|
+
value: [props.youKeepRate],
|
|
918
|
+
onValueChange: (value) => {
|
|
919
|
+
const newValue = value[0];
|
|
920
|
+
const nextValue = Math.min(newValue, props.maxBonusRate);
|
|
921
|
+
props.onChange(nextValue);
|
|
922
|
+
},
|
|
923
|
+
classNames: {
|
|
924
|
+
range: "oui-bg-success-darken oui-h-2 oui-top-[0px]",
|
|
925
|
+
trackInner: "oui-h-2 oui-top-[0px] oui-bg-base-contrast-12",
|
|
926
|
+
thumb: "oui-border-[#d9d9d9] oui-bg-[#d9d9d9] oui-size-4"
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
selectablePercent < 100 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
931
|
+
"div",
|
|
932
|
+
{
|
|
933
|
+
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)]",
|
|
934
|
+
style: { left: `${selectablePercent}%` }
|
|
935
|
+
}
|
|
936
|
+
)
|
|
937
|
+
] }),
|
|
938
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
939
|
+
RateSplitValues,
|
|
940
|
+
{
|
|
941
|
+
youKeepRate: props.youKeepRate,
|
|
942
|
+
refereeGetRate: props.refereeGetRate,
|
|
943
|
+
rightLabel: props.rightLabel
|
|
944
|
+
}
|
|
945
|
+
),
|
|
946
|
+
/* @__PURE__ */ jsxRuntime.jsx(PassDownHint, { amount: props.baseRebateRate })
|
|
947
|
+
]
|
|
948
|
+
}
|
|
949
|
+
)
|
|
950
|
+
] });
|
|
951
|
+
};
|
|
952
|
+
var RateRow = (props) => {
|
|
953
|
+
const label = /* @__PURE__ */ jsxRuntime.jsx(
|
|
954
|
+
ui.Text,
|
|
955
|
+
{
|
|
956
|
+
size: "2xs",
|
|
957
|
+
intensity: 98,
|
|
958
|
+
className: "oui-cursor-pointer oui-underline oui-decoration-dotted oui-underline-offset-4",
|
|
959
|
+
children: props.label
|
|
960
|
+
}
|
|
961
|
+
);
|
|
867
962
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
868
963
|
ui.Flex,
|
|
869
964
|
{
|
|
870
|
-
direction: "column",
|
|
871
|
-
gap: 2,
|
|
872
|
-
mt: 2,
|
|
873
965
|
width: "100%",
|
|
874
|
-
|
|
966
|
+
justify: "between",
|
|
967
|
+
itemAlign: "center",
|
|
968
|
+
gap: 2,
|
|
969
|
+
p: props.bordered === false ? 0 : 2,
|
|
875
970
|
r: "lg",
|
|
876
|
-
className: "oui-border oui-border-
|
|
971
|
+
className: props.bordered === false ? "" : "oui-border oui-border-line-6",
|
|
877
972
|
children: [
|
|
878
|
-
/* @__PURE__ */ jsxRuntime.
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
] }),
|
|
889
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 98, className: "oui-leading-[15px]", children: t("affiliate.noCommissionCard.content", { amount }) })
|
|
973
|
+
props.tooltip ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
974
|
+
ui.Tooltip,
|
|
975
|
+
{
|
|
976
|
+
content: props.tooltip,
|
|
977
|
+
className: "oui-max-w-[200px] oui-bg-base-6",
|
|
978
|
+
arrow: { className: "oui-fill-base-6" },
|
|
979
|
+
children: label
|
|
980
|
+
}
|
|
981
|
+
) : label,
|
|
982
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "lg", className: "oui-text-success-darken", children: formatPercent(props.value) })
|
|
890
983
|
]
|
|
891
984
|
}
|
|
892
985
|
);
|
|
893
986
|
};
|
|
894
|
-
var
|
|
987
|
+
var RateSplitValues = (props) => {
|
|
895
988
|
const { t } = i18n.useTranslation();
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
ui.Slider,
|
|
989
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { width: "100%", gap: 2, children: [
|
|
990
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
991
|
+
ui.Flex,
|
|
900
992
|
{
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
props.disabledIncrease ? Math.min(newValue, maxValue) : newValue
|
|
909
|
-
);
|
|
910
|
-
},
|
|
911
|
-
classNames: {
|
|
912
|
-
range: "oui-bg-success-darken oui-h-2 oui-top-[0px]",
|
|
913
|
-
trackInner: "oui-bg-success-darken/30 oui-h-2 oui-top-[0px]",
|
|
914
|
-
thumb: "oui-border-[#d9d9d9] oui-bg-[#d9d9d9] oui-size-4"
|
|
915
|
-
}
|
|
993
|
+
direction: "column",
|
|
994
|
+
itemAlign: "start",
|
|
995
|
+
className: "oui-min-w-0 oui-flex-1",
|
|
996
|
+
children: [
|
|
997
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, children: t("affiliate.youKeep") }),
|
|
998
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "lg", className: "oui-text-success-darken", children: formatPercent(props.youKeepRate) })
|
|
999
|
+
]
|
|
916
1000
|
}
|
|
917
|
-
)
|
|
918
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
props.
|
|
926
|
-
"
|
|
927
|
-
]
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
"%"
|
|
931
|
-
] })
|
|
932
|
-
] }),
|
|
933
|
-
props.noCommissionAvailable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
934
|
-
NoCommissionCard,
|
|
935
|
-
{
|
|
936
|
-
directBonusRebateRate: props.directBonusRebateRate
|
|
937
|
-
}
|
|
938
|
-
) : props.directBonusRebateRate != null && props.directBonusRebateRate > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, mt: 2, width: "100%", children: [
|
|
939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
940
|
-
GiftIcon,
|
|
941
|
-
{
|
|
942
|
-
size: 16,
|
|
943
|
-
className: "oui-mt-px oui-text-base-contrast"
|
|
944
|
-
}
|
|
945
|
-
),
|
|
946
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
-
ui.Text,
|
|
948
|
-
{
|
|
949
|
-
size: "sm",
|
|
950
|
-
intensity: 54,
|
|
951
|
-
as: "span",
|
|
952
|
-
className: "oui-inline-flex oui-items-center oui-gap-1 oui-tracking-[0.03em]",
|
|
953
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
954
|
-
i18n.Trans,
|
|
955
|
-
{
|
|
956
|
-
i18nKey: "affiliate.extraBonusOnDirectReferrals",
|
|
957
|
-
values: { amount: props.directBonusRebateRate },
|
|
958
|
-
components: [/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", color: "primaryLight" }, "0")]
|
|
959
|
-
}
|
|
960
|
-
)
|
|
961
|
-
}
|
|
962
|
-
)
|
|
963
|
-
] })
|
|
964
|
-
] })
|
|
1001
|
+
),
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1003
|
+
ui.Flex,
|
|
1004
|
+
{
|
|
1005
|
+
direction: "column",
|
|
1006
|
+
itemAlign: "end",
|
|
1007
|
+
className: "oui-min-w-0 oui-flex-1",
|
|
1008
|
+
children: [
|
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, className: "oui-text-right", children: props.rightLabel }),
|
|
1010
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "lg", intensity: 54, className: "oui-text-right", children: formatPercent(props.refereeGetRate) })
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
)
|
|
965
1014
|
] });
|
|
966
1015
|
};
|
|
1016
|
+
var PassDownHint = (props) => {
|
|
1017
|
+
const { t } = i18n.useTranslation();
|
|
1018
|
+
if (props.amount <= 0) {
|
|
1019
|
+
return null;
|
|
1020
|
+
}
|
|
1021
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1022
|
+
ui.Flex,
|
|
1023
|
+
{
|
|
1024
|
+
width: "100%",
|
|
1025
|
+
itemAlign: "center",
|
|
1026
|
+
gap: 2,
|
|
1027
|
+
className: "oui-overflow-hidden",
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.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)]" }),
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 36, className: "oui-leading-[15px]", children: t("affiliate.atLeastPassesDown", {
|
|
1031
|
+
amount: formatPercent(props.amount)
|
|
1032
|
+
}) })
|
|
1033
|
+
]
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
1036
|
+
};
|
|
967
1037
|
var ReferralCodeFormWidget = (props) => {
|
|
968
1038
|
const state = useReferralCodeFormScript(props);
|
|
969
1039
|
return /* @__PURE__ */ jsxRuntime.jsx(ReferralCodeForm, { ...state, ...props });
|
|
@@ -1046,6 +1116,21 @@ var useBindReferralCodeScript = (options) => {
|
|
|
1046
1116
|
onConfirm
|
|
1047
1117
|
};
|
|
1048
1118
|
};
|
|
1119
|
+
var WarningBox = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1120
|
+
ui.Flex,
|
|
1121
|
+
{
|
|
1122
|
+
className: "oui-bg-warning/10",
|
|
1123
|
+
justify: "start",
|
|
1124
|
+
itemAlign: "start",
|
|
1125
|
+
gap: 1,
|
|
1126
|
+
r: "lg",
|
|
1127
|
+
p: 3,
|
|
1128
|
+
children: [
|
|
1129
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.WarningIcon, { className: "oui-shrink-0 oui-text-warning" }),
|
|
1130
|
+
typeof props.children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 54, className: "oui-text-warning", children: props.children }) : props.children
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
);
|
|
1049
1134
|
var BindReferralCode = (props) => {
|
|
1050
1135
|
const { t } = i18n.useTranslation();
|
|
1051
1136
|
const bindCodeInvalid = !props.skipBinding && props.formattedBindCode.length >= 4 && !props.isBindCodeChecking && props.isBindCodeExist === false;
|
|
@@ -1266,10 +1351,12 @@ var TradingVolumeProgress = (props) => {
|
|
|
1266
1351
|
}
|
|
1267
1352
|
);
|
|
1268
1353
|
};
|
|
1269
|
-
function
|
|
1354
|
+
function parseMaxRebateRateInfoFromSettled(result) {
|
|
1270
1355
|
if (result.status !== "fulfilled") return void 0;
|
|
1271
|
-
|
|
1272
|
-
|
|
1356
|
+
if (typeof result.value !== "object" || result.value === null) {
|
|
1357
|
+
return void 0;
|
|
1358
|
+
}
|
|
1359
|
+
return result.value;
|
|
1273
1360
|
}
|
|
1274
1361
|
var Hero = () => {
|
|
1275
1362
|
const { t } = i18n.useTranslation();
|
|
@@ -1283,9 +1370,13 @@ var Hero = () => {
|
|
|
1283
1370
|
multiLevelRebateInfo,
|
|
1284
1371
|
multiLevelRebateInfoMutate,
|
|
1285
1372
|
maxRebateRate,
|
|
1373
|
+
maxRebateRateInfo,
|
|
1374
|
+
bonusMaxRebateRate,
|
|
1375
|
+
baseRebateRate,
|
|
1286
1376
|
maxRebateRateMutate,
|
|
1287
1377
|
mutate,
|
|
1288
|
-
referralInfo
|
|
1378
|
+
referralInfo,
|
|
1379
|
+
generateCode
|
|
1289
1380
|
} = useReferralContext();
|
|
1290
1381
|
const boundReferralCode = referralInfo?.referee_info?.referer_code?.trim() ?? "";
|
|
1291
1382
|
const openBindReferralOnlyModal = () => {
|
|
@@ -1296,10 +1387,14 @@ var Hero = () => {
|
|
|
1296
1387
|
}
|
|
1297
1388
|
});
|
|
1298
1389
|
};
|
|
1299
|
-
const showCreateReferralCodeModal = (
|
|
1390
|
+
const showCreateReferralCodeModal = (maxRateInfoOverride) => {
|
|
1391
|
+
const latestMaxRateInfo = maxRateInfoOverride ?? maxRebateRateInfo;
|
|
1300
1392
|
ui.modal.show(ReferralCodeFormDialogId, {
|
|
1301
1393
|
type: "create" /* Create */,
|
|
1302
|
-
maxRebateRate:
|
|
1394
|
+
maxRebateRate: latestMaxRateInfo?.max_rebate_rate ?? maxRebateRate ?? 0,
|
|
1395
|
+
bonusMaxRebateRate: latestMaxRateInfo?.bonus_max_rebate_rate ?? bonusMaxRebateRate,
|
|
1396
|
+
baseRebateRate: latestMaxRateInfo?.base_rebate_rate ?? baseRebateRate,
|
|
1397
|
+
referralCode: generateCode?.code,
|
|
1303
1398
|
directBonusRebateRate: 0,
|
|
1304
1399
|
onSuccess: () => {
|
|
1305
1400
|
multiLevelRebateInfoMutate();
|
|
@@ -1319,8 +1414,10 @@ var Hero = () => {
|
|
|
1319
1414
|
multiLevelRebateInfoMutate(),
|
|
1320
1415
|
mutate()
|
|
1321
1416
|
]);
|
|
1322
|
-
const
|
|
1323
|
-
|
|
1417
|
+
const latestMaxRebateRateInfo = parseMaxRebateRateInfoFromSettled(
|
|
1418
|
+
results[0]
|
|
1419
|
+
);
|
|
1420
|
+
showCreateReferralCodeModal(latestMaxRebateRateInfo);
|
|
1324
1421
|
}
|
|
1325
1422
|
});
|
|
1326
1423
|
return;
|
|
@@ -1812,12 +1909,18 @@ var useMultiLevelReferralScript = () => {
|
|
|
1812
1909
|
const {
|
|
1813
1910
|
isMultiLevelReferralUnlocked,
|
|
1814
1911
|
maxRebateRate,
|
|
1912
|
+
bonusMaxRebateRate,
|
|
1913
|
+
baseRebateRate,
|
|
1914
|
+
generateCode,
|
|
1815
1915
|
multiLevelRebateInfoMutate
|
|
1816
1916
|
} = useReferralContext();
|
|
1817
1917
|
const createReferralCode = () => {
|
|
1818
1918
|
ui.modal.show(ReferralCodeFormDialogId, {
|
|
1819
1919
|
type: "create" /* Create */,
|
|
1820
1920
|
maxRebateRate,
|
|
1921
|
+
bonusMaxRebateRate,
|
|
1922
|
+
baseRebateRate,
|
|
1923
|
+
referralCode: generateCode?.code,
|
|
1821
1924
|
// 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
|
|
1822
1925
|
directBonusRebateRate: 0,
|
|
1823
1926
|
onSuccess: () => {
|
|
@@ -1846,6 +1949,7 @@ var ReferralInfo = (props) => {
|
|
|
1846
1949
|
gap: 4,
|
|
1847
1950
|
p: 5,
|
|
1848
1951
|
direction: "column",
|
|
1952
|
+
itemAlign: "start",
|
|
1849
1953
|
intensity: 900,
|
|
1850
1954
|
className: "oui-affiliate-referralInfo oui-border oui-border-line-6",
|
|
1851
1955
|
children: [
|
|
@@ -1892,65 +1996,42 @@ var ReferralInfo = (props) => {
|
|
|
1892
1996
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "lg", color: "primaryLight", children: props.referralLink }),
|
|
1893
1997
|
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: props.referralLink })
|
|
1894
1998
|
] }),
|
|
1999
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2000
|
+
ui.Text,
|
|
2001
|
+
{
|
|
2002
|
+
size: "lg",
|
|
2003
|
+
intensity: 98,
|
|
2004
|
+
className: "oui-w-full oui-text-left oui-tracking-[0.03em]",
|
|
2005
|
+
children: t("affiliate.yourCommissionRates")
|
|
2006
|
+
}
|
|
2007
|
+
),
|
|
1895
2008
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1896
|
-
ui.
|
|
2009
|
+
ui.Flex,
|
|
1897
2010
|
{
|
|
1898
2011
|
width: "100%",
|
|
1899
|
-
|
|
1900
|
-
|
|
2012
|
+
gap: 4,
|
|
2013
|
+
itemAlign: "stretch",
|
|
2014
|
+
direction: "row",
|
|
2015
|
+
className: "oui-affiliate-referralInfo-commissionRates",
|
|
1901
2016
|
children: [
|
|
1902
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text.formatted, { size: "3xl", intensity: 80, children: [
|
|
1921
|
-
props.referrerRebateRate,
|
|
1922
|
-
"%"
|
|
1923
|
-
] }),
|
|
1924
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text.formatted, { size: "3xl", intensity: 36, children: [
|
|
1925
|
-
props.refereeRebateRate,
|
|
1926
|
-
"%"
|
|
1927
|
-
] })
|
|
1928
|
-
] }),
|
|
1929
|
-
props.directBonusRebateRate > 0 && /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { gap: 2, mt: 4, width: "100%", className: "oui-items-center", children: [
|
|
1930
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1931
|
-
GiftIcon,
|
|
1932
|
-
{
|
|
1933
|
-
size: 16,
|
|
1934
|
-
className: "oui-shrink-0 oui-text-base-contrast oui-mt-[1px]"
|
|
1935
|
-
}
|
|
1936
|
-
),
|
|
1937
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1938
|
-
ui.Text,
|
|
1939
|
-
{
|
|
1940
|
-
intensity: 54,
|
|
1941
|
-
as: "span",
|
|
1942
|
-
className: "oui-flex-1 oui-min-w-0 oui-tracking-[0.03em]",
|
|
1943
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1944
|
-
i18n.Trans,
|
|
1945
|
-
{
|
|
1946
|
-
i18nKey: "affiliate.extraBonusOnDirectReferrals",
|
|
1947
|
-
values: { amount: props.directBonusRebateRate },
|
|
1948
|
-
components: [/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", color: "primaryLight" }, "0")]
|
|
1949
|
-
}
|
|
1950
|
-
)
|
|
1951
|
-
}
|
|
1952
|
-
)
|
|
1953
|
-
] })
|
|
2017
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2018
|
+
CommissionRateCard,
|
|
2019
|
+
{
|
|
2020
|
+
title: t("affiliate.directTrades"),
|
|
2021
|
+
rate: props.directTradesRate,
|
|
2022
|
+
description: t("affiliate.directTradesDescription"),
|
|
2023
|
+
className: "oui-affiliate-referralInfo-directTrades"
|
|
2024
|
+
}
|
|
2025
|
+
),
|
|
2026
|
+
props.showIndirectTrades ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2027
|
+
CommissionRateCard,
|
|
2028
|
+
{
|
|
2029
|
+
title: t("affiliate.indirectTrades"),
|
|
2030
|
+
rate: props.indirectTradesRate,
|
|
2031
|
+
description: t("affiliate.indirectTradesDescription"),
|
|
2032
|
+
className: "oui-affiliate-referralInfo-indirectTrades"
|
|
2033
|
+
}
|
|
2034
|
+
) : null
|
|
1954
2035
|
]
|
|
1955
2036
|
}
|
|
1956
2037
|
)
|
|
@@ -1958,6 +2039,59 @@ var ReferralInfo = (props) => {
|
|
|
1958
2039
|
}
|
|
1959
2040
|
);
|
|
1960
2041
|
};
|
|
2042
|
+
var CommissionRateCard = (props) => {
|
|
2043
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2044
|
+
ui.Flex,
|
|
2045
|
+
{
|
|
2046
|
+
r: "2xl",
|
|
2047
|
+
direction: "column",
|
|
2048
|
+
itemAlign: "start",
|
|
2049
|
+
justify: "center",
|
|
2050
|
+
p: 5,
|
|
2051
|
+
className: ui.cn(
|
|
2052
|
+
"oui-min-w-0 oui-flex-1 oui-bg-base-contrast-4",
|
|
2053
|
+
props.className
|
|
2054
|
+
),
|
|
2055
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 4, width: "100%", itemAlign: "start", children: [
|
|
2056
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2057
|
+
ui.Text,
|
|
2058
|
+
{
|
|
2059
|
+
size: "sm",
|
|
2060
|
+
intensity: 98,
|
|
2061
|
+
weight: "semibold",
|
|
2062
|
+
className: "oui-w-full oui-tracking-[0.03em]",
|
|
2063
|
+
children: props.title
|
|
2064
|
+
}
|
|
2065
|
+
),
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { direction: "column", gap: 2, width: "100%", itemAlign: "start", children: [
|
|
2067
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2068
|
+
ui.Text,
|
|
2069
|
+
{
|
|
2070
|
+
size: "3xl",
|
|
2071
|
+
weight: "semibold",
|
|
2072
|
+
color: "success",
|
|
2073
|
+
className: "oui-leading-9 oui-tracking-[0.03em]",
|
|
2074
|
+
children: [
|
|
2075
|
+
props.rate,
|
|
2076
|
+
"%"
|
|
2077
|
+
]
|
|
2078
|
+
}
|
|
2079
|
+
),
|
|
2080
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2081
|
+
ui.Text,
|
|
2082
|
+
{
|
|
2083
|
+
size: "sm",
|
|
2084
|
+
intensity: 54,
|
|
2085
|
+
weight: "semibold",
|
|
2086
|
+
className: "oui-w-full oui-leading-5 oui-tracking-[0.03em]",
|
|
2087
|
+
children: props.description
|
|
2088
|
+
}
|
|
2089
|
+
)
|
|
2090
|
+
] })
|
|
2091
|
+
] })
|
|
2092
|
+
}
|
|
2093
|
+
);
|
|
2094
|
+
};
|
|
1961
2095
|
var Container = (props) => {
|
|
1962
2096
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1963
2097
|
ui.Flex,
|
|
@@ -2028,11 +2162,14 @@ var useReferralInfoScript = () => {
|
|
|
2028
2162
|
if (!referralCode) return "";
|
|
2029
2163
|
return generateReferralLink(referralLinkUrl, referralCode);
|
|
2030
2164
|
}, [referralCode]);
|
|
2031
|
-
const
|
|
2032
|
-
return new utils.Decimal(multiLevelRebateInfo?.
|
|
2165
|
+
const directTradesRate = react.useMemo(() => {
|
|
2166
|
+
return new utils.Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).add(multiLevelRebateInfo?.base_rebate_rate ?? 0).mul(100).toNumber();
|
|
2167
|
+
}, [multiLevelRebateInfo]);
|
|
2168
|
+
const indirectTradesRate = react.useMemo(() => {
|
|
2169
|
+
return new utils.Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).sub(multiLevelRebateInfo?.default_bonus_referee_rebate_rate ?? 0).mul(100).toNumber();
|
|
2033
2170
|
}, [multiLevelRebateInfo]);
|
|
2034
|
-
const
|
|
2035
|
-
return new utils.Decimal(multiLevelRebateInfo?.
|
|
2171
|
+
const showIndirectTrades = react.useMemo(() => {
|
|
2172
|
+
return !new utils.Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).eq(0);
|
|
2036
2173
|
}, [multiLevelRebateInfo]);
|
|
2037
2174
|
const directBonusRebateRate = react.useMemo(() => {
|
|
2038
2175
|
return new utils.Decimal(multiLevelRebateInfo?.direct_bonus_rebate_rate ?? 0).mul(100).toNumber();
|
|
@@ -2043,6 +2180,9 @@ var useReferralInfoScript = () => {
|
|
|
2043
2180
|
focusField,
|
|
2044
2181
|
referralCode: multiLevelRebateInfo?.referral_code,
|
|
2045
2182
|
maxRebateRate,
|
|
2183
|
+
bonusMaxRebateRate: multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2184
|
+
baseRebateRate: multiLevelRebateInfo?.base_rebate_rate,
|
|
2185
|
+
defaultBonusRefereeRebateRate: multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2046
2186
|
referrerRebateRate: multiLevelRebateInfo?.referrer_rebate_rate,
|
|
2047
2187
|
directInvites: multiLevelRebateInfo?.direct_invites,
|
|
2048
2188
|
directBonusRebateRate,
|
|
@@ -2056,8 +2196,9 @@ var useReferralInfoScript = () => {
|
|
|
2056
2196
|
referralCode,
|
|
2057
2197
|
referralLink,
|
|
2058
2198
|
multiLevelRebateInfo,
|
|
2059
|
-
|
|
2060
|
-
|
|
2199
|
+
directTradesRate,
|
|
2200
|
+
indirectTradesRate,
|
|
2201
|
+
showIndirectTrades,
|
|
2061
2202
|
directBonusRebateRate
|
|
2062
2203
|
};
|
|
2063
2204
|
};
|
|
@@ -2227,13 +2368,7 @@ var BreakdownCell = ({ total, direct, indirect, directBonus, prefix, fix = 0, ti
|
|
|
2227
2368
|
"\u2022 ",
|
|
2228
2369
|
t("affiliate.direct"),
|
|
2229
2370
|
": ",
|
|
2230
|
-
format9(direct + directBonus)
|
|
2231
|
-
" ",
|
|
2232
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2233
|
-
"(",
|
|
2234
|
-
t("affiliate.directInclBonus", { amount: format9(directBonus) }),
|
|
2235
|
-
")"
|
|
2236
|
-
] })
|
|
2371
|
+
format9(direct + directBonus)
|
|
2237
2372
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2238
2373
|
"\u2022 ",
|
|
2239
2374
|
t("affiliate.direct"),
|
|
@@ -2490,6 +2625,12 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2490
2625
|
return refereesPaginationUtils.parsePagination(refereesMeta);
|
|
2491
2626
|
}, [refereesMeta, refereesPaginationUtils]);
|
|
2492
2627
|
const { multiLevelRebateInfo, maxRebateRate, multiLevelRebateInfoMutate } = useReferralContext();
|
|
2628
|
+
const showActionColumn = react.useMemo(() => {
|
|
2629
|
+
return !new utils.Decimal(multiLevelRebateInfo?.bonus_max_rebate_rate ?? 0).eq(0);
|
|
2630
|
+
}, [multiLevelRebateInfo]);
|
|
2631
|
+
const baseRebateRate = react.useMemo(() => {
|
|
2632
|
+
return multiLevelRebateInfo?.base_rebate_rate ?? 0;
|
|
2633
|
+
}, [multiLevelRebateInfo]);
|
|
2493
2634
|
const onEditReferee = react.useCallback(
|
|
2494
2635
|
(type, item) => {
|
|
2495
2636
|
const referrerRebateRate = type === "reset" /* Reset */ ? multiLevelRebateInfo?.referrer_rebate_rate : item.referral_rebate_rate;
|
|
@@ -2497,6 +2638,9 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2497
2638
|
type,
|
|
2498
2639
|
referralCode: multiLevelRebateInfo?.referral_code,
|
|
2499
2640
|
maxRebateRate,
|
|
2641
|
+
bonusMaxRebateRate: multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2642
|
+
baseRebateRate: multiLevelRebateInfo?.base_rebate_rate,
|
|
2643
|
+
defaultBonusRefereeRebateRate: multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2500
2644
|
referrerRebateRate,
|
|
2501
2645
|
onSuccess: () => {
|
|
2502
2646
|
multiLevelRebateInfoMutate();
|
|
@@ -2512,6 +2656,11 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2512
2656
|
},
|
|
2513
2657
|
[
|
|
2514
2658
|
maxRebateRate,
|
|
2659
|
+
multiLevelRebateInfo?.base_rebate_rate,
|
|
2660
|
+
multiLevelRebateInfo?.bonus_max_rebate_rate,
|
|
2661
|
+
multiLevelRebateInfo?.default_bonus_referee_rebate_rate,
|
|
2662
|
+
multiLevelRebateInfo?.direct_bonus_rebate_rate,
|
|
2663
|
+
multiLevelRebateInfo?.direct_invites,
|
|
2515
2664
|
multiLevelRebateInfo?.referral_code,
|
|
2516
2665
|
multiLevelRebateInfo?.referrer_rebate_rate,
|
|
2517
2666
|
multiLevelRebateInfoMutate,
|
|
@@ -2552,12 +2701,17 @@ var useRefereesTableScript = (props = {}) => {
|
|
|
2552
2701
|
refereesPagination,
|
|
2553
2702
|
isRefereesLoading,
|
|
2554
2703
|
onEditReferee,
|
|
2555
|
-
onRefereesSort
|
|
2704
|
+
onRefereesSort,
|
|
2705
|
+
showActionColumn,
|
|
2706
|
+
baseRebateRate
|
|
2556
2707
|
};
|
|
2557
2708
|
};
|
|
2558
2709
|
var getRebateRateText = (rate) => {
|
|
2559
2710
|
return (rate * 100).toFixed(0) + "%";
|
|
2560
2711
|
};
|
|
2712
|
+
var getRefereeRebateRateText = (refereeRate, baseRebateRate) => {
|
|
2713
|
+
return new utils.Decimal(refereeRate).add(baseRebateRate).mul(100).toFixed(0) + "%";
|
|
2714
|
+
};
|
|
2561
2715
|
var getRefereeType = (bindType) => {
|
|
2562
2716
|
const { t } = i18n.useTranslation();
|
|
2563
2717
|
if (bindType === "legacy") {
|
|
@@ -2571,7 +2725,7 @@ var getRefereeType = (bindType) => {
|
|
|
2571
2725
|
tooltip: t("affiliate.multiLevel.tooltip")
|
|
2572
2726
|
};
|
|
2573
2727
|
};
|
|
2574
|
-
var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
2728
|
+
var MobileRefereeItem = ({ item, onEditReferee, showActionColumn, baseRebateRate }) => {
|
|
2575
2729
|
const { t } = i18n.useTranslation();
|
|
2576
2730
|
const typeInfo = getRefereeType(item.bind_type);
|
|
2577
2731
|
return /* @__PURE__ */ jsxRuntime.jsxs(MobileCard, { children: [
|
|
@@ -2586,14 +2740,23 @@ var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
|
2586
2740
|
) }),
|
|
2587
2741
|
/* @__PURE__ */ jsxRuntime.jsx(MobileCell, { label: t("affiliate.boundAt"), align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "sm", children: formatYMDTime(item.code_binding_time) }) }),
|
|
2588
2742
|
/* @__PURE__ */ jsxRuntime.jsx(MobileCell, { label: t("affiliate.referralCodes"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "sm", children: item.bind_code }) }),
|
|
2589
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
"
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2743
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2744
|
+
MobileCell,
|
|
2745
|
+
{
|
|
2746
|
+
label: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2747
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "sm", children: [
|
|
2748
|
+
getRebateRateText(item.referral_rebate_rate) + "/",
|
|
2749
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2750
|
+
getRefereeRebateRateText(
|
|
2751
|
+
item.referee_rebate_rate,
|
|
2752
|
+
baseRebateRate
|
|
2753
|
+
),
|
|
2754
|
+
" "
|
|
2755
|
+
] }),
|
|
2756
|
+
!item.is_default_rate && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oui-text-primary-light", children: `(${t("affiliate.customized")})` })
|
|
2757
|
+
] })
|
|
2758
|
+
}
|
|
2759
|
+
),
|
|
2597
2760
|
/* @__PURE__ */ jsxRuntime.jsx(MobileCell, { label: t("affiliate.networkSize"), align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2598
2761
|
BreakdownCell,
|
|
2599
2762
|
{
|
|
@@ -2626,7 +2789,7 @@ var MobileRefereeItem = ({ item, onEditReferee }) => {
|
|
|
2626
2789
|
title: t("affiliate.commission")
|
|
2627
2790
|
}
|
|
2628
2791
|
) }),
|
|
2629
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2792
|
+
showActionColumn && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2630
2793
|
MobileCell,
|
|
2631
2794
|
{
|
|
2632
2795
|
label: t("common.action"),
|
|
@@ -2691,12 +2854,16 @@ var RefereesTableUI = (props) => {
|
|
|
2691
2854
|
render: (value) => /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: value })
|
|
2692
2855
|
},
|
|
2693
2856
|
{
|
|
2694
|
-
title: t("affiliate.referralCodes.column.you&
|
|
2857
|
+
title: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2695
2858
|
dataIndex: "referee_rebate_rate",
|
|
2859
|
+
width: 175,
|
|
2696
2860
|
render: (_, record) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
2697
2861
|
getRebateRateText(record.referral_rebate_rate) + "/",
|
|
2698
2862
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "oui-text-base-contrast-54", children: [
|
|
2699
|
-
|
|
2863
|
+
getRefereeRebateRateText(
|
|
2864
|
+
record.referee_rebate_rate,
|
|
2865
|
+
props.baseRebateRate
|
|
2866
|
+
),
|
|
2700
2867
|
" "
|
|
2701
2868
|
] }),
|
|
2702
2869
|
!record.is_default_rate && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "oui-text-primary-light", children: `(${t("affiliate.customized")})` })
|
|
@@ -2750,30 +2917,35 @@ var RefereesTableUI = (props) => {
|
|
|
2750
2917
|
),
|
|
2751
2918
|
onSort: true
|
|
2752
2919
|
},
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2920
|
+
...props.showActionColumn ? [
|
|
2921
|
+
{
|
|
2922
|
+
title: t("common.action"),
|
|
2923
|
+
dataIndex: "action",
|
|
2924
|
+
render: (_, record) => record.bind_type !== "legacy" ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2925
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2926
|
+
ui.Text,
|
|
2927
|
+
{
|
|
2928
|
+
className: "oui-refereesTable-edit-btn oui-cursor-pointer oui-text-primary-light",
|
|
2929
|
+
onClick: () => props.onEditReferee("edit" /* Edit */, record),
|
|
2930
|
+
children: t("common.edit")
|
|
2931
|
+
}
|
|
2932
|
+
),
|
|
2933
|
+
!record.is_default_rate && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2934
|
+
ui.Text,
|
|
2935
|
+
{
|
|
2936
|
+
className: "oui-refereesTable-reset-btn oui-ms-2 oui-cursor-pointer oui-text-primary-light",
|
|
2937
|
+
onClick: () => props.onEditReferee(
|
|
2938
|
+
"reset" /* Reset */,
|
|
2939
|
+
record
|
|
2940
|
+
),
|
|
2941
|
+
children: t("common.reset")
|
|
2942
|
+
}
|
|
2943
|
+
)
|
|
2944
|
+
] }) : null
|
|
2945
|
+
}
|
|
2946
|
+
] : []
|
|
2775
2947
|
];
|
|
2776
|
-
}, [t, props.onEditReferee]);
|
|
2948
|
+
}, [t, props.onEditReferee, props.showActionColumn, props.baseRebateRate]);
|
|
2777
2949
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: isMobile ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-affiliate-refereesTable oui-flex oui-flex-col oui-px-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2778
2950
|
ui.ListView,
|
|
2779
2951
|
{
|
|
@@ -2784,7 +2956,9 @@ var RefereesTableUI = (props) => {
|
|
|
2784
2956
|
MobileRefereeItem,
|
|
2785
2957
|
{
|
|
2786
2958
|
item,
|
|
2787
|
-
onEditReferee: props.onEditReferee
|
|
2959
|
+
onEditReferee: props.onEditReferee,
|
|
2960
|
+
showActionColumn: props.showActionColumn,
|
|
2961
|
+
baseRebateRate: props.baseRebateRate
|
|
2788
2962
|
}
|
|
2789
2963
|
),
|
|
2790
2964
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Divider, { intensity: 8 })
|
|
@@ -2841,10 +3015,12 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2841
3015
|
const multiLevelReferralCode = multiLevelRebateInfo?.referral_code;
|
|
2842
3016
|
if (multiLevelRebateInfo?.referral_code) {
|
|
2843
3017
|
const maxRebateRate = multiLevelRebateInfo.max_rebate_rate ?? 0;
|
|
2844
|
-
const
|
|
3018
|
+
const bonusMaxRebateRate = multiLevelRebateInfo.bonus_max_rebate_rate ?? maxRebateRate;
|
|
3019
|
+
const baseRebateRate = multiLevelRebateInfo.base_rebate_rate ?? 0;
|
|
3020
|
+
const defaultRefereeRebateRate = multiLevelRebateInfo.default_bonus_referee_rebate_rate ?? multiLevelRebateInfo.default_referee_rebate_rate ?? 0;
|
|
2845
3021
|
const referrerRebateRate = Math.max(
|
|
2846
3022
|
0,
|
|
2847
|
-
|
|
3023
|
+
bonusMaxRebateRate - defaultRefereeRebateRate
|
|
2848
3024
|
);
|
|
2849
3025
|
const directInvites = multiLevelRebateInfo?.direct_invites ?? 0;
|
|
2850
3026
|
const indirectInvites = multiLevelRebateInfo?.indirect_invites ?? 0;
|
|
@@ -2863,6 +3039,7 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2863
3039
|
indirect_rebate: indirectRebate,
|
|
2864
3040
|
direct_bonus_rebate: directBonusRebate,
|
|
2865
3041
|
max_rebate_rate: maxRebateRate,
|
|
3042
|
+
base_rebate_rate: baseRebateRate,
|
|
2866
3043
|
referee_rebate_rate: defaultRefereeRebateRate,
|
|
2867
3044
|
referrer_rebate_rate: referrerRebateRate,
|
|
2868
3045
|
total_invites: directInvites + indirectInvites,
|
|
@@ -2891,6 +3068,7 @@ var useMultiLevelReferralCodes = () => {
|
|
|
2891
3068
|
direct_rebate: totalRebate,
|
|
2892
3069
|
indirect_rebate: 0,
|
|
2893
3070
|
max_rebate_rate: item.max_rebate_rate ?? 0,
|
|
3071
|
+
base_rebate_rate: 0,
|
|
2894
3072
|
referee_rebate_rate: item.referee_rebate_rate ?? 0,
|
|
2895
3073
|
referrer_rebate_rate: item.referrer_rebate_rate ?? 0,
|
|
2896
3074
|
total_invites: totalInvites,
|
|
@@ -2956,6 +3134,9 @@ var useReferralCodesTableScript = (props = {}) => {
|
|
|
2956
3134
|
isLoading: enabled && !codes
|
|
2957
3135
|
};
|
|
2958
3136
|
};
|
|
3137
|
+
var getRefereeRebateRateText2 = (refereeRate, baseRebateRate) => {
|
|
3138
|
+
return new utils.Decimal(refereeRate).add(baseRebateRate).mul(100).toFixed(0);
|
|
3139
|
+
};
|
|
2959
3140
|
var getReferralCodeType = (referralType) => {
|
|
2960
3141
|
const { t } = i18n.useTranslation();
|
|
2961
3142
|
if (referralType === "multi") {
|
|
@@ -2972,7 +3153,10 @@ var getReferralCodeType = (referralType) => {
|
|
|
2972
3153
|
var MobileReferralCodeItem = ({ item, copyCode }) => {
|
|
2973
3154
|
const { t } = i18n.useTranslation();
|
|
2974
3155
|
const referrerRate = new utils.Decimal(item.referrer_rebate_rate ?? 0).mul(100).toFixed(0);
|
|
2975
|
-
const refereeRate =
|
|
3156
|
+
const refereeRate = getRefereeRebateRateText2(
|
|
3157
|
+
item.referee_rebate_rate ?? 0,
|
|
3158
|
+
item.base_rebate_rate ?? 0
|
|
3159
|
+
);
|
|
2976
3160
|
const typeInfo = getReferralCodeType(item.referral_type);
|
|
2977
3161
|
return /* @__PURE__ */ jsxRuntime.jsxs(MobileCard, { children: [
|
|
2978
3162
|
/* @__PURE__ */ jsxRuntime.jsx(MobileCell, { label: t("affiliate.referralCode"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: item.code || "" }) }),
|
|
@@ -2987,7 +3171,7 @@ var MobileReferralCodeItem = ({ item, copyCode }) => {
|
|
|
2987
3171
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2988
3172
|
MobileCell,
|
|
2989
3173
|
{
|
|
2990
|
-
label: t("affiliate.referralCodes.column.you&
|
|
3174
|
+
label: t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
2991
3175
|
align: "end",
|
|
2992
3176
|
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
2993
3177
|
referrerRate,
|
|
@@ -3074,13 +3258,18 @@ var ReferralCodesTableUI = (props) => {
|
|
|
3074
3258
|
t("affiliate.referralCodes.column.defaultSplit"),
|
|
3075
3259
|
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
3076
3260
|
"(",
|
|
3077
|
-
t("affiliate.referralCodes.column.you&
|
|
3261
|
+
t("affiliate.referralCodes.column.you&DirectReferees"),
|
|
3078
3262
|
")"
|
|
3079
3263
|
] }),
|
|
3080
3264
|
dataIndex: "rate",
|
|
3265
|
+
width: 180,
|
|
3266
|
+
className: "!oui-whitespace-normal",
|
|
3081
3267
|
render: (_, record) => {
|
|
3082
3268
|
const referrerRate = new utils.Decimal(record.referrer_rebate_rate ?? 0).mul(100).toFixed(0);
|
|
3083
|
-
const refereeRate =
|
|
3269
|
+
const refereeRate = getRefereeRebateRateText2(
|
|
3270
|
+
record.referee_rebate_rate ?? 0,
|
|
3271
|
+
record.base_rebate_rate ?? 0
|
|
3272
|
+
);
|
|
3084
3273
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
3085
3274
|
referrerRate,
|
|
3086
3275
|
"%",
|
|
@@ -3273,35 +3462,44 @@ var Summary = (props) => {
|
|
|
3273
3462
|
}
|
|
3274
3463
|
}
|
|
3275
3464
|
),
|
|
3276
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
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
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3465
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3466
|
+
ui.Flex,
|
|
3467
|
+
{
|
|
3468
|
+
width: "100%",
|
|
3469
|
+
gap: 6,
|
|
3470
|
+
itemAlign: "stretch",
|
|
3471
|
+
className: "oui-flex-col md:oui-flex-row",
|
|
3472
|
+
children: [
|
|
3473
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3474
|
+
SummaryItem,
|
|
3475
|
+
{
|
|
3476
|
+
prefix: "$",
|
|
3477
|
+
rule: "human",
|
|
3478
|
+
label: `${t("affiliate.referralVol")} (USDC)`,
|
|
3479
|
+
value: statistics.total_volume,
|
|
3480
|
+
direct: statistics.direct_volume,
|
|
3481
|
+
indirect: statistics.indirect_volume,
|
|
3482
|
+
classNames: {
|
|
3483
|
+
root: "oui-w-full md:oui-w-1/2 md:oui-h-full"
|
|
3484
|
+
}
|
|
3485
|
+
}
|
|
3486
|
+
),
|
|
3487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3488
|
+
SummaryItem,
|
|
3489
|
+
{
|
|
3490
|
+
dp: 0,
|
|
3491
|
+
label: t("affiliate.referrals"),
|
|
3492
|
+
value: statistics.total_invites,
|
|
3493
|
+
direct: statistics.direct_invites,
|
|
3494
|
+
indirect: statistics.indirect_invites,
|
|
3495
|
+
classNames: {
|
|
3496
|
+
root: "oui-w-full md:oui-w-1/2 md:oui-h-full"
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
)
|
|
3500
|
+
]
|
|
3501
|
+
}
|
|
3502
|
+
)
|
|
3305
3503
|
]
|
|
3306
3504
|
}
|
|
3307
3505
|
);
|