@agg-build/ui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XUYPM4LM.mjs → chunk-UWAN6DRI.mjs} +43 -31
- package/dist/{chunk-Q2BRDVBU.mjs → chunk-VTLEFAAM.mjs} +49 -40
- package/dist/index.js +210 -183
- package/dist/index.mjs +2 -2
- package/dist/modals.js +751 -740
- package/dist/modals.mjs +1 -1
- package/dist/pages.js +43 -31
- package/dist/pages.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/types/shared/constants.d.mts +3 -2
- package/dist/types/shared/constants.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19950,18 +19950,20 @@ var formatChainIdLabel = (chainId) => {
|
|
|
19950
19950
|
|
|
19951
19951
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
19952
19952
|
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
19953
|
-
var
|
|
19954
|
-
|
|
19955
|
-
"
|
|
19956
|
-
|
|
19957
|
-
|
|
19958
|
-
|
|
19959
|
-
"137":
|
|
19960
|
-
"324":
|
|
19961
|
-
// zkSync (
|
|
19962
|
-
"
|
|
19963
|
-
"
|
|
19964
|
-
"
|
|
19953
|
+
var BASE_URL = "https://assets.snagsolutions.io";
|
|
19954
|
+
var CHAIN_ID_TO_ICON_URL = {
|
|
19955
|
+
"1": `${BASE_URL}/public/prediction-markets/logos/ETH.svg`,
|
|
19956
|
+
"10": `${BASE_URL}/public/prediction-markets/logos/ETH.svg`,
|
|
19957
|
+
// Optimism
|
|
19958
|
+
"56": `${BASE_URL}/public/prediction-markets/logos/BNB.svg`,
|
|
19959
|
+
"137": `${BASE_URL}/public/prediction-markets/logos/Polygon.svg`,
|
|
19960
|
+
"324": `${BASE_URL}/public/web/icons/chains/zksync/colored.svg`,
|
|
19961
|
+
// zkSync (no new logo)
|
|
19962
|
+
"747": `${BASE_URL}/public/prediction-markets/logos/Flow.svg`,
|
|
19963
|
+
"8453": `${BASE_URL}/public/prediction-markets/logos/Base.svg`,
|
|
19964
|
+
"42161": `${BASE_URL}/public/prediction-markets/logos/Arbitrum.svg`,
|
|
19965
|
+
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
19966
|
+
"792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
|
|
19965
19967
|
};
|
|
19966
19968
|
var CHAIN_VENUE_MAP = {
|
|
19967
19969
|
"137": ["polymarket"],
|
|
@@ -19971,17 +19973,19 @@ var CHAIN_VENUE_MAP = {
|
|
|
19971
19973
|
"56": ["limitless", "opinion"]
|
|
19972
19974
|
// BNB
|
|
19973
19975
|
};
|
|
19974
|
-
var
|
|
19975
|
-
if (key &&
|
|
19976
|
+
var chainIconUrl = (label2, key) => {
|
|
19977
|
+
if (key && CHAIN_ID_TO_ICON_URL[key]) return CHAIN_ID_TO_ICON_URL[key];
|
|
19976
19978
|
const k = label2.trim().toLowerCase();
|
|
19977
|
-
if (k.includes("polygon")) return "
|
|
19978
|
-
if (k.includes("solana")) return "
|
|
19979
|
-
if (k.includes("base")) return "
|
|
19980
|
-
if (k.includes("arbitrum")) return "
|
|
19981
|
-
if (k.includes("
|
|
19982
|
-
if (k.includes("
|
|
19983
|
-
if (k.includes("
|
|
19984
|
-
if (k.includes("
|
|
19979
|
+
if (k.includes("polygon")) return CHAIN_ID_TO_ICON_URL["137"];
|
|
19980
|
+
if (k.includes("solana")) return CHAIN_ID_TO_ICON_URL["792703809"];
|
|
19981
|
+
if (k.includes("base")) return CHAIN_ID_TO_ICON_URL["8453"];
|
|
19982
|
+
if (k.includes("arbitrum")) return CHAIN_ID_TO_ICON_URL["42161"];
|
|
19983
|
+
if (k.includes("bnb")) return CHAIN_ID_TO_ICON_URL["56"];
|
|
19984
|
+
if (k.includes("flow")) return CHAIN_ID_TO_ICON_URL["747"];
|
|
19985
|
+
if (k.includes("abstract")) return CHAIN_ID_TO_ICON_URL["2741"];
|
|
19986
|
+
if (k.includes("optimism")) return CHAIN_ID_TO_ICON_URL["10"];
|
|
19987
|
+
if (k.includes("zksync")) return CHAIN_ID_TO_ICON_URL["324"];
|
|
19988
|
+
if (k.includes("ethereum") || k.includes("eth")) return CHAIN_ID_TO_ICON_URL["1"];
|
|
19985
19989
|
return void 0;
|
|
19986
19990
|
};
|
|
19987
19991
|
var AvailableBalanceCard = ({
|
|
@@ -20033,7 +20037,7 @@ var AvailableBalanceCard = ({
|
|
|
20033
20037
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { className: "font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground", children: "Balance by network" }),
|
|
20034
20038
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("div", { role: "list", className: "agg-balance-list flex flex-col gap-3 w-full", children: chains.map((row) => {
|
|
20035
20039
|
var _a;
|
|
20036
|
-
const
|
|
20040
|
+
const iconUrl = chainIconUrl(row.label, row.key);
|
|
20037
20041
|
return /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)(
|
|
20038
20042
|
"div",
|
|
20039
20043
|
{
|
|
@@ -20041,7 +20045,15 @@ var AvailableBalanceCard = ({
|
|
|
20041
20045
|
className: "agg-balance-row flex items-center justify-between self-stretch gap-3 w-full",
|
|
20042
20046
|
children: [
|
|
20043
20047
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
20044
|
-
|
|
20048
|
+
iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "overflow-clip flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px]", children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
20049
|
+
"img",
|
|
20050
|
+
{
|
|
20051
|
+
src: iconUrl,
|
|
20052
|
+
alt: "",
|
|
20053
|
+
"aria-hidden": true,
|
|
20054
|
+
className: "size-full object-contain"
|
|
20055
|
+
}
|
|
20056
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-agg-separator text-[10px] leading-3 text-agg-muted-foreground", children: row.label.slice(0, 2).toUpperCase() }),
|
|
20045
20057
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "truncate font-agg-sans text-agg-sm leading-5 font-agg-normal text-agg-foreground", children: row.label })
|
|
20046
20058
|
] }),
|
|
20047
20059
|
/* @__PURE__ */ (0, import_jsx_runtime145.jsx)("span", { className: "w-[100px] shrink-0 whitespace-nowrap text-right tabular-nums font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground", children: row.balance.toLocaleString("en-US", {
|
|
@@ -20074,24 +20086,24 @@ var AvailableBalanceCard = ({
|
|
|
20074
20086
|
className: "agg-balance-trigger flex min-h-[20px] min-w-[20px] items-center gap-1 rounded-[6px] border-0 bg-agg-secondary-hover p-1.5",
|
|
20075
20087
|
children: [
|
|
20076
20088
|
(chains.slice(0, 4).length > 0 ? chains.slice(0, 4) : [{ key: "placeholder", label: "", balance: 0, accountCount: 0 }]).map((row) => {
|
|
20077
|
-
const
|
|
20078
|
-
return
|
|
20089
|
+
const iconUrl = chainIconUrl(row.label, row.key);
|
|
20090
|
+
return iconUrl ? /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
20079
20091
|
"span",
|
|
20080
20092
|
{
|
|
20081
|
-
className: "relative
|
|
20082
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
20093
|
+
className: "overflow-clip relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary",
|
|
20094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)("img", { src: iconUrl, alt: row.label, className: "size-full object-contain" })
|
|
20083
20095
|
},
|
|
20084
20096
|
`icon-${row.key}`
|
|
20085
20097
|
) : /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(
|
|
20086
20098
|
"span",
|
|
20087
20099
|
{
|
|
20088
|
-
className: "relative
|
|
20100
|
+
className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary text-[10px] leading-3 text-agg-muted-foreground",
|
|
20089
20101
|
children: row.label ? row.label.slice(0, 2).toUpperCase() : ""
|
|
20090
20102
|
},
|
|
20091
20103
|
`icon-${row.key}`
|
|
20092
20104
|
);
|
|
20093
20105
|
}),
|
|
20094
|
-
chains.length > 4 ? /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("span", { className: "relative
|
|
20106
|
+
chains.length > 4 ? /* @__PURE__ */ (0, import_jsx_runtime145.jsxs)("span", { className: "relative flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] bg-agg-secondary font-agg-sans text-[10px] leading-3 text-agg-muted-foreground", children: [
|
|
20095
20107
|
"+",
|
|
20096
20108
|
chains.length - 4
|
|
20097
20109
|
] }) : null
|
|
@@ -22240,7 +22252,7 @@ var UserProfilePage = ({
|
|
|
22240
22252
|
const currentPriceCents = typeof displayCurrentPrice === "number" ? Math.round(displayCurrentPrice * 100) : null;
|
|
22241
22253
|
const pnlPrefix = (displayPnlValue != null ? displayPnlValue : 0) >= 0 ? "+" : "";
|
|
22242
22254
|
const pnlPercent = displayPnlPercent == null ? null : displayPnlPercent.toFixed(2);
|
|
22243
|
-
const winningOutcomeIds = outcome.winner === true ? outcome.venueBreakdown.map((breakdown) => breakdown.venueMarketOutcomeId)
|
|
22255
|
+
const winningOutcomeIds = outcome.winner === true ? outcome.venueBreakdown.map((breakdown) => breakdown.venueMarketOutcomeId) : [];
|
|
22244
22256
|
return {
|
|
22245
22257
|
id: `${group.targetMarketId}-${outcome.label}-${(_a2 = outcome.title) != null ? _a2 : ""}`,
|
|
22246
22258
|
eventId,
|
|
@@ -22471,40 +22483,51 @@ var UserProfilePage = ({
|
|
|
22471
22483
|
UserProfilePage.displayName = "UserProfilePage";
|
|
22472
22484
|
|
|
22473
22485
|
// src/deposit/index.tsx
|
|
22474
|
-
var
|
|
22486
|
+
var import_react40 = require("react");
|
|
22475
22487
|
var import_hooks69 = require("@agg-build/hooks");
|
|
22476
22488
|
var import_deposit = require("@agg-build/hooks/deposit");
|
|
22477
22489
|
|
|
22478
22490
|
// src/shared/constants.ts
|
|
22479
|
-
var import_react38 = __toESM(require("react"));
|
|
22480
22491
|
var USDC = {
|
|
22481
22492
|
value: "USDC",
|
|
22482
22493
|
label: "USDC",
|
|
22483
22494
|
iconUrl: "https://assets.snagsolutions.io/public/web/icons/usdc.svg"
|
|
22484
22495
|
};
|
|
22485
22496
|
var SUPPORTED_NETWORKS = [
|
|
22497
|
+
{
|
|
22498
|
+
value: "abstract",
|
|
22499
|
+
label: "Abstract",
|
|
22500
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Abstract.svg",
|
|
22501
|
+
tokens: [USDC]
|
|
22502
|
+
},
|
|
22486
22503
|
{
|
|
22487
22504
|
value: "arbitrum",
|
|
22488
22505
|
label: "Arbitrum One",
|
|
22489
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22506
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Arbitrum.svg",
|
|
22490
22507
|
tokens: [USDC]
|
|
22491
22508
|
},
|
|
22492
22509
|
{
|
|
22493
22510
|
value: "base",
|
|
22494
22511
|
label: "Base",
|
|
22495
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22512
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Base.svg",
|
|
22496
22513
|
tokens: [USDC]
|
|
22497
22514
|
},
|
|
22498
22515
|
{
|
|
22499
22516
|
value: "bnb",
|
|
22500
22517
|
label: "BNB Chain",
|
|
22501
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22518
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/BNB.svg",
|
|
22519
|
+
tokens: [USDC]
|
|
22520
|
+
},
|
|
22521
|
+
{
|
|
22522
|
+
value: "flow",
|
|
22523
|
+
label: "Flow",
|
|
22524
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Flow.svg",
|
|
22502
22525
|
tokens: [USDC]
|
|
22503
22526
|
},
|
|
22504
22527
|
{
|
|
22505
22528
|
value: "mainnet",
|
|
22506
22529
|
label: "Ethereum",
|
|
22507
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22530
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/ETH.svg",
|
|
22508
22531
|
tokens: [USDC]
|
|
22509
22532
|
},
|
|
22510
22533
|
{
|
|
@@ -22516,13 +22539,13 @@ var SUPPORTED_NETWORKS = [
|
|
|
22516
22539
|
{
|
|
22517
22540
|
value: "polygon",
|
|
22518
22541
|
label: "Polygon Mainnet",
|
|
22519
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22542
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Polygon.svg",
|
|
22520
22543
|
tokens: [USDC]
|
|
22521
22544
|
},
|
|
22522
22545
|
{
|
|
22523
22546
|
value: "solana",
|
|
22524
22547
|
label: "Solana",
|
|
22525
|
-
iconUrl: "https://assets.snagsolutions.io/public/
|
|
22548
|
+
iconUrl: "https://assets.snagsolutions.io/public/prediction-markets/logos/Solana.svg",
|
|
22526
22549
|
tokens: [USDC]
|
|
22527
22550
|
},
|
|
22528
22551
|
{
|
|
@@ -22533,15 +22556,11 @@ var SUPPORTED_NETWORKS = [
|
|
|
22533
22556
|
}
|
|
22534
22557
|
];
|
|
22535
22558
|
var mapNetworksToOptions = () => {
|
|
22536
|
-
return SUPPORTED_NETWORKS.map((n) => {
|
|
22537
|
-
|
|
22538
|
-
|
|
22539
|
-
|
|
22540
|
-
|
|
22541
|
-
iconUrl: n.iconUrl,
|
|
22542
|
-
icon: Component2 ? import_react38.default.createElement(Component2) : void 0
|
|
22543
|
-
};
|
|
22544
|
-
});
|
|
22559
|
+
return SUPPORTED_NETWORKS.map((n) => ({
|
|
22560
|
+
value: n.value,
|
|
22561
|
+
label: n.label,
|
|
22562
|
+
iconUrl: n.iconUrl
|
|
22563
|
+
}));
|
|
22545
22564
|
};
|
|
22546
22565
|
var DEFAULT_CURRENCY_OPTIONS = [
|
|
22547
22566
|
{
|
|
@@ -22596,27 +22615,19 @@ var CHAIN_ID_TO_SLUG = {
|
|
|
22596
22615
|
"56": "bnb",
|
|
22597
22616
|
"137": "polygon",
|
|
22598
22617
|
"324": "zksync",
|
|
22618
|
+
"747": "flow",
|
|
22599
22619
|
"8453": "base",
|
|
22600
22620
|
"42161": "arbitrum",
|
|
22621
|
+
"2741": "abstract",
|
|
22601
22622
|
"792703809": "solana"
|
|
22602
22623
|
};
|
|
22603
|
-
var CHAIN_ICON_COMPONENTS = {
|
|
22604
|
-
mainnet: EthereumIcon,
|
|
22605
|
-
polygon: PolygonIcon,
|
|
22606
|
-
base: BaseIcon,
|
|
22607
|
-
arbitrum: ArbitrumIcon,
|
|
22608
|
-
solana: SolanaIcon,
|
|
22609
|
-
bnb: BnbIcon
|
|
22610
|
-
};
|
|
22611
22624
|
var withNetworkIcons = (options) => {
|
|
22612
22625
|
const bySlug = new Map(SUPPORTED_NETWORKS.map((n) => [n.value, n.iconUrl]));
|
|
22613
22626
|
return options.map((o) => {
|
|
22614
|
-
var _a, _b
|
|
22627
|
+
var _a, _b;
|
|
22615
22628
|
const slug = (_a = CHAIN_ID_TO_SLUG[o.value]) != null ? _a : o.value;
|
|
22616
|
-
const Component2 = CHAIN_ICON_COMPONENTS[slug];
|
|
22617
22629
|
return __spreadProps(__spreadValues({}, o), {
|
|
22618
|
-
iconUrl: (_b = o.iconUrl) != null ? _b : bySlug.get(slug)
|
|
22619
|
-
icon: (_c = o.icon) != null ? _c : Component2 ? import_react38.default.createElement(Component2) : void 0
|
|
22630
|
+
iconUrl: (_b = o.iconUrl) != null ? _b : bySlug.get(slug)
|
|
22620
22631
|
});
|
|
22621
22632
|
});
|
|
22622
22633
|
};
|
|
@@ -22639,13 +22650,29 @@ var mergeSelectOptionsUnique = (base, fill) => {
|
|
|
22639
22650
|
};
|
|
22640
22651
|
|
|
22641
22652
|
// src/deposit/deposit-modal.constants.ts
|
|
22642
|
-
var
|
|
22653
|
+
var BASE_URL2 = "https://assets.snagsolutions.io";
|
|
22643
22654
|
var CARD_NETWORK_OPTIONS = [
|
|
22644
|
-
{
|
|
22645
|
-
|
|
22646
|
-
|
|
22647
|
-
|
|
22648
|
-
|
|
22655
|
+
{
|
|
22656
|
+
value: "ethereum",
|
|
22657
|
+
label: "Ethereum",
|
|
22658
|
+
iconUrl: `${BASE_URL2}/public/prediction-markets/logos/ETH.svg`
|
|
22659
|
+
},
|
|
22660
|
+
{
|
|
22661
|
+
value: "arbitrum",
|
|
22662
|
+
label: "Arbitrum",
|
|
22663
|
+
iconUrl: `${BASE_URL2}/public/prediction-markets/logos/Arbitrum.svg`
|
|
22664
|
+
},
|
|
22665
|
+
{ value: "base", label: "Base", iconUrl: `${BASE_URL2}/public/prediction-markets/logos/Base.svg` },
|
|
22666
|
+
{
|
|
22667
|
+
value: "solana",
|
|
22668
|
+
label: "Solana",
|
|
22669
|
+
iconUrl: `${BASE_URL2}/public/prediction-markets/logos/Solana.svg`
|
|
22670
|
+
},
|
|
22671
|
+
{
|
|
22672
|
+
value: "polygon",
|
|
22673
|
+
label: "Polygon",
|
|
22674
|
+
iconUrl: `${BASE_URL2}/public/prediction-markets/logos/Polygon.svg`
|
|
22675
|
+
}
|
|
22649
22676
|
];
|
|
22650
22677
|
var NETWORK_TO_CURRENCY_CODE = {
|
|
22651
22678
|
ethereum: "USDC",
|
|
@@ -22758,7 +22785,7 @@ var DepositMethodStep = ({
|
|
|
22758
22785
|
|
|
22759
22786
|
// src/deposit/steps/card-deposit.tsx
|
|
22760
22787
|
var import_hooks61 = require("@agg-build/hooks");
|
|
22761
|
-
var
|
|
22788
|
+
var import_react38 = require("react");
|
|
22762
22789
|
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
22763
22790
|
var CardDepositStep = ({
|
|
22764
22791
|
amount,
|
|
@@ -22776,8 +22803,8 @@ var CardDepositStep = ({
|
|
|
22776
22803
|
onContinue
|
|
22777
22804
|
}) => {
|
|
22778
22805
|
const labels = (0, import_hooks61.useLabels)();
|
|
22779
|
-
const [localAmount, setLocalAmount] = (0,
|
|
22780
|
-
(0,
|
|
22806
|
+
const [localAmount, setLocalAmount] = (0, import_react38.useState)(amount);
|
|
22807
|
+
(0, import_react38.useEffect)(() => {
|
|
22781
22808
|
setLocalAmount(amount);
|
|
22782
22809
|
}, [amount]);
|
|
22783
22810
|
const numericAmount = Number(localAmount) || 0;
|
|
@@ -23447,7 +23474,7 @@ var CardPurchaseSuccessStep = ({
|
|
|
23447
23474
|
|
|
23448
23475
|
// src/deposit/steps/wallet-processing.tsx
|
|
23449
23476
|
var import_hooks67 = require("@agg-build/hooks");
|
|
23450
|
-
var
|
|
23477
|
+
var import_react39 = require("react");
|
|
23451
23478
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
23452
23479
|
var WalletProcessingStep = ({
|
|
23453
23480
|
steps,
|
|
@@ -23455,7 +23482,7 @@ var WalletProcessingStep = ({
|
|
|
23455
23482
|
onComplete
|
|
23456
23483
|
}) => {
|
|
23457
23484
|
const labels = (0, import_hooks67.useLabels)();
|
|
23458
|
-
(0,
|
|
23485
|
+
(0, import_react39.useEffect)(() => {
|
|
23459
23486
|
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
23460
23487
|
if (allDone) {
|
|
23461
23488
|
onComplete();
|
|
@@ -23625,28 +23652,28 @@ function DepositModalControlled({
|
|
|
23625
23652
|
const { walletActions } = (0, import_hooks69.useAggUiConfig)();
|
|
23626
23653
|
const labels = (0, import_hooks69.useLabels)();
|
|
23627
23654
|
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
23628
|
-
const [step, setStep] = (0,
|
|
23655
|
+
const [step, setStep] = (0, import_react40.useState)(
|
|
23629
23656
|
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
23630
23657
|
);
|
|
23631
|
-
const [highlightedMethod, setHighlightedMethod] = (0,
|
|
23632
|
-
const walletSubmitInFlightRef = (0,
|
|
23633
|
-
const [isWalletSubmitting, setIsWalletSubmitting] = (0,
|
|
23634
|
-
const [cardProviders, setCardProviders] = (0,
|
|
23635
|
-
const [quotesLoading, setQuotesLoading] = (0,
|
|
23636
|
-
const [quotesError, setQuotesError] = (0,
|
|
23637
|
-
const [sessionError, setSessionError] = (0,
|
|
23638
|
-
const [pendingProviderName, setPendingProviderName] = (0,
|
|
23639
|
-
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0,
|
|
23640
|
-
(0,
|
|
23658
|
+
const [highlightedMethod, setHighlightedMethod] = (0, import_react40.useState)(defaultMethod);
|
|
23659
|
+
const walletSubmitInFlightRef = (0, import_react40.useRef)(false);
|
|
23660
|
+
const [isWalletSubmitting, setIsWalletSubmitting] = (0, import_react40.useState)(false);
|
|
23661
|
+
const [cardProviders, setCardProviders] = (0, import_react40.useState)([]);
|
|
23662
|
+
const [quotesLoading, setQuotesLoading] = (0, import_react40.useState)(false);
|
|
23663
|
+
const [quotesError, setQuotesError] = (0, import_react40.useState)(null);
|
|
23664
|
+
const [sessionError, setSessionError] = (0, import_react40.useState)(null);
|
|
23665
|
+
const [pendingProviderName, setPendingProviderName] = (0, import_react40.useState)("");
|
|
23666
|
+
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0, import_react40.useState)("");
|
|
23667
|
+
(0, import_react40.useEffect)(() => {
|
|
23641
23668
|
if (pendingCardPurchaseSummary) {
|
|
23642
23669
|
clearPendingCardSession();
|
|
23643
23670
|
setStep("card-success");
|
|
23644
23671
|
}
|
|
23645
23672
|
}, [pendingCardPurchaseSummary]);
|
|
23646
|
-
const [walletChainId, setWalletChainId] = (0,
|
|
23647
|
-
const [walletToken, setWalletToken] = (0,
|
|
23648
|
-
const [sendChainId, setSendChainId] = (0,
|
|
23649
|
-
const [sendToken, setSendToken] = (0,
|
|
23673
|
+
const [walletChainId, setWalletChainId] = (0, import_react40.useState)("");
|
|
23674
|
+
const [walletToken, setWalletToken] = (0, import_react40.useState)("");
|
|
23675
|
+
const [sendChainId, setSendChainId] = (0, import_react40.useState)("");
|
|
23676
|
+
const [sendToken, setSendToken] = (0, import_react40.useState)("");
|
|
23650
23677
|
const {
|
|
23651
23678
|
isReady,
|
|
23652
23679
|
isTimedOut,
|
|
@@ -23654,14 +23681,14 @@ function DepositModalControlled({
|
|
|
23654
23681
|
supportedChains,
|
|
23655
23682
|
getAddress
|
|
23656
23683
|
} = (0, import_hooks69.useDepositAddresses)({ enabled: open });
|
|
23657
|
-
const fallbackNetworkOptions = (0,
|
|
23658
|
-
const networkOptions = (0,
|
|
23684
|
+
const fallbackNetworkOptions = (0, import_react40.useMemo)(() => mapNetworksToOptions(), []);
|
|
23685
|
+
const networkOptions = (0, import_react40.useMemo)(() => {
|
|
23659
23686
|
if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
|
|
23660
23687
|
return withNetworkIcons(
|
|
23661
23688
|
supportedChains.map((c) => ({ value: String(c.chainId), label: c.name }))
|
|
23662
23689
|
);
|
|
23663
23690
|
}, [supportedChains, fallbackNetworkOptions]);
|
|
23664
|
-
const walletNetworkOptions = (0,
|
|
23691
|
+
const walletNetworkOptions = (0, import_react40.useMemo)(() => {
|
|
23665
23692
|
if (!(supportedChains == null ? void 0 : supportedChains.length) || !connectedWalletKind) return networkOptions;
|
|
23666
23693
|
const filtered = supportedChains.filter(
|
|
23667
23694
|
(c) => connectedWalletKind === "solana" ? import_deposit.SVM_CHAIN_IDS.has(c.chainId) : !import_deposit.SVM_CHAIN_IDS.has(c.chainId)
|
|
@@ -23669,17 +23696,17 @@ function DepositModalControlled({
|
|
|
23669
23696
|
if (filtered.length === 0) return networkOptions;
|
|
23670
23697
|
return withNetworkIcons(filtered.map((c) => ({ value: String(c.chainId), label: c.name })));
|
|
23671
23698
|
}, [supportedChains, networkOptions, connectedWalletKind]);
|
|
23672
|
-
const walletTokenOptions = (0,
|
|
23699
|
+
const walletTokenOptions = (0, import_react40.useMemo)(() => {
|
|
23673
23700
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
23674
23701
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
23675
23702
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
23676
23703
|
}, [supportedChains, walletChainId]);
|
|
23677
|
-
const sendTokenOptions = (0,
|
|
23704
|
+
const sendTokenOptions = (0, import_react40.useMemo)(() => {
|
|
23678
23705
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === sendChainId);
|
|
23679
23706
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
23680
23707
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
23681
23708
|
}, [supportedChains, sendChainId]);
|
|
23682
|
-
(0,
|
|
23709
|
+
(0, import_react40.useEffect)(() => {
|
|
23683
23710
|
if (walletNetworkOptions.length > 0) {
|
|
23684
23711
|
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
23685
23712
|
const preferred = initialWalletChainId && walletNetworkOptions.some((o) => o.value === initialWalletChainId) ? initialWalletChainId : walletNetworkOptions[0].value;
|
|
@@ -23687,25 +23714,25 @@ function DepositModalControlled({
|
|
|
23687
23714
|
}
|
|
23688
23715
|
}
|
|
23689
23716
|
}, [walletNetworkOptions, walletChainId, initialWalletChainId]);
|
|
23690
|
-
(0,
|
|
23717
|
+
(0, import_react40.useEffect)(() => {
|
|
23691
23718
|
if (networkOptions.length > 0) {
|
|
23692
23719
|
if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) {
|
|
23693
23720
|
setSendChainId(networkOptions[0].value);
|
|
23694
23721
|
}
|
|
23695
23722
|
}
|
|
23696
23723
|
}, [networkOptions, sendChainId]);
|
|
23697
|
-
(0,
|
|
23724
|
+
(0, import_react40.useEffect)(() => {
|
|
23698
23725
|
if (walletTokenOptions.length > 0) setWalletToken(walletTokenOptions[0].value);
|
|
23699
23726
|
}, [walletTokenOptions]);
|
|
23700
|
-
(0,
|
|
23727
|
+
(0, import_react40.useEffect)(() => {
|
|
23701
23728
|
if (sendTokenOptions.length > 0) setSendToken(sendTokenOptions[0].value);
|
|
23702
23729
|
}, [sendTokenOptions]);
|
|
23703
|
-
(0,
|
|
23730
|
+
(0, import_react40.useEffect)(() => {
|
|
23704
23731
|
if (walletChainId) {
|
|
23705
23732
|
onWalletNetworkChange == null ? void 0 : onWalletNetworkChange(walletChainId);
|
|
23706
23733
|
}
|
|
23707
23734
|
}, [walletChainId, onWalletNetworkChange]);
|
|
23708
|
-
(0,
|
|
23735
|
+
(0, import_react40.useEffect)(() => {
|
|
23709
23736
|
if (walletToken) {
|
|
23710
23737
|
onWalletTokenChange == null ? void 0 : onWalletTokenChange(walletToken);
|
|
23711
23738
|
}
|
|
@@ -23724,7 +23751,7 @@ function DepositModalControlled({
|
|
|
23724
23751
|
fromWallet: walletFlow.walletLabel,
|
|
23725
23752
|
gasFee: ""
|
|
23726
23753
|
}, walletFlow.successSummary);
|
|
23727
|
-
(0,
|
|
23754
|
+
(0, import_react40.useEffect)(() => {
|
|
23728
23755
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
23729
23756
|
setStep("wallet-success");
|
|
23730
23757
|
}
|
|
@@ -24050,7 +24077,7 @@ var DepositModal = (props) => {
|
|
|
24050
24077
|
DepositModal.displayName = "DepositModal";
|
|
24051
24078
|
|
|
24052
24079
|
// src/withdraw/index.tsx
|
|
24053
|
-
var
|
|
24080
|
+
var import_react42 = require("react");
|
|
24054
24081
|
var import_withdraw2 = require("@agg-build/hooks/withdraw");
|
|
24055
24082
|
|
|
24056
24083
|
// src/withdraw/steps/withdraw-method.tsx
|
|
@@ -24240,7 +24267,7 @@ var WithdrawAmountStep = ({
|
|
|
24240
24267
|
};
|
|
24241
24268
|
|
|
24242
24269
|
// src/withdraw/steps/withdraw-success.tsx
|
|
24243
|
-
var
|
|
24270
|
+
var import_react41 = require("react");
|
|
24244
24271
|
var import_hooks72 = require("@agg-build/hooks");
|
|
24245
24272
|
var import_withdraw = require("@agg-build/hooks/withdraw");
|
|
24246
24273
|
|
|
@@ -24374,7 +24401,7 @@ var WithdrawSuccessStep = ({
|
|
|
24374
24401
|
features: { enableAnimations }
|
|
24375
24402
|
} = (0, import_hooks72.useSdkUiConfig)();
|
|
24376
24403
|
const { state } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawalId);
|
|
24377
|
-
const [isTimelineExpanded, setIsTimelineExpanded] = (0,
|
|
24404
|
+
const [isTimelineExpanded, setIsTimelineExpanded] = (0, import_react41.useState)(true);
|
|
24378
24405
|
const walletFlowLabels = labels.withdraw.walletFlow;
|
|
24379
24406
|
const { groups, finalStep, hasDetails } = buildWithdrawalLifecycleSteps({
|
|
24380
24407
|
pending: state.pending,
|
|
@@ -24382,7 +24409,7 @@ var WithdrawSuccessStep = ({
|
|
|
24382
24409
|
legs: state.legs,
|
|
24383
24410
|
walletFlowLabels
|
|
24384
24411
|
});
|
|
24385
|
-
(0,
|
|
24412
|
+
(0, import_react41.useEffect)(() => {
|
|
24386
24413
|
if (!state.terminal) return;
|
|
24387
24414
|
if (state.status !== "completed") return;
|
|
24388
24415
|
const timer = window.setTimeout(() => onClose(), 1500);
|
|
@@ -24574,10 +24601,10 @@ function WithdrawModalControlled({
|
|
|
24574
24601
|
onSelectWithdrawProvider,
|
|
24575
24602
|
onDoneWithdraw
|
|
24576
24603
|
}) {
|
|
24577
|
-
const [step, setStep] = (0,
|
|
24578
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
24579
|
-
const [confirmError, setConfirmError] = (0,
|
|
24580
|
-
(0,
|
|
24604
|
+
const [step, setStep] = (0, import_react42.useState)("method");
|
|
24605
|
+
const [isConfirming, setIsConfirming] = (0, import_react42.useState)(false);
|
|
24606
|
+
const [confirmError, setConfirmError] = (0, import_react42.useState)(null);
|
|
24607
|
+
(0, import_react42.useEffect)(() => {
|
|
24581
24608
|
if (!open) {
|
|
24582
24609
|
setStep("method");
|
|
24583
24610
|
setIsConfirming(false);
|
|
@@ -24660,7 +24687,7 @@ var WithdrawModal = (props) => {
|
|
|
24660
24687
|
WithdrawModal.displayName = "WithdrawModal";
|
|
24661
24688
|
|
|
24662
24689
|
// src/onboarding/index.tsx
|
|
24663
|
-
var
|
|
24690
|
+
var import_react47 = require("react");
|
|
24664
24691
|
var import_hooks78 = require("@agg-build/hooks");
|
|
24665
24692
|
var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
|
|
24666
24693
|
|
|
@@ -24680,7 +24707,7 @@ var ONBOARDING_STEPS = {
|
|
|
24680
24707
|
var ONCHAIN_VENUES = [import_sdk19.Venue.polymarket, import_sdk19.Venue.opinion, import_sdk19.Venue.predict];
|
|
24681
24708
|
|
|
24682
24709
|
// src/onboarding/steps/how-it-works.tsx
|
|
24683
|
-
var
|
|
24710
|
+
var import_react43 = require("react");
|
|
24684
24711
|
var import_hooks73 = require("@agg-build/hooks");
|
|
24685
24712
|
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
24686
24713
|
var defaultIcons = {
|
|
@@ -24691,10 +24718,10 @@ var defaultIcons = {
|
|
|
24691
24718
|
};
|
|
24692
24719
|
var HowItWorksStep = ({ onContinue, icons }) => {
|
|
24693
24720
|
const labels = (0, import_hooks73.useLabels)();
|
|
24694
|
-
const scrollRef = (0,
|
|
24695
|
-
const [showTopGradient, setShowTopGradient] = (0,
|
|
24696
|
-
const [showBottomGradient, setShowBottomGradient] = (0,
|
|
24697
|
-
const handleScroll = (0,
|
|
24721
|
+
const scrollRef = (0, import_react43.useRef)(null);
|
|
24722
|
+
const [showTopGradient, setShowTopGradient] = (0, import_react43.useState)(false);
|
|
24723
|
+
const [showBottomGradient, setShowBottomGradient] = (0, import_react43.useState)(true);
|
|
24724
|
+
const handleScroll = (0, import_react43.useCallback)(() => {
|
|
24698
24725
|
const el = scrollRef.current;
|
|
24699
24726
|
if (!el) return;
|
|
24700
24727
|
setShowTopGradient(el.scrollTop > 0);
|
|
@@ -24763,20 +24790,20 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
24763
24790
|
HowItWorksStep.displayName = "HowItWorksStep";
|
|
24764
24791
|
|
|
24765
24792
|
// src/onboarding/steps/profile-setup.tsx
|
|
24766
|
-
var
|
|
24793
|
+
var import_react44 = require("react");
|
|
24767
24794
|
var import_hooks74 = require("@agg-build/hooks");
|
|
24768
24795
|
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
24769
24796
|
var ProfileSetupStep = ({ onContinue }) => {
|
|
24770
24797
|
const labels = (0, import_hooks74.useLabels)();
|
|
24771
|
-
const [username, setUsername] = (0,
|
|
24772
|
-
const [avatarFile, setAvatarFile] = (0,
|
|
24773
|
-
const [avatarPreview, setAvatarPreview] = (0,
|
|
24774
|
-
const fileInputRef = (0,
|
|
24775
|
-
const handleAvatarClick = (0,
|
|
24798
|
+
const [username, setUsername] = (0, import_react44.useState)("");
|
|
24799
|
+
const [avatarFile, setAvatarFile] = (0, import_react44.useState)();
|
|
24800
|
+
const [avatarPreview, setAvatarPreview] = (0, import_react44.useState)();
|
|
24801
|
+
const fileInputRef = (0, import_react44.useRef)(null);
|
|
24802
|
+
const handleAvatarClick = (0, import_react44.useCallback)(() => {
|
|
24776
24803
|
var _a;
|
|
24777
24804
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
24778
24805
|
}, []);
|
|
24779
|
-
const handleFileChange = (0,
|
|
24806
|
+
const handleFileChange = (0, import_react44.useCallback)((e) => {
|
|
24780
24807
|
var _a;
|
|
24781
24808
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
24782
24809
|
if (!file) return;
|
|
@@ -24788,7 +24815,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
24788
24815
|
};
|
|
24789
24816
|
reader.readAsDataURL(file);
|
|
24790
24817
|
}, []);
|
|
24791
|
-
const handleContinue = (0,
|
|
24818
|
+
const handleContinue = (0, import_react44.useCallback)(() => {
|
|
24792
24819
|
onContinue({
|
|
24793
24820
|
username,
|
|
24794
24821
|
avatarFile,
|
|
@@ -25030,7 +25057,7 @@ ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
|
25030
25057
|
|
|
25031
25058
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
25032
25059
|
var import_sdk21 = require("@agg-build/sdk");
|
|
25033
|
-
var
|
|
25060
|
+
var import_react45 = require("react");
|
|
25034
25061
|
var import_hooks76 = require("@agg-build/hooks");
|
|
25035
25062
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
25036
25063
|
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
@@ -25040,15 +25067,15 @@ var ConnectKalshiModal = ({
|
|
|
25040
25067
|
onVerify
|
|
25041
25068
|
}) => {
|
|
25042
25069
|
const labels = (0, import_hooks76.useLabels)();
|
|
25043
|
-
const [apiKeyId, setApiKeyId] = (0,
|
|
25044
|
-
const [privateKey, setPrivateKey] = (0,
|
|
25045
|
-
const [verifying, setVerifying] = (0,
|
|
25046
|
-
const [error, setError] = (0,
|
|
25070
|
+
const [apiKeyId, setApiKeyId] = (0, import_react45.useState)("");
|
|
25071
|
+
const [privateKey, setPrivateKey] = (0, import_react45.useState)("");
|
|
25072
|
+
const [verifying, setVerifying] = (0, import_react45.useState)(false);
|
|
25073
|
+
const [error, setError] = (0, import_react45.useState)();
|
|
25047
25074
|
const canVerify = apiKeyId.trim().length > 0 && privateKey.trim().length > 0;
|
|
25048
|
-
const handleCancel = (0,
|
|
25075
|
+
const handleCancel = (0, import_react45.useCallback)(() => {
|
|
25049
25076
|
onOpenChange(false);
|
|
25050
25077
|
}, [onOpenChange]);
|
|
25051
|
-
const handleVerify = (0,
|
|
25078
|
+
const handleVerify = (0, import_react45.useCallback)(() => __async(null, null, function* () {
|
|
25052
25079
|
if (!canVerify || verifying) return;
|
|
25053
25080
|
setVerifying(true);
|
|
25054
25081
|
setError(void 0);
|
|
@@ -25077,7 +25104,7 @@ var ConnectKalshiModal = ({
|
|
|
25077
25104
|
privateKey,
|
|
25078
25105
|
verifying
|
|
25079
25106
|
]);
|
|
25080
|
-
const handleOpenChange = (0,
|
|
25107
|
+
const handleOpenChange = (0, import_react45.useCallback)(
|
|
25081
25108
|
(value) => {
|
|
25082
25109
|
if (value) {
|
|
25083
25110
|
setApiKeyId("");
|
|
@@ -25280,7 +25307,7 @@ var ConnectKalshiModal = ({
|
|
|
25280
25307
|
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
25281
25308
|
|
|
25282
25309
|
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
25283
|
-
var
|
|
25310
|
+
var import_react46 = require("react");
|
|
25284
25311
|
var import_hooks77 = require("@agg-build/hooks");
|
|
25285
25312
|
var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
|
|
25286
25313
|
var import_jsx_runtime172 = require("react/jsx-runtime");
|
|
@@ -25290,12 +25317,12 @@ var ConnectOnchainModal = ({
|
|
|
25290
25317
|
onConnect
|
|
25291
25318
|
}) => {
|
|
25292
25319
|
const labels = (0, import_hooks77.useLabels)();
|
|
25293
|
-
const [connecting, setConnecting] = (0,
|
|
25294
|
-
const [error, setError] = (0,
|
|
25295
|
-
const handleCancel = (0,
|
|
25320
|
+
const [connecting, setConnecting] = (0, import_react46.useState)(false);
|
|
25321
|
+
const [error, setError] = (0, import_react46.useState)();
|
|
25322
|
+
const handleCancel = (0, import_react46.useCallback)(() => {
|
|
25296
25323
|
onOpenChange(false);
|
|
25297
25324
|
}, [onOpenChange]);
|
|
25298
|
-
const handleConnect = (0,
|
|
25325
|
+
const handleConnect = (0, import_react46.useCallback)(() => __async(null, null, function* () {
|
|
25299
25326
|
if (connecting) return;
|
|
25300
25327
|
setConnecting(true);
|
|
25301
25328
|
setError(void 0);
|
|
@@ -25310,7 +25337,7 @@ var ConnectOnchainModal = ({
|
|
|
25310
25337
|
setConnecting(false);
|
|
25311
25338
|
}
|
|
25312
25339
|
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
25313
|
-
const handleOpenChange = (0,
|
|
25340
|
+
const handleOpenChange = (0, import_react46.useCallback)(
|
|
25314
25341
|
(value) => {
|
|
25315
25342
|
if (value) {
|
|
25316
25343
|
setError(void 0);
|
|
@@ -25402,48 +25429,48 @@ var OnboardingModal = ({
|
|
|
25402
25429
|
}) => {
|
|
25403
25430
|
var _a;
|
|
25404
25431
|
const labels = (0, import_hooks78.useLabels)();
|
|
25405
|
-
const [step, setStep] = (0,
|
|
25432
|
+
const [step, setStep] = (0, import_react47.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
25406
25433
|
const stepLabels = {
|
|
25407
25434
|
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
25408
25435
|
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
25409
25436
|
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
25410
25437
|
};
|
|
25411
25438
|
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
25412
|
-
const [kalshiModalOpen, setKalshiModalOpen] = (0,
|
|
25413
|
-
const [kalshiConnected, setKalshiConnected] = (0,
|
|
25414
|
-
const [onchainModalOpen, setOnchainModalOpen] = (0,
|
|
25415
|
-
const [onchainConnected, setOnchainConnected] = (0,
|
|
25416
|
-
(0,
|
|
25439
|
+
const [kalshiModalOpen, setKalshiModalOpen] = (0, import_react47.useState)(false);
|
|
25440
|
+
const [kalshiConnected, setKalshiConnected] = (0, import_react47.useState)(false);
|
|
25441
|
+
const [onchainModalOpen, setOnchainModalOpen] = (0, import_react47.useState)(false);
|
|
25442
|
+
const [onchainConnected, setOnchainConnected] = (0, import_react47.useState)(false);
|
|
25443
|
+
(0, import_react47.useEffect)(() => {
|
|
25417
25444
|
if (open) {
|
|
25418
25445
|
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
25419
25446
|
setKalshiConnected(false);
|
|
25420
25447
|
setOnchainConnected(false);
|
|
25421
25448
|
}
|
|
25422
25449
|
}, [open]);
|
|
25423
|
-
const handleHowItWorksContinue = (0,
|
|
25450
|
+
const handleHowItWorksContinue = (0, import_react47.useCallback)(() => {
|
|
25424
25451
|
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
25425
25452
|
}, []);
|
|
25426
|
-
const handleProfileContinue = (0,
|
|
25453
|
+
const handleProfileContinue = (0, import_react47.useCallback)(
|
|
25427
25454
|
(data) => {
|
|
25428
25455
|
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
25429
25456
|
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
25430
25457
|
},
|
|
25431
25458
|
[onProfileSubmit]
|
|
25432
25459
|
);
|
|
25433
|
-
const handleConnectContinue = (0,
|
|
25460
|
+
const handleConnectContinue = (0, import_react47.useCallback)(() => {
|
|
25434
25461
|
onComplete == null ? void 0 : onComplete();
|
|
25435
25462
|
}, [onComplete]);
|
|
25436
|
-
const handleOpenOnchainModal = (0,
|
|
25463
|
+
const handleOpenOnchainModal = (0, import_react47.useCallback)(() => {
|
|
25437
25464
|
setOnchainModalOpen(true);
|
|
25438
25465
|
}, []);
|
|
25439
|
-
const handleOnchainConnect = (0,
|
|
25466
|
+
const handleOnchainConnect = (0, import_react47.useCallback)(() => __async(null, null, function* () {
|
|
25440
25467
|
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
25441
25468
|
setOnchainConnected(true);
|
|
25442
25469
|
}), [onConnectOnchain]);
|
|
25443
|
-
const handleOpenKalshiModal = (0,
|
|
25470
|
+
const handleOpenKalshiModal = (0, import_react47.useCallback)(() => {
|
|
25444
25471
|
setKalshiModalOpen(true);
|
|
25445
25472
|
}, []);
|
|
25446
|
-
const handleKalshiVerify = (0,
|
|
25473
|
+
const handleKalshiVerify = (0, import_react47.useCallback)(
|
|
25447
25474
|
(credentials) => __async(null, null, function* () {
|
|
25448
25475
|
yield onConnectKalshi == null ? void 0 : onConnectKalshi(credentials);
|
|
25449
25476
|
setKalshiConnected(true);
|
|
@@ -25498,7 +25525,7 @@ OnboardingModal.displayName = "OnboardingModal";
|
|
|
25498
25525
|
|
|
25499
25526
|
// src/profile/index.tsx
|
|
25500
25527
|
var import_sdk22 = require("@agg-build/sdk");
|
|
25501
|
-
var
|
|
25528
|
+
var import_react50 = require("react");
|
|
25502
25529
|
var import_hooks81 = require("@agg-build/hooks");
|
|
25503
25530
|
|
|
25504
25531
|
// src/profile/profile-modal.constants.ts
|
|
@@ -25516,7 +25543,7 @@ var PROFILE_TAB_ITEMS = [
|
|
|
25516
25543
|
];
|
|
25517
25544
|
|
|
25518
25545
|
// src/profile/tabs/about-tab.tsx
|
|
25519
|
-
var
|
|
25546
|
+
var import_react48 = require("react");
|
|
25520
25547
|
var import_hooks79 = require("@agg-build/hooks");
|
|
25521
25548
|
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
25522
25549
|
var AboutTab = ({
|
|
@@ -25529,12 +25556,12 @@ var AboutTab = ({
|
|
|
25529
25556
|
avatarError: _avatarError
|
|
25530
25557
|
}) => {
|
|
25531
25558
|
const labels = (0, import_hooks79.useLabels)();
|
|
25532
|
-
const fileInputRef = (0,
|
|
25533
|
-
const handleAvatarClick = (0,
|
|
25559
|
+
const fileInputRef = (0, import_react48.useRef)(null);
|
|
25560
|
+
const handleAvatarClick = (0, import_react48.useCallback)(() => {
|
|
25534
25561
|
var _a;
|
|
25535
25562
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
25536
25563
|
}, []);
|
|
25537
|
-
const handleFileChange = (0,
|
|
25564
|
+
const handleFileChange = (0, import_react48.useCallback)(
|
|
25538
25565
|
(e) => {
|
|
25539
25566
|
var _a;
|
|
25540
25567
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -25648,7 +25675,7 @@ var AboutTab = ({
|
|
|
25648
25675
|
AboutTab.displayName = "AboutTab";
|
|
25649
25676
|
|
|
25650
25677
|
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
25651
|
-
var
|
|
25678
|
+
var import_react49 = require("react");
|
|
25652
25679
|
var import_hooks80 = require("@agg-build/hooks");
|
|
25653
25680
|
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
25654
25681
|
var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
@@ -25685,13 +25712,13 @@ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runti
|
|
|
25685
25712
|
var TRADING_ACCESS_VENUES = ["kalshi", "polymarket", "opinion", "predict"];
|
|
25686
25713
|
var VerifyIdentityButton = ({ onError }) => {
|
|
25687
25714
|
const client = (0, import_hooks80.useAggClient)();
|
|
25688
|
-
const [isInitiating, setIsInitiating] = (0,
|
|
25689
|
-
const [needsDepositAddress, setNeedsDepositAddress] = (0,
|
|
25715
|
+
const [isInitiating, setIsInitiating] = (0, import_react49.useState)(false);
|
|
25716
|
+
const [needsDepositAddress, setNeedsDepositAddress] = (0, import_react49.useState)(false);
|
|
25690
25717
|
const { isReady, isTimedOut } = (0, import_hooks80.useDepositAddresses)({
|
|
25691
25718
|
enabled: needsDepositAddress,
|
|
25692
25719
|
poll: true
|
|
25693
25720
|
});
|
|
25694
|
-
(0,
|
|
25721
|
+
(0, import_react49.useEffect)(() => {
|
|
25695
25722
|
if (!isInitiating || !isReady) return;
|
|
25696
25723
|
const redirectUri = window.location.href;
|
|
25697
25724
|
client.initiateKyc("kalshi", redirectUri).then((res) => {
|
|
@@ -25705,14 +25732,14 @@ var VerifyIdentityButton = ({ onError }) => {
|
|
|
25705
25732
|
setNeedsDepositAddress(false);
|
|
25706
25733
|
});
|
|
25707
25734
|
}, [isReady, isInitiating, client, onError]);
|
|
25708
|
-
(0,
|
|
25735
|
+
(0, import_react49.useEffect)(() => {
|
|
25709
25736
|
if (isTimedOut && isInitiating) {
|
|
25710
25737
|
setIsInitiating(false);
|
|
25711
25738
|
setNeedsDepositAddress(false);
|
|
25712
25739
|
onError == null ? void 0 : onError(new Error("Deposit address provisioning timed out"));
|
|
25713
25740
|
}
|
|
25714
25741
|
}, [isTimedOut, isInitiating, onError]);
|
|
25715
|
-
const handleClick = (0,
|
|
25742
|
+
const handleClick = (0, import_react49.useCallback)(() => {
|
|
25716
25743
|
setIsInitiating(true);
|
|
25717
25744
|
setNeedsDepositAddress(true);
|
|
25718
25745
|
}, []);
|
|
@@ -25877,18 +25904,18 @@ var ProfileModal = ({
|
|
|
25877
25904
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
25878
25905
|
const client = (0, import_hooks81.useAggClient)();
|
|
25879
25906
|
const { user, startAuth } = (0, import_hooks81.useAggAuthState)();
|
|
25880
|
-
const [activeTab, setActiveTab] = (0,
|
|
25907
|
+
const [activeTab, setActiveTab] = (0, import_react50.useState)(PROFILE_TAB_KEYS.ABOUT);
|
|
25881
25908
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
25882
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
25883
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
25884
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
25885
|
-
const [isSaving, setIsSaving] = (0,
|
|
25886
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
25887
|
-
(0,
|
|
25909
|
+
const [draftUsername, setDraftUsername] = (0, import_react50.useState)(resolvedInitialUsername);
|
|
25910
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react50.useState)();
|
|
25911
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react50.useState)();
|
|
25912
|
+
const [isSaving, setIsSaving] = (0, import_react50.useState)(false);
|
|
25913
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react50.useState)(null);
|
|
25914
|
+
(0, import_react50.useEffect)(() => {
|
|
25888
25915
|
var _a2;
|
|
25889
25916
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
25890
25917
|
}, [username, user == null ? void 0 : user.username]);
|
|
25891
|
-
const handleOpenChange = (0,
|
|
25918
|
+
const handleOpenChange = (0, import_react50.useCallback)(
|
|
25892
25919
|
(isOpen) => {
|
|
25893
25920
|
var _a2;
|
|
25894
25921
|
if (!isOpen) {
|
|
@@ -25912,7 +25939,7 @@ var ProfileModal = ({
|
|
|
25912
25939
|
setDraftAvatarPreview
|
|
25913
25940
|
]
|
|
25914
25941
|
);
|
|
25915
|
-
const handleDraftAvatarChange = (0,
|
|
25942
|
+
const handleDraftAvatarChange = (0, import_react50.useCallback)(
|
|
25916
25943
|
(file, preview) => {
|
|
25917
25944
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
25918
25945
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -25927,7 +25954,7 @@ var ProfileModal = ({
|
|
|
25927
25954
|
);
|
|
25928
25955
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
25929
25956
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
25930
|
-
const handleSave = (0,
|
|
25957
|
+
const handleSave = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
25931
25958
|
var _a2, _b2;
|
|
25932
25959
|
setIsSaving(true);
|
|
25933
25960
|
try {
|
|
@@ -25972,7 +25999,7 @@ var ProfileModal = ({
|
|
|
25972
25999
|
onSave,
|
|
25973
26000
|
originalUsername
|
|
25974
26001
|
]);
|
|
25975
|
-
const handleCancel = (0,
|
|
26002
|
+
const handleCancel = (0, import_react50.useCallback)(() => {
|
|
25976
26003
|
handleOpenChange(false);
|
|
25977
26004
|
}, [handleOpenChange]);
|
|
25978
26005
|
const isAccountConnected = (providers) => {
|
|
@@ -26016,7 +26043,7 @@ var ProfileModal = ({
|
|
|
26016
26043
|
if (typeof window === "undefined") return;
|
|
26017
26044
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
26018
26045
|
};
|
|
26019
|
-
const handleConnectTwitter = (0,
|
|
26046
|
+
const handleConnectTwitter = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26020
26047
|
const result = yield startAuth({
|
|
26021
26048
|
provider: "twitter",
|
|
26022
26049
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -26026,7 +26053,7 @@ var ProfileModal = ({
|
|
|
26026
26053
|
navigateTopWindow(result.url);
|
|
26027
26054
|
}
|
|
26028
26055
|
}), [onConnectTwitter, startAuth]);
|
|
26029
|
-
const handleConnectGoogle = (0,
|
|
26056
|
+
const handleConnectGoogle = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26030
26057
|
const result = yield startAuth({
|
|
26031
26058
|
provider: "google",
|
|
26032
26059
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -26036,7 +26063,7 @@ var ProfileModal = ({
|
|
|
26036
26063
|
navigateTopWindow(result.url);
|
|
26037
26064
|
}
|
|
26038
26065
|
}), [onConnectGoogle, startAuth]);
|
|
26039
|
-
const handleConnectApple = (0,
|
|
26066
|
+
const handleConnectApple = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26040
26067
|
const result = yield startAuth({
|
|
26041
26068
|
provider: "apple",
|
|
26042
26069
|
redirectUrl: resolveRedirectUrl()
|
|
@@ -26046,22 +26073,22 @@ var ProfileModal = ({
|
|
|
26046
26073
|
navigateTopWindow(result.url);
|
|
26047
26074
|
}
|
|
26048
26075
|
}), [onConnectApple, startAuth]);
|
|
26049
|
-
const handleDisconnectTwitter = (0,
|
|
26076
|
+
const handleDisconnectTwitter = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26050
26077
|
yield client.disconnectAccount("twitter");
|
|
26051
26078
|
yield client.getCurrentUser();
|
|
26052
26079
|
onDisconnectTwitter == null ? void 0 : onDisconnectTwitter();
|
|
26053
26080
|
}), [client, onDisconnectTwitter]);
|
|
26054
|
-
const handleDisconnectGoogle = (0,
|
|
26081
|
+
const handleDisconnectGoogle = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26055
26082
|
yield client.disconnectAccount("google");
|
|
26056
26083
|
yield client.getCurrentUser();
|
|
26057
26084
|
onDisconnectGoogle == null ? void 0 : onDisconnectGoogle();
|
|
26058
26085
|
}), [client, onDisconnectGoogle]);
|
|
26059
|
-
const handleDisconnectApple = (0,
|
|
26086
|
+
const handleDisconnectApple = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26060
26087
|
yield client.disconnectAccount("apple");
|
|
26061
26088
|
yield client.getCurrentUser();
|
|
26062
26089
|
onDisconnectApple == null ? void 0 : onDisconnectApple();
|
|
26063
26090
|
}), [client, onDisconnectApple]);
|
|
26064
|
-
const handleConnectEmail = (0,
|
|
26091
|
+
const handleConnectEmail = (0, import_react50.useCallback)(() => __async(null, null, function* () {
|
|
26065
26092
|
var _a2;
|
|
26066
26093
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
26067
26094
|
if (!typedEmail) return;
|
|
@@ -26072,7 +26099,7 @@ var ProfileModal = ({
|
|
|
26072
26099
|
});
|
|
26073
26100
|
onConnectEmail == null ? void 0 : onConnectEmail();
|
|
26074
26101
|
}), [onConnectEmail, startAuth]);
|
|
26075
|
-
const handleDisconnectWallet = (0,
|
|
26102
|
+
const handleDisconnectWallet = (0, import_react50.useCallback)(
|
|
26076
26103
|
(wallet) => __async(null, null, function* () {
|
|
26077
26104
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
26078
26105
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -26082,7 +26109,7 @@ var ProfileModal = ({
|
|
|
26082
26109
|
}),
|
|
26083
26110
|
[client, onDisconnectWallet]
|
|
26084
26111
|
);
|
|
26085
|
-
const providerActionMap = (0,
|
|
26112
|
+
const providerActionMap = (0, import_react50.useMemo)(
|
|
26086
26113
|
() => ({
|
|
26087
26114
|
twitter: {
|
|
26088
26115
|
connect: () => {
|
|
@@ -26124,7 +26151,7 @@ var ProfileModal = ({
|
|
|
26124
26151
|
handleDisconnectTwitter
|
|
26125
26152
|
]
|
|
26126
26153
|
);
|
|
26127
|
-
const resolvedWallets = (0,
|
|
26154
|
+
const resolvedWallets = (0, import_react50.useMemo)(() => {
|
|
26128
26155
|
var _a2, _b2;
|
|
26129
26156
|
if (wallets) return wallets;
|
|
26130
26157
|
return (_b2 = (_a2 = user == null ? void 0 : user.wallets) == null ? void 0 : _a2.map((wallet) => {
|
|
@@ -26136,7 +26163,7 @@ var ProfileModal = ({
|
|
|
26136
26163
|
};
|
|
26137
26164
|
})) != null ? _b2 : [];
|
|
26138
26165
|
}, [user == null ? void 0 : user.wallets, wallets]);
|
|
26139
|
-
const resolvedExchanges = (0,
|
|
26166
|
+
const resolvedExchanges = (0, import_react50.useMemo)(() => {
|
|
26140
26167
|
var _a2, _b2;
|
|
26141
26168
|
if (exchanges !== void 0) return exchanges;
|
|
26142
26169
|
const walletAccount = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.find(
|
|
@@ -26147,7 +26174,7 @@ var ProfileModal = ({
|
|
|
26147
26174
|
const displayAddress = (_b2 = shortenAddress(addr)) != null ? _b2 : addr;
|
|
26148
26175
|
return EVM_WALLET_VENUES.map((venue) => ({ venue, displayAddress, verified: false }));
|
|
26149
26176
|
}, [exchanges, user == null ? void 0 : user.accounts]);
|
|
26150
|
-
const handleDisconnectExchange = (0,
|
|
26177
|
+
const handleDisconnectExchange = (0, import_react50.useCallback)(
|
|
26151
26178
|
(venue) => __async(null, null, function* () {
|
|
26152
26179
|
if (exchanges !== void 0) {
|
|
26153
26180
|
onDisconnectExchangeProp == null ? void 0 : onDisconnectExchangeProp(venue);
|
|
@@ -26304,7 +26331,7 @@ ProfileModal.displayName = "ProfileModal";
|
|
|
26304
26331
|
|
|
26305
26332
|
// src/geo-block-modal/index.tsx
|
|
26306
26333
|
var import_hooks82 = require("@agg-build/hooks");
|
|
26307
|
-
var
|
|
26334
|
+
var import_react51 = require("react");
|
|
26308
26335
|
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
26309
26336
|
var GeoBlockModal = ({
|
|
26310
26337
|
open,
|
|
@@ -26313,7 +26340,7 @@ var GeoBlockModal = ({
|
|
|
26313
26340
|
classNames
|
|
26314
26341
|
}) => {
|
|
26315
26342
|
const labels = (0, import_hooks82.useLabels)();
|
|
26316
|
-
const handleConfirm = (0,
|
|
26343
|
+
const handleConfirm = (0, import_react51.useCallback)(() => {
|
|
26317
26344
|
onConfirm == null ? void 0 : onConfirm();
|
|
26318
26345
|
onOpenChange(false);
|
|
26319
26346
|
}, [onConfirm, onOpenChange]);
|