@enigma-lake/mines-play-controller-sdk 2.0.3 → 2.0.4

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 (46) hide show
  1. package/dist/components/AutoManualPlayStateProvider/AutoManualPlayProvider.d.ts +9 -0
  2. package/dist/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.d.ts +33 -0
  3. package/dist/components/AutoManualPlayStateProvider/index.d.ts +1 -0
  4. package/dist/components/Widgets/Widgets.d.ts +14 -0
  5. package/dist/components/base/AutoPlayController/AutoPlayController.d.ts +2 -0
  6. package/dist/components/base/AutoPlayController/enum.d.ts +4 -0
  7. package/dist/components/base/AutoPlayController/index.d.ts +1 -0
  8. package/dist/components/base/Button/Button.d.ts +21 -0
  9. package/dist/components/base/Button/index.d.ts +1 -0
  10. package/dist/components/base/ChevronIcon/ChevronIcon.d.ts +5 -0
  11. package/dist/components/base/ChevronIcon/index.d.ts +1 -0
  12. package/dist/components/base/GroupRow/GroupRow.d.ts +6 -0
  13. package/dist/components/base/GroupRow/index.d.ts +1 -0
  14. package/dist/components/base/Input/Input.d.ts +3 -0
  15. package/dist/components/base/Input/cleanInputNumber.d.ts +2 -0
  16. package/dist/components/base/Input/index.d.ts +1 -0
  17. package/dist/components/base/InputWithIcon/InputWithIcon.d.ts +15 -0
  18. package/dist/components/base/InputWithIcon/index.d.ts +1 -0
  19. package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +11 -0
  20. package/dist/components/base/InputWithSwitch/index.d.ts +1 -0
  21. package/dist/components/base/ManualPlayController/ManualPlayController.d.ts +2 -0
  22. package/dist/components/base/ManualPlayController/index.d.ts +1 -0
  23. package/dist/components/base/PlayController/PlayController.d.ts +5 -0
  24. package/dist/components/base/PlayValueInput/PlayValueInput.d.ts +8 -0
  25. package/dist/components/base/PlayValueInput/index.d.ts +1 -0
  26. package/dist/components/base/PlayValueList/PlayValueList.d.ts +2 -0
  27. package/dist/components/base/PlayValueList/index.d.ts +1 -0
  28. package/dist/components/base/SelectMenu/GoldIcon.d.ts +1 -0
  29. package/dist/components/base/SelectMenu/SelectMenu.d.ts +5 -0
  30. package/dist/components/base/SelectMenu/SweepsIcon.d.ts +1 -0
  31. package/dist/components/base/SelectMenu/config.d.ts +3 -0
  32. package/dist/components/base/SelectMenu/index.d.ts +1 -0
  33. package/dist/components/base/Switch/Switch.d.ts +8 -0
  34. package/dist/components/base/index.d.ts +6 -0
  35. package/dist/components/hooks/usePlayController.d.ts +29 -0
  36. package/dist/components/index.d.ts +4 -0
  37. package/dist/components/utils.d.ts +6 -0
  38. package/dist/index.d.ts +101 -0
  39. package/dist/index.mjs +845 -0
  40. package/dist/index.mjs.map +1 -0
  41. package/dist/style.css +1 -0
  42. package/dist/types/gameMode.d.ts +9 -0
  43. package/dist/types/index.d.ts +4 -0
  44. package/dist/types/playController.d.ts +39 -0
  45. package/dist/types/widgets.d.ts +13 -0
  46. package/package.json +1 -1
