rategame-shared 1.1.478 → 1.1.479

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,10 +901,10 @@ 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
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
907
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
908
908
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
909
909
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
910
910
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -2240,10 +2240,10 @@ 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
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
2246
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
2247
2247
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
2248
2248
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
2249
2249
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -3533,10 +3533,10 @@ 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
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
3539
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
3540
3540
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
3541
3541
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
3542
3542
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -4789,10 +4789,10 @@ 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
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
4795
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
4796
4796
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
4797
4797
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
4798
4798
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -6220,10 +6220,10 @@ export declare const miniLeagueInviteLinkPreviewDtoSchema: z.ZodObject<{
6220
6220
  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
6221
  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
6222
  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). */
6223
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
6224
6224
  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
6225
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
6226
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
6226
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
6227
6227
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
6228
6228
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
6229
6229
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -7544,10 +7544,10 @@ export declare const miniLeagueListResponseDtoSchema: z.ZodObject<{
7544
7544
  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
7545
  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
7546
  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). */
7547
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
7548
7548
  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
7549
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
7550
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
7550
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
7551
7551
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
7552
7552
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
7553
7553
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -8947,10 +8947,10 @@ export declare const miniLeagueMembersResponseDtoSchema: z.ZodObject<{
8947
8947
  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
8948
  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
8949
  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). */
8950
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
8951
8951
  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
8952
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
8953
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
8953
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
8954
8954
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
8955
8955
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
8956
8956
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -10272,10 +10272,10 @@ export declare const miniLeagueInvitationsResponseDtoSchema: z.ZodObject<{
10272
10272
  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
10273
  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
10274
  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). */
10275
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
10276
10276
  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
10277
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
10278
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
10278
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
10279
10279
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
10280
10280
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
10281
10281
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -11528,10 +11528,10 @@ export declare const miniLeagueInvitationsResponseDtoSchema: z.ZodObject<{
11528
11528
  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
11529
  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
11530
  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). */
11531
+ lastSelectedCombinedFeedType: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"newest">, z.ZodLiteral<"following">]>>;
11532
11532
  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
11533
  role: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"Admin">, z.ZodLiteral<"Creator">, z.ZodLiteral<"Moderator">]>>;
11534
- multiLeagueCreator: z.ZodOptional<z.ZodBoolean>;
11534
+ multiLeagueCreator: z.ZodOptional<z.ZodBoolean>; /** Preferred chart filter given the league span. */
11535
11535
  preferTraditionalTeamLayout: z.ZodOptional<z.ZodBoolean>;
11536
11536
  wasPromptedForReview: z.ZodOptional<z.ZodBoolean>;
11537
11537
  hideAddFavoritePrompt: z.ZodOptional<z.ZodBoolean>;
@@ -12213,6 +12213,23 @@ export declare const miniLeagueRecapAchievementSchema: z.ZodObject<{
12213
12213
  title: string;
12214
12214
  icon: string;
12215
12215
  }>;
12216
+ export declare const miniLeagueRecapLeagueBreakdownSchema: z.ZodObject<{
12217
+ /** Platform league slug, e.g. "nfl". */
12218
+ league: z.ZodString;
12219
+ correct: z.ZodNumber;
12220
+ total: z.ZodNumber;
12221
+ pct: z.ZodNumber;
12222
+ }, "strip", z.ZodTypeAny, {
12223
+ total: number;
12224
+ league: string;
12225
+ correct: number;
12226
+ pct: number;
12227
+ }, {
12228
+ total: number;
12229
+ league: string;
12230
+ correct: number;
12231
+ pct: number;
12232
+ }>;
12216
12233
  /** Personal season recap for a mini-league member (Your Stats / 3c). */
12217
12234
  export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12218
12235
  leagueId: z.ZodString;
@@ -12237,6 +12254,27 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12237
12254
  correct: number;
12238
12255
  }>>;
12239
12256
  longestStreak: z.ZodNumber;
