@simple-parlay/components 1.30.6-pre.2 → 1.30.6-pre.4

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.
Files changed (33) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.mjs +318 -317
  4. package/dist/react/components/EntrySubmission.d.ts +1 -1
  5. package/dist/react/components/GameSelector.d.ts +1 -1
  6. package/dist/react/components/MultiLegTable.d.ts +3 -1
  7. package/dist/react/components/PlaceEntryProvider.d.ts +3 -2
  8. package/dist/react/components/SelectionReview.d.ts +1 -1
  9. package/dist/react/components/SportSelector.d.ts +15 -2
  10. package/dist/react/index.js +1 -1
  11. package/dist/react/index.mjs +318 -317
  12. package/dist/react-native/components/EntrySubmission.d.ts +1 -1
  13. package/dist/react-native/components/GameSelector.d.ts +1 -1
  14. package/dist/react-native/components/MultiLegTable.d.ts +3 -1
  15. package/dist/react-native/components/PlaceEntryProvider.d.ts +3 -2
  16. package/dist/react-native/components/SelectionReview.d.ts +1 -1
  17. package/dist/react-native/components/SportSelector.d.ts +7 -2
  18. package/dist/react-native/index.js +1 -1
  19. package/dist/react-native/index.mjs +411 -407
  20. package/dist/shared/api-client.d.ts +2 -2
  21. package/dist/shared/game-flow.d.ts +12 -1
  22. package/dist/shared/game-icons.d.ts +1 -1
  23. package/dist/shared/game-set-bet.d.ts +0 -1
  24. package/dist/shared/hooks.d.ts +2 -2
  25. package/dist/shared/menu-placement.d.ts +26 -0
  26. package/dist/shared/mirror.d.ts +43 -3
  27. package/dist/shared/picker-brand.d.ts +0 -6
  28. package/dist/shared/selection-actions.d.ts +14 -4
  29. package/dist/shared/selection-caps.d.ts +51 -0
  30. package/dist/shared/swipe-deck.d.ts +1 -1
  31. package/dist/shared/types.d.ts +20 -2
  32. package/dist/shared/utils.d.ts +3 -3
  33. package/package.json +1 -1