@@ -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,33 @@
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
+ playValues: {
27
+ displayPlayAmountView: boolean;
28
+ setDisplayPlayAmountView: (v: boolean) => void;
29
+ togglePlayAmountView: () => void;
30
+ };
31
+ }
32
+ export declare const AutoManualPlayStateContext: import("react").Context<AutoManualPlayStateContextType | undefined>;
33
+ export declare const useAutoManualPlayState: () => AutoManualPlayStateContextType;
@@ -0,0 +1 @@
1
+ export { default } from "./AutoManualPlayProvider";
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { AUTO_PLAY_STATE, Widget } from "../../types";
3
+ type WidgetsByZone = {
4
+ left: Widget[];
5
+ center: Widget[];
6
+ right: Widget[];
7
+ };
8
+ interface WidgetContainerProps {
9
+ state: AUTO_PLAY_STATE;
10
+ widgets: WidgetsByZone;
11
+ displayPlayAmountView: boolean;
12
+ }
13
+ export declare const WidgetContainer: React.FC<WidgetContainerProps>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const AutoPlayController: () => import("react/jsx-runtime").JSX.Element;
2
+ export default AutoPlayController;
@@ -0,0 +1,4 @@
1
+ export declare enum AUTOPLAY_LABEL {
2
+ START = "START AUTOPLAY",
3
+ STOP = "STOP AUTOPLAY"
4
+ }
@@ -0,0 +1 @@
1
+ export { default } from "./AutoPlayController";
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import { GAME_MODE } from "../../../types";
3
+ declare const themes: {
4
+ primary: string;
5
+ success: string;
6
+ ghost: string;
7
+ };
8
+ type Props = React.ComponentProps<"button"> & {
9
+ theme?: (typeof themes)[keyof typeof themes];
10
+ roleType?: GAME_MODE;
11
+ className?: string;
12
+ };
13
+ declare const Button: {
14
+ ({ disabled, roleType, className, theme, ...props }: Props): import("react/jsx-runtime").JSX.Element;
15
+ themes: {
16
+ primary: string;
17
+ success: string;
18
+ ghost: string;
19
+ };
20
+ };
21
+ export default Button;
@@ -0,0 +1 @@
1
+ export { default } from "./Button";
@@ -0,0 +1,5 @@
1
+ declare const ChevronIcon: ({ open, disabled, }: {
2
+ open: boolean;
3
+ disabled: boolean;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default ChevronIcon;
@@ -0,0 +1 @@
1
+ export { default } from "./ChevronIcon";
@@ -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, max, ...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,11 @@
1
+ import { ComponentProps, PropsWithChildren } from "react";
2
+ export type Props = PropsWithChildren<ComponentProps<"input">> & {
3
+ switcherConfig: {
4
+ onSwitch: () => void;
5
+ isPlaying: boolean;
6
+ enabled: boolean;
7
+ disabled: boolean;
8
+ };
9
+ };
10
+ declare const InputWithSwitch: ({ children, switcherConfig, disabled, className, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default InputWithSwitch;
@@ -0,0 +1 @@
1
+ export { default } from "./InputWithSwitch";
@@ -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,5 @@
1
+ interface PlayAmountControlProps {
2
+ isDisabled: () => boolean;
3
+ }
4
+ declare const PlayAmountControl: ({ isDisabled }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default PlayAmountControl;
@@ -0,0 +1,8 @@
1
+ import { ComponentProps, PropsWithChildren } from "react";
2
+ export type Props = PropsWithChildren<ComponentProps<"div">> & {
3
+ disabled: boolean;
4
+ onClick: () => void;
5
+ value: string;
6
+ };
7
+ declare const PlayValueInput: ({ disabled, children, className, value, onClick, }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export default PlayValueInput;
@@ -0,0 +1 @@
1
+ export { default } from "./PlayValueInput";
@@ -0,0 +1,2 @@
1
+ declare const PlayValueList: () => import("react/jsx-runtime").JSX.Element | null;
2
+ export default PlayValueList;
@@ -0,0 +1 @@
1
+ export { default } from "./PlayValueList";
@@ -0,0 +1 @@
1
+ export declare const GoldIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ interface ISelectMenuProps {
2
+ disabled?: boolean;
3
+ }
4
+ declare const SelectMenu: ({ disabled }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default SelectMenu;
@@ -0,0 +1 @@
1
+ export declare const SweepsIcon: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { CurrencyMeta, CurrencyIcon } from "@enigma-lake/zoot-platform-sdk";
2
+ export declare const capitalize: (str: string) => string;
3
+ export declare const getIcon: (option: CurrencyMeta) => CurrencyIcon | undefined;
@@ -0,0 +1 @@
1
+ export { default } from "./SelectMenu";
@@ -0,0 +1,8 @@
1
+ interface SwitchProps {
2
+ enabled: boolean;
3
+ onSwitch: () => void;
4
+ isPlaying: boolean;
5
+ disabled: boolean;
6
+ }
7
+ export declare const Switch: ({ enabled, onSwitch, disabled, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
8
+ 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,29 @@
1
+ import { AUTO_PLAY_STATE } from "../../types";
2
+ export declare const usePlayController: () => {
3
+ playAmount: number;
4
+ minPlayAmount: number;
5
+ maxPlayAmount: number;
6
+ setPlayAmount: (value: number) => void;
7
+ adjustPlayAmount: ({ direction }: {
8
+ direction: -1 | 1;
9
+ }) => void;
10
+ onChangeAmount: (playValue: number) => void;
11
+ isValidPlayAmount: boolean;
12
+ totalBalance: number;
13
+ manualPlay: {
14
+ isDisabled: () => boolean;
15
+ onPlay: () => void;
16
+ canCashout: boolean;
17
+ };
18
+ autoPlay: {
19
+ isDisabled: () => boolean;
20
+ state: AUTO_PLAY_STATE;
21
+ onPlay: () => void;
22
+ onStopPlay: () => void;
23
+ };
24
+ playValues: {
25
+ displayPlayAmountView: boolean;
26
+ setDisplayPlayAmountView: (v: boolean) => void;
27
+ togglePlayAmountView: () => void;
28
+ };
29
+ };
@@ -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,6 @@
1
+ import { GAME_MODE } from "../types";
2
+ export declare const hexToRgb: (hex: string) => string | null;
3
+ export declare const selectButton: (gameMode: GAME_MODE) => HTMLButtonElement;
4
+ export declare const addPressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
5
+ export declare const removePressedClass: (gameMode: GAME_MODE, activeClassName: string) => void;
6
+ export declare const format: (balance: number, decimals: number) => string;
@@ -0,0 +1,101 @@
1
+ import { ReactNode, ReactElement } from 'react';
2
+ import { CurrencyProps, PlayLimitsV2 } from '@enigma-lake/zoot-platform-sdk';
3
+
4
+ declare enum GAME_MODE {
5
+ MANUAL = "manual",
6
+ AUTOPLAY = "autoplay"
7
+ }
8
+ declare enum AUTO_PLAY_STATE {
9
+ IDLE = "idle",
10
+ SELECTING = "selecting",
11
+ PLAYING = "playing"
12
+ }
13
+
14
+ declare enum WIDGET {
15
+ CENTER = "center",
16
+ SIDE = "side"
17
+ }
18
+ type Widget = {
19
+ type: WIDGET;
20
+ renderElement: ({ state, displayPlayAmountView, }: {
21
+ state: AUTO_PLAY_STATE;
22
+ displayPlayAmountView: boolean;
23
+ }) => ReactNode;
24
+ };
25
+
26
+ declare const format: (balance: number, decimals: number) => string;
27
+
28
+ type StylingProps = {
29
+ panel: {
30
+ bottom: string;
31
+ bgColorHex: string;
32
+ };
33
+ };
34
+ type ActionsProps = {
35
+ onPlay: () => void;
36
+ onAutoPlay: (selection: number[], next: () => void, stop: () => void, state: AUTO_PLAY_STATE) => void;
37
+ onAutoPlayStop?: () => void;
38
+ onCashout: () => void;
39
+ };
40
+ type PlaySettingsProps = {
41
+ isPlaying: boolean;
42
+ canCashout: boolean;
43
+ disabledController: boolean;
44
+ displayController: boolean;
45
+ showAutoPlayToast: (props: {
46
+ type: "success" | "error" | "warning" | "info";
47
+ message: string;
48
+ }) => void;
49
+ playHook: () => {
50
+ playLimits?: PlayLimitsV2;
51
+ playAmount: number;
52
+ setPlayAmount: (value: number) => void;
53
+ };
54
+ autoPlayDelay?: number;
55
+ totalBalance: number;
56
+ };
57
+ type PlayControllerProps = StylingProps & ActionsProps & {
58
+ currencyOptions: CurrencyProps;
59
+ playOptions: PlaySettingsProps;
60
+ leftWidgets: Widget[];
61
+ rightWidgets: Widget[];
62
+ centerWidgets: Widget[];
63
+ };
64
+
65
+ interface AutoManualPlayStateContextType {
66
+ mode: GAME_MODE;
67
+ config: PlayControllerProps;
68
+ manual: {
69
+ playManualMode: () => void;
70
+ };
71
+ autoPlay: {
72
+ state: AUTO_PLAY_STATE;
73
+ playedRounds: number;
74
+ numberOfPlays: number;
75
+ selection: number[];
76
+ isActive: boolean;
77
+ setIsActive: React.Dispatch<React.SetStateAction<boolean>>;
78
+ start: (numberOfPlays: number) => void;
79
+ stop: () => void;
80
+ setState: React.Dispatch<React.SetStateAction<AUTO_PLAY_STATE>>;
81
+ setPlayedRounds: React.Dispatch<React.SetStateAction<number>>;
82
+ setNumberOfPlays: React.Dispatch<React.SetStateAction<number>>;
83
+ setSelection: (values: number[]) => void;
84
+ updateState: (newState: AUTO_PLAY_STATE.SELECTING | AUTO_PLAY_STATE.PLAYING) => void;
85
+ };
86
+ reset: () => void;
87
+ toggleMode: () => void;
88
+ playValues: {
89
+ displayPlayAmountView: boolean;
90
+ setDisplayPlayAmountView: (v: boolean) => void;
91
+ togglePlayAmountView: () => void;
92
+ };
93
+ }
94
+
95
+ interface AutoManualPlayStateProviderProps {
96
+ children: React.ReactNode | ((state: AutoManualPlayStateContextType) => ReactElement);
97
+ config: PlayControllerProps;
98
+ }
99
+ declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
100
+
101
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE, WIDGET, type Widget, format };