@enigma-lake/tower-play-controller-sdk 1.0.2 → 2.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 +15 -6
- package/dist/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.d.ts +5 -0
- package/dist/components/Widgets/WidgetContainer.d.ts +13 -0
- package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +1 -5
- package/dist/components/base/PlayController/PlayController.d.ts +1 -11
- package/dist/components/base/PlayValueInput/PlayValueInput.d.ts +8 -0
- package/dist/components/base/PlayValueInput/index.d.ts +1 -0
- package/dist/components/base/PlayValueList/PlayValueList.d.ts +2 -0
- package/dist/components/base/PlayValueList/index.d.ts +1 -0
- package/dist/components/base/SelectMenu/SelectMenu.d.ts +1 -7
- package/dist/components/base/SelectMenu/config.d.ts +3 -0
- package/dist/components/base/Switch/Switch.d.ts +1 -3
- package/dist/components/base/index.d.ts +3 -2
- package/dist/components/hooks/usePlayController.d.ts +10 -7
- package/dist/components/index.d.ts +2 -2
- package/dist/components/utils.d.ts +1 -0
- package/dist/index.d.ts +28 -10
- package/dist/index.mjs +522 -241
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/playController.d.ts +8 -9
- package/dist/types/widgets.d.ts +12 -0
- package/package.json +2 -2
- package/dist/components/base/InputWithIcon/InputWithIcon.d.ts +0 -15
- package/dist/components/base/InputWithIcon/index.d.ts +0 -1
package/README.md
CHANGED
|
@@ -73,18 +73,16 @@ 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
|
-
- **`
|
|
79
|
-
- **`
|
|
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.
|
|
87
|
-
- **`onAutoPlay`**: A callback function to trigger when the user starts autoplay. It accepts `selection` (an array of selected indices)
|
|
84
|
+
- **`onAutoPlay`**: A callback function to trigger when the user starts autoplay. It accepts `selection` (an array of selected indices), `next` (a function to proceed to the next autoplay round), and `stop` (a function to stop autoplay).
|
|
85
|
+
- **`onAutoPlayStop`** (optional): A callback function to trigger when the user stops autoplay by pressing the "Stop Autoplay" button.
|
|
88
86
|
- **`onCashout`**: A callback function to trigger when the user decides to cash out their winnings.
|
|
89
87
|
|
|
90
88
|
### 4. `PlaySettingsProps`
|
|
@@ -108,6 +106,14 @@ Handles game-specific settings and states.
|
|
|
108
106
|
- **`onRiskChange`**: Callback function to handle risk selection.
|
|
109
107
|
- **`risks`**: Array of available risk types.
|
|
110
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
|
|
111
117
|
---
|
|
112
118
|
|
|
113
119
|
## Example Usage
|
|
@@ -130,6 +136,9 @@ const GameExample = () => {
|
|
|
130
136
|
next(); // Proceed to the next autoplay round
|
|
131
137
|
stop(); // Stop autoplay (e.g., in case of an error or when the user chooses to stop)
|
|
132
138
|
},
|
|
139
|
+
onAutoPlayStop: () => {
|
|
140
|
+
console.log("Auto Play stopped by user");
|
|
141
|
+
},
|
|
133
142
|
onCashout: () => console.log("Cashout clicked"),
|
|
134
143
|
playOptions: {
|
|
135
144
|
displayController: true,
|
|
@@ -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,
|
|
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: ({
|
|
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 @@
|
|
|
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: ({
|
|
4
|
+
declare const SelectMenu: ({ disabled }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
5
|
export default SelectMenu;
|
|
@@ -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,
|
|
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
|
|
4
|
+
import PlayValueInput from "./PlayValueInput";
|
|
5
|
+
import PlayValueList from "./PlayValueList";
|
|
5
6
|
import SelectMenu from "./SelectMenu";
|
|
6
|
-
export { Button,
|
|
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: (
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
|
35
|
+
bottom?: string;
|
|
23
36
|
bgColorHex: string;
|
|
24
37
|
bgColorOpacity?: number;
|
|
25
38
|
};
|
|
@@ -32,14 +45,10 @@ 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;
|
|
51
|
+
onAutoPlayStop?: () => void;
|
|
43
52
|
onCashout: () => void;
|
|
44
53
|
};
|
|
45
54
|
type PlaySettingsProps = {
|
|
@@ -57,15 +66,19 @@ type PlaySettingsProps = {
|
|
|
57
66
|
message: string;
|
|
58
67
|
}) => void;
|
|
59
68
|
playHook: () => {
|
|
60
|
-
playLimits?:
|
|
69
|
+
playLimits?: PlayLimitsV2;
|
|
61
70
|
playAmount: number;
|
|
62
71
|
setPlayAmount: (value: number) => void;
|
|
63
72
|
};
|
|
73
|
+
totalBalance: number;
|
|
64
74
|
autoPlayDelay?: number;
|
|
65
75
|
};
|
|
66
76
|
type PlayControllerProps = StylingProps & ActionsProps & {
|
|
67
77
|
currencyOptions: CurrencyProps;
|
|
68
78
|
playOptions: PlaySettingsProps;
|
|
79
|
+
leftWidgets: Widget[];
|
|
80
|
+
rightWidgets: Widget[];
|
|
81
|
+
centerWidgets: Widget[];
|
|
69
82
|
};
|
|
70
83
|
|
|
71
84
|
interface AutoManualPlayStateContextType {
|
|
@@ -91,6 +104,11 @@ interface AutoManualPlayStateContextType {
|
|
|
91
104
|
};
|
|
92
105
|
reset: () => void;
|
|
93
106
|
toggleMode: () => void;
|
|
107
|
+
playValues: {
|
|
108
|
+
displayPlayAmountView: boolean;
|
|
109
|
+
setDisplayPlayAmountView: (v: boolean) => void;
|
|
110
|
+
togglePlayAmountView: () => void;
|
|
111
|
+
};
|
|
94
112
|
}
|
|
95
113
|
|
|
96
114
|
interface AutoManualPlayStateProviderProps {
|
|
@@ -99,4 +117,4 @@ interface AutoManualPlayStateProviderProps {
|
|
|
99
117
|
}
|
|
100
118
|
declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
|
|
101
119
|
|
|
102
|
-
export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
|
|
120
|
+
export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE, WIDGET, type Widget, format };
|