@enigma-lake/tower-play-controller-sdk 2.0.23 → 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 (29) hide show
  1. package/README.md +130 -130
  2. package/dist/components/base/DifficultySelector/DifficultySelector.d.ts +4 -7
  3. package/dist/components/base/DifficultySelector/Selector.d.ts +1 -1
  4. package/dist/components/base/DifficultySelector/types.d.ts +3 -0
  5. package/dist/components/base/FreeRoundsIntroModal/FreeRoundsIntroModal.d.ts +14 -0
  6. package/dist/components/base/FreeRoundsIntroModal/freeRoundsCoin.d.ts +11 -0
  7. package/dist/components/base/FreeRoundsIntroModal/index.d.ts +3 -0
  8. package/dist/components/base/FreeRoundsSummaryModal/FreeRoundsSummaryModal.d.ts +9 -0
  9. package/dist/components/base/FreeRoundsSummaryModal/index.d.ts +3 -0
  10. package/dist/components/base/GroupRow/GroupRow.d.ts +2 -1
  11. package/dist/components/base/Input/Input.d.ts +3 -1
  12. package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +2 -1
  13. package/dist/components/base/PlayController/PlayController.d.ts +2 -1
  14. package/dist/components/base/PlayValueInput/PlayValueInput.d.ts +2 -1
  15. package/dist/components/hooks/usePlayController.d.ts +8 -0
  16. package/dist/components/hooks/useSpacebarButtonTrigger.d.ts +2 -1
  17. package/dist/i18n/I18nContext.d.ts +13 -0
  18. package/dist/i18n/index.d.ts +5 -0
  19. package/dist/i18n/locales/en.d.ts +2 -0
  20. package/dist/i18n/locales/zh-CN.d.ts +2 -0
  21. package/dist/i18n/translator.d.ts +5 -0
  22. package/dist/i18n/types.d.ts +41 -0
  23. package/dist/index.d.ts +132 -11
  24. package/dist/index.mjs +595 -113
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/style.css +1 -1
  27. package/dist/types/index.d.ts +2 -2
  28. package/dist/types/playController.d.ts +52 -9
  29. package/package.json +92 -85
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 };