@enigma-lake/mines-play-controller-sdk 1.0.4 → 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.
Files changed (28) hide show
  1. package/README.md +9 -4
  2. package/dist/components/AutoManualPlayStateProvider/AutoManualPlayStateContext.d.ts +5 -0
  3. package/dist/components/Widgets/Widgets.d.ts +14 -0
  4. package/dist/components/base/AutoPlayController/enum.d.ts +4 -0
  5. package/dist/components/base/Button/Button.d.ts +4 -2
  6. package/dist/components/base/ChevronIcon/ChevronIcon.d.ts +5 -0
  7. package/dist/components/base/ChevronIcon/index.d.ts +1 -0
  8. package/dist/components/base/Input/Input.d.ts +1 -1
  9. package/dist/components/base/InputWithSwitch/InputWithSwitch.d.ts +11 -0
  10. package/dist/components/base/InputWithSwitch/index.d.ts +1 -0
  11. package/dist/components/base/PlayController/PlayController.d.ts +1 -10
  12. package/dist/components/base/PlayValueInput/PlayValueInput.d.ts +8 -0
  13. package/dist/components/base/PlayValueInput/index.d.ts +1 -0
  14. package/dist/components/base/PlayValueList/PlayValueList.d.ts +2 -0
  15. package/dist/components/base/PlayValueList/index.d.ts +1 -0
  16. package/dist/components/base/SelectMenu/SelectMenu.d.ts +1 -7
  17. package/dist/components/base/SelectMenu/config.d.ts +3 -0
  18. package/dist/components/base/Switch/Switch.d.ts +1 -3
  19. package/dist/components/hooks/usePlayController.d.ts +10 -7
  20. package/dist/components/utils.d.ts +5 -0
  21. package/dist/index.d.ts +28 -10
  22. package/dist/index.mjs +565 -112
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/style.css +1 -1
  25. package/dist/types/index.d.ts +3 -1
  26. package/dist/types/playController.d.ts +9 -10
  27. package/dist/types/widgets.d.ts +13 -0
  28. package/package.json +2 -2
package/README.md CHANGED
@@ -63,11 +63,9 @@ Handles the styling-related properties for the component.
63
63
  ### 2. `CurrencyProps`
64
64
 
65
65
  Handles currency-related logic and settings.
