@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
package/dist/events.js
CHANGED
|
@@ -3824,12 +3824,16 @@ var sortOutcomes = (outcomes) => {
|
|
|
3824
3824
|
});
|
|
3825
3825
|
};
|
|
3826
3826
|
var dedupeVenueMarketsById = (venueMarkets) => {
|
|
3827
|
-
const
|
|
3827
|
+
const seenClusterIds = /* @__PURE__ */ new Set();
|
|
3828
3828
|
return venueMarkets.filter((venueMarket) => {
|
|
3829
|
-
|
|
3829
|
+
var _a;
|
|
3830
|
+
if (seenClusterIds.has(venueMarket.id)) {
|
|
3830
3831
|
return false;
|
|
3831
3832
|
}
|
|
3832
|
-
|
|
3833
|
+
seenClusterIds.add(venueMarket.id);
|
|
3834
|
+
for (const sibling of (_a = venueMarket.matchedVenueMarkets) != null ? _a : []) {
|
|
3835
|
+
seenClusterIds.add(sibling.id);
|
|
3836
|
+
}
|
|
3833
3837
|
return true;
|
|
3834
3838
|
});
|
|
3835
3839
|
};
|
|
@@ -3859,6 +3863,40 @@ var getVenueSummary = (venueMarkets) => {
|
|
|
3859
3863
|
singleVenue: uniqueVenues.length === 1 ? uniqueVenues[0] : void 0
|
|
3860
3864
|
};
|
|
3861
3865
|
};
|
|
3866
|
+
function buildSpreadByVenueMarketId(midpointRows) {
|
|
3867
|
+
const map = /* @__PURE__ */ new Map();
|
|
3868
|
+
for (const row of midpointRows) {
|
|
3869
|
+
map.set(row.venueMarketId, row.spread);
|
|
3870
|
+
for (const matched of row.matched) {
|
|
3871
|
+
if (!map.has(matched.venueMarketId)) {
|
|
3872
|
+
map.set(matched.venueMarketId, matched.spread);
|
|
3873
|
+
}
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
return map;
|
|
3877
|
+
}
|
|
3878
|
+
function resolveBestMidpointForMarket(market, midpointsByVenueMarketId, spreadByVenueMarketId) {
|
|
3879
|
+
var _a;
|
|
3880
|
+
const candidates = [
|
|
3881
|
+
{ id: market.id, venue: market.venue },
|
|
3882
|
+
...((_a = market.matchedVenueMarkets) != null ? _a : []).map((m) => ({ id: m.id, venue: m.venue }))
|
|
3883
|
+
];
|
|
3884
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3885
|
+
const deduped = candidates.filter((c) => {
|
|
3886
|
+
if (seen.has(c.id)) return false;
|
|
3887
|
+
seen.add(c.id);
|
|
3888
|
+
return true;
|
|
3889
|
+
});
|
|
3890
|
+
const valid = [];
|
|
3891
|
+
for (const candidate of deduped) {
|
|
3892
|
+
const midpoint = midpointsByVenueMarketId.get(candidate.id);
|
|
3893
|
+
if (midpoint == null) continue;
|
|
3894
|
+
valid.push(__spreadProps(__spreadValues({}, candidate), { midpoint }));
|
|
3895
|
+
}
|
|
3896
|
+
if (valid.length === 0) return void 0;
|
|
3897
|
+
const best = valid.reduce((acc, cur) => cur.midpoint < acc.midpoint ? cur : acc);
|
|
3898
|
+
return { midpoint: best.midpoint, venueMarketId: best.id, venue: best.venue };
|
|
3899
|
+
}
|
|
3862
3900
|
var resolveDisplayVolume = (eventVolume, venueMarkets) => {
|
|
3863
3901
|
const clusterMarkets = normalizeVenueMarketCluster(venueMarkets);
|
|
3864
3902
|
const marketSum = clusterMarkets.reduce(
|
|
@@ -6425,9 +6463,6 @@ var EventListItemContent = ({
|
|
|
6425
6463
|
const allVenueMarkets = (0, import_react9.useMemo)(() => {
|
|
6426
6464
|
return dedupeVenueMarketsById(event.venueMarkets);
|
|
6427
6465
|
}, [event.venueMarkets]);
|
|
6428
|
-
const _primaryVenueMarket = (0, import_react9.useMemo)(() => {
|
|
6429
|
-
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
6430
|
-
}, [allVenueMarkets]);
|
|
6431
6466
|
const resolvedTitle = event.title;
|
|
6432
6467
|
const resolvedImage = event.image;
|
|
6433
6468
|
const visibleVenueLogos = (0, import_react9.useMemo)(() => {
|
|
@@ -6438,11 +6473,12 @@ var EventListItemContent = ({
|
|
|
6438
6473
|
const resolvedVenueCount = typeof event.venueCount === "number" && Number.isFinite(event.venueCount) ? Math.max(0, Math.floor(event.venueCount)) : visibleVenueLogos.length;
|
|
6439
6474
|
const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = (0, import_react9.useState)(false);
|
|
6440
6475
|
const shouldEnableLazyMarketLoading = (0, import_react9.useMemo)(() => {
|
|
6441
|
-
if (allVenueMarkets.length <= 1) return false;
|
|
6442
6476
|
if (!event.id) return false;
|
|
6443
6477
|
const hasExplicitMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount);
|
|
6444
|
-
if (
|
|
6445
|
-
|
|
6478
|
+
if (hasExplicitMarketCount) {
|
|
6479
|
+
return resolvedMarketCount > allVenueMarkets.length;
|
|
6480
|
+
}
|
|
6481
|
+
return allVenueMarkets.length > 1;
|
|
6446
6482
|
}, [allVenueMarkets.length, event.id, event.marketCount, resolvedMarketCount]);
|
|
6447
6483
|
const {
|
|
6448
6484
|
markets: lazyLoadedMarkets,
|
|
@@ -6473,12 +6509,17 @@ var EventListItemContent = ({
|
|
|
6473
6509
|
}, [resolvedOutcomeMarkets]);
|
|
6474
6510
|
const {
|
|
6475
6511
|
midpointsByVenueMarketId,
|
|
6512
|
+
midpointRows,
|
|
6476
6513
|
isLoading: isLoadingMidpoints,
|
|
6477
6514
|
isFetching: isFetchingMidpoints
|
|
6478
6515
|
} = (0, import_hooks29.useVenueMarketMidpoints)({
|
|
6479
6516
|
venueMarketIds: midpointVenueMarketIds,
|
|
6480
6517
|
enabled: midpointVenueMarketIds.length > 0
|
|
6481
6518
|
});
|
|
6519
|
+
const spreadByVenueMarketId = (0, import_react9.useMemo)(
|
|
6520
|
+
() => buildSpreadByVenueMarketId(midpointRows),
|
|
6521
|
+
[midpointRows]
|
|
6522
|
+
);
|
|
6482
6523
|
const gapsByVenueMarketId = (0, import_react9.useMemo)(
|
|
6483
6524
|
() => (0, import_hooks29.computePriceGaps)({
|
|
6484
6525
|
markets: resolvedOutcomeMarkets,
|
|
@@ -6487,13 +6528,7 @@ var EventListItemContent = ({
|
|
|
6487
6528
|
[resolvedOutcomeMarkets, midpointsByVenueMarketId]
|
|
6488
6529
|
);
|
|
6489
6530
|
const isMidpointQueryInFlight = isLoadingMidpoints || isFetchingMidpoints;
|
|
6490
|
-
const
|
|
6491
|
-
(marketId) => {
|
|
6492
|
-
return normalizeProbability(midpointsByVenueMarketId.get(marketId));
|
|
6493
|
-
},
|
|
6494
|
-
[midpointsByVenueMarketId]
|
|
6495
|
-
);
|
|
6496
|
-
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && isLazyMarketsQueryEnabled && (isLoadingLazyMarkets || isFetchingNextLazyMarketsPage);
|
|
6531
|
+
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
|
|
6497
6532
|
const resolvedVolume = resolveDisplayVolume(event.volume, allVenueMarkets);
|
|
6498
6533
|
const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
|
|
6499
6534
|
const shouldUseNativeLinkNavigation = (eventToHandle) => {
|
|
@@ -6699,72 +6734,87 @@ var EventListItemContent = ({
|
|
|
6699
6734
|
),
|
|
6700
6735
|
onScroll: handleOutcomesScroll,
|
|
6701
6736
|
children: [
|
|
6702
|
-
resolvedOutcomeMarkets.length === 1 ?
|
|
6737
|
+
resolvedOutcomeMarkets.length === 1 ? (() => {
|
|
6738
|
+
var _a;
|
|
6703
6739
|
const market = resolvedOutcomeMarkets[0];
|
|
6704
|
-
const
|
|
6740
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
6741
|
+
market,
|
|
6742
|
+
midpointsByVenueMarketId,
|
|
6743
|
+
spreadByVenueMarketId
|
|
6744
|
+
);
|
|
6745
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
6746
|
+
const bestVenue = (_a = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _a : market.venue;
|
|
6705
6747
|
const hasYesOutcome = market.venueMarketOutcomes.some(
|
|
6706
6748
|
(item) => isYesLabel(item.label)
|
|
6707
6749
|
);
|
|
6708
6750
|
const hasNoOutcome = market.venueMarketOutcomes.some((item) => isNoLabel2(item.label));
|
|
6709
6751
|
const shouldUseMidpoint = hasYesOutcome && hasNoOutcome;
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
if (
|
|
6752
|
+
return sortOutcomes(market.venueMarketOutcomes).map((outcome) => {
|
|
6753
|
+
const probability = (() => {
|
|
6754
|
+
if (!shouldUseMidpoint) {
|
|
6755
|
+
return normalizeProbability(outcome.price);
|
|
6756
|
+
}
|
|
6757
|
+
if (marketMidpoint == null) {
|
|
6758
|
+
if (isMidpointQueryInFlight) return void 0;
|
|
6759
|
+
return normalizeProbability(outcome.price);
|
|
6760
|
+
}
|
|
6761
|
+
if (isYesLabel(outcome.label)) {
|
|
6762
|
+
return marketMidpoint;
|
|
6763
|
+
}
|
|
6764
|
+
if (isNoLabel2(outcome.label)) {
|
|
6765
|
+
return normalizeProbability(1 - marketMidpoint);
|
|
6766
|
+
}
|
|
6716
6767
|
return normalizeProbability(outcome.price);
|
|
6717
|
-
}
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
] })
|
|
6756
|
-
]
|
|
6757
|
-
},
|
|
6758
|
-
outcome.id
|
|
6759
|
-
);
|
|
6760
|
-
}) : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
|
|
6761
|
-
var _a, _b;
|
|
6768
|
+
})();
|
|
6769
|
+
const shouldRenderMidpointSkeleton = shouldUseMidpoint && marketMidpoint == null && isMidpointQueryInFlight;
|
|
6770
|
+
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[outcome.id];
|
|
6771
|
+
const _priceGapPct = gapsByVenueMarketId.get(market.id);
|
|
6772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(
|
|
6773
|
+
"div",
|
|
6774
|
+
{
|
|
6775
|
+
className: cn(
|
|
6776
|
+
"agg-outcome-row",
|
|
6777
|
+
"flex flex-row gap-3 w-full items-center justify-between",
|
|
6778
|
+
classNames == null ? void 0 : classNames.outcomeRow
|
|
6779
|
+
),
|
|
6780
|
+
children: [
|
|
6781
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsx)("div", { className: "agg-outcome-label-row flex min-w-0 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(
|
|
6782
|
+
Typography,
|
|
6783
|
+
{
|
|
6784
|
+
variant: "body",
|
|
6785
|
+
className: "agg-outcome-label min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
|
|
6786
|
+
children: resolveOutcomeTitle(outcome)
|
|
6787
|
+
}
|
|
6788
|
+
) }),
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: "agg-outcome-meta flex flex-row items-center justify-end gap-3", children: [
|
|
6790
|
+
renderArbitrage(arbitragePercent),
|
|
6791
|
+
renderOutcomePriceBadge(
|
|
6792
|
+
probability,
|
|
6793
|
+
bestVenue,
|
|
6794
|
+
shouldRenderMidpointSkeleton,
|
|
6795
|
+
market,
|
|
6796
|
+
outcome
|
|
6797
|
+
)
|
|
6798
|
+
] })
|
|
6799
|
+
]
|
|
6800
|
+
},
|
|
6801
|
+
outcome.id
|
|
6802
|
+
);
|
|
6803
|
+
});
|
|
6804
|
+
})() : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
|
|
6805
|
+
var _a, _b, _c;
|
|
6762
6806
|
const yesOutcome = resolveYesOutcome(market);
|
|
6763
6807
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b = market.venueMarketOutcomes) == null ? void 0 : _b.reduce(
|
|
6764
6808
|
(acc, o) => o.price > acc.price ? o : acc,
|
|
6765
6809
|
(_a = market.venueMarketOutcomes) == null ? void 0 : _a[0]
|
|
6766
6810
|
);
|
|
6767
|
-
const
|
|
6811
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
6812
|
+
market,
|
|
6813
|
+
midpointsByVenueMarketId,
|
|
6814
|
+
spreadByVenueMarketId
|
|
6815
|
+
);
|
|
6816
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
6817
|
+
const bestVenue = (_c = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _c : market.venue;
|
|
6768
6818
|
const probability = marketMidpoint != null ? marketMidpoint : isMidpointQueryInFlight ? void 0 : normalizeProbability(displayOutcome == null ? void 0 : displayOutcome.price);
|
|
6769
6819
|
const shouldRenderMidpointSkeleton = marketMidpoint == null && isMidpointQueryInFlight;
|
|
6770
6820
|
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[market.id];
|
|
@@ -6791,7 +6841,7 @@ var EventListItemContent = ({
|
|
|
6791
6841
|
renderArbitrage(arbitragePercent),
|
|
6792
6842
|
renderOutcomePriceBadge(
|
|
6793
6843
|
probability,
|
|
6794
|
-
|
|
6844
|
+
bestVenue,
|
|
6795
6845
|
shouldRenderMidpointSkeleton,
|
|
6796
6846
|
market,
|
|
6797
6847
|
displayOutcome
|
|
@@ -8705,6 +8755,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
8705
8755
|
selectedChartType,
|
|
8706
8756
|
venueMarkets,
|
|
8707
8757
|
livePrices,
|
|
8758
|
+
wsLivePrices,
|
|
8759
|
+
restMidpoints,
|
|
8708
8760
|
live
|
|
8709
8761
|
}) => {
|
|
8710
8762
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
@@ -8861,7 +8913,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
8861
8913
|
),
|
|
8862
8914
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
8863
8915
|
var _a3;
|
|
8864
|
-
const percentage = (_a3 =
|
|
8916
|
+
const percentage = (_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price;
|
|
8865
8917
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
8866
8918
|
const seriesId = `${item.venue}-chart`;
|
|
8867
8919
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -8922,8 +8974,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
8922
8974
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
|
|
8923
8975
|
},
|
|
8924
8976
|
options: selectedMarketOutcomes.map((outcome) => {
|
|
8925
|
-
var _a3;
|
|
8926
|
-
const price = (_a3 =
|
|
8977
|
+
var _a3, _b3;
|
|
8978
|
+
const price = (_b3 = (_a3 = restMidpoints.get(outcome.id)) != null ? _a3 : livePrices.get(outcome.id)) != null ? _b3 : outcome.price;
|
|
8927
8979
|
return {
|
|
8928
8980
|
value: outcome.id,
|
|
8929
8981
|
label: `${outcome.label} ${formatProbabilityCents(price)}`,
|
|
@@ -9140,6 +9192,8 @@ var EventListItemDetailsContent = ({
|
|
|
9140
9192
|
venueInfo,
|
|
9141
9193
|
venueMarkets,
|
|
9142
9194
|
livePrices,
|
|
9195
|
+
wsLivePrices,
|
|
9196
|
+
restMidpoints,
|
|
9143
9197
|
live: false
|
|
9144
9198
|
}
|
|
9145
9199
|
),
|
|
@@ -9378,18 +9432,42 @@ var useCenterOrderbookSpread = ({
|
|
|
9378
9432
|
if (!enabled) return;
|
|
9379
9433
|
if (hasAutoCenteredRef.current || hasUserScrolledRef.current) return;
|
|
9380
9434
|
let isCancelled = false;
|
|
9435
|
+
let resizeObserver = null;
|
|
9381
9436
|
const cancelPendingFrame = () => {
|
|
9382
9437
|
if (animationFrameRef.current === null) return;
|
|
9383
9438
|
window.cancelAnimationFrame(animationFrameRef.current);
|
|
9384
9439
|
animationFrameRef.current = null;
|
|
9385
9440
|
};
|
|
9441
|
+
const disconnectResizeObserver = () => {
|
|
9442
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
9443
|
+
resizeObserver = null;
|
|
9444
|
+
};
|
|
9386
9445
|
const scheduleMeasurement = () => {
|
|
9387
9446
|
cancelPendingFrame();
|
|
9388
9447
|
animationFrameRef.current = window.requestAnimationFrame(measureAndCenter);
|
|
9389
9448
|
};
|
|
9449
|
+
const setupResizeObserverFallback = () => {
|
|
9450
|
+
if (resizeObserver) return;
|
|
9451
|
+
const container = containerRef.current;
|
|
9452
|
+
if (!container) return;
|
|
9453
|
+
resizeObserver = new ResizeObserver(() => {
|
|
9454
|
+
if (isCancelled || hasAutoCenteredRef.current || hasUserScrolledRef.current) {
|
|
9455
|
+
disconnectResizeObserver();
|
|
9456
|
+
return;
|
|
9457
|
+
}
|
|
9458
|
+
if (container.clientHeight <= 0) return;
|
|
9459
|
+
disconnectResizeObserver();
|
|
9460
|
+
retryCountRef.current = 0;
|
|
9461
|
+
scheduleMeasurement();
|
|
9462
|
+
});
|
|
9463
|
+
resizeObserver.observe(container);
|
|
9464
|
+
};
|
|
9390
9465
|
const scheduleRetry = () => {
|
|
9391
9466
|
if (isCancelled || hasUserScrolledRef.current || hasAutoCenteredRef.current) return;
|
|
9392
|
-
if (retryCountRef.current >= maxAutoCenterAttempts)
|
|
9467
|
+
if (retryCountRef.current >= maxAutoCenterAttempts) {
|
|
9468
|
+
setupResizeObserverFallback();
|
|
9469
|
+
return;
|
|
9470
|
+
}
|
|
9393
9471
|
retryCountRef.current += 1;
|
|
9394
9472
|
scheduleMeasurement();
|
|
9395
9473
|
};
|
|
@@ -9414,6 +9492,11 @@ var useCenterOrderbookSpread = ({
|
|
|
9414
9492
|
}
|
|
9415
9493
|
const spreadOffsetTop = container.scrollTop + (spreadRect.top - containerRect.top);
|
|
9416
9494
|
const maxScrollTop = Math.max(0, container.scrollHeight - containerHeight);
|
|
9495
|
+
if (maxScrollTop === 0) {
|
|
9496
|
+
retryCountRef.current = 0;
|
|
9497
|
+
animationFrameRef.current = null;
|
|
9498
|
+
return;
|
|
9499
|
+
}
|
|
9417
9500
|
const targetScrollTop = Math.max(
|
|
9418
9501
|
0,
|
|
9419
9502
|
Math.min(maxScrollTop, spreadOffsetTop - containerHeight / 2 + spreadRect.height / 2)
|
|
@@ -9422,11 +9505,13 @@ var useCenterOrderbookSpread = ({
|
|
|
9422
9505
|
hasAutoCenteredRef.current = true;
|
|
9423
9506
|
retryCountRef.current = 0;
|
|
9424
9507
|
animationFrameRef.current = null;
|
|
9508
|
+
disconnectResizeObserver();
|
|
9425
9509
|
};
|
|
9426
9510
|
scheduleMeasurement();
|
|
9427
9511
|
return () => {
|
|
9428
9512
|
isCancelled = true;
|
|
9429
9513
|
cancelPendingFrame();
|
|
9514
|
+
disconnectResizeObserver();
|
|
9430
9515
|
};
|
|
9431
9516
|
}, [containerRef, enabled, resetKey, rowCount, spreadRef]);
|
|
9432
9517
|
const recenter = (0, import_react14.useCallback)(() => {
|
|
@@ -9891,6 +9976,7 @@ var MarketDetailsOutcomeButton = ({
|
|
|
9891
9976
|
type: "button",
|
|
9892
9977
|
role: "tab",
|
|
9893
9978
|
"data-id": item.id,
|
|
9979
|
+
"data-venue": item.venue,
|
|
9894
9980
|
"aria-controls": ariaControls,
|
|
9895
9981
|
"aria-selected": isSelected,
|
|
9896
9982
|
tabIndex: isSelected ? 0 : -1,
|
|
@@ -9992,7 +10078,8 @@ var MarketDetailsContent = ({
|
|
|
9992
10078
|
classNames,
|
|
9993
10079
|
otherContent,
|
|
9994
10080
|
live,
|
|
9995
|
-
midpointsFallback
|
|
10081
|
+
midpointsFallback,
|
|
10082
|
+
midpointsFallbackVenues
|
|
9996
10083
|
}) => {
|
|
9997
10084
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
9998
10085
|
const config = (0, import_hooks38.useSdkUiConfig)();
|
|
@@ -10023,7 +10110,7 @@ var MarketDetailsContent = ({
|
|
|
10023
10110
|
if (!controlledIsOpened || !resolvedMarket) return [];
|
|
10024
10111
|
return resolvedMarket.venueMarkets;
|
|
10025
10112
|
}, [controlledIsOpened, resolvedMarket]);
|
|
10026
|
-
const { prices: clusterMidpoints } = (0, import_hooks38.useMidpoints)(clusterMidpointMarkets);
|
|
10113
|
+
const { prices: clusterMidpoints, venueByOutcomeId: clusterVenueByOutcomeId } = (0, import_hooks38.useMidpoints)(clusterMidpointMarkets);
|
|
10027
10114
|
const livePrices = (0, import_react16.useMemo)(() => {
|
|
10028
10115
|
const merged = /* @__PURE__ */ new Map();
|
|
10029
10116
|
if (midpointsFallback == null ? void 0 : midpointsFallback.size) {
|
|
@@ -10105,24 +10192,39 @@ var MarketDetailsContent = ({
|
|
|
10105
10192
|
if (!model) return [];
|
|
10106
10193
|
const items = resolveHeaderOutcomeItems(model.market.venueMarkets);
|
|
10107
10194
|
return items.map((item) => {
|
|
10108
|
-
const
|
|
10109
|
-
|
|
10195
|
+
const clusterPrice = clusterMidpoints.get(item.id);
|
|
10196
|
+
if (clusterPrice != null) {
|
|
10197
|
+
const bestVenue = clusterVenueByOutcomeId.get(item.id);
|
|
10198
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: clusterPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
10199
|
+
}
|
|
10200
|
+
const fallbackPrice = midpointsFallback == null ? void 0 : midpointsFallback.get(item.id);
|
|
10201
|
+
if (fallbackPrice != null) {
|
|
10202
|
+
const bestVenue = midpointsFallbackVenues == null ? void 0 : midpointsFallbackVenues.get(item.id);
|
|
10203
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: fallbackPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
10204
|
+
}
|
|
10205
|
+
const wsPrice = (0, import_hooks38.findLivePriceById)(wsLivePrices, item.id);
|
|
10206
|
+
return wsPrice != null ? __spreadProps(__spreadValues({}, item), { probability: wsPrice }) : item;
|
|
10110
10207
|
});
|
|
10111
|
-
}, [
|
|
10208
|
+
}, [
|
|
10209
|
+
model,
|
|
10210
|
+
clusterMidpoints,
|
|
10211
|
+
clusterVenueByOutcomeId,
|
|
10212
|
+
midpointsFallback,
|
|
10213
|
+
midpointsFallbackVenues,
|
|
10214
|
+
wsLivePrices
|
|
10215
|
+
]);
|
|
10112
10216
|
const headlineProbability = (0, import_react16.useMemo)(() => {
|
|
10113
|
-
var _a2, _b2;
|
|
10217
|
+
var _a2, _b2, _c2, _d2;
|
|
10114
10218
|
if (!model || !scopedMarketForCard) return void 0;
|
|
10115
|
-
const resolveLiveProbability = (outcomeId, fallbackPrice) => {
|
|
10116
|
-
const liveProbability = (0, import_hooks38.findLivePriceById)(livePrices, outcomeId);
|
|
10117
|
-
return liveProbability != null ? liveProbability : fallbackPrice;
|
|
10118
|
-
};
|
|
10119
10219
|
const yesOutcome = resolveYesOutcome(scopedMarketForCard);
|
|
10120
10220
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _b2.reduce(
|
|
10121
10221
|
(acc, outcome) => outcome.price > acc.price ? outcome : acc,
|
|
10122
10222
|
(_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
|
|
10123
10223
|
);
|
|
10124
|
-
|
|
10125
|
-
|
|
10224
|
+
const restPrice = (_c2 = clusterMidpoints.get(displayOutcome.id)) != null ? _c2 : midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id);
|
|
10225
|
+
if (restPrice != null) return restPrice;
|
|
10226
|
+
return (_d2 = (0, import_hooks38.findLivePriceById)(wsLivePrices, displayOutcome.id)) != null ? _d2 : displayOutcome.price;
|
|
10227
|
+
}, [model, scopedMarketForCard, clusterMidpoints, midpointsFallback, wsLivePrices]);
|
|
10126
10228
|
const selectedOutcomesByVenue = (0, import_react16.useMemo)(() => {
|
|
10127
10229
|
if (!model) return [];
|
|
10128
10230
|
return collectEligibleVenueOutcomes({
|
|
@@ -10622,7 +10724,7 @@ var MarketDetailsContent = ({
|
|
|
10622
10724
|
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
|
|
10623
10725
|
var _a3;
|
|
10624
10726
|
const probability = formatProbabilityPercent(
|
|
10625
|
-
(_a3 =
|
|
10727
|
+
(_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price,
|
|
10626
10728
|
formatPercent
|
|
10627
10729
|
);
|
|
10628
10730
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
@@ -10668,8 +10770,7 @@ var MarketDetailsContent = ({
|
|
|
10668
10770
|
setChartOutcomeLabel(outcome.label);
|
|
10669
10771
|
},
|
|
10670
10772
|
options: headerOutcomeItems.map((outcome) => {
|
|
10671
|
-
|
|
10672
|
-
const price = (_a3 = livePrices.get(outcome.id)) != null ? _a3 : outcome.probability;
|
|
10773
|
+
const price = outcome.probability;
|
|
10673
10774
|
const outcomeLabel = `${outcome.label} ${formatProbabilityCents(price)}`;
|
|
10674
10775
|
return {
|
|
10675
10776
|
value: outcome.id,
|
|
@@ -10775,7 +10876,8 @@ var MarketDetails = (_a) => {
|
|
|
10775
10876
|
isOpened,
|
|
10776
10877
|
onOpenChange: props.onOpenChange,
|
|
10777
10878
|
venueMarkets: props.venueMarkets,
|
|
10778
|
-
midpointsFallback: props.midpointsFallback
|
|
10879
|
+
midpointsFallback: props.midpointsFallback,
|
|
10880
|
+
midpointsFallbackVenues: props.midpointsFallbackVenues
|
|
10779
10881
|
})
|
|
10780
10882
|
);
|
|
10781
10883
|
}
|
|
@@ -10912,7 +11014,7 @@ var MarketDetailsList = ({
|
|
|
10912
11014
|
return [...groupedMarkets.primary, ...visibleResolvedMarkets];
|
|
10913
11015
|
}, [groupedMarkets.primary, visibleResolvedMarkets]);
|
|
10914
11016
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
10915
|
-
const { prices: midpointsFallback } = (0, import_hooks38.useViewportMidpoints)(displayedMarkets);
|
|
11017
|
+
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = (0, import_hooks38.useViewportMidpoints)(displayedMarkets);
|
|
10916
11018
|
(0, import_react16.useEffect)(() => {
|
|
10917
11019
|
if (isResolvedEvent) {
|
|
10918
11020
|
setAreResolvedMarketsVisible(false);
|
|
@@ -11025,7 +11127,8 @@ var MarketDetailsList = ({
|
|
|
11025
11127
|
ariaLabel: market.question,
|
|
11026
11128
|
classNames: { root: cn("agg-market-list-item", classNames == null ? void 0 : classNames.item) },
|
|
11027
11129
|
live,
|
|
11028
|
-
midpointsFallback
|
|
11130
|
+
midpointsFallback,
|
|
11131
|
+
midpointsFallbackVenues
|
|
11029
11132
|
}
|
|
11030
11133
|
) }, market.id);
|
|
11031
11134
|
return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.root), children: [
|
package/dist/events.mjs
CHANGED
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
mergeVenueOutcomeOrderbooks,
|
|
15
15
|
orderbookRowLimitDefault,
|
|
16
16
|
useCenterOrderbookSpread
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5ES2VJHO.mjs";
|
|
18
18
|
import {
|
|
19
19
|
formatProbabilityCents,
|
|
20
20
|
resolveOrderBookRows,
|
|
21
21
|
resolveUnifiedOrderBookEntries
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-HD6HBTK2.mjs";
|
|
23
|
+
import "./chunk-YZNO6IUD.mjs";
|
|
24
24
|
export {
|
|
25
25
|
EventList,
|
|
26
26
|
EventListItem,
|