@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
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getDisplayOutcomePrice,
|
|
8
8
|
getFirstSettlementParagraph,
|
|
9
9
|
resolveHeaderOutcomeItems,
|
|
10
|
+
resolveInitialEventDetailsChartRange,
|
|
10
11
|
resolveInitialOutcomeLabel,
|
|
11
12
|
resolveInitialTab,
|
|
12
13
|
resolveMarketChartDisplaySeries,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
resolveUnifiedOrderBookEntries,
|
|
23
24
|
sortOutcomeSelectorOutcomes,
|
|
24
25
|
useEventTradingContext
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-LPIAEKSZ.mjs";
|
|
26
27
|
import {
|
|
27
28
|
AutocompleteSelect,
|
|
28
29
|
Badge,
|
|
@@ -67,13 +68,14 @@ import {
|
|
|
67
68
|
resolveDisplayVolume,
|
|
68
69
|
resolveEventListItemEvent,
|
|
69
70
|
resolveOutcomeTitle,
|
|
71
|
+
resolveResolvedOutcomeLabel,
|
|
70
72
|
resolveTabVenus,
|
|
71
73
|
resolveVenueLabel,
|
|
72
74
|
resolveYesOutcome,
|
|
73
75
|
sortCategoriesForNavigation,
|
|
74
76
|
sortOutcomes,
|
|
75
77
|
splitEventsByLifecycle
|
|
76
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-UTXQUOU3.mjs";
|
|
77
79
|
|
|
78
80
|
// src/events/item/index.tsx
|
|
79
81
|
import {
|
|
@@ -143,9 +145,8 @@ var collectOutcomePrices = (market, outcome, priceByOutcomeId) => {
|
|
|
143
145
|
const prices = [];
|
|
144
146
|
const seenOutcomeKeys = /* @__PURE__ */ new Set();
|
|
145
147
|
const addPrice = (priceMarket, priceOutcome) => {
|
|
146
|
-
var _a2;
|
|
147
148
|
if (!priceMarket || !priceOutcome) return;
|
|
148
|
-
const resolvedPrice =
|
|
149
|
+
const resolvedPrice = priceByOutcomeId === void 0 ? priceOutcome.price : priceByOutcomeId.has(priceOutcome.id) ? priceByOutcomeId.get(priceOutcome.id) : void 0;
|
|
149
150
|
const normalizedPrice = normalizeProbability(resolvedPrice);
|
|
150
151
|
if (normalizedPrice == null) return;
|
|
151
152
|
const key = `${priceMarket.id}:${priceOutcome.id}`;
|
|
@@ -327,6 +328,24 @@ var buildOutcomeMidpointsByOutcomeId = (midpointRows) => {
|
|
|
327
328
|
}
|
|
328
329
|
return outcomeMidpointsByOutcomeId;
|
|
329
330
|
};
|
|
331
|
+
var buildArbReturnByVenueMarketId = (midpointRows) => {
|
|
332
|
+
const arbReturnByVenueMarketId = /* @__PURE__ */ new Map();
|
|
333
|
+
const addArbReturn = (value) => {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
if (!value || typeof value !== "object") return;
|
|
336
|
+
const row = value;
|
|
337
|
+
if (row.venueMarketId && !arbReturnByVenueMarketId.has(row.venueMarketId)) {
|
|
338
|
+
arbReturnByVenueMarketId.set(row.venueMarketId, (_a = row.arbReturn) != null ? _a : null);
|
|
339
|
+
}
|
|
340
|
+
for (const matchedRow of (_b = row.matched) != null ? _b : []) {
|
|
341
|
+
addArbReturn(matchedRow);
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
for (const row of midpointRows) {
|
|
345
|
+
addArbReturn(row);
|
|
346
|
+
}
|
|
347
|
+
return arbReturnByVenueMarketId;
|
|
348
|
+
};
|
|
330
349
|
var resolveMarketHrefFromEventHref = (eventHref, marketId, outcomeId) => {
|
|
331
350
|
if (!eventHref) return void 0;
|
|
332
351
|
if (typeof window === "undefined") return void 0;
|
|
@@ -343,6 +362,9 @@ var EventListItemContent = ({
|
|
|
343
362
|
event,
|
|
344
363
|
classNames,
|
|
345
364
|
arbitrageByOutcomeId,
|
|
365
|
+
midpointPrices,
|
|
366
|
+
midpointRows: sharedMidpointRows,
|
|
367
|
+
midpointsLoading,
|
|
346
368
|
onEventClick,
|
|
347
369
|
onMarketClick,
|
|
348
370
|
getMarketHref,
|
|
@@ -396,6 +418,8 @@ var EventListItemContent = ({
|
|
|
396
418
|
if (!isLazyMarketsQueryEnabled || lazyLoadedMarkets.length === 0) return allVenueMarkets;
|
|
397
419
|
return dedupeVenueMarketsById([...allVenueMarkets, ...lazyLoadedMarkets]);
|
|
398
420
|
}, [allVenueMarkets, isLazyMarketsQueryEnabled, lazyLoadedMarkets]);
|
|
421
|
+
const hasExpandedMarkets = isLazyMarketsQueryEnabled && lazyLoadedMarkets.length > 0;
|
|
422
|
+
const shouldUseSharedMidpoints = !hasExpandedMarkets && (midpointPrices !== void 0 || sharedMidpointRows !== void 0 || midpointsLoading !== void 0);
|
|
399
423
|
const midpointVenueMarketIds = useMemo(() => {
|
|
400
424
|
var _a2;
|
|
401
425
|
const ids = [];
|
|
@@ -407,19 +431,21 @@ var EventListItemContent = ({
|
|
|
407
431
|
}
|
|
408
432
|
return [...new Set(ids)];
|
|
409
433
|
}, [resolvedOutcomeMarkets]);
|
|
410
|
-
const { midpointRows, isLoading: isVenueMarketMidpointsLoading } = useVenueMarketMidpoints({
|
|
411
|
-
venueMarketIds: midpointVenueMarketIds,
|
|
412
|
-
enabled: midpointVenueMarketIds.length > 0
|
|
434
|
+
const { midpointRows: fetchedMidpointRows, isLoading: isVenueMarketMidpointsLoading } = useVenueMarketMidpoints({
|
|
435
|
+
venueMarketIds: shouldUseSharedMidpoints ? [] : midpointVenueMarketIds,
|
|
436
|
+
enabled: !shouldUseSharedMidpoints && midpointVenueMarketIds.length > 0
|
|
413
437
|
});
|
|
414
|
-
const { prices: displayMidpointsByOutcomeId, isLoading: isOutcomeMidpointsLoading } = useMidpoints(resolvedOutcomeMarkets);
|
|
415
|
-
const
|
|
438
|
+
const { prices: displayMidpointsByOutcomeId, isLoading: isOutcomeMidpointsLoading } = useMidpoints(shouldUseSharedMidpoints ? [] : resolvedOutcomeMarkets);
|
|
439
|
+
const resolvedMidpointRows = shouldUseSharedMidpoints ? sharedMidpointRows != null ? sharedMidpointRows : [] : fetchedMidpointRows;
|
|
440
|
+
const resolvedDisplayMidpointsByOutcomeId = shouldUseSharedMidpoints ? midpointPrices != null ? midpointPrices : /* @__PURE__ */ new Map() : displayMidpointsByOutcomeId;
|
|
441
|
+
const isAwaitingMidpoints = midpointsLoading != null ? midpointsLoading : isOutcomeMidpointsLoading || midpointVenueMarketIds.length > 0 && isVenueMarketMidpointsLoading;
|
|
416
442
|
const displayPriceByOutcomeId = useMemo(() => {
|
|
417
|
-
const priceByOutcomeId = new Map(
|
|
418
|
-
for (const [outcomeId, price] of buildOutcomeMidpointsByOutcomeId(
|
|
443
|
+
const priceByOutcomeId = new Map(resolvedDisplayMidpointsByOutcomeId);
|
|
444
|
+
for (const [outcomeId, price] of buildOutcomeMidpointsByOutcomeId(resolvedMidpointRows)) {
|
|
419
445
|
priceByOutcomeId.set(outcomeId, price);
|
|
420
446
|
}
|
|
421
447
|
return priceByOutcomeId;
|
|
422
|
-
}, [
|
|
448
|
+
}, [resolvedDisplayMidpointsByOutcomeId, resolvedMidpointRows]);
|
|
423
449
|
const comparison = useMemo(() => {
|
|
424
450
|
return normalizeEventListItemV2Comparison({
|
|
425
451
|
venueMarkets: resolvedOutcomeMarkets,
|
|
@@ -430,6 +456,9 @@ var EventListItemContent = ({
|
|
|
430
456
|
const gapsByVenueMarketId = useMemo(() => {
|
|
431
457
|
return computePriceGapsFromComparisonRows(comparison.rows);
|
|
432
458
|
}, [comparison.rows]);
|
|
459
|
+
const arbReturnByVenueMarketId = useMemo(() => {
|
|
460
|
+
return buildArbReturnByVenueMarketId(resolvedMidpointRows);
|
|
461
|
+
}, [resolvedMidpointRows]);
|
|
433
462
|
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
|
|
434
463
|
const resolvedVolume = (_a = resolveDisplayVolume(event.volume, allVenueMarkets)) != null ? _a : 0;
|
|
435
464
|
const volumeLabel = `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}`;
|
|
@@ -561,10 +590,10 @@ var EventListItemContent = ({
|
|
|
561
590
|
)
|
|
562
591
|
] });
|
|
563
592
|
};
|
|
564
|
-
const renderPriceGapPill = (value) => {
|
|
593
|
+
const renderPriceGapPill = (value, source = "percent") => {
|
|
565
594
|
if (!config.features.enablePriceGap) return null;
|
|
566
595
|
if (isAwaitingMidpoints) return null;
|
|
567
|
-
const formattedPriceGap = formatPriceGapPercent(value);
|
|
596
|
+
const formattedPriceGap = formatPriceGapPercent(value, source);
|
|
568
597
|
if (!formattedPriceGap) return null;
|
|
569
598
|
return /* @__PURE__ */ jsxs(
|
|
570
599
|
"span",
|
|
@@ -700,7 +729,9 @@ var EventListItemContent = ({
|
|
|
700
729
|
comparison.rows.map((row) => {
|
|
701
730
|
var _a2;
|
|
702
731
|
const arbitragePercent = (_a2 = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.outcome.id]) != null ? _a2 : arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[row.market.id];
|
|
703
|
-
const
|
|
732
|
+
const arbReturn = arbReturnByVenueMarketId.get(row.market.id);
|
|
733
|
+
const priceGapPercent = arbReturn == null ? gapsByVenueMarketId.get(row.market.id) : arbReturn;
|
|
734
|
+
const priceGapSource = arbReturn == null ? "percent" : "fraction";
|
|
704
735
|
return /* @__PURE__ */ jsxs(
|
|
705
736
|
"div",
|
|
706
737
|
{
|
|
@@ -720,7 +751,7 @@ var EventListItemContent = ({
|
|
|
720
751
|
) }),
|
|
721
752
|
/* @__PURE__ */ jsxs("div", { className: "agg-outcome-meta flex shrink-0 flex-row items-center justify-end gap-2", children: [
|
|
722
753
|
renderArbitrage(arbitragePercent),
|
|
723
|
-
renderPriceGapPill(priceGapPercent),
|
|
754
|
+
renderPriceGapPill(priceGapPercent, priceGapSource),
|
|
724
755
|
/* @__PURE__ */ jsx("div", { className: "agg-outcome-price-strip relative flex shrink-0 items-center justify-end", children: isAwaitingMidpoints ? renderPriceStripSkeleton(row.prices.length) : row.prices.map(
|
|
725
756
|
(price, priceIndex) => renderComparisonPriceBadge(row, price, priceIndex)
|
|
726
757
|
) })
|
|
@@ -1286,6 +1317,7 @@ import {
|
|
|
1286
1317
|
mergeBestPricesPreferringLive,
|
|
1287
1318
|
optimizedImageUrl as optimizedImageUrl2,
|
|
1288
1319
|
resolveEventTradingState,
|
|
1320
|
+
resolveMarketTradingState,
|
|
1289
1321
|
useEventOrderbookData,
|
|
1290
1322
|
useLabels as useLabels5,
|
|
1291
1323
|
useLiveBestPrices,
|
|
@@ -1442,13 +1474,8 @@ var resolveChartVenueOutcomes = ({
|
|
|
1442
1474
|
}) => {
|
|
1443
1475
|
if (eligibleVenueOutcomes.length <= 1) return eligibleVenueOutcomes;
|
|
1444
1476
|
const sortedEligibleVenueOutcomes = [...eligibleVenueOutcomes].sort((left, right) => {
|
|
1445
|
-
|
|
1446
|
-
const
|
|
1447
|
-
(_a = livePrices.get(left.outcome.id)) != null ? _a : left.outcome.price
|
|
1448
|
-
);
|
|
1449
|
-
const rightProbability = normalizeProbability(
|
|
1450
|
-
(_b = livePrices.get(right.outcome.id)) != null ? _b : right.outcome.price
|
|
1451
|
-
);
|
|
1477
|
+
const leftProbability = normalizeProbability(livePrices.get(left.outcome.id));
|
|
1478
|
+
const rightProbability = normalizeProbability(livePrices.get(right.outcome.id));
|
|
1452
1479
|
const probabilityDifference = (leftProbability != null ? leftProbability : 2) - (rightProbability != null ? rightProbability : 2);
|
|
1453
1480
|
if (probabilityDifference !== 0) return probabilityDifference;
|
|
1454
1481
|
if (left.venue === right.venue) return 0;
|
|
@@ -2086,13 +2113,18 @@ var EventListItemDetailsNotFoundState = ({
|
|
|
2086
2113
|
}
|
|
2087
2114
|
);
|
|
2088
2115
|
};
|
|
2116
|
+
var resolveResolvedOutcomePriceMap = (outcomes) => {
|
|
2117
|
+
if (!(outcomes == null ? void 0 : outcomes.length)) return null;
|
|
2118
|
+
if (!outcomes.some((outcome) => outcome.winner === true)) return null;
|
|
2119
|
+
if (outcomes.some((outcome) => outcome.winner == null)) return null;
|
|
2120
|
+
return new Map(outcomes.map((outcome) => [outcome.id, outcome.winner === true ? 1 : 0]));
|
|
2121
|
+
};
|
|
2089
2122
|
var EventListItemDetailsGraphSection = ({
|
|
2090
2123
|
classNames,
|
|
2091
2124
|
selectedChartType,
|
|
2092
2125
|
venueMarkets,
|
|
2093
2126
|
selectedMarketId,
|
|
2094
2127
|
livePrices,
|
|
2095
|
-
wsLivePrices,
|
|
2096
2128
|
restMidpoints,
|
|
2097
2129
|
bestMidpoint,
|
|
2098
2130
|
bestPrices,
|
|
@@ -2207,6 +2239,18 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2207
2239
|
});
|
|
2208
2240
|
});
|
|
2209
2241
|
}, [availableMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarket]);
|
|
2242
|
+
const resolvedOutcomePriceByMarketId = useMemo5(() => {
|
|
2243
|
+
const map = /* @__PURE__ */ new Map();
|
|
2244
|
+
for (const market of availableMarkets) {
|
|
2245
|
+
const marketTradingState = resolveMarketTradingState(market);
|
|
2246
|
+
if (marketTradingState.kind !== "resolved") continue;
|
|
2247
|
+
const outcomePriceMap = resolveResolvedOutcomePriceMap(market.venueMarketOutcomes);
|
|
2248
|
+
if (outcomePriceMap) {
|
|
2249
|
+
map.set(market.id, outcomePriceMap);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
return map;
|
|
2253
|
+
}, [availableMarkets]);
|
|
2210
2254
|
const resolvedVenueChartSeries = useMemo5(() => {
|
|
2211
2255
|
return resolveMarketChartVenueSeries({
|
|
2212
2256
|
chartData: scopedMarketChartData,
|
|
@@ -2274,7 +2318,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2274
2318
|
{
|
|
2275
2319
|
classNames: { root: cn("agg-chart-region", classNames == null ? void 0 : classNames.chart) },
|
|
2276
2320
|
series: visibleChartSeries,
|
|
2277
|
-
height:
|
|
2321
|
+
height: 200,
|
|
2278
2322
|
isLoading: isScopedMarketChartLoading,
|
|
2279
2323
|
chartType: selectedChartType,
|
|
2280
2324
|
liveCandle: selectedChartType === "candlestick" ? (_m = chartLiveState.liveCandle) != null ? _m : void 0 : void 0,
|
|
@@ -2302,8 +2346,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2302
2346
|
classNames == null ? void 0 : classNames.outcomeBadges
|
|
2303
2347
|
),
|
|
2304
2348
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
2305
|
-
var _a3;
|
|
2306
|
-
const percentage = (_a3 =
|
|
2349
|
+
var _a3, _b3;
|
|
2350
|
+
const percentage = (_b3 = (_a3 = resolvedOutcomePriceByMarketId.get(item.market.id)) == null ? void 0 : _a3.get(item.outcome.id)) != null ? _b3 : livePrices.get(item.outcome.id);
|
|
2307
2351
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
2308
2352
|
const seriesId = `${item.venue}-chart`;
|
|
2309
2353
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -2311,6 +2355,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2311
2355
|
"button",
|
|
2312
2356
|
{
|
|
2313
2357
|
type: "button",
|
|
2358
|
+
"data-id": item.outcome.id,
|
|
2314
2359
|
"aria-label": `${item.venue} ${text}`,
|
|
2315
2360
|
"aria-pressed": isActiveVenue,
|
|
2316
2361
|
className: cn(
|
|
@@ -2366,21 +2411,21 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2366
2411
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
|
|
2367
2412
|
},
|
|
2368
2413
|
options: selectedMarketOutcomes.map((outcome) => {
|
|
2369
|
-
var _a3, _b3, _c3;
|
|
2370
|
-
const
|
|
2414
|
+
var _a3, _b3, _c3, _d3, _e2;
|
|
2415
|
+
const resolvedPrice = availableMarkets[0] == null ? void 0 : (_b3 = resolvedOutcomePriceByMarketId.get(((_a3 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a3 : availableMarkets[0]).id)) == null ? void 0 : _b3.get(outcome.id);
|
|
2416
|
+
const price = resolvedPrice != null ? resolvedPrice : getDisplayOutcomePrice({
|
|
2371
2417
|
outcomeId: outcome.id,
|
|
2372
2418
|
outcomeLabel: outcome.label,
|
|
2373
|
-
selection: (
|
|
2419
|
+
selection: (_c3 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _c3 : "buy",
|
|
2374
2420
|
bestPrices,
|
|
2375
2421
|
bestMidpoint,
|
|
2376
2422
|
bestMidpointsByOutcomeId: restMidpoints,
|
|
2377
|
-
livePrices
|
|
2378
|
-
fallbackPrice: outcome.price
|
|
2423
|
+
livePrices
|
|
2379
2424
|
});
|
|
2380
2425
|
return {
|
|
2381
2426
|
value: outcome.id,
|
|
2382
|
-
label: `${(
|
|
2383
|
-
ariaLabel: `${(
|
|
2427
|
+
label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
|
|
2428
|
+
ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
|
|
2384
2429
|
};
|
|
2385
2430
|
})
|
|
2386
2431
|
}
|
|
@@ -2401,6 +2446,7 @@ var EventListItemDetailsContent = ({
|
|
|
2401
2446
|
detailsStats,
|
|
2402
2447
|
eventTradingState,
|
|
2403
2448
|
ariaLabel,
|
|
2449
|
+
defaultTimeRange,
|
|
2404
2450
|
onClick,
|
|
2405
2451
|
midpointsResult
|
|
2406
2452
|
}) => {
|
|
@@ -2409,9 +2455,6 @@ var EventListItemDetailsContent = ({
|
|
|
2409
2455
|
const lastAppliedEventSyncKeyRef = useRef2(null);
|
|
2410
2456
|
const lastAppliedDefaultRef = useRef2(null);
|
|
2411
2457
|
const [chartRangeOverride, setChartRangeOverride] = useState3(null);
|
|
2412
|
-
useEffect2(() => {
|
|
2413
|
-
setChartRangeOverride(null);
|
|
2414
|
-
}, [event.id]);
|
|
2415
2458
|
const config = useSdkUiConfig2();
|
|
2416
2459
|
const labels = useLabels5();
|
|
2417
2460
|
const tradingContext = useEventTradingContext();
|
|
@@ -2420,13 +2463,20 @@ var EventListItemDetailsContent = ({
|
|
|
2420
2463
|
return eventTradingState != null ? eventTradingState : resolveEventTradingState(event);
|
|
2421
2464
|
}, [event, eventTradingState]);
|
|
2422
2465
|
const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
|
|
2466
|
+
const venueMarkets = useMemo5(
|
|
2467
|
+
() => resolvedEventTradingState.displayMarkets,
|
|
2468
|
+
[resolvedEventTradingState.displayMarkets]
|
|
2469
|
+
);
|
|
2470
|
+
const eventDetailVenueMarkets = useMemo5(() => {
|
|
2471
|
+
return normalizeVenueMarketCluster(venueMarkets);
|
|
2472
|
+
}, [venueMarkets]);
|
|
2423
2473
|
const scopedSelectedMarketId = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? tradingContext.selectedMarketId : null;
|
|
2424
2474
|
useEventOrderbookData(
|
|
2425
2475
|
resolvedEventTradingState.isTradingDisabled ? [] : resolvedEventTradingState.displayMarkets,
|
|
2426
2476
|
scopedSelectedMarketId
|
|
2427
2477
|
);
|
|
2428
|
-
const wsLivePrices = useLiveOutcomePrices(
|
|
2429
|
-
const wsBestPrices = useLiveBestPrices(
|
|
2478
|
+
const wsLivePrices = useLiveOutcomePrices(eventDetailVenueMarkets);
|
|
2479
|
+
const wsBestPrices = useLiveBestPrices(eventDetailVenueMarkets);
|
|
2430
2480
|
const resolvedMidpointsResult = midpointsResult != null ? midpointsResult : {
|
|
2431
2481
|
prices: /* @__PURE__ */ new Map(),
|
|
2432
2482
|
bestMidpointsByOutcomeId: /* @__PURE__ */ new Map(),
|
|
@@ -2451,6 +2501,16 @@ var EventListItemDetailsContent = ({
|
|
|
2451
2501
|
for (const [k, v] of wsLivePrices) merged.set(k, v);
|
|
2452
2502
|
return merged;
|
|
2453
2503
|
}, [restMidpoints, wsLivePrices]);
|
|
2504
|
+
const initialChartTimeRange = useMemo5(() => {
|
|
2505
|
+
return resolveInitialEventDetailsChartRange({
|
|
2506
|
+
event,
|
|
2507
|
+
selectedMarket: scopedSelectedMarket,
|
|
2508
|
+
fallbackRange: defaultTimeRange != null ? defaultTimeRange : config.chart.selectedChartTimeRange
|
|
2509
|
+
});
|
|
2510
|
+
}, [config.chart.selectedChartTimeRange, defaultTimeRange, event, scopedSelectedMarket]);
|
|
2511
|
+
useEffect2(() => {
|
|
2512
|
+
setChartRangeOverride(initialChartTimeRange);
|
|
2513
|
+
}, [event.id, initialChartTimeRange, scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id]);
|
|
2454
2514
|
useEffect2(() => {
|
|
2455
2515
|
if (!tradingContext) return;
|
|
2456
2516
|
if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
|
|
@@ -2488,10 +2548,6 @@ var EventListItemDetailsContent = ({
|
|
|
2488
2548
|
tradingContext,
|
|
2489
2549
|
tradingContext == null ? void 0 : tradingContext.selectedEventId
|
|
2490
2550
|
]);
|
|
2491
|
-
const venueMarkets = useMemo5(
|
|
2492
|
-
() => resolvedEventTradingState.displayMarkets,
|
|
2493
|
-
[resolvedEventTradingState.displayMarkets]
|
|
2494
|
-
);
|
|
2495
2551
|
const marketOptions = useMemo5(
|
|
2496
2552
|
() => venueMarkets.map((vm) => ({
|
|
2497
2553
|
value: vm.id,
|
|
@@ -2613,7 +2669,6 @@ var EventListItemDetailsContent = ({
|
|
|
2613
2669
|
venueMarkets,
|
|
2614
2670
|
selectedMarketId: (_d = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _d : null,
|
|
2615
2671
|
livePrices,
|
|
2616
|
-
wsLivePrices,
|
|
2617
2672
|
restMidpoints,
|
|
2618
2673
|
bestMidpoint,
|
|
2619
2674
|
bestPrices,
|
|
@@ -3250,7 +3305,7 @@ import {
|
|
|
3250
3305
|
MarketStatus,
|
|
3251
3306
|
mergeBestPricesPreferringLive as mergeBestPricesPreferringLive2,
|
|
3252
3307
|
optimizedImageUrl as optimizedImageUrl3,
|
|
3253
|
-
resolveMarketTradingState,
|
|
3308
|
+
resolveMarketTradingState as resolveMarketTradingState2,
|
|
3254
3309
|
useEventTradingContext as useEventTradingContext2,
|
|
3255
3310
|
useEventOrderbookData as useEventOrderbookData2,
|
|
3256
3311
|
useLabels as useLabels7,
|
|
@@ -3258,6 +3313,7 @@ import {
|
|
|
3258
3313
|
useLiveBestPriceCandidates,
|
|
3259
3314
|
useLiveOutcomePrices as useLiveOutcomePrices2,
|
|
3260
3315
|
useMarketOrderbook,
|
|
3316
|
+
useMidpoints as useMidpoints2,
|
|
3261
3317
|
useSdkUiConfig as useSdkUiConfig4,
|
|
3262
3318
|
useVenueMarkets as useVenueMarkets2,
|
|
3263
3319
|
useViewportMidpoints
|
|
@@ -3369,6 +3425,34 @@ var getMarketDetailsOutcomeButtonClassNames = ({
|
|
|
3369
3425
|
text: cn(isSelected ? toneClasses.text : "text-agg-foreground")
|
|
3370
3426
|
};
|
|
3371
3427
|
};
|
|
3428
|
+
var OutcomePriceContent = ({
|
|
3429
|
+
isLoading,
|
|
3430
|
+
isSelected,
|
|
3431
|
+
value,
|
|
3432
|
+
textClassName
|
|
3433
|
+
}) => {
|
|
3434
|
+
if (isLoading) {
|
|
3435
|
+
return /* @__PURE__ */ jsx8(
|
|
3436
|
+
"span",
|
|
3437
|
+
{
|
|
3438
|
+
"aria-hidden": "true",
|
|
3439
|
+
className: cn(
|
|
3440
|
+
"agg-market-details-outcome-price-loading",
|
|
3441
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
3442
|
+
)
|
|
3443
|
+
}
|
|
3444
|
+
);
|
|
3445
|
+
}
|
|
3446
|
+
return /* @__PURE__ */ jsx8(
|
|
3447
|
+
Typography,
|
|
3448
|
+
{
|
|
3449
|
+
as: "span",
|
|
3450
|
+
variant: isSelected ? "body-strong" : "body",
|
|
3451
|
+
className: cn("shrink-0 whitespace-nowrap", textClassName),
|
|
3452
|
+
children: formatProbabilityCents(value)
|
|
3453
|
+
}
|
|
3454
|
+
);
|
|
3455
|
+
};
|
|
3372
3456
|
var MarketDetailsOutcomeButton = ({
|
|
3373
3457
|
ariaControls,
|
|
3374
3458
|
enableAnimations,
|
|
@@ -3424,12 +3508,12 @@ var MarketDetailsOutcomeButton = ({
|
|
|
3424
3508
|
}
|
|
3425
3509
|
) : null,
|
|
3426
3510
|
/* @__PURE__ */ jsx8(
|
|
3427
|
-
|
|
3511
|
+
OutcomePriceContent,
|
|
3428
3512
|
{
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3513
|
+
isLoading: item.isPriceLoading,
|
|
3514
|
+
isSelected,
|
|
3515
|
+
value: item.probability,
|
|
3516
|
+
textClassName: classNames.text
|
|
3433
3517
|
}
|
|
3434
3518
|
)
|
|
3435
3519
|
] }) : /* @__PURE__ */ jsxs6("div", { className: "inline-flex max-w-full items-center justify-center gap-1.5", children: [
|
|
@@ -3444,12 +3528,12 @@ var MarketDetailsOutcomeButton = ({
|
|
|
3444
3528
|
}
|
|
3445
3529
|
),
|
|
3446
3530
|
/* @__PURE__ */ jsx8(
|
|
3447
|
-
|
|
3531
|
+
OutcomePriceContent,
|
|
3448
3532
|
{
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3533
|
+
isLoading: item.isPriceLoading,
|
|
3534
|
+
isSelected,
|
|
3535
|
+
value: item.probability,
|
|
3536
|
+
textClassName: classNames.text
|
|
3453
3537
|
}
|
|
3454
3538
|
)
|
|
3455
3539
|
] })
|
|
@@ -3647,9 +3731,8 @@ var MarketDetailsGraphPanel = ({
|
|
|
3647
3731
|
var _a2, _b2, _c2, _d;
|
|
3648
3732
|
return /* @__PURE__ */ jsxs7("div", { className: "agg-chart-toolbar w-full flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
|
|
3649
3733
|
/* @__PURE__ */ jsx9("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
|
|
3650
|
-
var _a3;
|
|
3651
3734
|
const probability = formatProbabilityPercent(
|
|
3652
|
-
|
|
3735
|
+
wsLivePrices.get(item.outcome.id),
|
|
3653
3736
|
formatPercent
|
|
3654
3737
|
);
|
|
3655
3738
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
@@ -3855,21 +3938,13 @@ var MarketDetailsContent = ({
|
|
|
3855
3938
|
if (!resolvedMarket) return null;
|
|
3856
3939
|
return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
|
|
3857
3940
|
}, [resolvedMarket]);
|
|
3858
|
-
const isResolvedMarket =
|
|
3941
|
+
const isResolvedMarket = resolveMarketTradingState2(scopedResolvedMarket).kind === "resolved";
|
|
3859
3942
|
useEventOrderbookData2(
|
|
3860
3943
|
isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
|
|
3861
3944
|
(_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
|
|
3862
3945
|
);
|
|
3863
|
-
const
|
|
3864
|
-
|
|
3865
|
-
bestMidpointsByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3866
|
-
venueByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3867
|
-
bestPrices: /* @__PURE__ */ new Map(),
|
|
3868
|
-
bestPriceVenuesByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3869
|
-
isLoading: false,
|
|
3870
|
-
bestMidpoint: void 0,
|
|
3871
|
-
bestMidpointVenue: void 0
|
|
3872
|
-
};
|
|
3946
|
+
const fetchedClusterMidpointResult = useMidpoints2(midpointsResult ? [] : clusterVenueMarkets);
|
|
3947
|
+
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
3873
3948
|
const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
|
|
3874
3949
|
const clusterBestMidpointsByOutcomeId = clusterMidpoints;
|
|
3875
3950
|
const clusterVenueByOutcomeId = clusterMidpointResult.venueByOutcomeId;
|
|
@@ -3932,11 +4007,15 @@ var MarketDetailsContent = ({
|
|
|
3932
4007
|
return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
|
|
3933
4008
|
}, [model]);
|
|
3934
4009
|
const marketTradingState = useMemo7(() => {
|
|
3935
|
-
return
|
|
4010
|
+
return resolveMarketTradingState2(scopedMarketForCard);
|
|
3936
4011
|
}, [scopedMarketForCard]);
|
|
3937
4012
|
const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
|
|
3938
4013
|
const isUpcomingMarket = marketTradingState.kind === "unopened";
|
|
3939
4014
|
const marketStatePresentation = resolveTradingStatePresentation(labels, marketTradingState);
|
|
4015
|
+
const resolvedWinningOutcomeLabel = resolveResolvedOutcomeLabel({
|
|
4016
|
+
market: scopedMarketForCard,
|
|
4017
|
+
outcome: marketTradingState.winningOutcome
|
|
4018
|
+
});
|
|
3940
4019
|
const marketDetailsTabs = useMemo7(() => {
|
|
3941
4020
|
return getMarketDetailsTabs(labels);
|
|
3942
4021
|
}, [labels]);
|
|
@@ -4029,18 +4108,24 @@ var MarketDetailsContent = ({
|
|
|
4029
4108
|
});
|
|
4030
4109
|
const bestVenue = candidate == null ? void 0 : candidate.venue;
|
|
4031
4110
|
const outcomeBestPrice = candidate == null ? void 0 : candidate.price;
|
|
4111
|
+
const isPriceLoading = !isResolvedMarket && outcomeBestPrice == null && clusterMidpointResult.isLoading;
|
|
4032
4112
|
if (isResolvedMarket) {
|
|
4033
4113
|
const isWinningOutcome = item.id === ((_a2 = marketTradingState.winningOutcome) == null ? void 0 : _a2.id);
|
|
4034
4114
|
return __spreadValues(__spreadProps(__spreadValues({}, item), {
|
|
4035
|
-
probability: isWinningOutcome ? 1 : 0
|
|
4115
|
+
probability: isWinningOutcome ? 1 : 0,
|
|
4116
|
+
isPriceLoading: false
|
|
4036
4117
|
}), bestVenue ? { venue: bestVenue } : {});
|
|
4037
4118
|
}
|
|
4038
4119
|
if (outcomeBestPrice != null) {
|
|
4039
4120
|
return __spreadValues(__spreadProps(__spreadValues({}, item), {
|
|
4040
|
-
probability: outcomeBestPrice
|
|
4121
|
+
probability: outcomeBestPrice,
|
|
4122
|
+
isPriceLoading: false
|
|
4041
4123
|
}), bestVenue ? { venue: bestVenue } : {});
|
|
4042
4124
|
}
|
|
4043
|
-
return item
|
|
4125
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
4126
|
+
probability: void 0,
|
|
4127
|
+
isPriceLoading
|
|
4128
|
+
});
|
|
4044
4129
|
});
|
|
4045
4130
|
}, [
|
|
4046
4131
|
clusterBestMidpoint,
|
|
@@ -4062,7 +4147,7 @@ var MarketDetailsContent = ({
|
|
|
4062
4147
|
wsBestCandidates
|
|
4063
4148
|
]);
|
|
4064
4149
|
const headlineProbability = useMemo7(() => {
|
|
4065
|
-
var _a2
|
|
4150
|
+
var _a2;
|
|
4066
4151
|
if (!model || !scopedMarketForCard) return void 0;
|
|
4067
4152
|
if (isResolvedMarket) {
|
|
4068
4153
|
const yesOutcome2 = resolveYesOutcome(scopedMarketForCard);
|
|
@@ -4070,10 +4155,7 @@ var MarketDetailsContent = ({
|
|
|
4070
4155
|
return yesOutcome2.winner === true ? 1 : 0;
|
|
4071
4156
|
}
|
|
4072
4157
|
const yesOutcome = resolveYesOutcome(scopedMarketForCard);
|
|
4073
|
-
const displayOutcome = yesOutcome != null ? yesOutcome : (
|
|
4074
|
-
(acc, outcome) => outcome.price > acc.price ? outcome : acc,
|
|
4075
|
-
(_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
|
|
4076
|
-
);
|
|
4158
|
+
const displayOutcome = yesOutcome != null ? yesOutcome : (_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0];
|
|
4077
4159
|
if (displayOutcome == null) return void 0;
|
|
4078
4160
|
const referencePrice = getDisplayOutcomePrice({
|
|
4079
4161
|
outcomeId: displayOutcome.id,
|
|
@@ -4083,10 +4165,10 @@ var MarketDetailsContent = ({
|
|
|
4083
4165
|
bestMidpoint: clusterBestMidpoint,
|
|
4084
4166
|
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
4085
4167
|
livePrices: wsLivePrices,
|
|
4086
|
-
fallbackPrice:
|
|
4168
|
+
fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
|
|
4087
4169
|
});
|
|
4088
4170
|
if (referencePrice != null) return referencePrice;
|
|
4089
|
-
return
|
|
4171
|
+
return findLivePriceById(wsLivePrices, displayOutcome.id);
|
|
4090
4172
|
}, [
|
|
4091
4173
|
clusterBestMidpoint,
|
|
4092
4174
|
clusterBestMidpointsByOutcomeId,
|
|
@@ -4370,7 +4452,9 @@ var MarketDetailsContent = ({
|
|
|
4370
4452
|
)
|
|
4371
4453
|
}
|
|
4372
4454
|
),
|
|
4373
|
-
/* @__PURE__ */ jsx10(Typography, { variant: "body", children: labels.eventMarketPage.resolvedOutcome(
|
|
4455
|
+
/* @__PURE__ */ jsx10(Typography, { variant: "body", children: labels.eventMarketPage.resolvedOutcome(
|
|
4456
|
+
resolvedWinningOutcomeLabel != null ? resolvedWinningOutcomeLabel : marketTradingState.winningOutcome.label
|
|
4457
|
+
) })
|
|
4374
4458
|
]
|
|
4375
4459
|
}
|
|
4376
4460
|
) }) : isUpcomingMarket ? /* @__PURE__ */ jsx10("div", { className: "agg-outcomes flex w-full items-center justify-end md:w-auto md:shrink-0", children: /* @__PURE__ */ jsxs8(
|
|
@@ -4597,13 +4681,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
|
|
|
4597
4681
|
return eventTradingState.kind === "resolved";
|
|
4598
4682
|
}
|
|
4599
4683
|
if (sourceMarkets.length === 0) return false;
|
|
4600
|
-
return sourceMarkets.every((market) =>
|
|
4684
|
+
return sourceMarkets.every((market) => resolveMarketTradingState2(market).kind === "resolved");
|
|
4601
4685
|
};
|
|
4602
4686
|
var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
|
|
4603
4687
|
var _a, _b, _c, _d, _e;
|
|
4604
4688
|
const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
|
|
4605
4689
|
if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
|
|
4606
|
-
if (
|
|
4690
|
+
if (resolveMarketTradingState2(preferredMarket).kind === "resolved") {
|
|
4607
4691
|
return preferredMarket.id;
|
|
4608
4692
|
}
|
|
4609
4693
|
}
|
|
@@ -4674,7 +4758,7 @@ var MarketDetailsList = ({
|
|
|
4674
4758
|
const resolved = [];
|
|
4675
4759
|
const closed = [];
|
|
4676
4760
|
sourceMarkets.forEach((market) => {
|
|
4677
|
-
const marketStateKind =
|
|
4761
|
+
const marketStateKind = resolveMarketTradingState2(market).kind;
|
|
4678
4762
|
if (marketStateKind === "resolved") {
|
|
4679
4763
|
resolved.push(market);
|
|
4680
4764
|
return;
|
|
@@ -4702,7 +4786,7 @@ var MarketDetailsList = ({
|
|
|
4702
4786
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
4703
4787
|
const midpointEligibleMarkets = useMemo7(() => {
|
|
4704
4788
|
return displayedMarkets.filter(
|
|
4705
|
-
(market) =>
|
|
4789
|
+
(market) => resolveMarketTradingState2(market).kind !== "resolved"
|
|
4706
4790
|
);
|
|
4707
4791
|
}, [displayedMarkets]);
|
|
4708
4792
|
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(midpointEligibleMarkets);
|
|
@@ -4724,7 +4808,7 @@ var MarketDetailsList = ({
|
|
|
4724
4808
|
return;
|
|
4725
4809
|
}
|
|
4726
4810
|
const fallbackSelectableMarket = displayedMarkets.find(
|
|
4727
|
-
(market) => !
|
|
4811
|
+
(market) => !resolveMarketTradingState2(market).isTradingDisabled
|
|
4728
4812
|
);
|
|
4729
4813
|
if (!fallbackSelectableMarket) {
|
|
4730
4814
|
return;
|
|
@@ -4746,7 +4830,7 @@ var MarketDetailsList = ({
|
|
|
4746
4830
|
setExpandedMarketId(marketId);
|
|
4747
4831
|
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
|
|
4748
4832
|
if (marketId === selectedMarketId) return;
|
|
4749
|
-
if (
|
|
4833
|
+
if (resolveMarketTradingState2(market).isTradingDisabled) return;
|
|
4750
4834
|
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
4751
4835
|
};
|
|
4752
4836
|
if (!hasPrefetchedMarkets && isLoading) {
|
|
@@ -4847,7 +4931,8 @@ import {
|
|
|
4847
4931
|
useCategoryChildren,
|
|
4848
4932
|
useLabels as useLabels9,
|
|
4849
4933
|
useSdkUiConfig as useSdkUiConfig5,
|
|
4850
|
-
useVenueEvents
|
|
4934
|
+
useVenueEvents,
|
|
4935
|
+
useVenueMarketMidpoints as useVenueMarketMidpoints2
|
|
4851
4936
|
} from "@agg-build/hooks";
|
|
4852
4937
|
import { VENUES } from "@agg-build/sdk";
|
|
4853
4938
|
import * as Dialog from "@radix-ui/react-dialog";
|
|
@@ -5216,6 +5301,23 @@ var resolveSortQueryParams = (value) => {
|
|
|
5216
5301
|
}
|
|
5217
5302
|
return { sortBy: "volume24hr", sortDir: "desc" };
|
|
5218
5303
|
};
|
|
5304
|
+
var collectEventListVenueMarkets = (events) => {
|
|
5305
|
+
return events.flatMap((event) => {
|
|
5306
|
+
var _a;
|
|
5307
|
+
return (_a = event.venueMarkets) != null ? _a : [];
|
|
5308
|
+
});
|
|
5309
|
+
};
|
|
5310
|
+
var collectMidpointVenueMarketIds = (venueMarkets) => {
|
|
5311
|
+
var _a;
|
|
5312
|
+
const ids = [];
|
|
5313
|
+
for (const market of venueMarkets) {
|
|
5314
|
+
ids.push(market.id);
|
|
5315
|
+
for (const sibling of (_a = market.matchedVenueMarkets) != null ? _a : []) {
|
|
5316
|
+
ids.push(sibling.id);
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
return [...new Set(ids)];
|
|
5320
|
+
};
|
|
5219
5321
|
var EventList = ({
|
|
5220
5322
|
title,
|
|
5221
5323
|
limit = DEFAULT_EVENTS_LIMIT,
|
|
@@ -5430,6 +5532,16 @@ var EventList = ({
|
|
|
5430
5532
|
if (resolvedMaxVisibleItems == null) return normalizedEvents;
|
|
5431
5533
|
return normalizedEvents.slice(0, resolvedMaxVisibleItems);
|
|
5432
5534
|
}, [orderedEvents, resolvedMaxVisibleItems]);
|
|
5535
|
+
const visibleVenueMarkets = useMemo10(() => {
|
|
5536
|
+
return collectEventListVenueMarkets(tileEvents);
|
|
5537
|
+
}, [tileEvents]);
|
|
5538
|
+
const visibleMidpointVenueMarketIds = useMemo10(() => {
|
|
5539
|
+
return collectMidpointVenueMarketIds(visibleVenueMarkets);
|
|
5540
|
+
}, [visibleVenueMarkets]);
|
|
5541
|
+
const { midpointRows: sharedMidpointRows, isLoading: isSharedMidpointsLoading } = useVenueMarketMidpoints2({
|
|
5542
|
+
venueMarketIds: visibleMidpointVenueMarketIds,
|
|
5543
|
+
enabled: visibleMidpointVenueMarketIds.length > 0
|
|
5544
|
+
});
|
|
5433
5545
|
const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
|
|
5434
5546
|
const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
|
|
5435
5547
|
const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
|
|
@@ -5598,6 +5710,8 @@ var EventList = ({
|
|
|
5598
5710
|
EventListItem,
|
|
5599
5711
|
{
|
|
5600
5712
|
event,
|
|
5713
|
+
midpointRows: sharedMidpointRows,
|
|
5714
|
+
midpointsLoading: isSharedMidpointsLoading,
|
|
5601
5715
|
classNames: {
|
|
5602
5716
|
root: "agg-event-list-item w-full min-w-0! max-w-none justify-between!"
|
|
5603
5717
|
},
|