@agg-build/ui 2.5.3 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AELMIG74.mjs → chunk-C247AYH7.mjs} +242 -162
- package/dist/{chunk-FAU2VOL6.mjs → chunk-O27JUYCF.mjs} +36 -25
- package/dist/index.js +277 -186
- package/dist/index.mjs +2 -2
- package/dist/pages.js +277 -186
- package/dist/pages.mjs +2 -2
- package/dist/trading.js +36 -25
- package/dist/trading.mjs +1 -1
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +5 -5
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +5 -5
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +34 -43
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +34 -43
- package/dist/types/pages/event-market/sports-markets.d.mts +1 -2
- package/dist/types/pages/event-market/sports-markets.d.ts +1 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +9 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +9 -0
- package/package.json +2 -2
|
@@ -1366,7 +1366,7 @@ var buildLiveRouteCards = ({
|
|
|
1366
1366
|
};
|
|
1367
1367
|
}
|
|
1368
1368
|
const avgPrice = sq.avgPrice;
|
|
1369
|
-
const soloQuoteData = __spreadProps(__spreadValues({}, quoteData), {
|
|
1369
|
+
const soloQuoteData = __spreadValues(__spreadProps(__spreadValues({}, quoteData), {
|
|
1370
1370
|
// Preview-only solos intentionally carry no executable quoteId; the card
|
|
1371
1371
|
// should still render for comparison, while the CTA stays disabled until
|
|
1372
1372
|
// the user is funded and requotes.
|
|
@@ -1379,7 +1379,7 @@ var buildLiveRouteCards = ({
|
|
|
1379
1379
|
returnPct: sq.returnPct,
|
|
1380
1380
|
// venueSoloQuotes stripped on solo card's quoteData (only the primary needs them)
|
|
1381
1381
|
venueSoloQuotes: void 0
|
|
1382
|
-
});
|
|
1382
|
+
}), sq.quoteId ? { status: "ok", error: void 0 } : null);
|
|
1383
1383
|
return {
|
|
1384
1384
|
id: `live-solo-${sq.venue}`,
|
|
1385
1385
|
hint: labels.averagePrice(avgPrice),
|
|
@@ -1435,6 +1435,17 @@ var buildLiveRouteCards = ({
|
|
|
1435
1435
|
})() : [];
|
|
1436
1436
|
return [...baseCards, ...unavailableCards, ...warningOnlyUnavailableCards];
|
|
1437
1437
|
};
|
|
1438
|
+
var resolveDefaultRouteCardId = (routeCards, primaryStatus) => {
|
|
1439
|
+
var _a, _b, _c, _d;
|
|
1440
|
+
if (routeCards.length === 0) return null;
|
|
1441
|
+
if (primaryStatus === "insufficient_balance") {
|
|
1442
|
+
const executableCard = routeCards.find(
|
|
1443
|
+
(card) => !card.isUnavailable && card.quoteData.status === "ok" && card.quoteData.quoteId
|
|
1444
|
+
);
|
|
1445
|
+
if (executableCard) return executableCard.id;
|
|
1446
|
+
}
|
|
1447
|
+
return (_d = (_c = (_a = routeCards.find((card) => !card.isUnavailable)) == null ? void 0 : _a.id) != null ? _c : (_b = routeCards[0]) == null ? void 0 : _b.id) != null ? _d : null;
|
|
1448
|
+
};
|
|
1438
1449
|
var sellSharesToAtomicUnits = (shares) => {
|
|
1439
1450
|
if (!Number.isFinite(shares) || shares <= 0) return BigInt(0);
|
|
1440
1451
|
const [whole = "0", fraction = ""] = shares.toFixed(12).split(".");
|
|
@@ -3369,7 +3380,7 @@ var PlaceOrder = ({
|
|
|
3369
3380
|
resolvedClaim,
|
|
3370
3381
|
midpointsResult
|
|
3371
3382
|
}) => {
|
|
3372
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X;
|
|
3383
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y;
|
|
3373
3384
|
const {
|
|
3374
3385
|
enableDebug: isExecutionDebugEnabled,
|
|
3375
3386
|
features: { enableAnimations, showFeesBreakdown, showLimitOrders },
|
|
@@ -3800,13 +3811,13 @@ var PlaceOrder = ({
|
|
|
3800
3811
|
venueSellQuotes.quotes
|
|
3801
3812
|
]);
|
|
3802
3813
|
const resolvedSelectedRouteCardId = useMemo(() => {
|
|
3803
|
-
var _a2
|
|
3814
|
+
var _a2;
|
|
3804
3815
|
if (routeCards.length === 0) return null;
|
|
3805
3816
|
if (selectedRouteCardId && routeCards.some((card) => card.id === selectedRouteCardId && !card.isUnavailable)) {
|
|
3806
3817
|
return selectedRouteCardId;
|
|
3807
3818
|
}
|
|
3808
|
-
return (
|
|
3809
|
-
}, [routeCards, selectedRouteCardId]);
|
|
3819
|
+
return resolveDefaultRouteCardId(routeCards, isSell ? void 0 : (_a2 = smartRoute.data) == null ? void 0 : _a2.status);
|
|
3820
|
+
}, [routeCards, selectedRouteCardId, isSell, (_w = smartRoute.data) == null ? void 0 : _w.status]);
|
|
3810
3821
|
useEffect2(() => {
|
|
3811
3822
|
if (routeCards.length === 0) {
|
|
3812
3823
|
setSelectedRouteCardId(null);
|
|
@@ -3846,14 +3857,14 @@ var PlaceOrder = ({
|
|
|
3846
3857
|
setLimitPriceInputError(null);
|
|
3847
3858
|
}, [executionType, scopedSelectedOutcomeId, selectedOutcomeDisplayPrice]);
|
|
3848
3859
|
const orderedRouteCards = routeCards;
|
|
3849
|
-
const selectedRouteCard = (
|
|
3860
|
+
const selectedRouteCard = (_y = (_x = orderedRouteCards.find((card) => card.id === resolvedSelectedRouteCardId)) != null ? _x : orderedRouteCards[0]) != null ? _y : null;
|
|
3850
3861
|
const isKalshiRoute = useMemo(() => {
|
|
3851
3862
|
if (selectedRouteCard) {
|
|
3852
3863
|
return selectedRouteCard.venue === "kalshi" || selectedRouteCard.quoteData.fills.some((f) => f.venue === "kalshi");
|
|
3853
3864
|
}
|
|
3854
3865
|
return (scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venue) === "kalshi";
|
|
3855
3866
|
}, [selectedRouteCard, scopedSelectedMarket]);
|
|
3856
|
-
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (
|
|
3867
|
+
const displayedBalance = isPaperMode ? paperTotalBalance : isKalshiRoute ? (_z = liveBalanceState.kalshiBalance) != null ? _z : 0 : liveAvailableBalance;
|
|
3857
3868
|
const legacyKalshiAccount = useMemo(
|
|
3858
3869
|
() => {
|
|
3859
3870
|
var _a2;
|
|
@@ -3861,8 +3872,8 @@ var PlaceOrder = ({
|
|
|
3861
3872
|
},
|
|
3862
3873
|
[user == null ? void 0 : user.venueAccounts]
|
|
3863
3874
|
);
|
|
3864
|
-
const isKalshiAccountActive = (
|
|
3865
|
-
const isKalshiVerified = ((
|
|
3875
|
+
const isKalshiAccountActive = (_A = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.connected) != null ? _A : (legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.status) === "active";
|
|
3876
|
+
const isKalshiVerified = ((_B = kalshiKeyStatus == null ? void 0 : kalshiKeyStatus.kycStatus) != null ? _B : legacyKalshiAccount == null ? void 0 : legacyKalshiAccount.kycStatus) === "verified";
|
|
3866
3877
|
const hasKalshiConnectionState = kalshiKeyStatus !== void 0 || (user == null ? void 0 : user.venueAccounts) != null;
|
|
3867
3878
|
const isKalshiAvailable = getVenueAvailabilityState({
|
|
3868
3879
|
venueId: "kalshi",
|
|
@@ -3889,7 +3900,7 @@ var PlaceOrder = ({
|
|
|
3889
3900
|
[aggClient, onConnectKalshi, refetchKalshiKeyStatus]
|
|
3890
3901
|
);
|
|
3891
3902
|
const needsKycVerification = isAuthenticated && hasKalshiConnectionState && isKalshiRoute && isKalshiAccountActive && !isKalshiVerified;
|
|
3892
|
-
const verifyKalshiConnectionLabel = (
|
|
3903
|
+
const verifyKalshiConnectionLabel = (_F = (_E = (_D = (_C = labels.onboarding) == null ? void 0 : _C.connectKalshiModal) == null ? void 0 : _D.actions) == null ? void 0 : _E.verifyConnection) != null ? _F : tradingLabels.kycRequired;
|
|
3893
3904
|
const handleRouteCardSelect = useCallback2(
|
|
3894
3905
|
(cardId) => {
|
|
3895
3906
|
if (cardId === resolvedSelectedRouteCardId) {
|
|
@@ -3904,15 +3915,15 @@ var PlaceOrder = ({
|
|
|
3904
3915
|
[resolvedSelectedRouteCardId, routeCards]
|
|
3905
3916
|
);
|
|
3906
3917
|
const executionProgress = useExecutionProgress({
|
|
3907
|
-
orderIds: (
|
|
3908
|
-
quoteId: (
|
|
3918
|
+
orderIds: (_G = submissionProgressState == null ? void 0 : submissionProgressState.orderIds) != null ? _G : null,
|
|
3919
|
+
quoteId: (_H = submissionProgressState == null ? void 0 : submissionProgressState.quoteId) != null ? _H : null,
|
|
3909
3920
|
mode: isPaperMode ? "paper" : void 0,
|
|
3910
|
-
enabled: ((submissionProgressState == null ? void 0 : submissionProgressState.phase) === "submitting" || (submissionProgressState == null ? void 0 : submissionProgressState.phase) === "executing") && !!((
|
|
3921
|
+
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)
|
|
3911
3922
|
});
|
|
3912
|
-
const selectedOutcomeLabel = (
|
|
3913
|
-
const headerImage = (
|
|
3914
|
-
const headerTitle = (
|
|
3915
|
-
const headerSubtitle = (
|
|
3923
|
+
const selectedOutcomeLabel = (_L = (_K = (_J = outcomes.find((outcome) => outcome.id === scopedSelectedOutcomeId)) == null ? void 0 : _J.label) != null ? _K : scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _L : "";
|
|
3924
|
+
const headerImage = (_N = (_M = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.image) != null ? _M : scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.image) != null ? _N : null;
|
|
3925
|
+
const headerTitle = (_P = (_O = scopedSelectedEvent == null ? void 0 : scopedSelectedEvent.title) != null ? _O : scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _P : "";
|
|
3926
|
+
const headerSubtitle = (_Q = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.question) != null ? _Q : "";
|
|
3916
3927
|
const buildExecutionSummary = useCallback2(
|
|
3917
3928
|
(quoteData, executionVenue, orderId, partialFillSummary) => {
|
|
3918
3929
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
@@ -4210,19 +4221,19 @@ var PlaceOrder = ({
|
|
|
4210
4221
|
queryClient,
|
|
4211
4222
|
submissionProgressState
|
|
4212
4223
|
]);
|
|
4213
|
-
const activeQuoteData = (
|
|
4224
|
+
const activeQuoteData = (_S = (_R = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData) != null ? _R : smartRoute.data) != null ? _S : null;
|
|
4214
4225
|
const visibleRouteCards = orderedRouteCards.length > PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT && !isRoutesExpanded ? orderedRouteCards.slice(0, PLACE_ORDER_ROUTE_COLLAPSED_CARD_COUNT) : orderedRouteCards;
|
|
4215
4226
|
const hasEnteredAmount = internalAmount > 0;
|
|
4216
4227
|
const isQuoteLoading = !isLimitOrder && hasEnteredAmount && (smartRoute.isFetching || smartRoute.isLoading || isSell && (venueSellQuotes.isFetching || venueSellQuotes.isLoading));
|
|
4217
4228
|
const routeLoadingMessage = isQuoteLoading ? smartRoute.loadingReason === "updating-route" ? tradingLabels.updatingRoute : smartRoute.loadingReason === "refreshing-quotes" ? tradingLabels.refreshingQuotes : tradingLabels.findingBestOdds : null;
|
|
4218
|
-
const selectedRouteFills = (
|
|
4229
|
+
const selectedRouteFills = (_T = selectedRouteCard == null ? void 0 : selectedRouteCard.quoteData.fills) != null ? _T : [];
|
|
4219
4230
|
const isKalshiOnlyRoute = isKalshiRoute && ((selectedRouteCard == null ? void 0 : selectedRouteCard.venue) === Venue4.kalshi || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue === Venue4.kalshi));
|
|
4220
4231
|
const isOnchainOnlyRoute = !isKalshiRoute || selectedRouteFills.length > 0 && selectedRouteFills.every((fill) => fill.venue !== Venue4.kalshi);
|
|
4221
4232
|
const kalshiRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue === Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4222
4233
|
const onchainRequiredAmount = isSell ? 0 : selectedRouteFills.filter((fill) => fill.venue !== Venue4.kalshi).reduce((total, fill) => total + fill.venueQty * fill.avgPrice, 0);
|
|
4223
4234
|
const resolvedKalshiRequiredAmount = isKalshiOnlyRoute || isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : kalshiRequiredAmount;
|
|
4224
4235
|
const resolvedOnchainRequiredAmount = isOnchainOnlyRoute || !isKalshiRoute && selectedRouteFills.length === 0 ? internalAmount : onchainRequiredAmount;
|
|
4225
|
-
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((
|
|
4236
|
+
const isKalshiBalanceInsufficient = !isPaperMode && isKalshiRoute && resolvedKalshiRequiredAmount > ((_U = liveBalanceState.kalshiBalance) != null ? _U : 0);
|
|
4226
4237
|
const isOnchainBalanceInsufficient = resolvedOnchainRequiredAmount > liveAvailableBalance;
|
|
4227
4238
|
const isInsufficientBalance = !isSell && isAuthenticated && hasEnteredAmount && !isBalanceLoading && (isLimitOrder ? internalAmount > totalBalance : isPaperMode ? internalAmount > paperTotalBalance : isKalshiBalanceInsufficient || isOnchainBalanceInsufficient);
|
|
4228
4239
|
const isQuoteInsufficientBalance = !isLimitOrder && (activeQuoteData == null ? void 0 : activeQuoteData.status) === "insufficient_balance";
|
|
@@ -4316,7 +4327,7 @@ var PlaceOrder = ({
|
|
|
4316
4327
|
}
|
|
4317
4328
|
return (_d2 = selectedRouteCard.hint) != null ? _d2 : "";
|
|
4318
4329
|
}, [selectedRouteCard, tradingLabels]);
|
|
4319
|
-
const displayedToWinValue = (
|
|
4330
|
+
const displayedToWinValue = (_V = selectedRouteCard == null ? void 0 : selectedRouteCard.numericValue) != null ? _V : 0;
|
|
4320
4331
|
const limitOrderPayload = useMemo(() => {
|
|
4321
4332
|
if (!scopedSelectedMarket || !scopedSelectedOutcomeId || internalAmount <= 0) return null;
|
|
4322
4333
|
if (limitPriceInputError) return null;
|
|
@@ -4435,13 +4446,13 @@ var PlaceOrder = ({
|
|
|
4435
4446
|
];
|
|
4436
4447
|
}, [activeFeeBreakdown, tradingLabels]);
|
|
4437
4448
|
const isActionLoading = isPrimaryActionLoading || executeManaged.isPending || placeLimitOrder.isPending || isBeforeActionPending;
|
|
4438
|
-
const selectedRouteGeoBlocked = (
|
|
4449
|
+
const selectedRouteGeoBlocked = (_W = selectedRouteCard == null ? void 0 : selectedRouteCard.isUnavailable) != null ? _W : false;
|
|
4439
4450
|
const geoBlockedVenuesFromWarnings = useMemo(
|
|
4440
4451
|
() => {
|
|
4441
4452
|
var _a2;
|
|
4442
4453
|
return extractGeoBlockedVenues((_a2 = smartRoute.data) == null ? void 0 : _a2.warnings);
|
|
4443
4454
|
},
|
|
4444
|
-
[(
|
|
4455
|
+
[(_X = smartRoute.data) == null ? void 0 : _X.warnings]
|
|
4445
4456
|
);
|
|
4446
4457
|
const isPrimaryVenueGeoBlocked = useMemo(() => {
|
|
4447
4458
|
var _a2, _b2;
|
|
@@ -5099,7 +5110,7 @@ var PlaceOrder = ({
|
|
|
5099
5110
|
PlaceOrderResolvedView,
|
|
5100
5111
|
{
|
|
5101
5112
|
tradingState: resolvedReadOnlyTradingState,
|
|
5102
|
-
resolutionTimestamp: (
|
|
5113
|
+
resolutionTimestamp: (_Y = resolvedEventTradingState.resolvesAt) != null ? _Y : resolvedReadOnlyTradingState.resolvesAt,
|
|
5103
5114
|
resolvedClaim,
|
|
5104
5115
|
classNames,
|
|
5105
5116
|
className,
|