@agg-build/ui 4.21.1 → 4.22.4
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-YBMDEGTJ.mjs → chunk-3DQGXJ7P.mjs} +2 -2
- package/dist/{chunk-R7ARCUYW.mjs → chunk-WAGNSZQ6.mjs} +54 -10
- package/dist/{event-market-5SIXH2XF.mjs → event-market-CEOSCKEG.mjs} +1 -1
- package/dist/index.js +55 -11
- package/dist/index.mjs +2 -2
- package/dist/pages.js +55 -11
- package/dist/pages.mjs +2 -2
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +8 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +8 -1
- package/package.json +2 -2
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
parseRawMicroValue,
|
|
22
22
|
selectOpenLimitOrders,
|
|
23
23
|
useOpenOrderCancellation
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WAGNSZQ6.mjs";
|
|
25
25
|
import {
|
|
26
26
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
27
27
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
@@ -266,7 +266,7 @@ var useHomePageModals = () => {
|
|
|
266
266
|
// src/pages/home/index.tsx
|
|
267
267
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
268
268
|
var DeferredEventMarketPage = lazy(
|
|
269
|
-
() => import("./event-market-
|
|
269
|
+
() => import("./event-market-CEOSCKEG.mjs").then((module) => ({ default: module.EventMarketPage }))
|
|
270
270
|
);
|
|
271
271
|
var MIN_SEARCH_LENGTH = 3;
|
|
272
272
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -1914,7 +1914,12 @@ var resolveSportsLadderTitle = (group, selectedLineDisplay) => {
|
|
|
1914
1914
|
const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
|
|
1915
1915
|
return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
|
|
1916
1916
|
};
|
|
1917
|
-
var
|
|
1917
|
+
var resolveDistanceFromEvenMoney = (market, prices) => {
|
|
1918
|
+
const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
|
|
1919
|
+
return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
|
|
1920
|
+
};
|
|
1921
|
+
var MAIN_LINE_PRICE_BAND = 0.2;
|
|
1922
|
+
var buildSportsSlideFromGroup = (group, prices) => {
|
|
1918
1923
|
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
|
|
1919
1924
|
const hasLadder = lineStops.length > 1;
|
|
1920
1925
|
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
@@ -1922,8 +1927,22 @@ var buildSportsSlideFromGroup = (group) => {
|
|
|
1922
1927
|
venues: lineStop.venues,
|
|
1923
1928
|
market: lineStop.representative
|
|
1924
1929
|
})) : [];
|
|
1930
|
+
const evenMoneyDistances = lineStops.map(
|
|
1931
|
+
(lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
|
|
1932
|
+
);
|
|
1933
|
+
const isBetter = (index, bestIndex) => {
|
|
1934
|
+
const distance = evenMoneyDistances[index];
|
|
1935
|
+
const bestDistance = evenMoneyDistances[bestIndex];
|
|
1936
|
+
const inBand = distance <= MAIN_LINE_PRICE_BAND;
|
|
1937
|
+
const bestInBand = bestDistance <= MAIN_LINE_PRICE_BAND;
|
|
1938
|
+
if (inBand !== bestInBand) return inBand;
|
|
1939
|
+
const volume = lineStops[index].volume;
|
|
1940
|
+
const bestVolume = lineStops[bestIndex].volume;
|
|
1941
|
+
if (inBand) return volume !== bestVolume ? volume > bestVolume : distance < bestDistance;
|
|
1942
|
+
return distance !== bestDistance ? distance < bestDistance : volume > bestVolume;
|
|
1943
|
+
};
|
|
1925
1944
|
const defaultStopIndex = hasLadder ? lineStops.reduce(
|
|
1926
|
-
(bestIndex,
|
|
1945
|
+
(bestIndex, _lineStop, index) => isBetter(index, bestIndex) ? index : bestIndex,
|
|
1927
1946
|
0
|
|
1928
1947
|
) : 0;
|
|
1929
1948
|
return {
|
|
@@ -2337,14 +2356,18 @@ var SportsMarketCard = ({
|
|
|
2337
2356
|
midpointsFallbackVenues,
|
|
2338
2357
|
midpointsResult
|
|
2339
2358
|
}) => {
|
|
2340
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2359
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2341
2360
|
const labels = useLabels6();
|
|
2342
2361
|
const {
|
|
2343
2362
|
formatting: { formatCompactCurrency }
|
|
2344
2363
|
} = useSdkUiConfig2();
|
|
2345
2364
|
const tradingContext = useEventTradingContext();
|
|
2346
|
-
const
|
|
2365
|
+
const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
|
|
2366
|
+
const slide = useMemo2(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
|
|
2347
2367
|
const [selectedLineIndex, setSelectedLineIndex] = useState4(slide.defaultStopIndex);
|
|
2368
|
+
const userPickedLineRef = useRef2(false);
|
|
2369
|
+
const autoLineIndexRef = useRef2(slide.defaultStopIndex);
|
|
2370
|
+
const autoSelectedMarketIdRef = useRef2(null);
|
|
2348
2371
|
const combinedLegs = useMemo2(() => resolveSportsCombinedLegs(group), [group]);
|
|
2349
2372
|
const isCombinedLegGroup = combinedLegs != null;
|
|
2350
2373
|
const combinedLegMarkets = useMemo2(
|
|
@@ -2373,11 +2396,30 @@ var SportsMarketCard = ({
|
|
|
2373
2396
|
const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
|
|
2374
2397
|
if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
|
|
2375
2398
|
}, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2399
|
+
useEffect3(() => {
|
|
2400
|
+
var _a2;
|
|
2401
|
+
if (!slide.hasLadder || userPickedLineRef.current) return;
|
|
2402
|
+
const nextIndex = slide.defaultStopIndex;
|
|
2403
|
+
if (nextIndex === autoLineIndexRef.current) return;
|
|
2404
|
+
const tradingIndex = slide.stops.findIndex(
|
|
2405
|
+
(stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
|
|
2406
|
+
);
|
|
2407
|
+
if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
autoLineIndexRef.current = nextIndex;
|
|
2411
|
+
setSelectedLineIndex(nextIndex);
|
|
2412
|
+
const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
|
|
2413
|
+
if (tradingIndex >= 0 && nextMarket) {
|
|
2414
|
+
autoSelectedMarketIdRef.current = nextMarket.id;
|
|
2415
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
|
|
2416
|
+
}
|
|
2417
|
+
}, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
|
|
2418
|
+
const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
|
|
2419
|
+
const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
|
|
2420
|
+
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
|
|
2379
2421
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
2380
|
-
)) != null ?
|
|
2422
|
+
)) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
2381
2423
|
const wasExpandedRef = useRef2(isExpanded);
|
|
2382
2424
|
useEffect3(() => {
|
|
2383
2425
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
@@ -2389,6 +2431,7 @@ var SportsMarketCard = ({
|
|
|
2389
2431
|
if (hasInScopeOutcome) return;
|
|
2390
2432
|
const firstOutcome = activeDefaultOutcome;
|
|
2391
2433
|
if (firstOutcome) {
|
|
2434
|
+
autoSelectedMarketIdRef.current = activeMarket.id;
|
|
2392
2435
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
2393
2436
|
}
|
|
2394
2437
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
@@ -2430,9 +2473,9 @@ var SportsMarketCard = ({
|
|
|
2430
2473
|
if (!activeMarket) return null;
|
|
2431
2474
|
const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
|
|
2432
2475
|
const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
|
|
2433
|
-
const activeOutcome = (
|
|
2476
|
+
const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
|
|
2434
2477
|
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
2435
|
-
)) != null ?
|
|
2478
|
+
)) != null ? _i : activeDefaultOutcome;
|
|
2436
2479
|
const activeOutcomeVenueCount = (() => {
|
|
2437
2480
|
var _a2, _b2;
|
|
2438
2481
|
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
@@ -2474,6 +2517,7 @@ var SportsMarketCard = ({
|
|
|
2474
2517
|
useSpreadOverride: slide.kind === "spread"
|
|
2475
2518
|
});
|
|
2476
2519
|
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
2520
|
+
userPickedLineRef.current = true;
|
|
2477
2521
|
setSelectedLineIndex(index);
|
|
2478
2522
|
if (nextOutcome) {
|
|
2479
2523
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
package/dist/index.js
CHANGED
|
@@ -31954,7 +31954,7 @@ var init_event_market_shared = __esm({
|
|
|
31954
31954
|
});
|
|
31955
31955
|
|
|
31956
31956
|
// src/pages/event-market/sports-event-market.utils.ts
|
|
31957
|
-
var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
|
|
31957
|
+
var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, resolveDistanceFromEvenMoney, MAIN_LINE_PRICE_BAND, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
|
|
31958
31958
|
var init_sports_event_market_utils = __esm({
|
|
31959
31959
|
"src/pages/event-market/sports-event-market.utils.ts"() {
|
|
31960
31960
|
"use strict";
|
|
@@ -32911,7 +32911,12 @@ var init_sports_event_market_utils = __esm({
|
|
|
32911
32911
|
const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
|
|
32912
32912
|
return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
|
|
32913
32913
|
};
|
|
32914
|
-
|
|
32914
|
+
resolveDistanceFromEvenMoney = (market, prices) => {
|
|
32915
|
+
const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
|
|
32916
|
+
return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
|
|
32917
|
+
};
|
|
32918
|
+
MAIN_LINE_PRICE_BAND = 0.2;
|
|
32919
|
+
buildSportsSlideFromGroup = (group, prices) => {
|
|
32915
32920
|
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
|
|
32916
32921
|
const hasLadder = lineStops.length > 1;
|
|
32917
32922
|
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
@@ -32919,8 +32924,22 @@ var init_sports_event_market_utils = __esm({
|
|
|
32919
32924
|
venues: lineStop.venues,
|
|
32920
32925
|
market: lineStop.representative
|
|
32921
32926
|
})) : [];
|
|
32927
|
+
const evenMoneyDistances = lineStops.map(
|
|
32928
|
+
(lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
|
|
32929
|
+
);
|
|
32930
|
+
const isBetter = (index, bestIndex) => {
|
|
32931
|
+
const distance = evenMoneyDistances[index];
|
|
32932
|
+
const bestDistance = evenMoneyDistances[bestIndex];
|
|
32933
|
+
const inBand = distance <= MAIN_LINE_PRICE_BAND;
|
|
32934
|
+
const bestInBand = bestDistance <= MAIN_LINE_PRICE_BAND;
|
|
32935
|
+
if (inBand !== bestInBand) return inBand;
|
|
32936
|
+
const volume = lineStops[index].volume;
|
|
32937
|
+
const bestVolume = lineStops[bestIndex].volume;
|
|
32938
|
+
if (inBand) return volume !== bestVolume ? volume > bestVolume : distance < bestDistance;
|
|
32939
|
+
return distance !== bestDistance ? distance < bestDistance : volume > bestVolume;
|
|
32940
|
+
};
|
|
32922
32941
|
const defaultStopIndex = hasLadder ? lineStops.reduce(
|
|
32923
|
-
(bestIndex,
|
|
32942
|
+
(bestIndex, _lineStop, index) => isBetter(index, bestIndex) ? index : bestIndex,
|
|
32924
32943
|
0
|
|
32925
32944
|
) : 0;
|
|
32926
32945
|
return {
|
|
@@ -33348,14 +33367,18 @@ var init_sports_market_card = __esm({
|
|
|
33348
33367
|
midpointsFallbackVenues,
|
|
33349
33368
|
midpointsResult
|
|
33350
33369
|
}) => {
|
|
33351
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
33370
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33352
33371
|
const labels = (0, import_hooks96.useLabels)();
|
|
33353
33372
|
const {
|
|
33354
33373
|
formatting: { formatCompactCurrency }
|
|
33355
33374
|
} = (0, import_hooks96.useSdkUiConfig)();
|
|
33356
33375
|
const tradingContext = (0, import_hooks96.useEventTradingContext)();
|
|
33357
|
-
const
|
|
33376
|
+
const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
|
|
33377
|
+
const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
|
|
33358
33378
|
const [selectedLineIndex, setSelectedLineIndex] = (0, import_react65.useState)(slide.defaultStopIndex);
|
|
33379
|
+
const userPickedLineRef = (0, import_react65.useRef)(false);
|
|
33380
|
+
const autoLineIndexRef = (0, import_react65.useRef)(slide.defaultStopIndex);
|
|
33381
|
+
const autoSelectedMarketIdRef = (0, import_react65.useRef)(null);
|
|
33359
33382
|
const combinedLegs = (0, import_react65.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
|
|
33360
33383
|
const isCombinedLegGroup = combinedLegs != null;
|
|
33361
33384
|
const combinedLegMarkets = (0, import_react65.useMemo)(
|
|
@@ -33384,11 +33407,30 @@ var init_sports_market_card = __esm({
|
|
|
33384
33407
|
const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
|
|
33385
33408
|
if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
|
|
33386
33409
|
}, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
|
|
33387
|
-
|
|
33388
|
-
|
|
33389
|
-
|
|
33410
|
+
(0, import_react65.useEffect)(() => {
|
|
33411
|
+
var _a2;
|
|
33412
|
+
if (!slide.hasLadder || userPickedLineRef.current) return;
|
|
33413
|
+
const nextIndex = slide.defaultStopIndex;
|
|
33414
|
+
if (nextIndex === autoLineIndexRef.current) return;
|
|
33415
|
+
const tradingIndex = slide.stops.findIndex(
|
|
33416
|
+
(stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
|
|
33417
|
+
);
|
|
33418
|
+
if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
|
|
33419
|
+
return;
|
|
33420
|
+
}
|
|
33421
|
+
autoLineIndexRef.current = nextIndex;
|
|
33422
|
+
setSelectedLineIndex(nextIndex);
|
|
33423
|
+
const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
|
|
33424
|
+
if (tradingIndex >= 0 && nextMarket) {
|
|
33425
|
+
autoSelectedMarketIdRef.current = nextMarket.id;
|
|
33426
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
|
|
33427
|
+
}
|
|
33428
|
+
}, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
|
|
33429
|
+
const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
|
|
33430
|
+
const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
|
|
33431
|
+
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
|
|
33390
33432
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
33391
|
-
)) != null ?
|
|
33433
|
+
)) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
33392
33434
|
const wasExpandedRef = (0, import_react65.useRef)(isExpanded);
|
|
33393
33435
|
(0, import_react65.useEffect)(() => {
|
|
33394
33436
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
@@ -33400,6 +33442,7 @@ var init_sports_market_card = __esm({
|
|
|
33400
33442
|
if (hasInScopeOutcome) return;
|
|
33401
33443
|
const firstOutcome = activeDefaultOutcome;
|
|
33402
33444
|
if (firstOutcome) {
|
|
33445
|
+
autoSelectedMarketIdRef.current = activeMarket.id;
|
|
33403
33446
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
33404
33447
|
}
|
|
33405
33448
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
@@ -33441,9 +33484,9 @@ var init_sports_market_card = __esm({
|
|
|
33441
33484
|
if (!activeMarket) return null;
|
|
33442
33485
|
const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
|
|
33443
33486
|
const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
|
|
33444
|
-
const activeOutcome = (
|
|
33487
|
+
const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
|
|
33445
33488
|
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
33446
|
-
)) != null ?
|
|
33489
|
+
)) != null ? _i : activeDefaultOutcome;
|
|
33447
33490
|
const activeOutcomeVenueCount = (() => {
|
|
33448
33491
|
var _a2, _b2;
|
|
33449
33492
|
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
@@ -33485,6 +33528,7 @@ var init_sports_market_card = __esm({
|
|
|
33485
33528
|
useSpreadOverride: slide.kind === "spread"
|
|
33486
33529
|
});
|
|
33487
33530
|
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
33531
|
+
userPickedLineRef.current = true;
|
|
33488
33532
|
setSelectedLineIndex(index);
|
|
33489
33533
|
if (nextOutcome) {
|
|
33490
33534
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
buildAggTxExplorerHref,
|
|
17
17
|
formatShareAmount,
|
|
18
18
|
useHomePageModals
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3DQGXJ7P.mjs";
|
|
20
20
|
import {
|
|
21
21
|
EventList,
|
|
22
22
|
EventListItem,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
EventOpenOrdersCard,
|
|
41
41
|
formatRecurringCountdown,
|
|
42
42
|
useEventOpenOrders
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-WAGNSZQ6.mjs";
|
|
44
44
|
import {
|
|
45
45
|
EventListItemDetails,
|
|
46
46
|
MarketDetails,
|
package/dist/pages.js
CHANGED
|
@@ -31229,7 +31229,7 @@ var init_event_market_shared = __esm({
|
|
|
31229
31229
|
});
|
|
31230
31230
|
|
|
31231
31231
|
// src/pages/event-market/sports-event-market.utils.ts
|
|
31232
|
-
var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
|
|
31232
|
+
var SPORTS_MARKET_TYPE_KEYS, SPORTS_PERIOD_KEYS, SPORTS_PERIOD_GRAMMAR_PATTERN, SPORTS_MARKET_CATEGORY_KEYS, SPORTS_MARKET_GROUP_KEYS, SPORTS_PERIOD_KEY_SET, SPORTS_MARKET_TYPE_KEY_SET, SPORTS_MARKET_CATEGORY_KEY_SET, SPORTS_MARKET_GROUP_KEY_SET, SPORTS_LEGACY_PROP_CATEGORY_KEY_SET, SPORTS_GAME_LINE_GROUPS, SPORTS_GENERIC_STAT, ESPORTS_CATEGORY_TOKENS, ESPORTS_TITLE_PATTERN, SERIES_SCOPE_PATTERN, SPORTS_PERIOD_ORDER, FIRST_N_INNINGS_PATTERN, SPORTS_MARKET_TYPE_ORDER, YES_NO_LABELS, LINE_MARKET_TYPES, PLAYER_PROP_COUNT_PATTERN, REG_TIME_TITLE_PATTERN, toTrimmedString, resolveSportsMarketAggKey, sanitizeFamilyValue, stripLineValueFromQuestion, SPORTS_PERIOD_FAMILY_ORDER, getSportsPeriodOrderIndex, getSportsMarketTypeOrderIndex, resolveSportsPeriodFamily, normalizeSportsPeriod, normalizeSportsMarketType, normalizeSportsMarketCategory, normalizeSportsMarketGroup, resolveFallbackSportsMarketCategory, resolveSportsStatToken, resolveMarketSectionTabKey, SPORTS_PERIOD_FAMILY_ALLOWED_SPORTS, PERIOD_N_FAMILY_PATTERN, isPeriodFamilyAllowedForSport, resolveEffectiveMarketSectionTabKey, resolveVisibleSportsSectionTabs, resolveSportsSectionFilters, hasTeamTitledOutcomes, isClusterRelation, isDecomposedLeg, singleEnumeratesLegs, dropDecomposedLegsMergedIntoSingle, resolveSportsSectionMarkets, resolveSportsMarketCardVariant, isBinarySportsMoneylineMarket, AGGKEY_LINE_TOKEN_PATTERN, resolveSportsLineFamilyKey, resolveSpreadFamilyKey, SPREAD_KEY_LEG_PATTERN, resolveSpreadKeyLeg, isSpreadUnderdogLeg, resolveSpreadAnchorToken, SPREAD_NON_TEAM_TITLE_PATTERN, isSpreadTeamTitle, resolveSpreadOutcomeTeamNames, resolveCombinedMoneylineLegLabel, normalizeSportsSubtypeToken, SPORTS_LEG_GROUPABLE_GROUPS, DRAW_OUTCOME_TITLE_PATTERN, isThreeWayMoneylineHub, resolveDisplayGroupFamilyKey, resolveMarketOwnCardKey, LEG_GROUP_KEY_MARKER, TOTAL_STAT_UNITS, resolveTotalStatUnit, SPORTS_LEG_TITLE_OVERRIDES, SPORTS_LEG_TITLE_SMALL_WORDS, formatSportsLegTitle, resolveDisplayGroupTitle, sortMarketsByLineValue, buildSportsMarketDisplayGroups, groupSportsMarketsByPeriod, resolveSelectedSportsLineValue, collectVenueNames, resolveTotalGroupVolume, resolveSportsExpandedMarkets, resolveSportsExpandedMarketsVolume, resolveHighestVolumeIndex, resolveSportsCombinedLegs, resolveSlideKind, aggregateSportsLineStops, escapeRegExp, resolveSportsLadderTitle, resolveDistanceFromEvenMoney, MAIN_LINE_PRICE_BAND, buildSportsSlideFromGroup, formatSportsPeriodGrammarLabel, resolveSportsCategoryTokens, isNonStandardSportsLikeEvent, mergeSportsSectionMarketsIntoEvent;
|
|
31233
31233
|
var init_sports_event_market_utils = __esm({
|
|
31234
31234
|
"src/pages/event-market/sports-event-market.utils.ts"() {
|
|
31235
31235
|
"use strict";
|
|
@@ -32186,7 +32186,12 @@ var init_sports_event_market_utils = __esm({
|
|
|
32186
32186
|
const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
|
|
32187
32187
|
return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
|
|
32188
32188
|
};
|
|
32189
|
-
|
|
32189
|
+
resolveDistanceFromEvenMoney = (market, prices) => {
|
|
32190
|
+
const price = market.venueMarketOutcomes.map((outcome) => prices == null ? void 0 : prices.get(outcome.id)).find((value) => value != null);
|
|
32191
|
+
return price == null ? Number.POSITIVE_INFINITY : Math.abs(price - 0.5);
|
|
32192
|
+
};
|
|
32193
|
+
MAIN_LINE_PRICE_BAND = 0.2;
|
|
32194
|
+
buildSportsSlideFromGroup = (group, prices) => {
|
|
32190
32195
|
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
|
|
32191
32196
|
const hasLadder = lineStops.length > 1;
|
|
32192
32197
|
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
@@ -32194,8 +32199,22 @@ var init_sports_event_market_utils = __esm({
|
|
|
32194
32199
|
venues: lineStop.venues,
|
|
32195
32200
|
market: lineStop.representative
|
|
32196
32201
|
})) : [];
|
|
32202
|
+
const evenMoneyDistances = lineStops.map(
|
|
32203
|
+
(lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
|
|
32204
|
+
);
|
|
32205
|
+
const isBetter = (index, bestIndex) => {
|
|
32206
|
+
const distance = evenMoneyDistances[index];
|
|
32207
|
+
const bestDistance = evenMoneyDistances[bestIndex];
|
|
32208
|
+
const inBand = distance <= MAIN_LINE_PRICE_BAND;
|
|
32209
|
+
const bestInBand = bestDistance <= MAIN_LINE_PRICE_BAND;
|
|
32210
|
+
if (inBand !== bestInBand) return inBand;
|
|
32211
|
+
const volume = lineStops[index].volume;
|
|
32212
|
+
const bestVolume = lineStops[bestIndex].volume;
|
|
32213
|
+
if (inBand) return volume !== bestVolume ? volume > bestVolume : distance < bestDistance;
|
|
32214
|
+
return distance !== bestDistance ? distance < bestDistance : volume > bestVolume;
|
|
32215
|
+
};
|
|
32197
32216
|
const defaultStopIndex = hasLadder ? lineStops.reduce(
|
|
32198
|
-
(bestIndex,
|
|
32217
|
+
(bestIndex, _lineStop, index) => isBetter(index, bestIndex) ? index : bestIndex,
|
|
32199
32218
|
0
|
|
32200
32219
|
) : 0;
|
|
32201
32220
|
return {
|
|
@@ -32623,14 +32642,18 @@ var init_sports_market_card = __esm({
|
|
|
32623
32642
|
midpointsFallbackVenues,
|
|
32624
32643
|
midpointsResult
|
|
32625
32644
|
}) => {
|
|
32626
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
32645
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
32627
32646
|
const labels = (0, import_hooks93.useLabels)();
|
|
32628
32647
|
const {
|
|
32629
32648
|
formatting: { formatCompactCurrency }
|
|
32630
32649
|
} = (0, import_hooks93.useSdkUiConfig)();
|
|
32631
32650
|
const tradingContext = (0, import_hooks93.useEventTradingContext)();
|
|
32632
|
-
const
|
|
32651
|
+
const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
|
|
32652
|
+
const slide = (0, import_react65.useMemo)(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
|
|
32633
32653
|
const [selectedLineIndex, setSelectedLineIndex] = (0, import_react65.useState)(slide.defaultStopIndex);
|
|
32654
|
+
const userPickedLineRef = (0, import_react65.useRef)(false);
|
|
32655
|
+
const autoLineIndexRef = (0, import_react65.useRef)(slide.defaultStopIndex);
|
|
32656
|
+
const autoSelectedMarketIdRef = (0, import_react65.useRef)(null);
|
|
32634
32657
|
const combinedLegs = (0, import_react65.useMemo)(() => resolveSportsCombinedLegs(group), [group]);
|
|
32635
32658
|
const isCombinedLegGroup = combinedLegs != null;
|
|
32636
32659
|
const combinedLegMarkets = (0, import_react65.useMemo)(
|
|
@@ -32659,11 +32682,30 @@ var init_sports_market_card = __esm({
|
|
|
32659
32682
|
const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
|
|
32660
32683
|
if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
|
|
32661
32684
|
}, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
|
|
32662
|
-
|
|
32663
|
-
|
|
32664
|
-
|
|
32685
|
+
(0, import_react65.useEffect)(() => {
|
|
32686
|
+
var _a2;
|
|
32687
|
+
if (!slide.hasLadder || userPickedLineRef.current) return;
|
|
32688
|
+
const nextIndex = slide.defaultStopIndex;
|
|
32689
|
+
if (nextIndex === autoLineIndexRef.current) return;
|
|
32690
|
+
const tradingIndex = slide.stops.findIndex(
|
|
32691
|
+
(stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
|
|
32692
|
+
);
|
|
32693
|
+
if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
|
|
32694
|
+
return;
|
|
32695
|
+
}
|
|
32696
|
+
autoLineIndexRef.current = nextIndex;
|
|
32697
|
+
setSelectedLineIndex(nextIndex);
|
|
32698
|
+
const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
|
|
32699
|
+
if (tradingIndex >= 0 && nextMarket) {
|
|
32700
|
+
autoSelectedMarketIdRef.current = nextMarket.id;
|
|
32701
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
|
|
32702
|
+
}
|
|
32703
|
+
}, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
|
|
32704
|
+
const activeLegMarket = isCombinedLegGroup ? preferredResolvedLegMarket != null ? preferredResolvedLegMarket : (tradingContext == null ? void 0 : tradingContext.selectedMarketId) ? (_b = group.markets.find((market) => market.id === tradingContext.selectedMarketId)) != null ? _b : null : null : null;
|
|
32705
|
+
const activeMarket = slide.hasLadder ? (_e = (_d = (_c = slide.stops[selectedLineIndex]) == null ? void 0 : _c.market) != null ? _d : group.markets[0]) != null ? _e : null : (_g = (_f = activeLegMarket != null ? activeLegMarket : combinedLegMarkets[0]) != null ? _f : group.markets[0]) != null ? _g : null;
|
|
32706
|
+
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
|
|
32665
32707
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
32666
|
-
)) != null ?
|
|
32708
|
+
)) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
32667
32709
|
const wasExpandedRef = (0, import_react65.useRef)(isExpanded);
|
|
32668
32710
|
(0, import_react65.useEffect)(() => {
|
|
32669
32711
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
@@ -32675,6 +32717,7 @@ var init_sports_market_card = __esm({
|
|
|
32675
32717
|
if (hasInScopeOutcome) return;
|
|
32676
32718
|
const firstOutcome = activeDefaultOutcome;
|
|
32677
32719
|
if (firstOutcome) {
|
|
32720
|
+
autoSelectedMarketIdRef.current = activeMarket.id;
|
|
32678
32721
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
32679
32722
|
}
|
|
32680
32723
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
@@ -32716,9 +32759,9 @@ var init_sports_market_card = __esm({
|
|
|
32716
32759
|
if (!activeMarket) return null;
|
|
32717
32760
|
const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
|
|
32718
32761
|
const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
|
|
32719
|
-
const activeOutcome = (
|
|
32762
|
+
const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
|
|
32720
32763
|
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
32721
|
-
)) != null ?
|
|
32764
|
+
)) != null ? _i : activeDefaultOutcome;
|
|
32722
32765
|
const activeOutcomeVenueCount = (() => {
|
|
32723
32766
|
var _a2, _b2;
|
|
32724
32767
|
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
@@ -32760,6 +32803,7 @@ var init_sports_market_card = __esm({
|
|
|
32760
32803
|
useSpreadOverride: slide.kind === "spread"
|
|
32761
32804
|
});
|
|
32762
32805
|
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
32806
|
+
userPickedLineRef.current = true;
|
|
32763
32807
|
setSelectedLineIndex(index);
|
|
32764
32808
|
if (nextOutcome) {
|
|
32765
32809
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
package/dist/pages.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
buildAggTxExplorerHref,
|
|
14
14
|
formatShareAmount,
|
|
15
15
|
useHomePageModals
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3DQGXJ7P.mjs";
|
|
17
17
|
import "./chunk-LIB6TLLV.mjs";
|
|
18
18
|
import {
|
|
19
19
|
EventMarketPage,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
EventOpenOrdersCard,
|
|
22
22
|
formatRecurringCountdown,
|
|
23
23
|
useEventOpenOrders
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WAGNSZQ6.mjs";
|
|
25
25
|
import "./chunk-LTFRGJPL.mjs";
|
|
26
26
|
import {
|
|
27
27
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
@@ -211,7 +211,14 @@ export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplay
|
|
|
211
211
|
* returned untouched.
|
|
212
212
|
*/
|
|
213
213
|
export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
|
|
214
|
-
|
|
214
|
+
/**
|
|
215
|
+
* The default line is the main line, picked by `prices` (outcomeId → midpoint):
|
|
216
|
+
* among lines priced within 30–70¢ the highest volume wins; with none in that
|
|
217
|
+
* band, the line closest to 50/50 wins. Volume alone is misleading — a stale
|
|
218
|
+
* lopsided line (kalshi's "Over 25.5" on an NFL game total, 95¢) can outtrade
|
|
219
|
+
* every real line, and most lines report zero volume at all.
|
|
220
|
+
*/
|
|
221
|
+
export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup, prices?: ReadonlyMap<string, number>) => SportsGameLineSlide;
|
|
215
222
|
/**
|
|
216
223
|
* Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
|
|
217
224
|
* flat list of venue markets. Reuses {@link buildSportsMarketDisplayGroups} so
|
|
@@ -211,7 +211,14 @@ export declare const resolveSportsCombinedLegs: (group: Pick<SportsMarketDisplay
|
|
|
211
211
|
* returned untouched.
|
|
212
212
|
*/
|
|
213
213
|
export declare const resolveSportsLadderTitle: (group: SportsMarketDisplayGroup, selectedLineDisplay: string) => string;
|
|
214
|
-
|
|
214
|
+
/**
|
|
215
|
+
* The default line is the main line, picked by `prices` (outcomeId → midpoint):
|
|
216
|
+
* among lines priced within 30–70¢ the highest volume wins; with none in that
|
|
217
|
+
* band, the line closest to 50/50 wins. Volume alone is misleading — a stale
|
|
218
|
+
* lopsided line (kalshi's "Over 25.5" on an NFL game total, 95¢) can outtrade
|
|
219
|
+
* every real line, and most lines report zero volume at all.
|
|
220
|
+
*/
|
|
221
|
+
export declare const buildSportsSlideFromGroup: (group: SportsMarketDisplayGroup, prices?: ReadonlyMap<string, number>) => SportsGameLineSlide;
|
|
215
222
|
/**
|
|
216
223
|
* Derive the Moneyline / Spreads / Total game-line slides (in that order) from a
|
|
217
224
|
* flat list of venue markets. Reuses {@link buildSportsMarketDisplayGroups} so
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.4",
|
|
4
4
|
"description": "Pre-built React component library for the AGG prediction market aggregator. Tailwind-based, themeable, with primitives, event surfaces, trading flows, full pages, and modals.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"react": "^18.0.0 || ^19.0.0",
|
|
102
102
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
103
103
|
"@agg-build/hooks": "^4.21.1",
|
|
104
|
-
"@agg-build/sdk": "^4.
|
|
104
|
+
"@agg-build/sdk": "^4.22.3"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"@number-flow/react": "^0.6.0",
|