@agg-build/ui 2.1.4 → 2.2.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-T4YZGAYS.mjs → chunk-5MRFY5ZQ.mjs} +1 -1
- package/dist/{chunk-BW7S2YR3.mjs → chunk-73MO7MYG.mjs} +21 -17
- package/dist/{chunk-TBZWRUFB.mjs → chunk-BTRFSEPC.mjs} +97 -61
- package/dist/{chunk-FLESSOSU.mjs → chunk-DTOI4V6P.mjs} +47 -10
- package/dist/{chunk-XHE2VO3S.mjs → chunk-HNLA44SY.mjs} +2 -2
- package/dist/{chunk-VP76G6PN.mjs → chunk-MIAAL7BL.mjs} +79 -23
- package/dist/{chunk-R2YNZJZ3.mjs → chunk-TR7HUVY7.mjs} +1 -1
- package/dist/events.js +93 -52
- package/dist/events.mjs +3 -3
- package/dist/index.js +214 -93
- package/dist/index.mjs +7 -7
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +214 -93
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +70 -23
- package/dist/primitives.mjs +1 -1
- package/dist/trading.js +17 -14
- package/dist/trading.mjs +4 -4
- package/dist/types/events/item/event-list-item.types.d.mts +2 -2
- package/dist/types/events/item/event-list-item.types.d.ts +2 -2
- package/dist/types/events/item/event-list-item.utils.d.mts +2 -1
- package/dist/types/events/item/event-list-item.utils.d.ts +2 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.mts +0 -1
- package/dist/types/events/item-details/event-list-item-details.types.d.ts +0 -1
- package/dist/types/events/market-details/market-details.types.d.mts +1 -0
- package/dist/types/events/market-details/market-details.types.d.ts +1 -0
- package/dist/types/events/shared/chart-venue-selection.d.mts +2 -1
- package/dist/types/events/shared/chart-venue-selection.d.ts +2 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +15 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +15 -1
- package/dist/types/primitives/search/search.types.d.mts +1 -0
- package/dist/types/primitives/search/search.types.d.ts +1 -0
- package/dist/types/primitives/search/search.utils.d.mts +4 -1
- package/dist/types/primitives/search/search.utils.d.ts +4 -1
- package/dist/types/trading/types.d.mts +2 -1
- package/dist/types/trading/types.d.ts +2 -1
- package/package.json +3 -3
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
getTradingValueLabel,
|
|
9
9
|
getTradingVenueLabel,
|
|
10
10
|
resolveOrderEligibilityMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TR7HUVY7.mjs";
|
|
12
12
|
import {
|
|
13
13
|
GeoBlockBanner,
|
|
14
14
|
subscribeAggDepositNotification
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5MRFY5ZQ.mjs";
|
|
16
16
|
import {
|
|
17
17
|
AGG_TERMS_OF_SERVICE_URL,
|
|
18
18
|
Button,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
getMotionClassName,
|
|
44
44
|
skeletonViews,
|
|
45
45
|
useOptionalToast
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-MIAAL7BL.mjs";
|
|
47
47
|
|
|
48
48
|
// src/trading/types.ts
|
|
49
49
|
import { Venue, enumGuard, isFiniteNonNeg, safeParse } from "@agg-build/sdk";
|
|
@@ -106,6 +106,7 @@ import {
|
|
|
106
106
|
useLiveBestPrices,
|
|
107
107
|
useLiveOutcomePrices,
|
|
108
108
|
useManagedBalances,
|
|
109
|
+
useMidpoints,
|
|
109
110
|
useQueryClient,
|
|
110
111
|
useSdkUiConfig,
|
|
111
112
|
useSmartRoute
|
|
@@ -1119,7 +1120,7 @@ var mapVenueMarketOutcomesToPlaceOrderOutcomes = (venueMarketOutcomes) => {
|
|
|
1119
1120
|
label: outcome.label,
|
|
1120
1121
|
title: (_a = outcome.title) != null ? _a : null,
|
|
1121
1122
|
price: outcome.price,
|
|
1122
|
-
priceLabel: getTradingPriceLabel(outcome.price)
|
|
1123
|
+
priceLabel: outcome.price != null ? getTradingPriceLabel(outcome.price) : ""
|
|
1123
1124
|
};
|
|
1124
1125
|
});
|
|
1125
1126
|
};
|
|
@@ -3339,16 +3340,10 @@ var PlaceOrder = ({
|
|
|
3339
3340
|
scopedSelectedMarket ? [scopedSelectedMarket] : void 0
|
|
3340
3341
|
);
|
|
3341
3342
|
const wsBestPrices = useLiveBestPrices(scopedSelectedMarket ? [scopedSelectedMarket] : void 0);
|
|
3342
|
-
const
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
bestPrices: /* @__PURE__ */ new Map(),
|
|
3347
|
-
bestPriceVenuesByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3348
|
-
isLoading: false,
|
|
3349
|
-
bestMidpoint: void 0,
|
|
3350
|
-
bestMidpointVenue: void 0
|
|
3351
|
-
};
|
|
3343
|
+
const fetchedClusterMidpointResult = useMidpoints(
|
|
3344
|
+
midpointsResult ? [] : scopedSelectedMarket ? [scopedSelectedMarket] : []
|
|
3345
|
+
);
|
|
3346
|
+
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
3352
3347
|
const clusterBestMidpointsByOutcomeId = (_i = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _i : clusterMidpointResult.prices;
|
|
3353
3348
|
const clusterBestMidpoint = clusterMidpointResult.bestMidpoint;
|
|
3354
3349
|
const clusterBestPricesRest = clusterMidpointResult.bestPrices;
|
|
@@ -4531,11 +4526,11 @@ var PlaceOrder = ({
|
|
|
4531
4526
|
bestPrices: clusterBestPrices,
|
|
4532
4527
|
bestMidpoint: clusterBestMidpoint,
|
|
4533
4528
|
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
4534
|
-
livePrices
|
|
4535
|
-
fallbackPrice: outcome.price
|
|
4529
|
+
livePrices
|
|
4536
4530
|
});
|
|
4537
4531
|
const isActive = outcome.id === scopedSelectedOutcomeId;
|
|
4538
4532
|
const isPositive = resolveIsPositiveOutcome(outcome, index);
|
|
4533
|
+
const isPriceLoading = clusterMidpointResult.isLoading && price == null;
|
|
4539
4534
|
return /* @__PURE__ */ jsxs4(
|
|
4540
4535
|
"button",
|
|
4541
4536
|
{
|
|
@@ -4565,7 +4560,16 @@ var PlaceOrder = ({
|
|
|
4565
4560
|
children: (_c2 = outcome.title) != null ? _c2 : outcome.label
|
|
4566
4561
|
}
|
|
4567
4562
|
),
|
|
4568
|
-
/* @__PURE__ */ jsx5(
|
|
4563
|
+
isPriceLoading ? /* @__PURE__ */ jsx5(
|
|
4564
|
+
"span",
|
|
4565
|
+
{
|
|
4566
|
+
"aria-hidden": "true",
|
|
4567
|
+
className: cn(
|
|
4568
|
+
"agg-place-order-outcome-price-loading",
|
|
4569
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
4570
|
+
)
|
|
4571
|
+
}
|
|
4572
|
+
) : /* @__PURE__ */ jsx5(Typography, { as: "span", variant: isActive ? "body-strong" : "body", children: formatProbabilityCents(price) })
|
|
4569
4573
|
]
|
|
4570
4574
|
},
|
|
4571
4575
|
outcome.id
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveUnifiedOrderBookEntries,
|
|
23
23
|
sortOutcomeSelectorOutcomes,
|
|
24
24
|
useEventTradingContext
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TR7HUVY7.mjs";
|
|
26
26
|
import {
|
|
27
27
|
AutocompleteSelect,
|
|
28
28
|
Badge,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
sortCategoriesForNavigation,
|
|
74
74
|
sortOutcomes,
|
|
75
75
|
splitEventsByLifecycle
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-MIAAL7BL.mjs";
|
|
77
77
|
|
|
78
78
|
// src/events/item/index.tsx
|
|
79
79
|
import {
|
|
@@ -143,9 +143,8 @@ var collectOutcomePrices = (market, outcome, priceByOutcomeId) => {
|
|
|
143
143
|
const prices = [];
|
|
144
144
|
const seenOutcomeKeys = /* @__PURE__ */ new Set();
|
|
145
145
|
const addPrice = (priceMarket, priceOutcome) => {
|
|
146
|
-
var _a2;
|
|
147
146
|
if (!priceMarket || !priceOutcome) return;
|
|
148
|
-
const resolvedPrice =
|
|
147
|
+
const resolvedPrice = priceByOutcomeId === void 0 ? priceOutcome.price : priceByOutcomeId.has(priceOutcome.id) ? priceByOutcomeId.get(priceOutcome.id) : void 0;
|
|
149
148
|
const normalizedPrice = normalizeProbability(resolvedPrice);
|
|
150
149
|
if (normalizedPrice == null) return;
|
|
151
150
|
const key = `${priceMarket.id}:${priceOutcome.id}`;
|
|
@@ -1286,6 +1285,7 @@ import {
|
|
|
1286
1285
|
mergeBestPricesPreferringLive,
|
|
1287
1286
|
optimizedImageUrl as optimizedImageUrl2,
|
|
1288
1287
|
resolveEventTradingState,
|
|
1288
|
+
resolveMarketTradingState,
|
|
1289
1289
|
useEventOrderbookData,
|
|
1290
1290
|
useLabels as useLabels5,
|
|
1291
1291
|
useLiveBestPrices,
|
|
@@ -1442,13 +1442,8 @@ var resolveChartVenueOutcomes = ({
|
|
|
1442
1442
|
}) => {
|
|
1443
1443
|
if (eligibleVenueOutcomes.length <= 1) return eligibleVenueOutcomes;
|
|
1444
1444
|
const sortedEligibleVenueOutcomes = [...eligibleVenueOutcomes].sort((left, right) => {
|
|
1445
|
-
|
|
1446
|
-
const
|
|
1447
|
-
(_a = livePrices.get(left.outcome.id)) != null ? _a : left.outcome.price
|
|
1448
|
-
);
|
|
1449
|
-
const rightProbability = normalizeProbability(
|
|
1450
|
-
(_b = livePrices.get(right.outcome.id)) != null ? _b : right.outcome.price
|
|
1451
|
-
);
|
|
1445
|
+
const leftProbability = normalizeProbability(livePrices.get(left.outcome.id));
|
|
1446
|
+
const rightProbability = normalizeProbability(livePrices.get(right.outcome.id));
|
|
1452
1447
|
const probabilityDifference = (leftProbability != null ? leftProbability : 2) - (rightProbability != null ? rightProbability : 2);
|
|
1453
1448
|
if (probabilityDifference !== 0) return probabilityDifference;
|
|
1454
1449
|
if (left.venue === right.venue) return 0;
|
|
@@ -2086,6 +2081,12 @@ var EventListItemDetailsNotFoundState = ({
|
|
|
2086
2081
|
}
|
|
2087
2082
|
);
|
|
2088
2083
|
};
|
|
2084
|
+
var resolveResolvedOutcomePriceMap = (outcomes) => {
|
|
2085
|
+
if (!(outcomes == null ? void 0 : outcomes.length)) return null;
|
|
2086
|
+
if (!outcomes.some((outcome) => outcome.winner === true)) return null;
|
|
2087
|
+
if (outcomes.some((outcome) => outcome.winner == null)) return null;
|
|
2088
|
+
return new Map(outcomes.map((outcome) => [outcome.id, outcome.winner === true ? 1 : 0]));
|
|
2089
|
+
};
|
|
2089
2090
|
var EventListItemDetailsGraphSection = ({
|
|
2090
2091
|
classNames,
|
|
2091
2092
|
selectedChartType,
|
|
@@ -2207,6 +2208,18 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2207
2208
|
});
|
|
2208
2209
|
});
|
|
2209
2210
|
}, [availableMarkets, tradingContext == null ? void 0 : tradingContext.selectedMarket]);
|
|
2211
|
+
const resolvedOutcomePriceByMarketId = useMemo5(() => {
|
|
2212
|
+
const map = /* @__PURE__ */ new Map();
|
|
2213
|
+
for (const market of availableMarkets) {
|
|
2214
|
+
const marketTradingState = resolveMarketTradingState(market);
|
|
2215
|
+
if (marketTradingState.kind !== "resolved") continue;
|
|
2216
|
+
const outcomePriceMap = resolveResolvedOutcomePriceMap(market.venueMarketOutcomes);
|
|
2217
|
+
if (outcomePriceMap) {
|
|
2218
|
+
map.set(market.id, outcomePriceMap);
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
return map;
|
|
2222
|
+
}, [availableMarkets]);
|
|
2210
2223
|
const resolvedVenueChartSeries = useMemo5(() => {
|
|
2211
2224
|
return resolveMarketChartVenueSeries({
|
|
2212
2225
|
chartData: scopedMarketChartData,
|
|
@@ -2302,8 +2315,8 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2302
2315
|
classNames == null ? void 0 : classNames.outcomeBadges
|
|
2303
2316
|
),
|
|
2304
2317
|
children: chartAvailableVenueOutcomes.map((item) => {
|
|
2305
|
-
var _a3;
|
|
2306
|
-
const percentage = (_a3 =
|
|
2318
|
+
var _a3, _b3;
|
|
2319
|
+
const percentage = (_b3 = (_a3 = resolvedOutcomePriceByMarketId.get(item.market.id)) == null ? void 0 : _a3.get(item.outcome.id)) != null ? _b3 : wsLivePrices.get(item.outcome.id);
|
|
2307
2320
|
const text = formatMarketProbabilityPercent(percentage, formatPercent);
|
|
2308
2321
|
const seriesId = `${item.venue}-chart`;
|
|
2309
2322
|
const isActiveVenue = activeGraphVenue === item.venue;
|
|
@@ -2366,21 +2379,21 @@ var EventListItemDetailsGraphSection = ({
|
|
|
2366
2379
|
tradingContext == null ? void 0 : tradingContext.selectOutcome(outcomeId);
|
|
2367
2380
|
},
|
|
2368
2381
|
options: selectedMarketOutcomes.map((outcome) => {
|
|
2369
|
-
var _a3, _b3, _c3;
|
|
2370
|
-
const
|
|
2382
|
+
var _a3, _b3, _c3, _d3, _e2;
|
|
2383
|
+
const resolvedPrice = availableMarkets[0] == null ? void 0 : (_b3 = resolvedOutcomePriceByMarketId.get(((_a3 = tradingContext == null ? void 0 : tradingContext.selectedMarket) != null ? _a3 : availableMarkets[0]).id)) == null ? void 0 : _b3.get(outcome.id);
|
|
2384
|
+
const price = resolvedPrice != null ? resolvedPrice : getDisplayOutcomePrice({
|
|
2371
2385
|
outcomeId: outcome.id,
|
|
2372
2386
|
outcomeLabel: outcome.label,
|
|
2373
|
-
selection: (
|
|
2387
|
+
selection: (_c3 = tradingContext == null ? void 0 : tradingContext.tradeSide) != null ? _c3 : "buy",
|
|
2374
2388
|
bestPrices,
|
|
2375
2389
|
bestMidpoint,
|
|
2376
2390
|
bestMidpointsByOutcomeId: restMidpoints,
|
|
2377
|
-
livePrices
|
|
2378
|
-
fallbackPrice: outcome.price
|
|
2391
|
+
livePrices
|
|
2379
2392
|
});
|
|
2380
2393
|
return {
|
|
2381
2394
|
value: outcome.id,
|
|
2382
|
-
label: `${(
|
|
2383
|
-
ariaLabel: `${(
|
|
2395
|
+
label: `${(_d3 = outcome.title) != null ? _d3 : outcome.label} ${formatProbabilityCents(price)}`,
|
|
2396
|
+
ariaLabel: `${(_e2 = outcome.title) != null ? _e2 : outcome.label} ${formatProbabilityCents(price)}`
|
|
2384
2397
|
};
|
|
2385
2398
|
})
|
|
2386
2399
|
}
|
|
@@ -3250,7 +3263,7 @@ import {
|
|
|
3250
3263
|
MarketStatus,
|
|
3251
3264
|
mergeBestPricesPreferringLive as mergeBestPricesPreferringLive2,
|
|
3252
3265
|
optimizedImageUrl as optimizedImageUrl3,
|
|
3253
|
-
resolveMarketTradingState,
|
|
3266
|
+
resolveMarketTradingState as resolveMarketTradingState2,
|
|
3254
3267
|
useEventTradingContext as useEventTradingContext2,
|
|
3255
3268
|
useEventOrderbookData as useEventOrderbookData2,
|
|
3256
3269
|
useLabels as useLabels7,
|
|
@@ -3258,6 +3271,7 @@ import {
|
|
|
3258
3271
|
useLiveBestPriceCandidates,
|
|
3259
3272
|
useLiveOutcomePrices as useLiveOutcomePrices2,
|
|
3260
3273
|
useMarketOrderbook,
|
|
3274
|
+
useMidpoints as useMidpoints2,
|
|
3261
3275
|
useSdkUiConfig as useSdkUiConfig4,
|
|
3262
3276
|
useVenueMarkets as useVenueMarkets2,
|
|
3263
3277
|
useViewportMidpoints
|
|
@@ -3369,6 +3383,34 @@ var getMarketDetailsOutcomeButtonClassNames = ({
|
|
|
3369
3383
|
text: cn(isSelected ? toneClasses.text : "text-agg-foreground")
|
|
3370
3384
|
};
|
|
3371
3385
|
};
|
|
3386
|
+
var OutcomePriceContent = ({
|
|
3387
|
+
isLoading,
|
|
3388
|
+
isSelected,
|
|
3389
|
+
value,
|
|
3390
|
+
textClassName
|
|
3391
|
+
}) => {
|
|
3392
|
+
if (isLoading) {
|
|
3393
|
+
return /* @__PURE__ */ jsx8(
|
|
3394
|
+
"span",
|
|
3395
|
+
{
|
|
3396
|
+
"aria-hidden": "true",
|
|
3397
|
+
className: cn(
|
|
3398
|
+
"agg-market-details-outcome-price-loading",
|
|
3399
|
+
"h-4 w-10 shrink-0 rounded-agg-sm bg-agg-separator animate-pulse"
|
|
3400
|
+
)
|
|
3401
|
+
}
|
|
3402
|
+
);
|
|
3403
|
+
}
|
|
3404
|
+
return /* @__PURE__ */ jsx8(
|
|
3405
|
+
Typography,
|
|
3406
|
+
{
|
|
3407
|
+
as: "span",
|
|
3408
|
+
variant: isSelected ? "body-strong" : "body",
|
|
3409
|
+
className: cn("shrink-0 whitespace-nowrap", textClassName),
|
|
3410
|
+
children: formatProbabilityCents(value)
|
|
3411
|
+
}
|
|
3412
|
+
);
|
|
3413
|
+
};
|
|
3372
3414
|
var MarketDetailsOutcomeButton = ({
|
|
3373
3415
|
ariaControls,
|
|
3374
3416
|
enableAnimations,
|
|
@@ -3424,12 +3466,12 @@ var MarketDetailsOutcomeButton = ({
|
|
|
3424
3466
|
}
|
|
3425
3467
|
) : null,
|
|
3426
3468
|
/* @__PURE__ */ jsx8(
|
|
3427
|
-
|
|
3469
|
+
OutcomePriceContent,
|
|
3428
3470
|
{
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3471
|
+
isLoading: item.isPriceLoading,
|
|
3472
|
+
isSelected,
|
|
3473
|
+
value: item.probability,
|
|
3474
|
+
textClassName: classNames.text
|
|
3433
3475
|
}
|
|
3434
3476
|
)
|
|
3435
3477
|
] }) : /* @__PURE__ */ jsxs6("div", { className: "inline-flex max-w-full items-center justify-center gap-1.5", children: [
|
|
@@ -3444,12 +3486,12 @@ var MarketDetailsOutcomeButton = ({
|
|
|
3444
3486
|
}
|
|
3445
3487
|
),
|
|
3446
3488
|
/* @__PURE__ */ jsx8(
|
|
3447
|
-
|
|
3489
|
+
OutcomePriceContent,
|
|
3448
3490
|
{
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3491
|
+
isLoading: item.isPriceLoading,
|
|
3492
|
+
isSelected,
|
|
3493
|
+
value: item.probability,
|
|
3494
|
+
textClassName: classNames.text
|
|
3453
3495
|
}
|
|
3454
3496
|
)
|
|
3455
3497
|
] })
|
|
@@ -3647,9 +3689,8 @@ var MarketDetailsGraphPanel = ({
|
|
|
3647
3689
|
var _a2, _b2, _c2, _d;
|
|
3648
3690
|
return /* @__PURE__ */ jsxs7("div", { className: "agg-chart-toolbar w-full flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
|
|
3649
3691
|
/* @__PURE__ */ jsx9("div", { className: "agg-market-venues flex flex-wrap gap-2", children: chartAvailableOutcomesByVenue.map((item) => {
|
|
3650
|
-
var _a3;
|
|
3651
3692
|
const probability = formatProbabilityPercent(
|
|
3652
|
-
|
|
3693
|
+
wsLivePrices.get(item.outcome.id),
|
|
3653
3694
|
formatPercent
|
|
3654
3695
|
);
|
|
3655
3696
|
const isActiveVenue = selectedGraphVenue === item.venue;
|
|
@@ -3855,21 +3896,13 @@ var MarketDetailsContent = ({
|
|
|
3855
3896
|
if (!resolvedMarket) return null;
|
|
3856
3897
|
return (_b2 = (_a2 = resolvedMarket.venueMarkets.find((venueMarket) => venueMarket.id === resolvedMarket.id)) != null ? _a2 : resolvedMarket.venueMarkets[0]) != null ? _b2 : null;
|
|
3857
3898
|
}, [resolvedMarket]);
|
|
3858
|
-
const isResolvedMarket =
|
|
3899
|
+
const isResolvedMarket = resolveMarketTradingState2(scopedResolvedMarket).kind === "resolved";
|
|
3859
3900
|
useEventOrderbookData2(
|
|
3860
3901
|
isResolvedMarket ? [] : resolvedMarket == null ? void 0 : resolvedMarket.venueMarkets,
|
|
3861
3902
|
(_b = scopedResolvedMarket == null ? void 0 : scopedResolvedMarket.id) != null ? _b : null
|
|
3862
3903
|
);
|
|
3863
|
-
const
|
|
3864
|
-
|
|
3865
|
-
bestMidpointsByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3866
|
-
venueByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3867
|
-
bestPrices: /* @__PURE__ */ new Map(),
|
|
3868
|
-
bestPriceVenuesByOutcomeId: /* @__PURE__ */ new Map(),
|
|
3869
|
-
isLoading: false,
|
|
3870
|
-
bestMidpoint: void 0,
|
|
3871
|
-
bestMidpointVenue: void 0
|
|
3872
|
-
};
|
|
3904
|
+
const fetchedClusterMidpointResult = useMidpoints2(midpointsResult ? [] : clusterVenueMarkets);
|
|
3905
|
+
const clusterMidpointResult = midpointsResult != null ? midpointsResult : fetchedClusterMidpointResult;
|
|
3873
3906
|
const clusterMidpoints = (_c = clusterMidpointResult.bestMidpointsByOutcomeId) != null ? _c : clusterMidpointResult.prices;
|
|
3874
3907
|
const clusterBestMidpointsByOutcomeId = clusterMidpoints;
|
|
3875
3908
|
const clusterVenueByOutcomeId = clusterMidpointResult.venueByOutcomeId;
|
|
@@ -3932,7 +3965,7 @@ var MarketDetailsContent = ({
|
|
|
3932
3965
|
return (_a2 = model.market.venueMarkets.find((venueMarket) => venueMarket.id === model.market.id)) != null ? _a2 : model.primaryVenueMarket;
|
|
3933
3966
|
}, [model]);
|
|
3934
3967
|
const marketTradingState = useMemo7(() => {
|
|
3935
|
-
return
|
|
3968
|
+
return resolveMarketTradingState2(scopedMarketForCard);
|
|
3936
3969
|
}, [scopedMarketForCard]);
|
|
3937
3970
|
const isOutcomeSelectionLocked = marketTradingState.isTradingDisabled;
|
|
3938
3971
|
const isUpcomingMarket = marketTradingState.kind === "unopened";
|
|
@@ -4029,18 +4062,24 @@ var MarketDetailsContent = ({
|
|
|
4029
4062
|
});
|
|
4030
4063
|
const bestVenue = candidate == null ? void 0 : candidate.venue;
|
|
4031
4064
|
const outcomeBestPrice = candidate == null ? void 0 : candidate.price;
|
|
4065
|
+
const isPriceLoading = !isResolvedMarket && outcomeBestPrice == null && clusterMidpointResult.isLoading;
|
|
4032
4066
|
if (isResolvedMarket) {
|
|
4033
4067
|
const isWinningOutcome = item.id === ((_a2 = marketTradingState.winningOutcome) == null ? void 0 : _a2.id);
|
|
4034
4068
|
return __spreadValues(__spreadProps(__spreadValues({}, item), {
|
|
4035
|
-
probability: isWinningOutcome ? 1 : 0
|
|
4069
|
+
probability: isWinningOutcome ? 1 : 0,
|
|
4070
|
+
isPriceLoading: false
|
|
4036
4071
|
}), bestVenue ? { venue: bestVenue } : {});
|
|
4037
4072
|
}
|
|
4038
4073
|
if (outcomeBestPrice != null) {
|
|
4039
4074
|
return __spreadValues(__spreadProps(__spreadValues({}, item), {
|
|
4040
|
-
probability: outcomeBestPrice
|
|
4075
|
+
probability: outcomeBestPrice,
|
|
4076
|
+
isPriceLoading: false
|
|
4041
4077
|
}), bestVenue ? { venue: bestVenue } : {});
|
|
4042
4078
|
}
|
|
4043
|
-
return item
|
|
4079
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
4080
|
+
probability: void 0,
|
|
4081
|
+
isPriceLoading
|
|
4082
|
+
});
|
|
4044
4083
|
});
|
|
4045
4084
|
}, [
|
|
4046
4085
|
clusterBestMidpoint,
|
|
@@ -4062,7 +4101,7 @@ var MarketDetailsContent = ({
|
|
|
4062
4101
|
wsBestCandidates
|
|
4063
4102
|
]);
|
|
4064
4103
|
const headlineProbability = useMemo7(() => {
|
|
4065
|
-
var _a2
|
|
4104
|
+
var _a2;
|
|
4066
4105
|
if (!model || !scopedMarketForCard) return void 0;
|
|
4067
4106
|
if (isResolvedMarket) {
|
|
4068
4107
|
const yesOutcome2 = resolveYesOutcome(scopedMarketForCard);
|
|
@@ -4070,10 +4109,7 @@ var MarketDetailsContent = ({
|
|
|
4070
4109
|
return yesOutcome2.winner === true ? 1 : 0;
|
|
4071
4110
|
}
|
|
4072
4111
|
const yesOutcome = resolveYesOutcome(scopedMarketForCard);
|
|
4073
|
-
const displayOutcome = yesOutcome != null ? yesOutcome : (
|
|
4074
|
-
(acc, outcome) => outcome.price > acc.price ? outcome : acc,
|
|
4075
|
-
(_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0]
|
|
4076
|
-
);
|
|
4112
|
+
const displayOutcome = yesOutcome != null ? yesOutcome : (_a2 = scopedMarketForCard.venueMarketOutcomes) == null ? void 0 : _a2[0];
|
|
4077
4113
|
if (displayOutcome == null) return void 0;
|
|
4078
4114
|
const referencePrice = getDisplayOutcomePrice({
|
|
4079
4115
|
outcomeId: displayOutcome.id,
|
|
@@ -4083,10 +4119,10 @@ var MarketDetailsContent = ({
|
|
|
4083
4119
|
bestMidpoint: clusterBestMidpoint,
|
|
4084
4120
|
bestMidpointsByOutcomeId: clusterBestMidpointsByOutcomeId,
|
|
4085
4121
|
livePrices: wsLivePrices,
|
|
4086
|
-
fallbackPrice:
|
|
4122
|
+
fallbackPrice: midpointsFallback == null ? void 0 : midpointsFallback.get(displayOutcome.id)
|
|
4087
4123
|
});
|
|
4088
4124
|
if (referencePrice != null) return referencePrice;
|
|
4089
|
-
return
|
|
4125
|
+
return findLivePriceById(wsLivePrices, displayOutcome.id);
|
|
4090
4126
|
}, [
|
|
4091
4127
|
clusterBestMidpoint,
|
|
4092
4128
|
clusterBestMidpointsByOutcomeId,
|
|
@@ -4597,13 +4633,13 @@ var resolveIsResolvedEvent = (sourceMarkets, eventTradingState) => {
|
|
|
4597
4633
|
return eventTradingState.kind === "resolved";
|
|
4598
4634
|
}
|
|
4599
4635
|
if (sourceMarkets.length === 0) return false;
|
|
4600
|
-
return sourceMarkets.every((market) =>
|
|
4636
|
+
return sourceMarkets.every((market) => resolveMarketTradingState2(market).kind === "resolved");
|
|
4601
4637
|
};
|
|
4602
4638
|
var resolveResolvedWinnerMarketId = (sourceMarkets, eventTradingState) => {
|
|
4603
4639
|
var _a, _b, _c, _d, _e;
|
|
4604
4640
|
const preferredMarket = (_a = eventTradingState == null ? void 0 : eventTradingState.primaryMarket) != null ? _a : null;
|
|
4605
4641
|
if (preferredMarket && sourceMarkets.some((market) => market.id === preferredMarket.id)) {
|
|
4606
|
-
if (
|
|
4642
|
+
if (resolveMarketTradingState2(preferredMarket).kind === "resolved") {
|
|
4607
4643
|
return preferredMarket.id;
|
|
4608
4644
|
}
|
|
4609
4645
|
}
|
|
@@ -4674,7 +4710,7 @@ var MarketDetailsList = ({
|
|
|
4674
4710
|
const resolved = [];
|
|
4675
4711
|
const closed = [];
|
|
4676
4712
|
sourceMarkets.forEach((market) => {
|
|
4677
|
-
const marketStateKind =
|
|
4713
|
+
const marketStateKind = resolveMarketTradingState2(market).kind;
|
|
4678
4714
|
if (marketStateKind === "resolved") {
|
|
4679
4715
|
resolved.push(market);
|
|
4680
4716
|
return;
|
|
@@ -4702,7 +4738,7 @@ var MarketDetailsList = ({
|
|
|
4702
4738
|
const hasPrefetchedMarkets = !!providedMarkets || !!((_b = eventTradingState == null ? void 0 : eventTradingState.marketStates) == null ? void 0 : _b.length);
|
|
4703
4739
|
const midpointEligibleMarkets = useMemo7(() => {
|
|
4704
4740
|
return displayedMarkets.filter(
|
|
4705
|
-
(market) =>
|
|
4741
|
+
(market) => resolveMarketTradingState2(market).kind !== "resolved"
|
|
4706
4742
|
);
|
|
4707
4743
|
}, [displayedMarkets]);
|
|
4708
4744
|
const { prices: midpointsFallback, venueByOutcomeId: midpointsFallbackVenues } = useViewportMidpoints(midpointEligibleMarkets);
|
|
@@ -4724,7 +4760,7 @@ var MarketDetailsList = ({
|
|
|
4724
4760
|
return;
|
|
4725
4761
|
}
|
|
4726
4762
|
const fallbackSelectableMarket = displayedMarkets.find(
|
|
4727
|
-
(market) => !
|
|
4763
|
+
(market) => !resolveMarketTradingState2(market).isTradingDisabled
|
|
4728
4764
|
);
|
|
4729
4765
|
if (!fallbackSelectableMarket) {
|
|
4730
4766
|
return;
|
|
@@ -4746,7 +4782,7 @@ var MarketDetailsList = ({
|
|
|
4746
4782
|
setExpandedMarketId(marketId);
|
|
4747
4783
|
onExpandedMarketChange == null ? void 0 : onExpandedMarketChange(marketId);
|
|
4748
4784
|
if (marketId === selectedMarketId) return;
|
|
4749
|
-
if (
|
|
4785
|
+
if (resolveMarketTradingState2(market).isTradingDisabled) return;
|
|
4750
4786
|
tradingContext == null ? void 0 : tradingContext.selectMarket(market.id, market);
|
|
4751
4787
|
};
|
|
4752
4788
|
if (!hasPrefetchedMarkets && isLoading) {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isErrorWithStatus,
|
|
11
11
|
useEventListTabs,
|
|
12
12
|
useEventListTabsHeaderOverflow
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BTRFSEPC.mjs";
|
|
14
14
|
import {
|
|
15
15
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
16
16
|
PlaceOrder,
|
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
19
19
|
useClaimWinnings,
|
|
20
20
|
useResolvedMarketClaim
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-73MO7MYG.mjs";
|
|
22
|
+
import {
|
|
23
|
+
getDisplayOutcomePrice
|
|
24
|
+
} from "./chunk-TR7HUVY7.mjs";
|
|
22
25
|
import {
|
|
23
26
|
AggErrorBoundary,
|
|
24
27
|
Button,
|
|
@@ -48,7 +51,7 @@ import {
|
|
|
48
51
|
resolveTabVenus,
|
|
49
52
|
shortenAddress,
|
|
50
53
|
sortCategoriesForNavigation
|
|
51
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-MIAAL7BL.mjs";
|
|
52
55
|
|
|
53
56
|
// src/pages/home/index.tsx
|
|
54
57
|
import {
|
|
@@ -654,6 +657,7 @@ var SPORTS_PERIOD_KEYS = [
|
|
|
654
657
|
"first_5_innings",
|
|
655
658
|
"other"
|
|
656
659
|
];
|
|
660
|
+
var SPORTS_PERIOD_GRAMMAR_PATTERN = /^(?:(set|map|game|period|inning)_(\d{1,2})|first_(\d{1,2})_innings)$/;
|
|
657
661
|
var SPORTS_MARKET_CATEGORY_KEYS = [
|
|
658
662
|
"game_lines",
|
|
659
663
|
"exact_score",
|
|
@@ -782,9 +786,22 @@ var stripLineValueFromQuestion = (question) => {
|
|
|
782
786
|
const strippedQuestion = sanitizeFamilyValue(question);
|
|
783
787
|
return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
|
|
784
788
|
};
|
|
789
|
+
var SPORTS_PERIOD_FAMILY_ORDER = ["period", "inning", "set", "map", "game"];
|
|
785
790
|
var getSportsPeriodOrderIndex = (period) => {
|
|
791
|
+
var _a, _b;
|
|
786
792
|
const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
|
|
787
|
-
|
|
793
|
+
if (periodIndex >= 0) {
|
|
794
|
+
return period === "other" ? Number.MAX_SAFE_INTEGER : periodIndex;
|
|
795
|
+
}
|
|
796
|
+
const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
|
|
797
|
+
if (grammarMatch) {
|
|
798
|
+
const familyIndex = grammarMatch[1] ? SPORTS_PERIOD_FAMILY_ORDER.indexOf(
|
|
799
|
+
grammarMatch[1]
|
|
800
|
+
) : SPORTS_PERIOD_FAMILY_ORDER.length;
|
|
801
|
+
const scopeNumber = Number((_b = (_a = grammarMatch[2]) != null ? _a : grammarMatch[3]) != null ? _b : 0);
|
|
802
|
+
return SPORTS_PERIOD_ORDER.length + familyIndex * 100 + scopeNumber;
|
|
803
|
+
}
|
|
804
|
+
return Number.MAX_SAFE_INTEGER - 1;
|
|
788
805
|
};
|
|
789
806
|
var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
|
|
790
807
|
if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
|
|
@@ -801,7 +818,10 @@ var resolveSportsSectionDefinition = (key) => {
|
|
|
801
818
|
var normalizeSportsPeriod = (value) => {
|
|
802
819
|
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
803
820
|
if (!resolvedValue) return "full";
|
|
804
|
-
|
|
821
|
+
if (resolvedValue === "match") return "full";
|
|
822
|
+
if (SPORTS_PERIOD_KEY_SET.has(resolvedValue)) return resolvedValue;
|
|
823
|
+
if (SPORTS_PERIOD_GRAMMAR_PATTERN.test(resolvedValue)) return resolvedValue;
|
|
824
|
+
return "other";
|
|
805
825
|
};
|
|
806
826
|
var normalizeSportsMarketType = (value) => {
|
|
807
827
|
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
@@ -884,8 +904,7 @@ var isBinarySportsMoneylineMarket = (market) => {
|
|
|
884
904
|
);
|
|
885
905
|
const marketSubtype = toTrimmedString(market.marketSubtype).toLowerCase();
|
|
886
906
|
const marketGroup = normalizeSportsMarketGroup(market.marketGroup);
|
|
887
|
-
|
|
888
|
-
return (marketSubtype === "moneyline" || hasMoneylineAggKey) && marketGroup === "game_lines" && normalizeSportsPeriod(market.period) === "full" && normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label));
|
|
907
|
+
return marketSubtype === "moneyline" && marketGroup === "game_lines" && normalizeSportsPeriod(market.period) === "full" && normalizedOutcomeLabels.length === 2 && normalizedOutcomeLabels.every((label) => YES_NO_LABELS.has(label));
|
|
889
908
|
};
|
|
890
909
|
var resolveDisplayGroupFamilyKey = (market) => {
|
|
891
910
|
var _a, _b, _c;
|
|
@@ -1110,6 +1129,15 @@ var buildSportsSlideFromGroup = (group) => {
|
|
|
1110
1129
|
defaultStopIndex
|
|
1111
1130
|
};
|
|
1112
1131
|
};
|
|
1132
|
+
var formatSportsPeriodGrammarLabel = (period) => {
|
|
1133
|
+
const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
|
|
1134
|
+
if (!grammarMatch) return null;
|
|
1135
|
+
if (grammarMatch[1]) {
|
|
1136
|
+
const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
|
|
1137
|
+
return `${family} ${Number(grammarMatch[2])}`;
|
|
1138
|
+
}
|
|
1139
|
+
return `First ${Number(grammarMatch[3])} Innings`;
|
|
1140
|
+
};
|
|
1113
1141
|
var resolveSportsCategoryTokens = (event) => {
|
|
1114
1142
|
return new Set(
|
|
1115
1143
|
event.categories.flatMap((entry) => {
|
|
@@ -1243,7 +1271,7 @@ var SportsMarketCard = ({
|
|
|
1243
1271
|
const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
|
|
1244
1272
|
if (!isCombinedMoneylineGroup) return void 0;
|
|
1245
1273
|
return combinedMoneylineMarkets.flatMap((market, index) => {
|
|
1246
|
-
var _a2;
|
|
1274
|
+
var _a2, _b2;
|
|
1247
1275
|
const typedMarket = market;
|
|
1248
1276
|
const yesOutcome = market.venueMarketOutcomes.find(
|
|
1249
1277
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
@@ -1251,19 +1279,25 @@ var SportsMarketCard = ({
|
|
|
1251
1279
|
if (!yesOutcome) return [];
|
|
1252
1280
|
const label = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
|
|
1253
1281
|
if (!label) return [];
|
|
1282
|
+
const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
|
|
1283
|
+
outcomeId: yesOutcome.id,
|
|
1284
|
+
outcomeLabel: yesOutcome.label,
|
|
1285
|
+
bestMidpointsByOutcomeId: (_b2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _b2 : midpointsResult.prices
|
|
1286
|
+
});
|
|
1254
1287
|
return [
|
|
1255
1288
|
{
|
|
1256
1289
|
id: yesOutcome.id,
|
|
1257
1290
|
label,
|
|
1258
1291
|
title: label,
|
|
1259
|
-
probability
|
|
1292
|
+
probability,
|
|
1293
|
+
isPriceLoading: (midpointsResult == null ? void 0 : midpointsResult.isLoading) === true && probability == null,
|
|
1260
1294
|
tone: index === 0 ? "positive" : "negative",
|
|
1261
1295
|
variant: "outcome",
|
|
1262
1296
|
venue: market.venue
|
|
1263
1297
|
}
|
|
1264
1298
|
];
|
|
1265
1299
|
});
|
|
1266
|
-
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup]);
|
|
1300
|
+
}, [combinedMoneylineMarkets, isCombinedMoneylineGroup, midpointsResult]);
|
|
1267
1301
|
const headerOutcomeVariant = isCombinedMoneylineGroup ? "outcome" : resolveSportsMarketCardVariant(activeMarket);
|
|
1268
1302
|
const handleLineSelect = (index) => {
|
|
1269
1303
|
var _a2, _b2;
|
|
@@ -1347,6 +1381,7 @@ var resolveSportsSectionLabel = (labels, key) => {
|
|
|
1347
1381
|
}
|
|
1348
1382
|
};
|
|
1349
1383
|
var resolveSportsPeriodLabel = (labels, period) => {
|
|
1384
|
+
var _a;
|
|
1350
1385
|
switch (period) {
|
|
1351
1386
|
case "full":
|
|
1352
1387
|
return labels.eventMarketPage.sports.fullPeriod;
|
|
@@ -1374,6 +1409,8 @@ var resolveSportsPeriodLabel = (labels, period) => {
|
|
|
1374
1409
|
return "1st 5 Innings";
|
|
1375
1410
|
case "other":
|
|
1376
1411
|
return labels.eventMarketPage.sports.otherPeriod;
|
|
1412
|
+
default:
|
|
1413
|
+
return (_a = formatSportsPeriodGrammarLabel(period)) != null ? _a : labels.eventMarketPage.sports.otherPeriod;
|
|
1377
1414
|
}
|
|
1378
1415
|
};
|
|
1379
1416
|
var SportsTabButton = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
dispatchAggDepositNotification
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5MRFY5ZQ.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BestPricesIcon,
|
|
7
7
|
BoltIcon,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
shortenAddress,
|
|
42
42
|
useOptionalToast,
|
|
43
43
|
venueLogoLabels
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-MIAAL7BL.mjs";
|
|
45
45
|
|
|
46
46
|
// src/deposit/index.tsx
|
|
47
47
|
import { useAggAuthState, useAggUiConfig, useDepositAddresses, useLabels as useLabels11 } from "@agg-build/hooks";
|