@agg-build/ui 1.0.0 → 1.0.1
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-2QJXRRYP.mjs → chunk-43K4PFBC.mjs} +3 -2
- package/dist/{chunk-I2WBGEWK.mjs → chunk-5ES2VJHO.mjs} +159 -93
- package/dist/{chunk-DMKKNK76.mjs → chunk-BYMLPLEZ.mjs} +791 -583
- package/dist/{chunk-C7T56TJR.mjs → chunk-HD6HBTK2.mjs} +1 -1
- package/dist/{chunk-CGNDMLQL.mjs → chunk-LPNZOX3E.mjs} +123 -52
- package/dist/{chunk-75IGOQ4N.mjs → chunk-WLXYCBZV.mjs} +62 -32
- package/dist/{chunk-6NS7D73S.mjs → chunk-YZNO6IUD.mjs} +740 -521
- package/dist/events.js +196 -93
- package/dist/events.mjs +3 -3
- package/dist/index.js +3396 -2806
- package/dist/index.mjs +13 -7
- package/dist/modals.js +798 -535
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +378 -176
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +713 -531
- package/dist/primitives.mjs +7 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +242 -54
- package/dist/trading.mjs +4 -4
- package/dist/types/deposit/steps/card-payment-pending.d.mts +3 -1
- package/dist/types/deposit/steps/card-payment-pending.d.ts +3 -1
- package/dist/types/deposit/steps/crypto-transfer.d.mts +1 -1
- package/dist/types/deposit/steps/crypto-transfer.d.ts +1 -1
- package/dist/types/events/item/event-list-item.utils.d.mts +57 -0
- package/dist/types/events/item/event-list-item.utils.d.ts +57 -0
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +16 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +16 -1
- package/dist/types/events/market-details/market-details.types.d.mts +8 -0
- package/dist/types/events/market-details/market-details.types.d.ts +8 -0
- package/dist/types/primitives/copy-button/index.d.mts +25 -0
- package/dist/types/primitives/copy-button/index.d.ts +25 -0
- package/dist/types/primitives/index.d.mts +2 -0
- package/dist/types/primitives/index.d.ts +2 -0
- package/dist/types/primitives/toast/index.d.mts +4 -0
- package/dist/types/primitives/toast/index.d.ts +4 -0
- package/dist/types/primitives/toast/toast.types.d.mts +31 -0
- package/dist/types/primitives/toast/toast.types.d.ts +31 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +8 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +8 -0
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -7
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -7
- package/dist/types/withdraw/index.d.mts +2 -2
- package/dist/types/withdraw/index.d.ts +2 -2
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +6 -3
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +6 -3
- package/dist/types/withdraw/steps/withdraw-success.d.mts +8 -1
- package/dist/types/withdraw/steps/withdraw-success.d.ts +8 -1
- package/dist/types/withdraw/steps/withdraw-success.utils.d.mts +36 -0
- package/dist/types/withdraw/steps/withdraw-success.utils.d.ts +36 -0
- package/dist/types/withdraw/withdraw-modal.types.d.mts +25 -15
- package/dist/types/withdraw/withdraw-modal.types.d.ts +25 -15
- package/package.json +6 -5
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
AGG_TERMS_OF_SERVICE_URL,
|
|
3
4
|
Icon,
|
|
4
5
|
cn
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YZNO6IUD.mjs";
|
|
6
7
|
|
|
7
8
|
// src/geo-block-banner/index.tsx
|
|
8
9
|
import { useLabels } from "@agg-build/hooks";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
11
|
var GeoBlockBanner = ({
|
|
11
12
|
venue,
|
|
12
|
-
termsUrl =
|
|
13
|
+
termsUrl = AGG_TERMS_OF_SERVICE_URL,
|
|
13
14
|
className
|
|
14
15
|
}) => {
|
|
15
16
|
const labels = useLabels();
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
resolveUnifiedOrderBookEntries,
|
|
20
20
|
sortOutcomeSelectorOutcomes,
|
|
21
21
|
useEventTradingContext
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-HD6HBTK2.mjs";
|
|
23
23
|
import {
|
|
24
24
|
AutocompleteSelect,
|
|
25
25
|
Badge,
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
__spreadProps,
|
|
45
45
|
__spreadValues,
|
|
46
46
|
baseCardClassName,
|
|
47
|
+
buildSpreadByVenueMarketId,
|
|
47
48
|
cn,
|
|
48
49
|
dedupeVenueMarketsById,
|
|
49
50
|
detailsBaseCardClassName,
|
|
@@ -61,16 +62,16 @@ import {
|
|
|
61
62
|
normalizeProbability,
|
|
62
63
|
normalizeVenueMarketCluster,
|
|
63
64
|
orderBookRowLimitDefault,
|
|
65
|
+
resolveBestMidpointForMarket,
|
|
64
66
|
resolveDisplayVolume,
|
|
65
67
|
resolveEventListItemEvent,
|
|
66
68
|
resolveOutcomeTitle,
|
|
67
69
|
resolveTabVenus,
|
|
68
70
|
resolveYesOutcome,
|
|
69
|
-
selectPrimaryVenueMarket,
|
|
70
71
|
sortMarketsByYesOddsDesc,
|
|
71
72
|
sortOutcomes,
|
|
72
73
|
splitEventsByLifecycle
|
|
73
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-YZNO6IUD.mjs";
|
|
74
75
|
|
|
75
76
|
// src/events/item/index.tsx
|
|
76
77
|
import {
|
|
@@ -186,9 +187,6 @@ var EventListItemContent = ({
|
|
|
186
187
|
const allVenueMarkets = useMemo(() => {
|
|
187
188
|
return dedupeVenueMarketsById(event.venueMarkets);
|
|
188
189
|
}, [event.venueMarkets]);
|
|
189
|
-
const _primaryVenueMarket = useMemo(() => {
|
|
190
|
-
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
191
|
-
}, [allVenueMarkets]);
|
|
192
190
|
const resolvedTitle = event.title;
|
|
193
191
|
const resolvedImage = event.image;
|
|
194
192
|
const visibleVenueLogos = useMemo(() => {
|
|
@@ -199,11 +197,12 @@ var EventListItemContent = ({
|
|
|
199
197
|
const resolvedVenueCount = typeof event.venueCount === "number" && Number.isFinite(event.venueCount) ? Math.max(0, Math.floor(event.venueCount)) : visibleVenueLogos.length;
|
|
200
198
|
const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = useState(false);
|
|
201
199
|
const shouldEnableLazyMarketLoading = useMemo(() => {
|
|
202
|
-
if (allVenueMarkets.length <= 1) return false;
|
|
203
200
|
if (!event.id) return false;
|
|
204
201
|
const hasExplicitMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount);
|
|
205
|
-
if (
|
|
206
|
-
|
|
202
|
+
if (hasExplicitMarketCount) {
|
|
203
|
+
return resolvedMarketCount > allVenueMarkets.length;
|
|
204
|
+
}
|
|
205
|
+
return allVenueMarkets.length > 1;
|
|
207
206
|
}, [allVenueMarkets.length, event.id, event.marketCount, resolvedMarketCount]);
|
|
208
207
|
const {
|
|
209
208
|
markets: lazyLoadedMarkets,
|
|
@@ -234,12 +233,17 @@ var EventListItemContent = ({
|
|
|
234
233
|
}, [resolvedOutcomeMarkets]);
|
|
235
234
|
const {
|
|
236
235
|
midpointsByVenueMarketId,
|
|
236
|
+
midpointRows,
|
|
237
237
|
isLoading: isLoadingMidpoints,
|
|
238
238
|
isFetching: isFetchingMidpoints
|
|
239
239
|
} = useVenueMarketMidpoints({
|
|
240
240
|
venueMarketIds: midpointVenueMarketIds,
|
|
241
241
|
enabled: midpointVenueMarketIds.length > 0
|
|
242
242
|
});
|
|
243
|
+
const spreadByVenueMarketId = useMemo(
|
|
244
|
+
() => buildSpreadByVenueMarketId(midpointRows),
|
|
245
|
+
[midpointRows]
|
|
246
|
+
);
|
|
243
247
|
const gapsByVenueMarketId = useMemo(
|
|
244
248
|
() => computePriceGaps({
|
|
245
249
|
markets: resolvedOutcomeMarkets,
|
|
@@ -248,13 +252,7 @@ var EventListItemContent = ({
|
|
|
248
252
|
[resolvedOutcomeMarkets, midpointsByVenueMarketId]
|
|
249
253
|
);
|
|
250
254
|
const isMidpointQueryInFlight = isLoadingMidpoints || isFetchingMidpoints;
|
|
251
|
-
const
|
|
252
|
-
(marketId) => {
|
|
253
|
-
return normalizeProbability(midpointsByVenueMarketId.get(marketId));
|
|
254
|
-
},
|
|
255
|
-
[midpointsByVenueMarketId]
|
|
256
|
-
);
|
|
257
|
-
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && isLazyMarketsQueryEnabled && (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage);
|
|
255
|
+
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
|
|
258
256
|
const resolvedVolume = resolveDisplayVolume(event.volume, allVenueMarkets);
|
|
259
257
|
const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
|
|
260
258
|
const shouldUseNativeLinkNavigation = (eventToHandle) => {
|
|
@@ -460,72 +458,87 @@ var EventListItemContent = ({
|
|
|
460
458
|
),
|
|
461
459
|
onScroll: handleOutcomesScroll,
|
|
462
460
|
children: [
|
|
463
|
-
resolvedOutcomeMarkets.length === 1 ?
|
|
461
|
+
resolvedOutcomeMarkets.length === 1 ? (() => {
|
|
462
|
+
var _a;
|
|
464
463
|
const market = resolvedOutcomeMarkets[0];
|
|
465
|
-
const
|
|
464
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
465
|
+
market,
|
|
466
|
+
midpointsByVenueMarketId,
|
|
467
|
+
spreadByVenueMarketId
|
|
468
|
+
);
|
|
469
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
470
|
+
const bestVenue = (_a = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _a : market.venue;
|
|
466
471
|
const hasYesOutcome = market.venueMarketOutcomes.some(
|
|
467
472
|
(item) => isYesLabel(item.label)
|
|
468
473
|
);
|
|
469
474
|
const hasNoOutcome = market.venueMarketOutcomes.some((item) => isNoLabel(item.label));
|
|
470
475
|
const shouldUseMidpoint = hasYesOutcome && hasNoOutcome;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (
|
|
476
|
+
return sortOutcomes(market.venueMarketOutcomes).map((outcome) => {
|
|
477
|
+
const probability = (() => {
|
|
478
|
+
if (!shouldUseMidpoint) {
|
|
479
|
+
return normalizeProbability(outcome.price);
|
|
480
|
+
}
|
|
481
|
+
if (marketMidpoint == null) {
|
|
482
|
+
if (isMidpointQueryInFlight) return void 0;
|
|
483
|
+
return normalizeProbability(outcome.price);
|
|
484
|
+
}
|
|
485
|
+
if (isYesLabel(outcome.label)) {
|
|
486
|
+
return marketMidpoint;
|
|
487
|
+
}
|
|
488
|
+
if (isNoLabel(outcome.label)) {
|
|
489
|
+
return normalizeProbability(1 - marketMidpoint);
|
|
490
|
+
}
|
|
477
491
|
return normalizeProbability(outcome.price);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
] })
|
|
517
|
-
]
|
|
518
|
-
},
|
|
519
|
-
outcome.id
|
|
520
|
-
);
|
|
521
|
-
}) : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
|
|
522
|
-
var _a, _b;
|
|
492
|
+
})();
|
|
493
|
+
const shouldRenderMidpointSkeleton = shouldUseMidpoint && marketMidpoint == null && isMidpointQueryInFlight;
|
|
494
|
+
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[outcome.id];
|
|
495
|
+
const _priceGapPct = gapsByVenueMarketId.get(market.id);
|
|
496
|
+
return /* @__PURE__ */ jsxs(
|
|
497
|
+
"div",
|
|
498
|
+
{
|
|
499
|
+
className: cn(
|
|
500
|
+
"agg-outcome-row",
|
|
501
|
+
"flex flex-row gap-3 w-full items-center justify-between",
|
|
502
|
+
classNames == null ? void 0 : classNames.outcomeRow
|
|
503
|
+
),
|
|
504
|
+
children: [
|
|
505
|
+
/* @__PURE__ */ jsx("div", { className: "agg-outcome-label-row flex min-w-0 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ jsx(
|
|
506
|
+
Typography,
|
|
507
|
+
{
|
|
508
|
+
variant: "body",
|
|
509
|
+
className: "agg-outcome-label min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
|
|
510
|
+
children: resolveOutcomeTitle(outcome)
|
|
511
|
+
}
|
|
512
|
+
) }),
|
|
513
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-outcome-meta flex flex-row items-center justify-end gap-3", children: [
|
|
514
|
+
renderArbitrage(arbitragePercent),
|
|
515
|
+
renderOutcomePriceBadge(
|
|
516
|
+
probability,
|
|
517
|
+
bestVenue,
|
|
518
|
+
shouldRenderMidpointSkeleton,
|
|
519
|
+
market,
|
|
520
|
+
outcome
|
|
521
|
+
)
|
|
522
|
+
] })
|
|
523
|
+
]
|
|
524
|
+
},
|
|
525
|
+
outcome.id
|
|
526
|
+
);
|
|
527
|
+
});
|
|
528
|
+
})() : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
|
|
529
|
+
var _a, _b, _c;
|
|
523
530
|
const yesOutcome = resolveYesOutcome(market);
|
|
524
531
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b = market.venueMarketOutcomes) == null ? void 0 : _b.reduce(
|
|
525
532
|
(acc, o) => o.price > acc.price ? o : acc,
|
|
526
533
|
(_a = market.venueMarketOutcomes) == null ? void 0 : _a[0]
|
|
527
534
|
);
|
|
528
|
-
const
|
|
535
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
536
|
+
market,
|
|
537
|
+
midpointsByVenueMarketId,
|
|
538
|
+
spreadByVenueMarketId
|
|
539
|
+
);
|
|
540
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
541
|
+
const bestVenue = (_c = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _c : market.venue;
|
|
529
542
|
const probability = marketMidpoint != null ? marketMidpoint : isMidpointQueryInFlight ? void 0 : normalizeProbability(displayOutcome == null ? void 0 : displayOutcome.price);
|
|
530
543
|
const shouldRenderMidpointSkeleton = marketMidpoint == null && isMidpointQueryInFlight;
|
|
531
544
|
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[market.id];
|
|
@@ -552,7 +565,7 @@ var EventListItemContent = ({
|
|
|
552
565
|
renderArbitrage(arbitragePercent),
|
|
553
566
|
renderOutcomePriceBadge(
|
|
554
567
|
probability,
|
|
555
|
-
|
|
568
|
+
bestVenue,
|
|
556
569
|
shouldRenderMidpointSkeleton,
|
|
557
570
|
market,
|
|
558
571
|
displayOutcome
|
|
@@ -1874,6 +1887,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1874
1887
|
selectedChartType,
|
|
1875
1888
|
venueMarkets,
|
|
1876
1889
|
livePrices,
|
|
1890
|
+
wsLivePrices,
|
|
1891
|
+
restMidpoints,
|
|
1877
1892
|
live
|
|
1878
1893
|
}) => {
|
|
1879
1894
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
@@ -2030,7 +2045,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2030
2045
|
),
|
|
2031
2046
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
2032
2047
|
var _a3;
|
|
2033
|
-
const percentage = (_a3 =
|
|
2048
|
+
const percentage = (_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price;
|
|
2034
2049
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
2035
2050
|
const seriesId = `${item.venue}-chart`;
|
|
2036
2051
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -2091,8 +2106,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2091
2106
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
|
|
2092
2107
|
},
|
|
2093
2108
|
options: selectedMarketOutcomes.map((outcome) => {
|
|
2094
|
-
var _a3;
|
|
2095
|
-
const price = (_a3 =
|
|
2109
|
+
var _a3, _b3;
|
|
2110
|
+
const price = (_b3 = (_a3 = restMidpoints.get(outcome.id)) != null ? _a3 : livePrices.get(outcome.id)) != null ? _b3 : outcome.price;
|
|
2096
2111
|
return {
|
|
2097
2112
|
value: outcome.id,
|
|
2098
2113
|
label: `${outcome.label} ${formatProbabilityCents(price)}`,
|
|
@@ -2309,6 +2324,8 @@ var EventListItemDetailsContent = ({
|
|
|
2309
2324
|
venueInfo,
|
|
2310
2325
|
venueMarkets,
|
|
2311
2326
|
livePrices,
|
|
2327
|
+
wsLivePrices,
|
|
2328
|
+
restMidpoints,
|
|
2312
2329
|
live: false
|
|
2313
2330
|
}
|
|
2314
2331
|
),
|
|
@@ -2539,18 +2556,42 @@ var useCenterOrderbookSpread = ({
|
|
|
2539
2556
|
if (!enabled) return;
|
|
2540
2557
|
if (hasAutoCenteredRef.current || hasUserScrolledRef.current) return;
|
|
2541
2558
|
let isCancelled = false;
|
|
2559
|
+
let resizeObserver = null;
|
|
2542
2560
|
const cancelPendingFrame = () => {
|
|
2543
2561
|
if (animationFrameRef.current === null) return;
|
|
2544
2562
|
window.cancelAnimationFrame(animationFrameRef.current);
|
|
2545
2563
|
animationFrameRef.current = null;
|
|
2546
2564
|
};
|
|
2565
|
+
const disconnectResizeObserver = () => {
|
|
2566
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
2567
|
+
resizeObserver = null;
|
|
2568
|
+
};
|
|
2547
2569
|
const scheduleMeasurement = () => {
|
|
2548
2570
|
cancelPendingFrame();
|
|
2549
2571
|
animationFrameRef.current = window.requestAnimationFrame(measureAndCenter);
|
|
2550
2572
|
};
|
|
2573
|
+
const setupResizeObserverFallback = () => {
|
|
2574
|
+
if (resizeObserver) return;
|
|
2575
|
+
const container = containerRef.current;
|
|
2576
|
+
if (!container) return;
|
|
2577
|
+
resizeObserver = new ResizeObserver(() => {
|
|
2578
|
+
if (isCancelled || hasAutoCenteredRef.current || hasUserScrolledRef.current) {
|
|
2579
|
+
disconnectResizeObserver();
|
|
2580
|
+
return;
|
|
2581
|
+
}
|
|
2582
|
+
if (container.clientHeight <= 0) return;
|
|
2583
|
+
disconnectResizeObserver();
|
|
2584
|
+
retryCountRef.current = 0;
|
|
2585
|
+
scheduleMeasurement();
|
|
2586
|
+
});
|
|
2587
|
+
resizeObserver.observe(container);
|
|
2588
|
+
};
|
|
2551
2589
|
const scheduleRetry = () => {
|
|
2552
2590
|
if (isCancelled || hasUserScrolledRef.current || hasAutoCenteredRef.current) return;
|
|
2553
|
-
if (retryCountRef.current >= maxAutoCenterAttempts)
|
|
2591
|
+
if (retryCountRef.current >= maxAutoCenterAttempts) {
|
|
2592
|
+
setupResizeObserverFallback();
|
|
2593
|
+
return;
|
|
2594
|
+
}
|
|
2554
2595
|
retryCountRef.current += 1;
|
|
2555
2596
|
scheduleMeasurement();
|
|
2556
2597
|
};
|
|
@@ -2575,6 +2616,11 @@ var useCenterOrderbookSpread = ({
|
|
|
2575
2616
|
}
|
|
2576
2617
|
const spreadOffsetTop = container.scrollTop + (spreadRect.top - containerRect.top);
|
|
2577
2618
|
const maxScrollTop = Math.max(0, container.scrollHeight - containerHeight);
|
|
2619
|
+
if (maxScrollTop === 0) {
|
|
2620
|
+
retryCountRef.current = 0;
|
|
2621
|
+
animationFrameRef.current = null;
|
|
2622
|
+
return;
|
|
2623
|
+
}
|
|
2578
2624
|
const targetScrollTop = Math.max(
|
|
2579
2625
|
0,
|
|
2580
2626
|
Math.min(maxScrollTop, spreadOffsetTop - containerHeight / 2 + spreadRect.height / 2)
|
|
@@ -2583,11 +2629,13 @@ var useCenterOrderbookSpread = ({
|
|
|
2583
2629
|
hasAutoCenteredRef.current = true;
|
|
2584
2630
|
retryCountRef.current = 0;
|
|
2585
2631
|
animationFrameRef.current = null;
|
|
2632
|
+
disconnectResizeObserver();
|
|
2586
2633
|
};
|
|
2587
2634
|
scheduleMeasurement();
|
|
2588
2635
|
return () => {
|
|
2589
2636
|
isCancelled = true;
|
|
2590
2637
|
cancelPendingFrame();
|
|
2638
|
+
disconnectResizeObserver();
|
|
2591
2639
|
};
|
|
2592
2640
|
}, [containerRef, enabled, resetKey, rowCount, spreadRef]);
|
|
2593
2641
|
const recenter = useCallback3(() => {
|
|
@@ -2988,6 +3036,7 @@ var MarketDetailsOutcomeButton = ({
|
|
|
2988
3036
|
type: "button",
|
|
2989
3037
|
role: "tab",
|
|
2990
3038
|
"data-id": item.id,
|
|
3039
|
+
"data-venue": item.venue,
|
|
2991
3040
|
"aria-controls": ariaControls,
|
|
2992
3041
|
"aria-selected": isSelected,
|
|
2993
3042
|
tabIndex: isSelected ? 0 : -1,
|
|
@@ -3089,7 +3138,8 @@ var MarketDetailsContent = ({
|
|
|
3089
3138
|
classNames,
|
|
3090
3139
|
otherContent,
|
|
3091
3140
|
live,
|
|
3092
|
-
midpointsFallback
|
|
3141
|
+
midpointsFallback,
|
|
3142
|
+
midpointsFallbackVenues
|
|
3093
3143
|
}) => {
|
|
3094
3144
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3095
3145
|
const config = useSdkUiConfig3();
|
|
@@ -3120,7 +3170,7 @@ var MarketDetailsContent = ({
|
|
|
3120
3170
|
if (!controlledIsOpened || !resolvedMarket) return [];
|
|
3121
3171
|
return resolvedMarket.venueMarkets;
|
|
3122
3172
|
}, [controlledIsOpened, resolvedMarket]);
|
|
3123
|
-
const { prices: clusterMidpoints } = useMidpoints2(clusterMidpointMarkets);
|
|
3173
|
+
const { prices: clusterMidpoints, venueByOutcomeId: clusterVenueByOutcomeId } = useMidpoints2(clusterMidpointMarkets);
|
|
3124
3174
|
const livePrices = useMemo5(() => {
|
|
3125
3175
|
const merged = /* @__PURE__ */ new Map();
|
|
3126
3176
|
if (midpointsFallback == null ? void 0 : midpointsFallback.size) {
|
|
@@ -3202,24 +3252,39 @@ var MarketDetailsContent = ({
|
|
|
3202
3252
|
if (!model) return [];
|
|
3203
3253
|
const items = resolveHeaderOutcomeItems(model.market.venueMarkets);
|
|
3204
3254
|
return items.map((item) => {
|
|
3205
|
-
const
|
|
3206
|
-
|
|
3255
|
+
const clusterPrice = clusterMidpoints.get(item.id);
|
|
3256
|
+
if (clusterPrice != null) {
|
|
3257
|
+
const bestVenue = clusterVenueByOutcomeId.get(item.id);
|
|
3258
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: clusterPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
3259
|
+
}
|
|
3260
|
+
const fallbackPrice = midpointsFallback == null ? void 0 : midpointsFallback.get(item.id);
|
|
3261
|
+
if (fallbackPrice != null) {
|
|
3262
|
+
const bestVenue = midpointsFallbackVenues == null ? void 0 : midpointsFallbackVenues.get(item.id);
|
|
3263
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: fallbackPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
3264
|
+
}
|
|
3265
|
+
const wsPrice = findLivePriceById(wsLivePrices, item.id);
|
|
3266
|
+
return wsPrice != null ? __spreadProps(__spreadValues({}, item), { probability: wsPrice }) : item;
|
|
3207
3267
|
});
|
|
3208
|
-
}, [
|
|
3268
|
+
}, [
|
|
3269
|
+
model,
|
|
3270
|
+
clusterMidpoints,
|
|
3271
|
+
clusterVenueByOutcomeId,
|
|
3272
|
+
midpointsFallback,
|
|
3273
|
+
midpointsFallbackVenues,
|
|
3274
|
+
wsLivePrices
|
|
3275
|
+
]);
|
|
3209
3276
|
const headlineProbability = useMemo5(() => {
|
|
3210
|
-
var _a2, _b2;
|
|
3277
|
+
var _a2, _b2, _c2, _d2;
|
|
3211
3278
|
if (!model || !scopedMarketForCard) return void 0;
|
|
3212
|
-
const resolveLiveProbability = (outcomeId, fallbackPrice) => {
|
|
3213
|
-
const liveProbability = findLivePriceById(livePrices, outcomeId);
|
|
3214
|
-
return liveProbability != null ? liveProbability : fallbackPrice;
|
|
3215
|
-
};
|
|
3216
3279
|
const yesOutcome = resolveYesOutcome(scopedMarketForCard);
|
|
3217
3280
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _b2.reduce(
|
|
3218
3281
|
(acc, outcome) => outcome.price > acc.price ? outcome : acc,
|
|
3219
3282
|
(_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
|
|
3220
3283
|
);
|
|
3221
|
-
|
|
3222
|
-
|
|
3284
|
+
const restPrice = (_c2 = clusterMidpoints.get(displayOutcome.id)) != null ? _c2 : midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id);
|
|
3285
|
+
if (restPrice != null) return restPrice;
|
|
3286
|
+
return (_d2 = findLivePriceById(wsLivePrices, displayOutcome.id)) != null ? _d2 : displayOutcome.price;
|
|
3287
|
+
}, [model, scopedMarketForCard, clusterMidpoints, midpointsFallback, wsLivePrices]);
|
|
3223
3288
|
const selectedOutcomesByVenue = useMemo5(() => {
|
|
3224
3289
|
if (!model) return [];
|
|
3225
3290
|
return collectEligibleVenueOutcomes({
|
|
@@ -3719,7 +3784,7 @@ var MarketDetailsContent = ({
|
|
|
3719
3784
|
/* @__PURE__ */ jsx9("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
|
|
3720
3785
|
var _a3;
|
|
3721
3786
|
const probability = formatProbabilityPercent(
|
|
3722
|
-
(_a3 =
|
|
3787
|
+
(_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price,
|
|
3723
3788
|
formatPercent
|
|
3724
3789
|
);
|
|
3725
3790
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
@@ -3765,8 +3830,7 @@ var MarketDetailsContent = ({
|
|
|
3765
3830
|
setChartOutcomeLabel(outcome.label);
|
|
3766
3831
|
},
|
|
3767
3832
|
options: headerOutcomeItems.map((outcome) => {
|
|
3768
|
-
|
|
3769
|
-
const price = (_a3 = livePrices.get(outcome.id)) != null ? _a3 : outcome.probability;
|
|
3833
|
+
const price = outcome.probability;
|
|
3770
3834
|
const outcomeLabel = `${outcome.label} ${formatProbabilityCents(price)}`;
|
|
3771
3835
|
return {
|
|
3772
3836
|
value: outcome.id,
|
|
@@ -3872,7 +3936,8 @@ var MarketDetails = (_a) => {
|
|
|
3872
3936
|
isOpened,
|
|
3873
3937
|
onOpenChange: props.onOpenChange,
|
|
3874
3938
|
venueMarkets: props.venueMarkets,
|
|
3875
|
-
midpointsFallback: props.midpointsFallback
|
|
3939
|
+
midpointsFallback: props.midpointsFallback,
|
|
3940
|
+
midpointsFallbackVenues: props.midpointsFallbackVenues
|
|
3876
3941
|
})
|
|
3877
3942
|
);
|
|
3878
3943
|
}
|
|
@@ -4009,7 +4074,7 @@ var MarketDetailsList = ({
|
|
|
4009
4074
|
return [...groupedMarkets.primary, ...visibleResolvedMarkets];
|
|
4010
4075
|
}, [groupedMarkets.primary, visibleResolvedMarkets]);
|
|
4011
4076
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
4012
|
-
const { prices: midpointsFallback } = useViewportMidpoints(displayedMarkets);
|
|
4077
|
+
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(displayedMarkets);
|
|
4013
4078
|
useEffect5(() => {
|
|
4014
4079
|
if (isResolvedEvent) {
|
|
4015
4080
|
setAreResolvedMarketsVisible(false);
|
|
@@ -4122,7 +4187,8 @@ var MarketDetailsList = ({
|
|
|
4122
4187
|
ariaLabel: market.question,
|
|
4123
4188
|
classNames: { root: cn("agg-market-list-item", classNames == null ? void 0 : classNames.item) },
|
|
4124
4189
|
live,
|
|
4125
|
-
midpointsFallback
|
|
4190
|
+
midpointsFallback,
|
|
4191
|
+
midpointsFallbackVenues
|
|
4126
4192
|
}
|
|
4127
4193
|
) }, market.id);
|
|
4128
4194
|
return /* @__PURE__ */ jsxs7("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.root), children: [
|