@orderly.network/affiliate 3.0.0-beta.4 → 3.0.0-beta.6

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.mjs CHANGED
@@ -461,25 +461,11 @@ var useReferralCode = () => {
461
461
  };
462
462
 
463
463
  // src/pages/multiLevel/affiliate/referralCodeForm/referralCodeForm.script.ts
464
- function formatReferralCodeInput(raw) {
465
- return String(raw).replace(/[a-z]/g, (c) => c.toUpperCase()).replace(/[^A-Z0-9]/g, "");
466
- }
467
464
  var useReferralCodeFormScript = (options) => {
468
465
  const { type, referralCode, maxRebateRate, referrerRebateRate, accountId } = options;
469
466
  const { t } = useTranslation();
470
- const isBind = type === "bind" /* Bind */;
471
467
  const [newCode, setNewCode] = useState(referralCode || "");
472
- const [bindCodeInput, setBindCodeInput] = useState("");
473
468
  const [isReview, setIsReview] = useState(false);
474
- const [skipBinding, setSkipBinding] = useState(false);
475
- const [isAwaitingPostSuccess, setIsAwaitingPostSuccess] = useState(false);
476
- const formattedBindCode = useMemo(
477
- () => formatReferralCodeInput(bindCodeInput),
478
- [bindCodeInput]
479
- );
480
- const { isExist: isBindCodeExist, isLoading: isBindCodeChecking } = useCheckReferralCode(
481
- isBind && formattedBindCode.length >= 4 ? formattedBindCode : void 0
482
- );
483
469
  const maxRebatePercentage = useMemo(() => {
484
470
  return new Decimal(maxRebateRate).mul(100).toNumber();
485
471
  }, [maxRebateRate]);
@@ -494,20 +480,7 @@ var useReferralCodeFormScript = (options) => {
494
480
  return 0;
495
481
  }
496
482
  );
497
- const applyCreateDefaults = () => {
498
- setReferrerRebatePercentage(Math.ceil(maxRebatePercentage / 2));
499
- };
500
- const runBindOnSuccessThenApplyDefaults = async () => {
501
- setIsAwaitingPostSuccess(true);
502
- try {
503
- await Promise.resolve(options.onSuccess?.());
504
- } finally {
505
- setIsAwaitingPostSuccess(false);
506
- }
507
- applyCreateDefaults();
508
- };
509
483
  const {
510
- bindReferralCode,
511
484
  createReferralCode,
512
485
  editReferralCode,
513
486
  updateRebateRate,
@@ -597,27 +570,8 @@ var useReferralCodeFormScript = (options) => {
597
570
  handleError(err);
598
571
  }
599
572
  };
