@enigma-lake/tower-play-controller-sdk 1.0.3 → 2.0.1

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.
package/README.md CHANGED
@@ -73,14 +73,11 @@ Handles the styling-related properties for the component.
73
73
  ### 2. `CurrencyProps`
74
74
 
75
75
  Handles currency-related logic and settings.
76
-
77
76
  - **`currencyOptions`**: An object containing the following properties:
78
- - **`currentCurrency`**: The currently selected currency (e.g., `Currency.SWEEPS`).
79
- - **`currencies`**: Array of available currencies that the user can choose from.
80
- - **`winText`**: The win amount during the playing.
77
+ - **`current`**: The currently selected currency
78
+ - **`available`**: Array of available currencies that the user can choose from.
81
79
 
82
80
  ### 3. `ActionsProps`
83
-
84
81
  Defines functions for the user actions.
85
82
 
86
83
  - **`onPlay`**: A callback function to trigger when the user starts a play.
@@ -109,6 +106,14 @@ Handles game-specific settings and states.
109
106
  - **`onRiskChange`**: Callback function to handle risk selection.
110
107
  - **`risks`**: Array of available risk types.
111
108
  - **`disabledMenu`**: Disable menu flag
109
+ - **`totalBalance`**: The available balance for the current currency
110
+
111
+ ### 3. `Widgets`
112
+ Defines functions for the user actions.
113
+
114
+ - **`leftWidgets`**: A list of widgets that will be displayed on the left side
115
+ - **`centerWidgets`**: A list of widgets that will be displayed on the center
116
+ - **`rightWidgets`**: A list of widgets that will be displayed on the right side
112
117
  ---
113
118
 
114
119
  ## Example Usage
@@ -23,6 +23,11 @@ export interface AutoManualPlayStateContextType {
23
23
  };
24
24
  reset: () => void;
25
25
  toggleMode: () => void;
26
+ playValues: {
27
+ displayPlayAmountView: boolean;
28
+ setDisplayPlayAmountView: (v: boolean) => void;
29
+ togglePlayAmountView: () => void;
30
+ };
26
31
  }
27
32
  export declare const AutoManualPlayStateContext: import("react").Context<AutoManualPlayStateContextType | undefined>;
28
33
  export declare const useAutoManualPlayState: () => AutoManualPlayStateContextType;
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { AUTO_PLAY_STATE, Widget } from "../../types";
3
+ type WidgetsByZone = {
4
+ left: Widget[];
5
+ center: Widget[];
6
+ right: Widget[];
7
+ };
8
+ interface WidgetContainerProps {
9
+ state: AUTO_PLAY_STATE;
10
+ widgets: WidgetsByZone;
11
+ }
12
+ export declare const WidgetContainer: React.FC<WidgetContainerProps>;
13
+ export {};
@@ -1,15 +1,11 @@
1
1
  import { ComponentProps, PropsWithChildren } from "react";
2
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
3
2
  export type Props = PropsWithChildren<ComponentProps<"input">> & {
4
3
  switcherConfig: {
5
4
  onSwitch: () => void;
6
5
  isPlaying: boolean;
7
6
  enabled: boolean;
8
- currency: Currency;
9
7
  disabled: boolean;
10
8
  };
11
- currency: Currency;
12
- label?: string;
13
9
  };
