@simple-parlay/components 1.30.6-pre → 1.30.6-pre.3

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.
@@ -21,7 +21,7 @@ export declare class BladeApiClient {
21
21
  invalidate(): void;
22
22
  private request;
23
23
  getGames(params?: {
24
- category?: 'sports' | 'casino' | 'racing';
24
+ category?: 'sports' | 'casino' | 'racing' | 'prediction';
25
25
  jurisdiction?: string;
26
26
  sport?: string;
27
27
  }): Promise<{
@@ -32,7 +32,7 @@ export declare class BladeApiClient {
32
32
  getPropositions(params?: {
33
33
  event_id?: string;
34
34
  sport?: string;
35
- category?: 'sports' | 'casino' | 'racing';
35
+ category?: 'sports' | 'casino' | 'racing' | 'prediction';
36
36
  }): Promise<Proposition[]>;
37
37
  getSports(): Promise<SportSummary[]>;
38
38
  getPropositionsByIds(ids: number[]): Promise<Proposition[]>;
@@ -1,5 +1,5 @@
1
1
  import { Game } from './types';
2
- export type GameIconId = 'perfect_pick' | 'head_to_head' | 'total_points' | 'quickpick' | 'safety_net' | 'ladder' | 'game_set' | 'pick_your_dividend' | 'mirror' | 'same_game_multi' | 'six_again' | 'unknown';
2
+ export type GameIconId = 'perfect_pick' | 'head_to_head' | 'total_points' | 'quickpick' | 'safety_net' | 'ladder' | 'game_set' | 'pick_your_dividend' | 'mirror' | 'mirror_double' | 'mirror_triple' | 'same_game_multi' | 'six_again' | 'unknown';
3
3
  export declare const GAME_ICON_SCHEME = "game-icon:";
4
4
  export declare const GAME_ICON_SVG: Record<GameIconId, string>;
5
5
  /** Resolve a bundled icon id for a game; unknown games use the question-mark fallback. */
@@ -1,7 +1,7 @@
1
1
  import { BladeApiClient } from './api-client';
2
2
  import { Game, Proposition, GameEntry, TopPayoutsResponse, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse } from './types';
3
3
  export declare function useGames(apiClient: BladeApiClient, params?: {
4
- category?: 'sports' | 'casino' | 'racing';
4
+ category?: 'sports' | 'casino' | 'racing' | 'prediction';
5
5
  jurisdiction?: string;
6
6
  sport?: string;
7
7
  }, options?: {
@@ -16,7 +16,7 @@ export declare function useGames(apiClient: BladeApiClient, params?: {
16
16
  export declare function usePropositions(apiClient: BladeApiClient, params?: {
17
17
  event_id?: string;
18
18
  sport?: string;
19
- category?: 'sports' | 'casino' | 'racing';
19
+ category?: 'sports' | 'casino' | 'racing' | 'prediction';
20
20
  }, options?: {
21
21
  skip?: boolean;
22
22
  }): {
@@ -34,7 +34,7 @@ export interface MirrorPrize {
34
34
  oddsOneIn: number;
35
35
  }
36
36
  export interface MirrorConfig {
37
- /** Selectable leg counts, smallest first (official range 4–12). */
37
+ variant: MirrorVariant;
38
38
  legOptions: number[];
39
39
  /** Leg count preselected on entry. */
40
40
  defaultLegs: number;
@@ -49,8 +49,16 @@ export interface MirrorConfig {
49
49
  operatorMargin: number;
50
50
  perLegProbability: number;
51
51
  }
52
- /** Whether a game is a Mirror (routes to the one-screen Straight Mirror builder). */
52
+ /**
53
+ * The server rule behind each mirror. They are separate games in the catalogue,
54
+ * not a switch inside one — each carries its own tier, pricing and settlement,
55
+ * so the rule on the game is what says which mirror the player opened.
56
+ */
57
+ export declare const MIRROR_RULES: Record<MirrorVariantId, string>;
58
+ /** Whether a game is any of the mirrors (all route to the one-screen builder). */
53
59
  export declare function isMirrorGame(game: Game | null | undefined): boolean;
60
+ /** Which mirror this game is. Unknown rules fall back to the straight one. */
61
+ export declare function resolveMirrorVariantId(game: Game | null | undefined): MirrorVariantId;
54
62
  /**
55
63
  * Price a Mirror ticket: what each winning side pays, exact to the cent.
56
64
  *
@@ -72,6 +80,8 @@ export interface MirrorVariant {
72
80
  minLegs: number;
73
81
  waysToWin: string;
74
82
  description: string;
83
+ /** One-line hook under the lockup on this mirror's setup page. */
84
+ tagline: string;
75
85
  tierNames: string[];
76
86
  }
77
87
  export declare const MIRROR_VARIANTS: MirrorVariant[];
@@ -96,4 +106,42 @@ export declare function mirrorCombinations(n: number, k: number): number;
96
106
  export declare function mirrorSuitePrize(variantId: MirrorVariantId, stake: number, legs: number, opts?: {
97
107
  operatorMargin?: number;
98
108
  }): MirrorSuitePrize;
109
+ /** Marks on a prize row: a call landed, a call missed. */
110
+ export declare const MIRROR_TICK = "\u2713";
111
+ export declare const MIRROR_CROSS = "\u2715";
112
+ /** One payable outcome: the two sweeps are two rows, not one "12 or 0" row. */
113
+ export interface MirrorPrizeRow {
114
+ /** Correct calls this row pays on — also how many ticks the row shows. */
115
+ correct: number;
116
+ label: string;
117
+ prize: number;
118
+ }
119
+ /**
120
+ * Flatten the tiers into one row per winning outcome. A tier reaching both
121
+ * edges pays twice, and quoting it as "12 or 0 of 12" reads as one way to win
122
+ * with strange wording — so each edge gets its own row and its own price.
123
+ */
124
+ export declare function mirrorPrizeRows(quote: MirrorSuitePrize): MirrorPrizeRow[];
125
+ /** A mirror in the catalogue, paired with the variant its rule names. */
126
+ export interface MirrorVariantGame {
127
+ variant: MirrorVariant;
128
+ game: Game;
129
+ }
130
+ /**
131
+ * The mirrors a player can switch between from `current`, straight first.
132
+ *
133
+ * The base mirror is the Straight Mirror and nothing else: on Signature it is
134
+ * one game with no depth to choose. The set of three lives on Premier, so only
135
+ * a Premier mirror offers the switch, and only to the mirrors sharing its tier.
136
+ * They are separate games, so the page can only offer what the catalogue
137
+ * carries — one mirror at that tier means no choice to make.
138
+ */
139
+ export declare function mirrorVariantGames(games: Game[], current: Game | null | undefined): MirrorVariantGame[];
140
+ /**
141
+ * The catalogue as the games menu should show it. A tier carrying a full
142
+ * mirror set lists one tile — the straight mirror, the set's front door —
143
+ * because its page is where the deeper two are chosen. A deeper mirror with no
144
+ * straight mirror beside it keeps its own tile, or there would be no way in.
145
+ */
146
+ export declare function collapseMirrorSet(games: Game[]): Game[];
99
147
  export declare function mirrorVariantLegOptions(config: MirrorConfig, variantId: MirrorVariantId): number[];
@@ -8,12 +8,6 @@ export declare function getCategoryTagline(category: string): string;
8
8
  export declare function getSportShortCode(sport: string, sportBaseKey?: string | null, override?: string): string;
9
9
  export declare function getSportPickerTagline(count: number, selectedCategory?: string | null): string;
10
10
  export declare function getSportSummaryTagline(gamesToday: number, activeProps: number): string;
11
- /**
12
- * The one-line caption on a sport rail card. A rail card is ~92px wide, so the
13
- * two-part `getSportSummaryTagline` never fits — lead with today's fixtures
14
- * when there are any, and fall back to the pick count when there aren't.
15
- */
16
- export declare function getSportRailCaption(gamesToday: number, activeProps: number): string;
17
11
  export declare function gameLogoTileFontSize(code: string): number;
18
12
  export interface ComingSoonSport {
19
13
  key: string;
@@ -3,6 +3,12 @@ import { TopPayoutsResponse } from './types';
3
3
  export declare const SLIP_EMPTY_HINT = "Tap Yes or No to start building your multi.";
4
4
  export declare const SLIP_STAKE_LABEL = "Your stake";
5
5
  export declare const SLIP_DIVIDEND_LABEL = "Potential dividend";
6
+ export declare const SLIP_LEG_HINT = "Tap a leg to read it.";
7
+ export declare const SLIP_LEG_REMOVE = "Remove";
8
+ export declare const VIEW_LIST_GLYPH = "\u2630";
9
+ export declare const VIEW_SWIPE_GLYPH = "\u21C6";
10
+ export declare const VIEW_LIST_LABEL = "List view";
11
+ export declare const VIEW_SWIPE_LABEL = "Swipe cards";
6
12
  export interface LiveSlipLeg {
7
13
  id: number;
8
14
  /** 1-based position in the multi — the number printed on the tile. */
@@ -0,0 +1,52 @@
1
+ import { Proposition } from './types';
2
+ export type MarketFamily = 'totals' | 'spread' | 'player';
3
+ export declare const MARKET_FAMILIES: MarketFamily[];
4
+ export declare const MARKET_CAPS: Record<MarketFamily, number>;
5
+ /** Slot names, as they read on a fixture header. */
6
+ export declare const MARKET_FAMILY_LABEL: Record<MarketFamily, string>;
7
+ export declare function slotTooltip(family: MarketFamily, filled: boolean): string;
8
+ /** Why a greyed row won't answer. */
9
+ export declare function capReason(family: MarketFamily): string;
10
+ /**
11
+ * Which slot a proposition spends, or null when it spends none.
12
+ *
13
+ * Market type first — it is the only field the feed guarantees a shape for —
14
+ * and the description second, for the markets whose type is a product name
15
+ * rather than a market key.
16
+ */
17
+ export declare function marketFamily(prop: Proposition): MarketFamily | null;
18
+ /**
19
+ * Every slot a proposition spends. A composite spends one per leg: "the total
20
+ * is over AND Hawthorn covers" is a total and a line bought together, so it
21
+ * blocks — and is blocked by — the singles that spend the same slots.
22
+ */
23
+ export declare function marketFamilies(prop: Proposition, componentById?: ReadonlyMap<number, Proposition> | null): MarketFamily[];
24
+ /**
25
+ * The fixture a proposition belongs to. Event id when the feed has one, the
26
+ * matchup otherwise; null when neither, which leaves the prop uncapped — with
27
+ * no fixture to count against there is no slot to spend.
28
+ */
29
+ export declare function capFixtureKey(prop: Proposition): string | null;
30
+ export interface SelectionCaps {
31
+ /** True when this prop's slot is already spent by a different pick in its fixture. */
32
+ isCapped: (prop: Proposition) => boolean;
33
+ /** Families already spent in a fixture — for the slot chips on its header. */
34
+ filledFor: (key: string | null) => ReadonlySet<MarketFamily>;
35
+ /** Slots to draw on a fixture header, in a fixed order. */
36
+ slotsFor: (key: string | null) => {
37
+ family: MarketFamily;
38
+ label: string;
39
+ filled: boolean;
40
+ }[];
41
+ }
42
+ /**
43
+ * Read the picks so far as spent slots. Everything the UI needs to grey a row
44
+ * or tick a chip comes off the returned object, so web and native ask the same
45
+ * question and get the same answer.
46
+ */
47
+ export declare function buildSelectionCaps(propositions: readonly Proposition[], selections: Record<number, 'yes' | 'no'>, componentById?: ReadonlyMap<number, Proposition> | null): SelectionCaps;
48
+ /**
49
+ * Quick pick's pool, thinned to what a player could have picked by hand — one
50
+ * slot per family per fixture, in the order it is handed (already shuffled).
51
+ */
52
+ export declare function takeWithinCaps(pool: readonly Proposition[], count: number, componentById?: ReadonlyMap<number, Proposition> | null): Proposition[];
@@ -19,4 +19,4 @@ export interface SwipeDeckState {
19
19
  * The platform-free half of the swipe deck — queue, visible stack, and what
20
20
  * skip/answer/undo do. The twins wrap it with their own gesture layers.
21
21
  */
22
- export declare function useSwipeDeck(propositions: Proposition[], selections: Record<number, 'yes' | 'no'>, toggleSelection: (id: number, answer: 'yes' | 'no') => void): SwipeDeckState;
22
+ export declare function useSwipeDeck(propositions: Proposition[], selections: Record<number, 'yes' | 'no'>, toggleSelection: (id: number, answer: 'yes' | 'no') => void, isBlocked?: (prop: Proposition) => boolean): SwipeDeckState;
@@ -242,7 +242,7 @@ export interface PlaceEntryFlowProps {
242
242
  onBeforeSubmit?: (betAmount: number) => void | Promise<void>;
243
243
  onCancel?: () => void;
244
244
  initialGameId?: number;
245
- gameCategory?: 'sports' | 'casino' | 'racing';
245
+ gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction';
246
246
  jurisdiction?: string;
247
247
  /** Supply demo/test data instead of hitting the API */
248
248
  demoGames?: Game[];
@@ -313,7 +313,7 @@ export interface SportSelectorProps {
313
313
  colorScheme?: ColorScheme;
314
314
  hideActions?: boolean;
315
315
  initialSport?: string;
316
- gameCategory?: 'sports' | 'casino' | 'racing';
316
+ gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction';
317
317
  renderTeamLogo?: RenderTeamLogo;
318
318
  /** Hide the Quick Pick button and count input. @default false */
319
319
  disableQuickPick?: boolean;
@@ -354,6 +354,11 @@ export interface EntrySubmissionProps {
354
354
  winningCounts?: number[];
355
355
  payouts?: Record<number, number>;
356
356
  renderTeamLogo?: RenderTeamLogo;
357
+ /**
358
+ * Component legs of composite propositions, by id — lets a composite row
359
+ * name the fixture each leg is from. See SelectionReviewProps.componentById.
360
+ */
361
+ componentById?: ReadonlyMap<number, Proposition> | null;
357
362
  /** Show the free-text custom amount input. @default false */
358
363
  showCustomAmount?: boolean;
359
364
  /**
@@ -389,6 +394,13 @@ export interface SelectionReviewProps {
389
394
  gameName?: string;
390
395
  potentialPayout?: number;
391
396
  defaultExpanded?: boolean;
397
+ /**
398
+ * Component legs of composite propositions, by id. Supply it and a composite
399
+ * row names the fixture each leg comes from — without it a cross-event
400
+ * composite reads as one run-on sentence with no clue the halves are from
401
+ * different games. `usePlaceEntry().compositeComponentById` provides it.
402
+ */
403
+ componentById?: ReadonlyMap<number, Proposition> | null;
392
404
  addMorePicks?: {
393
405
  remaining: number;
394
406
  max: number;
@@ -1,5 +1,5 @@
1
1
  import { Game, GamePermittedRule, Proposition, QuickPickResult } from './types';
2
- export declare const DEFAULT_STAKE = 10;
2
+ export declare const DEFAULT_STAKE = 20;
3
3
  export declare function stripColumns(count: number, containerWidth: number): number;
4
4
  export declare function resolvePrice(price: number | string | {
5
5
  amount: number | string;
@@ -14,7 +14,7 @@ export declare function groupPropositionsBySport(propositions: Proposition[]): R
14
14
  export declare function getPropositionSportKey(prop: Proposition, pool?: Proposition[]): string;
15
15
  export declare function collectPropositionSportKeys(propositions: Proposition[]): string[];
16
16
  export declare function groupPropositionsByCategory(propositions: Proposition[]): Record<string, Proposition[]>;
17
- export type EntryCategory = 'sports' | 'casino' | 'racing';
17
+ export type EntryCategory = 'sports' | 'casino' | 'racing' | 'prediction';
18
18
  export declare const ENTRY_CATEGORY_ORDER: EntryCategory[];
19
19
  export declare function getPropositionEntryCategory(prop: Proposition): EntryCategory;
20
20
  /**
@@ -58,7 +58,7 @@ export declare function getJackpotInfo(game: Game): {
58
58
  limit: number;
59
59
  progressive: boolean;
60
60
  };
61
- export declare function isRacingCategory(gameCategory?: 'sports' | 'casino' | 'racing', propositions?: Proposition[], sportBaseKey?: string | null): boolean;
61
+ export declare function isRacingCategory(gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction', propositions?: Proposition[], sportBaseKey?: string | null): boolean;
62
62
  export declare function getSportDisplayName(sport: string, sportBaseKey?: string | null): string;
63
63
  /** Host-supplied UI labels keyed by sport key (e.g. `basketball_nba` → `NBA`). */
64
64
  export type SportDisplayNameOverrides = Record<string, string>;
@@ -112,7 +112,7 @@ export declare function readableColor(bg: string | undefined | null, desired: st
112
112
  /** Group propositions by matchup (home_team vs away_team). */
113
113
  export declare function groupByMatchup(props: Proposition[]): Record<string, Proposition[]>;
114
114
  export declare function groupByRace(props: Proposition[]): Record<string, Proposition[]>;
115
- export declare function groupPropositionsForDisplay(props: Proposition[], gameCategory?: 'sports' | 'casino' | 'racing', sportBaseKey?: string | null): Record<string, Proposition[]>;
115
+ export declare function groupPropositionsForDisplay(props: Proposition[], gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction', sportBaseKey?: string | null): Record<string, Proposition[]>;
116
116
  /**
117
117
  * Group picks under the event they belong to, keeping pick order. The key is
118
118
  * the "A vs B" matchup, the race name, or `null` for props with no event.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-parlay/components",
3
- "version": "1.30.6-pre",
3
+ "version": "1.30.6-pre.3",
4
4
  "description": "UI components, hooks, and utilities for React and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",