600
- const onBind = async () => {
601
- if (skipBinding) {
602
- await runBindOnSuccessThenApplyDefaults();
603
- return;
604
- }
605
- if (formattedBindCode.length < 4 || formattedBindCode.length > 10 || isBindCodeChecking || !isBindCodeExist) {
606
- return;
607
- }
608
- try {
609
- await bindReferralCode({ referral_code: formattedBindCode });
610
- toast.success(t("affiliate.referralCode.bound"));
611
- await runBindOnSuccessThenApplyDefaults();
612
- } catch (err) {
613
- handleError(err);
614
- }
615
- };
616
573
  const onClick = () => {
617
574
  switch (type) {
618
- case "bind" /* Bind */:
619
- onBind();
620
- break;
621
575
  case "create" /* Create */:
622
576
  onCreate();
623
577
  break;
@@ -633,8 +587,8 @@ var useReferralCodeFormScript = (options) => {
633
587
  break;
634
588
  }
635
589
  };
636
- const buttonDisabled = type === "edit" /* Edit */ && !codeChanged && !rateChanged || isBind && !skipBinding && (formattedBindCode.length < 4 || formattedBindCode.length > 10 || isBindCodeChecking || !isBindCodeExist);
637
- const confirmButtonLoading = isMutating || isAwaitingPostSuccess;
590
+ const buttonDisabled = type === "edit" /* Edit */ && !codeChanged && !rateChanged;
591
+ const confirmButtonLoading = isMutating;
638
592
  return {
639
593
  type,
640
594
  onClick,
@@ -645,16 +599,9 @@ var useReferralCodeFormScript = (options) => {
645
599
  confirmButtonLoading,
646
600
  newCode,
647
601
  setNewCode,
648
- bindCodeInput,
649
- setBindCodeInput,
650
- formattedBindCode,
651
602
  isReview,
652
603
  buttonDisabled,
653
- onReset,
654
- skipBinding,
655
- setSkipBinding,
656
- isBindCodeExist,
657
- isBindCodeChecking
604
+ onReset
658
605
  };
659
606
  };
660
607
  var GiftIcon = (props) => {
@@ -679,30 +626,77 @@ var GiftIcon = (props) => {
679
626
  }
680
627
  );
681
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
+ var ReferralCodeInput = (props) => {
645
+ const hasSetCursorToEnd = useRef(false);
646
+ return /* @__PURE__ */ jsx(
647
+ TextField,
648
+ {
649
+ type: "text",
650
+ fullWidth: true,
651
+ label: props.label ?? "",
652
+ placeholder: props.placeholder,
653
+ value: props.value,
654
+ onChange: (e) => {
655
+ props.onChange(e.target.value);
656
+ },
657
+ onFocus: (e) => {
658
+ if (props.autoFocus && !hasSetCursorToEnd.current) {
659
+ hasSetCursorToEnd.current = true;
660
+ const input = e.target;
661
+ const len = input.value.length;
662
+ requestAnimationFrame(() => {
663
+ input.setSelectionRange(len, len);
664
+ });
665
+ }
666
+ },
667
+ formatters: [
668
+ inputFormatter.createRegexInputFormatter((value) => {
669
+ return String(value).replace(
670
+ /[a-z]/g,
671
+ (char) => char.toUpperCase()
672
+ );
673
+ }),
674
+ inputFormatter.createRegexInputFormatter(/[^A-Z0-9]/g)
675
+ ],
676
+ className: "oui-w-full",
677
+ classNames: {
678
+ label: "oui-text-base-contrast-54 oui-text-xs",
679
+ input: "placeholder:oui-text-base-contrast-20 placeholder:oui-text-sm"
680
+ },
681
+ helpText: props.helpText,
682
+ color: props.color,
683
+ maxLength: 10,
684
+ minLength: 4,
685
+ autoComplete: "off",
686
+ disabled: props.disabled,
687
+ autoFocus: props.autoFocus
688
+ }
689
+ );
690
+ };
682
691
  var ReferralCodeForm = (props) => {
683
692
  const { type, isReview } = props;
684
693
  const { t } = useTranslation();
685
- const isBind = type === "bind" /* Bind */;
686
694
  const isReset = type === "reset" /* Reset */;
687
695
  const hasBoundReferee = !!props.directInvites && props.directInvites > 0;
688
696
  const isEditingRefereeRebateRate = !!props.accountId;
689
697
  const noCommissionAvailable = props.maxRebateRate === 0;
690
698
  const { title, description, buttonText } = useMemo(() => {
691
699
  switch (type) {
692
- case "bind" /* Bind */:
693
- return {
694
- title: t("affiliate.referralCode.bind.modal.title"),
695
- description: /* @__PURE__ */ jsx(
696
- Text,
697
- {
698
- size: "2xs",
699
- intensity: 54,
700
- className: "oui-leading-[18px] oui-text-warning-darken",
701
- children: t("affiliate.referralCode.bind.modal.description")
702
- }
703
- ),
704
- buttonText: t("common.confirm")
705
- };
706
700
  case "create" /* Create */:
707
701
  return {
708
702
  title: t("affiliate.referralCode.create.modal.title"),
@@ -748,19 +742,6 @@ var ReferralCodeForm = (props) => {
748
742
  }
749
743
  );
750
744
  const descriptionView = /* @__PURE__ */ jsx(WarningBox, { children: description });
751
- const bindCodeInvalid = isBind && !props.skipBinding && props.formattedBindCode.length >= 4 && !props.isBindCodeChecking && props.isBindCodeExist === false;
752
- const bindReferralCodeInput = /* @__PURE__ */ jsx(
753
- ReferralCodeInput,
754
- {
755
- value: props.bindCodeInput,
756
- onChange: props.setBindCodeInput,
757
- autoFocus: true,
758
- disabled: props.skipBinding,
759
- placeholder: t("affiliate.referralCode.bind.input.placeholder"),
760
- helpText: bindCodeInvalid ? t("affiliate.referralCode.notExist") : void 0,
761
- color: bindCodeInvalid ? "danger" : void 0
762
- }
763
- );
764
745
  const referralCodeInput = /* @__PURE__ */ jsx(
765
746
  ReferralCodeInput,
766
747
  {
@@ -771,30 +752,6 @@ var ReferralCodeForm = (props) => {
771
752
  label: t("affiliate.referralCode.editCodeModal.label")
772
753
  }
773
754
  );
774
- const bindCheckbox = isBind && /* @__PURE__ */ jsxs(Flex, { className: "oui-gap-[6px]", children: [
775
- /* @__PURE__ */ jsx(
776
- Checkbox,
777
- {
778
- color: "white",
779
- id: "oui-checkbox-skipReferralBinding",
780
- checked: props.skipBinding,
781
- onCheckedChange: (checked) => {
782
- props.setSkipBinding(checked);
783
- if (checked) {
784
- props.setBindCodeInput("");
785
- }
786
- }
787
- }
788
- ),
789
- /* @__PURE__ */ jsx(
790
- "label",
791
- {
792
- htmlFor: "oui-checkbox-skipReferralBinding",
793
- className: "oui-text-2xs oui-font-normal oui-text-base-contrast-54",
794
- children: t("affiliate.referralCode.bind.skip")
795
- }
796
- )
797
- ] });
798
755
  const commissionConfiguration = /* @__PURE__ */ jsxs(Fragment, { children: [
799
756
  /* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, children: t("affiliate.commissionConfiguration") }),
800
757
  !isReview && /* @__PURE__ */ jsxs(Text, { size: "2xs", intensity: 54, children: [
@@ -857,12 +814,6 @@ var ReferralCodeForm = (props) => {
857
814
  ] });
858
815
  const renderContent = () => {
859
816
  switch (type) {
860
- case "bind" /* Bind */:
861
- return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 4, children: [
862
- bindReferralCodeInput,
863
- bindCheckbox,
864
- buttons
865
- ] });
866
817
  case "create" /* Create */:
867
818
  return /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 2, children: [
868
819
  commissionConfiguration,
@@ -1011,74 +962,6 @@ var RebateRateSlider = (props) => {
1011
962
  ] })
1012
963
  ] });
1013
964
  };
1014
- var ReferralCodeInput = (props) => {
1015
- const hasSetCursorToEnd = useRef(false);
1016
- return /* @__PURE__ */ jsx(
1017
- TextField,
1018
- {
1019
- type: "text",
1020
- fullWidth: true,
1021
- label: props.label ?? "",
1022
- placeholder: props.placeholder,
1023
- value: props.value,
1024
- onChange: (e) => {
1025
- props.onChange(e.target.value);
1026
- },
1027
- onFocus: (e) => {
1028
- if (props.autoFocus && !hasSetCursorToEnd.current) {
1029
- hasSetCursorToEnd.current = true;
1030
- const input = e.target;
1031
- const len = input.value.length;
1032
- requestAnimationFrame(() => {
1033
- input.setSelectionRange(len, len);
1034
- });
1035
- }
1036
- },
1037
- formatters: [
1038
- inputFormatter.createRegexInputFormatter((value) => {
1039
- return String(value).replace(
1040
- /[a-z]/g,
1041
- (char) => char.toUpperCase()
1042
- );
1043
- }),
1044
- inputFormatter.createRegexInputFormatter(/[^A-Z0-9]/g)
1045
- ],
1046
- className: "oui-w-full",
1047
- classNames: {
1048
- label: "oui-text-base-contrast-54 oui-text-xs",
1049
- input: "placeholder:oui-text-base-contrast-20 placeholder:oui-text-sm"
1050
- },
1051
- helpText: props.helpText,
1052
- color: props.color,
1053
- maxLength: 10,
1054
- minLength: 4,
1055
- autoComplete: "off",
1056
- disabled: props.disabled,
1057
- autoFocus: props.autoFocus
1058
- }
1059
- );
1060
- };
1061
- var WarningBox = (props) => {
1062
- const { children } = props;
1063
- if (typeof children === "string") {
1064
- return /* @__PURE__ */ jsxs(
1065
- Flex,
1066
- {
1067
- className: "oui-bg-warning/10",
1068
- justify: "start",
1069
- itemAlign: "start",
1070
- gap: 1,
1071
- r: "lg",
1072
- p: 3,
1073
- children: [
1074
- /* @__PURE__ */ jsx(WarningIcon, { className: "oui-shrink-0 oui-text-warning" }),
1075
- /* @__PURE__ */ jsx(Text, { size: "2xs", intensity: 54, className: "oui-text-warning", children })
1076
- ]
1077
- }
1078
- );
1079
- }
1080
- return children;
1081
- };
1082
965
  var ReferralCodeFormWidget = (props) => {
1083
966
  const state = useReferralCodeFormScript(props);
1084
967
  return /* @__PURE__ */ jsx(ReferralCodeForm, { ...state, ...props });
@@ -1095,6 +978,190 @@ registerSimpleDialog(ReferralCodeFormDialogId, ReferralCodeFormWidget, {
1095
978
  }
1096
979
  });
1097
980
  registerSimpleSheet(ReferralCodeFormSheetId, ReferralCodeFormWidget);
981
+ function formatReferralCodeInput(raw) {
982
+ return String(raw).replace(/[a-z]/g, (c) => c.toUpperCase()).replace(/[^A-Z0-9]/g, "");
983
+ }
984
+ var useBindReferralCodeScript = (options) => {
985
+ const { t } = useTranslation();
986
+ const [bindCodeInput, setBindCodeInput] = useState("");
987
+ const [skipBinding, setSkipBinding] = useState(false);
988
+ const [isAwaitingPostSuccess, setIsAwaitingPostSuccess] = useState(false);
989
+ const formattedBindCode = useMemo(
990
+ () => formatReferralCodeInput(bindCodeInput),
991
+ [bindCodeInput]
992
+ );
993
+ const { isExist: isBindCodeExist, isLoading: isBindCodeChecking } = useCheckReferralCode(
994
+ formattedBindCode.length >= 4 ? formattedBindCode : void 0
995
+ );
996
+ const { bindReferralCode, isMutating } = useReferralCode();
997
+ const getErrorMessage = (err) => {
998
+ if (typeof err === "object" && err !== null && "message" in err) {
999
+ const msg = err.message;
1000
+ return typeof msg === "string" ? msg : void 0;
1001
+ }
1002
+ return void 0;
1003
+ };
1004
+ const handleError = (err) => {
1005
+ toast.error(getErrorMessage(err) || t("common.somethingWentWrong"));
1006
+ };
1007
+ const runAfterSuccess = async (payload) => {
1008
+ setIsAwaitingPostSuccess(true);
1009
+ try {
1010
+ await Promise.resolve(options.onSuccess?.(payload));
1011
+ } finally {
1012
+ setIsAwaitingPostSuccess(false);
1013
+ }
1014
+ options.close?.();
1015
+ };
1016
+ const onConfirm = async () => {
1017
+ if (skipBinding) {
1018
+ await runAfterSuccess({ skipped: true });
1019
+ return;
1020
+ }
1021
+ if (formattedBindCode.length < 4 || formattedBindCode.length > 10 || isBindCodeChecking || !isBindCodeExist) {
1022
+ return;
1023
+ }
1024
+ try {
1025
+ await bindReferralCode({ referral_code: formattedBindCode });
1026
+ toast.success(t("affiliate.referralCode.bound"));
1027
+ await runAfterSuccess({ skipped: false });
1028
+ } catch (err) {
1029
+ handleError(err);
1030
+ }
1031
+ };
1032
+ const buttonDisabled = !skipBinding && (formattedBindCode.length < 4 || formattedBindCode.length > 10 || isBindCodeChecking || !isBindCodeExist);
1033
+ const confirmButtonLoading = isMutating || isAwaitingPostSuccess;
1034
+ return {
1035
+ bindCodeInput,
1036
+ setBindCodeInput,
1037
+ skipBinding,
1038
+ setSkipBinding,
1039
+ formattedBindCode,
1040
+ isBindCodeExist,
1041
+ isBindCodeChecking,
1042
+ buttonDisabled,
1043
+ confirmButtonLoading,
1044
+ onConfirm
1045
+ };
1046
+ };
1047
+ var BindReferralCode = (props) => {
1048
+ const { t } = useTranslation();
1049
+ const bindCodeInvalid = !props.skipBinding && props.formattedBindCode.length >= 4 && !props.isBindCodeChecking && props.isBindCodeExist === false;
1050
+ const titleView = /* @__PURE__ */ jsxs(
1051
+ Flex,
1052
+ {
1053
+ width: "100%",
1054
+ direction: "column",
1055
+ itemAlign: "start",
1056
+ gap: 3,
1057
+ className: "oui-bindReferralCode-header",
1058
+ children: [
1059
+ /* @__PURE__ */ jsx(Text, { size: "base", intensity: 98, children: t("affiliate.referralCode.bind.modal.title") }),
1060
+ /* @__PURE__ */ jsx(Divider, { intensity: 8, className: "oui-w-full" })
1061
+ ]
1062
+ }
1063
+ );
1064
+ const descriptionView = /* @__PURE__ */ jsx(WarningBox, { children: /* @__PURE__ */ jsx(
1065
+ Text,
1066
+ {
1067
+ size: "2xs",
1068
+ intensity: 54,
1069
+ className: "oui-leading-[18px] oui-text-warning-darken",
1070
+ children: t("affiliate.referralCode.bind.modal.description")
1071
+ }
1072
+ ) });
1073
+ return /* @__PURE__ */ jsxs(
1074
+ Flex,
1075
+ {
1076
+ direction: "column",
1077
+ itemAlign: "start",
1078
+ gap: 6,
1079
+ className: "oui-affiliate-bindReferralCode oui-font-semibold",
1080
+ children: [
1081
+ titleView,
1082
+ descriptionView,
1083
+ /* @__PURE__ */ jsxs(Flex, { width: "100%", direction: "column", itemAlign: "start", gap: 4, children: [
1084
+ /* @__PURE__ */ jsx(
1085
+ ReferralCodeInput,
1086
+ {
1087
+ value: props.bindCodeInput,
1088
+ onChange: props.setBindCodeInput,
1089
+ autoFocus: true,
1090
+ disabled: props.skipBinding,
1091
+ placeholder: t("affiliate.referralCode.bind.input.placeholder"),
1092
+ helpText: bindCodeInvalid ? t("affiliate.referralCode.notExist") : void 0,
1093
+ color: bindCodeInvalid ? "danger" : void 0
1094
+ }
1095
+ ),
1096
+ /* @__PURE__ */ jsxs(Flex, { className: "oui-gap-[6px]", children: [
1097
+ /* @__PURE__ */ jsx(
1098
+ Checkbox,
1099
+ {
1100
+ color: "white",
1101
+ id: "oui-checkbox-bindReferralCode-skip",
1102
+ checked: props.skipBinding,
1103
+ onCheckedChange: (checked) => {
1104
+ props.setSkipBinding(checked);
1105
+ if (checked) {
1106
+ props.setBindCodeInput("");
1107
+ }
1108
+ }
1109
+ }
1110
+ ),
1111
+ /* @__PURE__ */ jsx(
1112
+ "label",
1113
+ {
1114
+ htmlFor: "oui-checkbox-bindReferralCode-skip",
1115
+ className: "oui-text-2xs oui-font-normal oui-text-base-contrast-54",
1116
+ children: t("affiliate.referralCode.bind.skip")
1117
+ }
1118
+ )
1119
+ ] }),
1120
+ /* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 2, width: "100%", mt: 0, pt: 5, children: [
1121
+ /* @__PURE__ */ jsx(
1122
+ Button,
1123
+ {
1124
+ variant: "contained",
1125
+ color: "gray",
1126
+ fullWidth: true,
1127
+ onClick: props.close,
1128
+ size: "md",
1129
+ className: "oui-bindReferralCode-cancel-btn",
1130
+ children: t("common.cancel")
1131
+ }
1132
+ ),
1133
+ /* @__PURE__ */ jsx(
1134
+ Button,
1135
+ {
1136
+ fullWidth: true,
1137
+ onClick: props.onConfirm,
1138
+ disabled: props.buttonDisabled || props.confirmButtonLoading,
1139
+ loading: props.confirmButtonLoading,
1140
+ size: "md",
1141
+ className: "oui-bindReferralCode-confirm-btn",
1142
+ children: t("common.confirm")
1143
+ }
1144
+ )
1145
+ ] })
1146
+ ] })
1147
+ ]
1148
+ }
1149
+ );
1150
+ };
1151
+ var BindReferralCodeWidget = (props) => {
1152
+ const state = useBindReferralCodeScript(props);
1153
+ return /* @__PURE__ */ jsx(BindReferralCode, { ...state, ...props });
1154
+ };
1155
+
1156
+ // src/pages/multiLevel/components/bindReferralCode/modal.ts
1157
+ var BindReferralCodeDialogId = "BindReferralCodeDialogId";
1158
+ registerSimpleDialog(BindReferralCodeDialogId, BindReferralCodeWidget, {
1159
+ size: "sm",
1160
+ classNames: {
1161
+ content: "oui-border oui-border-line-6",
1162
+ body: "!oui-pt-3"
1163
+ }
1164
+ });
1098
1165
  var TradingVolumeProgress = (props) => {
1099
1166
  const { t } = useTranslation();
1100
1167
  const { classNames } = props;
@@ -1215,8 +1282,18 @@ var Hero = () => {
1215
1282
  multiLevelRebateInfoMutate,
1216
1283
  maxRebateRate,
1217
1284
  maxRebateRateMutate,
1218
- mutate
1285
+ mutate,
1286
+ referralInfo
1219
1287
  } = useReferralContext();
1288
+ const boundReferralCode = referralInfo?.referee_info?.referer_code?.trim() ?? "";
1289
+ const openBindReferralOnlyModal = () => {
1290
+ modal.show(BindReferralCodeDialogId, {
1291
+ onSuccess: async ({ skipped }) => {
1292
+ if (skipped) return;
1293
+ await Promise.allSettled([multiLevelRebateInfoMutate?.(), mutate?.()]);
1294
+ }
1295
+ });
1296
+ };
1220
1297
  const showCreateReferralCodeModal = (maxRateOverride) => {
1221
1298
  modal.show(ReferralCodeFormDialogId, {
1222
1299
  type: "create" /* Create */,
@@ -1229,10 +1306,12 @@ var Hero = () => {
1229
1306
  };
1230
1307
  const onCreateReferralCode = () => {
1231
1308
  if (!isTrader) {
1232
- modal.show(ReferralCodeFormDialogId, {
1233
- type: "bind" /* Bind */,
1234
- maxRebateRate,
1235
- onSuccess: async () => {
1309
+ modal.show(BindReferralCodeDialogId, {
1310
+ onSuccess: async ({ skipped }) => {
1311
+ if (skipped) {
1312
+ showCreateReferralCodeModal();
1313
+ return;
1314
+ }
1236
1315
  const results = await Promise.allSettled([
1237
1316
  maxRebateRateMutate(),
1238
1317
  multiLevelRebateInfoMutate(),
@@ -1260,24 +1339,64 @@ var Hero = () => {
1260
1339
  return "";
1261
1340
  }
1262
1341
  return t("affiliate.newReferralProgram.description");
1263
- }, [t, wrongNetwork, status]);
1342
+ }, [t, wrongNetwork, status, isMultiLevelReferralUnlocked]);
1264
1343
  const renderContent = () => {
1265
1344
  if (!isMultiLevelReferralUnlocked) {
1266
- return /* @__PURE__ */ jsx(
1267
- TradingVolumeProgress,
1345
+ return /* @__PURE__ */ jsxs(
1346
+ Flex,
1268
1347
  {
1269
- classNames: {
1270
- root: "oui-items-start",
1271
- description: "!oui-text-start"
1272
- },
1273
- buttonProps: {
1274
- size: "xl"
1275
- }
1348
+ direction: "column",
1349
+ itemAlign: "start",
1350
+ gap: 4,
1351
+ className: "oui-w-full",
1352
+ children: [
1353
+ /* @__PURE__ */ jsx(
1354
+ TradingVolumeProgress,
1355
+ {
1356
+ classNames: {
1357
+ root: "oui-items-start",
1358
+ description: "!oui-text-start"
1359
+ },
1360
+ buttonProps: {
1361
+ size: "xl"
1362
+ }
1363
+ }
1364
+ ),
1365
+ boundReferralCode ? /* @__PURE__ */ jsx(Text, { size: "sm", intensity: 54, className: "oui-leading-normal", children: t("affiliate.newReferralProgram.referredBy", {
1366
+ code: boundReferralCode
1367
+ }) }) : /* @__PURE__ */ jsx(
1368
+ "button",
1369
+ {
1370
+ type: "button",
1371
+ className: cn(
1372
+ "oui-cursor-pointer oui-border-none oui-bg-transparent oui-p-0",
1373
+ "oui-text-start oui-text-sm oui-font-normal oui-text-base-contrast-54 oui-underline oui-underline-offset-2",
1374
+ "oui-affiliate-landing-hero-bindReferralCode"
1375
+ ),
1376
+ onClick: openBindReferralOnlyModal,
1377
+ children: t("affiliate.newReferralProgram.wereYouReferred")
1378
+ }
1379
+ )
1380
+ ]
1276
1381
  }
1277
1382
  );
1278
1383
  }
1279
1384
  if (isMultiLevelEnabled && !multiLevelRebateInfo?.referral_code) {
1280
- return /* @__PURE__ */ jsx(Button, { size: "lg", className: "oui-px-4", onClick: onCreateReferralCode, children: t("affiliate.referralCode.create") });
1385
+ return /* @__PURE__ */ jsxs(
1386
+ Flex,
1387
+ {
1388
+ direction: "column",
1389
+ itemAlign: "start",
1390
+ gap: 4,
1391
+ className: "oui-w-full",
1392
+ children: [
1393
+ /* @__PURE__ */ jsx(Button, { size: "lg", className: "oui-px-4", onClick: onCreateReferralCode, children: t("affiliate.referralCode.create") }),
1394
+ boundReferralCode ? /* @__PURE__ */ jsx(Text, { size: "sm", intensity: 54, className: "oui-leading-normal", children: t("affiliate.newReferralProgram.referredBy", {
1395
+ code: boundReferralCode
1396
+ }) }) : null
1397
+ ]
1398
+ }
1399
+ );
1281
1400
  }
1282
1401
  return "";
1283
1402
  };