@simple-parlay/components 2.2.0 → 2.3.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.
@@ -1 +1 @@
1
- export type { GameFeatureId, EntryRuleAction, EntryFeatureClient, EntryFeatureOffer, EntryFeatureQuote, EntryFeatureQuoteInput, 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
+ export type { GameFeatureId, EntryRuleAction, EntryFeatureClient, EntryFeatureOffer, EntryFeatureQuote, EntryFeatureQuoteInput, BladeTheme, BladeThemeSet, ColorScheme, ScreenSize, RuleExpressionObject, Game, GameAllocation, SportSummary, Proposition, GameEntry, PlaceEntryFlowProps, DeviceContext, DeviceContextProp, GameSelectorProps, EntrySubmissionProps, SelectionReviewProps, GameEntriesProps, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, TopPayoutEntry, TopPayoutsResponse, ResolvedEntryData, ShareData, PendingBet, QuickPickResult, } from '../../shared/types';
@@ -1,4 +1,4 @@
1
- import { Game, Proposition, SportSummary, GameEntry, EntryFeatureOffer, EntryFeatureQuote, EntryFeatureQuoteInput, TopPayoutsResponse, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, GameCategory } from './types';
1
+ import { Game, Proposition, SportSummary, GameEntry, DeviceContext, EntryFeatureOffer, EntryFeatureQuote, EntryFeatureQuoteInput, TopPayoutsResponse, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, GameCategory } from './types';
2
2
  export interface GamesListResponse {
3
3
  payload: Game[];
4
4
  how_to_play_markdown?: string | null;
@@ -9,6 +9,7 @@ export interface BladeApiClientConfig {
9
9
  fetchImpl?: typeof fetch;
10
10
  getAuthHeaders?: () => Promise<Record<string, string>> | Record<string, string>;
11
11
  }
12
+ export declare function cleanDeviceContext(ctx: unknown): Record<string, string> | undefined;
12
13
  export declare class BladeApiClient {
13
14
  private apiUrl;
14
15
  private apiKey?;
@@ -48,6 +49,7 @@ export declare class BladeApiClient {
48
49
  selections?: Record<number, 'yes' | 'no'>;
49
50
  stake?: number;
50
51
  rule_id?: number | null;
52
+ device_context?: DeviceContext;
51
53
  }): Promise<GameEntry>;
52
54
  getPayoutsDue(params?: {
53
55
  game_id?: number;
@@ -6,7 +6,7 @@ export interface CallGameCatalogueProps {
6
6
  games: Game[];
7
7
  selectedGame: Game | null;
8
8
  theme: BladeTheme;
9
- onPlay: (game: Game, count: number) => void;
9
+ onPlay: (game: Game, count: number, sport?: string) => void;
10
10
  maxPayouts?: Record<number, TopPayoutsResponse>;
11
11
  quickPickLoading?: boolean;
12
12
  tierFilter?: React.ReactNode;
@@ -14,6 +14,10 @@ export interface CategoryGamePreset {
14
14
  color: string;
15
15
  allowedMarkets: readonly string[];
16
16
  }
17
+ export interface GameEdition {
18
+ name: string;
19
+ sports: readonly string[];
20
+ }
17
21
  /**
18
22
  * Artwork a game library brings with it. Components includes basic-game artwork; the
19
23
  * provider merges every pack in `gameLibrary` for IconSvg and the shelf.
@@ -26,6 +30,8 @@ export interface GameArtwork {
26
30
  /** One SVG mark per category (currentColor + icon accent), drawn on the Shelf category banners' drawn covers. */
27
31
  categoryIcons?: Readonly<Record<string, string>>;
28
32
  catalogueImages?: Readonly<Record<string, string>>;
33
+ coverPatterns?: Readonly<Record<string, string>>;
34
+ editions?: Readonly<Record<string, readonly GameEdition[]>>;
29
35
  /** Shelf cover data URLs by icon id. */
30
36
  covers: Readonly<Record<string, string>>;
31
37
  /** Category presets that re-dress rule games as racing, prediction or fantasy products. */
@@ -60,3 +66,7 @@ export declare const GameArtworkContext: import('react').Context<GameArtwork>;
60
66
  export declare function useGameArtwork(): GameArtwork;
61
67
  /** Category and rule must match: a name alone must never change a game's meaning. */
62
68
  export declare function findCategoryGamePreset(game: Game, presets: readonly CategoryGamePreset[]): CategoryGamePreset | undefined;
69
+ export declare function gameEditions(game: Game, artwork: Pick<GameArtwork, 'editions'>): readonly GameEdition[];
70
+ export declare function brandGame<G extends Game | null | undefined>(game: G, sport: string | null | undefined, artwork: Pick<GameArtwork, 'editions'>): G;
71
+ export declare function editionTiles(games: readonly Game[], artwork: Pick<GameArtwork, 'editions'>): Game[];
72
+ export declare function editionSport(game: Game, name: string, artwork: Pick<GameArtwork, 'editions'>): string | undefined;
@@ -1,6 +1,6 @@
1
1
  import { Game } from './types';
2
2
  /** Icon ids the base can derive from a game. Artwork for optional games ships with @simple-parlay/games. */
3
- export type GameIconId = 'perfect_pick' | 'first_past_the_post' | '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
+ export type GameIconId = 'perfect_pick' | 'first_past_the_post' | 'head_to_head' | 'total_points' | 'quickpick' | 'safety_net' | 'ladder' | 'game_set' | 'pick_your_dividend' | 'mirror' | 'mirror_double' | 'mirror_triple' | 'same_game_multi' | 'six_again' | 'tipping_round' | 'tipping_match' | 'tipping_court' | 'tipping_week' | 'unknown';
4
4
  export declare const GAME_ICON_SCHEME = "game-icon:";
5
5
  /** Bundled base-game icons; optional game icons arrive with the game library (see GameArtwork). */
6
6
  export declare const GAME_ICON_SVG: Readonly<Record<string, string>>;
@@ -1,5 +1,5 @@
1
1
  import { BladeApiClient } from './api-client';
2
- import { Game, Proposition, GameEntry, TopPayoutsResponse, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, GameCategory } from './types';
2
+ import { Game, Proposition, GameEntry, DeviceContext, TopPayoutsResponse, EvaluateRuleRequest, EvaluateRuleResponse, CalculatePayoutRequest, CalculatePayoutResponse, EntryPreviewRequest, EntryPreviewResponse, GameCategory } from './types';
3
3
  export declare function useGames(apiClient: BladeApiClient, params?: {
4
4
  category?: GameCategory;
5
5
  jurisdiction?: string;
@@ -64,6 +64,7 @@ export declare function useCreateGameEntry(apiClient: BladeApiClient): {
64
64
  selections?: Record<number, "yes" | "no">;
65
65
  stake?: number;
66
66
  rule_id?: number | null;
67
+ device_context?: DeviceContext;
67
68
  }) => Promise<GameEntry>;
68
69
  loading: boolean;
69
70
  error: string | null;
@@ -87,4 +87,4 @@ export declare function drawnCover(style: DrawnCoverStyle, raw: string, { ink, g
87
87
  * 270 box, the back two at 30% and 55%. The mark fills the front tile like the app icon's: a game's in paper with
88
88
  * its citron accent; a single-colour glyph (a category's) all in citron, like the lockups' pills.
89
89
  */
90
- export declare function brandCover(raw: string, ink?: string, accent?: string): DrawnCover;
90
+ export declare function brandCover(raw: string, ink?: string, accent?: string, pattern?: string): DrawnCover;
@@ -255,6 +255,8 @@ export interface TopPayoutEntry {
255
255
  export interface TopPayoutsResponse {
256
256
  top_payouts: TopPayoutEntry[];
257
257
  }
258
+ export type DeviceContext = Record<string, string | number | boolean | null | undefined>;
259
+ export type DeviceContextProp = DeviceContext | (() => DeviceContext | Promise<DeviceContext>);
258
260
  export interface PlaceEntryFlowProps {
259
261
  apiUrl: string;
260
262
  apiKey?: string;
@@ -266,6 +268,7 @@ export interface PlaceEntryFlowProps {
266
268
  onRecharge?: () => void;
267
269
  onEntryPlaced?: (entry: GameEntry) => void;
268
270
  onBeforeSubmit?: (betAmount: number) => void | Promise<void>;
271
+ deviceContext?: DeviceContextProp;
269
272
  onCancel?: () => void;
270
273
  initialGameId?: number;
271
274
  gameCategory?: GameCategory;
@@ -319,6 +322,7 @@ export interface GameSelectorProps {
319
322
  games: Game[];
320
323
  selectedGame: Game | null;
321
324
  onSelectGame: (game: Game) => void;
325
+ onSelectSport?: (sport: string) => void;
322
326
  loading?: boolean;
323
327
  error?: string | null;
324
328
  theme?: BladeTheme | BladeThemeSet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-parlay/components",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "UI components, hooks, and utilities for React and React Native",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",