@agg-build/ui 1.0.0 → 1.0.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-75IGOQ4N.mjs → chunk-3IY2GA2D.mjs} +69 -45
- package/dist/{chunk-I2WBGEWK.mjs → chunk-4ILR2YH3.mjs} +319 -344
- package/dist/{chunk-C7T56TJR.mjs → chunk-PEVG67XU.mjs} +369 -19
- package/dist/{chunk-6NS7D73S.mjs → chunk-TLGQ4LID.mjs} +1556 -1204
- package/dist/{chunk-DMKKNK76.mjs → chunk-WFS772A3.mjs} +800 -592
- package/dist/{chunk-CGNDMLQL.mjs → chunk-XDZLCWUZ.mjs} +511 -899
- package/dist/{chunk-2QJXRRYP.mjs → chunk-YSCHNVBZ.mjs} +3 -2
- package/dist/events.js +2081 -1673
- package/dist/events.mjs +3 -3
- package/dist/index.js +4890 -4318
- package/dist/index.mjs +195 -118
- package/dist/modals.js +1568 -1242
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +3007 -2904
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +1507 -1207
- package/dist/primitives.mjs +13 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +3920 -3734
- package/dist/trading.mjs +10 -12
- 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/item-details/settlement-summary.d.mts +6 -2
- package/dist/types/events/item-details/settlement-summary.d.ts +6 -2
- package/dist/types/events/list/event-list.types.d.mts +1 -1
- package/dist/types/events/list/event-list.types.d.ts +1 -1
- package/dist/types/events/list/event-list.utils.d.mts +1 -1
- package/dist/types/events/list/event-list.utils.d.ts +1 -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/pages/event-market/event-market.types.d.mts +1 -3
- package/dist/types/pages/event-market/event-market.types.d.ts +1 -3
- 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/icon/index.d.mts +3 -1
- package/dist/types/primitives/icon/index.d.ts +3 -1
- package/dist/types/primitives/icon/registry.d.mts +8 -0
- package/dist/types/primitives/icon/registry.d.ts +8 -0
- package/dist/types/primitives/icon/svg/apps.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apps.d.ts +5 -0
- package/dist/types/primitives/icon/svg/circle-overlap.d.mts +5 -0
- package/dist/types/primitives/icon/svg/circle-overlap.d.ts +5 -0
- package/dist/types/primitives/index.d.mts +2 -0
- package/dist/types/primitives/index.d.ts +2 -0
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +1 -1
- package/dist/types/primitives/select/select.types.d.ts +1 -1
- package/dist/types/primitives/select/select.utils.d.mts +0 -1
- package/dist/types/primitives/select/select.utils.d.ts +0 -1
- package/dist/types/primitives/skeleton/index.d.mts +2 -1
- package/dist/types/primitives/skeleton/index.d.ts +2 -1
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.mts +4 -0
- package/dist/types/primitives/skeleton/views/place-order-skeleton-view.d.ts +4 -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/primitives/typography/index.d.mts +1 -1
- package/dist/types/primitives/typography/index.d.ts +1 -1
- package/dist/types/primitives/typography/typography.types.d.mts +3 -1
- package/dist/types/primitives/typography/typography.types.d.ts +3 -1
- package/dist/types/shared/utils.d.mts +3 -1
- package/dist/types/shared/utils.d.ts +3 -1
- package/dist/types/trading/index.d.mts +0 -1
- package/dist/types/trading/index.d.ts +0 -1
- 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 -1
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -1
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +4 -11
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +4 -11
- package/dist/types/trading/settlement/index.d.mts +9 -6
- package/dist/types/trading/settlement/index.d.ts +9 -6
- package/dist/types/trading/settlement/settlement-text-renderer.d.mts +8 -0
- package/dist/types/trading/settlement/settlement-text-renderer.d.ts +8 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.mts +36 -0
- package/dist/types/trading/settlement/settlement-text.utils.d.ts +36 -0
- package/dist/types/trading/types.d.mts +0 -19
- package/dist/types/trading/types.d.ts +0 -19
- package/dist/types/trading/utils.d.mts +0 -1
- package/dist/types/trading/utils.d.ts +0 -1
- 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/types/primitives/card/card.constants.d.mts +0 -4
- package/dist/types/primitives/card/card.constants.d.ts +0 -4
- package/dist/types/trading/settlement/settlement-details.utils.d.mts +0 -7
- package/dist/types/trading/settlement/settlement-details.utils.d.ts +0 -7
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
SETTLEMENT_SECTION_ID,
|
|
3
4
|
buildMarketDetailsModel,
|
|
4
5
|
formatProbabilityCents,
|
|
5
6
|
formatProbabilityPercent,
|
|
7
|
+
getFirstSettlementParagraph,
|
|
6
8
|
getTimeWindowByRange,
|
|
7
9
|
resolveHeaderOutcomeItems,
|
|
8
10
|
resolveInitialOutcomeLabel,
|
|
@@ -19,7 +21,7 @@ import {
|
|
|
19
21
|
resolveUnifiedOrderBookEntries,
|
|
20
22
|
sortOutcomeSelectorOutcomes,
|
|
21
23
|
useEventTradingContext
|
|
22
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PEVG67XU.mjs";
|
|
23
25
|
import {
|
|
24
26
|
AutocompleteSelect,
|
|
25
27
|
Badge,
|
|
@@ -44,6 +46,7 @@ import {
|
|
|
44
46
|
__spreadProps,
|
|
45
47
|
__spreadValues,
|
|
46
48
|
baseCardClassName,
|
|
49
|
+
buildSpreadByVenueMarketId,
|
|
47
50
|
cn,
|
|
48
51
|
dedupeVenueMarketsById,
|
|
49
52
|
detailsBaseCardClassName,
|
|
@@ -61,16 +64,16 @@ import {
|
|
|
61
64
|
normalizeProbability,
|
|
62
65
|
normalizeVenueMarketCluster,
|
|
63
66
|
orderBookRowLimitDefault,
|
|
67
|
+
resolveBestMidpointForMarket,
|
|
64
68
|
resolveDisplayVolume,
|
|
65
69
|
resolveEventListItemEvent,
|
|
66
70
|
resolveOutcomeTitle,
|
|
67
71
|
resolveTabVenus,
|
|
68
72
|
resolveYesOutcome,
|
|
69
|
-
selectPrimaryVenueMarket,
|
|
70
73
|
sortMarketsByYesOddsDesc,
|
|
71
74
|
sortOutcomes,
|
|
72
75
|
splitEventsByLifecycle
|
|
73
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-TLGQ4LID.mjs";
|
|
74
77
|
|
|
75
78
|
// src/events/item/index.tsx
|
|
76
79
|
import {
|
|
@@ -186,9 +189,6 @@ var EventListItemContent = ({
|
|
|
186
189
|
const allVenueMarkets = useMemo(() => {
|
|
187
190
|
return dedupeVenueMarketsById(event.venueMarkets);
|
|
188
191
|
}, [event.venueMarkets]);
|
|
189
|
-
const _primaryVenueMarket = useMemo(() => {
|
|
190
|
-
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
191
|
-
}, [allVenueMarkets]);
|
|
192
192
|
const resolvedTitle = event.title;
|
|
193
193
|
const resolvedImage = event.image;
|
|
194
194
|
const visibleVenueLogos = useMemo(() => {
|
|
@@ -199,11 +199,12 @@ var EventListItemContent = ({
|
|
|
199
199
|
const resolvedVenueCount = typeof event.venueCount === "number" && Number.isFinite(event.venueCount) ? Math.max(0, Math.floor(event.venueCount)) : visibleVenueLogos.length;
|
|
200
200
|
const [isLazyMarketsQueryEnabled, setIsLazyMarketsQueryEnabled] = useState(false);
|
|
201
201
|
const shouldEnableLazyMarketLoading = useMemo(() => {
|
|
202
|
-
if (allVenueMarkets.length <= 1) return false;
|
|
203
202
|
if (!event.id) return false;
|
|
204
203
|
const hasExplicitMarketCount = typeof event.marketCount === "number" && Number.isFinite(event.marketCount);
|
|
205
|
-
if (
|
|
206
|
-
|
|
204
|
+
if (hasExplicitMarketCount) {
|
|
205
|
+
return resolvedMarketCount > allVenueMarkets.length;
|
|
206
|
+
}
|
|
207
|
+
return allVenueMarkets.length > 1;
|
|
207
208
|
}, [allVenueMarkets.length, event.id, event.marketCount, resolvedMarketCount]);
|
|
208
209
|
const {
|
|
209
210
|
markets: lazyLoadedMarkets,
|
|
@@ -234,12 +235,17 @@ var EventListItemContent = ({
|
|
|
234
235
|
}, [resolvedOutcomeMarkets]);
|
|
235
236
|
const {
|
|
236
237
|
midpointsByVenueMarketId,
|
|
238
|
+
midpointRows,
|
|
237
239
|
isLoading: isLoadingMidpoints,
|
|
238
240
|
isFetching: isFetchingMidpoints
|
|
239
241
|
} = useVenueMarketMidpoints({
|
|
240
242
|
venueMarketIds: midpointVenueMarketIds,
|
|
241
243
|
enabled: midpointVenueMarketIds.length > 0
|
|
242
244
|
});
|
|
245
|
+
const spreadByVenueMarketId = useMemo(
|
|
246
|
+
() => buildSpreadByVenueMarketId(midpointRows),
|
|
247
|
+
[midpointRows]
|
|
248
|
+
);
|
|
243
249
|
const gapsByVenueMarketId = useMemo(
|
|
244
250
|
() => computePriceGaps({
|
|
245
251
|
markets: resolvedOutcomeMarkets,
|
|
@@ -248,13 +254,7 @@ var EventListItemContent = ({
|
|
|
248
254
|
[resolvedOutcomeMarkets, midpointsByVenueMarketId]
|
|
249
255
|
);
|
|
250
256
|
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);
|
|
257
|
+
const shouldRenderLoadingOutcomeRow = shouldEnableLazyMarketLoading && (!isLazyMarketsQueryEnabled || isLoadingLazyMarkets || isFetchingNextLazyMarketsPage || hasNextLazyMarketsPage);
|
|
258
258
|
const resolvedVolume = resolveDisplayVolume(event.volume, allVenueMarkets);
|
|
259
259
|
const volumeLabel = typeof resolvedVolume === "number" ? `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItem.volumeSuffix}` : "";
|
|
260
260
|
const shouldUseNativeLinkNavigation = (eventToHandle) => {
|
|
@@ -460,72 +460,87 @@ var EventListItemContent = ({
|
|
|
460
460
|
),
|
|
461
461
|
onScroll: handleOutcomesScroll,
|
|
462
462
|
children: [
|
|
463
|
-
resolvedOutcomeMarkets.length === 1 ?
|
|
463
|
+
resolvedOutcomeMarkets.length === 1 ? (() => {
|
|
464
|
+
var _a;
|
|
464
465
|
const market = resolvedOutcomeMarkets[0];
|
|
465
|
-
const
|
|
466
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
467
|
+
market,
|
|
468
|
+
midpointsByVenueMarketId,
|
|
469
|
+
spreadByVenueMarketId
|
|
470
|
+
);
|
|
471
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
472
|
+
const bestVenue = (_a = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _a : market.venue;
|
|
466
473
|
const hasYesOutcome = market.venueMarketOutcomes.some(
|
|
467
474
|
(item) => isYesLabel(item.label)
|
|
468
475
|
);
|
|
469
476
|
const hasNoOutcome = market.venueMarketOutcomes.some((item) => isNoLabel(item.label));
|
|
470
477
|
const shouldUseMidpoint = hasYesOutcome && hasNoOutcome;
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
if (
|
|
478
|
+
return sortOutcomes(market.venueMarketOutcomes).map((outcome) => {
|
|
479
|
+
const probability = (() => {
|
|
480
|
+
if (!shouldUseMidpoint) {
|
|
481
|
+
return normalizeProbability(outcome.price);
|
|
482
|
+
}
|
|
483
|
+
if (marketMidpoint == null) {
|
|
484
|
+
if (isMidpointQueryInFlight) return void 0;
|
|
485
|
+
return normalizeProbability(outcome.price);
|
|
486
|
+
}
|
|
487
|
+
if (isYesLabel(outcome.label)) {
|
|
488
|
+
return marketMidpoint;
|
|
489
|
+
}
|
|
490
|
+
if (isNoLabel(outcome.label)) {
|
|
491
|
+
return normalizeProbability(1 - marketMidpoint);
|
|
492
|
+
}
|
|
477
493
|
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;
|
|
494
|
+
})();
|
|
495
|
+
const shouldRenderMidpointSkeleton = shouldUseMidpoint && marketMidpoint == null && isMidpointQueryInFlight;
|
|
496
|
+
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[outcome.id];
|
|
497
|
+
const _priceGapPct = gapsByVenueMarketId.get(market.id);
|
|
498
|
+
return /* @__PURE__ */ jsxs(
|
|
499
|
+
"div",
|
|
500
|
+
{
|
|
501
|
+
className: cn(
|
|
502
|
+
"agg-outcome-row",
|
|
503
|
+
"flex flex-row gap-3 w-full items-center justify-between",
|
|
504
|
+
classNames == null ? void 0 : classNames.outcomeRow
|
|
505
|
+
),
|
|
506
|
+
children: [
|
|
507
|
+
/* @__PURE__ */ jsx("div", { className: "agg-outcome-label-row flex min-w-0 flex-row items-center justify-start gap-2", children: /* @__PURE__ */ jsx(
|
|
508
|
+
Typography,
|
|
509
|
+
{
|
|
510
|
+
variant: "body",
|
|
511
|
+
className: "agg-outcome-label min-w-0 truncate text-agg-sm leading-agg-5 md:text-agg-base md:leading-agg-6",
|
|
512
|
+
children: resolveOutcomeTitle(outcome)
|
|
513
|
+
}
|
|
514
|
+
) }),
|
|
515
|
+
/* @__PURE__ */ jsxs("div", { className: "agg-outcome-meta flex flex-row items-center justify-end gap-3", children: [
|
|
516
|
+
renderArbitrage(arbitragePercent),
|
|
517
|
+
renderOutcomePriceBadge(
|
|
518
|
+
probability,
|
|
519
|
+
bestVenue,
|
|
520
|
+
shouldRenderMidpointSkeleton,
|
|
521
|
+
market,
|
|
522
|
+
outcome
|
|
523
|
+
)
|
|
524
|
+
] })
|
|
525
|
+
]
|
|
526
|
+
},
|
|
527
|
+
outcome.id
|
|
528
|
+
);
|
|
529
|
+
});
|
|
530
|
+
})() : sortMarketsByYesOddsDesc(resolvedOutcomeMarkets).map((market) => {
|
|
531
|
+
var _a, _b, _c;
|
|
523
532
|
const yesOutcome = resolveYesOutcome(market);
|
|
524
533
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b = market.venueMarketOutcomes) == null ? void 0 : _b.reduce(
|
|
525
534
|
(acc, o) => o.price > acc.price ? o : acc,
|
|
526
535
|
(_a = market.venueMarketOutcomes) == null ? void 0 : _a[0]
|
|
527
536
|
);
|
|
528
|
-
const
|
|
537
|
+
const bestMidpoint = resolveBestMidpointForMarket(
|
|
538
|
+
market,
|
|
539
|
+
midpointsByVenueMarketId,
|
|
540
|
+
spreadByVenueMarketId
|
|
541
|
+
);
|
|
542
|
+
const marketMidpoint = bestMidpoint != null ? normalizeProbability(bestMidpoint.midpoint) : void 0;
|
|
543
|
+
const bestVenue = (_c = bestMidpoint == null ? void 0 : bestMidpoint.venue) != null ? _c : market.venue;
|
|
529
544
|
const probability = marketMidpoint != null ? marketMidpoint : isMidpointQueryInFlight ? void 0 : normalizeProbability(displayOutcome == null ? void 0 : displayOutcome.price);
|
|
530
545
|
const shouldRenderMidpointSkeleton = marketMidpoint == null && isMidpointQueryInFlight;
|
|
531
546
|
const arbitragePercent = arbitrageByOutcomeId == null ? void 0 : arbitrageByOutcomeId[market.id];
|
|
@@ -552,7 +567,7 @@ var EventListItemContent = ({
|
|
|
552
567
|
renderArbitrage(arbitragePercent),
|
|
553
568
|
renderOutcomePriceBadge(
|
|
554
569
|
probability,
|
|
555
|
-
|
|
570
|
+
bestVenue,
|
|
556
571
|
shouldRenderMidpointSkeleton,
|
|
557
572
|
market,
|
|
558
573
|
displayOutcome
|
|
@@ -942,70 +957,23 @@ var mergeVenueOutcomeOrderbooks = ({
|
|
|
942
957
|
|
|
943
958
|
// src/events/item-details/settlement-summary.tsx
|
|
944
959
|
import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
945
|
-
import {
|
|
960
|
+
import { useMemo as useMemo2 } from "react";
|
|
946
961
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
947
962
|
var SettlementSummary = ({
|
|
948
963
|
content,
|
|
949
|
-
|
|
964
|
+
settlementSectionId = SETTLEMENT_SECTION_ID,
|
|
950
965
|
className
|
|
951
966
|
}) => {
|
|
952
|
-
var _a;
|
|
953
967
|
const labels = useLabels2();
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
const
|
|
957
|
-
const [isExpanded, setIsExpanded] = useState2(false);
|
|
958
|
-
const [canExpand, setCanExpand] = useState2(false);
|
|
959
|
-
const resolvedContent = (_a = content == null ? void 0 : content.trim()) != null ? _a : "";
|
|
960
|
-
const measureOverflow = useCallback2(() => {
|
|
961
|
-
const measureElement = measureRef.current;
|
|
962
|
-
if (!measureElement) return;
|
|
963
|
-
const nextCanExpand = measureElement.scrollWidth > measureElement.clientWidth + 1;
|
|
964
|
-
setCanExpand((currentValue) => {
|
|
965
|
-
if (currentValue === nextCanExpand) return currentValue;
|
|
966
|
-
return nextCanExpand;
|
|
967
|
-
});
|
|
968
|
-
}, []);
|
|
969
|
-
useEffect(() => {
|
|
970
|
-
if (!resolvedContent) {
|
|
971
|
-
setCanExpand(false);
|
|
972
|
-
setIsExpanded(false);
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
setCanExpand(false);
|
|
976
|
-
setIsExpanded(false);
|
|
977
|
-
measureOverflow();
|
|
978
|
-
}, [measureOverflow, resolvedContent]);
|
|
979
|
-
useEffect(() => {
|
|
980
|
-
if (!resolvedContent) return;
|
|
981
|
-
const containerElement = containerRef.current;
|
|
982
|
-
if (!containerElement) return;
|
|
983
|
-
if (typeof ResizeObserver === "function") {
|
|
984
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
985
|
-
measureOverflow();
|
|
986
|
-
});
|
|
987
|
-
resizeObserver.observe(containerElement);
|
|
988
|
-
return () => {
|
|
989
|
-
resizeObserver.disconnect();
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
const handleResize = () => {
|
|
993
|
-
measureOverflow();
|
|
994
|
-
};
|
|
995
|
-
window.addEventListener("resize", handleResize);
|
|
996
|
-
return () => {
|
|
997
|
-
window.removeEventListener("resize", handleResize);
|
|
998
|
-
};
|
|
999
|
-
}, [measureOverflow, resolvedContent]);
|
|
1000
|
-
if (!resolvedContent) return null;
|
|
1001
|
-
const shouldShowToggle = canExpand || isExpanded;
|
|
1002
|
-
const toggleLabel = isExpanded ? labels.settlementSummary.showLess : labels.settlementSummary.readFullDetails;
|
|
1003
|
-
const handleToggle = (event) => {
|
|
968
|
+
const firstParagraph = useMemo2(() => getFirstSettlementParagraph(content), [content]);
|
|
969
|
+
if (!firstParagraph) return null;
|
|
970
|
+
const handleReadFullDetails = (event) => {
|
|
1004
971
|
event.preventDefault();
|
|
1005
972
|
event.stopPropagation();
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
973
|
+
if (typeof document === "undefined") return;
|
|
974
|
+
const target = document.getElementById(settlementSectionId);
|
|
975
|
+
if (!target) return;
|
|
976
|
+
target.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
1009
977
|
};
|
|
1010
978
|
return /* @__PURE__ */ jsxs2("div", { className: cn("agg-settlement-summary flex w-full flex-col gap-2", className), children: [
|
|
1011
979
|
/* @__PURE__ */ jsx2(
|
|
@@ -1016,78 +984,32 @@ var SettlementSummary = ({
|
|
|
1016
984
|
children: labels.settlementSummary.title
|
|
1017
985
|
}
|
|
1018
986
|
),
|
|
1019
|
-
/* @__PURE__ */ jsxs2("div", {
|
|
987
|
+
/* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-row flex w-full items-center gap-3", children: [
|
|
1020
988
|
/* @__PURE__ */ jsx2(
|
|
1021
989
|
"p",
|
|
1022
990
|
{
|
|
1023
|
-
ref: measureRef,
|
|
1024
|
-
"aria-hidden": "true",
|
|
1025
991
|
className: cn(
|
|
1026
|
-
"agg-settlement-summary-
|
|
1027
|
-
"
|
|
1028
|
-
"text-agg-sm leading-agg-5 text-agg-foreground"
|
|
992
|
+
"agg-settlement-summary-text",
|
|
993
|
+
"min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
|
|
1029
994
|
),
|
|
1030
|
-
children:
|
|
995
|
+
children: firstParagraph
|
|
1031
996
|
}
|
|
1032
997
|
),
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
{
|
|
1049
|
-
type: "button",
|
|
1050
|
-
className: cn(
|
|
1051
|
-
"agg-settlement-summary-toggle",
|
|
1052
|
-
"w-fit shrink-0 cursor-pointer whitespace-nowrap text-left text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
|
|
1053
|
-
"hover:opacity-80",
|
|
1054
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
1055
|
-
),
|
|
1056
|
-
"aria-controls": contentId,
|
|
1057
|
-
"aria-expanded": isExpanded,
|
|
1058
|
-
onClick: handleToggle,
|
|
1059
|
-
children: toggleLabel
|
|
1060
|
-
}
|
|
1061
|
-
) : null
|
|
1062
|
-
] }) : /* @__PURE__ */ jsxs2("div", { className: "agg-settlement-summary-collapsed flex w-full items-start gap-3", children: [
|
|
1063
|
-
/* @__PURE__ */ jsx2(
|
|
1064
|
-
"p",
|
|
1065
|
-
{
|
|
1066
|
-
id: contentId,
|
|
1067
|
-
className: cn(
|
|
1068
|
-
"agg-settlement-summary-text",
|
|
1069
|
-
"min-w-0 flex-1 truncate text-agg-sm leading-agg-5 text-agg-foreground"
|
|
1070
|
-
),
|
|
1071
|
-
children: resolvedContent
|
|
1072
|
-
}
|
|
1073
|
-
),
|
|
1074
|
-
shouldShowToggle ? /* @__PURE__ */ jsx2(
|
|
1075
|
-
"button",
|
|
1076
|
-
{
|
|
1077
|
-
type: "button",
|
|
1078
|
-
className: cn(
|
|
1079
|
-
"agg-settlement-summary-toggle",
|
|
1080
|
-
"shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
|
|
1081
|
-
"hover:opacity-80",
|
|
1082
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
1083
|
-
),
|
|
1084
|
-
"aria-controls": contentId,
|
|
1085
|
-
"aria-expanded": isExpanded,
|
|
1086
|
-
onClick: handleToggle,
|
|
1087
|
-
children: toggleLabel
|
|
1088
|
-
}
|
|
1089
|
-
) : null
|
|
1090
|
-
] })
|
|
998
|
+
/* @__PURE__ */ jsx2(
|
|
999
|
+
"button",
|
|
1000
|
+
{
|
|
1001
|
+
type: "button",
|
|
1002
|
+
className: cn(
|
|
1003
|
+
"agg-settlement-summary-toggle",
|
|
1004
|
+
"shrink-0 cursor-pointer whitespace-nowrap text-agg-sm font-agg-bold leading-agg-5 text-agg-primary",
|
|
1005
|
+
"hover:opacity-80",
|
|
1006
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-0 focus-visible:ring-offset-agg-secondary"
|
|
1007
|
+
),
|
|
1008
|
+
"aria-controls": settlementSectionId,
|
|
1009
|
+
onClick: handleReadFullDetails,
|
|
1010
|
+
children: labels.settlementSummary.readFullDetails
|
|
1011
|
+
}
|
|
1012
|
+
)
|
|
1091
1013
|
] })
|
|
1092
1014
|
] });
|
|
1093
1015
|
};
|
|
@@ -1107,11 +1029,11 @@ import {
|
|
|
1107
1029
|
useSdkUiConfig as useSdkUiConfig2,
|
|
1108
1030
|
useVenueEvent as useVenueEvent2
|
|
1109
1031
|
} from "@agg-build/hooks";
|
|
1110
|
-
import { useEffect as
|
|
1032
|
+
import { useEffect as useEffect2, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
|
|
1111
1033
|
|
|
1112
1034
|
// src/primitives/chart/chart-type-switch.tsx
|
|
1113
1035
|
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
1114
|
-
import { useMemo as
|
|
1036
|
+
import { useMemo as useMemo3 } from "react";
|
|
1115
1037
|
|
|
1116
1038
|
// src/primitives/chart/chart-type-switch.constants.ts
|
|
1117
1039
|
var CHART_TYPE_SWITCH_OPTION_KEYS = ["line", "candlestick"];
|
|
@@ -1143,7 +1065,7 @@ var ChartTypeSwitch = ({
|
|
|
1143
1065
|
className
|
|
1144
1066
|
}) => {
|
|
1145
1067
|
const labels = useLabels3();
|
|
1146
|
-
const options =
|
|
1068
|
+
const options = useMemo3(
|
|
1147
1069
|
() => CHART_TYPE_SWITCH_OPTION_KEYS.map((chartType) => ({
|
|
1148
1070
|
value: chartType,
|
|
1149
1071
|
iconName: resolveChartTypeOptionIconName(chartType),
|
|
@@ -1259,7 +1181,7 @@ var filterChartVenueOutcomesByRenderableVenues = ({
|
|
|
1259
1181
|
|
|
1260
1182
|
// src/events/item-details/event-list-item-details-market-selector.tsx
|
|
1261
1183
|
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
1262
|
-
import { useEffect
|
|
1184
|
+
import { useEffect, useLayoutEffect, useMemo as useMemo4, useRef, useState as useState2 } from "react";
|
|
1263
1185
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1264
1186
|
var MARKET_PILL_MAX_ROWS = 2;
|
|
1265
1187
|
var MARKET_PILL_FALLBACK_CONTAINER_WIDTH = 640;
|
|
@@ -1356,37 +1278,37 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1356
1278
|
}) => {
|
|
1357
1279
|
var _a;
|
|
1358
1280
|
const labels = useLabels4();
|
|
1359
|
-
const containerRef =
|
|
1360
|
-
const measurementContainerRef =
|
|
1361
|
-
const moreButtonRef =
|
|
1362
|
-
const dropdownInputRef =
|
|
1363
|
-
const moreButtonMeasureRef =
|
|
1364
|
-
const optionMeasureRefs =
|
|
1365
|
-
const [layout, setLayout] =
|
|
1281
|
+
const containerRef = useRef(null);
|
|
1282
|
+
const measurementContainerRef = useRef(null);
|
|
1283
|
+
const moreButtonRef = useRef(null);
|
|
1284
|
+
const dropdownInputRef = useRef(null);
|
|
1285
|
+
const moreButtonMeasureRef = useRef(null);
|
|
1286
|
+
const optionMeasureRefs = useRef({});
|
|
1287
|
+
const [layout, setLayout] = useState2(() => ({
|
|
1366
1288
|
visibleItems: options,
|
|
1367
1289
|
hiddenItems: []
|
|
1368
1290
|
}));
|
|
1369
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
1370
|
-
const [isMobileViewport, setIsMobileViewport] =
|
|
1371
|
-
const [searchValue, setSearchValue] =
|
|
1372
|
-
const [dropdownPosition, setDropdownPosition] =
|
|
1291
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState2(false);
|
|
1292
|
+
const [isMobileViewport, setIsMobileViewport] = useState2(false);
|
|
1293
|
+
const [searchValue, setSearchValue] = useState2("");
|
|
1294
|
+
const [dropdownPosition, setDropdownPosition] = useState2({
|
|
1373
1295
|
left: 0,
|
|
1374
1296
|
top: 0,
|
|
1375
1297
|
width: 0
|
|
1376
1298
|
});
|
|
1377
|
-
const selectedHiddenOption =
|
|
1299
|
+
const selectedHiddenOption = useMemo4(() => {
|
|
1378
1300
|
var _a2;
|
|
1379
1301
|
return (_a2 = layout.hiddenItems.find((option) => option.value === selectedValue)) != null ? _a2 : null;
|
|
1380
1302
|
}, [layout.hiddenItems, selectedValue]);
|
|
1381
1303
|
const moreButtonLabel = (_a = selectedHiddenOption == null ? void 0 : selectedHiddenOption.label) != null ? _a : MARKET_PILL_MORE_LABEL;
|
|
1382
1304
|
const isMoreButtonSelected = selectedHiddenOption != null;
|
|
1383
|
-
const filteredOptions =
|
|
1305
|
+
const filteredOptions = useMemo4(() => {
|
|
1384
1306
|
const normalizedSearchValue = searchValue.trim().toLowerCase();
|
|
1385
1307
|
if (!normalizedSearchValue) return options;
|
|
1386
1308
|
return options.filter((option) => option.label.toLowerCase().includes(normalizedSearchValue));
|
|
1387
1309
|
}, [options, searchValue]);
|
|
1388
|
-
const lastMeasuredKeyRef =
|
|
1389
|
-
const measureFrameRef =
|
|
1310
|
+
const lastMeasuredKeyRef = useRef(null);
|
|
1311
|
+
const measureFrameRef = useRef(null);
|
|
1390
1312
|
useLayoutEffect(() => {
|
|
1391
1313
|
const measureLayout = () => {
|
|
1392
1314
|
var _a2, _b, _c, _d, _e;
|
|
@@ -1468,7 +1390,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1468
1390
|
}
|
|
1469
1391
|
};
|
|
1470
1392
|
}, [moreButtonLabel, options]);
|
|
1471
|
-
|
|
1393
|
+
useEffect(() => {
|
|
1472
1394
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1473
1395
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
1474
1396
|
const handleMediaQueryChange = (event) => {
|
|
@@ -1486,7 +1408,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1486
1408
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
1487
1409
|
};
|
|
1488
1410
|
}, []);
|
|
1489
|
-
|
|
1411
|
+
useEffect(() => {
|
|
1490
1412
|
if (!isDropdownOpen) {
|
|
1491
1413
|
setSearchValue("");
|
|
1492
1414
|
return;
|
|
@@ -1535,7 +1457,7 @@ var EventListItemDetailsMarketSelector = ({
|
|
|
1535
1457
|
resizeObserver.disconnect();
|
|
1536
1458
|
};
|
|
1537
1459
|
}, [isDropdownOpen, isMobileViewport, moreButtonLabel]);
|
|
1538
|
-
|
|
1460
|
+
useEffect(() => {
|
|
1539
1461
|
if (!isDropdownOpen) return;
|
|
1540
1462
|
const handlePointerDown = (event) => {
|
|
1541
1463
|
var _a2;
|
|
@@ -1874,16 +1796,18 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1874
1796
|
selectedChartType,
|
|
1875
1797
|
venueMarkets,
|
|
1876
1798
|
livePrices,
|
|
1799
|
+
wsLivePrices,
|
|
1800
|
+
restMidpoints,
|
|
1877
1801
|
live
|
|
1878
1802
|
}) => {
|
|
1879
1803
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1880
1804
|
const labels = useLabels5();
|
|
1881
1805
|
const tradingContext = useEventTradingContext();
|
|
1882
|
-
const [selectedGraphVenue, setSelectedGraphVenue] =
|
|
1883
|
-
const [chartOutcomeLabel, setChartOutcomeLabel] =
|
|
1806
|
+
const [selectedGraphVenue, setSelectedGraphVenue] = useState3(null);
|
|
1807
|
+
const [chartOutcomeLabel, setChartOutcomeLabel] = useState3(
|
|
1884
1808
|
(_c = (_b = (_a = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a.label) == null ? void 0 : _b.trim()) != null ? _c : null
|
|
1885
1809
|
);
|
|
1886
|
-
|
|
1810
|
+
useEffect2(() => {
|
|
1887
1811
|
var _a2, _b2, _c2;
|
|
1888
1812
|
if (chartOutcomeLabel != null) return;
|
|
1889
1813
|
const label = (_c2 = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _a2.label) == null ? void 0 : _b2.trim()) != null ? _c2 : null;
|
|
@@ -1897,15 +1821,15 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1897
1821
|
general: { theme }
|
|
1898
1822
|
} = useSdkUiConfig2();
|
|
1899
1823
|
const isDarkTheme = theme === "dark";
|
|
1900
|
-
const timeWindow =
|
|
1824
|
+
const timeWindow = useMemo5(() => {
|
|
1901
1825
|
return getTimeWindowByRange(selectedChartTimeRange);
|
|
1902
1826
|
}, [selectedChartTimeRange]);
|
|
1903
|
-
const availableMarkets =
|
|
1827
|
+
const availableMarkets = useMemo5(() => {
|
|
1904
1828
|
if (venueMarkets.length === 0) return [];
|
|
1905
1829
|
return normalizeVenueMarketCluster(venueMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarketId);
|
|
1906
1830
|
}, [tradingContext == null ? void 0 : tradingContext.selectedMarketId, venueMarkets]);
|
|
1907
1831
|
const resolvedChartOutcomeLabel = (_g = chartOutcomeLabel != null ? chartOutcomeLabel : (_f = (_e = tradingContext == null ? void 0 : tradingContext.selectedOutcome) == null ? void 0 : _e.label) == null ? void 0 : _f.trim()) != null ? _g : null;
|
|
1908
|
-
const availableVenueOutcomes =
|
|
1832
|
+
const availableVenueOutcomes = useMemo5(() => {
|
|
1909
1833
|
return resolveChartVenueOutcomes({
|
|
1910
1834
|
eligibleVenueOutcomes: collectEligibleVenueOutcomes({
|
|
1911
1835
|
venueMarkets: availableMarkets,
|
|
@@ -1929,13 +1853,13 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1929
1853
|
enabled: availableVenueOutcomes.length > 0,
|
|
1930
1854
|
live
|
|
1931
1855
|
});
|
|
1932
|
-
const selectedMarketOutcomes =
|
|
1856
|
+
const selectedMarketOutcomes = useMemo5(() => {
|
|
1933
1857
|
var _a2, _b2;
|
|
1934
1858
|
const selectedMarket = (_b2 = (_a2 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a2 : availableMarkets[0]) != null ? _b2 : null;
|
|
1935
1859
|
if (!selectedMarket) return [];
|
|
1936
1860
|
return sortOutcomeSelectorOutcomes(selectedMarket.venueMarketOutcomes);
|
|
1937
1861
|
}, [availableMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarket]);
|
|
1938
|
-
const resolvedVenueChartSeries =
|
|
1862
|
+
const resolvedVenueChartSeries = useMemo5(() => {
|
|
1939
1863
|
return resolveMarketChartVenueSeries({
|
|
1940
1864
|
chartData: scopedMarketChartData,
|
|
1941
1865
|
transformProbability: (v) => v
|
|
@@ -1948,31 +1872,31 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1948
1872
|
lineStyle: "solid"
|
|
1949
1873
|
}));
|
|
1950
1874
|
}, [isDarkTheme, scopedMarketChartData]);
|
|
1951
|
-
const chartAvailableVenueOutcomes =
|
|
1875
|
+
const chartAvailableVenueOutcomes = useMemo5(() => {
|
|
1952
1876
|
return filterChartVenueOutcomesByRenderableVenues({
|
|
1953
1877
|
chartData: scopedMarketChartData,
|
|
1954
1878
|
venueOutcomes: availableVenueOutcomes
|
|
1955
1879
|
});
|
|
1956
1880
|
}, [availableVenueOutcomes, scopedMarketChartData]);
|
|
1957
|
-
const defaultCandlestickVenue =
|
|
1881
|
+
const defaultCandlestickVenue = useMemo5(() => {
|
|
1958
1882
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
1959
1883
|
return (_f2 = (_e2 = (_c2 = (_a2 = chartAvailableVenueOutcomes.find((item) => item.venue === (tradingContext == null ? void 0 : tradingContext.selectedVenue))) == null ? void 0 : _a2.venue) != null ? _c2 : (_b2 = chartAvailableVenueOutcomes[0]) == null ? void 0 : _b2.venue) != null ? _e2 : (_d2 = availableVenueOutcomes[0]) == null ? void 0 : _d2.venue) != null ? _f2 : null;
|
|
1960
1884
|
}, [availableVenueOutcomes, chartAvailableVenueOutcomes, tradingContext == null ? void 0 : tradingContext.selectedVenue]);
|
|
1961
1885
|
const activeGraphVenue = selectedChartType === "candlestick" ? selectedGraphVenue != null ? selectedGraphVenue : defaultCandlestickVenue : selectedGraphVenue;
|
|
1962
|
-
const visibleChartSeries =
|
|
1886
|
+
const visibleChartSeries = useMemo5(() => {
|
|
1963
1887
|
if (!activeGraphVenue) {
|
|
1964
1888
|
return resolvedVenueChartSeries;
|
|
1965
1889
|
}
|
|
1966
1890
|
return resolvedVenueChartSeries.filter((seriesItem) => seriesItem.venue === activeGraphVenue);
|
|
1967
1891
|
}, [activeGraphVenue, resolvedVenueChartSeries]);
|
|
1968
|
-
const chartLiveState =
|
|
1892
|
+
const chartLiveState = useMemo5(() => {
|
|
1969
1893
|
return resolveMarketChartLiveState({
|
|
1970
1894
|
chartData: scopedMarketChartData,
|
|
1971
1895
|
selectedVenue: activeGraphVenue,
|
|
1972
1896
|
transformProbability: (v) => v
|
|
1973
1897
|
});
|
|
1974
1898
|
}, [activeGraphVenue, scopedMarketChartData]);
|
|
1975
|
-
|
|
1899
|
+
useEffect2(() => {
|
|
1976
1900
|
if (!selectedGraphVenue) return;
|
|
1977
1901
|
const hasSelectedGraphVenue = chartAvailableVenueOutcomes.some(
|
|
1978
1902
|
(item) => item.venue === selectedGraphVenue
|
|
@@ -2030,7 +1954,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2030
1954
|
),
|
|
2031
1955
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
2032
1956
|
var _a3;
|
|
2033
|
-
const percentage = (_a3 =
|
|
1957
|
+
const percentage = (_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price;
|
|
2034
1958
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
2035
1959
|
const seriesId = `${item.venue}-chart`;
|
|
2036
1960
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -2091,8 +2015,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2091
2015
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
|
|
2092
2016
|
},
|
|
2093
2017
|
options: selectedMarketOutcomes.map((outcome) => {
|
|
2094
|
-
var _a3;
|
|
2095
|
-
const price = (_a3 =
|
|
2018
|
+
var _a3, _b3;
|
|
2019
|
+
const price = (_b3 = (_a3 = restMidpoints.get(outcome.id)) != null ? _a3 : livePrices.get(outcome.id)) != null ? _b3 : outcome.price;
|
|
2096
2020
|
return {
|
|
2097
2021
|
value: outcome.id,
|
|
2098
2022
|
label: `${outcome.label} ${formatProbabilityCents(price)}`,
|
|
@@ -2120,14 +2044,14 @@ var EventListItemDetailsContent = ({
|
|
|
2120
2044
|
onClick
|
|
2121
2045
|
}) => {
|
|
2122
2046
|
var _a, _b;
|
|
2123
|
-
const [selectedChartType, setSelectedChartType] =
|
|
2124
|
-
const lastAppliedEventSyncKeyRef =
|
|
2125
|
-
const lastAppliedDefaultRef =
|
|
2047
|
+
const [selectedChartType, setSelectedChartType] = useState3("line");
|
|
2048
|
+
const lastAppliedEventSyncKeyRef = useRef2(null);
|
|
2049
|
+
const lastAppliedDefaultRef = useRef2(null);
|
|
2126
2050
|
const config = useSdkUiConfig2();
|
|
2127
2051
|
const labels = useLabels5();
|
|
2128
2052
|
const tradingContext = useEventTradingContext();
|
|
2129
|
-
const eventSyncKey =
|
|
2130
|
-
const resolvedEventTradingState =
|
|
2053
|
+
const eventSyncKey = useMemo5(() => resolveEventDetailsSyncKey(event), [event]);
|
|
2054
|
+
const resolvedEventTradingState = useMemo5(() => {
|
|
2131
2055
|
return eventTradingState != null ? eventTradingState : resolveEventTradingState(event);
|
|
2132
2056
|
}, [event, eventTradingState]);
|
|
2133
2057
|
const scopedSelectedMarket = (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? (_a = tradingContext.selectedMarket) != null ? _a : resolvedEventTradingState.primaryMarket : resolvedEventTradingState.primaryMarket;
|
|
@@ -2137,7 +2061,7 @@ var EventListItemDetailsContent = ({
|
|
|
2137
2061
|
scopedSelectedMarketId
|
|
2138
2062
|
);
|
|
2139
2063
|
const wsLivePrices = useLiveOutcomePrices(resolvedEventTradingState.displayMarkets);
|
|
2140
|
-
const midpointsClusterMarkets =
|
|
2064
|
+
const midpointsClusterMarkets = useMemo5(() => {
|
|
2141
2065
|
if (resolvedEventTradingState.isTradingDisabled) return [];
|
|
2142
2066
|
return normalizeVenueMarketCluster(
|
|
2143
2067
|
resolvedEventTradingState.displayMarkets,
|
|
@@ -2149,14 +2073,14 @@ var EventListItemDetailsContent = ({
|
|
|
2149
2073
|
scopedSelectedMarketId
|
|
2150
2074
|
]);
|
|
2151
2075
|
const { prices: restMidpoints } = useMidpoints(midpointsClusterMarkets);
|
|
2152
|
-
const livePrices =
|
|
2076
|
+
const livePrices = useMemo5(() => {
|
|
2153
2077
|
if (!restMidpoints.size) return wsLivePrices;
|
|
2154
2078
|
if (!wsLivePrices.size) return restMidpoints;
|
|
2155
2079
|
const merged = new Map(restMidpoints);
|
|
2156
2080
|
for (const [k, v] of wsLivePrices) merged.set(k, v);
|
|
2157
2081
|
return merged;
|
|
2158
2082
|
}, [restMidpoints, wsLivePrices]);
|
|
2159
|
-
|
|
2083
|
+
useEffect2(() => {
|
|
2160
2084
|
if (!tradingContext) return;
|
|
2161
2085
|
if (lastAppliedEventSyncKeyRef.current === eventSyncKey) return;
|
|
2162
2086
|
if ((tradingContext == null ? void 0 : tradingContext.selectedEventId) !== event.id) {
|
|
@@ -2166,7 +2090,7 @@ var EventListItemDetailsContent = ({
|
|
|
2166
2090
|
}
|
|
2167
2091
|
lastAppliedEventSyncKeyRef.current = eventSyncKey;
|
|
2168
2092
|
}, [event, eventSyncKey, tradingContext]);
|
|
2169
|
-
|
|
2093
|
+
useEffect2(() => {
|
|
2170
2094
|
if (!tradingContext) return;
|
|
2171
2095
|
if (!defaultMarketId) return;
|
|
2172
2096
|
if (tradingContext.selectedEventId !== event.id) return;
|
|
@@ -2193,19 +2117,19 @@ var EventListItemDetailsContent = ({
|
|
|
2193
2117
|
tradingContext,
|
|
2194
2118
|
tradingContext == null ? void 0 : tradingContext.selectedEventId
|
|
2195
2119
|
]);
|
|
2196
|
-
const venueMarkets =
|
|
2120
|
+
const venueMarkets = useMemo5(
|
|
2197
2121
|
() => resolvedEventTradingState.displayMarkets,
|
|
2198
2122
|
[resolvedEventTradingState.displayMarkets]
|
|
2199
2123
|
);
|
|
2200
|
-
const sortedVenueMarkets =
|
|
2201
|
-
const marketOptions =
|
|
2124
|
+
const sortedVenueMarkets = useMemo5(() => sortMarketsByYesOddsDesc(venueMarkets), [venueMarkets]);
|
|
2125
|
+
const marketOptions = useMemo5(
|
|
2202
2126
|
() => sortedVenueMarkets.map((vm) => ({
|
|
2203
2127
|
value: vm.id,
|
|
2204
2128
|
label: vm.question
|
|
2205
2129
|
})),
|
|
2206
2130
|
[sortedVenueMarkets]
|
|
2207
2131
|
);
|
|
2208
|
-
const volumeLabel =
|
|
2132
|
+
const volumeLabel = useMemo5(() => {
|
|
2209
2133
|
const resolvedVolume = resolveDisplayVolume(event.volume, venueMarkets);
|
|
2210
2134
|
if (typeof resolvedVolume !== "number") return "";
|
|
2211
2135
|
return `${config.formatting.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
@@ -2309,6 +2233,8 @@ var EventListItemDetailsContent = ({
|
|
|
2309
2233
|
venueInfo,
|
|
2310
2234
|
venueMarkets,
|
|
2311
2235
|
livePrices,
|
|
2236
|
+
wsLivePrices,
|
|
2237
|
+
restMidpoints,
|
|
2312
2238
|
live: false
|
|
2313
2239
|
}
|
|
2314
2240
|
),
|
|
@@ -2480,7 +2406,7 @@ var orderbookDefaultLabels = {
|
|
|
2480
2406
|
};
|
|
2481
2407
|
|
|
2482
2408
|
// src/events/orderbook/use-center-orderbook-spread.ts
|
|
2483
|
-
import { useCallback as
|
|
2409
|
+
import { useCallback as useCallback2, useLayoutEffect as useLayoutEffect2, useRef as useRef3 } from "react";
|
|
2484
2410
|
var maxAutoCenterAttempts = 12;
|
|
2485
2411
|
var userScrollKeys = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "PageDown", "PageUp", "Home", "End", " "]);
|
|
2486
2412
|
var useCenterOrderbookSpread = ({
|
|
@@ -2491,10 +2417,10 @@ var useCenterOrderbookSpread = ({
|
|
|
2491
2417
|
rowCount,
|
|
2492
2418
|
enabled = true
|
|
2493
2419
|
}) => {
|
|
2494
|
-
const hasAutoCenteredRef =
|
|
2495
|
-
const hasUserScrolledRef =
|
|
2496
|
-
const animationFrameRef =
|
|
2497
|
-
const retryCountRef =
|
|
2420
|
+
const hasAutoCenteredRef = useRef3(false);
|
|
2421
|
+
const hasUserScrolledRef = useRef3(false);
|
|
2422
|
+
const animationFrameRef = useRef3(null);
|
|
2423
|
+
const retryCountRef = useRef3(0);
|
|
2498
2424
|
const resetKey = marketId != null ? marketId : "";
|
|
2499
2425
|
useLayoutEffect2(() => {
|
|
2500
2426
|
const cancelPendingFrame = () => {
|
|
@@ -2539,18 +2465,42 @@ var useCenterOrderbookSpread = ({
|
|
|
2539
2465
|
if (!enabled) return;
|
|
2540
2466
|
if (hasAutoCenteredRef.current || hasUserScrolledRef.current) return;
|
|
2541
2467
|
let isCancelled = false;
|
|
2468
|
+
let resizeObserver = null;
|
|
2542
2469
|
const cancelPendingFrame = () => {
|
|
2543
2470
|
if (animationFrameRef.current === null) return;
|
|
2544
2471
|
window.cancelAnimationFrame(animationFrameRef.current);
|
|
2545
2472
|
animationFrameRef.current = null;
|
|
2546
2473
|
};
|
|
2474
|
+
const disconnectResizeObserver = () => {
|
|
2475
|
+
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
2476
|
+
resizeObserver = null;
|
|
2477
|
+
};
|
|
2547
2478
|
const scheduleMeasurement = () => {
|
|
2548
2479
|
cancelPendingFrame();
|
|
2549
2480
|
animationFrameRef.current = window.requestAnimationFrame(measureAndCenter);
|
|
2550
2481
|
};
|
|
2482
|
+
const setupResizeObserverFallback = () => {
|
|
2483
|
+
if (resizeObserver) return;
|
|
2484
|
+
const container = containerRef.current;
|
|
2485
|
+
if (!container) return;
|
|
2486
|
+
resizeObserver = new ResizeObserver(() => {
|
|
2487
|
+
if (isCancelled || hasAutoCenteredRef.current || hasUserScrolledRef.current) {
|
|
2488
|
+
disconnectResizeObserver();
|
|
2489
|
+
return;
|
|
2490
|
+
}
|
|
2491
|
+
if (container.clientHeight <= 0) return;
|
|
2492
|
+
disconnectResizeObserver();
|
|
2493
|
+
retryCountRef.current = 0;
|
|
2494
|
+
scheduleMeasurement();
|
|
2495
|
+
});
|
|
2496
|
+
resizeObserver.observe(container);
|
|
2497
|
+
};
|
|
2551
2498
|
const scheduleRetry = () => {
|
|
2552
2499
|
if (isCancelled || hasUserScrolledRef.current || hasAutoCenteredRef.current) return;
|
|
2553
|
-
if (retryCountRef.current >= maxAutoCenterAttempts)
|
|
2500
|
+
if (retryCountRef.current >= maxAutoCenterAttempts) {
|
|
2501
|
+
setupResizeObserverFallback();
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2554
2504
|
retryCountRef.current += 1;
|
|
2555
2505
|
scheduleMeasurement();
|
|
2556
2506
|
};
|
|
@@ -2575,6 +2525,11 @@ var useCenterOrderbookSpread = ({
|
|
|
2575
2525
|
}
|
|
2576
2526
|
const spreadOffsetTop = container.scrollTop + (spreadRect.top - containerRect.top);
|
|
2577
2527
|
const maxScrollTop = Math.max(0, container.scrollHeight - containerHeight);
|
|
2528
|
+
if (maxScrollTop === 0) {
|
|
2529
|
+
retryCountRef.current = 0;
|
|
2530
|
+
animationFrameRef.current = null;
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2578
2533
|
const targetScrollTop = Math.max(
|
|
2579
2534
|
0,
|
|
2580
2535
|
Math.min(maxScrollTop, spreadOffsetTop - containerHeight / 2 + spreadRect.height / 2)
|
|
@@ -2583,14 +2538,16 @@ var useCenterOrderbookSpread = ({
|
|
|
2583
2538
|
hasAutoCenteredRef.current = true;
|
|
2584
2539
|
retryCountRef.current = 0;
|
|
2585
2540
|
animationFrameRef.current = null;
|
|
2541
|
+
disconnectResizeObserver();
|
|
2586
2542
|
};
|
|
2587
2543
|
scheduleMeasurement();
|
|
2588
2544
|
return () => {
|
|
2589
2545
|
isCancelled = true;
|
|
2590
2546
|
cancelPendingFrame();
|
|
2547
|
+
disconnectResizeObserver();
|
|
2591
2548
|
};
|
|
2592
2549
|
}, [containerRef, enabled, resetKey, rowCount, spreadRef]);
|
|
2593
|
-
const recenter =
|
|
2550
|
+
const recenter = useCallback2(() => {
|
|
2594
2551
|
const container = containerRef.current;
|
|
2595
2552
|
const spread = spreadRef.current;
|
|
2596
2553
|
if (!container || !spread) return;
|
|
@@ -2611,7 +2568,7 @@ var useCenterOrderbookSpread = ({
|
|
|
2611
2568
|
|
|
2612
2569
|
// src/events/orderbook/index.tsx
|
|
2613
2570
|
import { sortVenues as sortVenues3, useAggUiConfig } from "@agg-build/hooks";
|
|
2614
|
-
import { useEffect as
|
|
2571
|
+
import { useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
2615
2572
|
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2616
2573
|
var OrderbookVenueLogos = ({ venues }) => {
|
|
2617
2574
|
const visible = sortVenues3(venues).slice(0, orderbookMaxVisibleVenues);
|
|
@@ -2708,8 +2665,8 @@ var Orderbook = ({
|
|
|
2708
2665
|
var _a, _b, _c, _d, _e;
|
|
2709
2666
|
const { enableWebsocketsLogs } = useAggUiConfig();
|
|
2710
2667
|
const labels = __spreadValues(__spreadValues({}, orderbookDefaultLabels), labelsProp);
|
|
2711
|
-
const scrollContainerRef =
|
|
2712
|
-
const spreadRowRef =
|
|
2668
|
+
const scrollContainerRef = useRef4(null);
|
|
2669
|
+
const spreadRowRef = useRef4(null);
|
|
2713
2670
|
const autoCenterMarketId = (_a = marketId != null ? marketId : outcomeId) != null ? _a : null;
|
|
2714
2671
|
const maxVisibleRows = Math.max(1, visibleRows);
|
|
2715
2672
|
const totalVisibleRows = maxVisibleRows * 2 + 1;
|
|
@@ -2726,7 +2683,7 @@ var Orderbook = ({
|
|
|
2726
2683
|
const spreadEntry = entries.find(
|
|
2727
2684
|
(e) => e.kind === "spread"
|
|
2728
2685
|
);
|
|
2729
|
-
|
|
2686
|
+
useEffect3(() => {
|
|
2730
2687
|
var _a2, _b2;
|
|
2731
2688
|
if (!enableWebsocketsLogs) return;
|
|
2732
2689
|
console.debug("[AggUI][orderbook] component_rendered", {
|
|
@@ -2926,7 +2883,7 @@ import {
|
|
|
2926
2883
|
useVenueMarkets as useVenueMarkets2,
|
|
2927
2884
|
useViewportMidpoints
|
|
2928
2885
|
} from "@agg-build/hooks";
|
|
2929
|
-
import { useEffect as
|
|
2886
|
+
import { useEffect as useEffect4, useId, useMemo as useMemo6, useRef as useRef5, useState as useState4 } from "react";
|
|
2930
2887
|
|
|
2931
2888
|
// src/events/market-details/market-details-outcome-button.tsx
|
|
2932
2889
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -2988,6 +2945,7 @@ var MarketDetailsOutcomeButton = ({
|
|
|
2988
2945
|
type: "button",
|
|
2989
2946
|
role: "tab",
|
|
2990
2947
|
"data-id": item.id,
|
|
2948
|
+
"data-venue": item.venue,
|
|
2991
2949
|
"aria-controls": ariaControls,
|
|
2992
2950
|
"aria-selected": isSelected,
|
|
2993
2951
|
tabIndex: isSelected ? 0 : -1,
|
|
@@ -3089,7 +3047,8 @@ var MarketDetailsContent = ({
|
|
|
3089
3047
|
classNames,
|
|
3090
3048
|
otherContent,
|
|
3091
3049
|
live,
|
|
3092
|
-
midpointsFallback
|
|
3050
|
+
midpointsFallback,
|
|
3051
|
+
midpointsFallbackVenues
|
|
3093
3052
|
}) => {
|
|
3094
3053
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
3095
3054
|
const config = useSdkUiConfig3();
|
|
@@ -3101,9 +3060,9 @@ var MarketDetailsContent = ({
|
|
|
3101
3060
|
const isDarkTheme = theme === "dark";
|
|
3102
3061
|
const labels = useLabels6();
|
|
3103
3062
|
const tradingContext = useEventTradingContext2();
|
|
3104
|
-
const detailsContentId =
|
|
3063
|
+
const detailsContentId = useId();
|
|
3105
3064
|
const wsLivePrices = useLiveOutcomePrices2(venueMarkets);
|
|
3106
|
-
const model =
|
|
3065
|
+
const model = useMemo6(() => {
|
|
3107
3066
|
return buildMarketDetailsModel({
|
|
3108
3067
|
venueMarkets,
|
|
3109
3068
|
marketId,
|
|
@@ -3113,15 +3072,15 @@ var MarketDetailsContent = ({
|
|
|
3113
3072
|
labels
|
|
3114
3073
|
});
|
|
3115
3074
|
}, [config.formatting.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
|
|
3116
|
-
const resolvedMarket =
|
|
3075
|
+
const resolvedMarket = useMemo6(() => {
|
|
3117
3076
|
return resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
3118
3077
|
}, [venueMarkets, marketId]);
|
|
3119
|
-
const clusterMidpointMarkets =
|
|
3078
|
+
const clusterMidpointMarkets = useMemo6(() => {
|
|
3120
3079
|
if (!controlledIsOpened || !resolvedMarket) return [];
|
|
3121
3080
|
return resolvedMarket.venueMarkets;
|
|
3122
3081
|
}, [controlledIsOpened, resolvedMarket]);
|
|
3123
|
-
const { prices: clusterMidpoints } = useMidpoints2(clusterMidpointMarkets);
|
|
3124
|
-
const livePrices =
|
|
3082
|
+
const { prices: clusterMidpoints, venueByOutcomeId: clusterVenueByOutcomeId } = useMidpoints2(clusterMidpointMarkets);
|
|
3083
|
+
const livePrices = useMemo6(() => {
|
|
3125
3084
|
const merged = /* @__PURE__ */ new Map();
|
|
3126
3085
|
if (midpointsFallback == null ? void 0 : midpointsFallback.size) {
|
|
3127
3086
|
for (const [outcomeId, price] of midpointsFallback) {
|
|
@@ -3136,49 +3095,49 @@ var MarketDetailsContent = ({
|
|
|
3136
3095
|
for (const [k, v] of wsLivePrices) merged.set(k, v);
|
|
3137
3096
|
return merged;
|
|
3138
3097
|
}, [clusterMidpoints, midpointsFallback, wsLivePrices]);
|
|
3139
|
-
const scopedMarketForCard =
|
|
3098
|
+
const scopedMarketForCard = useMemo6(() => {
|
|
3140
3099
|
var _a2;
|
|
3141
3100
|
if (!model) return null;
|
|
3142
3101
|
return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
|
|
3143
3102
|
}, [model]);
|
|
3144
|
-
const marketTradingState =
|
|
3103
|
+
const marketTradingState = useMemo6(() => {
|
|
3145
3104
|
return resolveMarketTradingState(scopedMarketForCard);
|
|
3146
3105
|
}, [scopedMarketForCard]);
|
|
3147
3106
|
const isResolvedMarket = marketTradingState.kind === "resolved";
|
|
3148
3107
|
const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
|
|
3149
3108
|
const isUpcomingMarket = marketTradingState.kind === "unopened";
|
|
3150
3109
|
const marketStatePresentation = resolveTradingStatePresentation(labels, marketTradingState);
|
|
3151
|
-
const marketDetailsTabs =
|
|
3110
|
+
const marketDetailsTabs = useMemo6(() => {
|
|
3152
3111
|
return getMarketDetailsTabs(labels);
|
|
3153
3112
|
}, [labels]);
|
|
3154
|
-
const [selectedTab, setSelectedTab] =
|
|
3113
|
+
const [selectedTab, setSelectedTab] = useState4(
|
|
3155
3114
|
() => resolveInitialTab(defaultTab)
|
|
3156
3115
|
);
|
|
3157
|
-
const [isOpened, setIsOpened] =
|
|
3158
|
-
|
|
3116
|
+
const [isOpened, setIsOpened] = useState4(controlledIsOpened);
|
|
3117
|
+
useEffect4(() => {
|
|
3159
3118
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
3160
3119
|
}, [defaultTab]);
|
|
3161
|
-
|
|
3120
|
+
useEffect4(() => {
|
|
3162
3121
|
setIsOpened(controlledIsOpened);
|
|
3163
3122
|
}, [controlledIsOpened]);
|
|
3164
3123
|
const selectedTimeRange = config.chart.selectedChartTimeRange;
|
|
3165
3124
|
const setSelectedTimeRange = config.chart.setSelectedChartTimeRange;
|
|
3166
3125
|
const effectiveSelectedTab = isResolvedMarket ? "graph" : selectedTab;
|
|
3167
3126
|
const effectiveChartTimeRange = isResolvedMarket ? "ALL" : selectedTimeRange;
|
|
3168
|
-
const [selectedChartType, setSelectedChartType] =
|
|
3127
|
+
const [selectedChartType, setSelectedChartType] = useState4("line");
|
|
3169
3128
|
const scopedSelectedOutcome = (_a = tradingContext == null ? void 0 : tradingContext.selectedOutcome) != null ? _a : null;
|
|
3170
3129
|
const selectedOutcomeId = (_b = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.id) != null ? _b : null;
|
|
3171
3130
|
const selectedOutcomeLabel = (_c = scopedSelectedOutcome == null ? void 0 : scopedSelectedOutcome.label) != null ? _c : null;
|
|
3172
3131
|
const selectOutcome = tradingContext == null ? void 0 : tradingContext.selectOutcome;
|
|
3173
|
-
const [selectedGraphVenue, setSelectedGraphVenue] =
|
|
3174
|
-
const [chartOutcomeLabel, setChartOutcomeLabel] =
|
|
3175
|
-
|
|
3132
|
+
const [selectedGraphVenue, setSelectedGraphVenue] = useState4(null);
|
|
3133
|
+
const [chartOutcomeLabel, setChartOutcomeLabel] = useState4(selectedOutcomeLabel);
|
|
3134
|
+
useEffect4(() => {
|
|
3176
3135
|
if (!isOpened) return;
|
|
3177
3136
|
if (selectedOutcomeLabel) {
|
|
3178
3137
|
setChartOutcomeLabel(selectedOutcomeLabel);
|
|
3179
3138
|
}
|
|
3180
3139
|
}, [isOpened]);
|
|
3181
|
-
|
|
3140
|
+
useEffect4(() => {
|
|
3182
3141
|
var _a2;
|
|
3183
3142
|
if (!isOpened || !model) return;
|
|
3184
3143
|
if (isOutcomeSelectionLocked) return;
|
|
@@ -3198,29 +3157,44 @@ var MarketDetailsContent = ({
|
|
|
3198
3157
|
selectedOutcomeId,
|
|
3199
3158
|
selectOutcome
|
|
3200
3159
|
]);
|
|
3201
|
-
const headerOutcomeItems =
|
|
3160
|
+
const headerOutcomeItems = useMemo6(() => {
|
|
3202
3161
|
if (!model) return [];
|
|
3203
3162
|
const items = resolveHeaderOutcomeItems(model.market.venueMarkets);
|
|
3204
3163
|
return items.map((item) => {
|
|
3205
|
-
const
|
|
3206
|
-
|
|
3164
|
+
const clusterPrice = clusterMidpoints.get(item.id);
|
|
3165
|
+
if (clusterPrice != null) {
|
|
3166
|
+
const bestVenue = clusterVenueByOutcomeId.get(item.id);
|
|
3167
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: clusterPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
3168
|
+
}
|
|
3169
|
+
const fallbackPrice = midpointsFallback == null ? void 0 : midpointsFallback.get(item.id);
|
|
3170
|
+
if (fallbackPrice != null) {
|
|
3171
|
+
const bestVenue = midpointsFallbackVenues == null ? void 0 : midpointsFallbackVenues.get(item.id);
|
|
3172
|
+
return __spreadValues(__spreadProps(__spreadValues({}, item), { probability: fallbackPrice }), bestVenue ? { venue: bestVenue } : {});
|
|
3173
|
+
}
|
|
3174
|
+
const wsPrice = findLivePriceById(wsLivePrices, item.id);
|
|
3175
|
+
return wsPrice != null ? __spreadProps(__spreadValues({}, item), { probability: wsPrice }) : item;
|
|
3207
3176
|
});
|
|
3208
|
-
}, [
|
|
3209
|
-
|
|
3210
|
-
|
|
3177
|
+
}, [
|
|
3178
|
+
model,
|
|
3179
|
+
clusterMidpoints,
|
|
3180
|
+
clusterVenueByOutcomeId,
|
|
3181
|
+
midpointsFallback,
|
|
3182
|
+
midpointsFallbackVenues,
|
|
3183
|
+
wsLivePrices
|
|
3184
|
+
]);
|
|
3185
|
+
const headlineProbability = useMemo6(() => {
|
|
3186
|
+
var _a2, _b2, _c2, _d2;
|
|
3211
3187
|
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
3188
|
const yesOutcome = resolveYesOutcome(scopedMarketForCard);
|
|
3217
3189
|
const displayOutcome = yesOutcome != null ? yesOutcome : (_b2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _b2.reduce(
|
|
3218
3190
|
(acc, outcome) => outcome.price > acc.price ? outcome : acc,
|
|
3219
3191
|
(_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
|
|
3220
3192
|
);
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3193
|
+
const restPrice = (_c2 = clusterMidpoints.get(displayOutcome.id)) != null ? _c2 : midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id);
|
|
3194
|
+
if (restPrice != null) return restPrice;
|
|
3195
|
+
return (_d2 = findLivePriceById(wsLivePrices, displayOutcome.id)) != null ? _d2 : displayOutcome.price;
|
|
3196
|
+
}, [model, scopedMarketForCard, clusterMidpoints, midpointsFallback, wsLivePrices]);
|
|
3197
|
+
const selectedOutcomesByVenue = useMemo6(() => {
|
|
3224
3198
|
if (!model) return [];
|
|
3225
3199
|
return collectEligibleVenueOutcomes({
|
|
3226
3200
|
venueMarkets: model.market.venueMarkets,
|
|
@@ -3228,7 +3202,7 @@ var MarketDetailsContent = ({
|
|
|
3228
3202
|
});
|
|
3229
3203
|
}, [model, selectedOutcomeLabel]);
|
|
3230
3204
|
const resolvedChartOutcomeLabel = chartOutcomeLabel != null ? chartOutcomeLabel : selectedOutcomeLabel;
|
|
3231
|
-
const chartOutcomesByVenue =
|
|
3205
|
+
const chartOutcomesByVenue = useMemo6(() => {
|
|
3232
3206
|
if (!model) return [];
|
|
3233
3207
|
return resolveChartVenueOutcomes({
|
|
3234
3208
|
eligibleVenueOutcomes: collectEligibleVenueOutcomes({
|
|
@@ -3240,13 +3214,13 @@ var MarketDetailsContent = ({
|
|
|
3240
3214
|
}, [livePrices, model, resolvedChartOutcomeLabel]);
|
|
3241
3215
|
const chartEnabled = isOpened && effectiveSelectedTab === "graph";
|
|
3242
3216
|
const orderBookEnabled = isOpened && effectiveSelectedTab === "order-book" && !marketTradingState.isTradingDisabled;
|
|
3243
|
-
const timeWindow =
|
|
3217
|
+
const timeWindow = useMemo6(() => {
|
|
3244
3218
|
return getTimeWindowByRange(effectiveChartTimeRange);
|
|
3245
3219
|
}, [effectiveChartTimeRange]);
|
|
3246
3220
|
const primaryVenueMarketId = (_e = (_d = selectedOutcomesByVenue[0]) == null ? void 0 : _d.market.id) != null ? _e : null;
|
|
3247
3221
|
const primaryOutcomeId = (_g = (_f = selectedOutcomesByVenue[0]) == null ? void 0 : _f.outcome.id) != null ? _g : null;
|
|
3248
3222
|
const chartPrimaryOutcomeId = (_i = (_h = chartOutcomesByVenue[0]) == null ? void 0 : _h.outcome.id) != null ? _i : null;
|
|
3249
|
-
const chartVenueOutcomeIds =
|
|
3223
|
+
const chartVenueOutcomeIds = useMemo6(() => {
|
|
3250
3224
|
return chartOutcomesByVenue.map((item) => item.outcome.id);
|
|
3251
3225
|
}, [chartOutcomesByVenue]);
|
|
3252
3226
|
const {
|
|
@@ -3272,14 +3246,14 @@ var MarketDetailsContent = ({
|
|
|
3272
3246
|
})),
|
|
3273
3247
|
live
|
|
3274
3248
|
});
|
|
3275
|
-
const marketOrderbookDataById =
|
|
3249
|
+
const marketOrderbookDataById = useMemo6(() => {
|
|
3276
3250
|
var _a2;
|
|
3277
3251
|
return (_a2 = marketOrderbookResult.dataById) != null ? _a2 : {};
|
|
3278
3252
|
}, [marketOrderbookResult]);
|
|
3279
3253
|
const isOrderBookLoading = marketOrderbookResult.isLoading;
|
|
3280
3254
|
const orderBookError = marketOrderbookResult.error;
|
|
3281
3255
|
const refetchOrderBook = marketOrderbookResult.refetch;
|
|
3282
|
-
const aggregatedOrderbookRows =
|
|
3256
|
+
const aggregatedOrderbookRows = useMemo6(() => {
|
|
3283
3257
|
return mergeVenueOutcomeOrderbooks({
|
|
3284
3258
|
eligibleOutcomes: selectedOutcomesByVenue,
|
|
3285
3259
|
orderbooksByOutcomeId: marketOrderbookDataById
|
|
@@ -3287,7 +3261,7 @@ var MarketDetailsContent = ({
|
|
|
3287
3261
|
}, [marketOrderbookDataById, selectedOutcomesByVenue]);
|
|
3288
3262
|
const askRows = aggregatedOrderbookRows.askRows;
|
|
3289
3263
|
const bidRows = aggregatedOrderbookRows.bidRows;
|
|
3290
|
-
const unifiedEntries =
|
|
3264
|
+
const unifiedEntries = useMemo6(() => {
|
|
3291
3265
|
return resolveUnifiedOrderBookEntries({
|
|
3292
3266
|
askRows,
|
|
3293
3267
|
bidRows,
|
|
@@ -3295,7 +3269,7 @@ var MarketDetailsContent = ({
|
|
|
3295
3269
|
spread: aggregatedOrderbookRows.spread
|
|
3296
3270
|
});
|
|
3297
3271
|
}, [aggregatedOrderbookRows.midpoint, aggregatedOrderbookRows.spread, askRows, bidRows]);
|
|
3298
|
-
const orderbookSnapshotKey =
|
|
3272
|
+
const orderbookSnapshotKey = useMemo6(() => {
|
|
3299
3273
|
if (selectedOutcomesByVenue.length === 0) return null;
|
|
3300
3274
|
return selectedOutcomesByVenue.map((item) => {
|
|
3301
3275
|
var _a2, _b2;
|
|
@@ -3303,13 +3277,13 @@ var MarketDetailsContent = ({
|
|
|
3303
3277
|
return `${item.outcomeId}:${snapshotVersion}`;
|
|
3304
3278
|
}).join("|");
|
|
3305
3279
|
}, [marketOrderbookDataById, selectedOutcomesByVenue]);
|
|
3306
|
-
const chartAvailableOutcomesByVenue =
|
|
3280
|
+
const chartAvailableOutcomesByVenue = useMemo6(() => {
|
|
3307
3281
|
return filterChartVenueOutcomesByRenderableVenues({
|
|
3308
3282
|
chartData: marketChartData,
|
|
3309
3283
|
venueOutcomes: chartOutcomesByVenue
|
|
3310
3284
|
});
|
|
3311
3285
|
}, [chartOutcomesByVenue, marketChartData]);
|
|
3312
|
-
const graphSeries =
|
|
3286
|
+
const graphSeries = useMemo6(() => {
|
|
3313
3287
|
var _a2, _b2, _c2, _d2;
|
|
3314
3288
|
const baseColor = resolveSeriesColor(
|
|
3315
3289
|
(_d2 = (_c2 = selectedGraphVenue != null ? selectedGraphVenue : (_a2 = chartAvailableOutcomesByVenue[0]) == null ? void 0 : _a2.venue) != null ? _c2 : (_b2 = chartOutcomesByVenue[0]) == null ? void 0 : _b2.venue) != null ? _d2 : "polymarket",
|
|
@@ -3337,14 +3311,14 @@ var MarketDetailsContent = ({
|
|
|
3337
3311
|
chartAvailableOutcomesByVenue,
|
|
3338
3312
|
chartOutcomesByVenue
|
|
3339
3313
|
]);
|
|
3340
|
-
const graphLiveState =
|
|
3314
|
+
const graphLiveState = useMemo6(() => {
|
|
3341
3315
|
return resolveMarketChartLiveState({
|
|
3342
3316
|
chartData: marketChartData,
|
|
3343
3317
|
selectedVenue: selectedGraphVenue,
|
|
3344
3318
|
transformProbability: (value) => value
|
|
3345
3319
|
});
|
|
3346
3320
|
}, [marketChartData, selectedGraphVenue]);
|
|
3347
|
-
const otherRows =
|
|
3321
|
+
const otherRows = useMemo6(() => {
|
|
3348
3322
|
if (!model) return [];
|
|
3349
3323
|
return resolveOtherTabRows(model.market, labels);
|
|
3350
3324
|
}, [labels, model]);
|
|
@@ -3418,7 +3392,7 @@ var MarketDetailsContent = ({
|
|
|
3418
3392
|
title: labels.marketDetails.orderBookEmptyTitle,
|
|
3419
3393
|
description: labels.marketDetails.orderBookEmptyDescription
|
|
3420
3394
|
} : { kind: "data" };
|
|
3421
|
-
|
|
3395
|
+
useEffect4(() => {
|
|
3422
3396
|
if (!selectedGraphVenue) {
|
|
3423
3397
|
return;
|
|
3424
3398
|
}
|
|
@@ -3719,7 +3693,7 @@ var MarketDetailsContent = ({
|
|
|
3719
3693
|
/* @__PURE__ */ jsx9("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
|
|
3720
3694
|
var _a3;
|
|
3721
3695
|
const probability = formatProbabilityPercent(
|
|
3722
|
-
(_a3 =
|
|
3696
|
+
(_a3 = wsLivePrices.get(item.outcome.id)) != null ? _a3 : item.outcome.price,
|
|
3723
3697
|
formatPercent
|
|
3724
3698
|
);
|
|
3725
3699
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
@@ -3765,8 +3739,7 @@ var MarketDetailsContent = ({
|
|
|
3765
3739
|
setChartOutcomeLabel(outcome.label);
|
|
3766
3740
|
},
|
|
3767
3741
|
options: headerOutcomeItems.map((outcome) => {
|
|
3768
|
-
|
|
3769
|
-
const price = (_a3 = livePrices.get(outcome.id)) != null ? _a3 : outcome.probability;
|
|
3742
|
+
const price = outcome.probability;
|
|
3770
3743
|
const outcomeLabel = `${outcome.label} ${formatProbabilityCents(price)}`;
|
|
3771
3744
|
return {
|
|
3772
3745
|
value: outcome.id,
|
|
@@ -3872,7 +3845,8 @@ var MarketDetails = (_a) => {
|
|
|
3872
3845
|
isOpened,
|
|
3873
3846
|
onOpenChange: props.onOpenChange,
|
|
3874
3847
|
venueMarkets: props.venueMarkets,
|
|
3875
|
-
midpointsFallback: props.midpointsFallback
|
|
3848
|
+
midpointsFallback: props.midpointsFallback,
|
|
3849
|
+
midpointsFallbackVenues: props.midpointsFallbackVenues
|
|
3876
3850
|
})
|
|
3877
3851
|
);
|
|
3878
3852
|
}
|
|
@@ -3934,9 +3908,9 @@ var MarketDetailsList = ({
|
|
|
3934
3908
|
const labels = useLabels6();
|
|
3935
3909
|
const tradingContext = useEventTradingContext2();
|
|
3936
3910
|
const selectedMarketId = (_a = tradingContext == null ? void 0 : tradingContext.selectedMarketId) != null ? _a : null;
|
|
3937
|
-
const [expandedMarketId, setExpandedMarketId] =
|
|
3938
|
-
const previousSelectedMarketIdRef =
|
|
3939
|
-
const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] =
|
|
3911
|
+
const [expandedMarketId, setExpandedMarketId] = useState4(selectedMarketId);
|
|
3912
|
+
const previousSelectedMarketIdRef = useRef5(selectedMarketId);
|
|
3913
|
+
const [areResolvedMarketsVisible, setAreResolvedMarketsVisible] = useState4(false);
|
|
3940
3914
|
const resolvedEventId = eventId || "";
|
|
3941
3915
|
const {
|
|
3942
3916
|
markets: rawMarkets,
|
|
@@ -3949,7 +3923,7 @@ var MarketDetailsList = ({
|
|
|
3949
3923
|
sortBy: "yesPrice",
|
|
3950
3924
|
sortDir: "desc"
|
|
3951
3925
|
});
|
|
3952
|
-
const sourceMarkets =
|
|
3926
|
+
const sourceMarkets = useMemo6(() => {
|
|
3953
3927
|
var _a2;
|
|
3954
3928
|
if ((_a2 = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _a2.length) {
|
|
3955
3929
|
return eventTradingState.marketStates.map((item) => item.market);
|
|
@@ -3957,10 +3931,10 @@ var MarketDetailsList = ({
|
|
|
3957
3931
|
if (providedMarkets) return providedMarkets;
|
|
3958
3932
|
return rawMarkets;
|
|
3959
3933
|
}, [eventTradingState == null ? void 0 : eventTradingState.marketStates, providedMarkets, rawMarkets]);
|
|
3960
|
-
const isResolvedEvent =
|
|
3934
|
+
const isResolvedEvent = useMemo6(() => {
|
|
3961
3935
|
return resolveIsResolvedEvent(sourceMarkets, eventTradingState);
|
|
3962
3936
|
}, [eventTradingState, sourceMarkets]);
|
|
3963
|
-
const groupedMarkets =
|
|
3937
|
+
const groupedMarkets = useMemo6(() => {
|
|
3964
3938
|
const sortedMarkets = sortMarketsByYesOddsDesc(sourceMarkets);
|
|
3965
3939
|
if (sortedMarkets.length === 0) {
|
|
3966
3940
|
return {
|
|
@@ -4001,16 +3975,16 @@ var MarketDetailsList = ({
|
|
|
4001
3975
|
return { primary, upcoming, resolved, closed };
|
|
4002
3976
|
}, [eventTradingState, isResolvedEvent, sourceMarkets]);
|
|
4003
3977
|
const shouldShowResolvedToggle = !isResolvedEvent && groupedMarkets.resolved.length > 0;
|
|
4004
|
-
const visibleResolvedMarkets =
|
|
3978
|
+
const visibleResolvedMarkets = useMemo6(() => {
|
|
4005
3979
|
if (isResolvedEvent || areResolvedMarketsVisible) return groupedMarkets.resolved;
|
|
4006
3980
|
return [];
|
|
4007
3981
|
}, [areResolvedMarketsVisible, groupedMarkets.resolved, isResolvedEvent]);
|
|
4008
|
-
const displayedMarkets =
|
|
3982
|
+
const displayedMarkets = useMemo6(() => {
|
|
4009
3983
|
return [...groupedMarkets.primary, ...visibleResolvedMarkets];
|
|
4010
3984
|
}, [groupedMarkets.primary, visibleResolvedMarkets]);
|
|
4011
3985
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
4012
|
-
const { prices: midpointsFallback } = useViewportMidpoints(displayedMarkets);
|
|
4013
|
-
|
|
3986
|
+
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(displayedMarkets);
|
|
3987
|
+
useEffect4(() => {
|
|
4014
3988
|
if (isResolvedEvent) {
|
|
4015
3989
|
setAreResolvedMarketsVisible(false);
|
|
4016
3990
|
return;
|
|
@@ -4019,14 +3993,14 @@ var MarketDetailsList = ({
|
|
|
4019
3993
|
setAreResolvedMarketsVisible(false);
|
|
4020
3994
|
}
|
|
4021
3995
|
}, [groupedMarkets.resolved.length, isResolvedEvent]);
|
|
4022
|
-
|
|
3996
|
+
useEffect4(() => {
|
|
4023
3997
|
if (previousSelectedMarketIdRef.current === selectedMarketId) return;
|
|
4024
3998
|
previousSelectedMarketIdRef.current = selectedMarketId;
|
|
4025
3999
|
if (!selectedMarketId) return;
|
|
4026
4000
|
if (!displayedMarkets.some((market) => market.id === selectedMarketId)) return;
|
|
4027
4001
|
setExpandedMarketId(selectedMarketId);
|
|
4028
4002
|
}, [displayedMarkets, selectedMarketId]);
|
|
4029
|
-
|
|
4003
|
+
useEffect4(() => {
|
|
4030
4004
|
if (displayedMarkets.length === 0) return;
|
|
4031
4005
|
if (selectedMarketId && displayedMarkets.some((market) => market.id === selectedMarketId)) {
|
|
4032
4006
|
return;
|
|
@@ -4045,7 +4019,7 @@ var MarketDetailsList = ({
|
|
|
4045
4019
|
}
|
|
4046
4020
|
tradingContext == null ? void 0 : tradingContext.selectMarket(fallbackSelectableMarket.id, fallbackSelectableMarket);
|
|
4047
4021
|
}, [displayedMarkets, expandedMarketId, selectedMarketId, sourceMarkets, tradingContext]);
|
|
4048
|
-
|
|
4022
|
+
useEffect4(() => {
|
|
4049
4023
|
var _a2, _b2;
|
|
4050
4024
|
if (!expandedMarketId) return;
|
|
4051
4025
|
if (displayedMarkets.some((market) => market.id === expandedMarketId)) return;
|
|
@@ -4122,7 +4096,8 @@ var MarketDetailsList = ({
|
|
|
4122
4096
|
ariaLabel: market.question,
|
|
4123
4097
|
classNames: { root: cn("agg-market-list-item", classNames == null ? void 0 : classNames.item) },
|
|
4124
4098
|
live,
|
|
4125
|
-
midpointsFallback
|
|
4099
|
+
midpointsFallback,
|
|
4100
|
+
midpointsFallbackVenues
|
|
4126
4101
|
}
|
|
4127
4102
|
) }, market.id);
|
|
4128
4103
|
return /* @__PURE__ */ jsxs7("div", { className: cn("agg-market-list flex flex-col gap-3", classNames == null ? void 0 : classNames.root), children: [
|
|
@@ -4157,11 +4132,11 @@ MarketDetailsList.displayName = "MarketDetailsList";
|
|
|
4157
4132
|
// src/events/list/index.tsx
|
|
4158
4133
|
import { MarketStatus as MarketStatus2, useAppConfig as useAppConfig2, useLabels as useLabels8, useVenueEvents } from "@agg-build/hooks";
|
|
4159
4134
|
import { VENUES } from "@agg-build/sdk";
|
|
4160
|
-
import { useEffect as
|
|
4135
|
+
import { useEffect as useEffect6, useMemo as useMemo8, useRef as useRef7, useState as useState6 } from "react";
|
|
4161
4136
|
|
|
4162
4137
|
// src/events/list/event-list-tabs.tsx
|
|
4163
4138
|
import { useAppConfig, useLabels as useLabels7 } from "@agg-build/hooks";
|
|
4164
|
-
import { useCallback as
|
|
4139
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo7, useRef as useRef6, useState as useState5 } from "react";
|
|
4165
4140
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
4166
4141
|
var renderTabIcon = (tab, isActive) => {
|
|
4167
4142
|
if (tab.venueLogo) {
|
|
@@ -4180,7 +4155,7 @@ var renderTabIcon = (tab, isActive) => {
|
|
|
4180
4155
|
var useEventListTabs = (tabs) => {
|
|
4181
4156
|
const labels = useLabels7();
|
|
4182
4157
|
const { disabledVenues } = useAppConfig();
|
|
4183
|
-
return
|
|
4158
|
+
return useMemo7(() => {
|
|
4184
4159
|
const baseTabs = tabs != null ? tabs : getDefaultEventListTabs(labels);
|
|
4185
4160
|
if (disabledVenues.length === 0) return baseTabs;
|
|
4186
4161
|
const disabled = new Set(disabledVenues);
|
|
@@ -4199,12 +4174,12 @@ var EventListTabs = ({
|
|
|
4199
4174
|
overflowBehavior
|
|
4200
4175
|
}) => {
|
|
4201
4176
|
const resolvedTabs = useEventListTabs(tabs);
|
|
4202
|
-
|
|
4177
|
+
useEffect5(() => {
|
|
4203
4178
|
if (resolvedTabs.length === 0) return;
|
|
4204
4179
|
if (resolvedTabs.some((tab) => tab.value === activeTab)) return;
|
|
4205
4180
|
onTabChange(resolvedTabs[0].value);
|
|
4206
4181
|
}, [activeTab, onTabChange, resolvedTabs]);
|
|
4207
|
-
const items =
|
|
4182
|
+
const items = useMemo7(() => {
|
|
4208
4183
|
return resolvedTabs.map((tab) => {
|
|
4209
4184
|
const isActive = tab.value === activeTab;
|
|
4210
4185
|
return {
|
|
@@ -4230,11 +4205,11 @@ var EventListTabs = ({
|
|
|
4230
4205
|
};
|
|
4231
4206
|
EventListTabs.displayName = "EventListTabs";
|
|
4232
4207
|
var useEventListTabsHeaderOverflow = (recomputeOn) => {
|
|
4233
|
-
const headerRef =
|
|
4234
|
-
const titleRef =
|
|
4235
|
-
const requiredTabsWidthRef =
|
|
4236
|
-
const [shouldUseSelectOverflow, setShouldUseSelectOverflow] =
|
|
4237
|
-
const updateTabsOverflowBehavior =
|
|
4208
|
+
const headerRef = useRef6(null);
|
|
4209
|
+
const titleRef = useRef6(null);
|
|
4210
|
+
const requiredTabsWidthRef = useRef6(0);
|
|
4211
|
+
const [shouldUseSelectOverflow, setShouldUseSelectOverflow] = useState5(false);
|
|
4212
|
+
const updateTabsOverflowBehavior = useCallback3(() => {
|
|
4238
4213
|
if (typeof window === "undefined") return;
|
|
4239
4214
|
const headerElement = headerRef.current;
|
|
4240
4215
|
const titleElement = titleRef.current;
|
|
@@ -4260,10 +4235,10 @@ var useEventListTabsHeaderOverflow = (recomputeOn) => {
|
|
|
4260
4235
|
if (requiredTabsWidthRef.current <= 0) return;
|
|
4261
4236
|
setShouldUseSelectOverflow(requiredTabsWidthRef.current > availableTabsWidth);
|
|
4262
4237
|
}, []);
|
|
4263
|
-
|
|
4238
|
+
useEffect5(() => {
|
|
4264
4239
|
updateTabsOverflowBehavior();
|
|
4265
4240
|
}, [recomputeOn, updateTabsOverflowBehavior]);
|
|
4266
|
-
|
|
4241
|
+
useEffect5(() => {
|
|
4267
4242
|
if (typeof window === "undefined") return;
|
|
4268
4243
|
const handleResize = () => {
|
|
4269
4244
|
updateTabsOverflowBehavior();
|
|
@@ -4273,7 +4248,7 @@ var useEventListTabsHeaderOverflow = (recomputeOn) => {
|
|
|
4273
4248
|
window.removeEventListener("resize", handleResize);
|
|
4274
4249
|
};
|
|
4275
4250
|
}, [updateTabsOverflowBehavior]);
|
|
4276
|
-
|
|
4251
|
+
useEffect5(() => {
|
|
4277
4252
|
if (typeof ResizeObserver === "undefined") return;
|
|
4278
4253
|
const headerElement = headerRef.current;
|
|
4279
4254
|
const titleElement = titleRef.current;
|
|
@@ -4310,32 +4285,32 @@ var EventList = ({
|
|
|
4310
4285
|
const labels = useLabels8();
|
|
4311
4286
|
const { disabledVenues } = useAppConfig2();
|
|
4312
4287
|
const resolvedTabs = useEventListTabs();
|
|
4313
|
-
const visibleVenues =
|
|
4288
|
+
const visibleVenues = useMemo8(
|
|
4314
4289
|
() => disabledVenues.length === 0 ? void 0 : VENUES.filter(
|
|
4315
4290
|
(v) => !disabledVenues.includes(v)
|
|
4316
4291
|
),
|
|
4317
4292
|
[disabledVenues]
|
|
4318
4293
|
);
|
|
4319
|
-
const [activeTabValue, setActiveTabValue] =
|
|
4294
|
+
const [activeTabValue, setActiveTabValue] = useState6(
|
|
4320
4295
|
(_b = initialVenueTab != null ? initialVenueTab : (_a = resolvedTabs[0]) == null ? void 0 : _a.value) != null ? _b : "matched"
|
|
4321
4296
|
);
|
|
4322
4297
|
const { headerRef, titleRef, shouldUseSelectOverflow } = useEventListTabsHeaderOverflow(resolvedTabs);
|
|
4323
|
-
const activeTab =
|
|
4298
|
+
const activeTab = useMemo8(() => {
|
|
4324
4299
|
return resolvedTabs.find((tab) => tab.value === activeTabValue);
|
|
4325
4300
|
}, [activeTabValue, resolvedTabs]);
|
|
4326
|
-
const venues =
|
|
4301
|
+
const venues = useMemo8(() => {
|
|
4327
4302
|
return resolveTabVenus(activeTab, visibleVenues);
|
|
4328
4303
|
}, [activeTab, visibleVenues]);
|
|
4329
|
-
const matchStatus =
|
|
4304
|
+
const matchStatus = useMemo8(() => {
|
|
4330
4305
|
return activeTabValue === "matched" ? activeTab == null ? void 0 : activeTab.matchStatus : void 0;
|
|
4331
4306
|
}, [activeTabValue, activeTab]);
|
|
4332
|
-
const resolvedMaxVisibleItems =
|
|
4307
|
+
const resolvedMaxVisibleItems = useMemo8(() => {
|
|
4333
4308
|
if (!Number.isFinite(maxVisibleItems)) return void 0;
|
|
4334
4309
|
return Math.max(1, Math.floor(maxVisibleItems));
|
|
4335
4310
|
}, [maxVisibleItems]);
|
|
4336
4311
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
4337
4312
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
4338
|
-
const endDateFrom =
|
|
4313
|
+
const endDateFrom = useMemo8(() => {
|
|
4339
4314
|
if (search) return void 0;
|
|
4340
4315
|
const BUCKET_MINUTES = 5;
|
|
4341
4316
|
const bucket = /* @__PURE__ */ new Date();
|
|
@@ -4368,21 +4343,21 @@ var EventList = ({
|
|
|
4368
4343
|
} : {}), {
|
|
4369
4344
|
initialPages: initialLoadedPageCount
|
|
4370
4345
|
}));
|
|
4371
|
-
|
|
4346
|
+
useEffect6(() => {
|
|
4372
4347
|
if (stateRef) {
|
|
4373
4348
|
stateRef.current = { venueTab: activeTabValue, loadedPageCount };
|
|
4374
4349
|
}
|
|
4375
4350
|
}, [stateRef, activeTabValue, loadedPageCount]);
|
|
4376
|
-
const filteredEvents =
|
|
4351
|
+
const filteredEvents = useMemo8(() => {
|
|
4377
4352
|
return filterEventsByTabValue(events, activeTabValue);
|
|
4378
4353
|
}, [events, activeTabValue]);
|
|
4379
|
-
const groupedEvents =
|
|
4354
|
+
const groupedEvents = useMemo8(() => {
|
|
4380
4355
|
return splitEventsByLifecycle(filteredEvents);
|
|
4381
4356
|
}, [filteredEvents]);
|
|
4382
|
-
const orderedEvents =
|
|
4357
|
+
const orderedEvents = useMemo8(() => {
|
|
4383
4358
|
return groupedEvents.open;
|
|
4384
4359
|
}, [groupedEvents.open]);
|
|
4385
|
-
const tileEvents =
|
|
4360
|
+
const tileEvents = useMemo8(() => {
|
|
4386
4361
|
const normalizedEvents = orderedEvents.map((event) => mapEventToEventListItemEvent(event)).filter((event) => event != null);
|
|
4387
4362
|
if (resolvedMaxVisibleItems == null) return normalizedEvents;
|
|
4388
4363
|
return normalizedEvents.slice(0, resolvedMaxVisibleItems);
|
|
@@ -4390,8 +4365,8 @@ var EventList = ({
|
|
|
4390
4365
|
const shouldRenderLoadingState = isLoading && !isPlaceholderData && tileEvents.length === 0;
|
|
4391
4366
|
const shouldRenderEmptyState = !isLoading && !isError && tileEvents.length === 0;
|
|
4392
4367
|
const shouldRenderPaginationLoadingItems = shouldPaginate && hasNextPage;
|
|
4393
|
-
const loadMoreRef =
|
|
4394
|
-
|
|
4368
|
+
const loadMoreRef = useRef7(null);
|
|
4369
|
+
useEffect6(() => {
|
|
4395
4370
|
if (!shouldPaginate) return;
|
|
4396
4371
|
if (!hasNextPage) return;
|
|
4397
4372
|
if (typeof IntersectionObserver === "undefined") return;
|