@oddsmith/ui 1.0.7 → 1.1.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,6 +1,6 @@
1
1
  import { LitElement, nothing } from 'lit';
2
2
  import { CasinoStore } from '../../store';
3
- import { TableView } from './types/view.js';
3
+ import { TablePlayer, TableView } from './types/view.js';
4
4
  import { TableSectionHost } from './table-section.host.js';
5
5
  /** Top-players preview — pinned current user, golden CTA. */
6
6
  export declare class OsLeaderboardCasinoTable extends LitElement implements TableSectionHost {
@@ -30,7 +30,8 @@ export declare class OsLeaderboardCasinoTable extends LitElement implements Tabl
30
30
  get emptyMessage(): string;
31
31
  get showPinned(): boolean;
32
32
  get yourPositionLabel(): string;
33
- onOpenClick(): void;
33
+ onCtaClick(): void;
34
+ onPlayerClick(player: TablePlayer): void;
34
35
  private resolvePlayerPrizeLabel;
35
36
  private renderRankChange;
36
37
  private renderMedal;
@@ -16,7 +16,7 @@ export interface TableSectionHost {
16
16
  emptyMessage: string;
17
17
  showPinned: boolean;
18
18
  yourPositionLabel: string;
19
- onOpenClick(): void;
19
+ onCtaClick(): void;
20
20
  renderPlayers(): LitTemplate;
21
21
  renderPinnedRow(): LitTemplate;
22
22
  }
@@ -1,9 +1,14 @@
1
1
  /** Custom events from the table section. */
2
2
  export declare const TableEvents: {
3
- /** Table CTA — current player (`isYou`). */
3
+ /** Table CTA — `players[].id` of the first `isYou: true`. */
4
+ readonly cta: "cta-click";
5
+ /** Table row — that player's `players[].id`. */
4
6
  readonly open: "leaderboard-player-open";
5
7
  };
6
8
  export type TableEventName = (typeof TableEvents)[keyof typeof TableEvents];
9
+ export interface TableCtaDetail {
10
+ playerId: string;
11
+ }
7
12
  export interface TableOpenDetail {
8
13
  playerId: string;
9
14
  }
@@ -1,9 +1,9 @@
1
- import { LeaderboardData, LeaderboardStatus, HeroView, PrizeView, StatsView, GamesView, ClimbView, TableView, MarqueeView, EventsBannerView, FooterView, LegalsView } from '../types';
1
+ import { ResolvedLeaderboardData, LeaderboardStatus, HeroView, PrizeView, StatsView, GamesView, ClimbView, TableView, MarqueeView, EventsBannerView, FooterView, LegalsView } from '../types';
2
2
  /**
3
3
  * Data-only store for a single board instance.
4
4
  * Bootstrap hydrates once; sections pull view slices via getters.
5
5
  *
6
- * Views are projected from {@link LeaderboardData} only — no demo/fallback fill-in.
6
+ * Views are projected from {@link ResolvedLeaderboardData} only — no demo/fallback fill-in.
7
7
  * Image URLs are copied from host data as-is.
8
8
  */
9
9
  export declare class CasinoStore {
@@ -11,11 +11,16 @@ export declare class CasinoStore {
11
11
  private demo;
12
12
  /** Demo countdown roll — only if the campaign was not already over at hydrate. */
13
13
  private demoRollClock;
14
- hydrate(data: LeaderboardData, demo?: boolean): void;
14
+ /** First `isYou: true` in `players[]`, resolved once per hydrate. */
15
+ private you;
16
+ private youIndex;
17
+ hydrate(data: ResolvedLeaderboardData, demo?: boolean): void;
15
18
  clear(): void;
16
19
  isReady(): boolean;
17
20
  isDemo(): boolean;
18
- getData(): LeaderboardData;
21
+ getData(): ResolvedLeaderboardData;
22
+ /** `players[].id` of the first `isYou: true`. Empty string if none. */
23
+ getCurrentUserId(): string;
19
24
  /**
20
25
  * Derived from data.hero startsAt / endsAt / cancelled.
21
26
  * Demo boards that loaded already finished stay finished.
@@ -33,5 +38,6 @@ export declare class CasinoStore {
33
38
  getEventsBannerView(): EventsBannerView | undefined;
34
39
  getFooterView(): FooterView;
35
40
  getLegalsView(): LegalsView | undefined;
41
+ private cacheCurrentUser;
36
42
  private requireData;
37
43
  }
@@ -15,26 +15,11 @@ export type { PlayerData } from '../sections/table-section/types/data.js';
15
15
  export type { MarqueeItemData, MarqueeData, } from '../sections/marquee-section/types/data.js';
16
16
  export type { EventItemData, EventsData, } from '../sections/events-banner/types/data.js';
17
17
  export type { ExternalLegalLink, InternalLegalLink, LegalLinkData, LegalsData, } from '../sections/legals-section/types/data.js';
18
- /** Resolved campaign. The store always sees this shape after mix. */
19
- export type LeaderboardData = {
20
- hero: HeroData;
21
- /** ISO 4217 (e.g. `USD`). Applies to every money amount. */
22
- currency: string;
23
- /** BCP 47 tag (e.g. `en-US`). Drives all date and number formatting. */
24
- locale: string;
25
- games?: GameData[];
26
- prizes?: PrizeData[];
27
- players?: PlayerData[];
28
- stats?: StatsData;
29
- marquee?: MarqueeData;
30
- events?: EventsData;
31
- legals?: LegalsData;
32
- };
33
18
  /**
34
- * Host `.data` input.
19
+ * Host `.data` (`LeaderboardHostProps.data`).
35
20
  * Mix rule: omit key → default. null → unmount. [] → empty copy. Keys mix. Arrays replace (no row merge).
36
21
  */
37
- export type LeaderboardDataInput = {
22
+ export type LeaderboardData = {
38
23
  hero?: Partial<HeroData>;
39
24
  currency?: string;
40
25
  locale?: string;
@@ -47,3 +32,20 @@ export type LeaderboardDataInput = {
47
32
  events?: Partial<EventsData> | null;
48
33
  legals?: Partial<LegalsData> | null;
49
34
  };
35
+ /**
36
+ * Campaign after mix. Store / producer only — not on the public package entry.
37
+ */
38
+ export type ResolvedLeaderboardData = {
39
+ hero: HeroData;
40
+ /** ISO 4217 (e.g. `USD`). Applies to every money amount. */
41
+ currency: string;
42
+ /** BCP 47 tag (e.g. `en-US`). Drives all date and number formatting. */
43
+ locale: string;
44
+ games?: GameData[];
45
+ prizes?: PrizeData[];
46
+ players?: PlayerData[];
47
+ stats?: StatsData;
48
+ marquee?: MarqueeData;
49
+ events?: EventsData;
50
+ legals?: LegalsData;
51
+ };
@@ -1,10 +1,10 @@
1
1
  import { LeaderboardLabels } from './labels.js';
2
2
  import { LeaderboardTheme } from './theme.js';
3
- import { LeaderboardDataInput } from './data.js';
3
+ import { LeaderboardData } from './data.js';
4
4
  /**
5
5
  * Host input — the only props the public TypeScript contract accepts.
6
6
  *
7
- * Assign these with `setProps({ labels, theme, data })`, then `mount(host)`.
7
+ * Pass these to `new OsLeaderboardCasino({ labels, theme, data })`, then `mount(host)`.
8
8
  * Omit all three for the hardcoded campaign, labels, and theme.
9
9
  *
10
10
  * `.labels`: omit for defaults. If set, the full bag is required.
@@ -20,5 +20,5 @@ export interface LeaderboardHostProps {
20
20
  /** Omit → DEFAULT_THEME. Set → per-key mix; invalid CSS falls back. */
21
21
  theme?: Partial<LeaderboardTheme>;
22
22
  /** Omit → hardcoded campaign. Set → per-key mix onto that campaign. */
23
- data?: LeaderboardDataInput;
23
+ data?: LeaderboardData;
24
24
  }
@@ -6,7 +6,7 @@ export type { SectionId, CasinoSectionConfig } from './config.js';
6
6
  export type { LeaderboardLabels, StatusLabels, CtaLabels, } from './labels.js';
7
7
  export type { LeaderboardTheme } from './theme.js';
8
8
  export type { LeaderboardStatus } from './status.js';
9
- export type { LeaderboardData, LeaderboardDataInput, HeroData, PrizeData, StatsData, GameData, PlayerData, MarqueeItemData, MarqueeData, EventItemData, EventsData, ExternalLegalLink, InternalLegalLink, LegalLinkData, LegalsData, } from './data.js';
9
+ export type { LeaderboardData, ResolvedLeaderboardData, HeroData, PrizeData, StatsData, GameData, PlayerData, MarqueeItemData, MarqueeData, EventItemData, EventsData, ExternalLegalLink, InternalLegalLink, LegalLinkData, LegalsData, } from './data.js';
10
10
  export type { LeaderboardHostProps } from './host.js';
11
11
  export type { MarqueeItem, MarqueeView } from '../sections/marquee-section/types/view.js';
12
12
  export type { MarqueeLabels } from '../sections/marquee-section/types/labels.js';
@@ -28,7 +28,7 @@ export type { ClimbView } from '../sections/climb-section/types/view.js';
28
28
  export type { ClimbLabels } from '../sections/climb-section/types/labels.js';
29
29
  export type { TablePlayer, TableView } from '../sections/table-section/types/view.js';
30
30
  export type { TableLabels } from '../sections/table-section/types/labels.js';
31
- export type { TableEventName, TableOpenDetail, } from '../sections/table-section/types/events.js';
31
+ export type { TableEventName, TableCtaDetail, TableOpenDetail, } from '../sections/table-section/types/events.js';
32
32
  export { TableEvents } from '../sections/table-section/types/events.js';
33
33
  export type { FooterView } from '../sections/footer-section/types/view.js';
34
34
  export type { LegalLink, LegalsView } from '../sections/legals-section/types/view.js';
@@ -14,10 +14,10 @@ export type { TableLabels } from '../sections/table-section/types/labels.js';
14
14
  export type { MarqueeLabels } from '../sections/marquee-section/types/labels.js';
15
15
  export type { EventsLabels } from '../sections/events-banner/types/labels.js';
16
16
  export type { LegalsLabels } from '../sections/legals-section/types/labels.js';
17
- export type { LeaderboardData, LeaderboardDataInput, HeroData, PrizeData, StatsData, GameData, PlayerData, MarqueeItemData, MarqueeData, EventItemData, EventsData, ExternalLegalLink, InternalLegalLink, LegalLinkData, LegalsData, } from './data.js';
17
+ export type { LeaderboardData, HeroData, PrizeData, StatsData, GameData, PlayerData, MarqueeItemData, MarqueeData, EventItemData, EventsData, ExternalLegalLink, InternalLegalLink, LegalLinkData, LegalsData, } from './data.js';
18
18
  export { PrizeEvents } from '../sections/prize-section/types/events.js';
19
19
  export type { PrizeClickDetail } from '../sections/prize-section/types/events.js';
20
20
  export { TableEvents } from '../sections/table-section/types/events.js';
21
- export type { TableOpenDetail } from '../sections/table-section/types/events.js';
21
+ export type { TableCtaDetail, TableOpenDetail } from '../sections/table-section/types/events.js';
22
22
  export { EventsEvents } from '../sections/events-banner/types/events.js';
23
23
  export type { EventsClickDetail } from '../sections/events-banner/types/events.js';
@@ -1,6 +1,6 @@
1
- import { LeaderboardData, LeaderboardDataInput } from '../types';
1
+ import { LeaderboardData, ResolvedLeaderboardData } from '../types';
2
2
  /**
3
3
  * Mix a partial host `.data` onto a hardcoded campaign.
4
4
  * Mix rule: omit key → default. null → unmount. [] → empty copy. Keys mix. Arrays replace (no row merge).
5
5
  */
6
- export declare function resolveLeaderboardData(input?: LeaderboardDataInput | null, logPrefix?: string, fallback?: LeaderboardData): LeaderboardData;
6
+ export declare function resolveLeaderboardData(input?: LeaderboardData | null, logPrefix?: string, fallback?: ResolvedLeaderboardData): ResolvedLeaderboardData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddsmith/ui",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "Brandable casino leaderboard web component",
5
5
  "keywords": [
6
6
  "casino",