@@ -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[]>;
@@ -38,7 +38,18 @@ export interface ConfirmBoostCopy {
38
38
  */
39
39
  export declare function getConfirmBoostCopy(game: Game | null | undefined): ConfirmBoostCopy;
40
40
  export declare function describeWinCondition(rule: GamePermittedRule | null | undefined, winningCounts: number[] | null | undefined, totalPicks: number, payouts?: Record<number, number> | null): string | null;
41
+ export interface WinConditionPrizeRow {
42
+ count: number;
43
+ label: string;
44
+ prize: number;
45
+ }
46
+ export declare function winConditionPrizeRows(winningCounts: number[] | null | undefined, totalPicks: number, payouts: Record<number, number> | null | undefined): WinConditionPrizeRow[];
47
+ export declare function lockedLegCount(game: Game | null | undefined, selectedCount: number | null | undefined): number | null;
48
+ export declare function isLegsLockedGame(game: Game | null | undefined): boolean;
41
49
  export declare function isStakeLockedGame(game: Game | null | undefined): boolean;
42
50
  /** Why the stake is fixed, shown beside the locked figure. */
43
51
  export declare function stakeLockedNote(game: Game | null | undefined): string;
44
- export declare function quotedPayoutAtCount(game: Game | null | undefined, count: number, stake: number): number;
52
+ export declare function quotedPayoutAtCount(game: Game | null | undefined, count: number, stake: number, opts?: {
53
+ expectedCorrect?: number;
54
+ }): number;
55
+ export declare function roundQuotedPayout(amount: number, game?: Game | null): number;
@@ -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. */
@@ -39,7 +39,6 @@ export interface GameSetBetConfig {
39
39
  }
40
40
  /** Whether a game is a Game Set Bet (routes to the one-screen ticket builder). */
41
41
  export declare function isGameSetBetGame(game: Game | null | undefined): boolean;
42
- /** Price a ticket: total return incl. stake, exact to the cent — never rounded. */
43
42
  export declare function gameSetPrize(stake: number, legs: number, opts?: {
44
43
  operatorMargin?: number;
45
44
  perLegProbability?: number;
@@ -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
  }): {
@@ -0,0 +1,26 @@
1
+ export interface MenuPlacement {
2
+ top: number;
3
+ left: number;
4
+ maxHeight: number;
5
+ }
6
+ export interface MenuPlacementInput {
7
+ /** Trigger box, viewport coordinates (a `getBoundingClientRect()`). */
8
+ trigger: {
9
+ top: number;
10
+ bottom: number;
11
+ left: number;
12
+ right: number;
13
+ };
14
+ viewport: {
15
+ width: number;
16
+ height: number;
17
+ };
18
+ /** How tall the menu is with every option shown. */
19
+ wanted: number;
20
+ width: number;
21
+ align: 'left' | 'right';
22
+ direction: 'down' | 'up';
23
+ /** Trim an over-tall menu to a whole number of rows. */
24
+ snap?: (space: number) => number;
25
+ }
26
+ export declare function placeMenu({ trigger, viewport, wanted, width, align, direction, snap, }: MenuPlacementInput): MenuPlacement;
@@ -13,11 +13,13 @@ import { Game } from './types';
13
13
  * Pricing (suite-standard 21.875% margin): the prize budget is the stake less
14
14
  * the margin, split equally across the two winning outcomes, so each side pays
15
15
  * prize = stake × (1 − margin) × 2^(N−1)
16
- * quoted EXACT — no rounding. Each extra leg exactly doubles the prize and the
17
- * margin holds flat at every leg count (RTP 78.125%).
16
+ * quoted in whole dollars — a dividend is advertised as $1,333, never
17
+ * $1,333.33. Each extra leg doubles the prize and the margin holds flat at
18
+ * every leg count (RTP 78.125%, within the cent the rounding moves).
18
19
  */
19
20
  /** Suite-standard operator margin for Mirror Standard. */
20
21
  export declare const MIRROR_STANDARD_MARGIN = 0.21875;
22
+ export declare function resolveMirrorMargin(stored: number | null | undefined): number;
21
23
  /** A live prize quote for a stake/legs combination. */
22
24
  export interface MirrorPrize {
23
25
  legs: number;
@@ -60,7 +62,7 @@ export declare function isMirrorGame(game: Game | null | undefined): boolean;
60
62
  /** Which mirror this game is. Unknown rules fall back to the straight one. */
61
63
  export declare function resolveMirrorVariantId(game: Game | null | undefined): MirrorVariantId;
62
64
  /**
63
- * Price a Mirror ticket: what each winning side pays, exact to the cent.
65
+ * Price a Mirror ticket: what each winning side pays, to the dollar.
64
66
  *
65
67
  * The prize is fixed at the fair 50/50 price — stake × (1 − margin) × 2^(N−1) —
66
68
  * so it is independent of `perLegProbability`; a skewed leg probability only
@@ -106,4 +108,42 @@ export declare function mirrorCombinations(n: number, k: number): number;
106
108
  export declare function mirrorSuitePrize(variantId: MirrorVariantId, stake: number, legs: number, opts?: {
107
109
  operatorMargin?: number;
108
110
  }): MirrorSuitePrize;
111
+ /** Marks on a prize row: a call landed, a call missed. */
112
+ export declare const MIRROR_TICK = "\u2713";
113
+ export declare const MIRROR_CROSS = "\u2715";
114
+ /** One payable outcome: the two sweeps are two rows, not one "12 or 0" row. */
115
+ export interface MirrorPrizeRow {
116
+ /** Correct calls this row pays on — also how many ticks the row shows. */
117
+ correct: number;
118
+ label: string;
119
+ prize: number;
120
+ }
121
+ /**
122
+ * Flatten the tiers into one row per winning outcome. A tier reaching both
123
+ * edges pays twice, and quoting it as "12 or 0 of 12" reads as one way to win
124
+ * with strange wording — so each edge gets its own row and its own price.
125
+ */
126
+ export declare function mirrorPrizeRows(quote: MirrorSuitePrize): MirrorPrizeRow[];
127
+ /** A mirror in the catalogue, paired with the variant its rule names. */
128
+ export interface MirrorVariantGame {
129
+ variant: MirrorVariant;
130
+ game: Game;
131
+ }
132
+ /**
133
+ * The mirrors a player can switch between from `current`, straight first.
134
+ *
135
+ * The base mirror is the Straight Mirror and nothing else: on Signature it is
136
+ * one game with no depth to choose. The set of three lives on Premier, so only
137
+ * a Premier mirror offers the switch, and only to the mirrors sharing its tier.
138
+ * They are separate games, so the page can only offer what the catalogue
139
+ * carries — one mirror at that tier means no choice to make.
140
+ */
141
+ export declare function mirrorVariantGames(games: Game[], current: Game | null | undefined): MirrorVariantGame[];
142
+ /**
143
+ * The catalogue as the games menu should show it. A tier carrying a full
144
+ * mirror set lists one tile — the straight mirror, the set's front door —
145
+ * because its page is where the deeper two are chosen. A deeper mirror with no
146
+ * straight mirror beside it keeps its own tile, or there would be no way in.
147
+ */
148
+ export declare function collapseMirrorSet(games: Game[]): Game[];
109
149
  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;
@@ -1,8 +1,15 @@
1
- import { TopPayoutsResponse } from './types';
1
+ import { Game, TopPayoutsResponse } from './types';
2
2
  /** Copy for the live slip docked under the selection list. */
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 SLIP_CLEAR = "Clear bet";
9
+ export declare const VIEW_LIST_GLYPH = "\u2630";
10
+ export declare const VIEW_SWIPE_GLYPH = "\u21C6";
11
+ export declare const VIEW_LIST_LABEL = "List view";
12
+ export declare const VIEW_SWIPE_LABEL = "Swipe cards";
6
13
  export interface LiveSlipLeg {
7
14
  id: number;
8
15
  /** 1-based position in the multi — the number printed on the tile. */
@@ -44,7 +51,10 @@ export declare function buildLiveSlip({ selections, order, minReq, maxReq, stake
44
51
  export declare function mergePickOrder(prev: number[], selections: Record<number, 'yes' | 'no'>): number[];
45
52
  /**
46
53
  * Dividend for a leg count, normalised to a $20 bet. Reads the game's own
47
- * `/max-payout` table, so it prices every game — not just the range ones the
48
- * overload callout covers.
54
+ * `/max-payout` table
49
55
  */
50
- export declare function payout20AtCount(payouts: TopPayoutsResponse | undefined, count: number): number;
56
+ export declare function payout20AtCount(payouts: TopPayoutsResponse | undefined, count: number, opts?: {
57
+ game?: Game | null;
58
+ expectedCorrect?: number;
59
+ stake?: number;
60
+ }): number;
@@ -0,0 +1,51 @@
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
+ slotsFor: (key: string | null) => {
36
+ family: MarketFamily;
37
+ label: string;
38
+ filled: boolean;
39
+ }[];
40
+ }
41
+ /**
42
+ * Read the picks so far as spent slots. Everything the UI needs to grey a row
43
+ * or tick a chip comes off the returned object, so web and native ask the same
44
+ * question and get the same answer.
45
+ */
46
+ export declare function buildSelectionCaps(propositions: readonly Proposition[], selections: Record<number, 'yes' | 'no'>, componentById?: ReadonlyMap<number, Proposition> | null): SelectionCaps;
47
+ /**
48
+ * Quick pick's pool, thinned to what a player could have picked by hand — one
49
+ * slot per family per fixture, in the order it is handed (already shuffled).
50
+ */
51
+ 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;
@@ -67,6 +67,12 @@ export interface Game {
67
67
  };
68
68
  };
69
69
  operator_margin?: number;
70
+ /**
71
+ * BLADE's quote-rounding switch: when true (or absent) quotes round to the
72
+ * nearest `payout_structure.round_to` (default $1); explicit false means the
73
+ * backend quotes exact and blade must not re-round.
74
+ */
75
+ round_payouts?: boolean;
70
76
  jackpot_enabled?: boolean;
71
77
  jackpot_amount?: number;
72
78
  jackpot_limit?: number | null;
@@ -242,7 +248,7 @@ export interface PlaceEntryFlowProps {
242
248
  onBeforeSubmit?: (betAmount: number) => void | Promise<void>;
243
249
  onCancel?: () => void;
244
250
  initialGameId?: number;
245
- gameCategory?: 'sports' | 'casino' | 'racing';
251
+ gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction';
246
252
  jurisdiction?: string;
247
253
  /** Supply demo/test data instead of hitting the API */
248
254
  demoGames?: Game[];
@@ -313,7 +319,7 @@ export interface SportSelectorProps {
313
319
  colorScheme?: ColorScheme;
314
320
  hideActions?: boolean;
315
321
  initialSport?: string;
316
- gameCategory?: 'sports' | 'casino' | 'racing';
322
+ gameCategory?: 'sports' | 'casino' | 'racing' | 'prediction';
317
323
  renderTeamLogo?: RenderTeamLogo;
318
324
  /** Hide the Quick Pick button and count input. @default false */
319
325
  disableQuickPick?: boolean;
@@ -354,6 +360,11 @@ export interface EntrySubmissionProps {
354
360
  winningCounts?: number[];
355
361
  payouts?: Record<number, number>;
356
362
  renderTeamLogo?: RenderTeamLogo;
363
+ /**
364
+ * Component legs of composite propositions, by id — lets a composite row
365
+ * name the fixture each leg is from. See SelectionReviewProps.componentById.
366
+ */
367
+ componentById?: ReadonlyMap<number, Proposition> | null;
357
368
  /** Show the free-text custom amount input. @default false */
358
369
  showCustomAmount?: boolean;
359
370
  /**
@@ -389,6 +400,13 @@ export interface SelectionReviewProps {
389
400
  gameName?: string;
390
401
  potentialPayout?: number;
391
402
  defaultExpanded?: boolean;
403
+ /**
404
+ * Component legs of composite propositions, by id. Supply it and a composite
405
+ * row names the fixture each leg comes from — without it a cross-event
406
+ * composite reads as one run-on sentence with no clue the halves are from
407
+ * different games. `usePlaceEntry().compositeComponentById` provides it.
408
+ */
409
+ componentById?: ReadonlyMap<number, Proposition> | null;
392
410
  addMorePicks?: {
393
411
  remaining: number;
394
412
  max: number;
@@ -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.2",
3
+ "version": "1.30.6-pre.4",
4
4
  "description": "UI components, hooks, and utilities for React and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",