rategame-shared 1.1.478 → 1.1.480

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.
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { miniLeagueSchema, miniLeagueMemberSchema, miniLeagueInvitationSchema, createMiniLeagueDtoSchema, updateMiniLeagueDtoSchema, createMiniLeagueInvitationDtoSchema, miniLeagueInviteLinkSchema, miniLeagueInviteLinkResponseDtoSchema, miniLeagueInviteLinkPreviewDtoSchema, miniLeagueInviteLinkClaimResponseDtoSchema, miniLeagueJoinResponseDtoSchema, miniLeagueInvitationActionResponseDtoSchema, miniLeagueListResponseDtoSchema, miniLeagueMembersResponseDtoSchema, miniLeagueInvitationsResponseDtoSchema, miniLeagueLeaderboardResponseDtoSchema, miniLeagueUpcomingGamesResponseDtoSchema, miniLeagueRecapResponseDtoSchema, miniLeagueVisibilitySchema, miniLeagueStatusSchema, miniLeagueMemberRoleSchema, miniLeagueInvitationStatusSchema } from "../schemas/miniLeague";
2
+ import { miniLeagueSchema, miniLeagueMemberSchema, miniLeagueInvitationSchema, createMiniLeagueDtoSchema, updateMiniLeagueDtoSchema, createMiniLeagueInvitationDtoSchema, miniLeagueInviteLinkSchema, miniLeagueInviteLinkResponseDtoSchema, miniLeagueInviteLinkPreviewDtoSchema, miniLeagueInviteLinkClaimResponseDtoSchema, miniLeagueJoinResponseDtoSchema, miniLeagueInvitationActionResponseDtoSchema, miniLeagueListResponseDtoSchema, miniLeagueMembersResponseDtoSchema, miniLeagueInvitationsResponseDtoSchema, miniLeagueLeaderboardResponseDtoSchema, miniLeagueUpcomingGamesResponseDtoSchema, miniLeagueRecapResponseDtoSchema, miniLeagueRecapLeagueBreakdownSchema, miniLeagueVisibilitySchema, miniLeagueStatusSchema, miniLeagueMemberRoleSchema, miniLeagueInvitationStatusSchema } from "../schemas/miniLeague";
3
3
  export type MiniLeague = z.infer<typeof miniLeagueSchema>;
4
4
  export type MiniLeagueMember = z.infer<typeof miniLeagueMemberSchema>;
5
5
  export type MiniLeagueInvitation = z.infer<typeof miniLeagueInvitationSchema>;
@@ -18,6 +18,7 @@ export type MiniLeagueInvitationsResponseDto = z.infer<typeof miniLeagueInvitati
18
18
  export type MiniLeagueLeaderboardResponseDto = z.infer<typeof miniLeagueLeaderboardResponseDtoSchema>;
19
19
  export type MiniLeagueUpcomingGamesResponseDto = z.infer<typeof miniLeagueUpcomingGamesResponseDtoSchema>;
20
20
  export type MiniLeagueRecapResponseDto = z.infer<typeof miniLeagueRecapResponseDtoSchema>;
21
+ export type MiniLeagueRecapLeagueBreakdown = z.infer<typeof miniLeagueRecapLeagueBreakdownSchema>;
21
22
  export type MiniLeagueVisibility = z.infer<typeof miniLeagueVisibilitySchema>;
22
23
  export type MiniLeagueStatus = z.infer<typeof miniLeagueStatusSchema>;
23
24
  export type MiniLeagueMemberRole = z.infer<typeof miniLeagueMemberRoleSchema>;
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  /** Max sports/platform leagues selectable when creating a mini league. */
3
3
  export declare const MINI_LEAGUE_MAX_PLATFORM_LEAGUES = 2;
4
- /** Max mini leagues a user can belong to (owned + joined). */
4
+ /** Max active (ongoing) mini leagues a user can belong to (owned + joined). */
5
5
  export declare const MINI_LEAGUE_MAX_MEMBERSHIPS_PER_USER = 5;
6
6
  export declare const miniLeagueVisibilitySchema: z.ZodUnion<[z.ZodLiteral<"public">, z.ZodLiteral<"private">]>;
