@agg-market/ui 8.0.0 → 10.0.0
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-SBLIHCN2.mjs → chunk-55YYUTBK.mjs} +807 -358
- package/dist/{chunk-JE4MV5RL.mjs → chunk-5G4T5R2H.mjs} +6 -2
- package/dist/{chunk-TLFRGJ5B.mjs → chunk-GYOCLZGH.mjs} +564 -414
- package/dist/{chunk-KRCRD4AJ.mjs → chunk-RYQSVETG.mjs} +212 -174
- package/dist/{chunk-WKY3IN52.mjs → chunk-XP7DREIX.mjs} +54 -15
- package/dist/events.js +604 -421
- package/dist/events.mjs +6 -4
- package/dist/index.js +1616 -948
- package/dist/index.mjs +10 -6
- package/dist/modals.js +1185 -374
- package/dist/modals.mjs +4 -2
- package/dist/pages.js +1434 -1005
- package/dist/pages.mjs +4 -4
- package/dist/primitives.js +53 -14
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +20 -4
- package/dist/trading.mjs +2 -2
- package/dist/types/events/item/event-list-item.types.d.mts +6 -4
- package/dist/types/events/item/event-list-item.types.d.ts +6 -4
- package/dist/types/events/item/event-list-item.utils.d.mts +5 -5
- package/dist/types/events/item/event-list-item.utils.d.ts +5 -5
- package/dist/types/events/item/index.d.mts +1 -1
- package/dist/types/events/item/index.d.ts +1 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +3 -5
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +3 -5
- package/dist/types/events/item-details/event-list-item-details.utils.d.mts +42 -3
- package/dist/types/events/item-details/event-list-item-details.utils.d.ts +42 -3
- package/dist/types/events/list/event-list.types.d.mts +6 -5
- package/dist/types/events/list/event-list.types.d.ts +6 -5
- package/dist/types/events/list/event-list.utils.d.mts +5 -5
- package/dist/types/events/list/event-list.utils.d.ts +5 -5
- package/dist/types/events/list/index.d.mts +1 -1
- package/dist/types/events/list/index.d.ts +1 -1
- package/dist/types/events/market-details/index.d.mts +6 -2
- package/dist/types/events/market-details/index.d.ts +6 -2
- package/dist/types/events/market-details/market-details.types.d.mts +35 -9
- package/dist/types/events/market-details/market-details.types.d.ts +35 -9
- package/dist/types/events/market-details/market-details.utils.d.mts +28 -12
- package/dist/types/events/market-details/market-details.utils.d.ts +28 -12
- package/dist/types/modals/index.d.mts +1 -0
- package/dist/types/modals/index.d.ts +1 -0
- package/dist/types/onramp/index.d.mts +6 -0
- package/dist/types/onramp/index.d.ts +6 -0
- package/dist/types/onramp/onramp-modal.constants.d.mts +9 -0
- package/dist/types/onramp/onramp-modal.constants.d.ts +9 -0
- package/dist/types/onramp/onramp-modal.types.d.mts +64 -0
- package/dist/types/onramp/onramp-modal.types.d.ts +64 -0
- package/dist/types/onramp/steps/quote-card.d.mts +8 -0
- package/dist/types/onramp/steps/quote-card.d.ts +8 -0
- package/dist/types/onramp/steps/quote-form.d.mts +12 -0
- package/dist/types/onramp/steps/quote-form.d.ts +12 -0
- package/dist/types/onramp/steps/quote-selection.d.mts +14 -0
- package/dist/types/onramp/steps/quote-selection.d.ts +14 -0
- package/dist/types/onramp/steps/widget.d.mts +7 -0
- package/dist/types/onramp/steps/widget.d.ts +7 -0
- package/dist/types/pages/event-market/event-market.types.d.mts +4 -2
- package/dist/types/pages/event-market/event-market.types.d.ts +4 -2
- package/dist/types/pages/home/home.constants.d.mts +1 -3
- package/dist/types/pages/home/home.constants.d.ts +1 -3
- package/dist/types/pages/home/home.types.d.mts +0 -2
- package/dist/types/pages/home/home.types.d.ts +0 -2
- package/dist/types/pages/home/home.utils.d.mts +4 -0
- package/dist/types/pages/home/home.utils.d.ts +4 -0
- package/dist/types/pages/home/index.d.mts +1 -1
- package/dist/types/pages/home/index.d.ts +1 -1
- package/dist/types/primitives/chart/index.d.mts +18 -1
- package/dist/types/primitives/chart/index.d.ts +18 -1
- package/dist/types/primitives/venue-logo/index.d.mts +1 -1
- package/dist/types/primitives/venue-logo/index.d.ts +1 -1
- package/dist/types/trading/types.d.mts +2 -2
- package/dist/types/trading/types.d.ts +2 -2
- package/package.json +3 -3
|
@@ -27,15 +27,15 @@ import {
|
|
|
27
27
|
marketDetailsDefaultIsOpened,
|
|
28
28
|
orderBookRowLimitDefault,
|
|
29
29
|
toDate
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-XP7DREIX.mjs";
|
|
31
31
|
|
|
32
32
|
// src/events/item/index.tsx
|
|
33
33
|
import dayjs from "dayjs";
|
|
34
34
|
import { useMemo } from "react";
|
|
35
35
|
import {
|
|
36
|
-
useEvent,
|
|
37
36
|
useLabels,
|
|
38
|
-
useSdkUiConfig
|
|
37
|
+
useSdkUiConfig,
|
|
38
|
+
useVenueEvent
|
|
39
39
|
} from "@agg-market/hooks";
|
|
40
40
|
|
|
41
41
|
// src/shared/query-error.ts
|
|
@@ -53,10 +53,7 @@ var isErrorWithStatus = (error, status) => {
|
|
|
53
53
|
var resolveEventListItemEvent = (fetchedEvent) => {
|
|
54
54
|
if (!fetchedEvent)
|
|
55
55
|
return void 0;
|
|
56
|
-
|
|
57
|
-
(market) => market.venueMarkets
|
|
58
|
-
);
|
|
59
|
-
if (mergedVenueMarkets.length === 0)
|
|
56
|
+
if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
|
|
60
57
|
return void 0;
|
|
61
58
|
return fetchedEvent;
|
|
62
59
|
};
|
|
@@ -241,7 +238,6 @@ var EventListItemContent = ({
|
|
|
241
238
|
event,
|
|
242
239
|
title,
|
|
243
240
|
image,
|
|
244
|
-
showVenueLogo = true,
|
|
245
241
|
maxOutcomes = 2,
|
|
246
242
|
classNames,
|
|
247
243
|
venueInfo,
|
|
@@ -253,8 +249,8 @@ var EventListItemContent = ({
|
|
|
253
249
|
const config = useSdkUiConfig();
|
|
254
250
|
const labels = useLabels();
|
|
255
251
|
const allVenueMarkets = useMemo(() => {
|
|
256
|
-
return event.
|
|
257
|
-
}, [event.
|
|
252
|
+
return event.venueMarkets;
|
|
253
|
+
}, [event.venueMarkets]);
|
|
258
254
|
const primaryVenueMarket = useMemo(() => {
|
|
259
255
|
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
260
256
|
}, [allVenueMarkets]);
|
|
@@ -277,7 +273,7 @@ var EventListItemContent = ({
|
|
|
277
273
|
return;
|
|
278
274
|
if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
|
|
279
275
|
eventToHandle == null ? void 0 : eventToHandle.preventDefault();
|
|
280
|
-
onClick();
|
|
276
|
+
onClick == null ? void 0 : onClick(event);
|
|
281
277
|
}
|
|
282
278
|
};
|
|
283
279
|
const renderArbitrage = (value) => {
|
|
@@ -304,7 +300,7 @@ var EventListItemContent = ({
|
|
|
304
300
|
className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
|
|
305
301
|
role: onClick ? "button" : void 0,
|
|
306
302
|
tabIndex: onClick ? 0 : void 0,
|
|
307
|
-
onClick,
|
|
303
|
+
onClick: () => onClick == null ? void 0 : onClick(event),
|
|
308
304
|
onKeyDown: handleKeyDown,
|
|
309
305
|
"aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
|
|
310
306
|
children: [
|
|
@@ -358,7 +354,7 @@ var EventListItemContent = ({
|
|
|
358
354
|
Badge,
|
|
359
355
|
{
|
|
360
356
|
text: config.formatPercent(probability),
|
|
361
|
-
prefix:
|
|
357
|
+
prefix: /* @__PURE__ */ jsx(VenueLogo, { venue: visibleOutcome.venue, size: "small" }),
|
|
362
358
|
size: "large",
|
|
363
359
|
classNames: {
|
|
364
360
|
root: cn(
|
|
@@ -391,7 +387,7 @@ var EventListItemContent = ({
|
|
|
391
387
|
) }),
|
|
392
388
|
/* @__PURE__ */ jsx("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
|
|
393
389
|
singleVenue ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
|
|
394
|
-
|
|
390
|
+
/* @__PURE__ */ jsx(
|
|
395
391
|
VenueLogo,
|
|
396
392
|
{
|
|
397
393
|
venue: singleVenue,
|
|
@@ -399,14 +395,14 @@ var EventListItemContent = ({
|
|
|
399
395
|
isMonochromatic: true,
|
|
400
396
|
className: "text-agg-muted-foreground!"
|
|
401
397
|
}
|
|
402
|
-
)
|
|
398
|
+
),
|
|
403
399
|
/* @__PURE__ */ jsx("span", { children: venueLabel })
|
|
404
400
|
] }) : /* @__PURE__ */ jsx("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
|
|
405
401
|
venueCount,
|
|
406
402
|
labels.eventItem.venueSingular,
|
|
407
403
|
labels.eventItem.venuePlural
|
|
408
404
|
) }),
|
|
409
|
-
|
|
405
|
+
!singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ jsx("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ jsx(
|
|
410
406
|
VenueLogo,
|
|
411
407
|
{
|
|
412
408
|
venue,
|
|
@@ -436,7 +432,8 @@ var EventListItemByEventId = (_a) => {
|
|
|
436
432
|
error,
|
|
437
433
|
isError,
|
|
438
434
|
isLoading
|
|
439
|
-
} =
|
|
435
|
+
} = useVenueEvent({
|
|
436
|
+
eventId: eventId != null ? eventId : "",
|
|
440
437
|
enabled: !!eventId
|
|
441
438
|
});
|
|
442
439
|
const resolvedEvent = useMemo(() => {
|
|
@@ -473,7 +470,13 @@ EventListItem.displayName = "EventListItem";
|
|
|
473
470
|
|
|
474
471
|
// src/events/item-details/index.tsx
|
|
475
472
|
import { useEffect, useMemo as useMemo3, useState } from "react";
|
|
476
|
-
import {
|
|
473
|
+
import {
|
|
474
|
+
useLabels as useLabels3,
|
|
475
|
+
useMarketChart,
|
|
476
|
+
useSdkUiConfig as useSdkUiConfig2,
|
|
477
|
+
useVenueEvent as useVenueEvent2,
|
|
478
|
+
timeRangeToInterval
|
|
479
|
+
} from "@agg-market/hooks";
|
|
477
480
|
|
|
478
481
|
// src/primitives/chart/chart-type-switch.tsx
|
|
479
482
|
import { useLabels as useLabels2 } from "@agg-market/hooks";
|
|
@@ -536,7 +539,9 @@ var ChartTypeSwitch = ({
|
|
|
536
539
|
"transition-colors duration-200 ease-in-out",
|
|
537
540
|
isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
538
541
|
),
|
|
539
|
-
onClick: () => {
|
|
542
|
+
onClick: (e) => {
|
|
543
|
+
e.stopPropagation();
|
|
544
|
+
e.preventDefault();
|
|
540
545
|
if (isActive) {
|
|
541
546
|
return;
|
|
542
547
|
}
|
|
@@ -565,14 +570,9 @@ var isDateLikeLabel = (value) => {
|
|
|
565
570
|
return false;
|
|
566
571
|
return dayjs2(value).isValid();
|
|
567
572
|
};
|
|
568
|
-
var
|
|
569
|
-
if (!isDateLikeLabel(value))
|
|
570
|
-
return value;
|
|
571
|
-
return dayjs2(value).format("MMM D, YYYY");
|
|
572
|
-
};
|
|
573
|
-
var getDefaultSelectedTimeRange = (value) => {
|
|
573
|
+
var getDefaultSelectedTimeRange = (value, fallback = "1D") => {
|
|
574
574
|
if (!value)
|
|
575
|
-
return
|
|
575
|
+
return fallback;
|
|
576
576
|
return value;
|
|
577
577
|
};
|
|
578
578
|
var getTimeWindowByRange = (range) => {
|
|
@@ -654,24 +654,6 @@ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
|
|
|
654
654
|
};
|
|
655
655
|
}).filter((item) => item != null);
|
|
656
656
|
};
|
|
657
|
-
var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
|
|
658
|
-
const marketIdByVenue = /* @__PURE__ */ new Map();
|
|
659
|
-
selectedOutcomes.forEach(({ venue, market }) => {
|
|
660
|
-
var _a, _b;
|
|
661
|
-
const marketWithCanonicalId = market;
|
|
662
|
-
const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
|
|
663
|
-
if (!canonicalMarketId)
|
|
664
|
-
return;
|
|
665
|
-
if (!marketIdByVenue.has(venue)) {
|
|
666
|
-
marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
|
|
667
|
-
}
|
|
668
|
-
(_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
|
|
669
|
-
});
|
|
670
|
-
return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
|
|
671
|
-
venue,
|
|
672
|
-
venueMarketOutcomeIds: [...marketIds]
|
|
673
|
-
})).filter((group) => group.venueMarketOutcomeIds.length > 0);
|
|
674
|
-
};
|
|
675
657
|
var resolveSeriesColor = (venue, index) => {
|
|
676
658
|
var _a;
|
|
677
659
|
const colorFromVenue = lineColorByVenue[venue];
|
|
@@ -679,6 +661,98 @@ var resolveSeriesColor = (venue, index) => {
|
|
|
679
661
|
return colorFromVenue;
|
|
680
662
|
return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
|
|
681
663
|
};
|
|
664
|
+
var toNonEmptyString = (value) => {
|
|
665
|
+
if (typeof value !== "string")
|
|
666
|
+
return void 0;
|
|
667
|
+
const trimmedValue = value.trim();
|
|
668
|
+
return trimmedValue ? trimmedValue : void 0;
|
|
669
|
+
};
|
|
670
|
+
var resolveCanonicalMarketId = (venueMarkets, fallbackMarketId) => {
|
|
671
|
+
var _a;
|
|
672
|
+
const uniqueMarketIds = Array.from(
|
|
673
|
+
new Set(venueMarkets.map((market) => toNonEmptyString(market.marketId)).filter(Boolean))
|
|
674
|
+
);
|
|
675
|
+
if (uniqueMarketIds.length === 1) {
|
|
676
|
+
return uniqueMarketIds[0];
|
|
677
|
+
}
|
|
678
|
+
return (_a = toNonEmptyString(fallbackMarketId)) != null ? _a : uniqueMarketIds[0];
|
|
679
|
+
};
|
|
680
|
+
var toChartDisplayValue = (value, transformProbability) => {
|
|
681
|
+
if (value == null || !Number.isFinite(value))
|
|
682
|
+
return void 0;
|
|
683
|
+
return transformProbability(value) * 100;
|
|
684
|
+
};
|
|
685
|
+
var marketChartCandleToLineChartPoint = (candle, transformProbability) => {
|
|
686
|
+
var _a, _b, _c, _d;
|
|
687
|
+
const open = (_a = toChartDisplayValue(candle.open, transformProbability)) != null ? _a : 0;
|
|
688
|
+
const high = (_b = toChartDisplayValue(candle.high, transformProbability)) != null ? _b : open;
|
|
689
|
+
const low = (_c = toChartDisplayValue(candle.low, transformProbability)) != null ? _c : open;
|
|
690
|
+
const close = (_d = toChartDisplayValue(candle.close, transformProbability)) != null ? _d : open;
|
|
691
|
+
return {
|
|
692
|
+
time: candle.time,
|
|
693
|
+
value: close,
|
|
694
|
+
open,
|
|
695
|
+
high,
|
|
696
|
+
low,
|
|
697
|
+
close
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
|
|
701
|
+
var _a, _b, _c, _d;
|
|
702
|
+
const point = marketChartCandleToLineChartPoint(candle, transformProbability);
|
|
703
|
+
return {
|
|
704
|
+
time: point.time,
|
|
705
|
+
open: (_a = point.open) != null ? _a : point.value,
|
|
706
|
+
high: (_b = point.high) != null ? _b : point.value,
|
|
707
|
+
low: (_c = point.low) != null ? _c : point.value,
|
|
708
|
+
close: (_d = point.close) != null ? _d : point.value,
|
|
709
|
+
v: candle.volume
|
|
710
|
+
};
|
|
711
|
+
};
|
|
712
|
+
var resolveMarketChartVenueSeries = ({
|
|
713
|
+
chartData,
|
|
714
|
+
transformProbability
|
|
715
|
+
}) => {
|
|
716
|
+
if (!chartData)
|
|
717
|
+
return [];
|
|
718
|
+
return Object.entries(chartData.venues).map(([venue, venueData]) => ({
|
|
719
|
+
venue,
|
|
720
|
+
points: venueData.candles.map(
|
|
721
|
+
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
722
|
+
)
|
|
723
|
+
})).filter((item) => item.points.length > 0);
|
|
724
|
+
};
|
|
725
|
+
var resolveMarketChartLiveState = ({
|
|
726
|
+
chartData,
|
|
727
|
+
selectedVenue,
|
|
728
|
+
transformProbability
|
|
729
|
+
}) => {
|
|
730
|
+
var _a, _b;
|
|
731
|
+
if (!chartData) {
|
|
732
|
+
return {
|
|
733
|
+
liveCandle: null,
|
|
734
|
+
lineValue: void 0,
|
|
735
|
+
live: false
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
const venueEntries = selectedVenue ? Object.entries(chartData.venues).filter(([venue]) => venue === selectedVenue) : Object.entries(chartData.venues);
|
|
739
|
+
if (venueEntries.length === 0) {
|
|
740
|
+
return {
|
|
741
|
+
liveCandle: null,
|
|
742
|
+
lineValue: void 0,
|
|
743
|
+
live: false
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
const singleVenueView = selectedVenue != null || venueEntries.length === 1;
|
|
747
|
+
const liveCandleEntry = singleVenueView ? venueEntries.find(([, venueData]) => venueData.liveCandle != null) : null;
|
|
748
|
+
const primaryLineValue = (_b = (_a = venueEntries[0]) == null ? void 0 : _a[1]) == null ? void 0 : _b.lineValue;
|
|
749
|
+
const lineValue = primaryLineValue != null ? toChartDisplayValue(primaryLineValue, transformProbability) : void 0;
|
|
750
|
+
return {
|
|
751
|
+
liveCandle: (liveCandleEntry == null ? void 0 : liveCandleEntry[1].liveCandle) ? marketChartCandleToScaledCandlePoint(liveCandleEntry[1].liveCandle, transformProbability) : null,
|
|
752
|
+
lineValue,
|
|
753
|
+
live: liveCandleEntry != null
|
|
754
|
+
};
|
|
755
|
+
};
|
|
682
756
|
|
|
683
757
|
// src/events/item-details/index.tsx
|
|
684
758
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -743,31 +817,23 @@ var resolveAverageProbability = (values) => {
|
|
|
743
817
|
return void 0;
|
|
744
818
|
return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
|
|
745
819
|
};
|
|
746
|
-
var resolveOutcomeCandidateIds = (market, outcome) => {
|
|
747
|
-
var _a, _b;
|
|
748
|
-
const marketWithCanonicalId = market;
|
|
749
|
-
return [
|
|
750
|
-
outcome.id,
|
|
751
|
-
(_a = outcome.externalIdentifier) != null ? _a : void 0,
|
|
752
|
-
market.externalIdentifier,
|
|
753
|
-
(_b = marketWithCanonicalId.marketId) != null ? _b : void 0
|
|
754
|
-
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
755
|
-
};
|
|
756
820
|
var EventListItemDetailsGraphSection = ({
|
|
757
821
|
venueMarkets,
|
|
758
|
-
canonicalMarketId,
|
|
759
822
|
selectedOutcomeLabel,
|
|
760
823
|
onSelectedOutcomeLabelChange,
|
|
761
824
|
switchLabels,
|
|
762
825
|
isDateOutcomeMarket,
|
|
763
826
|
classNames,
|
|
764
|
-
showVenueLogo,
|
|
765
827
|
venueInfo,
|
|
766
828
|
formatPercent,
|
|
767
829
|
selectedTimeRange,
|
|
768
|
-
selectedChartType
|
|
830
|
+
selectedChartType,
|
|
831
|
+
selectedOutcome: _selectedOutcome,
|
|
832
|
+
selectedMarket
|
|
769
833
|
}) => {
|
|
834
|
+
var _a, _b;
|
|
770
835
|
const labels = useLabels3();
|
|
836
|
+
const { enableLiveUpdates } = useSdkUiConfig2();
|
|
771
837
|
const [selectedVenue, setSelectedVenue] = useState(null);
|
|
772
838
|
const [activeProbabilityMode, setActiveProbabilityMode] = useState("yes");
|
|
773
839
|
const probabilityModeConfigs = useMemo3(() => {
|
|
@@ -836,105 +902,71 @@ var EventListItemDetailsGraphSection = ({
|
|
|
836
902
|
no: buildModeData("no")
|
|
837
903
|
};
|
|
838
904
|
}, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
|
|
839
|
-
const allOutcomesForHistory = useMemo3(() => {
|
|
840
|
-
const outcomeByModeAndId = /* @__PURE__ */ new Map();
|
|
841
|
-
probabilityModeOrder.forEach((mode) => {
|
|
842
|
-
selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
|
|
843
|
-
outcomeByModeAndId.set(
|
|
844
|
-
`${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
|
|
845
|
-
outcomeByVenue
|
|
846
|
-
);
|
|
847
|
-
});
|
|
848
|
-
});
|
|
849
|
-
return [...outcomeByModeAndId.values()];
|
|
850
|
-
}, [selectedOutcomesByMode]);
|
|
851
|
-
const priceHistoryGroups = useMemo3(() => {
|
|
852
|
-
return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
|
|
853
|
-
}, [allOutcomesForHistory, canonicalMarketId]);
|
|
854
905
|
const timeWindow = useMemo3(() => {
|
|
855
906
|
return getTimeWindowByRange(selectedTimeRange);
|
|
856
907
|
}, [selectedTimeRange]);
|
|
908
|
+
const activeOutcomes = selectedOutcomesByMode[activeProbabilityMode];
|
|
909
|
+
const activeCanonicalMarketId = useMemo3(() => {
|
|
910
|
+
return resolveCanonicalMarketId(activeOutcomes.map((item) => item.market));
|
|
911
|
+
}, [activeOutcomes]);
|
|
912
|
+
const venueMarketIds = useMemo3(() => {
|
|
913
|
+
return activeOutcomes.map((item) => item.market.id);
|
|
914
|
+
}, [activeOutcomes]);
|
|
857
915
|
const {
|
|
858
|
-
data:
|
|
859
|
-
isLoading:
|
|
860
|
-
error:
|
|
861
|
-
|
|
862
|
-
} =
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
872
|
-
priceHistoryData.forEach((historyItem) => {
|
|
873
|
-
const venue = historyItem.venue;
|
|
874
|
-
const venueHistory = historyByVenue.get(venue);
|
|
875
|
-
if (venueHistory) {
|
|
876
|
-
venueHistory.push(historyItem);
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
historyByVenue.set(venue, [historyItem]);
|
|
880
|
-
});
|
|
881
|
-
return historyByVenue;
|
|
882
|
-
}, [priceHistoryData]);
|
|
883
|
-
const chartSeriesByMode = useMemo3(() => {
|
|
884
|
-
const buildSeries = (mode) => {
|
|
885
|
-
const modeConfig = probabilityModeConfigs[mode];
|
|
886
|
-
const chartSeries = [];
|
|
887
|
-
normalizedVenueDataByMode[mode].forEach((venueData) => {
|
|
888
|
-
var _a;
|
|
889
|
-
const venueHistory = priceHistoryByVenue.get(venueData.venue);
|
|
890
|
-
if (!(venueHistory == null ? void 0 : venueHistory.length))
|
|
891
|
-
return;
|
|
892
|
-
const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
|
|
893
|
-
const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
|
|
894
|
-
if (!matchingHistory)
|
|
895
|
-
return;
|
|
896
|
-
const points = matchingHistory.points.map((point) => {
|
|
897
|
-
const probability = normalizeProbability(point.price);
|
|
898
|
-
if (probability == null || !Number.isFinite(point.timestamp))
|
|
899
|
-
return null;
|
|
900
|
-
const open = normalizeProbability(point.open);
|
|
901
|
-
const high = normalizeProbability(point.high);
|
|
902
|
-
const low = normalizeProbability(point.low);
|
|
903
|
-
const close = normalizeProbability(point.close);
|
|
904
|
-
const transformedPoint = {
|
|
905
|
-
time: point.timestamp,
|
|
906
|
-
value: clampProbability(modeConfig.transformProbability(probability)) * 100,
|
|
907
|
-
open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
|
|
908
|
-
high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
|
|
909
|
-
low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
|
|
910
|
-
close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
|
|
911
|
-
};
|
|
912
|
-
return transformedPoint;
|
|
913
|
-
}).filter((point) => point != null);
|
|
914
|
-
if (points.length === 0)
|
|
915
|
-
return;
|
|
916
|
-
chartSeries.push({
|
|
917
|
-
id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
|
|
918
|
-
venue: venueData.venue,
|
|
919
|
-
color: venueData.color,
|
|
920
|
-
points,
|
|
921
|
-
lineWidth: 2,
|
|
922
|
-
lineStyle: "solid"
|
|
923
|
-
});
|
|
924
|
-
});
|
|
925
|
-
return chartSeries;
|
|
926
|
-
};
|
|
927
|
-
return {
|
|
928
|
-
yes: buildSeries("yes"),
|
|
929
|
-
no: buildSeries("no")
|
|
930
|
-
};
|
|
931
|
-
}, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
|
|
916
|
+
data: marketChartData,
|
|
917
|
+
isLoading: isMarketChartLoading,
|
|
918
|
+
error: marketChartError,
|
|
919
|
+
refetch: refetchMarketChart
|
|
920
|
+
} = useMarketChart({
|
|
921
|
+
marketId: (_a = selectedMarket == null ? void 0 : selectedMarket.id) != null ? _a : null,
|
|
922
|
+
venueMarketIds,
|
|
923
|
+
interval: timeRangeToInterval(selectedTimeRange),
|
|
924
|
+
startTs: timeWindow.startTs * 1e3,
|
|
925
|
+
endTs: timeWindow.endTs * 1e3,
|
|
926
|
+
enabled: !!(selectedMarket == null ? void 0 : selectedMarket.id),
|
|
927
|
+
live: enableLiveUpdates
|
|
928
|
+
});
|
|
932
929
|
const visibleChartSeries = useMemo3(() => {
|
|
933
|
-
const
|
|
930
|
+
const transformProbability = probabilityModeConfigs[activeProbabilityMode].transformProbability;
|
|
931
|
+
const colorByVenue = new Map(
|
|
932
|
+
normalizedVenueDataByMode[activeProbabilityMode].map((venueData) => [
|
|
933
|
+
venueData.venue,
|
|
934
|
+
venueData.color
|
|
935
|
+
])
|
|
936
|
+
);
|
|
937
|
+
const series = resolveMarketChartVenueSeries({
|
|
938
|
+
chartData: marketChartData,
|
|
939
|
+
transformProbability
|
|
940
|
+
}).map((seriesItem) => {
|
|
941
|
+
var _a2;
|
|
942
|
+
const resolvedVenue = seriesItem.venue;
|
|
943
|
+
return {
|
|
944
|
+
id: `${activeProbabilityMode}-${resolvedVenue}-${activeCanonicalMarketId != null ? activeCanonicalMarketId : "chart"}`,
|
|
945
|
+
venue: resolvedVenue,
|
|
946
|
+
color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
|
|
947
|
+
points: seriesItem.points,
|
|
948
|
+
lineWidth: 2,
|
|
949
|
+
lineStyle: "solid"
|
|
950
|
+
};
|
|
951
|
+
});
|
|
934
952
|
if (!selectedVenue)
|
|
935
|
-
return
|
|
936
|
-
return
|
|
937
|
-
}, [
|
|
953
|
+
return series;
|
|
954
|
+
return series.filter((seriesItem) => seriesItem.venue === selectedVenue);
|
|
955
|
+
}, [
|
|
956
|
+
activeCanonicalMarketId,
|
|
957
|
+
activeProbabilityMode,
|
|
958
|
+
marketChartData,
|
|
959
|
+
normalizedVenueDataByMode,
|
|
960
|
+
probabilityModeConfigs,
|
|
961
|
+
selectedVenue
|
|
962
|
+
]);
|
|
963
|
+
const chartLiveState = useMemo3(() => {
|
|
964
|
+
return resolveMarketChartLiveState({
|
|
965
|
+
chartData: marketChartData,
|
|
966
|
+
selectedVenue,
|
|
967
|
+
transformProbability: probabilityModeConfigs[activeProbabilityMode].transformProbability
|
|
968
|
+
});
|
|
969
|
+
}, [activeProbabilityMode, marketChartData, probabilityModeConfigs, selectedVenue]);
|
|
938
970
|
const segmentedDisplayItems = useMemo3(() => {
|
|
939
971
|
return probabilityModeOrder.map((mode) => {
|
|
940
972
|
const averageProbability = resolveAverageProbability(
|
|
@@ -972,31 +1004,22 @@ var EventListItemDetailsGraphSection = ({
|
|
|
972
1004
|
return venue;
|
|
973
1005
|
});
|
|
974
1006
|
};
|
|
975
|
-
const
|
|
976
|
-
void
|
|
1007
|
+
const handleRetryMarketChart = () => {
|
|
1008
|
+
void refetchMarketChart();
|
|
977
1009
|
};
|
|
978
|
-
if (
|
|
979
|
-
return /* @__PURE__ */ jsx3(
|
|
980
|
-
|
|
1010
|
+
if (marketChartError) {
|
|
1011
|
+
return /* @__PURE__ */ jsx3("div", { className: cn("w-full", classNames == null ? void 0 : classNames.chart), children: /* @__PURE__ */ jsx3(
|
|
1012
|
+
StateMessage,
|
|
981
1013
|
{
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
990
|
-
tone: "warning",
|
|
991
|
-
title: labels.eventItemDetails.chartUnavailableTitle,
|
|
992
|
-
description: labels.eventItemDetails.chartUnavailableDescription,
|
|
993
|
-
actionLabel: labels.common.retry,
|
|
994
|
-
onAction: handleRetryPriceHistory,
|
|
995
|
-
className: "min-h-[300px] px-5 py-10 md:px-10"
|
|
996
|
-
}
|
|
997
|
-
)
|
|
1014
|
+
tone: "warning",
|
|
1015
|
+
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
1016
|
+
title: labels.eventItemDetails.chartUnavailableTitle,
|
|
1017
|
+
description: labels.eventItemDetails.chartUnavailableDescription,
|
|
1018
|
+
actionLabel: labels.common.retry,
|
|
1019
|
+
onAction: handleRetryMarketChart,
|
|
1020
|
+
className: "min-h-[300px] px-5 py-10 md:px-10"
|
|
998
1021
|
}
|
|
999
|
-
);
|
|
1022
|
+
) });
|
|
1000
1023
|
}
|
|
1001
1024
|
return /* @__PURE__ */ jsx3(
|
|
1002
1025
|
LineChart,
|
|
@@ -1004,8 +1027,10 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1004
1027
|
classNames: { root: classNames == null ? void 0 : classNames.chart },
|
|
1005
1028
|
series: visibleChartSeries,
|
|
1006
1029
|
height: 300,
|
|
1007
|
-
isLoading:
|
|
1030
|
+
isLoading: isMarketChartLoading,
|
|
1008
1031
|
chartType: selectedChartType,
|
|
1032
|
+
liveCandle: selectedChartType === "candlestick" ? (_b = chartLiveState.liveCandle) != null ? _b : void 0 : void 0,
|
|
1033
|
+
lineValue: chartLiveState.lineValue,
|
|
1009
1034
|
showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
|
|
1010
1035
|
renderSeriesControls: () => {
|
|
1011
1036
|
return /* @__PURE__ */ jsxs2(
|
|
@@ -1021,7 +1046,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1021
1046
|
classNames == null ? void 0 : classNames.outcomeBadges
|
|
1022
1047
|
),
|
|
1023
1048
|
children: activeModeVenueData.map((venueData) => {
|
|
1024
|
-
var
|
|
1049
|
+
var _a2;
|
|
1025
1050
|
const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
|
|
1026
1051
|
const isActiveVenue = selectedVenue === venueData.venue;
|
|
1027
1052
|
return /* @__PURE__ */ jsx3(
|
|
@@ -1038,14 +1063,14 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1038
1063
|
{
|
|
1039
1064
|
text,
|
|
1040
1065
|
size: "large",
|
|
1041
|
-
prefix:
|
|
1066
|
+
prefix: /* @__PURE__ */ jsx3(
|
|
1042
1067
|
VenueLogo,
|
|
1043
1068
|
{
|
|
1044
1069
|
venue: venueData.venue,
|
|
1045
1070
|
size: "small",
|
|
1046
|
-
title: (
|
|
1071
|
+
title: (_a2 = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a2.label
|
|
1047
1072
|
}
|
|
1048
|
-
)
|
|
1073
|
+
),
|
|
1049
1074
|
classNames: {
|
|
1050
1075
|
root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
|
|
1051
1076
|
},
|
|
@@ -1086,46 +1111,55 @@ var EventListItemDetailsGraphSection = ({
|
|
|
1086
1111
|
};
|
|
1087
1112
|
var EventListItemDetailsContent = ({
|
|
1088
1113
|
event,
|
|
1089
|
-
title,
|
|
1090
|
-
image,
|
|
1091
|
-
showVenueLogo = true,
|
|
1092
1114
|
classNames,
|
|
1093
1115
|
venueInfo,
|
|
1094
1116
|
detailsStats,
|
|
1095
1117
|
ariaLabel,
|
|
1096
|
-
defaultTimeRange
|
|
1118
|
+
defaultTimeRange,
|
|
1119
|
+
onClick
|
|
1097
1120
|
}) => {
|
|
1098
|
-
var _a
|
|
1121
|
+
var _a;
|
|
1099
1122
|
const config = useSdkUiConfig2();
|
|
1100
1123
|
const labels = useLabels3();
|
|
1101
1124
|
const venueMarkets = useMemo3(() => {
|
|
1102
|
-
var _a2
|
|
1103
|
-
return (
|
|
1104
|
-
}, [event.
|
|
1125
|
+
var _a2;
|
|
1126
|
+
return (_a2 = event.venueMarkets) != null ? _a2 : [];
|
|
1127
|
+
}, [event.venueMarkets]);
|
|
1128
|
+
const [selectedMarket, setSelectedMarket] = useState(venueMarkets[0]);
|
|
1129
|
+
const [selectedOutcome] = useState(
|
|
1130
|
+
(_a = selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes.find(
|
|
1131
|
+
(outcome) => outcome.winner
|
|
1132
|
+
)) != null ? _a : selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes[0]
|
|
1133
|
+
);
|
|
1105
1134
|
const primaryVenueMarket = useMemo3(() => {
|
|
1106
1135
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
1107
1136
|
}, [venueMarkets]);
|
|
1137
|
+
const filteredVenueMarkets = useMemo3(() => {
|
|
1138
|
+
if (!selectedMarket)
|
|
1139
|
+
return venueMarkets;
|
|
1140
|
+
return venueMarkets.filter(
|
|
1141
|
+
(vm) => vm.question === (selectedMarket == null ? void 0 : selectedMarket.question)
|
|
1142
|
+
);
|
|
1143
|
+
}, [venueMarkets, selectedMarket]);
|
|
1108
1144
|
const outcomeLabels = useMemo3(() => {
|
|
1109
|
-
return resolveOutcomeLabels(
|
|
1110
|
-
}, [
|
|
1145
|
+
return resolveOutcomeLabels(filteredVenueMarkets);
|
|
1146
|
+
}, [filteredVenueMarkets]);
|
|
1111
1147
|
const [selectedOutcomeLabel, setSelectedOutcomeLabel] = useState(() => {
|
|
1112
1148
|
return resolveDefaultOutcomeLabel(outcomeLabels);
|
|
1113
1149
|
});
|
|
1150
|
+
const configTimeRange = config.defaultChartTimeRange;
|
|
1114
1151
|
const [selectedTimeRange, setSelectedTimeRange] = useState(() => {
|
|
1115
|
-
return getDefaultSelectedTimeRange(defaultTimeRange);
|
|
1152
|
+
return getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange);
|
|
1116
1153
|
});
|
|
1117
1154
|
const [selectedChartType, setSelectedChartType] = useState("line");
|
|
1118
1155
|
useEffect(() => {
|
|
1119
|
-
setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
|
|
1120
|
-
}, [defaultTimeRange]);
|
|
1121
|
-
const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
|
|
1122
|
-
const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
|
|
1156
|
+
setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange));
|
|
1157
|
+
}, [defaultTimeRange, configTimeRange]);
|
|
1123
1158
|
const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
|
|
1124
|
-
const outcomeSelectorLabels = outcomeLabels;
|
|
1125
1159
|
const probabilityByLabel = useMemo3(() => {
|
|
1126
1160
|
return new Map(
|
|
1127
1161
|
outcomeLabels.map((label) => {
|
|
1128
|
-
const outcomesByVenue = resolveOutcomesByVenue(
|
|
1162
|
+
const outcomesByVenue = resolveOutcomesByVenue(filteredVenueMarkets, label);
|
|
1129
1163
|
const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
|
|
1130
1164
|
if (probabilities.length === 0) {
|
|
1131
1165
|
return [label, void 0];
|
|
@@ -1134,14 +1168,14 @@ var EventListItemDetailsContent = ({
|
|
|
1134
1168
|
return [label, averageProbability];
|
|
1135
1169
|
})
|
|
1136
1170
|
);
|
|
1137
|
-
}, [outcomeLabels,
|
|
1171
|
+
}, [outcomeLabels, filteredVenueMarkets]);
|
|
1138
1172
|
const mainOutcomeLabel = useMemo3(() => {
|
|
1139
1173
|
if (outcomeLabels.length === 0)
|
|
1140
1174
|
return void 0;
|
|
1141
1175
|
return [...outcomeLabels].sort((left, right) => {
|
|
1142
|
-
var _a2,
|
|
1176
|
+
var _a2, _b;
|
|
1143
1177
|
const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
|
|
1144
|
-
const rightProbability = (
|
|
1178
|
+
const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
|
|
1145
1179
|
return rightProbability - leftProbability;
|
|
1146
1180
|
})[0];
|
|
1147
1181
|
}, [outcomeLabels, probabilityByLabel]);
|
|
@@ -1157,18 +1191,18 @@ var EventListItemDetailsContent = ({
|
|
|
1157
1191
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
1158
1192
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
1159
1193
|
const switchLabels = useMemo3(() => {
|
|
1160
|
-
var _a2,
|
|
1194
|
+
var _a2, _b;
|
|
1161
1195
|
if (isDateOutcomeMarket) {
|
|
1162
1196
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
1163
1197
|
}
|
|
1164
1198
|
const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
|
|
1165
|
-
var _a3,
|
|
1199
|
+
var _a3, _b2;
|
|
1166
1200
|
const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
|
|
1167
|
-
const rightProbability = (
|
|
1201
|
+
const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
|
|
1168
1202
|
return rightProbability - leftProbability;
|
|
1169
1203
|
});
|
|
1170
1204
|
const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
|
|
1171
|
-
const secondLabel = (
|
|
1205
|
+
const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
|
|
1172
1206
|
return [firstLabel, secondLabel];
|
|
1173
1207
|
}, [
|
|
1174
1208
|
isDateOutcomeMarket,
|
|
@@ -1185,27 +1219,37 @@ var EventListItemDetailsContent = ({
|
|
|
1185
1219
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
1186
1220
|
}, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
|
|
1187
1221
|
if (!primaryVenueMarket || !selectedOutcomeLabel) {
|
|
1188
|
-
return /* @__PURE__ */ jsx3(
|
|
1222
|
+
return /* @__PURE__ */ jsx3(
|
|
1223
|
+
EventListItemDetailsUnavailableState,
|
|
1224
|
+
{
|
|
1225
|
+
classNames,
|
|
1226
|
+
ariaLabel: ariaLabel != null ? ariaLabel : event.title
|
|
1227
|
+
}
|
|
1228
|
+
);
|
|
1189
1229
|
}
|
|
1190
1230
|
return /* @__PURE__ */ jsxs2(
|
|
1191
1231
|
Card,
|
|
1192
1232
|
{
|
|
1193
1233
|
className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
1194
|
-
"aria-label": ariaLabel != null ? ariaLabel :
|
|
1234
|
+
"aria-label": ariaLabel != null ? ariaLabel : event.title,
|
|
1235
|
+
onClick: () => {
|
|
1236
|
+
onClick == null ? void 0 : onClick(event);
|
|
1237
|
+
},
|
|
1195
1238
|
children: [
|
|
1196
1239
|
/* @__PURE__ */ jsxs2(
|
|
1197
1240
|
"div",
|
|
1198
1241
|
{
|
|
1199
1242
|
className: cn(
|
|
1200
1243
|
"flex flex-row gap-3 md:gap-4",
|
|
1201
|
-
"items-
|
|
1244
|
+
venueMarkets.length > 1 ? "items-start" : "items-center",
|
|
1245
|
+
"justify-start",
|
|
1202
1246
|
classNames == null ? void 0 : classNames.header
|
|
1203
1247
|
),
|
|
1204
1248
|
children: [
|
|
1205
|
-
|
|
1249
|
+
event.image ? /* @__PURE__ */ jsx3(
|
|
1206
1250
|
RemoteImage,
|
|
1207
1251
|
{
|
|
1208
|
-
src:
|
|
1252
|
+
src: event.image,
|
|
1209
1253
|
alt: "",
|
|
1210
1254
|
className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
|
|
1211
1255
|
}
|
|
@@ -1220,19 +1264,18 @@ var EventListItemDetailsContent = ({
|
|
|
1220
1264
|
"truncate text-wrap wrap-break-word line-clamp-2",
|
|
1221
1265
|
classNames == null ? void 0 : classNames.title
|
|
1222
1266
|
),
|
|
1223
|
-
children:
|
|
1267
|
+
children: event.title
|
|
1224
1268
|
}
|
|
1225
1269
|
),
|
|
1226
|
-
|
|
1270
|
+
venueMarkets.length > 1 ? /* @__PURE__ */ jsx3(
|
|
1227
1271
|
"div",
|
|
1228
1272
|
{
|
|
1229
1273
|
className: cn(
|
|
1230
|
-
"flex items-center gap-2 overflow-x-auto pb-1 md:
|
|
1274
|
+
"flex flex-row flex-nowrap items-center gap-2 overflow-x-auto pb-1 md:pb-0",
|
|
1231
1275
|
classNames == null ? void 0 : classNames.headerPills
|
|
1232
1276
|
),
|
|
1233
|
-
children:
|
|
1234
|
-
const isActive =
|
|
1235
|
-
const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
|
|
1277
|
+
children: venueMarkets.map((venueMarket) => {
|
|
1278
|
+
const isActive = (selectedMarket == null ? void 0 : selectedMarket.id) === venueMarket.id;
|
|
1236
1279
|
return /* @__PURE__ */ jsx3(
|
|
1237
1280
|
Button,
|
|
1238
1281
|
{
|
|
@@ -1244,10 +1287,14 @@ var EventListItemDetailsContent = ({
|
|
|
1244
1287
|
"border-2",
|
|
1245
1288
|
isActive ? "border-agg-primary bg-agg-secondary text-agg-foreground font-agg-bold" : "border-transparent bg-agg-secondary-hover text-agg-foreground font-agg-normal"
|
|
1246
1289
|
),
|
|
1247
|
-
onClick: () =>
|
|
1248
|
-
|
|
1290
|
+
onClick: (e) => {
|
|
1291
|
+
e.stopPropagation();
|
|
1292
|
+
e.preventDefault();
|
|
1293
|
+
setSelectedMarket(venueMarket);
|
|
1294
|
+
},
|
|
1295
|
+
children: venueMarket.question
|
|
1249
1296
|
},
|
|
1250
|
-
|
|
1297
|
+
venueMarket.id
|
|
1251
1298
|
);
|
|
1252
1299
|
})
|
|
1253
1300
|
}
|
|
@@ -1276,14 +1323,14 @@ var EventListItemDetailsContent = ({
|
|
|
1276
1323
|
/* @__PURE__ */ jsx3(
|
|
1277
1324
|
EventListItemDetailsGraphSection,
|
|
1278
1325
|
{
|
|
1279
|
-
|
|
1280
|
-
|
|
1326
|
+
selectedOutcome,
|
|
1327
|
+
selectedMarket,
|
|
1328
|
+
venueMarkets: filteredVenueMarkets,
|
|
1281
1329
|
selectedOutcomeLabel,
|
|
1282
1330
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
1283
1331
|
switchLabels,
|
|
1284
1332
|
isDateOutcomeMarket,
|
|
1285
1333
|
classNames,
|
|
1286
|
-
showVenueLogo,
|
|
1287
1334
|
venueInfo,
|
|
1288
1335
|
formatPercent: config.formatPercent,
|
|
1289
1336
|
selectedTimeRange,
|
|
@@ -1309,7 +1356,11 @@ var EventListItemDetailsContent = ({
|
|
|
1309
1356
|
isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
|
|
1310
1357
|
),
|
|
1311
1358
|
"aria-pressed": isActive,
|
|
1312
|
-
onClick: () =>
|
|
1359
|
+
onClick: (e) => {
|
|
1360
|
+
e.stopPropagation();
|
|
1361
|
+
e.preventDefault();
|
|
1362
|
+
setSelectedTimeRange(timeRange);
|
|
1363
|
+
},
|
|
1313
1364
|
children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
|
|
1314
1365
|
},
|
|
1315
1366
|
timeRange
|
|
@@ -1327,18 +1378,20 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
1327
1378
|
} = _b, rest = __objRest(_b, [
|
|
1328
1379
|
"eventId"
|
|
1329
1380
|
]);
|
|
1381
|
+
const resolvedEventId = eventId != null ? eventId : "";
|
|
1330
1382
|
const {
|
|
1331
1383
|
event: fetchedEvent,
|
|
1332
1384
|
error,
|
|
1333
1385
|
isError,
|
|
1334
1386
|
isLoading
|
|
1335
|
-
} =
|
|
1336
|
-
|
|
1387
|
+
} = useVenueEvent2({
|
|
1388
|
+
eventId: resolvedEventId,
|
|
1389
|
+
enabled: !!resolvedEventId
|
|
1337
1390
|
});
|
|
1338
1391
|
const resolvedEvent = useMemo3(() => {
|
|
1339
1392
|
return resolveEventListItemEvent(fetchedEvent);
|
|
1340
1393
|
}, [fetchedEvent]);
|
|
1341
|
-
if (!
|
|
1394
|
+
if (!resolvedEventId) {
|
|
1342
1395
|
return /* @__PURE__ */ jsx3(
|
|
1343
1396
|
EventListItemDetailsUnavailableState,
|
|
1344
1397
|
{
|
|
@@ -1377,26 +1430,22 @@ var EventListItemDetails = (props) => {
|
|
|
1377
1430
|
}
|
|
1378
1431
|
if ("eventId" in props && typeof props.eventId === "string") {
|
|
1379
1432
|
const {
|
|
1380
|
-
title: titleOverride,
|
|
1381
|
-
image: imageOverride,
|
|
1382
|
-
showVenueLogo: showVenueLogoOverride,
|
|
1383
1433
|
classNames,
|
|
1384
1434
|
venueInfo,
|
|
1385
1435
|
detailsStats,
|
|
1386
1436
|
ariaLabel: ariaLabelOverride,
|
|
1387
|
-
defaultTimeRange: defaultTimeRangeOverride
|
|
1437
|
+
defaultTimeRange: defaultTimeRangeOverride,
|
|
1438
|
+
onClick
|
|
1388
1439
|
} = props;
|
|
1389
1440
|
const byEventIdProps = {
|
|
1390
1441
|
eventId: props.eventId,
|
|
1391
1442
|
isLoading: false,
|
|
1392
|
-
title: titleOverride,
|
|
1393
|
-
image: imageOverride,
|
|
1394
|
-
showVenueLogo: showVenueLogoOverride,
|
|
1395
1443
|
classNames,
|
|
1396
1444
|
venueInfo,
|
|
1397
1445
|
detailsStats,
|
|
1398
1446
|
ariaLabel: ariaLabelOverride,
|
|
1399
|
-
defaultTimeRange: defaultTimeRangeOverride
|
|
1447
|
+
defaultTimeRange: defaultTimeRangeOverride,
|
|
1448
|
+
onClick
|
|
1400
1449
|
};
|
|
1401
1450
|
return /* @__PURE__ */ jsx3(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
|
|
1402
1451
|
}
|
|
@@ -1413,11 +1462,12 @@ EventListItemDetails.displayName = "EventListItemDetails";
|
|
|
1413
1462
|
// src/events/market-details/index.tsx
|
|
1414
1463
|
import { useEffect as useEffect2, useId, useMemo as useMemo4, useState as useState2 } from "react";
|
|
1415
1464
|
import {
|
|
1416
|
-
useEvent as useEvent3,
|
|
1417
1465
|
useLabels as useLabels4,
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1466
|
+
useMarketChart as useMarketChart2,
|
|
1467
|
+
useMarketOrderbook,
|
|
1468
|
+
useVenueMarkets,
|
|
1469
|
+
useSdkUiConfig as useSdkUiConfig3,
|
|
1470
|
+
timeRangeToInterval as timeRangeToInterval2
|
|
1421
1471
|
} from "@agg-market/hooks";
|
|
1422
1472
|
|
|
1423
1473
|
// src/events/market-details/market-details.utils.ts
|
|
@@ -1449,12 +1499,47 @@ var resolveInitialTab = (defaultTab) => {
|
|
|
1449
1499
|
return parsedTab.data;
|
|
1450
1500
|
return "order-book";
|
|
1451
1501
|
};
|
|
1452
|
-
var
|
|
1453
|
-
|
|
1502
|
+
var resolveMarketFromVenueMarkets = (venueMarkets, marketId) => {
|
|
1503
|
+
var _a, _b;
|
|
1504
|
+
if (!venueMarkets || venueMarkets.length === 0)
|
|
1505
|
+
return void 0;
|
|
1506
|
+
if (!marketId) {
|
|
1507
|
+
const primary = selectPrimaryVenueMarket(venueMarkets);
|
|
1508
|
+
const totalVolume2 = venueMarkets.reduce((sum, vm) => {
|
|
1509
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
1510
|
+
}, 0);
|
|
1511
|
+
return {
|
|
1512
|
+
id: (_a = primary == null ? void 0 : primary.id) != null ? _a : venueMarkets[0].id,
|
|
1513
|
+
venueMarkets,
|
|
1514
|
+
volume: totalVolume2 || (primary == null ? void 0 : primary.volume),
|
|
1515
|
+
status: primary == null ? void 0 : primary.status,
|
|
1516
|
+
startDate: primary == null ? void 0 : primary.startDate,
|
|
1517
|
+
endDate: primary == null ? void 0 : primary.endDate,
|
|
1518
|
+
creationDate: primary == null ? void 0 : primary.creationDate,
|
|
1519
|
+
question: (_b = primary == null ? void 0 : primary.question) != null ? _b : venueMarkets[0].question
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
const matchedVenueMarket = venueMarkets.find(
|
|
1523
|
+
(vm) => vm.id === marketId || vm.externalIdentifier === marketId
|
|
1524
|
+
);
|
|
1525
|
+
if (!matchedVenueMarket)
|
|
1454
1526
|
return void 0;
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1527
|
+
const siblingVenueMarkets = venueMarkets.filter(
|
|
1528
|
+
(vm) => vm.question === matchedVenueMarket.question
|
|
1529
|
+
);
|
|
1530
|
+
const totalVolume = siblingVenueMarkets.reduce((sum, vm) => {
|
|
1531
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
1532
|
+
}, 0);
|
|
1533
|
+
return {
|
|
1534
|
+
id: matchedVenueMarket.id,
|
|
1535
|
+
venueMarkets: siblingVenueMarkets,
|
|
1536
|
+
volume: totalVolume || matchedVenueMarket.volume,
|
|
1537
|
+
status: matchedVenueMarket.status,
|
|
1538
|
+
startDate: matchedVenueMarket.startDate,
|
|
1539
|
+
endDate: matchedVenueMarket.endDate,
|
|
1540
|
+
creationDate: matchedVenueMarket.creationDate,
|
|
1541
|
+
question: matchedVenueMarket.question
|
|
1542
|
+
};
|
|
1458
1543
|
};
|
|
1459
1544
|
var resolveDisplayOutcomeLabels = (labels) => {
|
|
1460
1545
|
if (!hasBinaryLabels(labels))
|
|
@@ -1522,7 +1607,8 @@ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
|
|
|
1522
1607
|
label,
|
|
1523
1608
|
probability: probabilityByLabel.get(label),
|
|
1524
1609
|
tone: resolveOutcomeTone(label, index),
|
|
1525
|
-
isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
|
|
1610
|
+
isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : ""),
|
|
1611
|
+
venue: venueMarkets[0].venue
|
|
1526
1612
|
};
|
|
1527
1613
|
});
|
|
1528
1614
|
};
|
|
@@ -1613,23 +1699,23 @@ var resolveOtherTabRows = (market, labels) => {
|
|
|
1613
1699
|
return rows;
|
|
1614
1700
|
};
|
|
1615
1701
|
var buildMarketDetailsModel = ({
|
|
1616
|
-
|
|
1702
|
+
venueMarkets,
|
|
1617
1703
|
marketId,
|
|
1618
1704
|
title,
|
|
1619
1705
|
image,
|
|
1620
1706
|
formatCompactCurrency,
|
|
1621
1707
|
labels
|
|
1622
1708
|
}) => {
|
|
1623
|
-
var _a;
|
|
1624
|
-
const market =
|
|
1709
|
+
var _a, _b;
|
|
1710
|
+
const market = resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
1625
1711
|
if (!market)
|
|
1626
1712
|
return void 0;
|
|
1627
1713
|
const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
|
|
1628
1714
|
if (!primaryVenueMarket)
|
|
1629
1715
|
return void 0;
|
|
1630
|
-
const resolvedTitle =
|
|
1631
|
-
const resolvedImage =
|
|
1632
|
-
const resolvedVolume = typeof market.volume === "number" ? market.volume : (
|
|
1716
|
+
const resolvedTitle = (title == null ? void 0 : title.trim()) || primaryVenueMarket.question || market.question;
|
|
1717
|
+
const resolvedImage = (_a = typeof image === "string" && image.trim() ? image : void 0) != null ? _a : typeof primaryVenueMarket.image === "string" && primaryVenueMarket.image.trim() ? primaryVenueMarket.image : void 0;
|
|
1718
|
+
const resolvedVolume = typeof market.volume === "number" ? market.volume : (_b = primaryVenueMarket.volume) != null ? _b : void 0;
|
|
1633
1719
|
const subtitle = resolveSubtitle({
|
|
1634
1720
|
venueMarkets: market.venueMarkets,
|
|
1635
1721
|
volume: resolvedVolume,
|
|
@@ -1775,7 +1861,7 @@ var getOutcomeButtonClassName = ({
|
|
|
1775
1861
|
);
|
|
1776
1862
|
};
|
|
1777
1863
|
var MarketDetailsContent = ({
|
|
1778
|
-
|
|
1864
|
+
venueMarkets,
|
|
1779
1865
|
marketId,
|
|
1780
1866
|
title,
|
|
1781
1867
|
image,
|
|
@@ -1783,28 +1869,29 @@ var MarketDetailsContent = ({
|
|
|
1783
1869
|
onOpenChange,
|
|
1784
1870
|
defaultTab,
|
|
1785
1871
|
defaultOutcomeLabel,
|
|
1786
|
-
defaultTimeRange
|
|
1872
|
+
defaultTimeRange,
|
|
1787
1873
|
orderBookDepth = orderBookRowLimitDefault,
|
|
1788
1874
|
ariaLabel,
|
|
1789
1875
|
classNames,
|
|
1790
1876
|
otherContent
|
|
1791
1877
|
}) => {
|
|
1878
|
+
var _a, _b, _c, _d;
|
|
1792
1879
|
const config = useSdkUiConfig3();
|
|
1793
1880
|
const labels = useLabels4();
|
|
1794
1881
|
const detailsContentId = useId();
|
|
1795
1882
|
const model = useMemo4(() => {
|
|
1796
1883
|
return buildMarketDetailsModel({
|
|
1797
|
-
|
|
1884
|
+
venueMarkets,
|
|
1798
1885
|
marketId,
|
|
1799
1886
|
title,
|
|
1800
1887
|
image,
|
|
1801
1888
|
formatCompactCurrency: config.formatCompactCurrency,
|
|
1802
1889
|
labels
|
|
1803
1890
|
});
|
|
1804
|
-
}, [config.formatCompactCurrency,
|
|
1891
|
+
}, [config.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
|
|
1805
1892
|
const resolvedMarket = useMemo4(() => {
|
|
1806
|
-
return
|
|
1807
|
-
}, [
|
|
1893
|
+
return resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
1894
|
+
}, [venueMarkets, marketId]);
|
|
1808
1895
|
const marketDetailsTabs = useMemo4(() => {
|
|
1809
1896
|
return getMarketDetailsTabs(labels);
|
|
1810
1897
|
}, [labels]);
|
|
@@ -1815,22 +1902,23 @@ var MarketDetailsContent = ({
|
|
|
1815
1902
|
useEffect2(() => {
|
|
1816
1903
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
1817
1904
|
}, [defaultTab]);
|
|
1818
|
-
const
|
|
1905
|
+
const resolvedDefaultTimeRange = (_a = defaultTimeRange != null ? defaultTimeRange : config.defaultChartTimeRange) != null ? _a : "1D";
|
|
1906
|
+
const [selectedTimeRange, setSelectedTimeRange] = useState2(resolvedDefaultTimeRange);
|
|
1819
1907
|
const [selectedChartType, setSelectedChartType] = useState2("line");
|
|
1820
1908
|
useEffect2(() => {
|
|
1821
|
-
setSelectedTimeRange(
|
|
1822
|
-
}, [
|
|
1909
|
+
setSelectedTimeRange(resolvedDefaultTimeRange);
|
|
1910
|
+
}, [resolvedDefaultTimeRange]);
|
|
1823
1911
|
const [selectedOutcomeLabel, setSelectedOutcomeLabel] = useState2(
|
|
1824
1912
|
() => {
|
|
1825
|
-
var
|
|
1826
|
-
return resolveInitialOutcomeLabel((
|
|
1913
|
+
var _a2;
|
|
1914
|
+
return resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel);
|
|
1827
1915
|
}
|
|
1828
1916
|
);
|
|
1829
1917
|
const [selectedGraphVenue, setSelectedGraphVenue] = useState2(null);
|
|
1830
1918
|
useEffect2(() => {
|
|
1831
|
-
var
|
|
1919
|
+
var _a2;
|
|
1832
1920
|
setSelectedOutcomeLabel(
|
|
1833
|
-
resolveInitialOutcomeLabel((
|
|
1921
|
+
resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel)
|
|
1834
1922
|
);
|
|
1835
1923
|
}, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
|
|
1836
1924
|
const headerOutcomeItems = useMemo4(() => {
|
|
@@ -1857,51 +1945,66 @@ var MarketDetailsContent = ({
|
|
|
1857
1945
|
return outcomesByLabelMap;
|
|
1858
1946
|
}, [headerOutcomeItems, model]);
|
|
1859
1947
|
const selectedOutcomesByVenue = useMemo4(() => {
|
|
1860
|
-
var
|
|
1948
|
+
var _a2;
|
|
1861
1949
|
if (!selectedOutcomeLabel)
|
|
1862
1950
|
return [];
|
|
1863
|
-
return (
|
|
1951
|
+
return (_a2 = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a2 : [];
|
|
1864
1952
|
}, [outcomesByLabel, selectedOutcomeLabel]);
|
|
1953
|
+
const chartEnabled = isOpened && selectedTab === "graph";
|
|
1954
|
+
const orderBookEnabled = isOpened && selectedTab === "order-book";
|
|
1865
1955
|
const timeWindow = useMemo4(() => {
|
|
1866
1956
|
return getTimeWindowByRange(selectedTimeRange);
|
|
1867
1957
|
}, [selectedTimeRange]);
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
outcomes.forEach((outcomeByVenue) => {
|
|
1872
|
-
uniqueOutcomesByVenueAndId.set(
|
|
1873
|
-
`${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
|
|
1874
|
-
outcomeByVenue
|
|
1875
|
-
);
|
|
1876
|
-
});
|
|
1877
|
-
});
|
|
1878
|
-
return [...uniqueOutcomesByVenueAndId.values()];
|
|
1879
|
-
}, [outcomesByLabel]);
|
|
1880
|
-
const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
|
|
1881
|
-
const priceHistoryGroups = useMemo4(() => {
|
|
1882
|
-
return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
|
|
1883
|
-
}, [canonicalMarketIdForHistory, graphOutcomes]);
|
|
1884
|
-
const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = usePriceHistory2(__spreadProps(__spreadValues({
|
|
1885
|
-
groups: priceHistoryGroups
|
|
1886
|
-
}, timeWindow), {
|
|
1887
|
-
enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
|
|
1888
|
-
}));
|
|
1889
|
-
const orderBookInputs = useMemo4(() => {
|
|
1890
|
-
return selectedOutcomesByVenue.map(({ market, outcome }) => ({
|
|
1891
|
-
market,
|
|
1892
|
-
outcome,
|
|
1893
|
-
liveUpdate: true
|
|
1894
|
-
}));
|
|
1958
|
+
const primaryVenueMarketId = (_c = (_b = selectedOutcomesByVenue[0]) == null ? void 0 : _b.market.id) != null ? _c : null;
|
|
1959
|
+
const venueMarketIds = useMemo4(() => {
|
|
1960
|
+
return selectedOutcomesByVenue.map((item) => item.market.id);
|
|
1895
1961
|
}, [selectedOutcomesByVenue]);
|
|
1896
1962
|
const {
|
|
1897
|
-
data:
|
|
1963
|
+
data: marketChartData,
|
|
1964
|
+
isLoading: isMarketChartLoading,
|
|
1965
|
+
error: marketChartError,
|
|
1966
|
+
refetch: refetchMarketChart
|
|
1967
|
+
} = useMarketChart2({
|
|
1968
|
+
marketId: primaryVenueMarketId,
|
|
1969
|
+
venueMarketIds,
|
|
1970
|
+
interval: timeRangeToInterval2(selectedTimeRange),
|
|
1971
|
+
startTs: timeWindow.startTs * 1e3,
|
|
1972
|
+
endTs: timeWindow.endTs * 1e3,
|
|
1973
|
+
enabled: chartEnabled && !!primaryVenueMarketId
|
|
1974
|
+
});
|
|
1975
|
+
const {
|
|
1976
|
+
data: marketOrderbookData,
|
|
1898
1977
|
isLoading: isOrderBookLoading,
|
|
1899
1978
|
error: orderBookError,
|
|
1900
|
-
|
|
1901
|
-
} =
|
|
1902
|
-
|
|
1903
|
-
enabled:
|
|
1979
|
+
refetch: refetchOrderBook
|
|
1980
|
+
} = useMarketOrderbook({
|
|
1981
|
+
marketId: primaryVenueMarketId,
|
|
1982
|
+
enabled: orderBookEnabled && !!primaryVenueMarketId,
|
|
1983
|
+
venueOutcomes: selectedOutcomesByVenue.map((item) => ({
|
|
1984
|
+
venue: item.market.venue,
|
|
1985
|
+
venueMarketOutcomeId: item.outcome.id
|
|
1986
|
+
}))
|
|
1904
1987
|
});
|
|
1988
|
+
const orderBookData = useMemo4(() => {
|
|
1989
|
+
if (!marketOrderbookData)
|
|
1990
|
+
return void 0;
|
|
1991
|
+
const results = selectedOutcomesByVenue.flatMap(({ market, outcome }) => {
|
|
1992
|
+
const venueOrderbook = marketOrderbookData.venueOrderbooks[market.venue];
|
|
1993
|
+
if (!venueOrderbook)
|
|
1994
|
+
return [];
|
|
1995
|
+
return [
|
|
1996
|
+
{
|
|
1997
|
+
market,
|
|
1998
|
+
outcome,
|
|
1999
|
+
orderbook: {
|
|
2000
|
+
bids: venueOrderbook.bids,
|
|
2001
|
+
asks: venueOrderbook.asks
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
];
|
|
2005
|
+
});
|
|
2006
|
+
return results.length === selectedOutcomesByVenue.length ? results : void 0;
|
|
2007
|
+
}, [marketOrderbookData, selectedOutcomesByVenue]);
|
|
1905
2008
|
const askRows = useMemo4(() => {
|
|
1906
2009
|
return resolveOrderBookRows({
|
|
1907
2010
|
data: orderBookData,
|
|
@@ -1914,88 +2017,54 @@ var MarketDetailsContent = ({
|
|
|
1914
2017
|
side: "bids"
|
|
1915
2018
|
});
|
|
1916
2019
|
}, [orderBookData]);
|
|
1917
|
-
const priceHistoryByVenue = useMemo4(() => {
|
|
1918
|
-
const historyByVenue = /* @__PURE__ */ new Map();
|
|
1919
|
-
if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
|
|
1920
|
-
return historyByVenue;
|
|
1921
|
-
}
|
|
1922
|
-
priceHistoryData.forEach((historyItem) => {
|
|
1923
|
-
const venue = historyItem.venue;
|
|
1924
|
-
const venueHistory = historyByVenue.get(venue);
|
|
1925
|
-
if (venueHistory) {
|
|
1926
|
-
venueHistory.push(historyItem);
|
|
1927
|
-
return;
|
|
1928
|
-
}
|
|
1929
|
-
historyByVenue.set(venue, [historyItem]);
|
|
1930
|
-
});
|
|
1931
|
-
return historyByVenue;
|
|
1932
|
-
}, [priceHistoryData]);
|
|
1933
|
-
const graphSeriesByOutcomeLabel = useMemo4(() => {
|
|
1934
|
-
const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
|
|
1935
|
-
const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
|
|
1936
|
-
var _a, _b;
|
|
1937
|
-
const marketWithCanonicalId = outcomeByVenue.market;
|
|
1938
|
-
return [
|
|
1939
|
-
outcomeByVenue.outcome.id,
|
|
1940
|
-
(_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
|
|
1941
|
-
outcomeByVenue.market.externalIdentifier,
|
|
1942
|
-
(_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
|
|
1943
|
-
canonicalMarketIdForHistory
|
|
1944
|
-
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
1945
|
-
};
|
|
1946
|
-
headerOutcomeItems.forEach((headerOutcomeItem) => {
|
|
1947
|
-
var _a;
|
|
1948
|
-
const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
|
|
1949
|
-
const graphSeries2 = [];
|
|
1950
|
-
outcomes.forEach((outcomeByVenue, index) => {
|
|
1951
|
-
var _a2;
|
|
1952
|
-
const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
|
|
1953
|
-
if (!(venueHistory == null ? void 0 : venueHistory.length))
|
|
1954
|
-
return;
|
|
1955
|
-
const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
|
|
1956
|
-
const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
|
|
1957
|
-
if (!matchingHistory)
|
|
1958
|
-
return;
|
|
1959
|
-
const points = matchingHistory.points.map((point) => ({
|
|
1960
|
-
time: point.timestamp,
|
|
1961
|
-
value: point.price * 100,
|
|
1962
|
-
open: point.open == null ? void 0 : point.open * 100,
|
|
1963
|
-
high: point.high == null ? void 0 : point.high * 100,
|
|
1964
|
-
low: point.low == null ? void 0 : point.low * 100,
|
|
1965
|
-
close: point.close == null ? void 0 : point.close * 100
|
|
1966
|
-
})).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
|
|
1967
|
-
if (points.length === 0)
|
|
1968
|
-
return;
|
|
1969
|
-
graphSeries2.push({
|
|
1970
|
-
id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
|
|
1971
|
-
venue: outcomeByVenue.venue,
|
|
1972
|
-
color: resolveSeriesColor(outcomeByVenue.venue, index),
|
|
1973
|
-
points
|
|
1974
|
-
});
|
|
1975
|
-
});
|
|
1976
|
-
seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
|
|
1977
|
-
});
|
|
1978
|
-
return seriesByOutcomeLabel;
|
|
1979
|
-
}, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
|
|
1980
2020
|
const graphSeries = useMemo4(() => {
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
2021
|
+
const colorByVenue = new Map(
|
|
2022
|
+
selectedOutcomesByVenue.map((item, index) => [
|
|
2023
|
+
item.venue,
|
|
2024
|
+
resolveSeriesColor(item.venue, index)
|
|
2025
|
+
])
|
|
2026
|
+
);
|
|
2027
|
+
const seriesForOutcomeLabel = resolveMarketChartVenueSeries({
|
|
2028
|
+
chartData: marketChartData,
|
|
2029
|
+
transformProbability: (value) => value
|
|
2030
|
+
}).map((seriesItem) => {
|
|
2031
|
+
var _a2;
|
|
2032
|
+
const resolvedVenue = seriesItem.venue;
|
|
2033
|
+
return {
|
|
2034
|
+
id: `${selectedOutcomeLabel != null ? selectedOutcomeLabel : "graph"}-${resolvedVenue}-${primaryVenueMarketId != null ? primaryVenueMarketId : "chart"}`,
|
|
2035
|
+
venue: resolvedVenue,
|
|
2036
|
+
color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
|
|
2037
|
+
points: seriesItem.points
|
|
2038
|
+
};
|
|
2039
|
+
});
|
|
1985
2040
|
if (!selectedGraphVenue)
|
|
1986
2041
|
return seriesForOutcomeLabel;
|
|
1987
2042
|
return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
|
|
1988
|
-
}, [
|
|
2043
|
+
}, [
|
|
2044
|
+
primaryVenueMarketId,
|
|
2045
|
+
marketChartData,
|
|
2046
|
+
selectedGraphVenue,
|
|
2047
|
+
selectedOutcomeLabel,
|
|
2048
|
+
selectedOutcomesByVenue
|
|
2049
|
+
]);
|
|
2050
|
+
const graphLiveState = useMemo4(() => {
|
|
2051
|
+
return resolveMarketChartLiveState({
|
|
2052
|
+
chartData: marketChartData,
|
|
2053
|
+
selectedVenue: selectedGraphVenue,
|
|
2054
|
+
transformProbability: (value) => value
|
|
2055
|
+
});
|
|
2056
|
+
}, [marketChartData, selectedGraphVenue]);
|
|
1989
2057
|
const otherRows = useMemo4(() => {
|
|
1990
2058
|
if (!model)
|
|
1991
2059
|
return [];
|
|
1992
2060
|
return resolveOtherTabRows(model.market, labels);
|
|
1993
2061
|
}, [labels, model]);
|
|
1994
|
-
const isOrderBookNotFound =
|
|
2062
|
+
const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
|
|
1995
2063
|
const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
|
|
1996
|
-
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (
|
|
2064
|
+
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || askRows.length === 0 && bidRows.length === 0);
|
|
2065
|
+
const hasChartError = !!marketChartError;
|
|
1997
2066
|
const handleOutcomeKeyDown = (eventToHandle) => {
|
|
1998
|
-
var
|
|
2067
|
+
var _a2;
|
|
1999
2068
|
if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
|
|
2000
2069
|
return;
|
|
2001
2070
|
}
|
|
@@ -2006,14 +2075,14 @@ var MarketDetailsContent = ({
|
|
|
2006
2075
|
});
|
|
2007
2076
|
const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
|
|
2008
2077
|
const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
|
|
2009
|
-
setSelectedOutcomeLabel((
|
|
2078
|
+
setSelectedOutcomeLabel((_a2 = headerOutcomeItems[nextIndex]) == null ? void 0 : _a2.label);
|
|
2010
2079
|
};
|
|
2011
|
-
const handleToggleExpanded = (
|
|
2012
|
-
if (
|
|
2080
|
+
const handleToggleExpanded = (event) => {
|
|
2081
|
+
if (event && "key" in event && (event == null ? void 0 : event.key) !== "Enter" && (event == null ? void 0 : event.key) !== " ") {
|
|
2013
2082
|
return;
|
|
2014
2083
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2084
|
+
event == null ? void 0 : event.preventDefault();
|
|
2085
|
+
event == null ? void 0 : event.stopPropagation();
|
|
2017
2086
|
setIsOpened((prev) => {
|
|
2018
2087
|
const next = !prev;
|
|
2019
2088
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
@@ -2028,7 +2097,10 @@ var MarketDetailsContent = ({
|
|
|
2028
2097
|
});
|
|
2029
2098
|
};
|
|
2030
2099
|
const handleRetryOrderBook = () => {
|
|
2031
|
-
void
|
|
2100
|
+
void refetchOrderBook();
|
|
2101
|
+
};
|
|
2102
|
+
const handleRetryMarketChart = () => {
|
|
2103
|
+
void refetchMarketChart();
|
|
2032
2104
|
};
|
|
2033
2105
|
useEffect2(() => {
|
|
2034
2106
|
if (!selectedGraphVenue) {
|
|
@@ -2071,7 +2143,7 @@ var MarketDetailsContent = ({
|
|
|
2071
2143
|
onClick: handleToggleExpanded,
|
|
2072
2144
|
onKeyDown: handleToggleExpanded,
|
|
2073
2145
|
children: [
|
|
2074
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
|
|
2146
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-52 max-w-3/4 items-center gap-3 md:gap-4", children: [
|
|
2075
2147
|
model.image ? /* @__PURE__ */ jsx4(
|
|
2076
2148
|
RemoteImage,
|
|
2077
2149
|
{
|
|
@@ -2118,7 +2190,7 @@ var MarketDetailsContent = ({
|
|
|
2118
2190
|
/* @__PURE__ */ jsx4(
|
|
2119
2191
|
VenueLogo,
|
|
2120
2192
|
{
|
|
2121
|
-
venue:
|
|
2193
|
+
venue: "polymarket",
|
|
2122
2194
|
size: "small",
|
|
2123
2195
|
color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
|
|
2124
2196
|
}
|
|
@@ -2225,13 +2297,26 @@ var MarketDetailsContent = ({
|
|
|
2225
2297
|
)
|
|
2226
2298
|
] }) }) : null,
|
|
2227
2299
|
selectedTab === "graph" ? /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
|
|
2228
|
-
/* @__PURE__ */ jsx4(
|
|
2300
|
+
hasChartError ? /* @__PURE__ */ jsx4(
|
|
2301
|
+
StateMessage,
|
|
2302
|
+
{
|
|
2303
|
+
ariaLabel: labels.marketDetails.chartUnavailableAria,
|
|
2304
|
+
tone: "warning",
|
|
2305
|
+
title: labels.marketDetails.chartUnavailableTitle,
|
|
2306
|
+
description: labels.marketDetails.chartUnavailableDescription,
|
|
2307
|
+
actionLabel: labels.common.retry,
|
|
2308
|
+
onAction: handleRetryMarketChart,
|
|
2309
|
+
className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
|
|
2310
|
+
}
|
|
2311
|
+
) : /* @__PURE__ */ jsx4(
|
|
2229
2312
|
LineChart,
|
|
2230
2313
|
{
|
|
2231
2314
|
series: graphSeries,
|
|
2232
2315
|
height: 260,
|
|
2233
|
-
isLoading:
|
|
2316
|
+
isLoading: isMarketChartLoading,
|
|
2234
2317
|
chartType: selectedChartType,
|
|
2318
|
+
liveCandle: selectedChartType === "candlestick" ? (_d = graphLiveState.liveCandle) != null ? _d : void 0 : void 0,
|
|
2319
|
+
lineValue: graphLiveState.lineValue,
|
|
2235
2320
|
classNames: { root: "w-full" },
|
|
2236
2321
|
showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
|
|
2237
2322
|
renderSeriesControls: () => {
|
|
@@ -2372,14 +2457,6 @@ var MarketDetails = (props) => {
|
|
|
2372
2457
|
}
|
|
2373
2458
|
(_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
|
|
2374
2459
|
};
|
|
2375
|
-
const hasEventProp = "event" in props && !!props.event;
|
|
2376
|
-
const {
|
|
2377
|
-
event: fetchedEvent,
|
|
2378
|
-
error: eventError,
|
|
2379
|
-
isLoading: isFetchingEvent
|
|
2380
|
-
} = useEvent3(hasEventProp ? void 0 : props.eventId, {
|
|
2381
|
-
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
2382
|
-
});
|
|
2383
2460
|
if (props.isLoading) {
|
|
2384
2461
|
return /* @__PURE__ */ jsx4(
|
|
2385
2462
|
MarketDetailsLoadingState,
|
|
@@ -2390,46 +2467,119 @@ var MarketDetails = (props) => {
|
|
|
2390
2467
|
}
|
|
2391
2468
|
);
|
|
2392
2469
|
}
|
|
2393
|
-
if ("
|
|
2470
|
+
if ("venueMarkets" in props && props.venueMarkets) {
|
|
2394
2471
|
return /* @__PURE__ */ jsx4(
|
|
2395
2472
|
MarketDetailsContent,
|
|
2396
2473
|
__spreadProps(__spreadValues({}, props), {
|
|
2397
2474
|
isOpened: resolvedIsOpened,
|
|
2398
2475
|
onOpenChange: handleOpenChange,
|
|
2399
|
-
|
|
2476
|
+
venueMarkets: props.venueMarkets
|
|
2400
2477
|
})
|
|
2401
2478
|
);
|
|
2402
2479
|
}
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2480
|
+
const { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames } = props;
|
|
2481
|
+
return /* @__PURE__ */ jsx4(MarketDetailsUnavailableState, { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames });
|
|
2482
|
+
};
|
|
2483
|
+
MarketDetails.displayName = "MarketDetails";
|
|
2484
|
+
var resolveInitialExpandedId = (markets, defaultId) => {
|
|
2485
|
+
var _a, _b;
|
|
2486
|
+
if (!markets.length)
|
|
2487
|
+
return null;
|
|
2488
|
+
if (defaultId) {
|
|
2489
|
+
const match = markets.find((m) => m.id === defaultId);
|
|
2490
|
+
if (match)
|
|
2491
|
+
return match.id;
|
|
2492
|
+
}
|
|
2493
|
+
return (_b = (_a = markets[0]) == null ? void 0 : _a.id) != null ? _b : null;
|
|
2494
|
+
};
|
|
2495
|
+
var MarketDetailsList = ({
|
|
2496
|
+
eventId,
|
|
2497
|
+
expandedMarketId,
|
|
2498
|
+
defaultExpandedMarketId,
|
|
2499
|
+
onExpandedMarketChange,
|
|
2500
|
+
defaultTab,
|
|
2501
|
+
defaultTimeRange,
|
|
2502
|
+
classNames,
|
|
2503
|
+
ariaLabel
|
|
2504
|
+
}) => {
|
|
2505
|
+
const labels = useLabels4();
|
|
2506
|
+
const resolvedEventId = eventId || "";
|
|
2507
|
+
const { markets, isLoading, error } = useVenueMarkets({
|
|
2508
|
+
venueEventId: resolvedEventId,
|
|
2509
|
+
enabled: !!resolvedEventId
|
|
2510
|
+
});
|
|
2511
|
+
const [internalExpandedId, setInternalExpandedId] = useState2(
|
|
2512
|
+
() => resolveInitialExpandedId(markets, defaultExpandedMarketId)
|
|
2513
|
+
);
|
|
2514
|
+
useEffect2(() => {
|
|
2515
|
+
if (typeof expandedMarketId !== "undefined")
|
|
2516
|
+
return;
|
|
2517
|
+
setInternalExpandedId((current) => {
|
|
2518
|
+
if (current && markets.some((m) => m.id === current))
|
|
2519
|
+
return current;
|
|
2520
|
+
return resolveInitialExpandedId(markets, defaultExpandedMarketId);
|
|
2521
|
+
});
|
|
2522
|
+
}, [defaultExpandedMarketId, expandedMarketId, markets]);
|
|
2523
|
+
useEffect2(() => {
|
|
2524
|
+
if (typeof expandedMarketId === "undefined")
|
|
2525
|
+
return;
|
|
2526
|
+
setInternalExpandedId(expandedMarketId);
|
|
2527
|
+
}, [expandedMarketId]);
|
|
2528
|
+
const resolvedExpandedId = typeof expandedMarketId === "undefined" ? internalExpandedId : expandedMarketId;
|
|
2529
|
+
const handleToggle = (marketId, isOpened) => {
|
|
2530
|
+
const next = isOpened ? marketId : null;
|
|
2531
|
+
if (typeof expandedMarketId === "undefined") {
|
|
2532
|
+
setInternalExpandedId(next);
|
|
2533
|
+
}
|
|
2534
|
+
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(next);
|
|
2535
|
+
};
|
|
2536
|
+
if (isLoading) {
|
|
2537
|
+
return /* @__PURE__ */ jsxs3("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: [
|
|
2538
|
+
/* @__PURE__ */ jsx4(MarketDetailsLoadingState, { isOpened: true, classNames: { root: classNames == null ? void 0 : classNames.item } }),
|
|
2539
|
+
/* @__PURE__ */ jsx4(MarketDetailsLoadingState, { isOpened: false, classNames: { root: classNames == null ? void 0 : classNames.item } })
|
|
2540
|
+
] });
|
|
2541
|
+
}
|
|
2542
|
+
if (error) {
|
|
2543
|
+
return /* @__PURE__ */ jsx4(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx4(
|
|
2544
|
+
StateMessage,
|
|
2406
2545
|
{
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2546
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
|
|
2547
|
+
title: labels.marketDetails.unavailableTitle,
|
|
2548
|
+
description: labels.marketDetails.unavailableDescription,
|
|
2549
|
+
className: "min-h-[280px] md:min-h-[320px]"
|
|
2410
2550
|
}
|
|
2411
|
-
);
|
|
2551
|
+
) });
|
|
2412
2552
|
}
|
|
2413
|
-
if (
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2553
|
+
if (markets.length === 0) {
|
|
2554
|
+
return /* @__PURE__ */ jsx4(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx4(
|
|
2555
|
+
StateMessage,
|
|
2556
|
+
{
|
|
2557
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
|
|
2558
|
+
title: labels.marketDetails.notFoundTitle,
|
|
2559
|
+
description: labels.marketDetails.notFoundDescription,
|
|
2560
|
+
className: "min-h-[280px] md:min-h-[320px]"
|
|
2561
|
+
}
|
|
2562
|
+
) });
|
|
2418
2563
|
}
|
|
2419
|
-
return /* @__PURE__ */ jsx4(
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2564
|
+
return /* @__PURE__ */ jsx4("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: markets.map((market) => /* @__PURE__ */ jsx4(
|
|
2565
|
+
MarketDetails,
|
|
2566
|
+
{
|
|
2567
|
+
venueMarkets: [market],
|
|
2568
|
+
isOpened: resolvedExpandedId === market.id,
|
|
2569
|
+
onOpenChange: (nextIsOpened) => handleToggle(market.id, nextIsOpened),
|
|
2570
|
+
defaultTab,
|
|
2571
|
+
defaultTimeRange,
|
|
2572
|
+
ariaLabel: market.question,
|
|
2573
|
+
classNames: { root: classNames == null ? void 0 : classNames.item }
|
|
2574
|
+
},
|
|
2575
|
+
market.id
|
|
2576
|
+
)) });
|
|
2427
2577
|
};
|
|
2428
|
-
|
|
2578
|
+
MarketDetailsList.displayName = "MarketDetailsList";
|
|
2429
2579
|
|
|
2430
2580
|
// src/events/list/index.tsx
|
|
2431
2581
|
import { useCallback, useEffect as useEffect3, useMemo as useMemo5, useRef, useState as useState3 } from "react";
|
|
2432
|
-
import {
|
|
2582
|
+
import { useVenueEvents, useLabels as useLabels5 } from "@agg-market/hooks";
|
|
2433
2583
|
|
|
2434
2584
|
// src/events/list/event-list.constants.ts
|
|
2435
2585
|
var POLYMARKET_VENUE = "polymarket";
|
|
@@ -2460,8 +2610,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
2460
2610
|
|
|
2461
2611
|
// src/events/list/event-list.utils.ts
|
|
2462
2612
|
var mapEventToEventListItemEvent = (event) => {
|
|
2463
|
-
|
|
2464
|
-
if (mergedVenueMarkets.length === 0)
|
|
2613
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
2465
2614
|
return null;
|
|
2466
2615
|
return event;
|
|
2467
2616
|
};
|
|
@@ -2525,11 +2674,11 @@ var estimateTabsWidth = (items) => {
|
|
|
2525
2674
|
var EventList = ({
|
|
2526
2675
|
title,
|
|
2527
2676
|
maxItemsPerRow = 3,
|
|
2528
|
-
limit =
|
|
2677
|
+
limit = 9,
|
|
2529
2678
|
maxVisibleItems,
|
|
2530
|
-
showVenueLogo = true,
|
|
2531
2679
|
search,
|
|
2532
|
-
categoryIds
|
|
2680
|
+
categoryIds,
|
|
2681
|
+
onClick
|
|
2533
2682
|
}) => {
|
|
2534
2683
|
var _a, _b;
|
|
2535
2684
|
const labels = useLabels5();
|
|
@@ -2553,7 +2702,7 @@ var EventList = ({
|
|
|
2553
2702
|
}, [maxVisibleItems]);
|
|
2554
2703
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
2555
2704
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
2556
|
-
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } =
|
|
2705
|
+
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = useVenueEvents({
|
|
2557
2706
|
venues,
|
|
2558
2707
|
search,
|
|
2559
2708
|
categoryIds,
|
|
@@ -2684,10 +2833,10 @@ var EventList = ({
|
|
|
2684
2833
|
EventListItem,
|
|
2685
2834
|
{
|
|
2686
2835
|
event,
|
|
2687
|
-
showVenueLogo,
|
|
2688
2836
|
classNames: {
|
|
2689
2837
|
root: "w-full min-w-0 max-w-none"
|
|
2690
|
-
}
|
|
2838
|
+
},
|
|
2839
|
+
onClick
|
|
2691
2840
|
},
|
|
2692
2841
|
event.id
|
|
2693
2842
|
)),
|
|
@@ -2729,5 +2878,6 @@ export {
|
|
|
2729
2878
|
EventListItem,
|
|
2730
2879
|
EventListItemDetails,
|
|
2731
2880
|
MarketDetails,
|
|
2881
|
+
MarketDetailsList,
|
|
2732
2882
|
EventList
|
|
2733
2883
|
};
|