66
-
67
66
  - **`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.
67
+ - **`current`**: The currently selected currency
68
+ - **`available`**: Array of available currencies that the user can choose from.
71
69
 
72
70
  ### 3. `ActionsProps`
73
71
 
@@ -95,7 +93,14 @@ Handles game-specific settings and states.
95
93
  - **`playAmount`**: The current play amount.
96
94
  - **`setPlayAmount`**: A function to set the play amount.
97
95
  - **`autoPlayDelay`** (optional): The delay (in milliseconds) before auto play starts.
96
+ - **`totalBalance`**: The available balance for the current currency
97
+
98
+ ### 5. `Widgets`
99
+ Defines functions for the user actions.
98
100
 
101
+ - **`leftWidgets`**: A list of widgets that will be displayed on the left side
102
+ - **`centerWidgets`**: A list of widgets that will be displayed on the center
103
+ - **`rightWidgets`**: A list of widgets that will be displayed on the right side
99
104
  ---
100
105
 
101
106
  ## Example Usage
@@ -23,6 +23,11 @@ export interface AutoManualPlayStateContextType {
23
23
  };
24
24
  reset: () => void;
25
25
  toggleMode: () => void;
26
+ playValues: {
27
+ displayPlayAmountView: boolean;
28
+ setDisplayPlayAmountView: (v: boolean) => void;
29
+ togglePlayAmountView: () => void;
30
+ };
26
31
  }
27
32
  export declare const AutoManualPlayStateContext: import("react").Context<AutoManualPlayStateContextType | undefined>;
28
33
  export declare const useAutoManualPlayState: () => AutoManualPlayStateContextType;
@@ -0,0 +1,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,4 @@
1
+ export declare enum AUTOPLAY_LABEL {
2
+ START = "START AUTOPLAY",
3
+ STOP = "STOP AUTOPLAY"
4
+ }
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { GAME_MODE } from "../../../types";
2
3
  declare const themes: {
3
4
  primary: string;
4
5
  success: string;
@@ -6,10 +7,11 @@ declare const themes: {
6
7
  };
7
8
  type Props = React.ComponentProps<"button"> & {
8
9
  theme?: (typeof themes)[keyof typeof themes];
9
- onClick?: React.MouseEventHandler<HTMLButtonElement>;
10
+ roleType?: GAME_MODE;
11
+ className?: string;
10
12
  };
11
13
  declare const Button: {
12
- ({ disabled, className, theme, onClick, ...props }: Props): import("react/jsx-runtime").JSX.Element;
14
+ ({ disabled, roleType, className, theme, ...props }: Props): import("react/jsx-runtime").JSX.Element;
13
15
  themes: {
14
16
  primary: string;
15
17
  success: string;
@@ -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";
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- declare const Input: ({ onChange, disabled, className, ...restProps }: React.ComponentProps<"input">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Input: ({ onChange, disabled, className, max, ...restProps }: React.ComponentProps<"input">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Input;
@@ -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";
@@ -1,14 +1,5 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface PlayAmountControlProps {
3
- playAmount: number;
4
- minPlayAmount: number;
5
- maxPlayAmount: number;
6
2
  isDisabled: () => boolean;
7
- adjustPlayAmount: (multiplier: number) => void;
8
- onChangeAmount: (event: React.ChangeEvent<HTMLInputElement>) => void;
9
- onBlurAmount: (event: React.FocusEvent<HTMLInputElement>) => void;
10
- currentCurrency: Currency;
11
- currencies: Currency[];
12
3
  }
13
- declare const PlayAmountControl: ({ playAmount, minPlayAmount, maxPlayAmount, isDisabled, adjustPlayAmount, onChangeAmount, onBlurAmount, currentCurrency, currencies, }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const PlayAmountControl: ({ isDisabled }: PlayAmountControlProps) => import("react/jsx-runtime").JSX.Element;
14
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";
@@ -1,11 +1,5 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface ISelectMenuProps {
3
- currencies: Currency[];
4
- selectedCurrency: Currency;
5
- setSelectedCurrency: (currency: {
6
- currency: Currency;
7
- }) => void;
8
2
  disabled?: boolean;
9
3
  }
10
- declare const SelectMenu: ({ currencies, selectedCurrency, setSelectedCurrency, disabled, }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
4
+ declare const SelectMenu: ({ disabled }: ISelectMenuProps) => import("react/jsx-runtime").JSX.Element;
11
5
  export default SelectMenu;
@@ -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;
@@ -1,10 +1,8 @@
1
- import { Currency } from "@enigma-lake/zoot-platform-sdk";
2
1
  interface SwitchProps {
3
2
  enabled: boolean;
4
3
  onSwitch: () => void;
5
4
  isPlaying: boolean;
6
- currency: Currency;
7
5
  disabled: boolean;
8
6
  }
9
- export declare const Switch: ({ enabled, onSwitch, disabled, currency, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Switch: ({ enabled, onSwitch, disabled, isPlaying, }: SwitchProps) => import("react/jsx-runtime").JSX.Element;
10
8
  export {};
@@ -1,17 +1,15 @@
1
1
  import { AUTO_PLAY_STATE } from "../../types";
2
- import { ChangeEvent, FocusEvent } from "react";
3
2
  export declare const usePlayController: () => {
4
- currentCurrency: import("@enigma-lake/zoot-platform-sdk").Currency;
5
- currencies: import("@enigma-lake/zoot-platform-sdk").Currency[];
6
3
  playAmount: number;
7
4
  minPlayAmount: number;
8
5
  maxPlayAmount: number;
9
6
  setPlayAmount: (value: number) => void;
10
- adjustPlayAmount: (multiplier: number) => void;
11
- onChangeAmount: (event: ChangeEvent<HTMLInputElement>) => void;
12
- onBlurAmount: (event: FocusEvent<HTMLInputElement>) => void;
7
+ adjustPlayAmount: ({ direction }: {
8
+ direction: -1 | 1;
9
+ }) => void;
10
+ onChangeAmount: (playValue: number) => void;
13
11
  isValidPlayAmount: boolean;
14
- winText: string;
12
+ totalBalance: number;
15
13
  manualPlay: {
16
14
  isDisabled: () => boolean;
17
15
  onPlay: () => void;
@@ -23,4 +21,9 @@ export declare const usePlayController: () => {
23
21
  onPlay: () => void;
24
22
  onStopPlay: () => void;
25
23
  };
24
+ playValues: {
25
+ displayPlayAmountView: boolean;
26
+ setDisplayPlayAmountView: (v: boolean) => void;
27
+ togglePlayAmountView: () => void;
28
+ };
26
29
  };
@@ -1 +1,6 @@
1
+ import { GAME_MODE } from "../types";
1
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;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ReactElement } from 'react';
2
- import { Currency, PlayLimits } from '@enigma-lake/zoot-platform-sdk';
1
+ import { ReactNode, ReactElement } from 'react';
2
+ import { CurrencyProps, PlayLimitsV2 } from '@enigma-lake/zoot-platform-sdk';
3
3
 
4
4
  declare enum GAME_MODE {
5
5
  MANUAL = "manual",
@@ -11,20 +11,29 @@ declare enum AUTO_PLAY_STATE {
11
11
  PLAYING = "playing"
12
12
  }
13
13
 
14
+ declare enum WIDGET {
15
+ CENTER = "center",
16
+ SIDE = "side"
17
+ }
18
+ type Widget = {
19
+ type: WIDGET;
20
+ renderElement: ({ state, displayPlayAmountView, }: {
21
+ state: AUTO_PLAY_STATE;
22
+ displayPlayAmountView: boolean;
23
+ }) => ReactNode;
24
+ };
25
+
26
+ declare const format: (balance: number, decimals: number) => string;
27
+
14
28
  type StylingProps = {
15
29
  panel: {
16
30
  bottom: string;
17
31
  bgColorHex: string;
18
32
  };
19
33
  };
20
- type CurrencyProps = {
21
- currentCurrency: Currency;
22
- currencies: Currency[];
23
- winText: string;
24
- };
25
34
  type ActionsProps = {
26
35
  onPlay: () => void;
27
- onAutoPlay: (selection: number[], next: () => void, stop: () => void) => void;
36
+ onAutoPlay: (selection: number[], next: () => void, stop: () => void, state: AUTO_PLAY_STATE) => void;
28
37
  onAutoPlayStop?: () => void;
29
38
  onCashout: () => void;
30
39
  };
@@ -38,15 +47,19 @@ type PlaySettingsProps = {
38
47
  message: string;
39
48
  }) => void;
40
49
  playHook: () => {
41
- playLimits?: PlayLimits;
50
+ playLimits?: PlayLimitsV2;
42
51
  playAmount: number;
43
52
  setPlayAmount: (value: number) => void;
44
53
  };
45
54
  autoPlayDelay?: number;
55
+ totalBalance: number;
46
56
  };
47
57
  type PlayControllerProps = StylingProps & ActionsProps & {
48
58
  currencyOptions: CurrencyProps;
49
59
  playOptions: PlaySettingsProps;
60
+ leftWidgets: Widget[];
61
+ rightWidgets: Widget[];
62
+ centerWidgets: Widget[];
50
63
  };
51
64
 
52
65
  interface AutoManualPlayStateContextType {
@@ -72,6 +85,11 @@ interface AutoManualPlayStateContextType {
72
85
  };
73
86
  reset: () => void;
74
87
  toggleMode: () => void;
88
+ playValues: {
89
+ displayPlayAmountView: boolean;
90
+ setDisplayPlayAmountView: (v: boolean) => void;
91
+ togglePlayAmountView: () => void;
92
+ };
75
93
  }
76
94
 
77
95
  interface AutoManualPlayStateProviderProps {
@@ -80,4 +98,4 @@ interface AutoManualPlayStateProviderProps {
80
98
  }
81
99
  declare const AutoManualPlayProvider: React.FC<AutoManualPlayStateProviderProps>;
82
100
 
83
- export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE };
101
+ export { AUTO_PLAY_STATE, AutoManualPlayProvider, GAME_MODE, WIDGET, type Widget, format };