@orderly.network/affiliate 3.0.1 → 3.0.2-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.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, usePagination, DatePicker, TabsBase, TabsList, TabsTrigger, TabsContent, parseNumber, ListView, CopyIcon, DataTable, useScreen, Statistic, Tooltip, DialogTrigger, DialogHeader, DialogBody } from '@orderly.network/ui';
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, Tooltip, 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';
@@ -521,7 +521,7 @@ var useReferralCodeFormScript = (options) => {
521
521
  const onEdit = async () => {
522
522
  const editReferralCodeParams = {
523
523
  current_referral_code: referralCode,
524
- new_referral_code: newCode
524
+ new_referral_code: newCode.toUpperCase().replace(/[^A-Z0-9]/g, "")
525
525
  };
526
526
  const updateRebateRateParams = {
527
527
  referee_rebate_rate: new Decimal(refereeRebatePercentage).div(100).toNumber(),
@@ -944,7 +944,7 @@ var RebateRateSlider = (props) => {
944
944
  /* @__PURE__ */ jsx(
945
945
  Text,
946
946
  {
947
- size: "base",
947
+ size: "sm",
948
948
  intensity: 54,
949
949
  as: "span",
950
950
  className: "oui-inline-flex oui-items-center oui-gap-1 oui-tracking-[0.03em]",
@@ -4325,7 +4325,7 @@ var UnPinIcon = (props) => {
4325
4325
  );
4326
4326
  };
4327
4327
  var ReferralCodes = (props) => {
4328
- const isTablet = useMediaQuery("(max-width: 767px)");
4328
+ const { isMobile } = useScreen();
4329
4329
  return /* @__PURE__ */ jsxs(
4330
4330
  Flex,
4331
4331
  {
@@ -4339,7 +4339,7 @@ var ReferralCodes = (props) => {
4339
4339
  /* @__PURE__ */ jsx(Title4, { ...props }),
4340
4340
  /* @__PURE__ */ jsxs("div", { className: "oui-flex oui-w-full oui-flex-col 2xl:oui-h-full", children: [
4341
4341
  /* @__PURE__ */ jsx(Divider, {}),
4342
- isTablet ? /* @__PURE__ */ jsx(MobileLayout, { ...props }) : /* @__PURE__ */ jsx(DesktopLayout, { ...props })
4342
+ isMobile ? /* @__PURE__ */ jsx(MobileLayout, { ...props }) : /* @__PURE__ */ jsx(DesktopLayout, { ...props })
4343
4343
  ] })
4344
4344
  ]
4345
4345
  }
@@ -4528,7 +4528,7 @@ var MobileCell2 = (props) => {
4528
4528
  };
4529
4529
  var DesktopLayout = (props) => {
4530
4530
  const { t } = useTranslation();
4531
- const moreColumn = useMediaQuery("(min-width: 1024px)");
4531
+ const { isDesktop: moreColumn } = useScreen();
4532
4532
  const columns = useMemo(() => {
4533
4533
  const cols = [
4534
4534
  {
@@ -5069,7 +5069,7 @@ var MobileCellItem2 = (props) => {
5069
5069
  };
5070
5070
  var CommissionList = (props) => {
5071
5071
  const { t } = useTranslation();
5072
- const isLG = useMediaQuery("(max-width: 767px)");
5072
+ const { isMobile } = useScreen();
5073
5073
  const columns = useMemo(() => {
5074
5074
  const cols = [
5075
5075
  {
@@ -5110,7 +5110,7 @@ var CommissionList = (props) => {
5110
5110
  return cols;
5111
5111
  }, [t]);
5112
5112
  const body = useMemo(() => {
5113
- if (isLG) {
5113
+ if (isMobile) {
5114
5114
  return /* @__PURE__ */ jsx(
5115
5115
  ListView,
5116
5116
  {
@@ -5185,7 +5185,7 @@ var CommissionList = (props) => {
5185
5185
  }
5186
5186
  }
5187
5187
  );
5188
- }, [isLG, props.commission]);
5188
+ }, [isMobile, props.commission]);
5189
5189
  return /* @__PURE__ */ jsxs(
5190
5190
  Flex,
5191
5191
  {
@@ -5208,7 +5208,7 @@ var CommissionList = (props) => {
5208
5208
  };
5209
5209
  var RefereesList = (props) => {
5210
5210
  const { t } = useTranslation();
5211
- const isLG = useMediaQuery("(max-width: 767px)");
5211
+ const { isMobile } = useScreen();
5212
5212
  const columns = useMemo(() => {
5213
5213
  const cols = [
5214
5214
  {
@@ -5252,7 +5252,7 @@ var RefereesList = (props) => {
5252
5252
  return cols;
5253
5253
  }, [t]);
5254
5254
  const body = useMemo(() => {
5255
- if (isLG) {
5255
+ if (isMobile) {
5256
5256
  return /* @__PURE__ */ jsx(
5257
5257
  ListView,
5258
5258
  {
@@ -5347,7 +5347,7 @@ var RefereesList = (props) => {
5347
5347
  }
5348
5348
  }
5349
5349
  );
5350
- }, [isLG, props.referees]);
5350
+ }, [isMobile, props.referees]);
5351
5351
  return /* @__PURE__ */ jsx(
5352
5352
  Flex,
5353
5353
  {
@@ -5390,13 +5390,13 @@ var useCommissionDataScript = () => {
5390
5390
  to: subDays(/* @__PURE__ */ new Date(), 1)
5391
5391
  }
5392
5392
  );
5393
- const isLG = useMediaQuery("(max-width: 767px)");
5393
+ const { isMobile } = useScreen();
5394
5394
  const { page, pageSize, setPage, parsePagination } = usePagination();
5395
5395
  const [commissionData, { refresh, isLoading, loadMore, meta }] = useReferralRebateSummary({
5396
5396
  startDate: commissionRange?.from !== void 0 ? format(commissionRange.from, "yyyy-MM-dd") : void 0,
5397
5397
  endDate: commissionRange?.to !== void 0 ? format(commissionRange.to, "yyyy-MM-dd") : void 0,
5398
5398
  size: pageSize,
5399
- page: !isLG ? page : void 0
5399
+ page: !isMobile ? page : void 0
5400
5400
  });
5401
5401
  useEffect(() => {
5402
5402
  refresh();
@@ -5424,13 +5424,13 @@ var useRefereesDataScript = () => {
5424
5424
  to: subDays(/* @__PURE__ */ new Date(), 1)
5425
5425
  }
5426
5426
  );
5427
- const isLG = useMediaQuery("(max-width: 767px)");
5427
+ const { isMobile } = useScreen();
5428
5428
  const { page, pageSize, setPage, parsePagination } = usePagination();
5429
5429
  const [commissionData, { refresh, isLoading, loadMore, meta }] = useRefereeInfo({
5430
5430
  startDate: commissionRange?.from !== void 0 ? format(commissionRange.from, "yyyy-MM-dd") : void 0,
5431
5431
  endDate: commissionRange?.to !== void 0 ? format(commissionRange.to, "yyyy-MM-dd") : void 0,
5432
5432
  size: pageSize,
5433
- page: !isLG ? page : void 0,
5433
+ page: !isMobile ? page : void 0,
5434
5434
  sort: "descending_code_binding_time"
5435
5435
  });
5436
5436
  useEffect(() => {
@@ -5547,7 +5547,7 @@ var BecomeAffiliate = (props) => {
5547
5547
  width: "100%",
5548
5548
  children: [
5549
5549
  /* @__PURE__ */ jsx(Text, { children: t("affiliate.process.title") }),
5550
- /* @__PURE__ */ jsxs(Flex, { className: "oui-flex oui-flex-col oui-gap-3 lg:oui-w-full lg:oui-flex-row lg:oui-items-stretch", children: [
5550
+ /* @__PURE__ */ jsxs(Flex, { className: "oui-flex oui-flex-col oui-gap-3 xl:oui-w-full xl:oui-flex-row xl:oui-items-stretch", children: [
5551
5551
  /* @__PURE__ */ jsx(
5552
5552
  Item,
5553
5553
  {
@@ -5556,7 +5556,7 @@ var BecomeAffiliate = (props) => {
5556
5556
  content: applyText.desc
5557
5557
  }
5558
5558
  ),
5559
- /* @__PURE__ */ jsx("div", { className: "oui-shrink lg:oui-flex lg:-oui-rotate-90 lg:oui-flex-row lg:oui-items-center lg:oui-justify-center", children: /* @__PURE__ */ jsx(ArrowDownIcon, {}) }),
5559
+ /* @__PURE__ */ jsx("div", { className: "oui-shrink xl:oui-flex xl:-oui-rotate-90 xl:oui-flex-row xl:oui-items-center xl:oui-justify-center", children: /* @__PURE__ */ jsx(ArrowDownIcon, {}) }),
5560
5560
  /* @__PURE__ */ jsx(
5561
5561
  Item,
5562
5562
  {
@@ -5565,7 +5565,7 @@ var BecomeAffiliate = (props) => {
5565
5565
  content: t("affiliate.process.step2.description")
5566
5566
  }
5567
5567
  ),
5568
- /* @__PURE__ */ jsx("div", { className: "oui-shrink lg:oui-flex lg:-oui-rotate-90 lg:oui-flex-row lg:oui-items-center lg:oui-justify-center", children: /* @__PURE__ */ jsx(ArrowDownIcon, {}) }),
5568
+ /* @__PURE__ */ jsx("div", { className: "oui-shrink xl:oui-flex xl:-oui-rotate-90 xl:oui-flex-row xl:oui-items-center xl:oui-justify-center", children: /* @__PURE__ */ jsx(ArrowDownIcon, {}) }),
5569
5569
  /* @__PURE__ */ jsx(
5570
5570
  Item,
5571
5571
  {
@@ -5585,7 +5585,7 @@ var Item = (props) => {
5585
5585
  {
5586
5586
  className: cn(
5587
5587
  "oui-flex oui-flex-row oui-gap-3",
5588
- "lg:oui-flex-1 lg:oui-flex-col lg:oui-gap-[6px]"
5588
+ "xl:oui-flex-1 xl:oui-flex-col xl:oui-gap-[6px]"
5589
5589
  ),
5590
5590
  width: "100%",
5591
5591
  children: [
@@ -5596,11 +5596,11 @@ var Item = (props) => {
5596
5596
  className: cn(
5597
5597
  "oui-flex oui-flex-col oui-items-start oui-h-full oui-justify-between",
5598
5598
  // lg
5599
- "lg:oui-items-center lg:oui-justify-start"
5599
+ "xl:oui-items-center xl:oui-justify-start"
5600
5600
  ),
5601
5601
  children: [
5602
- /* @__PURE__ */ jsx(Text, { className: "oui-text-sm md:oui-text-base 2xl:oui-text-lg lg:oui-text-center", children: props.title }),
5603
- /* @__PURE__ */ jsx(Text, { className: "oui-text-2xs oui-text-base-contrast-36 lg:oui-text-center", children: props.content })
5602
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-sm md:oui-text-base 2xl:oui-text-lg xl:oui-text-center", children: props.title }),
5603
+ /* @__PURE__ */ jsx(Text, { className: "oui-text-2xs oui-text-base-contrast-36 xl:oui-text-center", children: props.content })
5604
5604
  ]
5605
5605
  }
5606
5606
  )
@@ -5617,7 +5617,7 @@ var ApplyIcon = () => {
5617
5617
  viewBox: "0 0 48 48",
5618
5618
  fill: "none",
5619
5619
  xmlns: "http://www.w3.org/2000/svg",
5620
- className: "lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5620
+ className: "xl:oui-w-[64px] xl:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5621
5621
  children: [
5622
5622
  /* @__PURE__ */ jsx(
5623
5623
  "path",
@@ -5685,7 +5685,7 @@ var ShareIcon = () => {
5685
5685
  viewBox: "0 0 48 48",
5686
5686
  fill: "none",
5687
5687
  xmlns: "http://www.w3.org/2000/svg",
5688
- className: "lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5688
+ className: "xl:oui-w-[64px] xl:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5689
5689
  children: [
5690
5690
  /* @__PURE__ */ jsx(
5691
5691
  "path",
@@ -5727,7 +5727,7 @@ var EarnIcon = () => {
5727
5727
  viewBox: "0 0 48 48",
5728
5728
  fill: "none",
5729
5729
  xmlns: "http://www.w3.org/2000/svg",
5730
- className: "lg:oui-w-[64px] lg:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5730
+ className: "xl:oui-w-[64px] xl:oui-h-[64px] 2xl:oui-w-[80px] 2xl:oui-h-[80px]",
5731
5731
  children: [
5732
5732
  /* @__PURE__ */ jsx(
5733
5733
  "path",
@@ -6833,7 +6833,7 @@ var Title8 = (props) => {
6833
6833
  };
6834
6834
  var List = (props) => {
6835
6835
  const { t } = useTranslation();
6836
- const layout767 = useMediaQuery("(max-width: 767px)");
6836
+ const { isMobile } = useScreen();
6837
6837
  const columns = [
6838
6838
  {
6839
6839
  title: `${t("affiliate.trader.rebates")} (USDC)`,
@@ -6864,7 +6864,7 @@ var List = (props) => {
6864
6864
  width: 127
6865
6865
  }
6866
6866
  ];
6867
- if (layout767) {
6867
+ if (isMobile) {
6868
6868
  return /* @__PURE__ */ jsx(
6869
6869
  ListView,
6870
6870
  {