12257
+ /**
12258
+ * Per platform-league breakdown of the member's picks.
12259
+ * One entry per league the mini league tracks (in league order).
12260
+ */
12261
+ byLeague: z.ZodOptional<z.ZodArray<z.ZodObject<{
12262
+ /** Platform league slug, e.g. "nfl". */
12263
+ league: z.ZodString;
12264
+ correct: z.ZodNumber;
12265
+ total: z.ZodNumber;
12266
+ pct: z.ZodNumber;
12267
+ }, "strip", z.ZodTypeAny, {
12268
+ total: number;
12269
+ league: string;
12270
+ correct: number;
12271
+ pct: number;
12272
+ }, {
12273
+ total: number;
12274
+ league: string;
12275
+ correct: number;
12276
+ pct: number;
12277
+ }>, "many">>;
12240
12278
  /** Day buckets — empty when the span is too short (<2 days) or too long (>14). */
12241
12279
  daily: z.ZodArray<z.ZodObject<{
12242
12280
  /** 1-based index within the league window for this granularity. */
@@ -12380,6 +12418,12 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12380
12418
  weekIndex: number;
12381
12419
  monthIndex: number;
12382
12420
  }[];
12421
+ byLeague?: {
12422
+ total: number;
12423
+ league: string;
12424
+ correct: number;
12425
+ pct: number;
12426
+ }[] | undefined;
12383
12427
  isTied?: boolean | undefined;
12384
12428
  }, {
12385
12429
  total: number;
@@ -12427,6 +12471,12 @@ export declare const miniLeagueRecapResponseDtoSchema: z.ZodObject<{
12427
12471
  weekIndex: number;
12428
12472
  monthIndex: number;
12429
12473
  }[];
12474
+ byLeague?: {
12475
+ total: number;
12476
+ league: string;
12477
+ correct: number;
12478
+ pct: number;
12479
+ }[] | undefined;
12430
12480
  isTied?: boolean | undefined;
12431
12481
  }>;
12432
12482
  /** Resolve platform leagues for a mini league doc (legacy-safe). */
@@ -12434,3 +12484,8 @@ export declare const getMiniLeaguePlatformLeagues: (league: {
12434
12484
  platformLeague?: string;
12435
12485
  platformLeagues?: string[] | null;
12436
12486
  }) => string[];
12487
+ /** True while the challenge is still running (status + calendar end). */
12488
+ export declare const isMiniLeagueOngoing: (league: {
12489
+ status?: string | null;
12490
+ endAt?: number | null;
12491
+ }, 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"),
@@ -228,6 +228,13 @@ exports.miniLeagueRecapAchievementSchema = zod_1.z.object({
228
228
  detail: zod_1.z.string(),
229
229
  icon: zod_1.z.string(),
230
230
  });
231
+ exports.miniLeagueRecapLeagueBreakdownSchema = zod_1.z.object({
232
+ /** Platform league slug, e.g. "nfl". */
233
+ league: zod_1.z.string(),
234
+ correct: zod_1.z.number().int().nonnegative(),
235
+ total: zod_1.z.number().int().nonnegative(),
236
+ pct: zod_1.z.number().nonnegative(),
237
+ });
231
238
  /** Personal season recap for a mini-league member (Your Stats / 3c). */
232
239
  exports.miniLeagueRecapResponseDtoSchema = zod_1.z.object({
233
240
  leagueId: zod_1.z.string(),
@@ -246,6 +253,11 @@ exports.miniLeagueRecapResponseDtoSchema = zod_1.z.object({
246
253
  })
247
254
  .nullable(),
248
255
  longestStreak: zod_1.z.number().int().nonnegative(),
256
+ /**
257
+ * Per platform-league breakdown of the member's picks.
258
+ * One entry per league the mini league tracks (in league order).
259
+ */
260
+ byLeague: zod_1.z.array(exports.miniLeagueRecapLeagueBreakdownSchema).optional(),
249
261
  /** Day buckets — empty when the span is too short (<2 days) or too long (>14). */
250
262
  daily: zod_1.z.array(exports.miniLeagueRecapPeriodBucketSchema),
251
263
  /**
@@ -268,3 +280,12 @@ const getMiniLeaguePlatformLeagues = (league) => {
268
280
  return league.platformLeague ? [league.platformLeague] : [];
269
281
  };
270
282
  exports.getMiniLeaguePlatformLeagues = getMiniLeaguePlatformLeagues;
283
+ /** True while the challenge is still running (status + calendar end). */
284
+ const isMiniLeagueOngoing = (league, now = Date.now()) => {
285
+ if (league.status === "ended")
286
+ return false;
287
+ if (typeof league.endAt === "number" && league.endAt < now)
288
+ return false;
289
+ return true;
290
+ };
291
+ 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.479",
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;