@enigma-lake/tower-play-controller-sdk 2.2.1 → 2.2.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.
@@ -1,14 +1,11 @@
1
1
  import { PlaySettingsProps } from "../../../types/playController";
2
2
  import { RiskTypes } from "./types";
3
- declare const DifficultySelector: ({ playOptions, dropdownConfig, }: {
3
+ declare const DifficultySelector: ({ playOptions, dropdownConfig, isClassicGame, }: {
4
4
  playOptions: PlaySettingsProps;
5
5
  dropdownConfig: {
6
- bgColorHex: string;
7
- riskColorConfig: {
8
- [RiskTypes.LOW]: string;
9
- [RiskTypes.MEDIUM]: string;
10
- [RiskTypes.HIGH]: string;
11
- };
6
+ bgColorHex?: string;
7
+ riskColorConfig?: Partial<Record<RiskTypes, string>>;
12
8
  };
9
+ isClassicGame?: boolean;
13
10
  }) => import("react/jsx-runtime").JSX.Element;
14
11
  export default DifficultySelector;
@@ -1,3 +1,3 @@
1
1
  import { SelectorProps } from "./types";
2
- declare const Selector: <T>({ currentValue, label, riskColor, values, onSelect, disabled, }: SelectorProps<T>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Selector: <T>({ currentValue, label, riskColor, values, onSelect, disabled, isClassicGame, formatDisplay, }: SelectorProps<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Selector;
@@ -5,6 +5,8 @@ export interface SelectorProps<T> {
5
5
  riskColor: string;
6
6
  disabled: boolean;
7
7
  currentValue: T;
8
+ isClassicGame?: boolean;
9
+ formatDisplay?: (value: T) => string;
8
10
  }
9
11
  export declare enum SELECTORS {
10
12
  RISK = "Risk"
@@ -14,3 +16,4 @@ export declare enum RiskTypes {
14
16
  MEDIUM = "MEDIUM",
15
17
  HIGH = "HIGH"
16
18
  }
19
+ export declare const DEFAULT_RISK_COLORS: Record<RiskTypes, string>;
@@ -1,13 +1,14 @@
1
1
  export interface FreeRoundsIntroModalProps {
2
2
  open: boolean;
3
3
  roundsRemaining: number;
4
- totalRounds?: number;
4
+ totalRounds: number;
5
5
  stakeCents: number;
6
6
  coinType?: number;
7
7
  currency?: string;
8
8
  decimals?: number;
9
+ expiresAt?: string | number | Date;
9
10
  onPlayNow?: () => void;
10
11
  onPlayLater?: () => void;
11
12
  }
12
- declare const FreeRoundsIntroModal: ({ open, roundsRemaining, stakeCents, coinType, currency, decimals, onPlayNow, onPlayLater, }: FreeRoundsIntroModalProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const FreeRoundsIntroModal: ({ open, roundsRemaining, stakeCents, coinType, currency, decimals, expiresAt, onPlayNow, onPlayLater, }: FreeRoundsIntroModalProps) => import("react/jsx-runtime").JSX.Element;
13
14
  export default FreeRoundsIntroModal;
@@ -0,0 +1,11 @@
1
+ export declare const resolveFreeRoundsCoinLabel: ({ coinType, currency, }: {
2
+ coinType?: number;
3
+ currency?: string;
4
+ }) => string;
5
+ export declare const resolveFreeRoundsDecimals: ({ coinType, currency, fallback, }: {
6
+ coinType?: number;
7
+ currency?: string;
8
+ fallback: number;
9
+ }) => number;
10
+ export declare const resolveCoinLabelDecimals: (coin: string) => number;
11
+ export declare const computeExpiresInDays: (expiresAt: string | number | Date | null | undefined, now?: number) => number | null;
@@ -0,0 +1,9 @@
1
+ export interface FreeRoundsSummaryModalProps {
2
+ totalWinAmount: number;
3
+ coin: string;
4
+ roundsPlayed: number;
5
+ decimals?: number;
6
+ onClose: () => void;
7
+ }
8
+ declare const FreeRoundsSummaryModal: ({ totalWinAmount, coin, roundsPlayed, decimals, onClose, }: FreeRoundsSummaryModalProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default FreeRoundsSummaryModal;
@@ -0,0 +1,3 @@
1
+ import FreeRoundsSummaryModal from "./FreeRoundsSummaryModal";
2
+ export type { FreeRoundsSummaryModalProps } from "./FreeRoundsSummaryModal";
3
+ export default FreeRoundsSummaryModal;
@@ -30,13 +30,11 @@ export declare const usePlayController: () => {
30
30
  togglePlayAmountView: () => void;
31
31
  };
32
32
  freeRounds: {
33
- isAvailable: boolean;
34
33
  isEngaged: boolean;
35
34
  roundsRemaining: number;
36
35
  totalRounds: number;
37
36
  stakeCents: number;
38
37
  coinType: number | undefined;
39
38
  currency: string | undefined;
40
- onUseFreeRounds: (() => void) | undefined;
41
39
  };
42
40
  };
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from "react";
2
+ import { SupportedLanguage } from "./types";
3
+ import { Translator } from "./translator";
4
+ interface I18nContextValue {
5
+ language: SupportedLanguage;
6
+ t: Translator;
7
+ }
8
+ export declare const I18nProvider: ({ language, children, }: {
9
+ language?: string;
10
+ children: ReactNode;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const useTranslation: () => I18nContextValue;
13
+ export {};
@@ -0,0 +1,5 @@
1
+ export type { Messages, MessageKey, SupportedLanguage, TranslationParams, } from "./types";
2
+ export { SUPPORTED_LANGUAGE_CODES } from "./types";
3
+ export { DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, resolveLanguage, createTranslator, } from "./translator";
4
+ export type { Translator } from "./translator";
5
+ export { I18nProvider, useTranslation } from "./I18nContext";
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "../types";
2
+ export declare const en: Messages;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "../types";
2
+ export declare const zhCN: Messages;
@@ -0,0 +1,5 @@
1
+ import { DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, resolveLanguage, type SupportedLanguage, type Translator as GenericTranslator } from "@enigma-lake/zoot-platform-sdk";
2
+ import { MessageKey } from "./types";
3
+ export type Translator = GenericTranslator<MessageKey>;
4
+ export declare const createTranslator: (language: SupportedLanguage) => Translator;
5
+ export { DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, resolveLanguage };
@@ -0,0 +1,41 @@
1
+ export { SUPPORTED_LANGUAGE_CODES } from "@enigma-lake/zoot-platform-sdk";
2
+ export type { SupportedLanguage, TranslationParams, } from "@enigma-lake/zoot-platform-sdk";
3
+ export type Messages = {
4
+ playNow: string;
5
+ playFreeRound: string;
6
+ selectPlayAmount: string;
7
+ cashout: string;
8
+ collect: string;
9
+ doubleTitle: string;
10
+ doubleSubtitle: string;
11
+ startAutoplay: string;
12
+ stopAutoplay: string;
13
+ numberOfPlays: string;
14
+ selectPlayAmountAria: string;
15
+ playAmountLabel: string;
16
+ autoLabel: string;
17
+ selectTileToast: string;
18
+ riskLabel: string;
19
+ riskLow: string;
20
+ riskMedium: string;
21
+ riskHigh: string;
22
+ freeRoundLeftOne: string;
23
+ freeRoundLeftOther: string;
24
+ freeRoundsModalTitle: string;
25
+ freeRoundsHave: string;
26
+ freeRoundsUnitOne: string;
27
+ freeRoundsUnitOther: string;
28
+ freeRoundsPerRound: string;
29
+ freeRoundsExpiresIn: string;
30
+ dayUnitOne: string;
31
+ dayUnitOther: string;
32
+ freeRoundsModalPlayNow: string;
33
+ freeRoundsModalPlayLater: string;
34
+ freeRoundsSummaryWon: string;
35
+ freeRoundsSummaryIn: string;
36
+ freeRoundsSummaryUnitOne: string;
37
+ freeRoundsSummaryUnitOther: string;
38
+ freeRoundsSummaryCredited: string;
39
+ freeRoundsSummaryClose: string;
40
+ };
41
+ export type MessageKey = keyof Messages;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import { CurrencyProps, PlayLimitsV2 } from '@enigma-lake/zoot-platform-sdk';
2
+ import { CurrencyProps, SupportedLanguage, PlayLimitsV2, Translator as Translator$1 } from '@enigma-lake/zoot-platform-sdk';
3
+ export { DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, SUPPORTED_LANGUAGE_CODES, SupportedLanguage, TranslationParams, resolveLanguage } from '@enigma-lake/zoot-platform-sdk';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
 
5
6
  declare enum GAME_MODE {
@@ -33,6 +34,47 @@ declare enum RiskTypes {
33
34
  MEDIUM = "MEDIUM",
34
35
  HIGH = "HIGH"
35
36
  }
37
+ declare const DEFAULT_RISK_COLORS: Record<RiskTypes, string>;
38
+
39
+ type Messages = {
40
+ playNow: string;
41
+ playFreeRound: string;
42
+ selectPlayAmount: string;
43
+ cashout: string;
44
+ collect: string;
45
+ doubleTitle: string;
46
+ doubleSubtitle: string;
47
+ startAutoplay: string;
48
+ stopAutoplay: string;
49
+ numberOfPlays: string;
50
+ selectPlayAmountAria: string;
51
+ playAmountLabel: string;
52
+ autoLabel: string;
53
+ selectTileToast: string;
54
+ riskLabel: string;
55
+ riskLow: string;
56
+ riskMedium: string;
57
+ riskHigh: string;
58
+ freeRoundLeftOne: string;
59
+ freeRoundLeftOther: string;
60
+ freeRoundsModalTitle: string;
61
+ freeRoundsHave: string;
62
+ freeRoundsUnitOne: string;
63
+ freeRoundsUnitOther: string;
64
+ freeRoundsPerRound: string;
65
+ freeRoundsExpiresIn: string;
66
+ dayUnitOne: string;
67
+ dayUnitOther: string;
68
+ freeRoundsModalPlayNow: string;
69
+ freeRoundsModalPlayLater: string;
70
+ freeRoundsSummaryWon: string;
71
+ freeRoundsSummaryIn: string;
72
+ freeRoundsSummaryUnitOne: string;
73
+ freeRoundsSummaryUnitOther: string;
74
+ freeRoundsSummaryCredited: string;
75
+ freeRoundsSummaryClose: string;
76
+ };
77
+ type MessageKey = keyof Messages;
36
78
 
37
79
  /**
38
80
  * Styling / theme-related props for the controller.
@@ -41,26 +83,22 @@ declare enum RiskTypes {
41
83
  type StylingWithRisk = {
42
84
  panel: {
43
85
  bottom?: string;
44
- bgColorHex: string;
86
+ bgColorHex?: string;
45
87
  bgColorOpacity?: number;
46
88
  };
47
89
  dropdown: {
48
- bgColorHex: string;
49
- riskColorConfig: {
50
- [RiskTypes.LOW]: string;
51
- [RiskTypes.MEDIUM]: string;
52
- [RiskTypes.HIGH]: string;
53
- };
90
+ bgColorHex?: string;
91
+ riskColorConfig?: Partial<Record<RiskTypes, string>>;
54
92
  };
55
93
  };
56
94
  type StylingWithoutRisk = {
57
95
  panel: {
58
96
  bottom?: string;
59
- bgColorHex: string;
97
+ bgColorHex?: string;
60
98
  bgColorOpacity?: number;
61
99
  };
62
100
  dropdown: {
63
- bgColorHex: string;
101
+ bgColorHex?: string;
64
102
  };
65
103
  };
66
104
  /**
@@ -134,14 +172,15 @@ type DoubleOrNothingProps = {
134
172
  onDoubleOrNothingClose: () => void;
135
173
  };
136
174
  type FreeRoundsOptionsProps = {
137
- available: boolean;
138
175
  engaged: boolean;
176
+ supportsGrantFundedAutoplay?: boolean;
139
177
  roundsRemaining: number;
140
178
  totalRounds: number;
141
179
  stakeCents: number;
142
180
  coinType?: number;
143
181
  currency?: string;
144
- onUseFreeRounds?: () => void;
182
+ expiresAt?: string | number | Date;
183
+ autoplayActive?: boolean;
145
184
  showIntroModal?: boolean;
146
185
  onPlayNow?: () => void;
147
186
  onPlayLater?: () => void;
@@ -168,6 +207,7 @@ type BaseControllerCommon = {
168
207
  leftWidgets: Widget[];
169
208
  rightWidgets: Widget[];
170
209
  centerWidgets: Widget[];
210
+ language?: SupportedLanguage | string;
171
211
  /**
172
212
  * Optional so existing integrations don't break.
173
213
  * If you want it required, remove the `?`.
@@ -182,9 +222,12 @@ type BaseControllerCommon = {
182
222
  isClassicGame?: boolean;
183
223
  classicGame?: ClassicGameProps;
184
224
  /**
185
- * Optional free-rounds config. When present, the manual controller surfaces
186
- * a "Use Free Rounds (N)" affordance and, once engaged, locks the stake to
187
- * the grant. Manual-mode only.
225
+ * Optional free-rounds config. Engagement is binary via the intro modal
226
+ * (PLAY NOW / PLAY LATER). When engaged, the per-round value is locked to
227
+ * the grant and a "{N} FREE ROUNDS LEFT" footer renders. When not engaged,
228
+ * the controller renders exactly as if the user had no free rounds.
229
+ * Manual-mode only unless the game opts into grant-funded autoplay via
230
+ * `supportsGrantFundedAutoplay`.
188
231
  */
189
232
  freeRoundsOptions?: FreeRoundsOptionsProps;
190
233
  };
@@ -301,14 +344,37 @@ declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>
301
344
  interface FreeRoundsIntroModalProps {
302
345
  open: boolean;
303
346
  roundsRemaining: number;
304
- totalRounds?: number;
347
+ totalRounds: number;
305
348
  stakeCents: number;
306
349
  coinType?: number;
307
350
  currency?: string;
308
351
  decimals?: number;
352
+ expiresAt?: string | number | Date;
309
353
  onPlayNow?: () => void;
310
354
  onPlayLater?: () => void;
311
355
  }
312
- declare const FreeRoundsIntroModal: ({ open, roundsRemaining, stakeCents, coinType, currency, decimals, onPlayNow, onPlayLater, }: FreeRoundsIntroModalProps) => react_jsx_runtime.JSX.Element;
356
+ declare const FreeRoundsIntroModal: ({ open, roundsRemaining, stakeCents, coinType, currency, decimals, expiresAt, onPlayNow, onPlayLater, }: FreeRoundsIntroModalProps) => react_jsx_runtime.JSX.Element;
357
+
358
+ interface FreeRoundsSummaryModalProps {
359
+ totalWinAmount: number;
360
+ coin: string;
361
+ roundsPlayed: number;
362
+ decimals?: number;
363
+ onClose: () => void;
364
+ }
365
+ declare const FreeRoundsSummaryModal: ({ totalWinAmount, coin, roundsPlayed, decimals, onClose, }: FreeRoundsSummaryModalProps) => react_jsx_runtime.JSX.Element;
366
+
367
+ type Translator = Translator$1<MessageKey>;
368
+ declare const createTranslator: (language: SupportedLanguage) => Translator;
369
+
370
+ interface I18nContextValue {
371
+ language: SupportedLanguage;
372
+ t: Translator;
373
+ }
374
+ declare const I18nProvider: ({ language, children, }: {
375
+ language?: string;
376
+ children: ReactNode;
377
+ }) => react_jsx_runtime.JSX.Element;
378
+ declare const useTranslation: () => I18nContextValue;
313
379
 
314
- export { AUTO_PLAY_STATE, AutoManualPlayProvider, DOUBLE_OR_NOTHING_STATE, FreeRoundsIntroModal, type FreeRoundsIntroModalProps, type FreeRoundsOptionsProps, GAME_MODE, type PlayControllerProps, type PlayControllerWithRisk, type PlayControllerWithoutRisk, WIDGET, type Widget, canAutoplaySpaceTrigger, createAutoplayButtonAction, createManualCashoutClickHandler, format, isAutoplayButtonDisabled, isManualCashoutDisabled };
380
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, DEFAULT_RISK_COLORS, DOUBLE_OR_NOTHING_STATE, FreeRoundsIntroModal, type FreeRoundsIntroModalProps, type FreeRoundsOptionsProps, FreeRoundsSummaryModal, type FreeRoundsSummaryModalProps, GAME_MODE, I18nProvider, type MessageKey, type Messages, type PlayControllerProps, type PlayControllerWithRisk, type PlayControllerWithoutRisk, type Translator, WIDGET, type Widget, canAutoplaySpaceTrigger, createAutoplayButtonAction, createManualCashoutClickHandler, createTranslator, format, isAutoplayButtonDisabled, isManualCashoutDisabled, useTranslation };