@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/dist/index.mjs
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useContext, useRef, useMemo, useCallback, useEffect, Fragment as Fragment$1, useState } from 'react';
|
|
3
|
+
import cx$1 from 'classnames';
|
|
4
|
+
import { Currency, sendSetUserCurrencyEvent, sendSetUserCurrencyEventV2, setToggleGameWidgets, sendOpenStoreEvent } from '@enigma-lake/zoot-platform-sdk';
|
|
5
|
+
import { Menu, MenuButton, MenuItems, MenuItem, Switch as Switch$1 } from '@headlessui/react';
|
|
6
|
+
|
|
7
|
+
const hexToRgb = (hex) => {
|
|
8
|
+
const shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
9
|
+
hex = hex.replace(shorthandRegex, (_, r, g, b) => r + r + g + g + b + b);
|
|
10
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
11
|
+
return result
|
|
12
|
+
? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`
|
|
13
|
+
: null;
|
|
14
|
+
};
|
|
15
|
+
const selectButton = (gameMode) => {
|
|
16
|
+
const role = `role-${gameMode}-button`;
|
|
17
|
+
const buttons = document.querySelectorAll(`[data-role="${role}"]`);
|
|
18
|
+
return buttons[0];
|
|
19
|
+
};
|
|
20
|
+
const addPressedClass = (gameMode, activeClassName) => {
|
|
21
|
+
const button = selectButton(gameMode);
|
|
22
|
+
if (!button) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (!button.classList.contains(activeClassName)) {
|
|
26
|
+
button.classList.add(activeClassName);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const removePressedClass = (gameMode, activeClassName) => {
|
|
30
|
+
const button = selectButton(gameMode);
|
|
31
|
+
if (!button) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (button.classList.contains(activeClassName)) {
|
|
35
|
+
button.classList.remove(activeClassName);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const format = (balance, decimals) => balance?.toFixed(decimals) ?? 0;
|
|
6
39
|
|
|
7
40
|
var GAME_MODE;
|
|
8
41
|
(function (GAME_MODE) {
|
|
@@ -16,132 +49,11 @@ var AUTO_PLAY_STATE;
|
|
|
16
49
|
AUTO_PLAY_STATE["PLAYING"] = "playing";
|
|
17
50
|
})(AUTO_PLAY_STATE || (AUTO_PLAY_STATE = {}));
|
|
18
51
|
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
ghost: "ghost",
|
|
25
|
-
};
|
|
26
|
-
const Button = ({ disabled, roleType, className = "", theme = "primary", ...props }) => {
|
|
27
|
-
return (jsx("button", { ...props, className: cx(styles_button.base, styles_button[`base__theme-${theme}`], className, {
|
|
28
|
-
[styles_button["base__state-disabled"]]: disabled,
|
|
29
|
-
}), disabled: disabled, "data-role": `role-${roleType}-button` }));
|
|
30
|
-
};
|
|
31
|
-
Button.themes = themes;
|
|
32
|
-
|
|
33
|
-
var styles_group = {"base":"GroupRow-module__base___b241-","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","gap-2":"GroupRow-module__gap-2___1eib1"};
|
|
34
|
-
|
|
35
|
-
const GroupRow = ({ children, label, className, ...restProps }) => {
|
|
36
|
-
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 })] }));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const ALLOWED_SEPARATORS = [",", "."];
|
|
40
|
-
function findFirstSeparatorIndex(value) {
|
|
41
|
-
const index = [...value].findIndex((char) => ALLOWED_SEPARATORS.includes(char));
|
|
42
|
-
return index !== -1 ? index : undefined;
|
|
43
|
-
}
|
|
44
|
-
function cleanInputNumber(value) {
|
|
45
|
-
const cleaned = value.replace(/[^0-9,.]/g, "");
|
|
46
|
-
if (cleaned === "0") {
|
|
47
|
-
return cleaned;
|
|
48
|
-
}
|
|
49
|
-
const trimmed = cleaned.replace(/^0+(?!$)/, "").replace(/(,|\.){2,}/g, "$1");
|
|
50
|
-
const separatorIndex = findFirstSeparatorIndex(trimmed);
|
|
51
|
-
if (separatorIndex === undefined) {
|
|
52
|
-
return trimmed;
|
|
53
|
-
}
|
|
54
|
-
const integerPart = trimmed.slice(0, separatorIndex).replace(/[,.]/g, "") || "0";
|
|
55
|
-
const decimalPart = trimmed.slice(separatorIndex + 1).replace(/[,.]/g, "");
|
|
56
|
-
return `${integerPart}.${decimalPart}`;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
var styles$3 = {"base":"Input-module__base___IifiA","disabled":"Input-module__disabled___WqyKa"};
|
|
60
|
-
|
|
61
|
-
const Input = ({ onChange, disabled, className, ...restProps }) => {
|
|
62
|
-
const handleChange = useCallback((event) => {
|
|
63
|
-
if (!disabled) {
|
|
64
|
-
event.target.value = cleanInputNumber(event.target.value);
|
|
65
|
-
onChange?.(event);
|
|
66
|
-
}
|
|
67
|
-
}, [disabled, onChange]);
|
|
68
|
-
return (jsx("input", { ...restProps, disabled: disabled, onChange: handleChange, className: cx(styles$3.base, className, { [styles$3.disabled]: disabled }), inputMode: "decimal" }));
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
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"};
|
|
72
|
-
|
|
73
|
-
const Switch = ({ enabled, onSwitch, disabled, currency, isPlaying, }) => {
|
|
74
|
-
const switcherClassName = useMemo(() => cx(styles$2.switcher, styles$2[currency], {
|
|
75
|
-
[styles$2.checked]: enabled,
|
|
76
|
-
[styles$2.unchecked]: !enabled,
|
|
77
|
-
[styles$2.disabled]: disabled,
|
|
78
|
-
}), [enabled, currency, disabled]);
|
|
79
|
-
useEffect(() => {
|
|
80
|
-
const handleGlobalKeyDown = (event) => {
|
|
81
|
-
const focusedElement = document.activeElement;
|
|
82
|
-
if (event.code === "Space" &&
|
|
83
|
-
focusedElement?.getAttribute("role") === "switch") {
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
event.stopPropagation();
|
|
86
|
-
event.stopImmediatePropagation();
|
|
87
|
-
focusedElement.blur();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
// Attach global event listener
|
|
91
|
-
window.addEventListener("keydown", handleGlobalKeyDown, true);
|
|
92
|
-
// Cleanup event listener on unmount
|
|
93
|
-
return () => {
|
|
94
|
-
window.removeEventListener("keydown", handleGlobalKeyDown, true);
|
|
95
|
-
};
|
|
96
|
-
}, []);
|
|
97
|
-
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 }) }) })] }) }));
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
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"};
|
|
101
|
-
|
|
102
|
-
const InputWithIcon = ({ children, switcherConfig, disabled, currency, label, className, ...restProps }) => {
|
|
103
|
-
return (jsxs("div", { className: cx(styles$1.base, className, {
|
|
104
|
-
[styles$1.disabled]: switcherConfig?.disabled,
|
|
105
|
-
}), children: [label && (jsx("span", { className: cx(styles$1.label, styles$1[currency]), children: label })), jsx(Input, { ...restProps, className: cx(styles$1.input, {
|
|
106
|
-
[styles$1.inputWithLabel]: label !== undefined,
|
|
107
|
-
}), disabled: disabled }), switcherConfig && jsx(Switch, { ...switcherConfig }), children && jsx("div", { className: cx(styles$1.icon), children: children })] }));
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
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" })] }));
|
|
111
|
-
|
|
112
|
-
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" })] }));
|
|
113
|
-
|
|
114
|
-
var style_select$1 = {"button":"SelectMenu-module__button___N-HeB","menu":"SelectMenu-module__menu___c5jvZ","menuItems":"SelectMenu-module__menuItems___BX1YQ","menuItem":"SelectMenu-module__menuItem___eXbi3","selected":"SelectMenu-module__selected___XyADw","disabled":"SelectMenu-module__disabled___jiTPl"};
|
|
115
|
-
|
|
116
|
-
var style_chevron = {"chevron":"ChevronIcon-module__chevron___lif8s","open":"ChevronIcon-module__open___niD1n","disable":"ChevronIcon-module__disable___8n-xg"};
|
|
117
|
-
|
|
118
|
-
const ChevronIcon = ({ open, disabled, }) => {
|
|
119
|
-
return (jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { className: cx(style_chevron.chevron, {
|
|
120
|
-
[style_chevron.open]: open,
|
|
121
|
-
[style_chevron.disabled]: disabled,
|
|
122
|
-
}), d: "M6 9L12 15L18 9", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const capitalize$1 = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
126
|
-
const getIcon = (option) => option === Currency.SWEEPS ? jsx(SweepsIcon, {}) : jsx(GoldIcon, {});
|
|
127
|
-
const SelectMenu = ({ currencies, selectedCurrency, setSelectedCurrency, disabled = false, }) => {
|
|
128
|
-
const handleClick = (e) => {
|
|
129
|
-
if (disabled) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const target = e.target;
|
|
133
|
-
const value = target.dataset.value;
|
|
134
|
-
if (!value) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
setSelectedCurrency({ currency: value });
|
|
138
|
-
};
|
|
139
|
-
return (jsx(Menu, { as: "div", className: cx(style_select$1.menu), children: ({ open }) => (jsxs(Fragment$1, { children: [jsxs(MenuButton, { className: cx(style_select$1.button, {
|
|
140
|
-
[style_select$1.disabled]: disabled,
|
|
141
|
-
}), disabled: disabled, as: "div", children: [getIcon(selectedCurrency), jsx(ChevronIcon, { open: open, disabled: disabled })] }), jsx(MenuItems, { anchor: { to: "top start" }, className: cx(style_select$1.menuItems), children: currencies.map((option) => (jsxs(MenuItem, { as: "div", "data-value": option, onClick: handleClick, className: cx(style_select$1.menuItem, {
|
|
142
|
-
[style_select$1.selected]: String(selectedCurrency) === String(option),
|
|
143
|
-
}), children: [getIcon(option), capitalize$1(String(option))] }, `element-${option}`))) })] })) }));
|
|
144
|
-
};
|
|
52
|
+
var WIDGET;
|
|
53
|
+
(function (WIDGET) {
|
|
54
|
+
WIDGET["CENTER"] = "center";
|
|
55
|
+
WIDGET["SIDE"] = "side";
|
|
56
|
+
})(WIDGET || (WIDGET = {}));
|
|
145
57
|
|
|
146
58
|
const AutoManualPlayStateContext = createContext(undefined);
|
|
147
59
|
const useAutoManualPlayState = () => {
|
|
@@ -153,12 +65,12 @@ const useAutoManualPlayState = () => {
|
|
|
153
65
|
};
|
|
154
66
|
|
|
155
67
|
const usePlayController = () => {
|
|
156
|
-
const { config, autoPlay: { setNumberOfPlays, numberOfPlays, setPlayedRounds, playedRounds, selection, setState, state, }, } = useAutoManualPlayState();
|
|
157
|
-
const {
|
|
68
|
+
const { config, autoPlay: { setNumberOfPlays, numberOfPlays, setPlayedRounds, playedRounds, selection, setState, state, }, playValues: { displayPlayAmountView, setDisplayPlayAmountView, togglePlayAmountView, }, } = useAutoManualPlayState();
|
|
69
|
+
const { current } = config.currencyOptions;
|
|
158
70
|
const { isPlaying, canCashout, disabledController, showAutoPlayToast, autoPlayDelay = 1500, playHook, } = config.playOptions;
|
|
159
71
|
const { playAmount, playLimits, setPlayAmount } = playHook?.() ?? {};
|
|
160
|
-
const minPlayAmount = playLimits?.[
|
|
161
|
-
const maxPlayAmount = playLimits?.[
|
|
72
|
+
const minPlayAmount = playLimits?.[current.code]?.limits.min ?? 0;
|
|
73
|
+
const maxPlayAmount = playLimits?.[current.code]?.limits.max ?? 0;
|
|
162
74
|
const playIntervalRef = useRef(null);
|
|
163
75
|
const isAutoplayActiveRef = useRef(false);
|
|
164
76
|
const stopAutoplay = () => {
|
|
@@ -171,6 +83,8 @@ const usePlayController = () => {
|
|
|
171
83
|
setTimeout(() => {
|
|
172
84
|
setPlayedRounds(0);
|
|
173
85
|
}, 1500);
|
|
86
|
+
// Call the onAutoPlayStop callback if provided
|
|
87
|
+
config.onAutoPlayStop?.();
|
|
174
88
|
};
|
|
175
89
|
const loopRounds = (currentPlayedRounds, remainingPlays) => {
|
|
176
90
|
if (!isAutoplayActiveRef.current) {
|
|
@@ -207,40 +121,54 @@ const usePlayController = () => {
|
|
|
207
121
|
};
|
|
208
122
|
const isDisabled = () => disabledController || isPlaying;
|
|
209
123
|
const isAutoplayDisabled = () => disabledController || state === AUTO_PLAY_STATE.PLAYING;
|
|
210
|
-
const adjustPlayAmount = (
|
|
124
|
+
const adjustPlayAmount = ({ direction }) => {
|
|
211
125
|
if (isDisabled()) {
|
|
212
126
|
return;
|
|
213
127
|
}
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
};
|
|
217
|
-
const onChangeAmount = (event) => {
|
|
218
|
-
if (isDisabled()) {
|
|
128
|
+
const opts = playLimits?.[current.code]?.defaultBetOptions ?? [];
|
|
129
|
+
if (!opts.length) {
|
|
219
130
|
return;
|
|
220
131
|
}
|
|
221
|
-
|
|
132
|
+
// Ensure options sorted ascending
|
|
133
|
+
const sorted = [...opts].sort((a, b) => a - b);
|
|
134
|
+
const currentIndex = sorted.findIndex((o) => o === playAmount);
|
|
135
|
+
let newAmount;
|
|
136
|
+
if (currentIndex === -1) {
|
|
137
|
+
// if current isn't exactly in list, insert it logically
|
|
138
|
+
sorted.push(playAmount);
|
|
139
|
+
sorted.sort((a, b) => a - b);
|
|
140
|
+
const idx = sorted.indexOf(playAmount);
|
|
141
|
+
newAmount = sorted[idx + direction] ?? playAmount;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
const targetIdx = currentIndex + direction;
|
|
145
|
+
if (targetIdx >= 0 && targetIdx < sorted.length) {
|
|
146
|
+
newAmount = sorted[targetIdx];
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// clamp if out of bounds
|
|
150
|
+
newAmount = sorted[currentIndex];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
setPlayAmount(newAmount);
|
|
222
154
|
};
|
|
223
|
-
const
|
|
155
|
+
const onChangeAmount = (playValue) => {
|
|
224
156
|
if (isDisabled()) {
|
|
225
157
|
return;
|
|
226
158
|
}
|
|
227
|
-
|
|
228
|
-
setPlayAmount(Math.max(minPlayAmount, Math.min(newAmount, maxPlayAmount)));
|
|
159
|
+
setPlayAmount(playValue);
|
|
229
160
|
};
|
|
230
161
|
const isValidPlayAmount = playAmount >= minPlayAmount && playAmount <= maxPlayAmount;
|
|
231
162
|
return {
|
|
232
|
-
currentCurrency,
|
|
233
|
-
currencies,
|
|
234
163
|
playAmount,
|
|
235
164
|
minPlayAmount,
|
|
236
165
|
maxPlayAmount,
|
|
237
166
|
setPlayAmount,
|
|
238
167
|
adjustPlayAmount,
|
|
239
168
|
onChangeAmount,
|
|
240
|
-
onBlurAmount,
|
|
241
169
|
playOptions: config.playOptions,
|
|
242
170
|
isValidPlayAmount,
|
|
243
|
-
|
|
171
|
+
totalBalance: config.playOptions.totalBalance,
|
|
244
172
|
manualPlay: {
|
|
245
173
|
isDisabled,
|
|
246
174
|
onPlay: config.onPlay,
|
|
@@ -252,76 +180,147 @@ const usePlayController = () => {
|
|
|
252
180
|
onPlay: handleAutoPlay,
|
|
253
181
|
onStopPlay: stopAutoplay,
|
|
254
182
|
},
|
|
183
|
+
playValues: {
|
|
184
|
+
displayPlayAmountView,
|
|
185
|
+
setDisplayPlayAmountView,
|
|
186
|
+
togglePlayAmountView,
|
|
187
|
+
},
|
|
255
188
|
};
|
|
256
189
|
};
|
|
257
190
|
|
|
258
|
-
var
|
|
259
|
-
(function (SELECTORS) {
|
|
260
|
-
SELECTORS["RISK"] = "Risk";
|
|
261
|
-
})(SELECTORS || (SELECTORS = {}));
|
|
262
|
-
var RiskTypes;
|
|
263
|
-
(function (RiskTypes) {
|
|
264
|
-
RiskTypes["LOW"] = "LOW";
|
|
265
|
-
RiskTypes["MEDIUM"] = "MEDIUM";
|
|
266
|
-
RiskTypes["HIGH"] = "HIGH";
|
|
267
|
-
})(RiskTypes || (RiskTypes = {}));
|
|
191
|
+
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","buttonPlayAmount":"Button-module__buttonPlayAmount___GMy3F","buttonCashout":"Button-module__buttonCashout___LG-Yr","buttonPlayAmount__active":"Button-module__buttonPlayAmount__active___e0nGe","buttonCashout__active":"Button-module__buttonCashout__active___qnE3h","buttonSweeps":"Button-module__buttonSweeps___0snDQ","buttonSweeps__active":"Button-module__buttonSweeps__active___PXIFH","buttonGold":"Button-module__buttonGold___DAj-d","buttonGold__active":"Button-module__buttonGold__active___vsi7m","buttonDefault":"Button-module__buttonDefault___QENXy","buttonDefault__active":"Button-module__buttonDefault__active___oS6gd"};
|
|
268
192
|
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
193
|
+
const themes = {
|
|
194
|
+
primary: "primary",
|
|
195
|
+
success: "success",
|
|
196
|
+
ghost: "ghost",
|
|
197
|
+
};
|
|
198
|
+
const Button = ({ disabled, roleType, className = "", theme = "primary", ...props }) => {
|
|
199
|
+
return (jsx("button", { ...props, className: cx$1(styles_button.base, styles_button[`base__theme-${theme}`], className, {
|
|
200
|
+
[styles_button["base__state-disabled"]]: disabled,
|
|
201
|
+
}), disabled: disabled, "data-role": `role-${roleType}-button` }));
|
|
274
202
|
};
|
|
203
|
+
Button.themes = themes;
|
|
275
204
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
return result
|
|
281
|
-
? `${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)}`
|
|
282
|
-
: null;
|
|
205
|
+
var styles_group = {"base":"GroupRow-module__base___b241-","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","gap-2":"GroupRow-module__gap-2___1eib1"};
|
|
206
|
+
|
|
207
|
+
const GroupRow = ({ children, label, className, ...restProps }) => {
|
|
208
|
+
return (jsxs("div", { ...restProps, className: cx$1(styles_group.base, className), children: [label && jsx("div", { className: styles_group.label, children: label }), jsx("div", { className: styles_group.group, children: children })] }));
|
|
283
209
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
210
|
+
|
|
211
|
+
var style_select$1 = {"button":"SelectMenu-module__button___N-HeB","menu":"SelectMenu-module__menu___c5jvZ","menuItems":"SelectMenu-module__menuItems___BX1YQ","menuItem":"SelectMenu-module__menuItem___eXbi3","selected":"SelectMenu-module__selected___XyADw","disabledSVG":"SelectMenu-module__disabledSVG___OdVFW","disabled":"SelectMenu-module__disabled___jiTPl"};
|
|
212
|
+
|
|
213
|
+
var style_chevron = {"chevron":"ChevronIcon-module__chevron___lif8s","open":"ChevronIcon-module__open___niD1n","disable":"ChevronIcon-module__disable___8n-xg"};
|
|
214
|
+
|
|
215
|
+
const ChevronIcon = ({ open, disabled, }) => {
|
|
216
|
+
return (jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { className: cx$1(style_chevron.chevron, {
|
|
217
|
+
[style_chevron.open]: open,
|
|
218
|
+
[style_chevron.disabled]: disabled,
|
|
219
|
+
}), d: "M6 9L12 15L18 9", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
288
220
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
221
|
+
|
|
222
|
+
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" })] }));
|
|
223
|
+
|
|
224
|
+
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" })] }));
|
|
225
|
+
|
|
226
|
+
const capitalize$1 = (str) => str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
227
|
+
const getIcon = (option) => {
|
|
228
|
+
if (option.code === Currency.GOLD) {
|
|
229
|
+
return GoldIcon;
|
|
293
230
|
}
|
|
294
|
-
if (
|
|
295
|
-
|
|
231
|
+
if (option.code === Currency.SWEEPS) {
|
|
232
|
+
return SweepsIcon;
|
|
296
233
|
}
|
|
234
|
+
return option.icon;
|
|
297
235
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
236
|
+
|
|
237
|
+
const SelectMenu = ({ disabled = false }) => {
|
|
238
|
+
const { config } = useAutoManualPlayState();
|
|
239
|
+
const { current, available } = config.currencyOptions;
|
|
240
|
+
const handleClick = (e) => {
|
|
241
|
+
if (disabled) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const target = e.target;
|
|
245
|
+
const value = target.dataset.value;
|
|
246
|
+
if (!value) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
const newCurrency = available.find((d) => d.code === value);
|
|
250
|
+
if (newCurrency) {
|
|
251
|
+
sendSetUserCurrencyEvent({ currency: newCurrency.code });
|
|
252
|
+
sendSetUserCurrencyEventV2({ current: newCurrency, available });
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const ButtonIcon = getIcon(current);
|
|
256
|
+
if (available.length === 1) {
|
|
257
|
+
return (jsx("div", { className: cx$1(style_select$1.button), children: ButtonIcon && jsx(ButtonIcon, {}) }));
|
|
305
258
|
}
|
|
259
|
+
return (jsx(Menu, { as: "div", className: cx$1(style_select$1.menu), children: ({ open }) => (jsxs(Fragment, { children: [jsxs(MenuButton, { className: cx$1(style_select$1.button, {
|
|
260
|
+
[style_select$1.disabled]: disabled,
|
|
261
|
+
}), disabled: disabled, as: "div", children: [ButtonIcon && jsx(ButtonIcon, {}), jsx(ChevronIcon, { open: open, disabled: disabled })] }), jsx(MenuItems, { anchor: { to: "top start" }, className: cx$1(style_select$1.menuItems), children: available.map((option) => {
|
|
262
|
+
const Icon = getIcon(option);
|
|
263
|
+
return (jsxs(MenuItem, { as: "div", "data-value": option.code, onClick: handleClick, className: cx$1(style_select$1.menuItem, {
|
|
264
|
+
[style_select$1.selected]: String(current.code) === String(option.code),
|
|
265
|
+
}), children: [Icon && jsx(Icon, {}), capitalize$1(String(option.label))] }, `element-${option.code}`));
|
|
266
|
+
}) })] })) }));
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
var styles$4 = {"base":"PlayValueInput-module__base___sTNW2","icon":"PlayValueInput-module__icon___jZj7O","playValueInput":"PlayValueInput-module__playValueInput___7pJtn","playValueInputWithLabel":"PlayValueInput-module__playValueInputWithLabel___S55Cr","label":"PlayValueInput-module__label___1ZSAV","inputContainer":"PlayValueInput-module__inputContainer___RKr1l","playValueWithLabel":"PlayValueInput-module__playValueWithLabel___K4-pr"};
|
|
270
|
+
|
|
271
|
+
const PlayValueInput = ({ disabled, children, className, value, onClick, }) => {
|
|
272
|
+
const handleOnClick = () => {
|
|
273
|
+
if (disabled) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
onClick();
|
|
277
|
+
};
|
|
278
|
+
return (jsxs("div", { className: cx$1(styles$4.base, className, {
|
|
279
|
+
[styles$4.disabled]: disabled,
|
|
280
|
+
}), children: [jsxs("div", { className: cx$1(styles$4.inputContainer), onClick: (e) => {
|
|
281
|
+
e.preventDefault();
|
|
282
|
+
handleOnClick();
|
|
283
|
+
}, children: [jsx("span", { className: styles$4.label, children: "Play amount" }), jsx("div", { className: cx$1(styles$4.playValueInput, {
|
|
284
|
+
[styles$4.playValueInputWithLabel]: true,
|
|
285
|
+
}), children: value })] }), children && jsx("div", { className: cx$1(styles$4.icon), children: children })] }));
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const PlayAmountControl = ({ isDisabled }) => {
|
|
289
|
+
const { config } = useAutoManualPlayState();
|
|
290
|
+
const { playAmount, adjustPlayAmount, playValues: { togglePlayAmountView }, autoPlay: { state }, } = usePlayController();
|
|
291
|
+
const handleTogglePlayAmount = () => {
|
|
292
|
+
togglePlayAmountView();
|
|
293
|
+
setToggleGameWidgets();
|
|
294
|
+
};
|
|
295
|
+
return (jsxs(GroupRow, { children: [jsx(PlayValueInput, { className: styles_group.groupItem, value: `${playAmount} ${config.currencyOptions.current.abbr}`, disabled: isDisabled() ||
|
|
296
|
+
config.playOptions.disableInput ||
|
|
297
|
+
config.playOptions.disabledController ||
|
|
298
|
+
state === AUTO_PLAY_STATE.PLAYING, onClick: handleTogglePlayAmount, children: jsx(SelectMenu, { disabled: isDisabled() }) }), jsx(Button, { className: styles_group.groupItem, onClick: () => adjustPlayAmount({ direction: -1 }), theme: "ghost", disabled: isDisabled(), children: jsx("span", { className: styles_group.x2, children: "-" }) }), jsx(Button, { className: styles_group.groupItem, onClick: () => adjustPlayAmount({ direction: 1 }), theme: "ghost", disabled: isDisabled(), children: jsx("span", { className: cx$1(styles_group.x2, styles_group.last), children: "+" }) })] }));
|
|
306
299
|
};
|
|
307
300
|
|
|
308
301
|
const AutoPlayController = () => {
|
|
309
|
-
const {
|
|
302
|
+
const { config } = useAutoManualPlayState();
|
|
303
|
+
const { isValidPlayAmount, playValues: { displayPlayAmountView, togglePlayAmountView }, autoPlay: { isDisabled, state, onPlay, onStopPlay }, } = usePlayController();
|
|
304
|
+
const { current } = config.currencyOptions;
|
|
310
305
|
const roleButton = GAME_MODE.AUTOPLAY;
|
|
311
306
|
const activeClassName = useMemo(() => {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
307
|
+
if (current.code === Currency.GOLD) {
|
|
308
|
+
return styles_button.buttonGold__active;
|
|
309
|
+
}
|
|
310
|
+
if (current.code === Currency.SWEEPS) {
|
|
311
|
+
return styles_button.buttonSweeps__active;
|
|
312
|
+
}
|
|
313
|
+
return styles_button.buttonDefault__active;
|
|
314
|
+
}, [current.code]);
|
|
315
|
+
const defaultClassName = useMemo(() => {
|
|
316
|
+
if (current.code === Currency.GOLD) {
|
|
317
|
+
return styles_button.buttonGold;
|
|
318
|
+
}
|
|
319
|
+
if (current.code === Currency.SWEEPS) {
|
|
320
|
+
return styles_button.buttonSweeps;
|
|
321
|
+
}
|
|
322
|
+
return styles_button.buttonDefault;
|
|
323
|
+
}, [current.code]);
|
|
325
324
|
const handleKeyPress = useCallback((event) => {
|
|
326
325
|
if (event.code !== "Space") {
|
|
327
326
|
return;
|
|
@@ -361,20 +360,48 @@ const AutoPlayController = () => {
|
|
|
361
360
|
const isButtonDisabled = state === AUTO_PLAY_STATE.PLAYING
|
|
362
361
|
? false
|
|
363
362
|
: isDisabled() || !isValidPlayAmount;
|
|
364
|
-
const buttonLabel = state === AUTO_PLAY_STATE.PLAYING ? "
|
|
363
|
+
const buttonLabel = state === AUTO_PLAY_STATE.PLAYING ? "STOP AUTOPLAY" : "START AUTOPLAY";
|
|
365
364
|
const buttonAction = state === AUTO_PLAY_STATE.PLAYING ? onStopPlay : onPlay;
|
|
366
|
-
|
|
365
|
+
const renderButton = useMemo(() => {
|
|
366
|
+
if (displayPlayAmountView) {
|
|
367
|
+
return (jsx(Button, { className: styles_button.buttonPlayAmount, onClick: togglePlayAmountView, roleType: roleButton, children: "SELECT PLAY AMOUNT" }));
|
|
368
|
+
}
|
|
369
|
+
return (jsx(Button, { disabled: isButtonDisabled, className: defaultClassName, onClick: buttonAction, roleType: roleButton, children: buttonLabel }));
|
|
370
|
+
}, [
|
|
371
|
+
buttonAction,
|
|
372
|
+
buttonLabel,
|
|
373
|
+
defaultClassName,
|
|
374
|
+
displayPlayAmountView,
|
|
375
|
+
isButtonDisabled,
|
|
376
|
+
roleButton,
|
|
377
|
+
togglePlayAmountView,
|
|
378
|
+
]);
|
|
379
|
+
return (jsxs(Fragment, { children: [jsx(PlayAmountControl, { isDisabled: isDisabled }), renderButton] }));
|
|
367
380
|
};
|
|
368
381
|
|
|
369
382
|
const ManualPlayController = () => {
|
|
370
383
|
const { config } = useAutoManualPlayState();
|
|
371
|
-
const {
|
|
384
|
+
const { isValidPlayAmount, playValues: { displayPlayAmountView, togglePlayAmountView }, manualPlay: { isDisabled, onPlay, canCashout }, } = usePlayController();
|
|
385
|
+
const { current } = config.currencyOptions;
|
|
372
386
|
const roleButton = GAME_MODE.MANUAL;
|
|
373
387
|
const activeClassName = useMemo(() => {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
388
|
+
if (current.code === Currency.GOLD) {
|
|
389
|
+
return styles_button.buttonGold__active;
|
|
390
|
+
}
|
|
391
|
+
if (current.code === Currency.SWEEPS) {
|
|
392
|
+
return styles_button.buttonSweeps__active;
|
|
393
|
+
}
|
|
394
|
+
return styles_button.buttonDefault__active;
|
|
395
|
+
}, [current.code]);
|
|
396
|
+
const defaultClassName = useMemo(() => {
|
|
397
|
+
if (current.code === Currency.GOLD) {
|
|
398
|
+
return styles_button.buttonGold;
|
|
399
|
+
}
|
|
400
|
+
if (current.code === Currency.SWEEPS) {
|
|
401
|
+
return styles_button.buttonSweeps;
|
|
402
|
+
}
|
|
403
|
+
return styles_button.buttonDefault;
|
|
404
|
+
}, [current.code]);
|
|
378
405
|
const handleKeyPress = useCallback((event) => {
|
|
379
406
|
if (event.code !== "Space") {
|
|
380
407
|
return;
|
|
@@ -409,14 +436,32 @@ const ManualPlayController = () => {
|
|
|
409
436
|
};
|
|
410
437
|
}, [handleKeyPress, handleKeyUp]);
|
|
411
438
|
const isButtonDisabled = isDisabled() || !isValidPlayAmount;
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
439
|
+
const renderButton = useMemo(() => {
|
|
440
|
+
if (displayPlayAmountView) {
|
|
441
|
+
return (jsx(Button, { className: styles_button.buttonPlayAmount, onClick: togglePlayAmountView, roleType: roleButton, children: "SELECT PLAY AMOUNT" }));
|
|
442
|
+
}
|
|
443
|
+
if (canCashout) {
|
|
444
|
+
return (jsxs(Button, { disabled: config.playOptions.disabledController ||
|
|
445
|
+
!config.playOptions.isPlaying, className: styles_button.buttonCashout, onClick: config.onCashout, roleType: roleButton, children: ["CASHOUT ", format(current.possibleWin ?? 0, current.decimals), " ", current.abbr] }));
|
|
446
|
+
}
|
|
447
|
+
return (jsx(Button, { disabled: isButtonDisabled, className: defaultClassName, onClick: onPlay, roleType: roleButton, children: "PLAY NOW" }));
|
|
448
|
+
}, [
|
|
449
|
+
canCashout,
|
|
450
|
+
config.onCashout,
|
|
451
|
+
config.playOptions.disabledController,
|
|
452
|
+
config.playOptions.isPlaying,
|
|
453
|
+
current,
|
|
454
|
+
defaultClassName,
|
|
455
|
+
displayPlayAmountView,
|
|
456
|
+
isButtonDisabled,
|
|
457
|
+
onPlay,
|
|
458
|
+
roleButton,
|
|
459
|
+
togglePlayAmountView,
|
|
460
|
+
]);
|
|
461
|
+
return (jsxs(Fragment, { children: [jsx(PlayAmountControl, { isDisabled: isDisabled || displayPlayAmountView }), renderButton] }));
|
|
417
462
|
};
|
|
418
463
|
|
|
419
|
-
var styles_ui = {"base":"UI-module__base___wThyQ","betForm":"UI-module__betForm___hQkYd","disabled":"UI-module__disabled___dnZJX","auto":"UI-module__auto___5peb8"};
|
|
464
|
+
var styles_ui = {"base":"UI-module__base___wThyQ","container":"UI-module__container___gMSiK","betForm":"UI-module__betForm___hQkYd","disabled":"UI-module__disabled___dnZJX","auto":"UI-module__auto___5peb8","controllerWidgets":"UI-module__controllerWidgets___x2lBy","sideWidget":"UI-module__sideWidget___WMGRy","centerWidget":"UI-module__centerWidget___sLLUi","left":"UI-module__left___1wtUp","center":"UI-module__center___E0ILH","right":"UI-module__right___yLHvk"};
|
|
420
465
|
|
|
421
466
|
var style_difficulty = {"base":"DifficultySelector-module__base___lDaQ-"};
|
|
422
467
|
|
|
@@ -435,13 +480,24 @@ const Selector = ({ currentValue, label, riskColor, values, onSelect, disabled,
|
|
|
435
480
|
}
|
|
436
481
|
onSelect(value);
|
|
437
482
|
};
|
|
438
|
-
return (jsxs("div", { className: cx(style_select.base), children: [label && jsx("span", { className: cx(style_select.label), children: label }), jsx(Menu, { as: "div", className: cx(style_select.menu), children: ({ open }) => (jsxs(Fragment
|
|
483
|
+
return (jsxs("div", { className: cx$1(style_select.base), children: [label && jsx("span", { className: cx$1(style_select.label), children: label }), jsx(Menu, { as: "div", className: cx$1(style_select.menu), children: ({ open }) => (jsxs(Fragment, { children: [jsxs(MenuButton, { className: cx$1(style_select.button, {
|
|
439
484
|
[style_select.disabled]: disabled,
|
|
440
|
-
}), style: { color: riskColor }, disabled: disabled, children: [capitalize(String(currentValue)), jsx(ChevronIcon, { open: open, disabled: disabled })] }), jsx(MenuItems, { anchor: { to: "top start" }, className: cx(style_select.menuItems), children: values.map((value) => (jsx(MenuItem, { as: "div", "data-value": value, onClick: handleClick, className: cx(style_select.menuItem, {
|
|
485
|
+
}), style: { color: riskColor }, disabled: disabled, children: [capitalize(String(currentValue)), jsx(ChevronIcon, { open: open, disabled: disabled })] }), jsx(MenuItems, { anchor: { to: "top start" }, className: cx$1(style_select.menuItems), children: values.map((value) => (jsx(MenuItem, { as: "div", "data-value": value, onClick: handleClick, className: cx$1(style_select.menuItem, {
|
|
441
486
|
[style_select.selected]: String(currentValue) === String(value),
|
|
442
487
|
}), children: capitalize(String(value)) }, `element-${value}`))) })] })) })] }));
|
|
443
488
|
};
|
|
444
489
|
|
|
490
|
+
var SELECTORS;
|
|
491
|
+
(function (SELECTORS) {
|
|
492
|
+
SELECTORS["RISK"] = "Risk";
|
|
493
|
+
})(SELECTORS || (SELECTORS = {}));
|
|
494
|
+
var RiskTypes;
|
|
495
|
+
(function (RiskTypes) {
|
|
496
|
+
RiskTypes["LOW"] = "LOW";
|
|
497
|
+
RiskTypes["MEDIUM"] = "MEDIUM";
|
|
498
|
+
RiskTypes["HIGH"] = "HIGH";
|
|
499
|
+
})(RiskTypes || (RiskTypes = {}));
|
|
500
|
+
|
|
445
501
|
const DifficultySelector = ({ playOptions, dropdownConfig, }) => {
|
|
446
502
|
const { risks, disabledMenu, currentRisk, onRiskChange } = playOptions;
|
|
447
503
|
const riskColor = useRef(dropdownConfig.riskColorConfig[RiskTypes.LOW]);
|
|
@@ -452,12 +508,223 @@ const DifficultySelector = ({ playOptions, dropdownConfig, }) => {
|
|
|
452
508
|
return (jsx("div", { className: style_difficulty.base, children: jsx(Selector, { currentValue: currentRisk, label: SELECTORS.RISK, values: risks, onSelect: onRiskSelected, disabled: disabledMenu, riskColor: riskColor.current }) }));
|
|
453
509
|
};
|
|
454
510
|
|
|
455
|
-
|
|
511
|
+
const ALLOWED_SEPARATORS = [",", "."];
|
|
512
|
+
function findFirstSeparatorIndex(value) {
|
|
513
|
+
const index = [...value].findIndex((char) => ALLOWED_SEPARATORS.includes(char));
|
|
514
|
+
return index !== -1 ? index : undefined;
|
|
515
|
+
}
|
|
516
|
+
function cleanInputNumber(value) {
|
|
517
|
+
const cleaned = value.replace(/[^0-9,.]/g, "");
|
|
518
|
+
if (cleaned === "0") {
|
|
519
|
+
return cleaned;
|
|
520
|
+
}
|
|
521
|
+
const trimmed = cleaned.replace(/^0+(?!$)/, "").replace(/(,|\.){2,}/g, "$1");
|
|
522
|
+
const separatorIndex = findFirstSeparatorIndex(trimmed);
|
|
523
|
+
if (separatorIndex === undefined) {
|
|
524
|
+
return trimmed;
|
|
525
|
+
}
|
|
526
|
+
const integerPart = trimmed.slice(0, separatorIndex).replace(/[,.]/g, "") || "0";
|
|
527
|
+
const decimalPart = trimmed.slice(separatorIndex + 1).replace(/[,.]/g, "");
|
|
528
|
+
return `${integerPart}.${decimalPart}`;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
var styles$3 = {"base":"Input-module__base___IifiA","disabled":"Input-module__disabled___WqyKa"};
|
|
456
532
|
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
533
|
+
const Input = ({ onChange, disabled, className, ...restProps }) => {
|
|
534
|
+
const handleChange = useCallback((event) => {
|
|
535
|
+
if (!disabled) {
|
|
536
|
+
event.target.value = cleanInputNumber(event.target.value);
|
|
537
|
+
onChange?.(event);
|
|
538
|
+
}
|
|
539
|
+
}, [disabled, onChange]);
|
|
540
|
+
return (jsx("input", { ...restProps, disabled: disabled, onChange: handleChange, className: cx$1(styles$3.base, className, { [styles$3.disabled]: disabled }), inputMode: "decimal" }));
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
var styles$2 = {"base":"Switch-module__base___gj2ey","switcher":"Switch-module__switcher___gHXIx","gold":"Switch-module__gold___oewnb","sweeps":"Switch-module__sweeps___yS-IY","default":"Switch-module__default___TmHoU","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"};
|
|
544
|
+
|
|
545
|
+
const Switch = ({ enabled, onSwitch, disabled, isPlaying, }) => {
|
|
546
|
+
const { config } = useAutoManualPlayState();
|
|
547
|
+
const { current } = config.currencyOptions;
|
|
548
|
+
const defaultClassName = useMemo(() => {
|
|
549
|
+
if (current.code === Currency.GOLD) {
|
|
550
|
+
return styles$2.gold;
|
|
551
|
+
}
|
|
552
|
+
if (current.code === Currency.SWEEPS) {
|
|
553
|
+
return styles$2.sweeps;
|
|
554
|
+
}
|
|
555
|
+
return styles$2.default;
|
|
556
|
+
}, [current.code]);
|
|
557
|
+
const switcherClassName = useMemo(() => cx$1(styles$2.switcher, defaultClassName, {
|
|
558
|
+
[styles$2.checked]: enabled,
|
|
559
|
+
[styles$2.unchecked]: !enabled,
|
|
560
|
+
[styles$2.disabled]: disabled,
|
|
561
|
+
}), [defaultClassName, enabled, disabled]);
|
|
562
|
+
useEffect(() => {
|
|
563
|
+
const handleGlobalKeyDown = (event) => {
|
|
564
|
+
const focusedElement = document.activeElement;
|
|
565
|
+
if (event.code === "Space" &&
|
|
566
|
+
focusedElement?.getAttribute("role") === "switch") {
|
|
567
|
+
event.preventDefault();
|
|
568
|
+
event.stopPropagation();
|
|
569
|
+
event.stopImmediatePropagation();
|
|
570
|
+
focusedElement.blur();
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
// Attach global event listener
|
|
574
|
+
window.addEventListener("keydown", handleGlobalKeyDown, true);
|
|
575
|
+
// Cleanup event listener on unmount
|
|
576
|
+
return () => {
|
|
577
|
+
window.removeEventListener("keydown", handleGlobalKeyDown, true);
|
|
578
|
+
};
|
|
579
|
+
}, []);
|
|
580
|
+
return (jsx(Switch$1, { checked: enabled, onChange: onSwitch, as: Fragment$1, 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$1(styles$2.thumb, { [styles$2["move-right"]]: enabled }) }) })] }) }));
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
var styles$1 = {"base":"InputWithSwitch-module__base___vjLoh","icon":"InputWithSwitch-module__icon___upeAL","input":"InputWithSwitch-module__input___K6RCD","label":"InputWithSwitch-module__label___tEjpj"};
|
|
584
|
+
|
|
585
|
+
const InputWithSwitch = ({ children, switcherConfig, disabled, className, ...restProps }) => {
|
|
586
|
+
return (jsxs("div", { className: cx$1(styles$1.base, className, {
|
|
587
|
+
[styles$1.disabled]: switcherConfig.disabled,
|
|
588
|
+
}), children: [jsx(Switch, { ...switcherConfig }), jsx(Input, { ...restProps, className: cx$1(styles$1.input), disabled: disabled, max: 99 }), jsx("div", { className: cx$1(styles$1.icon), children: children })] }));
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
function getDefaultExportFromCjs (x) {
|
|
592
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
var bind = {exports: {}};
|
|
596
|
+
|
|
597
|
+
/*!
|
|
598
|
+
Copyright (c) 2018 Jed Watson.
|
|
599
|
+
Licensed under the MIT License (MIT), see
|
|
600
|
+
http://jedwatson.github.io/classnames
|
|
601
|
+
*/
|
|
602
|
+
|
|
603
|
+
var hasRequiredBind;
|
|
604
|
+
|
|
605
|
+
function requireBind () {
|
|
606
|
+
if (hasRequiredBind) return bind.exports;
|
|
607
|
+
hasRequiredBind = 1;
|
|
608
|
+
(function (module) {
|
|
609
|
+
/* global define */
|
|
610
|
+
|
|
611
|
+
(function () {
|
|
612
|
+
|
|
613
|
+
var hasOwn = {}.hasOwnProperty;
|
|
614
|
+
|
|
615
|
+
function classNames () {
|
|
616
|
+
var classes = '';
|
|
617
|
+
|
|
618
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
619
|
+
var arg = arguments[i];
|
|
620
|
+
if (arg) {
|
|
621
|
+
classes = appendClass(classes, parseValue.call(this, arg));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return classes;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
function parseValue (arg) {
|
|
629
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
630
|
+
return this && this[arg] || arg;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if (typeof arg !== 'object') {
|
|
634
|
+
return '';
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (Array.isArray(arg)) {
|
|
638
|
+
return classNames.apply(this, arg);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
642
|
+
return arg.toString();
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
var classes = '';
|
|
646
|
+
|
|
647
|
+
for (var key in arg) {
|
|
648
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
649
|
+
classes = appendClass(classes, this && this[key] || key);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
return classes;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function appendClass (value, newClass) {
|
|
657
|
+
if (!newClass) {
|
|
658
|
+
return value;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (value) {
|
|
662
|
+
return value + ' ' + newClass;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return value + newClass;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if (module.exports) {
|
|
669
|
+
classNames.default = classNames;
|
|
670
|
+
module.exports = classNames;
|
|
671
|
+
} else {
|
|
672
|
+
window.classNames = classNames;
|
|
673
|
+
}
|
|
674
|
+
}());
|
|
675
|
+
} (bind));
|
|
676
|
+
return bind.exports;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
var bindExports = requireBind();
|
|
680
|
+
var cn = /*@__PURE__*/getDefaultExportFromCjs(bindExports);
|
|
681
|
+
|
|
682
|
+
const cx = cn.bind(styles_ui);
|
|
683
|
+
const WidgetContainer = ({ state, widgets, }) => {
|
|
684
|
+
const { left = [], center = [], right = [] } = widgets ?? {};
|
|
685
|
+
const renderZone = (items, zone) => {
|
|
686
|
+
const containerClass = zone === "center" ? cx("centerWidget") : cx("sideWidget");
|
|
687
|
+
return (jsx("div", { className: cx(containerClass, zone), children: items.map((widget) => widget.renderElement({ state })) }));
|
|
688
|
+
};
|
|
689
|
+
return (jsxs("div", { className: cx("controllerWidgets"), children: [renderZone(left, "left"), renderZone(center, "center"), renderZone(right, "right")] }));
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
var styles = {"base":"PlayValueList-module__base___5duc6","playValuesWrapper":"PlayValueList-module__playValuesWrapper___-zfj2","playValue":"PlayValueList-module__playValue___TJQhI","selectedPlayValue":"PlayValueList-module__selectedPlayValue___3DhDC","disabledPlayValue":"PlayValueList-module__disabledPlayValue___U9Bkj"};
|
|
693
|
+
|
|
694
|
+
const PlayValueList = () => {
|
|
695
|
+
const { config } = useAutoManualPlayState();
|
|
696
|
+
const { onChangeAmount, playAmount, totalBalance, playValues: { displayPlayAmountView, togglePlayAmountView }, } = usePlayController();
|
|
697
|
+
const { playLimits } = config.playOptions.playHook();
|
|
698
|
+
if (!displayPlayAmountView) {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
const applyValue = (value) => {
|
|
702
|
+
if (totalBalance < value) {
|
|
703
|
+
sendOpenStoreEvent();
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
onChangeAmount(value);
|
|
707
|
+
}
|
|
708
|
+
togglePlayAmountView();
|
|
709
|
+
};
|
|
710
|
+
const handleClick = (e) => {
|
|
711
|
+
const el = e.target?.closest("[data-value]");
|
|
712
|
+
if (!el) {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
const raw = el.dataset.value;
|
|
716
|
+
if (!raw) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
const value = Number(raw);
|
|
720
|
+
if (!Number.isNaN(value)) {
|
|
721
|
+
applyValue(value);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
return (jsx("div", { className: cx$1(styles.base), children: jsx("div", { className: cx$1(styles.playValuesWrapper), onClick: handleClick, role: "listbox", "aria-label": "Select play amount", "data-testid": "play-value-list", children: playLimits?.[config.currencyOptions.current.code].defaultBetOptions.map((playValue) => (jsx("div", { className: cx$1(styles.playValue, {
|
|
725
|
+
[styles.selectedPlayValue]: playValue === playAmount,
|
|
726
|
+
[styles.disabledPlayValue]: playValue > totalBalance,
|
|
727
|
+
}), "data-value": playValue, role: "option", tabIndex: 0, "aria-selected": false, children: format(playValue, config.currencyOptions.current.decimals) }, `${config.currencyOptions.current.code}-${playValue}`))) }) }));
|
|
461
728
|
};
|
|
462
729
|
|
|
463
730
|
const AutoManualPlayProvider = ({ children, config, }) => {
|
|
@@ -467,6 +734,10 @@ const AutoManualPlayProvider = ({ children, config, }) => {
|
|
|
467
734
|
const [playedRounds, setPlayedRounds] = useState(0);
|
|
468
735
|
const [numberOfPlays, setNumberOfPlays] = useState(Infinity);
|
|
469
736
|
const [selection, setSelection] = useState([]);
|
|
737
|
+
const [displayPlayAmountView, setDisplayPlayAmountView] = useState(false);
|
|
738
|
+
const togglePlayAmountView = useCallback(() => {
|
|
739
|
+
setDisplayPlayAmountView((v) => !v);
|
|
740
|
+
}, []);
|
|
470
741
|
const startAutoplay = useCallback((numPlays) => {
|
|
471
742
|
setMode(GAME_MODE.AUTOPLAY);
|
|
472
743
|
setAutoplayState(AUTO_PLAY_STATE.SELECTING);
|
|
@@ -525,6 +796,11 @@ const AutoManualPlayProvider = ({ children, config, }) => {
|
|
|
525
796
|
},
|
|
526
797
|
reset: resetState,
|
|
527
798
|
toggleMode,
|
|
799
|
+
playValues: {
|
|
800
|
+
displayPlayAmountView,
|
|
801
|
+
setDisplayPlayAmountView,
|
|
802
|
+
togglePlayAmountView,
|
|
803
|
+
},
|
|
528
804
|
}), [
|
|
529
805
|
mode,
|
|
530
806
|
config,
|
|
@@ -540,30 +816,35 @@ const AutoManualPlayProvider = ({ children, config, }) => {
|
|
|
540
816
|
updateAutoplayState,
|
|
541
817
|
resetState,
|
|
542
818
|
toggleMode,
|
|
819
|
+
displayPlayAmountView,
|
|
820
|
+
togglePlayAmountView,
|
|
543
821
|
]);
|
|
544
|
-
return (jsxs(AutoManualPlayStateContext.Provider, { value: contextValue, children: [typeof children === "function" ? children(contextValue) : children, config.playOptions.displayController && (
|
|
545
|
-
"--play-bottom": config.panel.bottom,
|
|
822
|
+
return (jsxs(AutoManualPlayStateContext.Provider, { value: contextValue, children: [typeof children === "function" ? children(contextValue) : children, config.playOptions.displayController && (jsx("div", { className: cx$1(styles_ui.base, styles_ui.betForm), style: {
|
|
823
|
+
"--play-bottom": config.panel.bottom ?? 0,
|
|
546
824
|
"--play-panel-bg": hexToRgb(config.panel.bgColorHex ?? "#01243A"),
|
|
547
825
|
"--play-dropdown-bg": hexToRgb(config.dropdown.bgColorHex ?? "#01243A"),
|
|
548
826
|
"--play-panel-bg-opacity": config.panel.bgColorOpacity ?? 0.5,
|
|
549
|
-
}, children: [jsxs("div", { className: cx(styles_ui.auto), children: [jsx(DifficultySelector, { playOptions: {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
disabled: config.playOptions.disabledController ||
|
|
560
|
-
autoplayState === AUTO_PLAY_STATE.PLAYING,
|
|
561
|
-
}, children: jsx("span", { className: cx({
|
|
562
|
-
[styles_ui.disabled]: mode !== GAME_MODE.AUTOPLAY ||
|
|
563
|
-
numberOfPlays !== Infinity ||
|
|
827
|
+
}, children: jsxs("div", { className: cx$1(styles_ui.container), children: [jsx(PlayValueList, {}), jsxs("div", { className: cx$1(styles_ui.auto), children: [jsx(DifficultySelector, { playOptions: {
|
|
828
|
+
...config.playOptions,
|
|
829
|
+
disabledMenu: config.playOptions.disabledController ||
|
|
830
|
+
config.playOptions.disabledMenu,
|
|
831
|
+
}, dropdownConfig: config.dropdown }), jsx(InputWithSwitch, { value: numberOfPlays === Infinity ? 0 : numberOfPlays, type: "number", onChange: (e) => setNumberOfPlays(Number(e.currentTarget.value)), placeholder: "Number of Plays", min: 0, max: 99, disabled: config.playOptions.disabledController ||
|
|
832
|
+
mode === GAME_MODE.MANUAL, switcherConfig: {
|
|
833
|
+
onSwitch: toggleMode,
|
|
834
|
+
isPlaying: isAutoPlaying || config.playOptions.isPlaying,
|
|
835
|
+
enabled: mode !== GAME_MODE.MANUAL,
|
|
836
|
+
disabled: config.playOptions.disabledController ||
|
|
564
837
|
autoplayState === AUTO_PLAY_STATE.PLAYING,
|
|
565
|
-
}
|
|
838
|
+
}, children: jsx("span", { className: cx$1({
|
|
839
|
+
[styles_ui.disabled]: mode !== GAME_MODE.AUTOPLAY ||
|
|
840
|
+
numberOfPlays !== Infinity ||
|
|
841
|
+
autoplayState === AUTO_PLAY_STATE.PLAYING,
|
|
842
|
+
}), children: `∞` }) })] }), mode === GAME_MODE.MANUAL ? (jsx(ManualPlayController, {})) : (jsx(AutoPlayController, {})), jsx(WidgetContainer, { state: autoplayState, widgets: {
|
|
843
|
+
left: config.leftWidgets,
|
|
844
|
+
center: config.centerWidgets,
|
|
845
|
+
right: config.rightWidgets,
|
|
846
|
+
} })] }) }))] }));
|
|
566
847
|
};
|
|
567
848
|
|
|
568
|
-
export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
|
|
849
|
+
export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE, WIDGET, format };
|
|
569
850
|
//# sourceMappingURL=index.mjs.map
|