@agg-build/ui 4.17.0 → 4.17.3
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-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-M6U2RKBD.mjs → chunk-DSQSQ4RG.mjs} +127 -62
- 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 +1060 -930
- package/dist/index.mjs +9 -38
- package/dist/modals.js +212 -184
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +841 -684
- 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/cost-basis-display.d.mts +29 -0
- package/dist/types/pages/user-profile/cost-basis-display.d.ts +29 -0
- 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 })
|
|
20940
|
-
] }),
|
|
20941
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
20942
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
20943
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsx)("br", {}),
|
|
20944
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
20945
|
-
] })
|
|
20946
|
-
] }),
|
|
20947
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
20948
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
20949
|
-
/* @__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 }),
|
|
20950
|
-
/* @__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 })
|
|
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 })
|
|
20951
20910
|
] }),
|
|
20952
|
-
/* @__PURE__ */ (0, import_jsx_runtime172.
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
children: labels.onboarding.connectKalshiModal.
|
|
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,31 @@ 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");
|
|
31830
|
+
|
|
31831
|
+
// src/pages/user-profile/cost-basis-display.ts
|
|
31832
|
+
function costBasisDisplay(outcome) {
|
|
31833
|
+
if (outcome.costBasisUnknown === true) {
|
|
31834
|
+
return {
|
|
31835
|
+
averagePriceCents: null,
|
|
31836
|
+
averagePrice: null,
|
|
31837
|
+
totalTradedValue: null,
|
|
31838
|
+
costUnknown: true
|
|
31839
|
+
};
|
|
31840
|
+
}
|
|
31841
|
+
return {
|
|
31842
|
+
averagePriceCents: Math.round(outcome.avgEntryPrice * 100),
|
|
31843
|
+
averagePrice: outcome.avgEntryPrice,
|
|
31844
|
+
totalTradedValue: outcome.avgEntryPrice * outcome.totalSize,
|
|
31845
|
+
costUnknown: false
|
|
31846
|
+
};
|
|
31847
|
+
}
|
|
31764
31848
|
|
|
31765
31849
|
// src/pages/user-profile/components/available-balance-card.tsx
|
|
31766
31850
|
var import_hooks80 = require("@agg-build/hooks");
|
|
31767
|
-
var
|
|
31851
|
+
var import_sdk26 = require("@agg-build/sdk");
|
|
31768
31852
|
var import_jsx_runtime186 = require("react/jsx-runtime");
|
|
31769
31853
|
var BASE_URL = "https://assets.snagsolutions.io";
|
|
31770
31854
|
var CHAIN_ID_TO_ICON_URL = {
|
|
@@ -31783,8 +31867,8 @@ var CHAIN_ID_TO_ICON_URL = {
|
|
|
31783
31867
|
"2741": `${BASE_URL}/public/prediction-markets/logos/Abstract.svg`,
|
|
31784
31868
|
"792703809": `${BASE_URL}/public/prediction-markets/logos/Solana.svg`
|
|
31785
31869
|
};
|
|
31786
|
-
var venueLogosForChain = (chainId) =>
|
|
31787
|
-
var isVenueBalanceChain = (chainId) => Object.values(
|
|
31870
|
+
var venueLogosForChain = (chainId) => import_sdk26.ACTIVE_VENUES.filter((venue) => import_sdk26.VENUE_CHAIN_IDS[venue] === Number(chainId));
|
|
31871
|
+
var isVenueBalanceChain = (chainId) => Object.values(import_sdk26.VENUE_CHAIN_IDS).includes(Number(chainId));
|
|
31788
31872
|
var isPaperChain = (row) => {
|
|
31789
31873
|
return row.key === "0" || row.label.trim().toLowerCase() === "paper";
|
|
31790
31874
|
};
|
|
@@ -31808,6 +31892,7 @@ var AvailableBalanceCard = ({
|
|
|
31808
31892
|
label: label2,
|
|
31809
31893
|
valueLabel,
|
|
31810
31894
|
reservedValueLabel,
|
|
31895
|
+
kalshiValueLabel,
|
|
31811
31896
|
chains,
|
|
31812
31897
|
isLoading = false,
|
|
31813
31898
|
className,
|
|
@@ -31960,6 +32045,13 @@ var AvailableBalanceCard = ({
|
|
|
31960
32045
|
}
|
|
31961
32046
|
)
|
|
31962
32047
|
] }),
|
|
32048
|
+
kalshiValueLabel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)("div", { className: "agg-balance-kalshi flex items-center justify-between gap-3", children: [
|
|
32049
|
+
/* @__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 }),
|
|
32050
|
+
/* @__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: [
|
|
32051
|
+
/* @__PURE__ */ (0, import_jsx_runtime186.jsx)(VenueLogo, { venue: "kalshi", size: "small", className: "size-3" }),
|
|
32052
|
+
/* @__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 })
|
|
32053
|
+
] })
|
|
32054
|
+
] }) : null,
|
|
31963
32055
|
!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
32056
|
]
|
|
31965
32057
|
}
|
|
@@ -31969,20 +32061,20 @@ AvailableBalanceCard.displayName = "AvailableBalanceCard";
|
|
|
31969
32061
|
|
|
31970
32062
|
// src/pages/user-profile/components/claim-activity-breakdown-modal.tsx
|
|
31971
32063
|
var import_hooks81 = require("@agg-build/hooks");
|
|
31972
|
-
var
|
|
32064
|
+
var import_sdk27 = require("@agg-build/sdk");
|
|
31973
32065
|
var import_jsx_runtime187 = require("react/jsx-runtime");
|
|
31974
32066
|
var CLAIM_VENUE_LABELS = {
|
|
31975
|
-
[
|
|
31976
|
-
[
|
|
31977
|
-
[
|
|
31978
|
-
[
|
|
31979
|
-
[
|
|
31980
|
-
[
|
|
31981
|
-
[
|
|
31982
|
-
[
|
|
31983
|
-
[
|
|
31984
|
-
[
|
|
31985
|
-
[
|
|
32067
|
+
[import_sdk27.Venue.kalshi]: "Kalshi",
|
|
32068
|
+
[import_sdk27.Venue.polymarket]: "Polymarket",
|
|
32069
|
+
[import_sdk27.Venue.limitless]: "Limitless",
|
|
32070
|
+
[import_sdk27.Venue.opinion]: "Opinion",
|
|
32071
|
+
[import_sdk27.Venue.predict]: "Predict",
|
|
32072
|
+
[import_sdk27.Venue.pred]: "PRED",
|
|
32073
|
+
[import_sdk27.Venue.probable]: "Probable",
|
|
32074
|
+
[import_sdk27.Venue.myriad]: "Myriad",
|
|
32075
|
+
[import_sdk27.Venue.hyperliquid]: "Hyperliquid",
|
|
32076
|
+
[import_sdk27.Venue.novig]: "Novig",
|
|
32077
|
+
[import_sdk27.Venue.prophetx]: "ProphetX"
|
|
31986
32078
|
};
|
|
31987
32079
|
var ClaimActivityBreakdownModal = ({
|
|
31988
32080
|
activity,
|
|
@@ -32100,9 +32192,9 @@ var ClaimActivityBreakdownModal = ({
|
|
|
32100
32192
|
|
|
32101
32193
|
// src/pages/user-profile/components/manage-balances-modal.tsx
|
|
32102
32194
|
var import_hooks82 = require("@agg-build/hooks");
|
|
32103
|
-
var
|
|
32195
|
+
var import_sdk28 = require("@agg-build/sdk");
|
|
32104
32196
|
var Dialog9 = __toESM(require("@radix-ui/react-dialog"));
|
|
32105
|
-
var
|
|
32197
|
+
var import_react53 = require("react");
|
|
32106
32198
|
var import_zod3 = require("zod");
|
|
32107
32199
|
var import_jsx_runtime188 = require("react/jsx-runtime");
|
|
32108
32200
|
var USDC_DECIMALS = 6;
|
|
@@ -32118,17 +32210,17 @@ var NETWORK_ORDER = {
|
|
|
32118
32210
|
1: 6
|
|
32119
32211
|
};
|
|
32120
32212
|
var VENUE_LABELS = {
|
|
32121
|
-
[
|
|
32122
|
-
[
|
|
32123
|
-
[
|
|
32124
|
-
[
|
|
32125
|
-
[
|
|
32126
|
-
[
|
|
32127
|
-
[
|
|
32128
|
-
[
|
|
32129
|
-
[
|
|
32130
|
-
[
|
|
32131
|
-
[
|
|
32213
|
+
[import_sdk28.Venue.kalshi]: "Kalshi",
|
|
32214
|
+
[import_sdk28.Venue.limitless]: "Limitless",
|
|
32215
|
+
[import_sdk28.Venue.opinion]: "Opinion",
|
|
32216
|
+
[import_sdk28.Venue.polymarket]: "Polymarket",
|
|
32217
|
+
[import_sdk28.Venue.predict]: "Predict",
|
|
32218
|
+
[import_sdk28.Venue.pred]: "PRED",
|
|
32219
|
+
[import_sdk28.Venue.probable]: "Probable",
|
|
32220
|
+
[import_sdk28.Venue.myriad]: "Myriad",
|
|
32221
|
+
[import_sdk28.Venue.hyperliquid]: "Hyperliquid",
|
|
32222
|
+
[import_sdk28.Venue.novig]: "Novig",
|
|
32223
|
+
[import_sdk28.Venue.prophetx]: "ProphetX"
|
|
32132
32224
|
};
|
|
32133
32225
|
var amountSchema = import_zod3.z.string().min(1).regex(FINAL_AMOUNT_PATTERN);
|
|
32134
32226
|
var decimalToRaw = (value, decimals = USDC_DECIMALS) => {
|
|
@@ -32162,9 +32254,9 @@ var areDraftsEqual = (current, initial) => {
|
|
|
32162
32254
|
};
|
|
32163
32255
|
var getPolicyMaximumRaw = (policy) => {
|
|
32164
32256
|
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 :
|
|
32257
|
+
return (0, import_sdk28.getBalanceRefillMaximumRaw)(
|
|
32258
|
+
(_a = policy == null ? void 0 : policy.dailyCapRaw) != null ? _a : import_sdk28.DEFAULT_BALANCE_REFILL_DAILY_CAP_RAW,
|
|
32259
|
+
(_b = policy == null ? void 0 : policy.maxFeeRaw) != null ? _b : import_sdk28.DEFAULT_BALANCE_REFILL_MAX_FEE_RAW
|
|
32168
32260
|
);
|
|
32169
32261
|
};
|
|
32170
32262
|
var getApiFieldErrors = (error) => {
|
|
@@ -32186,16 +32278,16 @@ var ManageBalancesModal = ({
|
|
|
32186
32278
|
const depositAddressesQuery = (0, import_hooks82.useDepositAddresses)({ enabled: open });
|
|
32187
32279
|
const policiesQuery = (0, import_hooks82.useBalanceRefillPolicies)({ enabled: open });
|
|
32188
32280
|
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,
|
|
32281
|
+
const descriptionId = (0, import_react53.useId)();
|
|
32282
|
+
const savingRef = (0, import_react53.useRef)(false);
|
|
32283
|
+
const [expandedChainIds, setExpandedChainIds] = (0, import_react53.useState)(/* @__PURE__ */ new Set());
|
|
32284
|
+
const [resetChainIds, setResetChainIds] = (0, import_react53.useState)(/* @__PURE__ */ new Set());
|
|
32285
|
+
const [drafts, setDrafts] = (0, import_react53.useState)({});
|
|
32286
|
+
const [initialDrafts, setInitialDrafts] = (0, import_react53.useState)({});
|
|
32287
|
+
const [submissionErrors, setSubmissionErrors] = (0, import_react53.useState)({});
|
|
32288
|
+
const [isInitialized, setIsInitialized] = (0, import_react53.useState)(false);
|
|
32289
|
+
const [isSaving, setIsSaving] = (0, import_react53.useState)(false);
|
|
32290
|
+
const networks = (0, import_react53.useMemo)(() => {
|
|
32199
32291
|
var _a, _b, _c;
|
|
32200
32292
|
const supportedChains = (_a = depositAddressesQuery.supportedChains) != null ? _a : [];
|
|
32201
32293
|
const availableBalanceBreakdown = (_c = (_b = balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown) != null ? _c : [];
|
|
@@ -32235,7 +32327,7 @@ var ManageBalancesModal = ({
|
|
|
32235
32327
|
const hasPoliciesLoadError = policiesQuery.isError && policiesQuery.data === void 0;
|
|
32236
32328
|
const loadError = hasDepositAddressesLoadError ? depositAddressesQuery.error : hasPoliciesLoadError ? policiesQuery.error : balanceState.error;
|
|
32237
32329
|
const hasLoadError = hasDepositAddressesLoadError || hasPoliciesLoadError || Boolean(balanceState.error);
|
|
32238
|
-
(0,
|
|
32330
|
+
(0, import_react53.useEffect)(() => {
|
|
32239
32331
|
if (open) return;
|
|
32240
32332
|
setExpandedChainIds(/* @__PURE__ */ new Set());
|
|
32241
32333
|
setResetChainIds(/* @__PURE__ */ new Set());
|
|
@@ -32246,7 +32338,7 @@ var ManageBalancesModal = ({
|
|
|
32246
32338
|
setIsSaving(false);
|
|
32247
32339
|
savingRef.current = false;
|
|
32248
32340
|
}, [open]);
|
|
32249
|
-
(0,
|
|
32341
|
+
(0, import_react53.useEffect)(() => {
|
|
32250
32342
|
if (!open || isLoading || hasLoadError || isInitialized) return;
|
|
32251
32343
|
const nextDrafts = Object.fromEntries(
|
|
32252
32344
|
networks.map((network) => [network.chainId, getInitialDraft(network.policy)])
|
|
@@ -32255,7 +32347,7 @@ var ManageBalancesModal = ({
|
|
|
32255
32347
|
setInitialDrafts(nextDrafts);
|
|
32256
32348
|
setIsInitialized(true);
|
|
32257
32349
|
}, [hasLoadError, isInitialized, isLoading, networks, open]);
|
|
32258
|
-
const validateDraft = (0,
|
|
32350
|
+
const validateDraft = (0, import_react53.useCallback)(
|
|
32259
32351
|
(network, draft) => {
|
|
32260
32352
|
const errors = {};
|
|
32261
32353
|
const minimum = draft.minimum.trim();
|
|
@@ -32289,7 +32381,7 @@ var ManageBalancesModal = ({
|
|
|
32289
32381
|
},
|
|
32290
32382
|
[refillLabels]
|
|
32291
32383
|
);
|
|
32292
|
-
const dirtyNetworks = (0,
|
|
32384
|
+
const dirtyNetworks = (0, import_react53.useMemo)(
|
|
32293
32385
|
() => networks.filter((network) => {
|
|
32294
32386
|
if (!network.canManageBalance) return false;
|
|
32295
32387
|
if (resetChainIds.has(network.chainId)) return true;
|
|
@@ -32300,7 +32392,7 @@ var ManageBalancesModal = ({
|
|
|
32300
32392
|
}),
|
|
32301
32393
|
[drafts, initialDrafts, networks, resetChainIds]
|
|
32302
32394
|
);
|
|
32303
|
-
const validationErrors = (0,
|
|
32395
|
+
const validationErrors = (0, import_react53.useMemo)(
|
|
32304
32396
|
() => Object.fromEntries(
|
|
32305
32397
|
dirtyNetworks.map((network) => {
|
|
32306
32398
|
var _a;
|
|
@@ -32316,14 +32408,14 @@ var ManageBalancesModal = ({
|
|
|
32316
32408
|
(errors) => errors.minimum || errors.refillTo || errors.general
|
|
32317
32409
|
);
|
|
32318
32410
|
const isSaveDisabled = dirtyNetworks.length === 0 || hasValidationErrors || isSaving;
|
|
32319
|
-
const handleOpenChange = (0,
|
|
32411
|
+
const handleOpenChange = (0, import_react53.useCallback)(
|
|
32320
32412
|
(nextOpen) => {
|
|
32321
32413
|
if (isSaving && !nextOpen) return;
|
|
32322
32414
|
onOpenChange(nextOpen);
|
|
32323
32415
|
},
|
|
32324
32416
|
[isSaving, onOpenChange]
|
|
32325
32417
|
);
|
|
32326
|
-
const handleToggleNetwork = (0,
|
|
32418
|
+
const handleToggleNetwork = (0, import_react53.useCallback)((chainId, canManageBalance) => {
|
|
32327
32419
|
if (!canManageBalance) return;
|
|
32328
32420
|
setExpandedChainIds((current) => {
|
|
32329
32421
|
const next = new Set(current);
|
|
@@ -32332,7 +32424,7 @@ var ManageBalancesModal = ({
|
|
|
32332
32424
|
return next;
|
|
32333
32425
|
});
|
|
32334
32426
|
}, []);
|
|
32335
|
-
const handleDraftChange = (0,
|
|
32427
|
+
const handleDraftChange = (0, import_react53.useCallback)(
|
|
32336
32428
|
(chainId, field, value) => {
|
|
32337
32429
|
if (!EDITABLE_AMOUNT_PATTERN.test(value)) return;
|
|
32338
32430
|
setDrafts((current) => {
|
|
@@ -32361,7 +32453,7 @@ var ManageBalancesModal = ({
|
|
|
32361
32453
|
},
|
|
32362
32454
|
[]
|
|
32363
32455
|
);
|
|
32364
|
-
const handleResetNetwork = (0,
|
|
32456
|
+
const handleResetNetwork = (0, import_react53.useCallback)((network) => {
|
|
32365
32457
|
setDrafts((current) => __spreadProps(__spreadValues({}, current), {
|
|
32366
32458
|
[network.chainId]: { minimum: "0", refillTo: "0" }
|
|
32367
32459
|
}));
|
|
@@ -32377,7 +32469,7 @@ var ManageBalancesModal = ({
|
|
|
32377
32469
|
return __spreadProps(__spreadValues({}, current), { [network.chainId]: {} });
|
|
32378
32470
|
});
|
|
32379
32471
|
}, []);
|
|
32380
|
-
const handleAmountBlur = (0,
|
|
32472
|
+
const handleAmountBlur = (0, import_react53.useCallback)((chainId, field) => {
|
|
32381
32473
|
setDrafts((current) => {
|
|
32382
32474
|
const currentDraft = current[chainId];
|
|
32383
32475
|
if (!currentDraft) return current;
|
|
@@ -32388,12 +32480,12 @@ var ManageBalancesModal = ({
|
|
|
32388
32480
|
});
|
|
32389
32481
|
});
|
|
32390
32482
|
}, []);
|
|
32391
|
-
const handleRetry = (0,
|
|
32483
|
+
const handleRetry = (0, import_react53.useCallback)(() => {
|
|
32392
32484
|
void depositAddressesQuery.refetch();
|
|
32393
32485
|
void policiesQuery.refetch();
|
|
32394
32486
|
balanceState.refetch();
|
|
32395
32487
|
}, [balanceState, depositAddressesQuery, policiesQuery]);
|
|
32396
|
-
const handleSave = (0,
|
|
32488
|
+
const handleSave = (0, import_react53.useCallback)(() => __async(null, null, function* () {
|
|
32397
32489
|
if (savingRef.current || isSaveDisabled) return;
|
|
32398
32490
|
savingRef.current = true;
|
|
32399
32491
|
setIsSaving(true);
|
|
@@ -32806,7 +32898,7 @@ ManageBalancesModal.displayName = "ManageBalancesModal";
|
|
|
32806
32898
|
|
|
32807
32899
|
// src/pages/user-profile/components/positions-activity.tsx
|
|
32808
32900
|
var import_hooks85 = require("@agg-build/hooks");
|
|
32809
|
-
var
|
|
32901
|
+
var import_react54 = require("react");
|
|
32810
32902
|
|
|
32811
32903
|
// src/pages/user-profile/user-profile.constants.ts
|
|
32812
32904
|
var USER_PROFILE_TAB_POSITIONS = "positions";
|
|
@@ -32885,6 +32977,7 @@ var resolvePositionStatus = (position) => {
|
|
|
32885
32977
|
return "open";
|
|
32886
32978
|
};
|
|
32887
32979
|
var resolvePositionBucket = (position) => {
|
|
32980
|
+
if (position.status === "closed") return "closed";
|
|
32888
32981
|
const status = resolvePositionStatus(position);
|
|
32889
32982
|
if (status === "won_unclaimed") return "active";
|
|
32890
32983
|
if (status === "open") return "active";
|
|
@@ -33661,6 +33754,18 @@ var OpenOrderRow = ({
|
|
|
33661
33754
|
};
|
|
33662
33755
|
const canCancel = canCancelOpenOrder(order);
|
|
33663
33756
|
const isPending = isPendingOpenOrder(order);
|
|
33757
|
+
const sideLabel = order.side === "buy" ? labels.buy : order.side === "sell" ? labels.sell : void 0;
|
|
33758
|
+
const outcomePillLabel = sideLabel ? `${sideLabel} ${order.outcomeLabel}` : order.outcomeLabel;
|
|
33759
|
+
const currentPriceLabel = order.currentPriceLabel ? `${labels.nowPrefix} ${order.currentPriceLabel}` : void 0;
|
|
33760
|
+
const mobileStats = [
|
|
33761
|
+
__spreadValues({
|
|
33762
|
+
label: resolvedLimitPriceHeader,
|
|
33763
|
+
value: (_a = order.limitPriceLabel) != null ? _a : "\u2014"
|
|
33764
|
+
}, currentPriceLabel ? { subValue: currentPriceLabel } : {}),
|
|
33765
|
+
{ label: resolvedFilledHeader, value: order.filledLabel },
|
|
33766
|
+
{ label: resolvedTotalHeader, value: order.valueLabel },
|
|
33767
|
+
{ label: resolvedExpirationHeader, value: (_b = order.expirationLabel) != null ? _b : "\u2014" }
|
|
33768
|
+
];
|
|
33664
33769
|
const Wrapper = href ? "a" : "div";
|
|
33665
33770
|
const wrapperProps = href ? {
|
|
33666
33771
|
href,
|
|
@@ -33699,22 +33804,23 @@ var OpenOrderRow = ({
|
|
|
33699
33804
|
) }),
|
|
33700
33805
|
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col justify-center gap-2", children: [
|
|
33701
33806
|
/* @__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:
|
|
33807
|
+
/* @__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
33808
|
] })
|
|
33704
33809
|
] }),
|
|
33705
33810
|
/* @__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 })
|
|
33811
|
+
/* @__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 }) }),
|
|
33812
|
+
mobileStats.map(({ label: label2, value, subValue }) => /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
33813
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsxs)("div", { className: "flex items-baseline gap-1.5 whitespace-nowrap", children: [
|
|
33814
|
+
/* @__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 }),
|
|
33815
|
+
/* @__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 })
|
|
33816
|
+
] }),
|
|
33817
|
+
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
33818
|
] }, label2))
|
|
33716
33819
|
] }),
|
|
33717
|
-
/* @__PURE__ */ (0, import_jsx_runtime191.
|
|
33820
|
+
/* @__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: [
|
|
33821
|
+
/* @__PURE__ */ (0, import_jsx_runtime191.jsx)("p", { className: "agg-type-body-strong text-agg-foreground", children: (_c = order.limitPriceLabel) != null ? _c : "\u2014" }),
|
|
33822
|
+
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
|
|
33823
|
+
] }),
|
|
33718
33824
|
/* @__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
33825
|
/* @__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
33826
|
/* @__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 +33911,8 @@ var ResultBadge = ({
|
|
|
33805
33911
|
status,
|
|
33806
33912
|
labels
|
|
33807
33913
|
}) => {
|
|
33808
|
-
|
|
33809
|
-
|
|
33914
|
+
const isWon = status === "won_claimed" || status === "won_unclaimed";
|
|
33915
|
+
if (!isWon && status !== "lost" && status !== "sold") return null;
|
|
33810
33916
|
const isSold = status === "sold";
|
|
33811
33917
|
return /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(
|
|
33812
33918
|
"span",
|
|
@@ -34072,7 +34178,7 @@ var getTabItems = (tabsLabels, showOpenOrders) => [
|
|
|
34072
34178
|
...showOpenOrders ? [{ value: USER_PROFILE_TAB_OPEN_ORDERS, label: tabsLabels.openOrders }] : [],
|
|
34073
34179
|
{ value: USER_PROFILE_TAB_ACTIVITY, label: tabsLabels.activity }
|
|
34074
34180
|
];
|
|
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)(
|
|
34181
|
+
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
34182
|
/* @__PURE__ */ (0, import_jsx_runtime193.jsx)("div", { className: "h-14 rounded-agg-sm bg-agg-secondary-hover/80 sm:h-16" }, index),
|
|
34077
34183
|
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
34184
|
] }, index)) });
|
|
@@ -34120,12 +34226,12 @@ var PositionsActivity = ({
|
|
|
34120
34226
|
const positionsLabels = userProfileLabels.positions;
|
|
34121
34227
|
const openOrdersLabels = userProfileLabels.openOrders;
|
|
34122
34228
|
const { formatCurrency: formatCurrency2, formatPrice } = (0, import_hooks85.useAggUiConfig)().formatting;
|
|
34123
|
-
const tabItems = (0,
|
|
34229
|
+
const tabItems = (0, import_react54.useMemo)(
|
|
34124
34230
|
() => getTabItems(userProfileLabels.tabs, showOpenOrders),
|
|
34125
34231
|
[showOpenOrders, userProfileLabels.tabs]
|
|
34126
34232
|
);
|
|
34127
34233
|
const isTabControlled = tab !== void 0;
|
|
34128
|
-
const [internalActiveTab, setInternalActiveTab] = (0,
|
|
34234
|
+
const [internalActiveTab, setInternalActiveTab] = (0, import_react54.useState)(
|
|
34129
34235
|
tab != null ? tab : USER_PROFILE_TAB_POSITIONS
|
|
34130
34236
|
);
|
|
34131
34237
|
const requestedActiveTab = isTabControlled ? tab : internalActiveTab;
|
|
@@ -34135,21 +34241,21 @@ var PositionsActivity = ({
|
|
|
34135
34241
|
if (!isTabControlled) setInternalActiveTab(next);
|
|
34136
34242
|
onTabChange == null ? void 0 : onTabChange(next);
|
|
34137
34243
|
};
|
|
34138
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
34139
|
-
const [searchValue, setSearchValue] = (0,
|
|
34140
|
-
const [isSearchFocused, setIsSearchFocused] = (0,
|
|
34141
|
-
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0,
|
|
34244
|
+
const [positionFilter, setPositionFilter] = (0, import_react54.useState)(initialPositionFilter);
|
|
34245
|
+
const [searchValue, setSearchValue] = (0, import_react54.useState)("");
|
|
34246
|
+
const [isSearchFocused, setIsSearchFocused] = (0, import_react54.useState)(false);
|
|
34247
|
+
const [locallyClaimedPositionIds, setLocallyClaimedPositionIds] = (0, import_react54.useState)(
|
|
34142
34248
|
() => /* @__PURE__ */ new Set()
|
|
34143
34249
|
);
|
|
34144
|
-
const positionsLoadMoreRef = (0,
|
|
34145
|
-
const openOrdersLoadMoreRef = (0,
|
|
34146
|
-
const activitiesLoadMoreRef = (0,
|
|
34147
|
-
const rowsScrollRef = (0,
|
|
34250
|
+
const positionsLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34251
|
+
const openOrdersLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34252
|
+
const activitiesLoadMoreRef = (0, import_react54.useRef)(null);
|
|
34253
|
+
const rowsScrollRef = (0, import_react54.useRef)(null);
|
|
34148
34254
|
const isPositionsTab = activeTab === USER_PROFILE_TAB_POSITIONS;
|
|
34149
34255
|
const isOpenOrdersTab = activeTab === USER_PROFILE_TAB_OPEN_ORDERS;
|
|
34150
34256
|
const isActivityTab = activeTab === USER_PROFILE_TAB_ACTIVITY;
|
|
34151
34257
|
const isClosedPositionsFilter = isPositionsTab && positionFilter === "closed";
|
|
34152
|
-
const positionsForCurrentFilter = (0,
|
|
34258
|
+
const positionsForCurrentFilter = (0, import_react54.useMemo)(() => {
|
|
34153
34259
|
if (positionFilter === "active") {
|
|
34154
34260
|
return activePositions.filter((position) => !locallyClaimedPositionIds.has(position.id));
|
|
34155
34261
|
}
|
|
@@ -34166,7 +34272,7 @@ var PositionsActivity = ({
|
|
|
34166
34272
|
}
|
|
34167
34273
|
return Array.from(byId.values());
|
|
34168
34274
|
}, [activePositions, closedPositions, locallyClaimedPositionIds, positionFilter]);
|
|
34169
|
-
const filteredPositions = (0,
|
|
34275
|
+
const filteredPositions = (0, import_react54.useMemo)(() => {
|
|
34170
34276
|
if (!searchValue.trim()) return positionsForCurrentFilter;
|
|
34171
34277
|
const q = searchValue.toLowerCase();
|
|
34172
34278
|
return positionsForCurrentFilter.filter((p) => p.title.toLowerCase().includes(q));
|
|
@@ -34191,7 +34297,7 @@ var PositionsActivity = ({
|
|
|
34191
34297
|
const isLoadingMorePositions = positionFilter === "active" ? isLoadingMoreActivePositions : isLoadingMoreClosedPositions;
|
|
34192
34298
|
const loadMorePositions = positionFilter === "active" ? onLoadMoreActivePositions : onLoadMoreClosedPositions;
|
|
34193
34299
|
const filteredActivities = activities;
|
|
34194
|
-
const searchResults = (0,
|
|
34300
|
+
const searchResults = (0, import_react54.useMemo)(() => {
|
|
34195
34301
|
if (!isPositionsTab || !searchValue.trim()) return [];
|
|
34196
34302
|
return filteredPositions.slice(0, 5).map((position) => ({
|
|
34197
34303
|
id: position.id,
|
|
@@ -34220,11 +34326,11 @@ var PositionsActivity = ({
|
|
|
34220
34326
|
const handleSearchChange = (event) => {
|
|
34221
34327
|
setSearchValue(event.target.value);
|
|
34222
34328
|
};
|
|
34223
|
-
(0,
|
|
34329
|
+
(0, import_react54.useEffect)(() => {
|
|
34224
34330
|
if (isPositionsTab) return;
|
|
34225
34331
|
setIsSearchFocused(false);
|
|
34226
34332
|
}, [isPositionsTab]);
|
|
34227
|
-
(0,
|
|
34333
|
+
(0, import_react54.useEffect)(() => {
|
|
34228
34334
|
if (!isPositionsTab || !hasMorePositions) return;
|
|
34229
34335
|
const target = positionsLoadMoreRef.current;
|
|
34230
34336
|
if (!target || !loadMorePositions) return;
|
|
@@ -34246,7 +34352,7 @@ var PositionsActivity = ({
|
|
|
34246
34352
|
isPositionsTab,
|
|
34247
34353
|
loadMorePositions
|
|
34248
34354
|
]);
|
|
34249
|
-
(0,
|
|
34355
|
+
(0, import_react54.useEffect)(() => {
|
|
34250
34356
|
if (!isActivityTab || !hasMoreActivities) return;
|
|
34251
34357
|
const target = activitiesLoadMoreRef.current;
|
|
34252
34358
|
if (!target || !onLoadMoreActivities) return;
|
|
@@ -34268,7 +34374,7 @@ var PositionsActivity = ({
|
|
|
34268
34374
|
isLoadingMoreActivities,
|
|
34269
34375
|
onLoadMoreActivities
|
|
34270
34376
|
]);
|
|
34271
|
-
(0,
|
|
34377
|
+
(0, import_react54.useEffect)(() => {
|
|
34272
34378
|
if (!isOpenOrdersTab || !hasMoreOpenOrders) return;
|
|
34273
34379
|
const target = openOrdersLoadMoreRef.current;
|
|
34274
34380
|
if (!target || !onLoadMoreOpenOrders) return;
|
|
@@ -34503,7 +34609,7 @@ var PositionsActivity = ({
|
|
|
34503
34609
|
}
|
|
34504
34610
|
) : filteredPositions.length > 0 ? filteredPositions.map((position, index) => {
|
|
34505
34611
|
var _a;
|
|
34506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34507
34613
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34508
34614
|
"div",
|
|
34509
34615
|
{
|
|
@@ -34548,7 +34654,7 @@ var PositionsActivity = ({
|
|
|
34548
34654
|
title: openOrdersLabels.errorTitle,
|
|
34549
34655
|
description: openOrdersLabels.errorDescription
|
|
34550
34656
|
}
|
|
34551
|
-
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34657
|
+
) : openOrders.length > 0 ? openOrders.map((order, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34552
34658
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34553
34659
|
"div",
|
|
34554
34660
|
{
|
|
@@ -34595,7 +34701,7 @@ var PositionsActivity = ({
|
|
|
34595
34701
|
title: "Unable to load activity",
|
|
34596
34702
|
description: "Please try again in a moment."
|
|
34597
34703
|
}
|
|
34598
|
-
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(
|
|
34704
|
+
) : filteredActivities.length > 0 ? filteredActivities.map((activity, index) => /* @__PURE__ */ (0, import_jsx_runtime193.jsxs)(import_react54.Fragment, { children: [
|
|
34599
34705
|
index > 0 ? /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(
|
|
34600
34706
|
"div",
|
|
34601
34707
|
{
|
|
@@ -34972,11 +35078,13 @@ var formatScaledNumberTwoDecimals = (value) => {
|
|
|
34972
35078
|
if (parsed == null) return "0.00";
|
|
34973
35079
|
return twoDecimalNumberFormatter.format(parsed);
|
|
34974
35080
|
};
|
|
35081
|
+
var formatPriceCentsLabel = (value) => `${limitPriceCentsFormatter.format(value * 100)}\xA2`;
|
|
34975
35082
|
var formatLimitPriceLabel2 = (value) => {
|
|
34976
35083
|
const parsed = parseRawMicroValue(value);
|
|
34977
35084
|
if (parsed == null) return void 0;
|
|
34978
|
-
return
|
|
35085
|
+
return formatPriceCentsLabel(parsed);
|
|
34979
35086
|
};
|
|
35087
|
+
var normalizeOutcomeMatchLabel = (value) => typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
34980
35088
|
var formatOpenOrderExpirationLabel = ({
|
|
34981
35089
|
timeInForce,
|
|
34982
35090
|
expiresAt,
|
|
@@ -35318,11 +35426,11 @@ var toRedeemTransactions = (item) => {
|
|
|
35318
35426
|
});
|
|
35319
35427
|
};
|
|
35320
35428
|
var POSITION_ROW_VENUE_ORDER = [
|
|
35321
|
-
|
|
35322
|
-
|
|
35323
|
-
|
|
35324
|
-
|
|
35325
|
-
|
|
35429
|
+
import_sdk29.Venue.polymarket,
|
|
35430
|
+
import_sdk29.Venue.kalshi,
|
|
35431
|
+
import_sdk29.Venue.opinion,
|
|
35432
|
+
import_sdk29.Venue.limitless,
|
|
35433
|
+
import_sdk29.Venue.pred
|
|
35326
35434
|
];
|
|
35327
35435
|
function venueBreakdownSortKey(venue) {
|
|
35328
35436
|
const idx = POSITION_ROW_VENUE_ORDER.indexOf(venue);
|
|
@@ -35407,8 +35515,8 @@ var UserProfilePage = ({
|
|
|
35407
35515
|
onError
|
|
35408
35516
|
}) => {
|
|
35409
35517
|
var _a, _b, _c;
|
|
35410
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
35411
|
-
(0,
|
|
35518
|
+
const [isHydrated, setIsHydrated] = (0, import_react55.useState)(false);
|
|
35519
|
+
(0, import_react55.useEffect)(() => {
|
|
35412
35520
|
setIsHydrated(true);
|
|
35413
35521
|
}, []);
|
|
35414
35522
|
const { user: currentUser, isAuthenticated } = (0, import_hooks87.useAggAuthState)();
|
|
@@ -35421,28 +35529,28 @@ var UserProfilePage = ({
|
|
|
35421
35529
|
const client = (0, import_hooks87.useAggClient)();
|
|
35422
35530
|
const cancelOrderMutation = (0, import_hooks87.useCancelManagedOrder)();
|
|
35423
35531
|
const toastContext = useOptionalToast();
|
|
35424
|
-
const [internalCancellingIds, setInternalCancellingIds] = (0,
|
|
35532
|
+
const [internalCancellingIds, setInternalCancellingIds] = (0, import_react55.useState)({});
|
|
35425
35533
|
const { claim: startClaim, claimingKeys } = useClaimWinnings({
|
|
35426
35534
|
onClaim,
|
|
35427
35535
|
onClaimResult,
|
|
35428
35536
|
onClaimSubmitError,
|
|
35429
35537
|
externalClaimingKeys: claimingPositionKeys
|
|
35430
35538
|
});
|
|
35431
|
-
const [profileUser, setProfileUser] = (0,
|
|
35539
|
+
const [profileUser, setProfileUser] = (0, import_react55.useState)(void 0);
|
|
35432
35540
|
const shouldUseHookData = !user;
|
|
35433
|
-
const connectedVenues = (0,
|
|
35541
|
+
const connectedVenues = (0, import_react55.useMemo)(() => {
|
|
35434
35542
|
var _a2;
|
|
35435
35543
|
if (!shouldUseHookData) return [];
|
|
35436
35544
|
const fromBalance = (_a2 = balanceState.connectedVenues) != null ? _a2 : [];
|
|
35437
35545
|
return [...new Set(fromBalance)].sort((a, b) => a.localeCompare(b));
|
|
35438
35546
|
}, [balanceState, shouldUseHookData]);
|
|
35439
|
-
const [positionFilter, setPositionFilter] = (0,
|
|
35440
|
-
const [selectedClaimActivity, setSelectedClaimActivity] = (0,
|
|
35441
|
-
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0,
|
|
35442
|
-
const manageBalancesButtonRef = (0,
|
|
35547
|
+
const [positionFilter, setPositionFilter] = (0, import_react55.useState)(initialPositionFilter);
|
|
35548
|
+
const [selectedClaimActivity, setSelectedClaimActivity] = (0, import_react55.useState)(null);
|
|
35549
|
+
const [isManageBalancesOpen, setIsManageBalancesOpen] = (0, import_react55.useState)(false);
|
|
35550
|
+
const manageBalancesButtonRef = (0, import_react55.useRef)(null);
|
|
35443
35551
|
const { executionMode: resolvedExecutionMode, isPaperMode } = (0, import_hooks87.useResolvedExecutionMode)(executionMode);
|
|
35444
35552
|
const queryExecutionMode = resolvedExecutionMode === "paper" ? "paper" : void 0;
|
|
35445
|
-
const handleManageBalancesOpenChange = (0,
|
|
35553
|
+
const handleManageBalancesOpenChange = (0, import_react55.useCallback)((open) => {
|
|
35446
35554
|
setIsManageBalancesOpen(open);
|
|
35447
35555
|
if (open) return;
|
|
35448
35556
|
requestAnimationFrame(() => {
|
|
@@ -35462,14 +35570,14 @@ var UserProfilePage = ({
|
|
|
35462
35570
|
limit: 25,
|
|
35463
35571
|
mode: queryExecutionMode
|
|
35464
35572
|
});
|
|
35465
|
-
const handlePositionFilterChange = (0,
|
|
35573
|
+
const handlePositionFilterChange = (0, import_react55.useCallback)(
|
|
35466
35574
|
(filter) => {
|
|
35467
35575
|
setPositionFilter(filter);
|
|
35468
35576
|
onPositionFilterChangeProp == null ? void 0 : onPositionFilterChangeProp(filter);
|
|
35469
35577
|
},
|
|
35470
35578
|
[onPositionFilterChangeProp]
|
|
35471
35579
|
);
|
|
35472
|
-
(0,
|
|
35580
|
+
(0, import_react55.useEffect)(() => {
|
|
35473
35581
|
setPositionFilter(initialPositionFilter);
|
|
35474
35582
|
}, [initialPositionFilter]);
|
|
35475
35583
|
const ordersQuery = (0, import_hooks87.useExecutionOrders)({
|
|
@@ -35534,7 +35642,7 @@ var UserProfilePage = ({
|
|
|
35534
35642
|
limit: 25,
|
|
35535
35643
|
mode: queryExecutionMode
|
|
35536
35644
|
});
|
|
35537
|
-
const openOrderQueries = (0,
|
|
35645
|
+
const openOrderQueries = (0, import_react55.useMemo)(
|
|
35538
35646
|
() => [
|
|
35539
35647
|
pendingOpenOrdersQuery,
|
|
35540
35648
|
signingOpenOrdersQuery,
|
|
@@ -35560,7 +35668,7 @@ var UserProfilePage = ({
|
|
|
35560
35668
|
enabled: shouldUseHookData && isAuthenticated,
|
|
35561
35669
|
limit: 25
|
|
35562
35670
|
});
|
|
35563
|
-
const handleCancelOrder = (0,
|
|
35671
|
+
const handleCancelOrder = (0, import_react55.useCallback)(
|
|
35564
35672
|
(order) => __async(null, null, function* () {
|
|
35565
35673
|
if (onCancelOrder) {
|
|
35566
35674
|
onCancelOrder(order);
|
|
@@ -35593,7 +35701,7 @@ var UserProfilePage = ({
|
|
|
35593
35701
|
}),
|
|
35594
35702
|
[cancelOrderMutation, labels.notifications.order, onCancelOrder, toastContext]
|
|
35595
35703
|
);
|
|
35596
|
-
const handleClaimPosition = (0,
|
|
35704
|
+
const handleClaimPosition = (0, import_react55.useCallback)(
|
|
35597
35705
|
(position) => {
|
|
35598
35706
|
var _a2, _b2;
|
|
35599
35707
|
return startClaim({
|
|
@@ -35604,7 +35712,7 @@ var UserProfilePage = ({
|
|
|
35604
35712
|
},
|
|
35605
35713
|
[startClaim]
|
|
35606
35714
|
);
|
|
35607
|
-
const handleActivityRowClick = (0,
|
|
35715
|
+
const handleActivityRowClick = (0, import_react55.useCallback)(
|
|
35608
35716
|
(activity) => {
|
|
35609
35717
|
if (activity.kind === "redeem") {
|
|
35610
35718
|
setSelectedClaimActivity(activity);
|
|
@@ -35614,13 +35722,13 @@ var UserProfilePage = ({
|
|
|
35614
35722
|
},
|
|
35615
35723
|
[onActivityClick]
|
|
35616
35724
|
);
|
|
35617
|
-
const handleClaimTransactionSelect = (0,
|
|
35725
|
+
const handleClaimTransactionSelect = (0, import_react55.useCallback)((transaction) => {
|
|
35618
35726
|
const href = buildAggTxExplorerHref(transaction.chainId, transaction.txHash);
|
|
35619
35727
|
setSelectedClaimActivity(null);
|
|
35620
35728
|
if (!href || typeof window === "undefined") return;
|
|
35621
35729
|
window.open(href, "_blank", "noopener,noreferrer");
|
|
35622
35730
|
}, []);
|
|
35623
|
-
(0,
|
|
35731
|
+
(0, import_react55.useEffect)(() => {
|
|
35624
35732
|
if (!shouldUseHookData || !isAuthenticated) {
|
|
35625
35733
|
setProfileUser(void 0);
|
|
35626
35734
|
return;
|
|
@@ -35639,7 +35747,7 @@ var UserProfilePage = ({
|
|
|
35639
35747
|
isActive = false;
|
|
35640
35748
|
};
|
|
35641
35749
|
}, [client, currentUser, isAuthenticated, shouldUseHookData]);
|
|
35642
|
-
const resolvedUser = (0,
|
|
35750
|
+
const resolvedUser = (0, import_react55.useMemo)(() => {
|
|
35643
35751
|
var _a2, _b2, _c2, _d, _e, _f;
|
|
35644
35752
|
if (user) return user;
|
|
35645
35753
|
const fullUser = profileUser != null ? profileUser : currentUser;
|
|
@@ -35673,7 +35781,7 @@ var UserProfilePage = ({
|
|
|
35673
35781
|
socialHandle: normalizedTwitterHandle != null ? normalizedTwitterHandle : void 0
|
|
35674
35782
|
};
|
|
35675
35783
|
}, [connectedVenues, currentUser, profileUser, user]);
|
|
35676
|
-
const _resolvedVenueBalances = (0,
|
|
35784
|
+
const _resolvedVenueBalances = (0, import_react55.useMemo)(() => {
|
|
35677
35785
|
if (_venueBalances) return _venueBalances;
|
|
35678
35786
|
return balanceState.balanceBreakdown.map((item) => ({
|
|
35679
35787
|
chain: item.label,
|
|
@@ -35681,24 +35789,24 @@ var UserProfilePage = ({
|
|
|
35681
35789
|
balanceLabel: formatUsd2(item.balance)
|
|
35682
35790
|
}));
|
|
35683
35791
|
}, [_venueBalances, balanceState.balanceBreakdown]);
|
|
35684
|
-
const positionsValueLabel = (0,
|
|
35792
|
+
const positionsValueLabel = (0, import_react55.useMemo)(() => {
|
|
35685
35793
|
var _a2;
|
|
35686
35794
|
if (balance == null ? void 0 : balance.totalLabel) return balance.totalLabel;
|
|
35687
35795
|
return formatUsd2((_a2 = balanceState.positionsBalanceTotal) != null ? _a2 : 0);
|
|
35688
35796
|
}, [balance == null ? void 0 : balance.totalLabel, balanceState.positionsBalanceTotal]);
|
|
35689
|
-
const availableBalanceLabel = (0,
|
|
35797
|
+
const availableBalanceLabel = (0, import_react55.useMemo)(() => {
|
|
35690
35798
|
var _a2, _b2;
|
|
35691
35799
|
return formatUsd2((_b2 = (_a2 = balanceState.availableBalance) != null ? _a2 : balanceState.totalBalance) != null ? _b2 : 0);
|
|
35692
35800
|
}, [balanceState.availableBalance, balanceState.totalBalance]);
|
|
35693
35801
|
const paperSummary = (_a = balanceState.managedBalances) == null ? void 0 : _a.paper;
|
|
35694
|
-
const paperBuyingPowerLabel = (0,
|
|
35802
|
+
const paperBuyingPowerLabel = (0, import_react55.useMemo)(
|
|
35695
35803
|
() => {
|
|
35696
35804
|
var _a2;
|
|
35697
35805
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.cashBalance) != null ? _a2 : 0);
|
|
35698
35806
|
},
|
|
35699
35807
|
[paperSummary == null ? void 0 : paperSummary.cashBalance]
|
|
35700
35808
|
);
|
|
35701
|
-
const paperEarningsLabel = (0,
|
|
35809
|
+
const paperEarningsLabel = (0, import_react55.useMemo)(
|
|
35702
35810
|
() => {
|
|
35703
35811
|
var _a2;
|
|
35704
35812
|
return formatUsd2((_a2 = paperSummary == null ? void 0 : paperSummary.earnings) != null ? _a2 : 0);
|
|
@@ -35707,13 +35815,13 @@ var UserProfilePage = ({
|
|
|
35707
35815
|
);
|
|
35708
35816
|
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks87.useAppConfig)();
|
|
35709
35817
|
const isKalshiAvailable = (0, import_hooks87.getVenueAvailabilityState)({
|
|
35710
|
-
venueId:
|
|
35818
|
+
venueId: import_sdk29.Venue.kalshi,
|
|
35711
35819
|
disabledVenues,
|
|
35712
35820
|
isConfigLoading: isAppConfigLoading
|
|
35713
35821
|
}) === "available";
|
|
35714
35822
|
const isPositionsValueLoading = !(balance == null ? void 0 : balance.totalLabel) && balanceState.isLoading;
|
|
35715
35823
|
const isAvailableBalanceLoading = balanceState.isLoading;
|
|
35716
|
-
const resolvedActivities = (0,
|
|
35824
|
+
const resolvedActivities = (0, import_react55.useMemo)(() => {
|
|
35717
35825
|
if (activities) return activities.filter(isVisibleUserProfileActivity);
|
|
35718
35826
|
const formatTime = isHydrated ? toRelativeTimeLabel : toAbsoluteTimeLabel;
|
|
35719
35827
|
return activityQuery.activities.filter(isVisibleActivityItem).map((item, index) => {
|
|
@@ -35864,8 +35972,7 @@ var UserProfilePage = ({
|
|
|
35864
35972
|
};
|
|
35865
35973
|
});
|
|
35866
35974
|
}, [activities, activityQuery.activities, isHydrated, labels, ordersQuery.orders]);
|
|
35867
|
-
const
|
|
35868
|
-
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
35975
|
+
const openOrderRows = (0, import_react55.useMemo)(() => {
|
|
35869
35976
|
const orderRowsById = /* @__PURE__ */ new Map();
|
|
35870
35977
|
for (const query of openOrderQueries) {
|
|
35871
35978
|
for (const order of query.orders) {
|
|
@@ -35876,7 +35983,47 @@ var UserProfilePage = ({
|
|
|
35876
35983
|
(order) => isOpenOrderStatus(order.status) && isExecutionLimitOrder(order)
|
|
35877
35984
|
).sort(
|
|
35878
35985
|
(a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
|
|
35879
|
-
)
|
|
35986
|
+
);
|
|
35987
|
+
}, [openOrderQueries]);
|
|
35988
|
+
const openOrderVenueMarketIds = (0, import_react55.useMemo)(
|
|
35989
|
+
() => openOrderRows.map((order) => {
|
|
35990
|
+
var _a2;
|
|
35991
|
+
return (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
35992
|
+
}).filter((venueMarketId) => Boolean(venueMarketId)),
|
|
35993
|
+
[openOrderRows]
|
|
35994
|
+
);
|
|
35995
|
+
const openOrderMidpointsQuery = (0, import_hooks87.useVenueMarketMidpoints)({
|
|
35996
|
+
venueMarketIds: openOrderVenueMarketIds,
|
|
35997
|
+
enabled: !openOrders && openOrderVenueMarketIds.length > 0
|
|
35998
|
+
});
|
|
35999
|
+
const openOrderMidpointRows = openOrderMidpointsQuery.midpointRows;
|
|
36000
|
+
const openOrderCurrentPriceLabels = (0, import_react55.useMemo)(() => {
|
|
36001
|
+
var _a2, _b2, _c2, _d;
|
|
36002
|
+
const midpointRowsByVenueMarketId = new Map(
|
|
36003
|
+
openOrderMidpointRows.map((row) => [row.venueMarketId, row])
|
|
36004
|
+
);
|
|
36005
|
+
const labelsByOrderId = /* @__PURE__ */ new Map();
|
|
36006
|
+
for (const order of openOrderRows) {
|
|
36007
|
+
const venueMarketId = (_a2 = order.venueMarket) == null ? void 0 : _a2.id;
|
|
36008
|
+
if (!venueMarketId) continue;
|
|
36009
|
+
const midpointRow = midpointRowsByVenueMarketId.get(venueMarketId);
|
|
36010
|
+
if (!midpointRow) continue;
|
|
36011
|
+
const orderOutcomeLabels = [
|
|
36012
|
+
normalizeOutcomeMatchLabel((_b2 = order.venueMarketOutcome) == null ? void 0 : _b2.label),
|
|
36013
|
+
normalizeOutcomeMatchLabel((_c2 = order.venueMarketOutcome) == null ? void 0 : _c2.title)
|
|
36014
|
+
].filter(Boolean);
|
|
36015
|
+
if (orderOutcomeLabels.length === 0) continue;
|
|
36016
|
+
const outcomeMidpoint = (_d = midpointRow.outcomes) == null ? void 0 : _d.find(
|
|
36017
|
+
(outcome) => orderOutcomeLabels.includes(normalizeOutcomeMatchLabel(outcome.label))
|
|
36018
|
+
);
|
|
36019
|
+
if ((outcomeMidpoint == null ? void 0 : outcomeMidpoint.midpoint) == null) continue;
|
|
36020
|
+
labelsByOrderId.set(order.id, formatPriceCentsLabel(outcomeMidpoint.midpoint));
|
|
36021
|
+
}
|
|
36022
|
+
return labelsByOrderId;
|
|
36023
|
+
}, [openOrderMidpointRows, openOrderRows]);
|
|
36024
|
+
const resolvedOpenOrders = (0, import_react55.useMemo)(() => {
|
|
36025
|
+
if (openOrders) return openOrders.filter(isUserProfileLimitOrder);
|
|
36026
|
+
return openOrderRows.map((order) => {
|
|
35880
36027
|
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
35881
36028
|
const isLimitOrder = isExecutionLimitOrder(order);
|
|
35882
36029
|
const filledRaw = isLimitOrder ? order.filledSizeRaw : order.filledAmountRaw;
|
|
@@ -35889,15 +36036,17 @@ var UserProfilePage = ({
|
|
|
35889
36036
|
goodTilCanceledLabel: labels.userProfile.openOrders.goodTilCanceled,
|
|
35890
36037
|
expiredLabel: labels.userProfile.openOrders.expired
|
|
35891
36038
|
});
|
|
35892
|
-
|
|
36039
|
+
const currentPriceLabel = openOrderCurrentPriceLabels.get(order.id);
|
|
36040
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadProps(__spreadValues({
|
|
35893
36041
|
id: order.id,
|
|
35894
36042
|
eventId: (_c2 = (_b2 = order.venueMarket) == null ? void 0 : _b2.venueEventId) != null ? _c2 : void 0,
|
|
35895
36043
|
marketId: (_e = (_d = order.venueMarket) == null ? void 0 : _d.id) != null ? _e : void 0,
|
|
35896
36044
|
thumbnailSrc: (_g = (_f = order.venueMarket) == null ? void 0 : _f.image) != null ? _g : fallbackThumbnailSrc,
|
|
35897
36045
|
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"
|
|
36046
|
+
outcomeLabel: ((_i = order.venueMarketOutcome) == null ? void 0 : _i.title) || ((_j = order.venueMarketOutcome) == null ? void 0 : _j.label) || "Outcome"
|
|
36047
|
+
}, order.side === "sell" || order.side === "buy" ? { side: order.side } : {}), {
|
|
35899
36048
|
venue: order.venue
|
|
35900
|
-
}, limitPriceLabel ? { limitPriceLabel } : {}), {
|
|
36049
|
+
}), limitPriceLabel ? { limitPriceLabel } : {}), currentPriceLabel ? { currentPriceLabel } : {}), {
|
|
35901
36050
|
filledLabel: `${formatScaledNumberTwoDecimals(filledRaw != null ? filledRaw : "0")}/${formatScaledNumberTwoDecimals(totalRaw)}`,
|
|
35902
36051
|
valueLabel: formatFilledUsdTwoDecimals(totalCostRaw)
|
|
35903
36052
|
}), expirationLabel ? { expirationLabel } : {}), {
|
|
@@ -35906,31 +36055,31 @@ var UserProfilePage = ({
|
|
|
35906
36055
|
dagRunId: (_k = order.dagRunId) != null ? _k : null
|
|
35907
36056
|
});
|
|
35908
36057
|
});
|
|
35909
|
-
}, [labels,
|
|
35910
|
-
const isOpenOrdersQueryLoading = (0,
|
|
36058
|
+
}, [labels, openOrderCurrentPriceLabels, openOrderRows, openOrders]);
|
|
36059
|
+
const isOpenOrdersQueryLoading = (0, import_react55.useMemo)(
|
|
35911
36060
|
() => openOrderQueries.some((query) => query.isLoading),
|
|
35912
36061
|
[openOrderQueries]
|
|
35913
36062
|
);
|
|
35914
|
-
const hasOpenOrdersQueryError = (0,
|
|
36063
|
+
const hasOpenOrdersQueryError = (0, import_react55.useMemo)(
|
|
35915
36064
|
() => openOrderQueries.some((query) => query.error),
|
|
35916
36065
|
[openOrderQueries]
|
|
35917
36066
|
);
|
|
35918
|
-
const hasMoreOpenOrdersQuery = (0,
|
|
36067
|
+
const hasMoreOpenOrdersQuery = (0, import_react55.useMemo)(
|
|
35919
36068
|
() => openOrderQueries.some((query) => query.hasNextPage),
|
|
35920
36069
|
[openOrderQueries]
|
|
35921
36070
|
);
|
|
35922
|
-
const isLoadingMoreOpenOrdersQuery = (0,
|
|
36071
|
+
const isLoadingMoreOpenOrdersQuery = (0, import_react55.useMemo)(
|
|
35923
36072
|
() => openOrderQueries.some((query) => query.isFetchingNextPage),
|
|
35924
36073
|
[openOrderQueries]
|
|
35925
36074
|
);
|
|
35926
|
-
const handleLoadMoreOpenOrders = (0,
|
|
36075
|
+
const handleLoadMoreOpenOrders = (0, import_react55.useCallback)(() => {
|
|
35927
36076
|
for (const query of openOrderQueries) {
|
|
35928
36077
|
if (query.hasNextPage) {
|
|
35929
36078
|
void query.fetchNextPage();
|
|
35930
36079
|
}
|
|
35931
36080
|
}
|
|
35932
36081
|
}, [openOrderQueries]);
|
|
35933
|
-
const adaptPositionGroups = (0,
|
|
36082
|
+
const adaptPositionGroups = (0, import_react55.useCallback)(
|
|
35934
36083
|
(groups) => {
|
|
35935
36084
|
return groups.flatMap((group) => {
|
|
35936
36085
|
var _a2, _b2, _c2, _d;
|
|
@@ -35947,16 +36096,15 @@ var UserProfilePage = ({
|
|
|
35947
36096
|
const outcomeId = (_b3 = (_a3 = outcome.venueBreakdown.find((row) => row.venueMarketOutcomeId)) == null ? void 0 : _a3.venueMarketOutcomeId) != null ? _b3 : void 0;
|
|
35948
36097
|
const isResolved = group.venueMarket.status === "resolved";
|
|
35949
36098
|
const isUnpriced = outcome.priceSource === "entry";
|
|
35950
|
-
const averagePriceCents =
|
|
35951
|
-
const totalTradedValue = outcome.avgEntryPrice * outcome.totalSize;
|
|
36099
|
+
const { averagePriceCents, averagePrice, totalTradedValue, costUnknown } = costBasisDisplay(outcome);
|
|
35952
36100
|
const finalPayoutValue = isResolved ? outcome.winner === true ? outcome.totalValue : 0 : outcome.totalValue;
|
|
35953
36101
|
const finalPrice = isResolved ? outcome.winner === true ? 1 : 0 : outcome.currentPrice;
|
|
35954
|
-
const finalPnlValue = finalPayoutValue - totalTradedValue;
|
|
35955
|
-
const finalPnlPercent = totalTradedValue === 0 ?
|
|
36102
|
+
const finalPnlValue = totalTradedValue == null ? null : finalPayoutValue - totalTradedValue;
|
|
36103
|
+
const finalPnlPercent = totalTradedValue == null || totalTradedValue === 0 || finalPnlValue == null ? null : finalPnlValue / Math.abs(totalTradedValue) * 100;
|
|
35956
36104
|
const displayCurrentPrice = isResolved ? finalPrice : isUnpriced ? null : outcome.currentPrice;
|
|
35957
36105
|
const displayCurrentValue = isResolved ? finalPayoutValue : isUnpriced ? null : outcome.totalValue;
|
|
35958
|
-
const displayPnlValue = isResolved ? finalPnlValue : isUnpriced ? null : outcome.unrealizedPnl;
|
|
35959
|
-
const displayPnlPercent = isResolved ? finalPnlPercent : isUnpriced ? null : outcome.unrealizedPnlPercent;
|
|
36106
|
+
const displayPnlValue = costUnknown ? null : isResolved ? finalPnlValue : isUnpriced ? null : outcome.unrealizedPnl;
|
|
36107
|
+
const displayPnlPercent = costUnknown ? null : isResolved ? finalPnlPercent : isUnpriced ? null : outcome.unrealizedPnlPercent;
|
|
35960
36108
|
const currentPriceCents = typeof displayCurrentPrice === "number" ? Math.round(displayCurrentPrice * 100) : null;
|
|
35961
36109
|
const pnlPrefix = (displayPnlValue != null ? displayPnlValue : 0) >= 0 ? "+" : "";
|
|
35962
36110
|
const pnlPercent = displayPnlPercent == null ? null : displayPnlPercent.toFixed(2);
|
|
@@ -35972,8 +36120,8 @@ var UserProfilePage = ({
|
|
|
35972
36120
|
resolutionLabel: winningOutcomeLabel,
|
|
35973
36121
|
venueShareBreakdown: buildVenueShareBreakdown(outcome),
|
|
35974
36122
|
totalShares: outcome.totalSize,
|
|
35975
|
-
averageLabel: `${averagePriceCents}\xA2`,
|
|
35976
|
-
averagePrice
|
|
36123
|
+
averageLabel: averagePriceCents == null ? "\u2014" : `${averagePriceCents}\xA2`,
|
|
36124
|
+
averagePrice,
|
|
35977
36125
|
currentLabel: currentPriceCents == null ? "\u2014" : `${currentPriceCents}\xA2`,
|
|
35978
36126
|
currentPrice: displayCurrentPrice,
|
|
35979
36127
|
valueLabel: displayCurrentValue == null ? "\u2014" : formatUsd2(displayCurrentValue),
|
|
@@ -35986,14 +36134,14 @@ var UserProfilePage = ({
|
|
|
35986
36134
|
marketStatus: group.venueMarket.status,
|
|
35987
36135
|
winner: (_f = outcome.winner) != null ? _f : null,
|
|
35988
36136
|
resolutionDate: group.resolutionDate,
|
|
35989
|
-
closedTotalTradedLabel: formatUsd2(totalTradedValue),
|
|
36137
|
+
closedTotalTradedLabel: totalTradedValue == null ? "\u2014" : formatUsd2(totalTradedValue),
|
|
35990
36138
|
totalTradedValue,
|
|
35991
36139
|
closedAmountWonLabel: formatUsd2(finalPayoutValue),
|
|
35992
36140
|
finalPayoutValue,
|
|
35993
36141
|
finalPnlValue,
|
|
35994
36142
|
finalPnlPercent,
|
|
35995
36143
|
finalPrice,
|
|
35996
|
-
closedReturnLabel: formatSignedPercentLabel(finalPnlPercent / 100),
|
|
36144
|
+
closedReturnLabel: finalPnlPercent == null ? "\u2014" : formatSignedPercentLabel(finalPnlPercent / 100),
|
|
35997
36145
|
closedClaimStatus: group.redeemStatus,
|
|
35998
36146
|
winningOutcomeIds: winningOutcomeIds.length > 0 ? winningOutcomeIds : closedTotals.winningOutcomeIds
|
|
35999
36147
|
};
|
|
@@ -36002,11 +36150,11 @@ var UserProfilePage = ({
|
|
|
36002
36150
|
},
|
|
36003
36151
|
[]
|
|
36004
36152
|
);
|
|
36005
|
-
const resolvedActivePositions = (0,
|
|
36153
|
+
const resolvedActivePositions = (0, import_react55.useMemo)(() => {
|
|
36006
36154
|
const source = activePositions != null ? activePositions : adaptPositionGroups(activePositionsQuery.positions);
|
|
36007
36155
|
return source.filter(shouldIncludeByShares);
|
|
36008
36156
|
}, [activePositions, activePositionsQuery.positions, adaptPositionGroups]);
|
|
36009
|
-
const resolvedClosedPositions = (0,
|
|
36157
|
+
const resolvedClosedPositions = (0, import_react55.useMemo)(() => {
|
|
36010
36158
|
const source = closedPositions != null ? closedPositions : adaptPositionGroups(closedPositionsQuery.positions);
|
|
36011
36159
|
return source.filter(shouldIncludeByShares);
|
|
36012
36160
|
}, [closedPositions, closedPositionsQuery.positions, adaptPositionGroups]);
|
|
@@ -36071,32 +36219,13 @@ var UserProfilePage = ({
|
|
|
36071
36219
|
classNames == null ? void 0 : classNames.rightColumn
|
|
36072
36220
|
),
|
|
36073
36221
|
children: [
|
|
36074
|
-
/* @__PURE__ */ (0, import_jsx_runtime196.
|
|
36075
|
-
|
|
36222
|
+
/* @__PURE__ */ (0, import_jsx_runtime196.jsx)(
|
|
36223
|
+
PositionsValueCard,
|
|
36076
36224
|
{
|
|
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
|
-
]
|
|
36225
|
+
label: labels.userProfile.balance.positionsValue,
|
|
36226
|
+
valueLabel: positionsValueLabel,
|
|
36227
|
+
isLoading: isPositionsValueLoading,
|
|
36228
|
+
compact: isPaperMode
|
|
36100
36229
|
}
|
|
36101
36230
|
),
|
|
36102
36231
|
isPaperMode ? (
|
|
@@ -36145,13 +36274,14 @@ var UserProfilePage = ({
|
|
|
36145
36274
|
{
|
|
36146
36275
|
valueLabel: availableBalanceLabel,
|
|
36147
36276
|
isLoading: isAvailableBalanceLoading,
|
|
36148
|
-
chains: ((
|
|
36277
|
+
chains: ((_b = balanceChainsOverride != null ? balanceChainsOverride : balanceState.availableBalanceBreakdown) != null ? _b : balanceState.balanceBreakdown).map((b) => ({
|
|
36149
36278
|
key: b.key,
|
|
36150
36279
|
label: b.label,
|
|
36151
36280
|
balance: b.balance,
|
|
36152
36281
|
accountCount: b.accountCount,
|
|
36153
36282
|
venues: b.venues
|
|
36154
36283
|
})),
|
|
36284
|
+
kalshiValueLabel: isKalshiAvailable ? formatUsd2((_c = balanceState.kalshiBalance) != null ? _c : 0) : void 0,
|
|
36155
36285
|
manageButtonRef: manageBalancesButtonRef,
|
|
36156
36286
|
onManage: () => handleManageBalancesOpenChange(true)
|
|
36157
36287
|
}
|
|
@@ -36243,7 +36373,7 @@ UserProfilePage.displayName = "UserProfilePage";
|
|
|
36243
36373
|
// src/deposit/index.tsx
|
|
36244
36374
|
var import_hooks98 = require("@agg-build/hooks");
|
|
36245
36375
|
var import_deposit = require("@agg-build/hooks/deposit");
|
|
36246
|
-
var
|
|
36376
|
+
var import_react58 = require("react");
|
|
36247
36377
|
|
|
36248
36378
|
// src/shared/constants.ts
|
|
36249
36379
|
var USDC = {
|
|
@@ -36475,7 +36605,7 @@ var NETWORK_TO_CURRENCY_CODE = {
|
|
|
36475
36605
|
|
|
36476
36606
|
// src/deposit/steps/card-deposit.tsx
|
|
36477
36607
|
var import_hooks88 = require("@agg-build/hooks");
|
|
36478
|
-
var
|
|
36608
|
+
var import_react56 = require("react");
|
|
36479
36609
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
36480
36610
|
var CardDepositStep = ({
|
|
36481
36611
|
amount,
|
|
@@ -36493,8 +36623,8 @@ var CardDepositStep = ({
|
|
|
36493
36623
|
onContinue
|
|
36494
36624
|
}) => {
|
|
36495
36625
|
const labels = (0, import_hooks88.useLabels)();
|
|
36496
|
-
const [localAmount, setLocalAmount] = (0,
|
|
36497
|
-
(0,
|
|
36626
|
+
const [localAmount, setLocalAmount] = (0, import_react56.useState)(amount);
|
|
36627
|
+
(0, import_react56.useEffect)(() => {
|
|
36498
36628
|
setLocalAmount(amount);
|
|
36499
36629
|
}, [amount]);
|
|
36500
36630
|
const numericAmount = Number(localAmount) || 0;
|
|
@@ -37351,7 +37481,7 @@ var WalletFormStep = ({
|
|
|
37351
37481
|
|
|
37352
37482
|
// src/deposit/steps/wallet-processing.tsx
|
|
37353
37483
|
var import_hooks96 = require("@agg-build/hooks");
|
|
37354
|
-
var
|
|
37484
|
+
var import_react57 = require("react");
|
|
37355
37485
|
var import_jsx_runtime206 = require("react/jsx-runtime");
|
|
37356
37486
|
var WalletProcessingStep = ({
|
|
37357
37487
|
steps,
|
|
@@ -37359,7 +37489,7 @@ var WalletProcessingStep = ({
|
|
|
37359
37489
|
onComplete
|
|
37360
37490
|
}) => {
|
|
37361
37491
|
const labels = (0, import_hooks96.useLabels)();
|
|
37362
|
-
(0,
|
|
37492
|
+
(0, import_react57.useEffect)(() => {
|
|
37363
37493
|
const allDone = steps.length > 0 && steps.every((s) => s.status === "complete");
|
|
37364
37494
|
if (allDone) {
|
|
37365
37495
|
onComplete();
|
|
@@ -37532,30 +37662,30 @@ function DepositModalControlled({
|
|
|
37532
37662
|
const { walletActions } = (0, import_hooks98.useAggUiConfig)();
|
|
37533
37663
|
const labels = (0, import_hooks98.useLabels)();
|
|
37534
37664
|
const defaultMethod = isWeb3User ? "wallet" : "crypto";
|
|
37535
|
-
const [step, setStep] = (0,
|
|
37665
|
+
const [step, setStep] = (0, import_react58.useState)(
|
|
37536
37666
|
() => pendingCardPurchaseSummary ? "card-success" : "method"
|
|
37537
37667
|
);
|
|
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,
|
|
37668
|
+
const [highlightedMethod, setHighlightedMethod] = (0, import_react58.useState)(defaultMethod);
|
|
37669
|
+
const walletSubmitInFlightRef = (0, import_react58.useRef)(false);
|
|
37670
|
+
const walletDepositAttemptIdRef = (0, import_react58.useRef)(0);
|
|
37671
|
+
const notifiedWalletDepositStatusesRef = (0, import_react58.useRef)(/* @__PURE__ */ new Set());
|
|
37672
|
+
const [isWalletSubmitting, setIsWalletSubmitting] = (0, import_react58.useState)(false);
|
|
37673
|
+
const [cardProviders, setCardProviders] = (0, import_react58.useState)([]);
|
|
37674
|
+
const [quotesLoading, setQuotesLoading] = (0, import_react58.useState)(false);
|
|
37675
|
+
const [quotesError, setQuotesError] = (0, import_react58.useState)(null);
|
|
37676
|
+
const [sessionError, setSessionError] = (0, import_react58.useState)(null);
|
|
37677
|
+
const [pendingProviderName, setPendingProviderName] = (0, import_react58.useState)("");
|
|
37678
|
+
const [pendingProviderWalletAddress, setPendingProviderWalletAddress] = (0, import_react58.useState)("");
|
|
37679
|
+
(0, import_react58.useEffect)(() => {
|
|
37550
37680
|
if (pendingCardPurchaseSummary) {
|
|
37551
37681
|
clearPendingCardSession();
|
|
37552
37682
|
setStep("card-success");
|
|
37553
37683
|
}
|
|
37554
37684
|
}, [pendingCardPurchaseSummary]);
|
|
37555
|
-
const [walletChainId, setWalletChainId] = (0,
|
|
37556
|
-
const [walletToken, setWalletToken] = (0,
|
|
37557
|
-
const [sendChainId, setSendChainId] = (0,
|
|
37558
|
-
const [sendToken, setSendToken] = (0,
|
|
37685
|
+
const [walletChainId, setWalletChainId] = (0, import_react58.useState)("");
|
|
37686
|
+
const [walletToken, setWalletToken] = (0, import_react58.useState)("");
|
|
37687
|
+
const [sendChainId, setSendChainId] = (0, import_react58.useState)("");
|
|
37688
|
+
const [sendToken, setSendToken] = (0, import_react58.useState)("");
|
|
37559
37689
|
const {
|
|
37560
37690
|
isReady,
|
|
37561
37691
|
isTimedOut,
|
|
@@ -37563,14 +37693,14 @@ function DepositModalControlled({
|
|
|
37563
37693
|
supportedChains,
|
|
37564
37694
|
getAddress
|
|
37565
37695
|
} = (0, import_hooks98.useDepositAddresses)({ enabled: open });
|
|
37566
|
-
const fallbackNetworkOptions = (0,
|
|
37567
|
-
const networkOptions = (0,
|
|
37696
|
+
const fallbackNetworkOptions = (0, import_react58.useMemo)(() => mapNetworksToOptions(), []);
|
|
37697
|
+
const networkOptions = (0, import_react58.useMemo)(() => {
|
|
37568
37698
|
if (!(supportedChains == null ? void 0 : supportedChains.length)) return fallbackNetworkOptions;
|
|
37569
37699
|
return withNetworkIcons(
|
|
37570
37700
|
supportedChains.map((c) => ({ value: String(c.chainId), label: c.name }))
|
|
37571
37701
|
);
|
|
37572
37702
|
}, [supportedChains, fallbackNetworkOptions]);
|
|
37573
|
-
const walletNetworkOptions = (0,
|
|
37703
|
+
const walletNetworkOptions = (0, import_react58.useMemo)(() => {
|
|
37574
37704
|
if (!(supportedChains == null ? void 0 : supportedChains.length) || !connectedWalletKind) return networkOptions;
|
|
37575
37705
|
const filtered = supportedChains.filter(
|
|
37576
37706
|
(c) => connectedWalletKind === "solana" ? import_deposit.SVM_CHAIN_IDS.has(c.chainId) : !import_deposit.SVM_CHAIN_IDS.has(c.chainId)
|
|
@@ -37578,17 +37708,17 @@ function DepositModalControlled({
|
|
|
37578
37708
|
if (filtered.length === 0) return networkOptions;
|
|
37579
37709
|
return withNetworkIcons(filtered.map((c) => ({ value: String(c.chainId), label: c.name })));
|
|
37580
37710
|
}, [supportedChains, networkOptions, connectedWalletKind]);
|
|
37581
|
-
const walletTokenOptions = (0,
|
|
37711
|
+
const walletTokenOptions = (0, import_react58.useMemo)(() => {
|
|
37582
37712
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === walletChainId);
|
|
37583
37713
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
37584
37714
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
37585
37715
|
}, [supportedChains, walletChainId]);
|
|
37586
|
-
const sendTokenOptions = (0,
|
|
37716
|
+
const sendTokenOptions = (0, import_react58.useMemo)(() => {
|
|
37587
37717
|
const chain = supportedChains == null ? void 0 : supportedChains.find((c) => String(c.chainId) === sendChainId);
|
|
37588
37718
|
if (!chain) return withTokenIcons(DEFAULT_CURRENCY_OPTIONS);
|
|
37589
37719
|
return withTokenIcons(chain.tokens.map((t) => ({ value: t.symbol, label: t.symbol })));
|
|
37590
37720
|
}, [supportedChains, sendChainId]);
|
|
37591
|
-
(0,
|
|
37721
|
+
(0, import_react58.useEffect)(() => {
|
|
37592
37722
|
if (walletNetworkOptions.length > 0) {
|
|
37593
37723
|
if (!walletChainId || !walletNetworkOptions.some((o) => o.value === walletChainId)) {
|
|
37594
37724
|
const ethereumMainnetOption = walletNetworkOptions.find(
|
|
@@ -37599,30 +37729,30 @@ function DepositModalControlled({
|
|
|
37599
37729
|
}
|
|
37600
37730
|
}
|
|
37601
37731
|
}, [walletNetworkOptions, walletChainId, initialWalletChainId]);
|
|
37602
|
-
(0,
|
|
37732
|
+
(0, import_react58.useEffect)(() => {
|
|
37603
37733
|
if (networkOptions.length > 0) {
|
|
37604
37734
|
if (!sendChainId || !networkOptions.some((o) => o.value === sendChainId)) {
|
|
37605
37735
|
setSendChainId(networkOptions[0].value);
|
|
37606
37736
|
}
|
|
37607
37737
|
}
|
|
37608
37738
|
}, [networkOptions, sendChainId]);
|
|
37609
|
-
(0,
|
|
37739
|
+
(0, import_react58.useEffect)(() => {
|
|
37610
37740
|
var _a2, _b2;
|
|
37611
37741
|
if (walletTokenOptions.length > 0) {
|
|
37612
37742
|
const preferredToken = (_b2 = (_a2 = walletTokenOptions.find((option) => option.value === DEFAULT_WALLET_TOKEN)) == null ? void 0 : _a2.value) != null ? _b2 : walletTokenOptions[0].value;
|
|
37613
37743
|
setWalletToken(preferredToken);
|
|
37614
37744
|
}
|
|
37615
37745
|
}, [walletTokenOptions]);
|
|
37616
|
-
(0,
|
|
37746
|
+
(0, import_react58.useEffect)(() => {
|
|
37617
37747
|
var _a2, _b2;
|
|
37618
37748
|
setSendToken((_b2 = (_a2 = sendTokenOptions == null ? void 0 : sendTokenOptions[0]) == null ? void 0 : _a2.value) != null ? _b2 : "");
|
|
37619
37749
|
}, [sendTokenOptions]);
|
|
37620
|
-
(0,
|
|
37750
|
+
(0, import_react58.useEffect)(() => {
|
|
37621
37751
|
if (walletChainId) {
|
|
37622
37752
|
onWalletNetworkChange == null ? void 0 : onWalletNetworkChange(walletChainId);
|
|
37623
37753
|
}
|
|
37624
37754
|
}, [walletChainId, onWalletNetworkChange]);
|
|
37625
|
-
(0,
|
|
37755
|
+
(0, import_react58.useEffect)(() => {
|
|
37626
37756
|
if (walletToken) {
|
|
37627
37757
|
onWalletTokenChange == null ? void 0 : onWalletTokenChange(walletToken);
|
|
37628
37758
|
}
|
|
@@ -37641,7 +37771,7 @@ function DepositModalControlled({
|
|
|
37641
37771
|
fromWallet: walletFlow.walletLabel,
|
|
37642
37772
|
gasFee: ""
|
|
37643
37773
|
}, walletFlow.successSummary);
|
|
37644
|
-
const handleWalletDepositNotification = (0,
|
|
37774
|
+
const handleWalletDepositNotification = (0, import_react58.useCallback)(
|
|
37645
37775
|
(status, errorMessage) => {
|
|
37646
37776
|
if (notifiedWalletDepositStatusesRef.current.has(status)) return;
|
|
37647
37777
|
notifiedWalletDepositStatusesRef.current.add(status);
|
|
@@ -37655,13 +37785,13 @@ function DepositModalControlled({
|
|
|
37655
37785
|
},
|
|
37656
37786
|
[walletFlow.amount, walletToken]
|
|
37657
37787
|
);
|
|
37658
|
-
(0,
|
|
37788
|
+
(0, import_react58.useEffect)(() => {
|
|
37659
37789
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "settled") {
|
|
37660
37790
|
handleWalletDepositNotification("completed");
|
|
37661
37791
|
setStep("wallet-success");
|
|
37662
37792
|
}
|
|
37663
37793
|
}, [handleWalletDepositNotification, isWalletSubmitting, step, walletFlow.transactionStatus]);
|
|
37664
|
-
(0,
|
|
37794
|
+
(0, import_react58.useEffect)(() => {
|
|
37665
37795
|
if (!onCancelWalletDeposit) return;
|
|
37666
37796
|
if (step === "wallet-processing" && !isWalletSubmitting && walletFlow.transactionStatus === "error") {
|
|
37667
37797
|
walletSubmitInFlightRef.current = false;
|
|
@@ -38004,7 +38134,7 @@ var DepositModal = (props) => {
|
|
|
38004
38134
|
DepositModal.displayName = "DepositModal";
|
|
38005
38135
|
|
|
38006
38136
|
// src/withdraw/index.tsx
|
|
38007
|
-
var
|
|
38137
|
+
var import_react59 = require("react");
|
|
38008
38138
|
var import_withdraw = require("@agg-build/hooks/withdraw");
|
|
38009
38139
|
|
|
38010
38140
|
// src/withdraw/steps/withdraw-method.tsx
|
|
@@ -38536,14 +38666,14 @@ function WithdrawModalControlled({
|
|
|
38536
38666
|
onSelectWithdrawProvider,
|
|
38537
38667
|
onDoneWithdraw
|
|
38538
38668
|
}) {
|
|
38539
|
-
const [flowState, setFlowState] = (0,
|
|
38669
|
+
const [flowState, setFlowState] = (0, import_react59.useState)({
|
|
38540
38670
|
status: "form",
|
|
38541
38671
|
formStep: "method"
|
|
38542
38672
|
});
|
|
38543
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
38544
|
-
const [confirmError, setConfirmError] = (0,
|
|
38673
|
+
const [isConfirming, setIsConfirming] = (0, import_react59.useState)(false);
|
|
38674
|
+
const [confirmError, setConfirmError] = (0, import_react59.useState)(null);
|
|
38545
38675
|
const { state: withdrawalLifecycleState, reset: resetWithdrawalLifecycle } = (0, import_withdraw.useWithdrawalLifecycle)(withdrawFlow.withdrawalId);
|
|
38546
|
-
(0,
|
|
38676
|
+
(0, import_react59.useEffect)(() => {
|
|
38547
38677
|
if (!open) {
|
|
38548
38678
|
setFlowState({ status: "form", formStep: "method" });
|
|
38549
38679
|
setIsConfirming(false);
|
|
@@ -38551,7 +38681,7 @@ function WithdrawModalControlled({
|
|
|
38551
38681
|
resetWithdrawalLifecycle();
|
|
38552
38682
|
}
|
|
38553
38683
|
}, [open, resetWithdrawalLifecycle]);
|
|
38554
|
-
(0,
|
|
38684
|
+
(0, import_react59.useEffect)(() => {
|
|
38555
38685
|
if (flowState.status !== "loading") return;
|
|
38556
38686
|
if (!withdrawalLifecycleState.terminal) return;
|
|
38557
38687
|
if (withdrawalLifecycleState.status === "completed") {
|
|
@@ -38688,7 +38818,7 @@ WithdrawModal.displayName = "WithdrawModal";
|
|
|
38688
38818
|
var import_hooks103 = require("@agg-build/hooks");
|
|
38689
38819
|
|
|
38690
38820
|
// src/paper-trading/paper-onboarding-modal.tsx
|
|
38691
|
-
var
|
|
38821
|
+
var import_react60 = require("react");
|
|
38692
38822
|
var import_hooks102 = require("@agg-build/hooks");
|
|
38693
38823
|
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
38694
38824
|
var PaperOnboardingModal = ({
|
|
@@ -38699,8 +38829,8 @@ var PaperOnboardingModal = ({
|
|
|
38699
38829
|
}) => {
|
|
38700
38830
|
const labels = (0, import_hooks102.useLabels)();
|
|
38701
38831
|
const copy = labels.paperTrading.onboarding;
|
|
38702
|
-
const [stepIndex, setStepIndex] = (0,
|
|
38703
|
-
const steps = (0,
|
|
38832
|
+
const [stepIndex, setStepIndex] = (0, import_react60.useState)(0);
|
|
38833
|
+
const steps = (0, import_react60.useMemo)(
|
|
38704
38834
|
() => [
|
|
38705
38835
|
{
|
|
38706
38836
|
key: "realMarkets",
|
|
@@ -38727,17 +38857,17 @@ var PaperOnboardingModal = ({
|
|
|
38727
38857
|
const isFirst = stepIndex === 0;
|
|
38728
38858
|
const isLast = stepIndex === total - 1;
|
|
38729
38859
|
const step = steps[stepIndex];
|
|
38730
|
-
const handleBack = (0,
|
|
38860
|
+
const handleBack = (0, import_react60.useCallback)(() => {
|
|
38731
38861
|
setStepIndex((current) => Math.max(0, current - 1));
|
|
38732
38862
|
}, []);
|
|
38733
|
-
const handleNext = (0,
|
|
38863
|
+
const handleNext = (0, import_react60.useCallback)(() => {
|
|
38734
38864
|
if (isLast) {
|
|
38735
38865
|
onDismiss();
|
|
38736
38866
|
return;
|
|
38737
38867
|
}
|
|
38738
38868
|
setStepIndex((current) => Math.min(total - 1, current + 1));
|
|
38739
38869
|
}, [isLast, onDismiss, total]);
|
|
38740
|
-
const handleOpenChange = (0,
|
|
38870
|
+
const handleOpenChange = (0, import_react60.useCallback)(
|
|
38741
38871
|
(next) => {
|
|
38742
38872
|
if (next) return;
|
|
38743
38873
|
setStepIndex(0);
|
|
@@ -38869,9 +38999,9 @@ var PaperTradingOnboarding = ({
|
|
|
38869
38999
|
PaperTradingOnboarding.displayName = "PaperTradingOnboarding";
|
|
38870
39000
|
|
|
38871
39001
|
// src/profile/index.tsx
|
|
38872
|
-
var
|
|
39002
|
+
var import_react63 = require("react");
|
|
38873
39003
|
var import_hooks106 = require("@agg-build/hooks");
|
|
38874
|
-
var
|
|
39004
|
+
var import_sdk30 = require("@agg-build/sdk");
|
|
38875
39005
|
|
|
38876
39006
|
// src/profile/profile-modal.constants.ts
|
|
38877
39007
|
var PROFILE_TAB_KEYS = {
|
|
@@ -38888,7 +39018,7 @@ var getProfileTabItems = () => [
|
|
|
38888
39018
|
];
|
|
38889
39019
|
|
|
38890
39020
|
// src/profile/tabs/about-tab.tsx
|
|
38891
|
-
var
|
|
39021
|
+
var import_react61 = require("react");
|
|
38892
39022
|
var import_hooks104 = require("@agg-build/hooks");
|
|
38893
39023
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
38894
39024
|
var AboutTab = ({
|
|
@@ -38901,12 +39031,12 @@ var AboutTab = ({
|
|
|
38901
39031
|
avatarError: _avatarError
|
|
38902
39032
|
}) => {
|
|
38903
39033
|
const labels = (0, import_hooks104.useLabels)();
|
|
38904
|
-
const fileInputRef = (0,
|
|
38905
|
-
const handleAvatarClick = (0,
|
|
39034
|
+
const fileInputRef = (0, import_react61.useRef)(null);
|
|
39035
|
+
const handleAvatarClick = (0, import_react61.useCallback)(() => {
|
|
38906
39036
|
var _a;
|
|
38907
39037
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
38908
39038
|
}, []);
|
|
38909
|
-
const handleFileChange = (0,
|
|
39039
|
+
const handleFileChange = (0, import_react61.useCallback)(
|
|
38910
39040
|
(e) => {
|
|
38911
39041
|
var _a;
|
|
38912
39042
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -39176,7 +39306,7 @@ AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
|
39176
39306
|
|
|
39177
39307
|
// src/profile/tabs/trading-access-tab.tsx
|
|
39178
39308
|
var import_hooks105 = require("@agg-build/hooks");
|
|
39179
|
-
var
|
|
39309
|
+
var import_react62 = require("react");
|
|
39180
39310
|
var import_jsx_runtime217 = require("react/jsx-runtime");
|
|
39181
39311
|
var TRADING_ACCESS_VENUES = [
|
|
39182
39312
|
"kalshi",
|
|
@@ -39226,7 +39356,7 @@ var TradingAccessTab = ({
|
|
|
39226
39356
|
const labels = (0, import_hooks105.useLabels)();
|
|
39227
39357
|
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks105.useAppConfig)();
|
|
39228
39358
|
const { isLocationBlocked } = (0, import_hooks105.useGeoBlock)();
|
|
39229
|
-
const visibleVenues = (0,
|
|
39359
|
+
const visibleVenues = (0, import_react62.useMemo)(
|
|
39230
39360
|
() => (0, import_hooks105.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
|
|
39231
39361
|
[disabledVenues]
|
|
39232
39362
|
);
|
|
@@ -39305,28 +39435,28 @@ var ProfileModal = ({
|
|
|
39305
39435
|
const client = (0, import_hooks106.useAggClient)();
|
|
39306
39436
|
const { user } = (0, import_hooks106.useAggAuthState)();
|
|
39307
39437
|
const toastCtx = useOptionalToast();
|
|
39308
|
-
const [activeTab, setActiveTab] = (0,
|
|
39309
|
-
const profileTabItems = (0,
|
|
39438
|
+
const [activeTab, setActiveTab] = (0, import_react63.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
39439
|
+
const profileTabItems = (0, import_react63.useMemo)(() => getProfileTabItems(), []);
|
|
39310
39440
|
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,
|
|
39441
|
+
const [draftUsername, setDraftUsername] = (0, import_react63.useState)(resolvedInitialUsername);
|
|
39442
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react63.useState)();
|
|
39443
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react63.useState)();
|
|
39444
|
+
const [isSaving, setIsSaving] = (0, import_react63.useState)(false);
|
|
39445
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react63.useState)(null);
|
|
39446
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react63.useState)(false);
|
|
39317
39447
|
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks106.useVenueKeyStatus)(
|
|
39318
|
-
|
|
39448
|
+
import_sdk30.Venue.kalshi,
|
|
39319
39449
|
open
|
|
39320
39450
|
);
|
|
39321
|
-
(0,
|
|
39451
|
+
(0, import_react63.useEffect)(() => {
|
|
39322
39452
|
var _a2;
|
|
39323
39453
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
39324
39454
|
}, [username, user == null ? void 0 : user.username]);
|
|
39325
|
-
(0,
|
|
39455
|
+
(0, import_react63.useEffect)(() => {
|
|
39326
39456
|
if (open) return;
|
|
39327
39457
|
setIsConnectKalshiModalOpen(false);
|
|
39328
39458
|
}, [open]);
|
|
39329
|
-
const handleOpenChange = (0,
|
|
39459
|
+
const handleOpenChange = (0, import_react63.useCallback)(
|
|
39330
39460
|
(isOpen) => {
|
|
39331
39461
|
var _a2;
|
|
39332
39462
|
if (!isOpen) {
|
|
@@ -39350,7 +39480,7 @@ var ProfileModal = ({
|
|
|
39350
39480
|
setDraftAvatarPreview
|
|
39351
39481
|
]
|
|
39352
39482
|
);
|
|
39353
|
-
const handleDraftAvatarChange = (0,
|
|
39483
|
+
const handleDraftAvatarChange = (0, import_react63.useCallback)(
|
|
39354
39484
|
(file, preview) => {
|
|
39355
39485
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
39356
39486
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -39365,7 +39495,7 @@ var ProfileModal = ({
|
|
|
39365
39495
|
);
|
|
39366
39496
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
39367
39497
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
39368
|
-
const handleSave = (0,
|
|
39498
|
+
const handleSave = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39369
39499
|
var _a2, _b2, _c2;
|
|
39370
39500
|
setIsSaving(true);
|
|
39371
39501
|
try {
|
|
@@ -39420,16 +39550,16 @@ var ProfileModal = ({
|
|
|
39420
39550
|
originalUsername,
|
|
39421
39551
|
toastCtx
|
|
39422
39552
|
]);
|
|
39423
|
-
const handleCancel = (0,
|
|
39553
|
+
const handleCancel = (0, import_react63.useCallback)(() => {
|
|
39424
39554
|
handleOpenChange(false);
|
|
39425
39555
|
}, [handleOpenChange]);
|
|
39426
|
-
const handleVerifyKalshi = (0,
|
|
39556
|
+
const handleVerifyKalshi = (0, import_react63.useCallback)(
|
|
39427
39557
|
(credentials) => __async(null, null, function* () {
|
|
39428
39558
|
if (onConnectKalshi) {
|
|
39429
39559
|
yield onConnectKalshi(credentials);
|
|
39430
39560
|
} else {
|
|
39431
39561
|
yield client.upsertVenueKey({
|
|
39432
|
-
venue:
|
|
39562
|
+
venue: import_sdk30.Venue.kalshi,
|
|
39433
39563
|
credentials: {
|
|
39434
39564
|
keyId: credentials.apiKeyId,
|
|
39435
39565
|
privateKey: credentials.privateKey
|
|
@@ -39441,12 +39571,12 @@ var ProfileModal = ({
|
|
|
39441
39571
|
}),
|
|
39442
39572
|
[client, onConnectKalshi, refetchKalshiStatus]
|
|
39443
39573
|
);
|
|
39444
|
-
const handleDisconnectKalshi = (0,
|
|
39445
|
-
yield client.deleteVenueKey(
|
|
39574
|
+
const handleDisconnectKalshi = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39575
|
+
yield client.deleteVenueKey(import_sdk30.Venue.kalshi);
|
|
39446
39576
|
yield refetchKalshiStatus();
|
|
39447
|
-
onDisconnectExchange == null ? void 0 : onDisconnectExchange(
|
|
39577
|
+
onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk30.Venue.kalshi);
|
|
39448
39578
|
}), [client, onDisconnectExchange, refetchKalshiStatus]);
|
|
39449
|
-
const resolvedVenueAccounts = (0,
|
|
39579
|
+
const resolvedVenueAccounts = (0, import_react63.useMemo)(() => {
|
|
39450
39580
|
var _a2;
|
|
39451
39581
|
const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
|
|
39452
39582
|
if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
|
|
@@ -39455,7 +39585,7 @@ var ProfileModal = ({
|
|
|
39455
39585
|
...nonKalshiAccounts != null ? nonKalshiAccounts : [],
|
|
39456
39586
|
{
|
|
39457
39587
|
id: "kalshi-venue-key",
|
|
39458
|
-
venue:
|
|
39588
|
+
venue: import_sdk30.Venue.kalshi,
|
|
39459
39589
|
status: "active",
|
|
39460
39590
|
kycStatus: kalshiStatus.kycStatus
|
|
39461
39591
|
}
|
|
@@ -39502,7 +39632,7 @@ var ProfileModal = ({
|
|
|
39502
39632
|
if (typeof window === "undefined") return;
|
|
39503
39633
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
39504
39634
|
};
|
|
39505
|
-
const surfaceError = (0,
|
|
39635
|
+
const surfaceError = (0, import_react63.useCallback)(
|
|
39506
39636
|
(err, title2) => {
|
|
39507
39637
|
const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
|
|
39508
39638
|
if (toastCtx) {
|
|
@@ -39513,7 +39643,7 @@ var ProfileModal = ({
|
|
|
39513
39643
|
},
|
|
39514
39644
|
[toastCtx]
|
|
39515
39645
|
);
|
|
39516
|
-
const handleConnectTwitter = (0,
|
|
39646
|
+
const handleConnectTwitter = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39517
39647
|
try {
|
|
39518
39648
|
const result = yield client.linkAccount({
|
|
39519
39649
|
provider: "twitter",
|
|
@@ -39527,7 +39657,7 @@ var ProfileModal = ({
|
|
|
39527
39657
|
surfaceError(err, "Could not connect X (Twitter)");
|
|
39528
39658
|
}
|
|
39529
39659
|
}), [client, onConnectTwitter, surfaceError]);
|
|
39530
|
-
const handleConnectGoogle = (0,
|
|
39660
|
+
const handleConnectGoogle = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39531
39661
|
try {
|
|
39532
39662
|
const result = yield client.linkAccount({
|
|
39533
39663
|
provider: "google",
|
|
@@ -39541,7 +39671,7 @@ var ProfileModal = ({
|
|
|
39541
39671
|
surfaceError(err, "Could not connect Google");
|
|
39542
39672
|
}
|
|
39543
39673
|
}), [client, onConnectGoogle, surfaceError]);
|
|
39544
|
-
const handleConnectApple = (0,
|
|
39674
|
+
const handleConnectApple = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39545
39675
|
try {
|
|
39546
39676
|
const result = yield client.linkAccount({
|
|
39547
39677
|
provider: "apple",
|
|
@@ -39555,7 +39685,7 @@ var ProfileModal = ({
|
|
|
39555
39685
|
surfaceError(err, "Could not connect Apple");
|
|
39556
39686
|
}
|
|
39557
39687
|
}), [client, onConnectApple, surfaceError]);
|
|
39558
|
-
const handleDisconnectTwitter = (0,
|
|
39688
|
+
const handleDisconnectTwitter = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39559
39689
|
try {
|
|
39560
39690
|
yield client.disconnectAccount("twitter");
|
|
39561
39691
|
yield client.getCurrentUser();
|
|
@@ -39564,7 +39694,7 @@ var ProfileModal = ({
|
|
|
39564
39694
|
surfaceError(err, "Could not disconnect X (Twitter)");
|
|
39565
39695
|
}
|
|
39566
39696
|
}), [client, onDisconnectTwitter, surfaceError]);
|
|
39567
|
-
const handleDisconnectGoogle = (0,
|
|
39697
|
+
const handleDisconnectGoogle = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39568
39698
|
try {
|
|
39569
39699
|
yield client.disconnectAccount("google");
|
|
39570
39700
|
yield client.getCurrentUser();
|
|
@@ -39573,7 +39703,7 @@ var ProfileModal = ({
|
|
|
39573
39703
|
surfaceError(err, "Could not disconnect Google");
|
|
39574
39704
|
}
|
|
39575
39705
|
}), [client, onDisconnectGoogle, surfaceError]);
|
|
39576
|
-
const handleDisconnectApple = (0,
|
|
39706
|
+
const handleDisconnectApple = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39577
39707
|
try {
|
|
39578
39708
|
yield client.disconnectAccount("apple");
|
|
39579
39709
|
yield client.getCurrentUser();
|
|
@@ -39582,7 +39712,7 @@ var ProfileModal = ({
|
|
|
39582
39712
|
surfaceError(err, "Could not disconnect Apple");
|
|
39583
39713
|
}
|
|
39584
39714
|
}), [client, onDisconnectApple, surfaceError]);
|
|
39585
|
-
const handleConnectEmail = (0,
|
|
39715
|
+
const handleConnectEmail = (0, import_react63.useCallback)(() => __async(null, null, function* () {
|
|
39586
39716
|
var _a2;
|
|
39587
39717
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
39588
39718
|
if (!typedEmail) return;
|
|
@@ -39601,7 +39731,7 @@ var ProfileModal = ({
|
|
|
39601
39731
|
surfaceError(err, "Could not connect email");
|
|
39602
39732
|
}
|
|
39603
39733
|
}), [client, onConnectEmail, surfaceError, toastCtx]);
|
|
39604
|
-
const handleDisconnectWallet = (0,
|
|
39734
|
+
const handleDisconnectWallet = (0, import_react63.useCallback)(
|
|
39605
39735
|
(wallet) => __async(null, null, function* () {
|
|
39606
39736
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
39607
39737
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -39615,7 +39745,7 @@ var ProfileModal = ({
|
|
|
39615
39745
|
}),
|
|
39616
39746
|
[client, onDisconnectWallet, surfaceError]
|
|
39617
39747
|
);
|
|
39618
|
-
const providerActionMap = (0,
|
|
39748
|
+
const providerActionMap = (0, import_react63.useMemo)(
|
|
39619
39749
|
() => ({
|
|
39620
39750
|
twitter: {
|
|
39621
39751
|
connect: () => {
|
|
@@ -39657,7 +39787,7 @@ var ProfileModal = ({
|
|
|
39657
39787
|
handleDisconnectTwitter
|
|
39658
39788
|
]
|
|
39659
39789
|
);
|
|
39660
|
-
const resolvedWallets = (0,
|
|
39790
|
+
const resolvedWallets = (0, import_react63.useMemo)(() => {
|
|
39661
39791
|
var _a2, _b2;
|
|
39662
39792
|
if (wallets) return wallets;
|
|
39663
39793
|
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
@@ -39822,7 +39952,7 @@ ProfileModal.displayName = "ProfileModal";
|
|
|
39822
39952
|
|
|
39823
39953
|
// src/geo-block-modal/index.tsx
|
|
39824
39954
|
var import_hooks107 = require("@agg-build/hooks");
|
|
39825
|
-
var
|
|
39955
|
+
var import_react64 = require("react");
|
|
39826
39956
|
var import_jsx_runtime219 = require("react/jsx-runtime");
|
|
39827
39957
|
var GeoBlockModal = ({
|
|
39828
39958
|
open,
|
|
@@ -39831,7 +39961,7 @@ var GeoBlockModal = ({
|
|
|
39831
39961
|
classNames
|
|
39832
39962
|
}) => {
|
|
39833
39963
|
const labels = (0, import_hooks107.useLabels)();
|
|
39834
|
-
const handleConfirm = (0,
|
|
39964
|
+
const handleConfirm = (0, import_react64.useCallback)(() => {
|
|
39835
39965
|
onConfirm == null ? void 0 : onConfirm();
|
|
39836
39966
|
onOpenChange(false);
|
|
39837
39967
|
}, [onConfirm, onOpenChange]);
|