@enigma-lake/tower-play-controller-sdk 2.0.24 → 2.0.25

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 (28) hide show
  1. package/dist/components/base/DifficultySelector/DifficultySelector.d.ts +4 -7
  2. package/dist/components/base/DifficultySelector/Selector.d.ts +1 -1
  3. package/dist/components/base/DifficultySelector/types.d.ts +3 -0
  4. package/dist/components/base/FreeRoundsIntroModal/FreeRoundsIntroModal.d.ts +14 -0
  5. package/dist/components/base/FreeRoundsIntroModal/freeRoundsCoin.d.ts +11 -0
  6. package/dist/components/base/FreeRoundsIntroModal/index.d.ts +3 -0
  7. package/dist/components/base/FreeRoundsSummaryModal/FreeRoundsSummaryModal.d.ts +9 -0
  8. package/dist/components/base/FreeRoundsSummaryModal/index.d.ts +3 -0
  9. package/dist/components/base/GroupRow/GroupRow.d.ts +2 -1
  10. package/dist/components/base/Input/Input.d.ts +3 -1
  11. package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +2 -1
  12. package/dist/components/base/PlayController/PlayController.d.ts +2 -1
  13. package/dist/components/base/PlayValueInput/PlayValueInput.d.ts +2 -1
  14. package/dist/components/hooks/usePlayController.d.ts +8 -0
  15. package/dist/components/hooks/useSpacebarButtonTrigger.d.ts +2 -1
  16. package/dist/i18n/I18nContext.d.ts +13 -0
  17. package/dist/i18n/index.d.ts +5 -0
  18. package/dist/i18n/locales/en.d.ts +2 -0
  19. package/dist/i18n/locales/zh-CN.d.ts +2 -0
  20. package/dist/i18n/translator.d.ts +5 -0
  21. package/dist/i18n/types.d.ts +41 -0
  22. package/dist/index.d.ts +132 -11
  23. package/dist/index.mjs +594 -115
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/style.css +1 -1
  26. package/dist/types/index.d.ts +2 -2
  27. package/dist/types/playController.d.ts +52 -9
  28. package/package.json +9 -2
@@ -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>;
@@ -0,0 +1,14 @@
1
+ export interface FreeRoundsIntroModalProps {
2
+ open: boolean;
3
+ roundsRemaining: number;
4
+ totalRounds: number;
5
+ stakeCents: number;
6
+ coinType?: number;
7
+ currency?: string;
8
+ decimals?: number;
9
+ expiresAt?: string | number | Date;
10
+ onPlayNow?: () => void;
11
+ onPlayLater?: () => void;
12
+ }
13
+ declare const FreeRoundsIntroModal: ({ open, roundsRemaining, stakeCents, coinType, currency, decimals, expiresAt, onPlayNow, onPlayLater, }: FreeRoundsIntroModalProps) => import("react/jsx-runtime").JSX.Element;
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,3 @@
1
+ import FreeRoundsIntroModal from "./FreeRoundsIntroModal";
2
+ export type { FreeRoundsIntroModalProps } from "./FreeRoundsIntroModal";
3
+ export default FreeRoundsIntroModal;
@@ -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;
@@ -1,6 +1,7 @@
1
1
  import { ComponentProps } from "react";
2
2
  export type Props = ComponentProps<"div"> & {
3
+ isClassicGame?: boolean;
3
4
  label?: string;
4
5
  };
