@agg-build/ui 4.18.2 → 4.19.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/README.md +1 -0
- package/dist/{chunk-RFMA5ABT.mjs → chunk-GT3DCFIT.mjs} +489 -36
- package/dist/index.js +1070 -603
- package/dist/index.mjs +9 -1
- package/dist/pages.js +502 -35
- package/dist/pages.mjs +9 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/types/pages/index.d.mts +1 -0
- package/dist/types/pages/index.d.ts +1 -0
- package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.mts +7 -0
- package/dist/types/pages/leaderboard/components/leaderboard-header-row.d.ts +7 -0
- package/dist/types/pages/leaderboard/components/leaderboard-row.d.mts +7 -0
- package/dist/types/pages/leaderboard/components/leaderboard-row.d.ts +7 -0
- package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.mts +3 -0
- package/dist/types/pages/leaderboard/components/leaderboard-skeleton.d.ts +3 -0
- package/dist/types/pages/leaderboard/components/segmented-control.d.mts +18 -0
- package/dist/types/pages/leaderboard/components/segmented-control.d.ts +18 -0
- package/dist/types/pages/leaderboard/index.d.mts +28 -0
- package/dist/types/pages/leaderboard/index.d.ts +28 -0
- package/dist/types/pages/leaderboard/leaderboard.constants.d.mts +8 -0
- package/dist/types/pages/leaderboard/leaderboard.constants.d.ts +8 -0
- package/dist/types/pages/leaderboard/leaderboard.types.d.mts +11 -0
- package/dist/types/pages/leaderboard/leaderboard.types.d.ts +11 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +2 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +2 -4
- package/dist/types/shared/pnl-format.d.mts +20 -0
- package/dist/types/shared/pnl-format.d.ts +20 -0
- package/package.json +3 -3
- /package/dist/types/{pages/user-profile/components → shared}/default-avatar.d.mts +0 -0
- /package/dist/types/{pages/user-profile/components → shared}/default-avatar.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -33484,6 +33484,10 @@ __export(src_exports, {
|
|
|
33484
33484
|
ImageIcon: () => ImageIcon,
|
|
33485
33485
|
InfoIcon: () => InfoIcon,
|
|
33486
33486
|
InlineAlert: () => InlineAlert,
|
|
33487
|
+
LEADERBOARD_DEFAULT_METRIC: () => LEADERBOARD_DEFAULT_METRIC,
|
|
33488
|
+
LEADERBOARD_DEFAULT_PERIOD: () => LEADERBOARD_DEFAULT_PERIOD,
|
|
33489
|
+
LEADERBOARD_METRICS: () => LEADERBOARD_METRICS,
|
|
33490
|
+
LeaderboardPage: () => LeaderboardPage,
|
|
33487
33491
|
LineChart: () => LineChart,
|
|
33488
33492
|
LinkAccountsIcon: () => LinkAccountsIcon,
|
|
33489
33493
|
LoadingIcon: () => LoadingIcon,
|
|
@@ -33652,7 +33656,7 @@ var import_hooks43 = require("@agg-build/hooks");
|
|
|
33652
33656
|
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
33653
33657
|
init_constants();
|
|
33654
33658
|
|
|
33655
|
-
// src/
|
|
33659
|
+
// src/shared/default-avatar.tsx
|
|
33656
33660
|
init_utils();
|
|
33657
33661
|
var import_jsx_runtime150 = require("react/jsx-runtime");
|
|
33658
33662
|
var DefaultAvatar = ({ className }) => {
|
|
@@ -38568,24 +38572,58 @@ var USER_PROFILE_POSITION_FILTERS = [
|
|
|
38568
38572
|
{ value: "closed", label: "Closed" }
|
|
38569
38573
|
];
|
|
38570
38574
|
|
|
38571
|
-
// src/
|
|
38572
|
-
var
|
|
38573
|
-
avgPrefix: "avg",
|
|
38574
|
-
nowPrefix: "now",
|
|
38575
|
-
finalPrefix: "final"
|
|
38576
|
-
};
|
|
38577
|
-
var missingLabel = "\u2014";
|
|
38575
|
+
// src/shared/pnl-format.ts
|
|
38576
|
+
var MISSING_VALUE_LABEL = "\u2014";
|
|
38578
38577
|
var usdFormatter = new Intl.NumberFormat("en-US", {
|
|
38579
38578
|
style: "currency",
|
|
38580
38579
|
currency: "USD",
|
|
38581
38580
|
minimumFractionDigits: 2,
|
|
38582
38581
|
maximumFractionDigits: 2
|
|
38583
38582
|
});
|
|
38583
|
+
var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
38584
|
+
var formatCurrency = (value, formatCurrencyOverride) => {
|
|
38585
|
+
if (!isFiniteNumber(value)) return MISSING_VALUE_LABEL;
|
|
38586
|
+
if (formatCurrencyOverride) return formatCurrencyOverride(value);
|
|
38587
|
+
return usdFormatter.format(value);
|
|
38588
|
+
};
|
|
38589
|
+
var NEGLIGIBLE_CURRENCY_THRESHOLD = 5e-3;
|
|
38590
|
+
var formatSignedCurrency = (value, formatCurrencyOverride, options = {}) => {
|
|
38591
|
+
if (!isFiniteNumber(value)) return MISSING_VALUE_LABEL;
|
|
38592
|
+
if (value === 0) return formatCurrency(0, formatCurrencyOverride);
|
|
38593
|
+
const sign = value > 0 ? "+" : "-";
|
|
38594
|
+
const magnitude = Math.abs(value);
|
|
38595
|
+
if (options.markNegligible && magnitude < NEGLIGIBLE_CURRENCY_THRESHOLD) {
|
|
38596
|
+
return `${sign}<${formatCurrency(0.01, formatCurrencyOverride)}`;
|
|
38597
|
+
}
|
|
38598
|
+
return `${sign}${formatCurrency(magnitude, formatCurrencyOverride)}`;
|
|
38599
|
+
};
|
|
38600
|
+
var formatCurrencyMarkingNegligible = (value, formatCurrencyOverride) => {
|
|
38601
|
+
if (!isFiniteNumber(value)) return MISSING_VALUE_LABEL;
|
|
38602
|
+
if (value !== 0 && Math.abs(value) < NEGLIGIBLE_CURRENCY_THRESHOLD) {
|
|
38603
|
+
return `<${formatCurrency(0.01, formatCurrencyOverride)}`;
|
|
38604
|
+
}
|
|
38605
|
+
return formatCurrency(value, formatCurrencyOverride);
|
|
38606
|
+
};
|
|
38607
|
+
var getPositionTone = (value) => {
|
|
38608
|
+
if (!isFiniteNumber(value) || value === 0) return "neutral";
|
|
38609
|
+
return value > 0 ? "positive" : "negative";
|
|
38610
|
+
};
|
|
38611
|
+
var toneClassName = (tone) => {
|
|
38612
|
+
if (tone === "positive") return "text-agg-success";
|
|
38613
|
+
if (tone === "negative") return "text-agg-error";
|
|
38614
|
+
return "text-agg-muted-foreground";
|
|
38615
|
+
};
|
|
38616
|
+
|
|
38617
|
+
// src/pages/user-profile/position-view-model.ts
|
|
38618
|
+
var defaultLabels2 = {
|
|
38619
|
+
avgPrefix: "avg",
|
|
38620
|
+
nowPrefix: "now",
|
|
38621
|
+
finalPrefix: "final"
|
|
38622
|
+
};
|
|
38584
38623
|
var percentFormatter = new Intl.NumberFormat("en-US", {
|
|
38585
38624
|
minimumFractionDigits: 0,
|
|
38586
38625
|
maximumFractionDigits: 1
|
|
38587
38626
|
});
|
|
38588
|
-
var isFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
38589
38627
|
var parseCurrencyLabel = (label2) => {
|
|
38590
38628
|
if (!label2) return null;
|
|
38591
38629
|
const normalized = label2.replace(/[$,\s]/g, "");
|
|
@@ -38606,23 +38644,13 @@ var parsePercentLabel = (label2) => {
|
|
|
38606
38644
|
const parsed = Number(match[1].replace(/,/g, ""));
|
|
38607
38645
|
return Number.isFinite(parsed) ? parsed : null;
|
|
38608
38646
|
};
|
|
38609
|
-
var formatCurrency = (value, formatCurrencyOverride) => {
|
|
38610
|
-
if (!isFiniteNumber(value)) return missingLabel;
|
|
38611
|
-
if (formatCurrencyOverride) return formatCurrencyOverride(value);
|
|
38612
|
-
return usdFormatter.format(value);
|
|
38613
|
-
};
|
|
38614
|
-
var formatSignedCurrency = (value, formatCurrencyOverride) => {
|
|
38615
|
-
if (!isFiniteNumber(value)) return missingLabel;
|
|
38616
|
-
if (value === 0) return formatCurrency(0, formatCurrencyOverride);
|
|
38617
|
-
return `${value > 0 ? "+" : "-"}${formatCurrency(Math.abs(value), formatCurrencyOverride)}`;
|
|
38618
|
-
};
|
|
38619
38647
|
var formatPriceCents2 = (value, formatPrice) => {
|
|
38620
|
-
if (!isFiniteNumber(value)) return
|
|
38648
|
+
if (!isFiniteNumber(value)) return MISSING_VALUE_LABEL;
|
|
38621
38649
|
if (formatPrice) return formatPrice(value);
|
|
38622
38650
|
return `${Math.round(value * 100)}\xA2`;
|
|
38623
38651
|
};
|
|
38624
38652
|
var formatSignedPercent = (value) => {
|
|
38625
|
-
if (!isFiniteNumber(value)) return
|
|
38653
|
+
if (!isFiniteNumber(value)) return MISSING_VALUE_LABEL;
|
|
38626
38654
|
if (value === 0) return "0%";
|
|
38627
38655
|
return `${value > 0 ? "+" : "-"}${percentFormatter.format(Math.abs(value))}%`;
|
|
38628
38656
|
};
|
|
@@ -38710,10 +38738,6 @@ var getFinalPnlPercent = (position, pnlValue) => {
|
|
|
38710
38738
|
}
|
|
38711
38739
|
return null;
|
|
38712
38740
|
};
|
|
38713
|
-
var getPositionTone = (value) => {
|
|
38714
|
-
if (!isFiniteNumber(value) || value === 0) return "neutral";
|
|
38715
|
-
return value > 0 ? "positive" : "negative";
|
|
38716
|
-
};
|
|
38717
38741
|
var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}) => {
|
|
38718
38742
|
const { formatCurrency: currency, formatPrice: price } = formatters;
|
|
38719
38743
|
const positionStatus = resolvePositionStatus(position);
|
|
@@ -38727,10 +38751,10 @@ var toPositionRowViewModel = (position, labels = defaultLabels2, formatters = {}
|
|
|
38727
38751
|
position,
|
|
38728
38752
|
positionStatus,
|
|
38729
38753
|
bucket: resolvePositionBucket(position),
|
|
38730
|
-
title: position.title ||
|
|
38754
|
+
title: position.title || MISSING_VALUE_LABEL,
|
|
38731
38755
|
thumbnailSrc: position.thumbnailSrc,
|
|
38732
|
-
selectedOutcomeLabel: position.outcomeLabel ||
|
|
38733
|
-
resolutionLabel: position.resolutionLabel || position.outcomeLabel ||
|
|
38756
|
+
selectedOutcomeLabel: position.outcomeLabel || MISSING_VALUE_LABEL,
|
|
38757
|
+
resolutionLabel: position.resolutionLabel || position.outcomeLabel || MISSING_VALUE_LABEL,
|
|
38734
38758
|
venueShareBreakdown: position.venueShareBreakdown,
|
|
38735
38759
|
totalTraded: {
|
|
38736
38760
|
primaryLabel: formatCurrency(getTotalTradedValue(position), currency),
|
|
@@ -39367,11 +39391,6 @@ var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
|
39367
39391
|
var shouldUseNativeLinkNavigation3 = (event) => {
|
|
39368
39392
|
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button === 1;
|
|
39369
39393
|
};
|
|
39370
|
-
var toneTextClassName = (tone) => {
|
|
39371
|
-
if (tone === "positive") return "text-agg-success";
|
|
39372
|
-
if (tone === "negative") return "text-agg-error";
|
|
39373
|
-
return "text-agg-muted-foreground";
|
|
39374
|
-
};
|
|
39375
39394
|
var OutcomePill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "agg-position-outcome max-w-[120px] inline-flex items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground truncate", children: label2 }) });
|
|
39376
39395
|
var ResolutionPill = ({ label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "agg-position-resolution-pill inline-flex w-full items-center justify-center overflow-hidden rounded-full bg-agg-secondary-hover px-4 py-[6px] md:w-auto", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("span", { className: "truncate whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: label2 }) });
|
|
39377
39396
|
var VenueShares = ({
|
|
@@ -39470,7 +39489,7 @@ var PositionValueCell = ({
|
|
|
39470
39489
|
{
|
|
39471
39490
|
className: cn(
|
|
39472
39491
|
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal",
|
|
39473
|
-
|
|
39492
|
+
toneClassName(value.tone)
|
|
39474
39493
|
),
|
|
39475
39494
|
children: value.deltaLabel
|
|
39476
39495
|
}
|
|
@@ -39483,7 +39502,7 @@ var PositionValueCell = ({
|
|
|
39483
39502
|
{
|
|
39484
39503
|
className: cn(
|
|
39485
39504
|
"font-agg-sans text-agg-xs leading-agg-4 font-agg-normal",
|
|
39486
|
-
|
|
39505
|
+
toneClassName(value.tone)
|
|
39487
39506
|
),
|
|
39488
39507
|
children: value.percentLabel
|
|
39489
39508
|
}
|
|
@@ -41748,10 +41767,454 @@ var UserProfilePage = ({
|
|
|
41748
41767
|
};
|
|
41749
41768
|
UserProfilePage.displayName = "UserProfilePage";
|
|
41750
41769
|
|
|
41770
|
+
// src/pages/leaderboard/index.tsx
|
|
41771
|
+
var import_hooks105 = require("@agg-build/hooks");
|
|
41772
|
+
var import_react69 = require("react");
|
|
41773
|
+
init_button();
|
|
41774
|
+
init_error_boundary();
|
|
41775
|
+
init_icon();
|
|
41776
|
+
init_state_message();
|
|
41777
|
+
init_utils();
|
|
41778
|
+
|
|
41779
|
+
// src/pages/leaderboard/components/leaderboard-header-row.tsx
|
|
41780
|
+
var import_hooks102 = require("@agg-build/hooks");
|
|
41781
|
+
init_utils();
|
|
41782
|
+
|
|
41783
|
+
// src/pages/leaderboard/leaderboard.constants.ts
|
|
41784
|
+
var LEADERBOARD_DEFAULT_PERIOD = "30d";
|
|
41785
|
+
var LEADERBOARD_DEFAULT_METRIC = "realizedPnl";
|
|
41786
|
+
var LEADERBOARD_METRICS = ["realizedPnl", "volume"];
|
|
41787
|
+
var LEADERBOARD_TOP_RANKS = 3;
|
|
41788
|
+
var LEADERBOARD_GRID_CLASS = "grid grid-cols-[36px_minmax(0,1fr)] grid-rows-[auto_auto] gap-x-3 gap-y-2 sm:grid-cols-[48px_minmax(0,1fr)_88px_128px_128px] sm:grid-rows-1 sm:gap-x-3 sm:gap-y-0";
|
|
41789
|
+
|
|
41790
|
+
// src/pages/leaderboard/components/leaderboard-header-row.tsx
|
|
41791
|
+
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
41792
|
+
var SORT_CARET = /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("svg", { viewBox: "0 0 10 10", className: "size-2.5", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)("path", { d: "M5 8 1 3h8z", fill: "currentColor" }) });
|
|
41793
|
+
function LeaderboardHeaderRow({
|
|
41794
|
+
metric,
|
|
41795
|
+
onMetricChange
|
|
41796
|
+
}) {
|
|
41797
|
+
const labels = (0, import_hooks102.useLabels)().leaderboard;
|
|
41798
|
+
const sortable = (key, text) => {
|
|
41799
|
+
const active = metric === key;
|
|
41800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(
|
|
41801
|
+
"span",
|
|
41802
|
+
{
|
|
41803
|
+
role: "columnheader",
|
|
41804
|
+
"aria-sort": active ? "descending" : void 0,
|
|
41805
|
+
className: "text-right",
|
|
41806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)(
|
|
41807
|
+
"button",
|
|
41808
|
+
{
|
|
41809
|
+
type: "button",
|
|
41810
|
+
onClick: () => onMetricChange(key),
|
|
41811
|
+
className: cn(
|
|
41812
|
+
"inline-flex cursor-pointer items-center justify-end gap-1 uppercase tracking-wide outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-agg-primary-hover",
|
|
41813
|
+
active ? "font-agg-bold text-agg-foreground" : "hover:text-agg-foreground"
|
|
41814
|
+
),
|
|
41815
|
+
children: [
|
|
41816
|
+
text,
|
|
41817
|
+
active ? SORT_CARET : null
|
|
41818
|
+
]
|
|
41819
|
+
}
|
|
41820
|
+
)
|
|
41821
|
+
}
|
|
41822
|
+
);
|
|
41823
|
+
};
|
|
41824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)(
|
|
41825
|
+
"div",
|
|
41826
|
+
{
|
|
41827
|
+
role: "row",
|
|
41828
|
+
className: cn(
|
|
41829
|
+
LEADERBOARD_GRID_CLASS,
|
|
41830
|
+
"agg-leaderboard-header hidden h-10 items-center border-b border-agg-separator bg-agg-secondary-hover px-5 text-agg-xs leading-agg-4 uppercase tracking-wide text-agg-muted-foreground sm:grid"
|
|
41831
|
+
),
|
|
41832
|
+
children: [
|
|
41833
|
+
/* @__PURE__ */ (0, import_jsx_runtime209.jsx)("span", { role: "columnheader", children: labels.columns.rank }),
|
|
41834
|
+
/* @__PURE__ */ (0, import_jsx_runtime209.jsx)("span", { role: "columnheader", children: labels.columns.trader }),
|
|
41835
|
+
/* @__PURE__ */ (0, import_jsx_runtime209.jsx)("span", { role: "columnheader", className: "text-right", children: labels.columns.orders }),
|
|
41836
|
+
sortable("volume", labels.columns.volume),
|
|
41837
|
+
sortable("realizedPnl", labels.columns.realizedPnl)
|
|
41838
|
+
]
|
|
41839
|
+
}
|
|
41840
|
+
);
|
|
41841
|
+
}
|
|
41842
|
+
|
|
41843
|
+
// src/pages/leaderboard/components/leaderboard-row.tsx
|
|
41844
|
+
var import_hooks103 = require("@agg-build/hooks");
|
|
41845
|
+
init_remote_image();
|
|
41846
|
+
init_utils();
|
|
41847
|
+
var import_jsx_runtime210 = require("react/jsx-runtime");
|
|
41848
|
+
var integer = new Intl.NumberFormat("en-US");
|
|
41849
|
+
function LeaderboardRowView({
|
|
41850
|
+
row,
|
|
41851
|
+
isCurrentUser,
|
|
41852
|
+
className
|
|
41853
|
+
}) {
|
|
41854
|
+
var _a, _b, _c;
|
|
41855
|
+
const labels = (0, import_hooks103.useLabels)().leaderboard;
|
|
41856
|
+
const { formatCurrency: formatCurrency2 } = (0, import_hooks103.useAggUiConfig)().formatting;
|
|
41857
|
+
const tone = getPositionTone(row.realizedPnl);
|
|
41858
|
+
const shortWallet = shortenAddress(row.walletAddress);
|
|
41859
|
+
const identity = (_b = (_a = row.username) != null ? _a : shortWallet) != null ? _b : labels.anonymousTrader;
|
|
41860
|
+
const identityKind = row.username ? "username" : shortWallet ? "wallet" : "anonymous";
|
|
41861
|
+
const isTop = row.rank != null && row.rank <= LEADERBOARD_TOP_RANKS;
|
|
41862
|
+
const hasOrders = Number.isFinite(row.orders);
|
|
41863
|
+
const cell = (caption2, value, extra) => /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("span", { role: "cell", className: "flex flex-col text-left tabular-nums sm:block sm:text-right", children: [
|
|
41864
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsx)("span", { className: "agg-type-caption uppercase tracking-wide text-agg-muted-foreground sm:hidden", children: caption2 }),
|
|
41865
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsx)("span", { className: cn("text-agg-sm leading-agg-5", extra), children: value })
|
|
41866
|
+
] });
|
|
41867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(
|
|
41868
|
+
"div",
|
|
41869
|
+
{
|
|
41870
|
+
role: "row",
|
|
41871
|
+
"aria-current": isCurrentUser ? "true" : void 0,
|
|
41872
|
+
className: cn(
|
|
41873
|
+
LEADERBOARD_GRID_CLASS,
|
|
41874
|
+
"agg-leaderboard-row items-center px-4 py-3 sm:min-h-16 sm:px-5",
|
|
41875
|
+
isCurrentUser ? "bg-agg-trade-highlight-surface shadow-[inset_3px_0_0_var(--agg-color-primary)]" : "hover:bg-agg-secondary-hover/60",
|
|
41876
|
+
className
|
|
41877
|
+
),
|
|
41878
|
+
children: [
|
|
41879
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
|
|
41880
|
+
"span",
|
|
41881
|
+
{
|
|
41882
|
+
role: "cell",
|
|
41883
|
+
"data-testid": "agg-leaderboard-rank",
|
|
41884
|
+
className: cn(
|
|
41885
|
+
"agg-leaderboard-rank row-span-2 inline-flex size-7 items-center justify-center rounded-agg-full text-agg-sm tabular-nums sm:row-span-1",
|
|
41886
|
+
// cn() is a plain join: colour classes must be mutually exclusive.
|
|
41887
|
+
row.rank === 1 ? "border border-agg-primary bg-agg-secondary-hover font-agg-bold text-agg-primary" : isTop ? "border border-agg-separator bg-agg-secondary-hover font-agg-bold text-agg-foreground" : "text-agg-muted-foreground"
|
|
41888
|
+
),
|
|
41889
|
+
children: (_c = row.rank) != null ? _c : "\u2013"
|
|
41890
|
+
}
|
|
41891
|
+
),
|
|
41892
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("div", { role: "cell", className: "agg-leaderboard-identity flex min-w-0 items-center gap-3", children: [
|
|
41893
|
+
row.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
|
|
41894
|
+
RemoteImage,
|
|
41895
|
+
{
|
|
41896
|
+
src: (0, import_hooks103.optimizedImageUrl)(row.avatarUrl, 80),
|
|
41897
|
+
alt: "",
|
|
41898
|
+
className: "size-10 shrink-0 rounded-agg-full object-cover"
|
|
41899
|
+
}
|
|
41900
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(DefaultAvatar, { className: "size-10 rounded-agg-full" }),
|
|
41901
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("div", { className: "flex min-w-0 flex-col", children: [
|
|
41902
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
41903
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsx)(
|
|
41904
|
+
"span",
|
|
41905
|
+
{
|
|
41906
|
+
className: cn(
|
|
41907
|
+
"truncate text-agg-sm leading-agg-5",
|
|
41908
|
+
identityKind === "username" && "font-agg-bold text-agg-foreground",
|
|
41909
|
+
identityKind === "wallet" && "font-mono font-agg-medium text-agg-foreground",
|
|
41910
|
+
identityKind === "anonymous" && "font-agg-medium text-agg-muted-foreground"
|
|
41911
|
+
),
|
|
41912
|
+
children: identity
|
|
41913
|
+
}
|
|
41914
|
+
),
|
|
41915
|
+
isCurrentUser ? /* @__PURE__ */ (0, import_jsx_runtime210.jsx)("span", { className: "rounded-agg-full bg-agg-primary px-1.5 text-agg-2xs font-agg-bold uppercase leading-agg-4 tracking-wide text-agg-on-primary", children: labels.you }) : null
|
|
41916
|
+
] }),
|
|
41917
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsx)("span", { className: "text-agg-xs leading-agg-4 text-agg-muted-foreground", children: hasOrders ? labels.tradesCount(row.orders) : MISSING_VALUE_LABEL })
|
|
41918
|
+
] })
|
|
41919
|
+
] }),
|
|
41920
|
+
/* @__PURE__ */ (0, import_jsx_runtime210.jsxs)("div", { className: "col-start-2 grid grid-cols-3 gap-2 sm:contents", children: [
|
|
41921
|
+
cell(labels.columns.orders, hasOrders ? integer.format(row.orders) : MISSING_VALUE_LABEL),
|
|
41922
|
+
cell(labels.columns.volume, formatCurrencyMarkingNegligible(row.volume, formatCurrency2)),
|
|
41923
|
+
cell(
|
|
41924
|
+
labels.columns.realizedPnl,
|
|
41925
|
+
formatSignedCurrency(row.realizedPnl, formatCurrency2, { markNegligible: true }),
|
|
41926
|
+
cn("font-agg-bold", toneClassName(tone))
|
|
41927
|
+
)
|
|
41928
|
+
] })
|
|
41929
|
+
]
|
|
41930
|
+
}
|
|
41931
|
+
);
|
|
41932
|
+
}
|
|
41933
|
+
|
|
41934
|
+
// src/pages/leaderboard/components/leaderboard-skeleton.tsx
|
|
41935
|
+
var import_hooks104 = require("@agg-build/hooks");
|
|
41936
|
+
init_utils();
|
|
41937
|
+
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
41938
|
+
function LeaderboardSkeleton({ rows = 4 }) {
|
|
41939
|
+
const labels = (0, import_hooks104.useLabels)().leaderboard;
|
|
41940
|
+
return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("div", { role: "status", "aria-label": labels.loadingAria, className: "agg-leaderboard-skeleton", children: Array.from({ length: rows }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(
|
|
41941
|
+
"div",
|
|
41942
|
+
{
|
|
41943
|
+
className: cn(
|
|
41944
|
+
LEADERBOARD_GRID_CLASS,
|
|
41945
|
+
"items-center border-b border-agg-separator px-4 py-3 last:border-b-0 sm:min-h-16 sm:px-5"
|
|
41946
|
+
),
|
|
41947
|
+
children: [
|
|
41948
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "size-7 rounded-agg-full bg-agg-secondary-hover/80" }),
|
|
41949
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
41950
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "size-10 rounded-agg-full bg-agg-secondary-hover/80" }),
|
|
41951
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsxs)("div", { className: "flex flex-1 flex-col gap-2", children: [
|
|
41952
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "h-3 w-2/5 rounded-agg-sm bg-agg-secondary-hover/80" }),
|
|
41953
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "h-3 w-1/5 rounded-agg-sm bg-agg-secondary-hover/80" })
|
|
41954
|
+
] })
|
|
41955
|
+
] }),
|
|
41956
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "hidden h-3 w-10 justify-self-end rounded-agg-sm bg-agg-secondary-hover/80 sm:block" }),
|
|
41957
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "hidden h-3 w-16 justify-self-end rounded-agg-sm bg-agg-secondary-hover/80 sm:block" }),
|
|
41958
|
+
/* @__PURE__ */ (0, import_jsx_runtime211.jsx)("span", { className: "hidden h-3 w-14 justify-self-end rounded-agg-sm bg-agg-secondary-hover/80 sm:block" })
|
|
41959
|
+
]
|
|
41960
|
+
},
|
|
41961
|
+
i
|
|
41962
|
+
)) });
|
|
41963
|
+
}
|
|
41964
|
+
|
|
41965
|
+
// src/pages/leaderboard/components/segmented-control.tsx
|
|
41966
|
+
init_utils();
|
|
41967
|
+
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
41968
|
+
function SegmentedControl({
|
|
41969
|
+
label: label2,
|
|
41970
|
+
value,
|
|
41971
|
+
onChange,
|
|
41972
|
+
items,
|
|
41973
|
+
className,
|
|
41974
|
+
itemClassName
|
|
41975
|
+
}) {
|
|
41976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
|
|
41977
|
+
"div",
|
|
41978
|
+
{
|
|
41979
|
+
role: "group",
|
|
41980
|
+
"aria-label": label2,
|
|
41981
|
+
className: cn(
|
|
41982
|
+
"agg-segmented flex h-10 w-full items-stretch overflow-clip rounded-agg-sm border border-agg-separator sm:w-auto",
|
|
41983
|
+
className
|
|
41984
|
+
),
|
|
41985
|
+
children: items.map((item, idx) => {
|
|
41986
|
+
const isActive = item.value === value;
|
|
41987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)("div", { className: "flex flex-1 items-stretch sm:flex-none", children: [
|
|
41988
|
+
idx > 0 ? /* @__PURE__ */ (0, import_jsx_runtime212.jsx)("div", { className: "w-px bg-agg-separator", "aria-hidden": true }) : null,
|
|
41989
|
+
/* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
|
|
41990
|
+
"button",
|
|
41991
|
+
{
|
|
41992
|
+
type: "button",
|
|
41993
|
+
"aria-pressed": isActive,
|
|
41994
|
+
onClick: () => onChange(item.value),
|
|
41995
|
+
className: cn(
|
|
41996
|
+
"agg-segmented-trigger flex flex-1 cursor-pointer items-center justify-center px-3 font-agg-sans text-agg-sm leading-agg-5 whitespace-nowrap outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-agg-primary-hover sm:px-4",
|
|
41997
|
+
isActive ? "bg-agg-secondary-hover font-agg-bold text-agg-foreground" : "bg-agg-secondary font-agg-normal text-agg-muted-foreground hover:bg-agg-secondary-hover hover:text-agg-foreground",
|
|
41998
|
+
itemClassName
|
|
41999
|
+
),
|
|
42000
|
+
children: item.label
|
|
42001
|
+
}
|
|
42002
|
+
)
|
|
42003
|
+
] }, item.value);
|
|
42004
|
+
})
|
|
42005
|
+
}
|
|
42006
|
+
);
|
|
42007
|
+
}
|
|
42008
|
+
|
|
42009
|
+
// src/pages/leaderboard/index.tsx
|
|
42010
|
+
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
42011
|
+
function LeaderboardPage(props) {
|
|
42012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(AggErrorBoundary, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(LeaderboardPageInner, __spreadValues({}, props)) });
|
|
42013
|
+
}
|
|
42014
|
+
function LeaderboardPageInner({
|
|
42015
|
+
rows: rowsProp,
|
|
42016
|
+
isLoading: isLoadingProp,
|
|
42017
|
+
error: errorProp,
|
|
42018
|
+
hasNextPage: hasNextPageProp,
|
|
42019
|
+
isLoadingMore: isLoadingMoreProp,
|
|
42020
|
+
onLoadMore: onLoadMoreProp,
|
|
42021
|
+
period: periodProp,
|
|
42022
|
+
onPeriodChange,
|
|
42023
|
+
metric: metricProp,
|
|
42024
|
+
onMetricChange,
|
|
42025
|
+
currentUserId: currentUserIdProp,
|
|
42026
|
+
appName,
|
|
42027
|
+
className,
|
|
42028
|
+
classNames
|
|
42029
|
+
}) {
|
|
42030
|
+
const allLabels = (0, import_hooks105.useLabels)();
|
|
42031
|
+
const labels = allLabels.leaderboard;
|
|
42032
|
+
const { user } = (0, import_hooks105.useAggAuthState)();
|
|
42033
|
+
const [periodState, setPeriodState] = (0, import_react69.useState)(LEADERBOARD_DEFAULT_PERIOD);
|
|
42034
|
+
const [metricState, setMetricState] = (0, import_react69.useState)(LEADERBOARD_DEFAULT_METRIC);
|
|
42035
|
+
const period = periodProp != null ? periodProp : periodState;
|
|
42036
|
+
const metric = metricProp != null ? metricProp : metricState;
|
|
42037
|
+
const handlePeriodChange = (0, import_react69.useCallback)(
|
|
42038
|
+
(next) => {
|
|
42039
|
+
if (periodProp === void 0) setPeriodState(next);
|
|
42040
|
+
onPeriodChange == null ? void 0 : onPeriodChange(next);
|
|
42041
|
+
},
|
|
42042
|
+
[onPeriodChange, periodProp]
|
|
42043
|
+
);
|
|
42044
|
+
const handleMetricChange = (0, import_react69.useCallback)(
|
|
42045
|
+
(next) => {
|
|
42046
|
+
if (metricProp === void 0) setMetricState(next);
|
|
42047
|
+
onMetricChange == null ? void 0 : onMetricChange(next);
|
|
42048
|
+
},
|
|
42049
|
+
[metricProp, onMetricChange]
|
|
42050
|
+
);
|
|
42051
|
+
const shouldUseHookData = !rowsProp;
|
|
42052
|
+
const query = (0, import_hooks105.useLeaderboard)({ period, metric, enabled: shouldUseHookData });
|
|
42053
|
+
const rows = rowsProp != null ? rowsProp : query.rows;
|
|
42054
|
+
const isLoading = isLoadingProp != null ? isLoadingProp : shouldUseHookData && query.isLoading;
|
|
42055
|
+
const error = errorProp != null ? errorProp : shouldUseHookData ? query.error : null;
|
|
42056
|
+
const hasNextPage = hasNextPageProp != null ? hasNextPageProp : shouldUseHookData && query.hasNextPage;
|
|
42057
|
+
const isLoadingMore = isLoadingMoreProp != null ? isLoadingMoreProp : shouldUseHookData && query.isFetchingNextPage;
|
|
42058
|
+
const fetchNextPage = query.fetchNextPage;
|
|
42059
|
+
const onLoadMore = (0, import_react69.useMemo)(
|
|
42060
|
+
() => onLoadMoreProp != null ? onLoadMoreProp : shouldUseHookData ? () => void fetchNextPage() : void 0,
|
|
42061
|
+
[onLoadMoreProp, shouldUseHookData, fetchNextPage]
|
|
42062
|
+
);
|
|
42063
|
+
const retry = shouldUseHookData ? () => void query.refetch() : void 0;
|
|
42064
|
+
const currentUserId = currentUserIdProp != null ? currentUserIdProp : user == null ? void 0 : user.id;
|
|
42065
|
+
const [sentinel, setSentinel] = (0, import_react69.useState)(null);
|
|
42066
|
+
(0, import_react69.useEffect)(() => {
|
|
42067
|
+
const target = sentinel;
|
|
42068
|
+
if (!target || !hasNextPage || !onLoadMore || typeof IntersectionObserver === "undefined")
|
|
42069
|
+
return;
|
|
42070
|
+
const observer = new IntersectionObserver(
|
|
42071
|
+
(entries) => {
|
|
42072
|
+
var _a;
|
|
42073
|
+
if (!((_a = entries[0]) == null ? void 0 : _a.isIntersecting) || isLoading || isLoadingMore) return;
|
|
42074
|
+
onLoadMore();
|
|
42075
|
+
},
|
|
42076
|
+
{ rootMargin: "60px 0px" }
|
|
42077
|
+
);
|
|
42078
|
+
observer.observe(target);
|
|
42079
|
+
return () => observer.disconnect();
|
|
42080
|
+
}, [sentinel, hasNextPage, isLoading, isLoadingMore, onLoadMore]);
|
|
42081
|
+
const hasRows = rows.length > 0;
|
|
42082
|
+
const showInlineError = Boolean(error) && hasRows;
|
|
42083
|
+
const periodItems = import_hooks105.LEADERBOARD_PERIODS.map((value) => ({ value, label: labels.periods[value] }));
|
|
42084
|
+
const metricItems = LEADERBOARD_METRICS.map((value) => ({ value, label: labels.metrics[value] }));
|
|
42085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(
|
|
42086
|
+
"div",
|
|
42087
|
+
{
|
|
42088
|
+
className: cn(
|
|
42089
|
+
"agg-leaderboard mx-auto flex w-full max-w-[960px] flex-col px-4 py-6 sm:px-6 gap-5 font-agg-sans text-agg-foreground",
|
|
42090
|
+
className,
|
|
42091
|
+
classNames == null ? void 0 : classNames.root
|
|
42092
|
+
),
|
|
42093
|
+
children: [
|
|
42094
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)("header", { className: cn("agg-leaderboard-title flex flex-col gap-1", classNames == null ? void 0 : classNames.header), children: [
|
|
42095
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("h1", { className: "agg-type-heading m-0", children: labels.title }),
|
|
42096
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("p", { className: "m-0 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: labels.subtitle(appName, labels.periods[period]) })
|
|
42097
|
+
] }),
|
|
42098
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(
|
|
42099
|
+
"div",
|
|
42100
|
+
{
|
|
42101
|
+
className: cn(
|
|
42102
|
+
"agg-leaderboard-toolbar flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",
|
|
42103
|
+
classNames == null ? void 0 : classNames.toolbar
|
|
42104
|
+
),
|
|
42105
|
+
children: [
|
|
42106
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3", children: [
|
|
42107
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("span", { className: "agg-type-caption uppercase tracking-wide text-agg-muted-foreground", children: labels.periodLabel }),
|
|
42108
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42109
|
+
SegmentedControl,
|
|
42110
|
+
{
|
|
42111
|
+
label: labels.periodLabel,
|
|
42112
|
+
value: period,
|
|
42113
|
+
onChange: handlePeriodChange,
|
|
42114
|
+
items: periodItems
|
|
42115
|
+
}
|
|
42116
|
+
)
|
|
42117
|
+
] }),
|
|
42118
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3", children: [
|
|
42119
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("span", { className: "agg-type-caption uppercase tracking-wide text-agg-muted-foreground", children: labels.rankByLabel }),
|
|
42120
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42121
|
+
SegmentedControl,
|
|
42122
|
+
{
|
|
42123
|
+
label: labels.rankByLabel,
|
|
42124
|
+
value: metric,
|
|
42125
|
+
onChange: handleMetricChange,
|
|
42126
|
+
items: metricItems
|
|
42127
|
+
}
|
|
42128
|
+
)
|
|
42129
|
+
] })
|
|
42130
|
+
]
|
|
42131
|
+
}
|
|
42132
|
+
),
|
|
42133
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(
|
|
42134
|
+
"section",
|
|
42135
|
+
{
|
|
42136
|
+
"aria-label": labels.title,
|
|
42137
|
+
className: cn(
|
|
42138
|
+
"agg-leaderboard-list overflow-clip rounded-agg-xl border border-agg-separator bg-agg-secondary shadow-agg-card",
|
|
42139
|
+
classNames == null ? void 0 : classNames.list
|
|
42140
|
+
),
|
|
42141
|
+
children: [
|
|
42142
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsxs)("div", { role: "table", "aria-label": labels.title, className: "agg-leaderboard-table", children: [
|
|
42143
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(LeaderboardHeaderRow, { metric, onMetricChange: handleMetricChange }),
|
|
42144
|
+
!isLoading && hasRows ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { className: "divide-y divide-agg-separator", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42145
|
+
LeaderboardRowView,
|
|
42146
|
+
{
|
|
42147
|
+
row,
|
|
42148
|
+
isCurrentUser: currentUserId !== void 0 && row.userId === currentUserId,
|
|
42149
|
+
className: classNames == null ? void 0 : classNames.row
|
|
42150
|
+
},
|
|
42151
|
+
row.userId
|
|
42152
|
+
)) }) : null
|
|
42153
|
+
] }),
|
|
42154
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(LeaderboardSkeleton, {}) : error && !hasRows ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { className: "py-10", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42155
|
+
StateMessage,
|
|
42156
|
+
{
|
|
42157
|
+
title: labels.errorTitle,
|
|
42158
|
+
description: labels.errorDescription,
|
|
42159
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(Icon, { name: "warning" }),
|
|
42160
|
+
onAction: retry
|
|
42161
|
+
}
|
|
42162
|
+
) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)("div", { className: "py-10", children: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42163
|
+
StateMessage,
|
|
42164
|
+
{
|
|
42165
|
+
title: labels.emptyTitle,
|
|
42166
|
+
description: labels.emptyDescription,
|
|
42167
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(Icon, { name: "search-empty" })
|
|
42168
|
+
}
|
|
42169
|
+
) }) : null,
|
|
42170
|
+
(hasNextPage || showInlineError) && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42171
|
+
"div",
|
|
42172
|
+
{
|
|
42173
|
+
className: cn(
|
|
42174
|
+
"agg-leaderboard-footer relative flex items-center justify-center gap-3 border-t border-agg-separator p-3.5",
|
|
42175
|
+
classNames == null ? void 0 : classNames.footer
|
|
42176
|
+
),
|
|
42177
|
+
children: showInlineError ? /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(import_jsx_runtime213.Fragment, { children: [
|
|
42178
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("span", { role: "alert", className: "text-agg-sm leading-agg-5 text-agg-error", children: labels.errorTitle }),
|
|
42179
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(Button, { variant: "tertiary", size: "small", onClick: retry != null ? retry : onLoadMore, children: allLabels.common.retry })
|
|
42180
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(import_jsx_runtime213.Fragment, { children: [
|
|
42181
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42182
|
+
"div",
|
|
42183
|
+
{
|
|
42184
|
+
ref: setSentinel,
|
|
42185
|
+
className: "agg-leaderboard-sentinel absolute inset-x-0 top-0 h-px",
|
|
42186
|
+
"aria-hidden": true
|
|
42187
|
+
}
|
|
42188
|
+
),
|
|
42189
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
|
|
42190
|
+
Button,
|
|
42191
|
+
{
|
|
42192
|
+
variant: "tertiary",
|
|
42193
|
+
size: "small",
|
|
42194
|
+
onClick: onLoadMore,
|
|
42195
|
+
disabled: isLoadingMore,
|
|
42196
|
+
isLoading: isLoadingMore,
|
|
42197
|
+
"aria-label": labels.showMore,
|
|
42198
|
+
children: labels.showMore
|
|
42199
|
+
}
|
|
42200
|
+
)
|
|
42201
|
+
] })
|
|
42202
|
+
}
|
|
42203
|
+
) : null
|
|
42204
|
+
]
|
|
42205
|
+
}
|
|
42206
|
+
),
|
|
42207
|
+
/* @__PURE__ */ (0, import_jsx_runtime213.jsx)("p", { className: "m-0 text-agg-xs leading-agg-4 text-agg-muted-foreground", children: labels.pnlFootnote })
|
|
42208
|
+
]
|
|
42209
|
+
}
|
|
42210
|
+
);
|
|
42211
|
+
}
|
|
42212
|
+
LeaderboardPage.displayName = "LeaderboardPage";
|
|
42213
|
+
|
|
41751
42214
|
// src/deposit/index.tsx
|
|
41752
|
-
var
|
|
42215
|
+
var import_hooks116 = require("@agg-build/hooks");
|
|
41753
42216
|
var import_deposit = require("@agg-build/hooks/deposit");
|
|
41754
|
-
var
|
|
42217
|
+
var import_react72 = require("react");
|
|
41755
42218
|
init_modal();
|
|
41756
42219
|
init_deposit_notification_events();
|
|
41757
42220
|
|
|
@@ -41984,14 +42447,14 @@ var NETWORK_TO_CURRENCY_CODE = {
|
|
|
41984
42447
|
};
|
|
41985
42448
|
|
|
41986
42449
|
// src/deposit/steps/card-deposit.tsx
|
|
41987
|
-
var
|
|
41988
|
-
var
|
|
42450
|
+
var import_hooks106 = require("@agg-build/hooks");
|
|
42451
|
+
var import_react70 = require("react");
|
|
41989
42452
|
init_utils();
|
|
41990
42453
|
init_modal();
|
|
41991
42454
|
init_button();
|
|
41992
42455
|
init_select();
|
|
41993
42456
|
init_icon();
|
|
41994
|
-
var
|
|
42457
|
+
var import_jsx_runtime214 = require("react/jsx-runtime");
|
|
41995
42458
|
var CardDepositStep = ({
|
|
41996
42459
|
amount: amount2,
|
|
41997
42460
|
currency,
|
|
@@ -42007,9 +42470,9 @@ var CardDepositStep = ({
|
|
|
42007
42470
|
onNetworkChange,
|
|
42008
42471
|
onContinue
|
|
42009
42472
|
}) => {
|
|
42010
|
-
const labels = (0,
|
|
42011
|
-
const [localAmount, setLocalAmount] = (0,
|
|
42012
|
-
(0,
|
|
42473
|
+
const labels = (0, import_hooks106.useLabels)();
|
|
42474
|
+
const [localAmount, setLocalAmount] = (0, import_react70.useState)(amount2);
|
|
42475
|
+
(0, import_react70.useEffect)(() => {
|
|
42013
42476
|
setLocalAmount(amount2);
|
|
42014
42477
|
}, [amount2]);
|
|
42015
42478
|
const numericAmount = Number(localAmount) || 0;
|
|
@@ -42017,33 +42480,33 @@ var CardDepositStep = ({
|
|
|
42017
42480
|
const isBelowMin = minAmount != null && hasInput && numericAmount < minAmount;
|
|
42018
42481
|
const isValid = numericAmount > 0 && !isBelowMin;
|
|
42019
42482
|
const formattedMin = minAmount != null ? `$${minAmount}` : void 0;
|
|
42020
|
-
return /* @__PURE__ */ (0,
|
|
42021
|
-
/* @__PURE__ */ (0,
|
|
42483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_jsx_runtime214.Fragment, { children: [
|
|
42484
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42022
42485
|
Modal.Header,
|
|
42023
42486
|
{
|
|
42024
42487
|
title: labels.deposit.cardFlow.title,
|
|
42025
42488
|
hideBorder: true,
|
|
42026
|
-
leftElement: /* @__PURE__ */ (0,
|
|
42489
|
+
leftElement: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42027
42490
|
"button",
|
|
42028
42491
|
{
|
|
42029
42492
|
type: "button",
|
|
42030
42493
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
42031
42494
|
onClick: onBack,
|
|
42032
42495
|
"aria-label": "Go back",
|
|
42033
|
-
children: /* @__PURE__ */ (0,
|
|
42496
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
42034
42497
|
}
|
|
42035
42498
|
)
|
|
42036
42499
|
}
|
|
42037
42500
|
),
|
|
42038
|
-
/* @__PURE__ */ (0,
|
|
42039
|
-
/* @__PURE__ */ (0,
|
|
42040
|
-
/* @__PURE__ */ (0,
|
|
42041
|
-
/* @__PURE__ */ (0,
|
|
42042
|
-
/* @__PURE__ */ (0,
|
|
42043
|
-
formattedMin ? /* @__PURE__ */ (0,
|
|
42501
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
42502
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
42503
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex-1 flex flex-col gap-2", children: [
|
|
42504
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
42505
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.amountLabel }),
|
|
42506
|
+
formattedMin ? /* @__PURE__ */ (0, import_jsx_runtime214.jsx)("p", { className: "agg-type-label text-agg-foreground", children: labels.deposit.cardFlow.minRequired(formattedMin) }) : null
|
|
42044
42507
|
] }),
|
|
42045
|
-
/* @__PURE__ */ (0,
|
|
42046
|
-
/* @__PURE__ */ (0,
|
|
42508
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex gap-3 items-center", children: [
|
|
42509
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
|
|
42047
42510
|
"div",
|
|
42048
42511
|
{
|
|
42049
42512
|
className: cn(
|
|
@@ -42051,7 +42514,7 @@ var CardDepositStep = ({
|
|
|
42051
42514
|
isBelowMin ? "border-agg-primary border-2" : "border-agg-separator"
|
|
42052
42515
|
),
|
|
42053
42516
|
children: [
|
|
42054
|
-
/* @__PURE__ */ (0,
|
|
42517
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42055
42518
|
"input",
|
|
42056
42519
|
{
|
|
42057
42520
|
type: "text",
|
|
@@ -42067,11 +42530,11 @@ var CardDepositStep = ({
|
|
|
42067
42530
|
}
|
|
42068
42531
|
}
|
|
42069
42532
|
),
|
|
42070
|
-
/* @__PURE__ */ (0,
|
|
42533
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)("span", { className: "agg-type-body text-agg-muted-foreground", children: "$" })
|
|
42071
42534
|
]
|
|
42072
42535
|
}
|
|
42073
42536
|
),
|
|
42074
|
-
/* @__PURE__ */ (0,
|
|
42537
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)("div", { className: "w-[100px]", children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42075
42538
|
Select,
|
|
42076
42539
|
{
|
|
42077
42540
|
items: [{ value: currency, label: currency }],
|
|
@@ -42083,8 +42546,8 @@ var CardDepositStep = ({
|
|
|
42083
42546
|
) })
|
|
42084
42547
|
] })
|
|
42085
42548
|
] }),
|
|
42086
|
-
isBelowMin && formattedMin ? /* @__PURE__ */ (0,
|
|
42087
|
-
/* @__PURE__ */ (0,
|
|
42549
|
+
isBelowMin && formattedMin ? /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex items-center gap-2", role: "alert", "aria-live": "assertive", children: [
|
|
42550
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42088
42551
|
Icon,
|
|
42089
42552
|
{
|
|
42090
42553
|
name: "warning",
|
|
@@ -42092,12 +42555,12 @@ var CardDepositStep = ({
|
|
|
42092
42555
|
"aria-hidden": "true"
|
|
42093
42556
|
}
|
|
42094
42557
|
),
|
|
42095
|
-
/* @__PURE__ */ (0,
|
|
42558
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)("p", { className: "agg-type-label text-agg-error", children: labels.deposit.cardFlow.minAmountError(formattedMin) })
|
|
42096
42559
|
] }) : null
|
|
42097
42560
|
] }),
|
|
42098
|
-
/* @__PURE__ */ (0,
|
|
42099
|
-
/* @__PURE__ */ (0,
|
|
42100
|
-
/* @__PURE__ */ (0,
|
|
42561
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
42562
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.cardFlow.networkLabel }),
|
|
42563
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42101
42564
|
Select,
|
|
42102
42565
|
{
|
|
42103
42566
|
items: networkOptions,
|
|
@@ -42108,7 +42571,7 @@ var CardDepositStep = ({
|
|
|
42108
42571
|
}
|
|
42109
42572
|
)
|
|
42110
42573
|
] }),
|
|
42111
|
-
/* @__PURE__ */ (0,
|
|
42574
|
+
/* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
|
|
42112
42575
|
Button,
|
|
42113
42576
|
{
|
|
42114
42577
|
variant: "secondary",
|
|
@@ -42124,12 +42587,12 @@ var CardDepositStep = ({
|
|
|
42124
42587
|
};
|
|
42125
42588
|
|
|
42126
42589
|
// src/deposit/steps/card-payment-pending.tsx
|
|
42127
|
-
var
|
|
42590
|
+
var import_hooks107 = require("@agg-build/hooks");
|
|
42128
42591
|
init_modal();
|
|
42129
42592
|
init_button();
|
|
42130
42593
|
init_copy_button();
|
|
42131
42594
|
init_icon();
|
|
42132
|
-
var
|
|
42595
|
+
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
42133
42596
|
var CardPaymentPendingStep = ({
|
|
42134
42597
|
providerName,
|
|
42135
42598
|
walletAddress,
|
|
@@ -42137,29 +42600,29 @@ var CardPaymentPendingStep = ({
|
|
|
42137
42600
|
onViewActivity,
|
|
42138
42601
|
onChooseAnotherProvider
|
|
42139
42602
|
}) => {
|
|
42140
|
-
const labels = (0,
|
|
42141
|
-
return /* @__PURE__ */ (0,
|
|
42142
|
-
/* @__PURE__ */ (0,
|
|
42603
|
+
const labels = (0, import_hooks107.useLabels)();
|
|
42604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
42605
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
|
|
42143
42606
|
"button",
|
|
42144
42607
|
{
|
|
42145
42608
|
type: "button",
|
|
42146
42609
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors cursor-pointer hover:text-agg-foreground/80",
|
|
42147
42610
|
onClick: onClose,
|
|
42148
42611
|
"aria-label": labels.common.close,
|
|
42149
|
-
children: /* @__PURE__ */ (0,
|
|
42612
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
42150
42613
|
}
|
|
42151
42614
|
),
|
|
42152
|
-
/* @__PURE__ */ (0,
|
|
42153
|
-
/* @__PURE__ */ (0,
|
|
42154
|
-
/* @__PURE__ */ (0,
|
|
42155
|
-
/* @__PURE__ */ (0,
|
|
42156
|
-
/* @__PURE__ */ (0,
|
|
42615
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
42616
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(ExternalLinkIcon, { className: "h-[60px] w-[60px]" }) }),
|
|
42617
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
42618
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.pendingTitle(providerName) }),
|
|
42619
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.pendingDescription })
|
|
42157
42620
|
] }),
|
|
42158
|
-
walletAddress ? /* @__PURE__ */ (0,
|
|
42159
|
-
/* @__PURE__ */ (0,
|
|
42160
|
-
/* @__PURE__ */ (0,
|
|
42161
|
-
/* @__PURE__ */ (0,
|
|
42162
|
-
/* @__PURE__ */ (0,
|
|
42621
|
+
walletAddress ? /* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex w-full flex-col items-center gap-3 rounded-agg-md bg-agg-secondary-hover p-5", children: [
|
|
42622
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "agg-type-label text-agg-foreground w-full", children: labels.deposit.cardFlow.pendingWalletAddressHelp }),
|
|
42623
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex w-full h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 py-[10px]", children: [
|
|
42624
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: walletAddress }),
|
|
42625
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
|
|
42163
42626
|
CopyButton,
|
|
42164
42627
|
{
|
|
42165
42628
|
value: walletAddress,
|
|
@@ -42169,11 +42632,11 @@ var CardPaymentPendingStep = ({
|
|
|
42169
42632
|
)
|
|
42170
42633
|
] })
|
|
42171
42634
|
] }) : null,
|
|
42172
|
-
/* @__PURE__ */ (0,
|
|
42173
|
-
/* @__PURE__ */ (0,
|
|
42174
|
-
/* @__PURE__ */ (0,
|
|
42635
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsxs)("div", { className: "flex items-start justify-center gap-3", children: [
|
|
42636
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: labels.common.close }),
|
|
42637
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)(Button, { variant: "primary", size: "large", onClick: onViewActivity, children: labels.deposit.cardFlow.viewActivity })
|
|
42175
42638
|
] }),
|
|
42176
|
-
/* @__PURE__ */ (0,
|
|
42639
|
+
/* @__PURE__ */ (0, import_jsx_runtime215.jsx)(
|
|
42177
42640
|
"button",
|
|
42178
42641
|
{
|
|
42179
42642
|
type: "button",
|
|
@@ -42187,26 +42650,26 @@ var CardPaymentPendingStep = ({
|
|
|
42187
42650
|
};
|
|
42188
42651
|
|
|
42189
42652
|
// src/deposit/steps/card-provider.tsx
|
|
42190
|
-
var
|
|
42653
|
+
var import_hooks108 = require("@agg-build/hooks");
|
|
42191
42654
|
init_modal();
|
|
42192
42655
|
init_button();
|
|
42193
42656
|
init_loading_icon();
|
|
42194
42657
|
init_icon();
|
|
42195
42658
|
init_usdc();
|
|
42196
|
-
var
|
|
42659
|
+
var import_jsx_runtime216 = require("react/jsx-runtime");
|
|
42197
42660
|
var CardProviderItem = ({ provider, onSelect }) => {
|
|
42198
|
-
const labels = (0,
|
|
42661
|
+
const labels = (0, import_hooks108.useLabels)();
|
|
42199
42662
|
const badgeText = provider.badge === "best" ? labels.deposit.cardFlow.providerBadges.best : provider.badge === "low-kyc" ? labels.deposit.cardFlow.providerBadges.lowKyc : void 0;
|
|
42200
|
-
return /* @__PURE__ */ (0,
|
|
42663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42201
42664
|
"button",
|
|
42202
42665
|
{
|
|
42203
42666
|
type: "button",
|
|
42204
42667
|
className: "w-full rounded-xl border border-agg-separator px-4 py-3 text-left bg-agg-secondary hover:bg-agg-secondary-hover transition-colors cursor-pointer",
|
|
42205
42668
|
onClick: () => onSelect(provider.id),
|
|
42206
|
-
children: /* @__PURE__ */ (0,
|
|
42207
|
-
/* @__PURE__ */ (0,
|
|
42208
|
-
/* @__PURE__ */ (0,
|
|
42209
|
-
badgeText ? /* @__PURE__ */ (0,
|
|
42669
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
42670
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
42671
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: provider.name }),
|
|
42672
|
+
badgeText ? /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42210
42673
|
"span",
|
|
42211
42674
|
{
|
|
42212
42675
|
className: `rounded border px-2 py-[2px] text-[10px] leading-[14px] font-agg-bold uppercase ${provider.badge === "best" ? "border-agg-primary/50 text-agg-primary bg-agg-secondary" : "border-agg-separator text-agg-foreground bg-agg-secondary"}`,
|
|
@@ -42214,16 +42677,16 @@ var CardProviderItem = ({ provider, onSelect }) => {
|
|
|
42214
42677
|
}
|
|
42215
42678
|
) : null
|
|
42216
42679
|
] }),
|
|
42217
|
-
/* @__PURE__ */ (0,
|
|
42218
|
-
/* @__PURE__ */ (0,
|
|
42219
|
-
/* @__PURE__ */ (0,
|
|
42220
|
-
/* @__PURE__ */ (0,
|
|
42680
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
42681
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "text-right", children: [
|
|
42682
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "agg-type-body text-agg-foreground", children: provider.quote }),
|
|
42683
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
42221
42684
|
labels.deposit.cardFlow.feeLabel,
|
|
42222
42685
|
" ",
|
|
42223
42686
|
provider.fee
|
|
42224
42687
|
] })
|
|
42225
42688
|
] }),
|
|
42226
|
-
/* @__PURE__ */ (0,
|
|
42689
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ChevronRightIcon, { className: "h-5 w-5 text-agg-muted-foreground" })
|
|
42227
42690
|
] })
|
|
42228
42691
|
] })
|
|
42229
42692
|
}
|
|
@@ -42241,41 +42704,41 @@ var CardProviderStep = ({
|
|
|
42241
42704
|
onSelectProvider,
|
|
42242
42705
|
onRetry
|
|
42243
42706
|
}) => {
|
|
42244
|
-
const labels = (0,
|
|
42245
|
-
return /* @__PURE__ */ (0,
|
|
42246
|
-
/* @__PURE__ */ (0,
|
|
42707
|
+
const labels = (0, import_hooks108.useLabels)();
|
|
42708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)(import_jsx_runtime216.Fragment, { children: [
|
|
42709
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42247
42710
|
Modal.Header,
|
|
42248
42711
|
{
|
|
42249
42712
|
title: labels.deposit.cardFlow.selectProviderTitle,
|
|
42250
42713
|
hideBorder: true,
|
|
42251
|
-
leftElement: /* @__PURE__ */ (0,
|
|
42714
|
+
leftElement: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42252
42715
|
"button",
|
|
42253
42716
|
{
|
|
42254
42717
|
type: "button",
|
|
42255
42718
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
42256
42719
|
onClick: onBack,
|
|
42257
42720
|
"aria-label": labels.deposit.back,
|
|
42258
|
-
children: /* @__PURE__ */ (0,
|
|
42721
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
42259
42722
|
}
|
|
42260
42723
|
)
|
|
42261
42724
|
}
|
|
42262
42725
|
),
|
|
42263
|
-
/* @__PURE__ */ (0,
|
|
42264
|
-
/* @__PURE__ */ (0,
|
|
42265
|
-
/* @__PURE__ */ (0,
|
|
42266
|
-
/* @__PURE__ */ (0,
|
|
42267
|
-
/* @__PURE__ */ (0,
|
|
42726
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
42727
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
42728
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(UsdcIcon, { className: "h-4 w-4 shrink-0" }),
|
|
42729
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("span", { className: "agg-type-body font-agg-bold text-agg-foreground", children: token }),
|
|
42730
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("span", { className: "agg-type-body text-agg-foreground", children: [
|
|
42268
42731
|
"$",
|
|
42269
42732
|
amount2,
|
|
42270
42733
|
" ",
|
|
42271
42734
|
currency
|
|
42272
42735
|
] })
|
|
42273
42736
|
] }),
|
|
42274
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
42275
|
-
/* @__PURE__ */ (0,
|
|
42276
|
-
/* @__PURE__ */ (0,
|
|
42277
|
-
] }) : error ? /* @__PURE__ */ (0,
|
|
42278
|
-
/* @__PURE__ */ (0,
|
|
42737
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-3", children: [
|
|
42738
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(LoadingIcon, { variant: "prominent" }),
|
|
42739
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.loadingQuotes })
|
|
42740
|
+
] }) : error ? /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex min-h-[200px] flex-col items-center justify-center gap-6 px-2 text-center", children: [
|
|
42741
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42279
42742
|
Icon,
|
|
42280
42743
|
{
|
|
42281
42744
|
name: "quotes-warning",
|
|
@@ -42284,13 +42747,13 @@ var CardProviderStep = ({
|
|
|
42284
42747
|
color: "currentColor"
|
|
42285
42748
|
}
|
|
42286
42749
|
),
|
|
42287
|
-
/* @__PURE__ */ (0,
|
|
42288
|
-
/* @__PURE__ */ (0,
|
|
42289
|
-
/* @__PURE__ */ (0,
|
|
42750
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex max-w-[320px] flex-col gap-2", children: [
|
|
42751
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesTitle }),
|
|
42752
|
+
/* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.errorLoadingQuotesDescription })
|
|
42290
42753
|
] }),
|
|
42291
|
-
onRetry ? /* @__PURE__ */ (0,
|
|
42292
|
-
] }) : providers.length === 0 ? /* @__PURE__ */ (0,
|
|
42293
|
-
providers.map((provider) => /* @__PURE__ */ (0,
|
|
42754
|
+
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(Button, { variant: "secondary", size: "medium", onClick: onRetry, children: labels.deposit.cardFlow.retry }) : null
|
|
42755
|
+
] }) : providers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("div", { className: "flex min-h-[200px] items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "agg-type-body text-agg-muted-foreground", children: labels.deposit.cardFlow.noQuotes }) }) : /* @__PURE__ */ (0, import_jsx_runtime216.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
42756
|
+
providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(
|
|
42294
42757
|
CardProviderItem,
|
|
42295
42758
|
{
|
|
42296
42759
|
provider,
|
|
@@ -42298,63 +42761,63 @@ var CardProviderStep = ({
|
|
|
42298
42761
|
},
|
|
42299
42762
|
provider.id
|
|
42300
42763
|
)),
|
|
42301
|
-
sessionError ? /* @__PURE__ */ (0,
|
|
42764
|
+
sessionError ? /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("p", { className: "agg-type-label text-agg-error text-center", children: sessionError }) : null
|
|
42302
42765
|
] })
|
|
42303
42766
|
] }) })
|
|
42304
42767
|
] });
|
|
42305
42768
|
};
|
|
42306
42769
|
|
|
42307
42770
|
// src/deposit/steps/card-purchase-success.tsx
|
|
42308
|
-
var
|
|
42771
|
+
var import_hooks109 = require("@agg-build/hooks");
|
|
42309
42772
|
init_modal();
|
|
42310
42773
|
init_button();
|
|
42311
42774
|
init_icon();
|
|
42312
|
-
var
|
|
42313
|
-
var SummaryRow = ({ label: label2, value }) => /* @__PURE__ */ (0,
|
|
42314
|
-
/* @__PURE__ */ (0,
|
|
42315
|
-
/* @__PURE__ */ (0,
|
|
42775
|
+
var import_jsx_runtime217 = require("react/jsx-runtime");
|
|
42776
|
+
var SummaryRow = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
42777
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
|
|
42778
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
42316
42779
|
] });
|
|
42317
42780
|
var CardPurchaseSuccessStep = ({
|
|
42318
42781
|
summary,
|
|
42319
42782
|
onDone,
|
|
42320
42783
|
onClose
|
|
42321
42784
|
}) => {
|
|
42322
|
-
const labels = (0,
|
|
42323
|
-
return /* @__PURE__ */ (0,
|
|
42324
|
-
/* @__PURE__ */ (0,
|
|
42785
|
+
const labels = (0, import_hooks109.useLabels)();
|
|
42786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime217.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
42787
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
|
|
42325
42788
|
"button",
|
|
42326
42789
|
{
|
|
42327
42790
|
type: "button",
|
|
42328
42791
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
42329
42792
|
onClick: onClose,
|
|
42330
42793
|
"aria-label": labels.common.close,
|
|
42331
|
-
children: /* @__PURE__ */ (0,
|
|
42794
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
42332
42795
|
}
|
|
42333
42796
|
),
|
|
42334
|
-
/* @__PURE__ */ (0,
|
|
42335
|
-
/* @__PURE__ */ (0,
|
|
42336
|
-
/* @__PURE__ */ (0,
|
|
42337
|
-
/* @__PURE__ */ (0,
|
|
42338
|
-
/* @__PURE__ */ (0,
|
|
42797
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
42798
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
42799
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
42800
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.cardFlow.successTitle }),
|
|
42801
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.cardFlow.successDescription })
|
|
42339
42802
|
] }),
|
|
42340
|
-
/* @__PURE__ */ (0,
|
|
42341
|
-
/* @__PURE__ */ (0,
|
|
42803
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsxs)("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
42804
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)(
|
|
42342
42805
|
SummaryRow,
|
|
42343
42806
|
{
|
|
42344
42807
|
label: labels.deposit.summary.amountReceived,
|
|
42345
42808
|
value: summary.amountReceived
|
|
42346
42809
|
}
|
|
42347
42810
|
),
|
|
42348
|
-
/* @__PURE__ */ (0,
|
|
42349
|
-
/* @__PURE__ */ (0,
|
|
42811
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)(SummaryRow, { label: labels.deposit.summary.network, value: summary.network }),
|
|
42812
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)(SummaryRow, { label: labels.deposit.cardFlow.summary.fees, value: summary.fees })
|
|
42350
42813
|
] }),
|
|
42351
|
-
/* @__PURE__ */ (0,
|
|
42814
|
+
/* @__PURE__ */ (0, import_jsx_runtime217.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
42352
42815
|
] })
|
|
42353
42816
|
] }) });
|
|
42354
42817
|
};
|
|
42355
42818
|
|
|
42356
42819
|
// src/deposit/steps/crypto-transfer.tsx
|
|
42357
|
-
var
|
|
42820
|
+
var import_hooks111 = require("@agg-build/hooks");
|
|
42358
42821
|
init_button();
|
|
42359
42822
|
init_copy_button();
|
|
42360
42823
|
init_icon();
|
|
@@ -42362,10 +42825,10 @@ init_modal();
|
|
|
42362
42825
|
init_select();
|
|
42363
42826
|
|
|
42364
42827
|
// src/shared/transfer-fee-summary.tsx
|
|
42365
|
-
var
|
|
42828
|
+
var import_hooks110 = require("@agg-build/hooks");
|
|
42366
42829
|
init_tooltip();
|
|
42367
|
-
var
|
|
42368
|
-
var separator = /* @__PURE__ */ (0,
|
|
42830
|
+
var import_jsx_runtime218 = require("react/jsx-runtime");
|
|
42831
|
+
var separator = /* @__PURE__ */ (0, import_jsx_runtime218.jsx)("span", { className: "text-agg-muted-foreground", "aria-hidden": "true", children: "\xB7" });
|
|
42369
42832
|
var normalizeFeeLabel = (label2) => label2.replace(/\s*~\s*$/, "");
|
|
42370
42833
|
var TransferFeeSummary = ({
|
|
42371
42834
|
estimate,
|
|
@@ -42373,46 +42836,46 @@ var TransferFeeSummary = ({
|
|
|
42373
42836
|
minDeposit,
|
|
42374
42837
|
eta
|
|
42375
42838
|
}) => {
|
|
42376
|
-
const labels = (0,
|
|
42839
|
+
const labels = (0, import_hooks110.useLabels)();
|
|
42377
42840
|
if (!estimate) return null;
|
|
42378
42841
|
if (view === "deposit") {
|
|
42379
|
-
return /* @__PURE__ */ (0,
|
|
42380
|
-
minDeposit ? /* @__PURE__ */ (0,
|
|
42842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("p", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
|
|
42843
|
+
minDeposit ? /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { children: [
|
|
42381
42844
|
labels.deposit.sendCrypto.minDepositPrefix,
|
|
42382
42845
|
" ",
|
|
42383
42846
|
minDeposit
|
|
42384
42847
|
] }) : null,
|
|
42385
42848
|
minDeposit ? separator : null,
|
|
42386
|
-
/* @__PURE__ */ (0,
|
|
42849
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { children: [
|
|
42387
42850
|
normalizeFeeLabel(labels.deposit.walletFlow.feePrefix),
|
|
42388
42851
|
": ",
|
|
42389
42852
|
estimate.estimatedFees
|
|
42390
42853
|
] }),
|
|
42391
42854
|
eta ? separator : null,
|
|
42392
|
-
eta ? /* @__PURE__ */ (0,
|
|
42855
|
+
eta ? /* @__PURE__ */ (0, import_jsx_runtime218.jsx)("span", { children: eta }) : null
|
|
42393
42856
|
] });
|
|
42394
42857
|
}
|
|
42395
|
-
return /* @__PURE__ */ (0,
|
|
42396
|
-
/* @__PURE__ */ (0,
|
|
42858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("div", { className: "agg-type-label flex flex-wrap items-center gap-x-2 gap-y-1 text-agg-foreground", children: [
|
|
42859
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { children: [
|
|
42397
42860
|
labels.withdraw.walletFlow.estimatedFees,
|
|
42398
42861
|
": ",
|
|
42399
42862
|
estimate.estimatedFees
|
|
42400
42863
|
] }),
|
|
42401
42864
|
separator,
|
|
42402
|
-
/* @__PURE__ */ (0,
|
|
42403
|
-
/* @__PURE__ */ (0,
|
|
42865
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { className: "inline-flex items-center gap-1", children: [
|
|
42866
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { children: [
|
|
42404
42867
|
labels.withdraw.walletFlow.networkReserve,
|
|
42405
42868
|
": ",
|
|
42406
42869
|
estimate.networkReserve
|
|
42407
42870
|
] }),
|
|
42408
|
-
/* @__PURE__ */ (0,
|
|
42871
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsx)(
|
|
42409
42872
|
Tooltip,
|
|
42410
42873
|
{
|
|
42411
42874
|
"aria-label": labels.withdraw.walletFlow.networkReserveTooltipAria,
|
|
42412
42875
|
size: "medium",
|
|
42413
|
-
content: /* @__PURE__ */ (0,
|
|
42414
|
-
/* @__PURE__ */ (0,
|
|
42415
|
-
/* @__PURE__ */ (0,
|
|
42876
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("div", { className: "text-center", children: [
|
|
42877
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineOne }),
|
|
42878
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsx)("p", { children: labels.withdraw.walletFlow.networkReserveTooltipLineTwo })
|
|
42416
42879
|
] }),
|
|
42417
42880
|
classNames: {
|
|
42418
42881
|
content: "min-w-96 max-w-none!",
|
|
@@ -42423,7 +42886,7 @@ var TransferFeeSummary = ({
|
|
|
42423
42886
|
)
|
|
42424
42887
|
] }),
|
|
42425
42888
|
separator,
|
|
42426
|
-
/* @__PURE__ */ (0,
|
|
42889
|
+
/* @__PURE__ */ (0, import_jsx_runtime218.jsxs)("span", { children: [
|
|
42427
42890
|
labels.withdraw.walletFlow.youReceive,
|
|
42428
42891
|
": ",
|
|
42429
42892
|
estimate.youReceive
|
|
@@ -42433,21 +42896,21 @@ var TransferFeeSummary = ({
|
|
|
42433
42896
|
|
|
42434
42897
|
// src/deposit/components/DepositQRCode.tsx
|
|
42435
42898
|
var import_qrcode = require("qrcode.react");
|
|
42436
|
-
var
|
|
42899
|
+
var import_jsx_runtime219 = require("react/jsx-runtime");
|
|
42437
42900
|
function DepositQRCode({
|
|
42438
42901
|
depositAddress,
|
|
42439
42902
|
networkLogoUrl,
|
|
42440
42903
|
networkLogo,
|
|
42441
42904
|
size = 160
|
|
42442
42905
|
}) {
|
|
42443
|
-
const logoOverlay = networkLogo ? /* @__PURE__ */ (0,
|
|
42906
|
+
const logoOverlay = networkLogo ? /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
|
|
42444
42907
|
"div",
|
|
42445
42908
|
{
|
|
42446
42909
|
className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-sm",
|
|
42447
42910
|
style: { width: 32, height: 32, backgroundColor: "#FFFFFF", padding: 2 },
|
|
42448
42911
|
children: networkLogo
|
|
42449
42912
|
}
|
|
42450
|
-
) : networkLogoUrl ? /* @__PURE__ */ (0,
|
|
42913
|
+
) : networkLogoUrl ? /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
|
|
42451
42914
|
"img",
|
|
42452
42915
|
{
|
|
42453
42916
|
src: networkLogoUrl,
|
|
@@ -42458,7 +42921,7 @@ function DepositQRCode({
|
|
|
42458
42921
|
style: { backgroundColor: "#FFFFFF", padding: 2 }
|
|
42459
42922
|
}
|
|
42460
42923
|
) : null;
|
|
42461
|
-
return /* @__PURE__ */ (0,
|
|
42924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
|
|
42462
42925
|
"div",
|
|
42463
42926
|
{
|
|
42464
42927
|
className: "inline-flex items-center justify-center rounded-xl border",
|
|
@@ -42467,8 +42930,8 @@ function DepositQRCode({
|
|
|
42467
42930
|
borderColor: "#E5E7EB",
|
|
42468
42931
|
backgroundColor: "#FFFFFF"
|
|
42469
42932
|
},
|
|
42470
|
-
children: /* @__PURE__ */ (0,
|
|
42471
|
-
/* @__PURE__ */ (0,
|
|
42933
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
42934
|
+
/* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_qrcode.QRCodeSVG, { value: depositAddress, size, level: "H" }),
|
|
42472
42935
|
logoOverlay
|
|
42473
42936
|
] })
|
|
42474
42937
|
}
|
|
@@ -42477,27 +42940,27 @@ function DepositQRCode({
|
|
|
42477
42940
|
DepositQRCode.displayName = "DepositQRCode";
|
|
42478
42941
|
|
|
42479
42942
|
// src/deposit/steps/crypto-transfer.tsx
|
|
42480
|
-
var
|
|
42943
|
+
var import_jsx_runtime220 = require("react/jsx-runtime");
|
|
42481
42944
|
var CryptoAddressLoadingState = () => {
|
|
42482
|
-
const labels = (0,
|
|
42945
|
+
const labels = (0, import_hooks111.useLabels)();
|
|
42483
42946
|
const sendCryptoLabels = labels.deposit.sendCrypto;
|
|
42484
|
-
return /* @__PURE__ */ (0,
|
|
42947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)(
|
|
42485
42948
|
"div",
|
|
42486
42949
|
{
|
|
42487
42950
|
className: "flex w-full flex-col items-center justify-center gap-6 py-10 text-center text-agg-foreground",
|
|
42488
42951
|
role: "status",
|
|
42489
42952
|
"aria-live": "polite",
|
|
42490
42953
|
children: [
|
|
42491
|
-
/* @__PURE__ */ (0,
|
|
42954
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42492
42955
|
"span",
|
|
42493
42956
|
{
|
|
42494
42957
|
className: "h-9 w-9 animate-spin rounded-full border-2 border-agg-primary/25 border-t-agg-primary",
|
|
42495
42958
|
"aria-hidden": "true"
|
|
42496
42959
|
}
|
|
42497
42960
|
),
|
|
42498
|
-
/* @__PURE__ */ (0,
|
|
42499
|
-
/* @__PURE__ */ (0,
|
|
42500
|
-
/* @__PURE__ */ (0,
|
|
42961
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex w-full flex-col items-center gap-2", children: [
|
|
42962
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6", children: sendCryptoLabels.addressLoadingTitle }),
|
|
42963
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "max-w-[300px] text-agg-sm leading-agg-5", children: sendCryptoLabels.addressLoadingDescription })
|
|
42501
42964
|
] })
|
|
42502
42965
|
]
|
|
42503
42966
|
}
|
|
@@ -42524,38 +42987,38 @@ var CryptoTransferStep = ({
|
|
|
42524
42987
|
onDone
|
|
42525
42988
|
}) => {
|
|
42526
42989
|
var _a;
|
|
42527
|
-
const labels = (0,
|
|
42990
|
+
const labels = (0, import_hooks111.useLabels)();
|
|
42528
42991
|
const selectedNetworkOption = networkOptions.find((n) => n.value === selectedNetwork);
|
|
42529
42992
|
const networkLogoUrl = (_a = selectedNetworkOption == null ? void 0 : selectedNetworkOption.iconUrl) != null ? _a : "";
|
|
42530
42993
|
const networkLogo = selectedNetworkOption == null ? void 0 : selectedNetworkOption.icon;
|
|
42531
|
-
const transferFeeEstimate = (0,
|
|
42994
|
+
const transferFeeEstimate = (0, import_hooks111.useWithdrawEstimate)({
|
|
42532
42995
|
amount: getEstimateAmountFromMinDeposit(minDeposit),
|
|
42533
42996
|
selectedToken,
|
|
42534
42997
|
selectedNetwork
|
|
42535
42998
|
});
|
|
42536
|
-
return /* @__PURE__ */ (0,
|
|
42537
|
-
/* @__PURE__ */ (0,
|
|
42999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)(import_jsx_runtime220.Fragment, { children: [
|
|
43000
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42538
43001
|
Modal.Header,
|
|
42539
43002
|
{
|
|
42540
43003
|
title: labels.deposit.sendCrypto.title,
|
|
42541
43004
|
hideBorder: true,
|
|
42542
|
-
leftElement: /* @__PURE__ */ (0,
|
|
43005
|
+
leftElement: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42543
43006
|
"button",
|
|
42544
43007
|
{
|
|
42545
43008
|
type: "button",
|
|
42546
43009
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
42547
43010
|
onClick: onBack,
|
|
42548
43011
|
"aria-label": "Go back",
|
|
42549
|
-
children: /* @__PURE__ */ (0,
|
|
43012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
42550
43013
|
}
|
|
42551
43014
|
)
|
|
42552
43015
|
}
|
|
42553
43016
|
),
|
|
42554
|
-
/* @__PURE__ */ (0,
|
|
42555
|
-
/* @__PURE__ */ (0,
|
|
42556
|
-
/* @__PURE__ */ (0,
|
|
42557
|
-
/* @__PURE__ */ (0,
|
|
42558
|
-
/* @__PURE__ */ (0,
|
|
43017
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex flex-col gap-7", children: [
|
|
43018
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: "flex flex-col gap-5", children: /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex gap-5", children: [
|
|
43019
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
43020
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.tokenLabel }),
|
|
43021
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42559
43022
|
Select,
|
|
42560
43023
|
{
|
|
42561
43024
|
items: tokenOptions,
|
|
@@ -42565,9 +43028,9 @@ var CryptoTransferStep = ({
|
|
|
42565
43028
|
}
|
|
42566
43029
|
)
|
|
42567
43030
|
] }),
|
|
42568
|
-
/* @__PURE__ */ (0,
|
|
42569
|
-
/* @__PURE__ */ (0,
|
|
42570
|
-
/* @__PURE__ */ (0,
|
|
43031
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
43032
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.networkLabel }),
|
|
43033
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42571
43034
|
Select,
|
|
42572
43035
|
{
|
|
42573
43036
|
items: networkOptions,
|
|
@@ -42578,7 +43041,7 @@ var CryptoTransferStep = ({
|
|
|
42578
43041
|
)
|
|
42579
43042
|
] })
|
|
42580
43043
|
] }) }),
|
|
42581
|
-
/* @__PURE__ */ (0,
|
|
43044
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: "mx-auto", children: isLoadingAddress ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(CryptoAddressLoadingState, {}) : addressError ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: "flex h-[192px] w-[192px] items-center justify-center rounded-xl border border-agg-separator bg-agg-secondary", children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "agg-type-label text-center text-agg-error px-3", children: addressError }) }) : /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42582
43045
|
DepositQRCode,
|
|
42583
43046
|
{
|
|
42584
43047
|
depositAddress,
|
|
@@ -42586,11 +43049,11 @@ var CryptoTransferStep = ({
|
|
|
42586
43049
|
networkLogo
|
|
42587
43050
|
}
|
|
42588
43051
|
) }),
|
|
42589
|
-
/* @__PURE__ */ (0,
|
|
42590
|
-
/* @__PURE__ */ (0,
|
|
42591
|
-
/* @__PURE__ */ (0,
|
|
42592
|
-
isLoadingAddress ? /* @__PURE__ */ (0,
|
|
42593
|
-
/* @__PURE__ */ (0,
|
|
43052
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
43053
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.sendCrypto.depositAddressLabel }),
|
|
43054
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex items-center gap-2 rounded border border-agg-separator bg-agg-secondary h-10 px-3", children: [
|
|
43055
|
+
isLoadingAddress ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: "h-4 flex-1 animate-pulse rounded bg-agg-muted-foreground/20" }) : /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "agg-type-body flex-1 min-w-0 truncate text-agg-foreground", children: depositAddress }),
|
|
43056
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42594
43057
|
CopyButton,
|
|
42595
43058
|
{
|
|
42596
43059
|
value: depositAddress,
|
|
@@ -42602,7 +43065,7 @@ var CryptoTransferStep = ({
|
|
|
42602
43065
|
}
|
|
42603
43066
|
)
|
|
42604
43067
|
] }),
|
|
42605
|
-
/* @__PURE__ */ (0,
|
|
43068
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42606
43069
|
TransferFeeSummary,
|
|
42607
43070
|
{
|
|
42608
43071
|
estimate: transferFeeEstimate,
|
|
@@ -42612,11 +43075,11 @@ var CryptoTransferStep = ({
|
|
|
42612
43075
|
}
|
|
42613
43076
|
)
|
|
42614
43077
|
] }),
|
|
42615
|
-
/* @__PURE__ */ (0,
|
|
42616
|
-
/* @__PURE__ */ (0,
|
|
42617
|
-
/* @__PURE__ */ (0,
|
|
43078
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsxs)("div", { className: "flex items-start gap-3 rounded-lg bg-agg-secondary-hover p-3", children: [
|
|
43079
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(WarningIcon, { className: "h-4 w-4 text-agg-muted-foreground mt-0.5" }),
|
|
43080
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)("p", { className: "text-agg-xs leading-agg-4 text-agg-foreground", children: labels.deposit.sendCrypto.warning })
|
|
42618
43081
|
] }),
|
|
42619
|
-
/* @__PURE__ */ (0,
|
|
43082
|
+
/* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
|
|
42620
43083
|
Button,
|
|
42621
43084
|
{
|
|
42622
43085
|
variant: "secondary",
|
|
@@ -42631,12 +43094,12 @@ var CryptoTransferStep = ({
|
|
|
42631
43094
|
};
|
|
42632
43095
|
|
|
42633
43096
|
// src/deposit/steps/deposit-method.tsx
|
|
42634
|
-
var
|
|
43097
|
+
var import_hooks112 = require("@agg-build/hooks");
|
|
42635
43098
|
init_utils();
|
|
42636
43099
|
init_modal();
|
|
42637
43100
|
init_icon();
|
|
42638
43101
|
init_loading_icon();
|
|
42639
|
-
var
|
|
43102
|
+
var import_jsx_runtime221 = require("react/jsx-runtime");
|
|
42640
43103
|
var DepositMethodCard = ({
|
|
42641
43104
|
icon,
|
|
42642
43105
|
title: title2,
|
|
@@ -42645,7 +43108,7 @@ var DepositMethodCard = ({
|
|
|
42645
43108
|
highlighted = false,
|
|
42646
43109
|
disabled = false,
|
|
42647
43110
|
onContinue
|
|
42648
|
-
}) => /* @__PURE__ */ (0,
|
|
43111
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(
|
|
42649
43112
|
"div",
|
|
42650
43113
|
{
|
|
42651
43114
|
className: cn(
|
|
@@ -42667,13 +43130,13 @@ var DepositMethodCard = ({
|
|
|
42667
43130
|
}
|
|
42668
43131
|
},
|
|
42669
43132
|
children: [
|
|
42670
|
-
/* @__PURE__ */ (0,
|
|
42671
|
-
/* @__PURE__ */ (0,
|
|
42672
|
-
/* @__PURE__ */ (0,
|
|
42673
|
-
/* @__PURE__ */ (0,
|
|
43133
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: icon }),
|
|
43134
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
43135
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: title2 }),
|
|
43136
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: description })
|
|
42674
43137
|
] }),
|
|
42675
|
-
value ? /* @__PURE__ */ (0,
|
|
42676
|
-
/* @__PURE__ */ (0,
|
|
43138
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: value }) : null,
|
|
43139
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
42677
43140
|
]
|
|
42678
43141
|
}
|
|
42679
43142
|
);
|
|
@@ -42688,32 +43151,32 @@ var DepositMethodStep = ({
|
|
|
42688
43151
|
depositAddressesReady = true,
|
|
42689
43152
|
onSelectMethod
|
|
42690
43153
|
}) => {
|
|
42691
|
-
const labels = (0,
|
|
42692
|
-
return /* @__PURE__ */ (0,
|
|
42693
|
-
/* @__PURE__ */ (0,
|
|
42694
|
-
/* @__PURE__ */ (0,
|
|
42695
|
-
/* @__PURE__ */ (0,
|
|
43154
|
+
const labels = (0, import_hooks112.useLabels)();
|
|
43155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)(import_jsx_runtime221.Fragment, { children: [
|
|
43156
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)(Modal.Header, { title: labels.deposit.title, hideBorder: true }),
|
|
43157
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
43158
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsxs)("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
42696
43159
|
labels.deposit.balancePrefix,
|
|
42697
43160
|
" ",
|
|
42698
43161
|
formatCompactUsd(balance)
|
|
42699
43162
|
] }),
|
|
42700
|
-
/* @__PURE__ */ (0,
|
|
42701
|
-
showWalletMethod ? /* @__PURE__ */ (0,
|
|
43163
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
43164
|
+
showWalletMethod ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
|
|
42702
43165
|
DepositMethodCard,
|
|
42703
43166
|
{
|
|
42704
|
-
icon: /* @__PURE__ */ (0,
|
|
43167
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
42705
43168
|
title: labels.deposit.methods.walletTitle(walletLabel),
|
|
42706
43169
|
description: labels.deposit.methods.walletDescription,
|
|
42707
|
-
value: isWalletBalanceLoading ? /* @__PURE__ */ (0,
|
|
43170
|
+
value: isWalletBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(LoadingIcon, { size: "small" }) : formatTokenAmount(walletBalance, walletToken),
|
|
42708
43171
|
highlighted: highlightedMethod === "wallet",
|
|
42709
43172
|
disabled: !depositAddressesReady,
|
|
42710
43173
|
onContinue: () => onSelectMethod("wallet")
|
|
42711
43174
|
}
|
|
42712
43175
|
) : null,
|
|
42713
|
-
/* @__PURE__ */ (0,
|
|
43176
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
|
|
42714
43177
|
DepositMethodCard,
|
|
42715
43178
|
{
|
|
42716
|
-
icon: /* @__PURE__ */ (0,
|
|
43179
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(BoltIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
42717
43180
|
title: labels.deposit.methods.cryptoTitle,
|
|
42718
43181
|
description: labels.deposit.methods.cryptoDescription,
|
|
42719
43182
|
highlighted: highlightedMethod === "crypto",
|
|
@@ -42721,10 +43184,10 @@ var DepositMethodStep = ({
|
|
|
42721
43184
|
onContinue: () => onSelectMethod("crypto")
|
|
42722
43185
|
}
|
|
42723
43186
|
),
|
|
42724
|
-
/* @__PURE__ */ (0,
|
|
43187
|
+
/* @__PURE__ */ (0, import_jsx_runtime221.jsx)(
|
|
42725
43188
|
DepositMethodCard,
|
|
42726
43189
|
{
|
|
42727
|
-
icon: /* @__PURE__ */ (0,
|
|
43190
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)(CreditCardIcon, { className: "h-6 w-6 text-agg-muted-foreground" }),
|
|
42728
43191
|
title: labels.deposit.methods.cardTitle,
|
|
42729
43192
|
description: labels.deposit.methods.cardDescription,
|
|
42730
43193
|
highlighted: highlightedMethod === "card",
|
|
@@ -42737,14 +43200,14 @@ var DepositMethodStep = ({
|
|
|
42737
43200
|
};
|
|
42738
43201
|
|
|
42739
43202
|
// src/deposit/steps/wallet-form.tsx
|
|
42740
|
-
var
|
|
43203
|
+
var import_hooks113 = require("@agg-build/hooks");
|
|
42741
43204
|
init_utils();
|
|
42742
43205
|
init_modal();
|
|
42743
43206
|
init_button();
|
|
42744
43207
|
init_loading_icon();
|
|
42745
43208
|
init_select();
|
|
42746
43209
|
init_icon();
|
|
42747
|
-
var
|
|
43210
|
+
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
42748
43211
|
var WalletFormStep = ({
|
|
42749
43212
|
walletLabel,
|
|
42750
43213
|
walletBalance,
|
|
@@ -42767,40 +43230,40 @@ var WalletFormStep = ({
|
|
|
42767
43230
|
onMax,
|
|
42768
43231
|
onConfirm
|
|
42769
43232
|
}) => {
|
|
42770
|
-
const labels = (0,
|
|
43233
|
+
const labels = (0, import_hooks113.useLabels)();
|
|
42771
43234
|
const isConfirmEnabled = !isSubmitting && !isBalanceLoading && Number(amount2) > 0 && Number(amount2) <= walletBalance;
|
|
42772
|
-
return /* @__PURE__ */ (0,
|
|
42773
|
-
/* @__PURE__ */ (0,
|
|
43235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(import_jsx_runtime222.Fragment, { children: [
|
|
43236
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42774
43237
|
Modal.Header,
|
|
42775
43238
|
{
|
|
42776
43239
|
title: labels.deposit.walletFlow.title,
|
|
42777
43240
|
hideBorder: true,
|
|
42778
|
-
leftElement: /* @__PURE__ */ (0,
|
|
43241
|
+
leftElement: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42779
43242
|
"button",
|
|
42780
43243
|
{
|
|
42781
43244
|
type: "button",
|
|
42782
43245
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
42783
43246
|
onClick: onBack,
|
|
42784
43247
|
"aria-label": "Go back",
|
|
42785
|
-
children: /* @__PURE__ */ (0,
|
|
43248
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
42786
43249
|
}
|
|
42787
43250
|
)
|
|
42788
43251
|
}
|
|
42789
43252
|
),
|
|
42790
|
-
/* @__PURE__ */ (0,
|
|
42791
|
-
/* @__PURE__ */ (0,
|
|
42792
|
-
/* @__PURE__ */ (0,
|
|
42793
|
-
/* @__PURE__ */ (0,
|
|
43253
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex flex-col gap-7", children: [
|
|
43254
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
43255
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label text-agg-foreground", children: walletLabel }),
|
|
43256
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
42794
43257
|
labels.deposit.balanceLabel,
|
|
42795
43258
|
" ",
|
|
42796
|
-
isBalanceLoading ? /* @__PURE__ */ (0,
|
|
43259
|
+
isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(LoadingIcon, { size: "small" }) : formatTokenAmount(walletBalance, selectedToken)
|
|
42797
43260
|
] })
|
|
42798
43261
|
] }),
|
|
42799
|
-
/* @__PURE__ */ (0,
|
|
42800
|
-
/* @__PURE__ */ (0,
|
|
42801
|
-
/* @__PURE__ */ (0,
|
|
42802
|
-
/* @__PURE__ */ (0,
|
|
42803
|
-
/* @__PURE__ */ (0,
|
|
43262
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
43263
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex gap-5", children: [
|
|
43264
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
43265
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.tokenLabel }),
|
|
43266
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42804
43267
|
Select,
|
|
42805
43268
|
{
|
|
42806
43269
|
items: tokenOptions,
|
|
@@ -42810,9 +43273,9 @@ var WalletFormStep = ({
|
|
|
42810
43273
|
}
|
|
42811
43274
|
)
|
|
42812
43275
|
] }),
|
|
42813
|
-
networkOptions.length >= 1 ? /* @__PURE__ */ (0,
|
|
42814
|
-
/* @__PURE__ */ (0,
|
|
42815
|
-
/* @__PURE__ */ (0,
|
|
43276
|
+
networkOptions.length >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex flex-1 flex-col gap-2 min-w-0", children: [
|
|
43277
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.networkLabel }),
|
|
43278
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42816
43279
|
Select,
|
|
42817
43280
|
{
|
|
42818
43281
|
items: networkOptions,
|
|
@@ -42823,9 +43286,9 @@ var WalletFormStep = ({
|
|
|
42823
43286
|
)
|
|
42824
43287
|
] }) : null
|
|
42825
43288
|
] }),
|
|
42826
|
-
/* @__PURE__ */ (0,
|
|
42827
|
-
/* @__PURE__ */ (0,
|
|
42828
|
-
/* @__PURE__ */ (0,
|
|
43289
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
43290
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.deposit.walletFlow.amountLabel }),
|
|
43291
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(
|
|
42829
43292
|
"div",
|
|
42830
43293
|
{
|
|
42831
43294
|
className: cn(
|
|
@@ -42834,7 +43297,7 @@ var WalletFormStep = ({
|
|
|
42834
43297
|
"h-10 px-3"
|
|
42835
43298
|
),
|
|
42836
43299
|
children: [
|
|
42837
|
-
/* @__PURE__ */ (0,
|
|
43300
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42838
43301
|
"input",
|
|
42839
43302
|
{
|
|
42840
43303
|
type: "text",
|
|
@@ -42846,7 +43309,7 @@ var WalletFormStep = ({
|
|
|
42846
43309
|
onChange: (event) => onAmountChange(event.target.value)
|
|
42847
43310
|
}
|
|
42848
43311
|
),
|
|
42849
|
-
/* @__PURE__ */ (0,
|
|
43312
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42850
43313
|
"button",
|
|
42851
43314
|
{
|
|
42852
43315
|
type: "button",
|
|
@@ -42860,8 +43323,8 @@ var WalletFormStep = ({
|
|
|
42860
43323
|
}
|
|
42861
43324
|
)
|
|
42862
43325
|
] }),
|
|
42863
|
-
estimatedReceive && feeEstimate && eta ? /* @__PURE__ */ (0,
|
|
42864
|
-
formErrorMessage ? /* @__PURE__ */ (0,
|
|
43326
|
+
estimatedReceive && feeEstimate && eta ? /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label text-agg-foreground", children: `\u2248 ${estimatedReceive} \xB7 ${labels.deposit.walletFlow.feePrefix} ${feeEstimate} \xB7 ${eta}` }) : null,
|
|
43327
|
+
formErrorMessage ? /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(
|
|
42865
43328
|
"div",
|
|
42866
43329
|
{
|
|
42867
43330
|
className: cn(
|
|
@@ -42869,13 +43332,13 @@ var WalletFormStep = ({
|
|
|
42869
43332
|
formErrorTone === "warning" ? "text-agg-warning" : "text-agg-error"
|
|
42870
43333
|
),
|
|
42871
43334
|
children: [
|
|
42872
|
-
/* @__PURE__ */ (0,
|
|
42873
|
-
/* @__PURE__ */ (0,
|
|
43335
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(WarningIcon, { className: "mt-0.5 h-4 w-4 shrink-0" }),
|
|
43336
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)("p", { className: "agg-type-label", children: formErrorMessage })
|
|
42874
43337
|
]
|
|
42875
43338
|
}
|
|
42876
43339
|
) : null
|
|
42877
43340
|
] }),
|
|
42878
|
-
/* @__PURE__ */ (0,
|
|
43341
|
+
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
42879
43342
|
Button,
|
|
42880
43343
|
{
|
|
42881
43344
|
variant: isConfirmEnabled ? "primary" : "secondary",
|
|
@@ -42893,31 +43356,31 @@ var WalletFormStep = ({
|
|
|
42893
43356
|
};
|
|
42894
43357
|
|
|
42895
43358
|
// src/deposit/steps/wallet-processing.tsx
|
|
42896
|
-
var
|
|
42897
|
-
var
|
|
43359
|
+
var import_hooks114 = require("@agg-build/hooks");
|
|
43360
|
+
var import_react71 = require("react");
|
|
42898
43361
|
init_modal();
|
|
42899
43362
|
init_icon();
|
|
42900
|
-
var
|
|
43363
|
+
var import_jsx_runtime223 = require("react/jsx-runtime");
|
|
42901
43364
|
var WalletProcessingStep = ({
|
|
42902
43365
|
steps,
|
|
42903
43366
|
errorMessage,
|
|
42904
43367
|
onComplete
|
|
42905
43368
|
}) => {
|
|
42906
|
-
const labels = (0,
|
|
42907
|
-
(0,
|
|
43369
|
+
const labels = (0, import_hooks114.useLabels)();
|
|
43370
|
+
(0, import_react71.useEffect)(() => {
|
|
42908
43371
|
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
42909
43372
|
if (allDone) {
|
|
42910
43373
|
onComplete();
|
|
42911
43374
|
}
|
|
42912
43375
|
}, [steps, onComplete]);
|
|
42913
|
-
return /* @__PURE__ */ (0,
|
|
42914
|
-
/* @__PURE__ */ (0,
|
|
42915
|
-
/* @__PURE__ */ (0,
|
|
43376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)(import_jsx_runtime223.Fragment, { children: [
|
|
43377
|
+
/* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Modal.Header, { title: labels.deposit.processingTitle, hideBorder: true }),
|
|
43378
|
+
/* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
42916
43379
|
steps.map((step) => {
|
|
42917
43380
|
const isComplete = step.status === "complete";
|
|
42918
43381
|
const isActive = step.status === "active";
|
|
42919
|
-
return /* @__PURE__ */ (0,
|
|
42920
|
-
isComplete ? /* @__PURE__ */ (0,
|
|
43382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
43383
|
+
isComplete ? /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(CheckCircleIcon, { className: "h-4 w-4 text-agg-primary" }) : /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(
|
|
42921
43384
|
"span",
|
|
42922
43385
|
{
|
|
42923
43386
|
className: [
|
|
@@ -42927,7 +43390,7 @@ var WalletProcessingStep = ({
|
|
|
42927
43390
|
].join(" ")
|
|
42928
43391
|
}
|
|
42929
43392
|
),
|
|
42930
|
-
/* @__PURE__ */ (0,
|
|
43393
|
+
/* @__PURE__ */ (0, import_jsx_runtime223.jsx)(
|
|
42931
43394
|
"p",
|
|
42932
43395
|
{
|
|
42933
43396
|
className: isComplete || isActive ? "agg-type-body text-agg-foreground" : "agg-type-body text-agg-muted-foreground",
|
|
@@ -42936,63 +43399,63 @@ var WalletProcessingStep = ({
|
|
|
42936
43399
|
)
|
|
42937
43400
|
] }, step.id);
|
|
42938
43401
|
}),
|
|
42939
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
43402
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime223.jsx)("p", { className: "agg-type-body text-agg-destructive", children: errorMessage }) : null
|
|
42940
43403
|
] }) })
|
|
42941
43404
|
] });
|
|
42942
43405
|
};
|
|
42943
43406
|
|
|
42944
43407
|
// src/deposit/steps/wallet-success.tsx
|
|
42945
|
-
var
|
|
43408
|
+
var import_hooks115 = require("@agg-build/hooks");
|
|
42946
43409
|
init_modal();
|
|
42947
43410
|
init_button();
|
|
42948
43411
|
init_icon();
|
|
42949
|
-
var
|
|
42950
|
-
var SummaryRow2 = ({ label: label2, value }) => /* @__PURE__ */ (0,
|
|
42951
|
-
/* @__PURE__ */ (0,
|
|
42952
|
-
/* @__PURE__ */ (0,
|
|
43412
|
+
var import_jsx_runtime224 = require("react/jsx-runtime");
|
|
43413
|
+
var SummaryRow2 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)("div", { className: "flex items-center justify-between border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
43414
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)("p", { className: "text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
|
|
43415
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)("p", { className: "agg-type-label text-agg-foreground", children: value })
|
|
42953
43416
|
] });
|
|
42954
43417
|
var WalletSuccessStep = ({
|
|
42955
43418
|
summary,
|
|
42956
43419
|
onDone,
|
|
42957
43420
|
onClose
|
|
42958
43421
|
}) => {
|
|
42959
|
-
const labels = (0,
|
|
42960
|
-
return /* @__PURE__ */ (0,
|
|
42961
|
-
/* @__PURE__ */ (0,
|
|
43422
|
+
const labels = (0, import_hooks115.useLabels)();
|
|
43423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime224.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime224.jsxs)(Modal.Body, { classNames: { root: "px-5 py-8 sm:px-8 sm:py-10" }, children: [
|
|
43424
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(
|
|
42962
43425
|
"button",
|
|
42963
43426
|
{
|
|
42964
43427
|
type: "button",
|
|
42965
43428
|
className: "absolute right-8 top-7 flex items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
42966
43429
|
onClick: onClose,
|
|
42967
43430
|
"aria-label": labels.common.close,
|
|
42968
|
-
children: /* @__PURE__ */ (0,
|
|
43431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
42969
43432
|
}
|
|
42970
43433
|
),
|
|
42971
|
-
/* @__PURE__ */ (0,
|
|
42972
|
-
/* @__PURE__ */ (0,
|
|
42973
|
-
/* @__PURE__ */ (0,
|
|
42974
|
-
/* @__PURE__ */ (0,
|
|
42975
|
-
/* @__PURE__ */ (0,
|
|
43434
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
43435
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)("div", { className: "flex h-[60px] w-[60px] items-center justify-center rounded-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" }) }),
|
|
43436
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
43437
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: labels.deposit.successTitle }),
|
|
43438
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)("p", { className: "agg-type-body text-agg-foreground", children: labels.deposit.successDescription })
|
|
42976
43439
|
] }),
|
|
42977
|
-
/* @__PURE__ */ (0,
|
|
42978
|
-
/* @__PURE__ */ (0,
|
|
43440
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsxs)("div", { className: "w-full rounded-lg border border-agg-separator bg-agg-secondary px-3 py-1", children: [
|
|
43441
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(
|
|
42979
43442
|
SummaryRow2,
|
|
42980
43443
|
{
|
|
42981
43444
|
label: labels.deposit.summary.amountReceived,
|
|
42982
43445
|
value: summary.amountReceived
|
|
42983
43446
|
}
|
|
42984
43447
|
),
|
|
42985
|
-
/* @__PURE__ */ (0,
|
|
42986
|
-
/* @__PURE__ */ (0,
|
|
42987
|
-
/* @__PURE__ */ (0,
|
|
43448
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(SummaryRow2, { label: labels.deposit.summary.network, value: summary.network }),
|
|
43449
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(SummaryRow2, { label: labels.deposit.summary.fromWallet, value: summary.fromWallet }),
|
|
43450
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(SummaryRow2, { label: labels.deposit.summary.gasFee, value: summary.gasFee })
|
|
42988
43451
|
] }),
|
|
42989
|
-
/* @__PURE__ */ (0,
|
|
43452
|
+
/* @__PURE__ */ (0, import_jsx_runtime224.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.deposit.done })
|
|
42990
43453
|
] })
|
|
42991
43454
|
] }) });
|
|
42992
43455
|
};
|
|
42993
43456
|
|
|
42994
43457
|
// src/deposit/index.tsx
|
|
42995
|
-
var
|
|
43458
|
+
var import_jsx_runtime225 = require("react/jsx-runtime");
|
|
42996
43459
|
var PENDING_CARD_SESSION_KEY = "agg-pending-card-session";
|
|
42997
43460
|
var DEFAULT_WALLET_CHAIN_ID = "1";
|
|
42998
43461
|
var DEFAULT_WALLET_TOKEN = "USDC";
|
|
@@ -43042,7 +43505,7 @@ function isControlledDepositModalProps(props) {
|
|
|
43042
43505
|
}
|
|
43043
43506
|
function DepositModalSelfDriven({ open, onOpenChange }) {
|
|
43044
43507
|
const depositProps = (0, import_deposit.useDepositFlow)({ open, onOpenChange });
|
|
43045
|
-
return /* @__PURE__ */ (0,
|
|
43508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(DepositModalControlled, __spreadValues({}, depositProps));
|
|
43046
43509
|
}
|
|
43047
43510
|
function DepositModalControlled({
|
|
43048
43511
|
open,
|
|
@@ -43076,49 +43539,49 @@ function DepositModalControlled({
|
|
|
43076
43539
|
pendingCardPurchaseSummary
|
|
43077
43540
|
}) {
|
|
43078
43541
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
43079
|
-
const { isWeb3User } = (0,
|
|
43080
|
-
const { walletActions } = (0,
|
|
43081
|
-
const labels = (0,
|
|
43542
|
+
const { isWeb3User } = (0, import_hooks116.useAggAuthState)();
|
|
43543
|
+
const { walletActions } = (0, import_hooks116.useAggUiConfig)();
|
|
43544
|
+
const labels = (0, import_hooks116.useLabels)();
|
|
43082
43545
|
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
43083
|
-
const [step, setStep] = (0,
|
|
43546
|
+
const [step, setStep] = (0, import_react72.useState)(
|
|
43084
43547
|
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
43085
43548
|
);
|
|
43086
|
-
const [highlightedMethod, setHighlightedMethod] = (0,
|
|
43087
|
-
const walletSubmitInFlightRef = (0,
|
|
43088
|
-
const walletDepositAttemptIdRef = (0,
|
|
43089
|
-
const notifiedWalletDepositStatusesRef = (0,
|
|
43090
|
-
const [isWalletSubmitting, setIsWalletSubmitting] = (0,
|
|
43091
|
-
const [cardProviders, setCardProviders] = (0,
|
|
43092
|
-
const [quotesLoading, setQuotesLoading] = (0,
|
|
43093
|
-
const [quotesError, setQuotesError] = (0,
|
|
43094
|
-
const [sessionError, setSessionError] = (0,
|
|
43095
|
-
const [pendingProviderName, setPendingProviderName] = (0,
|
|
43096
|
-
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0,
|
|
43097
|
-
(0,
|
|
43549
|
+
const [highlightedMethod, setHighlightedMethod] = (0, import_react72.useState)(defaultMethod);
|
|
43550
|
+
const walletSubmitInFlightRef = (0, import_react72.useRef)(false);
|
|
43551
|
+
const walletDepositAttemptIdRef = (0, import_react72.useRef)(0);
|
|
43552
|
+
const notifiedWalletDepositStatusesRef = (0, import_react72.useRef)(/* @__PURE__ */ new Set());
|
|
43553
|
+
const [isWalletSubmitting, setIsWalletSubmitting] = (0, import_react72.useState)(false);
|
|
43554
|
+
const [cardProviders, setCardProviders] = (0, import_react72.useState)([]);
|
|
43555
|
+
const [quotesLoading, setQuotesLoading] = (0, import_react72.useState)(false);
|
|
43556
|
+
const [quotesError, setQuotesError] = (0, import_react72.useState)(null);
|
|
43557
|
+
const [sessionError, setSessionError] = (0, import_react72.useState)(null);
|
|
43558
|
+
const [pendingProviderName, setPendingProviderName] = (0, import_react72.useState)("");
|
|
43559
|
+
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0, import_react72.useState)("");
|
|
43560
|
+
(0, import_react72.useEffect)(() => {
|
|
43098
43561
|
if (pendingCardPurchaseSummary) {
|
|
43099
43562
|
clearPendingCardSession();
|
|
43100
43563
|
setStep("card-success");
|
|
43101
43564
|
}
|
|
43102
43565
|
}, [pendingCardPurchaseSummary]);
|
|
43103
|
-
const [walletChainId, setWalletChainId] = (0,
|
|
43104
|
-
const [walletToken, setWalletToken] = (0,
|
|
43105
|
-
const [sendChainId, setSendChainId] = (0,
|
|
43106
|
-
const [sendToken, setSendToken] = (0,
|
|
43566
|
+
const [walletChainId, setWalletChainId] = (0, import_react72.useState)("");
|
|
43567
|
+
const [walletToken, setWalletToken] = (0, import_react72.useState)("");
|
|
43568
|
+
const [sendChainId, setSendChainId] = (0, import_react72.useState)("");
|
|
43569
|
+
const [sendToken, setSendToken] = (0, import_react72.useState)("");
|
|
43107
43570
|
const {
|
|
43108
43571
|
isReady,
|
|
43109
43572
|
isTimedOut,
|
|
43110
43573
|
error: addrError,
|
|
43111
43574
|
supportedChains,
|
|
43112
43575
|
getAddress
|
|
43113
|
-
} = (0,
|
|
43114
|
-
const fallbackNetworkOptions = (0,
|
|
43115
|
-
const networkOptions = (0,
|
|
43576
|
+
} = (0, import_hooks116.useDepositAddresses)({ enabled: open });
|
|
43577
|
+
const fallbackNetworkOptions = (0, import_react72.useMemo)(() => mapNetworksToOptions(), []);
|
|
43578
|
+
const networkOptions = (0, import_react72.useMemo)(() => {
|
|
43116
43579
|
if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
|
|
43117
43580
|
return withNetworkIcons(
|
|
43118
43581
|
supportedChains.map((c) => ({ value: String(c.chainId), label: c.name }))
|
|
43119
43582
|
);
|
|
43120
43583
|
}, [supportedChains, fallbackNetworkOptions]);
|
|
43121
|
-
const walletNetworkOptions = (0,
|
|
43584
|
+
const walletNetworkOptions = (0, import_react72.useMemo)(() => {
|
|
43122
43585
|
if (!(supportedChains == null ? void 0 : supportedChains.length) || !connectedWalletKind) return networkOptions;
|
|
43123
43586
|
const filtered = supportedChains.filter(
|
|
43124
43587
|
(c) => connectedWalletKind === "solana" ? import_deposit.SVM_CHAIN_IDS.has(c.chainId) : !import_deposit.SVM_CHAIN_IDS.has(c.chainId)
|
|
@@ -43126,17 +43589,17 @@ function DepositModalControlled({
|
|
|
43126
43589
|
if (filtered.length === 0) return networkOptions;
|
|
43127
43590
|
return withNetworkIcons(filtered.map((c) => ({ value: String(c.chainId), label: c.name })));
|
|
43128
43591
|
}, [supportedChains, networkOptions, connectedWalletKind]);
|
|
43129
|
-
const walletTokenOptions = (0,
|
|
43592
|
+
const walletTokenOptions = (0, import_react72.useMemo)(() => {
|
|
43130
43593
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
43131
43594
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
43132
43595
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
43133
43596
|
}, [supportedChains, walletChainId]);
|
|
43134
|
-
const sendTokenOptions = (0,
|
|
43597
|
+
const sendTokenOptions = (0, import_react72.useMemo)(() => {
|
|
43135
43598
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === sendChainId);
|
|
43136
43599
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
43137
43600
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
43138
43601
|
}, [supportedChains, sendChainId]);
|
|
43139
|
-
(0,
|
|
43602
|
+
(0, import_react72.useEffect)(() => {
|
|
43140
43603
|
if (walletNetworkOptions.length > 0) {
|
|
43141
43604
|
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
43142
43605
|
const ethereumMainnetOption = walletNetworkOptions.find(
|
|
@@ -43147,30 +43610,30 @@ function DepositModalControlled({
|
|
|
43147
43610
|
}
|
|
43148
43611
|
}
|
|
43149
43612
|
}, [walletNetworkOptions, walletChainId, initialWalletChainId]);
|
|
43150
|
-
(0,
|
|
43613
|
+
(0, import_react72.useEffect)(() => {
|
|
43151
43614
|
if (networkOptions.length > 0) {
|
|
43152
43615
|
if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) {
|
|
43153
43616
|
setSendChainId(networkOptions[0].value);
|
|
43154
43617
|
}
|
|
43155
43618
|
}
|
|
43156
43619
|
}, [networkOptions, sendChainId]);
|
|
43157
|
-
(0,
|
|
43620
|
+
(0, import_react72.useEffect)(() => {
|
|
43158
43621
|
var _a2, _b2;
|
|
43159
43622
|
if (walletTokenOptions.length > 0) {
|
|
43160
43623
|
const preferredToken = (_b2 = (_a2 = walletTokenOptions.find((option) => option.value === DEFAULT_WALLET_TOKEN)) == null ? void 0 : _a2.value) != null ? _b2 : walletTokenOptions[0].value;
|
|
43161
43624
|
setWalletToken(preferredToken);
|
|
43162
43625
|
}
|
|
43163
43626
|
}, [walletTokenOptions]);
|
|
43164
|
-
(0,
|
|
43627
|
+
(0, import_react72.useEffect)(() => {
|
|
43165
43628
|
var _a2, _b2;
|
|
43166
43629
|
setSendToken((_b2 = (_a2 = sendTokenOptions == null ? void 0 : sendTokenOptions[0]) == null ? void 0 : _a2.value) != null ? _b2 : "");
|
|
43167
43630
|
}, [sendTokenOptions]);
|
|
43168
|
-
(0,
|
|
43631
|
+
(0, import_react72.useEffect)(() => {
|
|
43169
43632
|
if (walletChainId) {
|
|
43170
43633
|
onWalletNetworkChange == null ? void 0 : onWalletNetworkChange(walletChainId);
|
|
43171
43634
|
}
|
|
43172
43635
|
}, [walletChainId, onWalletNetworkChange]);
|
|
43173
|
-
(0,
|
|
43636
|
+
(0, import_react72.useEffect)(() => {
|
|
43174
43637
|
if (walletToken) {
|
|
43175
43638
|
onWalletTokenChange == null ? void 0 : onWalletTokenChange(walletToken);
|
|
43176
43639
|
}
|
|
@@ -43189,7 +43652,7 @@ function DepositModalControlled({
|
|
|
43189
43652
|
fromWallet: walletFlow.walletLabel,
|
|
43190
43653
|
gasFee: ""
|
|
43191
43654
|
}, walletFlow.successSummary);
|
|
43192
|
-
const handleWalletDepositNotification = (0,
|
|
43655
|
+
const handleWalletDepositNotification = (0, import_react72.useCallback)(
|
|
43193
43656
|
(status, errorMessage) => {
|
|
43194
43657
|
if (notifiedWalletDepositStatusesRef.current.has(status)) return;
|
|
43195
43658
|
notifiedWalletDepositStatusesRef.current.add(status);
|
|
@@ -43203,13 +43666,13 @@ function DepositModalControlled({
|
|
|
43203
43666
|
},
|
|
43204
43667
|
[walletFlow.amount, walletToken]
|
|
43205
43668
|
);
|
|
43206
|
-
(0,
|
|
43669
|
+
(0, import_react72.useEffect)(() => {
|
|
43207
43670
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
43208
43671
|
handleWalletDepositNotification("completed");
|
|
43209
43672
|
setStep("wallet-success");
|
|
43210
43673
|
}
|
|
43211
43674
|
}, [handleWalletDepositNotification, isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
43212
|
-
(0,
|
|
43675
|
+
(0, import_react72.useEffect)(() => {
|
|
43213
43676
|
if (!onCancelWalletDeposit) return;
|
|
43214
43677
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "error") {
|
|
43215
43678
|
walletSubmitInFlightRef.current = false;
|
|
@@ -43362,8 +43825,8 @@ function DepositModalControlled({
|
|
|
43362
43825
|
onOpenChange(isOpen);
|
|
43363
43826
|
};
|
|
43364
43827
|
const depositModalMaxWidth = step === "method" ? "600px" : "480px";
|
|
43365
|
-
return /* @__PURE__ */ (0,
|
|
43366
|
-
step === "method" ? /* @__PURE__ */ (0,
|
|
43828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(Modal.Container, { maxWidth: depositModalMaxWidth, "aria-label": "Deposit", children: [
|
|
43829
|
+
step === "method" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43367
43830
|
DepositMethodStep,
|
|
43368
43831
|
{
|
|
43369
43832
|
balance: walletFlow.balance,
|
|
@@ -43377,7 +43840,7 @@ function DepositModalControlled({
|
|
|
43377
43840
|
onSelectMethod: handleSelectMethod
|
|
43378
43841
|
}
|
|
43379
43842
|
) : null,
|
|
43380
|
-
step === "wallet-form" ? /* @__PURE__ */ (0,
|
|
43843
|
+
step === "wallet-form" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43381
43844
|
WalletFormStep,
|
|
43382
43845
|
{
|
|
43383
43846
|
walletLabel: walletFlow.walletLabel,
|
|
@@ -43443,7 +43906,7 @@ function DepositModalControlled({
|
|
|
43443
43906
|
})
|
|
43444
43907
|
}
|
|
43445
43908
|
) : null,
|
|
43446
|
-
step === "wallet-processing" ? /* @__PURE__ */ (0,
|
|
43909
|
+
step === "wallet-processing" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43447
43910
|
WalletProcessingStep,
|
|
43448
43911
|
{
|
|
43449
43912
|
steps: processingSteps,
|
|
@@ -43451,7 +43914,7 @@ function DepositModalControlled({
|
|
|
43451
43914
|
onComplete: () => setStep("wallet-success")
|
|
43452
43915
|
}
|
|
43453
43916
|
) : null,
|
|
43454
|
-
step === "wallet-success" ? /* @__PURE__ */ (0,
|
|
43917
|
+
step === "wallet-success" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43455
43918
|
WalletSuccessStep,
|
|
43456
43919
|
{
|
|
43457
43920
|
summary: resolvedSuccessSummary,
|
|
@@ -43459,7 +43922,7 @@ function DepositModalControlled({
|
|
|
43459
43922
|
onClose: () => handleOpenChange(false)
|
|
43460
43923
|
}
|
|
43461
43924
|
) : null,
|
|
43462
|
-
step === "card-deposit" && cardFlow ? /* @__PURE__ */ (0,
|
|
43925
|
+
step === "card-deposit" && cardFlow ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43463
43926
|
CardDepositStep,
|
|
43464
43927
|
{
|
|
43465
43928
|
amount: cardFlow.amount,
|
|
@@ -43477,7 +43940,7 @@ function DepositModalControlled({
|
|
|
43477
43940
|
onContinue: handleContinueCardDeposit
|
|
43478
43941
|
}
|
|
43479
43942
|
) : null,
|
|
43480
|
-
step === "card-provider" && cardFlow ? /* @__PURE__ */ (0,
|
|
43943
|
+
step === "card-provider" && cardFlow ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43481
43944
|
CardProviderStep,
|
|
43482
43945
|
{
|
|
43483
43946
|
amount: cardFlow.amount,
|
|
@@ -43492,7 +43955,7 @@ function DepositModalControlled({
|
|
|
43492
43955
|
onRetry: handleRetryQuotes
|
|
43493
43956
|
}
|
|
43494
43957
|
) : null,
|
|
43495
|
-
step === "card-payment-pending" ? /* @__PURE__ */ (0,
|
|
43958
|
+
step === "card-payment-pending" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43496
43959
|
CardPaymentPendingStep,
|
|
43497
43960
|
{
|
|
43498
43961
|
providerName: pendingProviderName,
|
|
@@ -43502,7 +43965,7 @@ function DepositModalControlled({
|
|
|
43502
43965
|
onChooseAnotherProvider: handleChooseAnotherProvider
|
|
43503
43966
|
}
|
|
43504
43967
|
) : null,
|
|
43505
|
-
step === "card-success" ? /* @__PURE__ */ (0,
|
|
43968
|
+
step === "card-success" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43506
43969
|
CardPurchaseSuccessStep,
|
|
43507
43970
|
{
|
|
43508
43971
|
summary: (_g = pendingCardPurchaseSummary != null ? pendingCardPurchaseSummary : cardFlow == null ? void 0 : cardFlow.purchaseSummary) != null ? _g : {
|
|
@@ -43514,7 +43977,7 @@ function DepositModalControlled({
|
|
|
43514
43977
|
onDone: handleDoneCardPurchase
|
|
43515
43978
|
}
|
|
43516
43979
|
) : null,
|
|
43517
|
-
step === "crypto-transfer" ? /* @__PURE__ */ (0,
|
|
43980
|
+
step === "crypto-transfer" ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(
|
|
43518
43981
|
CryptoTransferStep,
|
|
43519
43982
|
{
|
|
43520
43983
|
tokenOptions: sendTokenOptions,
|
|
@@ -43543,37 +44006,37 @@ var ignoreCardChange = (_value) => {
|
|
|
43543
44006
|
};
|
|
43544
44007
|
var DepositModal = (props) => {
|
|
43545
44008
|
if (!isControlledDepositModalProps(props)) {
|
|
43546
|
-
return /* @__PURE__ */ (0,
|
|
44009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(DepositModalSelfDriven, __spreadValues({}, props));
|
|
43547
44010
|
}
|
|
43548
|
-
return /* @__PURE__ */ (0,
|
|
44011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(DepositModalControlled, __spreadValues({}, props));
|
|
43549
44012
|
};
|
|
43550
44013
|
DepositModal.displayName = "DepositModal";
|
|
43551
44014
|
|
|
43552
44015
|
// src/withdraw/index.tsx
|
|
43553
|
-
var
|
|
44016
|
+
var import_react73 = require("react");
|
|
43554
44017
|
var import_withdraw = require("@agg-build/hooks/withdraw");
|
|
43555
44018
|
init_modal();
|
|
43556
44019
|
|
|
43557
44020
|
// src/withdraw/steps/withdraw-method.tsx
|
|
43558
|
-
var
|
|
44021
|
+
var import_hooks117 = require("@agg-build/hooks");
|
|
43559
44022
|
init_icon();
|
|
43560
44023
|
init_modal();
|
|
43561
44024
|
init_utils();
|
|
43562
|
-
var
|
|
44025
|
+
var import_jsx_runtime226 = require("react/jsx-runtime");
|
|
43563
44026
|
var WithdrawMethodStep = ({
|
|
43564
44027
|
balance,
|
|
43565
44028
|
onSelectMethod
|
|
43566
44029
|
}) => {
|
|
43567
|
-
const labels = (0,
|
|
43568
|
-
return /* @__PURE__ */ (0,
|
|
43569
|
-
/* @__PURE__ */ (0,
|
|
43570
|
-
/* @__PURE__ */ (0,
|
|
43571
|
-
/* @__PURE__ */ (0,
|
|
44030
|
+
const labels = (0, import_hooks117.useLabels)();
|
|
44031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(import_jsx_runtime226.Fragment, { children: [
|
|
44032
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Modal.Header, { title: labels.withdraw.title, hideBorder: true }),
|
|
44033
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
44034
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsxs)("p", { className: "agg-type-body text-agg-foreground", children: [
|
|
43572
44035
|
labels.withdraw.balancePrefix,
|
|
43573
44036
|
" ",
|
|
43574
44037
|
formatCompactUsd(balance)
|
|
43575
44038
|
] }),
|
|
43576
|
-
/* @__PURE__ */ (0,
|
|
44039
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(
|
|
43577
44040
|
"div",
|
|
43578
44041
|
{
|
|
43579
44042
|
className: cn(
|
|
@@ -43590,12 +44053,12 @@ var WithdrawMethodStep = ({
|
|
|
43590
44053
|
}
|
|
43591
44054
|
},
|
|
43592
44055
|
children: [
|
|
43593
|
-
/* @__PURE__ */ (0,
|
|
43594
|
-
/* @__PURE__ */ (0,
|
|
43595
|
-
/* @__PURE__ */ (0,
|
|
43596
|
-
/* @__PURE__ */ (0,
|
|
44056
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", { className: "shrink-0 flex items-center justify-center h-10 w-10 rounded-lg bg-agg-secondary-hover", children: /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(WalletIcon, { className: "h-6 w-6 text-agg-muted-foreground" }) }),
|
|
44057
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
44058
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: labels.withdraw.methods.walletTitle }),
|
|
44059
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("p", { className: "agg-type-label text-agg-muted-foreground", children: labels.withdraw.methods.walletDescription })
|
|
43597
44060
|
] }),
|
|
43598
|
-
/* @__PURE__ */ (0,
|
|
44061
|
+
/* @__PURE__ */ (0, import_jsx_runtime226.jsx)("div", { className: "shrink-0 text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(ChevronRightIcon, { className: "h-5 w-5" }) })
|
|
43599
44062
|
]
|
|
43600
44063
|
}
|
|
43601
44064
|
)
|
|
@@ -43604,14 +44067,14 @@ var WithdrawMethodStep = ({
|
|
|
43604
44067
|
};
|
|
43605
44068
|
|
|
43606
44069
|
// src/withdraw/steps/withdraw-amount.tsx
|
|
43607
|
-
var
|
|
44070
|
+
var import_hooks118 = require("@agg-build/hooks");
|
|
43608
44071
|
init_button();
|
|
43609
44072
|
init_icon();
|
|
43610
44073
|
init_loading_icon();
|
|
43611
44074
|
init_modal();
|
|
43612
44075
|
init_select();
|
|
43613
44076
|
init_utils();
|
|
43614
|
-
var
|
|
44077
|
+
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
43615
44078
|
var formatRawTokenAmount = (rawAmount, decimals) => {
|
|
43616
44079
|
if (!rawAmount) return "0";
|
|
43617
44080
|
const raw = BigInt(rawAmount);
|
|
@@ -43655,7 +44118,7 @@ var WithdrawAmountStep = ({
|
|
|
43655
44118
|
onContinue
|
|
43656
44119
|
}) => {
|
|
43657
44120
|
var _a, _b, _c, _d;
|
|
43658
|
-
const labels = (0,
|
|
44121
|
+
const labels = (0, import_hooks118.useLabels)();
|
|
43659
44122
|
const SOLANA_CHAIN_ID = "792703809";
|
|
43660
44123
|
const isSolanaDest = selectedNetwork === SOLANA_CHAIN_ID;
|
|
43661
44124
|
const trimmedDestination = destinationWallet.trim();
|
|
@@ -43663,7 +44126,7 @@ var WithdrawAmountStep = ({
|
|
|
43663
44126
|
const isValid = Number(amount2) > 0 && isValidAddress;
|
|
43664
44127
|
const amountRaw = amount2 && Number(amount2) > 0 ? parseTokenAmountToRaw(amount2, destDecimals) : null;
|
|
43665
44128
|
const destinationChainId = Number(selectedNetwork) || null;
|
|
43666
|
-
const preview = (0,
|
|
44129
|
+
const preview = (0, import_hooks118.useWithdrawPreview)({
|
|
43667
44130
|
amountRaw,
|
|
43668
44131
|
tokenSymbol: selectedToken || null,
|
|
43669
44132
|
destinationChainId,
|
|
@@ -43680,29 +44143,29 @@ var WithdrawAmountStep = ({
|
|
|
43680
44143
|
youReceive: preview.data.receiveAmountRaw != null ? `~${formatRawTokenAmount(preview.data.receiveAmountRaw, destDecimals)} ${selectedToken}` : "\u2014"
|
|
43681
44144
|
} : null;
|
|
43682
44145
|
const shouldShowWithdrawEstimate = Boolean(withdrawEstimate);
|
|
43683
|
-
return /* @__PURE__ */ (0,
|
|
43684
|
-
/* @__PURE__ */ (0,
|
|
44146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [
|
|
44147
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43685
44148
|
Modal.Header,
|
|
43686
44149
|
{
|
|
43687
44150
|
title: labels.withdraw.walletFlow.title,
|
|
43688
44151
|
hideBorder: true,
|
|
43689
|
-
leftElement: /* @__PURE__ */ (0,
|
|
44152
|
+
leftElement: /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43690
44153
|
"button",
|
|
43691
44154
|
{
|
|
43692
44155
|
type: "button",
|
|
43693
44156
|
className: "mr-2 flex items-center justify-center text-agg-foreground transition-colors hover:cursor-pointer hover:text-agg-foreground/80",
|
|
43694
44157
|
onClick: onBack,
|
|
43695
44158
|
"aria-label": labels.withdraw.back,
|
|
43696
|
-
children: /* @__PURE__ */ (0,
|
|
44159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(ChevronLeftIcon, { className: "h-6 w-6" })
|
|
43697
44160
|
}
|
|
43698
44161
|
)
|
|
43699
44162
|
}
|
|
43700
44163
|
),
|
|
43701
|
-
/* @__PURE__ */ (0,
|
|
43702
|
-
/* @__PURE__ */ (0,
|
|
43703
|
-
/* @__PURE__ */ (0,
|
|
43704
|
-
/* @__PURE__ */ (0,
|
|
43705
|
-
/* @__PURE__ */ (0,
|
|
44164
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Modal.Body, { classNames: { root: "px-5 pt-0 pb-6 sm:px-8 sm:pt-0 sm:pb-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
44165
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex flex-col gap-5", children: [
|
|
44166
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
44167
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.recipientAddressLabel }),
|
|
44168
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43706
44169
|
"input",
|
|
43707
44170
|
{
|
|
43708
44171
|
type: "text",
|
|
@@ -43718,17 +44181,17 @@ var WithdrawAmountStep = ({
|
|
|
43718
44181
|
}
|
|
43719
44182
|
)
|
|
43720
44183
|
] }),
|
|
43721
|
-
/* @__PURE__ */ (0,
|
|
43722
|
-
/* @__PURE__ */ (0,
|
|
43723
|
-
/* @__PURE__ */ (0,
|
|
43724
|
-
/* @__PURE__ */ (0,
|
|
44184
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
44185
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
44186
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.amountLabel }),
|
|
44187
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("p", { className: "agg-type-label text-agg-muted-foreground", children: [
|
|
43725
44188
|
labels.withdraw.balancePrefix,
|
|
43726
44189
|
" ",
|
|
43727
44190
|
balanceDisplay
|
|
43728
44191
|
] })
|
|
43729
44192
|
] }),
|
|
43730
|
-
/* @__PURE__ */ (0,
|
|
43731
|
-
/* @__PURE__ */ (0,
|
|
44193
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex h-10 items-center gap-2 rounded border border-agg-separator bg-agg-secondary px-3 focus-within:border-agg-primary transition-colors", children: [
|
|
44194
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43732
44195
|
"input",
|
|
43733
44196
|
{
|
|
43734
44197
|
type: "text",
|
|
@@ -43743,8 +44206,8 @@ var WithdrawAmountStep = ({
|
|
|
43743
44206
|
onChange: (e) => onAmountChange(e.target.value)
|
|
43744
44207
|
}
|
|
43745
44208
|
),
|
|
43746
|
-
/* @__PURE__ */ (0,
|
|
43747
|
-
onMaxClick ? /* @__PURE__ */ (0,
|
|
44209
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("span", { className: "agg-type-body text-agg-muted-foreground shrink-0", children: selectedToken }),
|
|
44210
|
+
onMaxClick ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43748
44211
|
"button",
|
|
43749
44212
|
{
|
|
43750
44213
|
type: "button",
|
|
@@ -43755,10 +44218,10 @@ var WithdrawAmountStep = ({
|
|
|
43755
44218
|
) : null
|
|
43756
44219
|
] })
|
|
43757
44220
|
] }),
|
|
43758
|
-
/* @__PURE__ */ (0,
|
|
43759
|
-
/* @__PURE__ */ (0,
|
|
43760
|
-
/* @__PURE__ */ (0,
|
|
43761
|
-
/* @__PURE__ */ (0,
|
|
44221
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex flex-col gap-3 sm:flex-row sm:gap-5", children: [
|
|
44222
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
44223
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.tokenLabel }),
|
|
44224
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43762
44225
|
Select,
|
|
43763
44226
|
{
|
|
43764
44227
|
items: tokenOptions,
|
|
@@ -43768,9 +44231,9 @@ var WithdrawAmountStep = ({
|
|
|
43768
44231
|
}
|
|
43769
44232
|
)
|
|
43770
44233
|
] }),
|
|
43771
|
-
/* @__PURE__ */ (0,
|
|
43772
|
-
/* @__PURE__ */ (0,
|
|
43773
|
-
/* @__PURE__ */ (0,
|
|
44234
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsxs)("div", { className: "flex-1 flex flex-col gap-2 min-w-0", children: [
|
|
44235
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label-strong text-agg-foreground", children: labels.withdraw.walletFlow.networkLabel }),
|
|
44236
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43774
44237
|
Select,
|
|
43775
44238
|
{
|
|
43776
44239
|
items: networkOptions,
|
|
@@ -43781,51 +44244,51 @@ var WithdrawAmountStep = ({
|
|
|
43781
44244
|
)
|
|
43782
44245
|
] })
|
|
43783
44246
|
] }),
|
|
43784
|
-
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0,
|
|
43785
|
-
previewUnviableMessage ? /* @__PURE__ */ (0,
|
|
44247
|
+
shouldShowWithdrawEstimate && withdrawEstimate ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(TransferFeeSummary, { estimate: withdrawEstimate, view: "withdraw" }) : null,
|
|
44248
|
+
previewUnviableMessage ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label text-agg-error", role: "alert", children: previewUnviableMessage }) : null
|
|
43786
44249
|
] }),
|
|
43787
|
-
/* @__PURE__ */ (0,
|
|
44250
|
+
/* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
43788
44251
|
Button,
|
|
43789
44252
|
{
|
|
43790
44253
|
variant: isValid && !isConfirming && !previewUnviable && !previewLoading ? "primary" : "secondary",
|
|
43791
44254
|
size: "large",
|
|
43792
44255
|
className: "w-full",
|
|
43793
44256
|
disabled: isDisabled,
|
|
43794
|
-
prefix: previewLoading && !isConfirming ? /* @__PURE__ */ (0,
|
|
44257
|
+
prefix: previewLoading && !isConfirming ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(LoadingIcon, { size: "small", className: "mr-2 text-current" }) : void 0,
|
|
43795
44258
|
onClick: onContinue,
|
|
43796
44259
|
children: isConfirming ? labels.common.loading : previewLoading ? labels.withdraw.walletFlow.calculatingFees : labels.withdraw.walletFlow.confirm
|
|
43797
44260
|
}
|
|
43798
44261
|
),
|
|
43799
|
-
error ? /* @__PURE__ */ (0,
|
|
44262
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime227.jsx)("p", { className: "agg-type-label text-agg-error text-center", role: "alert", children: error }) : null
|
|
43800
44263
|
] }) })
|
|
43801
44264
|
] });
|
|
43802
44265
|
};
|
|
43803
44266
|
|
|
43804
44267
|
// src/withdraw/steps/withdraw-success.tsx
|
|
43805
|
-
var
|
|
44268
|
+
var import_hooks119 = require("@agg-build/hooks");
|
|
43806
44269
|
init_modal();
|
|
43807
44270
|
init_button();
|
|
43808
44271
|
init_icon();
|
|
43809
44272
|
init_utils();
|
|
43810
|
-
var
|
|
43811
|
-
var SummaryRow3 = ({ label: label2, value }) => /* @__PURE__ */ (0,
|
|
43812
|
-
/* @__PURE__ */ (0,
|
|
43813
|
-
/* @__PURE__ */ (0,
|
|
44273
|
+
var import_jsx_runtime228 = require("react/jsx-runtime");
|
|
44274
|
+
var SummaryRow3 = ({ label: label2, value }) => /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-agg-separator py-2 last:border-b-0", children: [
|
|
44275
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("p", { className: "min-w-0 text-[12px] leading-4 font-agg-bold uppercase text-agg-muted-foreground", children: label2 }),
|
|
44276
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("p", { className: "min-w-0 text-right text-[14px] leading-5 text-agg-foreground", children: value })
|
|
43814
44277
|
] });
|
|
43815
|
-
var WithdrawCloseButton = ({ onClose, label: label2 }) => /* @__PURE__ */ (0,
|
|
44278
|
+
var WithdrawCloseButton = ({ onClose, label: label2 }) => /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43816
44279
|
"button",
|
|
43817
44280
|
{
|
|
43818
44281
|
type: "button",
|
|
43819
44282
|
className: "absolute right-8 top-7 flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
43820
44283
|
onClick: onClose,
|
|
43821
44284
|
"aria-label": label2,
|
|
43822
|
-
children: /* @__PURE__ */ (0,
|
|
44285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
43823
44286
|
}
|
|
43824
44287
|
);
|
|
43825
44288
|
var LoadingGlyph = ({
|
|
43826
44289
|
className,
|
|
43827
44290
|
enableAnimations
|
|
43828
|
-
}) => /* @__PURE__ */ (0,
|
|
44291
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43829
44292
|
"span",
|
|
43830
44293
|
{
|
|
43831
44294
|
"aria-hidden": "true",
|
|
@@ -43851,33 +44314,33 @@ var WithdrawLoadingStep = ({
|
|
|
43851
44314
|
lifecycleState,
|
|
43852
44315
|
onClose
|
|
43853
44316
|
}) => {
|
|
43854
|
-
const labels = (0,
|
|
44317
|
+
const labels = (0, import_hooks119.useLabels)();
|
|
43855
44318
|
const {
|
|
43856
44319
|
features: { enableAnimations }
|
|
43857
|
-
} = (0,
|
|
44320
|
+
} = (0, import_hooks119.useSdkUiConfig)();
|
|
43858
44321
|
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
43859
44322
|
const activeIndex = loadingActiveIndexFor(lifecycleState);
|
|
43860
44323
|
const loadingSteps = getLoadingSteps(walletFlowLabels);
|
|
43861
|
-
return /* @__PURE__ */ (0,
|
|
43862
|
-
/* @__PURE__ */ (0,
|
|
43863
|
-
/* @__PURE__ */ (0,
|
|
43864
|
-
/* @__PURE__ */ (0,
|
|
44324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(Modal.Body, { classNames: { root: "px-8 py-7" }, children: /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex flex-col gap-7", children: [
|
|
44325
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
44326
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold text-agg-foreground", children: walletFlowLabels.successTitle }),
|
|
44327
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43865
44328
|
"button",
|
|
43866
44329
|
{
|
|
43867
44330
|
type: "button",
|
|
43868
44331
|
className: "flex cursor-pointer items-center justify-center text-agg-foreground transition-colors hover:text-agg-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
43869
44332
|
onClick: onClose,
|
|
43870
44333
|
"aria-label": labels.common.close,
|
|
43871
|
-
children: /* @__PURE__ */ (0,
|
|
44334
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(CloseIcon, { className: "h-6 w-6" })
|
|
43872
44335
|
}
|
|
43873
44336
|
)
|
|
43874
44337
|
] }),
|
|
43875
|
-
/* @__PURE__ */ (0,
|
|
44338
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("div", { className: "flex flex-col gap-5", role: "status", "aria-live": "polite", children: loadingSteps.map((step, index) => {
|
|
43876
44339
|
const isComplete = index < activeIndex;
|
|
43877
44340
|
const isActive = index === activeIndex;
|
|
43878
44341
|
const textClassName = isActive || isComplete ? "text-agg-foreground" : "text-agg-muted-foreground";
|
|
43879
|
-
return /* @__PURE__ */ (0,
|
|
43880
|
-
isComplete ? /* @__PURE__ */ (0,
|
|
44342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
44343
|
+
isComplete ? /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43881
44344
|
Icon,
|
|
43882
44345
|
{
|
|
43883
44346
|
name: "check-circle",
|
|
@@ -43886,24 +44349,24 @@ var WithdrawLoadingStep = ({
|
|
|
43886
44349
|
"aria-hidden": "true"
|
|
43887
44350
|
}
|
|
43888
44351
|
) : null,
|
|
43889
|
-
isActive ? /* @__PURE__ */ (0,
|
|
44352
|
+
isActive ? /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43890
44353
|
LoadingGlyph,
|
|
43891
44354
|
{
|
|
43892
44355
|
enableAnimations,
|
|
43893
44356
|
className: "h-4 w-4 shrink-0 text-agg-primary"
|
|
43894
44357
|
}
|
|
43895
44358
|
) : null,
|
|
43896
|
-
!isComplete && !isActive ? /* @__PURE__ */ (0,
|
|
44359
|
+
!isComplete && !isActive ? /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43897
44360
|
"span",
|
|
43898
44361
|
{
|
|
43899
44362
|
"aria-hidden": "true",
|
|
43900
44363
|
className: "h-4 w-4 shrink-0 rounded-full border border-agg-separator"
|
|
43901
44364
|
}
|
|
43902
44365
|
) : null,
|
|
43903
|
-
/* @__PURE__ */ (0,
|
|
44366
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("p", { className: cn("min-w-0 flex-1 text-agg-base leading-agg-6", textClassName), children: step.label })
|
|
43904
44367
|
] }, step.id);
|
|
43905
44368
|
}) }),
|
|
43906
|
-
/* @__PURE__ */ (0,
|
|
44369
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: walletFlowLabels.loadingDescription })
|
|
43907
44370
|
] }) }) });
|
|
43908
44371
|
};
|
|
43909
44372
|
var resultCopyFor = ({
|
|
@@ -43938,7 +44401,7 @@ var WithdrawSuccessStep = ({
|
|
|
43938
44401
|
onRetry,
|
|
43939
44402
|
onClose
|
|
43940
44403
|
}) => {
|
|
43941
|
-
const labels = (0,
|
|
44404
|
+
const labels = (0, import_hooks119.useLabels)();
|
|
43942
44405
|
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
43943
44406
|
const { title: title2, description } = resultCopyFor({
|
|
43944
44407
|
status: resultStatus,
|
|
@@ -43946,10 +44409,10 @@ var WithdrawSuccessStep = ({
|
|
|
43946
44409
|
labels: walletFlowLabels
|
|
43947
44410
|
});
|
|
43948
44411
|
const isFailed = resultStatus === "failed";
|
|
43949
|
-
return /* @__PURE__ */ (0,
|
|
43950
|
-
/* @__PURE__ */ (0,
|
|
43951
|
-
/* @__PURE__ */ (0,
|
|
43952
|
-
/* @__PURE__ */ (0,
|
|
44412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)(Modal.Body, { classNames: { root: "px-10 py-12" }, children: [
|
|
44413
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(WithdrawCloseButton, { onClose, label: labels.common.close }),
|
|
44414
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex flex-col items-center justify-center gap-8 text-center", children: [
|
|
44415
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43953
44416
|
"div",
|
|
43954
44417
|
{
|
|
43955
44418
|
className: cn(
|
|
@@ -43957,12 +44420,12 @@ var WithdrawSuccessStep = ({
|
|
|
43957
44420
|
isFailed ? "bg-agg-error/15" : "bg-agg-success/15"
|
|
43958
44421
|
),
|
|
43959
44422
|
"aria-hidden": "true",
|
|
43960
|
-
children: isFailed ? /* @__PURE__ */ (0,
|
|
44423
|
+
children: isFailed ? /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(CloseIcon, { className: "h-6 w-6 text-agg-error" }) : /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(SuccessCheckIcon, { className: "h-6 w-6 text-agg-success" })
|
|
43961
44424
|
}
|
|
43962
44425
|
),
|
|
43963
|
-
/* @__PURE__ */ (0,
|
|
43964
|
-
/* @__PURE__ */ (0,
|
|
43965
|
-
/* @__PURE__ */ (0,
|
|
44426
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex w-full flex-col items-center gap-3 text-center text-agg-foreground", children: [
|
|
44427
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)("h3", { className: "text-agg-2xl leading-agg-8 font-agg-bold", children: title2 }),
|
|
44428
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43966
44429
|
"p",
|
|
43967
44430
|
{
|
|
43968
44431
|
className: "max-w-[400px] text-agg-base leading-agg-6",
|
|
@@ -43971,35 +44434,35 @@ var WithdrawSuccessStep = ({
|
|
|
43971
44434
|
}
|
|
43972
44435
|
)
|
|
43973
44436
|
] }),
|
|
43974
|
-
!isFailed ? /* @__PURE__ */ (0,
|
|
43975
|
-
/* @__PURE__ */ (0,
|
|
44437
|
+
!isFailed ? /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex w-full max-w-[400px] flex-col rounded-agg-lg border border-agg-separator bg-agg-secondary px-3 py-1 text-left", children: [
|
|
44438
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43976
44439
|
SummaryRow3,
|
|
43977
44440
|
{
|
|
43978
44441
|
label: walletFlowLabels.summary.requestedWithdrawal,
|
|
43979
44442
|
value: requestedWithdrawal
|
|
43980
44443
|
}
|
|
43981
44444
|
),
|
|
43982
|
-
/* @__PURE__ */ (0,
|
|
44445
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(
|
|
43983
44446
|
SummaryRow3,
|
|
43984
44447
|
{
|
|
43985
44448
|
label: walletFlowLabels.summary.amountReceived,
|
|
43986
44449
|
value: summary.amountReceived
|
|
43987
44450
|
}
|
|
43988
44451
|
),
|
|
43989
|
-
/* @__PURE__ */ (0,
|
|
43990
|
-
/* @__PURE__ */ (0,
|
|
43991
|
-
/* @__PURE__ */ (0,
|
|
44452
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(SummaryRow3, { label: walletFlowLabels.summary.fees, value: summary.fees }),
|
|
44453
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(SummaryRow3, { label: walletFlowLabels.summary.network, value: summary.network }),
|
|
44454
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(SummaryRow3, { label: walletFlowLabels.summary.toWallet, value: summary.toWallet })
|
|
43992
44455
|
] }) : null,
|
|
43993
|
-
isFailed ? /* @__PURE__ */ (0,
|
|
43994
|
-
/* @__PURE__ */ (0,
|
|
43995
|
-
/* @__PURE__ */ (0,
|
|
43996
|
-
] }) : /* @__PURE__ */ (0,
|
|
44456
|
+
isFailed ? /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
|
|
44457
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onClose, children: walletFlowLabels.close }),
|
|
44458
|
+
/* @__PURE__ */ (0, import_jsx_runtime228.jsx)(Button, { variant: "primary", size: "large", className: "w-[123px]", onClick: onRetry, children: walletFlowLabels.retry })
|
|
44459
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(Button, { variant: "secondary", size: "large", className: "w-[120px]", onClick: onDone, children: labels.withdraw.done })
|
|
43997
44460
|
] })
|
|
43998
44461
|
] }) });
|
|
43999
44462
|
};
|
|
44000
44463
|
|
|
44001
44464
|
// src/withdraw/index.tsx
|
|
44002
|
-
var
|
|
44465
|
+
var import_jsx_runtime229 = require("react/jsx-runtime");
|
|
44003
44466
|
var DEFAULT_TOKEN_DECIMALS2 = 6;
|
|
44004
44467
|
var TOKEN_DECIMALS_BY_SYMBOL2 = {
|
|
44005
44468
|
BNB: 18,
|
|
@@ -44082,7 +44545,7 @@ function WithdrawModalSelfDriven({
|
|
|
44082
44545
|
onOpenChange
|
|
44083
44546
|
}) {
|
|
44084
44547
|
const withdrawProps = (0, import_withdraw.useWithdrawFlow)({ open, onOpenChange });
|
|
44085
|
-
return /* @__PURE__ */ (0,
|
|
44548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(WithdrawModalControlled, __spreadValues({}, withdrawProps));
|
|
44086
44549
|
}
|
|
44087
44550
|
function WithdrawModalControlled({
|
|
44088
44551
|
open,
|
|
@@ -44096,14 +44559,14 @@ function WithdrawModalControlled({
|
|
|
44096
44559
|
onSelectWithdrawProvider,
|
|
44097
44560
|
onDoneWithdraw
|
|
44098
44561
|
}) {
|
|
44099
|
-
const [flowState, setFlowState] = (0,
|
|
44562
|
+
const [flowState, setFlowState] = (0, import_react73.useState)({
|
|
44100
44563
|
status: "form",
|
|
44101
44564
|
formStep: "method"
|
|
44102
44565
|
});
|
|
44103
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
44104
|
-
const [confirmError, setConfirmError] = (0,
|
|
44566
|
+
const [isConfirming, setIsConfirming] = (0, import_react73.useState)(false);
|
|
44567
|
+
const [confirmError, setConfirmError] = (0, import_react73.useState)(null);
|
|
44105
44568
|
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
|
|
44106
|
-
(0,
|
|
44569
|
+
(0, import_react73.useEffect)(() => {
|
|
44107
44570
|
if (!open) {
|
|
44108
44571
|
setFlowState({ status: "form", formStep: "method" });
|
|
44109
44572
|
setIsConfirming(false);
|
|
@@ -44111,7 +44574,7 @@ function WithdrawModalControlled({
|
|
|
44111
44574
|
resetWithdrawalLifecycle();
|
|
44112
44575
|
}
|
|
44113
44576
|
}, [open, resetWithdrawalLifecycle]);
|
|
44114
|
-
(0,
|
|
44577
|
+
(0, import_react73.useEffect)(() => {
|
|
44115
44578
|
if (flowState.status !== "loading") return;
|
|
44116
44579
|
if (!withdrawalLifecycleState.terminal) return;
|
|
44117
44580
|
if (withdrawalLifecycleState.status === "completed") {
|
|
@@ -44180,15 +44643,15 @@ function WithdrawModalControlled({
|
|
|
44180
44643
|
tokenSymbol: withdrawFlow.selectedToken,
|
|
44181
44644
|
chainId: withdrawFlow.selectedNetwork
|
|
44182
44645
|
});
|
|
44183
|
-
return /* @__PURE__ */ (0,
|
|
44184
|
-
flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ (0,
|
|
44646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime229.jsxs)(Modal.Container, { maxWidth: modalMaxWidth, "aria-label": "Withdraw", children: [
|
|
44647
|
+
flowState.status === "form" && flowState.formStep === "method" ? /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
44185
44648
|
WithdrawMethodStep,
|
|
44186
44649
|
{
|
|
44187
44650
|
balance: withdrawFlow.balance,
|
|
44188
44651
|
onSelectMethod: () => setFlowState({ status: "form", formStep: "withdraw-amount" })
|
|
44189
44652
|
}
|
|
44190
44653
|
) : null,
|
|
44191
|
-
flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ (0,
|
|
44654
|
+
flowState.status === "form" && flowState.formStep === "withdraw-amount" ? /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
44192
44655
|
WithdrawAmountStep,
|
|
44193
44656
|
{
|
|
44194
44657
|
amount: withdrawFlow.amount,
|
|
@@ -44214,14 +44677,14 @@ function WithdrawModalControlled({
|
|
|
44214
44677
|
onContinue: handleConfirm
|
|
44215
44678
|
}
|
|
44216
44679
|
) : null,
|
|
44217
|
-
flowState.status === "loading" ? /* @__PURE__ */ (0,
|
|
44680
|
+
flowState.status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
44218
44681
|
WithdrawLoadingStep,
|
|
44219
44682
|
{
|
|
44220
44683
|
lifecycleState: withdrawalLifecycleState,
|
|
44221
44684
|
onClose: () => handleOpenChange(false)
|
|
44222
44685
|
}
|
|
44223
44686
|
) : null,
|
|
44224
|
-
flowState.status === "success" || flowState.status === "partial_success" || flowState.status === "failed" ? /* @__PURE__ */ (0,
|
|
44687
|
+
flowState.status === "success" || flowState.status === "partial_success" || flowState.status === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(
|
|
44225
44688
|
WithdrawSuccessStep,
|
|
44226
44689
|
{
|
|
44227
44690
|
summary: terminalSummary,
|
|
@@ -44238,34 +44701,34 @@ function WithdrawModalControlled({
|
|
|
44238
44701
|
}
|
|
44239
44702
|
var WithdrawModal = (props) => {
|
|
44240
44703
|
if (isControlledWithdrawModalProps(props)) {
|
|
44241
|
-
return /* @__PURE__ */ (0,
|
|
44704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(WithdrawModalControlled, __spreadValues({}, props));
|
|
44242
44705
|
}
|
|
44243
|
-
return /* @__PURE__ */ (0,
|
|
44706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime229.jsx)(WithdrawModalSelfDriven, __spreadValues({}, props));
|
|
44244
44707
|
};
|
|
44245
44708
|
WithdrawModal.displayName = "WithdrawModal";
|
|
44246
44709
|
|
|
44247
44710
|
// src/paper-trading/paper-trading-onboarding.tsx
|
|
44248
|
-
var
|
|
44711
|
+
var import_hooks121 = require("@agg-build/hooks");
|
|
44249
44712
|
init_utils();
|
|
44250
44713
|
|
|
44251
44714
|
// src/paper-trading/paper-onboarding-modal.tsx
|
|
44252
|
-
var
|
|
44253
|
-
var
|
|
44715
|
+
var import_react74 = require("react");
|
|
44716
|
+
var import_hooks120 = require("@agg-build/hooks");
|
|
44254
44717
|
init_utils();
|
|
44255
44718
|
init_button();
|
|
44256
44719
|
init_icon();
|
|
44257
44720
|
init_modal();
|
|
44258
|
-
var
|
|
44721
|
+
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
44259
44722
|
var PaperOnboardingModal = ({
|
|
44260
44723
|
open,
|
|
44261
44724
|
onDismiss,
|
|
44262
44725
|
startingBalanceLabel,
|
|
44263
44726
|
classNames
|
|
44264
44727
|
}) => {
|
|
44265
|
-
const labels = (0,
|
|
44728
|
+
const labels = (0, import_hooks120.useLabels)();
|
|
44266
44729
|
const copy = labels.paperTrading.onboarding;
|
|
44267
|
-
const [stepIndex, setStepIndex] = (0,
|
|
44268
|
-
const steps = (0,
|
|
44730
|
+
const [stepIndex, setStepIndex] = (0, import_react74.useState)(0);
|
|
44731
|
+
const steps = (0, import_react74.useMemo)(
|
|
44269
44732
|
() => [
|
|
44270
44733
|
{
|
|
44271
44734
|
key: "realMarkets",
|
|
@@ -44292,17 +44755,17 @@ var PaperOnboardingModal = ({
|
|
|
44292
44755
|
const isFirst = stepIndex === 0;
|
|
44293
44756
|
const isLast = stepIndex === total - 1;
|
|
44294
44757
|
const step = steps[stepIndex];
|
|
44295
|
-
const handleBack = (0,
|
|
44758
|
+
const handleBack = (0, import_react74.useCallback)(() => {
|
|
44296
44759
|
setStepIndex((current) => Math.max(0, current - 1));
|
|
44297
44760
|
}, []);
|
|
44298
|
-
const handleNext = (0,
|
|
44761
|
+
const handleNext = (0, import_react74.useCallback)(() => {
|
|
44299
44762
|
if (isLast) {
|
|
44300
44763
|
onDismiss();
|
|
44301
44764
|
return;
|
|
44302
44765
|
}
|
|
44303
44766
|
setStepIndex((current) => Math.min(total - 1, current + 1));
|
|
44304
44767
|
}, [isLast, onDismiss, total]);
|
|
44305
|
-
const handleOpenChange = (0,
|
|
44768
|
+
const handleOpenChange = (0, import_react74.useCallback)(
|
|
44306
44769
|
(next) => {
|
|
44307
44770
|
if (next) return;
|
|
44308
44771
|
setStepIndex(0);
|
|
@@ -44310,7 +44773,7 @@ var PaperOnboardingModal = ({
|
|
|
44310
44773
|
},
|
|
44311
44774
|
[onDismiss]
|
|
44312
44775
|
);
|
|
44313
|
-
return /* @__PURE__ */ (0,
|
|
44776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44314
44777
|
Modal.Container,
|
|
44315
44778
|
{
|
|
44316
44779
|
maxWidth: "480px",
|
|
@@ -44328,9 +44791,9 @@ var PaperOnboardingModal = ({
|
|
|
44328
44791
|
// Only the radius needs overriding, from the container's default 16.
|
|
44329
44792
|
container: cn("rounded-agg-xl! md:rounded-agg-xl!", classNames == null ? void 0 : classNames.card)
|
|
44330
44793
|
},
|
|
44331
|
-
children: /* @__PURE__ */ (0,
|
|
44332
|
-
/* @__PURE__ */ (0,
|
|
44333
|
-
/* @__PURE__ */ (0,
|
|
44794
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: cn("agg-paper-onboarding", "flex w-full flex-col gap-5 p-6"), children: [
|
|
44795
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: "flex w-full items-start justify-center gap-5", children: [
|
|
44796
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44334
44797
|
"div",
|
|
44335
44798
|
{
|
|
44336
44799
|
className: cn(
|
|
@@ -44338,12 +44801,12 @@ var PaperOnboardingModal = ({
|
|
|
44338
44801
|
"rounded-agg-lg bg-agg-primary/10 text-agg-primary",
|
|
44339
44802
|
classNames == null ? void 0 : classNames.icon
|
|
44340
44803
|
),
|
|
44341
|
-
children: /* @__PURE__ */ (0,
|
|
44804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(Icon, { name: step.icon, className: "!h-6 !w-6", "aria-hidden": "true" })
|
|
44342
44805
|
}
|
|
44343
44806
|
),
|
|
44344
|
-
/* @__PURE__ */ (0,
|
|
44345
|
-
/* @__PURE__ */ (0,
|
|
44346
|
-
/* @__PURE__ */ (0,
|
|
44807
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-2 break-words", children: [
|
|
44808
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
44809
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44347
44810
|
"p",
|
|
44348
44811
|
{
|
|
44349
44812
|
className: cn(
|
|
@@ -44356,7 +44819,7 @@ var PaperOnboardingModal = ({
|
|
|
44356
44819
|
children: copy.stepEyebrow({ current: stepIndex + 1, total })
|
|
44357
44820
|
}
|
|
44358
44821
|
),
|
|
44359
|
-
/* @__PURE__ */ (0,
|
|
44822
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44360
44823
|
"p",
|
|
44361
44824
|
{
|
|
44362
44825
|
className: cn(
|
|
@@ -44367,11 +44830,11 @@ var PaperOnboardingModal = ({
|
|
|
44367
44830
|
}
|
|
44368
44831
|
)
|
|
44369
44832
|
] }),
|
|
44370
|
-
/* @__PURE__ */ (0,
|
|
44833
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)("p", { className: cn("text-agg-sm leading-agg-5 text-agg-foreground", classNames == null ? void 0 : classNames.body), children: step.body })
|
|
44371
44834
|
] })
|
|
44372
44835
|
] }),
|
|
44373
|
-
/* @__PURE__ */ (0,
|
|
44374
|
-
/* @__PURE__ */ (0,
|
|
44836
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: cn("flex w-full items-center justify-between", classNames == null ? void 0 : classNames.footer), children: [
|
|
44837
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)("div", { className: cn("flex items-center gap-1", classNames == null ? void 0 : classNames.dots), "aria-hidden": "true", children: steps.map((dotStep, index) => /* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44375
44838
|
"span",
|
|
44376
44839
|
{
|
|
44377
44840
|
className: cn(
|
|
@@ -44381,8 +44844,8 @@ var PaperOnboardingModal = ({
|
|
|
44381
44844
|
},
|
|
44382
44845
|
dotStep.key
|
|
44383
44846
|
)) }),
|
|
44384
|
-
/* @__PURE__ */ (0,
|
|
44385
|
-
/* @__PURE__ */ (0,
|
|
44847
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsxs)("div", { className: "flex items-start gap-3", children: [
|
|
44848
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44386
44849
|
Button,
|
|
44387
44850
|
{
|
|
44388
44851
|
variant: "secondary",
|
|
@@ -44392,7 +44855,7 @@ var PaperOnboardingModal = ({
|
|
|
44392
44855
|
children: isFirst ? copy.skip : copy.back
|
|
44393
44856
|
}
|
|
44394
44857
|
),
|
|
44395
|
-
/* @__PURE__ */ (0,
|
|
44858
|
+
/* @__PURE__ */ (0, import_jsx_runtime230.jsx)(
|
|
44396
44859
|
Button,
|
|
44397
44860
|
{
|
|
44398
44861
|
variant: "primary",
|
|
@@ -44411,15 +44874,15 @@ var PaperOnboardingModal = ({
|
|
|
44411
44874
|
PaperOnboardingModal.displayName = "PaperOnboardingModal";
|
|
44412
44875
|
|
|
44413
44876
|
// src/paper-trading/paper-trading-onboarding.tsx
|
|
44414
|
-
var
|
|
44877
|
+
var import_jsx_runtime231 = require("react/jsx-runtime");
|
|
44415
44878
|
var FALLBACK_STARTING_BALANCE = 1e4;
|
|
44416
44879
|
var PaperTradingOnboarding = ({
|
|
44417
44880
|
classNames
|
|
44418
44881
|
}) => {
|
|
44419
|
-
const { isOpen, dismiss } = (0,
|
|
44420
|
-
const { paperStartingBalance } = (0,
|
|
44882
|
+
const { isOpen, dismiss } = (0, import_hooks121.usePaperOnboarding)();
|
|
44883
|
+
const { paperStartingBalance } = (0, import_hooks121.useAppConfig)();
|
|
44421
44884
|
if (!isOpen) return null;
|
|
44422
|
-
return /* @__PURE__ */ (0,
|
|
44885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime231.jsx)(
|
|
44423
44886
|
PaperOnboardingModal,
|
|
44424
44887
|
{
|
|
44425
44888
|
open: true,
|
|
@@ -44434,8 +44897,8 @@ var PaperTradingOnboarding = ({
|
|
|
44434
44897
|
PaperTradingOnboarding.displayName = "PaperTradingOnboarding";
|
|
44435
44898
|
|
|
44436
44899
|
// src/profile/index.tsx
|
|
44437
|
-
var
|
|
44438
|
-
var
|
|
44900
|
+
var import_react77 = require("react");
|
|
44901
|
+
var import_hooks124 = require("@agg-build/hooks");
|
|
44439
44902
|
var import_sdk32 = require("@agg-build/sdk");
|
|
44440
44903
|
init_modal();
|
|
44441
44904
|
init_icon();
|
|
@@ -44461,11 +44924,11 @@ var getProfileTabItems = () => [
|
|
|
44461
44924
|
];
|
|
44462
44925
|
|
|
44463
44926
|
// src/profile/tabs/about-tab.tsx
|
|
44464
|
-
var
|
|
44465
|
-
var
|
|
44927
|
+
var import_react75 = require("react");
|
|
44928
|
+
var import_hooks122 = require("@agg-build/hooks");
|
|
44466
44929
|
init_utils();
|
|
44467
44930
|
init_primitives();
|
|
44468
|
-
var
|
|
44931
|
+
var import_jsx_runtime232 = require("react/jsx-runtime");
|
|
44469
44932
|
var AboutTab = ({
|
|
44470
44933
|
avatarPreview,
|
|
44471
44934
|
onDeleteProfile: _onDeleteProfile,
|
|
@@ -44475,13 +44938,13 @@ var AboutTab = ({
|
|
|
44475
44938
|
draftAvatarPreview,
|
|
44476
44939
|
avatarError: _avatarError
|
|
44477
44940
|
}) => {
|
|
44478
|
-
const labels = (0,
|
|
44479
|
-
const fileInputRef = (0,
|
|
44480
|
-
const handleAvatarClick = (0,
|
|
44941
|
+
const labels = (0, import_hooks122.useLabels)();
|
|
44942
|
+
const fileInputRef = (0, import_react75.useRef)(null);
|
|
44943
|
+
const handleAvatarClick = (0, import_react75.useCallback)(() => {
|
|
44481
44944
|
var _a;
|
|
44482
44945
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
44483
44946
|
}, []);
|
|
44484
|
-
const handleFileChange = (0,
|
|
44947
|
+
const handleFileChange = (0, import_react75.useCallback)(
|
|
44485
44948
|
(e) => {
|
|
44486
44949
|
var _a;
|
|
44487
44950
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -44497,8 +44960,8 @@ var AboutTab = ({
|
|
|
44497
44960
|
);
|
|
44498
44961
|
const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
|
|
44499
44962
|
const hasAvatarPreview = Boolean(resolvedPreview);
|
|
44500
|
-
return /* @__PURE__ */ (0,
|
|
44501
|
-
/* @__PURE__ */ (0,
|
|
44963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime232.jsx)("div", { className: "agg-profile-about flex flex-col gap-8", children: /* @__PURE__ */ (0, import_jsx_runtime232.jsxs)("div", { className: "agg-profile-avatar-section flex w-full items-center gap-6", children: [
|
|
44964
|
+
/* @__PURE__ */ (0, import_jsx_runtime232.jsxs)(
|
|
44502
44965
|
"button",
|
|
44503
44966
|
{
|
|
44504
44967
|
type: "button",
|
|
@@ -44515,13 +44978,13 @@ var AboutTab = ({
|
|
|
44515
44978
|
),
|
|
44516
44979
|
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
44517
44980
|
children: [
|
|
44518
|
-
!hasAvatarPreview ? /* @__PURE__ */ (0,
|
|
44981
|
+
!hasAvatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44519
44982
|
"svg",
|
|
44520
44983
|
{
|
|
44521
44984
|
"aria-hidden": true,
|
|
44522
44985
|
viewBox: "0 0 80 80",
|
|
44523
44986
|
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
44524
|
-
children: /* @__PURE__ */ (0,
|
|
44987
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44525
44988
|
"circle",
|
|
44526
44989
|
{
|
|
44527
44990
|
cx: "40",
|
|
@@ -44535,18 +44998,18 @@ var AboutTab = ({
|
|
|
44535
44998
|
)
|
|
44536
44999
|
}
|
|
44537
45000
|
) : null,
|
|
44538
|
-
resolvedPreview ? /* @__PURE__ */ (0,
|
|
45001
|
+
resolvedPreview ? /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44539
45002
|
RemoteImage,
|
|
44540
45003
|
{
|
|
44541
45004
|
src: resolvedPreview,
|
|
44542
45005
|
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
44543
45006
|
className: "h-full w-full object-cover"
|
|
44544
45007
|
}
|
|
44545
|
-
) : /* @__PURE__ */ (0,
|
|
45008
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime232.jsx)(Icon, { name: "profile", className: "h-7 w-7 text-agg-muted-foreground" })
|
|
44546
45009
|
]
|
|
44547
45010
|
}
|
|
44548
45011
|
),
|
|
44549
|
-
/* @__PURE__ */ (0,
|
|
45012
|
+
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44550
45013
|
"input",
|
|
44551
45014
|
{
|
|
44552
45015
|
ref: fileInputRef,
|
|
@@ -44557,8 +45020,8 @@ var AboutTab = ({
|
|
|
44557
45020
|
"aria-hidden": "true"
|
|
44558
45021
|
}
|
|
44559
45022
|
),
|
|
44560
|
-
/* @__PURE__ */ (0,
|
|
44561
|
-
/* @__PURE__ */ (0,
|
|
45023
|
+
/* @__PURE__ */ (0, import_jsx_runtime232.jsxs)("div", { className: "agg-form-section flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
45024
|
+
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44562
45025
|
"label",
|
|
44563
45026
|
{
|
|
44564
45027
|
htmlFor: "profile-username",
|
|
@@ -44566,7 +45029,7 @@ var AboutTab = ({
|
|
|
44566
45029
|
children: "Username"
|
|
44567
45030
|
}
|
|
44568
45031
|
),
|
|
44569
|
-
/* @__PURE__ */ (0,
|
|
45032
|
+
/* @__PURE__ */ (0, import_jsx_runtime232.jsx)(
|
|
44570
45033
|
"input",
|
|
44571
45034
|
{
|
|
44572
45035
|
id: "profile-username",
|
|
@@ -44595,9 +45058,9 @@ AboutTab.displayName = "AboutTab";
|
|
|
44595
45058
|
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
44596
45059
|
init_icon();
|
|
44597
45060
|
init_utils();
|
|
44598
|
-
var
|
|
44599
|
-
var SectionTitle = ({ children }) => /* @__PURE__ */ (0,
|
|
44600
|
-
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0,
|
|
45061
|
+
var import_jsx_runtime233 = require("react/jsx-runtime");
|
|
45062
|
+
var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime233.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
45063
|
+
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44601
45064
|
"div",
|
|
44602
45065
|
{
|
|
44603
45066
|
className: cn(
|
|
@@ -44613,11 +45076,11 @@ var AccountIdentity = ({
|
|
|
44613
45076
|
icon,
|
|
44614
45077
|
label: label2,
|
|
44615
45078
|
iconClassName
|
|
44616
|
-
}) => /* @__PURE__ */ (0,
|
|
44617
|
-
/* @__PURE__ */ (0,
|
|
44618
|
-
/* @__PURE__ */ (0,
|
|
45079
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
45080
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)("span", { className: cn("flex h-5 w-5 shrink-0 items-center justify-center", iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Icon, { name: icon, size: "small", color: "currentColor" }) }),
|
|
45081
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: label2 })
|
|
44619
45082
|
] });
|
|
44620
|
-
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
45083
|
+
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44621
45084
|
"button",
|
|
44622
45085
|
{
|
|
44623
45086
|
type: "button",
|
|
@@ -44626,7 +45089,7 @@ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime2
|
|
|
44626
45089
|
children: "Connect"
|
|
44627
45090
|
}
|
|
44628
45091
|
);
|
|
44629
|
-
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
45092
|
+
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44630
45093
|
"button",
|
|
44631
45094
|
{
|
|
44632
45095
|
type: "button",
|
|
@@ -44635,7 +45098,7 @@ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runti
|
|
|
44635
45098
|
children: "Disconnect"
|
|
44636
45099
|
}
|
|
44637
45100
|
);
|
|
44638
|
-
var VerifiedBadge = () => /* @__PURE__ */ (0,
|
|
45101
|
+
var VerifiedBadge = () => /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" });
|
|
44639
45102
|
var getWalletIconName = (wallet) => {
|
|
44640
45103
|
const chain = wallet.chain.toLowerCase();
|
|
44641
45104
|
if (chain === "solana" || chain === "svm") {
|
|
@@ -44653,12 +45116,12 @@ var ConnectedAccountRow = ({
|
|
|
44653
45116
|
onDisconnect
|
|
44654
45117
|
}) => {
|
|
44655
45118
|
const displayLabel = connected ? connectedLabel != null ? connectedLabel : label2 : label2;
|
|
44656
|
-
return /* @__PURE__ */ (0,
|
|
44657
|
-
/* @__PURE__ */ (0,
|
|
44658
|
-
/* @__PURE__ */ (0,
|
|
44659
|
-
connected ? /* @__PURE__ */ (0,
|
|
45119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(AccountRow, { className: "agg-social-account-row gap-4", children: [
|
|
45120
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
45121
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(AccountIdentity, { icon, label: displayLabel, iconClassName }),
|
|
45122
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(VerifiedBadge, {}) : null
|
|
44660
45123
|
] }),
|
|
44661
|
-
connected ? /* @__PURE__ */ (0,
|
|
45124
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(DisconnectTextButton, { onClick: onDisconnect }) : /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(ConnectTextButton, { onClick: onConnect })
|
|
44662
45125
|
] });
|
|
44663
45126
|
};
|
|
44664
45127
|
var AccountsWalletsTab = ({
|
|
@@ -44677,11 +45140,11 @@ var AccountsWalletsTab = ({
|
|
|
44677
45140
|
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
44678
45141
|
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
44679
45142
|
const hasEmail = Boolean(email);
|
|
44680
|
-
return /* @__PURE__ */ (0,
|
|
44681
|
-
/* @__PURE__ */ (0,
|
|
44682
|
-
/* @__PURE__ */ (0,
|
|
44683
|
-
/* @__PURE__ */ (0,
|
|
44684
|
-
/* @__PURE__ */ (0,
|
|
45143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "agg-accounts-wallets-tab flex flex-col gap-6", children: [
|
|
45144
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
45145
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(SectionTitle, { children: "Connected accounts" }),
|
|
45146
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "agg-social-accounts-list flex flex-col gap-4", children: [
|
|
45147
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44685
45148
|
ConnectedAccountRow,
|
|
44686
45149
|
{
|
|
44687
45150
|
icon: "google",
|
|
@@ -44693,7 +45156,7 @@ var AccountsWalletsTab = ({
|
|
|
44693
45156
|
onDisconnect: onDisconnectGoogle
|
|
44694
45157
|
}
|
|
44695
45158
|
),
|
|
44696
|
-
/* @__PURE__ */ (0,
|
|
45159
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44697
45160
|
ConnectedAccountRow,
|
|
44698
45161
|
{
|
|
44699
45162
|
icon: "apple",
|
|
@@ -44705,7 +45168,7 @@ var AccountsWalletsTab = ({
|
|
|
44705
45168
|
onDisconnect: onDisconnectApple
|
|
44706
45169
|
}
|
|
44707
45170
|
),
|
|
44708
|
-
/* @__PURE__ */ (0,
|
|
45171
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44709
45172
|
ConnectedAccountRow,
|
|
44710
45173
|
{
|
|
44711
45174
|
icon: "twitter",
|
|
@@ -44717,7 +45180,7 @@ var AccountsWalletsTab = ({
|
|
|
44717
45180
|
onDisconnect: onDisconnectTwitter
|
|
44718
45181
|
}
|
|
44719
45182
|
),
|
|
44720
|
-
/* @__PURE__ */ (0,
|
|
45183
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44721
45184
|
ConnectedAccountRow,
|
|
44722
45185
|
{
|
|
44723
45186
|
icon: "email",
|
|
@@ -44730,12 +45193,12 @@ var AccountsWalletsTab = ({
|
|
|
44730
45193
|
)
|
|
44731
45194
|
] })
|
|
44732
45195
|
] }),
|
|
44733
|
-
wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
44734
|
-
/* @__PURE__ */ (0,
|
|
44735
|
-
/* @__PURE__ */ (0,
|
|
45196
|
+
wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
45197
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(SectionTitle, { children: "Wallets" }),
|
|
45198
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)("div", { className: "flex flex-col gap-2", children: wallets.map((wallet) => {
|
|
44736
45199
|
var _a;
|
|
44737
|
-
return /* @__PURE__ */ (0,
|
|
44738
|
-
/* @__PURE__ */ (0,
|
|
45200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime233.jsx)(AccountRow, { className: "gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
45201
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(
|
|
44739
45202
|
AccountIdentity,
|
|
44740
45203
|
{
|
|
44741
45204
|
icon: getWalletIconName(wallet),
|
|
@@ -44743,7 +45206,7 @@ var AccountsWalletsTab = ({
|
|
|
44743
45206
|
label: (_a = wallet.displayAddress) != null ? _a : wallet.address
|
|
44744
45207
|
}
|
|
44745
45208
|
),
|
|
44746
|
-
/* @__PURE__ */ (0,
|
|
45209
|
+
/* @__PURE__ */ (0, import_jsx_runtime233.jsx)(VerifiedBadge, {})
|
|
44747
45210
|
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
44748
45211
|
}) })
|
|
44749
45212
|
] }) : null
|
|
@@ -44752,12 +45215,12 @@ var AccountsWalletsTab = ({
|
|
|
44752
45215
|
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
44753
45216
|
|
|
44754
45217
|
// src/profile/tabs/trading-access-tab.tsx
|
|
44755
|
-
var
|
|
44756
|
-
var
|
|
45218
|
+
var import_hooks123 = require("@agg-build/hooks");
|
|
45219
|
+
var import_react76 = require("react");
|
|
44757
45220
|
init_icon();
|
|
44758
45221
|
init_venue_logo();
|
|
44759
45222
|
init_utils();
|
|
44760
|
-
var
|
|
45223
|
+
var import_jsx_runtime234 = require("react/jsx-runtime");
|
|
44761
45224
|
var TRADING_ACCESS_VENUES = [
|
|
44762
45225
|
"kalshi",
|
|
44763
45226
|
"polymarket",
|
|
@@ -44772,8 +45235,8 @@ var TRADING_ACCESS_VENUES = [
|
|
|
44772
45235
|
"pred"
|
|
44773
45236
|
];
|
|
44774
45237
|
var TRADING_ACCESS_VENUE_ITEMS = TRADING_ACCESS_VENUES.map((id) => ({ id }));
|
|
44775
|
-
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0,
|
|
44776
|
-
var AccessRow = ({ children }) => /* @__PURE__ */ (0,
|
|
45238
|
+
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime234.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
45239
|
+
var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(
|
|
44777
45240
|
"div",
|
|
44778
45241
|
{
|
|
44779
45242
|
className: cn(
|
|
@@ -44785,17 +45248,17 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime229.jsx)
|
|
|
44785
45248
|
}
|
|
44786
45249
|
);
|
|
44787
45250
|
var AvailableStatus = () => {
|
|
44788
|
-
const labels = (0,
|
|
44789
|
-
return /* @__PURE__ */ (0,
|
|
44790
|
-
/* @__PURE__ */ (0,
|
|
44791
|
-
/* @__PURE__ */ (0,
|
|
45251
|
+
const labels = (0, import_hooks123.useLabels)();
|
|
45252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
45253
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(Icon, { name: "check-badge", size: "small", className: "text-agg-primary" }),
|
|
45254
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: labels.trading.tradingAccessAvailable })
|
|
44792
45255
|
] });
|
|
44793
45256
|
};
|
|
44794
45257
|
var GeoblockedStatus = () => {
|
|
44795
|
-
const labels = (0,
|
|
44796
|
-
return /* @__PURE__ */ (0,
|
|
44797
|
-
/* @__PURE__ */ (0,
|
|
44798
|
-
/* @__PURE__ */ (0,
|
|
45258
|
+
const labels = (0, import_hooks123.useLabels)();
|
|
45259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "flex items-center gap-2 text-agg-muted-foreground", children: [
|
|
45260
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" }),
|
|
45261
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap", children: labels.trading.venueUnavailableInRegion })
|
|
44799
45262
|
] });
|
|
44800
45263
|
};
|
|
44801
45264
|
var TradingAccessTab = ({
|
|
@@ -44803,21 +45266,21 @@ var TradingAccessTab = ({
|
|
|
44803
45266
|
onConnectKalshi,
|
|
44804
45267
|
onDisconnectKalshi
|
|
44805
45268
|
}) => {
|
|
44806
|
-
const labels = (0,
|
|
44807
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
44808
|
-
const { isLocationBlocked } = (0,
|
|
44809
|
-
const visibleVenues = (0,
|
|
44810
|
-
() => (0,
|
|
45269
|
+
const labels = (0, import_hooks123.useLabels)();
|
|
45270
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks123.useAppConfig)();
|
|
45271
|
+
const { isLocationBlocked } = (0, import_hooks123.useGeoBlock)();
|
|
45272
|
+
const visibleVenues = (0, import_react76.useMemo)(
|
|
45273
|
+
() => (0, import_hooks123.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
|
|
44811
45274
|
[disabledVenues]
|
|
44812
45275
|
);
|
|
44813
|
-
return /* @__PURE__ */ (0,
|
|
44814
|
-
/* @__PURE__ */ (0,
|
|
44815
|
-
/* @__PURE__ */ (0,
|
|
45276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
|
|
45277
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(SectionTitle2, { children: labels.trading.tradingAccessVenues }),
|
|
45278
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)("div", { className: "flex flex-col gap-3", children: visibleVenues.map(({ id: venue }) => {
|
|
44816
45279
|
var _a;
|
|
44817
45280
|
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((account) => account.venue === venue);
|
|
44818
45281
|
const isKalshi = venue === "kalshi";
|
|
44819
45282
|
const isConnected = (venueAccount == null ? void 0 : venueAccount.status) === "active";
|
|
44820
|
-
const availabilityState = (0,
|
|
45283
|
+
const availabilityState = (0, import_hooks123.getVenueAvailabilityState)({
|
|
44821
45284
|
venueId: venue,
|
|
44822
45285
|
disabledVenues,
|
|
44823
45286
|
isConfigLoading: isKalshi && isAppConfigLoading,
|
|
@@ -44825,12 +45288,12 @@ var TradingAccessTab = ({
|
|
|
44825
45288
|
});
|
|
44826
45289
|
const displayName = (_a = venueLogoLabels[venue]) != null ? _a : venue;
|
|
44827
45290
|
if (availabilityState === "hidden") return null;
|
|
44828
|
-
return /* @__PURE__ */ (0,
|
|
44829
|
-
/* @__PURE__ */ (0,
|
|
44830
|
-
/* @__PURE__ */ (0,
|
|
44831
|
-
/* @__PURE__ */ (0,
|
|
45291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)(AccessRow, { children: [
|
|
45292
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
45293
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(VenueLogo, { venue, size: "small" }),
|
|
45294
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: displayName })
|
|
44832
45295
|
] }),
|
|
44833
|
-
availabilityState === "geoblocked" ? /* @__PURE__ */ (0,
|
|
45296
|
+
availabilityState === "geoblocked" ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(GeoblockedStatus, {}) : isKalshi && !isConnected ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(
|
|
44834
45297
|
"button",
|
|
44835
45298
|
{
|
|
44836
45299
|
type: "button",
|
|
@@ -44839,9 +45302,9 @@ var TradingAccessTab = ({
|
|
|
44839
45302
|
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
44840
45303
|
children: labels.trading.tradingAccessAddKalshiAccount
|
|
44841
45304
|
}
|
|
44842
|
-
) : isKalshi ? /* @__PURE__ */ (0,
|
|
44843
|
-
/* @__PURE__ */ (0,
|
|
44844
|
-
onDisconnectKalshi ? /* @__PURE__ */ (0,
|
|
45305
|
+
) : isKalshi ? /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
45306
|
+
/* @__PURE__ */ (0, import_jsx_runtime234.jsx)(AvailableStatus, {}),
|
|
45307
|
+
onDisconnectKalshi ? /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(
|
|
44845
45308
|
"button",
|
|
44846
45309
|
{
|
|
44847
45310
|
type: "button",
|
|
@@ -44850,7 +45313,7 @@ var TradingAccessTab = ({
|
|
|
44850
45313
|
children: labels.auth.disconnect
|
|
44851
45314
|
}
|
|
44852
45315
|
) : null
|
|
44853
|
-
] }) : /* @__PURE__ */ (0,
|
|
45316
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(AvailableStatus, {})
|
|
44854
45317
|
] }, venue);
|
|
44855
45318
|
}) })
|
|
44856
45319
|
] });
|
|
@@ -44858,7 +45321,7 @@ var TradingAccessTab = ({
|
|
|
44858
45321
|
TradingAccessTab.displayName = "TradingAccessTab";
|
|
44859
45322
|
|
|
44860
45323
|
// src/profile/index.tsx
|
|
44861
|
-
var
|
|
45324
|
+
var import_jsx_runtime235 = require("react/jsx-runtime");
|
|
44862
45325
|
var ProfileModal = ({
|
|
44863
45326
|
open,
|
|
44864
45327
|
onOpenChange,
|
|
@@ -44882,31 +45345,31 @@ var ProfileModal = ({
|
|
|
44882
45345
|
onDisconnectExchange
|
|
44883
45346
|
}) => {
|
|
44884
45347
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
44885
|
-
const client = (0,
|
|
44886
|
-
const { user } = (0,
|
|
45348
|
+
const client = (0, import_hooks124.useAggClient)();
|
|
45349
|
+
const { user } = (0, import_hooks124.useAggAuthState)();
|
|
44887
45350
|
const toastCtx = useOptionalToast();
|
|
44888
|
-
const [activeTab, setActiveTab] = (0,
|
|
44889
|
-
const profileTabItems = (0,
|
|
45351
|
+
const [activeTab, setActiveTab] = (0, import_react77.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
45352
|
+
const profileTabItems = (0, import_react77.useMemo)(() => getProfileTabItems(), []);
|
|
44890
45353
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
44891
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
44892
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
44893
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
44894
|
-
const [isSaving, setIsSaving] = (0,
|
|
44895
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
44896
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
44897
|
-
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0,
|
|
45354
|
+
const [draftUsername, setDraftUsername] = (0, import_react77.useState)(resolvedInitialUsername);
|
|
45355
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react77.useState)();
|
|
45356
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react77.useState)();
|
|
45357
|
+
const [isSaving, setIsSaving] = (0, import_react77.useState)(false);
|
|
45358
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react77.useState)(null);
|
|
45359
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react77.useState)(false);
|
|
45360
|
+
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks124.useVenueKeyStatus)(
|
|
44898
45361
|
import_sdk32.Venue.kalshi,
|
|
44899
45362
|
open
|
|
44900
45363
|
);
|
|
44901
|
-
(0,
|
|
45364
|
+
(0, import_react77.useEffect)(() => {
|
|
44902
45365
|
var _a2;
|
|
44903
45366
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
44904
45367
|
}, [username, user == null ? void 0 : user.username]);
|
|
44905
|
-
(0,
|
|
45368
|
+
(0, import_react77.useEffect)(() => {
|
|
44906
45369
|
if (open) return;
|
|
44907
45370
|
setIsConnectKalshiModalOpen(false);
|
|
44908
45371
|
}, [open]);
|
|
44909
|
-
const handleOpenChange = (0,
|
|
45372
|
+
const handleOpenChange = (0, import_react77.useCallback)(
|
|
44910
45373
|
(isOpen) => {
|
|
44911
45374
|
var _a2;
|
|
44912
45375
|
if (!isOpen) {
|
|
@@ -44930,7 +45393,7 @@ var ProfileModal = ({
|
|
|
44930
45393
|
setDraftAvatarPreview
|
|
44931
45394
|
]
|
|
44932
45395
|
);
|
|
44933
|
-
const handleDraftAvatarChange = (0,
|
|
45396
|
+
const handleDraftAvatarChange = (0, import_react77.useCallback)(
|
|
44934
45397
|
(file, preview) => {
|
|
44935
45398
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
44936
45399
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -44945,7 +45408,7 @@ var ProfileModal = ({
|
|
|
44945
45408
|
);
|
|
44946
45409
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
44947
45410
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
44948
|
-
const handleSave = (0,
|
|
45411
|
+
const handleSave = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
44949
45412
|
var _a2, _b2, _c2;
|
|
44950
45413
|
setIsSaving(true);
|
|
44951
45414
|
try {
|
|
@@ -45000,10 +45463,10 @@ var ProfileModal = ({
|
|
|
45000
45463
|
originalUsername,
|
|
45001
45464
|
toastCtx
|
|
45002
45465
|
]);
|
|
45003
|
-
const handleCancel = (0,
|
|
45466
|
+
const handleCancel = (0, import_react77.useCallback)(() => {
|
|
45004
45467
|
handleOpenChange(false);
|
|
45005
45468
|
}, [handleOpenChange]);
|
|
45006
|
-
const handleVerifyKalshi = (0,
|
|
45469
|
+
const handleVerifyKalshi = (0, import_react77.useCallback)(
|
|
45007
45470
|
(credentials) => __async(null, null, function* () {
|
|
45008
45471
|
if (onConnectKalshi) {
|
|
45009
45472
|
yield onConnectKalshi(credentials);
|
|
@@ -45021,12 +45484,12 @@ var ProfileModal = ({
|
|
|
45021
45484
|
}),
|
|
45022
45485
|
[client, onConnectKalshi, refetchKalshiStatus]
|
|
45023
45486
|
);
|
|
45024
|
-
const handleDisconnectKalshi = (0,
|
|
45487
|
+
const handleDisconnectKalshi = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45025
45488
|
yield client.deleteVenueKey(import_sdk32.Venue.kalshi);
|
|
45026
45489
|
yield refetchKalshiStatus();
|
|
45027
45490
|
onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk32.Venue.kalshi);
|
|
45028
45491
|
}), [client, onDisconnectExchange, refetchKalshiStatus]);
|
|
45029
|
-
const resolvedVenueAccounts = (0,
|
|
45492
|
+
const resolvedVenueAccounts = (0, import_react77.useMemo)(() => {
|
|
45030
45493
|
var _a2;
|
|
45031
45494
|
const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
|
|
45032
45495
|
if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
|
|
@@ -45082,7 +45545,7 @@ var ProfileModal = ({
|
|
|
45082
45545
|
if (typeof window === "undefined") return;
|
|
45083
45546
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
45084
45547
|
};
|
|
45085
|
-
const surfaceError = (0,
|
|
45548
|
+
const surfaceError = (0, import_react77.useCallback)(
|
|
45086
45549
|
(err, title2) => {
|
|
45087
45550
|
const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
|
|
45088
45551
|
if (toastCtx) {
|
|
@@ -45093,7 +45556,7 @@ var ProfileModal = ({
|
|
|
45093
45556
|
},
|
|
45094
45557
|
[toastCtx]
|
|
45095
45558
|
);
|
|
45096
|
-
const handleConnectTwitter = (0,
|
|
45559
|
+
const handleConnectTwitter = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45097
45560
|
try {
|
|
45098
45561
|
const result = yield client.linkAccount({
|
|
45099
45562
|
provider: "twitter",
|
|
@@ -45107,7 +45570,7 @@ var ProfileModal = ({
|
|
|
45107
45570
|
surfaceError(err, "Could not connect X (Twitter)");
|
|
45108
45571
|
}
|
|
45109
45572
|
}), [client, onConnectTwitter, surfaceError]);
|
|
45110
|
-
const handleConnectGoogle = (0,
|
|
45573
|
+
const handleConnectGoogle = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45111
45574
|
try {
|
|
45112
45575
|
const result = yield client.linkAccount({
|
|
45113
45576
|
provider: "google",
|
|
@@ -45121,7 +45584,7 @@ var ProfileModal = ({
|
|
|
45121
45584
|
surfaceError(err, "Could not connect Google");
|
|
45122
45585
|
}
|
|
45123
45586
|
}), [client, onConnectGoogle, surfaceError]);
|
|
45124
|
-
const handleConnectApple = (0,
|
|
45587
|
+
const handleConnectApple = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45125
45588
|
try {
|
|
45126
45589
|
const result = yield client.linkAccount({
|
|
45127
45590
|
provider: "apple",
|
|
@@ -45135,7 +45598,7 @@ var ProfileModal = ({
|
|
|
45135
45598
|
surfaceError(err, "Could not connect Apple");
|
|
45136
45599
|
}
|
|
45137
45600
|
}), [client, onConnectApple, surfaceError]);
|
|
45138
|
-
const handleDisconnectTwitter = (0,
|
|
45601
|
+
const handleDisconnectTwitter = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45139
45602
|
try {
|
|
45140
45603
|
yield client.disconnectAccount("twitter");
|
|
45141
45604
|
yield client.getCurrentUser();
|
|
@@ -45144,7 +45607,7 @@ var ProfileModal = ({
|
|
|
45144
45607
|
surfaceError(err, "Could not disconnect X (Twitter)");
|
|
45145
45608
|
}
|
|
45146
45609
|
}), [client, onDisconnectTwitter, surfaceError]);
|
|
45147
|
-
const handleDisconnectGoogle = (0,
|
|
45610
|
+
const handleDisconnectGoogle = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45148
45611
|
try {
|
|
45149
45612
|
yield client.disconnectAccount("google");
|
|
45150
45613
|
yield client.getCurrentUser();
|
|
@@ -45153,7 +45616,7 @@ var ProfileModal = ({
|
|
|
45153
45616
|
surfaceError(err, "Could not disconnect Google");
|
|
45154
45617
|
}
|
|
45155
45618
|
}), [client, onDisconnectGoogle, surfaceError]);
|
|
45156
|
-
const handleDisconnectApple = (0,
|
|
45619
|
+
const handleDisconnectApple = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45157
45620
|
try {
|
|
45158
45621
|
yield client.disconnectAccount("apple");
|
|
45159
45622
|
yield client.getCurrentUser();
|
|
@@ -45162,7 +45625,7 @@ var ProfileModal = ({
|
|
|
45162
45625
|
surfaceError(err, "Could not disconnect Apple");
|
|
45163
45626
|
}
|
|
45164
45627
|
}), [client, onDisconnectApple, surfaceError]);
|
|
45165
|
-
const handleConnectEmail = (0,
|
|
45628
|
+
const handleConnectEmail = (0, import_react77.useCallback)(() => __async(null, null, function* () {
|
|
45166
45629
|
var _a2;
|
|
45167
45630
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
45168
45631
|
if (!typedEmail) return;
|
|
@@ -45181,7 +45644,7 @@ var ProfileModal = ({
|
|
|
45181
45644
|
surfaceError(err, "Could not connect email");
|
|
45182
45645
|
}
|
|
45183
45646
|
}), [client, onConnectEmail, surfaceError, toastCtx]);
|
|
45184
|
-
const handleDisconnectWallet = (0,
|
|
45647
|
+
const handleDisconnectWallet = (0, import_react77.useCallback)(
|
|
45185
45648
|
(wallet) => __async(null, null, function* () {
|
|
45186
45649
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
45187
45650
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -45195,7 +45658,7 @@ var ProfileModal = ({
|
|
|
45195
45658
|
}),
|
|
45196
45659
|
[client, onDisconnectWallet, surfaceError]
|
|
45197
45660
|
);
|
|
45198
|
-
const providerActionMap = (0,
|
|
45661
|
+
const providerActionMap = (0, import_react77.useMemo)(
|
|
45199
45662
|
() => ({
|
|
45200
45663
|
twitter: {
|
|
45201
45664
|
connect: () => {
|
|
@@ -45237,7 +45700,7 @@ var ProfileModal = ({
|
|
|
45237
45700
|
handleDisconnectTwitter
|
|
45238
45701
|
]
|
|
45239
45702
|
);
|
|
45240
|
-
const resolvedWallets = (0,
|
|
45703
|
+
const resolvedWallets = (0, import_react77.useMemo)(() => {
|
|
45241
45704
|
var _a2, _b2;
|
|
45242
45705
|
if (wallets) return wallets;
|
|
45243
45706
|
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
@@ -45256,8 +45719,8 @@ var ProfileModal = ({
|
|
|
45256
45719
|
};
|
|
45257
45720
|
});
|
|
45258
45721
|
}, [user == null ? void 0 : user.accounts, wallets]);
|
|
45259
|
-
return /* @__PURE__ */ (0,
|
|
45260
|
-
/* @__PURE__ */ (0,
|
|
45722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
|
|
45723
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(
|
|
45261
45724
|
Modal.Container,
|
|
45262
45725
|
{
|
|
45263
45726
|
maxWidth: "800px",
|
|
@@ -45266,8 +45729,8 @@ var ProfileModal = ({
|
|
|
45266
45729
|
container: cn("agg-profile-modal", "min-h-[37.5rem]")
|
|
45267
45730
|
},
|
|
45268
45731
|
children: [
|
|
45269
|
-
/* @__PURE__ */ (0,
|
|
45270
|
-
/* @__PURE__ */ (0,
|
|
45732
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
|
|
45733
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45271
45734
|
Tabs,
|
|
45272
45735
|
{
|
|
45273
45736
|
className: "w-full [&>div]:w-full",
|
|
@@ -45276,14 +45739,14 @@ var ProfileModal = ({
|
|
|
45276
45739
|
items: profileTabItems.map((tab) => ({
|
|
45277
45740
|
value: tab.value,
|
|
45278
45741
|
label: tab.label,
|
|
45279
|
-
icon: /* @__PURE__ */ (0,
|
|
45742
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(Icon, { name: tab.icon, size: "small" })
|
|
45280
45743
|
})),
|
|
45281
45744
|
value: activeTab,
|
|
45282
45745
|
onChange: (val) => setActiveTab(val)
|
|
45283
45746
|
}
|
|
45284
45747
|
) }),
|
|
45285
|
-
/* @__PURE__ */ (0,
|
|
45286
|
-
/* @__PURE__ */ (0,
|
|
45748
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
|
|
45749
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45287
45750
|
"nav",
|
|
45288
45751
|
{
|
|
45289
45752
|
className: cn(
|
|
@@ -45299,7 +45762,7 @@ var ProfileModal = ({
|
|
|
45299
45762
|
"aria-label": "Profile sections",
|
|
45300
45763
|
children: profileTabItems.map((tab) => {
|
|
45301
45764
|
const isActive = activeTab === tab.value;
|
|
45302
|
-
return /* @__PURE__ */ (0,
|
|
45765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(
|
|
45303
45766
|
"button",
|
|
45304
45767
|
{
|
|
45305
45768
|
type: "button",
|
|
@@ -45315,9 +45778,9 @@ var ProfileModal = ({
|
|
|
45315
45778
|
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
45316
45779
|
),
|
|
45317
45780
|
children: [
|
|
45318
|
-
isActive ? /* @__PURE__ */ (0,
|
|
45319
|
-
/* @__PURE__ */ (0,
|
|
45320
|
-
/* @__PURE__ */ (0,
|
|
45781
|
+
isActive ? /* @__PURE__ */ (0, import_jsx_runtime235.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
45782
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
45783
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
45321
45784
|
]
|
|
45322
45785
|
},
|
|
45323
45786
|
tab.value
|
|
@@ -45325,9 +45788,9 @@ var ProfileModal = ({
|
|
|
45325
45788
|
})
|
|
45326
45789
|
}
|
|
45327
45790
|
) }),
|
|
45328
|
-
/* @__PURE__ */ (0,
|
|
45329
|
-
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0,
|
|
45330
|
-
/* @__PURE__ */ (0,
|
|
45791
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
45792
|
+
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
|
|
45793
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45331
45794
|
AboutTab,
|
|
45332
45795
|
{
|
|
45333
45796
|
username: username != null ? username : user == null ? void 0 : user.username,
|
|
@@ -45341,7 +45804,7 @@ var ProfileModal = ({
|
|
|
45341
45804
|
avatarError: avatarTypeError
|
|
45342
45805
|
}
|
|
45343
45806
|
),
|
|
45344
|
-
/* @__PURE__ */ (0,
|
|
45807
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45345
45808
|
AccountsWalletsTab,
|
|
45346
45809
|
{
|
|
45347
45810
|
socialAccounts: resolvedSocialAccounts,
|
|
@@ -45360,7 +45823,7 @@ var ProfileModal = ({
|
|
|
45360
45823
|
}
|
|
45361
45824
|
)
|
|
45362
45825
|
] }) : null,
|
|
45363
|
-
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0,
|
|
45826
|
+
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45364
45827
|
TradingAccessTab,
|
|
45365
45828
|
{
|
|
45366
45829
|
venueAccounts: resolvedVenueAccounts,
|
|
@@ -45371,9 +45834,9 @@ var ProfileModal = ({
|
|
|
45371
45834
|
) : null
|
|
45372
45835
|
] })
|
|
45373
45836
|
] }) }),
|
|
45374
|
-
/* @__PURE__ */ (0,
|
|
45375
|
-
/* @__PURE__ */ (0,
|
|
45376
|
-
/* @__PURE__ */ (0,
|
|
45837
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
|
|
45838
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(Button, { variant: "secondary", size: "large", onClick: handleCancel, className: "min-w-[120px]", children: "Cancel" }),
|
|
45839
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45377
45840
|
Button,
|
|
45378
45841
|
{
|
|
45379
45842
|
variant: "primary",
|
|
@@ -45388,7 +45851,7 @@ var ProfileModal = ({
|
|
|
45388
45851
|
]
|
|
45389
45852
|
}
|
|
45390
45853
|
),
|
|
45391
|
-
/* @__PURE__ */ (0,
|
|
45854
|
+
/* @__PURE__ */ (0, import_jsx_runtime235.jsx)(
|
|
45392
45855
|
ConnectKalshiModal,
|
|
45393
45856
|
{
|
|
45394
45857
|
open: open && isConnectKalshiModalOpen,
|
|
@@ -45401,37 +45864,37 @@ var ProfileModal = ({
|
|
|
45401
45864
|
ProfileModal.displayName = "ProfileModal";
|
|
45402
45865
|
|
|
45403
45866
|
// src/geo-block-modal/index.tsx
|
|
45404
|
-
var
|
|
45405
|
-
var
|
|
45867
|
+
var import_hooks125 = require("@agg-build/hooks");
|
|
45868
|
+
var import_react78 = require("react");
|
|
45406
45869
|
init_button();
|
|
45407
45870
|
init_icon();
|
|
45408
45871
|
init_modal();
|
|
45409
45872
|
init_utils();
|
|
45410
|
-
var
|
|
45873
|
+
var import_jsx_runtime236 = require("react/jsx-runtime");
|
|
45411
45874
|
var GeoBlockModal = ({
|
|
45412
45875
|
open,
|
|
45413
45876
|
onOpenChange,
|
|
45414
45877
|
onConfirm,
|
|
45415
45878
|
classNames
|
|
45416
45879
|
}) => {
|
|
45417
|
-
const labels = (0,
|
|
45418
|
-
const handleConfirm = (0,
|
|
45880
|
+
const labels = (0, import_hooks125.useLabels)();
|
|
45881
|
+
const handleConfirm = (0, import_react78.useCallback)(() => {
|
|
45419
45882
|
onConfirm == null ? void 0 : onConfirm();
|
|
45420
45883
|
onOpenChange(false);
|
|
45421
45884
|
}, [onConfirm, onOpenChange]);
|
|
45422
|
-
return /* @__PURE__ */ (0,
|
|
45885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
45423
45886
|
Modal,
|
|
45424
45887
|
{
|
|
45425
45888
|
open,
|
|
45426
45889
|
onOpenChange,
|
|
45427
45890
|
"aria-label": labels.trading.geoBlockModalAriaLabel,
|
|
45428
|
-
children: /* @__PURE__ */ (0,
|
|
45891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)(
|
|
45429
45892
|
Modal.Container,
|
|
45430
45893
|
{
|
|
45431
45894
|
maxWidth: "480px",
|
|
45432
45895
|
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
45433
45896
|
children: [
|
|
45434
|
-
/* @__PURE__ */ (0,
|
|
45897
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
45435
45898
|
Modal.Header,
|
|
45436
45899
|
{
|
|
45437
45900
|
title: "",
|
|
@@ -45443,19 +45906,19 @@ var GeoBlockModal = ({
|
|
|
45443
45906
|
}
|
|
45444
45907
|
}
|
|
45445
45908
|
),
|
|
45446
|
-
/* @__PURE__ */ (0,
|
|
45447
|
-
/* @__PURE__ */ (0,
|
|
45909
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime236.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
45910
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
45448
45911
|
Icon,
|
|
45449
45912
|
{
|
|
45450
45913
|
name: "internet-security",
|
|
45451
45914
|
className: "h-[60px] w-[60px] text-agg-muted-foreground"
|
|
45452
45915
|
}
|
|
45453
45916
|
),
|
|
45454
|
-
/* @__PURE__ */ (0,
|
|
45455
|
-
/* @__PURE__ */ (0,
|
|
45456
|
-
/* @__PURE__ */ (0,
|
|
45917
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
45918
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
|
|
45919
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
|
|
45457
45920
|
] }),
|
|
45458
|
-
/* @__PURE__ */ (0,
|
|
45921
|
+
/* @__PURE__ */ (0, import_jsx_runtime236.jsx)(
|
|
45459
45922
|
Button,
|
|
45460
45923
|
{
|
|
45461
45924
|
variant: "secondary",
|
|
@@ -45561,6 +46024,10 @@ init_deposit_modal_events();
|
|
|
45561
46024
|
ImageIcon,
|
|
45562
46025
|
InfoIcon,
|
|
45563
46026
|
InlineAlert,
|
|
46027
|
+
LEADERBOARD_DEFAULT_METRIC,
|
|
46028
|
+
LEADERBOARD_DEFAULT_PERIOD,
|
|
46029
|
+
LEADERBOARD_METRICS,
|
|
46030
|
+
LeaderboardPage,
|
|
45564
46031
|
LineChart,
|
|
45565
46032
|
LinkAccountsIcon,
|
|
45566
46033
|
LoadingIcon,
|