@agg-build/ui 4.21.0 → 4.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5PA5KLXN.mjs → chunk-4IO5CRSG.mjs} +3 -3
- package/dist/{chunk-JLO2BGSF.mjs → chunk-LIB6TLLV.mjs} +1 -1
- package/dist/{chunk-DWPBGMVJ.mjs → chunk-LTFRGJPL.mjs} +121 -167
- package/dist/{chunk-DONMO42Q.mjs → chunk-NDD5IHAU.mjs} +62 -16
- package/dist/{event-market-UREM3ZE7.mjs → event-market-F2FPSTAB.mjs} +2 -2
- package/dist/events.js +121 -167
- package/dist/events.mjs +2 -2
- package/dist/index.js +188 -188
- package/dist/index.mjs +4 -4
- package/dist/pages.js +188 -188
- package/dist/pages.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/types/events/item-details/event-markets-chart.d.mts +1 -2
- package/dist/types/events/item-details/event-markets-chart.d.ts +1 -2
- package/dist/types/events/item-details/event-markets-chart.utils.d.mts +4 -12
- package/dist/types/events/item-details/event-markets-chart.utils.d.ts +4 -12
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +6 -1
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +6 -1
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
EventListTabs,
|
|
9
9
|
useEventListTabs,
|
|
10
10
|
useEventListTabsHeaderOverflow
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LIB6TLLV.mjs";
|
|
12
12
|
import {
|
|
13
13
|
OPEN_ORDER_FALLBACK_THUMBNAIL_SRC,
|
|
14
14
|
OPEN_ORDER_QUERY_STATUSES,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
parseRawMicroValue,
|
|
22
22
|
selectOpenLimitOrders,
|
|
23
23
|
useOpenOrderCancellation
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-NDD5IHAU.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-F2FPSTAB.mjs").then((module) => ({ default: module.EventMarketPage }))
|
|
270
270
|
);
|
|
271
271
|
var MIN_SEARCH_LENGTH = 3;
|
|
272
272
|
var SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -1650,64 +1650,32 @@ var formatContractChartTime = (timestamp) => {
|
|
|
1650
1650
|
|
|
1651
1651
|
// src/events/item-details/event-markets-chart.utils.ts
|
|
1652
1652
|
import { resolveMarketTradingState } from "@agg-build/hooks";
|
|
1653
|
-
var
|
|
1654
|
-
|
|
1655
|
-
var _a, _b;
|
|
1656
|
-
if (!selectedOutcomeId) return null;
|
|
1657
|
-
const allMarkets = normalizeVenueMarketCluster(markets);
|
|
1658
|
-
const market = allMarkets.find(
|
|
1659
|
-
(item) => item.venueMarketOutcomes.some((outcome2) => outcome2.id === selectedOutcomeId)
|
|
1660
|
-
);
|
|
1661
|
-
const outcome = market == null ? void 0 : market.venueMarketOutcomes.find((item) => item.id === selectedOutcomeId);
|
|
1662
|
-
if (!market || !outcome) return null;
|
|
1663
|
-
return (_b = (_a = collectEligibleVenueOutcomes({
|
|
1664
|
-
venueMarkets: normalizeVenueMarketCluster(markets, market.id),
|
|
1665
|
-
selectedOutcomeLabel: outcome.label,
|
|
1666
|
-
selectedOutcomeId
|
|
1667
|
-
}).find((item) => item.venue === venue)) == null ? void 0 : _a.outcomeId) != null ? _b : null;
|
|
1668
|
-
}
|
|
1669
|
-
function resolveEventChartPage(outcomes, selectedOutcomeId, requestedPage) {
|
|
1653
|
+
var EVENT_CHART_MARKET_LIMIT = 3;
|
|
1654
|
+
var marketVolume = (market) => {
|
|
1670
1655
|
var _a;
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
page,
|
|
1678
|
-
pageCount,
|
|
1679
|
-
pinnedId: (_a = pinned == null ? void 0 : pinned.id) != null ? _a : null,
|
|
1680
|
-
outcomes: [
|
|
1681
|
-
...pinned ? [pinned] : [],
|
|
1682
|
-
...remaining.slice(page * pageSize, (page + 1) * pageSize)
|
|
1683
|
-
]
|
|
1684
|
-
};
|
|
1685
|
-
}
|
|
1686
|
-
var resolveEventChartOutcomes = (markets, venue, eventEndDate) => normalizeVenueMarketCluster(markets).filter((market) => market.venue === venue).sort(
|
|
1687
|
-
(left, right) => {
|
|
1688
|
-
var _a, _b;
|
|
1689
|
-
return ((_a = right.volume) != null ? _a : 0) - ((_b = left.volume) != null ? _b : 0) || left.id.localeCompare(right.id);
|
|
1690
|
-
}
|
|
1691
|
-
).flatMap((market) => {
|
|
1656
|
+
return Number.isFinite(market.volume) ? Math.max(0, (_a = market.volume) != null ? _a : 0) : 0;
|
|
1657
|
+
};
|
|
1658
|
+
var resolveTopEventChartMarkets = (markets, venue) => normalizeVenueMarketCluster(markets).filter((market) => market.venue === venue && market.venueMarketOutcomes.length > 0).sort(
|
|
1659
|
+
(left, right) => marketVolume(right) - marketVolume(left) || left.id.localeCompare(right.id)
|
|
1660
|
+
).slice(0, EVENT_CHART_MARKET_LIMIT);
|
|
1661
|
+
var resolveEventChartOutcomes = (markets, venue, eventEndDate) => resolveTopEventChartMarkets(markets, venue).flatMap((market) => {
|
|
1692
1662
|
var _a, _b, _c;
|
|
1693
1663
|
const state = resolveMarketTradingState(market);
|
|
1694
1664
|
const hasFinalResult = state.kind === "resolved" && market.venueMarketOutcomes.some((outcome) => outcome.winner === true) && market.venueMarketOutcomes.every((outcome) => outcome.winner != null);
|
|
1695
1665
|
const settledAt = Date.parse((_c = (_b = (_a = market.resolutionDate) != null ? _a : market.endDate) != null ? _b : eventEndDate) != null ? _c : "") / 1e3;
|
|
1696
|
-
const ordered =
|
|
1697
|
-
const rank = (label) => label.trim().toLowerCase() === "yes" ? 0 : label.trim().toLowerCase() === "no" ? 1 : 2;
|
|
1698
|
-
return rank(a.label) - rank(b.label);
|
|
1699
|
-
});
|
|
1666
|
+
const ordered = sortOutcomeSelectorOutcomes(market.venueMarketOutcomes);
|
|
1700
1667
|
return ordered.map((outcome) => {
|
|
1701
|
-
var _a2;
|
|
1668
|
+
var _a2, _b2;
|
|
1702
1669
|
return {
|
|
1703
1670
|
id: outcome.id,
|
|
1704
1671
|
marketId: market.id,
|
|
1705
1672
|
venue: market.venue,
|
|
1706
1673
|
side: outcome.label,
|
|
1674
|
+
outcomeLabel: ((_a2 = outcome.title) == null ? void 0 : _a2.trim()) || outcome.label,
|
|
1707
1675
|
live: !state.isTradingDisabled,
|
|
1708
1676
|
finalValue: hasFinalResult ? outcome.winner ? 100 : 0 : void 0,
|
|
1709
1677
|
settledAt: Number.isFinite(settledAt) ? settledAt : void 0,
|
|
1710
|
-
label: `${market.question} \xB7 ${((
|
|
1678
|
+
label: `${market.question} \xB7 ${((_b2 = outcome.title) == null ? void 0 : _b2.trim()) || outcome.label}`
|
|
1711
1679
|
};
|
|
1712
1680
|
});
|
|
1713
1681
|
});
|
|
@@ -1720,8 +1688,7 @@ var EventMarketsChart = ({
|
|
|
1720
1688
|
eventEndDate,
|
|
1721
1689
|
contractWindow,
|
|
1722
1690
|
range,
|
|
1723
|
-
live
|
|
1724
|
-
selectedOutcomeId
|
|
1691
|
+
live
|
|
1725
1692
|
}) => {
|
|
1726
1693
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1727
1694
|
const labels = useLabels6();
|
|
@@ -1733,31 +1700,20 @@ var EventMarketsChart = ({
|
|
|
1733
1700
|
() => [...new Set(normalizeVenueMarketCluster(markets).map((market) => market.venue))],
|
|
1734
1701
|
[markets]
|
|
1735
1702
|
);
|
|
1736
|
-
const venue = venues.includes(defaultVenue) ? defaultVenue : (_a = venues[0]) != null ? _a : defaultVenue;
|
|
1737
|
-
const outcomes = useMemo5(
|
|
1738
|
-
() => resolveEventChartOutcomes(markets, venue, eventEndDate),
|
|
1739
|
-
[markets, venue, eventEndDate]
|
|
1740
|
-
);
|
|
1741
1703
|
const [selection, setSelection] = useState2(() => ({
|
|
1742
|
-
|
|
1743
|
-
|
|
1704
|
+
defaultVenue,
|
|
1705
|
+
venue: defaultVenue,
|
|
1744
1706
|
hidden: /* @__PURE__ */ new Set()
|
|
1745
1707
|
}));
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
);
|
|
1750
|
-
const
|
|
1751
|
-
() =>
|
|
1752
|
-
[
|
|
1753
|
-
);
|
|
1754
|
-
const page = useMemo5(
|
|
1755
|
-
() => resolveEventChartPage(outcomes, pinnedOutcomeId, currentSelection.page),
|
|
1756
|
-
[outcomes, pinnedOutcomeId, currentSelection.page]
|
|
1757
|
-
);
|
|
1758
|
-
const activeOutcomes = page.outcomes.filter(
|
|
1759
|
-
(outcome) => outcome.id === page.pinnedId || !currentSelection.hidden.has(outcome.id)
|
|
1708
|
+
const requestedVenue = selection.defaultVenue === defaultVenue ? selection.venue : defaultVenue;
|
|
1709
|
+
const venue = venues.includes(requestedVenue) ? requestedVenue : (_a = venues[0]) != null ? _a : defaultVenue;
|
|
1710
|
+
const hidden = selection.defaultVenue === defaultVenue && selection.venue === venue ? selection.hidden : /* @__PURE__ */ new Set();
|
|
1711
|
+
const topMarkets = useMemo5(() => resolveTopEventChartMarkets(markets, venue), [markets, venue]);
|
|
1712
|
+
const outcomes = useMemo5(
|
|
1713
|
+
() => resolveEventChartOutcomes(topMarkets, venue, eventEndDate),
|
|
1714
|
+
[topMarkets, venue, eventEndDate]
|
|
1760
1715
|
);
|
|
1716
|
+
const activeOutcomes = outcomes.filter((outcome) => !hidden.has(outcome.id));
|
|
1761
1717
|
const activeIds = new Set(activeOutcomes.map((outcome) => outcome.id));
|
|
1762
1718
|
const rollingWindow = useRollingChartWindow({
|
|
1763
1719
|
range,
|
|
@@ -1790,10 +1746,10 @@ var EventMarketsChart = ({
|
|
|
1790
1746
|
live: live && !windowEnded
|
|
1791
1747
|
});
|
|
1792
1748
|
const stableColorIds = useMemo5(
|
|
1793
|
-
() =>
|
|
1794
|
-
[
|
|
1749
|
+
() => normalizeVenueMarketCluster(markets).filter((market) => market.venue === venue).map((market) => market.id).sort(),
|
|
1750
|
+
[markets, venue]
|
|
1795
1751
|
);
|
|
1796
|
-
const allSeries =
|
|
1752
|
+
const allSeries = outcomes.map((outcome) => {
|
|
1797
1753
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i;
|
|
1798
1754
|
const settledAt = outcome.settledAt == null ? void 0 : contractWindow ? Math.min(outcome.settledAt, contractWindow.to) : outcome.settledAt;
|
|
1799
1755
|
const outcomeLive = outcome.live && !windowEnded;
|
|
@@ -1829,110 +1785,109 @@ var EventMarketsChart = ({
|
|
|
1829
1785
|
});
|
|
1830
1786
|
const visibleSeries = allSeries.filter((series) => activeIds.has(series.id));
|
|
1831
1787
|
const hasVisibleHistory = visibleSeries.some((series) => series.points.length > 0);
|
|
1832
|
-
const volume =
|
|
1833
|
-
(
|
|
1788
|
+
const volume = topMarkets.reduce(
|
|
1789
|
+
(sum, market) => {
|
|
1834
1790
|
var _a2;
|
|
1835
|
-
return sum + ((_a2 = market.volume) != null ? _a2 : 0);
|
|
1836
|
-
},
|
|
1837
|
-
|
|
1791
|
+
return sum + (Number.isFinite(market.volume) ? Math.max(0, (_a2 = market.volume) != null ? _a2 : 0) : 0);
|
|
1792
|
+
},
|
|
1793
|
+
0
|
|
1838
1794
|
);
|
|
1839
1795
|
const venueLabel = (_g = labels.venues[venue]) != null ? _g : venue;
|
|
1840
1796
|
return /* @__PURE__ */ jsxs4("div", { className: "agg-event-markets-chart flex flex-col gap-3", children: [
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
suffix: /* @__PURE__ */ jsx6(Icon, { name: "chevron-right", size: "small" }),
|
|
1870
|
-
children: labels.eventItemDetails.comparisonNextSeries
|
|
1871
|
-
}
|
|
1872
|
-
)
|
|
1873
|
-
] }) : null
|
|
1874
|
-
] }),
|
|
1875
|
-
outcomes.length > EVENT_CHART_SERIES_LIMIT ? /* @__PURE__ */ jsx6("p", { className: "text-agg-xs text-agg-muted-foreground", children: labels.eventItemDetails.comparisonSeriesBudget(EVENT_CHART_SERIES_LIMIT) }) : null,
|
|
1797
|
+
/* @__PURE__ */ jsx6("div", { className: "agg-market-badges flex min-w-0 gap-2 overflow-x-auto pb-1 md:flex-wrap", children: venues.map((item) => {
|
|
1798
|
+
var _a2, _b2;
|
|
1799
|
+
return /* @__PURE__ */ jsx6(
|
|
1800
|
+
"button",
|
|
1801
|
+
{
|
|
1802
|
+
type: "button",
|
|
1803
|
+
"aria-label": (_a2 = labels.venues[item]) != null ? _a2 : item,
|
|
1804
|
+
"aria-pressed": venue === item,
|
|
1805
|
+
className: "agg-market-badge cursor-pointer rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
1806
|
+
onClick: (event) => {
|
|
1807
|
+
event.preventDefault();
|
|
1808
|
+
event.stopPropagation();
|
|
1809
|
+
if (item !== venue) setSelection({ defaultVenue, venue: item, hidden: /* @__PURE__ */ new Set() });
|
|
1810
|
+
},
|
|
1811
|
+
children: /* @__PURE__ */ jsx6(
|
|
1812
|
+
Badge,
|
|
1813
|
+
{
|
|
1814
|
+
text: (_b2 = labels.venues[item]) != null ? _b2 : item,
|
|
1815
|
+
prefix: /* @__PURE__ */ jsx6(VenueLogo, { venue: item, size: "small", title: item }),
|
|
1816
|
+
size: "large",
|
|
1817
|
+
isActive: venue === item,
|
|
1818
|
+
classNames: { root: "shrink-0 border px-4 h-8 md:h-9" }
|
|
1819
|
+
}
|
|
1820
|
+
)
|
|
1821
|
+
},
|
|
1822
|
+
item
|
|
1823
|
+
);
|
|
1824
|
+
}) }),
|
|
1876
1825
|
/* @__PURE__ */ jsx6(
|
|
1877
1826
|
"div",
|
|
1878
1827
|
{
|
|
1879
1828
|
role: "group",
|
|
1880
1829
|
"aria-label": labels.eventItemDetails.chartLegend,
|
|
1881
|
-
className: "flex flex-
|
|
1882
|
-
children:
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1830
|
+
className: "flex flex-col gap-2",
|
|
1831
|
+
children: topMarkets.map((market) => {
|
|
1832
|
+
var _a2;
|
|
1833
|
+
return /* @__PURE__ */ jsxs4(
|
|
1834
|
+
"div",
|
|
1835
|
+
{
|
|
1836
|
+
"data-chart-market-id": market.id,
|
|
1837
|
+
className: "flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-1",
|
|
1838
|
+
children: [
|
|
1839
|
+
/* @__PURE__ */ jsxs4("span", { className: "flex min-w-0 items-center gap-2 text-agg-sm text-agg-foreground", children: [
|
|
1840
|
+
/* @__PURE__ */ jsx6(
|
|
1841
|
+
"span",
|
|
1842
|
+
{
|
|
1843
|
+
"aria-hidden": "true",
|
|
1844
|
+
className: "h-0 w-4 shrink-0 border-t-2",
|
|
1845
|
+
style: {
|
|
1846
|
+
borderColor: (_a2 = allSeries.find((series) => series.marketId === market.id)) == null ? void 0 : _a2.color
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
/* @__PURE__ */ jsx6("span", { className: "truncate", title: market.question, children: market.question })
|
|
1851
|
+
] }),
|
|
1852
|
+
/* @__PURE__ */ jsx6("div", { className: "agg-outcome-switch flex max-w-full flex-wrap gap-1 rounded-agg-full bg-agg-secondary", children: allSeries.filter((series) => series.marketId === market.id).map((series) => {
|
|
1853
|
+
const value = !activeIds.has(series.id) ? labels.eventItemDetails.comparisonHiddenSeries : series.pending ? labels.common.loading : series.points.length === 0 ? labels.eventItemDetails.marketHistoryUnavailable : formatDefaultChartValue(
|
|
1854
|
+
series.current != null ? series.current * 100 : series.points.at(-1).value
|
|
1855
|
+
);
|
|
1856
|
+
return /* @__PURE__ */ jsx6(
|
|
1857
|
+
"button",
|
|
1858
|
+
{
|
|
1859
|
+
type: "button",
|
|
1860
|
+
"data-chart-outcome-id": series.id,
|
|
1861
|
+
"aria-label": `${series.label} ${value}`,
|
|
1862
|
+
"aria-pressed": activeIds.has(series.id),
|
|
1863
|
+
title: `${series.label} ${value}`,
|
|
1864
|
+
className: "cursor-pointer rounded-agg-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
1865
|
+
onClick: (event) => {
|
|
1866
|
+
event.preventDefault();
|
|
1867
|
+
event.stopPropagation();
|
|
1868
|
+
const next = new Set(hidden);
|
|
1869
|
+
if (next.has(series.id)) next.delete(series.id);
|
|
1870
|
+
else next.add(series.id);
|
|
1871
|
+
setSelection({ defaultVenue, venue, hidden: next });
|
|
1872
|
+
},
|
|
1873
|
+
children: /* @__PURE__ */ jsx6(
|
|
1874
|
+
Badge,
|
|
1875
|
+
{
|
|
1876
|
+
text: `${series.outcomeLabel} ${value}`,
|
|
1877
|
+
size: "large",
|
|
1878
|
+
isActive: activeIds.has(series.id),
|
|
1879
|
+
classNames: { root: "h-8 w-36 border px-4 tabular-nums md:h-9" }
|
|
1880
|
+
}
|
|
1881
|
+
)
|
|
1882
|
+
},
|
|
1883
|
+
series.id
|
|
1884
|
+
);
|
|
1885
|
+
}) })
|
|
1886
|
+
]
|
|
1897
1887
|
},
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
/* @__PURE__ */ jsx6(
|
|
1902
|
-
"span",
|
|
1903
|
-
{
|
|
1904
|
-
"aria-hidden": "true",
|
|
1905
|
-
className: "h-0 w-4 shrink-0 border-t-2",
|
|
1906
|
-
style: {
|
|
1907
|
-
borderColor: series.color,
|
|
1908
|
-
borderTopStyle: series.lineStyle === "dashed" ? "dashed" : "solid"
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
),
|
|
1912
|
-
/* @__PURE__ */ jsx6("span", { className: "min-w-0 text-left [overflow-wrap:anywhere]", children: series.label }),
|
|
1913
|
-
series.id === page.pinnedId ? /* @__PURE__ */ jsx6("span", { children: labels.eventItemDetails.comparisonSelectedSeries }) : null,
|
|
1914
|
-
/* @__PURE__ */ jsxs4("span", { className: "inline-grid shrink-0 items-center font-agg-semibold tabular-nums", children: [
|
|
1915
|
-
[
|
|
1916
|
-
formatDefaultChartValue(100),
|
|
1917
|
-
formatDefaultChartValue(99.9),
|
|
1918
|
-
labels.common.loading,
|
|
1919
|
-
labels.eventItemDetails.comparisonHiddenSeries,
|
|
1920
|
-
labels.eventItemDetails.marketHistoryUnavailable
|
|
1921
|
-
].map((value, index) => /* @__PURE__ */ jsx6(
|
|
1922
|
-
"span",
|
|
1923
|
-
{
|
|
1924
|
-
"aria-hidden": "true",
|
|
1925
|
-
className: "invisible col-start-1 row-start-1 select-none",
|
|
1926
|
-
children: value
|
|
1927
|
-
},
|
|
1928
|
-
index
|
|
1929
|
-
)),
|
|
1930
|
-
/* @__PURE__ */ jsx6("span", { className: "col-start-1 row-start-1", children: !activeIds.has(series.id) ? labels.eventItemDetails.comparisonHiddenSeries : series.pending ? labels.common.loading : series.points.length === 0 ? labels.eventItemDetails.marketHistoryUnavailable : series.current != null ? formatDefaultChartValue(series.current * 100) : formatDefaultChartValue(series.points.at(-1).value) })
|
|
1931
|
-
] })
|
|
1932
|
-
]
|
|
1933
|
-
},
|
|
1934
|
-
series.id
|
|
1935
|
-
))
|
|
1888
|
+
market.id
|
|
1889
|
+
);
|
|
1890
|
+
})
|
|
1936
1891
|
}
|
|
1937
1892
|
),
|
|
1938
1893
|
visibleSeries.length === 0 && allSeries.length > 0 ? /* @__PURE__ */ jsx6(
|
|
@@ -2434,7 +2389,7 @@ var EventListItemDetailsContent = ({
|
|
|
2434
2389
|
recurringMarkets,
|
|
2435
2390
|
sportsLiveState
|
|
2436
2391
|
}) => {
|
|
2437
|
-
var _a, _b, _c, _d, _e, _f
|
|
2392
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2438
2393
|
const [selectedChartType, setSelectedChartType] = useState3("line");
|
|
2439
2394
|
const [chartView, setChartView] = useState3(defaultChartView);
|
|
2440
2395
|
const lastAppliedEventSyncKeyRef = useRef2(null);
|
|
@@ -2762,7 +2717,6 @@ var EventListItemDetailsContent = ({
|
|
|
2762
2717
|
{
|
|
2763
2718
|
markets: event.venueMarkets,
|
|
2764
2719
|
defaultVenue: event.venue,
|
|
2765
|
-
selectedOutcomeId: (tradingContext == null ? void 0 : tradingContext.selectedEventId) === event.id ? tradingContext.selectedOutcomeId : (_f = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.venueMarketOutcomes[0]) == null ? void 0 : _f.id,
|
|
2766
2720
|
eventEndDate: event.endDate,
|
|
2767
2721
|
contractWindow,
|
|
2768
2722
|
range: chartRangeOverride != null ? chartRangeOverride : config.chart.selectedChartTimeRange,
|
|
@@ -2777,7 +2731,7 @@ var EventListItemDetailsContent = ({
|
|
|
2777
2731
|
selectedChartType,
|
|
2778
2732
|
venueInfo,
|
|
2779
2733
|
venueMarkets,
|
|
2780
|
-
selectedMarketId: (
|
|
2734
|
+
selectedMarketId: (_f = scopedSelectedMarket == null ? void 0 : scopedSelectedMarket.id) != null ? _f : null,
|
|
2781
2735
|
livePrices,
|
|
2782
2736
|
restMidpoints,
|
|
2783
2737
|
bestMidpoint,
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
MarketDetails,
|
|
5
5
|
MarketDetailsList,
|
|
6
6
|
isErrorWithStatus
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LTFRGJPL.mjs";
|
|
8
8
|
import {
|
|
9
9
|
PlaceOrder,
|
|
10
10
|
SettlementDetails,
|
|
@@ -1368,6 +1368,7 @@ var resolveSportsSectionMarkets = ({
|
|
|
1368
1368
|
}
|
|
1369
1369
|
if (tab.kind !== "game_lines") return filteredSectionMarkets;
|
|
1370
1370
|
const dedupeEventMarketsOfType = (type) => {
|
|
1371
|
+
var _a, _b, _c, _d;
|
|
1371
1372
|
const dedupedMarkets = [];
|
|
1372
1373
|
const keptIndexByKey = /* @__PURE__ */ new Map();
|
|
1373
1374
|
for (const market of eventMarkets) {
|
|
@@ -1378,6 +1379,10 @@ var resolveSportsSectionMarkets = ({
|
|
|
1378
1379
|
const keptIndex = keptIndexByKey.get(key);
|
|
1379
1380
|
if (keptIndex !== void 0) {
|
|
1380
1381
|
const kept = dedupedMarkets[keptIndex];
|
|
1382
|
+
if (hasTeamTitledOutcomes(kept) && hasTeamTitledOutcomes(market) && ((_b = (_a = kept.venueMarketOutcomes) == null ? void 0 : _a.length) != null ? _b : 0) !== ((_d = (_c = market.venueMarketOutcomes) == null ? void 0 : _c.length) != null ? _d : 0)) {
|
|
1383
|
+
dedupedMarkets.push(market);
|
|
1384
|
+
continue;
|
|
1385
|
+
}
|
|
1381
1386
|
if (!hasTeamTitledOutcomes(kept) && hasTeamTitledOutcomes(market)) {
|
|
1382
1387
|
dedupedMarkets[keptIndex] = market;
|
|
1383
1388
|
}
|
|
@@ -1507,6 +1512,12 @@ var SPORTS_LEG_GROUPABLE_GROUPS = /* @__PURE__ */ new Set([
|
|
|
1507
1512
|
"specials",
|
|
1508
1513
|
"completion"
|
|
1509
1514
|
]);
|
|
1515
|
+
var DRAW_OUTCOME_TITLE_PATTERN = /\b(draw|tie)\b/i;
|
|
1516
|
+
var isThreeWayMoneylineHub = (market) => {
|
|
1517
|
+
var _a, _b;
|
|
1518
|
+
const outcomes = (_a = market.venueMarketOutcomes) != null ? _a : [];
|
|
1519
|
+
return normalizeSportsMarketType(market.sportsMarketType) === "moneyline" && normalizeSportsMarketGroup(market.marketGroup) === "game_lines" && normalizeSportsPeriod(market.period) === "full" && outcomes.length === 3 && outcomes.filter((outcome) => DRAW_OUTCOME_TITLE_PATTERN.test(toTrimmedString(outcome.title))).length === 1 && ((_b = market.matchedVenueMarkets) != null ? _b : []).length > 0;
|
|
1520
|
+
};
|
|
1510
1521
|
var resolveDisplayGroupFamilyKey = (market, sport) => {
|
|
1511
1522
|
var _a, _b, _c;
|
|
1512
1523
|
const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
|
|
@@ -1516,7 +1527,7 @@ var resolveDisplayGroupFamilyKey = (market, sport) => {
|
|
|
1516
1527
|
const sportsMarketType = (_b = normalizeSportsMarketType(market.sportsMarketType)) != null ? _b : "other";
|
|
1517
1528
|
const period = normalizeSportsPeriod(market.period);
|
|
1518
1529
|
const marketCategory = (_c = normalizeSportsMarketCategory(market.marketCategory)) != null ? _c : "other";
|
|
1519
|
-
if (isBinarySportsMoneylineMarket(market)) {
|
|
1530
|
+
if (isBinarySportsMoneylineMarket(market) || isThreeWayMoneylineHub(market)) {
|
|
1520
1531
|
return `${period}|moneyline|${marketCategory}`;
|
|
1521
1532
|
}
|
|
1522
1533
|
if (sportsMarketType === "to_advance") {
|
|
@@ -1580,7 +1591,7 @@ var formatSportsLegTitle = (token) => {
|
|
|
1580
1591
|
var resolveDisplayGroupTitle = (market, groupMarkets = [market], sport, isCombinedLegGroup = false) => {
|
|
1581
1592
|
const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
|
|
1582
1593
|
const question = toTrimmedString(market.question);
|
|
1583
|
-
if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
|
|
1594
|
+
if (isBinarySportsMoneylineMarket(market) || isThreeWayMoneylineHub(market)) return "Moneyline";
|
|
1584
1595
|
if (sportsMarketType === "to_advance") return "Team to Advance";
|
|
1585
1596
|
if (sportsMarketType === "spread") return "Spreads";
|
|
1586
1597
|
if (isCombinedLegGroup) {
|
|
@@ -1903,7 +1914,11 @@ var resolveSportsLadderTitle = (group, selectedLineDisplay) => {
|
|
|
1903
1914
|
const pattern = new RegExp(`(^|[^\\d.])${escapeRegExp(anchorDisplay)}(?![\\d.])`);
|
|
1904
1915
|
return pattern.test(group.title) ? group.title.replace(pattern, (_match, prefix) => `${prefix}${selectedLineDisplay}`) : group.title;
|
|
1905
1916
|
};
|
|
1906
|
-
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 buildSportsSlideFromGroup = (group, prices) => {
|
|
1907
1922
|
const lineStops = group.hasLineVariants ? aggregateSportsLineStops(group.markets, group.sportsMarketType === "spread") : [];
|
|
1908
1923
|
const hasLadder = lineStops.length > 1;
|
|
1909
1924
|
const stops = hasLadder ? lineStops.map((lineStop) => ({
|
|
@@ -1911,10 +1926,16 @@ var buildSportsSlideFromGroup = (group) => {
|
|
|
1911
1926
|
venues: lineStop.venues,
|
|
1912
1927
|
market: lineStop.representative
|
|
1913
1928
|
})) : [];
|
|
1914
|
-
const
|
|
1915
|
-
(
|
|
1916
|
-
|
|
1917
|
-
)
|
|
1929
|
+
const evenMoneyDistances = lineStops.map(
|
|
1930
|
+
(lineStop) => resolveDistanceFromEvenMoney(lineStop.representative, prices)
|
|
1931
|
+
);
|
|
1932
|
+
const defaultStopIndex = hasLadder ? lineStops.reduce((bestIndex, lineStop, index) => {
|
|
1933
|
+
const best = lineStops[bestIndex];
|
|
1934
|
+
if (lineStop.volume !== best.volume) {
|
|
1935
|
+
return lineStop.volume > best.volume ? index : bestIndex;
|
|
1936
|
+
}
|
|
1937
|
+
return evenMoneyDistances[index] < evenMoneyDistances[bestIndex] ? index : bestIndex;
|
|
1938
|
+
}, 0) : 0;
|
|
1918
1939
|
return {
|
|
1919
1940
|
id: group.id,
|
|
1920
1941
|
kind: resolveSlideKind(group),
|
|
@@ -2326,14 +2347,18 @@ var SportsMarketCard = ({
|
|
|
2326
2347
|
midpointsFallbackVenues,
|
|
2327
2348
|
midpointsResult
|
|
2328
2349
|
}) => {
|
|
2329
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2350
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2330
2351
|
const labels = useLabels6();
|
|
2331
2352
|
const {
|
|
2332
2353
|
formatting: { formatCompactCurrency }
|
|
2333
2354
|
} = useSdkUiConfig2();
|
|
2334
2355
|
const tradingContext = useEventTradingContext();
|
|
2335
|
-
const
|
|
2356
|
+
const linePrices = (_a = midpointsResult == null ? void 0 : midpointsResult.bestMidpointsByOutcomeId) != null ? _a : midpointsResult == null ? void 0 : midpointsResult.prices;
|
|
2357
|
+
const slide = useMemo2(() => buildSportsSlideFromGroup(group, linePrices), [group, linePrices]);
|
|
2336
2358
|
const [selectedLineIndex, setSelectedLineIndex] = useState4(slide.defaultStopIndex);
|
|
2359
|
+
const userPickedLineRef = useRef2(false);
|
|
2360
|
+
const autoLineIndexRef = useRef2(slide.defaultStopIndex);
|
|
2361
|
+
const autoSelectedMarketIdRef = useRef2(null);
|
|
2337
2362
|
const combinedLegs = useMemo2(() => resolveSportsCombinedLegs(group), [group]);
|
|
2338
2363
|
const isCombinedLegGroup = combinedLegs != null;
|
|
2339
2364
|
const combinedLegMarkets = useMemo2(
|
|
@@ -2362,11 +2387,30 @@ var SportsMarketCard = ({
|
|
|
2362
2387
|
const matchedIndex = slide.stops.findIndex((stop) => stop.market.id === tradingMarketId);
|
|
2363
2388
|
if (matchedIndex >= 0) setSelectedLineIndex(matchedIndex);
|
|
2364
2389
|
}, [slide.hasLadder, slide.stops, tradingContext == null ? void 0 : tradingContext.selectedMarketId]);
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2390
|
+
useEffect3(() => {
|
|
2391
|
+
var _a2;
|
|
2392
|
+
if (!slide.hasLadder || userPickedLineRef.current) return;
|
|
2393
|
+
const nextIndex = slide.defaultStopIndex;
|
|
2394
|
+
if (nextIndex === autoLineIndexRef.current) return;
|
|
2395
|
+
const tradingIndex = slide.stops.findIndex(
|
|
2396
|
+
(stop) => stop.market.id === (tradingContext == null ? void 0 : tradingContext.selectedMarketId)
|
|
2397
|
+
);
|
|
2398
|
+
if (tradingIndex >= 0 && (tradingContext == null ? void 0 : tradingContext.selectedMarketId) !== autoSelectedMarketIdRef.current) {
|
|
2399
|
+
return;
|
|
2400
|
+
}
|
|
2401
|
+
autoLineIndexRef.current = nextIndex;
|
|
2402
|
+
setSelectedLineIndex(nextIndex);
|
|
2403
|
+
const nextMarket = (_a2 = slide.stops[nextIndex]) == null ? void 0 : _a2.market;
|
|
2404
|
+
if (tradingIndex >= 0 && nextMarket) {
|
|
2405
|
+
autoSelectedMarketIdRef.current = nextMarket.id;
|
|
2406
|
+
tradingContext == null ? void 0 : tradingContext.selectMarket(nextMarket.id, nextMarket);
|
|
2407
|
+
}
|
|
2408
|
+
}, [slide.hasLadder, slide.defaultStopIndex, slide.stops, tradingContext]);
|
|
2409
|
+
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;
|
|
2410
|
+
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;
|
|
2411
|
+
const activeDefaultOutcome = isCombinedLegGroup && activeMarket ? (_h = activeMarket.venueMarketOutcomes.find(
|
|
2368
2412
|
(outcome) => outcome.label.trim().toLowerCase() === "yes"
|
|
2369
|
-
)) != null ?
|
|
2413
|
+
)) != null ? _h : activeMarket.venueMarketOutcomes[0] : activeMarket == null ? void 0 : activeMarket.venueMarketOutcomes[0];
|
|
2370
2414
|
const wasExpandedRef = useRef2(isExpanded);
|
|
2371
2415
|
useEffect3(() => {
|
|
2372
2416
|
const justOpened = isExpanded && !wasExpandedRef.current;
|
|
@@ -2378,6 +2422,7 @@ var SportsMarketCard = ({
|
|
|
2378
2422
|
if (hasInScopeOutcome) return;
|
|
2379
2423
|
const firstOutcome = activeDefaultOutcome;
|
|
2380
2424
|
if (firstOutcome) {
|
|
2425
|
+
autoSelectedMarketIdRef.current = activeMarket.id;
|
|
2381
2426
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(activeMarket.id, firstOutcome.id);
|
|
2382
2427
|
}
|
|
2383
2428
|
}, [activeDefaultOutcome, isExpanded, activeMarket, tradingContext]);
|
|
@@ -2419,9 +2464,9 @@ var SportsMarketCard = ({
|
|
|
2419
2464
|
if (!activeMarket) return null;
|
|
2420
2465
|
const selectedStop = slide.hasLadder ? slide.stops[selectedLineIndex] : void 0;
|
|
2421
2466
|
const cardTitle = selectedStop ? resolveSportsLadderTitle(group, selectedStop.value) : group.title;
|
|
2422
|
-
const activeOutcome = (
|
|
2467
|
+
const activeOutcome = (_i = activeMarket.venueMarketOutcomes.find(
|
|
2423
2468
|
(outcome) => outcome.id === (tradingContext == null ? void 0 : tradingContext.selectedOutcomeId)
|
|
2424
|
-
)) != null ?
|
|
2469
|
+
)) != null ? _i : activeDefaultOutcome;
|
|
2425
2470
|
const activeOutcomeVenueCount = (() => {
|
|
2426
2471
|
var _a2, _b2;
|
|
2427
2472
|
if (!activeOutcome) return collectVenueNames(activeMarket).length;
|
|
@@ -2463,6 +2508,7 @@ var SportsMarketCard = ({
|
|
|
2463
2508
|
useSpreadOverride: slide.kind === "spread"
|
|
2464
2509
|
});
|
|
2465
2510
|
const nextOutcome = resolveOutcomeBySide(targetDisplayedOutcomes, selectedSide != null ? selectedSide : "left");
|
|
2511
|
+
userPickedLineRef.current = true;
|
|
2466
2512
|
setSelectedLineIndex(index);
|
|
2467
2513
|
if (nextOutcome) {
|
|
2468
2514
|
tradingContext == null ? void 0 : tradingContext.selectMarketAndOutcome(targetMarket.id, nextOutcome.id);
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
EventOpenOrdersCard,
|
|
7
7
|
formatRecurringCountdown,
|
|
8
8
|
useEventOpenOrders
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-NDD5IHAU.mjs";
|
|
10
|
+
import "./chunk-LTFRGJPL.mjs";
|
|
11
11
|
import "./chunk-NV6WT3TN.mjs";
|
|
12
12
|
import "./chunk-WOCZ4TVT.mjs";
|
|
13
13
|
import "./chunk-CKHECAKV.mjs";
|