@agg-build/ui 4.15.0 → 4.17.2
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-UFU5HUHC.mjs → chunk-3Y2GCNVL.mjs} +100 -52
- package/dist/{chunk-HK4DEG4E.mjs → chunk-7E4UXCEX.mjs} +223 -169
- package/dist/{chunk-QQ2Q75BF.mjs → chunk-B5ALKYD5.mjs} +210 -184
- package/dist/{chunk-U6ANP4P5.mjs → chunk-BBDFSTIA.mjs} +6 -2
- package/dist/{chunk-MR6AORPA.mjs → chunk-JI5KV4QI.mjs} +4 -3
- package/dist/{chunk-BTQGP257.mjs → chunk-RZLM3M5R.mjs} +2 -2
- package/dist/{chunk-2OQCZNGY.mjs → chunk-TK62UB5F.mjs} +27 -16
- package/dist/events.js +32 -17
- package/dist/events.mjs +3 -3
- package/dist/index.js +1038 -922
- package/dist/index.mjs +9 -38
- package/dist/modals.js +214 -185
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +817 -675
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +6 -2
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +535 -442
- package/dist/trading.mjs +4 -4
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +0 -2
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +0 -2
- package/dist/types/auth/connect-button-view/index.d.mts +1 -1
- package/dist/types/auth/connect-button-view/index.d.ts +1 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +3 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +8 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +8 -0
- package/dist/types/primitives/modal/index.d.mts +1 -1
- package/dist/types/primitives/modal/index.d.ts +1 -1
- package/dist/types/primitives/modal/modal.types.d.mts +6 -0
- package/dist/types/primitives/modal/modal.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +12 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +12 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7490,11 +7490,13 @@ var formatRecurringMarketWindowTimeEt = (windowStart, windowEnd) => {
|
|
|
7490
7490
|
// src/events/shared/format-event-title.ts
|
|
7491
7491
|
var SPORT_CATEGORY_TOKENS = /* @__PURE__ */ new Set(["sport", "sports"]);
|
|
7492
7492
|
var RECURRING_CRYPTO_TIMESTAMP_SUFFIX = /\s+-\s+(?:jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|jun(?:e)?|jul(?:y)?|aug(?:ust)?|sep(?:t(?:ember)?)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)\b.*$/i;
|
|
7493
|
-
var RECURRING_CRYPTO_DURATION_SUFFIX = /\s+-\s+(?:5m(?:in)?|15m(?:in)?|1h|1d)$/i;
|
|
7493
|
+
var RECURRING_CRYPTO_DURATION_SUFFIX = /\s+-\s+(?:5m(?:in)?|15m(?:in)?|30m(?:in)?|1h|4h|1d)$/i;
|
|
7494
7494
|
var RECURRING_CRYPTO_DURATION_LABELS = {
|
|
7495
7495
|
PT5M: "5min",
|
|
7496
7496
|
PT15M: "15min",
|
|
7497
|
+
PT30M: "30min",
|
|
7497
7498
|
PT1H: "1h",
|
|
7499
|
+
PT4H: "4h",
|
|
7498
7500
|
P1D: "1d"
|
|
7499
7501
|
};
|
|
7500
7502
|
var normalizeCategoryToken = (value) => {
|
|
@@ -8950,7 +8952,8 @@ var ModalContainer = ({
|
|
|
8950
8952
|
maxWidth = "600px",
|
|
8951
8953
|
classNames,
|
|
8952
8954
|
"aria-label": ariaLabel,
|
|
8953
|
-
"aria-labelledby": ariaLabelledBy
|
|
8955
|
+
"aria-labelledby": ariaLabelledBy,
|
|
8956
|
+
onOpenAutoFocus
|
|
8954
8957
|
}) => {
|
|
8955
8958
|
const {
|
|
8956
8959
|
general: { rootClassName },
|
|
@@ -8981,6 +8984,7 @@ var ModalContainer = ({
|
|
|
8981
8984
|
),
|
|
8982
8985
|
"aria-label": ariaLabel,
|
|
8983
8986
|
"aria-labelledby": ariaLabelledBy,
|
|
8987
|
+
onOpenAutoFocus,
|
|
8984
8988
|
onCloseAutoFocus: (event) => {
|
|
8985
8989
|
event.preventDefault();
|
|
8986
8990
|
},
|
|
@@ -11070,7 +11074,6 @@ function AggProvider(_a) {
|
|
|
11070
11074
|
|
|
11071
11075
|
// src/auth/connect-button-view/index.tsx
|
|
11072
11076
|
var import_hooks42 = require("@agg-build/hooks");
|
|
11073
|
-
var import_sdk14 = require("@agg-build/sdk");
|
|
11074
11077
|
var DropdownMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
11075
11078
|
|
|
11076
11079
|
// src/pages/user-profile/components/default-avatar.tsx
|
|
@@ -11563,7 +11566,6 @@ var AuthConnectButtonView = ({
|
|
|
11563
11566
|
profileLabel,
|
|
11564
11567
|
totalBalance,
|
|
11565
11568
|
positionsBalance,
|
|
11566
|
-
kalshiBalance = null,
|
|
11567
11569
|
claimReadyCount = 0,
|
|
11568
11570
|
onClaimWinningsClick,
|
|
11569
11571
|
walletMethods,
|
|
@@ -11571,19 +11573,12 @@ var AuthConnectButtonView = ({
|
|
|
11571
11573
|
}) => {
|
|
11572
11574
|
var _a;
|
|
11573
11575
|
const labels = (0, import_hooks42.useLabels)();
|
|
11574
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks42.useAppConfig)();
|
|
11575
11576
|
const { isPaperMode } = (0, import_hooks42.useResolvedExecutionMode)();
|
|
11576
|
-
const isKalshiAvailable = (0, import_hooks42.getVenueAvailabilityState)({
|
|
11577
|
-
venueId: import_sdk14.Venue.kalshi,
|
|
11578
|
-
disabledVenues,
|
|
11579
|
-
isConfigLoading: isAppConfigLoading
|
|
11580
|
-
}) === "available";
|
|
11581
11577
|
const {
|
|
11582
11578
|
general: { rootClassName },
|
|
11583
11579
|
features: { enableAnimations }
|
|
11584
11580
|
} = (0, import_hooks42.useSdkUiConfig)();
|
|
11585
11581
|
const resolvedProfileLabel = profileLabel || labels.auth.myProfile;
|
|
11586
|
-
const kalshiBalanceLabel = formatUsd(kalshiBalance != null ? kalshiBalance : 0);
|
|
11587
11582
|
const authLabelsWithClaim = labels.auth;
|
|
11588
11583
|
const resolveClaimTooltipLabel = (count) => {
|
|
11589
11584
|
var _a2, _b;
|
|
@@ -11711,18 +11706,7 @@ var AuthConnectButtonView = ({
|
|
|
11711
11706
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
11712
11707
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "h-3.5 w-3.5 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(Icon, { name: "wallet-filled", size: "small", className: "text-agg-muted-foreground" }) }),
|
|
11713
11708
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: cn("agg-type-label text-agg-foreground", classNames == null ? void 0 : classNames.balanceText), children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(LoadingIcon, { size: "small" }) : formatUsd(totalBalance) })
|
|
11714
|
-
] })
|
|
11715
|
-
isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
11716
|
-
"div",
|
|
11717
|
-
{
|
|
11718
|
-
className: "flex items-center gap-2",
|
|
11719
|
-
"aria-label": `${labels.userProfile.balance.kalshiBalance}: ${kalshiBalanceLabel}`,
|
|
11720
|
-
children: [
|
|
11721
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(VenueLogo, { venue: import_sdk14.Venue.kalshi, size: "small", className: "size-3.5" }),
|
|
11722
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "agg-type-label text-agg-foreground", children: kalshiBalanceLabel })
|
|
11723
|
-
]
|
|
11724
|
-
}
|
|
11725
|
-
) : null
|
|
11709
|
+
] })
|
|
11726
11710
|
] }),
|
|
11727
11711
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: onProfileMenuOpenChange, children: [
|
|
11728
11712
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)(
|
|
@@ -11848,14 +11832,7 @@ var AuthConnectButtonView = ({
|
|
|
11848
11832
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: "Positions Value" })
|
|
11849
11833
|
] }),
|
|
11850
11834
|
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground text-left", children: isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(LoadingIcon, { size: "small" }) : formatUsd(positionsBalance) })
|
|
11851
|
-
] })
|
|
11852
|
-
isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex min-w-0 flex-col gap-2", children: [
|
|
11853
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
11854
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)(VenueLogo, { venue: import_sdk14.Venue.kalshi, size: "small", className: "size-4" }),
|
|
11855
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { className: "truncate text-agg-sm leading-agg-5 text-agg-foreground", children: labels.userProfile.balance.kalshiBalance })
|
|
11856
|
-
] }),
|
|
11857
|
-
/* @__PURE__ */ (0, import_jsx_runtime148.jsx)("p", { className: "text-left text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground", children: kalshiBalanceLabel })
|
|
11858
|
-
] }) : null
|
|
11835
|
+
] })
|
|
11859
11836
|
] })
|
|
11860
11837
|
]
|
|
11861
11838
|
}
|
|
@@ -13004,7 +12981,7 @@ ChartTypeSwitch.displayName = "ChartTypeSwitch";
|
|
|
13004
12981
|
var import_hooks45 = require("@agg-build/hooks");
|
|
13005
12982
|
|
|
13006
12983
|
// src/events/market-details/market-details.utils.ts
|
|
13007
|
-
var
|
|
12984
|
+
var import_sdk15 = require("@agg-build/sdk");
|
|
13008
12985
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
13009
12986
|
|
|
13010
12987
|
// src/events/item-details/event-list-item-details.utils.ts
|
|
@@ -13350,12 +13327,12 @@ var resolveMarketChartLiveState = ({
|
|
|
13350
13327
|
};
|
|
13351
13328
|
|
|
13352
13329
|
// src/events/orderbook/orderbook.utils.ts
|
|
13353
|
-
var
|
|
13354
|
-
var isOrderBookLevel = (v) => (0,
|
|
13330
|
+
var import_sdk14 = require("@agg-build/sdk");
|
|
13331
|
+
var isOrderBookLevel = (v) => (0, import_sdk14.hasShape)(v, {
|
|
13355
13332
|
price: (p) => typeof p === "number" && p >= 0 && p <= 1,
|
|
13356
13333
|
size: (s) => typeof s === "number" && s >= 0
|
|
13357
13334
|
});
|
|
13358
|
-
var isOrderBookRow = (v) => (0,
|
|
13335
|
+
var isOrderBookRow = (v) => (0, import_sdk14.hasShape)(v, {
|
|
13359
13336
|
id: (x) => typeof x === "string",
|
|
13360
13337
|
venue: (x) => typeof x === "string" && x.length > 0,
|
|
13361
13338
|
price: (p) => typeof p === "number" && p >= 0 && p <= 1,
|
|
@@ -13379,9 +13356,9 @@ var resolveOrderBookRows = ({
|
|
|
13379
13356
|
var _a;
|
|
13380
13357
|
return ((_a = result.orderbook[side]) != null ? _a : []).flatMap(
|
|
13381
13358
|
(level, index) => {
|
|
13382
|
-
const parsedLevel = (0,
|
|
13359
|
+
const parsedLevel = (0, import_sdk14.safeParse)(level, isOrderBookLevel);
|
|
13383
13360
|
if (!parsedLevel.success) return [];
|
|
13384
|
-
const parsedRow = (0,
|
|
13361
|
+
const parsedRow = (0, import_sdk14.safeParse)(
|
|
13385
13362
|
{
|
|
13386
13363
|
id: `${result.market.id}-${side}-${index}-${parsedLevel.data.price}`,
|
|
13387
13364
|
venue: result.market.venue,
|
|
@@ -13456,7 +13433,7 @@ var hasBinaryLabels = (labels) => {
|
|
|
13456
13433
|
return normalizedLabels.includes("yes") && normalizedLabels.includes("no");
|
|
13457
13434
|
};
|
|
13458
13435
|
var resolveInitialTab = (defaultTab) => {
|
|
13459
|
-
const parsedTab = (0,
|
|
13436
|
+
const parsedTab = (0, import_sdk15.safeParse)(defaultTab, isMarketDetailsTab);
|
|
13460
13437
|
if (parsedTab.success) return parsedTab.data;
|
|
13461
13438
|
return "order-book";
|
|
13462
13439
|
};
|
|
@@ -15341,13 +15318,14 @@ var parseSettlementDateMs = (value) => {
|
|
|
15341
15318
|
var isDateLikeDifference = (canonicalKey) => {
|
|
15342
15319
|
return canonicalKey === "resolution_timing" || canonicalKey === "start_date" || canonicalKey === "end_date";
|
|
15343
15320
|
};
|
|
15344
|
-
var
|
|
15345
|
-
if (!isDateLikeDifference(canonicalKey)) return false;
|
|
15321
|
+
var hasEqualValuesAcrossVenues = (difference) => {
|
|
15346
15322
|
const values = Object.values(difference.perVenue);
|
|
15347
15323
|
if (values.length < 2) return false;
|
|
15348
15324
|
const timestamps = values.map(parseSettlementDateMs);
|
|
15349
|
-
if (timestamps.
|
|
15350
|
-
|
|
15325
|
+
if (timestamps.every((timestamp) => timestamp !== null)) {
|
|
15326
|
+
return new Set(timestamps).size === 1;
|
|
15327
|
+
}
|
|
15328
|
+
return new Set(values.map(normalizeSettlementForCompare)).size === 1;
|
|
15351
15329
|
};
|
|
15352
15330
|
var resolveDifferenceSeverity = (difference, canonicalKey) => {
|
|
15353
15331
|
var _a;
|
|
@@ -15382,7 +15360,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
15382
15360
|
if (!title2 || Object.keys(perVenue).length === 0) continue;
|
|
15383
15361
|
const difference = __spreadProps(__spreadValues({}, rawDifference), { title: title2, perVenue });
|
|
15384
15362
|
const canonicalKey = resolveCanonicalDifferenceKey(difference);
|
|
15385
|
-
if (
|
|
15363
|
+
if (hasEqualValuesAcrossVenues(difference)) continue;
|
|
15386
15364
|
const existing = byCanonicalKey.get(canonicalKey);
|
|
15387
15365
|
if (existing) {
|
|
15388
15366
|
byCanonicalKey.set(canonicalKey, __spreadProps(__spreadValues({}, existing), {
|
|
@@ -15396,7 +15374,7 @@ var prepareSettlementDifferences = (differences) => {
|
|
|
15396
15374
|
originalIndex
|
|
15397
15375
|
}));
|
|
15398
15376
|
}
|
|
15399
|
-
return Array.from(byCanonicalKey.values()).sort((left, right) => {
|
|
15377
|
+
return Array.from(byCanonicalKey.values()).filter((difference) => !hasEqualValuesAcrossVenues(difference)).sort((left, right) => {
|
|
15400
15378
|
const severityDelta = Number(right.severity === "critical") - Number(left.severity === "critical");
|
|
15401
15379
|
if (severityDelta !== 0) return severityDelta;
|
|
15402
15380
|
return left.originalIndex - right.originalIndex;
|
|
@@ -15410,9 +15388,7 @@ var resolveSettlementVenueLabel = (venue, labels) => {
|
|
|
15410
15388
|
return (_a = labels.venues[venue]) != null ? _a : formatVenueFallbackLabel(venue);
|
|
15411
15389
|
};
|
|
15412
15390
|
var resolveDifferenceVenueKeys = (difference, settlementVenues) => {
|
|
15413
|
-
const
|
|
15414
|
-
if (!isDateLikeDifference(difference.canonicalKey)) return explicitVenues;
|
|
15415
|
-
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...explicitVenues];
|
|
15391
|
+
const allVenues = [...settlementVenues != null ? settlementVenues : [], ...Object.keys(difference.perVenue)];
|
|
15416
15392
|
return Array.from(new Set(allVenues.filter((venue) => venue.trim().length > 0)));
|
|
15417
15393
|
};
|
|
15418
15394
|
var resolveDifferenceIconClassName = (canonicalKey) => {
|
|
@@ -15451,6 +15427,12 @@ var buildSettlementVenueRules = ({
|
|
|
15451
15427
|
if (!venueRules.includes(content2)) venueRules.push(content2);
|
|
15452
15428
|
rulesByVenue.set(venue2, venueRules);
|
|
15453
15429
|
}
|
|
15430
|
+
if (rulesByVenue.size > 0) {
|
|
15431
|
+
for (const venue2 of settlementVenues != null ? settlementVenues : []) {
|
|
15432
|
+
const trimmedVenue = venue2.trim();
|
|
15433
|
+
if (trimmedVenue && !rulesByVenue.has(trimmedVenue)) rulesByVenue.set(trimmedVenue, []);
|
|
15434
|
+
}
|
|
15435
|
+
}
|
|
15454
15436
|
return Array.from(rulesByVenue, ([venue2, contents]) => ({
|
|
15455
15437
|
venue: venue2,
|
|
15456
15438
|
content: contents.join("\n\n")
|
|
@@ -15460,6 +15442,11 @@ var buildSettlementVenueRules = ({
|
|
|
15460
15442
|
const venue = (_b = settlementVenues == null ? void 0 : settlementVenues.find((candidate) => candidate.trim().length > 0)) == null ? void 0 : _b.trim();
|
|
15461
15443
|
return content && venue ? [{ venue, content }] : [];
|
|
15462
15444
|
};
|
|
15445
|
+
var repeatsQuestion = (content, question) => {
|
|
15446
|
+
const normalizedQuestion = normalizeSettlementForCompare(question != null ? question : "");
|
|
15447
|
+
if (!normalizedQuestion) return false;
|
|
15448
|
+
return normalizeSettlementForCompare(content) === normalizedQuestion;
|
|
15449
|
+
};
|
|
15463
15450
|
var isDuplicatedByVenueRules = (content, venueRules) => {
|
|
15464
15451
|
const normalizedContent = normalizeSettlementForCompare(content);
|
|
15465
15452
|
if (!normalizedContent) return false;
|
|
@@ -15476,8 +15463,8 @@ var SettlementVenueRules = ({
|
|
|
15476
15463
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.trading.settlementFullRulesTitle }),
|
|
15477
15464
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "flex w-full flex-col items-start gap-4", children: rules.map((rule) => {
|
|
15478
15465
|
const venueLabel = resolveSettlementVenueLabel(rule.venue, labels);
|
|
15479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("details", { className: "
|
|
15480
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("summary", { className: "flex cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground
|
|
15466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("details", { className: "w-full", children: [
|
|
15467
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("summary", { className: "group/agg-settlement-rule flex w-fit cursor-pointer list-none items-center gap-2 text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground transition-colors marker:hidden", children: [
|
|
15481
15468
|
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)(
|
|
15482
15469
|
VenueLogo,
|
|
15483
15470
|
{
|
|
@@ -15501,7 +15488,7 @@ var SettlementVenueRules = ({
|
|
|
15501
15488
|
}
|
|
15502
15489
|
)
|
|
15503
15490
|
] }),
|
|
15504
|
-
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "mt-3 pl-6", children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(SettlementTextRenderer, { content: rule.content }) })
|
|
15491
|
+
/* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "mt-3 pl-6", children: rule.content ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(SettlementTextRenderer, { content: rule.content }) : /* @__PURE__ */ (0, import_jsx_runtime154.jsx)("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: labels.trading.settlementValueUnavailable }) })
|
|
15505
15492
|
] }, rule.venue);
|
|
15506
15493
|
}) })
|
|
15507
15494
|
] });
|
|
@@ -15529,9 +15516,10 @@ var Settlement = ({
|
|
|
15529
15516
|
}),
|
|
15530
15517
|
[eventDescription, marketDescription, primaryRules]
|
|
15531
15518
|
);
|
|
15519
|
+
const isSingleVenueCluster = settlementVenues !== void 0 && settlementVenues.length < 2;
|
|
15532
15520
|
const settlementDifferences = (0, import_react24.useMemo)(
|
|
15533
|
-
() => prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
15534
|
-
[settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
15521
|
+
() => isSingleVenueCluster ? [] : prepareSettlementDifferences(settlementDiff == null ? void 0 : settlementDiff.differences),
|
|
15522
|
+
[isSingleVenueCluster, settlementDiff == null ? void 0 : settlementDiff.differences]
|
|
15535
15523
|
);
|
|
15536
15524
|
const eventBlock = (_a = blocks.find((block) => block.key === "eventDescription")) != null ? _a : null;
|
|
15537
15525
|
const marketBlock = (_b = blocks.find((block) => block.key === "marketDescription")) != null ? _b : null;
|
|
@@ -15547,7 +15535,7 @@ var Settlement = ({
|
|
|
15547
15535
|
);
|
|
15548
15536
|
const hasSettlementDifferences = settlementDifferences.length > 0;
|
|
15549
15537
|
const hasVenueSettlementRules = venueRuleBlocks.length > 0;
|
|
15550
|
-
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) ? eventBlock : null;
|
|
15538
|
+
const standaloneEventBlock = eventBlock && !isDuplicatedByVenueRules(eventBlock.content, venueRuleBlocks) && !repeatsQuestion(eventBlock.content, question) ? eventBlock : null;
|
|
15551
15539
|
const standaloneMarketBlock = hasVenueSettlementRules ? null : marketBlock;
|
|
15552
15540
|
const standalonePrimaryRulesBlock = hasVenueSettlementRules ? null : primaryRulesBlock;
|
|
15553
15541
|
const hasStandaloneSettlementText = hasVenueSettlementRules ? standaloneEventBlock !== null : blocks.length > 0;
|
|
@@ -18893,7 +18881,7 @@ MarketDetailsList.displayName = "MarketDetailsList";
|
|
|
18893
18881
|
|
|
18894
18882
|
// src/events/list/index.tsx
|
|
18895
18883
|
var import_hooks60 = require("@agg-build/hooks");
|
|
18896
|
-
var
|
|
18884
|
+
var import_sdk18 = require("@agg-build/sdk");
|
|
18897
18885
|
var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
|
|
18898
18886
|
var import_react33 = require("react");
|
|
18899
18887
|
|
|
@@ -19016,12 +19004,12 @@ CategorySidebar.displayName = "CategorySidebar";
|
|
|
19016
19004
|
|
|
19017
19005
|
// src/events/list/event-list-tabs.tsx
|
|
19018
19006
|
var import_hooks59 = require("@agg-build/hooks");
|
|
19019
|
-
var
|
|
19007
|
+
var import_sdk17 = require("@agg-build/sdk");
|
|
19020
19008
|
var import_react32 = require("react");
|
|
19021
19009
|
|
|
19022
19010
|
// src/events/list/event-list.constants.ts
|
|
19023
19011
|
var import_hooks58 = require("@agg-build/hooks");
|
|
19024
|
-
var
|
|
19012
|
+
var import_sdk16 = require("@agg-build/sdk");
|
|
19025
19013
|
var DEFAULT_EVENTS_LIMIT = 50;
|
|
19026
19014
|
var DEFAULT_EVENT_LIST_SORT = "volume24hr";
|
|
19027
19015
|
var EVENT_LIST_SORT_VALUES = [
|
|
@@ -19036,7 +19024,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
19036
19024
|
value: "matched",
|
|
19037
19025
|
label: labels.eventList.matchedTab,
|
|
19038
19026
|
iconName: "circle-overlap",
|
|
19039
|
-
matchStatus: [
|
|
19027
|
+
matchStatus: [import_sdk16.MatchStatus.matched, import_sdk16.MatchStatus.verified]
|
|
19040
19028
|
},
|
|
19041
19029
|
{
|
|
19042
19030
|
value: "all",
|
|
@@ -19044,66 +19032,66 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
19044
19032
|
iconName: "apps"
|
|
19045
19033
|
},
|
|
19046
19034
|
{
|
|
19047
|
-
value:
|
|
19035
|
+
value: import_sdk16.Venue.polymarket,
|
|
19048
19036
|
label: labels.venues.polymarket,
|
|
19049
|
-
venueLogo:
|
|
19050
|
-
venues: [
|
|
19037
|
+
venueLogo: import_sdk16.Venue.polymarket,
|
|
19038
|
+
venues: [import_sdk16.Venue.polymarket]
|
|
19051
19039
|
},
|
|
19052
19040
|
{
|
|
19053
|
-
value:
|
|
19041
|
+
value: import_sdk16.Venue.kalshi,
|
|
19054
19042
|
label: labels.venues.kalshi,
|
|
19055
|
-
venueLogo:
|
|
19056
|
-
venues: [
|
|
19043
|
+
venueLogo: import_sdk16.Venue.kalshi,
|
|
19044
|
+
venues: [import_sdk16.Venue.kalshi]
|
|
19057
19045
|
},
|
|
19058
19046
|
{
|
|
19059
|
-
value:
|
|
19047
|
+
value: import_sdk16.Venue.limitless,
|
|
19060
19048
|
label: labels.venues.limitless,
|
|
19061
|
-
venueLogo:
|
|
19062
|
-
venues: [
|
|
19049
|
+
venueLogo: import_sdk16.Venue.limitless,
|
|
19050
|
+
venues: [import_sdk16.Venue.limitless]
|
|
19063
19051
|
},
|
|
19064
19052
|
{
|
|
19065
|
-
value:
|
|
19053
|
+
value: import_sdk16.Venue.predict,
|
|
19066
19054
|
label: labels.venues.predict,
|
|
19067
|
-
venueLogo:
|
|
19068
|
-
venues: [
|
|
19055
|
+
venueLogo: import_sdk16.Venue.predict,
|
|
19056
|
+
venues: [import_sdk16.Venue.predict]
|
|
19069
19057
|
},
|
|
19070
19058
|
{
|
|
19071
|
-
value:
|
|
19059
|
+
value: import_sdk16.Venue.pred,
|
|
19072
19060
|
label: labels.venues.pred,
|
|
19073
|
-
venueLogo:
|
|
19074
|
-
venues: [
|
|
19061
|
+
venueLogo: import_sdk16.Venue.pred,
|
|
19062
|
+
venues: [import_sdk16.Venue.pred]
|
|
19075
19063
|
},
|
|
19076
19064
|
{
|
|
19077
|
-
value:
|
|
19065
|
+
value: import_sdk16.Venue.hyperliquid,
|
|
19078
19066
|
label: labels.venues.hyperliquid,
|
|
19079
|
-
venueLogo:
|
|
19080
|
-
venues: [
|
|
19067
|
+
venueLogo: import_sdk16.Venue.hyperliquid,
|
|
19068
|
+
venues: [import_sdk16.Venue.hyperliquid]
|
|
19081
19069
|
// isComingSoon: true,
|
|
19082
19070
|
},
|
|
19083
19071
|
{
|
|
19084
|
-
value:
|
|
19072
|
+
value: import_sdk16.Venue.myriad,
|
|
19085
19073
|
label: labels.venues.myriad,
|
|
19086
|
-
venueLogo:
|
|
19087
|
-
venues: [
|
|
19074
|
+
venueLogo: import_sdk16.Venue.myriad,
|
|
19075
|
+
venues: [import_sdk16.Venue.myriad]
|
|
19088
19076
|
// isComingSoon: true,
|
|
19089
19077
|
},
|
|
19090
19078
|
{
|
|
19091
|
-
value:
|
|
19079
|
+
value: import_sdk16.Venue.novig,
|
|
19092
19080
|
label: labels.venues.novig,
|
|
19093
|
-
venueLogo:
|
|
19094
|
-
venues: [
|
|
19081
|
+
venueLogo: import_sdk16.Venue.novig,
|
|
19082
|
+
venues: [import_sdk16.Venue.novig]
|
|
19095
19083
|
},
|
|
19096
19084
|
{
|
|
19097
|
-
value:
|
|
19085
|
+
value: import_sdk16.Venue.prophetx,
|
|
19098
19086
|
label: labels.venues.prophetx,
|
|
19099
|
-
venueLogo:
|
|
19100
|
-
venues: [
|
|
19087
|
+
venueLogo: import_sdk16.Venue.prophetx,
|
|
19088
|
+
venues: [import_sdk16.Venue.prophetx]
|
|
19101
19089
|
},
|
|
19102
19090
|
{
|
|
19103
|
-
value:
|
|
19091
|
+
value: import_sdk16.Venue.opinion,
|
|
19104
19092
|
label: labels.venues.opinion,
|
|
19105
|
-
venueLogo:
|
|
19106
|
-
venues: [
|
|
19093
|
+
venueLogo: import_sdk16.Venue.opinion,
|
|
19094
|
+
venues: [import_sdk16.Venue.opinion],
|
|
19107
19095
|
isComingSoon: true
|
|
19108
19096
|
}
|
|
19109
19097
|
];
|
|
@@ -19122,7 +19110,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
19122
19110
|
|
|
19123
19111
|
// src/events/list/event-list-tabs.tsx
|
|
19124
19112
|
var import_jsx_runtime163 = require("react/jsx-runtime");
|
|
19125
|
-
var DEFAULT_HIDDEN_VENUES = new Set((0,
|
|
19113
|
+
var DEFAULT_HIDDEN_VENUES = new Set((0, import_sdk17.getEffectiveDisabledVenues)(void 0));
|
|
19126
19114
|
var renderTabIcon = (tab, isActive) => {
|
|
19127
19115
|
if (tab.iconName === "warning-filled") {
|
|
19128
19116
|
return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" });
|
|
@@ -19155,7 +19143,7 @@ var useEventListTabs = (tabs) => {
|
|
|
19155
19143
|
// `/app/config` resolves. That prevents partner-opt-in venues such as
|
|
19156
19144
|
// Novig from flashing briefly for apps that still disable them, while
|
|
19157
19145
|
// ordinary active venues continue rendering immediately.
|
|
19158
|
-
isConfigLoading: isAppConfigLoading && ((0,
|
|
19146
|
+
isConfigLoading: isAppConfigLoading && ((0, import_sdk17.isVenueInactive)(tab.venueLogo) || DEFAULT_HIDDEN_VENUES.has(tab.venueLogo)),
|
|
19159
19147
|
isLocationBlocked
|
|
19160
19148
|
});
|
|
19161
19149
|
if (availabilityState === "hidden") return [];
|
|
@@ -19351,7 +19339,7 @@ var EventList = ({
|
|
|
19351
19339
|
const isDiscoveryFiltersEnabled = enableVenueEventDiscoveryFilters && !search;
|
|
19352
19340
|
const resolvedTabs = useEventListTabs();
|
|
19353
19341
|
const visibleVenues = (0, import_react33.useMemo)(
|
|
19354
|
-
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks60.getVisibleVenueIdsByConfig)(
|
|
19342
|
+
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks60.getVisibleVenueIdsByConfig)(import_sdk18.VENUES, disabledVenues),
|
|
19355
19343
|
[disabledVenues]
|
|
19356
19344
|
);
|
|
19357
19345
|
const [internalActiveTabValue, setInternalActiveTabValue] = (0, import_react33.useState)(
|
|
@@ -19864,18 +19852,18 @@ EventList.displayName = "EventList";
|
|
|
19864
19852
|
|
|
19865
19853
|
// src/pages/home/index.tsx
|
|
19866
19854
|
var import_hooks79 = require("@agg-build/hooks");
|
|
19867
|
-
var
|
|
19868
|
-
var
|
|
19855
|
+
var import_sdk25 = require("@agg-build/sdk");
|
|
19856
|
+
var import_react52 = require("react");
|
|
19869
19857
|
|
|
19870
19858
|
// src/pages/event-market/index.tsx
|
|
19871
19859
|
var import_hooks78 = require("@agg-build/hooks");
|
|
19872
|
-
var
|
|
19860
|
+
var import_react49 = require("react");
|
|
19873
19861
|
|
|
19874
19862
|
// src/trading/types.ts
|
|
19875
|
-
var
|
|
19876
|
-
var isVenue = (0,
|
|
19877
|
-
var parseVenue = (v) => (0,
|
|
19878
|
-
var parseAmount = (v) => (0,
|
|
19863
|
+
var import_sdk19 = require("@agg-build/sdk");
|
|
19864
|
+
var isVenue = (0, import_sdk19.enumGuard)(import_sdk19.Venue);
|
|
19865
|
+
var parseVenue = (v) => (0, import_sdk19.safeParse)(v, isVenue);
|
|
19866
|
+
var parseAmount = (v) => (0, import_sdk19.safeParse)(v, import_sdk19.isFiniteNonNeg);
|
|
19879
19867
|
|
|
19880
19868
|
// src/trading/settlement/settlement-details.tsx
|
|
19881
19869
|
var import_hooks61 = require("@agg-build/hooks");
|
|
@@ -19948,13 +19936,13 @@ SettlementDetails.displayName = "SettlementDetails";
|
|
|
19948
19936
|
|
|
19949
19937
|
// src/trading/place-order/index.tsx
|
|
19950
19938
|
var import_hooks71 = require("@agg-build/hooks");
|
|
19951
|
-
var
|
|
19952
|
-
var
|
|
19939
|
+
var import_sdk24 = require("@agg-build/sdk");
|
|
19940
|
+
var import_react41 = __toESM(require("@number-flow/react"));
|
|
19953
19941
|
var Popover = __toESM(require("@radix-ui/react-popover"));
|
|
19954
19942
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
19955
19943
|
var import_timezone2 = __toESM(require("dayjs/plugin/timezone"));
|
|
19956
19944
|
var import_utc2 = __toESM(require("dayjs/plugin/utc"));
|
|
19957
|
-
var
|
|
19945
|
+
var import_react42 = require("react");
|
|
19958
19946
|
|
|
19959
19947
|
// src/geo-block-banner/index.tsx
|
|
19960
19948
|
var import_hooks62 = require("@agg-build/hooks");
|
|
@@ -19985,8 +19973,8 @@ var GeoBlockBanner = ({
|
|
|
19985
19973
|
GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
19986
19974
|
|
|
19987
19975
|
// src/kyc/shared-kyc.ts
|
|
19988
|
-
var
|
|
19989
|
-
var TEMPORARY_SHARED_KYC_VENUES = /* @__PURE__ */ new Set([
|
|
19976
|
+
var import_sdk20 = require("@agg-build/sdk");
|
|
19977
|
+
var TEMPORARY_SHARED_KYC_VENUES = /* @__PURE__ */ new Set([import_sdk20.Venue.novig, import_sdk20.Venue.prophetx]);
|
|
19990
19978
|
var venueRequiresSharedKyc = ({
|
|
19991
19979
|
venue,
|
|
19992
19980
|
requiresKyc
|
|
@@ -20292,7 +20280,7 @@ var import_hooks69 = require("@agg-build/hooks");
|
|
|
20292
20280
|
var Dialog6 = __toESM(require("@radix-ui/react-dialog"));
|
|
20293
20281
|
|
|
20294
20282
|
// src/onboarding/onboarding-modal.constants.ts
|
|
20295
|
-
var
|
|
20283
|
+
var import_sdk21 = require("@agg-build/sdk");
|
|
20296
20284
|
var HOW_IT_WORKS_FEATURE_KEYS = [
|
|
20297
20285
|
"createAccount",
|
|
20298
20286
|
"linkAccounts",
|
|
@@ -20305,11 +20293,11 @@ var ONBOARDING_STEPS = {
|
|
|
20305
20293
|
CONNECT_ACCOUNTS: 2
|
|
20306
20294
|
};
|
|
20307
20295
|
var ONCHAIN_VENUES = [
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
].filter(
|
|
20296
|
+
import_sdk21.Venue.polymarket,
|
|
20297
|
+
import_sdk21.Venue.opinion,
|
|
20298
|
+
import_sdk21.Venue.predict,
|
|
20299
|
+
import_sdk21.Venue.pred
|
|
20300
|
+
].filter(import_sdk21.isVenueActive);
|
|
20313
20301
|
|
|
20314
20302
|
// src/onboarding/steps/how-it-works.tsx
|
|
20315
20303
|
var import_react35 = require("react");
|
|
@@ -20745,7 +20733,7 @@ ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
|
20745
20733
|
|
|
20746
20734
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
20747
20735
|
var import_hooks68 = require("@agg-build/hooks");
|
|
20748
|
-
var
|
|
20736
|
+
var import_sdk22 = require("@agg-build/sdk");
|
|
20749
20737
|
var Dialog5 = __toESM(require("@radix-ui/react-dialog"));
|
|
20750
20738
|
var import_react38 = require("react");
|
|
20751
20739
|
var import_zod = require("zod");
|
|
@@ -20766,6 +20754,27 @@ var getSafeConnectionError = ({
|
|
|
20766
20754
|
error.message
|
|
20767
20755
|
).trim();
|
|
20768
20756
|
};
|
|
20757
|
+
var CloseButton = ({
|
|
20758
|
+
className,
|
|
20759
|
+
disabled
|
|
20760
|
+
}) => {
|
|
20761
|
+
const labels = (0, import_hooks68.useLabels)();
|
|
20762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20763
|
+
Dialog5.Close,
|
|
20764
|
+
{
|
|
20765
|
+
"aria-label": labels.common.close,
|
|
20766
|
+
disabled,
|
|
20767
|
+
className: cn(
|
|
20768
|
+
"z-30 flex size-6 cursor-pointer items-center justify-center rounded-agg-full",
|
|
20769
|
+
"text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
20770
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
|
|
20771
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
20772
|
+
className
|
|
20773
|
+
),
|
|
20774
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "close", size: "medium", className: "!text-agg-foreground" })
|
|
20775
|
+
}
|
|
20776
|
+
);
|
|
20777
|
+
};
|
|
20769
20778
|
var ConnectKalshiModal = ({
|
|
20770
20779
|
open,
|
|
20771
20780
|
onOpenChange,
|
|
@@ -20781,7 +20790,7 @@ var ConnectKalshiModal = ({
|
|
|
20781
20790
|
const [isConnected, setIsConnected] = (0, import_react38.useState)(false);
|
|
20782
20791
|
const [error, setError] = (0, import_react38.useState)();
|
|
20783
20792
|
const availabilityState = (0, import_hooks68.getVenueAvailabilityState)({
|
|
20784
|
-
venueId:
|
|
20793
|
+
venueId: import_sdk22.Venue.kalshi,
|
|
20785
20794
|
disabledVenues,
|
|
20786
20795
|
isConfigLoading: isAppConfigLoading
|
|
20787
20796
|
});
|
|
@@ -20796,12 +20805,12 @@ var ConnectKalshiModal = ({
|
|
|
20796
20805
|
setError(void 0);
|
|
20797
20806
|
setIsVerifying(false);
|
|
20798
20807
|
setIsConnected(false);
|
|
20799
|
-
const animationFrame = window.requestAnimationFrame(() => {
|
|
20800
|
-
var _a;
|
|
20801
|
-
return (_a = apiKeyInputRef.current) == null ? void 0 : _a.focus();
|
|
20802
|
-
});
|
|
20803
|
-
return () => window.cancelAnimationFrame(animationFrame);
|
|
20804
20808
|
}, [open]);
|
|
20809
|
+
const handleOpenAutoFocus = (0, import_react38.useCallback)((event) => {
|
|
20810
|
+
var _a;
|
|
20811
|
+
event.preventDefault();
|
|
20812
|
+
(_a = apiKeyInputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
20813
|
+
}, []);
|
|
20805
20814
|
const handleOpenChange = (0, import_react38.useCallback)(
|
|
20806
20815
|
(nextOpen) => {
|
|
20807
20816
|
if (isVerifying && !nextOpen) return;
|
|
@@ -20844,207 +20853,211 @@ var ConnectKalshiModal = ({
|
|
|
20844
20853
|
[handleVerify]
|
|
20845
20854
|
);
|
|
20846
20855
|
if (availabilityState === "hidden") return null;
|
|
20847
|
-
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime172.
|
|
20856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20848
20857
|
Modal.Container,
|
|
20849
20858
|
{
|
|
20850
|
-
maxWidth: "600px",
|
|
20859
|
+
maxWidth: isConnected ? "480px" : "600px",
|
|
20851
20860
|
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
20852
|
-
classNames: {
|
|
20853
|
-
|
|
20854
|
-
|
|
20855
|
-
|
|
20856
|
-
|
|
20857
|
-
|
|
20858
|
-
|
|
20859
|
-
disabled: isVerifying,
|
|
20860
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "close", size: "medium" })
|
|
20861
|
-
}
|
|
20862
|
-
) }),
|
|
20863
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
|
|
20861
|
+
classNames: {
|
|
20862
|
+
container: "!rounded-t-agg-xl !rounded-b-none md:!rounded-agg-2xl"
|
|
20863
|
+
},
|
|
20864
|
+
onOpenAutoFocus: isConnected ? void 0 : handleOpenAutoFocus,
|
|
20865
|
+
children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(Modal.Body, { classNames: { root: "relative !px-5 !py-8 md:!px-10 md:!py-12" }, children: [
|
|
20866
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(CloseButton, { className: "absolute right-5 top-5 md:right-8 md:top-8" }),
|
|
20867
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
|
|
20864
20868
|
"div",
|
|
20865
20869
|
{
|
|
20866
|
-
className: "flex flex-col items-center gap-8
|
|
20870
|
+
className: "flex flex-col items-center gap-8 text-center",
|
|
20867
20871
|
role: "status",
|
|
20868
20872
|
"aria-live": "polite",
|
|
20869
20873
|
children: [
|
|
20870
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20871
|
-
|
|
20872
|
-
{
|
|
20873
|
-
name: "success-check",
|
|
20874
|
-
className: "size-7 text-agg-on-primary",
|
|
20875
|
-
"aria-hidden": "true"
|
|
20876
|
-
}
|
|
20877
|
-
) }),
|
|
20878
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
20874
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success/15", children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "success-check", className: "size-6 text-agg-success", "aria-hidden": "true" }) }),
|
|
20875
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
20879
20876
|
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Dialog5.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
|
|
20880
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Dialog5.Description, { className: "
|
|
20877
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Dialog5.Description, { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
|
|
20881
20878
|
] }),
|
|
20882
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20883
|
-
Button,
|
|
20884
|
-
{
|
|
20885
|
-
variant: "primary",
|
|
20886
|
-
size: "large",
|
|
20887
|
-
className: "min-w-[120px]",
|
|
20888
|
-
onClick: () => handleOpenChange(false),
|
|
20889
|
-
children: labels.onboarding.connectKalshiModal.success.done
|
|
20890
|
-
}
|
|
20891
|
-
)
|
|
20879
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: labels.onboarding.connectKalshiModal.success.done })
|
|
20892
20880
|
]
|
|
20893
20881
|
}
|
|
20894
|
-
)
|
|
20895
|
-
|
|
20896
|
-
|
|
20897
|
-
|
|
20898
|
-
|
|
20899
|
-
|
|
20900
|
-
|
|
20901
|
-
|
|
20902
|
-
|
|
20903
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
20904
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
20905
|
-
] }),
|
|
20906
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
20907
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
20908
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { children: [
|
|
20909
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
20910
|
-
" ",
|
|
20911
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
20912
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
20913
|
-
" ",
|
|
20882
|
+
)
|
|
20883
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: handleSubmit, children: [
|
|
20884
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20885
|
+
Modal.Body,
|
|
20886
|
+
{
|
|
20887
|
+
classNames: { root: "relative !px-5 !pb-6 !pt-5 md:!px-10 md:!pb-0 md:!pt-12" },
|
|
20888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-6 md:items-center md:gap-0", children: [
|
|
20889
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex w-full flex-col md:contents", children: [
|
|
20890
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex items-center gap-3 md:contents", children: [
|
|
20914
20891
|
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20915
|
-
|
|
20892
|
+
VenueLogo,
|
|
20916
20893
|
{
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
className: "
|
|
20921
|
-
|
|
20894
|
+
venue: import_sdk22.Venue.kalshi,
|
|
20895
|
+
variant: "logo",
|
|
20896
|
+
size: "large",
|
|
20897
|
+
className: "!size-10 md:!mb-8 md:!size-[60px]"
|
|
20898
|
+
}
|
|
20899
|
+
),
|
|
20900
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Dialog5.Title, { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground md:mb-4 md:text-center md:text-agg-2xl md:leading-agg-8", children: labels.onboarding.connectKalshiModal.title }),
|
|
20901
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20902
|
+
CloseButton,
|
|
20903
|
+
{
|
|
20904
|
+
disabled: isVerifying,
|
|
20905
|
+
className: "ml-auto shrink-0 md:absolute md:right-8 md:top-8 md:ml-0"
|
|
20922
20906
|
}
|
|
20923
20907
|
)
|
|
20924
20908
|
] }),
|
|
20925
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.
|
|
20926
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
20927
|
-
" ",
|
|
20928
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
20929
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
20930
|
-
] }),
|
|
20931
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { children: [
|
|
20932
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
20933
|
-
" ",
|
|
20934
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
20935
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
20936
|
-
] }),
|
|
20937
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
20909
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Dialog5.Description, { className: "mt-3 text-agg-sm leading-agg-5 text-agg-foreground md:mb-8 md:mt-0 md:text-center md:text-agg-base md:leading-agg-6", children: labels.onboarding.connectKalshiModal.description })
|
|
20938
20910
|
] }),
|
|
20939
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20911
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
20912
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
20913
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
20914
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
20915
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
20916
|
+
] }),
|
|
20917
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
20918
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
20919
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { children: [
|
|
20920
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
20921
|
+
" ",
|
|
20922
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
20923
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
20924
|
+
" ",
|
|
20925
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20926
|
+
"a",
|
|
20927
|
+
{
|
|
20928
|
+
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
20929
|
+
target: "_blank",
|
|
20930
|
+
rel: "noreferrer",
|
|
20931
|
+
className: "cursor-pointer underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
20932
|
+
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl
|
|
20933
|
+
}
|
|
20934
|
+
)
|
|
20935
|
+
] }),
|
|
20936
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { children: [
|
|
20937
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
20938
|
+
" ",
|
|
20939
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
20940
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
20941
|
+
] }),
|
|
20942
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { children: [
|
|
20943
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
20944
|
+
" ",
|
|
20945
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
20946
|
+
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
20947
|
+
] }),
|
|
20948
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
20949
|
+
] }),
|
|
20950
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
20951
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
20952
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("br", {}),
|
|
20953
|
+
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
20954
|
+
] })
|
|
20955
|
+
] }),
|
|
20956
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
20957
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
20958
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
20959
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
20960
|
+
] }),
|
|
20961
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
20962
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
20963
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20964
|
+
"label",
|
|
20965
|
+
{
|
|
20966
|
+
htmlFor: "kalshi-api-key-id",
|
|
20967
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
20968
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
20969
|
+
}
|
|
20970
|
+
),
|
|
20971
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20972
|
+
"input",
|
|
20973
|
+
{
|
|
20974
|
+
ref: apiKeyInputRef,
|
|
20975
|
+
id: "kalshi-api-key-id",
|
|
20976
|
+
type: "text",
|
|
20977
|
+
autoComplete: "off",
|
|
20978
|
+
value: apiKeyId,
|
|
20979
|
+
onChange: (event) => setApiKeyId(event.target.value),
|
|
20980
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
20981
|
+
disabled: isVerifying,
|
|
20982
|
+
"aria-invalid": !!error,
|
|
20983
|
+
"aria-describedby": error ? errorId : void 0,
|
|
20984
|
+
className: cn(
|
|
20985
|
+
"h-10 w-full rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
20986
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
20987
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
20988
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
20989
|
+
)
|
|
20990
|
+
}
|
|
20978
20991
|
)
|
|
20979
|
-
}
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
20992
|
+
] }),
|
|
20993
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
20994
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
20995
|
+
"label",
|
|
20996
|
+
{
|
|
20997
|
+
htmlFor: "kalshi-private-key",
|
|
20998
|
+
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
20999
|
+
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
21000
|
+
}
|
|
21001
|
+
),
|
|
21002
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
21003
|
+
"textarea",
|
|
21004
|
+
{
|
|
21005
|
+
id: "kalshi-private-key",
|
|
21006
|
+
autoComplete: "off",
|
|
21007
|
+
value: privateKey,
|
|
21008
|
+
onChange: (event) => setPrivateKey(event.target.value),
|
|
21009
|
+
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
21010
|
+
rows: 3,
|
|
21011
|
+
disabled: isVerifying,
|
|
21012
|
+
"aria-invalid": !!error,
|
|
21013
|
+
"aria-describedby": error ? errorId : void 0,
|
|
21014
|
+
className: cn(
|
|
21015
|
+
"w-full resize-none rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
21016
|
+
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
21017
|
+
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
21018
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
21019
|
+
)
|
|
21020
|
+
}
|
|
21008
21021
|
)
|
|
21009
|
-
}
|
|
21010
|
-
)
|
|
21011
|
-
] })
|
|
21012
|
-
] })
|
|
21013
|
-
] }),
|
|
21014
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
21015
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
21016
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
21017
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
|
|
21018
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
|
|
21019
|
-
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
21022
|
+
] })
|
|
21023
|
+
] })
|
|
21020
21024
|
] }),
|
|
21021
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21025
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
|
|
21026
|
+
"div",
|
|
21027
|
+
{
|
|
21028
|
+
id: errorId,
|
|
21029
|
+
className: "flex items-center gap-2 md:justify-center",
|
|
21030
|
+
role: "alert",
|
|
21031
|
+
"aria-live": "assertive",
|
|
21032
|
+
children: [
|
|
21033
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
|
|
21034
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
21035
|
+
]
|
|
21036
|
+
}
|
|
21037
|
+
) : null
|
|
21026
21038
|
] })
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
|
|
21042
|
-
|
|
21039
|
+
}
|
|
21040
|
+
),
|
|
21041
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(
|
|
21042
|
+
Modal.Footer,
|
|
21043
|
+
{
|
|
21044
|
+
classNames: {
|
|
21045
|
+
root: "relative !h-auto !gap-3 !p-4 md:!justify-center md:!border-0 md:!px-10 md:!pb-12 md:!pt-8"
|
|
21046
|
+
},
|
|
21047
|
+
children: [
|
|
21048
|
+
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
21049
|
+
"div",
|
|
21050
|
+
{
|
|
21051
|
+
"aria-hidden": "true",
|
|
21052
|
+
className: "pointer-events-none absolute inset-x-0 -top-[60px] h-[60px] bg-gradient-to-b from-transparent to-agg-secondary md:hidden"
|
|
21053
|
+
}
|
|
21054
|
+
),
|
|
21043
21055
|
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)(
|
|
21044
21056
|
Button,
|
|
21045
21057
|
{
|
|
21046
21058
|
variant: "secondary",
|
|
21047
21059
|
size: "large",
|
|
21060
|
+
className: "shrink-0",
|
|
21048
21061
|
onClick: () => handleOpenChange(false),
|
|
21049
21062
|
disabled: isVerifying,
|
|
21050
21063
|
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
@@ -21056,15 +21069,16 @@ var ConnectKalshiModal = ({
|
|
|
21056
21069
|
type: "submit",
|
|
21057
21070
|
variant: "primary",
|
|
21058
21071
|
size: "large",
|
|
21072
|
+
className: "flex-1 md:flex-none",
|
|
21059
21073
|
disabled: !parsedCredentials.success || isVerifying,
|
|
21060
21074
|
isLoading: isVerifying,
|
|
21061
21075
|
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
21062
21076
|
}
|
|
21063
21077
|
)
|
|
21064
|
-
]
|
|
21065
|
-
|
|
21066
|
-
|
|
21067
|
-
]
|
|
21078
|
+
]
|
|
21079
|
+
}
|
|
21080
|
+
)
|
|
21081
|
+
] })
|
|
21068
21082
|
}
|
|
21069
21083
|
) });
|
|
21070
21084
|
};
|
|
@@ -21168,7 +21182,7 @@ var requestAggWithdrawModalOpen = () => {
|
|
|
21168
21182
|
|
|
21169
21183
|
// src/trading/fund-kalshi-modal.tsx
|
|
21170
21184
|
var import_hooks70 = require("@agg-build/hooks");
|
|
21171
|
-
var
|
|
21185
|
+
var import_sdk23 = require("@agg-build/sdk");
|
|
21172
21186
|
var Dialog7 = __toESM(require("@radix-ui/react-dialog"));
|
|
21173
21187
|
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
21174
21188
|
var FundKalshiModal = ({ open, onOpenChange }) => {
|
|
@@ -21190,7 +21204,7 @@ var FundKalshiModal = ({ open, onOpenChange }) => {
|
|
|
21190
21204
|
}
|
|
21191
21205
|
),
|
|
21192
21206
|
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(Modal.Body, { classNames: { root: "!px-5 !py-12 sm:!px-10" }, children: /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "flex flex-col items-center gap-8 text-center", children: [
|
|
21193
|
-
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(VenueLogo, { venue:
|
|
21207
|
+
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(VenueLogo, { venue: import_sdk23.Venue.kalshi, variant: "logo", size: "large", className: "size-[60px]" }),
|
|
21194
21208
|
/* @__PURE__ */ (0, import_jsx_runtime174.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
21195
21209
|
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(Dialog7.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: modalLabels.title }),
|
|
21196
21210
|
/* @__PURE__ */ (0, import_jsx_runtime174.jsx)(Dialog7.Description, { className: "max-w-[520px] text-agg-base leading-agg-6 text-agg-foreground", children: modalLabels.description })
|
|
@@ -21552,14 +21566,10 @@ var routePriceLabelFormatter = new Intl.NumberFormat("en-US", {
|
|
|
21552
21566
|
minimumFractionDigits: 0,
|
|
21553
21567
|
maximumFractionDigits: 1
|
|
21554
21568
|
});
|
|
21555
|
-
var PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER = 1e3;
|
|
21556
21569
|
var GEO_BLOCK_WARNING_PREFIX = "Venue not available in your region";
|
|
21557
21570
|
var isFiniteNonNegativePrice = (value) => {
|
|
21558
21571
|
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
21559
21572
|
};
|
|
21560
|
-
var isPredictionMarketPrice = (value) => {
|
|
21561
|
-
return isFiniteNonNegativePrice(value) && value <= 1;
|
|
21562
|
-
};
|
|
21563
21573
|
var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
21564
21574
|
var _a;
|
|
21565
21575
|
if (!quoteData || quoteData.totalFilled <= 0) return null;
|
|
@@ -21570,22 +21580,6 @@ var getPlaceOrderAverageExecutionPrice = (quoteData) => {
|
|
|
21570
21580
|
const averageExecutionPrice = quoteData.rawExecCost / quoteData.totalFilled;
|
|
21571
21581
|
return isFiniteNonNegativePrice(averageExecutionPrice) ? averageExecutionPrice : null;
|
|
21572
21582
|
};
|
|
21573
|
-
var isPlaceOrderAveragePriceWorse = ({
|
|
21574
|
-
averageExecutionPrice,
|
|
21575
|
-
displayedMarketPrice,
|
|
21576
|
-
tradeSide
|
|
21577
|
-
}) => {
|
|
21578
|
-
if (!isPredictionMarketPrice(averageExecutionPrice) || !isPredictionMarketPrice(displayedMarketPrice)) {
|
|
21579
|
-
return false;
|
|
21580
|
-
}
|
|
21581
|
-
const displayedAveragePrice = Math.round(
|
|
21582
|
-
averageExecutionPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
21583
|
-
);
|
|
21584
|
-
const displayedReferencePrice = Math.round(
|
|
21585
|
-
displayedMarketPrice * PLACE_ORDER_PRICE_DISPLAY_MULTIPLIER
|
|
21586
|
-
);
|
|
21587
|
-
return tradeSide === "buy" ? displayedAveragePrice > displayedReferencePrice : displayedAveragePrice < displayedReferencePrice;
|
|
21588
|
-
};
|
|
21589
21583
|
var floorToDecimals = (value, decimals) => {
|
|
21590
21584
|
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
21591
21585
|
const [coefficient = "0", exponentText = "0"] = value.toString().toLowerCase().split("e");
|
|
@@ -22196,16 +22190,21 @@ var buildLiveRouteCards = ({
|
|
|
22196
22190
|
})() : [];
|
|
22197
22191
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
22198
22192
|
};
|
|
22199
|
-
var
|
|
22200
|
-
|
|
22193
|
+
var routeCardRequiresKalshi = (card) => card.venue === "kalshi" || card.quoteData.fills.some((fill) => fill.venue === "kalshi");
|
|
22194
|
+
var resolveDefaultRouteCardId = (routeCards, primaryStatus, options) => {
|
|
22195
|
+
var _a, _b, _c, _d, _e, _f;
|
|
22201
22196
|
if (routeCards.length === 0) return null;
|
|
22202
|
-
const
|
|
22203
|
-
|
|
22204
|
-
|
|
22197
|
+
const isExecutableCard = (card) => !card.isUnavailable && card.quoteData.status === "ok" && !!card.quoteData.quoteId;
|
|
22198
|
+
if (options == null ? void 0 : options.isKalshiDisconnected) {
|
|
22199
|
+
const nonKalshiCards = routeCards.filter((card) => !routeCardRequiresKalshi(card));
|
|
22200
|
+
const preferredCard = (_a = nonKalshiCards.find(isExecutableCard)) != null ? _a : nonKalshiCards.find((card) => !card.isUnavailable);
|
|
22201
|
+
if (preferredCard) return preferredCard.id;
|
|
22202
|
+
}
|
|
22203
|
+
const firstExecutableCard = routeCards.find(isExecutableCard);
|
|
22205
22204
|
if (primaryStatus === "insufficient_balance") {
|
|
22206
22205
|
if (firstExecutableCard) return firstExecutableCard.id;
|
|
22207
22206
|
}
|
|
22208
|
-
return (
|
|
22207
|
+
return (_f = (_e = (_c = firstExecutableCard == null ? void 0 : firstExecutableCard.id) != null ? _c : (_b = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _b.id) != null ? _e : (_d = routeCards[0]) == null ? void 0 : _d.id) != null ? _f : null;
|
|
22209
22208
|
};
|
|
22210
22209
|
var getPlaceOrderRouteCardIdentity = (card) => {
|
|
22211
22210
|
var _a;
|
|
@@ -23411,9 +23410,9 @@ var deriveBackendExecutionOrderGroups = ({
|
|
|
23411
23410
|
return [__spreadProps(__spreadValues({ id: order.orderId }, presentation), { steps })];
|
|
23412
23411
|
});
|
|
23413
23412
|
const allOrdersTerminal = executionOrders.every((order) => order.event !== null);
|
|
23414
|
-
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal);
|
|
23413
|
+
return deriveSequentialDisplayGroups(realGroups, allOrdersTerminal, "per-leg");
|
|
23415
23414
|
};
|
|
23416
|
-
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) => {
|
|
23415
|
+
var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false, scope = "global") => {
|
|
23417
23416
|
if (revealTerminalOutcomes) {
|
|
23418
23417
|
return groups.map((group) => __spreadProps(__spreadValues({}, group), {
|
|
23419
23418
|
steps: group.steps.map((_a) => {
|
|
@@ -23423,19 +23422,22 @@ var deriveSequentialDisplayGroups = (groups, revealTerminalOutcomes = false) =>
|
|
|
23423
23422
|
}));
|
|
23424
23423
|
}
|
|
23425
23424
|
let hasUnresolvedPredecessor = false;
|
|
23426
|
-
return groups.map((group) =>
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
|
|
23430
|
-
|
|
23431
|
-
|
|
23432
|
-
|
|
23433
|
-
|
|
23434
|
-
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
|
|
23438
|
-
|
|
23425
|
+
return groups.map((group) => {
|
|
23426
|
+
if (scope === "per-leg") hasUnresolvedPredecessor = false;
|
|
23427
|
+
return __spreadProps(__spreadValues({}, group), {
|
|
23428
|
+
steps: group.steps.map((_a) => {
|
|
23429
|
+
var _b = _a, { realStatus } = _b, step = __objRest(_b, ["realStatus"]);
|
|
23430
|
+
if (hasUnresolvedPredecessor) {
|
|
23431
|
+
return __spreadProps(__spreadValues({}, step), { status: "not-started" });
|
|
23432
|
+
}
|
|
23433
|
+
if (realStatus === "done") {
|
|
23434
|
+
return __spreadProps(__spreadValues({}, step), { status: "done" });
|
|
23435
|
+
}
|
|
23436
|
+
hasUnresolvedPredecessor = true;
|
|
23437
|
+
return __spreadProps(__spreadValues({}, step), { status: realStatus });
|
|
23438
|
+
})
|
|
23439
|
+
});
|
|
23440
|
+
});
|
|
23439
23441
|
};
|
|
23440
23442
|
var deriveExecutionOrderGroups = ({
|
|
23441
23443
|
quoteData,
|
|
@@ -23656,6 +23658,7 @@ var calculateExecutionProgress = ({
|
|
|
23656
23658
|
};
|
|
23657
23659
|
|
|
23658
23660
|
// src/trading/place-order/index.place-order.execution-view.tsx
|
|
23661
|
+
var import_react40 = require("react");
|
|
23659
23662
|
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
23660
23663
|
var PlaceOrderExecutionHeader = ({
|
|
23661
23664
|
className,
|
|
@@ -23678,6 +23681,85 @@ var PlaceOrderExecutionHeader = ({
|
|
|
23678
23681
|
eventDateLabel ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)("p", { className: "text-agg-base leading-agg-6 text-agg-foreground", children: eventDateLabel }) : null
|
|
23679
23682
|
] });
|
|
23680
23683
|
};
|
|
23684
|
+
var PROGRESS_TWEEN_MS = 700;
|
|
23685
|
+
var prefersReducedMotion = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
23686
|
+
var useTweenedProgress = (target, enabled) => {
|
|
23687
|
+
const [value, setValue] = (0, import_react40.useState)(target);
|
|
23688
|
+
const valueRef = (0, import_react40.useRef)(target);
|
|
23689
|
+
(0, import_react40.useEffect)(() => {
|
|
23690
|
+
const from = valueRef.current;
|
|
23691
|
+
if (!enabled || from === target || prefersReducedMotion()) {
|
|
23692
|
+
valueRef.current = target;
|
|
23693
|
+
setValue(target);
|
|
23694
|
+
return;
|
|
23695
|
+
}
|
|
23696
|
+
let frame = 0;
|
|
23697
|
+
const start = performance.now();
|
|
23698
|
+
const tick = (now) => {
|
|
23699
|
+
const t = Math.min(1, (now - start) / PROGRESS_TWEEN_MS);
|
|
23700
|
+
const eased = 1 - Math.pow(1 - t, 3);
|
|
23701
|
+
const next = Math.round(from + (target - from) * eased);
|
|
23702
|
+
valueRef.current = next;
|
|
23703
|
+
setValue(next);
|
|
23704
|
+
if (t < 1) frame = requestAnimationFrame(tick);
|
|
23705
|
+
};
|
|
23706
|
+
frame = requestAnimationFrame(tick);
|
|
23707
|
+
return () => cancelAnimationFrame(frame);
|
|
23708
|
+
}, [enabled, target]);
|
|
23709
|
+
return value;
|
|
23710
|
+
};
|
|
23711
|
+
var ExecutionProgressBar = ({
|
|
23712
|
+
enableAnimations,
|
|
23713
|
+
label: label2,
|
|
23714
|
+
progress
|
|
23715
|
+
}) => {
|
|
23716
|
+
const clamped = Math.max(0, Math.min(100, progress));
|
|
23717
|
+
const displayed = useTweenedProgress(clamped, enableAnimations);
|
|
23718
|
+
const isRunning = clamped < 100;
|
|
23719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
23720
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("p", { className: "shrink-0 tabular-nums text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
23721
|
+
displayed,
|
|
23722
|
+
"%"
|
|
23723
|
+
] }),
|
|
23724
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
23725
|
+
"div",
|
|
23726
|
+
{
|
|
23727
|
+
role: "progressbar",
|
|
23728
|
+
"aria-label": label2,
|
|
23729
|
+
"aria-valuemin": 0,
|
|
23730
|
+
"aria-valuemax": 100,
|
|
23731
|
+
"aria-valuenow": clamped,
|
|
23732
|
+
className: "relative h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator",
|
|
23733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
23734
|
+
"div",
|
|
23735
|
+
{
|
|
23736
|
+
className: cn(
|
|
23737
|
+
"absolute inset-y-0 left-0 overflow-hidden rounded-agg-full bg-agg-primary",
|
|
23738
|
+
getMotionClassName(
|
|
23739
|
+
enableAnimations,
|
|
23740
|
+
"transition-[width] duration-700 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
23741
|
+
)
|
|
23742
|
+
),
|
|
23743
|
+
style: { width: `${clamped}%` },
|
|
23744
|
+
children: isRunning ? /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
23745
|
+
"span",
|
|
23746
|
+
{
|
|
23747
|
+
"aria-hidden": "true",
|
|
23748
|
+
className: cn(
|
|
23749
|
+
"absolute inset-0 hidden bg-gradient-to-r from-transparent via-white/40 to-transparent",
|
|
23750
|
+
getMotionClassName(
|
|
23751
|
+
enableAnimations,
|
|
23752
|
+
"motion-safe:block motion-safe:animate-agg-progress-shimmer"
|
|
23753
|
+
)
|
|
23754
|
+
)
|
|
23755
|
+
}
|
|
23756
|
+
) : null
|
|
23757
|
+
}
|
|
23758
|
+
)
|
|
23759
|
+
}
|
|
23760
|
+
)
|
|
23761
|
+
] });
|
|
23762
|
+
};
|
|
23681
23763
|
var ExecutionStepIndicator = ({
|
|
23682
23764
|
enableAnimations,
|
|
23683
23765
|
step
|
|
@@ -23813,21 +23895,14 @@ var PlaceOrderExecutionView = ({
|
|
|
23813
23895
|
}
|
|
23814
23896
|
),
|
|
23815
23897
|
/* @__PURE__ */ (0, import_jsx_runtime175.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.content), children: [
|
|
23816
|
-
/* @__PURE__ */ (0, import_jsx_runtime175.
|
|
23817
|
-
|
|
23818
|
-
|
|
23819
|
-
|
|
23820
|
-
|
|
23821
|
-
|
|
23822
|
-
|
|
23823
|
-
|
|
23824
|
-
"aria-label": labels.executingOrder,
|
|
23825
|
-
className: "h-1 min-w-0 flex-1 overflow-hidden rounded-agg-full bg-agg-separator text-agg-primary accent-agg-primary [&::-moz-progress-bar]:bg-agg-primary [&::-webkit-progress-bar]:bg-agg-separator [&::-webkit-progress-value]:bg-agg-primary",
|
|
23826
|
-
max: 100,
|
|
23827
|
-
value: progress
|
|
23828
|
-
}
|
|
23829
|
-
)
|
|
23830
|
-
] }),
|
|
23898
|
+
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
23899
|
+
ExecutionProgressBar,
|
|
23900
|
+
{
|
|
23901
|
+
enableAnimations,
|
|
23902
|
+
label: labels.executingOrder,
|
|
23903
|
+
progress
|
|
23904
|
+
}
|
|
23905
|
+
),
|
|
23831
23906
|
/* @__PURE__ */ (0, import_jsx_runtime175.jsx)(
|
|
23832
23907
|
PlaceOrderExecutionGroups,
|
|
23833
23908
|
{
|
|
@@ -24075,7 +24150,7 @@ var PlaceOrderSuccessView = ({
|
|
|
24075
24150
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "flex items-center justify-between gap-4", children: [
|
|
24076
24151
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
24077
24152
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: tradingLabels.orderPayout }),
|
|
24078
|
-
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "
|
|
24153
|
+
potentialReturnLabel ? /* @__PURE__ */ (0, import_jsx_runtime177.jsx)("span", { className: "agg-type-overline agg-text-brand", children: potentialReturnLabel }) : null
|
|
24079
24154
|
] }),
|
|
24080
24155
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)("p", { className: "shrink-0 text-right text-[30px] font-agg-bold leading-[36px] text-agg-success", children: resolvedPayoutLabel })
|
|
24081
24156
|
] })
|
|
@@ -24116,11 +24191,11 @@ var ceilDiv = (numerator, denominator) => {
|
|
|
24116
24191
|
};
|
|
24117
24192
|
var toRaw6 = (value) => {
|
|
24118
24193
|
const normalizedValue = Number.isFinite(value) ? Math.max(0, value) : 0;
|
|
24119
|
-
return Math.ceil(normalizedValue * Number(
|
|
24194
|
+
return Math.ceil(normalizedValue * Number(import_sdk24.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
24120
24195
|
};
|
|
24121
24196
|
var toLimitPriceRaw = (value) => {
|
|
24122
24197
|
const clampedValue = Math.min(LIMIT_PRICE_MAX, Math.max(LIMIT_PRICE_MIN, value));
|
|
24123
|
-
return Math.round(clampedValue * Number(
|
|
24198
|
+
return Math.round(clampedValue * Number(import_sdk24.LIMIT_PRICE_RAW_SCALE)).toString();
|
|
24124
24199
|
};
|
|
24125
24200
|
var toLimitSizeRaw = ({
|
|
24126
24201
|
amount,
|
|
@@ -24130,7 +24205,7 @@ var toLimitSizeRaw = ({
|
|
|
24130
24205
|
if (side === "sell") return toRaw6(amount);
|
|
24131
24206
|
const spendRaw = BigInt(toRaw6(amount));
|
|
24132
24207
|
const priceRaw = BigInt(limitPriceRaw);
|
|
24133
|
-
return ceilDiv(spendRaw *
|
|
24208
|
+
return ceilDiv(spendRaw * import_sdk24.LIMIT_PRICE_RAW_SCALE, priceRaw).toString();
|
|
24134
24209
|
};
|
|
24135
24210
|
var formatLimitPriceLabel = (value) => {
|
|
24136
24211
|
return `${(value * 100).toLocaleString("en-US", {
|
|
@@ -24139,7 +24214,7 @@ var formatLimitPriceLabel = (value) => {
|
|
|
24139
24214
|
})}\xA2`;
|
|
24140
24215
|
};
|
|
24141
24216
|
var formatLimitPriceRawLabel = (value) => {
|
|
24142
|
-
return formatLimitPriceLabel(Number(BigInt(value)) / Number(
|
|
24217
|
+
return formatLimitPriceLabel(Number(BigInt(value)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE));
|
|
24143
24218
|
};
|
|
24144
24219
|
var getLimitOrderToWinValue = ({
|
|
24145
24220
|
amount,
|
|
@@ -24147,10 +24222,10 @@ var getLimitOrderToWinValue = ({
|
|
|
24147
24222
|
side
|
|
24148
24223
|
}) => {
|
|
24149
24224
|
const priceRaw = BigInt(limitPriceRaw);
|
|
24150
|
-
if (priceRaw <= BigInt(0) || priceRaw >=
|
|
24225
|
+
if (priceRaw <= BigInt(0) || priceRaw >= import_sdk24.LIMIT_PRICE_RAW_SCALE) return 0;
|
|
24151
24226
|
const sizeRaw = BigInt(toLimitSizeRaw({ amount, limitPriceRaw, side }));
|
|
24152
|
-
if (side === "buy") return Number(sizeRaw) / Number(
|
|
24153
|
-
return Number(ceilDiv(priceRaw * sizeRaw,
|
|
24227
|
+
if (side === "buy") return Number(sizeRaw) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
24228
|
+
return Number(ceilDiv(priceRaw * sizeRaw, import_sdk24.LIMIT_PRICE_RAW_SCALE)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
24154
24229
|
};
|
|
24155
24230
|
var normalizeLimitPrice = (value) => {
|
|
24156
24231
|
if (!Number.isFinite(value)) return LIMIT_PRICE_MIN;
|
|
@@ -24217,24 +24292,24 @@ var PlaceOrderSlippageControl = ({
|
|
|
24217
24292
|
}) => {
|
|
24218
24293
|
var _a, _b;
|
|
24219
24294
|
const labels = (0, import_hooks71.useLabels)();
|
|
24220
|
-
const containerRef = (0,
|
|
24221
|
-
const triggerRef = (0,
|
|
24222
|
-
const inputRef = (0,
|
|
24223
|
-
const warningId = (0,
|
|
24295
|
+
const containerRef = (0, import_react42.useRef)(null);
|
|
24296
|
+
const triggerRef = (0, import_react42.useRef)(null);
|
|
24297
|
+
const inputRef = (0, import_react42.useRef)(null);
|
|
24298
|
+
const warningId = (0, import_react42.useId)();
|
|
24224
24299
|
const defaultValue = finalizePercentageValue(slippageDefaultValue);
|
|
24225
24300
|
const committedValue = finalizePercentageValue(slippageValue) || defaultValue;
|
|
24226
|
-
const [draftValue, setDraftValue] = (0,
|
|
24227
|
-
const [isEditing, setIsEditing] = (0,
|
|
24301
|
+
const [draftValue, setDraftValue] = (0, import_react42.useState)(committedValue);
|
|
24302
|
+
const [isEditing, setIsEditing] = (0, import_react42.useState)(
|
|
24228
24303
|
() => isPercentageBelowMinimum(committedValue, slippageMinimumValue)
|
|
24229
24304
|
);
|
|
24230
|
-
const [shouldFocusInput, setShouldFocusInput] = (0,
|
|
24231
|
-
(0,
|
|
24305
|
+
const [shouldFocusInput, setShouldFocusInput] = (0, import_react42.useState)(false);
|
|
24306
|
+
(0, import_react42.useEffect)(() => {
|
|
24232
24307
|
setDraftValue(committedValue);
|
|
24233
24308
|
if (isPercentageBelowMinimum(committedValue, slippageMinimumValue)) {
|
|
24234
24309
|
setIsEditing(true);
|
|
24235
24310
|
}
|
|
24236
24311
|
}, [committedValue, slippageMinimumValue]);
|
|
24237
|
-
(0,
|
|
24312
|
+
(0, import_react42.useEffect)(() => {
|
|
24238
24313
|
if (!shouldFocusInput) return;
|
|
24239
24314
|
requestAnimationFrame(() => {
|
|
24240
24315
|
var _a2, _b2;
|
|
@@ -24251,7 +24326,7 @@ var PlaceOrderSlippageControl = ({
|
|
|
24251
24326
|
Number(committedValue || slippageDefaultValue || DEFAULT_SLIPPAGE_VALUE)
|
|
24252
24327
|
);
|
|
24253
24328
|
const resolvedAutoLabel = labels.trading.resetSlippage;
|
|
24254
|
-
const resolvedWarningMessage = (0,
|
|
24329
|
+
const resolvedWarningMessage = (0, import_react42.useMemo)(() => {
|
|
24255
24330
|
if (isLowSlippage) {
|
|
24256
24331
|
return labels.trading.slippageLow(slippageMinimumValue);
|
|
24257
24332
|
}
|
|
@@ -24658,13 +24733,15 @@ var renderRouteCard = ({
|
|
|
24658
24733
|
isExpanded,
|
|
24659
24734
|
isSelected,
|
|
24660
24735
|
onSelect,
|
|
24736
|
+
isKalshiDisconnected = false,
|
|
24661
24737
|
sharedKycStatus,
|
|
24662
24738
|
tradingLabels
|
|
24663
24739
|
}) => {
|
|
24664
24740
|
var _a, _b, _c;
|
|
24665
24741
|
const showSharedKycRequirement = card.requiresSharedKyc === true && sharedKycStatus !== void 0 && sharedKycStatus !== "verified" && !card.isUnavailable;
|
|
24742
|
+
const showKalshiRequirement = isKalshiDisconnected && card.kind === "venue" && card.venue === "kalshi" && !isSelected && !card.isUnavailable;
|
|
24666
24743
|
const showSplitDetails = isSelected && isExpanded && card.kind === "split" && !!((_a = card.rows) == null ? void 0 : _a.length);
|
|
24667
|
-
const displayedHint = showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
24744
|
+
const displayedHint = showKalshiRequirement ? tradingLabels.requiresKalshiAccount : showSharedKycRequirement ? tradingLabels.sharedKyc.required : card.hint;
|
|
24668
24745
|
const ariaLabel = [card.label, displayedHint, card.value].filter(Boolean).join(" ");
|
|
24669
24746
|
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
24670
24747
|
"button",
|
|
@@ -24718,7 +24795,7 @@ var renderRouteCard = ({
|
|
|
24718
24795
|
className: "shrink-0 text-agg-muted-foreground",
|
|
24719
24796
|
"aria-hidden": "true"
|
|
24720
24797
|
}
|
|
24721
|
-
) : showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
24798
|
+
) : showKalshiRequirement || showSharedKycRequirement || card.insufficientInventory ? /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
24722
24799
|
Icon,
|
|
24723
24800
|
{
|
|
24724
24801
|
name: "warning",
|
|
@@ -24801,10 +24878,10 @@ var PlaceOrder = ({
|
|
|
24801
24878
|
const selectedEvent = (_a = tradingContext == null ? void 0 : tradingContext.selectedEvent) != null ? _a : null;
|
|
24802
24879
|
const selectedMarket = (_b = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _b : null;
|
|
24803
24880
|
const selectedOutcomeId = (_c = tradingContext == null ? void 0 : tradingContext.selectedOutcomeId) != null ? _c : null;
|
|
24804
|
-
const resolvedEventTradingState = (0,
|
|
24881
|
+
const resolvedEventTradingState = (0, import_react42.useMemo)(() => {
|
|
24805
24882
|
return eventTradingState != null ? eventTradingState : (0, import_hooks71.resolveEventTradingState)(selectedEvent);
|
|
24806
24883
|
}, [eventTradingState, selectedEvent]);
|
|
24807
|
-
const scopedSelectedEvent = (0,
|
|
24884
|
+
const scopedSelectedEvent = (0, import_react42.useMemo)(() => {
|
|
24808
24885
|
var _a2;
|
|
24809
24886
|
if (!selectedEvent) return null;
|
|
24810
24887
|
const primaryMarketId = (_a2 = resolvedEventTradingState.primaryMarket) == null ? void 0 : _a2.id;
|
|
@@ -24814,7 +24891,7 @@ var PlaceOrder = ({
|
|
|
24814
24891
|
);
|
|
24815
24892
|
return isSelectedEventInScope ? selectedEvent : null;
|
|
24816
24893
|
}, [(_d = resolvedEventTradingState.primaryMarket) == null ? void 0 : _d.id, selectedEvent]);
|
|
24817
|
-
const scopedSelectedMarket = (0,
|
|
24894
|
+
const scopedSelectedMarket = (0, import_react42.useMemo)(() => {
|
|
24818
24895
|
if (!selectedMarket) return resolvedEventTradingState.primaryMarket;
|
|
24819
24896
|
const isSelectedMarketInScope = resolvedEventTradingState.marketStates.some(
|
|
24820
24897
|
(item) => item.market.id === selectedMarket.id
|
|
@@ -24829,10 +24906,10 @@ var PlaceOrder = ({
|
|
|
24829
24906
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
24830
24907
|
)) != null ? _f : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) != null ? _g : null;
|
|
24831
24908
|
const scopedSelectedOutcomeId = (_h = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _h : null;
|
|
24832
|
-
const resolvedTradingState = (0,
|
|
24909
|
+
const resolvedTradingState = (0, import_react42.useMemo)(() => {
|
|
24833
24910
|
return (0, import_hooks71.resolveMarketTradingState)(scopedSelectedMarket);
|
|
24834
24911
|
}, [scopedSelectedMarket]);
|
|
24835
|
-
const resolvedReadOnlyMarket = (0,
|
|
24912
|
+
const resolvedReadOnlyMarket = (0, import_react42.useMemo)(() => {
|
|
24836
24913
|
var _a2;
|
|
24837
24914
|
if (resolvedEventTradingState.kind !== "resolved") {
|
|
24838
24915
|
return scopedSelectedMarket;
|
|
@@ -24843,11 +24920,11 @@ var PlaceOrder = ({
|
|
|
24843
24920
|
resolvedEventTradingState.primaryMarket,
|
|
24844
24921
|
scopedSelectedMarket
|
|
24845
24922
|
]);
|
|
24846
|
-
const resolvedReadOnlyTradingState = (0,
|
|
24923
|
+
const resolvedReadOnlyTradingState = (0, import_react42.useMemo)(() => {
|
|
24847
24924
|
return (0, import_hooks71.resolveMarketTradingState)(resolvedReadOnlyMarket);
|
|
24848
24925
|
}, [resolvedReadOnlyMarket]);
|
|
24849
24926
|
const isEndedWithoutKnownWinner = showResolvingState && !resolvedEventTradingState.winningOutcome && !resolvedReadOnlyTradingState.winningOutcome;
|
|
24850
|
-
const orderEligibility = (0,
|
|
24927
|
+
const orderEligibility = (0, import_react42.useMemo)(
|
|
24851
24928
|
() => (0, import_hooks71.resolveOrderEligibility)({
|
|
24852
24929
|
event: scopedSelectedEvent,
|
|
24853
24930
|
market: scopedSelectedMarket,
|
|
@@ -24870,7 +24947,7 @@ var PlaceOrder = ({
|
|
|
24870
24947
|
enabled: Boolean(isAuthenticated && isPaperMode),
|
|
24871
24948
|
mode: "paper"
|
|
24872
24949
|
});
|
|
24873
|
-
const paperTotalBalance = (0,
|
|
24950
|
+
const paperTotalBalance = (0, import_react42.useMemo)(() => {
|
|
24874
24951
|
var _a2, _b2;
|
|
24875
24952
|
const cash = (_b2 = (_a2 = paperBalancesQuery.balances) == null ? void 0 : _a2.cash) != null ? _b2 : [];
|
|
24876
24953
|
return cash.reduce((sum, token) => {
|
|
@@ -24892,11 +24969,11 @@ var PlaceOrder = ({
|
|
|
24892
24969
|
const queryClient = (0, import_hooks71.useQueryClient)();
|
|
24893
24970
|
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks71.useAppConfig)();
|
|
24894
24971
|
const { data: kalshiKeyStatus, refetch: refetchKalshiKeyStatus } = (0, import_hooks71.useVenueKeyStatus)(
|
|
24895
|
-
|
|
24972
|
+
import_sdk24.Venue.kalshi,
|
|
24896
24973
|
isAuthenticated
|
|
24897
24974
|
);
|
|
24898
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
24899
|
-
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0,
|
|
24975
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react42.useState)(false);
|
|
24976
|
+
const [isFundKalshiModalOpen, setIsFundKalshiModalOpen] = (0, import_react42.useState)(false);
|
|
24900
24977
|
const livePrices = (0, import_hooks71.useLiveOutcomePrices)(
|
|
24901
24978
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
24902
24979
|
);
|
|
@@ -24908,41 +24985,41 @@ var PlaceOrder = ({
|
|
|
24908
24985
|
const clusterBestMidpointsByOutcomeId = (_j = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _j : clusterMidpointResult.prices;
|
|
24909
24986
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
24910
24987
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
24911
|
-
const clusterBestPrices = (0,
|
|
24988
|
+
const clusterBestPrices = (0, import_react42.useMemo)(
|
|
24912
24989
|
() => (0, import_hooks71.mergeBestPricesPreferringLive)(clusterBestPricesRest, wsBestPrices),
|
|
24913
24990
|
[clusterBestPricesRest, wsBestPrices]
|
|
24914
24991
|
);
|
|
24915
|
-
const [internalTab, setInternalTab] = (0,
|
|
24916
|
-
const [executionType, setExecutionType] = (0,
|
|
24917
|
-
const [selectedLimitVenue, setSelectedLimitVenue] = (0,
|
|
24918
|
-
const [limitPrice, setLimitPrice] = (0,
|
|
24919
|
-
const [limitPriceInputValue, setLimitPriceInputValue] = (0,
|
|
24920
|
-
const [limitPriceInputError, setLimitPriceInputError] = (0,
|
|
24921
|
-
const [limitExpirationType, setLimitExpirationType] = (0,
|
|
24922
|
-
const [limitExpirationDate, setLimitExpirationDate] = (0,
|
|
24923
|
-
const [limitExpirationTime, setLimitExpirationTime] = (0,
|
|
24924
|
-
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0,
|
|
24925
|
-
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0,
|
|
24926
|
-
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0,
|
|
24927
|
-
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0,
|
|
24928
|
-
const [internalAmount, setInternalAmount] = (0,
|
|
24929
|
-
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0,
|
|
24930
|
-
const [internalSlippage] = (0,
|
|
24931
|
-
const [isRoutesExpanded, setIsRoutesExpanded] = (0,
|
|
24932
|
-
const [selectedRouteCardId, setSelectedRouteCardId] = (0,
|
|
24933
|
-
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0,
|
|
24992
|
+
const [internalTab, setInternalTab] = (0, import_react42.useState)("buy");
|
|
24993
|
+
const [executionType, setExecutionType] = (0, import_react42.useState)("market");
|
|
24994
|
+
const [selectedLimitVenue, setSelectedLimitVenue] = (0, import_react42.useState)(null);
|
|
24995
|
+
const [limitPrice, setLimitPrice] = (0, import_react42.useState)(0.5);
|
|
24996
|
+
const [limitPriceInputValue, setLimitPriceInputValue] = (0, import_react42.useState)(formatLimitPriceInputValue(0.5));
|
|
24997
|
+
const [limitPriceInputError, setLimitPriceInputError] = (0, import_react42.useState)(null);
|
|
24998
|
+
const [limitExpirationType, setLimitExpirationType] = (0, import_react42.useState)("GTC");
|
|
24999
|
+
const [limitExpirationDate, setLimitExpirationDate] = (0, import_react42.useState)(void 0);
|
|
25000
|
+
const [limitExpirationTime, setLimitExpirationTime] = (0, import_react42.useState)("17:00");
|
|
25001
|
+
const [limitExpirationDraftDate, setLimitExpirationDraftDate] = (0, import_react42.useState)();
|
|
25002
|
+
const [limitExpirationDraftTime, setLimitExpirationDraftTime] = (0, import_react42.useState)("17:00");
|
|
25003
|
+
const [limitExpirationPickerView, setLimitExpirationPickerView] = (0, import_react42.useState)("options");
|
|
25004
|
+
const [isLimitExpirationPickerOpen, setIsLimitExpirationPickerOpen] = (0, import_react42.useState)(false);
|
|
25005
|
+
const [internalAmount, setInternalAmount] = (0, import_react42.useState)(PLACE_ORDER_DEFAULT_AMOUNT);
|
|
25006
|
+
const [sellFilledForOutcomeId, setSellFilledForOutcomeId] = (0, import_react42.useState)(null);
|
|
25007
|
+
const [internalSlippage] = (0, import_react42.useState)(DEFAULT_SLIPPAGE_VALUE);
|
|
25008
|
+
const [isRoutesExpanded, setIsRoutesExpanded] = (0, import_react42.useState)(false);
|
|
25009
|
+
const [selectedRouteCardId, setSelectedRouteCardId] = (0, import_react42.useState)(null);
|
|
25010
|
+
const [manualRouteSelectionIdentity, setManualRouteSelectionIdentity] = (0, import_react42.useState)(
|
|
24934
25011
|
null
|
|
24935
25012
|
);
|
|
24936
|
-
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0,
|
|
24937
|
-
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0,
|
|
24938
|
-
const [submissionFeedback, setSubmissionFeedback] = (0,
|
|
24939
|
-
const [submissionProgressState, setSubmissionProgressState] = (0,
|
|
24940
|
-
const [isBeforeActionPending, setIsBeforeActionPending] = (0,
|
|
24941
|
-
const outcomes = (0,
|
|
25013
|
+
const [isSplitDetailOpen, setIsSplitDetailOpen] = (0, import_react42.useState)(false);
|
|
25014
|
+
const [buyGeoBlockSnapshot, setBuyGeoBlockSnapshot] = (0, import_react42.useState)(null);
|
|
25015
|
+
const [submissionFeedback, setSubmissionFeedback] = (0, import_react42.useState)(null);
|
|
25016
|
+
const [submissionProgressState, setSubmissionProgressState] = (0, import_react42.useState)(null);
|
|
25017
|
+
const [isBeforeActionPending, setIsBeforeActionPending] = (0, import_react42.useState)(false);
|
|
25018
|
+
const outcomes = (0, import_react42.useMemo)(
|
|
24942
25019
|
() => mapVenueMarketOutcomesToPlaceOrderOutcomes(scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes),
|
|
24943
25020
|
[scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes]
|
|
24944
25021
|
);
|
|
24945
|
-
const selectedOutcomeDisplayPrice = (0,
|
|
25022
|
+
const selectedOutcomeDisplayPrice = (0, import_react42.useMemo)(() => {
|
|
24946
25023
|
var _a2;
|
|
24947
25024
|
if (!scopedSelectedOutcomeId || !scopedSelectedOutcome) return 0.5;
|
|
24948
25025
|
return getDisplayOutcomePrice({
|
|
@@ -24965,25 +25042,25 @@ var PlaceOrder = ({
|
|
|
24965
25042
|
scopedSelectedOutcomeId,
|
|
24966
25043
|
tradingContext == null ? void 0 : tradingContext.tradeSide
|
|
24967
25044
|
]);
|
|
24968
|
-
const buyTabRef = (0,
|
|
24969
|
-
const sellTabRef = (0,
|
|
24970
|
-
const expirationTriggerRef = (0,
|
|
24971
|
-
const limitPriceInitializedForOutcomeRef = (0,
|
|
24972
|
-
const expirationOptionRefs = (0,
|
|
24973
|
-
const shouldFocusExpirationOptionsRef = (0,
|
|
24974
|
-
const expirationTimeInputId = (0,
|
|
24975
|
-
const executionDebugStoreRef = (0,
|
|
24976
|
-
const executionDebugAttemptIdRef = (0,
|
|
24977
|
-
const submittedSelectionRef = (0,
|
|
24978
|
-
const lastValidRouteCardsRef = (0,
|
|
24979
|
-
(0,
|
|
25045
|
+
const buyTabRef = (0, import_react42.useRef)(null);
|
|
25046
|
+
const sellTabRef = (0, import_react42.useRef)(null);
|
|
25047
|
+
const expirationTriggerRef = (0, import_react42.useRef)(null);
|
|
25048
|
+
const limitPriceInitializedForOutcomeRef = (0, import_react42.useRef)(void 0);
|
|
25049
|
+
const expirationOptionRefs = (0, import_react42.useRef)([]);
|
|
25050
|
+
const shouldFocusExpirationOptionsRef = (0, import_react42.useRef)(false);
|
|
25051
|
+
const expirationTimeInputId = (0, import_react42.useId)();
|
|
25052
|
+
const executionDebugStoreRef = (0, import_react42.useRef)(null);
|
|
25053
|
+
const executionDebugAttemptIdRef = (0, import_react42.useRef)(null);
|
|
25054
|
+
const submittedSelectionRef = (0, import_react42.useRef)(null);
|
|
25055
|
+
const lastValidRouteCardsRef = (0, import_react42.useRef)(null);
|
|
25056
|
+
(0, import_react42.useEffect)(() => {
|
|
24980
25057
|
if (!isExecutionDebugEnabled) {
|
|
24981
25058
|
executionDebugStoreRef.current = null;
|
|
24982
25059
|
return;
|
|
24983
25060
|
}
|
|
24984
25061
|
executionDebugStoreRef.current = enableExecutionDebugInBrowser();
|
|
24985
25062
|
}, [isExecutionDebugEnabled]);
|
|
24986
|
-
(0,
|
|
25063
|
+
(0, import_react42.useEffect)(() => {
|
|
24987
25064
|
var _a2;
|
|
24988
25065
|
if (!isLimitExpirationPickerOpen) return;
|
|
24989
25066
|
if (limitExpirationPickerView !== "options") return;
|
|
@@ -24991,7 +25068,7 @@ var PlaceOrder = ({
|
|
|
24991
25068
|
(_a2 = expirationOptionRefs.current[LIMIT_EXPIRATION_OPTION_COUNT - 1]) == null ? void 0 : _a2.focus();
|
|
24992
25069
|
shouldFocusExpirationOptionsRef.current = false;
|
|
24993
25070
|
}, [isLimitExpirationPickerOpen, limitExpirationPickerView]);
|
|
24994
|
-
(0,
|
|
25071
|
+
(0, import_react42.useEffect)(() => {
|
|
24995
25072
|
if (!isExecutionDebugEnabled) return;
|
|
24996
25073
|
const store = executionDebugStoreRef.current;
|
|
24997
25074
|
if (!store) return;
|
|
@@ -25006,8 +25083,8 @@ var PlaceOrder = ({
|
|
|
25006
25083
|
const debouncedAmount = (0, import_hooks71.useDebouncedValue)(internalAmount, 300);
|
|
25007
25084
|
const isQuoteInputEditing = internalAmount !== debouncedAmount;
|
|
25008
25085
|
const isLimitOrder = showLimitOrders && executionType === "limit";
|
|
25009
|
-
const isSell = (0,
|
|
25010
|
-
const limitVenueOptions = (0,
|
|
25086
|
+
const isSell = (0, import_react42.useMemo)(() => internalTab === "sell", [internalTab]);
|
|
25087
|
+
const limitVenueOptions = (0, import_react42.useMemo)(
|
|
25011
25088
|
() => {
|
|
25012
25089
|
var _a2;
|
|
25013
25090
|
return buildLimitOrderVenueOptions({
|
|
@@ -25019,7 +25096,7 @@ var PlaceOrder = ({
|
|
|
25019
25096
|
},
|
|
25020
25097
|
[clusterMidpointResult, livePrices, scopedSelectedMarket, scopedSelectedOutcomeId]
|
|
25021
25098
|
);
|
|
25022
|
-
const visibleLimitVenueOptions = (0,
|
|
25099
|
+
const visibleLimitVenueOptions = (0, import_react42.useMemo)(() => {
|
|
25023
25100
|
return limitVenueOptions.filter((option) => {
|
|
25024
25101
|
return (0, import_hooks71.getVenueAvailabilityState)({
|
|
25025
25102
|
venueId: option.venue,
|
|
@@ -25037,7 +25114,7 @@ var PlaceOrder = ({
|
|
|
25037
25114
|
enabled: Boolean(isAuthenticated && isSell),
|
|
25038
25115
|
mode: isPaperMode ? "paper" : void 0
|
|
25039
25116
|
});
|
|
25040
|
-
const sellableSharesByVenue = (0,
|
|
25117
|
+
const sellableSharesByVenue = (0, import_react42.useMemo)(
|
|
25041
25118
|
() => isSell ? resolveSellableSharesByVenue({
|
|
25042
25119
|
positions: executionPositions,
|
|
25043
25120
|
market: scopedSelectedMarket,
|
|
@@ -25058,7 +25135,7 @@ var PlaceOrder = ({
|
|
|
25058
25135
|
isPanelActive: isQuotePanelActive,
|
|
25059
25136
|
isSubmitting: submissionProgressState != null || isBeforeActionPending || executeManaged.isPending || placeLimitOrder.isPending
|
|
25060
25137
|
};
|
|
25061
|
-
const limitVenueQuoteRequests = (0,
|
|
25138
|
+
const limitVenueQuoteRequests = (0, import_react42.useMemo)(
|
|
25062
25139
|
() => visibleLimitVenueOptions.map((option) => ({
|
|
25063
25140
|
venue: option.venue,
|
|
25064
25141
|
venueMarketOutcomeId: option.venueMarketOutcomeId
|
|
@@ -25079,11 +25156,11 @@ var PlaceOrder = ({
|
|
|
25079
25156
|
enabled: isLimitVenueQuoteEnabled,
|
|
25080
25157
|
refreshContext: smartRouteRefreshContext
|
|
25081
25158
|
});
|
|
25082
|
-
const limitVenueQuoteByVenue = (0,
|
|
25159
|
+
const limitVenueQuoteByVenue = (0, import_react42.useMemo)(
|
|
25083
25160
|
() => new Map(limitVenueQuotes.quotes.map((quote) => [quote.request.venue, quote])),
|
|
25084
25161
|
[limitVenueQuotes.quotes]
|
|
25085
25162
|
);
|
|
25086
|
-
const geoBlockedLimitVenues = (0,
|
|
25163
|
+
const geoBlockedLimitVenues = (0, import_react42.useMemo)(() => {
|
|
25087
25164
|
var _a2;
|
|
25088
25165
|
const venues = /* @__PURE__ */ new Set();
|
|
25089
25166
|
for (const quote of limitVenueQuotes.quotes) {
|
|
@@ -25093,7 +25170,7 @@ var PlaceOrder = ({
|
|
|
25093
25170
|
}
|
|
25094
25171
|
return venues;
|
|
25095
25172
|
}, [limitVenueQuotes.quotes]);
|
|
25096
|
-
const availableLimitVenueOptions = (0,
|
|
25173
|
+
const availableLimitVenueOptions = (0, import_react42.useMemo)(() => {
|
|
25097
25174
|
return visibleLimitVenueOptions.filter((option) => {
|
|
25098
25175
|
var _a2;
|
|
25099
25176
|
return !geoBlockedLimitVenues.has(option.venue) && // A limit SELL rests against shares held at that specific venue, so a
|
|
@@ -25115,11 +25192,11 @@ var PlaceOrder = ({
|
|
|
25115
25192
|
sellableSharesByVenue,
|
|
25116
25193
|
visibleLimitVenueOptions
|
|
25117
25194
|
]);
|
|
25118
|
-
const automaticLimitVenueOption = (0,
|
|
25195
|
+
const automaticLimitVenueOption = (0, import_react42.useMemo)(
|
|
25119
25196
|
() => resolveAutomaticLimitOrderVenueOption(availableLimitVenueOptions, internalTab),
|
|
25120
25197
|
[availableLimitVenueOptions, internalTab]
|
|
25121
25198
|
);
|
|
25122
|
-
const selectedLimitVenueOption = (0,
|
|
25199
|
+
const selectedLimitVenueOption = (0, import_react42.useMemo)(() => {
|
|
25123
25200
|
if (selectedLimitVenue) {
|
|
25124
25201
|
const selectedOption = availableLimitVenueOptions.find(
|
|
25125
25202
|
(option) => option.venue === selectedLimitVenue
|
|
@@ -25128,7 +25205,7 @@ var PlaceOrder = ({
|
|
|
25128
25205
|
}
|
|
25129
25206
|
return automaticLimitVenueOption;
|
|
25130
25207
|
}, [automaticLimitVenueOption, availableLimitVenueOptions, selectedLimitVenue]);
|
|
25131
|
-
(0,
|
|
25208
|
+
(0, import_react42.useEffect)(() => {
|
|
25132
25209
|
if (!selectedLimitVenue || !geoBlockedLimitVenues.has(selectedLimitVenue)) return;
|
|
25133
25210
|
setSelectedLimitVenue(null);
|
|
25134
25211
|
}, [geoBlockedLimitVenues, selectedLimitVenue]);
|
|
@@ -25157,7 +25234,7 @@ var PlaceOrder = ({
|
|
|
25157
25234
|
} : {}), {
|
|
25158
25235
|
refreshContext: smartRouteRefreshContext
|
|
25159
25236
|
}));
|
|
25160
|
-
(0,
|
|
25237
|
+
(0, import_react42.useEffect)(() => {
|
|
25161
25238
|
var _a2, _b2, _c2;
|
|
25162
25239
|
if (isSell || smartRoute.isFetching || ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) {
|
|
25163
25240
|
return;
|
|
@@ -25179,7 +25256,7 @@ var PlaceOrder = ({
|
|
|
25179
25256
|
smartRoute.isFetching,
|
|
25180
25257
|
user == null ? void 0 : user.id
|
|
25181
25258
|
]);
|
|
25182
|
-
const inheritedBuyGeoBlockedVenues = (0,
|
|
25259
|
+
const inheritedBuyGeoBlockedVenues = (0, import_react42.useMemo)(() => {
|
|
25183
25260
|
var _a2, _b2;
|
|
25184
25261
|
if (!isSell || !buyGeoBlockSnapshot || !scopedSelectedOutcomeId) return void 0;
|
|
25185
25262
|
if (buyGeoBlockSnapshot.eventId !== ((_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.id) != null ? _a2 : null)) return void 0;
|
|
@@ -25195,7 +25272,7 @@ var PlaceOrder = ({
|
|
|
25195
25272
|
scopedSelectedOutcomeId,
|
|
25196
25273
|
user == null ? void 0 : user.id
|
|
25197
25274
|
]);
|
|
25198
|
-
const venueSellQuoteRequests = (0,
|
|
25275
|
+
const venueSellQuoteRequests = (0, import_react42.useMemo)(
|
|
25199
25276
|
() => {
|
|
25200
25277
|
var _a2;
|
|
25201
25278
|
return isSell && !smartRoute.isLoading && ((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) === scopedSelectedOutcomeId ? buildVenueSellQuoteRequests({
|
|
@@ -25215,7 +25292,7 @@ var PlaceOrder = ({
|
|
|
25215
25292
|
enabled: isSell && isSmartRouteEnabled && !smartRoute.isLoading && ((_o = smartRoute.data) == null ? void 0 : _o.venueMarketOutcomeId) === scopedSelectedOutcomeId,
|
|
25216
25293
|
refreshContext: smartRouteRefreshContext
|
|
25217
25294
|
});
|
|
25218
|
-
const currentSellableShares = (0,
|
|
25295
|
+
const currentSellableShares = (0, import_react42.useMemo)(() => {
|
|
25219
25296
|
var _a2, _b2;
|
|
25220
25297
|
const sharesFromQuote = (_b2 = (_a2 = smartRoute.data) == null ? void 0 : _a2.positionAvailability) == null ? void 0 : _b2.totalSellableShares;
|
|
25221
25298
|
if (typeof sharesFromQuote === "number" && Number.isFinite(sharesFromQuote)) {
|
|
@@ -25225,22 +25302,22 @@ var PlaceOrder = ({
|
|
|
25225
25302
|
for (const size of sellableSharesByVenue.values()) resolvedShares += size;
|
|
25226
25303
|
return Math.max(0, resolvedShares);
|
|
25227
25304
|
}, [sellableSharesByVenue, (_q = (_p = smartRoute.data) == null ? void 0 : _p.positionAvailability) == null ? void 0 : _q.totalSellableShares]);
|
|
25228
|
-
const maxSellableShares = (0,
|
|
25305
|
+
const maxSellableShares = (0, import_react42.useMemo)(
|
|
25229
25306
|
() => floorToDecimals(currentSellableShares, SELL_SHARE_INPUT_DECIMALS),
|
|
25230
25307
|
[currentSellableShares]
|
|
25231
25308
|
);
|
|
25232
25309
|
const isCurrentSellableSharesLoading = isSell && isAuthenticated && !(typeof ((_s = (_r = smartRoute.data) == null ? void 0 : _r.positionAvailability) == null ? void 0 : _s.totalSellableShares) === "number") && (isExecutionPositionsLoading || isExecutionPositionsFetching);
|
|
25233
|
-
const displayedCurrentSellableShares = (0,
|
|
25310
|
+
const displayedCurrentSellableShares = (0, import_react42.useMemo)(() => {
|
|
25234
25311
|
if (!Number.isFinite(currentSellableShares) || currentSellableShares <= 0) return 0;
|
|
25235
25312
|
return floorToDecimals(currentSellableShares, SELL_SHARE_DISPLAY_DECIMALS);
|
|
25236
25313
|
}, [currentSellableShares]);
|
|
25237
|
-
const displayedCurrentSellableSharesLabel = (0,
|
|
25314
|
+
const displayedCurrentSellableSharesLabel = (0, import_react42.useMemo)(
|
|
25238
25315
|
() => `${formatFlooredShareAmount(maxSellableShares, SELL_SHARE_DISPLAY_DECIMALS)} shares`,
|
|
25239
25316
|
[maxSellableShares]
|
|
25240
25317
|
);
|
|
25241
25318
|
const isAtMaxSellableShares = isSell && maxSellableShares > 0 && Math.abs(internalAmount - maxSellableShares) < 1e-9;
|
|
25242
25319
|
const isSellAmountAboveAvailability = isSell && ((_t = smartRoute.data) == null ? void 0 : _t.venueMarketOutcomeId) === scopedSelectedOutcomeId && typeof ((_u = smartRoute.data.positionAvailability) == null ? void 0 : _u.totalSellableShares) === "number" && internalAmount > maxSellableShares;
|
|
25243
|
-
(0,
|
|
25320
|
+
(0, import_react42.useEffect)(() => {
|
|
25244
25321
|
if (submissionProgressState != null) return;
|
|
25245
25322
|
if (!isSell || isCurrentSellableSharesLoading) return;
|
|
25246
25323
|
if (scopedSelectedOutcomeId === sellFilledForOutcomeId) return;
|
|
@@ -25256,7 +25333,7 @@ var PlaceOrder = ({
|
|
|
25256
25333
|
onAmountChange,
|
|
25257
25334
|
submissionProgressState
|
|
25258
25335
|
]);
|
|
25259
|
-
(0,
|
|
25336
|
+
(0, import_react42.useEffect)(() => {
|
|
25260
25337
|
var _a2, _b2;
|
|
25261
25338
|
if (submissionProgressState != null || !isSell) return;
|
|
25262
25339
|
if (((_a2 = smartRoute.data) == null ? void 0 : _a2.venueMarketOutcomeId) !== scopedSelectedOutcomeId) return;
|
|
@@ -25280,7 +25357,7 @@ var PlaceOrder = ({
|
|
|
25280
25357
|
submissionProgressState
|
|
25281
25358
|
]);
|
|
25282
25359
|
const scopedSmartRouteData = ((_y = smartRoute.data) == null ? void 0 : _y.venueMarketOutcomeId) === scopedSelectedOutcomeId ? smartRoute.data : null;
|
|
25283
|
-
const routeCards = (0,
|
|
25360
|
+
const routeCards = (0, import_react42.useMemo)(() => {
|
|
25284
25361
|
const eventVenues = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.venueMarkets.map((market) => market.venue);
|
|
25285
25362
|
if (isSell) {
|
|
25286
25363
|
return buildLiveSellRouteCards({
|
|
@@ -25324,7 +25401,22 @@ var PlaceOrder = ({
|
|
|
25324
25401
|
const selectedManualRouteCard = manualRouteSelectionIdentity ? routeCards.find(
|
|
25325
25402
|
(card) => getPlaceOrderRouteCardIdentity(card) === manualRouteSelectionIdentity
|
|
25326
25403
|
) : void 0;
|
|
25327
|
-
const
|
|
25404
|
+
const legacyKalshiAccount = (0, import_react42.useMemo)(
|
|
25405
|
+
() => {
|
|
25406
|
+
var _a2;
|
|
25407
|
+
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
25408
|
+
},
|
|
25409
|
+
[user == null ? void 0 : user.venueAccounts]
|
|
25410
|
+
);
|
|
25411
|
+
const isKalshiAccountActive = (_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _B : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
25412
|
+
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
25413
|
+
const isKalshiAvailable = (0, import_hooks71.getVenueAvailabilityState)({
|
|
25414
|
+
venueId: "kalshi",
|
|
25415
|
+
disabledVenues,
|
|
25416
|
+
isConfigLoading: isAppConfigLoading
|
|
25417
|
+
}) === "available";
|
|
25418
|
+
const isKalshiDisconnected = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && !isKalshiAccountActive;
|
|
25419
|
+
const resolvedSelectedRouteCardId = (0, import_react42.useMemo)(() => {
|
|
25328
25420
|
var _a2;
|
|
25329
25421
|
if (selectedManualRouteCard && !selectedManualRouteCard.isUnavailable) {
|
|
25330
25422
|
return selectedManualRouteCard.id;
|
|
@@ -25333,17 +25425,20 @@ var PlaceOrder = ({
|
|
|
25333
25425
|
return selectedRouteCardId;
|
|
25334
25426
|
}
|
|
25335
25427
|
if (routeCards.length === 0) return null;
|
|
25336
|
-
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status
|
|
25428
|
+
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status, {
|
|
25429
|
+
isKalshiDisconnected
|
|
25430
|
+
});
|
|
25337
25431
|
}, [
|
|
25432
|
+
isKalshiDisconnected,
|
|
25338
25433
|
isSell,
|
|
25339
25434
|
isRouteCardsTransient,
|
|
25340
25435
|
manualRouteSelectionIdentity,
|
|
25341
25436
|
routeCards,
|
|
25342
25437
|
selectedManualRouteCard,
|
|
25343
25438
|
selectedRouteCardId,
|
|
25344
|
-
(
|
|
25439
|
+
(_C = smartRoute.data) == null ? void 0 : _C.status
|
|
25345
25440
|
]);
|
|
25346
|
-
(0,
|
|
25441
|
+
(0, import_react42.useEffect)(() => {
|
|
25347
25442
|
if (routeCards.length === 0) {
|
|
25348
25443
|
if (isRouteCardsTransient) return;
|
|
25349
25444
|
setSelectedRouteCardId(null);
|
|
@@ -25367,19 +25462,19 @@ var PlaceOrder = ({
|
|
|
25367
25462
|
selectedRouteCardId
|
|
25368
25463
|
]);
|
|
25369
25464
|
const isSubmissionLocked = submissionProgressState != null;
|
|
25370
|
-
const isSubmissionLockedRef = (0,
|
|
25465
|
+
const isSubmissionLockedRef = (0, import_react42.useRef)(isSubmissionLocked);
|
|
25371
25466
|
isSubmissionLockedRef.current = isSubmissionLocked;
|
|
25372
|
-
(0,
|
|
25467
|
+
(0, import_react42.useEffect)(() => {
|
|
25373
25468
|
if (isSubmissionLockedRef.current) return;
|
|
25374
25469
|
setSubmissionFeedback(null);
|
|
25375
25470
|
setSubmissionProgressState(null);
|
|
25376
25471
|
}, [executionType, internalAmount, internalSlippage, internalTab, scopedSelectedOutcomeId]);
|
|
25377
|
-
(0,
|
|
25472
|
+
(0, import_react42.useEffect)(() => {
|
|
25378
25473
|
if (showLimitOrders || executionType !== "limit") return;
|
|
25379
25474
|
setExecutionType("market");
|
|
25380
25475
|
setIsLimitExpirationPickerOpen(false);
|
|
25381
25476
|
}, [executionType, showLimitOrders]);
|
|
25382
|
-
(0,
|
|
25477
|
+
(0, import_react42.useEffect)(() => {
|
|
25383
25478
|
if (executionType !== "limit") {
|
|
25384
25479
|
limitPriceInitializedForOutcomeRef.current = void 0;
|
|
25385
25480
|
return;
|
|
@@ -25392,18 +25487,18 @@ var PlaceOrder = ({
|
|
|
25392
25487
|
setLimitPriceInputValue(formatLimitPriceInputValue(nextLimitPrice));
|
|
25393
25488
|
setLimitPriceInputError(null);
|
|
25394
25489
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
25395
|
-
(0,
|
|
25490
|
+
(0, import_react42.useEffect)(() => {
|
|
25396
25491
|
setSelectedLimitVenue(null);
|
|
25397
25492
|
}, [scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id, scopedSelectedOutcomeId]);
|
|
25398
|
-
(0,
|
|
25493
|
+
(0, import_react42.useEffect)(() => {
|
|
25399
25494
|
setSelectedRouteCardId(null);
|
|
25400
25495
|
setManualRouteSelectionIdentity(null);
|
|
25401
25496
|
setIsRoutesExpanded(false);
|
|
25402
25497
|
setIsSplitDetailOpen(false);
|
|
25403
25498
|
}, [executionType, internalTab, scopedSelectedOutcomeId]);
|
|
25404
25499
|
const orderedRouteCards = routeCards;
|
|
25405
|
-
const selectedRouteCard = (
|
|
25406
|
-
const selectedSharedKycVenue = (0,
|
|
25500
|
+
const selectedRouteCard = (_E = (_D = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _D : orderedRouteCards[0]) != null ? _E : null;
|
|
25501
|
+
const selectedSharedKycVenue = (0, import_react42.useMemo)(() => {
|
|
25407
25502
|
var _a2, _b2;
|
|
25408
25503
|
const candidateVenue = isLimitOrder ? selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue : (_b2 = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills.find(
|
|
25409
25504
|
(fill) => venueRequiresSharedKyc({ venue: fill.venue })
|
|
@@ -25413,36 +25508,22 @@ var PlaceOrder = ({
|
|
|
25413
25508
|
return parsedVenue.success ? parsedVenue.data : null;
|
|
25414
25509
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard]);
|
|
25415
25510
|
const needsSharedKycVerification = !isPaperMode && isAuthenticated && sharedKyc !== void 0 && selectedSharedKycVenue !== null && sharedKyc.status !== "verified";
|
|
25416
|
-
const isKalshiRoute = (0,
|
|
25417
|
-
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) ===
|
|
25511
|
+
const isKalshiRoute = (0, import_react42.useMemo)(() => {
|
|
25512
|
+
if (isLimitOrder) return (selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue) === import_sdk24.Venue.kalshi;
|
|
25418
25513
|
if (selectedRouteCard) {
|
|
25419
25514
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
25420
25515
|
}
|
|
25421
25516
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
25422
25517
|
}, [isLimitOrder, selectedLimitVenueOption == null ? void 0 : selectedLimitVenueOption.venue, selectedRouteCard, scopedSelectedMarket]);
|
|
25423
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
25424
|
-
const
|
|
25425
|
-
|
|
25426
|
-
var _a2;
|
|
25427
|
-
return (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.find((venueAccount) => venueAccount.venue === "kalshi");
|
|
25428
|
-
},
|
|
25429
|
-
[user == null ? void 0 : user.venueAccounts]
|
|
25430
|
-
);
|
|
25431
|
-
const isKalshiAccountActive = (_F = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _F : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
25432
|
-
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
25433
|
-
const isKalshiAvailable = (0, import_hooks71.getVenueAvailabilityState)({
|
|
25434
|
-
venueId: "kalshi",
|
|
25435
|
-
disabledVenues,
|
|
25436
|
-
isConfigLoading: isAppConfigLoading
|
|
25437
|
-
}) === "available";
|
|
25438
|
-
const needsKalshiConnection = !isPaperMode && isAuthenticated && hasKalshiConnectionState && isKalshiAvailable && isKalshiRoute && !isKalshiAccountActive;
|
|
25439
|
-
const handleVerifyKalshi = (0, import_react41.useCallback)(
|
|
25518
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_F = liveBalanceState.kalshiBalance) != null ? _F : 0 : liveAvailableBalance;
|
|
25519
|
+
const needsKalshiConnection = isKalshiDisconnected && isKalshiRoute;
|
|
25520
|
+
const handleVerifyKalshi = (0, import_react42.useCallback)(
|
|
25440
25521
|
(credentials) => __async(null, null, function* () {
|
|
25441
25522
|
if (onConnectKalshi) {
|
|
25442
25523
|
yield onConnectKalshi(credentials);
|
|
25443
25524
|
} else {
|
|
25444
25525
|
yield aggClient.upsertVenueKey({
|
|
25445
|
-
venue:
|
|
25526
|
+
venue: import_sdk24.Venue.kalshi,
|
|
25446
25527
|
credentials: {
|
|
25447
25528
|
keyId: credentials.apiKeyId,
|
|
25448
25529
|
privateKey: credentials.privateKey
|
|
@@ -25454,7 +25535,7 @@ var PlaceOrder = ({
|
|
|
25454
25535
|
}),
|
|
25455
25536
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
25456
25537
|
);
|
|
25457
|
-
const handleRouteCardSelect = (0,
|
|
25538
|
+
const handleRouteCardSelect = (0, import_react42.useCallback)(
|
|
25458
25539
|
(cardId) => {
|
|
25459
25540
|
const card = routeCards.find((routeCard) => routeCard.id === cardId);
|
|
25460
25541
|
if (!card || card.isUnavailable) return;
|
|
@@ -25491,7 +25572,7 @@ var PlaceOrder = ({
|
|
|
25491
25572
|
mode: isPaperMode ? "paper" : void 0,
|
|
25492
25573
|
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((_I = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _I.length)
|
|
25493
25574
|
});
|
|
25494
|
-
const executionProgressFloorRef = (0,
|
|
25575
|
+
const executionProgressFloorRef = (0, import_react42.useRef)({
|
|
25495
25576
|
quoteId: null,
|
|
25496
25577
|
value: 0
|
|
25497
25578
|
});
|
|
@@ -25502,7 +25583,7 @@ var PlaceOrder = ({
|
|
|
25502
25583
|
const executionDateSource = (_R = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _R : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
25503
25584
|
const executionDateLabel = executionDateSource ? getTradingDateLabel(executionDateSource) : "";
|
|
25504
25585
|
const executionQuoteData = (_T = (_S = submissionProgressState == null ? void 0 : submissionProgressState.quoteData) != null ? _S : selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _T : null;
|
|
25505
|
-
const executionOrderGroups = (0,
|
|
25586
|
+
const executionOrderGroups = (0, import_react42.useMemo)(() => {
|
|
25506
25587
|
var _a2, _b2, _c2;
|
|
25507
25588
|
if (!executionQuoteData) return [];
|
|
25508
25589
|
return deriveExecutionOrderGroups({
|
|
@@ -25525,7 +25606,7 @@ var PlaceOrder = ({
|
|
|
25525
25606
|
(_U = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) == null ? void 0 : _U.length,
|
|
25526
25607
|
tradingLabels
|
|
25527
25608
|
]);
|
|
25528
|
-
const executionProgressPercent = (0,
|
|
25609
|
+
const executionProgressPercent = (0, import_react42.useMemo)(() => {
|
|
25529
25610
|
var _a2, _b2, _c2;
|
|
25530
25611
|
const quoteId = (_a2 = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _a2 : null;
|
|
25531
25612
|
const previousProgress = executionProgressFloorRef.current.quoteId === quoteId ? executionProgressFloorRef.current.value : 0;
|
|
@@ -25545,7 +25626,7 @@ var PlaceOrder = ({
|
|
|
25545
25626
|
submissionProgressState == null ? void 0 : submissionProgressState.orderIds,
|
|
25546
25627
|
submissionProgressState == null ? void 0 : submissionProgressState.quoteId
|
|
25547
25628
|
]);
|
|
25548
|
-
const buildExecutionSummary = (0,
|
|
25629
|
+
const buildExecutionSummary = (0, import_react42.useCallback)(
|
|
25549
25630
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
25550
25631
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
|
|
25551
25632
|
if (!quoteData) return void 0;
|
|
@@ -25649,7 +25730,7 @@ var PlaceOrder = ({
|
|
|
25649
25730
|
tradingLabels
|
|
25650
25731
|
]
|
|
25651
25732
|
);
|
|
25652
|
-
(0,
|
|
25733
|
+
(0, import_react42.useEffect)(() => {
|
|
25653
25734
|
if (executionProgress.phase === "order_submitted") {
|
|
25654
25735
|
const submittedOrder = executionProgress.submittedOrders[0];
|
|
25655
25736
|
setSubmissionProgressState((prev) => {
|
|
@@ -25662,7 +25743,7 @@ var PlaceOrder = ({
|
|
|
25662
25743
|
});
|
|
25663
25744
|
}
|
|
25664
25745
|
}, [executionProgress.phase, executionProgress.submittedOrders]);
|
|
25665
|
-
(0,
|
|
25746
|
+
(0, import_react42.useEffect)(() => {
|
|
25666
25747
|
var _a2, _b2;
|
|
25667
25748
|
const dp = executionProgress.dagProgress;
|
|
25668
25749
|
if (!dp) return;
|
|
@@ -25717,7 +25798,7 @@ var PlaceOrder = ({
|
|
|
25717
25798
|
return __spreadProps(__spreadValues({}, prev), { dagProgress: dp });
|
|
25718
25799
|
});
|
|
25719
25800
|
}, [executionOrderGroups, executionProgress.dagProgress, tradingLabels]);
|
|
25720
|
-
(0,
|
|
25801
|
+
(0, import_react42.useEffect)(() => {
|
|
25721
25802
|
const orderIds = submissionProgressState == null ? void 0 : submissionProgressState.orderIds;
|
|
25722
25803
|
if (!(orderIds == null ? void 0 : orderIds.length)) return;
|
|
25723
25804
|
const aggregateStatus = deriveAggregateOrderStatus(
|
|
@@ -25778,7 +25859,7 @@ var PlaceOrder = ({
|
|
|
25778
25859
|
tradingLabels
|
|
25779
25860
|
]);
|
|
25780
25861
|
const estDurationMs = executionQuoteData && typeof executionQuoteData.estDurationMs === "number" ? executionQuoteData.estDurationMs : 6e4;
|
|
25781
|
-
(0,
|
|
25862
|
+
(0, import_react42.useEffect)(() => {
|
|
25782
25863
|
const phase = submissionProgressState == null ? void 0 : submissionProgressState.phase;
|
|
25783
25864
|
if (phase !== "submitting" && phase !== "executing") return;
|
|
25784
25865
|
const timeoutMs = Math.max(6e4, 2 * estDurationMs);
|
|
@@ -25793,7 +25874,7 @@ var PlaceOrder = ({
|
|
|
25793
25874
|
}, timeoutMs);
|
|
25794
25875
|
return () => clearTimeout(id);
|
|
25795
25876
|
}, [submissionProgressState == null ? void 0 : submissionProgressState.phase, estDurationMs, tradingLabels.orderStillSettling]);
|
|
25796
|
-
const emitTerminalOrderNotifications = (0,
|
|
25877
|
+
const emitTerminalOrderNotifications = (0, import_react42.useCallback)(() => {
|
|
25797
25878
|
const toast = toastCtx == null ? void 0 : toastCtx.toast;
|
|
25798
25879
|
if (!toast) return;
|
|
25799
25880
|
for (const event of executionProgress.terminalOrderEvents) {
|
|
@@ -25822,7 +25903,7 @@ var PlaceOrder = ({
|
|
|
25822
25903
|
});
|
|
25823
25904
|
}
|
|
25824
25905
|
}, [executionProgress.terminalOrderEvents, labels, toastCtx]);
|
|
25825
|
-
(0,
|
|
25906
|
+
(0, import_react42.useEffect)(() => {
|
|
25826
25907
|
var _a2, _b2;
|
|
25827
25908
|
if (!submissionProgressState) return;
|
|
25828
25909
|
onExecutionStateChange == null ? void 0 : onExecutionStateChange(submissionProgressState);
|
|
@@ -25880,10 +25961,10 @@ var PlaceOrder = ({
|
|
|
25880
25961
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (isSell && isQuoteInputEditing || smartRoute.isLoading || !isSell && smartRoute.isFetching || isSell && venueSellQuotes.isLoading);
|
|
25881
25962
|
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
25882
25963
|
const selectedRouteFills = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _W : [];
|
|
25883
|
-
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) ===
|
|
25884
|
-
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !==
|
|
25885
|
-
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue ===
|
|
25886
|
-
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !==
|
|
25964
|
+
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === import_sdk24.Venue.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === import_sdk24.Venue.kalshi));
|
|
25965
|
+
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== import_sdk24.Venue.kalshi);
|
|
25966
|
+
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === import_sdk24.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
25967
|
+
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== import_sdk24.Venue.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
25887
25968
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
25888
25969
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
25889
25970
|
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_X = liveBalanceState.kalshiBalance) != null ? _X : 0);
|
|
@@ -25897,7 +25978,7 @@ var PlaceOrder = ({
|
|
|
25897
25978
|
const isBelowVenueMinimumFromQuote = isQuoteBelowVenueMinimum(activeQuoteData);
|
|
25898
25979
|
const isBelowMinimum = isBelowClientMinimum || isBelowVenueMinimumFromQuote;
|
|
25899
25980
|
const belowMinimumMessage = isBelowClientMinimum ? tradingLabels.minimumOrderAmount(MIN_BUY_ORDER_AMOUNT) : tradingLabels.minOrderSizeViolated;
|
|
25900
|
-
const quoteStatus = (0,
|
|
25981
|
+
const quoteStatus = (0, import_react42.useMemo)(() => {
|
|
25901
25982
|
if (!orderEligibility.canPlaceOrder) return void 0;
|
|
25902
25983
|
return resolvePlaceOrderQuoteStatus({
|
|
25903
25984
|
amount: internalAmount,
|
|
@@ -25914,7 +25995,7 @@ var PlaceOrder = ({
|
|
|
25914
25995
|
scopedSelectedMarket,
|
|
25915
25996
|
tradingLabels
|
|
25916
25997
|
]);
|
|
25917
|
-
const smartRouteErrorMessage = (0,
|
|
25998
|
+
const smartRouteErrorMessage = (0, import_react42.useMemo)(() => {
|
|
25918
25999
|
var _a2;
|
|
25919
26000
|
const quoteError = (_a2 = smartRoute.error) != null ? _a2 : isSell ? venueSellQuotes.error : null;
|
|
25920
26001
|
if (!quoteError || orderedRouteCards.length > 0) return null;
|
|
@@ -25925,26 +26006,26 @@ var PlaceOrder = ({
|
|
|
25925
26006
|
});
|
|
25926
26007
|
}, [isSell, orderedRouteCards.length, smartRoute.error, tradingLabels, venueSellQuotes.error]);
|
|
25927
26008
|
const progressActionLabel = (internalTab === "buy" ? tradingLabels.buyingOutcome(selectedOutcomeLabel) : tradingLabels.sellingOutcome(selectedOutcomeLabel)).trim();
|
|
25928
|
-
const retryRemainingAmount = (0,
|
|
26009
|
+
const retryRemainingAmount = (0, import_react42.useMemo)(() => {
|
|
25929
26010
|
return getCanonicalPlaceOrderUnfilledRemaining({
|
|
25930
26011
|
originalAmount: internalAmount,
|
|
25931
26012
|
tradeSide: internalTab,
|
|
25932
26013
|
terminalOrderEvents: executionProgress.terminalOrderEvents
|
|
25933
26014
|
});
|
|
25934
26015
|
}, [executionProgress.terminalOrderEvents, internalAmount, internalTab]);
|
|
25935
|
-
const canRetryRemaining = (0,
|
|
26016
|
+
const canRetryRemaining = (0, import_react42.useMemo)(() => {
|
|
25936
26017
|
if (retryRemainingAmount == null) return false;
|
|
25937
26018
|
const minRemainder = isSell ? MIN_SELL_ORDER_SHARES : MIN_BUY_ORDER_AMOUNT;
|
|
25938
26019
|
return retryRemainingAmount >= minRemainder;
|
|
25939
26020
|
}, [isSell, retryRemainingAmount]);
|
|
25940
26021
|
const PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD = 0.95;
|
|
25941
|
-
const shouldAutoSkipPartialFill = (0,
|
|
26022
|
+
const shouldAutoSkipPartialFill = (0, import_react42.useMemo)(() => {
|
|
25942
26023
|
if (internalAmount <= 0 || retryRemainingAmount == null) return false;
|
|
25943
26024
|
const filled = Math.max(0, internalAmount - retryRemainingAmount);
|
|
25944
26025
|
const fillRatio = filled / internalAmount;
|
|
25945
26026
|
return fillRatio >= PARTIAL_FILL_AUTO_SUCCESS_THRESHOLD || !canRetryRemaining;
|
|
25946
26027
|
}, [canRetryRemaining, internalAmount, retryRemainingAmount]);
|
|
25947
|
-
const failureSummary = (0,
|
|
26028
|
+
const failureSummary = (0, import_react42.useMemo)(() => {
|
|
25948
26029
|
var _a2;
|
|
25949
26030
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return void 0;
|
|
25950
26031
|
const quoteData = (_a2 = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _a2 : activeQuoteData;
|
|
@@ -26017,21 +26098,21 @@ var PlaceOrder = ({
|
|
|
26017
26098
|
submissionProgressState,
|
|
26018
26099
|
tradingLabels
|
|
26019
26100
|
]);
|
|
26020
|
-
const displayedToWinHint = (0,
|
|
26101
|
+
const displayedToWinHint = (0, import_react42.useMemo)(() => {
|
|
26021
26102
|
if (!selectedRouteCard) return "";
|
|
26022
26103
|
const averagePrice = selectedRouteCard.executionPrice;
|
|
26023
26104
|
return averagePrice == null ? "" : tradingLabels.averagePrice(averagePrice);
|
|
26024
26105
|
}, [selectedRouteCard, tradingLabels]);
|
|
26025
26106
|
const displayedToWinValue = (_Y = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _Y : 0;
|
|
26026
|
-
const originalLimitPriceRaw = (0,
|
|
26027
|
-
const limitPriceAdjustmentByVenue = (0,
|
|
26107
|
+
const originalLimitPriceRaw = (0, import_react42.useMemo)(() => toLimitPriceRaw(limitPrice), [limitPrice]);
|
|
26108
|
+
const limitPriceAdjustmentByVenue = (0, import_react42.useMemo)(() => {
|
|
26028
26109
|
var _a2;
|
|
26029
26110
|
const adjustments = /* @__PURE__ */ new Map();
|
|
26030
26111
|
for (const option of visibleLimitVenueOptions) {
|
|
26031
26112
|
try {
|
|
26032
26113
|
adjustments.set(
|
|
26033
26114
|
option.venue,
|
|
26034
|
-
(0,
|
|
26115
|
+
(0, import_sdk24.adjustLimitPriceRawToTick)({
|
|
26035
26116
|
limitPriceRaw: originalLimitPriceRaw,
|
|
26036
26117
|
side: internalTab,
|
|
26037
26118
|
tickSize: (_a2 = limitVenueQuoteByVenue.get(option.venue)) == null ? void 0 : _a2.tickSize
|
|
@@ -26040,7 +26121,7 @@ var PlaceOrder = ({
|
|
|
26040
26121
|
} catch (e) {
|
|
26041
26122
|
adjustments.set(
|
|
26042
26123
|
option.venue,
|
|
26043
|
-
(0,
|
|
26124
|
+
(0, import_sdk24.adjustLimitPriceRawToTick)({
|
|
26044
26125
|
limitPriceRaw: originalLimitPriceRaw,
|
|
26045
26126
|
side: internalTab,
|
|
26046
26127
|
tickSize: null
|
|
@@ -26052,13 +26133,13 @@ var PlaceOrder = ({
|
|
|
26052
26133
|
}, [internalTab, limitVenueQuoteByVenue, originalLimitPriceRaw, visibleLimitVenueOptions]);
|
|
26053
26134
|
const selectedLimitPriceAdjustment = selectedLimitVenueOption ? limitPriceAdjustmentByVenue.get(selectedLimitVenueOption.venue) : void 0;
|
|
26054
26135
|
const selectedLimitPriceRaw = (_Z = selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjustedPriceRaw) != null ? _Z : originalLimitPriceRaw;
|
|
26055
|
-
const limitPriceAdjustmentMessage = (0,
|
|
26136
|
+
const limitPriceAdjustmentMessage = (0, import_react42.useMemo)(() => {
|
|
26056
26137
|
if (!selectedLimitVenueOption || !(selectedLimitPriceAdjustment == null ? void 0 : selectedLimitPriceAdjustment.adjusted) || !selectedLimitPriceAdjustment.tickSizeRaw) {
|
|
26057
26138
|
return "";
|
|
26058
26139
|
}
|
|
26059
26140
|
return tradingLabels.limitPriceAdjusted(
|
|
26060
26141
|
[getTradingVenueLabel(selectedLimitVenueOption.venue)],
|
|
26061
|
-
Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(
|
|
26142
|
+
Number(BigInt(selectedLimitPriceAdjustment.tickSizeRaw)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE) * 100,
|
|
26062
26143
|
formatLimitPriceRawLabel(originalLimitPriceRaw),
|
|
26063
26144
|
internalTab,
|
|
26064
26145
|
formatLimitPriceRawLabel(selectedLimitPriceAdjustment.adjustedPriceRaw)
|
|
@@ -26070,11 +26151,11 @@ var PlaceOrder = ({
|
|
|
26070
26151
|
selectedLimitVenueOption,
|
|
26071
26152
|
tradingLabels
|
|
26072
26153
|
]);
|
|
26073
|
-
const limitOrderPayload = (0,
|
|
26154
|
+
const limitOrderPayload = (0, import_react42.useMemo)(() => {
|
|
26074
26155
|
if (!selectedLimitVenueOption || internalAmount <= 0) return null;
|
|
26075
26156
|
if (limitPriceInputError) return null;
|
|
26076
26157
|
const effectivePriceRaw = BigInt(selectedLimitPriceRaw);
|
|
26077
|
-
if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >=
|
|
26158
|
+
if (effectivePriceRaw <= BigInt(0) || effectivePriceRaw >= import_sdk24.LIMIT_PRICE_RAW_SCALE) return null;
|
|
26078
26159
|
const expirationDate = resolveLimitExpirationDate({
|
|
26079
26160
|
expirationType: limitExpirationType,
|
|
26080
26161
|
customDate: limitExpirationDate,
|
|
@@ -26106,7 +26187,7 @@ var PlaceOrder = ({
|
|
|
26106
26187
|
selectedLimitVenueOption,
|
|
26107
26188
|
selectedLimitPriceRaw
|
|
26108
26189
|
]);
|
|
26109
|
-
const resolvedLimitExpirationDraftDate = (0,
|
|
26190
|
+
const resolvedLimitExpirationDraftDate = (0, import_react42.useMemo)(() => {
|
|
26110
26191
|
return resolveLimitExpirationDate({
|
|
26111
26192
|
expirationType: "CUSTOM",
|
|
26112
26193
|
customDate: limitExpirationDraftDate,
|
|
@@ -26114,7 +26195,7 @@ var PlaceOrder = ({
|
|
|
26114
26195
|
});
|
|
26115
26196
|
}, [limitExpirationDraftDate, limitExpirationDraftTime]);
|
|
26116
26197
|
const isLimitExpirationDraftValid = isFutureLimitExpiration(resolvedLimitExpirationDraftDate);
|
|
26117
|
-
const resolvedCustomExpirationDate = (0,
|
|
26198
|
+
const resolvedCustomExpirationDate = (0, import_react42.useMemo)(() => {
|
|
26118
26199
|
return resolveLimitExpirationDate({
|
|
26119
26200
|
expirationType: "CUSTOM",
|
|
26120
26201
|
customDate: limitExpirationDate,
|
|
@@ -26136,18 +26217,18 @@ var PlaceOrder = ({
|
|
|
26136
26217
|
expiresAt: serializeLimitOrderExpiration(expirationDate)
|
|
26137
26218
|
});
|
|
26138
26219
|
};
|
|
26139
|
-
const displayedLimitToWinValue = (0,
|
|
26220
|
+
const displayedLimitToWinValue = (0, import_react42.useMemo)(() => {
|
|
26140
26221
|
if (!limitOrderPayload) return 0;
|
|
26141
|
-
const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(
|
|
26222
|
+
const size = Number(BigInt(limitOrderPayload.sizeRaw)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
26142
26223
|
if (internalTab === "buy") return size;
|
|
26143
26224
|
return Number(
|
|
26144
26225
|
ceilDiv(
|
|
26145
26226
|
BigInt(limitOrderPayload.limitPriceRaw) * BigInt(limitOrderPayload.sizeRaw),
|
|
26146
|
-
|
|
26227
|
+
import_sdk24.LIMIT_PRICE_RAW_SCALE
|
|
26147
26228
|
)
|
|
26148
|
-
) / Number(
|
|
26229
|
+
) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
26149
26230
|
}, [internalTab, limitOrderPayload]);
|
|
26150
|
-
const limitRouteCards = (0,
|
|
26231
|
+
const limitRouteCards = (0, import_react42.useMemo)(() => {
|
|
26151
26232
|
return visibleLimitVenueOptions.map((option) => {
|
|
26152
26233
|
var _a2, _b2, _c2, _d2;
|
|
26153
26234
|
const effectiveLimitPriceRaw = (_b2 = (_a2 = limitPriceAdjustmentByVenue.get(option.venue)) == null ? void 0 : _a2.adjustedPriceRaw) != null ? _b2 : originalLimitPriceRaw;
|
|
@@ -26197,7 +26278,7 @@ var PlaceOrder = ({
|
|
|
26197
26278
|
tradingLabels,
|
|
26198
26279
|
visibleLimitVenueOptions
|
|
26199
26280
|
]);
|
|
26200
|
-
const limitVenueOptionByCardId = (0,
|
|
26281
|
+
const limitVenueOptionByCardId = (0, import_react42.useMemo)(() => {
|
|
26201
26282
|
return new Map(
|
|
26202
26283
|
visibleLimitVenueOptions.map((option) => [
|
|
26203
26284
|
`limit-venue-${option.venue}-${option.venueMarketOutcomeId}`,
|
|
@@ -26220,13 +26301,13 @@ var PlaceOrder = ({
|
|
|
26220
26301
|
const activeFeeBreakdown = activeQuoteData == null ? void 0 : activeQuoteData.feeBreakdown;
|
|
26221
26302
|
const executionReserve = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.executionReserve;
|
|
26222
26303
|
const executionReserveValue = typeof executionReserve === "number" && Number.isFinite(executionReserve) && executionReserve > 0 ? formatUsd(executionReserve, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null;
|
|
26223
|
-
const estimatedFeesValue = (0,
|
|
26304
|
+
const estimatedFeesValue = (0, import_react42.useMemo)(() => {
|
|
26224
26305
|
const totalFees = getSmartRouteTotalFees(activeFeeBreakdown);
|
|
26225
26306
|
if (totalFees == null) return null;
|
|
26226
26307
|
return formatUsd(totalFees, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
26227
26308
|
}, [activeFeeBreakdown]);
|
|
26228
26309
|
const appFeeValue = (__ = activeFeeBreakdown == null ? void 0 : activeFeeBreakdown.appFee) != null ? __ : 0;
|
|
26229
|
-
const feeBreakdownRows = (0,
|
|
26310
|
+
const feeBreakdownRows = (0, import_react42.useMemo)(() => {
|
|
26230
26311
|
var _a2;
|
|
26231
26312
|
if (!activeFeeBreakdown) return [];
|
|
26232
26313
|
return [
|
|
@@ -26277,30 +26358,25 @@ var PlaceOrder = ({
|
|
|
26277
26358
|
const selectedLimitRouteCardId = selectedLimitVenueOption ? `limit-venue-${selectedLimitVenueOption.venue}-${selectedLimitVenueOption.venueMarketOutcomeId}` : null;
|
|
26278
26359
|
const selectedLimitRouteCard = selectedLimitRouteCardId ? (_$ = limitRouteCards.find((card) => card.id === selectedLimitRouteCardId)) != null ? _$ : null : null;
|
|
26279
26360
|
const selectedRouteGeoBlocked = isLimitOrder ? (_aa = selectedLimitRouteCard == null ? void 0 : selectedLimitRouteCard.isUnavailable) != null ? _aa : false : (_ba = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _ba : false;
|
|
26280
|
-
const geoBlockedVenuesFromWarnings = (0,
|
|
26361
|
+
const geoBlockedVenuesFromWarnings = (0, import_react42.useMemo)(
|
|
26281
26362
|
() => {
|
|
26282
26363
|
var _a2;
|
|
26283
26364
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
26284
26365
|
},
|
|
26285
26366
|
[(_ca = smartRoute.data) == null ? void 0 : _ca.warnings]
|
|
26286
26367
|
);
|
|
26287
|
-
const isPrimaryVenueGeoBlocked = (0,
|
|
26368
|
+
const isPrimaryVenueGeoBlocked = (0, import_react42.useMemo)(() => {
|
|
26288
26369
|
var _a2, _b2;
|
|
26289
26370
|
if (!selectedRouteCard || selectedRouteCard.isUnavailable) return false;
|
|
26290
26371
|
const fills = (_b2 = (_a2 = selectedRouteCard.quoteData) == null ? void 0 : _a2.fills) != null ? _b2 : [];
|
|
26291
26372
|
return fills.length > 0 && fills.every((f) => geoBlockedVenuesFromWarnings.has(f.venue));
|
|
26292
26373
|
}, [selectedRouteCard, geoBlockedVenuesFromWarnings]);
|
|
26293
26374
|
const shouldShowGeoBlockBanner = isTradingBlocked || selectedRouteGeoBlocked || isPrimaryVenueGeoBlocked || isLimitOrder && limitRouteCards.length > 0 && limitRouteCards.every((card) => card.isUnavailable);
|
|
26294
|
-
const shouldShowLowLiquidityWarning = !isQuoteInputEditing && !isQuoteLoading && (activeQuoteData == null ? void 0 : activeQuoteData.venueMarketOutcomeId) === scopedSelectedOutcomeId && !(activeQuoteData == null ? void 0 : activeQuoteData.fills.some((fill) => fill.venue === "prophetx")) && isPlaceOrderAveragePriceWorse({
|
|
26295
|
-
averageExecutionPrice: selectedRouteCard == null ? void 0 : selectedRouteCard.executionPrice,
|
|
26296
|
-
displayedMarketPrice: selectedOutcomeDisplayPrice,
|
|
26297
|
-
tradeSide: internalTab
|
|
26298
|
-
});
|
|
26299
26375
|
const actionLabel = `${internalTab === "buy" ? tradingLabels.buy : tradingLabels.sell} ${selectedOutcomeLabel}`.trim();
|
|
26300
26376
|
const isActionDisabled = isPrimaryActionDisabled || !orderEligibility.canPlaceOrder || isActionLoading || !hasEnteredAmount || !scopedSelectedMarket || isInsufficientBalance || isQuoteInsufficientBalance || isSell && isQuoteInputEditing || isSellAmountAboveAvailability || isBelowMinimum || !isLimitOrder && isQuoteLoading || isSelectedVenueInventoryInsufficient || (isLimitOrder ? !limitOrderPayload : !selectedRouteCard || !selectedRouteCard.quoteData.quoteId) || selectedRouteGeoBlocked || !isAuthenticated || !isLimitOrder && quoteStatus !== void 0;
|
|
26301
26377
|
const shouldShowSmartRouting = orderEligibility.canPlaceOrder && hasEnteredAmount && !isBelowMinimum && (isLimitOrder ? limitRouteCards.length > 0 : displayedRouteCards.length > 0 || smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
26302
26378
|
const shouldShowRouteToggle = !isLimitOrder && !isQuoteLoading && displayedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT;
|
|
26303
|
-
const handleReturnToOrderForm = (0,
|
|
26379
|
+
const handleReturnToOrderForm = (0, import_react42.useCallback)(() => {
|
|
26304
26380
|
const submittedSelection = submittedSelectionRef.current;
|
|
26305
26381
|
submittedSelectionRef.current = null;
|
|
26306
26382
|
setSubmissionProgressState(null);
|
|
@@ -26322,7 +26398,7 @@ var PlaceOrder = ({
|
|
|
26322
26398
|
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(shareText)}`;
|
|
26323
26399
|
window.open(shareUrl, "_blank", "noopener,noreferrer");
|
|
26324
26400
|
};
|
|
26325
|
-
const handleExecuteQuote = (0,
|
|
26401
|
+
const handleExecuteQuote = (0, import_react42.useCallback)(
|
|
26326
26402
|
(quoteData) => __async(null, null, function* () {
|
|
26327
26403
|
var _a2, _b2, _c2;
|
|
26328
26404
|
const quoteId = quoteData == null ? void 0 : quoteData.quoteId;
|
|
@@ -26439,7 +26515,7 @@ var PlaceOrder = ({
|
|
|
26439
26515
|
venueSellQuotes.quotes
|
|
26440
26516
|
]
|
|
26441
26517
|
);
|
|
26442
|
-
const handlePlaceLimitOrder = (0,
|
|
26518
|
+
const handlePlaceLimitOrder = (0, import_react42.useCallback)(
|
|
26443
26519
|
(submissionLimitOrderPayload) => __async(null, null, function* () {
|
|
26444
26520
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
26445
26521
|
if (!showLimitOrders) return;
|
|
@@ -26460,7 +26536,7 @@ var PlaceOrder = ({
|
|
|
26460
26536
|
}
|
|
26461
26537
|
const response = yield placeLimitOrder.mutateAsync(submissionLimitOrderPayload);
|
|
26462
26538
|
const limitPriceLabel = formatLimitPriceRawLabel(response.limitPriceRaw);
|
|
26463
|
-
const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(
|
|
26539
|
+
const size = Number(BigInt(submissionLimitOrderPayload.sizeRaw)) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE);
|
|
26464
26540
|
const sizeLabel = size.toLocaleString("en-US", {
|
|
26465
26541
|
minimumFractionDigits: 2,
|
|
26466
26542
|
maximumFractionDigits: 2
|
|
@@ -26469,13 +26545,13 @@ var PlaceOrder = ({
|
|
|
26469
26545
|
Number(
|
|
26470
26546
|
ceilDiv(
|
|
26471
26547
|
BigInt(submissionLimitOrderPayload.limitPriceRaw) * BigInt(submissionLimitOrderPayload.sizeRaw),
|
|
26472
|
-
|
|
26548
|
+
import_sdk24.LIMIT_PRICE_RAW_SCALE
|
|
26473
26549
|
)
|
|
26474
|
-
) / Number(
|
|
26550
|
+
) / Number(import_sdk24.LIMIT_PRICE_RAW_SCALE)
|
|
26475
26551
|
) : sizeLabel;
|
|
26476
26552
|
const eventTitle = (_b2 = (_a2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _a2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _b2 : "";
|
|
26477
26553
|
const eventDateSource = (_c2 = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.endDate) != null ? _c2 : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.endDate;
|
|
26478
|
-
const responseVenue =
|
|
26554
|
+
const responseVenue = import_sdk24.Venue[response.venue];
|
|
26479
26555
|
setSubmissionProgressState({
|
|
26480
26556
|
orderId: response.orderId,
|
|
26481
26557
|
orderIds: [response.orderId],
|
|
@@ -26522,7 +26598,7 @@ var PlaceOrder = ({
|
|
|
26522
26598
|
tradingLabels
|
|
26523
26599
|
]
|
|
26524
26600
|
);
|
|
26525
|
-
const handleSkipToSuccess = (0,
|
|
26601
|
+
const handleSkipToSuccess = (0, import_react42.useCallback)(() => {
|
|
26526
26602
|
const primaryFilledEvent = executionProgress.terminalOrderEvents.find(
|
|
26527
26603
|
(e) => e.event === "filled" || e.event === "partial_fill"
|
|
26528
26604
|
);
|
|
@@ -26547,7 +26623,7 @@ var PlaceOrder = ({
|
|
|
26547
26623
|
failureSummary,
|
|
26548
26624
|
selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData
|
|
26549
26625
|
]);
|
|
26550
|
-
(0,
|
|
26626
|
+
(0, import_react42.useEffect)(() => {
|
|
26551
26627
|
if ((submissionProgressState == null ? void 0 : submissionProgressState.phase) !== "failed") return;
|
|
26552
26628
|
if ((failureSummary == null ? void 0 : failureSummary.kind) !== "partial_fill") return;
|
|
26553
26629
|
if (!shouldAutoSkipPartialFill) return;
|
|
@@ -26558,7 +26634,7 @@ var PlaceOrder = ({
|
|
|
26558
26634
|
shouldAutoSkipPartialFill,
|
|
26559
26635
|
submissionProgressState == null ? void 0 : submissionProgressState.phase
|
|
26560
26636
|
]);
|
|
26561
|
-
const handleRetrySubmission = (0,
|
|
26637
|
+
const handleRetrySubmission = (0, import_react42.useCallback)(() => __async(null, null, function* () {
|
|
26562
26638
|
var _a2, _b2, _c2, _d2, _e2;
|
|
26563
26639
|
if (!orderEligibility.canPlaceOrder || !failureSummary || failureSummary.kind === "generic") {
|
|
26564
26640
|
handleReturnToOrderForm();
|
|
@@ -26976,7 +27052,7 @@ var PlaceOrder = ({
|
|
|
26976
27052
|
}
|
|
26977
27053
|
);
|
|
26978
27054
|
}
|
|
26979
|
-
return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(
|
|
27055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(import_react42.Fragment, { children: [
|
|
26980
27056
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(
|
|
26981
27057
|
Card,
|
|
26982
27058
|
{
|
|
@@ -27352,12 +27428,13 @@ var PlaceOrder = ({
|
|
|
27352
27428
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(PlaceOrderRouteCardSkeleton, {}),
|
|
27353
27429
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(PlaceOrderRouteCardSkeleton, {})
|
|
27354
27430
|
] }) : activeRouteCards.length > 0 ? activeRouteCards.map((card) => {
|
|
27355
|
-
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
27431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_react42.Fragment, { children: renderRouteCard({
|
|
27356
27432
|
card,
|
|
27357
27433
|
enableAnimations,
|
|
27358
27434
|
isExpanded: card.kind === "split" ? isSplitDetailOpen : isRoutesExpanded,
|
|
27359
27435
|
isSelected: !card.isUnavailable && card.id === (isLimitOrder ? selectedLimitRouteCardId : resolvedSelectedRouteCardId),
|
|
27360
27436
|
onSelect: handleActiveRouteCardSelect,
|
|
27437
|
+
isKalshiDisconnected,
|
|
27361
27438
|
sharedKycStatus: isPaperMode ? void 0 : sharedKyc == null ? void 0 : sharedKyc.status,
|
|
27362
27439
|
tradingLabels
|
|
27363
27440
|
}) }, card.id);
|
|
@@ -27561,7 +27638,7 @@ var PlaceOrder = ({
|
|
|
27561
27638
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)("p", { className: "agg-order-summary-hint text-agg-sm leading-agg-5 text-agg-muted-foreground", children: isLimitOrder ? displayedLimitToWinHint : displayedToWinHint })
|
|
27562
27639
|
] }),
|
|
27563
27640
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
27564
|
-
|
|
27641
|
+
import_react41.default,
|
|
27565
27642
|
{
|
|
27566
27643
|
value: isLimitOrder ? displayedLimitToWinValue : displayedToWinValue,
|
|
27567
27644
|
locales: locale,
|
|
@@ -27719,15 +27796,6 @@ var PlaceOrder = ({
|
|
|
27719
27796
|
children: actionLabel
|
|
27720
27797
|
}
|
|
27721
27798
|
),
|
|
27722
|
-
shouldShowLowLiquidityWarning ? /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
27723
|
-
InlineAlert,
|
|
27724
|
-
{
|
|
27725
|
-
tone: "warning",
|
|
27726
|
-
variant: "surface",
|
|
27727
|
-
className: "agg-order-low-liquidity-warning justify-start! border-0! bg-agg-warning/10! py-2!",
|
|
27728
|
-
message: internalTab === "buy" ? tradingLabels.lowLiquidityWarning : tradingLabels.lowLiquiditySellWarning
|
|
27729
|
-
}
|
|
27730
|
-
) : null,
|
|
27731
27799
|
!shouldShowGeoBlockBanner && internalTab === "buy" && showFeesBreakdown && appFeeValue === 0 ? /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)("div", { className: "agg-order-platform-fee mt-1 flex items-center justify-center gap-1.5 text-agg-sm leading-agg-5 text-agg-muted-foreground", children: [
|
|
27732
27800
|
/* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
|
|
27733
27801
|
Icon,
|
|
@@ -27778,7 +27846,7 @@ PlaceOrder.displayName = "PlaceOrder";
|
|
|
27778
27846
|
|
|
27779
27847
|
// src/trading/use-claim-winnings.ts
|
|
27780
27848
|
var import_hooks72 = require("@agg-build/hooks");
|
|
27781
|
-
var
|
|
27849
|
+
var import_react43 = require("react");
|
|
27782
27850
|
var toClaimError = (err) => {
|
|
27783
27851
|
if (err instanceof Error) return err;
|
|
27784
27852
|
return new Error(String(err));
|
|
@@ -27790,17 +27858,17 @@ function useClaimWinnings(options = {}) {
|
|
|
27790
27858
|
const toastCtx = useOptionalToast();
|
|
27791
27859
|
const queryClient = (0, import_hooks72.useQueryClient)();
|
|
27792
27860
|
const redeemMutation = (0, import_hooks72.useRedeem)();
|
|
27793
|
-
const [activeRedeems, setActiveRedeems] = (0,
|
|
27794
|
-
const activeClaimKeysRef = (0,
|
|
27795
|
-
const pendingClaimToastIdsRef = (0,
|
|
27796
|
-
const submittedClaimToastKeysRef = (0,
|
|
27797
|
-
const [submittingClaimKeys, setSubmittingClaimKeys] = (0,
|
|
27798
|
-
const lifecycleInputs = (0,
|
|
27861
|
+
const [activeRedeems, setActiveRedeems] = (0, import_react43.useState)({});
|
|
27862
|
+
const activeClaimKeysRef = (0, import_react43.useRef)(/* @__PURE__ */ new Set());
|
|
27863
|
+
const pendingClaimToastIdsRef = (0, import_react43.useRef)({});
|
|
27864
|
+
const submittedClaimToastKeysRef = (0, import_react43.useRef)(/* @__PURE__ */ new Set());
|
|
27865
|
+
const [submittingClaimKeys, setSubmittingClaimKeys] = (0, import_react43.useState)({});
|
|
27866
|
+
const lifecycleInputs = (0, import_react43.useMemo)(
|
|
27799
27867
|
() => Object.values(activeRedeems),
|
|
27800
27868
|
[activeRedeems]
|
|
27801
27869
|
);
|
|
27802
27870
|
const lifecycleStates = (0, import_hooks72.useRedeemLifecycles)(lifecycleInputs);
|
|
27803
|
-
const internalClaimingIds = (0,
|
|
27871
|
+
const internalClaimingIds = (0, import_react43.useMemo)(() => {
|
|
27804
27872
|
const out = __spreadValues({}, submittingClaimKeys);
|
|
27805
27873
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
27806
27874
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -27809,11 +27877,11 @@ function useClaimWinnings(options = {}) {
|
|
|
27809
27877
|
return out;
|
|
27810
27878
|
}, [activeRedeems, lifecycleStates, submittingClaimKeys]);
|
|
27811
27879
|
const claimingKeys = externalClaimingKeys != null ? externalClaimingKeys : internalClaimingIds;
|
|
27812
|
-
const isClaiming = (0,
|
|
27880
|
+
const isClaiming = (0, import_react43.useCallback)(
|
|
27813
27881
|
(claimKey) => Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || Boolean(internalClaimingIds[claimKey]),
|
|
27814
27882
|
[externalClaimingKeys, internalClaimingIds]
|
|
27815
27883
|
);
|
|
27816
|
-
const invalidateClaimUiState = (0,
|
|
27884
|
+
const invalidateClaimUiState = (0, import_react43.useCallback)(() => {
|
|
27817
27885
|
(0, import_hooks72.invalidateBalanceQueries)(queryClient);
|
|
27818
27886
|
(0, import_hooks72.invalidatePositionQueries)(queryClient);
|
|
27819
27887
|
queryClient.invalidateQueries({
|
|
@@ -27822,7 +27890,7 @@ function useClaimWinnings(options = {}) {
|
|
|
27822
27890
|
});
|
|
27823
27891
|
(0, import_hooks72.invalidateUserActivityQueries)(queryClient);
|
|
27824
27892
|
}, [queryClient]);
|
|
27825
|
-
const claim = (0,
|
|
27893
|
+
const claim = (0, import_react43.useCallback)(
|
|
27826
27894
|
(_0) => __async(null, [_0], function* ({ claimKey, winningOutcomeIds, payload }) {
|
|
27827
27895
|
if (activeClaimKeysRef.current.has(claimKey) || Boolean(externalClaimingKeys == null ? void 0 : externalClaimingKeys[claimKey]) || internalClaimingIds[claimKey]) {
|
|
27828
27896
|
return;
|
|
@@ -27960,8 +28028,8 @@ function useClaimWinnings(options = {}) {
|
|
|
27960
28028
|
toastCtx
|
|
27961
28029
|
]
|
|
27962
28030
|
);
|
|
27963
|
-
const firedTerminalRef = (0,
|
|
27964
|
-
(0,
|
|
28031
|
+
const firedTerminalRef = (0, import_react43.useRef)({});
|
|
28032
|
+
(0, import_react43.useEffect)(() => {
|
|
27965
28033
|
var _a, _b;
|
|
27966
28034
|
for (const [claimKey, active] of Object.entries(activeRedeems)) {
|
|
27967
28035
|
const state = lifecycleStates[active.redeemId];
|
|
@@ -28018,7 +28086,7 @@ function useClaimWinnings(options = {}) {
|
|
|
28018
28086
|
|
|
28019
28087
|
// src/trading/use-resolved-market-claim.ts
|
|
28020
28088
|
var import_hooks73 = require("@agg-build/hooks");
|
|
28021
|
-
var
|
|
28089
|
+
var import_react44 = require("react");
|
|
28022
28090
|
var sharesFormatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: 2 });
|
|
28023
28091
|
var dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
28024
28092
|
month: "short",
|
|
@@ -28035,7 +28103,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
28035
28103
|
var _a;
|
|
28036
28104
|
const { market, enabled = true, executionMode } = options;
|
|
28037
28105
|
const { isAuthenticated } = (0, import_hooks73.useAggAuthState)();
|
|
28038
|
-
const tradingState = (0,
|
|
28106
|
+
const tradingState = (0, import_react44.useMemo)(() => (0, import_hooks73.resolveMarketTradingState)(market), [market]);
|
|
28039
28107
|
const isResolved = tradingState.kind === "resolved";
|
|
28040
28108
|
const marketId = (_a = market == null ? void 0 : market.id) != null ? _a : null;
|
|
28041
28109
|
const shouldFetch = Boolean(enabled && isAuthenticated && isResolved && marketId);
|
|
@@ -28045,7 +28113,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
28045
28113
|
limit: 50
|
|
28046
28114
|
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
28047
28115
|
const claimWinnings = useClaimWinnings();
|
|
28048
|
-
return (0,
|
|
28116
|
+
return (0, import_react44.useMemo)(() => {
|
|
28049
28117
|
var _a2;
|
|
28050
28118
|
if (!shouldFetch || !marketId) return void 0;
|
|
28051
28119
|
const group = positions.find(
|
|
@@ -28142,7 +28210,7 @@ var resolveEventMarketPageStickyState = ({
|
|
|
28142
28210
|
// src/pages/event-market/event-market.shared.tsx
|
|
28143
28211
|
var import_hooks74 = require("@agg-build/hooks");
|
|
28144
28212
|
var Dialog8 = __toESM(require("@radix-ui/react-dialog"));
|
|
28145
|
-
var
|
|
28213
|
+
var import_react45 = require("react");
|
|
28146
28214
|
var import_jsx_runtime179 = require("react/jsx-runtime");
|
|
28147
28215
|
var MOBILE_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1023px)";
|
|
28148
28216
|
var SPORTS_EVENT_MARKET_MEDIA_QUERY = "(max-width: 1279px)";
|
|
@@ -28152,10 +28220,10 @@ var getIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUE
|
|
|
28152
28220
|
return window.matchMedia(mediaQuery).matches;
|
|
28153
28221
|
};
|
|
28154
28222
|
var useIsMobileEventMarketViewport = (mediaQuery = MOBILE_EVENT_MARKET_MEDIA_QUERY) => {
|
|
28155
|
-
const [isMobileViewport, setIsMobileViewport] = (0,
|
|
28223
|
+
const [isMobileViewport, setIsMobileViewport] = (0, import_react45.useState)(
|
|
28156
28224
|
() => getIsMobileEventMarketViewport(mediaQuery)
|
|
28157
28225
|
);
|
|
28158
|
-
(0,
|
|
28226
|
+
(0, import_react45.useEffect)(() => {
|
|
28159
28227
|
if (typeof window === "undefined") return;
|
|
28160
28228
|
if (typeof window.matchMedia !== "function") return;
|
|
28161
28229
|
const mediaQueryList = window.matchMedia(mediaQuery);
|
|
@@ -28380,11 +28448,11 @@ var EventMarketPageLoadingState = ({
|
|
|
28380
28448
|
|
|
28381
28449
|
// src/pages/event-market/sports-event-market-page.tsx
|
|
28382
28450
|
var import_hooks77 = require("@agg-build/hooks");
|
|
28383
|
-
var
|
|
28451
|
+
var import_react48 = require("react");
|
|
28384
28452
|
|
|
28385
28453
|
// src/pages/event-market/sports-markets.tsx
|
|
28386
28454
|
var import_hooks76 = require("@agg-build/hooks");
|
|
28387
|
-
var
|
|
28455
|
+
var import_react47 = require("react");
|
|
28388
28456
|
|
|
28389
28457
|
// src/pages/event-market/sports-event-market.utils.ts
|
|
28390
28458
|
var SPORTS_MARKET_TYPE_KEYS = [
|
|
@@ -29399,7 +29467,7 @@ var mergeSportsSectionMarketsIntoEvent = ({
|
|
|
29399
29467
|
|
|
29400
29468
|
// src/pages/event-market/sports-market-card.tsx
|
|
29401
29469
|
var import_hooks75 = require("@agg-build/hooks");
|
|
29402
|
-
var
|
|
29470
|
+
var import_react46 = require("react");
|
|
29403
29471
|
|
|
29404
29472
|
// src/pages/event-market/sports-line-rail.tsx
|
|
29405
29473
|
var React = __toESM(require("react"));
|
|
@@ -29752,18 +29820,18 @@ var SportsMarketCard = ({
|
|
|
29752
29820
|
formatting: { formatCompactCurrency }
|
|
29753
29821
|
} = (0, import_hooks75.useSdkUiConfig)();
|
|
29754
29822
|
const tradingContext = (0, import_hooks75.useEventTradingContext)();
|
|
29755
|
-
const slide = (0,
|
|
29756
|
-
const [selectedLineIndex, setSelectedLineIndex] = (0,
|
|
29757
|
-
const combinedLegs = (0,
|
|
29823
|
+
const slide = (0, import_react46.useMemo)(() => buildSportsSlideFromGroup(group), [group]);
|
|
29824
|
+
const [selectedLineIndex, setSelectedLineIndex] = (0, import_react46.useState)(slide.defaultStopIndex);
|
|
29825
|
+
const combinedLegs = (0, import_react46.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
|
|
29758
29826
|
const isCombinedLegGroup = combinedLegs != null;
|
|
29759
|
-
const combinedLegMarkets = (0,
|
|
29827
|
+
const combinedLegMarkets = (0, import_react46.useMemo)(
|
|
29760
29828
|
() => {
|
|
29761
29829
|
var _a2;
|
|
29762
29830
|
return (_a2 = combinedLegs == null ? void 0 : combinedLegs.map((leg) => leg.market)) != null ? _a2 : [];
|
|
29763
29831
|
},
|
|
29764
29832
|
[combinedLegs]
|
|
29765
29833
|
);
|
|
29766
|
-
const preferredResolvedLegMarket = (0,
|
|
29834
|
+
const preferredResolvedLegMarket = (0, import_react46.useMemo)(() => {
|
|
29767
29835
|
var _a2, _b2;
|
|
29768
29836
|
const resolvedYesWinnerMarket = (_a2 = combinedLegMarkets.find(
|
|
29769
29837
|
(market) => market.venueMarketOutcomes.some(
|
|
@@ -29775,7 +29843,7 @@ var SportsMarketCard = ({
|
|
|
29775
29843
|
(market) => market.venueMarketOutcomes.some((outcome) => outcome.winner === true)
|
|
29776
29844
|
)) != null ? _b2 : null;
|
|
29777
29845
|
}, [combinedLegMarkets]);
|
|
29778
|
-
(0,
|
|
29846
|
+
(0, import_react46.useEffect)(() => {
|
|
29779
29847
|
if (!slide.hasLadder) return;
|
|
29780
29848
|
const tradingMarketId = tradingContext == null ? void 0 : tradingContext.selectedMarketId;
|
|
29781
29849
|
if (!tradingMarketId) return;
|
|
@@ -29787,8 +29855,8 @@ var SportsMarketCard = ({
|
|
|
29787
29855
|
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_g = activeMarket.venueMarketOutcomes.find(
|
|
29788
29856
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
29789
29857
|
)) != null ? _g : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
29790
|
-
const wasExpandedRef = (0,
|
|
29791
|
-
(0,
|
|
29858
|
+
const wasExpandedRef = (0, import_react46.useRef)(isExpanded);
|
|
29859
|
+
(0, import_react46.useEffect)(() => {
|
|
29792
29860
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
29793
29861
|
wasExpandedRef.current = isExpanded;
|
|
29794
29862
|
if (!justOpened || !activeMarket) return;
|
|
@@ -29801,7 +29869,7 @@ var SportsMarketCard = ({
|
|
|
29801
29869
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
29802
29870
|
}
|
|
29803
29871
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
29804
|
-
const combinedLegHeaderOutcomeItems = (0,
|
|
29872
|
+
const combinedLegHeaderOutcomeItems = (0, import_react46.useMemo)(() => {
|
|
29805
29873
|
if (!combinedLegs) return void 0;
|
|
29806
29874
|
return combinedLegs.flatMap(({ label: label2, market }, index) => {
|
|
29807
29875
|
var _a2;
|
|
@@ -29828,7 +29896,7 @@ var SportsMarketCard = ({
|
|
|
29828
29896
|
];
|
|
29829
29897
|
});
|
|
29830
29898
|
}, [combinedLegs, midpointsResult]);
|
|
29831
|
-
const spreadHeaderOutcomeItems = (0,
|
|
29899
|
+
const spreadHeaderOutcomeItems = (0, import_react46.useMemo)(() => {
|
|
29832
29900
|
if (slide.kind !== "spread" || !activeMarket) return void 0;
|
|
29833
29901
|
return resolveSpreadHeaderOutcomeItems({
|
|
29834
29902
|
market: activeMarket,
|
|
@@ -30071,7 +30139,7 @@ var SportsMarkets = ({
|
|
|
30071
30139
|
isFetchingNextPage: isFetchingNextGameMarketsPage,
|
|
30072
30140
|
fetchNextPage: fetchNextGameMarketsPage
|
|
30073
30141
|
} = gameMarketsQuery;
|
|
30074
|
-
const tabSourceMarkets = (0,
|
|
30142
|
+
const tabSourceMarkets = (0, import_react47.useMemo)(() => {
|
|
30075
30143
|
const seen = /* @__PURE__ */ new Set();
|
|
30076
30144
|
const merged = [];
|
|
30077
30145
|
for (const market of [...event.venueMarkets, ...gameMarkets]) {
|
|
@@ -30081,21 +30149,21 @@ var SportsMarkets = ({
|
|
|
30081
30149
|
}
|
|
30082
30150
|
return merged;
|
|
30083
30151
|
}, [event.venueMarkets, gameMarkets]);
|
|
30084
|
-
const visibleTabs = (0,
|
|
30152
|
+
const visibleTabs = (0, import_react47.useMemo)(
|
|
30085
30153
|
() => resolveVisibleSportsSectionTabs(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
|
|
30086
30154
|
[event, tabSourceMarkets]
|
|
30087
30155
|
);
|
|
30088
30156
|
const shouldRenderTabs = visibleTabs.length > 1 && tabSourceMarkets.length > 1;
|
|
30089
|
-
const [activeTabKey, setActiveTabKey] = (0,
|
|
30090
|
-
const activeTab = (0,
|
|
30157
|
+
const [activeTabKey, setActiveTabKey] = (0, import_react47.useState)((_b = (_a = visibleTabs[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines");
|
|
30158
|
+
const activeTab = (0, import_react47.useMemo)(
|
|
30091
30159
|
() => {
|
|
30092
30160
|
var _a2, _b2;
|
|
30093
30161
|
return (_b2 = (_a2 = visibleTabs.find((tab) => tab.key === activeTabKey)) != null ? _a2 : visibleTabs[0]) != null ? _b2 : { key: "game_lines", kind: "game_lines" };
|
|
30094
30162
|
},
|
|
30095
30163
|
[visibleTabs, activeTabKey]
|
|
30096
30164
|
);
|
|
30097
|
-
const [expandedGroupId, setExpandedGroupId] = (0,
|
|
30098
|
-
const [stableMarketsByTab, setStableMarketsByTab] = (0,
|
|
30165
|
+
const [expandedGroupId, setExpandedGroupId] = (0, import_react47.useState)(null);
|
|
30166
|
+
const [stableMarketsByTab, setStableMarketsByTab] = (0, import_react47.useState)({});
|
|
30099
30167
|
const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
|
|
30100
30168
|
const sectionFilters = resolveSportsSectionFilters(activeTab);
|
|
30101
30169
|
const sectionMarketsQuery = (0, import_hooks76.useVenueMarkets)({
|
|
@@ -30118,7 +30186,7 @@ var SportsMarkets = ({
|
|
|
30118
30186
|
isFetchingNextPage,
|
|
30119
30187
|
fetchNextPage
|
|
30120
30188
|
} = sectionMarketsQuery;
|
|
30121
|
-
const resolvedSectionMarkets = (0,
|
|
30189
|
+
const resolvedSectionMarkets = (0, import_react47.useMemo)(
|
|
30122
30190
|
() => resolveSportsSectionMarkets({
|
|
30123
30191
|
tab: activeTab,
|
|
30124
30192
|
eventMarkets: tabSourceMarkets,
|
|
@@ -30129,29 +30197,29 @@ var SportsMarkets = ({
|
|
|
30129
30197
|
);
|
|
30130
30198
|
const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
|
|
30131
30199
|
const stableSectionMarkets = stableMarketsByTab[activeTabKey];
|
|
30132
|
-
const displayedSectionMarkets = (0,
|
|
30200
|
+
const displayedSectionMarkets = (0, import_react47.useMemo)(
|
|
30133
30201
|
() => stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [],
|
|
30134
30202
|
[stableSectionMarkets, isSectionSettled, resolvedSectionMarkets]
|
|
30135
30203
|
);
|
|
30136
|
-
const periodGroups = (0,
|
|
30204
|
+
const periodGroups = (0, import_react47.useMemo)(
|
|
30137
30205
|
() => groupSportsMarketsByPeriod(displayedSectionMarkets, event.sport),
|
|
30138
30206
|
[displayedSectionMarkets, event.sport]
|
|
30139
30207
|
);
|
|
30140
|
-
const allGroups = (0,
|
|
30208
|
+
const allGroups = (0, import_react47.useMemo)(
|
|
30141
30209
|
() => periodGroups.flatMap((periodGroup) => periodGroup.groups),
|
|
30142
30210
|
[periodGroups]
|
|
30143
30211
|
);
|
|
30144
|
-
(0,
|
|
30212
|
+
(0, import_react47.useEffect)(() => {
|
|
30145
30213
|
if (hasNextPage && !isFetchingNextPage) {
|
|
30146
30214
|
void fetchNextPage();
|
|
30147
30215
|
}
|
|
30148
30216
|
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
|
|
30149
|
-
(0,
|
|
30217
|
+
(0, import_react47.useEffect)(() => {
|
|
30150
30218
|
if (hasNextGameMarketsPage && !isFetchingNextGameMarketsPage) {
|
|
30151
30219
|
void fetchNextGameMarketsPage();
|
|
30152
30220
|
}
|
|
30153
30221
|
}, [hasNextGameMarketsPage, isFetchingNextGameMarketsPage, fetchNextGameMarketsPage]);
|
|
30154
|
-
(0,
|
|
30222
|
+
(0, import_react47.useEffect)(() => {
|
|
30155
30223
|
if (!isSectionSettled) return;
|
|
30156
30224
|
setStableMarketsByTab((currentStableMarketsByTab) => {
|
|
30157
30225
|
var _a2;
|
|
@@ -30167,17 +30235,17 @@ var SportsMarkets = ({
|
|
|
30167
30235
|
});
|
|
30168
30236
|
});
|
|
30169
30237
|
}, [activeTabKey, isSectionSettled, resolvedSectionMarkets]);
|
|
30170
|
-
(0,
|
|
30238
|
+
(0, import_react47.useEffect)(() => {
|
|
30171
30239
|
if (!hasAggKey) return;
|
|
30172
30240
|
onSectionMarketsChange(activeTabKey, displayedSectionMarkets);
|
|
30173
30241
|
}, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
|
|
30174
|
-
(0,
|
|
30242
|
+
(0, import_react47.useEffect)(() => {
|
|
30175
30243
|
var _a2, _b2;
|
|
30176
30244
|
if (visibleTabs.some((tab) => tab.key === activeTabKey)) return;
|
|
30177
30245
|
setActiveTabKey((_b2 = (_a2 = visibleTabs[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
|
|
30178
30246
|
}, [activeTabKey, visibleTabs]);
|
|
30179
|
-
const lastActiveTabRef = (0,
|
|
30180
|
-
(0,
|
|
30247
|
+
const lastActiveTabRef = (0, import_react47.useRef)(null);
|
|
30248
|
+
(0, import_react47.useEffect)(() => {
|
|
30181
30249
|
if (allGroups.length === 0) return;
|
|
30182
30250
|
if (lastActiveTabRef.current !== activeTabKey) {
|
|
30183
30251
|
lastActiveTabRef.current = activeTabKey;
|
|
@@ -30303,15 +30371,15 @@ var SportsEventMarketPage = ({
|
|
|
30303
30371
|
onBeforePrimaryAction,
|
|
30304
30372
|
sharedKyc
|
|
30305
30373
|
}) => {
|
|
30306
|
-
const [sectionMarketsByKey, setSectionMarketsByKey] = (0,
|
|
30307
|
-
const composedEvent = (0,
|
|
30374
|
+
const [sectionMarketsByKey, setSectionMarketsByKey] = (0, import_react48.useState)({});
|
|
30375
|
+
const composedEvent = (0, import_react48.useMemo)(() => {
|
|
30308
30376
|
return mergeSportsSectionMarketsIntoEvent({
|
|
30309
30377
|
event,
|
|
30310
30378
|
sectionMarketsByKey
|
|
30311
30379
|
});
|
|
30312
30380
|
}, [event, sectionMarketsByKey]);
|
|
30313
|
-
const eventTradingState = (0,
|
|
30314
|
-
const hasSportsSections = (0,
|
|
30381
|
+
const eventTradingState = (0, import_react48.useMemo)(() => (0, import_hooks77.resolveEventTradingState)(composedEvent), [composedEvent]);
|
|
30382
|
+
const hasSportsSections = (0, import_react48.useMemo)(
|
|
30315
30383
|
() => resolveVisibleSportsSectionTabs(event).length > 0,
|
|
30316
30384
|
[event]
|
|
30317
30385
|
);
|
|
@@ -30319,7 +30387,7 @@ var SportsEventMarketPage = ({
|
|
|
30319
30387
|
stickyOrderPanel
|
|
30320
30388
|
});
|
|
30321
30389
|
const { executionMode: resolvedExecutionMode } = (0, import_hooks77.useResolvedExecutionMode)(executionMode);
|
|
30322
|
-
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0,
|
|
30390
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react48.useState)(false);
|
|
30323
30391
|
const isMobileViewport = useIsMobileEventMarketViewport(SPORTS_EVENT_MARKET_MEDIA_QUERY);
|
|
30324
30392
|
const tradingContext = (0, import_hooks77.useEventTradingContext)();
|
|
30325
30393
|
const { stateByEventId: sportsLiveStateByEventId } = (0, import_hooks77.useSportsLive)([event.id]);
|
|
@@ -30330,15 +30398,15 @@ var SportsEventMarketPage = ({
|
|
|
30330
30398
|
executionMode: resolvedExecutionMode
|
|
30331
30399
|
});
|
|
30332
30400
|
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
30333
|
-
const setTradeSideRef = (0,
|
|
30401
|
+
const setTradeSideRef = (0, import_react48.useRef)(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
30334
30402
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
30335
|
-
(0,
|
|
30403
|
+
(0, import_react48.useEffect)(() => {
|
|
30336
30404
|
return () => {
|
|
30337
30405
|
var _a;
|
|
30338
30406
|
(_a = setTradeSideRef.current) == null ? void 0 : _a.call(setTradeSideRef, import_hooks77.TradeSide.Buy);
|
|
30339
30407
|
};
|
|
30340
30408
|
}, []);
|
|
30341
|
-
const handleSectionMarketsChange = (0,
|
|
30409
|
+
const handleSectionMarketsChange = (0, import_react48.useCallback)(
|
|
30342
30410
|
(tabKey, markets) => {
|
|
30343
30411
|
setSectionMarketsByKey((currentSectionMarketsByKey) => {
|
|
30344
30412
|
var _a;
|
|
@@ -30511,8 +30579,8 @@ var formatRecurringCountdown = (remainingMs) => {
|
|
|
30511
30579
|
return hours > 0 ? `${hours}:${minuteSecondLabel}` : minuteSecondLabel;
|
|
30512
30580
|
};
|
|
30513
30581
|
var useCurrentTimestamp = (enabled) => {
|
|
30514
|
-
const [currentTimestamp, setCurrentTimestamp] = (0,
|
|
30515
|
-
(0,
|
|
30582
|
+
const [currentTimestamp, setCurrentTimestamp] = (0, import_react49.useState)(null);
|
|
30583
|
+
(0, import_react49.useEffect)(() => {
|
|
30516
30584
|
if (!enabled) {
|
|
30517
30585
|
setCurrentTimestamp(null);
|
|
30518
30586
|
return;
|
|
@@ -30546,18 +30614,18 @@ var EventMarketPageContent = ({
|
|
|
30546
30614
|
onRecurringMarketNavigate
|
|
30547
30615
|
}) => {
|
|
30548
30616
|
var _a;
|
|
30549
|
-
const eventTradingState = (0,
|
|
30617
|
+
const eventTradingState = (0, import_react49.useMemo)(() => (0, import_hooks78.resolveEventTradingState)(event), [event]);
|
|
30550
30618
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|
|
30551
30619
|
stickyOrderPanel
|
|
30552
30620
|
});
|
|
30553
30621
|
const { executionMode: resolvedExecutionMode } = (0, import_hooks78.useResolvedExecutionMode)(executionMode);
|
|
30554
|
-
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0,
|
|
30622
|
+
const [isMobileTradeOpen, setIsMobileTradeOpen] = (0, import_react49.useState)(false);
|
|
30555
30623
|
const isMobileViewport = useIsMobileEventMarketViewport();
|
|
30556
30624
|
const tradingContext = (0, import_hooks78.useEventTradingContext)();
|
|
30557
30625
|
const labels = (0, import_hooks78.useLabels)();
|
|
30558
30626
|
const recurringQuery = (0, import_hooks78.useRecurringCryptoMarkets)({ event });
|
|
30559
30627
|
const currentTimestamp = useCurrentTimestamp(recurringQuery.isRecurringCryptoMarket);
|
|
30560
|
-
const recurringTimeline = (0,
|
|
30628
|
+
const recurringTimeline = (0, import_react49.useMemo)(
|
|
30561
30629
|
() => currentTimestamp == null ? null : (0, import_hooks78.resolveRecurringCryptoTimeline)(recurringQuery.windows, event, currentTimestamp),
|
|
30562
30630
|
[currentTimestamp, event, recurringQuery.windows]
|
|
30563
30631
|
);
|
|
@@ -30565,11 +30633,11 @@ var EventMarketPageContent = ({
|
|
|
30565
30633
|
const recurringViewedEndTimestamp = (recurringTimeline == null ? void 0 : recurringTimeline.viewed) ? Date.parse(recurringTimeline.viewed.windowEnd) : Number.NaN;
|
|
30566
30634
|
const hasViewedMarketEnded = currentTimestamp != null && Number.isFinite(recurringViewedEndTimestamp) && currentTimestamp >= recurringViewedEndTimestamp;
|
|
30567
30635
|
const isRecurringResolvingMarket = recurringQuery.isRecurringCryptoMarket && eventTradingState.kind === "closed";
|
|
30568
|
-
const lastBoundaryRefetchRef = (0,
|
|
30569
|
-
(0,
|
|
30636
|
+
const lastBoundaryRefetchRef = (0, import_react49.useRef)(null);
|
|
30637
|
+
(0, import_react49.useEffect)(() => {
|
|
30570
30638
|
lastBoundaryRefetchRef.current = null;
|
|
30571
30639
|
}, [event.id]);
|
|
30572
|
-
(0,
|
|
30640
|
+
(0, import_react49.useEffect)(() => {
|
|
30573
30641
|
if (!isRecurringCryptoMarket || !hasViewedMarketEnded || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return;
|
|
30574
30642
|
const refetchKey = `${event.id}:${recurringTimeline.viewed.windowEnd}`;
|
|
30575
30643
|
if (lastBoundaryRefetchRef.current === refetchKey) return;
|
|
@@ -30582,20 +30650,20 @@ var EventMarketPageContent = ({
|
|
|
30582
30650
|
recurringQuery,
|
|
30583
30651
|
recurringTimeline == null ? void 0 : recurringTimeline.viewed
|
|
30584
30652
|
]);
|
|
30585
|
-
const handleRecurringMarketSelect = (0,
|
|
30653
|
+
const handleRecurringMarketSelect = (0, import_react49.useCallback)(
|
|
30586
30654
|
(eventId) => {
|
|
30587
30655
|
if (!onRecurringMarketNavigate || eventId === event.id) return;
|
|
30588
30656
|
onRecurringMarketNavigate(eventId, { replace: false });
|
|
30589
30657
|
},
|
|
30590
30658
|
[event.id, onRecurringMarketNavigate]
|
|
30591
30659
|
);
|
|
30592
|
-
const handleGoToLive = (0,
|
|
30660
|
+
const handleGoToLive = (0, import_react49.useCallback)(() => {
|
|
30593
30661
|
var _a2;
|
|
30594
30662
|
const liveEventId = (_a2 = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a2.venueEventId;
|
|
30595
30663
|
if (!onRecurringMarketNavigate || !liveEventId || liveEventId === event.id) return;
|
|
30596
30664
|
onRecurringMarketNavigate(liveEventId, { replace: false });
|
|
30597
30665
|
}, [event.id, onRecurringMarketNavigate, (_a = recurringTimeline == null ? void 0 : recurringTimeline.live) == null ? void 0 : _a.venueEventId]);
|
|
30598
|
-
const recurringMarketsPresentation = (0,
|
|
30666
|
+
const recurringMarketsPresentation = (0, import_react49.useMemo)(() => {
|
|
30599
30667
|
var _a2, _b;
|
|
30600
30668
|
if (!isRecurringCryptoMarket || !(recurringTimeline == null ? void 0 : recurringTimeline.viewed)) return void 0;
|
|
30601
30669
|
const toOption = (market) => {
|
|
@@ -30634,7 +30702,7 @@ var EventMarketPageContent = ({
|
|
|
30634
30702
|
recurringTimeline,
|
|
30635
30703
|
recurringViewedEndTimestamp
|
|
30636
30704
|
]);
|
|
30637
|
-
const eventDetailVenueMarkets = (0,
|
|
30705
|
+
const eventDetailVenueMarkets = (0, import_react49.useMemo)(
|
|
30638
30706
|
() => normalizeVenueMarketCluster(event.venueMarkets),
|
|
30639
30707
|
[event.venueMarkets]
|
|
30640
30708
|
);
|
|
@@ -30647,9 +30715,9 @@ var EventMarketPageContent = ({
|
|
|
30647
30715
|
executionMode: resolvedExecutionMode
|
|
30648
30716
|
});
|
|
30649
30717
|
const effectiveResolvedClaim = resolvedClaim != null ? resolvedClaim : internalResolvedClaim;
|
|
30650
|
-
const setTradeSideRef = (0,
|
|
30718
|
+
const setTradeSideRef = (0, import_react49.useRef)(tradingContext == null ? void 0 : tradingContext.setTradeSide);
|
|
30651
30719
|
setTradeSideRef.current = tradingContext == null ? void 0 : tradingContext.setTradeSide;
|
|
30652
|
-
(0,
|
|
30720
|
+
(0, import_react49.useEffect)(() => {
|
|
30653
30721
|
return () => {
|
|
30654
30722
|
var _a2;
|
|
30655
30723
|
(_a2 = setTradeSideRef.current) == null ? void 0 : _a2.call(setTradeSideRef, import_hooks78.TradeSide.Buy);
|
|
@@ -30990,15 +31058,15 @@ var buildEventDiscoveryUrl = ({
|
|
|
30990
31058
|
};
|
|
30991
31059
|
|
|
30992
31060
|
// src/pages/home/use-scroll-restoration.ts
|
|
30993
|
-
var
|
|
31061
|
+
var import_react50 = require("react");
|
|
30994
31062
|
function useScrollRestoration({
|
|
30995
31063
|
enabled,
|
|
30996
31064
|
scrollY,
|
|
30997
31065
|
isReady
|
|
30998
31066
|
}) {
|
|
30999
|
-
const restoredRef = (0,
|
|
31000
|
-
const [isRestoring, setIsRestoring] = (0,
|
|
31001
|
-
(0,
|
|
31067
|
+
const restoredRef = (0, import_react50.useRef)(false);
|
|
31068
|
+
const [isRestoring, setIsRestoring] = (0, import_react50.useState)(enabled && scrollY > 0);
|
|
31069
|
+
(0, import_react50.useLayoutEffect)(() => {
|
|
31002
31070
|
if (!enabled || restoredRef.current) return;
|
|
31003
31071
|
if (!isReady) return;
|
|
31004
31072
|
restoredRef.current = true;
|
|
@@ -31011,15 +31079,15 @@ function useScrollRestoration({
|
|
|
31011
31079
|
}
|
|
31012
31080
|
|
|
31013
31081
|
// src/pages/home/use-home-page-modals.ts
|
|
31014
|
-
var
|
|
31082
|
+
var import_react51 = require("react");
|
|
31015
31083
|
var useHomePageModals = () => {
|
|
31016
|
-
const [profileOpen, setProfileOpen] = (0,
|
|
31017
|
-
const [depositOpen, setDepositOpen] = (0,
|
|
31018
|
-
const [withdrawOpen, setWithdrawOpen] = (0,
|
|
31019
|
-
const onProfileClick = (0,
|
|
31020
|
-
const onDepositClick = (0,
|
|
31021
|
-
const onWithdrawClick = (0,
|
|
31022
|
-
(0,
|
|
31084
|
+
const [profileOpen, setProfileOpen] = (0, import_react51.useState)(false);
|
|
31085
|
+
const [depositOpen, setDepositOpen] = (0, import_react51.useState)(false);
|
|
31086
|
+
const [withdrawOpen, setWithdrawOpen] = (0, import_react51.useState)(false);
|
|
31087
|
+
const onProfileClick = (0, import_react51.useCallback)(() => setProfileOpen(true), []);
|
|
31088
|
+
const onDepositClick = (0, import_react51.useCallback)(() => setDepositOpen(true), []);
|
|
31089
|
+
const onWithdrawClick = (0, import_react51.useCallback)(() => setWithdrawOpen(true), []);
|
|
31090
|
+
(0, import_react51.useEffect)(() => {
|
|
31023
31091
|
if (typeof window === "undefined") return;
|
|
31024
31092
|
window.addEventListener(DEPOSIT_MODAL_OPEN_EVENT, onDepositClick);
|
|
31025
31093
|
window.addEventListener(WITHDRAW_MODAL_OPEN_EVENT, onWithdrawClick);
|
|
@@ -31070,17 +31138,17 @@ var HomeSearchResults = ({
|
|
|
31070
31138
|
const labels = (0, import_hooks79.useLabels)();
|
|
31071
31139
|
const { search: searchConfig } = (0, import_hooks79.useSdkUiConfig)();
|
|
31072
31140
|
const { disabledVenues } = (0, import_hooks79.useAppConfig)();
|
|
31073
|
-
const [activeVenueTabValue, setActiveVenueTabValue] = (0,
|
|
31141
|
+
const [activeVenueTabValue, setActiveVenueTabValue] = (0, import_react52.useState)("all");
|
|
31074
31142
|
const eventListTabs = useEventListTabs();
|
|
31075
31143
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(eventListTabs);
|
|
31076
|
-
const visibleVenues = (0,
|
|
31077
|
-
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks79.getVisibleVenueIdsByConfig)(
|
|
31144
|
+
const visibleVenues = (0, import_react52.useMemo)(
|
|
31145
|
+
() => disabledVenues.length === 0 ? void 0 : (0, import_hooks79.getVisibleVenueIdsByConfig)(import_sdk25.VENUES, disabledVenues),
|
|
31078
31146
|
[disabledVenues]
|
|
31079
31147
|
);
|
|
31080
|
-
const activeVenueTab = (0,
|
|
31148
|
+
const activeVenueTab = (0, import_react52.useMemo)(() => {
|
|
31081
31149
|
return eventListTabs.find((tab) => tab.value === activeVenueTabValue);
|
|
31082
31150
|
}, [activeVenueTabValue, eventListTabs]);
|
|
31083
|
-
const activeCategoryTab = (0,
|
|
31151
|
+
const activeCategoryTab = (0, import_react52.useMemo)(() => {
|
|
31084
31152
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
31085
31153
|
}, [activeTabValue, resolvedTabs]);
|
|
31086
31154
|
const activeVenues = resolveTabVenus(activeVenueTab, visibleVenues);
|
|
@@ -31104,28 +31172,28 @@ var HomeSearchResults = ({
|
|
|
31104
31172
|
// so debounced keystrokes don't pay reranker latency.
|
|
31105
31173
|
deep: true
|
|
31106
31174
|
});
|
|
31107
|
-
const openEvents = (0,
|
|
31175
|
+
const openEvents = (0, import_react52.useMemo)(() => {
|
|
31108
31176
|
let filtered = filterOpenEvents(searchResults);
|
|
31109
31177
|
if (activeVenues == null ? void 0 : activeVenues.length) {
|
|
31110
31178
|
filtered = filtered.filter((e) => activeVenues.includes(e.venue));
|
|
31111
31179
|
}
|
|
31112
31180
|
return filtered;
|
|
31113
31181
|
}, [searchResults, activeVenues]);
|
|
31114
|
-
const visibleVenueMarkets = (0,
|
|
31182
|
+
const visibleVenueMarkets = (0, import_react52.useMemo)(() => {
|
|
31115
31183
|
return openEvents.flatMap((event) => {
|
|
31116
31184
|
var _a;
|
|
31117
31185
|
return (_a = event.venueMarkets) != null ? _a : [];
|
|
31118
31186
|
});
|
|
31119
31187
|
}, [openEvents]);
|
|
31120
|
-
const visibleMidpointVenueMarketIds = (0,
|
|
31188
|
+
const visibleMidpointVenueMarketIds = (0, import_react52.useMemo)(() => {
|
|
31121
31189
|
return collectVisibleVenueMarketIds(visibleVenueMarkets);
|
|
31122
31190
|
}, [visibleVenueMarkets]);
|
|
31123
31191
|
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = (0, import_hooks79.useVenueMarketMidpoints)({
|
|
31124
31192
|
venueMarketIds: visibleMidpointVenueMarketIds,
|
|
31125
31193
|
enabled: visibleMidpointVenueMarketIds.length > 0
|
|
31126
31194
|
});
|
|
31127
|
-
const loadMoreRef = (0,
|
|
31128
|
-
(0,
|
|
31195
|
+
const loadMoreRef = (0, import_react52.useRef)(null);
|
|
31196
|
+
(0, import_react52.useEffect)(() => {
|
|
31129
31197
|
if (!hasNextPage) return;
|
|
31130
31198
|
const target = loadMoreRef.current;
|
|
31131
31199
|
if (!target) return;
|
|
@@ -31284,9 +31352,9 @@ var HomePage = ({
|
|
|
31284
31352
|
const { isLoading: isAppConfigLoading } = (0, import_hooks79.useAppConfig)();
|
|
31285
31353
|
const primaryEventListTabs = useEventListTabs();
|
|
31286
31354
|
const { capture, consume } = (0, import_hooks79.useEventListState)();
|
|
31287
|
-
const [snapshot] = (0,
|
|
31288
|
-
const eventListStateRef = (0,
|
|
31289
|
-
const handleSelectEvent = (0,
|
|
31355
|
+
const [snapshot] = (0, import_react52.useState)(() => consume());
|
|
31356
|
+
const eventListStateRef = (0, import_react52.useRef)(null);
|
|
31357
|
+
const handleSelectEvent = (0, import_react52.useCallback)(
|
|
31290
31358
|
(event) => {
|
|
31291
31359
|
var _a2, _b2, _c2, _d2;
|
|
31292
31360
|
capture({
|
|
@@ -31305,14 +31373,14 @@ var HomePage = ({
|
|
|
31305
31373
|
);
|
|
31306
31374
|
const hasCustomTabs = !!tabs && tabs.length > 0;
|
|
31307
31375
|
const normalizedSearchValue = searchValue.trim();
|
|
31308
|
-
const [stickySelectedEvent, setStickySelectedEvent] = (0,
|
|
31376
|
+
const [stickySelectedEvent, setStickySelectedEvent] = (0, import_react52.useState)(
|
|
31309
31377
|
selectedEvent
|
|
31310
31378
|
);
|
|
31311
|
-
const [debouncedSearchValue, setDebouncedSearchValue] = (0,
|
|
31379
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = (0, import_react52.useState)(() => {
|
|
31312
31380
|
return normalizedSearchValue.length >= MIN_SEARCH_LENGTH2 ? normalizedSearchValue : "";
|
|
31313
31381
|
});
|
|
31314
|
-
const [isMobileSearchViewport, setIsMobileSearchViewport] = (0,
|
|
31315
|
-
(0,
|
|
31382
|
+
const [isMobileSearchViewport, setIsMobileSearchViewport] = (0, import_react52.useState)(false);
|
|
31383
|
+
(0, import_react52.useEffect)(() => {
|
|
31316
31384
|
if (typeof window === "undefined") return;
|
|
31317
31385
|
const mediaQueryList = window.matchMedia(MOBILE_HOME_SEARCH_MEDIA_QUERY);
|
|
31318
31386
|
const handleMediaQueryChange = (event) => {
|
|
@@ -31330,7 +31398,7 @@ var HomePage = ({
|
|
|
31330
31398
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
31331
31399
|
};
|
|
31332
31400
|
}, []);
|
|
31333
|
-
(0,
|
|
31401
|
+
(0, import_react52.useEffect)(() => {
|
|
31334
31402
|
if (normalizedSearchValue.length < MIN_SEARCH_LENGTH2) {
|
|
31335
31403
|
setDebouncedSearchValue("");
|
|
31336
31404
|
return;
|
|
@@ -31342,7 +31410,7 @@ var HomePage = ({
|
|
|
31342
31410
|
window.clearTimeout(timeoutId);
|
|
31343
31411
|
};
|
|
31344
31412
|
}, [normalizedSearchValue]);
|
|
31345
|
-
(0,
|
|
31413
|
+
(0, import_react52.useEffect)(() => {
|
|
31346
31414
|
if (selectedEvent) {
|
|
31347
31415
|
setStickySelectedEvent(selectedEvent);
|
|
31348
31416
|
return;
|
|
@@ -31357,30 +31425,30 @@ var HomePage = ({
|
|
|
31357
31425
|
limit: categoriesLimit,
|
|
31358
31426
|
enabled: !hasCustomTabs
|
|
31359
31427
|
});
|
|
31360
|
-
const categoryTabs = (0,
|
|
31428
|
+
const categoryTabs = (0, import_react52.useMemo)(() => {
|
|
31361
31429
|
return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
|
|
31362
31430
|
}, [categories, resolvedAllCategoryTabLabel]);
|
|
31363
|
-
const resolvedTabs = (0,
|
|
31431
|
+
const resolvedTabs = (0, import_react52.useMemo)(() => {
|
|
31364
31432
|
if (hasCustomTabs && tabs) return tabs;
|
|
31365
31433
|
return categoryTabs;
|
|
31366
31434
|
}, [categoryTabs, hasCustomTabs, tabs]);
|
|
31367
|
-
const availableCategoryValues = (0,
|
|
31435
|
+
const availableCategoryValues = (0, import_react52.useMemo)(
|
|
31368
31436
|
() => resolvedTabs.filter((tab) => !tab.disabled).map((tab) => tab.value),
|
|
31369
31437
|
[resolvedTabs]
|
|
31370
31438
|
);
|
|
31371
31439
|
const resolvedDefaultCategory = resolveInitialTabValue(resolvedTabs, defaultActiveTab);
|
|
31372
31440
|
const defaultCategory = availableCategoryValues.includes(resolvedDefaultCategory) ? resolvedDefaultCategory : (_a = availableCategoryValues[0]) != null ? _a : resolvedDefaultCategory;
|
|
31373
|
-
const availableVenueTabs = (0,
|
|
31441
|
+
const availableVenueTabs = (0, import_react52.useMemo)(
|
|
31374
31442
|
() => primaryEventListTabs.filter((tab) => !tab.disabled && !tab.isComingSoon),
|
|
31375
31443
|
[primaryEventListTabs]
|
|
31376
31444
|
);
|
|
31377
|
-
const availableVenueValues = (0,
|
|
31445
|
+
const availableVenueValues = (0, import_react52.useMemo)(
|
|
31378
31446
|
() => availableVenueTabs.map((tab) => tab.value),
|
|
31379
31447
|
[availableVenueTabs]
|
|
31380
31448
|
);
|
|
31381
31449
|
const defaultVenue = (_c = (_b = availableVenueTabs[0]) == null ? void 0 : _b.value) != null ? _c : "matched";
|
|
31382
31450
|
const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
|
|
31383
|
-
const [discoveryFilterState, setDiscoveryFilterState] = (0,
|
|
31451
|
+
const [discoveryFilterState, setDiscoveryFilterState] = (0, import_react52.useState)(
|
|
31384
31452
|
() => {
|
|
31385
31453
|
var _a2, _b2;
|
|
31386
31454
|
return {
|
|
@@ -31391,12 +31459,12 @@ var HomePage = ({
|
|
|
31391
31459
|
};
|
|
31392
31460
|
}
|
|
31393
31461
|
);
|
|
31394
|
-
const discoveryFilterStateRef = (0,
|
|
31462
|
+
const discoveryFilterStateRef = (0, import_react52.useRef)(discoveryFilterState);
|
|
31395
31463
|
discoveryFilterStateRef.current = discoveryFilterState;
|
|
31396
|
-
const [isUrlStateReady, setIsUrlStateReady] = (0,
|
|
31397
|
-
const hasInitializedUrlStateRef = (0,
|
|
31464
|
+
const [isUrlStateReady, setIsUrlStateReady] = (0, import_react52.useState)(!enableEventDiscoveryUrlPersistence);
|
|
31465
|
+
const hasInitializedUrlStateRef = (0, import_react52.useRef)(false);
|
|
31398
31466
|
const activeTabValue = discoveryFilterState.category;
|
|
31399
|
-
const resolveCurrentUrlState = (0,
|
|
31467
|
+
const resolveCurrentUrlState = (0, import_react52.useCallback)(() => {
|
|
31400
31468
|
if (typeof window === "undefined") return null;
|
|
31401
31469
|
const parsedState = readEventDiscoveryUrlState(new URL(window.location.href).searchParams);
|
|
31402
31470
|
const resolvedState = resolveEventDiscoveryUrlState({
|
|
@@ -31420,7 +31488,7 @@ var HomePage = ({
|
|
|
31420
31488
|
shouldCanonicalize: resolvedState.shouldCanonicalize
|
|
31421
31489
|
};
|
|
31422
31490
|
}, [availableCategoryValues, availableVenueValues, defaultCategory, defaultVenue]);
|
|
31423
|
-
const writeFilterStateToHistory = (0,
|
|
31491
|
+
const writeFilterStateToHistory = (0, import_react52.useCallback)(
|
|
31424
31492
|
(state, historyMode) => {
|
|
31425
31493
|
if (!enableEventDiscoveryUrlPersistence || typeof window === "undefined") return;
|
|
31426
31494
|
const currentUrl = new URL(window.location.href);
|
|
@@ -31442,7 +31510,7 @@ var HomePage = ({
|
|
|
31442
31510
|
},
|
|
31443
31511
|
[defaultCategory, defaultVenue, enableEventDiscoveryUrlPersistence]
|
|
31444
31512
|
);
|
|
31445
|
-
const commitDiscoveryFilterState = (0,
|
|
31513
|
+
const commitDiscoveryFilterState = (0, import_react52.useCallback)(
|
|
31446
31514
|
(state, historyMode) => {
|
|
31447
31515
|
discoveryFilterStateRef.current = state;
|
|
31448
31516
|
setDiscoveryFilterState(state);
|
|
@@ -31450,7 +31518,7 @@ var HomePage = ({
|
|
|
31450
31518
|
},
|
|
31451
31519
|
[isUrlStateReady, writeFilterStateToHistory]
|
|
31452
31520
|
);
|
|
31453
|
-
(0,
|
|
31521
|
+
(0, import_react52.useEffect)(() => {
|
|
31454
31522
|
if (!enableEventDiscoveryUrlPersistence) {
|
|
31455
31523
|
hasInitializedUrlStateRef.current = false;
|
|
31456
31524
|
setIsUrlStateReady(true);
|
|
@@ -31489,7 +31557,7 @@ var HomePage = ({
|
|
|
31489
31557
|
isCategoriesLoading,
|
|
31490
31558
|
resolveCurrentUrlState
|
|
31491
31559
|
]);
|
|
31492
|
-
(0,
|
|
31560
|
+
(0, import_react52.useEffect)(() => {
|
|
31493
31561
|
if (!enableEventDiscoveryUrlPersistence || !isUrlStateReady) return;
|
|
31494
31562
|
const handlePopState = () => {
|
|
31495
31563
|
const resolvedUrlState = resolveCurrentUrlState();
|
|
@@ -31510,9 +31578,9 @@ var HomePage = ({
|
|
|
31510
31578
|
resolveCurrentUrlState,
|
|
31511
31579
|
writeFilterStateToHistory
|
|
31512
31580
|
]);
|
|
31513
|
-
const activeTabValueRef = (0,
|
|
31581
|
+
const activeTabValueRef = (0, import_react52.useRef)(activeTabValue);
|
|
31514
31582
|
activeTabValueRef.current = activeTabValue;
|
|
31515
|
-
(0,
|
|
31583
|
+
(0, import_react52.useEffect)(() => {
|
|
31516
31584
|
if (enableEventDiscoveryUrlPersistence && !isUrlStateReady) return;
|
|
31517
31585
|
const currentState = discoveryFilterStateRef.current;
|
|
31518
31586
|
const categoryIsAvailable = availableCategoryValues.includes(currentState.category);
|
|
@@ -31538,7 +31606,7 @@ var HomePage = ({
|
|
|
31538
31606
|
enableEventDiscoveryUrlPersistence,
|
|
31539
31607
|
isUrlStateReady
|
|
31540
31608
|
]);
|
|
31541
|
-
const tabsItems = (0,
|
|
31609
|
+
const tabsItems = (0, import_react52.useMemo)(() => {
|
|
31542
31610
|
return resolvedTabs.map((tab) => {
|
|
31543
31611
|
const isActive = tab.value === activeTabValue;
|
|
31544
31612
|
return {
|
|
@@ -31558,10 +31626,10 @@ var HomePage = ({
|
|
|
31558
31626
|
};
|
|
31559
31627
|
});
|
|
31560
31628
|
}, [activeTabValue, resolvedTabs]);
|
|
31561
|
-
const activeTab = (0,
|
|
31629
|
+
const activeTab = (0, import_react52.useMemo)(() => {
|
|
31562
31630
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
31563
31631
|
}, [activeTabValue, resolvedTabs]);
|
|
31564
|
-
const resolvedSectionItems = (0,
|
|
31632
|
+
const resolvedSectionItems = (0, import_react52.useMemo)(() => {
|
|
31565
31633
|
var _a2, _b2, _c2;
|
|
31566
31634
|
if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
|
|
31567
31635
|
return resolvedEventSectionItems;
|
|
@@ -31756,13 +31824,13 @@ HomePage.displayName = "HomePage";
|
|
|
31756
31824
|
|
|
31757
31825
|
// src/pages/user-profile/index.tsx
|
|
31758
31826
|
var import_hooks87 = require("@agg-build/hooks");
|
|
31759
|
-
var
|
|
31827
|
+
var import_sdk29 = require("@agg-build/sdk");
|
|
31760
31828
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
31761
|
-
var
|
|
31829
|
+
var import_react55 = require("react");
|
|
31762
31830
|
|
|
31763
31831
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
31764
31832
|
var import_hooks80 = require("@agg-build/hooks");
|
|
31765
|
-
var
|
|
31833
|
+
var import_sdk26 = require("@agg-build/sdk");
|
|
31766
31834
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
31767
31835
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
31768
31836
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -31781,8 +31849,8 @@ var CHAIN_ID_TO_ICON_URL = {
|
|
|
31781
31849
|
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
31782
31850
|
"792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
|
|
31783
31851
|
};
|
|
31784
|
-
var venueLogosForChain = (chainId) =>
|
|
31785
|
-
var isVenueBalanceChain = (chainId) => Object.values(
|
|
31852
|
+
var venueLogosForChain = (chainId) => import_sdk26.ACTIVE_VENUES.filter((venue) => import_sdk26.VENUE_CHAIN_IDS[venue] === Number(chainId));
|
|
31853
|
+
var isVenueBalanceChain = (chainId) => Object.values(import_sdk26.VENUE_CHAIN_IDS).includes(Number(chainId));
|
|
31786
31854
|
var isPaperChain = (row) => {
|
|
31787
31855
|
return row.key === "0" || row.label.trim().toLowerCase() === "paper";
|
|
31788
31856
|
};
|
|
@@ -31806,6 +31874,7 @@ var AvailableBalanceCard = ({
|
|
|
31806
31874
|
label: label2,
|
|
31807
31875
|
valueLabel,
|
|
31808
31876
|
reservedValueLabel,
|
|
31877
|
+
kalshiValueLabel,
|
|
31809
31878
|
chains,
|
|
31810
31879
|
isLoading = false,
|
|
31811
31880
|
className,
|
|
@@ -31958,6 +32027,13 @@ var AvailableBalanceCard = ({
|
|
|
31958
32027
|
}
|
|
31959
32028
|
)
|
|
31960
32029
|
] }),
|
|
32030
|
+
kalshiValueLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)("div", { className: "agg-balance-kalshi flex items-center justify-between gap-3", children: [
|
|
32031
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)("div", { className: "font-agg-sans text-agg-base leading-6 font-agg-bold text-agg-foreground", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("div", { role: "status", "aria-label": "Loading Kalshi balance", children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(SkeletonBlock, { className: "h-6 w-16 rounded-agg-sm" }) }) : kalshiValueLabel }),
|
|
32032
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsxs)("span", { className: "flex h-5 shrink-0 items-center gap-1 rounded-[4px] bg-agg-secondary-hover px-1.5", children: [
|
|
32033
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)(VenueLogo, { venue: "kalshi", size: "small", className: "size-3" }),
|
|
32034
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)("span", { className: "font-agg-sans text-agg-xs leading-agg-4 font-agg-normal text-agg-muted-foreground", children: labels.venues.kalshi })
|
|
32035
|
+
] })
|
|
32036
|
+
] }) : null,
|
|
31961
32037
|
!isLoading && reservedValueLabel ? /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("p", { className: "font-agg-sans text-agg-xs leading-agg-4 text-agg-muted-foreground", children: balanceLabels.reservedForOpenOrders(reservedValueLabel) }) : null
|
|
31962
32038
|
]
|
|
31963
32039
|
}
|
|
@@ -31967,20 +32043,20 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
|
31967
32043
|
|
|
31968
32044
|
// src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
|
|
31969
32045
|
var import_hooks81 = require("@agg-build/hooks");
|
|
31970
|
-
var
|
|
32046
|
+
var import_sdk27 = require("@agg-build/sdk");
|
|
31971
32047
|
var import_jsx_runtime187 = require("react/jsx-runtime");
|
|
31972
32048
|
var CLAIM_VENUE_LABELS = {
|
|
31973
|
-
[
|
|
31974
|
-
[
|
|
31975
|
-
[
|
|
31976
|
-
[
|
|
31977
|
-
[
|
|
31978
|
-
[
|
|
31979
|
-
[
|
|
31980
|
-
[
|
|
31981
|
-
[
|
|
31982
|
-
[
|
|
31983
|
-
[
|
|
32049
|
+
[import_sdk27.Venue.kalshi]: "Kalshi",
|
|
32050
|
+
[import_sdk27.Venue.polymarket]: "Polymarket",
|
|
32051
|
+
[import_sdk27.Venue.limitless]: "Limitless",
|
|
32052
|
+
[import_sdk27.Venue.opinion]: "Opinion",
|
|
32053
|
+
[import_sdk27.Venue.predict]: "Predict",
|
|
32054
|
+
[import_sdk27.Venue.pred]: "PRED",
|
|
32055
|
+
[import_sdk27.Venue.probable]: "Probable",
|
|
32056
|
+
[import_sdk27.Venue.myriad]: "Myriad",
|
|
32057
|
+
[import_sdk27.Venue.hyperliquid]: "Hyperliquid",
|
|
32058
|
+
[import_sdk27.Venue.novig]: "Novig",
|
|
32059
|
+
[import_sdk27.Venue.prophetx]: "ProphetX"
|
|
31984
32060
|
};
|
|
31985
32061
|
var ClaimActivityBreakdownModal = ({
|
|
31986
32062
|
activity,
|
|
@@ -32098,9 +32174,9 @@ var ClaimActivityBreakdownModal = ({
|
|
|
32098
32174
|
|
|
32099
32175
|
// src/pages/user-profile/components/manage-balances-modal.tsx
|
|
32100
32176
|
var import_hooks82 = require("@agg-build/hooks");
|
|
32101
|
-
var
|
|
32177
|
+
var import_sdk28 = require("@agg-build/sdk");
|
|
32102
32178
|
var Dialog9 = __toESM(require("@radix-ui/react-dialog"));
|
|
32103
|
-
var
|
|
32179
|
+
var import_react53 = require("react");
|
|
32104
32180
|
var import_zod3 = require("zod");
|
|
32105
32181
|
var import_jsx_runtime188 = require("react/jsx-runtime");
|
|
32106
32182
|
var USDC_DECIMALS = 6;
|
|
@@ -32116,17 +32192,17 @@ var NETWORK_ORDER = {
|
|
|
32116
32192
|
1: 6
|
|
32117
32193
|
};
|
|
32118
32194
|
var VENUE_LABELS = {
|
|
32119
|
-
[
|
|
32120
|
-
[
|
|
32121
|
-
[
|
|
32122
|
-
[
|
|
32123
|
-
[
|
|
32124
|
-
[
|
|
32125
|
-
[
|
|
32126
|
-
[
|
|
32127
|
-
[
|
|
32128
|
-
[
|
|
32129
|
-
[
|
|
32195
|
+
[import_sdk28.Venue.kalshi]: "Kalshi",
|
|
32196
|
+
[import_sdk28.Venue.limitless]: "Limitless",
|
|
32197
|
+
[import_sdk28.Venue.opinion]: "Opinion",
|
|
32198
|
+
[import_sdk28.Venue.polymarket]: "Polymarket",
|
|
32199
|
+
[import_sdk28.Venue.predict]: "Predict",
|
|
32200
|
+
[import_sdk28.Venue.pred]: "PRED",
|
|
32201
|
+
[import_sdk28.Venue.probable]: "Probable",
|
|
32202
|
+
[import_sdk28.Venue.myriad]: "Myriad",
|
|
32203
|
+
[import_sdk28.Venue.hyperliquid]: "Hyperliquid",
|
|
32204
|
+
[import_sdk28.Venue.novig]: "Novig",
|
|
32205
|
+
[import_sdk28.Venue.prophetx]: "ProphetX"
|
|
32130
32206
|
};
|
|
32131
32207
|
var amountSchema = import_zod3.z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
32132
32208
|
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
@@ -32160,9 +32236,9 @@ var areDraftsEqual = (current, initial) => {
|
|
|
32160
32236
|
};
|
|
32161
32237
|
var getPolicyMaximumRaw = (policy) => {
|
|
32162
32238
|
var _a, _b;
|
|
32163
|
-
return (0,
|
|
32164
|
-
(_a = policy == null ? void 0 : policy.dailyCapRaw) != null ? _a :
|
|
32165
|
-
(_b = policy == null ? void 0 : policy.maxFeeRaw) != null ? _b :
|
|
32239
|
+
return (0, import_sdk28.getBalanceRefillMaximumRaw)(
|
|
32240
|
+
(_a = policy == null ? void 0 : policy.dailyCapRaw) != null ? _a : import_sdk28.DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
|
|
32241
|
+
(_b = policy == null ? void 0 : policy.maxFeeRaw) != null ? _b : import_sdk28.DEFAULT_BALANCE_REFILL_MAX_FEE_RAW
|
|
32166
32242
|
);
|
|
32167
32243
|
};
|
|
32168
32244
|
var getApiFieldErrors = (error) => {
|
|
@@ -32184,16 +32260,16 @@ var ManageBalancesModal = ({
|
|
|
32184
32260
|
const depositAddressesQuery = (0, import_hooks82.useDepositAddresses)({ enabled: open });
|
|
32185
32261
|
const policiesQuery = (0, import_hooks82.useBalanceRefillPolicies)({ enabled: open });
|
|
32186
32262
|
const toastContext = useOptionalToast();
|
|
32187
|
-
const descriptionId = (0,
|
|
32188
|
-
const savingRef = (0,
|
|
32189
|
-
const [expandedChainIds, setExpandedChainIds] = (0,
|
|
32190
|
-
const [resetChainIds, setResetChainIds] = (0,
|
|
32191
|
-
const [drafts, setDrafts] = (0,
|
|
32192
|
-
const [initialDrafts, setInitialDrafts] = (0,
|
|
32193
|
-
const [submissionErrors, setSubmissionErrors] = (0,
|
|
32194
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
32195
|
-
const [isSaving, setIsSaving] = (0,
|
|
32196
|
-
const networks = (0,
|
|
32263
|
+
const descriptionId = (0, import_react53.useId)();
|
|
32264
|
+
const savingRef = (0, import_react53.useRef)(false);
|
|
32265
|
+
const [expandedChainIds, setExpandedChainIds] = (0, import_react53.useState)(/* @__PURE__ */ new Set());
|
|
32266
|
+
const [resetChainIds, setResetChainIds] = (0, import_react53.useState)(/* @__PURE__ */ new Set());
|
|
32267
|
+
const [drafts, setDrafts] = (0, import_react53.useState)({});
|
|
32268
|
+
const [initialDrafts, setInitialDrafts] = (0, import_react53.useState)({});
|
|
32269
|
+
const [submissionErrors, setSubmissionErrors] = (0, import_react53.useState)({});
|
|
32270
|
+
const [isInitialized, setIsInitialized] = (0, import_react53.useState)(false);
|
|
32271
|
+
const [isSaving, setIsSaving] = (0, import_react53.useState)(false);
|
|
32272
|
+
const networks = (0, import_react53.useMemo)(() => {
|
|
32197
32273
|
var _a, _b, _c;
|
|
32198
32274
|
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
32199
32275
|
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
@@ -32233,7 +32309,7 @@ var ManageBalancesModal = ({
|
|
|
32233
32309
|
const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
|
|
32234
32310
|
const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
|
|
32235
32311
|
const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
|
|
32236
|
-
(0,
|
|
32312
|
+
(0, import_react53.useEffect)(() => {
|
|
32237
32313
|
if (open) return;
|
|
32238
32314
|
setExpandedChainIds(/* @__PURE__ */ new Set());
|
|
32239
32315
|
setResetChainIds(/* @__PURE__ */ new Set());
|
|
@@ -32244,7 +32320,7 @@ var ManageBalancesModal = ({
|
|
|
32244
32320
|
setIsSaving(false);
|
|
32245
32321
|
savingRef.current = false;
|
|
32246
32322
|
}, [open]);
|
|
32247
|
-
(0,
|
|
32323
|
+
(0, import_react53.useEffect)(() => {
|
|
32248
32324
|
if (!open || isLoading || hasLoadError || isInitialized) return;
|
|
32249
32325
|
const nextDrafts = Object.fromEntries(
|
|
32250
32326
|
networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
|
|
@@ -32253,7 +32329,7 @@ var ManageBalancesModal = ({
|
|
|
32253
32329
|
setInitialDrafts(nextDrafts);
|
|
32254
32330
|
setIsInitialized(true);
|
|
32255
32331
|
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
32256
|
-
const validateDraft = (0,
|
|
32332
|
+
const validateDraft = (0, import_react53.useCallback)(
|
|
32257
32333
|
(network, draft) => {
|
|
32258
32334
|
const errors = {};
|
|
32259
32335
|
const minimum = draft.minimum.trim();
|
|
@@ -32287,7 +32363,7 @@ var ManageBalancesModal = ({
|
|
|
32287
32363
|
},
|
|
32288
32364
|
[refillLabels]
|
|
32289
32365
|
);
|
|
32290
|
-
const dirtyNetworks = (0,
|
|
32366
|
+
const dirtyNetworks = (0, import_react53.useMemo)(
|
|
32291
32367
|
() => networks.filter((network) => {
|
|
32292
32368
|
if (!network.canManageBalance) return false;
|
|
32293
32369
|
if (resetChainIds.has(network.chainId)) return true;
|
|
@@ -32298,7 +32374,7 @@ var ManageBalancesModal = ({
|
|
|
32298
32374
|
}),
|
|
32299
32375
|
[drafts, initialDrafts, networks, resetChainIds]
|
|
32300
32376
|
);
|
|
32301
|
-
const validationErrors = (0,
|
|
32377
|
+
const validationErrors = (0, import_react53.useMemo)(
|
|
32302
32378
|
() => Object.fromEntries(
|
|
32303
32379
|
dirtyNetworks.map((network) => {
|
|
32304
32380
|
var _a;
|
|
@@ -32314,14 +32390,14 @@ var ManageBalancesModal = ({
|
|
|
32314
32390
|
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
32315
32391
|
);
|
|
32316
32392
|
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
32317
|
-
const handleOpenChange = (0,
|
|
32393
|
+
const handleOpenChange = (0, import_react53.useCallback)(
|
|
32318
32394
|
(nextOpen) => {
|
|
32319
32395
|
if (isSaving && !nextOpen) return;
|
|
32320
32396
|
onOpenChange(nextOpen);
|
|
32321
32397
|
},
|
|
32322
32398
|
[isSaving, onOpenChange]
|
|
32323
32399
|
);
|
|
32324
|
-
const handleToggleNetwork = (0,
|
|
32400
|
+
const handleToggleNetwork = (0, import_react53.useCallback)((chainId, canManageBalance) => {
|
|
32325
32401
|
if (!canManageBalance) return;
|
|
32326
32402
|
setExpandedChainIds((current) => {
|
|
32327
32403
|
const next = new Set(current);
|
|
@@ -32330,7 +32406,7 @@ var ManageBalancesModal = ({
|
|
|
32330
32406
|
return next;
|
|
32331
32407
|
});
|
|
32332
32408
|
}, []);
|
|
32333
|
-
const handleDraftChange = (0,
|
|
32409
|
+
const handleDraftChange = (0, import_react53.useCallback)(
|
|
32334
32410
|
(chainId, field, value) => {
|
|
32335
32411
|
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
32336
32412
|
setDrafts((current) => {
|
|
@@ -32359,7 +32435,7 @@ var ManageBalancesModal = ({
|
|
|
32359
32435
|
},
|
|
32360
32436
|
[]
|
|
32361
32437
|
);
|
|
32362
|
-
const handleResetNetwork = (0,
|
|
32438
|
+
const handleResetNetwork = (0, import_react53.useCallback)((network) => {
|
|
32363
32439
|
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
32364
32440
|
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
32365
32441
|
}));
|
|
@@ -32375,7 +32451,7 @@ var ManageBalancesModal = ({
|
|
|
32375
32451
|
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
32376
32452
|
});
|
|
32377
32453
|
}, []);
|
|
32378
|
-
const handleAmountBlur = (0,
|
|
32454
|
+
const handleAmountBlur = (0, import_react53.useCallback)((chainId, field) => {
|
|
32379
32455
|
setDrafts((current) => {
|
|
32380
32456
|
const currentDraft = current[chainId];
|
|
32381
32457
|
if (!currentDraft) return current;
|
|
@@ -32386,12 +32462,12 @@ var ManageBalancesModal = ({
|
|
|
32386
32462
|
});
|
|
32387
32463
|
});
|
|
32388
32464
|
}, []);
|
|
32389
|
-
const handleRetry = (0,
|
|
32465
|
+
const handleRetry = (0, import_react53.useCallback)(() => {
|
|
32390
32466
|
void depositAddressesQuery.refetch();
|
|
32391
32467
|
void policiesQuery.refetch();
|
|
32392
32468
|
balanceState.refetch();
|
|
32393
32469
|
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
32394
|
-
const handleSave = (0,
|
|
32470
|
+
const handleSave = (0, import_react53.useCallback)(() => __async(null, null, function* () {
|
|
32395
32471
|
if (savingRef.current || isSaveDisabled) return;
|
|
32396
32472
|
savingRef.current = true;
|
|
32397
32473
|
setIsSaving(true);
|
|
@@ -32804,7 +32880,7 @@ ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
|
32804
32880
|
|
|
32805
32881
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
32806
32882
|
var import_hooks85 = require("@agg-build/hooks");
|
|
32807
|
-
var
|
|
32883
|
+
var import_react54 = require("react");
|
|
32808
32884
|
|
|
32809
32885
|
// src/pages/user-profile/user-profile.constants.ts
|
|
32810
32886
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -32883,6 +32959,7 @@ var resolvePositionStatus = (position) => {
|
|
|
32883
32959
|
return "open";
|
|
32884
32960
|
};
|
|
32885
32961
|
var resolvePositionBucket = (position) => {
|
|
32962
|
+
if (position.status === "closed") return "closed";
|
|
32886
32963
|
const status = resolvePositionStatus(position);
|
|
32887
32964
|
if (status === "won_unclaimed") return "active";
|
|
32888
32965
|
if (status === "open") return "active";
|
|
@@ -33659,6 +33736,18 @@ var OpenOrderRow = ({
|
|
|
33659
33736
|
};
|
|
33660
33737
|
const canCancel = canCancelOpenOrder(order);
|
|
33661
33738
|
const isPending = isPendingOpenOrder(order);
|
|
33739
|
+
const sideLabel = order.side === "buy" ? labels.buy : order.side === "sell" ? labels.sell : void 0;
|
|
33740
|
+
const outcomePillLabel = sideLabel ? `${sideLabel} ${order.outcomeLabel}` : order.outcomeLabel;
|
|
33741
|
+
const currentPriceLabel = order.currentPriceLabel ? `${labels.nowPrefix} ${order.currentPriceLabel}` : void 0;
|
|
33742
|
+
const mobileStats = [
|
|
33743
|
+
__spreadValues({
|
|
33744
|
+
label: resolvedLimitPriceHeader,
|
|
33745
|
+
value: (_a = order.limitPriceLabel) != null ? _a : "\u2014"
|
|
33746
|
+
}, currentPriceLabel ? { subValue: currentPriceLabel } : {}),
|
|
33747
|
+
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
33748
|
+
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
33749
|
+
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
33750
|
+
];
|
|
33662
33751
|
const Wrapper = href ? "a" : "div";
|
|
33663
33752
|
const wrapperProps = href ? {
|
|
33664
33753
|
href,
|
|
@@ -33697,22 +33786,23 @@ var OpenOrderRow = ({
|
|
|
33697
33786
|
) }),
|
|
33698
33787
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
33699
33788
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-open-order-market min-w-0 overflow-hidden font-agg-sans text-agg-sm leading-agg-5 font-agg-bold text-agg-foreground [display:-webkit-box] [-webkit-line-clamp:2] [-webkit-box-orient:vertical] lg:text-agg-base lg:leading-agg-6 lg:whitespace-nowrap lg:text-ellipsis lg:[-webkit-line-clamp:1] lg:[display:block]", children: order.title }),
|
|
33700
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
33789
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "agg-open-order-outcome hidden lg:inline-flex w-fit items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) })
|
|
33701
33790
|
] })
|
|
33702
33791
|
] }),
|
|
33703
33792
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex w-full flex-wrap items-center gap-x-4 gap-y-2 lg:hidden", children: [
|
|
33704
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children:
|
|
33705
|
-
[
|
|
33706
|
-
|
|
33707
|
-
|
|
33708
|
-
|
|
33709
|
-
|
|
33710
|
-
|
|
33711
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
33712
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
|
|
33793
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "agg-open-order-outcome inline-flex shrink-0 items-center justify-center rounded-full bg-agg-secondary-hover px-4 py-[6px]", children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground whitespace-nowrap", children: outcomePillLabel }) }),
|
|
33794
|
+
mobileStats.map(({ label: label2, value, subValue }) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
33795
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
33796
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-agg-lg leading-agg-7 font-agg-normal text-agg-foreground", children: value }),
|
|
33797
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "font-agg-sans text-[10px] leading-[14px] font-agg-bold uppercase text-agg-muted-foreground", children: label2 })
|
|
33798
|
+
] }),
|
|
33799
|
+
subValue ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal whitespace-nowrap text-agg-foreground", children: subValue }) : null
|
|
33713
33800
|
] }, label2))
|
|
33714
33801
|
] }),
|
|
33715
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.
|
|
33802
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "agg-open-order-limit-price hidden w-[120px] shrink-0 flex-col justify-center gap-0.5 lg:flex", children: [
|
|
33803
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
33804
|
+
currentPriceLabel ? /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-open-order-current-price font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground", children: currentPriceLabel }) : null
|
|
33805
|
+
] }),
|
|
33716
33806
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-open-order-filled hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.filledLabel }),
|
|
33717
33807
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-open-order-value hidden w-[120px] shrink-0 agg-type-body-strong text-agg-foreground lg:block", children: order.valueLabel }),
|
|
33718
33808
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-open-order-expiration hidden w-[140px] shrink-0 agg-type-label text-agg-foreground lg:block", children: (_d = order.expirationLabel) != null ? _d : "\u2014" }),
|
|
@@ -33803,8 +33893,8 @@ var ResultBadge = ({
|
|
|
33803
33893
|
status,
|
|
33804
33894
|
labels
|
|
33805
33895
|
}) => {
|
|
33806
|
-
|
|
33807
|
-
|
|
33896
|
+
const isWon = status === "won_claimed" || status === "won_unclaimed";
|
|
33897
|
+
if (!isWon && status !== "lost" && status !== "sold") return null;
|
|
33808
33898
|
const isSold = status === "sold";
|
|
33809
33899
|
return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
|
|
33810
33900
|
"span",
|
|
@@ -34070,7 +34160,7 @@ var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
|
34070
34160
|
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
34071
34161
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
34072
34162
|
];
|
|
34073
|
-
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34163
|
+
var TabRowsSkeleton = ({ ariaLabel }) => /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { role: "status", "aria-label": ariaLabel, className: "flex flex-col gap-3 sm:gap-4", children: Array.from({ length: 3 }).map((_, index, acc) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34074
34164
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
34075
34165
|
index < acc.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "agg-position-divider h-px w-full shrink-0 bg-agg-separator", "aria-hidden": true }) : null
|
|
34076
34166
|
] }, index)) });
|
|
@@ -34118,12 +34208,12 @@ var PositionsActivity = ({
|
|
|
34118
34208
|
const positionsLabels = userProfileLabels.positions;
|
|
34119
34209
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
34120
34210
|
const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks85.useAggUiConfig)().formatting;
|
|
34121
|
-
const tabItems = (0,
|
|
34211
|
+
const tabItems = (0, import_react54.useMemo)(
|
|
34122
34212
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
34123
34213
|
[showOpenOrders, userProfileLabels.tabs]
|
|
34124
34214
|
);
|
|
34125
34215
|
const isTabControlled = tab !== void 0;
|
|
34126
|
-
const [internalActiveTab, setInternalActiveTab] = (0,
|
|
34216
|
+
const [internalActiveTab, setInternalActiveTab] = (0, import_react54.useState)(
|
|
34127
34217
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
34128
34218
|
);
|
|
34129
34219
|
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -34133,21 +34223,21 @@ var PositionsActivity = ({
|
|
|
34133
34223
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
34134
34224
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
34135
34225
|
};
|
|
34136
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
34137
|
-
const [searchValue, setSearchValue] = (0,
|
|
34138
|
-
const [isSearchFocused, setIsSearchFocused] = (0,
|
|
34139
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0,
|
|
34226
|
+
const [positionFilter, setPositionFilter] = (0, import_react54.useState)(initialPositionFilter);
|
|
34227
|
+
const [searchValue, setSearchValue] = (0, import_react54.useState)("");
|
|
34228
|
+
const [isSearchFocused, setIsSearchFocused] = (0, import_react54.useState)(false);
|
|
34229
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0, import_react54.useState)(
|
|
34140
34230
|
() => /* @__PURE__ */ new Set()
|
|
34141
34231
|
);
|
|
34142
|
-
const positionsLoadMoreRef = (0,
|
|
34143
|
-
const openOrdersLoadMoreRef = (0,
|
|
34144
|
-
const activitiesLoadMoreRef = (0,
|
|
34145
|
-
const rowsScrollRef = (0,
|
|
34232
|
+
const positionsLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34233
|
+
const openOrdersLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34234
|
+
const activitiesLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34235
|
+
const rowsScrollRef = (0, import_react54.useRef)(null);
|
|
34146
34236
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
34147
34237
|
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
34148
34238
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
34149
34239
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
34150
|
-
const positionsForCurrentFilter = (0,
|
|
34240
|
+
const positionsForCurrentFilter = (0, import_react54.useMemo)(() => {
|
|
34151
34241
|
if (positionFilter === "active") {
|
|
34152
34242
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
34153
34243
|
}
|
|
@@ -34164,7 +34254,7 @@ var PositionsActivity = ({
|
|
|
34164
34254
|
}
|
|
34165
34255
|
return Array.from(byId.values());
|
|
34166
34256
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
34167
|
-
const filteredPositions = (0,
|
|
34257
|
+
const filteredPositions = (0, import_react54.useMemo)(() => {
|
|
34168
34258
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
34169
34259
|
const q = searchValue.toLowerCase();
|
|
34170
34260
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -34189,7 +34279,7 @@ var PositionsActivity = ({
|
|
|
34189
34279
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
34190
34280
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
34191
34281
|
const filteredActivities = activities;
|
|
34192
|
-
const searchResults = (0,
|
|
34282
|
+
const searchResults = (0, import_react54.useMemo)(() => {
|
|
34193
34283
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
34194
34284
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
34195
34285
|
id: position.id,
|
|
@@ -34218,11 +34308,11 @@ var PositionsActivity = ({
|
|
|
34218
34308
|
const handleSearchChange = (event) => {
|
|
34219
34309
|
setSearchValue(event.target.value);
|
|
34220
34310
|
};
|
|
34221
|
-
(0,
|
|
34311
|
+
(0, import_react54.useEffect)(() => {
|
|
34222
34312
|
if (isPositionsTab) return;
|
|
34223
34313
|
setIsSearchFocused(false);
|
|
34224
34314
|
}, [isPositionsTab]);
|
|
34225
|
-
(0,
|
|
34315
|
+
(0, import_react54.useEffect)(() => {
|
|
34226
34316
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
34227
34317
|
const target = positionsLoadMoreRef.current;
|
|
34228
34318
|
if (!target || !loadMorePositions) return;
|
|
@@ -34244,7 +34334,7 @@ var PositionsActivity = ({
|
|
|
34244
34334
|
isPositionsTab,
|
|
34245
34335
|
loadMorePositions
|
|
34246
34336
|
]);
|
|
34247
|
-
(0,
|
|
34337
|
+
(0, import_react54.useEffect)(() => {
|
|
34248
34338
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
34249
34339
|
const target = activitiesLoadMoreRef.current;
|
|
34250
34340
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -34266,7 +34356,7 @@ var PositionsActivity = ({
|
|
|
34266
34356
|
isLoadingMoreActivities,
|
|
34267
34357
|
onLoadMoreActivities
|
|
34268
34358
|
]);
|
|
34269
|
-
(0,
|
|
34359
|
+
(0, import_react54.useEffect)(() => {
|
|
34270
34360
|
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
34271
34361
|
const target = openOrdersLoadMoreRef.current;
|
|
34272
34362
|
if (!target || !onLoadMoreOpenOrders) return;
|
|
@@ -34501,7 +34591,7 @@ var PositionsActivity = ({
|
|
|
34501
34591
|
}
|
|
34502
34592
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
34503
34593
|
var _a;
|
|
34504
|
-
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34505
34595
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34506
34596
|
"div",
|
|
34507
34597
|
{
|
|
@@ -34546,7 +34636,7 @@ var PositionsActivity = ({
|
|
|
34546
34636
|
title: openOrdersLabels.errorTitle,
|
|
34547
34637
|
description: openOrdersLabels.errorDescription
|
|
34548
34638
|
}
|
|
34549
|
-
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34639
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34550
34640
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34551
34641
|
"div",
|
|
34552
34642
|
{
|
|
@@ -34593,7 +34683,7 @@ var PositionsActivity = ({
|
|
|
34593
34683
|
title: "Unable to load activity",
|
|
34594
34684
|
description: "Please try again in a moment."
|
|
34595
34685
|
}
|
|
34596
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34686
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34597
34687
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34598
34688
|
"div",
|
|
34599
34689
|
{
|
|
@@ -34970,11 +35060,13 @@ var formatScaledNumberTwoDecimals = (value) => {
|
|
|
34970
35060
|
if (parsed == null) return "0.00";
|
|
34971
35061
|
return twoDecimalNumberFormatter.format(parsed);
|
|
34972
35062
|
};
|
|
35063
|
+
var formatPriceCentsLabel = (value) => `${limitPriceCentsFormatter.format(value * 100)}\xA2`;
|
|
34973
35064
|
var formatLimitPriceLabel2 = (value) => {
|
|
34974
35065
|
const parsed = parseRawMicroValue(value);
|
|
34975
35066
|
if (parsed == null) return void 0;
|
|
34976
|
-
return
|
|
35067
|
+
return formatPriceCentsLabel(parsed);
|
|
34977
35068
|
};
|
|
35069
|
+
var normalizeOutcomeMatchLabel = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
34978
35070
|
var formatOpenOrderExpirationLabel = ({
|
|
34979
35071
|
timeInForce,
|
|
34980
35072
|
expiresAt,
|
|
@@ -35316,11 +35408,11 @@ var toRedeemTransactions = (item) => {
|
|
|
35316
35408
|
});
|
|
35317
35409
|
};
|
|
35318
35410
|
var POSITION_ROW_VENUE_ORDER = [
|
|
35319
|
-
|
|
35320
|
-
|
|
35321
|
-
|
|
35322
|
-
|
|
35323
|
-
|
|
35411
|
+
import_sdk29.Venue.polymarket,
|
|
35412
|
+
import_sdk29.Venue.kalshi,
|
|
35413
|
+
import_sdk29.Venue.opinion,
|
|
35414
|
+
import_sdk29.Venue.limitless,
|
|
35415
|
+
import_sdk29.Venue.pred
|
|
35324
35416
|
];
|
|
35325
35417
|
function venueBreakdownSortKey(venue) {
|
|
35326
35418
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -35405,8 +35497,8 @@ var UserProfilePage = ({
|
|
|
35405
35497
|
onError
|
|
35406
35498
|
}) => {
|
|
35407
35499
|
var _a, _b, _c;
|
|
35408
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
35409
|
-
(0,
|
|
35500
|
+
const [isHydrated, setIsHydrated] = (0, import_react55.useState)(false);
|
|
35501
|
+
(0, import_react55.useEffect)(() => {
|
|
35410
35502
|
setIsHydrated(true);
|
|
35411
35503
|
}, []);
|
|
35412
35504
|
const { user: currentUser, isAuthenticated } = (0, import_hooks87.useAggAuthState)();
|
|
@@ -35419,28 +35511,28 @@ var UserProfilePage = ({
|
|
|
35419
35511
|
const client = (0, import_hooks87.useAggClient)();
|
|
35420
35512
|
const cancelOrderMutation = (0, import_hooks87.useCancelManagedOrder)();
|
|
35421
35513
|
const toastContext = useOptionalToast();
|
|
35422
|
-
const [internalCancellingIds, setInternalCancellingIds] = (0,
|
|
35514
|
+
const [internalCancellingIds, setInternalCancellingIds] = (0, import_react55.useState)({});
|
|
35423
35515
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
35424
35516
|
onClaim,
|
|
35425
35517
|
onClaimResult,
|
|
35426
35518
|
onClaimSubmitError,
|
|
35427
35519
|
externalClaimingKeys: claimingPositionKeys
|
|
35428
35520
|
});
|
|
35429
|
-
const [profileUser, setProfileUser] = (0,
|
|
35521
|
+
const [profileUser, setProfileUser] = (0, import_react55.useState)(void 0);
|
|
35430
35522
|
const shouldUseHookData = !user;
|
|
35431
|
-
const connectedVenues = (0,
|
|
35523
|
+
const connectedVenues = (0, import_react55.useMemo)(() => {
|
|
35432
35524
|
var _a2;
|
|
35433
35525
|
if (!shouldUseHookData) return [];
|
|
35434
35526
|
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
35435
35527
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
35436
35528
|
}, [balanceState, shouldUseHookData]);
|
|
35437
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
35438
|
-
const [selectedClaimActivity, setSelectedClaimActivity] = (0,
|
|
35439
|
-
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0,
|
|
35440
|
-
const manageBalancesButtonRef = (0,
|
|
35529
|
+
const [positionFilter, setPositionFilter] = (0, import_react55.useState)(initialPositionFilter);
|
|
35530
|
+
const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react55.useState)(null);
|
|
35531
|
+
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0, import_react55.useState)(false);
|
|
35532
|
+
const manageBalancesButtonRef = (0, import_react55.useRef)(null);
|
|
35441
35533
|
const { executionMode: resolvedExecutionMode, isPaperMode } = (0, import_hooks87.useResolvedExecutionMode)(executionMode);
|
|
35442
35534
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
35443
|
-
const handleManageBalancesOpenChange = (0,
|
|
35535
|
+
const handleManageBalancesOpenChange = (0, import_react55.useCallback)((open) => {
|
|
35444
35536
|
setIsManageBalancesOpen(open);
|
|
35445
35537
|
if (open) return;
|
|
35446
35538
|
requestAnimationFrame(() => {
|
|
@@ -35460,14 +35552,14 @@ var UserProfilePage = ({
|
|
|
35460
35552
|
limit: 25,
|
|
35461
35553
|
mode: queryExecutionMode
|
|
35462
35554
|
});
|
|
35463
|
-
const handlePositionFilterChange = (0,
|
|
35555
|
+
const handlePositionFilterChange = (0, import_react55.useCallback)(
|
|
35464
35556
|
(filter) => {
|
|
35465
35557
|
setPositionFilter(filter);
|
|
35466
35558
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
35467
35559
|
},
|
|
35468
35560
|
[onPositionFilterChangeProp]
|
|
35469
35561
|
);
|
|
35470
|
-
(0,
|
|
35562
|
+
(0, import_react55.useEffect)(() => {
|
|
35471
35563
|
setPositionFilter(initialPositionFilter);
|
|
35472
35564
|
}, [initialPositionFilter]);
|
|
35473
35565
|
const ordersQuery = (0, import_hooks87.useExecutionOrders)({
|
|
@@ -35532,7 +35624,7 @@ var UserProfilePage = ({
|
|
|
35532
35624
|
limit: 25,
|
|
35533
35625
|
mode: queryExecutionMode
|
|
35534
35626
|
});
|
|
35535
|
-
const openOrderQueries = (0,
|
|
35627
|
+
const openOrderQueries = (0, import_react55.useMemo)(
|
|
35536
35628
|
() => [
|
|
35537
35629
|
pendingOpenOrdersQuery,
|
|
35538
35630
|
signingOpenOrdersQuery,
|
|
@@ -35558,7 +35650,7 @@ var UserProfilePage = ({
|
|
|
35558
35650
|
enabled: shouldUseHookData && isAuthenticated,
|
|
35559
35651
|
limit: 25
|
|
35560
35652
|
});
|
|
35561
|
-
const handleCancelOrder = (0,
|
|
35653
|
+
const handleCancelOrder = (0, import_react55.useCallback)(
|
|
35562
35654
|
(order) => __async(null, null, function* () {
|
|
35563
35655
|
if (onCancelOrder) {
|
|
35564
35656
|
onCancelOrder(order);
|
|
@@ -35591,7 +35683,7 @@ var UserProfilePage = ({
|
|
|
35591
35683
|
}),
|
|
35592
35684
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
35593
35685
|
);
|
|
35594
|
-
const handleClaimPosition = (0,
|
|
35686
|
+
const handleClaimPosition = (0, import_react55.useCallback)(
|
|
35595
35687
|
(position) => {
|
|
35596
35688
|
var _a2, _b2;
|
|
35597
35689
|
return startClaim({
|
|
@@ -35602,7 +35694,7 @@ var UserProfilePage = ({
|
|
|
35602
35694
|
},
|
|
35603
35695
|
[startClaim]
|
|
35604
35696
|
);
|
|
35605
|
-
const handleActivityRowClick = (0,
|
|
35697
|
+
const handleActivityRowClick = (0, import_react55.useCallback)(
|
|
35606
35698
|
(activity) => {
|
|
35607
35699
|
if (activity.kind === "redeem") {
|
|
35608
35700
|
setSelectedClaimActivity(activity);
|
|
@@ -35612,13 +35704,13 @@ var UserProfilePage = ({
|
|
|
35612
35704
|
},
|
|
35613
35705
|
[onActivityClick]
|
|
35614
35706
|
);
|
|
35615
|
-
const handleClaimTransactionSelect = (0,
|
|
35707
|
+
const handleClaimTransactionSelect = (0, import_react55.useCallback)((transaction) => {
|
|
35616
35708
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
35617
35709
|
setSelectedClaimActivity(null);
|
|
35618
35710
|
if (!href || typeof window === "undefined") return;
|
|
35619
35711
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
35620
35712
|
}, []);
|
|
35621
|
-
(0,
|
|
35713
|
+
(0, import_react55.useEffect)(() => {
|
|
35622
35714
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
35623
35715
|
setProfileUser(void 0);
|
|
35624
35716
|
return;
|
|
@@ -35637,7 +35729,7 @@ var UserProfilePage = ({
|
|
|
35637
35729
|
isActive = false;
|
|
35638
35730
|
};
|
|
35639
35731
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
35640
|
-
const resolvedUser = (0,
|
|
35732
|
+
const resolvedUser = (0, import_react55.useMemo)(() => {
|
|
35641
35733
|
var _a2, _b2, _c2, _d, _e, _f;
|
|
35642
35734
|
if (user) return user;
|
|
35643
35735
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -35671,7 +35763,7 @@ var UserProfilePage = ({
|
|
|
35671
35763
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
35672
35764
|
};
|
|
35673
35765
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
35674
|
-
const _resolvedVenueBalances = (0,
|
|
35766
|
+
const _resolvedVenueBalances = (0, import_react55.useMemo)(() => {
|
|
35675
35767
|
if (_venueBalances) return _venueBalances;
|
|
35676
35768
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
35677
35769
|
chain: item.label,
|
|
@@ -35679,24 +35771,24 @@ var UserProfilePage = ({
|
|
|
35679
35771
|
balanceLabel: formatUsd2(item.balance)
|
|
35680
35772
|
}));
|
|
35681
35773
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
35682
|
-
const positionsValueLabel = (0,
|
|
35774
|
+
const positionsValueLabel = (0, import_react55.useMemo)(() => {
|
|
35683
35775
|
var _a2;
|
|
35684
35776
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
35685
35777
|
return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
|
|
35686
35778
|
}, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
|
|
35687
|
-
const availableBalanceLabel = (0,
|
|
35779
|
+
const availableBalanceLabel = (0, import_react55.useMemo)(() => {
|
|
35688
35780
|
var _a2, _b2;
|
|
35689
35781
|
return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
35690
35782
|
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
35691
35783
|
const paperSummary = (_a = balanceState.managedBalances) == null ? void 0 : _a.paper;
|
|
35692
|
-
const paperBuyingPowerLabel = (0,
|
|
35784
|
+
const paperBuyingPowerLabel = (0, import_react55.useMemo)(
|
|
35693
35785
|
() => {
|
|
35694
35786
|
var _a2;
|
|
35695
35787
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.cashBalance) != null ? _a2 : 0);
|
|
35696
35788
|
},
|
|
35697
35789
|
[paperSummary == null ? void 0 : paperSummary.cashBalance]
|
|
35698
35790
|
);
|
|
35699
|
-
const paperEarningsLabel = (0,
|
|
35791
|
+
const paperEarningsLabel = (0, import_react55.useMemo)(
|
|
35700
35792
|
() => {
|
|
35701
35793
|
var _a2;
|
|
35702
35794
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.earnings) != null ? _a2 : 0);
|
|
@@ -35705,13 +35797,13 @@ var UserProfilePage = ({
|
|
|
35705
35797
|
);
|
|
35706
35798
|
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks87.useAppConfig)();
|
|
35707
35799
|
const isKalshiAvailable = (0, import_hooks87.getVenueAvailabilityState)({
|
|
35708
|
-
venueId:
|
|
35800
|
+
venueId: import_sdk29.Venue.kalshi,
|
|
35709
35801
|
disabledVenues,
|
|
35710
35802
|
isConfigLoading: isAppConfigLoading
|
|
35711
35803
|
}) === "available";
|
|
35712
35804
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
35713
35805
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
35714
|
-
const resolvedActivities = (0,
|
|
35806
|
+
const resolvedActivities = (0, import_react55.useMemo)(() => {
|
|
35715
35807
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
35716
35808
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
35717
35809
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -35862,8 +35954,7 @@ var UserProfilePage = ({
|
|
|
35862
35954
|
};
|
|
35863
35955
|
});
|
|
35864
35956
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
35865
|
-
const
|
|
35866
|
-
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
35957
|
+
const openOrderRows = (0, import_react55.useMemo)(() => {
|
|
35867
35958
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
35868
35959
|
for (const query of openOrderQueries) {
|
|
35869
35960
|
for (const order of query.orders) {
|
|
@@ -35874,7 +35965,47 @@ var UserProfilePage = ({
|
|
|
35874
35965
|
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
35875
35966
|
).sort(
|
|
35876
35967
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
35877
|
-
)
|
|
35968
|
+
);
|
|
35969
|
+
}, [openOrderQueries]);
|
|
35970
|
+
const openOrderVenueMarketIds = (0, import_react55.useMemo)(
|
|
35971
|
+
() => openOrderRows.map((order) => {
|
|
35972
|
+
var _a2;
|
|
35973
|
+
return (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
35974
|
+
}).filter((venueMarketId) => Boolean(venueMarketId)),
|
|
35975
|
+
[openOrderRows]
|
|
35976
|
+
);
|
|
35977
|
+
const openOrderMidpointsQuery = (0, import_hooks87.useVenueMarketMidpoints)({
|
|
35978
|
+
venueMarketIds: openOrderVenueMarketIds,
|
|
35979
|
+
enabled: !openOrders && openOrderVenueMarketIds.length > 0
|
|
35980
|
+
});
|
|
35981
|
+
const openOrderMidpointRows = openOrderMidpointsQuery.midpointRows;
|
|
35982
|
+
const openOrderCurrentPriceLabels = (0, import_react55.useMemo)(() => {
|
|
35983
|
+
var _a2, _b2, _c2, _d;
|
|
35984
|
+
const midpointRowsByVenueMarketId = new Map(
|
|
35985
|
+
openOrderMidpointRows.map((row) => [row.venueMarketId, row])
|
|
35986
|
+
);
|
|
35987
|
+
const labelsByOrderId = /* @__PURE__ */ new Map();
|
|
35988
|
+
for (const order of openOrderRows) {
|
|
35989
|
+
const venueMarketId = (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
35990
|
+
if (!venueMarketId) continue;
|
|
35991
|
+
const midpointRow = midpointRowsByVenueMarketId.get(venueMarketId);
|
|
35992
|
+
if (!midpointRow) continue;
|
|
35993
|
+
const orderOutcomeLabels = [
|
|
35994
|
+
normalizeOutcomeMatchLabel((_b2 = order.venueMarketOutcome) == null ? void 0 : _b2.label),
|
|
35995
|
+
normalizeOutcomeMatchLabel((_c2 = order.venueMarketOutcome) == null ? void 0 : _c2.title)
|
|
35996
|
+
].filter(Boolean);
|
|
35997
|
+
if (orderOutcomeLabels.length === 0) continue;
|
|
35998
|
+
const outcomeMidpoint = (_d = midpointRow.outcomes) == null ? void 0 : _d.find(
|
|
35999
|
+
(outcome) => orderOutcomeLabels.includes(normalizeOutcomeMatchLabel(outcome.label))
|
|
36000
|
+
);
|
|
36001
|
+
if ((outcomeMidpoint == null ? void 0 : outcomeMidpoint.midpoint) == null) continue;
|
|
36002
|
+
labelsByOrderId.set(order.id, formatPriceCentsLabel(outcomeMidpoint.midpoint));
|
|
36003
|
+
}
|
|
36004
|
+
return labelsByOrderId;
|
|
36005
|
+
}, [openOrderMidpointRows, openOrderRows]);
|
|
36006
|
+
const resolvedOpenOrders = (0, import_react55.useMemo)(() => {
|
|
36007
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
36008
|
+
return openOrderRows.map((order) => {
|
|
35878
36009
|
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
35879
36010
|
const isLimitOrder = isExecutionLimitOrder(order);
|
|
35880
36011
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
@@ -35887,15 +36018,17 @@ var UserProfilePage = ({
|
|
|
35887
36018
|
goodTilCanceledLabel: labels.userProfile.openOrders.goodTilCanceled,
|
|
35888
36019
|
expiredLabel: labels.userProfile.openOrders.expired
|
|
35889
36020
|
});
|
|
35890
|
-
|
|
36021
|
+
const currentPriceLabel = openOrderCurrentPriceLabels.get(order.id);
|
|
36022
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
35891
36023
|
id: order.id,
|
|
35892
36024
|
eventId: (_c2 = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c2 : void 0,
|
|
35893
36025
|
marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
|
|
35894
36026
|
thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
|
|
35895
36027
|
title: ((_h = order.venueMarket) == null ? void 0 : _h.question) || "Market",
|
|
35896
|
-
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
36028
|
+
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
36029
|
+
}, order.side === "sell" || order.side === "buy" ? { side: order.side } : {}), {
|
|
35897
36030
|
venue: order.venue
|
|
35898
|
-
}, limitPriceLabel ? { limitPriceLabel } : {}), {
|
|
36031
|
+
}), limitPriceLabel ? { limitPriceLabel } : {}), currentPriceLabel ? { currentPriceLabel } : {}), {
|
|
35899
36032
|
filledLabel: `${formatScaledNumberTwoDecimals(filledRaw != null ? filledRaw : "0")}/${formatScaledNumberTwoDecimals(totalRaw)}`,
|
|
35900
36033
|
valueLabel: formatFilledUsdTwoDecimals(totalCostRaw)
|
|
35901
36034
|
}), expirationLabel ? { expirationLabel } : {}), {
|
|
@@ -35904,31 +36037,31 @@ var UserProfilePage = ({
|
|
|
35904
36037
|
dagRunId: (_k = order.dagRunId) != null ? _k : null
|
|
35905
36038
|
});
|
|
35906
36039
|
});
|
|
35907
|
-
}, [labels,
|
|
35908
|
-
const isOpenOrdersQueryLoading = (0,
|
|
36040
|
+
}, [labels, openOrderCurrentPriceLabels, openOrderRows, openOrders]);
|
|
36041
|
+
const isOpenOrdersQueryLoading = (0, import_react55.useMemo)(
|
|
35909
36042
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
35910
36043
|
[openOrderQueries]
|
|
35911
36044
|
);
|
|
35912
|
-
const hasOpenOrdersQueryError = (0,
|
|
36045
|
+
const hasOpenOrdersQueryError = (0, import_react55.useMemo)(
|
|
35913
36046
|
() => openOrderQueries.some((query) => query.error),
|
|
35914
36047
|
[openOrderQueries]
|
|
35915
36048
|
);
|
|
35916
|
-
const hasMoreOpenOrdersQuery = (0,
|
|
36049
|
+
const hasMoreOpenOrdersQuery = (0, import_react55.useMemo)(
|
|
35917
36050
|
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
35918
36051
|
[openOrderQueries]
|
|
35919
36052
|
);
|
|
35920
|
-
const isLoadingMoreOpenOrdersQuery = (0,
|
|
36053
|
+
const isLoadingMoreOpenOrdersQuery = (0, import_react55.useMemo)(
|
|
35921
36054
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
35922
36055
|
[openOrderQueries]
|
|
35923
36056
|
);
|
|
35924
|
-
const handleLoadMoreOpenOrders = (0,
|
|
36057
|
+
const handleLoadMoreOpenOrders = (0, import_react55.useCallback)(() => {
|
|
35925
36058
|
for (const query of openOrderQueries) {
|
|
35926
36059
|
if (query.hasNextPage) {
|
|
35927
36060
|
void query.fetchNextPage();
|
|
35928
36061
|
}
|
|
35929
36062
|
}
|
|
35930
36063
|
}, [openOrderQueries]);
|
|
35931
|
-
const adaptPositionGroups = (0,
|
|
36064
|
+
const adaptPositionGroups = (0, import_react55.useCallback)(
|
|
35932
36065
|
(groups) => {
|
|
35933
36066
|
return groups.flatMap((group) => {
|
|
35934
36067
|
var _a2, _b2, _c2, _d;
|
|
@@ -36000,11 +36133,11 @@ var UserProfilePage = ({
|
|
|
36000
36133
|
},
|
|
36001
36134
|
[]
|
|
36002
36135
|
);
|
|
36003
|
-
const resolvedActivePositions = (0,
|
|
36136
|
+
const resolvedActivePositions = (0, import_react55.useMemo)(() => {
|
|
36004
36137
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
36005
36138
|
return source.filter(shouldIncludeByShares);
|
|
36006
36139
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
36007
|
-
const resolvedClosedPositions = (0,
|
|
36140
|
+
const resolvedClosedPositions = (0, import_react55.useMemo)(() => {
|
|
36008
36141
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
36009
36142
|
return source.filter(shouldIncludeByShares);
|
|
36010
36143
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
@@ -36069,32 +36202,13 @@ var UserProfilePage = ({
|
|
|
36069
36202
|
classNames == null ? void 0 : classNames.rightColumn
|
|
36070
36203
|
),
|
|
36071
36204
|
children: [
|
|
36072
|
-
/* @__PURE__ */ (0, import_jsx_runtime196.
|
|
36073
|
-
|
|
36205
|
+
/* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
36206
|
+
PositionsValueCard,
|
|
36074
36207
|
{
|
|
36075
|
-
|
|
36076
|
-
|
|
36077
|
-
|
|
36078
|
-
|
|
36079
|
-
children: [
|
|
36080
|
-
/* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
36081
|
-
PositionsValueCard,
|
|
36082
|
-
{
|
|
36083
|
-
label: labels.userProfile.balance.positionsValue,
|
|
36084
|
-
valueLabel: positionsValueLabel,
|
|
36085
|
-
isLoading: isPositionsValueLoading,
|
|
36086
|
-
compact: isPaperMode
|
|
36087
|
-
}
|
|
36088
|
-
),
|
|
36089
|
-
isKalshiAvailable && !isPaperMode ? /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
36090
|
-
PositionsValueCard,
|
|
36091
|
-
{
|
|
36092
|
-
label: labels.userProfile.balance.kalshiBalance,
|
|
36093
|
-
valueLabel: formatUsd2((_b = balanceState.kalshiBalance) != null ? _b : 0),
|
|
36094
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(VenueLogo, { venue: import_sdk30.Venue.kalshi, size: "small", className: "size-4" })
|
|
36095
|
-
}
|
|
36096
|
-
) : null
|
|
36097
|
-
]
|
|
36208
|
+
label: labels.userProfile.balance.positionsValue,
|
|
36209
|
+
valueLabel: positionsValueLabel,
|
|
36210
|
+
isLoading: isPositionsValueLoading,
|
|
36211
|
+
compact: isPaperMode
|
|
36098
36212
|
}
|
|
36099
36213
|
),
|
|
36100
36214
|
isPaperMode ? (
|
|
@@ -36143,13 +36257,14 @@ var UserProfilePage = ({
|
|
|
36143
36257
|
{
|
|
36144
36258
|
valueLabel: availableBalanceLabel,
|
|
36145
36259
|
isLoading: isAvailableBalanceLoading,
|
|
36146
|
-
chains: ((
|
|
36260
|
+
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
36147
36261
|
key: b.key,
|
|
36148
36262
|
label: b.label,
|
|
36149
36263
|
balance: b.balance,
|
|
36150
36264
|
accountCount: b.accountCount,
|
|
36151
36265
|
venues: b.venues
|
|
36152
36266
|
})),
|
|
36267
|
+
kalshiValueLabel: isKalshiAvailable ? formatUsd2((_c = balanceState.kalshiBalance) != null ? _c : 0) : void 0,
|
|
36153
36268
|
manageButtonRef: manageBalancesButtonRef,
|
|
36154
36269
|
onManage: () => handleManageBalancesOpenChange(true)
|
|
36155
36270
|
}
|
|
@@ -36241,7 +36356,7 @@ UserProfilePage.displayName = "UserProfilePage";
|
|
|
36241
36356
|
// src/deposit/index.tsx
|
|
36242
36357
|
var import_hooks98 = require("@agg-build/hooks");
|
|
36243
36358
|
var import_deposit = require("@agg-build/hooks/deposit");
|
|
36244
|
-
var
|
|
36359
|
+
var import_react58 = require("react");
|
|
36245
36360
|
|
|
36246
36361
|
// src/shared/constants.ts
|
|
36247
36362
|
var USDC = {
|
|
@@ -36473,7 +36588,7 @@ var NETWORK_TO_CURRENCY_CODE = {
|
|
|
36473
36588
|
|
|
36474
36589
|
// src/deposit/steps/card-deposit.tsx
|
|
36475
36590
|
var import_hooks88 = require("@agg-build/hooks");
|
|
36476
|
-
var
|
|
36591
|
+
var import_react56 = require("react");
|
|
36477
36592
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
36478
36593
|
var CardDepositStep = ({
|
|
36479
36594
|
amount,
|
|
@@ -36491,8 +36606,8 @@ var CardDepositStep = ({
|
|
|
36491
36606
|
onContinue
|
|
36492
36607
|
}) => {
|
|
36493
36608
|
const labels = (0, import_hooks88.useLabels)();
|
|
36494
|
-
const [localAmount, setLocalAmount] = (0,
|
|
36495
|
-
(0,
|
|
36609
|
+
const [localAmount, setLocalAmount] = (0, import_react56.useState)(amount);
|
|
36610
|
+
(0, import_react56.useEffect)(() => {
|
|
36496
36611
|
setLocalAmount(amount);
|
|
36497
36612
|
}, [amount]);
|
|
36498
36613
|
const numericAmount = Number(localAmount) || 0;
|
|
@@ -37349,7 +37464,7 @@ var WalletFormStep = ({
|
|
|
37349
37464
|
|
|
37350
37465
|
// src/deposit/steps/wallet-processing.tsx
|
|
37351
37466
|
var import_hooks96 = require("@agg-build/hooks");
|
|
37352
|
-
var
|
|
37467
|
+
var import_react57 = require("react");
|
|
37353
37468
|
var import_jsx_runtime206 = require("react/jsx-runtime");
|
|
37354
37469
|
var WalletProcessingStep = ({
|
|
37355
37470
|
steps,
|
|
@@ -37357,7 +37472,7 @@ var WalletProcessingStep = ({
|
|
|
37357
37472
|
onComplete
|
|
37358
37473
|
}) => {
|
|
37359
37474
|
const labels = (0, import_hooks96.useLabels)();
|
|
37360
|
-
(0,
|
|
37475
|
+
(0, import_react57.useEffect)(() => {
|
|
37361
37476
|
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
37362
37477
|
if (allDone) {
|
|
37363
37478
|
onComplete();
|
|
@@ -37530,30 +37645,30 @@ function DepositModalControlled({
|
|
|
37530
37645
|
const { walletActions } = (0, import_hooks98.useAggUiConfig)();
|
|
37531
37646
|
const labels = (0, import_hooks98.useLabels)();
|
|
37532
37647
|
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
37533
|
-
const [step, setStep] = (0,
|
|
37648
|
+
const [step, setStep] = (0, import_react58.useState)(
|
|
37534
37649
|
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
37535
37650
|
);
|
|
37536
|
-
const [highlightedMethod, setHighlightedMethod] = (0,
|
|
37537
|
-
const walletSubmitInFlightRef = (0,
|
|
37538
|
-
const walletDepositAttemptIdRef = (0,
|
|
37539
|
-
const notifiedWalletDepositStatusesRef = (0,
|
|
37540
|
-
const [isWalletSubmitting, setIsWalletSubmitting] = (0,
|
|
37541
|
-
const [cardProviders, setCardProviders] = (0,
|
|
37542
|
-
const [quotesLoading, setQuotesLoading] = (0,
|
|
37543
|
-
const [quotesError, setQuotesError] = (0,
|
|
37544
|
-
const [sessionError, setSessionError] = (0,
|
|
37545
|
-
const [pendingProviderName, setPendingProviderName] = (0,
|
|
37546
|
-
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0,
|
|
37547
|
-
(0,
|
|
37651
|
+
const [highlightedMethod, setHighlightedMethod] = (0, import_react58.useState)(defaultMethod);
|
|
37652
|
+
const walletSubmitInFlightRef = (0, import_react58.useRef)(false);
|
|
37653
|
+
const walletDepositAttemptIdRef = (0, import_react58.useRef)(0);
|
|
37654
|
+
const notifiedWalletDepositStatusesRef = (0, import_react58.useRef)(/* @__PURE__ */ new Set());
|
|
37655
|
+
const [isWalletSubmitting, setIsWalletSubmitting] = (0, import_react58.useState)(false);
|
|
37656
|
+
const [cardProviders, setCardProviders] = (0, import_react58.useState)([]);
|
|
37657
|
+
const [quotesLoading, setQuotesLoading] = (0, import_react58.useState)(false);
|
|
37658
|
+
const [quotesError, setQuotesError] = (0, import_react58.useState)(null);
|
|
37659
|
+
const [sessionError, setSessionError] = (0, import_react58.useState)(null);
|
|
37660
|
+
const [pendingProviderName, setPendingProviderName] = (0, import_react58.useState)("");
|
|
37661
|
+
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0, import_react58.useState)("");
|
|
37662
|
+
(0, import_react58.useEffect)(() => {
|
|
37548
37663
|
if (pendingCardPurchaseSummary) {
|
|
37549
37664
|
clearPendingCardSession();
|
|
37550
37665
|
setStep("card-success");
|
|
37551
37666
|
}
|
|
37552
37667
|
}, [pendingCardPurchaseSummary]);
|
|
37553
|
-
const [walletChainId, setWalletChainId] = (0,
|
|
37554
|
-
const [walletToken, setWalletToken] = (0,
|
|
37555
|
-
const [sendChainId, setSendChainId] = (0,
|
|
37556
|
-
const [sendToken, setSendToken] = (0,
|
|
37668
|
+
const [walletChainId, setWalletChainId] = (0, import_react58.useState)("");
|
|
37669
|
+
const [walletToken, setWalletToken] = (0, import_react58.useState)("");
|
|
37670
|
+
const [sendChainId, setSendChainId] = (0, import_react58.useState)("");
|
|
37671
|
+
const [sendToken, setSendToken] = (0, import_react58.useState)("");
|
|
37557
37672
|
const {
|
|
37558
37673
|
isReady,
|
|
37559
37674
|
isTimedOut,
|
|
@@ -37561,14 +37676,14 @@ function DepositModalControlled({
|
|
|
37561
37676
|
supportedChains,
|
|
37562
37677
|
getAddress
|
|
37563
37678
|
} = (0, import_hooks98.useDepositAddresses)({ enabled: open });
|
|
37564
|
-
const fallbackNetworkOptions = (0,
|
|
37565
|
-
const networkOptions = (0,
|
|
37679
|
+
const fallbackNetworkOptions = (0, import_react58.useMemo)(() => mapNetworksToOptions(), []);
|
|
37680
|
+
const networkOptions = (0, import_react58.useMemo)(() => {
|
|
37566
37681
|
if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
|
|
37567
37682
|
return withNetworkIcons(
|
|
37568
37683
|
supportedChains.map((c) => ({ value: String(c.chainId), label: c.name }))
|
|
37569
37684
|
);
|
|
37570
37685
|
}, [supportedChains, fallbackNetworkOptions]);
|
|
37571
|
-
const walletNetworkOptions = (0,
|
|
37686
|
+
const walletNetworkOptions = (0, import_react58.useMemo)(() => {
|
|
37572
37687
|
if (!(supportedChains == null ? void 0 : supportedChains.length) || !connectedWalletKind) return networkOptions;
|
|
37573
37688
|
const filtered = supportedChains.filter(
|
|
37574
37689
|
(c) => connectedWalletKind === "solana" ? import_deposit.SVM_CHAIN_IDS.has(c.chainId) : !import_deposit.SVM_CHAIN_IDS.has(c.chainId)
|
|
@@ -37576,17 +37691,17 @@ function DepositModalControlled({
|
|
|
37576
37691
|
if (filtered.length === 0) return networkOptions;
|
|
37577
37692
|
return withNetworkIcons(filtered.map((c) => ({ value: String(c.chainId), label: c.name })));
|
|
37578
37693
|
}, [supportedChains, networkOptions, connectedWalletKind]);
|
|
37579
|
-
const walletTokenOptions = (0,
|
|
37694
|
+
const walletTokenOptions = (0, import_react58.useMemo)(() => {
|
|
37580
37695
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
37581
37696
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
37582
37697
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
37583
37698
|
}, [supportedChains, walletChainId]);
|
|
37584
|
-
const sendTokenOptions = (0,
|
|
37699
|
+
const sendTokenOptions = (0, import_react58.useMemo)(() => {
|
|
37585
37700
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === sendChainId);
|
|
37586
37701
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
37587
37702
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
37588
37703
|
}, [supportedChains, sendChainId]);
|
|
37589
|
-
(0,
|
|
37704
|
+
(0, import_react58.useEffect)(() => {
|
|
37590
37705
|
if (walletNetworkOptions.length > 0) {
|
|
37591
37706
|
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
37592
37707
|
const ethereumMainnetOption = walletNetworkOptions.find(
|
|
@@ -37597,30 +37712,30 @@ function DepositModalControlled({
|
|
|
37597
37712
|
}
|
|
37598
37713
|
}
|
|
37599
37714
|
}, [walletNetworkOptions, walletChainId, initialWalletChainId]);
|
|
37600
|
-
(0,
|
|
37715
|
+
(0, import_react58.useEffect)(() => {
|
|
37601
37716
|
if (networkOptions.length > 0) {
|
|
37602
37717
|
if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) {
|
|
37603
37718
|
setSendChainId(networkOptions[0].value);
|
|
37604
37719
|
}
|
|
37605
37720
|
}
|
|
37606
37721
|
}, [networkOptions, sendChainId]);
|
|
37607
|
-
(0,
|
|
37722
|
+
(0, import_react58.useEffect)(() => {
|
|
37608
37723
|
var _a2, _b2;
|
|
37609
37724
|
if (walletTokenOptions.length > 0) {
|
|
37610
37725
|
const preferredToken = (_b2 = (_a2 = walletTokenOptions.find((option) => option.value === DEFAULT_WALLET_TOKEN)) == null ? void 0 : _a2.value) != null ? _b2 : walletTokenOptions[0].value;
|
|
37611
37726
|
setWalletToken(preferredToken);
|
|
37612
37727
|
}
|
|
37613
37728
|
}, [walletTokenOptions]);
|
|
37614
|
-
(0,
|
|
37729
|
+
(0, import_react58.useEffect)(() => {
|
|
37615
37730
|
var _a2, _b2;
|
|
37616
37731
|
setSendToken((_b2 = (_a2 = sendTokenOptions == null ? void 0 : sendTokenOptions[0]) == null ? void 0 : _a2.value) != null ? _b2 : "");
|
|
37617
37732
|
}, [sendTokenOptions]);
|
|
37618
|
-
(0,
|
|
37733
|
+
(0, import_react58.useEffect)(() => {
|
|
37619
37734
|
if (walletChainId) {
|
|
37620
37735
|
onWalletNetworkChange == null ? void 0 : onWalletNetworkChange(walletChainId);
|
|
37621
37736
|
}
|
|
37622
37737
|
}, [walletChainId, onWalletNetworkChange]);
|
|
37623
|
-
(0,
|
|
37738
|
+
(0, import_react58.useEffect)(() => {
|
|
37624
37739
|
if (walletToken) {
|
|
37625
37740
|
onWalletTokenChange == null ? void 0 : onWalletTokenChange(walletToken);
|
|
37626
37741
|
}
|
|
@@ -37639,7 +37754,7 @@ function DepositModalControlled({
|
|
|
37639
37754
|
fromWallet: walletFlow.walletLabel,
|
|
37640
37755
|
gasFee: ""
|
|
37641
37756
|
}, walletFlow.successSummary);
|
|
37642
|
-
const handleWalletDepositNotification = (0,
|
|
37757
|
+
const handleWalletDepositNotification = (0, import_react58.useCallback)(
|
|
37643
37758
|
(status, errorMessage) => {
|
|
37644
37759
|
if (notifiedWalletDepositStatusesRef.current.has(status)) return;
|
|
37645
37760
|
notifiedWalletDepositStatusesRef.current.add(status);
|
|
@@ -37653,13 +37768,13 @@ function DepositModalControlled({
|
|
|
37653
37768
|
},
|
|
37654
37769
|
[walletFlow.amount, walletToken]
|
|
37655
37770
|
);
|
|
37656
|
-
(0,
|
|
37771
|
+
(0, import_react58.useEffect)(() => {
|
|
37657
37772
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
37658
37773
|
handleWalletDepositNotification("completed");
|
|
37659
37774
|
setStep("wallet-success");
|
|
37660
37775
|
}
|
|
37661
37776
|
}, [handleWalletDepositNotification, isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
37662
|
-
(0,
|
|
37777
|
+
(0, import_react58.useEffect)(() => {
|
|
37663
37778
|
if (!onCancelWalletDeposit) return;
|
|
37664
37779
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "error") {
|
|
37665
37780
|
walletSubmitInFlightRef.current = false;
|
|
@@ -38002,7 +38117,7 @@ var DepositModal = (props) => {
|
|
|
38002
38117
|
DepositModal.displayName = "DepositModal";
|
|
38003
38118
|
|
|
38004
38119
|
// src/withdraw/index.tsx
|
|
38005
|
-
var
|
|
38120
|
+
var import_react59 = require("react");
|
|
38006
38121
|
var import_withdraw = require("@agg-build/hooks/withdraw");
|
|
38007
38122
|
|
|
38008
38123
|
// src/withdraw/steps/withdraw-method.tsx
|
|
@@ -38534,14 +38649,14 @@ function WithdrawModalControlled({
|
|
|
38534
38649
|
onSelectWithdrawProvider,
|
|
38535
38650
|
onDoneWithdraw
|
|
38536
38651
|
}) {
|
|
38537
|
-
const [flowState, setFlowState] = (0,
|
|
38652
|
+
const [flowState, setFlowState] = (0, import_react59.useState)({
|
|
38538
38653
|
status: "form",
|
|
38539
38654
|
formStep: "method"
|
|
38540
38655
|
});
|
|
38541
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
38542
|
-
const [confirmError, setConfirmError] = (0,
|
|
38656
|
+
const [isConfirming, setIsConfirming] = (0, import_react59.useState)(false);
|
|
38657
|
+
const [confirmError, setConfirmError] = (0, import_react59.useState)(null);
|
|
38543
38658
|
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
|
|
38544
|
-
(0,
|
|
38659
|
+
(0, import_react59.useEffect)(() => {
|
|
38545
38660
|
if (!open) {
|
|
38546
38661
|
setFlowState({ status: "form", formStep: "method" });
|
|
38547
38662
|
setIsConfirming(false);
|
|
@@ -38549,7 +38664,7 @@ function WithdrawModalControlled({
|
|
|
38549
38664
|
resetWithdrawalLifecycle();
|
|
38550
38665
|
}
|
|
38551
38666
|
}, [open, resetWithdrawalLifecycle]);
|
|
38552
|
-
(0,
|
|
38667
|
+
(0, import_react59.useEffect)(() => {
|
|
38553
38668
|
if (flowState.status !== "loading") return;
|
|
38554
38669
|
if (!withdrawalLifecycleState.terminal) return;
|
|
38555
38670
|
if (withdrawalLifecycleState.status === "completed") {
|
|
@@ -38686,7 +38801,7 @@ WithdrawModal.displayName = "WithdrawModal";
|
|
|
38686
38801
|
var import_hooks103 = require("@agg-build/hooks");
|
|
38687
38802
|
|
|
38688
38803
|
// src/paper-trading/paper-onboarding-modal.tsx
|
|
38689
|
-
var
|
|
38804
|
+
var import_react60 = require("react");
|
|
38690
38805
|
var import_hooks102 = require("@agg-build/hooks");
|
|
38691
38806
|
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
38692
38807
|
var PaperOnboardingModal = ({
|
|
@@ -38697,8 +38812,8 @@ var PaperOnboardingModal = ({
|
|
|
38697
38812
|
}) => {
|
|
38698
38813
|
const labels = (0, import_hooks102.useLabels)();
|
|
38699
38814
|
const copy = labels.paperTrading.onboarding;
|
|
38700
|
-
const [stepIndex, setStepIndex] = (0,
|
|
38701
|
-
const steps = (0,
|
|
38815
|
+
const [stepIndex, setStepIndex] = (0, import_react60.useState)(0);
|
|
38816
|
+
const steps = (0, import_react60.useMemo)(
|
|
38702
38817
|
() => [
|
|
38703
38818
|
{
|
|
38704
38819
|
key: "realMarkets",
|
|
@@ -38725,17 +38840,17 @@ var PaperOnboardingModal = ({
|
|
|
38725
38840
|
const isFirst = stepIndex === 0;
|
|
38726
38841
|
const isLast = stepIndex === total - 1;
|
|
38727
38842
|
const step = steps[stepIndex];
|
|
38728
|
-
const handleBack = (0,
|
|
38843
|
+
const handleBack = (0, import_react60.useCallback)(() => {
|
|
38729
38844
|
setStepIndex((current) => Math.max(0, current - 1));
|
|
38730
38845
|
}, []);
|
|
38731
|
-
const handleNext = (0,
|
|
38846
|
+
const handleNext = (0, import_react60.useCallback)(() => {
|
|
38732
38847
|
if (isLast) {
|
|
38733
38848
|
onDismiss();
|
|
38734
38849
|
return;
|
|
38735
38850
|
}
|
|
38736
38851
|
setStepIndex((current) => Math.min(total - 1, current + 1));
|
|
38737
38852
|
}, [isLast, onDismiss, total]);
|
|
38738
|
-
const handleOpenChange = (0,
|
|
38853
|
+
const handleOpenChange = (0, import_react60.useCallback)(
|
|
38739
38854
|
(next) => {
|
|
38740
38855
|
if (next) return;
|
|
38741
38856
|
setStepIndex(0);
|
|
@@ -38867,9 +38982,9 @@ var PaperTradingOnboarding = ({
|
|
|
38867
38982
|
PaperTradingOnboarding.displayName = "PaperTradingOnboarding";
|
|
38868
38983
|
|
|
38869
38984
|
// src/profile/index.tsx
|
|
38870
|
-
var
|
|
38985
|
+
var import_react63 = require("react");
|
|
38871
38986
|
var import_hooks106 = require("@agg-build/hooks");
|
|
38872
|
-
var
|
|
38987
|
+
var import_sdk30 = require("@agg-build/sdk");
|
|
38873
38988
|
|
|
38874
38989
|
// src/profile/profile-modal.constants.ts
|
|
38875
38990
|
var PROFILE_TAB_KEYS = {
|
|
@@ -38886,7 +39001,7 @@ var getProfileTabItems = () => [
|
|
|
38886
39001
|
];
|
|
38887
39002
|
|
|
38888
39003
|
// src/profile/tabs/about-tab.tsx
|
|
38889
|
-
var
|
|
39004
|
+
var import_react61 = require("react");
|
|
38890
39005
|
var import_hooks104 = require("@agg-build/hooks");
|
|
38891
39006
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
38892
39007
|
var AboutTab = ({
|
|
@@ -38899,12 +39014,12 @@ var AboutTab = ({
|
|
|
38899
39014
|
avatarError: _avatarError
|
|
38900
39015
|
}) => {
|
|
38901
39016
|
const labels = (0, import_hooks104.useLabels)();
|
|
38902
|
-
const fileInputRef = (0,
|
|
38903
|
-
const handleAvatarClick = (0,
|
|
39017
|
+
const fileInputRef = (0, import_react61.useRef)(null);
|
|
39018
|
+
const handleAvatarClick = (0, import_react61.useCallback)(() => {
|
|
38904
39019
|
var _a;
|
|
38905
39020
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
38906
39021
|
}, []);
|
|
38907
|
-
const handleFileChange = (0,
|
|
39022
|
+
const handleFileChange = (0, import_react61.useCallback)(
|
|
38908
39023
|
(e) => {
|
|
38909
39024
|
var _a;
|
|
38910
39025
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -39174,7 +39289,7 @@ AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
|
39174
39289
|
|
|
39175
39290
|
// src/profile/tabs/trading-access-tab.tsx
|
|
39176
39291
|
var import_hooks105 = require("@agg-build/hooks");
|
|
39177
|
-
var
|
|
39292
|
+
var import_react62 = require("react");
|
|
39178
39293
|
var import_jsx_runtime217 = require("react/jsx-runtime");
|
|
39179
39294
|
var TRADING_ACCESS_VENUES = [
|
|
39180
39295
|
"kalshi",
|
|
@@ -39186,7 +39301,8 @@ var TRADING_ACCESS_VENUES = [
|
|
|
39186
39301
|
"myriad",
|
|
39187
39302
|
"hyperliquid",
|
|
39188
39303
|
"novig",
|
|
39189
|
-
"prophetx"
|
|
39304
|
+
"prophetx",
|
|
39305
|
+
"pred"
|
|
39190
39306
|
];
|
|
39191
39307
|
var TRADING_ACCESS_VENUE_ITEMS = TRADING_ACCESS_VENUES.map((id) => ({ id }));
|
|
39192
39308
|
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime217.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
@@ -39223,7 +39339,7 @@ var TradingAccessTab = ({
|
|
|
39223
39339
|
const labels = (0, import_hooks105.useLabels)();
|
|
39224
39340
|
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks105.useAppConfig)();
|
|
39225
39341
|
const { isLocationBlocked } = (0, import_hooks105.useGeoBlock)();
|
|
39226
|
-
const visibleVenues = (0,
|
|
39342
|
+
const visibleVenues = (0, import_react62.useMemo)(
|
|
39227
39343
|
() => (0, import_hooks105.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
|
|
39228
39344
|
[disabledVenues]
|
|
39229
39345
|
);
|
|
@@ -39302,28 +39418,28 @@ var ProfileModal = ({
|
|
|
39302
39418
|
const client = (0, import_hooks106.useAggClient)();
|
|
39303
39419
|
const { user } = (0, import_hooks106.useAggAuthState)();
|
|
39304
39420
|
const toastCtx = useOptionalToast();
|
|
39305
|
-
const [activeTab, setActiveTab] = (0,
|
|
39306
|
-
const profileTabItems = (0,
|
|
39421
|
+
const [activeTab, setActiveTab] = (0, import_react63.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
39422
|
+
const profileTabItems = (0, import_react63.useMemo)(() => getProfileTabItems(), []);
|
|
39307
39423
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
39308
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
39309
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
39310
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
39311
|
-
const [isSaving, setIsSaving] = (0,
|
|
39312
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
39313
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
39424
|
+
const [draftUsername, setDraftUsername] = (0, import_react63.useState)(resolvedInitialUsername);
|
|
39425
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react63.useState)();
|
|
39426
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react63.useState)();
|
|
39427
|
+
const [isSaving, setIsSaving] = (0, import_react63.useState)(false);
|
|
39428
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react63.useState)(null);
|
|
39429
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react63.useState)(false);
|
|
39314
39430
|
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks106.useVenueKeyStatus)(
|
|
39315
|
-
|
|
39431
|
+
import_sdk30.Venue.kalshi,
|
|
39316
39432
|
open
|
|
39317
39433
|
);
|
|
39318
|
-
(0,
|
|
39434
|
+
(0, import_react63.useEffect)(() => {
|
|
39319
39435
|
var _a2;
|
|
39320
39436
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
39321
39437
|
}, [username, user == null ? void 0 : user.username]);
|
|
39322
|
-
(0,
|
|
39438
|
+
(0, import_react63.useEffect)(() => {
|
|
39323
39439
|
if (open) return;
|
|
39324
39440
|
setIsConnectKalshiModalOpen(false);
|
|
39325
39441
|
}, [open]);
|
|
39326
|
-
const handleOpenChange = (0,
|
|
39442
|
+
const handleOpenChange = (0, import_react63.useCallback)(
|
|
39327
39443
|
(isOpen) => {
|
|
39328
39444
|
var _a2;
|
|
39329
39445
|
if (!isOpen) {
|
|
@@ -39347,7 +39463,7 @@ var ProfileModal = ({
|
|
|
39347
39463
|
setDraftAvatarPreview
|
|
39348
39464
|
]
|
|
39349
39465
|
);
|
|
39350
|
-
const handleDraftAvatarChange = (0,
|
|
39466
|
+
const handleDraftAvatarChange = (0, import_react63.useCallback)(
|
|
39351
39467
|
(file, preview) => {
|
|
39352
39468
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
39353
39469
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -39362,7 +39478,7 @@ var ProfileModal = ({
|
|
|
39362
39478
|
);
|
|
39363
39479
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
39364
39480
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
39365
|
-
const handleSave = (0,
|
|
39481
|
+
const handleSave = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39366
39482
|
var _a2, _b2, _c2;
|
|
39367
39483
|
setIsSaving(true);
|
|
39368
39484
|
try {
|
|
@@ -39417,16 +39533,16 @@ var ProfileModal = ({
|
|
|
39417
39533
|
originalUsername,
|
|
39418
39534
|
toastCtx
|
|
39419
39535
|
]);
|
|
39420
|
-
const handleCancel = (0,
|
|
39536
|
+
const handleCancel = (0, import_react63.useCallback)(() => {
|
|
39421
39537
|
handleOpenChange(false);
|
|
39422
39538
|
}, [handleOpenChange]);
|
|
39423
|
-
const handleVerifyKalshi = (0,
|
|
39539
|
+
const handleVerifyKalshi = (0, import_react63.useCallback)(
|
|
39424
39540
|
(credentials) => __async(null, null, function* () {
|
|
39425
39541
|
if (onConnectKalshi) {
|
|
39426
39542
|
yield onConnectKalshi(credentials);
|
|
39427
39543
|
} else {
|
|
39428
39544
|
yield client.upsertVenueKey({
|
|
39429
|
-
venue:
|
|
39545
|
+
venue: import_sdk30.Venue.kalshi,
|
|
39430
39546
|
credentials: {
|
|
39431
39547
|
keyId: credentials.apiKeyId,
|
|
39432
39548
|
privateKey: credentials.privateKey
|
|
@@ -39438,12 +39554,12 @@ var ProfileModal = ({
|
|
|
39438
39554
|
}),
|
|
39439
39555
|
[client, onConnectKalshi, refetchKalshiStatus]
|
|
39440
39556
|
);
|
|
39441
|
-
const handleDisconnectKalshi = (0,
|
|
39442
|
-
yield client.deleteVenueKey(
|
|
39557
|
+
const handleDisconnectKalshi = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39558
|
+
yield client.deleteVenueKey(import_sdk30.Venue.kalshi);
|
|
39443
39559
|
yield refetchKalshiStatus();
|
|
39444
|
-
onDisconnectExchange == null ? void 0 : onDisconnectExchange(
|
|
39560
|
+
onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk30.Venue.kalshi);
|
|
39445
39561
|
}), [client, onDisconnectExchange, refetchKalshiStatus]);
|
|
39446
|
-
const resolvedVenueAccounts = (0,
|
|
39562
|
+
const resolvedVenueAccounts = (0, import_react63.useMemo)(() => {
|
|
39447
39563
|
var _a2;
|
|
39448
39564
|
const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
|
|
39449
39565
|
if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
|
|
@@ -39452,7 +39568,7 @@ var ProfileModal = ({
|
|
|
39452
39568
|
...nonKalshiAccounts != null ? nonKalshiAccounts : [],
|
|
39453
39569
|
{
|
|
39454
39570
|
id: "kalshi-venue-key",
|
|
39455
|
-
venue:
|
|
39571
|
+
venue: import_sdk30.Venue.kalshi,
|
|
39456
39572
|
status: "active",
|
|
39457
39573
|
kycStatus: kalshiStatus.kycStatus
|
|
39458
39574
|
}
|
|
@@ -39499,7 +39615,7 @@ var ProfileModal = ({
|
|
|
39499
39615
|
if (typeof window === "undefined") return;
|
|
39500
39616
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
39501
39617
|
};
|
|
39502
|
-
const surfaceError = (0,
|
|
39618
|
+
const surfaceError = (0, import_react63.useCallback)(
|
|
39503
39619
|
(err, title2) => {
|
|
39504
39620
|
const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
|
|
39505
39621
|
if (toastCtx) {
|
|
@@ -39510,7 +39626,7 @@ var ProfileModal = ({
|
|
|
39510
39626
|
},
|
|
39511
39627
|
[toastCtx]
|
|
39512
39628
|
);
|
|
39513
|
-
const handleConnectTwitter = (0,
|
|
39629
|
+
const handleConnectTwitter = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39514
39630
|
try {
|
|
39515
39631
|
const result = yield client.linkAccount({
|
|
39516
39632
|
provider: "twitter",
|
|
@@ -39524,7 +39640,7 @@ var ProfileModal = ({
|
|
|
39524
39640
|
surfaceError(err, "Could not connect X (Twitter)");
|
|
39525
39641
|
}
|
|
39526
39642
|
}), [client, onConnectTwitter, surfaceError]);
|
|
39527
|
-
const handleConnectGoogle = (0,
|
|
39643
|
+
const handleConnectGoogle = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39528
39644
|
try {
|
|
39529
39645
|
const result = yield client.linkAccount({
|
|
39530
39646
|
provider: "google",
|
|
@@ -39538,7 +39654,7 @@ var ProfileModal = ({
|
|
|
39538
39654
|
surfaceError(err, "Could not connect Google");
|
|
39539
39655
|
}
|
|
39540
39656
|
}), [client, onConnectGoogle, surfaceError]);
|
|
39541
|
-
const handleConnectApple = (0,
|
|
39657
|
+
const handleConnectApple = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39542
39658
|
try {
|
|
39543
39659
|
const result = yield client.linkAccount({
|
|
39544
39660
|
provider: "apple",
|
|
@@ -39552,7 +39668,7 @@ var ProfileModal = ({
|
|
|
39552
39668
|
surfaceError(err, "Could not connect Apple");
|
|
39553
39669
|
}
|
|
39554
39670
|
}), [client, onConnectApple, surfaceError]);
|
|
39555
|
-
const handleDisconnectTwitter = (0,
|
|
39671
|
+
const handleDisconnectTwitter = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39556
39672
|
try {
|
|
39557
39673
|
yield client.disconnectAccount("twitter");
|
|
39558
39674
|
yield client.getCurrentUser();
|
|
@@ -39561,7 +39677,7 @@ var ProfileModal = ({
|
|
|
39561
39677
|
surfaceError(err, "Could not disconnect X (Twitter)");
|
|
39562
39678
|
}
|
|
39563
39679
|
}), [client, onDisconnectTwitter, surfaceError]);
|
|
39564
|
-
const handleDisconnectGoogle = (0,
|
|
39680
|
+
const handleDisconnectGoogle = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39565
39681
|
try {
|
|
39566
39682
|
yield client.disconnectAccount("google");
|
|
39567
39683
|
yield client.getCurrentUser();
|
|
@@ -39570,7 +39686,7 @@ var ProfileModal = ({
|
|
|
39570
39686
|
surfaceError(err, "Could not disconnect Google");
|
|
39571
39687
|
}
|
|
39572
39688
|
}), [client, onDisconnectGoogle, surfaceError]);
|
|
39573
|
-
const handleDisconnectApple = (0,
|
|
39689
|
+
const handleDisconnectApple = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39574
39690
|
try {
|
|
39575
39691
|
yield client.disconnectAccount("apple");
|
|
39576
39692
|
yield client.getCurrentUser();
|
|
@@ -39579,7 +39695,7 @@ var ProfileModal = ({
|
|
|
39579
39695
|
surfaceError(err, "Could not disconnect Apple");
|
|
39580
39696
|
}
|
|
39581
39697
|
}), [client, onDisconnectApple, surfaceError]);
|
|
39582
|
-
const handleConnectEmail = (0,
|
|
39698
|
+
const handleConnectEmail = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39583
39699
|
var _a2;
|
|
39584
39700
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
39585
39701
|
if (!typedEmail) return;
|
|
@@ -39598,7 +39714,7 @@ var ProfileModal = ({
|
|
|
39598
39714
|
surfaceError(err, "Could not connect email");
|
|
39599
39715
|
}
|
|
39600
39716
|
}), [client, onConnectEmail, surfaceError, toastCtx]);
|
|
39601
|
-
const handleDisconnectWallet = (0,
|
|
39717
|
+
const handleDisconnectWallet = (0, import_react63.useCallback)(
|
|
39602
39718
|
(wallet) => __async(null, null, function* () {
|
|
39603
39719
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
39604
39720
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -39612,7 +39728,7 @@ var ProfileModal = ({
|
|
|
39612
39728
|
}),
|
|
39613
39729
|
[client, onDisconnectWallet, surfaceError]
|
|
39614
39730
|
);
|
|
39615
|
-
const providerActionMap = (0,
|
|
39731
|
+
const providerActionMap = (0, import_react63.useMemo)(
|
|
39616
39732
|
() => ({
|
|
39617
39733
|
twitter: {
|
|
39618
39734
|
connect: () => {
|
|
@@ -39654,7 +39770,7 @@ var ProfileModal = ({
|
|
|
39654
39770
|
handleDisconnectTwitter
|
|
39655
39771
|
]
|
|
39656
39772
|
);
|
|
39657
|
-
const resolvedWallets = (0,
|
|
39773
|
+
const resolvedWallets = (0, import_react63.useMemo)(() => {
|
|
39658
39774
|
var _a2, _b2;
|
|
39659
39775
|
if (wallets) return wallets;
|
|
39660
39776
|
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
@@ -39819,7 +39935,7 @@ ProfileModal.displayName = "ProfileModal";
|
|
|
39819
39935
|
|
|
39820
39936
|
// src/geo-block-modal/index.tsx
|
|
39821
39937
|
var import_hooks107 = require("@agg-build/hooks");
|
|
39822
|
-
var
|
|
39938
|
+
var import_react64 = require("react");
|
|
39823
39939
|
var import_jsx_runtime219 = require("react/jsx-runtime");
|
|
39824
39940
|
var GeoBlockModal = ({
|
|
39825
39941
|
open,
|
|
@@ -39828,7 +39944,7 @@ var GeoBlockModal = ({
|
|
|
39828
39944
|
classNames
|
|
39829
39945
|
}) => {
|
|
39830
39946
|
const labels = (0, import_hooks107.useLabels)();
|
|
39831
|
-
const handleConfirm = (0,
|
|
39947
|
+
const handleConfirm = (0, import_react64.useCallback)(() => {
|
|
39832
39948
|
onConfirm == null ? void 0 : onConfirm();
|
|
39833
39949
|
onOpenChange(false);
|
|
39834
39950
|
}, [onConfirm, onOpenChange]);
|