@agg-build/ui 2.1.3 → 2.1.5

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.
@@ -654,6 +654,7 @@ var SPORTS_PERIOD_KEYS = [
654
654
  "first_5_innings",
655
655
  "other"
656
656
  ];
657
+ var SPORTS_PERIOD_GRAMMAR_PATTERN = /^(?:(set|map|game|period|inning)_(\d{1,2})|first_(\d{1,2})_innings)$/;
657
658
  var SPORTS_MARKET_CATEGORY_KEYS = [
658
659
  "game_lines",
659
660
  "exact_score",
@@ -782,9 +783,22 @@ var stripLineValueFromQuestion = (question) => {
782
783
  const strippedQuestion = sanitizeFamilyValue(question);
783
784
  return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
784
785
  };
786
+ var SPORTS_PERIOD_FAMILY_ORDER = ["period", "inning", "set", "map", "game"];
785
787
  var getSportsPeriodOrderIndex = (period) => {
788
+ var _a, _b;
786
789
  const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
787
- return periodIndex >= 0 ? periodIndex : SPORTS_PERIOD_ORDER.length;
790
+ if (periodIndex >= 0) {
791
+ return period === "other" ? Number.MAX_SAFE_INTEGER : periodIndex;
792
+ }
793
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
794
+ if (grammarMatch) {
795
+ const familyIndex = grammarMatch[1] ? SPORTS_PERIOD_FAMILY_ORDER.indexOf(
796
+ grammarMatch[1]
797
+ ) : SPORTS_PERIOD_FAMILY_ORDER.length;
798
+ const scopeNumber = Number((_b = (_a = grammarMatch[2]) != null ? _a : grammarMatch[3]) != null ? _b : 0);
799
+ return SPORTS_PERIOD_ORDER.length + familyIndex * 100 + scopeNumber;
800
+ }
801
+ return Number.MAX_SAFE_INTEGER - 1;
788
802
  };
789
803
  var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
790
804
  if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
@@ -801,7 +815,10 @@ var resolveSportsSectionDefinition = (key) => {
801
815
  var normalizeSportsPeriod = (value) => {
802
816
  const resolvedValue = toTrimmedString(value).toLowerCase();
803
817
  if (!resolvedValue) return "full";
804
- return SPORTS_PERIOD_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
818
+ if (resolvedValue === "match") return "full";
819
+ if (SPORTS_PERIOD_KEY_SET.has(resolvedValue)) return resolvedValue;
820
+ if (SPORTS_PERIOD_GRAMMAR_PATTERN.test(resolvedValue)) return resolvedValue;
821
+ return "other";
805
822
  };
806
823
  var normalizeSportsMarketType = (value) => {
807
824
  const resolvedValue = toTrimmedString(value).toLowerCase();
@@ -1109,6 +1126,15 @@ var buildSportsSlideFromGroup = (group) => {
1109
1126
  defaultStopIndex
1110
1127
  };
1111
1128
  };
1129
+ var formatSportsPeriodGrammarLabel = (period) => {
1130
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
1131
+ if (!grammarMatch) return null;
1132
+ if (grammarMatch[1]) {
1133
+ const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
1134
+ return `${family} ${Number(grammarMatch[2])}`;
1135
+ }
1136
+ return `First ${Number(grammarMatch[3])} Innings`;
1137
+ };
1112
1138
  var resolveSportsCategoryTokens = (event) => {
1113
1139
  return new Set(
1114
1140
  event.categories.flatMap((entry) => {
@@ -1346,6 +1372,7 @@ var resolveSportsSectionLabel = (labels, key) => {
1346
1372
  }
1347
1373
  };
1348
1374
  var resolveSportsPeriodLabel = (labels, period) => {
1375
+ var _a;
1349
1376
  switch (period) {
1350
1377
  case "full":
1351
1378
  return labels.eventMarketPage.sports.fullPeriod;
@@ -1373,6 +1400,8 @@ var resolveSportsPeriodLabel = (labels, period) => {
1373
1400
  return "1st 5 Innings";
1374
1401
  case "other":
1375
1402
  return labels.eventMarketPage.sports.otherPeriod;
1403
+ default:
1404
+ return (_a = formatSportsPeriodGrammarLabel(period)) != null ? _a : labels.eventMarketPage.sports.otherPeriod;
1376
1405
  }
1377
1406
  };
1378
1407
  var SportsTabButton = ({
package/dist/index.js CHANGED
@@ -23027,6 +23027,7 @@ var SPORTS_PERIOD_KEYS = [
23027
23027
  "first_5_innings",
23028
23028
  "other"
23029
23029
  ];
23030
+ var SPORTS_PERIOD_GRAMMAR_PATTERN = /^(?:(set|map|game|period|inning)_(\d{1,2})|first_(\d{1,2})_innings)$/;
23030
23031
  var SPORTS_MARKET_CATEGORY_KEYS = [
23031
23032
  "game_lines",
23032
23033
  "exact_score",
@@ -23155,9 +23156,22 @@ var stripLineValueFromQuestion = (question) => {
23155
23156
  const strippedQuestion = sanitizeFamilyValue(question);
23156
23157
  return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
23157
23158
  };
23159
+ var SPORTS_PERIOD_FAMILY_ORDER = ["period", "inning", "set", "map", "game"];
23158
23160
  var getSportsPeriodOrderIndex = (period) => {
23161
+ var _a, _b;
23159
23162
  const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
23160
- return periodIndex >= 0 ? periodIndex : SPORTS_PERIOD_ORDER.length;
23163
+ if (periodIndex >= 0) {
23164
+ return period === "other" ? Number.MAX_SAFE_INTEGER : periodIndex;
23165
+ }
23166
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
23167
+ if (grammarMatch) {
23168
+ const familyIndex = grammarMatch[1] ? SPORTS_PERIOD_FAMILY_ORDER.indexOf(
23169
+ grammarMatch[1]
23170
+ ) : SPORTS_PERIOD_FAMILY_ORDER.length;
23171
+ const scopeNumber = Number((_b = (_a = grammarMatch[2]) != null ? _a : grammarMatch[3]) != null ? _b : 0);
23172
+ return SPORTS_PERIOD_ORDER.length + familyIndex * 100 + scopeNumber;
23173
+ }
23174
+ return Number.MAX_SAFE_INTEGER - 1;
23161
23175
  };
23162
23176
  var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
23163
23177
  if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
@@ -23174,7 +23188,10 @@ var resolveSportsSectionDefinition = (key) => {
23174
23188
  var normalizeSportsPeriod = (value) => {
23175
23189
  const resolvedValue = toTrimmedString(value).toLowerCase();
23176
23190
  if (!resolvedValue) return "full";
23177
- return SPORTS_PERIOD_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
23191
+ if (resolvedValue === "match") return "full";
23192
+ if (SPORTS_PERIOD_KEY_SET.has(resolvedValue)) return resolvedValue;
23193
+ if (SPORTS_PERIOD_GRAMMAR_PATTERN.test(resolvedValue)) return resolvedValue;
23194
+ return "other";
23178
23195
  };
23179
23196
  var normalizeSportsMarketType = (value) => {
23180
23197
  const resolvedValue = toTrimmedString(value).toLowerCase();
@@ -23482,6 +23499,15 @@ var buildSportsSlideFromGroup = (group) => {
23482
23499
  defaultStopIndex
23483
23500
  };
23484
23501
  };
23502
+ var formatSportsPeriodGrammarLabel = (period) => {
23503
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
23504
+ if (!grammarMatch) return null;
23505
+ if (grammarMatch[1]) {
23506
+ const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
23507
+ return `${family} ${Number(grammarMatch[2])}`;
23508
+ }
23509
+ return `First ${Number(grammarMatch[3])} Innings`;
23510
+ };
23485
23511
  var resolveSportsCategoryTokens = (event) => {
23486
23512
  return new Set(
23487
23513
  event.categories.flatMap((entry) => {
@@ -23719,6 +23745,7 @@ var resolveSportsSectionLabel = (labels, key) => {
23719
23745
  }
23720
23746
  };
23721
23747
  var resolveSportsPeriodLabel = (labels, period) => {
23748
+ var _a;
23722
23749
  switch (period) {
23723
23750
  case "full":
23724
23751
  return labels.eventMarketPage.sports.fullPeriod;
@@ -23746,6 +23773,8 @@ var resolveSportsPeriodLabel = (labels, period) => {
23746
23773
  return "1st 5 Innings";
23747
23774
  case "other":
23748
23775
  return labels.eventMarketPage.sports.otherPeriod;
23776
+ default:
23777
+ return (_a = formatSportsPeriodGrammarLabel(period)) != null ? _a : labels.eventMarketPage.sports.otherPeriod;
23749
23778
  }
23750
23779
  };
23751
23780
  var SportsTabButton = ({
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  UserProfilePage,
12
12
  buildAggTxExplorerHref,
13
13
  useHomePageModals
14
- } from "./chunk-TAGPAADA.mjs";
14
+ } from "./chunk-XUBIJI4R.mjs";
15
15
  import {
16
16
  EventList,
17
17
  EventListItem,
package/dist/pages.js CHANGED
@@ -20839,6 +20839,7 @@ var SPORTS_PERIOD_KEYS = [
20839
20839
  "first_5_innings",
20840
20840
  "other"
20841
20841
  ];
20842
+ var SPORTS_PERIOD_GRAMMAR_PATTERN = /^(?:(set|map|game|period|inning)_(\d{1,2})|first_(\d{1,2})_innings)$/;
20842
20843
  var SPORTS_MARKET_CATEGORY_KEYS = [
20843
20844
  "game_lines",
20844
20845
  "exact_score",
@@ -20967,9 +20968,22 @@ var stripLineValueFromQuestion = (question) => {
20967
20968
  const strippedQuestion = sanitizeFamilyValue(question);
20968
20969
  return strippedQuestion ? question.replace(/\(\s*[+-]?\d+(?:\.\d+)?\s*\)\s*$/g, "").replace(/\s+[+-]?\d+(?:\.\d+)?\s*$/g, "").replace(/\s+/g, " ").trim() : question.trim();
20969
20970
  };
20971
+ var SPORTS_PERIOD_FAMILY_ORDER = ["period", "inning", "set", "map", "game"];
20970
20972
  var getSportsPeriodOrderIndex = (period) => {
20973
+ var _a, _b;
20971
20974
  const periodIndex = SPORTS_PERIOD_ORDER.indexOf(period);
20972
- return periodIndex >= 0 ? periodIndex : SPORTS_PERIOD_ORDER.length;
20975
+ if (periodIndex >= 0) {
20976
+ return period === "other" ? Number.MAX_SAFE_INTEGER : periodIndex;
20977
+ }
20978
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
20979
+ if (grammarMatch) {
20980
+ const familyIndex = grammarMatch[1] ? SPORTS_PERIOD_FAMILY_ORDER.indexOf(
20981
+ grammarMatch[1]
20982
+ ) : SPORTS_PERIOD_FAMILY_ORDER.length;
20983
+ const scopeNumber = Number((_b = (_a = grammarMatch[2]) != null ? _a : grammarMatch[3]) != null ? _b : 0);
20984
+ return SPORTS_PERIOD_ORDER.length + familyIndex * 100 + scopeNumber;
20985
+ }
20986
+ return Number.MAX_SAFE_INTEGER - 1;
20973
20987
  };
20974
20988
  var getSportsMarketTypeOrderIndex = (sportsMarketType) => {
20975
20989
  if (!sportsMarketType) return SPORTS_MARKET_TYPE_ORDER.length;
@@ -20986,7 +21000,10 @@ var resolveSportsSectionDefinition = (key) => {
20986
21000
  var normalizeSportsPeriod = (value) => {
20987
21001
  const resolvedValue = toTrimmedString(value).toLowerCase();
20988
21002
  if (!resolvedValue) return "full";
20989
- return SPORTS_PERIOD_KEY_SET.has(resolvedValue) ? resolvedValue : "other";
21003
+ if (resolvedValue === "match") return "full";
21004
+ if (SPORTS_PERIOD_KEY_SET.has(resolvedValue)) return resolvedValue;
21005
+ if (SPORTS_PERIOD_GRAMMAR_PATTERN.test(resolvedValue)) return resolvedValue;
21006
+ return "other";
20990
21007
  };
20991
21008
  var normalizeSportsMarketType = (value) => {
20992
21009
  const resolvedValue = toTrimmedString(value).toLowerCase();
@@ -21294,6 +21311,15 @@ var buildSportsSlideFromGroup = (group) => {
21294
21311
  defaultStopIndex
21295
21312
  };
21296
21313
  };
21314
+ var formatSportsPeriodGrammarLabel = (period) => {
21315
+ const grammarMatch = SPORTS_PERIOD_GRAMMAR_PATTERN.exec(period);
21316
+ if (!grammarMatch) return null;
21317
+ if (grammarMatch[1]) {
21318
+ const family = grammarMatch[1].charAt(0).toUpperCase() + grammarMatch[1].slice(1);
21319
+ return `${family} ${Number(grammarMatch[2])}`;
21320
+ }
21321
+ return `First ${Number(grammarMatch[3])} Innings`;
21322
+ };
21297
21323
  var resolveSportsCategoryTokens = (event) => {
21298
21324
  return new Set(
21299
21325
  event.categories.flatMap((entry) => {
@@ -21531,6 +21557,7 @@ var resolveSportsSectionLabel = (labels, key) => {
21531
21557
  }
21532
21558
  };
21533
21559
  var resolveSportsPeriodLabel = (labels, period) => {
21560
+ var _a;
21534
21561
  switch (period) {
21535
21562
  case "full":
21536
21563
  return labels.eventMarketPage.sports.fullPeriod;
@@ -21558,6 +21585,8 @@ var resolveSportsPeriodLabel = (labels, period) => {
21558
21585
  return "1st 5 Innings";
21559
21586
  case "other":
21560
21587
  return labels.eventMarketPage.sports.otherPeriod;
21588
+ default:
21589
+ return (_a = formatSportsPeriodGrammarLabel(period)) != null ? _a : labels.eventMarketPage.sports.otherPeriod;
21561
21590
  }
21562
21591
  };
21563
21592
  var SportsTabButton = ({
package/dist/pages.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  UserProfilePage,
9
9
  buildAggTxExplorerHref,
10
10
  useHomePageModals
11
- } from "./chunk-TAGPAADA.mjs";
11
+ } from "./chunk-XUBIJI4R.mjs";
12
12
  import "./chunk-TBZWRUFB.mjs";
13
13
  import {
14
14
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -4,7 +4,15 @@ export type SportsSectionTabKey = (typeof SPORTS_SECTION_TAB_KEYS)[number];
4
4
  export declare const SPORTS_MARKET_TYPE_KEYS: readonly ["moneyline", "spread", "total", "prop", "completion", "other"];
5
5
  export type SportsMarketTypeKey = (typeof SPORTS_MARKET_TYPE_KEYS)[number];
6
6
  export declare const SPORTS_PERIOD_KEYS: readonly ["full", "1h", "2h", "q1", "q2", "q3", "q4", "ot", "first_inning", "second_inning", "third_inning", "first_5_innings", "other"];
7
- export type SportsPeriodKey = (typeof SPORTS_PERIOD_KEYS)[number];
7
+ /**
8
+ * Known named periods plus the documented open grammar (`set_N`, `map_N`,
9
+ * `game_N`, `period_N`, `inning_N`, `first_N_innings` — see the sports
10
+ * recipe's period vocabulary). Grammar tokens pass through verbatim so
11
+ * tennis sets / esports maps / hockey periods group under their own named
12
+ * period instead of collapsing into "other" (prod 2026-07: set_1 ×1,741,
13
+ * inning_1 ×144 were all landing in the Other bucket).
14
+ */
15
+ export type SportsPeriodKey = (typeof SPORTS_PERIOD_KEYS)[number] | (string & {});
8
16
  export declare const SPORTS_MARKET_CATEGORY_KEYS: readonly ["game_lines", "exact_score", "corners", "goals", "assists", "shots", "other"];
9
17
  export type SportsMarketCategoryKey = (typeof SPORTS_MARKET_CATEGORY_KEYS)[number];
10
18
  export declare const SPORTS_MARKET_GROUP_KEYS: readonly ["game_lines", "spreads", "totals", "period_lines", "exact_score", "team_props", "player_props", "specials", "completion", "other"];
@@ -148,6 +156,12 @@ export type SportsTeams = {
148
156
  };
149
157
  export declare const resolveSportsTeams: (event: Pick<VenueEventWithMarkets, "title">, moneylineMarket?: VenueMarket | null) => SportsTeams | null;
150
158
  export declare const resolveSportsLeagueLabel: (event: Pick<VenueEventWithMarkets, "categories" | "aggKey">) => string | null;
159
+ /**
160
+ * Human label for an open-grammar period token (`set_2` → "Set 2",
161
+ * `inning_4` → "Inning 4", `first_5_innings` → "First 5 Innings").
162
+ * Returns null for anything outside the documented grammar.
163
+ */
164
+ export declare const formatSportsPeriodGrammarLabel: (period: string) => string | null;
151
165
  export declare const isNonStandardSportsLikeEvent: (event: Pick<VenueEventWithMarkets, "categories" | "title" | "venueMarkets">) => boolean;
152
166
  export declare const resolveVisibleSportsSectionTabDefinitions: (event: Pick<VenueEventWithMarkets, "categories" | "title" | "venueMarkets">) => SportsSectionTabDefinition[];
153
167
  export declare const mergeSportsSectionMarketsIntoEvent: ({ event, sectionMarketsByKey, }: {
@@ -4,7 +4,15 @@ export type SportsSectionTabKey = (typeof SPORTS_SECTION_TAB_KEYS)[number];
4
4
  export declare const SPORTS_MARKET_TYPE_KEYS: readonly ["moneyline", "spread", "total", "prop", "completion", "other"];
5
5
  export type SportsMarketTypeKey = (typeof SPORTS_MARKET_TYPE_KEYS)[number];
6
6
  export declare const SPORTS_PERIOD_KEYS: readonly ["full", "1h", "2h", "q1", "q2", "q3", "q4", "ot", "first_inning", "second_inning", "third_inning", "first_5_innings", "other"];
7
- export type SportsPeriodKey = (typeof SPORTS_PERIOD_KEYS)[number];
7
+ /**
8
+ * Known named periods plus the documented open grammar (`set_N`, `map_N`,
9
+ * `game_N`, `period_N`, `inning_N`, `first_N_innings` — see the sports
10
+ * recipe's period vocabulary). Grammar tokens pass through verbatim so
11
+ * tennis sets / esports maps / hockey periods group under their own named
12
+ * period instead of collapsing into "other" (prod 2026-07: set_1 ×1,741,
13
+ * inning_1 ×144 were all landing in the Other bucket).
14
+ */
15
+ export type SportsPeriodKey = (typeof SPORTS_PERIOD_KEYS)[number] | (string & {});
8
16
  export declare const SPORTS_MARKET_CATEGORY_KEYS: readonly ["game_lines", "exact_score", "corners", "goals", "assists", "shots", "other"];
9
17
  export type SportsMarketCategoryKey = (typeof SPORTS_MARKET_CATEGORY_KEYS)[number];
10
18
  export declare const SPORTS_MARKET_GROUP_KEYS: readonly ["game_lines", "spreads", "totals", "period_lines", "exact_score", "team_props", "player_props", "specials", "completion", "other"];
@@ -148,6 +156,12 @@ export type SportsTeams = {
148
156
  };
149
157
  export declare const resolveSportsTeams: (event: Pick<VenueEventWithMarkets, "title">, moneylineMarket?: VenueMarket | null) => SportsTeams | null;
150
158
  export declare const resolveSportsLeagueLabel: (event: Pick<VenueEventWithMarkets, "categories" | "aggKey">) => string | null;
159
+ /**
160
+ * Human label for an open-grammar period token (`set_2` → "Set 2",
161
+ * `inning_4` → "Inning 4", `first_5_innings` → "First 5 Innings").
162
+ * Returns null for anything outside the documented grammar.
163
+ */
164
+ export declare const formatSportsPeriodGrammarLabel: (period: string) => string | null;
151
165
  export declare const isNonStandardSportsLikeEvent: (event: Pick<VenueEventWithMarkets, "categories" | "title" | "venueMarkets">) => boolean;
152
166
  export declare const resolveVisibleSportsSectionTabDefinitions: (event: Pick<VenueEventWithMarkets, "categories" | "title" | "venueMarkets">) => SportsSectionTabDefinition[];
153
167
  export declare const mergeSportsSectionMarketsIntoEvent: ({ event, sectionMarketsByKey, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/ui",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
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",