5
- declare const GroupRow: ({ children, label, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ declare const GroupRow: ({ children, label, className, isClassicGame, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
6
7
  export default GroupRow;
@@ -1,3 +1,5 @@
1
1
  import React from "react";
2
- declare const Input: ({ onChange, disabled, className, max, ...restProps }: React.ComponentProps<"input">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Input: ({ onChange, disabled, className, max, isClassicGame, ...restProps }: React.ComponentProps<"input"> & {
3
+ isClassicGame?: boolean;
4
+ }) => import("react/jsx-runtime").JSX.Element;
3
5
  export default Input;
@@ -6,6 +6,7 @@ export type Props = PropsWithChildren<ComponentProps<"input">> & {
6
6
  enabled: boolean;
7
7
  disabled: boolean;
8
8
  };
9
+ isClassicGame?: boolean;
9
10
  };
10
- declare const InputWithSwitch: ({ children, switcherConfig, disabled, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ declare const InputWithSwitch: ({ children, switcherConfig, disabled, className, isClassicGame, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
11
12
  export default InputWithSwitch;
@@ -1,6 +1,7 @@
1
1
  interface PlayAmountControlProps {
2
2
  isDisabled: () => boolean;
3
3
  forceRefresh: () => void;
4
+ lockCurrency?: boolean;
4
5
  }
5
- declare const PlayAmountControl: ({ isDisabled, forceRefresh, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const PlayAmountControl: ({ isDisabled, forceRefresh, lockCurrency, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
6
7
  export default PlayAmountControl;
@@ -3,6 +3,7 @@ export type Props = PropsWithChildren<ComponentProps<"div">> & {
3
3
  disabled: boolean;
4
4
  onClick: () => void;
5
5
  value: string;
6
+ isClassicGame?: boolean;
6
7
  };
7
- declare const PlayValueInput: ({ disabled, children, className, value, onClick, }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ declare const PlayValueInput: ({ disabled, children, className, value, onClick, isClassicGame, }: Props) => import("react/jsx-runtime").JSX.Element;
8
9
  export default PlayValueInput;
@@ -29,4 +29,12 @@ export declare const usePlayController: () => {
29
29
  setDisplayPlayAmountView: (v: boolean) => void;
30
30
  togglePlayAmountView: () => void;
31
31
  };
32
+ freeRounds: {
33
+ isEngaged: boolean;
34
+ roundsRemaining: number;
35
+ totalRounds: number;
36
+ stakeCents: number;
37
+ coinType: number | undefined;
38
+ currency: string | undefined;
39
+ };
32
40
  };
@@ -3,6 +3,7 @@ type UseSpacebarButtonTriggerParams = {
3
3
  roleButton: GAME_MODE;
4
4
  activeClassName: string;
5
5
  canTrigger: () => boolean;
6
+ suppressed?: boolean;
6
7
  };
7
- export declare const useSpacebarButtonTrigger: ({ roleButton, activeClassName, canTrigger, }: UseSpacebarButtonTriggerParams) => void;
8
+ export declare const useSpacebarButtonTrigger: ({ roleButton, activeClassName, canTrigger, suppressed, }: UseSpacebarButtonTriggerParams) => void;
8
9
  export {};
@@ -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,7 @@
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';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
5
 
4
6
  declare enum GAME_MODE {
5
7
  MANUAL = "manual",
@@ -32,6 +34,47 @@ declare enum RiskTypes {
32
34
  MEDIUM = "MEDIUM",
33
35
  HIGH = "HIGH"
34
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;
35
78
 
36
79
  /**
37
80
  * Styling / theme-related props for the controller.
@@ -40,26 +83,22 @@ declare enum RiskTypes {
40
83
  type StylingWithRisk = {
41
84
  panel: {
42
85
  bottom?: string;
43
- bgColorHex: string;
86
+ bgColorHex?: string;
44
87
  bgColorOpacity?: number;
45
88
  };
46
89
  dropdown: {
47
- bgColorHex: string;
48
- riskColorConfig: {
49
- [RiskTypes.LOW]: string;
50
- [RiskTypes.MEDIUM]: string;
51
- [RiskTypes.HIGH]: string;
52
- };
90
+ bgColorHex?: string;
91
+ riskColorConfig?: Partial<Record<RiskTypes, string>>;
53
92
  };
54
93
  };
55
94
  type StylingWithoutRisk = {
56
95
  panel: {
57
96
  bottom?: string;
58
- bgColorHex: string;
97
+ bgColorHex?: string;
59
98
  bgColorOpacity?: number;
60
99
  };
61
100
  dropdown: {
62
- bgColorHex: string;
101
+ bgColorHex?: string;
63
102
  };
64
103
  };
65
104
  /**
@@ -132,6 +171,34 @@ type DoubleOrNothingProps = {
132
171
  onDoubleOrNothingOpen: () => void;
133
172
  onDoubleOrNothingClose: () => void;
134
173
  };
174
+ type FreeRoundsOptionsProps = {
175
+ engaged: boolean;
176
+ supportsGrantFundedAutoplay?: boolean;
177
+ roundsRemaining: number;
178
+ totalRounds: number;
179
+ stakeCents: number;
180
+ coinType?: number;
181
+ currency?: string;
182
+ expiresAt?: string | number | Date;
183
+ autoplayActive?: boolean;
184
+ showIntroModal?: boolean;
185
+ onPlayNow?: () => void;
186
+ onPlayLater?: () => void;
187
+ };
188
+ /**
189
+ * Classic-game layout opts. So towers
190
+ * can opt into the same left-rail layout used by classic.
191
+ *
192
+ * Both fields are OPTIONAL. Omitting `classicGame` (or omitting
193
+ * `isClassicGame`) keeps the controller rendering exactly as today — so
194
+ * existing tower integrations are unaffected.
195
+ */
196
+ type ClassicGameProps = {
197
+ forceLeftStyle?: boolean;
198
+ dropdown?: {
199
+ bgColorHex: string;
200
+ };
201
+ };
135
202
  /**
136
203
  * Common controller props that don't depend on the flag.
137
204
  */
@@ -140,11 +207,29 @@ type BaseControllerCommon = {
140
207
  leftWidgets: Widget[];
141
208
  rightWidgets: Widget[];
142
209
  centerWidgets: Widget[];
210
+ language?: SupportedLanguage | string;
143
211
  /**
144
212
  * Optional so existing integrations don't break.
145
213
  * If you want it required, remove the `?`.
146
214
  */
147
215
  doubleOrNothing?: DoubleOrNothingProps;
216
+ /**
217
+ * Opt-in flag for the classic-mines-style layout. When true (and
218
+ * paired with `classicGame.forceLeftStyle`), the controller renders as
219
+ * a left rail on desktop. Default: undefined / false → no behavior
220
+ * change for existing integrations.
221
+ */
222
+ isClassicGame?: boolean;
223
+ classicGame?: ClassicGameProps;
224
+ /**
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`.
231
+ */
232
+ freeRoundsOptions?: FreeRoundsOptionsProps;
148
233
  };
149
234
  /**
150
235
  * Variant when risk & autoplay are enabled (FULL mode).
@@ -256,4 +341,40 @@ interface AutoManualPlayStateProviderProps {
256
341
  }
257
342
  declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
258
343
 
259
- export { AUTO_PLAY_STATE, AutoManualPlayProvider, DOUBLE_OR_NOTHING_STATE, GAME_MODE, type PlayControllerProps, type PlayControllerWithRisk, type PlayControllerWithoutRisk, WIDGET, type Widget, canAutoplaySpaceTrigger, createAutoplayButtonAction, createManualCashoutClickHandler, format, isAutoplayButtonDisabled, isManualCashoutDisabled };
344
+ interface FreeRoundsIntroModalProps {
345
+ open: boolean;
346
+ roundsRemaining: number;
347
+ totalRounds: number;
348
+ stakeCents: number;
349
+ coinType?: number;
350
+ currency?: string;
351
+ decimals?: number;
352
+ expiresAt?: string | number | Date;
353
+ onPlayNow?: () => void;
354
+ onPlayLater?: () => void;
355
+ }
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;
379
+
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 };