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