@agg-build/ui 2.5.3 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-AELMIG74.mjs → chunk-TQL5I4GX.mjs} +241 -161
- package/dist/index.js +241 -161
- package/dist/index.mjs +1 -1
- package/dist/pages.js +241 -161
- package/dist/pages.mjs +1 -1
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.mts +5 -5
- package/dist/types/pages/event-market/sports-event-market.fixtures.d.ts +5 -5
- package/dist/types/pages/event-market/sports-event-market.utils.d.mts +34 -43
- package/dist/types/pages/event-market/sports-event-market.utils.d.ts +34 -43
- package/dist/types/pages/event-market/sports-markets.d.mts +1 -2
- package/dist/types/pages/event-market/sports-markets.d.ts +1 -2
- package/package.json +2 -2
|
@@ -449,64 +449,15 @@ var SPORTS_LEGACY_PROP_CATEGORY_KEY_SET = /* @__PURE__ */ new Set([
|
|
|
449
449
|
"assists",
|
|
450
450
|
"shots"
|
|
451
451
|
]);
|
|
452
|
-
var
|
|
453
|
-
"
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
totals: "game_lines",
|
|
460
|
-
period_lines: "halves",
|
|
461
|
-
exact_score: "exact_score",
|
|
462
|
-
team_props: "other",
|
|
463
|
-
player_props: "other",
|
|
464
|
-
specials: "other",
|
|
465
|
-
completion: "other",
|
|
466
|
-
other: "other"
|
|
467
|
-
};
|
|
468
|
-
var SPORTS_SECTION_TAB_DEFINITIONS = [
|
|
469
|
-
{
|
|
470
|
-
key: "game_lines",
|
|
471
|
-
// NO sportsMarketType filter: spread/total markets on some sports (e.g.
|
|
472
|
-
// esports "Map 1 Rounds Handicap"/"Total Rounds") are sportsMarketType="other"
|
|
473
|
-
// with marketGroup=spreads/totals; AND-ing the game-line types would drop them
|
|
474
|
-
// and leave only the moneyline. marketGroup already scopes the tab. (Safe now
|
|
475
|
-
// that classify_market no longer mis-groups prop/to-score-first/extra-innings
|
|
476
|
-
// markets into game_lines/totals — see agg-venue-core market_group.rs.)
|
|
477
|
-
marketGroup: ["game_lines", "spreads", "totals"]
|
|
478
|
-
// No server-side period filter: many regular-time game-line markets arrive
|
|
479
|
-
// with period=null (moneyline sides, team totals, BTTS), and a
|
|
480
|
-
// period=["full"] filter would drop them server-side. The Game Lines tab
|
|
481
|
-
// narrows to the regular-time group client-side instead (see SportsMarkets).
|
|
482
|
-
},
|
|
483
|
-
{ key: "exact_score", marketGroup: ["exact_score"] },
|
|
484
|
-
{
|
|
485
|
-
key: "halves",
|
|
486
|
-
// NO sportsMarketType filter: half-result legs ("France leading at halftime?")
|
|
487
|
-
// are sportsMarketType="other"; AND-ing the game-line types would drop them.
|
|
488
|
-
// marketGroup=period_lines + period already scope the tab.
|
|
489
|
-
marketGroup: ["period_lines"],
|
|
490
|
-
period: ["1h", "2h"]
|
|
491
|
-
},
|
|
492
|
-
{ key: "corners", marketCategory: "corners" },
|
|
493
|
-
{ key: "goals", marketCategory: "goals" },
|
|
494
|
-
{ key: "assists", marketCategory: "assists" },
|
|
495
|
-
{ key: "shots", marketCategory: "shots" },
|
|
496
|
-
{
|
|
497
|
-
key: "other",
|
|
498
|
-
// `player_props` is deliberately NOT fetched here: goals/assists/shots/corners
|
|
499
|
-
// props already have dedicated tabs (resolveMarketSectionTabKey routes them
|
|
500
|
-
// there by category), so including the group would re-fetch hundreds of props
|
|
501
|
-
// already shown elsewhere. The handful with no stat category (e.g. "saves")
|
|
502
|
-
// are back-filled from the game-wide set in resolveSportsSectionMarkets.
|
|
503
|
-
marketGroup: ["other", "team_props", "specials", "completion"]
|
|
504
|
-
}
|
|
452
|
+
var SPORTS_GAME_LINE_GROUPS = [
|
|
453
|
+
"game_lines",
|
|
454
|
+
"spreads",
|
|
455
|
+
"totals",
|
|
456
|
+
"team_props",
|
|
457
|
+
"specials",
|
|
458
|
+
"completion"
|
|
505
459
|
];
|
|
506
|
-
var
|
|
507
|
-
var SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET = new Set(
|
|
508
|
-
SPORTS_NON_STANDARD_VISIBLE_TAB_KEYS
|
|
509
|
-
);
|
|
460
|
+
var SPORTS_GENERIC_STAT = "player_props";
|
|
510
461
|
var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
|
|
511
462
|
"esports",
|
|
512
463
|
"video games",
|
|
@@ -517,9 +468,6 @@ var ESPORTS_CATEGORY_TOKENS = /* @__PURE__ */ new Set([
|
|
|
517
468
|
]);
|
|
518
469
|
var ESPORTS_TITLE_PATTERN = /\b(?:esports?|valorant|counter-strike|cs2|league of legends|lol|dota|rocket league|overwatch|rainbow six|starcraft|call of duty)\b/i;
|
|
519
470
|
var SERIES_SCOPE_PATTERN = /\b(?:bo[1-9]|best of \d+|map \d+|game \d+)\b/i;
|
|
520
|
-
var SPORTS_SECTION_TAB_BY_KEY = new Map(
|
|
521
|
-
SPORTS_SECTION_TAB_DEFINITIONS.map((definition) => [definition.key, definition])
|
|
522
|
-
);
|
|
523
471
|
var SPORTS_PERIOD_ORDER = [
|
|
524
472
|
"full",
|
|
525
473
|
"1h",
|
|
@@ -584,12 +532,13 @@ var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
|
|
|
584
532
|
const marketTypeIndex = SPORTS_MARKET_TYPE_ORDER.indexOf(sportsMarketType);
|
|
585
533
|
return marketTypeIndex >= 0 ? marketTypeIndex : SPORTS_MARKET_TYPE_ORDER.length;
|
|
586
534
|
};
|
|
587
|
-
var
|
|
588
|
-
|
|
589
|
-
if (
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
return
|
|
535
|
+
var resolveSportsPeriodFamily = (period) => {
|
|
536
|
+
if (period === "1h" || period === "2h") return "halves";
|
|
537
|
+
if (period === "q1" || period === "q2" || period === "q3" || period === "q4") return "quarters";
|
|
538
|
+
if (/^inning_\d{1,2}$/.test(period)) return "innings";
|
|
539
|
+
if (/^set_\d{1,2}$/.test(period)) return "sets";
|
|
540
|
+
if (/^(?:map|game)_\d{1,2}$/.test(period)) return "maps";
|
|
541
|
+
return period;
|
|
593
542
|
};
|
|
594
543
|
var normalizeSportsPeriod = (value) => {
|
|
595
544
|
const resolvedValue = toTrimmedString(value).toLowerCase();
|
|
@@ -634,34 +583,134 @@ var resolveFallbackSportsMarketCategory = (market) => {
|
|
|
634
583
|
if (question.includes("goal")) return "goals";
|
|
635
584
|
return null;
|
|
636
585
|
};
|
|
586
|
+
var resolveSportsStatToken = (market) => {
|
|
587
|
+
const subtype = toTrimmedString(market.marketSubtype).toLowerCase();
|
|
588
|
+
const playerMatch = /_player_(.+)$/.exec(subtype);
|
|
589
|
+
if (playerMatch) return playerMatch[1];
|
|
590
|
+
const category = normalizeSportsMarketCategory(market.marketCategory);
|
|
591
|
+
if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return category;
|
|
592
|
+
return null;
|
|
593
|
+
};
|
|
637
594
|
var resolveMarketSectionTabKey = (market) => {
|
|
595
|
+
var _a;
|
|
638
596
|
if (normalizeSportsMarketType(market.sportsMarketType) === "to_advance") {
|
|
639
597
|
return "game_lines";
|
|
640
598
|
}
|
|
641
599
|
const normalizedCategory = normalizeSportsMarketCategory(market.marketCategory);
|
|
642
600
|
const fallbackCategory = !normalizedCategory || normalizedCategory === "other" ? resolveFallbackSportsMarketCategory(market) : null;
|
|
643
601
|
const category = fallbackCategory != null ? fallbackCategory : normalizedCategory;
|
|
644
|
-
if (category &&
|
|
645
|
-
|
|
646
|
-
}
|
|
602
|
+
if (category && SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(category)) return `stat:${category}`;
|
|
603
|
+
if (category === "exact_score") return "exact_score";
|
|
647
604
|
const group = normalizeSportsMarketGroup(market.marketGroup);
|
|
648
|
-
if (group) return
|
|
605
|
+
if (group === "exact_score") return "exact_score";
|
|
606
|
+
if (group === "player_props") {
|
|
607
|
+
return `stat:${(_a = resolveSportsStatToken(market)) != null ? _a : SPORTS_GENERIC_STAT}`;
|
|
608
|
+
}
|
|
609
|
+
if (group === "period_lines") {
|
|
610
|
+
return `period:${resolveSportsPeriodFamily(normalizeSportsPeriod(market.period))}`;
|
|
611
|
+
}
|
|
612
|
+
if (group === "other") return "other";
|
|
613
|
+
if (group) return "game_lines";
|
|
649
614
|
if (category === "game_lines") return "game_lines";
|
|
650
615
|
if (category === "other") return "other";
|
|
651
616
|
return null;
|
|
652
617
|
};
|
|
653
|
-
var
|
|
654
|
-
var _a;
|
|
655
|
-
const
|
|
656
|
-
const
|
|
618
|
+
var resolveVisibleSportsSectionTabs = (event) => {
|
|
619
|
+
var _a, _b, _c;
|
|
620
|
+
const periodsByFamily = /* @__PURE__ */ new Map();
|
|
621
|
+
const statVolume = /* @__PURE__ */ new Map();
|
|
622
|
+
let hasGameLines = false;
|
|
623
|
+
let hasExactScore = false;
|
|
624
|
+
let hasOther = false;
|
|
625
|
+
for (const market of event.venueMarkets) {
|
|
626
|
+
const key = resolveMarketSectionTabKey(market);
|
|
627
|
+
if (!key) continue;
|
|
628
|
+
if (key === "game_lines") hasGameLines = true;
|
|
629
|
+
else if (key === "exact_score") hasExactScore = true;
|
|
630
|
+
else if (key === "other") hasOther = true;
|
|
631
|
+
else if (key.startsWith("period:")) {
|
|
632
|
+
const family = key.slice("period:".length);
|
|
633
|
+
const periods = (_a = periodsByFamily.get(family)) != null ? _a : /* @__PURE__ */ new Set();
|
|
634
|
+
periods.add(normalizeSportsPeriod(market.period));
|
|
635
|
+
periodsByFamily.set(family, periods);
|
|
636
|
+
} else if (key.startsWith("stat:")) {
|
|
637
|
+
const stat = key.slice("stat:".length);
|
|
638
|
+
statVolume.set(stat, ((_b = statVolume.get(stat)) != null ? _b : 0) + ((_c = market.volume) != null ? _c : 0));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const tabs = [];
|
|
642
|
+
if (hasGameLines) tabs.push({ key: "game_lines", kind: "game_lines" });
|
|
643
|
+
const periodTabs = Array.from(periodsByFamily.entries()).map(([periodFamily, periods]) => ({
|
|
644
|
+
key: `period:${periodFamily}`,
|
|
645
|
+
kind: "period",
|
|
646
|
+
periodFamily,
|
|
647
|
+
periods: Array.from(periods).sort(
|
|
648
|
+
(left, right) => getSportsPeriodOrderIndex(left) - getSportsPeriodOrderIndex(right)
|
|
649
|
+
)
|
|
650
|
+
})).sort(
|
|
651
|
+
(left, right) => getSportsPeriodOrderIndex(left.periods[0]) - getSportsPeriodOrderIndex(right.periods[0])
|
|
652
|
+
);
|
|
653
|
+
tabs.push(...periodTabs);
|
|
654
|
+
const statTabs = Array.from(statVolume.entries()).sort((left, right) => {
|
|
655
|
+
if (left[0] === SPORTS_GENERIC_STAT !== (right[0] === SPORTS_GENERIC_STAT)) {
|
|
656
|
+
return left[0] === SPORTS_GENERIC_STAT ? 1 : -1;
|
|
657
|
+
}
|
|
658
|
+
return right[1] - left[1];
|
|
659
|
+
}).map(([stat]) => ({ key: `stat:${stat}`, kind: "stat", stat }));
|
|
660
|
+
tabs.push(...statTabs);
|
|
661
|
+
if (hasExactScore) tabs.push({ key: "exact_score", kind: "exact_score" });
|
|
662
|
+
if (hasOther) tabs.push({ key: "other", kind: "other" });
|
|
663
|
+
if (isNonStandardSportsLikeEvent(event)) {
|
|
664
|
+
return tabs.filter((tab) => tab.kind === "game_lines" || tab.kind === "other");
|
|
665
|
+
}
|
|
666
|
+
return tabs;
|
|
667
|
+
};
|
|
668
|
+
var resolveSportsSectionFilters = (tab) => {
|
|
669
|
+
if (tab.kind === "period") {
|
|
670
|
+
return {
|
|
671
|
+
marketGroup: ["period_lines"],
|
|
672
|
+
marketCategory: void 0,
|
|
673
|
+
sportsMarketType: void 0,
|
|
674
|
+
period: tab.periods ? [...tab.periods] : void 0
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
if (tab.kind === "stat") {
|
|
678
|
+
const legacyCategory = SPORTS_LEGACY_PROP_CATEGORY_KEY_SET.has(
|
|
679
|
+
tab.stat
|
|
680
|
+
) ? tab.stat : null;
|
|
681
|
+
return legacyCategory ? {
|
|
682
|
+
marketGroup: void 0,
|
|
683
|
+
marketCategory: [legacyCategory],
|
|
684
|
+
sportsMarketType: void 0,
|
|
685
|
+
period: void 0
|
|
686
|
+
} : {
|
|
687
|
+
marketGroup: ["player_props"],
|
|
688
|
+
marketCategory: void 0,
|
|
689
|
+
sportsMarketType: void 0,
|
|
690
|
+
period: void 0
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
if (tab.kind === "exact_score") {
|
|
694
|
+
return {
|
|
695
|
+
marketGroup: ["exact_score"],
|
|
696
|
+
marketCategory: void 0,
|
|
697
|
+
sportsMarketType: void 0,
|
|
698
|
+
period: void 0
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
if (tab.kind === "other") {
|
|
702
|
+
return {
|
|
703
|
+
marketGroup: ["other"],
|
|
704
|
+
marketCategory: void 0,
|
|
705
|
+
sportsMarketType: void 0,
|
|
706
|
+
period: void 0
|
|
707
|
+
};
|
|
708
|
+
}
|
|
657
709
|
return {
|
|
658
|
-
marketGroup:
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
marketCategory: !useMarketGroup && resolvedDefinition.marketCategory ? [resolvedDefinition.marketCategory] : void 0,
|
|
663
|
-
sportsMarketType: resolvedDefinition.sportsMarketType ? [...resolvedDefinition.sportsMarketType] : void 0,
|
|
664
|
-
period: resolvedDefinition.period ? [...resolvedDefinition.period] : void 0
|
|
710
|
+
marketGroup: [...SPORTS_GAME_LINE_GROUPS],
|
|
711
|
+
marketCategory: void 0,
|
|
712
|
+
sportsMarketType: void 0,
|
|
713
|
+
period: void 0
|
|
665
714
|
};
|
|
666
715
|
};
|
|
667
716
|
var hasTeamTitledOutcomes = (market) => {
|
|
@@ -675,28 +724,41 @@ var isClusterRelation = (left, right) => {
|
|
|
675
724
|
var _a, _b;
|
|
676
725
|
return ((_a = left.matchedVenueMarkets) != null ? _a : []).some((market) => market.id === right.id) || ((_b = right.matchedVenueMarkets) != null ? _b : []).some((market) => market.id === left.id);
|
|
677
726
|
};
|
|
678
|
-
var
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
);
|
|
727
|
+
var isDecomposedLeg = (market) => {
|
|
728
|
+
var _a;
|
|
729
|
+
const labels = ((_a = market.venueMarketOutcomes) != null ? _a : []).map(
|
|
730
|
+
(outcome) => toTrimmedString(outcome.label).toLowerCase()
|
|
731
|
+
);
|
|
732
|
+
return labels.length === 2 && labels.every((label) => YES_NO_LABELS.has(label)) && !hasTeamTitledOutcomes(market);
|
|
733
|
+
};
|
|
734
|
+
var dropDecomposedLegsMergedIntoSingle = (markets) => {
|
|
735
|
+
const legs = markets.filter((market) => isDecomposedLeg(market));
|
|
736
|
+
if (legs.length === 0) return markets;
|
|
737
|
+
const hasMergedSingle = markets.some(
|
|
738
|
+
(market) => {
|
|
739
|
+
var _a, _b;
|
|
740
|
+
return hasTeamTitledOutcomes(market) && ((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a.length) != null ? _b : 0) >= legs.length && markets.some((other) => other !== market && isClusterRelation(market, other));
|
|
741
|
+
}
|
|
742
|
+
);
|
|
743
|
+
return hasMergedSingle ? markets.filter((market) => !isDecomposedLeg(market)) : markets;
|
|
744
|
+
};
|
|
683
745
|
var resolveSportsSectionMarkets = ({
|
|
684
|
-
|
|
746
|
+
tab,
|
|
685
747
|
eventMarkets,
|
|
686
748
|
sectionMarkets
|
|
687
749
|
}) => {
|
|
688
|
-
const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) ===
|
|
750
|
+
const effectiveSectionMarkets = sectionMarkets.length > 0 ? sectionMarkets : eventMarkets.filter((market) => resolveMarketSectionTabKey(market) === tab.key);
|
|
689
751
|
const filteredSectionMarkets = effectiveSectionMarkets.filter(
|
|
690
|
-
(market) => resolveMarketSectionTabKey(market) ===
|
|
752
|
+
(market) => resolveMarketSectionTabKey(market) === tab.key
|
|
691
753
|
);
|
|
692
|
-
if (
|
|
754
|
+
if (tab.key === "other" || tab.key === `stat:${SPORTS_GENERIC_STAT}`) {
|
|
693
755
|
const seenIds = new Set(filteredSectionMarkets.map((market) => market.id));
|
|
694
|
-
const
|
|
695
|
-
(market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) ===
|
|
756
|
+
const strayMarkets = eventMarkets.filter(
|
|
757
|
+
(market) => !seenIds.has(market.id) && resolveMarketSectionTabKey(market) === tab.key
|
|
696
758
|
);
|
|
697
|
-
return [...filteredSectionMarkets, ...
|
|
759
|
+
return [...filteredSectionMarkets, ...strayMarkets];
|
|
698
760
|
}
|
|
699
|
-
if (
|
|
761
|
+
if (tab.kind !== "game_lines") return filteredSectionMarkets;
|
|
700
762
|
const dedupeEventMarketsOfType = (type) => {
|
|
701
763
|
const dedupedMarkets = [];
|
|
702
764
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
@@ -796,7 +858,9 @@ var resolveSpreadOutcomeTeamNames = (activeMarket, groupMarkets) => {
|
|
|
796
858
|
return toTrimmedString((_b = (_a = market.venueMarketOutcomes) == null ? void 0 : _a[index]) == null ? void 0 : _b.title);
|
|
797
859
|
}).filter((title) => isSpreadTeamTitle(title));
|
|
798
860
|
if (cleanTitles.length === 0) return null;
|
|
799
|
-
return cleanTitles.reduce(
|
|
861
|
+
return cleanTitles.reduce(
|
|
862
|
+
(longest, title) => title.length > longest.length ? title : longest
|
|
863
|
+
);
|
|
800
864
|
};
|
|
801
865
|
return { favored: pickName(0), dog: pickName(1) };
|
|
802
866
|
};
|
|
@@ -805,9 +869,7 @@ var resolveCombinedMoneylineLegLabel = (market) => {
|
|
|
805
869
|
return toTrimmedString(typedMarket.shortTitle) || toTrimmedString(market.question);
|
|
806
870
|
};
|
|
807
871
|
var areCombinedMoneylineLegsDistinct = (markets) => {
|
|
808
|
-
const labels = markets.map(
|
|
809
|
-
(market) => resolveCombinedMoneylineLegLabel(market).toLowerCase()
|
|
810
|
-
);
|
|
872
|
+
const labels = markets.map((market) => resolveCombinedMoneylineLegLabel(market).toLowerCase());
|
|
811
873
|
return labels.every((label) => label.length > 0) && new Set(labels).size === labels.length;
|
|
812
874
|
};
|
|
813
875
|
var resolveDisplayGroupFamilyKey = (market) => {
|
|
@@ -1092,6 +1154,15 @@ var buildSportsSlideFromGroup = (group) => {
|
|
|
1092
1154
|
defaultStopIndex
|
|
1093
1155
|
};
|
|
1094
1156
|
};
|
|
1157
|
+
var formatSportsPeriodGrammarLabel = (period) => {
|
|
1158
|
+
const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
|
|
1159
|
+
if (!grammarMatch) return null;
|
|
1160
|
+
if (grammarMatch[1]) {
|
|
1161
|
+
const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
|
|
1162
|
+
return `${family} ${Number(grammarMatch[2])}`;
|
|
1163
|
+
}
|
|
1164
|
+
return `First ${Number(grammarMatch[3])} Innings`;
|
|
1165
|
+
};
|
|
1095
1166
|
var resolveSportsCategoryTokens = (event) => {
|
|
1096
1167
|
return new Set(
|
|
1097
1168
|
event.categories.flatMap((entry) => {
|
|
@@ -1114,39 +1185,20 @@ var isNonStandardSportsLikeEvent = (event) => {
|
|
|
1114
1185
|
return ESPORTS_TITLE_PATTERN.test(question) || SERIES_SCOPE_PATTERN.test(question);
|
|
1115
1186
|
});
|
|
1116
1187
|
};
|
|
1117
|
-
var resolveVisibleSportsSectionTabDefinitions = (event) => {
|
|
1118
|
-
const presentTabKeys = /* @__PURE__ */ new Set();
|
|
1119
|
-
for (const market of event.venueMarkets) {
|
|
1120
|
-
const tabKey = resolveMarketSectionTabKey(market);
|
|
1121
|
-
if (tabKey) presentTabKeys.add(tabKey);
|
|
1122
|
-
}
|
|
1123
|
-
let definitions = SPORTS_SECTION_TAB_DEFINITIONS.filter(
|
|
1124
|
-
(definition) => presentTabKeys.has(definition.key)
|
|
1125
|
-
);
|
|
1126
|
-
if (isNonStandardSportsLikeEvent(event)) {
|
|
1127
|
-
definitions = definitions.filter(
|
|
1128
|
-
(definition) => SPORTS_NON_STANDARD_VISIBLE_TAB_KEY_SET.has(definition.key)
|
|
1129
|
-
);
|
|
1130
|
-
}
|
|
1131
|
-
return definitions;
|
|
1132
|
-
};
|
|
1133
1188
|
var mergeSportsSectionMarketsIntoEvent = ({
|
|
1134
1189
|
event,
|
|
1135
1190
|
sectionMarketsByKey
|
|
1136
1191
|
}) => {
|
|
1137
|
-
var _a;
|
|
1138
1192
|
const orderedVenueMarkets = [...event.venueMarkets];
|
|
1139
1193
|
const seenMarketIds = new Set(orderedVenueMarkets.map((market) => market.id));
|
|
1140
|
-
for (const
|
|
1141
|
-
for (const market of
|
|
1194
|
+
for (const markets of Object.values(sectionMarketsByKey)) {
|
|
1195
|
+
for (const market of markets != null ? markets : []) {
|
|
1142
1196
|
if (seenMarketIds.has(market.id)) continue;
|
|
1143
1197
|
seenMarketIds.add(market.id);
|
|
1144
1198
|
orderedVenueMarkets.push(market);
|
|
1145
1199
|
}
|
|
1146
1200
|
}
|
|
1147
|
-
return __spreadProps(__spreadValues({}, event), {
|
|
1148
|
-
venueMarkets: orderedVenueMarkets
|
|
1149
|
-
});
|
|
1201
|
+
return __spreadProps(__spreadValues({}, event), { venueMarkets: orderedVenueMarkets });
|
|
1150
1202
|
};
|
|
1151
1203
|
|
|
1152
1204
|
// src/pages/event-market/sports-market-card.tsx
|
|
@@ -1635,24 +1687,48 @@ SportsMarketCard.displayName = "SportsMarketCard";
|
|
|
1635
1687
|
|
|
1636
1688
|
// src/pages/event-market/sports-markets.tsx
|
|
1637
1689
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1638
|
-
var
|
|
1639
|
-
|
|
1690
|
+
var STAT_LABEL_OVERRIDES = {
|
|
1691
|
+
rbis: "RBIs",
|
|
1692
|
+
hits_runs_rbis: "Hits + Runs + RBIs",
|
|
1693
|
+
ot: "OT"
|
|
1694
|
+
};
|
|
1695
|
+
var formatStatLabel = (stat) => {
|
|
1696
|
+
var _a;
|
|
1697
|
+
return (_a = STAT_LABEL_OVERRIDES[stat]) != null ? _a : stat.split("_").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
1698
|
+
};
|
|
1699
|
+
var LEGACY_STAT_LABEL_KEYS = {
|
|
1700
|
+
corners: "cornersTab",
|
|
1701
|
+
goals: "goalsTab",
|
|
1702
|
+
assists: "assistsTab",
|
|
1703
|
+
shots: "shotsTab"
|
|
1704
|
+
};
|
|
1705
|
+
var resolveSportsSectionLabel = (labels, tab) => {
|
|
1706
|
+
var _a, _b, _c, _d, _e;
|
|
1707
|
+
const sports = labels.eventMarketPage.sports;
|
|
1708
|
+
switch (tab.kind) {
|
|
1640
1709
|
case "game_lines":
|
|
1641
|
-
return
|
|
1642
|
-
case "halves":
|
|
1643
|
-
return labels.eventMarketPage.sports.halvesTab;
|
|
1710
|
+
return sports.gameLinesTab;
|
|
1644
1711
|
case "exact_score":
|
|
1645
|
-
return
|
|
1646
|
-
case "corners":
|
|
1647
|
-
return labels.eventMarketPage.sports.cornersTab;
|
|
1648
|
-
case "goals":
|
|
1649
|
-
return labels.eventMarketPage.sports.goalsTab;
|
|
1650
|
-
case "assists":
|
|
1651
|
-
return labels.eventMarketPage.sports.assistsTab;
|
|
1652
|
-
case "shots":
|
|
1653
|
-
return labels.eventMarketPage.sports.shotsTab;
|
|
1712
|
+
return sports.exactScoreTab;
|
|
1654
1713
|
case "other":
|
|
1655
|
-
return
|
|
1714
|
+
return sports.otherTab;
|
|
1715
|
+
case "stat": {
|
|
1716
|
+
if (tab.stat === "player_props") return sports.playerPropsTab;
|
|
1717
|
+
const legacyLabelKey = tab.stat ? LEGACY_STAT_LABEL_KEYS[tab.stat] : void 0;
|
|
1718
|
+
return legacyLabelKey ? sports[legacyLabelKey] : formatStatLabel((_a = tab.stat) != null ? _a : "");
|
|
1719
|
+
}
|
|
1720
|
+
case "period": {
|
|
1721
|
+
switch (tab.periodFamily) {
|
|
1722
|
+
case "halves":
|
|
1723
|
+
return sports.halvesTab;
|
|
1724
|
+
case "quarters":
|
|
1725
|
+
return sports.quartersTab;
|
|
1726
|
+
case "sets":
|
|
1727
|
+
return sports.setsTab;
|
|
1728
|
+
default:
|
|
1729
|
+
return (_e = (_c = formatSportsPeriodGrammarLabel((_b = tab.periodFamily) != null ? _b : "")) == null ? void 0 : _c.replace(/^First /, "")) != null ? _e : formatStatLabel((_d = tab.periodFamily) != null ? _d : "");
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1656
1732
|
}
|
|
1657
1733
|
};
|
|
1658
1734
|
var SportsTabButton = ({
|
|
@@ -1740,18 +1816,23 @@ var SportsMarkets = ({
|
|
|
1740
1816
|
}
|
|
1741
1817
|
return merged;
|
|
1742
1818
|
}, [event.venueMarkets, gameMarkets]);
|
|
1743
|
-
const
|
|
1744
|
-
() =>
|
|
1819
|
+
const visibleTabs = useMemo2(
|
|
1820
|
+
() => resolveVisibleSportsSectionTabs(__spreadProps(__spreadValues({}, event), { venueMarkets: tabSourceMarkets })),
|
|
1745
1821
|
[event, tabSourceMarkets]
|
|
1746
1822
|
);
|
|
1747
|
-
const shouldRenderTabs =
|
|
1748
|
-
const [activeTabKey, setActiveTabKey] = useState4(
|
|
1749
|
-
|
|
1823
|
+
const shouldRenderTabs = visibleTabs.length > 1 && tabSourceMarkets.length > 1;
|
|
1824
|
+
const [activeTabKey, setActiveTabKey] = useState4((_b = (_a = visibleTabs[0]) == null ? void 0 : _a.key) != null ? _b : "game_lines");
|
|
1825
|
+
const activeTab = useMemo2(
|
|
1826
|
+
() => {
|
|
1827
|
+
var _a2, _b2;
|
|
1828
|
+
return (_b2 = (_a2 = visibleTabs.find((tab) => tab.key === activeTabKey)) != null ? _a2 : visibleTabs[0]) != null ? _b2 : { key: "game_lines", kind: "game_lines" };
|
|
1829
|
+
},
|
|
1830
|
+
[visibleTabs, activeTabKey]
|
|
1750
1831
|
);
|
|
1751
1832
|
const [expandedGroupId, setExpandedGroupId] = useState4(null);
|
|
1752
1833
|
const [stableMarketsByTab, setStableMarketsByTab] = useState4({});
|
|
1753
|
-
const activeTabLabel = resolveSportsSectionLabel(labels,
|
|
1754
|
-
const sectionFilters = resolveSportsSectionFilters(
|
|
1834
|
+
const activeTabLabel = resolveSportsSectionLabel(labels, activeTab);
|
|
1835
|
+
const sectionFilters = resolveSportsSectionFilters(activeTab);
|
|
1755
1836
|
const sectionMarketsQuery = useVenueMarkets({
|
|
1756
1837
|
aggKey: event.aggKey ? [event.aggKey] : void 0,
|
|
1757
1838
|
sportsMarketType: sectionFilters.sportsMarketType,
|
|
@@ -1774,26 +1855,25 @@ var SportsMarkets = ({
|
|
|
1774
1855
|
} = sectionMarketsQuery;
|
|
1775
1856
|
const resolvedSectionMarkets = useMemo2(
|
|
1776
1857
|
() => resolveSportsSectionMarkets({
|
|
1777
|
-
|
|
1858
|
+
tab: activeTab,
|
|
1778
1859
|
eventMarkets: tabSourceMarkets,
|
|
1779
1860
|
sectionMarkets
|
|
1780
1861
|
}),
|
|
1781
|
-
[
|
|
1862
|
+
[activeTab, tabSourceMarkets, sectionMarkets]
|
|
1782
1863
|
);
|
|
1783
1864
|
const isSectionSettled = !isSectionLoading && !hasNextPage && !isFetchingNextPage;
|
|
1784
1865
|
const stableSectionMarkets = stableMarketsByTab[activeTabKey];
|
|
1785
|
-
const displayedSectionMarkets =
|
|
1866
|
+
const displayedSectionMarkets = useMemo2(
|
|
1867
|
+
() => stableSectionMarkets != null ? stableSectionMarkets : isSectionSettled ? resolvedSectionMarkets : [],
|
|
1868
|
+
[stableSectionMarkets, isSectionSettled, resolvedSectionMarkets]
|
|
1869
|
+
);
|
|
1786
1870
|
const periodGroups = useMemo2(
|
|
1787
1871
|
() => groupSportsMarketsByPeriod(displayedSectionMarkets),
|
|
1788
1872
|
[displayedSectionMarkets]
|
|
1789
1873
|
);
|
|
1790
|
-
const displayedPeriodGroups = useMemo2(
|
|
1791
|
-
() => activeTabKey === "game_lines" ? periodGroups.filter((periodGroup) => periodGroup.key === "full") : periodGroups,
|
|
1792
|
-
[activeTabKey, periodGroups]
|
|
1793
|
-
);
|
|
1794
1874
|
const allGroups = useMemo2(
|
|
1795
|
-
() =>
|
|
1796
|
-
[
|
|
1875
|
+
() => periodGroups.flatMap((periodGroup) => periodGroup.groups),
|
|
1876
|
+
[periodGroups]
|
|
1797
1877
|
);
|
|
1798
1878
|
useEffect4(() => {
|
|
1799
1879
|
if (hasNextPage && !isFetchingNextPage) {
|
|
@@ -1827,9 +1907,9 @@ var SportsMarkets = ({
|
|
|
1827
1907
|
}, [activeTabKey, displayedSectionMarkets, hasAggKey, onSectionMarketsChange]);
|
|
1828
1908
|
useEffect4(() => {
|
|
1829
1909
|
var _a2, _b2;
|
|
1830
|
-
if (
|
|
1831
|
-
setActiveTabKey((_b2 = (_a2 =
|
|
1832
|
-
}, [activeTabKey,
|
|
1910
|
+
if (visibleTabs.some((tab) => tab.key === activeTabKey)) return;
|
|
1911
|
+
setActiveTabKey((_b2 = (_a2 = visibleTabs[0]) == null ? void 0 : _a2.key) != null ? _b2 : "game_lines");
|
|
1912
|
+
}, [activeTabKey, visibleTabs]);
|
|
1833
1913
|
const lastActiveTabRef = useRef3(null);
|
|
1834
1914
|
useEffect4(() => {
|
|
1835
1915
|
if (allGroups.length === 0) return;
|
|
@@ -1876,14 +1956,14 @@ var SportsMarkets = ({
|
|
|
1876
1956
|
role: "tablist",
|
|
1877
1957
|
"aria-label": labels.eventMarketPage.sports.sectionTabsAria,
|
|
1878
1958
|
className: "flex flex-nowrap items-center gap-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
1879
|
-
children:
|
|
1959
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsx4(
|
|
1880
1960
|
SportsTabButton,
|
|
1881
1961
|
{
|
|
1882
|
-
isActive:
|
|
1883
|
-
label: resolveSportsSectionLabel(labels,
|
|
1884
|
-
onClick: () => setActiveTabKey(
|
|
1962
|
+
isActive: tab.key === activeTabKey,
|
|
1963
|
+
label: resolveSportsSectionLabel(labels, tab),
|
|
1964
|
+
onClick: () => setActiveTabKey(tab.key)
|
|
1885
1965
|
},
|
|
1886
|
-
|
|
1966
|
+
tab.key
|
|
1887
1967
|
))
|
|
1888
1968
|
}
|
|
1889
1969
|
) : null,
|
|
@@ -1897,7 +1977,7 @@ var SportsMarkets = ({
|
|
|
1897
1977
|
classNames: { root: "min-h-[220px]" }
|
|
1898
1978
|
}
|
|
1899
1979
|
) : null,
|
|
1900
|
-
|
|
1980
|
+
periodGroups.map((periodGroup) => {
|
|
1901
1981
|
return /* @__PURE__ */ jsx4(
|
|
1902
1982
|
"section",
|
|
1903
1983
|
{
|
|
@@ -1954,7 +2034,7 @@ var SportsEventMarketPage = ({
|
|
|
1954
2034
|
}, [event, sectionMarketsByKey]);
|
|
1955
2035
|
const eventTradingState = useMemo3(() => resolveEventTradingState2(composedEvent), [composedEvent]);
|
|
1956
2036
|
const hasSportsSections = useMemo3(
|
|
1957
|
-
() =>
|
|
2037
|
+
() => resolveVisibleSportsSectionTabs(event).length > 0,
|
|
1958
2038
|
[event]
|
|
1959
2039
|
);
|
|
1960
2040
|
const stickyOrderPanelState = resolveEventMarketPageStickyState({
|