@agg-build/ui 2.1.5 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-T4YZGAYS.mjs → chunk-4QGZ3FWI.mjs} +1 -1
- package/dist/{chunk-XUBIJI4R.mjs → chunk-JGBEQ4IV.mjs} +1079 -872
- package/dist/{chunk-BW7S2YR3.mjs → chunk-JOZPXDNZ.mjs} +48 -21
- package/dist/{chunk-R2YNZJZ3.mjs → chunk-LPIAEKSZ.mjs} +82 -2
- package/dist/{chunk-TBZWRUFB.mjs → chunk-QM3WWPCV.mjs} +201 -87
- package/dist/{chunk-VP76G6PN.mjs → chunk-UTXQUOU3.mjs} +177 -27
- package/dist/{chunk-XHE2VO3S.mjs → chunk-ZRYHWHTD.mjs} +2 -2
- package/dist/events.js +369 -82
- package/dist/events.mjs +3 -3
- package/dist/index.js +2180 -1621
- package/dist/index.mjs +9 -7
- package/dist/modals.js +2 -2
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +1552 -995
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +74 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +131 -20
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.types.d.mts +6 -2
- package/dist/types/events/item/event-list-item.types.d.ts +6 -2
- package/dist/types/events/item/event-list-item.utils.d.mts +3 -2
- package/dist/types/events/item/event-list-item.utils.d.ts +3 -2
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +0 -6
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +0 -6
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +9 -0
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +9 -0
- package/dist/types/events/market-details/market-details.types.d.mts +1 -0
- package/dist/types/events/market-details/market-details.types.d.ts +1 -0
- package/dist/types/events/shared/chart-venue-selection.d.mts +2 -1
- package/dist/types/events/shared/chart-venue-selection.d.ts +2 -1
- package/dist/types/events/shared/event-trading-state.utils.d.mts +4 -2
- package/dist/types/events/shared/event-trading-state.utils.d.ts +4 -2
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +1 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.mts +8 -0
- package/dist/types/pages/user-profile/components/claim-activity-breakdown-modal.d.ts +8 -0
- package/dist/types/pages/user-profile/index.d.mts +1 -1
- package/dist/types/pages/user-profile/index.d.ts +1 -1
- package/dist/types/pages/user-profile/user-profile.types.d.mts +14 -0
- package/dist/types/pages/user-profile/user-profile.types.d.ts +14 -0
- package/dist/types/primitives/search/search.types.d.mts +1 -0
- package/dist/types/primitives/search/search.types.d.ts +1 -0
- package/dist/types/primitives/search/search.utils.d.mts +4 -1
- package/dist/types/primitives/search/search.utils.d.ts +4 -1
- package/dist/types/shared/utils.d.mts +16 -0
- package/dist/types/shared/utils.d.ts +16 -0
- package/dist/types/trading/types.d.mts +2 -1
- package/dist/types/trading/types.d.ts +2 -1
- package/package.json +3 -3
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LPIAEKSZ.mjs";
|
|
12
12
|
import {
|
|
13
13
|
GeoBlockBanner,
|
|
14
14
|
subscribeAggDepositNotification
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4QGZ3FWI.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AGG_TERMS_OF_SERVICE_URL,
|
|
18
18
|
Button,
|
|
@@ -41,9 +41,10 @@ import {
|
|
|
41
41
|
formatSportsEventTimeEt,
|
|
42
42
|
formatUsd,
|
|
43
43
|
getMotionClassName,
|
|
44
|
+
resolveResolvedOutcomeLabel,
|
|
44
45
|
skeletonViews,
|
|
45
46
|
useOptionalToast
|
|
46
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-UTXQUOU3.mjs";
|
|
47
48
|
|
|
48
49
|
// src/trading/types.ts
|
|
49
50
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -106,6 +107,7 @@ import {
|
|
|
106
107
|
useLiveBestPrices,
|
|
107
108
|
useLiveOutcomePrices,
|
|
108
109
|
useManagedBalances,
|
|
110
|
+
useMidpoints,
|
|
109
111
|
useQueryClient,
|
|
110
112
|
useSdkUiConfig,
|
|
111
113
|
useSmartRoute
|
|
@@ -1119,7 +1121,7 @@ var mapVenueMarketOutcomesToPlaceOrderOutcomes = (venueMarketOutcomes) => {
|
|
|
1119
1121
|
label: outcome.label,
|
|
1120
1122
|
title: (_a = outcome.title) != null ? _a : null,
|
|
1121
1123
|
price: outcome.price,
|
|
1122
|
-
priceLabel: getTradingPriceLabel(outcome.price)
|
|
1124
|
+
priceLabel: outcome.price != null ? getTradingPriceLabel(outcome.price) : ""
|
|
1123
1125
|
};
|
|
1124
1126
|
});
|
|
1125
1127
|
};
|
|
@@ -2784,7 +2786,7 @@ var PlaceOrderResolvedView = ({
|
|
|
2784
2786
|
className,
|
|
2785
2787
|
isSportsEvent = false
|
|
2786
2788
|
}) => {
|
|
2787
|
-
var _a;
|
|
2789
|
+
var _a, _b;
|
|
2788
2790
|
const labels = useLabels();
|
|
2789
2791
|
const tradingLabels = labels.trading;
|
|
2790
2792
|
const resolvingTimestamp = (_a = resolutionTimestamp != null ? resolutionTimestamp : tradingState.resolvesAt) != null ? _a : tradingState.endsAt;
|
|
@@ -2862,7 +2864,16 @@ var PlaceOrderResolvedView = ({
|
|
|
2862
2864
|
),
|
|
2863
2865
|
children: [
|
|
2864
2866
|
tradingState.market ? /* @__PURE__ */ jsx5(Typography, { variant: "body", className: "text-center", children: tradingState.market.question }) : null,
|
|
2865
|
-
tradingState.winningOutcome ? /* @__PURE__ */ jsx5(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
|
|
2867
|
+
tradingState.winningOutcome ? /* @__PURE__ */ jsx5(Typography, { variant: "body-large-strong", children: tradingLabels.outcome(
|
|
2868
|
+
shouldUseRawResolvedPlaceOrderOutcomeLabel(
|
|
2869
|
+
tradingState.market,
|
|
2870
|
+
tradingState.winningOutcome
|
|
2871
|
+
) ? tradingState.winningOutcome.label : (_b = resolveResolvedOutcomeLabel({
|
|
2872
|
+
market: tradingState.market,
|
|
2873
|
+
outcome: tradingState.winningOutcome,
|
|
2874
|
+
allowSportsMoneylineMarketFallback: false
|
|
2875
|
+
})) != null ? _b : tradingState.winningOutcome.label
|
|
2876
|
+
) }) : null
|
|
2866
2877
|
]
|
|
2867
2878
|
}
|
|
2868
2879
|
)
|
|
@@ -2924,6 +2935,16 @@ var renderRouteBreakdownRow = (row) => {
|
|
|
2924
2935
|
rowKey
|
|
2925
2936
|
);
|
|
2926
2937
|
};
|
|
2938
|
+
var SIDE_NAMED_MONEYLINE_QUESTION_RE = /\s(?:vs\.?|@|at)\s/i;
|
|
2939
|
+
var shouldUseRawResolvedPlaceOrderOutcomeLabel = (market, outcome) => {
|
|
2940
|
+
var _a, _b;
|
|
2941
|
+
if (!market || !outcome) return false;
|
|
2942
|
+
const isSportsMoneylineMarket = (market.sportsMarketType === "moneyline" || market.marketGroup === "game_lines") && (outcome.label.trim().toLowerCase() === "yes" || outcome.label.trim().toLowerCase() === "no");
|
|
2943
|
+
if (!isSportsMoneylineMarket) return false;
|
|
2944
|
+
const marketLabel = ((_b = (_a = market.shortTitle) != null ? _a : market.question) != null ? _b : "").trim();
|
|
2945
|
+
if (!marketLabel) return false;
|
|
2946
|
+
return !SIDE_NAMED_MONEYLINE_QUESTION_RE.test(marketLabel);
|
|
2947
|
+
};
|
|
2927
2948
|
var renderRouteCard = ({
|
|
2928
2949
|
card,
|
|
2929
2950
|
enableAnimations,
|
|
@@ -3339,16 +3360,10 @@ var PlaceOrder = ({
|
|
|
3339
3360
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
3340
3361
|
);
|
|
3341
3362
|
const wsBestPrices = useLiveBestPrices(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
|
|
3342
|
-
const
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
bestPrices: /* @__PURE__ */ new Map(),
|
|
3347
|
-
bestPriceVenuesByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3348
|
-
isLoading: false,
|
|
3349
|
-
bestMidpoint: void 0,
|
|
3350
|
-
bestMidpointVenue: void 0
|
|
3351
|
-
};
|
|
3363
|
+
const fetchedClusterMidpointResult = useMidpoints(
|
|
3364
|
+
midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
|
|
3365
|
+
);
|
|
3366
|
+
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
3352
3367
|
const clusterBestMidpointsByOutcomeId = (_i = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _i : clusterMidpointResult.prices;
|
|
3353
3368
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
3354
3369
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
@@ -4531,11 +4546,11 @@ var PlaceOrder = ({
|
|
|
4531
4546
|
bestPrices: clusterBestPrices,
|
|
4532
4547
|
bestMidpoint: clusterBestMidpoint,
|
|
4533
4548
|
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
4534
|
-
livePrices
|
|
4535
|
-
fallbackPrice: outcome.price
|
|
4549
|
+
livePrices
|
|
4536
4550
|
});
|
|
4537
4551
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
4538
4552
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
4553
|
+
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
4539
4554
|
return /* @__PURE__ */ jsxs4(
|
|
4540
4555
|
"button",
|
|
4541
4556
|
{
|
|
@@ -4565,7 +4580,16 @@ var PlaceOrder = ({
|
|
|
4565
4580
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
4566
4581
|
}
|
|
4567
4582
|
),
|
|
4568
|
-
/* @__PURE__ */ jsx5(
|
|
4583
|
+
isPriceLoading ? /* @__PURE__ */ jsx5(
|
|
4584
|
+
"span",
|
|
4585
|
+
{
|
|
4586
|
+
"aria-hidden": "true",
|
|
4587
|
+
className: cn(
|
|
4588
|
+
"agg-place-order-outcome-price-loading",
|
|
4589
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
4590
|
+
)
|
|
4591
|
+
}
|
|
4592
|
+
) : /* @__PURE__ */ jsx5(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
4569
4593
|
]
|
|
4570
4594
|
},
|
|
4571
4595
|
outcome.id
|
|
@@ -5168,7 +5192,7 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
5168
5192
|
}, executionMode === "paper" ? { mode: "paper" } : {}));
|
|
5169
5193
|
const claimWinnings = useClaimWinnings();
|
|
5170
5194
|
return useMemo4(() => {
|
|
5171
|
-
var _a2
|
|
5195
|
+
var _a2;
|
|
5172
5196
|
if (!shouldFetch || !marketId) return void 0;
|
|
5173
5197
|
const group = positions.find(
|
|
5174
5198
|
(candidate) => candidate.targetMarketId === marketId
|
|
@@ -5180,7 +5204,10 @@ function useResolvedMarketClaim(options = {}) {
|
|
|
5180
5204
|
if (winningOutcomes.length === 0) return void 0;
|
|
5181
5205
|
const totals = computeClosedPositionTotals(group);
|
|
5182
5206
|
const winningShares = winningOutcomes.reduce((sum, outcome) => sum + outcome.totalSize, 0);
|
|
5183
|
-
const winningOutcomeLabel = (
|
|
5207
|
+
const winningOutcomeLabel = (_a2 = resolveResolvedOutcomeLabel({
|
|
5208
|
+
market: market != null ? market : group.venueMarket,
|
|
5209
|
+
outcome: winningOutcomes[0]
|
|
5210
|
+
})) != null ? _a2 : "";
|
|
5184
5211
|
const claimKey = group.targetMarketId;
|
|
5185
5212
|
const canClaim = group.redeemStatus === "eligible" && totals.winningOutcomeIds.length > 0;
|
|
5186
5213
|
return {
|
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
normalizeProbability,
|
|
14
14
|
normalizeVenueMarketCluster,
|
|
15
15
|
resolveOutcomeTitle,
|
|
16
|
+
resolveResolvedOutcomeLabel,
|
|
16
17
|
resolveVenueLineColor,
|
|
17
18
|
selectPrimaryVenueMarket,
|
|
18
19
|
skeletonViews,
|
|
19
20
|
sortOutcomes
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-UTXQUOU3.mjs";
|
|
21
22
|
|
|
22
23
|
// src/trading/trading-context/index.tsx
|
|
23
24
|
import { useEventTradingContext } from "@agg-build/hooks";
|
|
@@ -508,6 +509,79 @@ var isDateLikeLabel = (value) => {
|
|
|
508
509
|
if (!value.trim()) return false;
|
|
509
510
|
return dayjs2(value).isValid();
|
|
510
511
|
};
|
|
512
|
+
var CHART_RANGE_PRIORITY = ["1H", "6H", "1D", "1W", "1M", "ALL"];
|
|
513
|
+
var RANGE_SECONDS_BY_TIME_RANGE = {
|
|
514
|
+
"1H": 60 * 60,
|
|
515
|
+
"6H": 6 * 60 * 60,
|
|
516
|
+
"1D": 24 * 60 * 60,
|
|
517
|
+
"1W": 7 * 24 * 60 * 60,
|
|
518
|
+
"1M": 30 * 24 * 60 * 60,
|
|
519
|
+
ALL: 6 * 30 * 24 * 60 * 60
|
|
520
|
+
};
|
|
521
|
+
var toUnixTimestamp = (value) => {
|
|
522
|
+
if (!value) return null;
|
|
523
|
+
const parsedValue = dayjs2(value);
|
|
524
|
+
if (!parsedValue.isValid()) return null;
|
|
525
|
+
return parsedValue.unix();
|
|
526
|
+
};
|
|
527
|
+
var isResolvedMarketStatus = (status) => {
|
|
528
|
+
if (!status) return false;
|
|
529
|
+
const normalizedStatus = status.trim().toLowerCase();
|
|
530
|
+
return normalizedStatus.includes("resolved") || normalizedStatus.includes("closed") || normalizedStatus.includes("settled") || normalizedStatus.includes("final");
|
|
531
|
+
};
|
|
532
|
+
var resolveInitialEventDetailsChartRange = ({
|
|
533
|
+
chartData,
|
|
534
|
+
event,
|
|
535
|
+
fallbackRange,
|
|
536
|
+
nowSec = dayjs2().unix(),
|
|
537
|
+
selectedMarket
|
|
538
|
+
}) => {
|
|
539
|
+
var _a, _b;
|
|
540
|
+
const scopedMarkets = selectedMarket ? [selectedMarket] : event.venueMarkets;
|
|
541
|
+
const preferredEventStart = (_a = toUnixTimestamp(event.startDate)) != null ? _a : toUnixTimestamp(event.creationDate);
|
|
542
|
+
const marketStartCandidates = scopedMarkets.map((market) => {
|
|
543
|
+
var _a2;
|
|
544
|
+
return (_a2 = toUnixTimestamp(market.startDate)) != null ? _a2 : toUnixTimestamp(market.creationDate);
|
|
545
|
+
}).filter((value) => value != null);
|
|
546
|
+
const metadataStarts = [preferredEventStart, ...marketStartCandidates].filter(
|
|
547
|
+
(value) => value != null
|
|
548
|
+
);
|
|
549
|
+
const metadataEnds = [
|
|
550
|
+
toUnixTimestamp(event.endDate),
|
|
551
|
+
...scopedMarkets.flatMap((market) => [
|
|
552
|
+
toUnixTimestamp(market.endDate),
|
|
553
|
+
toUnixTimestamp(market.resolutionDate)
|
|
554
|
+
])
|
|
555
|
+
].filter((value) => value != null);
|
|
556
|
+
const historyTimestamps = chartData == null ? [] : Object.values(chartData.venues).flatMap((venueData) => [
|
|
557
|
+
...venueData.candles.map((candle) => candle.time),
|
|
558
|
+
...venueData.liveCandle ? [venueData.liveCandle.time] : []
|
|
559
|
+
]);
|
|
560
|
+
const startCandidates = [...metadataStarts, ...historyTimestamps];
|
|
561
|
+
if (startCandidates.length === 0) {
|
|
562
|
+
return fallbackRange != null ? fallbackRange : null;
|
|
563
|
+
}
|
|
564
|
+
const marketResolved = [event.status, ...scopedMarkets.map((market) => market.status)].some(
|
|
565
|
+
isResolvedMarketStatus
|
|
566
|
+
);
|
|
567
|
+
const isUsingSharedOverlapStart = scopedMarkets.length > 1 && marketStartCandidates.length === scopedMarkets.length;
|
|
568
|
+
const startTs = isUsingSharedOverlapStart ? Math.max(...marketStartCandidates) : Math.min(...startCandidates);
|
|
569
|
+
const endTs = Math.max(
|
|
570
|
+
...marketResolved && metadataEnds.length > 0 ? [nowSec, ...metadataEnds, ...historyTimestamps] : [nowSec, ...historyTimestamps]
|
|
571
|
+
);
|
|
572
|
+
const spanSeconds = Math.max(0, endTs - startTs);
|
|
573
|
+
if (spanSeconds <= 0) {
|
|
574
|
+
return fallbackRange != null ? fallbackRange : null;
|
|
575
|
+
}
|
|
576
|
+
if (!marketResolved && spanSeconds > RANGE_SECONDS_BY_TIME_RANGE["1M"]) {
|
|
577
|
+
return "1M";
|
|
578
|
+
}
|
|
579
|
+
const requiredSeconds = spanSeconds * (isUsingSharedOverlapStart ? 1 : marketResolved ? 1.05 : 1.2);
|
|
580
|
+
const matchingRange = CHART_RANGE_PRIORITY.find((range) => {
|
|
581
|
+
return RANGE_SECONDS_BY_TIME_RANGE[range] >= requiredSeconds;
|
|
582
|
+
});
|
|
583
|
+
return (_b = matchingRange != null ? matchingRange : fallbackRange) != null ? _b : "ALL";
|
|
584
|
+
};
|
|
511
585
|
var matchOutcomeByLabel = (outcome, selectedOutcomeLabel) => {
|
|
512
586
|
const normalizedSelectedLabel = normalizeLabel(selectedOutcomeLabel);
|
|
513
587
|
const semanticSelectedLabel = toSemanticLabel(selectedOutcomeLabel);
|
|
@@ -1122,8 +1196,13 @@ var resolveTradingStateTimestampLabel = (labels, state) => {
|
|
|
1122
1196
|
return null;
|
|
1123
1197
|
};
|
|
1124
1198
|
var resolveTradingStatePresentation = (labels, state) => {
|
|
1199
|
+
var _a;
|
|
1125
1200
|
const timestampLabel = resolveTradingStateTimestampLabel(labels, state);
|
|
1126
|
-
const
|
|
1201
|
+
const resolvedOutcomeLabel = resolveResolvedOutcomeLabel({
|
|
1202
|
+
market: (_a = state.market) != null ? _a : null,
|
|
1203
|
+
outcome: state.winningOutcome
|
|
1204
|
+
});
|
|
1205
|
+
const winningOutcomeLabel = resolvedOutcomeLabel ? labels.eventMarketPage.winningOutcome(resolvedOutcomeLabel) : null;
|
|
1127
1206
|
if (state.kind === "resolved") {
|
|
1128
1207
|
return {
|
|
1129
1208
|
badgeLabel: labels.eventMarketPage.tradingResolvedBadge,
|
|
@@ -1211,6 +1290,7 @@ var resolveOrderEligibilityMessage = (labels, reason) => {
|
|
|
1211
1290
|
export {
|
|
1212
1291
|
useEventTradingContext,
|
|
1213
1292
|
sortOutcomeSelectorOutcomes,
|
|
1293
|
+
resolveInitialEventDetailsChartRange,
|
|
1214
1294
|
resolveOutcomesByVenue,
|
|
1215
1295
|
resolveSeriesColor,
|
|
1216
1296
|
resolveMarketChartVenueSeries,
|