@enigma-lake/tower-play-controller-sdk 1.0.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.
- package/README.md +202 -0
- package/dist/components/AutoManualPlayStateProvider/AutoManualPlayProvider.d.ts +9 -0
- package/dist/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.d.ts +28 -0
- package/dist/components/AutoManualPlayStateProvider/index.d.ts +1 -0
- package/dist/components/base/AutoPlayController/AutoPlayController.d.ts +2 -0
- package/dist/components/base/AutoPlayController/index.d.ts +1 -0
- package/dist/components/base/Button/Button.d.ts +21 -0
- package/dist/components/base/Button/index.d.ts +1 -0
- package/dist/components/base/ChevronIcon/ChevronIcon.d.ts +5 -0
- package/dist/components/base/ChevronIcon/index.d.ts +1 -0
- package/dist/components/base/DifficultySelector/DifficultySelector.d.ts +14 -0
- package/dist/components/base/DifficultySelector/Selector.d.ts +3 -0
- package/dist/components/base/DifficultySelector/types.d.ts +16 -0
- package/dist/components/base/GroupRow/GroupRow.d.ts +6 -0
- package/dist/components/base/GroupRow/index.d.ts +1 -0
- package/dist/components/base/Input/Input.d.ts +3 -0
- package/dist/components/base/Input/cleanInputNumber.d.ts +2 -0
- package/dist/components/base/Input/index.d.ts +1 -0
- package/dist/components/base/InputWithIcon/InputWithIcon.d.ts +15 -0
- package/dist/components/base/InputWithIcon/index.d.ts +1 -0
- package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +15 -0
- package/dist/components/base/InputWithSwitch/index.d.ts +1 -0
- package/dist/components/base/ManualPlayController/ManualPlayController.d.ts +2 -0
- package/dist/components/base/ManualPlayController/index.d.ts +1 -0
- package/dist/components/base/PlayController/PlayController.d.ts +15 -0
- package/dist/components/base/SelectMenu/GoldIcon.d.ts +1 -0
- package/dist/components/base/SelectMenu/SelectMenu.d.ts +11 -0
- package/dist/components/base/SelectMenu/SweepsIcon.d.ts +1 -0
- package/dist/components/base/SelectMenu/index.d.ts +1 -0
- package/dist/components/base/Switch/Switch.d.ts +10 -0
- package/dist/components/base/index.d.ts +6 -0
- package/dist/components/hooks/usePlayController.d.ts +27 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/utils.d.ts +5 -0
- package/dist/index.d.ts +101 -0
- package/dist/index.mjs +568 -0
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/gameMode.d.ts +9 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/playController.d.ts +53 -0
- package/package.json +84 -0
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
# TowerPlayController
|
|
3
|
+
|
|
4
|
+
The `TowerPlayController` component is a key part of the gameplay interface, allowing users to initiate a play or cash out based on their current game state. It supports manual play, autoplay for a specified number of plays, dynamic currency handling, and play amount adjustments.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Component Overview
|
|
9
|
+
|
|
10
|
+
The `TowerPlayController` allows the user to:
|
|
11
|
+
|
|
12
|
+
- Select a currency.
|
|
13
|
+
- Adjust the play amount.
|
|
14
|
+
- Start a play (manual or auto).
|
|
15
|
+
- Cash out winnings.
|
|
16
|
+
- Toggle between manual play and autoplay.
|
|
17
|
+
- Select risk difficulty
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Setup
|
|
22
|
+
|
|
23
|
+
### 1. Install the package using npm:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @enigma-lake/tower-play-controller-sdk
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Import the component and styles in your project:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import {
|
|
33
|
+
AUTO_PLAY_STATE,
|
|
34
|
+
GAME_MODE,
|
|
35
|
+
AutoManualPlayProvider,
|
|
36
|
+
} from "@enigma-lake/tower-play-controller-sdk";
|
|
37
|
+
|
|
38
|
+
import "@enigma-lake/tower-play-controller-sdk/dist/style.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Context & Provider
|
|
44
|
+
|
|
45
|
+
### `AutoManualPlayProvider`
|
|
46
|
+
|
|
47
|
+
The `AutoManualPlayProvider` wraps the TowerPlayController, managing both manual play and autoplay. It uses React Context to provide game state and actions throughout the component tree.
|
|
48
|
+
|
|
49
|
+
🔹 **Features of `AutoManualPlayProvider`**:
|
|
50
|
+
- **Manages Game Mode**: Switches between MANUAL and AUTOPLAY.
|
|
51
|
+
- **Handles Autoplay**: Sets the number of plays, tracks rounds, and stops automatically.
|
|
52
|
+
- **Provides Context:** Exposes state and functions for controlling play behavior.
|
|
53
|
+
|
|
54
|
+
## Props
|
|
55
|
+
|
|
56
|
+
### 1. `StylingProps`
|
|
57
|
+
|
|
58
|
+
Handles the styling-related properties for the component.
|
|
59
|
+
|
|
60
|
+
- **`panel` (optional)**: Custom styling for the play controller.
|
|
61
|
+
|
|
62
|
+
- **`bgColorHex`**: Hex color for the panel background.
|
|
63
|
+
- **`bottom`**: Position of the panel relative to the window.
|
|
64
|
+
|
|
65
|
+
- **`dropdown` (optional)**: Custom styling for the dropdown.
|
|
66
|
+
- **`bgColorHex`**: Hex color for the panel background.
|
|
67
|
+
- **`riskColorConfig`**: Object defining colors for different risk levels.
|
|
68
|
+
- **`LOW`**: color (e.g." #1AE380")
|
|
69
|
+
- **`MEDIUM`**: color (e.g." #FAEB78")
|
|
70
|
+
- **`HIGH`**: color (e.g." #FF5646")
|
|
71
|
+
|
|
72
|
+
### 2. `CurrencyProps`
|
|
73
|
+
|
|
74
|
+
Handles currency-related logic and settings.
|
|
75
|
+
|
|
76
|
+
- **`currencyOptions`**: An object containing the following properties:
|
|
77
|
+
- **`currentCurrency`**: The currently selected currency (e.g., `Currency.SWEEPS`).
|
|
78
|
+
- **`currencies`**: Array of available currencies that the user can choose from.
|
|
79
|
+
- **`winText`**: The win amount during the playing.
|
|
80
|
+
|
|
81
|
+
### 3. `ActionsProps`
|
|
82
|
+
|
|
83
|
+
Defines functions for the user actions.
|
|
84
|
+
|
|
85
|
+
- **`onPlay`**: A callback function to trigger when the user starts a play.
|
|
86
|
+
- **`onAutoPlay`**: A callback function to trigger when the user starts autoplay. It accepts `selection` (an array of selected indices) and `callback` (a function to be executed once autoplay finishes).
|
|
87
|
+
- **`onCashout`**: A callback function to trigger when the user decides to cash out their winnings.
|
|
88
|
+
|
|
89
|
+
### 4. `PlaySettingsProps`
|
|
90
|
+
|
|
91
|
+
Handles game-specific settings and states.
|
|
92
|
+
|
|
93
|
+
- **`playOptions`**: An object containing the following properties:
|
|
94
|
+
- **`isPlaying`**: Boolean flag indicating whether the game is currently in progress.
|
|
95
|
+
- **`canCashout`**: Boolean flag indicating whether the user can cash out their current play.
|
|
96
|
+
- **`disabledController`**: Boolean flag to disable all interactive elements in the component, preventing user interactions (e.g., when the game is in progress).
|
|
97
|
+
- **`displayController`**: Boolean flag to determine if the play controller should be visible.
|
|
98
|
+
- **`showAutoPlayToast`**: A function to show a toast message during autoplay. Accepts an object with:
|
|
99
|
+
- **`type`**: Message type (`"success"`, `"error"`, `"warning"`, or `"info"`).
|
|
100
|
+
- **`message`**: The message to display.
|
|
101
|
+
- **`playHook`**: A hook providing the current play amount, play limits, and a function to set the play amount.
|
|
102
|
+
- **`playLimits`**: Play limits for the game.
|
|
103
|
+
- **`playAmount`**: The current play amount.
|
|
104
|
+
- **`setPlayAmount`**: A function to set the play amount.
|
|
105
|
+
- **`autoPlayDelay`** (optional): The delay (in milliseconds) before auto play starts.
|
|
106
|
+
- **`currentRisk`**: The current risk setting.
|
|
107
|
+
- **`onRiskChange`**: Callback function to handle risk selection.
|
|
108
|
+
- **`risks`**: Array of available risk types.
|
|
109
|
+
- **`disabledMenu`**: Disable menu flag
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Example Usage
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import "@enigma-lake/tower-play-controller-sdk/dist/style.css";
|
|
116
|
+
import { AutoManualPlayProvider, GAME_MODE, AUTO_PLAY_STATE } from "@enigma-lake/tower-play-controller-sdk";
|
|
117
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
118
|
+
|
|
119
|
+
const GameExample = () => {
|
|
120
|
+
const config = {
|
|
121
|
+
currencyOptions: {
|
|
122
|
+
currentCurrency: Currency.SWEEPS,
|
|
123
|
+
currencies: [Currency.SWEEPS, Currency.GOLD],
|
|
124
|
+
winText: "0.00 SC",
|
|
125
|
+
},
|
|
126
|
+
onPlay: () => console.log("Play button clicked"),
|
|
127
|
+
onAutoPlay: (selection, next, stop) => {
|
|
128
|
+
console.log("Auto Play started with selection:", selection);
|
|
129
|
+
next(); // Proceed to the next autoplay round
|
|
130
|
+
stop(); // Stop autoplay (e.g., in case of an error or when the user chooses to stop)
|
|
131
|
+
},
|
|
132
|
+
onCashout: () => console.log("Cashout clicked"),
|
|
133
|
+
playOptions: {
|
|
134
|
+
displayController: true,
|
|
135
|
+
canCashout: false,
|
|
136
|
+
isPlaying: false,
|
|
137
|
+
disabledController: false,
|
|
138
|
+
onRiskChange: (risk: RiskType) => {},
|
|
139
|
+
disabledMenu: false,
|
|
140
|
+
risks: [RiskTypes.LOW, RiskTypes.MEDIUM, RiskTypes.HIGH],
|
|
141
|
+
showAutoPlayToast: (props) => {
|
|
142
|
+
console.log(`${props.type}: ${props.message}`);
|
|
143
|
+
},
|
|
144
|
+
playHook: () => {
|
|
145
|
+
return {
|
|
146
|
+
playLimits: { min: 1, max: 100 },
|
|
147
|
+
playAmount: 10,
|
|
148
|
+
setPlayAmount: (value) => console.log("New play amount:", value),
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
panel: {
|
|
153
|
+
bottom: window.innerWidth < 450 ? "55px" : "70px",
|
|
154
|
+
bgColorHex: "#08643F"
|
|
155
|
+
},
|
|
156
|
+
dropdown: {
|
|
157
|
+
bgColorHex: "#10243F",
|
|
158
|
+
riskColorConfig: {
|
|
159
|
+
LOW: "#1AE380",
|
|
160
|
+
MEDIUM: "#FAEB78",
|
|
161
|
+
HIGH: "#FF5646",
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<AutoManualPlayProvider config={config}>
|
|
168
|
+
{({ autoPlay: { selection, setSelection, state }, mode }) => (
|
|
169
|
+
// children content
|
|
170
|
+
)}
|
|
171
|
+
</AutoManualPlayProvider>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Key Features
|
|
179
|
+
|
|
180
|
+
1. **Dynamic Currency Handling**:
|
|
181
|
+
- Supports multiple currencies (e.g., SWEEPS, GOLD).
|
|
182
|
+
- Allows users to switch currencies easily.
|
|
183
|
+
|
|
184
|
+
2. **Play Amount Adjustment**:
|
|
185
|
+
- Includes buttons to halve or double the play amount.
|
|
186
|
+
- Validates play amounts against user balance and play limits.
|
|
187
|
+
|
|
188
|
+
3. **Custom Styling**:
|
|
189
|
+
- Supports customizable input and button colors.
|
|
190
|
+
|
|
191
|
+
4. **Play & Cashout Actions**:
|
|
192
|
+
- Allows users to initiate gameplay or cash out winnings seamlessly.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Development Notes
|
|
197
|
+
|
|
198
|
+
1. **Play Amount Validation**:
|
|
199
|
+
- The play amount is validated to ensure it falls within the minimum and maximum limits, as well as the user's available balance.
|
|
200
|
+
|
|
201
|
+
2. **Responsive Design**:
|
|
202
|
+
- The component is styled to be responsive and integrate seamlessly into various layouts.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
import { PlayControllerProps } from "../../types/playController";
|
|
3
|
+
import { AutoManualPlayStateContextType } from "./AutoManualPlayStateContext";
|
|
4
|
+
interface AutoManualPlayStateProviderProps {
|
|
5
|
+
children: React.ReactNode | ((state: AutoManualPlayStateContextType) => ReactElement);
|
|
6
|
+
config: PlayControllerProps;
|
|
7
|
+
}
|
|
8
|
+
declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
|
|
9
|
+
export default AutoManualPlayProvider;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GAME_MODE, AUTO_PLAY_STATE } from "../../types/gameMode";
|
|
2
|
+
import { PlayControllerProps } from "../../types/playController";
|
|
3
|
+
export interface AutoManualPlayStateContextType {
|
|
4
|
+
mode: GAME_MODE;
|
|
5
|
+
config: PlayControllerProps;
|
|
6
|
+
manual: {
|
|
7
|
+
playManualMode: () => void;
|
|
8
|
+
};
|
|
9
|
+
autoPlay: {
|
|
10
|
+
state: AUTO_PLAY_STATE;
|
|
11
|
+
playedRounds: number;
|
|
12
|
+
numberOfPlays: number;
|
|
13
|
+
selection: number[];
|
|
14
|
+
isActive: boolean;
|
|
15
|
+
setIsActive: React.Dispatch<React.SetStateAction<boolean>>;
|
|
16
|
+
start: (numberOfPlays: number) => void;
|
|
17
|
+
stop: () => void;
|
|
18
|
+
setState: React.Dispatch<React.SetStateAction<AUTO_PLAY_STATE>>;
|
|
19
|
+
setPlayedRounds: React.Dispatch<React.SetStateAction<number>>;
|
|
20
|
+
setNumberOfPlays: React.Dispatch<React.SetStateAction<number>>;
|
|
21
|
+
setSelection: (values: number[]) => void;
|
|
22
|
+
updateState: (newState: AUTO_PLAY_STATE.SELECTING | AUTO_PLAY_STATE.PLAYING) => void;
|
|
23
|
+
};
|
|
24
|
+
reset: () => void;
|
|
25
|
+
toggleMode: () => void;
|
|
26
|
+
}
|
|
27
|
+
export declare const AutoManualPlayStateContext: import("react").Context<AutoManualPlayStateContextType | undefined>;
|
|
28
|
+
export declare const useAutoManualPlayState: () => AutoManualPlayStateContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AutoManualPlayProvider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./AutoPlayController";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GAME_MODE } from "../../../types";
|
|
3
|
+
declare const themes: {
|
|
4
|
+
primary: string;
|
|
5
|
+
success: string;
|
|
6
|
+
ghost: string;
|
|
7
|
+
};
|
|
8
|
+
type Props = React.ComponentProps<"button"> & {
|
|
9
|
+
theme?: (typeof themes)[keyof typeof themes];
|
|
10
|
+
roleType?: GAME_MODE;
|
|
11
|
+
className?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const Button: {
|
|
14
|
+
({ disabled, roleType, className, theme, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
themes: {
|
|
16
|
+
primary: string;
|
|
17
|
+
success: string;
|
|
18
|
+
ghost: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Button";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ChevronIcon";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlaySettingsProps } from "../../../types/playController";
|
|
2
|
+
import { RiskTypes } from "./types";
|
|
3
|
+
declare const DifficultySelector: ({ playOptions, dropdownConfig, }: {
|
|
4
|
+
playOptions: PlaySettingsProps;
|
|
5
|
+
dropdownConfig: {
|
|
6
|
+
bgColorHex: string;
|
|
7
|
+
riskColorConfig: {
|
|
8
|
+
[RiskTypes.LOW]: string;
|
|
9
|
+
[RiskTypes.MEDIUM]: string;
|
|
10
|
+
[RiskTypes.HIGH]: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default DifficultySelector;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface SelectorProps<T> {
|
|
2
|
+
label: string;
|
|
3
|
+
values: T[];
|
|
4
|
+
onSelect: (value: T) => void;
|
|
5
|
+
riskColor: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
currentValue: T;
|
|
8
|
+
}
|
|
9
|
+
export declare enum SELECTORS {
|
|
10
|
+
RISK = "Risk"
|
|
11
|
+
}
|
|
12
|
+
export declare enum RiskTypes {
|
|
13
|
+
LOW = "LOW",
|
|
14
|
+
MEDIUM = "MEDIUM",
|
|
15
|
+
HIGH = "HIGH"
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./GroupRow";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Input";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, PropsWithChildren } from "react";
|
|
2
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
3
|
+
export type Props = PropsWithChildren<ComponentProps<"input">> & {
|
|
4
|
+
switcherConfig?: {
|
|
5
|
+
onSwitch: () => void;
|
|
6
|
+
isPlaying: boolean;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
currency: Currency;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
};
|
|
11
|
+
currency: Currency;
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const InputWithIcon: ({ children, switcherConfig, disabled, currency, label, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default InputWithIcon;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./InputWithIcon";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentProps, PropsWithChildren } from "react";
|
|
2
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
3
|
+
export type Props = PropsWithChildren<ComponentProps<"input">> & {
|
|
4
|
+
switcherConfig: {
|
|
5
|
+
onSwitch: () => void;
|
|
6
|
+
isPlaying: boolean;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
currency: Currency;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
};
|
|
11
|
+
currency: Currency;
|
|
12
|
+
label?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const InputWithSwitch: ({ children, switcherConfig, disabled, currency, label, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default InputWithSwitch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./InputWithSwitch";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ManualPlayController";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
2
|
+
interface PlayAmountControlProps {
|
|
3
|
+
playAmount: number;
|
|
4
|
+
minPlayAmount: number;
|
|
5
|
+
maxPlayAmount: number;
|
|
6
|
+
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
|
+
}
|
|
14
|
+
declare const PlayAmountControl: ({ playAmount, minPlayAmount, maxPlayAmount, isDisabled, adjustPlayAmount, onChangeAmount, onBlurAmount, currentCurrency, currencies, disableInput, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default PlayAmountControl;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GoldIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
2
|
+
interface ISelectMenuProps {
|
|
3
|
+
currencies: Currency[];
|
|
4
|
+
selectedCurrency: Currency;
|
|
5
|
+
setSelectedCurrency: (currency: {
|
|
6
|
+
currency: Currency;
|
|
7
|
+
}) => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectMenu: ({ currencies, selectedCurrency, setSelectedCurrency, disabled, }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default SelectMenu;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SweepsIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./SelectMenu";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Currency } from "@enigma-lake/zoot-platform-sdk";
|
|
2
|
+
interface SwitchProps {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
onSwitch: () => void;
|
|
5
|
+
isPlaying: boolean;
|
|
6
|
+
currency: Currency;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const Switch: ({ enabled, onSwitch, disabled, currency, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AUTO_PLAY_STATE } from "../../types";
|
|
2
|
+
import { ChangeEvent, FocusEvent } from "react";
|
|
3
|
+
export declare const usePlayController: () => {
|
|
4
|
+
currentCurrency: import("@enigma-lake/zoot-platform-sdk").Currency;
|
|
5
|
+
currencies: import("@enigma-lake/zoot-platform-sdk").Currency[];
|
|
6
|
+
playAmount: number;
|
|
7
|
+
minPlayAmount: number;
|
|
8
|
+
maxPlayAmount: number;
|
|
9
|
+
setPlayAmount: (value: number) => void;
|
|
10
|
+
adjustPlayAmount: (multiplier: number) => void;
|
|
11
|
+
onChangeAmount: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
+
onBlurAmount: (event: FocusEvent<HTMLInputElement>) => void;
|
|
13
|
+
playOptions: import("../../types/playController").PlaySettingsProps;
|
|
14
|
+
isValidPlayAmount: boolean;
|
|
15
|
+
winText: string;
|
|
16
|
+
manualPlay: {
|
|
17
|
+
isDisabled: () => boolean;
|
|
18
|
+
onPlay: () => void;
|
|
19
|
+
canCashout: boolean;
|
|
20
|
+
};
|
|
21
|
+
autoPlay: {
|
|
22
|
+
isDisabled: () => boolean;
|
|
23
|
+
state: AUTO_PLAY_STATE;
|
|
24
|
+
onPlay: () => void;
|
|
25
|
+
onStopPlay: () => void;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Button, Input, InputWithIcon, GroupRow, SelectMenu } from "./base";
|
|
2
|
+
import AutoManualPlayProvider from "./AutoManualPlayStateProvider";
|
|
3
|
+
import { GAME_MODE, AUTO_PLAY_STATE } from "../types/gameMode";
|
|
4
|
+
export { Button, InputWithIcon, GroupRow, Input, SelectMenu, AutoManualPlayProvider, GAME_MODE, AUTO_PLAY_STATE, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GAME_MODE } from "../types";
|
|
2
|
+
export declare const hexToRgb: (hex: string) => string | null;
|
|
3
|
+
export declare const selectButton: (gameMode: GAME_MODE) => HTMLButtonElement;
|
|
4
|
+
export declare const addPressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
|
|
5
|
+
export declare const removePressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Currency, PlayLimits } from '@enigma-lake/zoot-platform-sdk';
|
|
3
|
+
|
|
4
|
+
declare enum GAME_MODE {
|
|
5
|
+
MANUAL = "manual",
|
|
6
|
+
AUTOPLAY = "autoplay"
|
|
7
|
+
}
|
|
8
|
+
declare enum AUTO_PLAY_STATE {
|
|
9
|
+
IDLE = "idle",
|
|
10
|
+
SELECTING = "selecting",
|
|
11
|
+
PLAYING = "playing"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare enum RiskTypes {
|
|
15
|
+
LOW = "LOW",
|
|
16
|
+
MEDIUM = "MEDIUM",
|
|
17
|
+
HIGH = "HIGH"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type StylingProps = {
|
|
21
|
+
panel: {
|
|
22
|
+
bottom: string;
|
|
23
|
+
bgColorHex: string;
|
|
24
|
+
};
|
|
25
|
+
dropdown: {
|
|
26
|
+
bgColorHex: string;
|
|
27
|
+
riskColorConfig: {
|
|
28
|
+
[RiskTypes.LOW]: string;
|
|
29
|
+
[RiskTypes.MEDIUM]: string;
|
|
30
|
+
[RiskTypes.HIGH]: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
type CurrencyProps = {
|
|
35
|
+
currentCurrency: Currency;
|
|
36
|
+
currencies: Currency[];
|
|
37
|
+
winText: string;
|
|
38
|
+
};
|
|
39
|
+
type ActionsProps = {
|
|
40
|
+
onPlay: () => void;
|
|
41
|
+
onAutoPlay: (selection: number[], next: () => void, stop: () => void) => void;
|
|
42
|
+
onCashout: () => void;
|
|
43
|
+
};
|
|
44
|
+
type PlaySettingsProps = {
|
|
45
|
+
isPlaying: boolean;
|
|
46
|
+
canCashout: boolean;
|
|
47
|
+
disabledController: boolean;
|
|
48
|
+
risks: RiskTypes[];
|
|
49
|
+
currentRisk: RiskTypes;
|
|
50
|
+
onRiskChange: (risk: RiskTypes) => void;
|
|
51
|
+
disabledMenu: boolean;
|
|
52
|
+
displayController: boolean;
|
|
53
|
+
disableInput: boolean;
|
|
54
|
+
showAutoPlayToast: (props: {
|
|
55
|
+
type: "success" | "error" | "warning" | "info";
|
|
56
|
+
message: string;
|
|
57
|
+
}) => void;
|
|
58
|
+
playHook: () => {
|
|
59
|
+
playLimits?: PlayLimits;
|
|
60
|
+
playAmount: number;
|
|
61
|
+
setPlayAmount: (value: number) => void;
|
|
62
|
+
};
|
|
63
|
+
autoPlayDelay?: number;
|
|
64
|
+
};
|
|
65
|
+
type PlayControllerProps = StylingProps & ActionsProps & {
|
|
66
|
+
currencyOptions: CurrencyProps;
|
|
67
|
+
playOptions: PlaySettingsProps;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
interface AutoManualPlayStateContextType {
|
|
71
|
+
mode: GAME_MODE;
|
|
72
|
+
config: PlayControllerProps;
|
|
73
|
+
manual: {
|
|
74
|
+
playManualMode: () => void;
|
|
75
|
+
};
|
|
76
|
+
autoPlay: {
|
|
77
|
+
state: AUTO_PLAY_STATE;
|
|
78
|
+
playedRounds: number;
|
|
79
|
+
numberOfPlays: number;
|
|
80
|
+
selection: number[];
|
|
81
|
+
isActive: boolean;
|
|
82
|
+
setIsActive: React.Dispatch<React.SetStateAction<boolean>>;
|
|
83
|
+
start: (numberOfPlays: number) => void;
|
|
84
|
+
stop: () => void;
|
|
85
|
+
setState: React.Dispatch<React.SetStateAction<AUTO_PLAY_STATE>>;
|
|
86
|
+
setPlayedRounds: React.Dispatch<React.SetStateAction<number>>;
|
|
87
|
+
setNumberOfPlays: React.Dispatch<React.SetStateAction<number>>;
|
|
88
|
+
setSelection: (values: number[]) => void;
|
|
89
|
+
updateState: (newState: AUTO_PLAY_STATE.SELECTING | AUTO_PLAY_STATE.PLAYING) => void;
|
|
90
|
+
};
|
|
91
|
+
reset: () => void;
|
|
92
|
+
toggleMode: () => void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface AutoManualPlayStateProviderProps {
|
|
96
|
+
children: React.ReactNode | ((state: AutoManualPlayStateContextType) => ReactElement);
|
|
97
|
+
config: PlayControllerProps;
|
|
98
|
+
}
|
|
99
|
+
declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
|
|
100
|
+
|
|
101
|
+
export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
|