@agg-build/ui 2.4.1 → 2.4.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.
@@ -775,6 +775,16 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
775
775
  };
776
776
  return { favored: pickName(0), dog: pickName(1) };
777
777
  };
778
+ var resolveCombinedMoneylineLegLabel = (market) => {
779
+ const typedMarket = market;
780
+ return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
781
+ };
782
+ var areCombinedMoneylineLegsDistinct = (markets) => {
783
+ const labels = markets.map(
784
+ (market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
785
+ );
786
+ return labels.every((label) => label.length > 0) && new Set(labels).size === labels.length;
787
+ };
778
788
  var resolveDisplayGroupFamilyKey = (market) => {
779
789
  var _a, _b, _c;
780
790
  const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
@@ -1391,7 +1401,10 @@ var SportsMarketCard = ({
1391
1401
  () => group.markets.filter((market) => isBinarySportsMoneylineMarket(market)),
1392
1402
  [group.markets]
1393
1403
  );
1394
- const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length;
1404
+ const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length && // Per-leg pills need distinct labels — unmerged cross-venue duplicates of
1405
+ // one 2-way single ("Match Winner" ×2) would render the same Yes price
1406
+ // twice as two options; fall back to the standard team-pill card instead.
1407
+ areCombinedMoneylineLegsDistinct(combinedMoneylineMarkets);
1395
1408
  const preferredResolvedMoneylineMarket = useMemo(() => {
1396
1409
  var _a2, _b2;
1397
1410
  if (!isCombinedMoneylineGroup) return null;
@@ -1455,18 +1468,17 @@ var SportsMarketCard = ({
1455
1468
  const combinedMoneylineHeaderOutcomeItems = useMemo(() => {
1456
1469
  if (!isCombinedMoneylineGroup) return void 0;
1457
1470
  return combinedMoneylineMarkets.flatMap((market, index) => {
1458
- var _a2, _b2;
1459
- const typedMarket = market;
1471
+ var _a2;
1460
1472
  const yesOutcome = market.venueMarketOutcomes.find(
1461
1473
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
1462
1474
  );
1463
1475
  if (!yesOutcome) return [];
1464
- const label = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
1476
+ const label = resolveCombinedMoneylineLegLabel(market);
1465
1477
  if (!label) return [];
1466
1478
  const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
1467
1479
  outcomeId: yesOutcome.id,
1468
1480
  outcomeLabel: yesOutcome.label,
1469
- bestMidpointsByOutcomeId: (_b2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _b2 : midpointsResult.prices
1481
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
1470
1482
  });
1471
1483
  return [
1472
1484
  {
package/dist/index.js CHANGED
@@ -23591,6 +23591,16 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
23591
23591
  };
23592
23592
  return { favored: pickName(0), dog: pickName(1) };
23593
23593
  };
23594
+ var resolveCombinedMoneylineLegLabel = (market) => {
23595
+ const typedMarket = market;
23596
+ return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
23597
+ };
23598
+ var areCombinedMoneylineLegsDistinct = (markets) => {
23599
+ const labels = markets.map(
23600
+ (market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
23601
+ );
23602
+ return labels.every((label2) => label2.length > 0) && new Set(labels).size === labels.length;
23603
+ };
23594
23604
  var resolveDisplayGroupFamilyKey = (market) => {
23595
23605
  var _a, _b, _c;
23596
23606
  const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
@@ -24201,7 +24211,10 @@ var SportsMarketCard = ({
24201
24211
  () => group.markets.filter((market) => isBinarySportsMoneylineMarket(market)),
24202
24212
  [group.markets]
24203
24213
  );
24204
- const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length;
24214
+ const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length && // Per-leg pills need distinct labels — unmerged cross-venue duplicates of
24215
+ // one 2-way single ("Match Winner" ×2) would render the same Yes price
24216
+ // twice as two options; fall back to the standard team-pill card instead.
24217
+ areCombinedMoneylineLegsDistinct(combinedMoneylineMarkets);
24205
24218
  const preferredResolvedMoneylineMarket = (0, import_react39.useMemo)(() => {
24206
24219
  var _a2, _b2;
24207
24220
  if (!isCombinedMoneylineGroup) return null;
@@ -24265,18 +24278,17 @@ var SportsMarketCard = ({
24265
24278
  const combinedMoneylineHeaderOutcomeItems = (0, import_react39.useMemo)(() => {
24266
24279
  if (!isCombinedMoneylineGroup) return void 0;
24267
24280
  return combinedMoneylineMarkets.flatMap((market, index) => {
24268
- var _a2, _b2;
24269
- const typedMarket = market;
24281
+ var _a2;
24270
24282
  const yesOutcome = market.venueMarketOutcomes.find(
24271
24283
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
24272
24284
  );
24273
24285
  if (!yesOutcome) return [];
24274
- const label2 = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
24286
+ const label2 = resolveCombinedMoneylineLegLabel(market);
24275
24287
  if (!label2) return [];
24276
24288
  const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
24277
24289
  outcomeId: yesOutcome.id,
24278
24290
  outcomeLabel: yesOutcome.label,
24279
- bestMidpointsByOutcomeId: (_b2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _b2 : midpointsResult.prices
24291
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
24280
24292
  });
24281
24293
  return [
24282
24294
  {
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  UserProfilePage,
12
12
  buildAggTxExplorerHref,
13
13
  useHomePageModals
14
- } from "./chunk-FIN55CXA.mjs";
14
+ } from "./chunk-EOCHFD2U.mjs";
15
15
  import {
16
16
  EventList,
17
17
  EventListItem,
package/dist/pages.js CHANGED
@@ -21402,6 +21402,16 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
21402
21402
  };
21403
21403
  return { favored: pickName(0), dog: pickName(1) };
21404
21404
  };
21405
+ var resolveCombinedMoneylineLegLabel = (market) => {
21406
+ const typedMarket = market;
21407
+ return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
21408
+ };
21409
+ var areCombinedMoneylineLegsDistinct = (markets) => {
21410
+ const labels = markets.map(
21411
+ (market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
21412
+ );
21413
+ return labels.every((label2) => label2.length > 0) && new Set(labels).size === labels.length;
21414
+ };
21405
21415
  var resolveDisplayGroupFamilyKey = (market) => {
21406
21416
  var _a, _b, _c;
21407
21417
  const normalizedQuestion = sanitizeFamilyValue(toTrimmedString(market.question));
@@ -22012,7 +22022,10 @@ var SportsMarketCard = ({
22012
22022
  () => group.markets.filter((market) => isBinarySportsMoneylineMarket(market)),
22013
22023
  [group.markets]
22014
22024
  );
22015
- const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length;
22025
+ const isCombinedMoneylineGroup = group.sportsMarketType === "moneyline" && combinedMoneylineMarkets.length > 1 && combinedMoneylineMarkets.length === group.markets.length && // Per-leg pills need distinct labels — unmerged cross-venue duplicates of
22026
+ // one 2-way single ("Match Winner" ×2) would render the same Yes price
22027
+ // twice as two options; fall back to the standard team-pill card instead.
22028
+ areCombinedMoneylineLegsDistinct(combinedMoneylineMarkets);
22016
22029
  const preferredResolvedMoneylineMarket = (0, import_react36.useMemo)(() => {
22017
22030
  var _a2, _b2;
22018
22031
  if (!isCombinedMoneylineGroup) return null;
@@ -22076,18 +22089,17 @@ var SportsMarketCard = ({
22076
22089
  const combinedMoneylineHeaderOutcomeItems = (0, import_react36.useMemo)(() => {
22077
22090
  if (!isCombinedMoneylineGroup) return void 0;
22078
22091
  return combinedMoneylineMarkets.flatMap((market, index) => {
22079
- var _a2, _b2;
22080
- const typedMarket = market;
22092
+ var _a2;
22081
22093
  const yesOutcome = market.venueMarketOutcomes.find(
22082
22094
  (outcome) => outcome.label.trim().toLowerCase() === "yes"
22083
22095
  );
22084
22096
  if (!yesOutcome) return [];
22085
- const label2 = ((_a2 = typedMarket.shortTitle) == null ? void 0 : _a2.trim()) || market.question.trim();
22097
+ const label2 = resolveCombinedMoneylineLegLabel(market);
22086
22098
  if (!label2) return [];
22087
22099
  const probability = midpointsResult == null ? void 0 : getDisplayOutcomePrice({
22088
22100
  outcomeId: yesOutcome.id,
22089
22101
  outcomeLabel: yesOutcome.label,
22090
- bestMidpointsByOutcomeId: (_b2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _b2 : midpointsResult.prices
22102
+ bestMidpointsByOutcomeId: (_a2 = midpointsResult.bestMidpointsByOutcomeId) != null ? _a2 : midpointsResult.prices
22091
22103
  });
22092
22104
  return [
22093
22105
  {
package/dist/pages.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  UserProfilePage,
9
9
  buildAggTxExplorerHref,
10
10
  useHomePageModals
11
- } from "./chunk-FIN55CXA.mjs";
11
+ } from "./chunk-EOCHFD2U.mjs";
12
12
  import "./chunk-MDO3NMXP.mjs";
13
13
  import {
14
14
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -132,6 +132,17 @@ export declare const resolveSpreadOutcomeTeamNames: (activeMarket: VenueMarket,
132
132
  favored: string | null;
133
133
  dog: string | null;
134
134
  };
135
+ /** The per-leg pill label for a combined (decomposed) moneyline group. */
136
+ export declare const resolveCombinedMoneylineLegLabel: (market: VenueMarket) => string;
137
+ /**
138
+ * Combined per-leg moneyline pills are only meaningful when every leg carries a
139
+ * DISTINCT label. Cross-venue duplicates of the SAME 2-way single that never
140
+ * merged (e.g. poly + predict "… (BO5) - Match Winner") collapse to identical
141
+ * labels — rendering them as separate pills shows the same Yes price twice as
142
+ * if it were two different options. Non-distinct → the card falls back to the
143
+ * standard single-market rendering (team-title pills).
144
+ */
145
+ export declare const areCombinedMoneylineLegsDistinct: (markets: VenueMarket[]) => boolean;
135
146
  export declare const buildSportsMarketDisplayGroups: (markets: VenueMarket[]) => SportsMarketDisplayGroup[];
136
147
  export declare const groupSportsMarketsByPeriod: (markets: VenueMarket[]) => SportsPeriodGroup[];
137
148
  export type SportsGameLineSlideKind = "to_advance" | "moneyline" | "spread" | "total" | "other";
@@ -132,6 +132,17 @@ export declare const resolveSpreadOutcomeTeamNames: (activeMarket: VenueMarket,
132
132
  favored: string | null;
133
133
  dog: string | null;
134
134
  };
135
+ /** The per-leg pill label for a combined (decomposed) moneyline group. */
136
+ export declare const resolveCombinedMoneylineLegLabel: (market: VenueMarket) => string;
137
+ /**
138
+ * Combined per-leg moneyline pills are only meaningful when every leg carries a
139
+ * DISTINCT label. Cross-venue duplicates of the SAME 2-way single that never
140
+ * merged (e.g. poly + predict "… (BO5) - Match Winner") collapse to identical
141
+ * labels — rendering them as separate pills shows the same Yes price twice as
142
+ * if it were two different options. Non-distinct → the card falls back to the
143
+ * standard single-market rendering (team-title pills).
144
+ */
145
+ export declare const areCombinedMoneylineLegsDistinct: (markets: VenueMarket[]) => boolean;
135
146
  export declare const buildSportsMarketDisplayGroups: (markets: VenueMarket[]) => SportsMarketDisplayGroup[];
136
147
  export declare const groupSportsMarketsByPeriod: (markets: VenueMarket[]) => SportsPeriodGroup[];
137
148
  export type SportsGameLineSlideKind = "to_advance" | "moneyline" | "spread" | "total" | "other";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
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",