14
- declare const InputWithSwitch: ({ children, switcherConfig, disabled, currency, label, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
10
+ declare const InputWithSwitch: ({ children, switcherConfig, disabled, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
15
11
  export default InputWithSwitch;
@@ -1,15 +1,5 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface PlayAmountControlProps {
3
- playAmount: number;
4
- minPlayAmount: number;
5
- maxPlayAmount: number;
6
2
  isDisabled: () => boolean;
7
- adjustPlayAmount: (multiplier: number) => void;
8
- onChangeAmount: (event: React.ChangeEvent<HTMLInputElement>) => void;
9
- onBlurAmount: (event: React.FocusEvent<HTMLInputElement>) => void;
10
- currentCurrency: Currency;
11
- currencies: Currency[];
12
- disableInput: boolean;
13
3
  }
14
- declare const PlayAmountControl: ({ playAmount, minPlayAmount, maxPlayAmount, isDisabled, adjustPlayAmount, onChangeAmount, onBlurAmount, currentCurrency, currencies, disableInput, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const PlayAmountControl: ({ isDisabled }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
15
5
  export default PlayAmountControl;
@@ -0,0 +1,8 @@
1
+ import { ComponentProps, PropsWithChildren } from "react";
2
+ export type Props = PropsWithChildren<ComponentProps<"div">> & {
3
+ disabled: boolean;
4
+ onClick: () => void;
5
+ value: string;
6
+ };
7
+ declare const PlayValueInput: ({ disabled, children, className, value, onClick, }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export default PlayValueInput;
@@ -0,0 +1 @@
1
+ export { default } from "./PlayValueInput";
@@ -0,0 +1,2 @@
1
+ declare const PlayValueList: () => import("react/jsx-runtime").JSX.Element | null;
2
+ export default PlayValueList;
@@ -0,0 +1 @@
1
+ export { default } from "./PlayValueList";
@@ -1,11 +1,5 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface ISelectMenuProps {
3
- currencies: Currency[];
4
- selectedCurrency: Currency;
5
- setSelectedCurrency: (currency: {
6
- currency: Currency;
7
- }) => void;
8
2
  disabled?: boolean;
9
3
  }
10
- declare const SelectMenu: ({ currencies, selectedCurrency, setSelectedCurrency, disabled, }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const SelectMenu: ({ disabled }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
11
5
  export default SelectMenu;
@@ -0,0 +1,3 @@
1
+ import { CurrencyMeta, CurrencyIcon } from "@enigma-lake/zoot-platform-sdk";
2
+ export declare const capitalize: (str: string) => string;
3
+ export declare const getIcon: (option: CurrencyMeta) => CurrencyIcon | undefined;
@@ -1,10 +1,8 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface SwitchProps {
3
2
  enabled: boolean;
4
3
  onSwitch: () => void;
5
4
  isPlaying: boolean;
6
- currency: Currency;
7
5
  disabled: boolean;
8
6
  }
9
- export declare const Switch: ({ enabled, onSwitch, disabled, currency, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Switch: ({ enabled, onSwitch, disabled, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
10
8
  export {};
@@ -1,6 +1,7 @@
1
1
  import Button from "./Button";
2
2
  import GroupRow from "./GroupRow";
3
3
  import Input from "./Input";
4
- import InputWithIcon from "./InputWithIcon";
4
+ import PlayValueInput from "./PlayValueInput";
5
+ import PlayValueList from "./PlayValueList";
5
6
  import SelectMenu from "./SelectMenu";
6
- export { Button, InputWithIcon, GroupRow, Input, SelectMenu };
7
+ export { Button, GroupRow, Input, SelectMenu, PlayValueInput, PlayValueList };
@@ -1,18 +1,16 @@
1
1
  import { AUTO_PLAY_STATE } from "../../types";
2
- import { ChangeEvent, FocusEvent } from "react";
3
2
  export declare const usePlayController: () => {
4
- currentCurrency: import("@enigma-lake/zoot-platform-sdk").Currency;
5
- currencies: import("@enigma-lake/zoot-platform-sdk").Currency[];
6
3
  playAmount: number;
7
4
  minPlayAmount: number;
8
5
  maxPlayAmount: number;
9
6
  setPlayAmount: (value: number) => void;
10
- adjustPlayAmount: (multiplier: number) => void;
11
- onChangeAmount: (event: ChangeEvent<HTMLInputElement>) => void;
12
- onBlurAmount: (event: FocusEvent<HTMLInputElement>) => void;
7
+ adjustPlayAmount: ({ direction }: {
8
+ direction: -1 | 1;
9
+ }) => void;
10
+ onChangeAmount: (playValue: number) => void;
13
11
  playOptions: import("../../types/playController").PlaySettingsProps;
14
12
  isValidPlayAmount: boolean;
15
- winText: string;
13
+ totalBalance: number;
16
14
  manualPlay: {
17
15
  isDisabled: () => boolean;
18
16
  onPlay: () => void;
@@ -24,4 +22,9 @@ export declare const usePlayController: () => {
24
22
  onPlay: () => void;
25
23
  onStopPlay: () => void;
26
24
  };
25
+ playValues: {
26
+ displayPlayAmountView: boolean;
27
+ setDisplayPlayAmountView: (v: boolean) => void;
28
+ togglePlayAmountView: () => void;
29
+ };
27
30
  };
@@ -1,4 +1,4 @@
1
- import { Button, Input, InputWithIcon, GroupRow, SelectMenu } from "./base";
2
1
  import AutoManualPlayProvider from "./AutoManualPlayStateProvider";
3
2
  import { GAME_MODE, AUTO_PLAY_STATE } from "../types/gameMode";
4
- export { Button, InputWithIcon, GroupRow, Input, SelectMenu, AutoManualPlayProvider, GAME_MODE, AUTO_PLAY_STATE, };
3
+ import { format } from "./utils";
4
+ export { AutoManualPlayProvider, GAME_MODE, AUTO_PLAY_STATE, format };
@@ -3,3 +3,4 @@ export declare const hexToRgb: (hex: string) => string | null;
3
3
  export declare const selectButton: (gameMode: GAME_MODE) => HTMLButtonElement;
4
4
  export declare const addPressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
5
5
  export declare const removePressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
6
+ export declare const format: (balance: number, decimals: number) => string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { Currency, PlayLimits } from '@enigma-lake/zoot-platform-sdk';
1
+ import { ReactNode, ReactElement } from 'react';
2
+ import { CurrencyProps, PlayLimitsV2 } from '@enigma-lake/zoot-platform-sdk';
3
3
 
4
4
  declare enum GAME_MODE {
5
5
  MANUAL = "manual",
@@ -11,6 +11,19 @@ declare enum AUTO_PLAY_STATE {
11
11
  PLAYING = "playing"
12
12
  }
13
13
 
14
+ declare enum WIDGET {
15
+ CENTER = "center",
16
+ SIDE = "side"
17
+ }
18
+ type Widget = {
19
+ type: WIDGET;
20
+ renderElement: ({ state }: {
21
+ state: AUTO_PLAY_STATE;
22
+ }) => ReactNode;
23
+ };
24
+
25
+ declare const format: (balance: number, decimals: number) => string;
26
+
14
27
  declare enum RiskTypes {
15
28
  LOW = "LOW",
16
29
  MEDIUM = "MEDIUM",
@@ -19,7 +32,7 @@ declare enum RiskTypes {
19
32
 
20
33
  type StylingProps = {
21
34
  panel: {
22
- bottom: string;
35
+ bottom?: string;
23
36
  bgColorHex: string;
24
37
  bgColorOpacity?: number;
25
38
  };
@@ -32,11 +45,6 @@ type StylingProps = {
32
45
  };
33
46
  };
34
47
  };
35
- type CurrencyProps = {
36
- currentCurrency: Currency;
37
- currencies: Currency[];
38
- winText: string;
39
- };
40
48
  type ActionsProps = {
41
49
  onPlay: () => void;
42
50
  onAutoPlay: (selection: number[], next: () => void, stop: () => void) => void;
@@ -58,15 +66,19 @@ type PlaySettingsProps = {
58
66
  message: string;
59
67
  }) => void;
60
68
  playHook: () => {
61
- playLimits?: PlayLimits;
69
+ playLimits?: PlayLimitsV2;
62
70
  playAmount: number;
63
71
  setPlayAmount: (value: number) => void;
64
72
  };
73
+ totalBalance: number;
65
74
  autoPlayDelay?: number;
66
75
  };
67
76
  type PlayControllerProps = StylingProps & ActionsProps & {
68
77
  currencyOptions: CurrencyProps;
69
78
  playOptions: PlaySettingsProps;
79
+ leftWidgets: Widget[];
80
+ rightWidgets: Widget[];
81
+ centerWidgets: Widget[];
70
82
  };
71
83
 
72
84
  interface AutoManualPlayStateContextType {
@@ -92,6 +104,11 @@ interface AutoManualPlayStateContextType {
92
104
  };
93
105
  reset: () => void;
94
106
  toggleMode: () => void;
107
+ playValues: {
108
+ displayPlayAmountView: boolean;
109
+ setDisplayPlayAmountView: (v: boolean) => void;
110
+ togglePlayAmountView: () => void;
111
+ };
95
112
  }
96
113
 
97
114
  interface AutoManualPlayStateProviderProps {
@@ -100,4 +117,4 @@ interface AutoManualPlayStateProviderProps {
100
117
  }
101
118
  declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
102
119
 
103
- export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
120
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE, WIDGET, type Widget, format };