@simple-parlay/components 1.29.0 → 1.30.0
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.
- package/README.md +6 -164
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +346 -282
- package/dist/react/components/ConfirmPage.d.ts +9 -2
- package/dist/react/components/EntrySubmission.d.ts +1 -1
- package/dist/react/components/GameModeCard.d.ts +26 -6
- package/dist/react/components/GamePage.d.ts +10 -6
- package/dist/react/components/GameSelector.d.ts +19 -1
- package/dist/react/components/GameSetupPage.d.ts +0 -14
- package/dist/react/components/HowToPlayButton.d.ts +15 -3
- package/dist/react/components/HowToPlayPanel.d.ts +13 -0
- package/dist/react/components/LoadingIndicators.d.ts +21 -6
- package/dist/react/components/PageBackButton.d.ts +11 -1
- package/dist/react/components/PickerBrand.d.ts +10 -0
- package/dist/react/components/PlaceEntryProvider.d.ts +5 -4
- package/dist/react/components/PropositionFilters.d.ts +24 -0
- package/dist/react/components/SafetyNetPage.d.ts +16 -0
- package/dist/react/components/SelectionReview.d.ts +1 -1
- package/dist/react/components/SelectionsPage.d.ts +7 -1
- package/dist/react/components/SportPickerPage.d.ts +3 -1
- package/dist/react/components/SportSelector.d.ts +15 -2
- package/dist/react/components/SwipeDeck.d.ts +33 -0
- package/dist/react/components/_primitives/index.d.ts +2 -0
- package/dist/react/index.d.ts +16 -4
- package/dist/react/index.js +1 -1
- package/dist/react/index.mjs +346 -282
- package/dist/react/types/index.d.ts +1 -1
- package/dist/react/utils/index.d.ts +2 -2
- package/dist/react-native/components/ConfirmPage.d.ts +9 -2
- package/dist/react-native/components/EntrySubmission.d.ts +1 -1
- package/dist/react-native/components/GameModeCard.d.ts +40 -7
- package/dist/react-native/components/GamePage.d.ts +15 -6
- package/dist/react-native/components/GameSelector.d.ts +19 -0
- package/dist/react-native/components/GameSetupPage.d.ts +2 -4
- package/dist/react-native/components/HowToPlayButton.d.ts +9 -1
- package/dist/react-native/components/HowToPlayPanel.d.ts +12 -0
- package/dist/react-native/components/LoadingIndicators.d.ts +23 -8
- package/dist/react-native/components/PageBackButton.d.ts +3 -1
- package/dist/react-native/components/PickerBrand.d.ts +8 -0
- package/dist/react-native/components/PlaceEntryProvider.d.ts +5 -4
- package/dist/react-native/components/PropositionFilters.d.ts +22 -0
- package/dist/react-native/components/SafetyNetPage.d.ts +14 -0
- package/dist/react-native/components/SelectionReview.d.ts +1 -1
- package/dist/react-native/components/SelectionsPage.d.ts +7 -1
- package/dist/react-native/components/SportPickerPage.d.ts +3 -1
- package/dist/react-native/components/SportSelector.d.ts +15 -2
- package/dist/react-native/components/SwipeDeck.d.ts +32 -0
- package/dist/react-native/components/_primitives/index.d.ts +9 -0
- package/dist/react-native/index.d.ts +16 -4
- package/dist/react-native/index.js +1 -1
- package/dist/react-native/index.mjs +390 -334
- package/dist/react-native/types/index.d.ts +1 -1
- package/dist/react-native/utils/index.d.ts +2 -2
- package/dist/shared/api-client.d.ts +1 -0
- package/dist/shared/game-dividends.d.ts +34 -0
- package/dist/shared/game-flow.d.ts +3 -2
- package/dist/shared/hooks.d.ts +2 -1
- package/dist/shared/how-to-play-panel.d.ts +36 -0
- package/dist/shared/picker-brand.d.ts +11 -0
- package/dist/shared/rule-setup.d.ts +1 -8
- package/dist/shared/safety-net.d.ts +47 -0
- package/dist/shared/swipe-deck.d.ts +22 -0
- package/dist/shared/types.d.ts +31 -10
- package/dist/shared/utils.d.ts +21 -9
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { BladeTheme, BladeThemeSet, ColorScheme, ScreenSize, RuleExpressionObject, Game, GameAllocation, SportSummary, Proposition, GameEntry, PlaceEntryFlowProps, GameSelectorProps, EntrySubmissionProps, SelectionReviewProps, GameEntriesProps, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, TopPayoutEntry, TopPayoutsResponse, ResolvedEntryData, ShareData, QuickPickResult, } from '../../shared/types';
|
|
1
|
+
export type { BladeTheme, BladeThemeSet, ColorScheme, ScreenSize, RuleExpressionObject, Game, GameAllocation, SportSummary, Proposition, GameEntry, PlaceEntryFlowProps, GameSelectorProps, EntrySubmissionProps, SelectionReviewProps, GameEntriesProps, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, TopPayoutEntry, TopPayoutsResponse, ResolvedEntryData, ShareData, PendingBet, QuickPickResult, } from '../../shared/types';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { resolvePrice, toNumber, toBool, formatYesNo, formatCurrency, formatDate, groupPropositionsBySport, getPropositionSportKey, collectPropositionSportKeys, compositePropositionMatchesSport, compositePropositionMatchesGameSports, groupPropositionsByCategory, groupPropositionsByEntryCategory, getPropositionEntryCategory, getAvailableEntryCategories, getSportPickerTitle, getCategoryDisplayName, getCategoryTagline, getSportShortCode, getSportPickerTagline, getSportSummaryTagline, groupByMatchup, groupByRace, groupPropositionsForDisplay, isRacingCategory, buildRangeLegOptions, getPayoutForCount, generateQuickPick, isValidSelectionCount, getEffectivePropositionLimits, getJackpotInfo, getSportDisplayName, resolveSportDisplayName, resolveCategoryDisplayName, filterPropositionsForGame, filterPropositionPool, filterGamesByPropositionPool, filterGamesByEntryCategory, gameHasPropositionsInPool, getGameEntryCategory, gameMatchesEntryCategory, gamePermitsSport, normalizeGamesSport, sportKeysCompatible, propositionSportMatches, isGameAvailableToday, getAvailableDaysLabel, contrastTextColour, readableColor, getCompositeOperatorLabel, getCompositeHelperText, parseCompositeDescription, inferCompositeOperatorFromDescription, resolveCompositeOperator, resolveCompositeDisplay, resolveCompositeLegs, parseCompositeComponentIds, collectCompositeComponentIds, formatPropositionEventLabel, getPropositionDescription, getPropositionMarketType, resolveGameIconId, resolveGameIconUrl, isGameIconUrl, resolveGameIconMarkup, } from '../../shared/utils';
|
|
2
|
-
export type { SportDisplayNameOverrides, CategoryDisplayNameOverrides, GameIconId } from '../../shared/utils';
|
|
1
|
+
export { resolvePrice, toNumber, toBool, formatYesNo, formatCurrency, formatDate, groupPropositionsBySport, getPropositionSportKey, collectPropositionSportKeys, compositePropositionMatchesSport, compositePropositionMatchesGameSports, groupPropositionsByCategory, groupPropositionsByEntryCategory, getPropositionEntryCategory, isRacingProposition, getAvailableEntryCategories, getSportPickerTitle, getCategoryDisplayName, getCategoryTagline, getSportShortCode, getSportPickerTagline, getSportSummaryTagline, splitSportLabel, getSportComingSoonCaption, getHowToPlayPanel, describeDemoVerdict, groupByMatchup, groupByRace, groupPropositionsForDisplay, isRacingCategory, buildRangeLegOptions, getPayoutForCount, generateQuickPick, isValidSelectionCount, getEffectivePropositionLimits, findPermittedRule, getJackpotInfo, getSportDisplayName, resolveSportDisplayName, resolveCategoryDisplayName, filterPropositionsForGame, filterPropositionPool, filterGamesByPropositionPool, filterGamesByEntryCategory, gameHasPropositionsInPool, getGameEntryCategory, gameMatchesEntryCategory, gamePermitsSport, normalizeGamesSport, sportKeysCompatible, propositionSportMatches, isGameAvailableToday, getAvailableDaysLabel, contrastTextColour, readableColor, getCompositeOperatorLabel, getCompositeHelperText, parseCompositeDescription, inferCompositeOperatorFromDescription, resolveCompositeOperator, resolveCompositeDisplay, resolveCompositeLegs, parseCompositeComponentIds, collectCompositeComponentIds, formatPropositionEventLabel, getPropositionDescription, getPropositionMarketType, resolveGameIconId, resolveGameIconUrl, isGameIconUrl, resolveGameIconMarkup, } from '../../shared/utils';
|
|
2
|
+
export type { SportDisplayNameOverrides, CategoryDisplayNameOverrides, GameIconId, ComingSoonSport, HowToPlayPanelContent, HowToPlaySummarySegment, HowToPlayStep, HowToPlayDemoLeg, HowToPlayDemoVerdict } from '../../shared/utils';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Game, TopPayoutsResponse } from './types';
|
|
2
|
+
export interface DividendTier {
|
|
3
|
+
count: number;
|
|
4
|
+
payout20: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DividendMode {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
tiers: {
|
|
10
|
+
label: string;
|
|
11
|
+
payout20: number;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
export interface GameDividends {
|
|
15
|
+
/** Leg counts this game can be played at, smallest first. */
|
|
16
|
+
legOptions: number[];
|
|
17
|
+
maxLegCount: number;
|
|
18
|
+
/** Payout per leg count, normalised to a $20 bet. Empty for Pick Your Dividend. */
|
|
19
|
+
tiers: DividendTier[];
|
|
20
|
+
/** Safety Net and friends: one payout table per cover option. */
|
|
21
|
+
modes: DividendMode[];
|
|
22
|
+
/** Pick Your Dividend: the set dividends and the stake each starts from. */
|
|
23
|
+
pydDividends?: {
|
|
24
|
+
dividend: number;
|
|
25
|
+
stakeFrom: number;
|
|
26
|
+
}[];
|
|
27
|
+
/** Whether `tiers` is worth showing — a priced table, not a column of dashes. */
|
|
28
|
+
hasGenericDividends: boolean;
|
|
29
|
+
/** The game's bet limits, bounding the example-bet input. */
|
|
30
|
+
minBet: number;
|
|
31
|
+
maxBet: number | null;
|
|
32
|
+
}
|
|
33
|
+
/** A game's dividend table, derived from the game and its `/max-payout` response. */
|
|
34
|
+
export declare function buildGameDividends(game: Game, topPayouts?: TopPayoutsResponse): GameDividends;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Game } from './types';
|
|
1
|
+
import { Game, GamePermittedRule } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Which journey a game takes after its tile is pressed.
|
|
4
4
|
*
|
|
5
5
|
* The unique games each own a purpose-built setup page; everything else goes
|
|
6
6
|
* through the generic rule page or straight to selections.
|
|
7
7
|
*/
|
|
8
|
-
export type GameFlow = 'quick_pick' | 'game_set' | 'pick_your_dividend' | 'ladder' | 'mirror' | 'rule_setup' | 'selections';
|
|
8
|
+
export type GameFlow = 'quick_pick' | 'game_set' | 'pick_your_dividend' | 'ladder' | 'mirror' | 'safety_net' | 'rule_setup' | 'selections';
|
|
9
9
|
export declare function getGameFlow(game: Game | null | undefined): GameFlow;
|
|
10
10
|
export declare function isFixedCardExactGame(game: Game | null | undefined): boolean;
|
|
11
11
|
export declare function isOpenExactMultiGame(game: Game | null | undefined): boolean;
|
|
@@ -37,3 +37,4 @@ export interface ConfirmBoostCopy {
|
|
|
37
37
|
* purpose-built setup games use their own product language instead.
|
|
38
38
|
*/
|
|
39
39
|
export declare function getConfirmBoostCopy(game: Game | null | undefined): ConfirmBoostCopy;
|
|
40
|
+
export declare function describeWinCondition(rule: GamePermittedRule | null | undefined, winningCounts: number[] | null | undefined, totalPicks: number, payouts?: Record<number, number> | null): string | null;
|
package/dist/shared/hooks.d.ts
CHANGED
|
@@ -59,13 +59,14 @@ export declare function useCreateGameEntry(apiClient: BladeApiClient): {
|
|
|
59
59
|
proposition_ids: number[];
|
|
60
60
|
selections?: Record<number, "yes" | "no">;
|
|
61
61
|
stake?: number;
|
|
62
|
+
rule_id?: number | null;
|
|
62
63
|
}) => Promise<GameEntry>;
|
|
63
64
|
loading: boolean;
|
|
64
65
|
error: string | null;
|
|
65
66
|
entry: GameEntry | null;
|
|
66
67
|
};
|
|
67
68
|
export declare function usePlaceEntryFlow(initialGameId?: number): {
|
|
68
|
-
step: "
|
|
69
|
+
step: "success" | "sport" | "game" | "confirm";
|
|
69
70
|
selectedGame: Game | null;
|
|
70
71
|
selections: Record<number, "yes" | "no">;
|
|
71
72
|
placedEntry: GameEntry | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Game } from './types';
|
|
2
|
+
import { GameIconId } from './game-icons';
|
|
3
|
+
export type HowToPlaySummarySegment = string | {
|
|
4
|
+
text: string;
|
|
5
|
+
tone: 'yes' | 'no';
|
|
6
|
+
};
|
|
7
|
+
export interface HowToPlayStep {
|
|
8
|
+
title: string;
|
|
9
|
+
detail: string;
|
|
10
|
+
}
|
|
11
|
+
export interface HowToPlayDemoLeg {
|
|
12
|
+
question: string;
|
|
13
|
+
outcome: 'yes' | 'no';
|
|
14
|
+
}
|
|
15
|
+
export interface HowToPlayPanelContent {
|
|
16
|
+
id: GameIconId;
|
|
17
|
+
summary: HowToPlaySummarySegment[];
|
|
18
|
+
steps: HowToPlayStep[];
|
|
19
|
+
/** Always populated by `getHowToPlayPanel`, sized to the game's leg range. */
|
|
20
|
+
demoLegs: HowToPlayDemoLeg[];
|
|
21
|
+
demoPrompt: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the bundled panel for a game; `null` when the game isn't one we
|
|
25
|
+
* recognise — the caller falls back to the server's markdown/HTML content.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getHowToPlayPanel(game: Pick<Game, 'game_name' | 'quick_pick_only' | 'rule'> & Partial<Pick<Game, 'allowed_propositions' | 'min_propositions' | 'max_propositions' | 'num_propositions'>> | null | undefined): HowToPlayPanelContent | null;
|
|
28
|
+
export interface HowToPlayDemoVerdict {
|
|
29
|
+
won: boolean;
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Settle the test play under the game's rule. `correct` of `total` legs
|
|
34
|
+
* matched the scripted outcomes.
|
|
35
|
+
*/
|
|
36
|
+
export declare function describeDemoVerdict(id: GameIconId, correct: number, total: number): HowToPlayDemoVerdict;
|
|
@@ -9,3 +9,14 @@ export declare function getSportShortCode(sport: string, sportBaseKey?: 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
11
|
export declare function gameLogoTileFontSize(code: string): number;
|
|
12
|
+
export interface ComingSoonSport {
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
short?: string;
|
|
16
|
+
seasonStart?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function splitSportLabel(displayLabel: string, short: string): {
|
|
19
|
+
game: string;
|
|
20
|
+
league: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function getSportComingSoonCaption(seasonStart?: string): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Game } from './types';
|
|
2
|
+
export { roundDividendAmount } from './safety-net';
|
|
2
3
|
export type RuleSetupMode = 'description' | 'selection';
|
|
3
4
|
/** Discriminates which rule page identity (emblem / accent / voice) to show. */
|
|
4
5
|
export type RuleKind = 'exact' | 'safety_net' | 'pick';
|
|
@@ -62,14 +63,6 @@ export interface RuleSetupConfig {
|
|
|
62
63
|
options?: RuleSetupOption[];
|
|
63
64
|
continueLabel?: string;
|
|
64
65
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Round a dividend for display/pricing to the nearest `roundTo` step.
|
|
67
|
-
*
|
|
68
|
-
* Amounts smaller than the step keep whole-dollar precision (rounding a $28
|
|
69
|
-
* rung to the nearest $1,000 would crush it to $0). `roundTo <= 0` disables
|
|
70
|
-
* step rounding entirely — figures stay exact to the dollar.
|
|
71
|
-
*/
|
|
72
|
-
export declare function roundDividendAmount(amount: number, roundTo: number): number;
|
|
73
66
|
/** Built-in rule setup pages keyed by rule slug. Hosts can override via RuleSetupPage props. */
|
|
74
67
|
export declare function getRuleSetupConfig(game: Game | null | undefined, legCount?: number): RuleSetupConfig | null;
|
|
75
68
|
export declare function gameNeedsRuleSetup(game: Game | null | undefined): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Game } from './types';
|
|
2
|
+
export type SafetyNetModeId = 'extra_shot' | 'double_shot';
|
|
3
|
+
export interface SafetyNetMode {
|
|
4
|
+
id: SafetyNetModeId;
|
|
5
|
+
label: string;
|
|
6
|
+
allowedMisses: number;
|
|
7
|
+
stat: string;
|
|
8
|
+
explain: string;
|
|
9
|
+
legOptions: number[];
|
|
10
|
+
defaultLegs: number;
|
|
11
|
+
ruleId: number | null;
|
|
12
|
+
}
|
|
13
|
+
export interface SafetyNetPricing {
|
|
14
|
+
margin: number;
|
|
15
|
+
perLegProbability: number;
|
|
16
|
+
perfectMultiple: number;
|
|
17
|
+
perfectBaseLegs: number;
|
|
18
|
+
nearMissBudgetFraction: number;
|
|
19
|
+
roundTo: number;
|
|
20
|
+
}
|
|
21
|
+
export interface SafetyNetTicket {
|
|
22
|
+
legs: number;
|
|
23
|
+
stake: number;
|
|
24
|
+
allowedMisses: number;
|
|
25
|
+
perfect: number;
|
|
26
|
+
nearMiss: number[];
|
|
27
|
+
sweep: number;
|
|
28
|
+
}
|
|
29
|
+
export interface SafetyNetConfig {
|
|
30
|
+
modes: SafetyNetMode[];
|
|
31
|
+
defaultModeId: SafetyNetModeId;
|
|
32
|
+
defaultStake: number;
|
|
33
|
+
minStake: number;
|
|
34
|
+
maxStake: number | null;
|
|
35
|
+
quickAdds: number[];
|
|
36
|
+
tagline: string;
|
|
37
|
+
pricing: SafetyNetPricing;
|
|
38
|
+
}
|
|
39
|
+
export declare const EXTRA_SHOT_MIN_LEGS = 4;
|
|
40
|
+
export declare const DOUBLE_SHOT_MIN_LEGS = 6;
|
|
41
|
+
export declare function isSafetyNetGame(game: Game | null | undefined): boolean;
|
|
42
|
+
export declare function getSafetyNetPricing(game: Game): SafetyNetPricing;
|
|
43
|
+
export declare function roundDividendAmount(amount: number, roundTo: number): number;
|
|
44
|
+
export declare function safetyNetTicket(stake: number, legs: number, allowedMisses: number, p: SafetyNetPricing): SafetyNetTicket;
|
|
45
|
+
export declare function safetyNetCollect(ticket: SafetyNetTicket, wrong: number): number;
|
|
46
|
+
/** Resolve the one-screen ticket-builder config for a Safety Net game. */
|
|
47
|
+
export declare function getSafetyNetConfig(game: Game | null | undefined): SafetyNetConfig | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Proposition } from './types';
|
|
2
|
+
export type FlyDirection = 'right' | 'left' | 'up';
|
|
3
|
+
/** How many cards the deck renders in the stack at once. */
|
|
4
|
+
export declare const VISIBLE_DEPTH = 3;
|
|
5
|
+
export interface SwipeDeckState {
|
|
6
|
+
/** The top cards of the deck, top card first — at most {@link VISIBLE_DEPTH}. */
|
|
7
|
+
visible: Proposition[];
|
|
8
|
+
canSkip: boolean;
|
|
9
|
+
canUndo: boolean;
|
|
10
|
+
/** A card re-entering after an undo, and the edge it flies back in from. */
|
|
11
|
+
restored: {
|
|
12
|
+
id: number;
|
|
13
|
+
from: FlyDirection;
|
|
14
|
+
} | null;
|
|
15
|
+
resolve: (id: number, answer: 'yes' | 'no' | null) => void;
|
|
16
|
+
undo: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The platform-free half of the swipe deck — queue, visible stack, and what
|
|
20
|
+
* skip/answer/undo do. The twins wrap it with their own gesture layers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSwipeDeck(propositions: Proposition[], selections: Record<number, 'yes' | 'no'>, toggleSelection: (id: number, answer: 'yes' | 'no') => void): SwipeDeckState;
|
package/dist/shared/types.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ export interface Game {
|
|
|
41
41
|
play_icon_url?: string | null;
|
|
42
42
|
rule: string;
|
|
43
43
|
description?: string | null;
|
|
44
|
+
call_to_action?: string | null;
|
|
44
45
|
active: boolean;
|
|
45
46
|
payout_structure?: {
|
|
46
47
|
type: string;
|
|
@@ -90,9 +91,24 @@ export interface Game {
|
|
|
90
91
|
available_from?: string | null;
|
|
91
92
|
available_until?: string | null;
|
|
92
93
|
allowed_markets?: string[];
|
|
94
|
+
default_rule_id?: number | null;
|
|
95
|
+
permitted_rule_ids?: number[];
|
|
96
|
+
permitted_rules?: GamePermittedRule[];
|
|
93
97
|
created_at?: string;
|
|
94
98
|
updated_at?: string;
|
|
95
99
|
}
|
|
100
|
+
export interface GamePermittedRule {
|
|
101
|
+
id: number;
|
|
102
|
+
name: string;
|
|
103
|
+
slug?: string | null;
|
|
104
|
+
description?: string | null;
|
|
105
|
+
image_url?: string | null;
|
|
106
|
+
min_access_level?: number | null;
|
|
107
|
+
min_propositions?: number | null;
|
|
108
|
+
max_propositions?: number | null;
|
|
109
|
+
allowed_propositions?: number[] | null;
|
|
110
|
+
is_default?: boolean;
|
|
111
|
+
}
|
|
96
112
|
export interface GameAllocation {
|
|
97
113
|
id: number;
|
|
98
114
|
game_id: number;
|
|
@@ -119,6 +135,7 @@ export interface Proposition {
|
|
|
119
135
|
proposition_type?: string;
|
|
120
136
|
/** Hidden `co_*` legs used only inside composites — not bettable standalone. */
|
|
121
137
|
is_composite_component?: boolean;
|
|
138
|
+
price?: number | null;
|
|
122
139
|
proposition?: string;
|
|
123
140
|
description: string;
|
|
124
141
|
outcome?: string | null;
|
|
@@ -173,6 +190,14 @@ export interface ShareData {
|
|
|
173
190
|
betAmount: number;
|
|
174
191
|
summary: string;
|
|
175
192
|
}
|
|
193
|
+
/** Everything needed to rebuild an entry after the user logs in. */
|
|
194
|
+
export interface PendingBet {
|
|
195
|
+
game_id: number;
|
|
196
|
+
rule_id: number | null;
|
|
197
|
+
proposition_ids: number[];
|
|
198
|
+
selections: Record<number, 'yes' | 'no'>;
|
|
199
|
+
stake: number;
|
|
200
|
+
}
|
|
176
201
|
export interface TopPayoutEntry {
|
|
177
202
|
proposition_count: number;
|
|
178
203
|
multiplier: number;
|
|
@@ -215,8 +240,6 @@ export interface PlaceEntryFlowProps {
|
|
|
215
240
|
filterSport?: string;
|
|
216
241
|
/** Custom renderer for team or proposition logos. Receives a display name or prop logo key. */
|
|
217
242
|
renderTeamLogo?: RenderTeamLogo;
|
|
218
|
-
/** Show "Home" / "Away" labels under each team name. @default false */
|
|
219
|
-
showHomeAway?: boolean;
|
|
220
243
|
/** Hide the Quick Pick @default false */
|
|
221
244
|
disableQuickPick?: boolean;
|
|
222
245
|
/** Callback when an entry is selected in the Entries tab */
|
|
@@ -265,13 +288,12 @@ export interface SportSelectorProps {
|
|
|
265
288
|
initialSport?: string;
|
|
266
289
|
gameCategory?: 'sports' | 'casino' | 'racing';
|
|
267
290
|
renderTeamLogo?: RenderTeamLogo;
|
|
268
|
-
/** Show "Home" / "Away" labels under each team name. @default false */
|
|
269
|
-
showHomeAway?: boolean;
|
|
270
291
|
/** Hide the Quick Pick button and count input. @default false */
|
|
271
292
|
disableQuickPick?: boolean;
|
|
272
293
|
selectedPropositionCount?: number;
|
|
273
294
|
onPropositionCountChange?: (count: number) => void;
|
|
274
295
|
allowAnswerToggle?: boolean;
|
|
296
|
+
headerExtra?: ReactNode;
|
|
275
297
|
}
|
|
276
298
|
export interface EntrySubmissionProps {
|
|
277
299
|
game: Game;
|
|
@@ -294,8 +316,6 @@ export interface EntrySubmissionProps {
|
|
|
294
316
|
winningCounts?: number[];
|
|
295
317
|
payouts?: Record<number, number>;
|
|
296
318
|
renderTeamLogo?: RenderTeamLogo;
|
|
297
|
-
/** Show "Home" / "Away" labels under each team name. @default false */
|
|
298
|
-
showHomeAway?: boolean;
|
|
299
319
|
/** Show the free-text custom amount input. @default false */
|
|
300
320
|
showCustomAmount?: boolean;
|
|
301
321
|
/**
|
|
@@ -307,6 +327,11 @@ export interface EntrySubmissionProps {
|
|
|
307
327
|
/** Note shown beside the locked stake, e.g. "set by your dividend ladder". */
|
|
308
328
|
betAmountLockedNote?: string;
|
|
309
329
|
canSubmit?: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* When false, the bet amount and Place Entry cards are replaced by a log-in
|
|
332
|
+
* prompt — pressing it calls `onSubmit`. @default true
|
|
333
|
+
*/
|
|
334
|
+
authenticated?: boolean;
|
|
310
335
|
/** User Balance number and function for recharging **/
|
|
311
336
|
userBalance?: number;
|
|
312
337
|
onRecharge?: () => void;
|
|
@@ -322,8 +347,6 @@ export interface SelectionReviewProps {
|
|
|
322
347
|
colorScheme?: ColorScheme;
|
|
323
348
|
hideActions?: boolean;
|
|
324
349
|
renderTeamLogo?: RenderTeamLogo;
|
|
325
|
-
/** Show "Home" / "Away" labels under each team name. @default false */
|
|
326
|
-
showHomeAway?: boolean;
|
|
327
350
|
allowAnswerToggle?: boolean;
|
|
328
351
|
gameName?: string;
|
|
329
352
|
potentialPayout?: number;
|
|
@@ -350,8 +373,6 @@ export interface GameEntriesProps {
|
|
|
350
373
|
theme?: BladeTheme | BladeThemeSet;
|
|
351
374
|
colorScheme?: ColorScheme;
|
|
352
375
|
renderTeamLogo?: RenderTeamLogo;
|
|
353
|
-
/** Show "Home" / "Away" labels under each team name. @default false */
|
|
354
|
-
showHomeAway?: boolean;
|
|
355
376
|
filterSport?: string;
|
|
356
377
|
}
|
|
357
378
|
export interface EvaluateRuleRequest {
|
package/dist/shared/utils.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { Game, Proposition, QuickPickResult } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Resolve a price value to a plain number.
|
|
4
|
-
* Handles number, string, or { amount, currency } object forms.
|
|
5
|
-
*/
|
|
1
|
+
import { Game, GamePermittedRule, Proposition, QuickPickResult } from './types';
|
|
6
2
|
export declare function resolvePrice(price: number | string | {
|
|
7
3
|
amount: number | string;
|
|
8
4
|
currency?: string;
|
|
@@ -13,25 +9,33 @@ export declare function formatYesNo(value: string): string;
|
|
|
13
9
|
export declare function formatCurrency(value: number): string;
|
|
14
10
|
export declare function formatDate(date: Date | string): string;
|
|
15
11
|
export declare function groupPropositionsBySport(propositions: Proposition[]): Record<string, Proposition[]>;
|
|
16
|
-
/** Resolve the sport bucket for UI grouping (composites inherit from component legs). */
|
|
17
12
|
export declare function getPropositionSportKey(prop: Proposition, pool?: Proposition[]): string;
|
|
18
|
-
/** Collect distinct sport keys from a pool, including composite component legs. */
|
|
19
13
|
export declare function collectPropositionSportKeys(propositions: Proposition[]): string[];
|
|
20
14
|
export declare function groupPropositionsByCategory(propositions: Proposition[]): Record<string, Proposition[]>;
|
|
21
15
|
export type EntryCategory = 'sports' | 'casino' | 'racing';
|
|
22
16
|
export declare const ENTRY_CATEGORY_ORDER: EntryCategory[];
|
|
23
17
|
export declare function getPropositionEntryCategory(prop: Proposition): EntryCategory;
|
|
18
|
+
/**
|
|
19
|
+
* Racing rows carry the venue in `home_team` and the race name in `away_team`,
|
|
20
|
+
* so "home vs away" reads "Caulfield Heath vs R1 Caulfield Heath - ...".
|
|
21
|
+
* Display code uses this to drop the venue and label the race alone.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isRacingProposition(prop: Proposition): boolean;
|
|
24
24
|
export declare function groupPropositionsByEntryCategory(propositions: Proposition[]): Partial<Record<EntryCategory, Proposition[]>>;
|
|
25
25
|
export declare function getAvailableEntryCategories(propositions: Proposition[]): EntryCategory[];
|
|
26
26
|
export declare function getCategoryDisplayName(category: string): string;
|
|
27
27
|
export { COMPOSITE_AND_TYPE, COMPOSITE_OR_TYPE, COMPOSITE_PROPOSITION_TYPES, getCompositeOperatorLabel, getCompositeHelperText, parseCompositeDescription, inferCompositeOperatorFromDescription, resolveCompositeOperator, resolveCompositeDisplay, resolveCompositeLegs, parseCompositeComponentIds, collectCompositeComponentIds, formatPropositionEventLabel, isCompositeProposition, getPropositionDescription, getPropositionMarketType, gameAcceptsCompositeMarkets, isCompositeComponentType, isCompositePropositionType, propositionAllowedForGameMarkets, } from './composite';
|
|
28
28
|
export type { CompositeOperator, CompositeLegDisplay } from './composite';
|
|
29
|
-
export { PICKER_BRAND, SPORT_SHORT_CODES, getCategoryTagline, getSportShortCode, getSportPickerTagline, getSportSummaryTagline, gameLogoTileFontSize, } from './picker-brand';
|
|
29
|
+
export { PICKER_BRAND, SPORT_SHORT_CODES, getCategoryTagline, getSportShortCode, getSportPickerTagline, getSportSummaryTagline, gameLogoTileFontSize, splitSportLabel, getSportComingSoonCaption, } from './picker-brand';
|
|
30
|
+
export type { ComingSoonSport } from './picker-brand';
|
|
31
|
+
export { getHowToPlayPanel, describeDemoVerdict, } from './how-to-play-panel';
|
|
32
|
+
export type { HowToPlayPanelContent, HowToPlaySummarySegment, HowToPlayStep, HowToPlayDemoLeg, HowToPlayDemoVerdict, } from './how-to-play-panel';
|
|
30
33
|
export { resolveGameIconId, resolveGameIconUrl, isGameIconUrl, resolveGameIconMarkup, GAME_ICON_SCHEME, GAME_ICON_SVG, } from './game-icons';
|
|
31
34
|
export type { GameIconId } from './game-icons';
|
|
32
35
|
export declare function getSportPickerTitle(selectedCategory: string | null | undefined): string;
|
|
33
36
|
export declare function isValidSelectionCount(count: number, min?: number, max?: number, options?: number[]): boolean;
|
|
34
|
-
export declare function
|
|
37
|
+
export declare function findPermittedRule(game: Game | null | undefined, ruleId: number | null | undefined): GamePermittedRule | null;
|
|
38
|
+
export declare function getEffectivePropositionLimits(game: Game, selectedCount?: number, rule?: GamePermittedRule | null): {
|
|
35
39
|
min: number;
|
|
36
40
|
max: number;
|
|
37
41
|
};
|
|
@@ -107,6 +111,14 @@ export declare function readableColor(bg: string | undefined | null, desired: st
|
|
|
107
111
|
export declare function groupByMatchup(props: Proposition[]): Record<string, Proposition[]>;
|
|
108
112
|
export declare function groupByRace(props: Proposition[]): Record<string, Proposition[]>;
|
|
109
113
|
export declare function groupPropositionsForDisplay(props: Proposition[], gameCategory?: 'sports' | 'casino' | 'racing', sportBaseKey?: string | null): Record<string, Proposition[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Group picks under the event they belong to, keeping pick order. The key is
|
|
116
|
+
* the "A vs B" matchup, the race name, or `null` for props with no event.
|
|
117
|
+
*/
|
|
118
|
+
export declare function groupPropositionsByEvent(props: Proposition[]): {
|
|
119
|
+
key: string | null;
|
|
120
|
+
props: Proposition[];
|
|
121
|
+
}[];
|
|
110
122
|
/** Returns all integer counts from min to max inclusive. */
|
|
111
123
|
export declare function buildRangeLegOptions(min: number, max: number): number[];
|
|
112
124
|
/** Returns the net payout for a given count from a game's payout_structure. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simple-parlay/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "UI components, hooks, and utilities for React and React Native",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"test:live": "vitest run --project live --reporter=verbose",
|
|
44
44
|
"test:native": "vitest run --project react-native --reporter=verbose",
|
|
45
45
|
"test:parity": "vitest run --project parity --reporter=verbose",
|
|
46
|
+
"test:release": "vitest run --project release --reporter=verbose",
|
|
46
47
|
"test:e2e": "playwright test",
|
|
47
48
|
"test:e2e:ui": "playwright test --ui",
|
|
48
49
|
"test:visual": "playwright test --config playwright.visual.config.ts",
|