@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
package/dist/events.js
CHANGED
|
@@ -62,7 +62,8 @@ __export(events_exports, {
|
|
|
62
62
|
EventList: () => EventList,
|
|
63
63
|
EventListItem: () => EventListItem,
|
|
64
64
|
EventListItemDetails: () => EventListItemDetails,
|
|
65
|
-
MarketDetails: () => MarketDetails
|
|
65
|
+
MarketDetails: () => MarketDetails,
|
|
66
|
+
MarketDetailsList: () => MarketDetailsList
|
|
66
67
|
});
|
|
67
68
|
module.exports = __toCommonJS(events_exports);
|
|
68
69
|
|
|
@@ -138,9 +139,9 @@ function Badge({
|
|
|
138
139
|
)
|
|
139
140
|
}, onClick && { onClick }), {
|
|
140
141
|
children: [
|
|
141
|
-
prefix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
|
|
142
|
+
prefix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.prefix, "empty:hidden"), children: prefix }) : null,
|
|
142
143
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
|
|
143
|
-
suffix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
|
|
144
|
+
suffix ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: cn(classNames == null ? void 0 : classNames.suffix, "empty:hidden"), children: suffix }) : null
|
|
144
145
|
]
|
|
145
146
|
})
|
|
146
147
|
);
|
|
@@ -2498,7 +2499,11 @@ var StateMessage = ({
|
|
|
2498
2499
|
size: "large",
|
|
2499
2500
|
className: "text-agg-base leading-agg-6",
|
|
2500
2501
|
"aria-label": actionLabel,
|
|
2501
|
-
onClick:
|
|
2502
|
+
onClick: (e) => {
|
|
2503
|
+
e.stopPropagation();
|
|
2504
|
+
e.preventDefault();
|
|
2505
|
+
onAction == null ? void 0 : onAction();
|
|
2506
|
+
},
|
|
2502
2507
|
children: actionLabel
|
|
2503
2508
|
}
|
|
2504
2509
|
) : null
|
|
@@ -2911,9 +2916,12 @@ var VenueLogo = ({
|
|
|
2911
2916
|
title
|
|
2912
2917
|
}) => {
|
|
2913
2918
|
var _a;
|
|
2919
|
+
const { showVenueLogo = true } = (0, import_hooks10.useAggUiConfig)();
|
|
2914
2920
|
const labels = (0, import_hooks10.useLabels)();
|
|
2915
2921
|
const sizeClass = sizeClasses2[size];
|
|
2916
2922
|
const resolvedLabel = (_a = ariaLabel != null ? ariaLabel : labels.venues[venue]) != null ? _a : venueLogoLabels[venue];
|
|
2923
|
+
if (!showVenueLogo)
|
|
2924
|
+
return null;
|
|
2917
2925
|
if (variant === "logo") {
|
|
2918
2926
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
2919
2927
|
RemoteImage,
|
|
@@ -3027,7 +3035,7 @@ var SwitchButton = ({
|
|
|
3027
3035
|
"div",
|
|
3028
3036
|
{
|
|
3029
3037
|
className: cn(
|
|
3030
|
-
"group/agg-switch",
|
|
3038
|
+
"group/agg-switch min-w-fit",
|
|
3031
3039
|
"inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
|
|
3032
3040
|
getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
|
|
3033
3041
|
"cursor-pointer hover:bg-agg-tertiary",
|
|
@@ -3073,6 +3081,7 @@ var SwitchButton = ({
|
|
|
3073
3081
|
tabIndex: isActive ? 0 : -1,
|
|
3074
3082
|
disabled: option.disabled,
|
|
3075
3083
|
className: cn(
|
|
3084
|
+
"whitespace-nowrap",
|
|
3076
3085
|
"relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
|
|
3077
3086
|
getMotionClassName(
|
|
3078
3087
|
enableAnimations,
|
|
@@ -3265,11 +3274,16 @@ var LineChart = ({
|
|
|
3265
3274
|
isLoading = false,
|
|
3266
3275
|
chartType = "line",
|
|
3267
3276
|
showSeriesControls = true,
|
|
3268
|
-
renderSeriesControls
|
|
3277
|
+
renderSeriesControls,
|
|
3278
|
+
liveCandle: liveForming,
|
|
3279
|
+
lineData,
|
|
3280
|
+
lineValue,
|
|
3281
|
+
live
|
|
3269
3282
|
}) => {
|
|
3270
3283
|
var _a, _b;
|
|
3271
3284
|
const labels = (0, import_hooks12.useLabels)();
|
|
3272
|
-
const { theme } = (0, import_hooks12.useSdkUiConfig)();
|
|
3285
|
+
const { theme, enableGradients, enableLiveUpdates } = (0, import_hooks12.useSdkUiConfig)();
|
|
3286
|
+
const isLive = enableLiveUpdates && (live != null ? live : true);
|
|
3273
3287
|
const normalizedSeries = (0, import_react3.useMemo)(() => {
|
|
3274
3288
|
return normalizeSeries(series);
|
|
3275
3289
|
}, [series]);
|
|
@@ -3292,7 +3306,19 @@ var LineChart = ({
|
|
|
3292
3306
|
if (!primarySeries) {
|
|
3293
3307
|
return [];
|
|
3294
3308
|
}
|
|
3295
|
-
|
|
3309
|
+
const points = toLivelinePoints(primarySeries.points);
|
|
3310
|
+
if (points.length < 3) {
|
|
3311
|
+
return [
|
|
3312
|
+
...points,
|
|
3313
|
+
...points.map((point) => __spreadProps(__spreadValues({}, point), {
|
|
3314
|
+
time: point.time + 1500
|
|
3315
|
+
})),
|
|
3316
|
+
...points.map((point) => __spreadProps(__spreadValues({}, point), {
|
|
3317
|
+
time: point.time + 3e3
|
|
3318
|
+
}))
|
|
3319
|
+
];
|
|
3320
|
+
}
|
|
3321
|
+
return points;
|
|
3296
3322
|
}, [primarySeries]);
|
|
3297
3323
|
const primaryCandles = (0, import_react3.useMemo)(() => {
|
|
3298
3324
|
if (!primarySeries) {
|
|
@@ -3326,7 +3352,7 @@ var LineChart = ({
|
|
|
3326
3352
|
const timeFormatter = (0, import_react3.useMemo)(() => {
|
|
3327
3353
|
return resolveTimeFormatter(windowSeconds);
|
|
3328
3354
|
}, [windowSeconds]);
|
|
3329
|
-
const seriesControls = showSeriesControls
|
|
3355
|
+
const seriesControls = showSeriesControls ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
|
|
3330
3356
|
series: normalizedSeries,
|
|
3331
3357
|
activeSeriesId,
|
|
3332
3358
|
handleSeriesChange
|
|
@@ -3359,13 +3385,17 @@ var LineChart = ({
|
|
|
3359
3385
|
series: livelineSeries,
|
|
3360
3386
|
color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
|
|
3361
3387
|
theme: livelineTheme,
|
|
3388
|
+
fill: enableGradients,
|
|
3362
3389
|
grid: true,
|
|
3363
|
-
momentum:
|
|
3364
|
-
pulse:
|
|
3390
|
+
momentum: isLive,
|
|
3391
|
+
pulse: isLive,
|
|
3365
3392
|
window: windowSeconds,
|
|
3366
3393
|
mode: chartType === "candlestick" ? "candle" : "line",
|
|
3367
3394
|
candles: chartType === "candlestick" ? primaryCandles : void 0,
|
|
3368
3395
|
candleWidth: chartType === "candlestick" ? candleWidth : void 0,
|
|
3396
|
+
liveCandle: chartType === "candlestick" ? liveForming : void 0,
|
|
3397
|
+
lineData,
|
|
3398
|
+
lineValue,
|
|
3369
3399
|
formatValue: defaultValueFormatter,
|
|
3370
3400
|
formatTime: timeFormatter,
|
|
3371
3401
|
padding: {
|
|
@@ -3374,7 +3404,8 @@ var LineChart = ({
|
|
|
3374
3404
|
bottom: 28,
|
|
3375
3405
|
left: 12
|
|
3376
3406
|
},
|
|
3377
|
-
loading: isLoading
|
|
3407
|
+
loading: isLoading,
|
|
3408
|
+
lineWidth: 1
|
|
3378
3409
|
}
|
|
3379
3410
|
)
|
|
3380
3411
|
}
|
|
@@ -3581,7 +3612,7 @@ var getTabButtonClassName = ({
|
|
|
3581
3612
|
return cn(
|
|
3582
3613
|
"cursor-pointer disabled:cursor-not-allowed",
|
|
3583
3614
|
"relative inline-flex h-full shrink-0 items-center justify-center gap-2 font-agg-sans",
|
|
3584
|
-
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-bold",
|
|
3615
|
+
isBarVariant ? "hover:text-agg-foreground hover:bg-agg-secondary-hover" : "hover:text-agg-foreground hover:font-agg-bold",
|
|
3585
3616
|
getMotionClassName(
|
|
3586
3617
|
enableAnimations,
|
|
3587
3618
|
"transition-[colors] duration-300 ease-in-out motion-reduce:transition-none"
|
|
@@ -4007,8 +4038,17 @@ var Tabs = ({
|
|
|
4007
4038
|
)
|
|
4008
4039
|
}
|
|
4009
4040
|
) }) : null,
|
|
4010
|
-
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center", children: item.icon }) : null,
|
|
4011
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
4041
|
+
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "relative z-10 inline-flex shrink-0 items-center justify-center empty:hidden", children: item.icon }) : null,
|
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
4043
|
+
"span",
|
|
4044
|
+
{
|
|
4045
|
+
className: cn(
|
|
4046
|
+
"relative z-10 truncate whitespace-nowrap [&::first-letter]:uppercase"
|
|
4047
|
+
),
|
|
4048
|
+
"data-text": item.label,
|
|
4049
|
+
children: item.label
|
|
4050
|
+
}
|
|
4051
|
+
)
|
|
4012
4052
|
]
|
|
4013
4053
|
},
|
|
4014
4054
|
item.value
|
|
@@ -4066,10 +4106,7 @@ Tabs.displayName = "Tabs";
|
|
|
4066
4106
|
var resolveEventListItemEvent = (fetchedEvent) => {
|
|
4067
4107
|
if (!fetchedEvent)
|
|
4068
4108
|
return void 0;
|
|
4069
|
-
|
|
4070
|
-
(market) => market.venueMarkets
|
|
4071
|
-
);
|
|
4072
|
-
if (mergedVenueMarkets.length === 0)
|
|
4109
|
+
if (!fetchedEvent.venueMarkets || fetchedEvent.venueMarkets.length === 0)
|
|
4073
4110
|
return void 0;
|
|
4074
4111
|
return fetchedEvent;
|
|
4075
4112
|
};
|
|
@@ -4254,7 +4291,6 @@ var EventListItemContent = ({
|
|
|
4254
4291
|
event,
|
|
4255
4292
|
title,
|
|
4256
4293
|
image,
|
|
4257
|
-
showVenueLogo = true,
|
|
4258
4294
|
maxOutcomes = 2,
|
|
4259
4295
|
classNames,
|
|
4260
4296
|
venueInfo,
|
|
@@ -4266,8 +4302,8 @@ var EventListItemContent = ({
|
|
|
4266
4302
|
const config = (0, import_hooks15.useSdkUiConfig)();
|
|
4267
4303
|
const labels = (0, import_hooks15.useLabels)();
|
|
4268
4304
|
const allVenueMarkets = (0, import_react6.useMemo)(() => {
|
|
4269
|
-
return event.
|
|
4270
|
-
}, [event.
|
|
4305
|
+
return event.venueMarkets;
|
|
4306
|
+
}, [event.venueMarkets]);
|
|
4271
4307
|
const primaryVenueMarket = (0, import_react6.useMemo)(() => {
|
|
4272
4308
|
return selectPrimaryVenueMarket(allVenueMarkets);
|
|
4273
4309
|
}, [allVenueMarkets]);
|
|
@@ -4290,7 +4326,7 @@ var EventListItemContent = ({
|
|
|
4290
4326
|
return;
|
|
4291
4327
|
if ((eventToHandle == null ? void 0 : eventToHandle.key) === "Enter" || (eventToHandle == null ? void 0 : eventToHandle.key) === " ") {
|
|
4292
4328
|
eventToHandle == null ? void 0 : eventToHandle.preventDefault();
|
|
4293
|
-
onClick();
|
|
4329
|
+
onClick == null ? void 0 : onClick(event);
|
|
4294
4330
|
}
|
|
4295
4331
|
};
|
|
4296
4332
|
const renderArbitrage = (value) => {
|
|
@@ -4317,7 +4353,7 @@ var EventListItemContent = ({
|
|
|
4317
4353
|
className: cn(baseCardClassName, onClick && "cursor-pointer", classNames == null ? void 0 : classNames.root),
|
|
4318
4354
|
role: onClick ? "button" : void 0,
|
|
4319
4355
|
tabIndex: onClick ? 0 : void 0,
|
|
4320
|
-
onClick,
|
|
4356
|
+
onClick: () => onClick == null ? void 0 : onClick(event),
|
|
4321
4357
|
onKeyDown: handleKeyDown,
|
|
4322
4358
|
"aria-label": ariaLabel != null ? ariaLabel : resolvedTitle,
|
|
4323
4359
|
children: [
|
|
@@ -4371,7 +4407,7 @@ var EventListItemContent = ({
|
|
|
4371
4407
|
Badge,
|
|
4372
4408
|
{
|
|
4373
4409
|
text: config.formatPercent(probability),
|
|
4374
|
-
prefix:
|
|
4410
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(VenueLogo, { venue: visibleOutcome.venue, size: "small" }),
|
|
4375
4411
|
size: "large",
|
|
4376
4412
|
classNames: {
|
|
4377
4413
|
root: cn(
|
|
@@ -4404,7 +4440,7 @@ var EventListItemContent = ({
|
|
|
4404
4440
|
) }),
|
|
4405
4441
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "text-agg-muted-foreground", children: "\xD7" }),
|
|
4406
4442
|
singleVenue ? /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("span", { className: "flex items-center gap-1 truncate text-agg-muted-foreground", children: [
|
|
4407
|
-
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4408
4444
|
VenueLogo,
|
|
4409
4445
|
{
|
|
4410
4446
|
venue: singleVenue,
|
|
@@ -4412,14 +4448,14 @@ var EventListItemContent = ({
|
|
|
4412
4448
|
isMonochromatic: true,
|
|
4413
4449
|
className: "text-agg-muted-foreground!"
|
|
4414
4450
|
}
|
|
4415
|
-
)
|
|
4451
|
+
),
|
|
4416
4452
|
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { children: venueLabel })
|
|
4417
4453
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "truncate text-agg-muted-foreground", children: formatCountLabel(
|
|
4418
4454
|
venueCount,
|
|
4419
4455
|
labels.eventItem.venueSingular,
|
|
4420
4456
|
labels.eventItem.venuePlural
|
|
4421
4457
|
) }),
|
|
4422
|
-
|
|
4458
|
+
!singleVenue && visibleVenueLogos.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "flex items-center gap-1 overflow-hidden", children: visibleVenueLogos.map((venue) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4423
4459
|
VenueLogo,
|
|
4424
4460
|
{
|
|
4425
4461
|
venue,
|
|
@@ -4449,7 +4485,8 @@ var EventListItemByEventId = (_a) => {
|
|
|
4449
4485
|
error,
|
|
4450
4486
|
isError,
|
|
4451
4487
|
isLoading
|
|
4452
|
-
} = (0, import_hooks15.
|
|
4488
|
+
} = (0, import_hooks15.useVenueEvent)({
|
|
4489
|
+
eventId: eventId != null ? eventId : "",
|
|
4453
4490
|
enabled: !!eventId
|
|
4454
4491
|
});
|
|
4455
4492
|
const resolvedEvent = (0, import_react6.useMemo)(() => {
|
|
@@ -4549,7 +4586,9 @@ var ChartTypeSwitch = ({
|
|
|
4549
4586
|
"transition-colors duration-200 ease-in-out",
|
|
4550
4587
|
isActive ? "text-agg-foreground" : "text-agg-muted-foreground"
|
|
4551
4588
|
),
|
|
4552
|
-
onClick: () => {
|
|
4589
|
+
onClick: (e) => {
|
|
4590
|
+
e.stopPropagation();
|
|
4591
|
+
e.preventDefault();
|
|
4553
4592
|
if (isActive) {
|
|
4554
4593
|
return;
|
|
4555
4594
|
}
|
|
@@ -4578,14 +4617,9 @@ var isDateLikeLabel = (value) => {
|
|
|
4578
4617
|
return false;
|
|
4579
4618
|
return (0, import_dayjs3.default)(value).isValid();
|
|
4580
4619
|
};
|
|
4581
|
-
var
|
|
4582
|
-
if (!isDateLikeLabel(value))
|
|
4583
|
-
return value;
|
|
4584
|
-
return (0, import_dayjs3.default)(value).format("MMM D, YYYY");
|
|
4585
|
-
};
|
|
4586
|
-
var getDefaultSelectedTimeRange = (value) => {
|
|
4620
|
+
var getDefaultSelectedTimeRange = (value, fallback = "1D") => {
|
|
4587
4621
|
if (!value)
|
|
4588
|
-
return
|
|
4622
|
+
return fallback;
|
|
4589
4623
|
return value;
|
|
4590
4624
|
};
|
|
4591
4625
|
var getTimeWindowByRange = (range) => {
|
|
@@ -4667,24 +4701,6 @@ var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
|
|
|
4667
4701
|
};
|
|
4668
4702
|
}).filter((item) => item != null);
|
|
4669
4703
|
};
|
|
4670
|
-
var buildPriceHistoryGroups = (selectedOutcomes, fallbackMarketId) => {
|
|
4671
|
-
const marketIdByVenue = /* @__PURE__ */ new Map();
|
|
4672
|
-
selectedOutcomes.forEach(({ venue, market }) => {
|
|
4673
|
-
var _a, _b;
|
|
4674
|
-
const marketWithCanonicalId = market;
|
|
4675
|
-
const canonicalMarketId = (_a = marketWithCanonicalId.marketId) != null ? _a : fallbackMarketId;
|
|
4676
|
-
if (!canonicalMarketId)
|
|
4677
|
-
return;
|
|
4678
|
-
if (!marketIdByVenue.has(venue)) {
|
|
4679
|
-
marketIdByVenue.set(venue, /* @__PURE__ */ new Set());
|
|
4680
|
-
}
|
|
4681
|
-
(_b = marketIdByVenue.get(venue)) == null ? void 0 : _b.add(canonicalMarketId);
|
|
4682
|
-
});
|
|
4683
|
-
return [...marketIdByVenue.entries()].map(([venue, marketIds]) => ({
|
|
4684
|
-
venue,
|
|
4685
|
-
venueMarketOutcomeIds: [...marketIds]
|
|
4686
|
-
})).filter((group) => group.venueMarketOutcomeIds.length > 0);
|
|
4687
|
-
};
|
|
4688
4704
|
var resolveSeriesColor = (venue, index) => {
|
|
4689
4705
|
var _a;
|
|
4690
4706
|
const colorFromVenue = lineColorByVenue[venue];
|
|
@@ -4692,6 +4708,98 @@ var resolveSeriesColor = (venue, index) => {
|
|
|
4692
4708
|
return colorFromVenue;
|
|
4693
4709
|
return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
|
|
4694
4710
|
};
|
|
4711
|
+
var toNonEmptyString = (value) => {
|
|
4712
|
+
if (typeof value !== "string")
|
|
4713
|
+
return void 0;
|
|
4714
|
+
const trimmedValue = value.trim();
|
|
4715
|
+
return trimmedValue ? trimmedValue : void 0;
|
|
4716
|
+
};
|
|
4717
|
+
var resolveCanonicalMarketId = (venueMarkets, fallbackMarketId) => {
|
|
4718
|
+
var _a;
|
|
4719
|
+
const uniqueMarketIds = Array.from(
|
|
4720
|
+
new Set(venueMarkets.map((market) => toNonEmptyString(market.marketId)).filter(Boolean))
|
|
4721
|
+
);
|
|
4722
|
+
if (uniqueMarketIds.length === 1) {
|
|
4723
|
+
return uniqueMarketIds[0];
|
|
4724
|
+
}
|
|
4725
|
+
return (_a = toNonEmptyString(fallbackMarketId)) != null ? _a : uniqueMarketIds[0];
|
|
4726
|
+
};
|
|
4727
|
+
var toChartDisplayValue = (value, transformProbability) => {
|
|
4728
|
+
if (value == null || !Number.isFinite(value))
|
|
4729
|
+
return void 0;
|
|
4730
|
+
return transformProbability(value) * 100;
|
|
4731
|
+
};
|
|
4732
|
+
var marketChartCandleToLineChartPoint = (candle, transformProbability) => {
|
|
4733
|
+
var _a, _b, _c, _d;
|
|
4734
|
+
const open = (_a = toChartDisplayValue(candle.open, transformProbability)) != null ? _a : 0;
|
|
4735
|
+
const high = (_b = toChartDisplayValue(candle.high, transformProbability)) != null ? _b : open;
|
|
4736
|
+
const low = (_c = toChartDisplayValue(candle.low, transformProbability)) != null ? _c : open;
|
|
4737
|
+
const close = (_d = toChartDisplayValue(candle.close, transformProbability)) != null ? _d : open;
|
|
4738
|
+
return {
|
|
4739
|
+
time: candle.time,
|
|
4740
|
+
value: close,
|
|
4741
|
+
open,
|
|
4742
|
+
high,
|
|
4743
|
+
low,
|
|
4744
|
+
close
|
|
4745
|
+
};
|
|
4746
|
+
};
|
|
4747
|
+
var marketChartCandleToScaledCandlePoint = (candle, transformProbability) => {
|
|
4748
|
+
var _a, _b, _c, _d;
|
|
4749
|
+
const point = marketChartCandleToLineChartPoint(candle, transformProbability);
|
|
4750
|
+
return {
|
|
4751
|
+
time: point.time,
|
|
4752
|
+
open: (_a = point.open) != null ? _a : point.value,
|
|
4753
|
+
high: (_b = point.high) != null ? _b : point.value,
|
|
4754
|
+
low: (_c = point.low) != null ? _c : point.value,
|
|
4755
|
+
close: (_d = point.close) != null ? _d : point.value,
|
|
4756
|
+
v: candle.volume
|
|
4757
|
+
};
|
|
4758
|
+
};
|
|
4759
|
+
var resolveMarketChartVenueSeries = ({
|
|
4760
|
+
chartData,
|
|
4761
|
+
transformProbability
|
|
4762
|
+
}) => {
|
|
4763
|
+
if (!chartData)
|
|
4764
|
+
return [];
|
|
4765
|
+
return Object.entries(chartData.venues).map(([venue, venueData]) => ({
|
|
4766
|
+
venue,
|
|
4767
|
+
points: venueData.candles.map(
|
|
4768
|
+
(candle) => marketChartCandleToLineChartPoint(candle, transformProbability)
|
|
4769
|
+
)
|
|
4770
|
+
})).filter((item) => item.points.length > 0);
|
|
4771
|
+
};
|
|
4772
|
+
var resolveMarketChartLiveState = ({
|
|
4773
|
+
chartData,
|
|
4774
|
+
selectedVenue,
|
|
4775
|
+
transformProbability
|
|
4776
|
+
}) => {
|
|
4777
|
+
var _a, _b;
|
|
4778
|
+
if (!chartData) {
|
|
4779
|
+
return {
|
|
4780
|
+
liveCandle: null,
|
|
4781
|
+
lineValue: void 0,
|
|
4782
|
+
live: false
|
|
4783
|
+
};
|
|
4784
|
+
}
|
|
4785
|
+
const venueEntries = selectedVenue ? Object.entries(chartData.venues).filter(([venue]) => venue === selectedVenue) : Object.entries(chartData.venues);
|
|
4786
|
+
if (venueEntries.length === 0) {
|
|
4787
|
+
return {
|
|
4788
|
+
liveCandle: null,
|
|
4789
|
+
lineValue: void 0,
|
|
4790
|
+
live: false
|
|
4791
|
+
};
|
|
4792
|
+
}
|
|
4793
|
+
const singleVenueView = selectedVenue != null || venueEntries.length === 1;
|
|
4794
|
+
const liveCandleEntry = singleVenueView ? venueEntries.find(([, venueData]) => venueData.liveCandle != null) : null;
|
|
4795
|
+
const primaryLineValue = (_b = (_a = venueEntries[0]) == null ? void 0 : _a[1]) == null ? void 0 : _b.lineValue;
|
|
4796
|
+
const lineValue = primaryLineValue != null ? toChartDisplayValue(primaryLineValue, transformProbability) : void 0;
|
|
4797
|
+
return {
|
|
4798
|
+
liveCandle: (liveCandleEntry == null ? void 0 : liveCandleEntry[1].liveCandle) ? marketChartCandleToScaledCandlePoint(liveCandleEntry[1].liveCandle, transformProbability) : null,
|
|
4799
|
+
lineValue,
|
|
4800
|
+
live: liveCandleEntry != null
|
|
4801
|
+
};
|
|
4802
|
+
};
|
|
4695
4803
|
|
|
4696
4804
|
// src/events/item-details/index.tsx
|
|
4697
4805
|
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
@@ -4756,31 +4864,23 @@ var resolveAverageProbability = (values) => {
|
|
|
4756
4864
|
return void 0;
|
|
4757
4865
|
return validValues.reduce((sum, value) => sum + value, 0) / validValues.length;
|
|
4758
4866
|
};
|
|
4759
|
-
var resolveOutcomeCandidateIds = (market, outcome) => {
|
|
4760
|
-
var _a, _b;
|
|
4761
|
-
const marketWithCanonicalId = market;
|
|
4762
|
-
return [
|
|
4763
|
-
outcome.id,
|
|
4764
|
-
(_a = outcome.externalIdentifier) != null ? _a : void 0,
|
|
4765
|
-
market.externalIdentifier,
|
|
4766
|
-
(_b = marketWithCanonicalId.marketId) != null ? _b : void 0
|
|
4767
|
-
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
4768
|
-
};
|
|
4769
4867
|
var EventListItemDetailsGraphSection = ({
|
|
4770
4868
|
venueMarkets,
|
|
4771
|
-
canonicalMarketId,
|
|
4772
4869
|
selectedOutcomeLabel,
|
|
4773
4870
|
onSelectedOutcomeLabelChange,
|
|
4774
4871
|
switchLabels,
|
|
4775
4872
|
isDateOutcomeMarket,
|
|
4776
4873
|
classNames,
|
|
4777
|
-
showVenueLogo,
|
|
4778
4874
|
venueInfo,
|
|
4779
4875
|
formatPercent,
|
|
4780
4876
|
selectedTimeRange,
|
|
4781
|
-
selectedChartType
|
|
4877
|
+
selectedChartType,
|
|
4878
|
+
selectedOutcome: _selectedOutcome,
|
|
4879
|
+
selectedMarket
|
|
4782
4880
|
}) => {
|
|
4881
|
+
var _a, _b;
|
|
4783
4882
|
const labels = (0, import_hooks17.useLabels)();
|
|
4883
|
+
const { enableLiveUpdates } = (0, import_hooks17.useSdkUiConfig)();
|
|
4784
4884
|
const [selectedVenue, setSelectedVenue] = (0, import_react8.useState)(null);
|
|
4785
4885
|
const [activeProbabilityMode, setActiveProbabilityMode] = (0, import_react8.useState)("yes");
|
|
4786
4886
|
const probabilityModeConfigs = (0, import_react8.useMemo)(() => {
|
|
@@ -4849,105 +4949,71 @@ var EventListItemDetailsGraphSection = ({
|
|
|
4849
4949
|
no: buildModeData("no")
|
|
4850
4950
|
};
|
|
4851
4951
|
}, [labels, probabilityModeConfigs, selectedOutcomesByMode, venueInfo]);
|
|
4852
|
-
const allOutcomesForHistory = (0, import_react8.useMemo)(() => {
|
|
4853
|
-
const outcomeByModeAndId = /* @__PURE__ */ new Map();
|
|
4854
|
-
probabilityModeOrder.forEach((mode) => {
|
|
4855
|
-
selectedOutcomesByMode[mode].forEach((outcomeByVenue) => {
|
|
4856
|
-
outcomeByModeAndId.set(
|
|
4857
|
-
`${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
|
|
4858
|
-
outcomeByVenue
|
|
4859
|
-
);
|
|
4860
|
-
});
|
|
4861
|
-
});
|
|
4862
|
-
return [...outcomeByModeAndId.values()];
|
|
4863
|
-
}, [selectedOutcomesByMode]);
|
|
4864
|
-
const priceHistoryGroups = (0, import_react8.useMemo)(() => {
|
|
4865
|
-
return buildPriceHistoryGroups(allOutcomesForHistory, canonicalMarketId);
|
|
4866
|
-
}, [allOutcomesForHistory, canonicalMarketId]);
|
|
4867
4952
|
const timeWindow = (0, import_react8.useMemo)(() => {
|
|
4868
4953
|
return getTimeWindowByRange(selectedTimeRange);
|
|
4869
4954
|
}, [selectedTimeRange]);
|
|
4955
|
+
const activeOutcomes = selectedOutcomesByMode[activeProbabilityMode];
|
|
4956
|
+
const activeCanonicalMarketId = (0, import_react8.useMemo)(() => {
|
|
4957
|
+
return resolveCanonicalMarketId(activeOutcomes.map((item) => item.market));
|
|
4958
|
+
}, [activeOutcomes]);
|
|
4959
|
+
const venueMarketIds = (0, import_react8.useMemo)(() => {
|
|
4960
|
+
return activeOutcomes.map((item) => item.market.id);
|
|
4961
|
+
}, [activeOutcomes]);
|
|
4870
4962
|
const {
|
|
4871
|
-
data:
|
|
4872
|
-
isLoading:
|
|
4873
|
-
error:
|
|
4874
|
-
|
|
4875
|
-
} = (0, import_hooks17.
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
}
|
|
4885
|
-
priceHistoryData.forEach((historyItem) => {
|
|
4886
|
-
const venue = historyItem.venue;
|
|
4887
|
-
const venueHistory = historyByVenue.get(venue);
|
|
4888
|
-
if (venueHistory) {
|
|
4889
|
-
venueHistory.push(historyItem);
|
|
4890
|
-
return;
|
|
4891
|
-
}
|
|
4892
|
-
historyByVenue.set(venue, [historyItem]);
|
|
4893
|
-
});
|
|
4894
|
-
return historyByVenue;
|
|
4895
|
-
}, [priceHistoryData]);
|
|
4896
|
-
const chartSeriesByMode = (0, import_react8.useMemo)(() => {
|
|
4897
|
-
const buildSeries = (mode) => {
|
|
4898
|
-
const modeConfig = probabilityModeConfigs[mode];
|
|
4899
|
-
const chartSeries = [];
|
|
4900
|
-
normalizedVenueDataByMode[mode].forEach((venueData) => {
|
|
4901
|
-
var _a;
|
|
4902
|
-
const venueHistory = priceHistoryByVenue.get(venueData.venue);
|
|
4903
|
-
if (!(venueHistory == null ? void 0 : venueHistory.length))
|
|
4904
|
-
return;
|
|
4905
|
-
const candidateIds = resolveOutcomeCandidateIds(venueData.market, venueData.outcome);
|
|
4906
|
-
const matchingHistory = (_a = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a : venueHistory.length === 1 ? venueHistory[0] : void 0;
|
|
4907
|
-
if (!matchingHistory)
|
|
4908
|
-
return;
|
|
4909
|
-
const points = matchingHistory.points.map((point) => {
|
|
4910
|
-
const probability = normalizeProbability(point.price);
|
|
4911
|
-
if (probability == null || !Number.isFinite(point.timestamp))
|
|
4912
|
-
return null;
|
|
4913
|
-
const open = normalizeProbability(point.open);
|
|
4914
|
-
const high = normalizeProbability(point.high);
|
|
4915
|
-
const low = normalizeProbability(point.low);
|
|
4916
|
-
const close = normalizeProbability(point.close);
|
|
4917
|
-
const transformedPoint = {
|
|
4918
|
-
time: point.timestamp,
|
|
4919
|
-
value: clampProbability(modeConfig.transformProbability(probability)) * 100,
|
|
4920
|
-
open: open == null ? void 0 : clampProbability(modeConfig.transformProbability(open)) * 100,
|
|
4921
|
-
high: high == null ? void 0 : clampProbability(modeConfig.transformProbability(high)) * 100,
|
|
4922
|
-
low: low == null ? void 0 : clampProbability(modeConfig.transformProbability(low)) * 100,
|
|
4923
|
-
close: close == null ? void 0 : clampProbability(modeConfig.transformProbability(close)) * 100
|
|
4924
|
-
};
|
|
4925
|
-
return transformedPoint;
|
|
4926
|
-
}).filter((point) => point != null);
|
|
4927
|
-
if (points.length === 0)
|
|
4928
|
-
return;
|
|
4929
|
-
chartSeries.push({
|
|
4930
|
-
id: `${mode}-${venueData.venue}-${matchingHistory.marketId}`,
|
|
4931
|
-
venue: venueData.venue,
|
|
4932
|
-
color: venueData.color,
|
|
4933
|
-
points,
|
|
4934
|
-
lineWidth: 2,
|
|
4935
|
-
lineStyle: "solid"
|
|
4936
|
-
});
|
|
4937
|
-
});
|
|
4938
|
-
return chartSeries;
|
|
4939
|
-
};
|
|
4940
|
-
return {
|
|
4941
|
-
yes: buildSeries("yes"),
|
|
4942
|
-
no: buildSeries("no")
|
|
4943
|
-
};
|
|
4944
|
-
}, [normalizedVenueDataByMode, priceHistoryByVenue, probabilityModeConfigs]);
|
|
4963
|
+
data: marketChartData,
|
|
4964
|
+
isLoading: isMarketChartLoading,
|
|
4965
|
+
error: marketChartError,
|
|
4966
|
+
refetch: refetchMarketChart
|
|
4967
|
+
} = (0, import_hooks17.useMarketChart)({
|
|
4968
|
+
marketId: (_a = selectedMarket == null ? void 0 : selectedMarket.id) != null ? _a : null,
|
|
4969
|
+
venueMarketIds,
|
|
4970
|
+
interval: (0, import_hooks17.timeRangeToInterval)(selectedTimeRange),
|
|
4971
|
+
startTs: timeWindow.startTs * 1e3,
|
|
4972
|
+
endTs: timeWindow.endTs * 1e3,
|
|
4973
|
+
enabled: !!(selectedMarket == null ? void 0 : selectedMarket.id),
|
|
4974
|
+
live: enableLiveUpdates
|
|
4975
|
+
});
|
|
4945
4976
|
const visibleChartSeries = (0, import_react8.useMemo)(() => {
|
|
4946
|
-
const
|
|
4977
|
+
const transformProbability = probabilityModeConfigs[activeProbabilityMode].transformProbability;
|
|
4978
|
+
const colorByVenue = new Map(
|
|
4979
|
+
normalizedVenueDataByMode[activeProbabilityMode].map((venueData) => [
|
|
4980
|
+
venueData.venue,
|
|
4981
|
+
venueData.color
|
|
4982
|
+
])
|
|
4983
|
+
);
|
|
4984
|
+
const series = resolveMarketChartVenueSeries({
|
|
4985
|
+
chartData: marketChartData,
|
|
4986
|
+
transformProbability
|
|
4987
|
+
}).map((seriesItem) => {
|
|
4988
|
+
var _a2;
|
|
4989
|
+
const resolvedVenue = seriesItem.venue;
|
|
4990
|
+
return {
|
|
4991
|
+
id: `${activeProbabilityMode}-${resolvedVenue}-${activeCanonicalMarketId != null ? activeCanonicalMarketId : "chart"}`,
|
|
4992
|
+
venue: resolvedVenue,
|
|
4993
|
+
color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
|
|
4994
|
+
points: seriesItem.points,
|
|
4995
|
+
lineWidth: 2,
|
|
4996
|
+
lineStyle: "solid"
|
|
4997
|
+
};
|
|
4998
|
+
});
|
|
4947
4999
|
if (!selectedVenue)
|
|
4948
|
-
return
|
|
4949
|
-
return
|
|
4950
|
-
}, [
|
|
5000
|
+
return series;
|
|
5001
|
+
return series.filter((seriesItem) => seriesItem.venue === selectedVenue);
|
|
5002
|
+
}, [
|
|
5003
|
+
activeCanonicalMarketId,
|
|
5004
|
+
activeProbabilityMode,
|
|
5005
|
+
marketChartData,
|
|
5006
|
+
normalizedVenueDataByMode,
|
|
5007
|
+
probabilityModeConfigs,
|
|
5008
|
+
selectedVenue
|
|
5009
|
+
]);
|
|
5010
|
+
const chartLiveState = (0, import_react8.useMemo)(() => {
|
|
5011
|
+
return resolveMarketChartLiveState({
|
|
5012
|
+
chartData: marketChartData,
|
|
5013
|
+
selectedVenue,
|
|
5014
|
+
transformProbability: probabilityModeConfigs[activeProbabilityMode].transformProbability
|
|
5015
|
+
});
|
|
5016
|
+
}, [activeProbabilityMode, marketChartData, probabilityModeConfigs, selectedVenue]);
|
|
4951
5017
|
const segmentedDisplayItems = (0, import_react8.useMemo)(() => {
|
|
4952
5018
|
return probabilityModeOrder.map((mode) => {
|
|
4953
5019
|
const averageProbability = resolveAverageProbability(
|
|
@@ -4985,31 +5051,22 @@ var EventListItemDetailsGraphSection = ({
|
|
|
4985
5051
|
return venue;
|
|
4986
5052
|
});
|
|
4987
5053
|
};
|
|
4988
|
-
const
|
|
4989
|
-
void
|
|
5054
|
+
const handleRetryMarketChart = () => {
|
|
5055
|
+
void refetchMarketChart();
|
|
4990
5056
|
};
|
|
4991
|
-
if (
|
|
4992
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4993
|
-
|
|
5057
|
+
if (marketChartError) {
|
|
5058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: cn("w-full", classNames == null ? void 0 : classNames.chart), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5059
|
+
StateMessage,
|
|
4994
5060
|
{
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
5003
|
-
tone: "warning",
|
|
5004
|
-
title: labels.eventItemDetails.chartUnavailableTitle,
|
|
5005
|
-
description: labels.eventItemDetails.chartUnavailableDescription,
|
|
5006
|
-
actionLabel: labels.common.retry,
|
|
5007
|
-
onAction: handleRetryPriceHistory,
|
|
5008
|
-
className: "min-h-[300px] px-5 py-10 md:px-10"
|
|
5009
|
-
}
|
|
5010
|
-
)
|
|
5061
|
+
tone: "warning",
|
|
5062
|
+
ariaLabel: labels.eventItemDetails.chartUnavailableAria,
|
|
5063
|
+
title: labels.eventItemDetails.chartUnavailableTitle,
|
|
5064
|
+
description: labels.eventItemDetails.chartUnavailableDescription,
|
|
5065
|
+
actionLabel: labels.common.retry,
|
|
5066
|
+
onAction: handleRetryMarketChart,
|
|
5067
|
+
className: "min-h-[300px] px-5 py-10 md:px-10"
|
|
5011
5068
|
}
|
|
5012
|
-
);
|
|
5069
|
+
) });
|
|
5013
5070
|
}
|
|
5014
5071
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5015
5072
|
LineChart,
|
|
@@ -5017,8 +5074,10 @@ var EventListItemDetailsGraphSection = ({
|
|
|
5017
5074
|
classNames: { root: classNames == null ? void 0 : classNames.chart },
|
|
5018
5075
|
series: visibleChartSeries,
|
|
5019
5076
|
height: 300,
|
|
5020
|
-
isLoading:
|
|
5077
|
+
isLoading: isMarketChartLoading,
|
|
5021
5078
|
chartType: selectedChartType,
|
|
5079
|
+
liveCandle: selectedChartType === "candlestick" ? (_b = chartLiveState.liveCandle) != null ? _b : void 0 : void 0,
|
|
5080
|
+
lineValue: chartLiveState.lineValue,
|
|
5022
5081
|
showSeriesControls: activeModeVenueData.length > 0 || segmentedDisplayItems.length > 0,
|
|
5023
5082
|
renderSeriesControls: () => {
|
|
5024
5083
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
@@ -5034,7 +5093,7 @@ var EventListItemDetailsGraphSection = ({
|
|
|
5034
5093
|
classNames == null ? void 0 : classNames.outcomeBadges
|
|
5035
5094
|
),
|
|
5036
5095
|
children: activeModeVenueData.map((venueData) => {
|
|
5037
|
-
var
|
|
5096
|
+
var _a2;
|
|
5038
5097
|
const text = venueData.probability == null ? "-" : formatPercent(venueData.probability);
|
|
5039
5098
|
const isActiveVenue = selectedVenue === venueData.venue;
|
|
5040
5099
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
@@ -5051,14 +5110,14 @@ var EventListItemDetailsGraphSection = ({
|
|
|
5051
5110
|
{
|
|
5052
5111
|
text,
|
|
5053
5112
|
size: "large",
|
|
5054
|
-
prefix:
|
|
5113
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5055
5114
|
VenueLogo,
|
|
5056
5115
|
{
|
|
5057
5116
|
venue: venueData.venue,
|
|
5058
5117
|
size: "small",
|
|
5059
|
-
title: (
|
|
5118
|
+
title: (_a2 = venueInfo == null ? void 0 : venueInfo[venueData.venue]) == null ? void 0 : _a2.label
|
|
5060
5119
|
}
|
|
5061
|
-
)
|
|
5120
|
+
),
|
|
5062
5121
|
classNames: {
|
|
5063
5122
|
root: cn("h-9 shrink-0 border-2 px-4 text-agg-base leading-agg-6")
|
|
5064
5123
|
},
|
|
@@ -5099,46 +5158,55 @@ var EventListItemDetailsGraphSection = ({
|
|
|
5099
5158
|
};
|
|
5100
5159
|
var EventListItemDetailsContent = ({
|
|
5101
5160
|
event,
|
|
5102
|
-
title,
|
|
5103
|
-
image,
|
|
5104
|
-
showVenueLogo = true,
|
|
5105
5161
|
classNames,
|
|
5106
5162
|
venueInfo,
|
|
5107
5163
|
detailsStats,
|
|
5108
5164
|
ariaLabel,
|
|
5109
|
-
defaultTimeRange
|
|
5165
|
+
defaultTimeRange,
|
|
5166
|
+
onClick
|
|
5110
5167
|
}) => {
|
|
5111
|
-
var _a
|
|
5168
|
+
var _a;
|
|
5112
5169
|
const config = (0, import_hooks17.useSdkUiConfig)();
|
|
5113
5170
|
const labels = (0, import_hooks17.useLabels)();
|
|
5114
5171
|
const venueMarkets = (0, import_react8.useMemo)(() => {
|
|
5115
|
-
var _a2
|
|
5116
|
-
return (
|
|
5117
|
-
}, [event.
|
|
5172
|
+
var _a2;
|
|
5173
|
+
return (_a2 = event.venueMarkets) != null ? _a2 : [];
|
|
5174
|
+
}, [event.venueMarkets]);
|
|
5175
|
+
const [selectedMarket, setSelectedMarket] = (0, import_react8.useState)(venueMarkets[0]);
|
|
5176
|
+
const [selectedOutcome] = (0, import_react8.useState)(
|
|
5177
|
+
(_a = selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes.find(
|
|
5178
|
+
(outcome) => outcome.winner
|
|
5179
|
+
)) != null ? _a : selectedMarket == null ? void 0 : selectedMarket.venueMarketOutcomes[0]
|
|
5180
|
+
);
|
|
5118
5181
|
const primaryVenueMarket = (0, import_react8.useMemo)(() => {
|
|
5119
5182
|
return selectPrimaryVenueMarket(venueMarkets);
|
|
5120
5183
|
}, [venueMarkets]);
|
|
5184
|
+
const filteredVenueMarkets = (0, import_react8.useMemo)(() => {
|
|
5185
|
+
if (!selectedMarket)
|
|
5186
|
+
return venueMarkets;
|
|
5187
|
+
return venueMarkets.filter(
|
|
5188
|
+
(vm) => vm.question === (selectedMarket == null ? void 0 : selectedMarket.question)
|
|
5189
|
+
);
|
|
5190
|
+
}, [venueMarkets, selectedMarket]);
|
|
5121
5191
|
const outcomeLabels = (0, import_react8.useMemo)(() => {
|
|
5122
|
-
return resolveOutcomeLabels(
|
|
5123
|
-
}, [
|
|
5192
|
+
return resolveOutcomeLabels(filteredVenueMarkets);
|
|
5193
|
+
}, [filteredVenueMarkets]);
|
|
5124
5194
|
const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react8.useState)(() => {
|
|
5125
5195
|
return resolveDefaultOutcomeLabel(outcomeLabels);
|
|
5126
5196
|
});
|
|
5197
|
+
const configTimeRange = config.defaultChartTimeRange;
|
|
5127
5198
|
const [selectedTimeRange, setSelectedTimeRange] = (0, import_react8.useState)(() => {
|
|
5128
|
-
return getDefaultSelectedTimeRange(defaultTimeRange);
|
|
5199
|
+
return getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange);
|
|
5129
5200
|
});
|
|
5130
5201
|
const [selectedChartType, setSelectedChartType] = (0, import_react8.useState)("line");
|
|
5131
5202
|
(0, import_react8.useEffect)(() => {
|
|
5132
|
-
setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange));
|
|
5133
|
-
}, [defaultTimeRange]);
|
|
5134
|
-
const resolvedTitle = resolveTileTitle(event, primaryVenueMarket, title);
|
|
5135
|
-
const resolvedImage = resolveTileImage(event, primaryVenueMarket, image);
|
|
5203
|
+
setSelectedTimeRange(getDefaultSelectedTimeRange(defaultTimeRange, configTimeRange));
|
|
5204
|
+
}, [defaultTimeRange, configTimeRange]);
|
|
5136
5205
|
const isDateOutcomeMarket = outcomeLabels.length > 2 && outcomeLabels.every(isDateLikeLabel);
|
|
5137
|
-
const outcomeSelectorLabels = outcomeLabels;
|
|
5138
5206
|
const probabilityByLabel = (0, import_react8.useMemo)(() => {
|
|
5139
5207
|
return new Map(
|
|
5140
5208
|
outcomeLabels.map((label) => {
|
|
5141
|
-
const outcomesByVenue = resolveOutcomesByVenue(
|
|
5209
|
+
const outcomesByVenue = resolveOutcomesByVenue(filteredVenueMarkets, label);
|
|
5142
5210
|
const probabilities = outcomesByVenue.map((item) => normalizeProbability(item.outcome.price)).filter((value) => value != null);
|
|
5143
5211
|
if (probabilities.length === 0) {
|
|
5144
5212
|
return [label, void 0];
|
|
@@ -5147,14 +5215,14 @@ var EventListItemDetailsContent = ({
|
|
|
5147
5215
|
return [label, averageProbability];
|
|
5148
5216
|
})
|
|
5149
5217
|
);
|
|
5150
|
-
}, [outcomeLabels,
|
|
5218
|
+
}, [outcomeLabels, filteredVenueMarkets]);
|
|
5151
5219
|
const mainOutcomeLabel = (0, import_react8.useMemo)(() => {
|
|
5152
5220
|
if (outcomeLabels.length === 0)
|
|
5153
5221
|
return void 0;
|
|
5154
5222
|
return [...outcomeLabels].sort((left, right) => {
|
|
5155
|
-
var _a2,
|
|
5223
|
+
var _a2, _b;
|
|
5156
5224
|
const leftProbability = (_a2 = probabilityByLabel.get(left)) != null ? _a2 : -1;
|
|
5157
|
-
const rightProbability = (
|
|
5225
|
+
const rightProbability = (_b = probabilityByLabel.get(right)) != null ? _b : -1;
|
|
5158
5226
|
return rightProbability - leftProbability;
|
|
5159
5227
|
})[0];
|
|
5160
5228
|
}, [outcomeLabels, probabilityByLabel]);
|
|
@@ -5170,18 +5238,18 @@ var EventListItemDetailsContent = ({
|
|
|
5170
5238
|
setSelectedOutcomeLabel(fallbackOutcomeLabel);
|
|
5171
5239
|
}, [isDateOutcomeMarket, mainOutcomeLabel, outcomeLabels, selectedOutcomeLabel]);
|
|
5172
5240
|
const switchLabels = (0, import_react8.useMemo)(() => {
|
|
5173
|
-
var _a2,
|
|
5241
|
+
var _a2, _b;
|
|
5174
5242
|
if (isDateOutcomeMarket) {
|
|
5175
5243
|
return [labels.eventItemDetails.yes, labels.eventItemDetails.no];
|
|
5176
5244
|
}
|
|
5177
5245
|
const sortedOutcomeLabels = [...outcomeLabels].sort((left, right) => {
|
|
5178
|
-
var _a3,
|
|
5246
|
+
var _a3, _b2;
|
|
5179
5247
|
const leftProbability = (_a3 = probabilityByLabel.get(left)) != null ? _a3 : -1;
|
|
5180
|
-
const rightProbability = (
|
|
5248
|
+
const rightProbability = (_b2 = probabilityByLabel.get(right)) != null ? _b2 : -1;
|
|
5181
5249
|
return rightProbability - leftProbability;
|
|
5182
5250
|
});
|
|
5183
5251
|
const firstLabel = (_a2 = sortedOutcomeLabels[0]) != null ? _a2 : labels.eventItemDetails.yes;
|
|
5184
|
-
const secondLabel = (
|
|
5252
|
+
const secondLabel = (_b = sortedOutcomeLabels.find((label) => label !== firstLabel)) != null ? _b : firstLabel;
|
|
5185
5253
|
return [firstLabel, secondLabel];
|
|
5186
5254
|
}, [
|
|
5187
5255
|
isDateOutcomeMarket,
|
|
@@ -5198,27 +5266,37 @@ var EventListItemDetailsContent = ({
|
|
|
5198
5266
|
return `${config.formatCompactCurrency(resolvedVolume)} ${labels.eventItemDetails.volumeSuffix}`;
|
|
5199
5267
|
}, [config, event.volume, labels.eventItemDetails.volumeSuffix, primaryVenueMarket == null ? void 0 : primaryVenueMarket.volume]);
|
|
5200
5268
|
if (!primaryVenueMarket || !selectedOutcomeLabel) {
|
|
5201
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5270
|
+
EventListItemDetailsUnavailableState,
|
|
5271
|
+
{
|
|
5272
|
+
classNames,
|
|
5273
|
+
ariaLabel: ariaLabel != null ? ariaLabel : event.title
|
|
5274
|
+
}
|
|
5275
|
+
);
|
|
5202
5276
|
}
|
|
5203
5277
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
5204
5278
|
Card,
|
|
5205
5279
|
{
|
|
5206
5280
|
className: cn(detailsBaseCardClassName, classNames == null ? void 0 : classNames.root),
|
|
5207
|
-
"aria-label": ariaLabel != null ? ariaLabel :
|
|
5281
|
+
"aria-label": ariaLabel != null ? ariaLabel : event.title,
|
|
5282
|
+
onClick: () => {
|
|
5283
|
+
onClick == null ? void 0 : onClick(event);
|
|
5284
|
+
},
|
|
5208
5285
|
children: [
|
|
5209
5286
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
5210
5287
|
"div",
|
|
5211
5288
|
{
|
|
5212
5289
|
className: cn(
|
|
5213
5290
|
"flex flex-row gap-3 md:gap-4",
|
|
5214
|
-
"items-
|
|
5291
|
+
venueMarkets.length > 1 ? "items-start" : "items-center",
|
|
5292
|
+
"justify-start",
|
|
5215
5293
|
classNames == null ? void 0 : classNames.header
|
|
5216
5294
|
),
|
|
5217
5295
|
children: [
|
|
5218
|
-
|
|
5296
|
+
event.image ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5219
5297
|
RemoteImage,
|
|
5220
5298
|
{
|
|
5221
|
-
src:
|
|
5299
|
+
src: event.image,
|
|
5222
5300
|
alt: "",
|
|
5223
5301
|
className: "size-10 rounded-agg-lg object-cover md:size-[60px]"
|
|
5224
5302
|
}
|
|
@@ -5233,19 +5311,18 @@ var EventListItemDetailsContent = ({
|
|
|
5233
5311
|
"truncate text-wrap wrap-break-word line-clamp-2",
|
|
5234
5312
|
classNames == null ? void 0 : classNames.title
|
|
5235
5313
|
),
|
|
5236
|
-
children:
|
|
5314
|
+
children: event.title
|
|
5237
5315
|
}
|
|
5238
5316
|
),
|
|
5239
|
-
|
|
5317
|
+
venueMarkets.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5240
5318
|
"div",
|
|
5241
5319
|
{
|
|
5242
5320
|
className: cn(
|
|
5243
|
-
"flex items-center gap-2 overflow-x-auto pb-1 md:
|
|
5321
|
+
"flex flex-row flex-nowrap items-center gap-2 overflow-x-auto pb-1 md:pb-0",
|
|
5244
5322
|
classNames == null ? void 0 : classNames.headerPills
|
|
5245
5323
|
),
|
|
5246
|
-
children:
|
|
5247
|
-
const isActive =
|
|
5248
|
-
const displayLabel = isDateLikeLabel(outcomeSelectorLabel) ? formatDateLabel(outcomeSelectorLabel) : outcomeSelectorLabel;
|
|
5324
|
+
children: venueMarkets.map((venueMarket) => {
|
|
5325
|
+
const isActive = (selectedMarket == null ? void 0 : selectedMarket.id) === venueMarket.id;
|
|
5249
5326
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5250
5327
|
Button,
|
|
5251
5328
|
{
|
|
@@ -5257,10 +5334,14 @@ var EventListItemDetailsContent = ({
|
|
|
5257
5334
|
"border-2",
|
|
5258
5335
|
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"
|
|
5259
5336
|
),
|
|
5260
|
-
onClick: () =>
|
|
5261
|
-
|
|
5337
|
+
onClick: (e) => {
|
|
5338
|
+
e.stopPropagation();
|
|
5339
|
+
e.preventDefault();
|
|
5340
|
+
setSelectedMarket(venueMarket);
|
|
5341
|
+
},
|
|
5342
|
+
children: venueMarket.question
|
|
5262
5343
|
},
|
|
5263
|
-
|
|
5344
|
+
venueMarket.id
|
|
5264
5345
|
);
|
|
5265
5346
|
})
|
|
5266
5347
|
}
|
|
@@ -5289,14 +5370,14 @@ var EventListItemDetailsContent = ({
|
|
|
5289
5370
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5290
5371
|
EventListItemDetailsGraphSection,
|
|
5291
5372
|
{
|
|
5292
|
-
|
|
5293
|
-
|
|
5373
|
+
selectedOutcome,
|
|
5374
|
+
selectedMarket,
|
|
5375
|
+
venueMarkets: filteredVenueMarkets,
|
|
5294
5376
|
selectedOutcomeLabel,
|
|
5295
5377
|
onSelectedOutcomeLabelChange: setSelectedOutcomeLabel,
|
|
5296
5378
|
switchLabels,
|
|
5297
5379
|
isDateOutcomeMarket,
|
|
5298
5380
|
classNames,
|
|
5299
|
-
showVenueLogo,
|
|
5300
5381
|
venueInfo,
|
|
5301
5382
|
formatPercent: config.formatPercent,
|
|
5302
5383
|
selectedTimeRange,
|
|
@@ -5322,7 +5403,11 @@ var EventListItemDetailsContent = ({
|
|
|
5322
5403
|
isActive ? "font-agg-bold! text-agg-foreground!" : "font-agg-normal! text-agg-muted-foreground!"
|
|
5323
5404
|
),
|
|
5324
5405
|
"aria-pressed": isActive,
|
|
5325
|
-
onClick: () =>
|
|
5406
|
+
onClick: (e) => {
|
|
5407
|
+
e.stopPropagation();
|
|
5408
|
+
e.preventDefault();
|
|
5409
|
+
setSelectedTimeRange(timeRange);
|
|
5410
|
+
},
|
|
5326
5411
|
children: timeRange === "ALL" ? labels.eventItemDetails.allTimeRange : timeRange
|
|
5327
5412
|
},
|
|
5328
5413
|
timeRange
|
|
@@ -5340,18 +5425,20 @@ var EventListItemDetailsByEventId = (_a) => {
|
|
|
5340
5425
|
} = _b, rest = __objRest(_b, [
|
|
5341
5426
|
"eventId"
|
|
5342
5427
|
]);
|
|
5428
|
+
const resolvedEventId = eventId != null ? eventId : "";
|
|
5343
5429
|
const {
|
|
5344
5430
|
event: fetchedEvent,
|
|
5345
5431
|
error,
|
|
5346
5432
|
isError,
|
|
5347
5433
|
isLoading
|
|
5348
|
-
} = (0, import_hooks17.
|
|
5349
|
-
|
|
5434
|
+
} = (0, import_hooks17.useVenueEvent)({
|
|
5435
|
+
eventId: resolvedEventId,
|
|
5436
|
+
enabled: !!resolvedEventId
|
|
5350
5437
|
});
|
|
5351
5438
|
const resolvedEvent = (0, import_react8.useMemo)(() => {
|
|
5352
5439
|
return resolveEventListItemEvent(fetchedEvent);
|
|
5353
5440
|
}, [fetchedEvent]);
|
|
5354
|
-
if (!
|
|
5441
|
+
if (!resolvedEventId) {
|
|
5355
5442
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5356
5443
|
EventListItemDetailsUnavailableState,
|
|
5357
5444
|
{
|
|
@@ -5390,26 +5477,22 @@ var EventListItemDetails = (props) => {
|
|
|
5390
5477
|
}
|
|
5391
5478
|
if ("eventId" in props && typeof props.eventId === "string") {
|
|
5392
5479
|
const {
|
|
5393
|
-
title: titleOverride,
|
|
5394
|
-
image: imageOverride,
|
|
5395
|
-
showVenueLogo: showVenueLogoOverride,
|
|
5396
5480
|
classNames,
|
|
5397
5481
|
venueInfo,
|
|
5398
5482
|
detailsStats,
|
|
5399
5483
|
ariaLabel: ariaLabelOverride,
|
|
5400
|
-
defaultTimeRange: defaultTimeRangeOverride
|
|
5484
|
+
defaultTimeRange: defaultTimeRangeOverride,
|
|
5485
|
+
onClick
|
|
5401
5486
|
} = props;
|
|
5402
5487
|
const byEventIdProps = {
|
|
5403
5488
|
eventId: props.eventId,
|
|
5404
5489
|
isLoading: false,
|
|
5405
|
-
title: titleOverride,
|
|
5406
|
-
image: imageOverride,
|
|
5407
|
-
showVenueLogo: showVenueLogoOverride,
|
|
5408
5490
|
classNames,
|
|
5409
5491
|
venueInfo,
|
|
5410
5492
|
detailsStats,
|
|
5411
5493
|
ariaLabel: ariaLabelOverride,
|
|
5412
|
-
defaultTimeRange: defaultTimeRangeOverride
|
|
5494
|
+
defaultTimeRange: defaultTimeRangeOverride,
|
|
5495
|
+
onClick
|
|
5413
5496
|
};
|
|
5414
5497
|
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(EventListItemDetailsByEventId, __spreadValues({}, byEventIdProps));
|
|
5415
5498
|
}
|
|
@@ -5456,12 +5539,47 @@ var resolveInitialTab = (defaultTab) => {
|
|
|
5456
5539
|
return parsedTab.data;
|
|
5457
5540
|
return "order-book";
|
|
5458
5541
|
};
|
|
5459
|
-
var
|
|
5460
|
-
|
|
5542
|
+
var resolveMarketFromVenueMarkets = (venueMarkets, marketId) => {
|
|
5543
|
+
var _a, _b;
|
|
5544
|
+
if (!venueMarkets || venueMarkets.length === 0)
|
|
5545
|
+
return void 0;
|
|
5546
|
+
if (!marketId) {
|
|
5547
|
+
const primary = selectPrimaryVenueMarket(venueMarkets);
|
|
5548
|
+
const totalVolume2 = venueMarkets.reduce((sum, vm) => {
|
|
5549
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
5550
|
+
}, 0);
|
|
5551
|
+
return {
|
|
5552
|
+
id: (_a = primary == null ? void 0 : primary.id) != null ? _a : venueMarkets[0].id,
|
|
5553
|
+
venueMarkets,
|
|
5554
|
+
volume: totalVolume2 || (primary == null ? void 0 : primary.volume),
|
|
5555
|
+
status: primary == null ? void 0 : primary.status,
|
|
5556
|
+
startDate: primary == null ? void 0 : primary.startDate,
|
|
5557
|
+
endDate: primary == null ? void 0 : primary.endDate,
|
|
5558
|
+
creationDate: primary == null ? void 0 : primary.creationDate,
|
|
5559
|
+
question: (_b = primary == null ? void 0 : primary.question) != null ? _b : venueMarkets[0].question
|
|
5560
|
+
};
|
|
5561
|
+
}
|
|
5562
|
+
const matchedVenueMarket = venueMarkets.find(
|
|
5563
|
+
(vm) => vm.id === marketId || vm.externalIdentifier === marketId
|
|
5564
|
+
);
|
|
5565
|
+
if (!matchedVenueMarket)
|
|
5461
5566
|
return void 0;
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5567
|
+
const siblingVenueMarkets = venueMarkets.filter(
|
|
5568
|
+
(vm) => vm.question === matchedVenueMarket.question
|
|
5569
|
+
);
|
|
5570
|
+
const totalVolume = siblingVenueMarkets.reduce((sum, vm) => {
|
|
5571
|
+
return sum + (typeof vm.volume === "number" ? vm.volume : 0);
|
|
5572
|
+
}, 0);
|
|
5573
|
+
return {
|
|
5574
|
+
id: matchedVenueMarket.id,
|
|
5575
|
+
venueMarkets: siblingVenueMarkets,
|
|
5576
|
+
volume: totalVolume || matchedVenueMarket.volume,
|
|
5577
|
+
status: matchedVenueMarket.status,
|
|
5578
|
+
startDate: matchedVenueMarket.startDate,
|
|
5579
|
+
endDate: matchedVenueMarket.endDate,
|
|
5580
|
+
creationDate: matchedVenueMarket.creationDate,
|
|
5581
|
+
question: matchedVenueMarket.question
|
|
5582
|
+
};
|
|
5465
5583
|
};
|
|
5466
5584
|
var resolveDisplayOutcomeLabels = (labels) => {
|
|
5467
5585
|
if (!hasBinaryLabels(labels))
|
|
@@ -5529,7 +5647,8 @@ var resolveHeaderOutcomeItems = (venueMarkets, defaultOutcomeLabel) => {
|
|
|
5529
5647
|
label,
|
|
5530
5648
|
probability: probabilityByLabel.get(label),
|
|
5531
5649
|
tone: resolveOutcomeTone(label, index),
|
|
5532
|
-
isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : "")
|
|
5650
|
+
isDefault: normalizeLabel2(label) === normalizeLabel2((_a = defaultOutcomeLabel != null ? defaultOutcomeLabel : labels[0]) != null ? _a : ""),
|
|
5651
|
+
venue: venueMarkets[0].venue
|
|
5533
5652
|
};
|
|
5534
5653
|
});
|
|
5535
5654
|
};
|
|
@@ -5620,23 +5739,23 @@ var resolveOtherTabRows = (market, labels) => {
|
|
|
5620
5739
|
return rows;
|
|
5621
5740
|
};
|
|
5622
5741
|
var buildMarketDetailsModel = ({
|
|
5623
|
-
|
|
5742
|
+
venueMarkets,
|
|
5624
5743
|
marketId,
|
|
5625
5744
|
title,
|
|
5626
5745
|
image,
|
|
5627
5746
|
formatCompactCurrency,
|
|
5628
5747
|
labels
|
|
5629
5748
|
}) => {
|
|
5630
|
-
var _a;
|
|
5631
|
-
const market =
|
|
5749
|
+
var _a, _b;
|
|
5750
|
+
const market = resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
5632
5751
|
if (!market)
|
|
5633
5752
|
return void 0;
|
|
5634
5753
|
const primaryVenueMarket = selectPrimaryVenueMarket(market.venueMarkets);
|
|
5635
5754
|
if (!primaryVenueMarket)
|
|
5636
5755
|
return void 0;
|
|
5637
|
-
const resolvedTitle =
|
|
5638
|
-
const resolvedImage =
|
|
5639
|
-
const resolvedVolume = typeof market.volume === "number" ? market.volume : (
|
|
5756
|
+
const resolvedTitle = (title == null ? void 0 : title.trim()) || primaryVenueMarket.question || market.question;
|
|
5757
|
+
const resolvedImage = (_a = typeof image === "string" && image.trim() ? image : void 0) != null ? _a : typeof primaryVenueMarket.image === "string" && primaryVenueMarket.image.trim() ? primaryVenueMarket.image : void 0;
|
|
5758
|
+
const resolvedVolume = typeof market.volume === "number" ? market.volume : (_b = primaryVenueMarket.volume) != null ? _b : void 0;
|
|
5640
5759
|
const subtitle = resolveSubtitle({
|
|
5641
5760
|
venueMarkets: market.venueMarkets,
|
|
5642
5761
|
volume: resolvedVolume,
|
|
@@ -5782,7 +5901,7 @@ var getOutcomeButtonClassName = ({
|
|
|
5782
5901
|
);
|
|
5783
5902
|
};
|
|
5784
5903
|
var MarketDetailsContent = ({
|
|
5785
|
-
|
|
5904
|
+
venueMarkets,
|
|
5786
5905
|
marketId,
|
|
5787
5906
|
title,
|
|
5788
5907
|
image,
|
|
@@ -5790,28 +5909,29 @@ var MarketDetailsContent = ({
|
|
|
5790
5909
|
onOpenChange,
|
|
5791
5910
|
defaultTab,
|
|
5792
5911
|
defaultOutcomeLabel,
|
|
5793
|
-
defaultTimeRange
|
|
5912
|
+
defaultTimeRange,
|
|
5794
5913
|
orderBookDepth = orderBookRowLimitDefault,
|
|
5795
5914
|
ariaLabel,
|
|
5796
5915
|
classNames,
|
|
5797
5916
|
otherContent
|
|
5798
5917
|
}) => {
|
|
5918
|
+
var _a, _b, _c, _d;
|
|
5799
5919
|
const config = (0, import_hooks18.useSdkUiConfig)();
|
|
5800
5920
|
const labels = (0, import_hooks18.useLabels)();
|
|
5801
5921
|
const detailsContentId = (0, import_react9.useId)();
|
|
5802
5922
|
const model = (0, import_react9.useMemo)(() => {
|
|
5803
5923
|
return buildMarketDetailsModel({
|
|
5804
|
-
|
|
5924
|
+
venueMarkets,
|
|
5805
5925
|
marketId,
|
|
5806
5926
|
title,
|
|
5807
5927
|
image,
|
|
5808
5928
|
formatCompactCurrency: config.formatCompactCurrency,
|
|
5809
5929
|
labels
|
|
5810
5930
|
});
|
|
5811
|
-
}, [config.formatCompactCurrency,
|
|
5931
|
+
}, [config.formatCompactCurrency, venueMarkets, image, labels, marketId, title]);
|
|
5812
5932
|
const resolvedMarket = (0, import_react9.useMemo)(() => {
|
|
5813
|
-
return
|
|
5814
|
-
}, [
|
|
5933
|
+
return resolveMarketFromVenueMarkets(venueMarkets, marketId);
|
|
5934
|
+
}, [venueMarkets, marketId]);
|
|
5815
5935
|
const marketDetailsTabs = (0, import_react9.useMemo)(() => {
|
|
5816
5936
|
return getMarketDetailsTabs(labels);
|
|
5817
5937
|
}, [labels]);
|
|
@@ -5822,22 +5942,23 @@ var MarketDetailsContent = ({
|
|
|
5822
5942
|
(0, import_react9.useEffect)(() => {
|
|
5823
5943
|
setSelectedTab(resolveInitialTab(defaultTab));
|
|
5824
5944
|
}, [defaultTab]);
|
|
5825
|
-
const
|
|
5945
|
+
const resolvedDefaultTimeRange = (_a = defaultTimeRange != null ? defaultTimeRange : config.defaultChartTimeRange) != null ? _a : "1D";
|
|
5946
|
+
const [selectedTimeRange, setSelectedTimeRange] = (0, import_react9.useState)(resolvedDefaultTimeRange);
|
|
5826
5947
|
const [selectedChartType, setSelectedChartType] = (0, import_react9.useState)("line");
|
|
5827
5948
|
(0, import_react9.useEffect)(() => {
|
|
5828
|
-
setSelectedTimeRange(
|
|
5829
|
-
}, [
|
|
5949
|
+
setSelectedTimeRange(resolvedDefaultTimeRange);
|
|
5950
|
+
}, [resolvedDefaultTimeRange]);
|
|
5830
5951
|
const [selectedOutcomeLabel, setSelectedOutcomeLabel] = (0, import_react9.useState)(
|
|
5831
5952
|
() => {
|
|
5832
|
-
var
|
|
5833
|
-
return resolveInitialOutcomeLabel((
|
|
5953
|
+
var _a2;
|
|
5954
|
+
return resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel);
|
|
5834
5955
|
}
|
|
5835
5956
|
);
|
|
5836
5957
|
const [selectedGraphVenue, setSelectedGraphVenue] = (0, import_react9.useState)(null);
|
|
5837
5958
|
(0, import_react9.useEffect)(() => {
|
|
5838
|
-
var
|
|
5959
|
+
var _a2;
|
|
5839
5960
|
setSelectedOutcomeLabel(
|
|
5840
|
-
resolveInitialOutcomeLabel((
|
|
5961
|
+
resolveInitialOutcomeLabel((_a2 = model == null ? void 0 : model.outcomeLabels) != null ? _a2 : [], defaultOutcomeLabel)
|
|
5841
5962
|
);
|
|
5842
5963
|
}, [defaultOutcomeLabel, model == null ? void 0 : model.outcomeLabels]);
|
|
5843
5964
|
const headerOutcomeItems = (0, import_react9.useMemo)(() => {
|
|
@@ -5864,51 +5985,66 @@ var MarketDetailsContent = ({
|
|
|
5864
5985
|
return outcomesByLabelMap;
|
|
5865
5986
|
}, [headerOutcomeItems, model]);
|
|
5866
5987
|
const selectedOutcomesByVenue = (0, import_react9.useMemo)(() => {
|
|
5867
|
-
var
|
|
5988
|
+
var _a2;
|
|
5868
5989
|
if (!selectedOutcomeLabel)
|
|
5869
5990
|
return [];
|
|
5870
|
-
return (
|
|
5991
|
+
return (_a2 = outcomesByLabel.get(selectedOutcomeLabel)) != null ? _a2 : [];
|
|
5871
5992
|
}, [outcomesByLabel, selectedOutcomeLabel]);
|
|
5993
|
+
const chartEnabled = isOpened && selectedTab === "graph";
|
|
5994
|
+
const orderBookEnabled = isOpened && selectedTab === "order-book";
|
|
5872
5995
|
const timeWindow = (0, import_react9.useMemo)(() => {
|
|
5873
5996
|
return getTimeWindowByRange(selectedTimeRange);
|
|
5874
5997
|
}, [selectedTimeRange]);
|
|
5875
|
-
const
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
outcomes.forEach((outcomeByVenue) => {
|
|
5879
|
-
uniqueOutcomesByVenueAndId.set(
|
|
5880
|
-
`${outcomeByVenue.venue}:${outcomeByVenue.outcome.id}`,
|
|
5881
|
-
outcomeByVenue
|
|
5882
|
-
);
|
|
5883
|
-
});
|
|
5884
|
-
});
|
|
5885
|
-
return [...uniqueOutcomesByVenueAndId.values()];
|
|
5886
|
-
}, [outcomesByLabel]);
|
|
5887
|
-
const canonicalMarketIdForHistory = model == null ? void 0 : model.market.id;
|
|
5888
|
-
const priceHistoryGroups = (0, import_react9.useMemo)(() => {
|
|
5889
|
-
return buildPriceHistoryGroups(graphOutcomes, canonicalMarketIdForHistory);
|
|
5890
|
-
}, [canonicalMarketIdForHistory, graphOutcomes]);
|
|
5891
|
-
const { data: priceHistoryData, isLoading: isPriceHistoryLoading } = (0, import_hooks18.usePriceHistory)(__spreadProps(__spreadValues({
|
|
5892
|
-
groups: priceHistoryGroups
|
|
5893
|
-
}, timeWindow), {
|
|
5894
|
-
enabled: isOpened && selectedTab === "graph" && priceHistoryGroups.length > 0
|
|
5895
|
-
}));
|
|
5896
|
-
const orderBookInputs = (0, import_react9.useMemo)(() => {
|
|
5897
|
-
return selectedOutcomesByVenue.map(({ market, outcome }) => ({
|
|
5898
|
-
market,
|
|
5899
|
-
outcome,
|
|
5900
|
-
liveUpdate: true
|
|
5901
|
-
}));
|
|
5998
|
+
const primaryVenueMarketId = (_c = (_b = selectedOutcomesByVenue[0]) == null ? void 0 : _b.market.id) != null ? _c : null;
|
|
5999
|
+
const venueMarketIds = (0, import_react9.useMemo)(() => {
|
|
6000
|
+
return selectedOutcomesByVenue.map((item) => item.market.id);
|
|
5902
6001
|
}, [selectedOutcomesByVenue]);
|
|
5903
6002
|
const {
|
|
5904
|
-
data:
|
|
6003
|
+
data: marketChartData,
|
|
6004
|
+
isLoading: isMarketChartLoading,
|
|
6005
|
+
error: marketChartError,
|
|
6006
|
+
refetch: refetchMarketChart
|
|
6007
|
+
} = (0, import_hooks18.useMarketChart)({
|
|
6008
|
+
marketId: primaryVenueMarketId,
|
|
6009
|
+
venueMarketIds,
|
|
6010
|
+
interval: (0, import_hooks18.timeRangeToInterval)(selectedTimeRange),
|
|
6011
|
+
startTs: timeWindow.startTs * 1e3,
|
|
6012
|
+
endTs: timeWindow.endTs * 1e3,
|
|
6013
|
+
enabled: chartEnabled && !!primaryVenueMarketId
|
|
6014
|
+
});
|
|
6015
|
+
const {
|
|
6016
|
+
data: marketOrderbookData,
|
|
5905
6017
|
isLoading: isOrderBookLoading,
|
|
5906
6018
|
error: orderBookError,
|
|
5907
|
-
|
|
5908
|
-
} = (0, import_hooks18.
|
|
5909
|
-
|
|
5910
|
-
enabled:
|
|
6019
|
+
refetch: refetchOrderBook
|
|
6020
|
+
} = (0, import_hooks18.useMarketOrderbook)({
|
|
6021
|
+
marketId: primaryVenueMarketId,
|
|
6022
|
+
enabled: orderBookEnabled && !!primaryVenueMarketId,
|
|
6023
|
+
venueOutcomes: selectedOutcomesByVenue.map((item) => ({
|
|
6024
|
+
venue: item.market.venue,
|
|
6025
|
+
venueMarketOutcomeId: item.outcome.id
|
|
6026
|
+
}))
|
|
5911
6027
|
});
|
|
6028
|
+
const orderBookData = (0, import_react9.useMemo)(() => {
|
|
6029
|
+
if (!marketOrderbookData)
|
|
6030
|
+
return void 0;
|
|
6031
|
+
const results = selectedOutcomesByVenue.flatMap(({ market, outcome }) => {
|
|
6032
|
+
const venueOrderbook = marketOrderbookData.venueOrderbooks[market.venue];
|
|
6033
|
+
if (!venueOrderbook)
|
|
6034
|
+
return [];
|
|
6035
|
+
return [
|
|
6036
|
+
{
|
|
6037
|
+
market,
|
|
6038
|
+
outcome,
|
|
6039
|
+
orderbook: {
|
|
6040
|
+
bids: venueOrderbook.bids,
|
|
6041
|
+
asks: venueOrderbook.asks
|
|
6042
|
+
}
|
|
6043
|
+
}
|
|
6044
|
+
];
|
|
6045
|
+
});
|
|
6046
|
+
return results.length === selectedOutcomesByVenue.length ? results : void 0;
|
|
6047
|
+
}, [marketOrderbookData, selectedOutcomesByVenue]);
|
|
5912
6048
|
const askRows = (0, import_react9.useMemo)(() => {
|
|
5913
6049
|
return resolveOrderBookRows({
|
|
5914
6050
|
data: orderBookData,
|
|
@@ -5921,88 +6057,54 @@ var MarketDetailsContent = ({
|
|
|
5921
6057
|
side: "bids"
|
|
5922
6058
|
});
|
|
5923
6059
|
}, [orderBookData]);
|
|
5924
|
-
const priceHistoryByVenue = (0, import_react9.useMemo)(() => {
|
|
5925
|
-
const historyByVenue = /* @__PURE__ */ new Map();
|
|
5926
|
-
if (!(priceHistoryData == null ? void 0 : priceHistoryData.length)) {
|
|
5927
|
-
return historyByVenue;
|
|
5928
|
-
}
|
|
5929
|
-
priceHistoryData.forEach((historyItem) => {
|
|
5930
|
-
const venue = historyItem.venue;
|
|
5931
|
-
const venueHistory = historyByVenue.get(venue);
|
|
5932
|
-
if (venueHistory) {
|
|
5933
|
-
venueHistory.push(historyItem);
|
|
5934
|
-
return;
|
|
5935
|
-
}
|
|
5936
|
-
historyByVenue.set(venue, [historyItem]);
|
|
5937
|
-
});
|
|
5938
|
-
return historyByVenue;
|
|
5939
|
-
}, [priceHistoryData]);
|
|
5940
|
-
const graphSeriesByOutcomeLabel = (0, import_react9.useMemo)(() => {
|
|
5941
|
-
const seriesByOutcomeLabel = /* @__PURE__ */ new Map();
|
|
5942
|
-
const resolveOutcomeCandidateIds2 = (outcomeByVenue) => {
|
|
5943
|
-
var _a, _b;
|
|
5944
|
-
const marketWithCanonicalId = outcomeByVenue.market;
|
|
5945
|
-
return [
|
|
5946
|
-
outcomeByVenue.outcome.id,
|
|
5947
|
-
(_a = outcomeByVenue.outcome.externalIdentifier) != null ? _a : void 0,
|
|
5948
|
-
outcomeByVenue.market.externalIdentifier,
|
|
5949
|
-
(_b = marketWithCanonicalId.marketId) != null ? _b : void 0,
|
|
5950
|
-
canonicalMarketIdForHistory
|
|
5951
|
-
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
5952
|
-
};
|
|
5953
|
-
headerOutcomeItems.forEach((headerOutcomeItem) => {
|
|
5954
|
-
var _a;
|
|
5955
|
-
const outcomes = (_a = outcomesByLabel.get(headerOutcomeItem.label)) != null ? _a : [];
|
|
5956
|
-
const graphSeries2 = [];
|
|
5957
|
-
outcomes.forEach((outcomeByVenue, index) => {
|
|
5958
|
-
var _a2;
|
|
5959
|
-
const venueHistory = priceHistoryByVenue.get(outcomeByVenue.venue);
|
|
5960
|
-
if (!(venueHistory == null ? void 0 : venueHistory.length))
|
|
5961
|
-
return;
|
|
5962
|
-
const candidateIds = resolveOutcomeCandidateIds2(outcomeByVenue);
|
|
5963
|
-
const matchingHistory = (_a2 = venueHistory.find((historyItem) => candidateIds.includes(historyItem.marketId))) != null ? _a2 : venueHistory.length === 1 ? venueHistory[0] : void 0;
|
|
5964
|
-
if (!matchingHistory)
|
|
5965
|
-
return;
|
|
5966
|
-
const points = matchingHistory.points.map((point) => ({
|
|
5967
|
-
time: point.timestamp,
|
|
5968
|
-
value: point.price * 100,
|
|
5969
|
-
open: point.open == null ? void 0 : point.open * 100,
|
|
5970
|
-
high: point.high == null ? void 0 : point.high * 100,
|
|
5971
|
-
low: point.low == null ? void 0 : point.low * 100,
|
|
5972
|
-
close: point.close == null ? void 0 : point.close * 100
|
|
5973
|
-
})).filter((point) => Number.isFinite(point.time) && Number.isFinite(point.value));
|
|
5974
|
-
if (points.length === 0)
|
|
5975
|
-
return;
|
|
5976
|
-
graphSeries2.push({
|
|
5977
|
-
id: `${headerOutcomeItem.label}-${outcomeByVenue.venue}-${matchingHistory.marketId}`,
|
|
5978
|
-
venue: outcomeByVenue.venue,
|
|
5979
|
-
color: resolveSeriesColor(outcomeByVenue.venue, index),
|
|
5980
|
-
points
|
|
5981
|
-
});
|
|
5982
|
-
});
|
|
5983
|
-
seriesByOutcomeLabel.set(headerOutcomeItem.label, graphSeries2);
|
|
5984
|
-
});
|
|
5985
|
-
return seriesByOutcomeLabel;
|
|
5986
|
-
}, [canonicalMarketIdForHistory, headerOutcomeItems, outcomesByLabel, priceHistoryByVenue]);
|
|
5987
6060
|
const graphSeries = (0, import_react9.useMemo)(() => {
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
6061
|
+
const colorByVenue = new Map(
|
|
6062
|
+
selectedOutcomesByVenue.map((item, index) => [
|
|
6063
|
+
item.venue,
|
|
6064
|
+
resolveSeriesColor(item.venue, index)
|
|
6065
|
+
])
|
|
6066
|
+
);
|
|
6067
|
+
const seriesForOutcomeLabel = resolveMarketChartVenueSeries({
|
|
6068
|
+
chartData: marketChartData,
|
|
6069
|
+
transformProbability: (value) => value
|
|
6070
|
+
}).map((seriesItem) => {
|
|
6071
|
+
var _a2;
|
|
6072
|
+
const resolvedVenue = seriesItem.venue;
|
|
6073
|
+
return {
|
|
6074
|
+
id: `${selectedOutcomeLabel != null ? selectedOutcomeLabel : "graph"}-${resolvedVenue}-${primaryVenueMarketId != null ? primaryVenueMarketId : "chart"}`,
|
|
6075
|
+
venue: resolvedVenue,
|
|
6076
|
+
color: (_a2 = colorByVenue.get(resolvedVenue)) != null ? _a2 : resolveSeriesColor(resolvedVenue, 0),
|
|
6077
|
+
points: seriesItem.points
|
|
6078
|
+
};
|
|
6079
|
+
});
|
|
5992
6080
|
if (!selectedGraphVenue)
|
|
5993
6081
|
return seriesForOutcomeLabel;
|
|
5994
6082
|
return seriesForOutcomeLabel.filter((seriesItem) => seriesItem.venue === selectedGraphVenue);
|
|
5995
|
-
}, [
|
|
6083
|
+
}, [
|
|
6084
|
+
primaryVenueMarketId,
|
|
6085
|
+
marketChartData,
|
|
6086
|
+
selectedGraphVenue,
|
|
6087
|
+
selectedOutcomeLabel,
|
|
6088
|
+
selectedOutcomesByVenue
|
|
6089
|
+
]);
|
|
6090
|
+
const graphLiveState = (0, import_react9.useMemo)(() => {
|
|
6091
|
+
return resolveMarketChartLiveState({
|
|
6092
|
+
chartData: marketChartData,
|
|
6093
|
+
selectedVenue: selectedGraphVenue,
|
|
6094
|
+
transformProbability: (value) => value
|
|
6095
|
+
});
|
|
6096
|
+
}, [marketChartData, selectedGraphVenue]);
|
|
5996
6097
|
const otherRows = (0, import_react9.useMemo)(() => {
|
|
5997
6098
|
if (!model)
|
|
5998
6099
|
return [];
|
|
5999
6100
|
return resolveOtherTabRows(model.market, labels);
|
|
6000
6101
|
}, [labels, model]);
|
|
6001
|
-
const isOrderBookNotFound =
|
|
6102
|
+
const isOrderBookNotFound = orderBookError && typeof orderBookError === "object" && "status" in orderBookError && orderBookError.status === 404;
|
|
6002
6103
|
const hasOrderBookError = !!orderBookError && !isOrderBookNotFound;
|
|
6003
|
-
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (
|
|
6104
|
+
const hasNoOrderBook = isOrderBookNotFound || !isOrderBookLoading && !hasOrderBookError && (selectedOutcomesByVenue.length === 0 || askRows.length === 0 && bidRows.length === 0);
|
|
6105
|
+
const hasChartError = !!marketChartError;
|
|
6004
6106
|
const handleOutcomeKeyDown = (eventToHandle) => {
|
|
6005
|
-
var
|
|
6107
|
+
var _a2;
|
|
6006
6108
|
if ((eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowLeft" && (eventToHandle == null ? void 0 : eventToHandle.key) !== "ArrowRight") {
|
|
6007
6109
|
return;
|
|
6008
6110
|
}
|
|
@@ -6013,14 +6115,14 @@ var MarketDetailsContent = ({
|
|
|
6013
6115
|
});
|
|
6014
6116
|
const direction = eventToHandle.key === "ArrowRight" ? 1 : -1;
|
|
6015
6117
|
const nextIndex = activeIndex < 0 ? 0 : (activeIndex + direction + headerOutcomeItems.length) % headerOutcomeItems.length;
|
|
6016
|
-
setSelectedOutcomeLabel((
|
|
6118
|
+
setSelectedOutcomeLabel((_a2 = headerOutcomeItems[nextIndex]) == null ? void 0 : _a2.label);
|
|
6017
6119
|
};
|
|
6018
|
-
const handleToggleExpanded = (
|
|
6019
|
-
if (
|
|
6120
|
+
const handleToggleExpanded = (event) => {
|
|
6121
|
+
if (event && "key" in event && (event == null ? void 0 : event.key) !== "Enter" && (event == null ? void 0 : event.key) !== " ") {
|
|
6020
6122
|
return;
|
|
6021
6123
|
}
|
|
6022
|
-
|
|
6023
|
-
|
|
6124
|
+
event == null ? void 0 : event.preventDefault();
|
|
6125
|
+
event == null ? void 0 : event.stopPropagation();
|
|
6024
6126
|
setIsOpened((prev) => {
|
|
6025
6127
|
const next = !prev;
|
|
6026
6128
|
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
@@ -6035,7 +6137,10 @@ var MarketDetailsContent = ({
|
|
|
6035
6137
|
});
|
|
6036
6138
|
};
|
|
6037
6139
|
const handleRetryOrderBook = () => {
|
|
6038
|
-
void
|
|
6140
|
+
void refetchOrderBook();
|
|
6141
|
+
};
|
|
6142
|
+
const handleRetryMarketChart = () => {
|
|
6143
|
+
void refetchMarketChart();
|
|
6039
6144
|
};
|
|
6040
6145
|
(0, import_react9.useEffect)(() => {
|
|
6041
6146
|
if (!selectedGraphVenue) {
|
|
@@ -6078,7 +6183,7 @@ var MarketDetailsContent = ({
|
|
|
6078
6183
|
onClick: handleToggleExpanded,
|
|
6079
6184
|
onKeyDown: handleToggleExpanded,
|
|
6080
6185
|
children: [
|
|
6081
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-52 items-center gap-3 md:gap-4", children: [
|
|
6186
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex min-w-52 max-w-3/4 items-center gap-3 md:gap-4", children: [
|
|
6082
6187
|
model.image ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6083
6188
|
RemoteImage,
|
|
6084
6189
|
{
|
|
@@ -6125,7 +6230,7 @@ var MarketDetailsContent = ({
|
|
|
6125
6230
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6126
6231
|
VenueLogo,
|
|
6127
6232
|
{
|
|
6128
|
-
venue:
|
|
6233
|
+
venue: "polymarket",
|
|
6129
6234
|
size: "small",
|
|
6130
6235
|
color: isActiveOutcome ? "var(--agg-color-on-primary)" : void 0
|
|
6131
6236
|
}
|
|
@@ -6232,13 +6337,26 @@ var MarketDetailsContent = ({
|
|
|
6232
6337
|
)
|
|
6233
6338
|
] }) }) : null,
|
|
6234
6339
|
selectedTab === "graph" ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-col gap-5", classNames == null ? void 0 : classNames.graph), children: [
|
|
6235
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6340
|
+
hasChartError ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6341
|
+
StateMessage,
|
|
6342
|
+
{
|
|
6343
|
+
ariaLabel: labels.marketDetails.chartUnavailableAria,
|
|
6344
|
+
tone: "warning",
|
|
6345
|
+
title: labels.marketDetails.chartUnavailableTitle,
|
|
6346
|
+
description: labels.marketDetails.chartUnavailableDescription,
|
|
6347
|
+
actionLabel: labels.common.retry,
|
|
6348
|
+
onAction: handleRetryMarketChart,
|
|
6349
|
+
className: "min-h-[248px] px-5 py-10 md:min-h-[272px]"
|
|
6350
|
+
}
|
|
6351
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6236
6352
|
LineChart,
|
|
6237
6353
|
{
|
|
6238
6354
|
series: graphSeries,
|
|
6239
6355
|
height: 260,
|
|
6240
|
-
isLoading:
|
|
6356
|
+
isLoading: isMarketChartLoading,
|
|
6241
6357
|
chartType: selectedChartType,
|
|
6358
|
+
liveCandle: selectedChartType === "candlestick" ? (_d = graphLiveState.liveCandle) != null ? _d : void 0 : void 0,
|
|
6359
|
+
lineValue: graphLiveState.lineValue,
|
|
6242
6360
|
classNames: { root: "w-full" },
|
|
6243
6361
|
showSeriesControls: selectedOutcomesByVenue.length > 0 || headerOutcomeItems.length > 0,
|
|
6244
6362
|
renderSeriesControls: () => {
|
|
@@ -6379,14 +6497,6 @@ var MarketDetails = (props) => {
|
|
|
6379
6497
|
}
|
|
6380
6498
|
(_a2 = props.onOpenChange) == null ? void 0 : _a2.call(props, nextIsOpened);
|
|
6381
6499
|
};
|
|
6382
|
-
const hasEventProp = "event" in props && !!props.event;
|
|
6383
|
-
const {
|
|
6384
|
-
event: fetchedEvent,
|
|
6385
|
-
error: eventError,
|
|
6386
|
-
isLoading: isFetchingEvent
|
|
6387
|
-
} = (0, import_hooks18.useEvent)(hasEventProp ? void 0 : props.eventId, {
|
|
6388
|
-
enabled: !props.isLoading && !hasEventProp && !!props.eventId
|
|
6389
|
-
});
|
|
6390
6500
|
if (props.isLoading) {
|
|
6391
6501
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6392
6502
|
MarketDetailsLoadingState,
|
|
@@ -6397,42 +6507,115 @@ var MarketDetails = (props) => {
|
|
|
6397
6507
|
}
|
|
6398
6508
|
);
|
|
6399
6509
|
}
|
|
6400
|
-
if ("
|
|
6510
|
+
if ("venueMarkets" in props && props.venueMarkets) {
|
|
6401
6511
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6402
6512
|
MarketDetailsContent,
|
|
6403
6513
|
__spreadProps(__spreadValues({}, props), {
|
|
6404
6514
|
isOpened: resolvedIsOpened,
|
|
6405
6515
|
onOpenChange: handleOpenChange,
|
|
6406
|
-
|
|
6516
|
+
venueMarkets: props.venueMarkets
|
|
6407
6517
|
})
|
|
6408
6518
|
);
|
|
6409
6519
|
}
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6520
|
+
const { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames } = props;
|
|
6521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsUnavailableState, { ariaLabel: fallbackAriaLabel, classNames: fallbackClassNames });
|
|
6522
|
+
};
|
|
6523
|
+
MarketDetails.displayName = "MarketDetails";
|
|
6524
|
+
var resolveInitialExpandedId = (markets, defaultId) => {
|
|
6525
|
+
var _a, _b;
|
|
6526
|
+
if (!markets.length)
|
|
6527
|
+
return null;
|
|
6528
|
+
if (defaultId) {
|
|
6529
|
+
const match = markets.find((m) => m.id === defaultId);
|
|
6530
|
+
if (match)
|
|
6531
|
+
return match.id;
|
|
6532
|
+
}
|
|
6533
|
+
return (_b = (_a = markets[0]) == null ? void 0 : _a.id) != null ? _b : null;
|
|
6534
|
+
};
|
|
6535
|
+
var MarketDetailsList = ({
|
|
6536
|
+
eventId,
|
|
6537
|
+
expandedMarketId,
|
|
6538
|
+
defaultExpandedMarketId,
|
|
6539
|
+
onExpandedMarketChange,
|
|
6540
|
+
defaultTab,
|
|
6541
|
+
defaultTimeRange,
|
|
6542
|
+
classNames,
|
|
6543
|
+
ariaLabel
|
|
6544
|
+
}) => {
|
|
6545
|
+
const labels = (0, import_hooks18.useLabels)();
|
|
6546
|
+
const resolvedEventId = eventId || "";
|
|
6547
|
+
const { markets, isLoading, error } = (0, import_hooks18.useVenueMarkets)({
|
|
6548
|
+
venueEventId: resolvedEventId,
|
|
6549
|
+
enabled: !!resolvedEventId
|
|
6550
|
+
});
|
|
6551
|
+
const [internalExpandedId, setInternalExpandedId] = (0, import_react9.useState)(
|
|
6552
|
+
() => resolveInitialExpandedId(markets, defaultExpandedMarketId)
|
|
6553
|
+
);
|
|
6554
|
+
(0, import_react9.useEffect)(() => {
|
|
6555
|
+
if (typeof expandedMarketId !== "undefined")
|
|
6556
|
+
return;
|
|
6557
|
+
setInternalExpandedId((current) => {
|
|
6558
|
+
if (current && markets.some((m) => m.id === current))
|
|
6559
|
+
return current;
|
|
6560
|
+
return resolveInitialExpandedId(markets, defaultExpandedMarketId);
|
|
6561
|
+
});
|
|
6562
|
+
}, [defaultExpandedMarketId, expandedMarketId, markets]);
|
|
6563
|
+
(0, import_react9.useEffect)(() => {
|
|
6564
|
+
if (typeof expandedMarketId === "undefined")
|
|
6565
|
+
return;
|
|
6566
|
+
setInternalExpandedId(expandedMarketId);
|
|
6567
|
+
}, [expandedMarketId]);
|
|
6568
|
+
const resolvedExpandedId = typeof expandedMarketId === "undefined" ? internalExpandedId : expandedMarketId;
|
|
6569
|
+
const handleToggle = (marketId, isOpened) => {
|
|
6570
|
+
const next = isOpened ? marketId : null;
|
|
6571
|
+
if (typeof expandedMarketId === "undefined") {
|
|
6572
|
+
setInternalExpandedId(next);
|
|
6573
|
+
}
|
|
6574
|
+
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(next);
|
|
6575
|
+
};
|
|
6576
|
+
if (isLoading) {
|
|
6577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: [
|
|
6578
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsLoadingState, { isOpened: true, classNames: { root: classNames == null ? void 0 : classNames.item } }),
|
|
6579
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MarketDetailsLoadingState, { isOpened: false, classNames: { root: classNames == null ? void 0 : classNames.item } })
|
|
6580
|
+
] });
|
|
6581
|
+
}
|
|
6582
|
+
if (error) {
|
|
6583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6584
|
+
StateMessage,
|
|
6413
6585
|
{
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6586
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.unavailableAria,
|
|
6587
|
+
title: labels.marketDetails.unavailableTitle,
|
|
6588
|
+
description: labels.marketDetails.unavailableDescription,
|
|
6589
|
+
className: "min-h-[280px] md:min-h-[320px]"
|
|
6417
6590
|
}
|
|
6418
|
-
);
|
|
6591
|
+
) });
|
|
6419
6592
|
}
|
|
6420
|
-
if (
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6593
|
+
if (markets.length === 0) {
|
|
6594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Card, { className: cn(marketDetailsBaseCardClassName, "p-0", classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6595
|
+
StateMessage,
|
|
6596
|
+
{
|
|
6597
|
+
ariaLabel: ariaLabel != null ? ariaLabel : labels.marketDetails.notFoundAria,
|
|
6598
|
+
title: labels.marketDetails.notFoundTitle,
|
|
6599
|
+
description: labels.marketDetails.notFoundDescription,
|
|
6600
|
+
className: "min-h-[280px] md:min-h-[320px]"
|
|
6601
|
+
}
|
|
6602
|
+
) });
|
|
6425
6603
|
}
|
|
6426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: cn("flex flex-col gap-3", classNames == null ? void 0 : classNames.root), "aria-label": ariaLabel, children: markets.map((market) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
6605
|
+
MarketDetails,
|
|
6606
|
+
{
|
|
6607
|
+
venueMarkets: [market],
|
|
6608
|
+
isOpened: resolvedExpandedId === market.id,
|
|
6609
|
+
onOpenChange: (nextIsOpened) => handleToggle(market.id, nextIsOpened),
|
|
6610
|
+
defaultTab,
|
|
6611
|
+
defaultTimeRange,
|
|
6612
|
+
ariaLabel: market.question,
|
|
6613
|
+
classNames: { root: classNames == null ? void 0 : classNames.item }
|
|
6614
|
+
},
|
|
6615
|
+
market.id
|
|
6616
|
+
)) });
|
|
6434
6617
|
};
|
|
6435
|
-
|
|
6618
|
+
MarketDetailsList.displayName = "MarketDetailsList";
|
|
6436
6619
|
|
|
6437
6620
|
// src/events/list/index.tsx
|
|
6438
6621
|
var import_react10 = require("react");
|
|
@@ -6467,8 +6650,7 @@ var getDefaultEventListTabs = (labels) => {
|
|
|
6467
6650
|
|
|
6468
6651
|
// src/events/list/event-list.utils.ts
|
|
6469
6652
|
var mapEventToEventListItemEvent = (event) => {
|
|
6470
|
-
|
|
6471
|
-
if (mergedVenueMarkets.length === 0)
|
|
6653
|
+
if (!event.venueMarkets || event.venueMarkets.length === 0)
|
|
6472
6654
|
return null;
|
|
6473
6655
|
return event;
|
|
6474
6656
|
};
|
|
@@ -6532,11 +6714,11 @@ var estimateTabsWidth = (items) => {
|
|
|
6532
6714
|
var EventList = ({
|
|
6533
6715
|
title,
|
|
6534
6716
|
maxItemsPerRow = 3,
|
|
6535
|
-
limit =
|
|
6717
|
+
limit = 9,
|
|
6536
6718
|
maxVisibleItems,
|
|
6537
|
-
showVenueLogo = true,
|
|
6538
6719
|
search,
|
|
6539
|
-
categoryIds
|
|
6720
|
+
categoryIds,
|
|
6721
|
+
onClick
|
|
6540
6722
|
}) => {
|
|
6541
6723
|
var _a, _b;
|
|
6542
6724
|
const labels = (0, import_hooks19.useLabels)();
|
|
@@ -6560,7 +6742,7 @@ var EventList = ({
|
|
|
6560
6742
|
}, [maxVisibleItems]);
|
|
6561
6743
|
const requestLimit = resolvedMaxVisibleItems != null ? resolvedMaxVisibleItems : limit;
|
|
6562
6744
|
const shouldPaginate = resolvedMaxVisibleItems == null;
|
|
6563
|
-
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks19.
|
|
6745
|
+
const { events, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = (0, import_hooks19.useVenueEvents)({
|
|
6564
6746
|
venues,
|
|
6565
6747
|
search,
|
|
6566
6748
|
categoryIds,
|
|
@@ -6691,10 +6873,10 @@ var EventList = ({
|
|
|
6691
6873
|
EventListItem,
|
|
6692
6874
|
{
|
|
6693
6875
|
event,
|
|
6694
|
-
showVenueLogo,
|
|
6695
6876
|
classNames: {
|
|
6696
6877
|
root: "w-full min-w-0 max-w-none"
|
|
6697
|
-
}
|
|
6878
|
+
},
|
|
6879
|
+
onClick
|
|
6698
6880
|
},
|
|
6699
6881
|
event.id
|
|
6700
6882
|
)),
|
|
@@ -6735,5 +6917,6 @@ EventList.displayName = "EventList";
|
|
|
6735
6917
|
EventList,
|
|
6736
6918
|
EventListItem,
|
|
6737
6919
|
EventListItemDetails,
|
|
6738
|
-
MarketDetails
|
|
6920
|
+
MarketDetails,
|
|
6921
|
+
MarketDetailsList
|
|
6739
6922
|
});
|