7
7
  export declare const miniLeagueStatusSchema: z.ZodUnion<[z.ZodLiteral<"active">, z.ZodLiteral<"ended">]>;
@@ -901,7 +901,7 @@ export declare const miniLeagueSchema: z.ZodObject<{
901
901
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
902
902
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
903
903
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
904
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
904
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
905
905
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
906
906
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
907
907
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -2240,7 +2240,7 @@ export declare const miniLeagueMemberSchema: z.ZodObject<{
2240
2240
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
2241
2241
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
2242
2242
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
2243
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
2243
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
2244
2244
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
2245
2245
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
2246
2246
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -3533,7 +3533,7 @@ export declare const miniLeagueInvitationSchema: z.ZodObject<{
3533
3533
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
3534
3534
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
3535
3535
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
3536
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
3536
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
3537
3537
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
3538
3538
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
3539
3539
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -4789,7 +4789,7 @@ export declare const miniLeagueInvitationSchema: z.ZodObject<{
4789
4789
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
4790
4790
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
4791
4791
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
4792
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
4792
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
4793
4793
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
4794
4794
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
4795
4795
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -5331,6 +5331,9 @@ export declare const miniLeagueInviteLinkPreviewDtoSchema: z.ZodObject<{
5331
5331
  memberCount: z.ZodNumber;
5332
5332
  platformLeagues: z.ZodArray<z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, "many">;
5333
5333
  status: z.ZodUnion<[z.ZodLiteral<"active">, z.ZodLiteral<"ended">]>;
5334
+ visibility: z.ZodUnion<[z.ZodLiteral<"public">, z.ZodLiteral<"private">]>;
5335
+ endAt: z.ZodNumber;
5336
+ endsWithSeason: z.ZodOptional<z.ZodBoolean>;
5334
5337
  inviter: z.ZodOptional<z.ZodObject<Pick<{
5335
5338
  id: z.ZodString;
5336
5339
  email: z.ZodString;
@@ -6220,7 +6223,7 @@ export declare const miniLeagueInviteLinkPreviewDtoSchema: z.ZodObject<{
6220
6223
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
6221
6224
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
6222
6225
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
6223
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
6226
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
6224
6227
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
6225
6228
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
6226
6229
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -6588,10 +6591,13 @@ export declare const miniLeagueInviteLinkPreviewDtoSchema: z.ZodObject<{
6588
6591
  }>>;
6589
6592
  }, "strip", z.ZodTypeAny, {
6590
6593
  name: string;
6594
+ visibility: "private" | "public";
6591
6595
  status: "active" | "ended";
6592
6596
  leagueId: string;
6593
6597
  platformLeagues: string[];
6598
+ endAt: number;
6594
6599
  memberCount: number;
6600
+ endsWithSeason?: boolean | undefined;
6595
6601
  inviter?: {
6596
6602
  id: string;
6597
6603
  email: string;
@@ -6601,10 +6607,13 @@ export declare const miniLeagueInviteLinkPreviewDtoSchema: z.ZodObject<{
6601
6607
  } | undefined;
6602
6608
  }, {
6603
6609
  name: string;
6610
+ visibility: "private" | "public";
6604
6611
  status: "active" | "ended";
6605
6612
  leagueId: string;
6606
6613
  platformLeagues: string[];
6614
+ endAt: number;
6607
6615
  memberCount: number;
6616
+ endsWithSeason?: boolean | undefined;
6608
6617
  inviter?: {
6609
6618
  id: string;
6610
6619
  email: string;
@@ -7544,7 +7553,7 @@ export declare const miniLeagueListResponseDtoSchema: z.ZodObject<{
7544
7553
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
7545
7554
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
7546
7555
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
7547
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
7556
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
7548
7557
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
7549
7558
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
7550
7559
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -8947,7 +8956,7 @@ export declare const miniLeagueMembersResponseDtoSchema: z.ZodObject<{
8947
8956
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
8948
8957
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
8949
8958
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
8950
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
8959
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
8951
8960
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
8952
8961
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
8953
8962
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -10272,7 +10281,7 @@ export declare const miniLeagueInvitationsResponseDtoSchema: z.ZodObject<{
10272
10281
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
10273
10282
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
10274
10283
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
10275
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
10284
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
10276
10285
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
10277
10286
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
10278
10287
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -11528,7 +11537,7 @@ export declare const miniLeagueInvitationsResponseDtoSchema: z.ZodObject<{
11528
11537
  lastSelectedFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"16hr">, z.ZodLiteral<"Today">, z.ZodLiteral<"Last 3 Days">, z.ZodLiteral<"This Week">, z.ZodLiteral<"This Season">, z.ZodLiteral<"This Month">, z.ZodLiteral<"This Year">, z.ZodLiteral<"2025">, z.ZodLiteral<"2024">, z.ZodLiteral<"All">, z.ZodLiteral<"All Time">, z.ZodLiteral<"12h">, z.ZodLiteral<"daily">, z.ZodLiteral<"weekly">]>>;
11529
11538
  lastSelectedRatingFilter: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"rating:asc">, z.ZodLiteral<"rating:desc">, z.ZodLiteral<"createdAt:asc">, z.ZodLiteral<"createdAt:desc">, z.ZodLiteral<"userLikes:asc">, z.ZodLiteral<"userLikes:desc">, z.ZodLiteral<"game.startedAt:desc">]>>;
11530
11539
  lastSelectedGamesFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"forYou">]>>;
11531
- lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>; /** Resolve platform leagues for a mini league doc (legacy-safe). */
11540
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
11532
11541
  creatorLeague: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"nba">, z.ZodLiteral<"ncaa">, z.ZodLiteral<"nfl">, z.ZodLiteral<"nhl">, z.ZodLiteral<"mlb">, z.ZodLiteral<"cbb">, z.ZodLiteral<"cfb">, z.ZodLiteral<"epl">, z.ZodLiteral<"mls">, z.ZodLiteral<"wnba">, z.ZodLiteral<"cwc">, z.ZodLiteral<"fifa">, z.ZodLiteral<"laliga">, z.ZodLiteral<"seriea">, z.ZodLiteral<"bundesliga">, z.ZodLiteral<"ligue1">, z.ZodLiteral<"ucl">, z.ZodUnion<[z.ZodLiteral<"global">, z.ZodString]>]>, z.ZodString]>>;
11533
11542
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
11534
11543
  multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
@@ -12213,6 +12222,23 @@ export declare const miniLeagueRecapAchievementSchema: z.ZodObject<{
12213
12222
  title: string;
12214
12223
  icon: string;
12215
12224
  }>;
12225
+ export declare const miniLeagueRecapLeagueBreakdownSchema: z.ZodObject<{
12226
+ /** Platform league slug, e.g. "nfl". */
12227
+ league: z.ZodString;
12228
+ correct: z.ZodNumber;
12229
+ total: z.ZodNumber;
12230
+ pct: z.ZodNumber;
12231
+ }, "strip", z.ZodTypeAny, {
12232
+ total: number;
12233
+ league: string;
12234
+ correct: number;
12235
+ pct: number;
12236
+ }, {
12237
+ total: number;
12238
+ league: string;
12239
+ correct: number;
12240
+ pct: number;
12241
+ }>;
12216
12242
  /** Personal season recap for a mini-league member (Your Stats / 3c). */
12217
12243
  export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12218
12244
  leagueId: z.ZodString;
@@ -12237,6 +12263,27 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12237
12263
  correct: number;
12238
12264
  }>>;
12239
12265
  longestStreak: z.ZodNumber;
12266
+ /**
12267
+ * Per platform-league breakdown of the member's picks.
12268
+ * One entry per league the mini league tracks (in league order).
12269
+ */
12270
+ byLeague: z.ZodOptional<z.ZodArray<z.ZodObject<{
12271
+ /** Platform league slug, e.g. "nfl". */
12272
+ league: z.ZodString;
12273
+ correct: z.ZodNumber;
12274
+ total: z.ZodNumber;
12275
+ pct: z.ZodNumber;
12276
+ }, "strip", z.ZodTypeAny, {
12277
+ total: number;
12278
+ league: string;
12279
+ correct: number;
12280
+ pct: number;
12281
+ }, {
12282
+ total: number;
12283
+ league: string;
12284
+ correct: number;
12285
+ pct: number;
12286
+ }>, "many">>;
12240
12287
  /** Day buckets — empty when the span is too short (<2 days) or too long (>14). */
12241
12288
  daily: z.ZodArray<z.ZodObject<{
12242
12289
  /** 1-based index within the league window for this granularity. */
@@ -12380,6 +12427,12 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12380
12427
  weekIndex: number;
12381
12428
  monthIndex: number;
12382
12429
  }[];
12430
+ byLeague?: {
12431
+ total: number;
12432
+ league: string;
12433
+ correct: number;
12434
+ pct: number;
12435
+ }[] | undefined;
12383
12436
  isTied?: boolean | undefined;
12384
12437
  }, {
12385
12438
  total: number;
@@ -12427,6 +12480,12 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12427
12480
  weekIndex: number;
12428
12481
  monthIndex: number;
12429
12482
  }[];
12483
+ byLeague?: {
12484
+ total: number;
12485
+ league: string;
12486
+ correct: number;
12487
+ pct: number;
12488
+ }[] | undefined;
12430
12489
  isTied?: boolean | undefined;
12431
12490
  }>;
12432
12491
  /** Resolve platform leagues for a mini league doc (legacy-safe). */
@@ -12434,3 +12493,8 @@ export declare const getMiniLeaguePlatformLeagues: (league: {
12434
12493
  platformLeague?: string;
12435
12494
  platformLeagues?: string[] | null;
12436
12495
  }) => string[];
12496
+ /** True while the challenge is still running (status + calendar end). */
12497
+ export declare const isMiniLeagueOngoing: (league: {
12498
+ status?: string | null;
12499
+ endAt?: number | null;
12500
+ }, now?: number) => boolean;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMiniLeaguePlatformLeagues = exports.miniLeagueRecapResponseDtoSchema = exports.miniLeagueRecapAchievementSchema = exports.miniLeagueRecapDefiningPickSchema = exports.miniLeagueRecapChartPeriodSchema = exports.miniLeagueRecapPeriodBucketSchema = exports.miniLeagueRecapWeeklySchema = exports.miniLeagueUpcomingGamesResponseDtoSchema = exports.miniLeagueLeaderboardResponseDtoSchema = exports.miniLeagueInvitationsResponseDtoSchema = exports.miniLeagueMembersResponseDtoSchema = exports.miniLeagueListResponseDtoSchema = exports.miniLeagueInvitationActionResponseDtoSchema = exports.miniLeagueJoinResponseDtoSchema = exports.miniLeagueInviteLinkClaimResponseDtoSchema = exports.miniLeagueInviteLinkPreviewDtoSchema = exports.miniLeagueInviteLinkResponseDtoSchema = exports.miniLeagueInviteLinkSchema = exports.createMiniLeagueInvitationDtoSchema = exports.updateMiniLeagueDtoSchema = exports.createMiniLeagueDtoSchema = exports.miniLeagueInvitationSchema = exports.miniLeagueMemberSchema = exports.miniLeagueSchema = exports.miniLeagueInvitationStatusSchema = exports.miniLeagueMemberRoleSchema = exports.miniLeagueStatusSchema = exports.miniLeagueVisibilitySchema = exports.MINI_LEAGUE_MAX_MEMBERSHIPS_PER_USER = exports.MINI_LEAGUE_MAX_PLATFORM_LEAGUES = void 0;
3
+ exports.isMiniLeagueOngoing = exports.getMiniLeaguePlatformLeagues = exports.miniLeagueRecapResponseDtoSchema = exports.miniLeagueRecapLeagueBreakdownSchema = exports.miniLeagueRecapAchievementSchema = exports.miniLeagueRecapDefiningPickSchema = exports.miniLeagueRecapChartPeriodSchema = exports.miniLeagueRecapPeriodBucketSchema = exports.miniLeagueRecapWeeklySchema = exports.miniLeagueUpcomingGamesResponseDtoSchema = exports.miniLeagueLeaderboardResponseDtoSchema = exports.miniLeagueInvitationsResponseDtoSchema = exports.miniLeagueMembersResponseDtoSchema = exports.miniLeagueListResponseDtoSchema = exports.miniLeagueInvitationActionResponseDtoSchema = exports.miniLeagueJoinResponseDtoSchema = exports.miniLeagueInviteLinkClaimResponseDtoSchema = exports.miniLeagueInviteLinkPreviewDtoSchema = exports.miniLeagueInviteLinkResponseDtoSchema = exports.miniLeagueInviteLinkSchema = exports.createMiniLeagueInvitationDtoSchema = exports.updateMiniLeagueDtoSchema = exports.createMiniLeagueDtoSchema = exports.miniLeagueInvitationSchema = exports.miniLeagueMemberSchema = exports.miniLeagueSchema = exports.miniLeagueInvitationStatusSchema = exports.miniLeagueMemberRoleSchema = exports.miniLeagueStatusSchema = exports.miniLeagueVisibilitySchema = exports.MINI_LEAGUE_MAX_MEMBERSHIPS_PER_USER = exports.MINI_LEAGUE_MAX_PLATFORM_LEAGUES = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const pick_1 = require("./pick");
6
6
  const sharedTypes_1 = require("./sharedTypes");
7
7
  const user_1 = require("./user");
8
8
  /** Max sports/platform leagues selectable when creating a mini league. */
9
9
  exports.MINI_LEAGUE_MAX_PLATFORM_LEAGUES = 2;
10
- /** Max mini leagues a user can belong to (owned + joined). */
10
+ /** Max active (ongoing) mini leagues a user can belong to (owned + joined). */
11
11
  exports.MINI_LEAGUE_MAX_MEMBERSHIPS_PER_USER = 5;
12
12
  exports.miniLeagueVisibilitySchema = zod_1.z.union([
13
13
  zod_1.z.literal("public"),
@@ -158,6 +158,9 @@ exports.miniLeagueInviteLinkPreviewDtoSchema = zod_1.z.object({
158
158
  memberCount: zod_1.z.number().int().nonnegative(),
159
159
  platformLeagues: zod_1.z.array(sharedTypes_1.leagueSlug),
160
160
  status: exports.miniLeagueStatusSchema,
161
+ visibility: exports.miniLeagueVisibilitySchema,
162
+ endAt: zod_1.z.number(),
163
+ endsWithSeason: zod_1.z.boolean().optional(),
161
164
  inviter: user_1.reducedUserSchema.optional(),
162
165
  });
163
166
  exports.miniLeagueInviteLinkClaimResponseDtoSchema = zod_1.z.object({
@@ -228,6 +231,13 @@ exports.miniLeagueRecapAchievementSchema = zod_1.z.object({
228
231
  detail: zod_1.z.string(),
229
232
  icon: zod_1.z.string(),
230
233
  });
234
+ exports.miniLeagueRecapLeagueBreakdownSchema = zod_1.z.object({
235
+ /** Platform league slug, e.g. "nfl". */
236
+ league: zod_1.z.string(),
237
+ correct: zod_1.z.number().int().nonnegative(),
238
+ total: zod_1.z.number().int().nonnegative(),
239
+ pct: zod_1.z.number().nonnegative(),
240
+ });
231
241
  /** Personal season recap for a mini-league member (Your Stats / 3c). */
232
242
  exports.miniLeagueRecapResponseDtoSchema = zod_1.z.object({
233
243
  leagueId: zod_1.z.string(),
@@ -246,6 +256,11 @@ exports.miniLeagueRecapResponseDtoSchema = zod_1.z.object({
246
256
  })
247
257
  .nullable(),
248
258
  longestStreak: zod_1.z.number().int().nonnegative(),
259
+ /**
260
+ * Per platform-league breakdown of the member's picks.
261
+ * One entry per league the mini league tracks (in league order).
262
+ */
263
+ byLeague: zod_1.z.array(exports.miniLeagueRecapLeagueBreakdownSchema).optional(),
249
264
  /** Day buckets — empty when the span is too short (<2 days) or too long (>14). */
250
265
  daily: zod_1.z.array(exports.miniLeagueRecapPeriodBucketSchema),
251
266
  /**
@@ -268,3 +283,12 @@ const getMiniLeaguePlatformLeagues = (league) => {
268
283
  return league.platformLeague ? [league.platformLeague] : [];
269
284
  };
270
285
  exports.getMiniLeaguePlatformLeagues = getMiniLeaguePlatformLeagues;
286
+ /** True while the challenge is still running (status + calendar end). */
287
+ const isMiniLeagueOngoing = (league, now = Date.now()) => {
288
+ if (league.status === "ended")
289
+ return false;
290
+ if (typeof league.endAt === "number" && league.endAt < now)
291
+ return false;
292
+ return true;
293
+ };
294
+ exports.isMiniLeagueOngoing = isMiniLeagueOngoing;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rategame-shared",
3
- "version": "1.1.478",
3
+ "version": "1.1.480",
4
4
  "description": "This package contains shared resources for the Rate Game project.",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1,5 +0,0 @@
1
- export declare const FANCY_TEXT_ERROR_MESSAGE = "Fancy or styled characters are not allowed. Please use normal letters and numbers.";
2
- /**
3
- * Detects mathematical-alphanumeric, fullwidth, and similar disguised characters.
4
- */
5
- export declare function containsFancyText(value: string | null | undefined): boolean;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.containsFancyText = exports.FANCY_TEXT_ERROR_MESSAGE = void 0;
4
- exports.FANCY_TEXT_ERROR_MESSAGE = 'Fancy or styled characters are not allowed. Please use normal letters and numbers.';
5
- /** Unicode ranges used for disguised / styled text (not normal user input). */
6
- const FANCY_CODE_POINT_RANGES = [
7
- [0x1d400, 0x1d7ff],
8
- [0x1d800, 0x1daff],
9
- [0x1f100, 0x1f1ff],
10
- [0x2100, 0x214f],
11
- [0x2460, 0x24ff],
12
- [0xff01, 0xff5e], // Fullwidth ASCII variants
13
- ];
14
- const isFancyCodePoint = (code) => FANCY_CODE_POINT_RANGES.some(([start, end]) => code >= start && code <= end);
15
- /**
16
- * Detects mathematical-alphanumeric, fullwidth, and similar disguised characters.
17
- */
18
- function containsFancyText(value) {
19
- if (!value)
20
- return false;
21
- for (const char of value) {
22
- const code = char.codePointAt(0);
23
- if (code !== undefined && isFancyCodePoint(code)) {
24
- return true;
25
- }
26
- }
27
- return false;
28
- }
29
- exports.containsFancyText = containsFancyText;
@@ -1,26 +0,0 @@
1
- export declare const DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER: readonly ["nba", "mlb", "wbc", "nfl", "nhl", "iho", "epl", "fifa", "cbb", "cfb", "mls", "wnba", "cwc"];
2
- export type FavoriteTeamLookup = {
3
- id?: string | number;
4
- name?: string;
5
- image?: string;
6
- primaryColor?: string | null;
7
- countryId?: string | number;
8
- };
9
- export type FavoriteTeamChip = {
10
- key: string;
11
- league: string;
12
- teamImage: string;
13
- teamId: string;
14
- teamName: string;
15
- primaryColor: string | null;
16
- countryId?: string;
17
- };
18
- export declare function getFavoriteTeamChipKey({ league, teamId, countryId, }: {
19
- league: string;
20
- teamId: string;
21
- countryId?: string;
22
- }): string;
23
- export declare function buildFavoriteTeamChips(favoriteTeamsPerLeague: Record<string, string> | undefined, allTeams: Record<string, FavoriteTeamLookup[] | undefined> | undefined): FavoriteTeamChip[];
24
- export declare function sortFavoriteTeamChips(chips: FavoriteTeamChip[], favoriteTeamsOrder?: string[]): FavoriteTeamChip[];
25
- export declare function buildFavoriteTeamsOrderFromChips(chips: FavoriteTeamChip[]): string[];
26
- export declare function syncFavoriteTeamsOrder(favoriteTeamsOrder: string[] | undefined, chips: FavoriteTeamChip[]): string[];
@@ -1,91 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syncFavoriteTeamsOrder = exports.buildFavoriteTeamsOrderFromChips = exports.sortFavoriteTeamChips = exports.buildFavoriteTeamChips = exports.getFavoriteTeamChipKey = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER = void 0;
4
- exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER = [
5
- "nba",
6
- "mlb",
7
- "wbc",
8
- "nfl",
9
- "nhl",
10
- "iho",
11
- "epl",
12
- "fifa",
13
- "cbb",
14
- "cfb",
15
- "mls",
16
- "wnba",
17
- "cwc",
18
- ];
19
- function getFavoriteTeamChipKey({ league, teamId, countryId, }) {
20
- return countryId ? `country-${countryId}` : `${league}-${teamId}`;
21
- }
22
- exports.getFavoriteTeamChipKey = getFavoriteTeamChipKey;
23
- function buildFavoriteTeamChips(favoriteTeamsPerLeague, allTeams) {
24
- if (!favoriteTeamsPerLeague)
25
- return [];
26
- const chipsByKey = new Map();
27
- Object.entries(favoriteTeamsPerLeague).forEach(([league, teamId]) => {
28
- var _a, _b, _c;
29
- const leagueKey = league === "ncaa" ? "cbb" : league;
30
- const favoriteTeam = (_a = allTeams === null || allTeams === void 0 ? void 0 : allTeams[leagueKey]) === null || _a === void 0 ? void 0 : _a.find(item => { var _a; return ((_a = item === null || item === void 0 ? void 0 : item.id) === null || _a === void 0 ? void 0 : _a.toString()) === teamId; });
31
- if (!(favoriteTeam === null || favoriteTeam === void 0 ? void 0 : favoriteTeam.image))
32
- return;
33
- const countryId = favoriteTeam.countryId
34
- ? String(favoriteTeam.countryId)
35
- : undefined;
36
- const key = getFavoriteTeamChipKey({
37
- league: leagueKey,
38
- teamId,
39
- countryId,
40
- });
41
- if (chipsByKey.has(key))
42
- return;
43
- chipsByKey.set(key, {
44
- key,
45
- league: leagueKey,
46
- teamImage: favoriteTeam.image,
47
- teamId,
48
- teamName: (_b = favoriteTeam.name) !== null && _b !== void 0 ? _b : "",
49
- primaryColor: (_c = favoriteTeam.primaryColor) !== null && _c !== void 0 ? _c : null,
50
- countryId,
51
- });
52
- });
53
- return Array.from(chipsByKey.values());
54
- }
55
- exports.buildFavoriteTeamChips = buildFavoriteTeamChips;
56
- function sortFavoriteTeamChips(chips, favoriteTeamsOrder) {
57
- if (!chips.length)
58
- return chips;
59
- const orderIndex = new Map((favoriteTeamsOrder !== null && favoriteTeamsOrder !== void 0 ? favoriteTeamsOrder : []).map((key, index) => [key, index]));
60
- return [...chips].sort((a, b) => {
61
- const aOrder = orderIndex.get(a.key);
62
- const bOrder = orderIndex.get(b.key);
63
- if (aOrder !== undefined && bOrder !== undefined) {
64
- return aOrder - bOrder;
65
- }
66
- if (aOrder !== undefined)
67
- return -1;
68
- if (bOrder !== undefined)
69
- return 1;
70
- const aIndex = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.indexOf(a.league);
71
- const bIndex = exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.indexOf(b.league);
72
- return ((aIndex === -1 ? exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.length : aIndex) -
73
- (bIndex === -1 ? exports.DEFAULT_FAVORITE_TEAM_LEAGUE_ORDER.length : bIndex));
74
- });
75
- }
76
- exports.sortFavoriteTeamChips = sortFavoriteTeamChips;
77
- function buildFavoriteTeamsOrderFromChips(chips) {
78
- return sortFavoriteTeamChips(chips).map(chip => chip.key);
79
- }
80
- exports.buildFavoriteTeamsOrderFromChips = buildFavoriteTeamsOrderFromChips;
81
- function syncFavoriteTeamsOrder(favoriteTeamsOrder, chips) {
82
- const chipKeys = new Set(chips.map(chip => chip.key));
83
- const syncedOrder = (favoriteTeamsOrder !== null && favoriteTeamsOrder !== void 0 ? favoriteTeamsOrder : []).filter(key => chipKeys.has(key));
84
- chips.forEach(chip => {
85
- if (!syncedOrder.includes(chip.key)) {
86
- syncedOrder.push(chip.key);
87
- }
88
- });
89
- return syncedOrder;
90
- }
91
- exports.syncFavoriteTeamsOrder = syncFavoriteTeamsOrder;