@enigma-lake/mines-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.
Files changed (35) hide show
  1. package/README.md +179 -0
  2. package/dist/components/AutoManualPlayStateProvider/AutoManualPlayProvider.d.ts +9 -0
  3. package/dist/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.d.ts +28 -0
  4. package/dist/components/AutoManualPlayStateProvider/index.d.ts +1 -0
  5. package/dist/components/base/AutoPlayController/AutoPlayController.d.ts +2 -0
  6. package/dist/components/base/AutoPlayController/index.d.ts +1 -0
  7. package/dist/components/base/Button/Button.d.ts +19 -0
  8. package/dist/components/base/Button/index.d.ts +1 -0
  9. package/dist/components/base/GroupRow/GroupRow.d.ts +6 -0
  10. package/dist/components/base/GroupRow/index.d.ts +1 -0
  11. package/dist/components/base/Input/Input.d.ts +3 -0
  12. package/dist/components/base/Input/cleanInputNumber.d.ts +2 -0
  13. package/dist/components/base/Input/index.d.ts +1 -0
  14. package/dist/components/base/InputWithIcon/InputWithIcon.d.ts +15 -0
  15. package/dist/components/base/InputWithIcon/index.d.ts +1 -0
  16. package/dist/components/base/ManualPlayController/ManualPlayController.d.ts +2 -0
  17. package/dist/components/base/ManualPlayController/index.d.ts +1 -0
  18. package/dist/components/base/PlayController/PlayController.d.ts +14 -0
  19. package/dist/components/base/SelectMenu/GoldIcon.d.ts +1 -0
  20. package/dist/components/base/SelectMenu/SelectMenu.d.ts +11 -0
  21. package/dist/components/base/SelectMenu/SweepsIcon.d.ts +1 -0
  22. package/dist/components/base/SelectMenu/index.d.ts +1 -0
  23. package/dist/components/base/Switch/Switch.d.ts +10 -0
  24. package/dist/components/base/index.d.ts +6 -0
  25. package/dist/components/hooks/usePlayController.d.ts +26 -0
  26. package/dist/components/index.d.ts +4 -0
  27. package/dist/components/utils.d.ts +1 -0
  28. package/dist/index.d.ts +82 -0
  29. package/dist/index.mjs +361 -0
  30. package/dist/index.mjs.map +1 -0
  31. package/dist/style.css +1 -0
  32. package/dist/types/gameMode.d.ts +9 -0
  33. package/dist/types/index.d.ts +2 -0
  34. package/dist/types/playController.d.ts +39 -0
  35. package/package.json +81 -0
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+
2
+ # MinesPlayController
3
+
4
+ The `MinesPlayController` 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 `MinesPlayController` 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
+
18
+ ---
19
+
20
+ ## Setup
21
+
22
+ ### 1. Install the package using npm:
23
+
24
+ ```bash
25
+ npm install @enigma-lake/mines-play-controller-sdk
26
+ ```
27
+
28
+ ### 2. Import the component and styles in your project:
29
+
30
+ ```tsx
31
+ import {
32
+ AUTO_PLAY_STATE,
33
+ GAME_MODE,
34
+ AutoManualPlayProvider,
35
+ } from "@enigma-lake/mines-play-controller-sdk";
36
+
37
+ import "@enigma-lake/mines-play-controller-sdk/dist/style.css";
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Context & Provider
43
+
44
+ ### `AutoManualPlayProvider`
45
+
46
+ The `AutoManualPlayProvider` wraps the MinesPlayController, managing both manual play and autoplay. It uses React Context to provide game state and actions throughout the component tree.
47
+
48
+ 🔹 **Features of `AutoManualPlayProvider`**:
49
+ - **Manages Game Mode**: Switches between MANUAL and AUTOPLAY.
50
+ - **Handles Autoplay**: Sets the number of plays, tracks rounds, and stops automatically.
51
+ - **Provides Context:** Exposes state and functions for controlling play behavior.
52
+
53
+ ## Props
54
+
55
+ ### 1. `StylingProps`
56
+
57
+ Handles the styling-related properties for the component.
58
+
59
+ - **`panel` (optional)**: Custom styling for the play controller.
60
+ - **`bgColorHex`**: Hex color for the panel background.
61
+ - **`bottom`**: Bottom margin for the panel relative to the window.
62
+
63
+ ### 2. `CurrencyProps`
64
+
65
+ Handles currency-related logic and settings.
66
+
67
+ - **`currencyOptions`**: An object containing the following properties:
68
+ - **`currentCurrency`**: The currently selected currency (e.g., `Currency.SWEEPS`).
69
+ - **`currencies`**: Array of available currencies that the user can choose from.
70
+ - **`winText`**: The win amount during the playing.
71
+
72
+ ### 3. `ActionsProps`
73
+
74
+ Defines functions for the user actions.
75
+
76
+ - **`onPlay`**: A callback function to trigger when the user starts a play.
77
+ - **`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).
78
+ - **`onCashout`**: A callback function to trigger when the user decides to cash out their winnings.
79
+
80
+ ### 4. `PlaySettingsProps`
81
+
82
+ Handles game-specific settings and states.
83
+
84
+ - **`playOptions`**: An object containing the following properties:
85
+ - **`isPlaying`**: Boolean flag indicating whether the game is currently in progress.
86
+ - **`canCashout`**: Boolean flag indicating whether the user can cash out their current play.
87
+ - **`disabledController`**: Boolean flag to disable all interactive elements in the component, preventing user interactions (e.g., when the game is in progress).
88
+ - **`displayController`**: Boolean flag to determine if the play controller should be visible.
89
+ - **`showAutoPlayToast`**: A function to show a toast message during autoplay. Accepts an object with:
90
+ - **`type`**: Message type (`"success"`, `"error"`, `"warning"`, or `"info"`).
91
+ - **`message`**: The message to display.
92
+ - **`playHook`**: A hook providing the current play amount, play limits, and a function to set the play amount.
93
+ - **`playLimits`**: Play limits for the game.
94
+ - **`playAmount`**: The current play amount.
95
+ - **`setPlayAmount`**: A function to set the play amount.
96
+ - **`autoPlayDelay`** (optional): The delay (in milliseconds) before auto play starts.
97
+
98
+ ---
99
+
100
+ ## Example Usage
101
+
102
+ ```tsx
103
+ import "@enigma-lake/mines-play-controller-sdk/dist/style.css";
104
+ import { AutoManualPlayProvider, GAME_MODE, AUTO_PLAY_STATE } from "@enigma-lake/mines-play-controller-sdk";
105
+ import { Currency } from "@enigma-lake/zoot-platform-sdk";
106
+
107
+ const GameExample = () => {
108
+ const config = {
109
+ currencyOptions: {
110
+ currentCurrency: Currency.SWEEPS,
111
+ currencies: [Currency.SWEEPS, Currency.GOLD],
112
+ winText: "0.00 SC",
113
+ },
114
+ onPlay: () => console.log("Play button clicked"),
115
+ onAutoPlay: (selection, next, stop) => {
116
+ console.log("Auto Play started with selection:", selection);
117
+ next(); // Proceed to the next autoplay round
118
+ stop(); // Stop autoplay (e.g., in case of an error or when the user chooses to stop)
119
+ },
120
+ onCashout: () => console.log("Cashout clicked"),
121
+ playOptions: {
122
+ displayController: true,
123
+ canCashout: false,
124
+ isPlaying: false,
125
+ disabledController: false,
126
+ showAutoPlayToast: (props) => {
127
+ console.log(`${props.type}: ${props.message}`);
128
+ },
129
+ playHook: () => {
130
+ return {
131
+ playLimits: { min: 1, max: 100 },
132
+ playAmount: 10,
133
+ setPlayAmount: (value) => console.log("New play amount:", value),
134
+ };
135
+ },
136
+ },
137
+ panel: {
138
+ bottom: '15px',
139
+ bgColorHex: "#081E64"
140
+ }
141
+ };
142
+
143
+ return (
144
+ <AutoManualPlayProvider config={config}>
145
+ {({ autoPlay: { selection, setSelection, state }, mode }) => (
146
+ // children content
147
+ )}
148
+ </AutoManualPlayProvider>
149
+ );
150
+ };
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Key Features
156
+
157
+ 1. **Dynamic Currency Handling**:
158
+ - Supports multiple currencies (e.g., SWEEPS, GOLD).
159
+ - Allows users to switch currencies easily.
160
+
161
+ 2. **Play Amount Adjustment**:
162
+ - Includes buttons to halve or double the play amount.
163
+ - Validates play amounts against user balance and play limits.
164
+
165
+ 3. **Custom Styling**:
166
+ - Supports customizable input and button colors.
167
+
168
+ 4. **Play & Cashout Actions**:
169
+ - Allows users to initiate gameplay or cash out winnings seamlessly.
170
+
171
+ ---
172
+
173
+ ## Development Notes
174
+
175
+ 1. **Play Amount Validation**:
176
+ - The play amount is validated to ensure it falls within the minimum and maximum limits, as well as the user's available balance.
177
+
178
+ 2. **Responsive Design**:
179
+ - 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,2 @@
1
+ declare const AutoPlayController: () => import("react/jsx-runtime").JSX.Element;
2
+ export default AutoPlayController;
@@ -0,0 +1 @@
1
+ export { default } from "./AutoPlayController";
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ declare const themes: {
3
+ primary: string;
4
+ success: string;
5
+ ghost: string;
6
+ };
7
+ type Props = React.ComponentProps<"button"> & {
8
+ theme?: (typeof themes)[keyof typeof themes];
9
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
10
+ };
11
+ declare const Button: {
12
+ ({ disabled, className, theme, onClick, ...props }: Props): import("react/jsx-runtime").JSX.Element;
13
+ themes: {
14
+ primary: string;
15
+ success: string;
16
+ ghost: string;
17
+ };
18
+ };
19
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+ export type Props = ComponentProps<"div"> & {
3
+ label?: string;
4
+ };
5
+ declare const GroupRow: ({ children, label, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default GroupRow;
@@ -0,0 +1 @@
1
+ export { default } from "./GroupRow";
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Input: ({ onChange, disabled, className, ...restProps }: React.ComponentProps<"input">) => import("react/jsx-runtime").JSX.Element;
3
+ export default Input;
@@ -0,0 +1,2 @@
1
+ export declare function findFirstSeparatorIndex(value: string): number | undefined;
2
+ export declare function cleanInputNumber(value: string): string;
@@ -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,2 @@
1
+ declare const ManualPlayController: () => import("react/jsx-runtime").JSX.Element;
2
+ export default ManualPlayController;
@@ -0,0 +1 @@
1
+ export { default } from "./ManualPlayController";
@@ -0,0 +1,14 @@
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
+ }
13
+ declare const PlayAmountControl: ({ playAmount, minPlayAmount, maxPlayAmount, isDisabled, adjustPlayAmount, onChangeAmount, onBlurAmount, currentCurrency, currencies, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
14
+ 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,6 @@
1
+ import Button from "./Button";
2
+ import GroupRow from "./GroupRow";
3
+ import Input from "./Input";
4
+ import InputWithIcon from "./InputWithIcon";
5
+ import SelectMenu from "./SelectMenu";
6
+ export { Button, InputWithIcon, GroupRow, Input, SelectMenu };
@@ -0,0 +1,26 @@
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
+ isValidPlayAmount: boolean;
14
+ winText: string;
15
+ manualPlay: {
16
+ isDisabled: () => boolean;
17
+ onPlay: () => void;
18
+ canCashout: boolean;
19
+ };
20
+ autoPlay: {
21
+ isDisabled: () => boolean;
22
+ state: AUTO_PLAY_STATE;
23
+ onPlay: () => void;
24
+ onStopPlay: () => void;
25
+ };
26
+ };
@@ -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 @@
1
+ export declare const hexToRgb: (hex: string) => string | null;
@@ -0,0 +1,82 @@
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
+ type StylingProps = {
15
+ panel: {
16
+ bottom: string;
17
+ bgColorHex: string;
18
+ };
19
+ };
20
+ type CurrencyProps = {
21
+ currentCurrency: Currency;
22
+ currencies: Currency[];
23
+ winText: string;
24
+ };
25
+ type ActionsProps = {
26
+ onPlay: () => void;
27
+ onAutoPlay: (selection: number[], next: () => void, stop: () => void) => void;
28
+ onCashout: () => void;
29
+ };
30
+ type PlaySettingsProps = {
31
+ isPlaying: boolean;
32
+ canCashout: boolean;
33
+ disabledController: boolean;
34
+ displayController: boolean;
35
+ showAutoPlayToast: (props: {
36
+ type: "success" | "error" | "warning" | "info";
37
+ message: string;
38
+ }) => void;
39
+ playHook: () => {
40
+ playLimits?: PlayLimits;
41
+ playAmount: number;
42
+ setPlayAmount: (value: number) => void;
43
+ };
44
+ autoPlayDelay?: number;
45
+ };
46
+ type PlayControllerProps = StylingProps & ActionsProps & {
47
+ currencyOptions: CurrencyProps;
48
+ playOptions: PlaySettingsProps;
49
+ };
50
+
51
+ interface AutoManualPlayStateContextType {
52
+ mode: GAME_MODE;
53
+ config: PlayControllerProps;
54
+ manual: {
55
+ playManualMode: () => void;
56
+ };
57
+ autoPlay: {
58
+ state: AUTO_PLAY_STATE;
59
+ playedRounds: number;
60
+ numberOfPlays: number;
61
+ selection: number[];
62
+ isActive: boolean;
63
+ setIsActive: React.Dispatch<React.SetStateAction<boolean>>;
64
+ start: (numberOfPlays: number) => void;
65
+ stop: () => void;
66
+ setState: React.Dispatch<React.SetStateAction<AUTO_PLAY_STATE>>;
67
+ setPlayedRounds: React.Dispatch<React.SetStateAction<number>>;
68
+ setNumberOfPlays: React.Dispatch<React.SetStateAction<number>>;
69
+ setSelection: (values: number[]) => void;
70
+ updateState: (newState: AUTO_PLAY_STATE.SELECTING | AUTO_PLAY_STATE.PLAYING) => void;
71
+ };
72
+ reset: () => void;
73
+ toggleMode: () => void;
74
+ }
75
+
76
+ interface AutoManualPlayStateProviderProps {
77
+ children: React.ReactNode | ((state: AutoManualPlayStateContextType) => ReactElement);
78
+ config: PlayControllerProps;
79
+ }
80
+ declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
81
+
82
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
package/dist/index.mjs ADDED
@@ -0,0 +1,361 @@
1
+ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
2
+ import cx from 'classnames';
3
+ import { useCallback, useMemo, Fragment, createContext, useContext, useRef, useState } from 'react';
4
+ import { useDebouncedCallback } from 'use-debounce';
5
+ import { Switch as Switch$1, Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/react';
6
+ import { Currency, sendSetUserCurrencyEvent } from '@enigma-lake/zoot-platform-sdk';
7
+
8
+ var GAME_MODE;
9
+ (function (GAME_MODE) {
10
+ GAME_MODE["MANUAL"] = "manual";
11
+ GAME_MODE["AUTOPLAY"] = "autoplay";
12
+ })(GAME_MODE || (GAME_MODE = {}));
13
+ var AUTO_PLAY_STATE;
14
+ (function (AUTO_PLAY_STATE) {
15
+ AUTO_PLAY_STATE["IDLE"] = "idle";
16
+ AUTO_PLAY_STATE["SELECTING"] = "selecting";
17
+ AUTO_PLAY_STATE["PLAYING"] = "playing";
18
+ })(AUTO_PLAY_STATE || (AUTO_PLAY_STATE = {}));
19
+
20
+ var styles_button = {"base":"Button-module__base___muNxk","base__theme-ghost":"Button-module__base__theme-ghost___I5-LJ","base__theme-primary":"Button-module__base__theme-primary___Zuswb","base__state-disabled":"Button-module__base__state-disabled___EU5tH","buttonCashout":"Button-module__buttonCashout___LG-Yr","buttonSweeps":"Button-module__buttonSweeps___0snDQ","buttonGold":"Button-module__buttonGold___DAj-d"};
21
+
22
+ const themes = {
23
+ primary: "primary",
24
+ success: "success",
25
+ ghost: "ghost",
26
+ };
27
+ const Button = ({ disabled, className = "", theme = "primary", onClick = () => { }, ...props }) => {
28
+ const debouncedOnClick = useDebouncedCallback(onClick, 20);
29
+ const handleOnClick = useCallback((event) => {
30
+ debouncedOnClick(event);
31
+ }, [debouncedOnClick]);
32
+ return (jsx("button", { ...props, className: cx(styles_button.base, styles_button[`base__theme-${theme}`], className, {
33
+ [styles_button["base__state-disabled"]]: disabled,
34
+ }), disabled: disabled, onClick: handleOnClick }));
35
+ };
36
+ Button.themes = themes;
37
+
38
+ var styles_group = {"label":"GroupRow-module__label___Du57P","group":"GroupRow-module__group___V7xa6","groupItem":"GroupRow-module__groupItem___yNSX8","x2":"GroupRow-module__x2___9bLae","last":"GroupRow-module__last___ArsSn"};
39
+
40
+ const GroupRow = ({ children, label, className, ...restProps }) => {
41
+ return (jsxs("div", { ...restProps, className: cx(styles_group.base, className), children: [label && jsx("div", { className: styles_group.label, children: label }), jsx("div", { className: styles_group.group, children: children })] }));
42
+ };
43
+
44
+ const ALLOWED_SEPARATORS = [",", "."];
45
+ function findFirstSeparatorIndex(value) {
46
+ const index = [...value].findIndex((char) => ALLOWED_SEPARATORS.includes(char));
47
+ return index !== -1 ? index : undefined;
48
+ }
49
+ function cleanInputNumber(value) {
50
+ const cleaned = value.replace(/[^0-9,.]/g, "");
51
+ if (cleaned === "0") {
52
+ return cleaned;
53
+ }
54
+ const trimmed = cleaned.replace(/^0+(?!$)/, "").replace(/(,|\.){2,}/g, "$1");
55
+ const separatorIndex = findFirstSeparatorIndex(trimmed);
56
+ if (separatorIndex === undefined) {
57
+ return trimmed;
58
+ }
59
+ const integerPart = trimmed.slice(0, separatorIndex).replace(/[,.]/g, "") || "0";
60
+ const decimalPart = trimmed.slice(separatorIndex + 1).replace(/[,.]/g, "");
61
+ return `${integerPart}.${decimalPart}`;
62
+ }
63
+
64
+ var styles$3 = {"base":"Input-module__base___IifiA","disabled":"Input-module__disabled___WqyKa"};
65
+
66
+ const Input = ({ onChange, disabled, className, ...restProps }) => {
67
+ const handleChange = useCallback((event) => {
68
+ if (!disabled) {
69
+ event.target.value = cleanInputNumber(event.target.value);
70
+ onChange?.(event);
71
+ }
72
+ }, [disabled, onChange]);
73
+ return (jsx("input", { ...restProps, disabled: disabled, onChange: handleChange, className: cx(styles$3.base, className, { [styles$3.disabled]: disabled }) }));
74
+ };
75
+
76
+ var styles$2 = {"base":"Switch-module__base___gj2ey","switcher":"Switch-module__switcher___gHXIx","gold":"Switch-module__gold___oewnb","sweeps":"Switch-module__sweeps___yS-IY","unchecked":"Switch-module__unchecked___ooSS2","disabled":"Switch-module__disabled___lMRv0","thumb":"Switch-module__thumb___1wJ9D","move-right":"Switch-module__move-right___ca-6D","label":"Switch-module__label___pG2uz"};
77
+
78
+ const Switch = ({ enabled, onSwitch, disabled, currency, isPlaying, }) => {
79
+ const switcherClassName = useMemo(() => cx(styles$2.switcher, styles$2[currency], {
80
+ [styles$2.checked]: enabled,
81
+ [styles$2.unchecked]: !enabled,
82
+ [styles$2.disabled]: disabled,
83
+ }), [enabled, currency, disabled]);
84
+ return (jsx(Switch$1, { checked: enabled, onChange: onSwitch, as: Fragment, disabled: isPlaying, children: jsxs("div", { className: styles$2.base, children: [jsx("span", { className: styles$2.label, children: "Auto" }), jsx("div", { className: switcherClassName, children: jsx("span", { className: cx(styles$2.thumb, { [styles$2["move-right"]]: enabled }) }) })] }) }));
85
+ };
86
+
87
+ var styles$1 = {"base":"InputWithIcon-module__base___FwgXx","icon":"InputWithIcon-module__icon___KtOjW","input":"InputWithIcon-module__input___mQFr9","inputWithLabel":"InputWithIcon-module__inputWithLabel___06L8W","label":"InputWithIcon-module__label___O28vw","gold":"InputWithIcon-module__gold___GlVw1","sweeps":"InputWithIcon-module__sweeps___J4JdJ"};
88
+
89
+ const InputWithIcon = ({ children, switcherConfig, disabled, currency, label, className, ...restProps }) => {
90
+ return (jsxs("div", { className: cx(styles$1.base, className, {
91
+ [styles$1.disabled]: switcherConfig?.disabled,
92
+ }), children: [label && (jsx("span", { className: cx(styles$1.label, styles$1[currency]), children: label })), jsx(Input, { ...restProps, className: cx(styles$1.input, {
93
+ [styles$1.inputWithLabel]: label !== undefined,
94
+ }), disabled: disabled }), switcherConfig && jsx(Switch, { ...switcherConfig }), children && jsx("div", { className: cx(styles$1.icon), children: children })] }));
95
+ };
96
+
97
+ const GoldIcon = () => (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", children: [jsx("path", { opacity: "0.39", d: "M7.41645 14.1044C11.0357 14.1044 13.9697 11.136 13.9697 7.47417C13.9697 3.81236 11.0357 0.843872 7.41645 0.843872C3.79725 0.843872 0.863281 3.81236 0.863281 7.47417C0.863281 11.136 3.79725 14.1044 7.41645 14.1044Z", fill: "#F2BF0B" }), jsx("path", { d: "M7.49933 13.5066C5.90609 13.5066 4.37818 12.8736 3.25163 11.7471C2.12508 10.6205 1.49219 9.09258 1.49219 7.49944C1.49219 5.90626 2.12508 4.37833 3.25163 3.25178C4.37818 2.12523 5.90609 1.49234 7.49933 1.49234C8.32641 1.48979 9.14495 1.6605 9.90213 1.99347C9.92954 2.00654 9.9541 2.02489 9.97447 2.04746C9.99484 2.07003 10.0105 2.0964 10.0207 2.12503C10.0308 2.15367 10.0352 2.18402 10.0336 2.21437C10.032 2.2447 10.0244 2.27444 10.0113 2.30186C9.98737 2.3563 9.94287 2.39903 9.88746 2.42071C9.83205 2.44238 9.77036 2.44123 9.71579 2.4175C9.01511 2.11018 8.25801 1.95261 7.49287 1.95492C6.19268 1.95633 4.93427 2.41409 3.93705 3.24836C2.93984 4.08263 2.26711 5.24047 2.03619 6.51997C1.80527 7.79947 2.03081 9.11941 2.67348 10.2497C3.31615 11.3799 4.33517 12.2487 5.55286 12.7045C6.77048 13.1603 8.10948 13.1743 9.3364 12.7439C10.5632 12.3135 11.6001 11.466 12.2661 10.3494C12.9322 9.23282 13.1852 7.91786 12.9809 6.63384C12.7767 5.34981 12.1281 4.17822 11.1485 3.32338C11.1125 3.28223 11.0928 3.22938 11.0929 3.17472C11.0931 3.12006 11.1132 3.06732 11.1494 3.02638C11.1856 2.98544 11.2355 2.9591 11.2897 2.95227C11.344 2.94544 11.3988 2.9586 11.4441 2.98929C12.3644 3.79366 13.0174 4.85964 13.316 6.04489C13.6146 7.23014 13.5444 8.47827 13.1151 9.62268C12.6857 10.767 11.9174 11.7531 10.9128 12.4495C9.90824 13.1457 8.71519 13.519 7.49287 13.5194L7.49933 13.5066Z", fill: "#F2BF0B" }), jsx("path", { d: "M7.50001 14.6249C6.09085 14.6249 4.71327 14.207 3.54156 13.4241C2.36986 12.6412 1.45664 11.5284 0.91736 10.2265C0.378089 8.92454 0.236989 7.49197 0.511905 6.10986C0.78683 4.72775 1.46542 3.45819 2.46187 2.46175C3.45832 1.4653 4.72787 0.786705 6.10996 0.511786C7.49213 0.236866 8.92467 0.377965 10.2266 0.91724C11.5286 1.45651 12.6413 2.36974 13.4242 3.54145C14.2071 4.71314 14.625 6.09069 14.625 7.49988C14.6233 9.38901 13.8721 11.2003 12.5363 12.5362C11.2004 13.872 9.38914 14.6232 7.50001 14.6249ZM7.50001 1.01735C6.21784 1.01735 4.96455 1.39754 3.8985 2.10986C2.83246 2.82216 2.00158 3.83459 1.51093 5.01912C1.02028 6.20365 0.891903 7.50707 1.14203 8.76452C1.39216 10.022 2.00956 11.1771 2.91617 12.0837C3.82276 12.9903 4.97784 13.6077 6.23536 13.8578C7.4928 14.1079 8.79625 13.9796 9.98076 13.489C11.1653 12.9983 12.1777 12.1674 12.89 11.1014C13.6024 10.0354 13.9825 8.78204 13.9825 7.49988C13.9791 5.78165 13.2951 4.13477 12.0801 2.91979C10.8651 1.70481 9.21822 1.02075 7.50001 1.01735Z", fill: "#F2BF0B" }), jsx("path", { d: "M10.1591 10.5131C9.43158 10.7452 8.6739 10.8686 7.91043 10.8794C6.91972 10.9596 5.93706 10.6482 5.17347 10.012C4.86218 9.70525 4.61761 9.33743 4.45509 8.93173C4.29258 8.52596 4.21562 8.09104 4.22904 7.65417C4.22904 5.37982 5.94443 4.22981 8.08386 4.22981C8.72897 4.20483 9.37215 4.31423 9.97274 4.55104L9.61934 5.95163C9.13325 5.7425 8.60617 5.64587 8.07741 5.66894C7.8189 5.63999 7.55711 5.6683 7.31067 5.75187C7.06423 5.83544 6.83925 5.9722 6.65165 6.15248C6.46397 6.33274 6.31837 6.5521 6.22499 6.79497C6.13161 7.03784 6.09288 7.29828 6.11149 7.5578C6.0892 7.80993 6.12113 8.0639 6.20512 8.30265C6.2892 8.5414 6.42332 8.75939 6.59859 8.94195C6.77387 9.12461 6.98628 9.26753 7.2214 9.36124C7.45653 9.45496 7.709 9.4972 7.96181 9.48522C8.14782 9.49377 8.33407 9.47423 8.51429 9.42738V8.29664H7.60841V6.94745H10.1783L10.1591 10.5131Z", fill: "#F2BF0B" })] }));
98
+
99
+ const SweepsIcon = () => (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", children: [jsx("path", { opacity: "0.39", d: "M7.41174 14.4521C11.2215 14.4521 14.3099 11.3275 14.3099 7.47291C14.3099 3.61837 11.2215 0.493652 7.41174 0.493652C3.60206 0.493652 0.513672 3.61837 0.513672 7.47291C0.513672 11.3275 3.60206 14.4521 7.41174 14.4521Z", fill: "#0DE83D" }), jsx("path", { d: "M8.35827 6.34123C8.33727 6.1169 8.25066 5.94313 8.09843 5.81991C7.94619 5.6951 7.75459 5.6327 7.52362 5.6327C7.35827 5.6327 7.21522 5.6643 7.09449 5.72749C6.97375 5.7891 6.87992 5.87441 6.81299 5.98341C6.74738 6.09084 6.71457 6.21327 6.71457 6.35071C6.71457 6.46603 6.73688 6.56556 6.7815 6.64929C6.82743 6.73302 6.88714 6.80332 6.96063 6.86019C7.03543 6.91548 7.11549 6.96209 7.20079 7C7.28609 7.03633 7.36811 7.06635 7.44685 7.09005L7.84055 7.21327C7.96916 7.25118 8.10105 7.30253 8.23622 7.3673C8.37139 7.43207 8.49672 7.51738 8.6122 7.62322C8.72769 7.72907 8.82087 7.86019 8.89173 8.01659C8.96391 8.17299 9 8.36019 9 8.5782C9 8.85308 8.94094 9.09716 8.82283 9.31043C8.70604 9.5237 8.53609 9.69194 8.31299 9.81517C8.09121 9.93839 7.82283 10 7.50787 10C7.20604 10 6.94488 9.94234 6.72441 9.82701C6.50394 9.71169 6.33136 9.54818 6.20669 9.33649C6.08202 9.12322 6.01312 8.87046 6 8.5782H6.61024C6.62205 8.75355 6.66929 8.89968 6.75197 9.01659C6.83596 9.13191 6.94291 9.21801 7.07283 9.27488C7.20407 9.33017 7.34777 9.35782 7.50394 9.35782C7.67585 9.35782 7.82874 9.32543 7.9626 9.26066C8.09777 9.19431 8.20407 9.10269 8.2815 8.98578C8.35892 8.8673 8.39764 8.72907 8.39764 8.57109C8.39764 8.42733 8.36352 8.30964 8.29528 8.21801C8.22835 8.12638 8.13714 8.05055 8.02165 7.99052C7.90748 7.93049 7.77822 7.87757 7.63386 7.83175L7.15748 7.67536C6.83465 7.56951 6.57874 7.4139 6.38976 7.20853C6.2021 7.00316 6.10827 6.73144 6.10827 6.39336C6.10827 6.11374 6.17126 5.86967 6.29724 5.66114C6.42323 5.45261 6.59383 5.29068 6.80906 5.17536C7.02428 5.05845 7.26706 5 7.5374 5C7.81037 5 8.05118 5.05766 8.25984 5.17299C8.46982 5.28831 8.63517 5.44708 8.75591 5.64929C8.87664 5.84992 8.93963 6.08057 8.94488 6.34123H8.35827Z", fill: "#0DE83D" }), jsx("path", { d: "M7.50006 13.8228C5.82297 13.8228 4.21465 13.1566 3.0288 11.9708C1.84296 10.7849 1.17676 9.17656 1.17676 7.49957C1.17676 5.82253 1.84296 4.21419 3.0288 3.02834C4.21465 1.8425 5.82297 1.1763 7.50006 1.1763C8.37068 1.17362 9.2323 1.35331 10.0293 1.7038C10.0582 1.71756 10.084 1.73688 10.1055 1.76064C10.1269 1.7844 10.1434 1.81215 10.1541 1.84229C10.1648 1.87244 10.1694 1.90439 10.1677 1.93633C10.166 1.96826 10.1581 1.99956 10.1443 2.02842C10.1191 2.08573 10.0722 2.13071 10.0139 2.15353C9.95556 2.17634 9.89062 2.17513 9.83318 2.15015C9.09562 1.82665 8.29868 1.6608 7.49327 1.66323C6.12465 1.66471 4.8 2.14656 3.7503 3.02474C2.7006 3.90292 1.99247 5.1217 1.74939 6.46855C1.50632 7.81539 1.74373 9.20479 2.42022 10.3946C3.09672 11.5842 4.16937 12.4988 5.45115 12.9786C6.73285 13.4583 8.14233 13.4731 9.43383 13.02C10.7252 12.567 11.8167 11.6749 12.5177 10.4996C13.2189 9.32417 13.4851 7.94001 13.2701 6.5884C13.0552 5.2368 12.3725 4.00354 11.3413 3.10371C11.3034 3.0604 11.2826 3.00476 11.2828 2.94723C11.283 2.88969 11.3041 2.83418 11.3423 2.79108C11.3804 2.74799 11.4329 2.72026 11.49 2.71307C11.5471 2.70588 11.6048 2.71974 11.6524 2.75204C12.6211 3.59875 13.3086 4.72083 13.6229 5.96845C13.9372 7.21609 13.8633 8.52992 13.4114 9.73456C12.9594 10.9391 12.1507 11.9771 11.0932 12.7101C10.0358 13.443 8.77991 13.8359 7.49327 13.8363L7.50006 13.8228Z", fill: "#0DE83D" }), jsx("path", { d: "M7.50001 15C6.01668 15 4.5666 14.5601 3.33323 13.736C2.09986 12.9119 1.13857 11.7406 0.570905 10.3701C0.00325189 8.99965 -0.145274 7.49168 0.144111 6.03682C0.433505 4.58197 1.14781 3.24559 2.1967 2.19671C3.2456 1.14781 4.58197 0.433502 6.0368 0.144114C7.49171 -0.145275 8.99965 0.00324947 10.3701 0.570907C11.7406 1.13856 12.9119 2.09986 13.736 3.33323C14.5602 4.56659 15 6.01664 15 7.5C14.9982 9.48856 14.2075 11.3951 12.8014 12.8014C11.3952 14.2075 9.48857 14.9982 7.50001 15ZM7.50001 0.676288C6.15036 0.676288 4.83111 1.07649 3.70895 1.82629C2.5868 2.57609 1.71218 3.64181 1.19572 4.88868C0.679241 6.13555 0.544108 7.50757 0.807402 8.83121C1.0707 10.1549 1.72059 11.3708 2.67491 12.3251C3.62922 13.2794 4.84509 13.9293 6.1688 14.1926C7.49242 14.4559 8.86448 14.3208 10.1113 13.8043C11.3582 13.2878 12.4239 12.4132 13.1737 11.291C13.9235 10.1689 14.3237 8.84965 14.3237 7.5C14.3202 5.69134 13.6001 3.95778 12.3212 2.67886C11.0422 1.39993 9.30865 0.679862 7.50001 0.676288Z", fill: "#0DE83D" })] }));
100
+
101
+ var styles = {"button":"SelectMenu-module__button___N-HeB","disabled":"SelectMenu-module__disabled___jiTPl","menu":"SelectMenu-module__menu___c5jvZ","menu_item":"SelectMenu-module__menu_item___fpgJy","menu_name":"SelectMenu-module__menu_name___X4-Sk","selected":"SelectMenu-module__selected___XyADw","arrow":"SelectMenu-module__arrow___qiOb9"};
102
+
103
+ const ArrowIcon = () => (jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { className: styles.arrow, d: "M6 9L12 15L18 9", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
104
+ const getIcon = (option) => option === Currency.SWEEPS ? jsx(SweepsIcon, {}) : jsx(GoldIcon, {});
105
+ const SelectMenu = ({ currencies, selectedCurrency, setSelectedCurrency, disabled = false, }) => {
106
+ const handleOnChange = (newCurrency) => {
107
+ if (disabled) {
108
+ return;
109
+ }
110
+ setSelectedCurrency({ currency: newCurrency });
111
+ };
112
+ return (jsxs(Listbox, { value: selectedCurrency, onChange: handleOnChange, children: [jsxs(ListboxButton, { className: cx(styles.button, { [styles.disabled]: disabled }), children: [getIcon(selectedCurrency), jsx(ArrowIcon, {})] }), jsx(ListboxOptions, { anchor: "right end", className: styles.menu, children: currencies.map((option) => (jsxs(ListboxOption, { value: option, className: cx(styles.menu_item, {
113
+ [styles.selected]: selectedCurrency === option,
114
+ }), children: [getIcon(option), jsx("div", { className: cx(styles.menu_name), children: option })] }, option))) })] }));
115
+ };
116
+
117
+ const AutoManualPlayStateContext = createContext(undefined);
118
+ const useAutoManualPlayState = () => {
119
+ const context = useContext(AutoManualPlayStateContext);
120
+ if (!context) {
121
+ throw new Error("useAutoManualPlayStateState must be used within a AutoManualPlayStateProvider");
122
+ }
123
+ return context;
124
+ };
125
+
126
+ const usePlayController = () => {
127
+ const { config, autoPlay: { setNumberOfPlays, numberOfPlays, setPlayedRounds, playedRounds, selection, setState, state, }, } = useAutoManualPlayState();
128
+ const { currentCurrency, currencies, winText } = config.currencyOptions;
129
+ const { isPlaying, canCashout, disabledController, showAutoPlayToast, autoPlayDelay = 1500, playHook, } = config.playOptions;
130
+ const { playAmount, playLimits, setPlayAmount } = playHook?.() ?? {};
131
+ const minPlayAmount = playLimits?.[currentCurrency]?.limits.min ?? 0;
132
+ const maxPlayAmount = playLimits?.[currentCurrency]?.limits.max ?? 0;
133
+ const playIntervalRef = useRef(null);
134
+ const isAutoplayActiveRef = useRef(false);
135
+ const stopAutoplay = () => {
136
+ isAutoplayActiveRef.current = false;
137
+ if (playIntervalRef.current) {
138
+ clearTimeout(playIntervalRef.current);
139
+ playIntervalRef.current = null;
140
+ }
141
+ setState(AUTO_PLAY_STATE.SELECTING);
142
+ setTimeout(() => {
143
+ setPlayedRounds(0);
144
+ }, 1500);
145
+ };
146
+ const loopRounds = (currentPlayedRounds, remainingPlays) => {
147
+ if (!isAutoplayActiveRef.current) {
148
+ return;
149
+ }
150
+ if (remainingPlays < 1 || numberOfPlays === 0) {
151
+ setNumberOfPlays(Infinity);
152
+ stopAutoplay();
153
+ return;
154
+ }
155
+ setPlayedRounds(currentPlayedRounds + 1);
156
+ setNumberOfPlays((prev) => Math.max(prev - 1, 0));
157
+ config.onAutoPlay(selection, () => {
158
+ if (!isAutoplayActiveRef.current) {
159
+ return;
160
+ }
161
+ playIntervalRef.current = setTimeout(() => loopRounds(currentPlayedRounds + 1, remainingPlays - 1), autoPlayDelay);
162
+ }, stopAutoplay);
163
+ };
164
+ const handleAutoPlay = () => {
165
+ if (disabledController) {
166
+ return;
167
+ }
168
+ if (selection.length === 0) {
169
+ showAutoPlayToast?.({
170
+ type: "info",
171
+ message: "Please select at least one tile to start autoplay.",
172
+ });
173
+ return;
174
+ }
175
+ isAutoplayActiveRef.current = true;
176
+ setState(AUTO_PLAY_STATE.PLAYING);
177
+ loopRounds(playedRounds, numberOfPlays);
178
+ };
179
+ const isDisabled = () => disabledController || isPlaying;
180
+ const isAutoplayDisabled = () => disabledController || state === AUTO_PLAY_STATE.PLAYING;
181
+ const adjustPlayAmount = (multiplier) => {
182
+ if (isDisabled()) {
183
+ return;
184
+ }
185
+ const newAmount = Math.max(minPlayAmount, Math.min(playAmount * multiplier, maxPlayAmount));
186
+ setPlayAmount(Number(newAmount.toFixed(2)));
187
+ };
188
+ const onChangeAmount = (event) => {
189
+ if (isDisabled()) {
190
+ return;
191
+ }
192
+ setPlayAmount(Number(event.currentTarget.value));
193
+ };
194
+ const onBlurAmount = (event) => {
195
+ if (isDisabled()) {
196
+ return;
197
+ }
198
+ const newAmount = Number(event.currentTarget.value);
199
+ setPlayAmount(Math.max(minPlayAmount, Math.min(newAmount, maxPlayAmount)));
200
+ };
201
+ const isValidPlayAmount = playAmount >= minPlayAmount && playAmount <= maxPlayAmount;
202
+ return {
203
+ currentCurrency,
204
+ currencies,
205
+ playAmount,
206
+ minPlayAmount,
207
+ maxPlayAmount,
208
+ setPlayAmount,
209
+ adjustPlayAmount,
210
+ onChangeAmount,
211
+ onBlurAmount,
212
+ isValidPlayAmount,
213
+ winText,
214
+ manualPlay: {
215
+ isDisabled,
216
+ onPlay: config.onPlay,
217
+ canCashout,
218
+ },
219
+ autoPlay: {
220
+ isDisabled: isAutoplayDisabled,
221
+ state,
222
+ onPlay: handleAutoPlay,
223
+ onStopPlay: stopAutoplay,
224
+ },
225
+ };
226
+ };
227
+
228
+ const PLAY_HALVE = 0.5;
229
+ const PLAY_DOUBLE = 2;
230
+
231
+ const PlayAmountControl = ({ playAmount, minPlayAmount, maxPlayAmount, isDisabled, adjustPlayAmount, onChangeAmount, onBlurAmount, currentCurrency, currencies, }) => (jsxs(GroupRow, { children: [jsx(InputWithIcon, { className: styles_group.groupItem, value: playAmount, type: "number", onChange: onChangeAmount, onBlur: onBlurAmount, placeholder: minPlayAmount.toString(), max: maxPlayAmount, min: minPlayAmount, disabled: isDisabled(), currency: currentCurrency, label: "Play Amount", children: jsx(SelectMenu, { currencies: currencies, selectedCurrency: currentCurrency, setSelectedCurrency: sendSetUserCurrencyEvent, disabled: isDisabled() }) }), jsx(Button, { className: styles_group.groupItem, onClick: () => adjustPlayAmount(PLAY_HALVE), theme: "ghost", disabled: isDisabled(), children: jsx("span", { className: styles_group.x2, children: "-" }) }), jsx(Button, { className: styles_group.groupItem, onClick: () => adjustPlayAmount(PLAY_DOUBLE), theme: "ghost", disabled: isDisabled(), children: jsx("span", { className: cx(styles_group.x2, styles_group.last), children: "+" }) })] }));
232
+
233
+ const AutoPlayController = () => {
234
+ const { currentCurrency, currencies, playAmount, minPlayAmount, maxPlayAmount, isValidPlayAmount, adjustPlayAmount, onChangeAmount, onBlurAmount, autoPlay: { isDisabled, state, onPlay, onStopPlay }, } = usePlayController();
235
+ return (jsxs(Fragment$1, { children: [jsx(PlayAmountControl, { playAmount: playAmount, minPlayAmount: minPlayAmount, maxPlayAmount: maxPlayAmount, isDisabled: isDisabled, adjustPlayAmount: adjustPlayAmount, onChangeAmount: onChangeAmount, onBlurAmount: onBlurAmount, currentCurrency: currentCurrency, currencies: currencies }), state === AUTO_PLAY_STATE.PLAYING ? (jsx(Button, { disabled: state !== AUTO_PLAY_STATE.PLAYING, className: styles_button.buttonCashout, onClick: onStopPlay, children: "Stop Autoplay" })) : (jsx(Button, { disabled: isDisabled() || !isValidPlayAmount, className: currentCurrency === Currency.GOLD
236
+ ? styles_button.buttonGold
237
+ : styles_button.buttonSweeps, onClick: onPlay, children: "Start Autoplay" }))] }));
238
+ };
239
+
240
+ const ManualPlayController = () => {
241
+ const { config } = useAutoManualPlayState();
242
+ const { currentCurrency, currencies, playAmount, minPlayAmount, maxPlayAmount, isValidPlayAmount, adjustPlayAmount, onChangeAmount, onBlurAmount, manualPlay: { isDisabled, onPlay, canCashout }, } = usePlayController();
243
+ return (jsxs(Fragment$1, { children: [jsx(PlayAmountControl, { playAmount: playAmount, minPlayAmount: minPlayAmount, maxPlayAmount: maxPlayAmount, isDisabled: isDisabled, adjustPlayAmount: adjustPlayAmount, onChangeAmount: onChangeAmount, onBlurAmount: onBlurAmount, currentCurrency: currentCurrency, currencies: currencies }), canCashout ? (jsxs(Button, { disabled: config.playOptions.disabledController ||
244
+ !config.playOptions.isPlaying, className: styles_button.buttonCashout, onClick: config.onCashout, children: ["Cashout ", config.currencyOptions.winText] })) : (jsx(Button, { disabled: isDisabled() || !isValidPlayAmount, className: currentCurrency === Currency.GOLD
245
+ ? styles_button.buttonGold
246
+ : styles_button.buttonSweeps, onClick: onPlay, children: "Play now" }))] }));
247
+ };
248
+
249
+ var styles_ui = {"base":"UI-module__base___wThyQ","betForm":"UI-module__betForm___hQkYd","disabled":"UI-module__disabled___dnZJX"};
250
+
251
+ const hexToRgb = (hex) => {
252
+ const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
253
+ hex = hex.replace(shorthandRegex, (_, r, g, b) => r + r + g + g + b + b);
254
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
255
+ return result
256
+ ? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`
257
+ : null;
258
+ };
259
+
260
+ const AutoManualPlayProvider = ({ children, config, }) => {
261
+ const [mode, setMode] = useState(GAME_MODE.MANUAL);
262
+ const [autoplayState, setAutoplayState] = useState(AUTO_PLAY_STATE.IDLE);
263
+ const [isAutoPlaying, setIsAutoPlaying] = useState(false);
264
+ const [playedRounds, setPlayedRounds] = useState(0);
265
+ const [numberOfPlays, setNumberOfPlays] = useState(Infinity);
266
+ const [selection, setSelection] = useState([]);
267
+ const startAutoplay = useCallback((numPlays) => {
268
+ setMode(GAME_MODE.AUTOPLAY);
269
+ setAutoplayState(AUTO_PLAY_STATE.SELECTING);
270
+ setNumberOfPlays(numPlays);
271
+ setPlayedRounds(0); // Reset when starting autoplay
272
+ }, []);
273
+ const stopAutoplay = useCallback(() => {
274
+ setMode(GAME_MODE.MANUAL);
275
+ setAutoplayState(AUTO_PLAY_STATE.IDLE);
276
+ setIsAutoPlaying(false);
277
+ }, []);
278
+ const updateAutoplayState = useCallback((newState) => setAutoplayState(newState), []);
279
+ const playManualMode = useCallback(() => {
280
+ setMode(GAME_MODE.MANUAL);
281
+ setAutoplayState(AUTO_PLAY_STATE.IDLE);
282
+ }, []);
283
+ const resetState = useCallback(() => {
284
+ setMode(GAME_MODE.MANUAL);
285
+ setAutoplayState(AUTO_PLAY_STATE.IDLE);
286
+ setPlayedRounds(0);
287
+ setNumberOfPlays(0);
288
+ setSelection([]);
289
+ }, []);
290
+ const toggleMode = useCallback(() => {
291
+ if (config.playOptions.isPlaying ||
292
+ config.playOptions.disabledController ||
293
+ autoplayState === AUTO_PLAY_STATE.PLAYING) {
294
+ return;
295
+ }
296
+ setNumberOfPlays(Infinity);
297
+ setMode((prevMode) => prevMode === GAME_MODE.MANUAL ? GAME_MODE.AUTOPLAY : GAME_MODE.MANUAL);
298
+ }, [autoplayState, config.playOptions]);
299
+ const updateSelection = useCallback((values) => {
300
+ if (!isAutoPlaying) {
301
+ setSelection(values);
302
+ }
303
+ }, [isAutoPlaying]);
304
+ const contextValue = useMemo(() => ({
305
+ mode,
306
+ config,
307
+ manual: { playManualMode },
308
+ autoPlay: {
309
+ state: autoplayState,
310
+ playedRounds,
311
+ numberOfPlays,
312
+ selection,
313
+ isActive: isAutoPlaying,
314
+ start: startAutoplay,
315
+ stop: stopAutoplay,
316
+ setSelection: updateSelection,
317
+ updateState: updateAutoplayState,
318
+ setIsActive: setIsAutoPlaying,
319
+ setPlayedRounds,
320
+ setNumberOfPlays,
321
+ setState: setAutoplayState,
322
+ },
323
+ reset: resetState,
324
+ toggleMode,
325
+ }), [
326
+ mode,
327
+ config,
328
+ playManualMode,
329
+ autoplayState,
330
+ playedRounds,
331
+ numberOfPlays,
332
+ selection,
333
+ isAutoPlaying,
334
+ startAutoplay,
335
+ stopAutoplay,
336
+ updateSelection,
337
+ updateAutoplayState,
338
+ resetState,
339
+ toggleMode,
340
+ ]);
341
+ return (jsxs(AutoManualPlayStateContext.Provider, { value: contextValue, children: [typeof children === "function" ? children(contextValue) : children, config.playOptions.displayController && (jsxs("div", { className: cx(styles_ui.base, styles_ui.betForm), style: {
342
+ "--bet-bottom": config.panel.bottom,
343
+ "--bet-panel-bg": hexToRgb(config.panel.bgColorHex ?? "#ffff"),
344
+ }, children: [jsx(InputWithIcon, { value: numberOfPlays === Infinity ? 0 : numberOfPlays, type: "number", onChange: (e) => setNumberOfPlays(Number(e.currentTarget.value)), placeholder: "Number of Plays", min: 0, disabled: config.playOptions.disabledController ||
345
+ autoplayState === AUTO_PLAY_STATE.PLAYING ||
346
+ mode === GAME_MODE.MANUAL, currency: config.currencyOptions.currentCurrency, switcherConfig: {
347
+ onSwitch: toggleMode,
348
+ isPlaying: isAutoPlaying || config.playOptions.isPlaying,
349
+ enabled: mode !== GAME_MODE.MANUAL,
350
+ currency: config.currencyOptions.currentCurrency,
351
+ disabled: config.playOptions.disabledController ||
352
+ autoplayState === AUTO_PLAY_STATE.PLAYING,
353
+ }, children: jsx("span", { className: cx({
354
+ [styles_ui.disabled]: mode !== GAME_MODE.AUTOPLAY ||
355
+ numberOfPlays !== Infinity ||
356
+ autoplayState === AUTO_PLAY_STATE.PLAYING,
357
+ }), children: `∞` }) }), mode === GAME_MODE.MANUAL ? (jsx(ManualPlayController, {})) : (jsx(AutoPlayController, {}))] }))] }));
358
+ };
359
+
360
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
361
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../src/types/gameMode.ts","../src/components/base/Button/Button.tsx","../src/components/base/GroupRow/GroupRow.tsx","../src/components/base/Input/cleanInputNumber.ts","../src/components/base/Input/Input.tsx","../src/components/base/Switch/Switch.tsx","../src/components/base/InputWithIcon/InputWithIcon.tsx","../src/components/base/SelectMenu/GoldIcon.tsx","../src/components/base/SelectMenu/SweepsIcon.tsx","../src/components/base/SelectMenu/SelectMenu.tsx","../src/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.tsx","../src/components/hooks/usePlayController.ts","../src/types/playController.ts","../src/components/base/PlayController/PlayController.tsx","../src/components/base/AutoPlayController/AutoPlayController.tsx","../src/components/base/ManualPlayController/ManualPlayController.tsx","../src/components/utils.ts","../src/components/AutoManualPlayStateProvider/AutoManualPlayProvider.tsx"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_jsx","styles","_jsxs","HeadlessSwitch","_Fragment"],"mappings":";;;;;;;IAAY;AAAZ,CAAA,UAAY,SAAS,EAAA;AACnB,IAAA,SAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjB,IAAA,SAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHW,SAAS,KAAT,SAAS,GAGpB,EAAA,CAAA,CAAA;IAEW;AAAZ,CAAA,UAAY,eAAe,EAAA;AACzB,IAAA,eAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,eAAA,CAAA,WAAA,CAAA,GAAA,WAAuB;AACvB,IAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAJW,eAAe,KAAf,eAAe,GAI1B,EAAA,CAAA,CAAA;;;;ACJD,MAAM,MAAM,GAAG;AACb,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,OAAO,EAAE,SAAS;AA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AA,MAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CAAC;gCACZ,CAAC,SAAS,CAAC,QAAQ,GACjB,IAAI,KAAK,SAAS,CAAC,QAAQ;AAC3B,oCAAA,aAAa,KAAK,QAAQ;oCAC1B,aAAa,KAAK,eAAe,CAAC,OAAO;AAC5C,6BAAA,CAAC,EACF,QAAA,EAAA,CAAA,CAAA,CAAG,EAAQ,CAAA,EAAA,CACC,EAEf,IAAI,KAAK,SAAS,CAAC,MAAM,IACxBA,GAAA,CAAC,oBAAoB,EAAA,EAAA,CAAG,KAExBA,GAAA,CAAC,kBAAkB,EAAA,EAAA,CAAG,CACvB,CAAA,EAAA,CACG,CACP,CAAA,EAAA,CACmC;AAE1C;;;;"}
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .Button-module__base___muNxk{background:transparent;border:0;cursor:pointer;margin:0;outline:none;user-select:none}.Button-module__base__theme-ghost___I5-LJ{align-items:center;backdrop-filter:blur(10px);border-radius:10px;color:rgba(var(--text-color-hex),1);display:flex;height:35px}.Button-module__base__theme-ghost___I5-LJ:active,.Button-module__base__theme-ghost___I5-LJ:focus,.Button-module__base__theme-ghost___I5-LJ:hover{background:rgba(var(--bg-color-rgb),.05)}.Button-module__base__theme-primary___Zuswb{align-items:center;border-radius:10px;color:rgba(var(--text-color-hex),1);display:flex;height:39px;justify-content:center;letter-spacing:.75px;line-height:125%;margin-top:7px;width:231px}.Button-module__base__state-disabled___EU5tH{color:rgba(var(--text-color-hex),.5)!important;pointer-events:none}.Button-module__buttonCashout___LG-Yr{background:linear-gradient(357deg,#7f44c3 22.01%,#9f5eeb 97.97%)}.Button-module__buttonSweeps___0snDQ{background:linear-gradient(357deg,#10be68 23.9%,#29cf7d 97.97%)}.Button-module__buttonGold___DAj-d{background:linear-gradient(357deg,#bf9e21 22.01%,#f0c72c 97.97%)}.GroupRow-module__label___Du57P{color:hsla(0,6%,41%,.6);font-size:12px;font-style:Inter;font-weight:700;letter-spacing:.02em;line-height:18px;margin-bottom:6px}.GroupRow-module__group___V7xa6{display:flex;margin-top:5px;width:231px}.GroupRow-module__group___V7xa6 .GroupRow-module__groupItem___yNSX8{border-radius:0;box-sizing:border-box}.GroupRow-module__group___V7xa6 .GroupRow-module__groupItem___yNSX8:last-child{border-bottom-right-radius:10px;border-top-right-radius:10px}.GroupRow-module__group___V7xa6 .GroupRow-module__groupItem___yNSX8:first-child{border-bottom-left-radius:10px;border-top-left-radius:10px}.GroupRow-module__group___V7xa6 .GroupRow-module__groupItem___yNSX8+.GroupRow-module__groupItem___yNSX8{margin-left:2px}.GroupRow-module__x2___9bLae{align-items:center;background:hsla(0,0%,100%,.15);cursor:pointer;display:block;display:flex;font-family:Inter;font-size:15px;font-style:normal;font-weight:700;height:35px;justify-content:center;width:35px}.GroupRow-module__x2___9bLae.GroupRow-module__last___ArsSn{border-bottom-right-radius:10px;border-top-right-radius:10px}.Input-module__base___IifiA{border:none;color:rgba(var(--text-color-hex),1);outline:none;padding:10px 12px;user-select:none!important;width:100%}.Input-module__disabled___WqyKa{color:rgba(var(--text-color-hex),.1)!important;cursor:pointer;pointer-events:none}.Switch-module__base___gj2ey{align-items:center;cursor:pointer;display:flex;gap:6px;position:absolute;right:12px;top:50%;transform:translateY(-50%)}.Switch-module__switcher___gHXIx{align-items:center;background-color:#0e2749;border-radius:23px;cursor:pointer;display:inline-flex;height:21px;justify-content:center;position:relative;transition:background-color .3s ease;width:43px}.Switch-module__gold___oewnb{background-color:#d4af26}.Switch-module__sweeps___yS-IY{background-color:#10be68}.Switch-module__unchecked___ooSS2{background-color:rgba(14,39,73,.722)}.Switch-module__disabled___lMRv0{opacity:.1}.Switch-module__base___gj2ey .Switch-module__thumb___1wJ9D{background-color:#5c74b1;border-radius:50%;cursor:pointer;height:17px;left:3px;position:absolute;transition:all .3s ease;width:17px}.Switch-module__base___gj2ey .Switch-module__thumb___1wJ9D.Switch-module__move-right___ca-6D{background-color:#fff;transform:translateX(21px)}.Switch-module__base___gj2ey .Switch-module__label___pG2uz{color:#fff;cursor:pointer;font-family:Inter;font-size:10px;font-style:normal;font-weight:700;letter-spacing:.5px;line-height:125%}.InputWithIcon-module__base___FwgXx{background:hsla(0,0%,100%,.15);border-radius:10px;color:rgba(var(--text-color-hex),1);display:flex;font-family:Inter;font-size:15px;font-style:normal;font-weight:700;height:35px;position:relative;width:100%;z-index:1}.InputWithIcon-module__icon___KtOjW{display:block;font-family:Inter;font-size:15px;font-style:normal;font-weight:700;left:11px;position:absolute;top:50%;transform:translateY(-50%)}.InputWithIcon-module__inputWithLabel___06L8W,.InputWithIcon-module__input___mQFr9,.InputWithIcon-module__label___O28vw{background:transparent;color:rgba(var(--text-color-hex),1);margin-left:50px;max-width:90px;padding:0;text-align:left}.InputWithIcon-module__label___O28vw{font-size:10px;position:absolute;top:2px}.InputWithIcon-module__inputWithLabel___06L8W{padding-top:15px;user-select:none;z-index:1}.InputWithIcon-module__gold___GlVw1{color:#d4af26}.InputWithIcon-module__sweeps___J4JdJ{color:#10be68}.SelectMenu-module__button___N-HeB{align-items:center;display:flex;gap:3px;height:35px;justify-content:space-between;width:35px}.SelectMenu-module__disabled___jiTPl svg{opacity:.1}.SelectMenu-module__menu___c5jvZ{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:rgba(var(--bg-color-rgb),.16);border-radius:10px;color:rgba(var(--text-color-hex),1);cursor:pointer;width:auto}.SelectMenu-module__menu_item___fpgJy{align-items:center;display:flex;font-size:16px;height:21px;padding:0 11px;text-transform:capitalize;width:100%}.SelectMenu-module__menu_item___fpgJy:hover{background:rgba(var(--bg-color-rgb),.16);border-radius:10px;color:rgba(var(--text-color-hex),1)}.SelectMenu-module__menu_name___X4-Sk{color:rgba(var(--text-color-hex),1);margin-left:10px}.SelectMenu-module__selected___XyADw{background:rgba(var(--bg-color-rgb),.16);border-radius:10px;color:rgba(var(--text-color-hex),1)}.SelectMenu-module__arrow___qiOb9{stroke:rgba(var(--text-color-hex),1)}*,html{--bet-bottom:15px;--bet-panel-bg:8,30,100;--bg-color-rgb:255,255,255;--text-color-hex:255,255,255;cursor:default;font-family:Inter;font-size:15px;font-style:normal;font-weight:700;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.UI-module__base___wThyQ{align-items:center;border-radius:15px;justify-content:center;position:relative}.UI-module__base___wThyQ,.UI-module__betForm___hQkYd{display:flex;flex-direction:column;height:140px;padding:9px 10px;position:absolute;width:250px}.UI-module__betForm___hQkYd{background-color:rgba(var(--bet-panel-bg),.75);bottom:var(--bet-bottom);left:50%;transform:translateX(-50%)}.UI-module__disabled___dnZJX{opacity:.1}
@@ -0,0 +1,9 @@
1
+ export declare enum GAME_MODE {
2
+ MANUAL = "manual",
3
+ AUTOPLAY = "autoplay"
4
+ }
5
+ export declare enum AUTO_PLAY_STATE {
6
+ IDLE = "idle",
7
+ SELECTING = "selecting",
8
+ PLAYING = "playing"
9
+ }
@@ -0,0 +1,2 @@
1
+ import { GAME_MODE, AUTO_PLAY_STATE } from "./gameMode";
2
+ export { GAME_MODE, AUTO_PLAY_STATE };
@@ -0,0 +1,39 @@
1
+ import { Currency, PlayLimits } from "@enigma-lake/zoot-platform-sdk";
2
+ export type StylingProps = {
3
+ panel: {
4
+ bottom: string;
5
+ bgColorHex: string;
6
+ };
7
+ };
8
+ export type CurrencyProps = {
9
+ currentCurrency: Currency;
10
+ currencies: Currency[];
11
+ winText: string;
12
+ };
13
+ export type ActionsProps = {
14
+ onPlay: () => void;
15
+ onAutoPlay: (selection: number[], next: () => void, stop: () => void) => void;
16
+ onCashout: () => void;
17
+ };
18
+ export type PlaySettingsProps = {
19
+ isPlaying: boolean;
20
+ canCashout: boolean;
21
+ disabledController: boolean;
22
+ displayController: boolean;
23
+ showAutoPlayToast: (props: {
24
+ type: "success" | "error" | "warning" | "info";
25
+ message: string;
26
+ }) => void;
27
+ playHook: () => {
28
+ playLimits?: PlayLimits;
29
+ playAmount: number;
30
+ setPlayAmount: (value: number) => void;
31
+ };
32
+ autoPlayDelay?: number;
33
+ };
34
+ export type PlayControllerProps = StylingProps & ActionsProps & {
35
+ currencyOptions: CurrencyProps;
36
+ playOptions: PlaySettingsProps;
37
+ };
38
+ export declare const PLAY_HALVE = 0.5;
39
+ export declare const PLAY_DOUBLE = 2;
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@enigma-lake/mines-play-controller-sdk",
3
+ "version": "1.0.0",
4
+ "description": "A React component library for building gameplay interfaces",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "typings": "dist/index.d.ts",
8
+ "type": "module",
9
+ "style": "dist/style.css",
10
+ "scripts": {
11
+ "build": "tsc && rollup -c --bundleConfigAsCjs",
12
+ "start": "webpack serve --mode development --open",
13
+ "eslint": "eslint --cache --fix .",
14
+ "eslint:check": "eslint .",
15
+ "prettier": "prettier --write .",
16
+ "prettier:check": "prettier --check ."
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "files": [
22
+ "dist",
23
+ "dist/style.css",
24
+ "dist/index.js",
25
+ "dist/index.d.ts"
26
+ ],
27
+ "peerDependencies": {
28
+ "@enigma-lake/zoot-platform-sdk": "^1.0.21",
29
+ "@headlessui/react": "^2.2.0",
30
+ "@types/react": "^19.0.7",
31
+ "@types/react-dom": "^19.0.3",
32
+ "react": "18.2.0",
33
+ "react-dom": "18.2.0",
34
+ "use-debounce": "^10.0.4"
35
+ },
36
+ "resolutions": {
37
+ "react": "18.2.0",
38
+ "react-dom": "18.2.0"
39
+ },
40
+ "devDependencies": {
41
+ "@babel/core": "^7.26.0",
42
+ "@babel/preset-env": "^7.26.0",
43
+ "@babel/preset-react": "^7.26.3",
44
+ "@rollup/plugin-babel": "^6.0.4",
45
+ "@rollup/plugin-commonjs": "^28.0.2",
46
+ "@rollup/plugin-inject": "^5.0.5",
47
+ "@rollup/plugin-node-resolve": "^16.0.0",
48
+ "@rollup/plugin-typescript": "^12.1.2",
49
+ "@types/node": "^22.10.6",
50
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
51
+ "@typescript-eslint/parser": "^8.20.0",
52
+ "babel-loader": "^9.2.1",
53
+ "classnames": "^2.5.1",
54
+ "css-loader": "^7.1.2",
55
+ "eslint": "^9.18.0",
56
+ "eslint-config-prettier": "^10.0.1",
57
+ "eslint-plugin-import": "^2.31.0",
58
+ "eslint-plugin-prettier": "^5.2.2",
59
+ "eslint-plugin-promise": "^7.2.1",
60
+ "eslint-plugin-react": "^7.37.4",
61
+ "eslint-plugin-react-hooks": "^5.1.0",
62
+ "eslint-plugin-storybook": "^0.11.2",
63
+ "mini-css-extract-plugin": "^2.9.2",
64
+ "prettier": "^3.4.2",
65
+ "react-switch": "^7.1.0",
66
+ "rollup": "^4.30.1",
67
+ "rollup-plugin-delete": "^2.1.0",
68
+ "rollup-plugin-dts": "^6.1.1",
69
+ "rollup-plugin-peer-deps-external": "^2.2.4",
70
+ "rollup-plugin-postcss": "^4.0.2",
71
+ "rollup-plugin-sass": "^1.15.0",
72
+ "sass": "^1.83.4",
73
+ "sass-loader": "^16.0.4",
74
+ "style-loader": "^4.0.0",
75
+ "ts-loader": "^9.5.2",
76
+ "typescript": "^5.7.3",
77
+ "webpack": "^5.97.1",
78
+ "webpack-cli": "^6.0.1",
79
+ "webpack-dev-server": "^5.2.0"
80
+ }
81
+ }