@agg-build/ui 2.2.4 → 2.3.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.
@@ -785,7 +785,28 @@ var resolveDisplayGroupFamilyKey = (market) => {
785
785
  }
786
786
  return `${period}|${sportsMarketType}|${marketCategory}|${toTrimmedString(market.question)}|${outcomeKey}|${market.id}`;
787
787
  };
788
- var resolveDisplayGroupTitle = (market) => {
788
+ var TOTAL_STAT_UNITS = [
789
+ [/\bcorners?\b/i, "Corners"],
790
+ [/\bcards?\b|\bbookings?\b/i, "Cards"],
791
+ [/\bgoals?\b/i, "Goals"],
792
+ [/\bpoints?\b/i, "Points"],
793
+ [/\bruns?\b/i, "Runs"],
794
+ [/\brounds?\b/i, "Rounds"],
795
+ [/\bgames?\b/i, "Games"],
796
+ [/\bsets?\b/i, "Sets"],
797
+ [/\bmaps?\b/i, "Maps"]
798
+ ];
799
+ var resolveTotalStatUnit = (markets, marketCategory) => {
800
+ if (marketCategory === "corners") return "Corners";
801
+ for (const market of markets) {
802
+ const question = toTrimmedString(market.question);
803
+ for (const [pattern, unit] of TOTAL_STAT_UNITS) {
804
+ if (pattern.test(question)) return unit;
805
+ }
806
+ }
807
+ return null;
808
+ };
809
+ var resolveDisplayGroupTitle = (market, groupMarkets = [market]) => {
789
810
  const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
790
811
  const question = toTrimmedString(market.question);
791
812
  if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
@@ -794,6 +815,12 @@ var resolveDisplayGroupTitle = (market) => {
794
815
  return sportsMarketType != null ? sportsMarketType : market.id;
795
816
  }
796
817
  if (sportsMarketType === "total") {
818
+ const lineFamily = resolveSportsLineFamilyKey(market);
819
+ const marketCategory = normalizeSportsMarketCategory(market.marketCategory);
820
+ if (/_tot(_corners)?(_\dh)?$/i.test(lineFamily)) {
821
+ const unit = resolveTotalStatUnit(groupMarkets, marketCategory);
822
+ return unit ? `Total ${unit}` : "Totals";
823
+ }
797
824
  const base = stripLineValueFromQuestion(question).replace(/o\s*\/\s*u/gi, " ").replace(/\btotals?\b/gi, " ").replace(/\s+/g, " ").trim();
798
825
  return base ? `${base} Totals` : "Totals";
799
826
  }
@@ -833,7 +860,7 @@ var buildSportsMarketDisplayGroups = (markets) => {
833
860
  const sectionRank = (_a2 = firstMarket == null ? void 0 : firstMarket.sectionRank) != null ? _a2 : Number.MAX_SAFE_INTEGER;
834
861
  return {
835
862
  id,
836
- title: resolveDisplayGroupTitle(firstMarket),
863
+ title: resolveDisplayGroupTitle(firstMarket, orderedMarkets),
837
864
  questionKey: sanitizeFamilyValue(toTrimmedString(firstMarket == null ? void 0 : firstMarket.question)),
838
865
  sportsMarketType,
839
866
  marketCategory,
package/dist/index.js CHANGED
@@ -23595,7 +23595,28 @@ var resolveDisplayGroupFamilyKey = (market) => {
23595
23595
  }
23596
23596
  return `${period}|${sportsMarketType}|${marketCategory}|${toTrimmedString(market.question)}|${outcomeKey}|${market.id}`;
23597
23597
  };
23598
- var resolveDisplayGroupTitle = (market) => {
23598
+ var TOTAL_STAT_UNITS = [
23599
+ [/\bcorners?\b/i, "Corners"],
23600
+ [/\bcards?\b|\bbookings?\b/i, "Cards"],
23601
+ [/\bgoals?\b/i, "Goals"],
23602
+ [/\bpoints?\b/i, "Points"],
23603
+ [/\bruns?\b/i, "Runs"],
23604
+ [/\brounds?\b/i, "Rounds"],
23605
+ [/\bgames?\b/i, "Games"],
23606
+ [/\bsets?\b/i, "Sets"],
23607
+ [/\bmaps?\b/i, "Maps"]
23608
+ ];
23609
+ var resolveTotalStatUnit = (markets, marketCategory) => {
23610
+ if (marketCategory === "corners") return "Corners";
23611
+ for (const market of markets) {
23612
+ const question = toTrimmedString(market.question);
23613
+ for (const [pattern, unit] of TOTAL_STAT_UNITS) {
23614
+ if (pattern.test(question)) return unit;
23615
+ }
23616
+ }
23617
+ return null;
23618
+ };
23619
+ var resolveDisplayGroupTitle = (market, groupMarkets = [market]) => {
23599
23620
  const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
23600
23621
  const question = toTrimmedString(market.question);
23601
23622
  if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
@@ -23604,6 +23625,12 @@ var resolveDisplayGroupTitle = (market) => {
23604
23625
  return sportsMarketType != null ? sportsMarketType : market.id;
23605
23626
  }
23606
23627
  if (sportsMarketType === "total") {
23628
+ const lineFamily = resolveSportsLineFamilyKey(market);
23629
+ const marketCategory = normalizeSportsMarketCategory(market.marketCategory);
23630
+ if (/_tot(_corners)?(_\dh)?$/i.test(lineFamily)) {
23631
+ const unit = resolveTotalStatUnit(groupMarkets, marketCategory);
23632
+ return unit ? `Total ${unit}` : "Totals";
23633
+ }
23607
23634
  const base = stripLineValueFromQuestion(question).replace(/o\s*\/\s*u/gi, " ").replace(/\btotals?\b/gi, " ").replace(/\s+/g, " ").trim();
23608
23635
  return base ? `${base} Totals` : "Totals";
23609
23636
  }
@@ -23643,7 +23670,7 @@ var buildSportsMarketDisplayGroups = (markets) => {
23643
23670
  const sectionRank = (_a2 = firstMarket == null ? void 0 : firstMarket.sectionRank) != null ? _a2 : Number.MAX_SAFE_INTEGER;
23644
23671
  return {
23645
23672
  id,
23646
- title: resolveDisplayGroupTitle(firstMarket),
23673
+ title: resolveDisplayGroupTitle(firstMarket, orderedMarkets),
23647
23674
  questionKey: sanitizeFamilyValue(toTrimmedString(firstMarket == null ? void 0 : firstMarket.question)),
23648
23675
  sportsMarketType,
23649
23676
  marketCategory,
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  UserProfilePage,
12
12
  buildAggTxExplorerHref,
13
13
  useHomePageModals
14
- } from "./chunk-XJTNK3DS.mjs";
14
+ } from "./chunk-ELLV56FR.mjs";
15
15
  import {
16
16
  EventList,
17
17
  EventListItem,
package/dist/pages.js CHANGED
@@ -21406,7 +21406,28 @@ var resolveDisplayGroupFamilyKey = (market) => {
21406
21406
  }
21407
21407
  return `${period}|${sportsMarketType}|${marketCategory}|${toTrimmedString(market.question)}|${outcomeKey}|${market.id}`;
21408
21408
  };
21409
- var resolveDisplayGroupTitle = (market) => {
21409
+ var TOTAL_STAT_UNITS = [
21410
+ [/\bcorners?\b/i, "Corners"],
21411
+ [/\bcards?\b|\bbookings?\b/i, "Cards"],
21412
+ [/\bgoals?\b/i, "Goals"],
21413
+ [/\bpoints?\b/i, "Points"],
21414
+ [/\bruns?\b/i, "Runs"],
21415
+ [/\brounds?\b/i, "Rounds"],
21416
+ [/\bgames?\b/i, "Games"],
21417
+ [/\bsets?\b/i, "Sets"],
21418
+ [/\bmaps?\b/i, "Maps"]
21419
+ ];
21420
+ var resolveTotalStatUnit = (markets, marketCategory) => {
21421
+ if (marketCategory === "corners") return "Corners";
21422
+ for (const market of markets) {
21423
+ const question = toTrimmedString(market.question);
21424
+ for (const [pattern, unit] of TOTAL_STAT_UNITS) {
21425
+ if (pattern.test(question)) return unit;
21426
+ }
21427
+ }
21428
+ return null;
21429
+ };
21430
+ var resolveDisplayGroupTitle = (market, groupMarkets = [market]) => {
21410
21431
  const sportsMarketType = normalizeSportsMarketType(market.sportsMarketType);
21411
21432
  const question = toTrimmedString(market.question);
21412
21433
  if (isBinarySportsMoneylineMarket(market)) return "Moneyline";
@@ -21415,6 +21436,12 @@ var resolveDisplayGroupTitle = (market) => {
21415
21436
  return sportsMarketType != null ? sportsMarketType : market.id;
21416
21437
  }
21417
21438
  if (sportsMarketType === "total") {
21439
+ const lineFamily = resolveSportsLineFamilyKey(market);
21440
+ const marketCategory = normalizeSportsMarketCategory(market.marketCategory);
21441
+ if (/_tot(_corners)?(_\dh)?$/i.test(lineFamily)) {
21442
+ const unit = resolveTotalStatUnit(groupMarkets, marketCategory);
21443
+ return unit ? `Total ${unit}` : "Totals";
21444
+ }
21418
21445
  const base = stripLineValueFromQuestion(question).replace(/o\s*\/\s*u/gi, " ").replace(/\btotals?\b/gi, " ").replace(/\s+/g, " ").trim();
21419
21446
  return base ? `${base} Totals` : "Totals";
21420
21447
  }
@@ -21454,7 +21481,7 @@ var buildSportsMarketDisplayGroups = (markets) => {
21454
21481
  const sectionRank = (_a2 = firstMarket == null ? void 0 : firstMarket.sectionRank) != null ? _a2 : Number.MAX_SAFE_INTEGER;
21455
21482
  return {
21456
21483
  id,
21457
- title: resolveDisplayGroupTitle(firstMarket),
21484
+ title: resolveDisplayGroupTitle(firstMarket, orderedMarkets),
21458
21485
  questionKey: sanitizeFamilyValue(toTrimmedString(firstMarket == null ? void 0 : firstMarket.question)),
21459
21486
  sportsMarketType,
21460
21487
  marketCategory,
package/dist/pages.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  UserProfilePage,
9
9
  buildAggTxExplorerHref,
10
10
  useHomePageModals
11
- } from "./chunk-XJTNK3DS.mjs";
11
+ } from "./chunk-ELLV56FR.mjs";
12
12
  import "./chunk-3R2CQTNM.mjs";
13
13
  import {
14
14
  DEPOSIT_MODAL_OPEN_EVENT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "2.2.4",
3
+ "version": "2.3.0",
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",
@@ -100,8 +100,8 @@
100
100
  "liveline": "^0.0.7",
101
101
  "react": "^18.0.0 || ^19.0.0",
102
102
  "react-dom": "^18.0.0 || ^19.0.0",
103
- "@agg-build/sdk": "^2.2.1",
104
- "@agg-build/hooks": "^2.2.1"
103
+ "@agg-build/hooks": "^2.3.0",
104
+ "@agg-build/sdk": "^2.3.0"
105
105
  },
106
106
  "dependencies": {
107
107
  "@number-flow/react": "^0.6.0",