@betorigami/game-ui-shared 1.7.0 → 2.0.1

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 (57) hide show
  1. package/README.md +3 -1
  2. package/dist/components/shared/Alert/Alert.d.ts +0 -2
  3. package/dist/components/shared/AlertManager/AlertManager.d.ts +1 -3
  4. package/dist/components/shared/BetResultModal/BetResultModal.d.ts +3 -4
  5. package/dist/components/shared/Button/Button.d.ts +3 -2
  6. package/dist/components/shared/Button/LinkButton.d.ts +3 -3
  7. package/dist/components/shared/ChipTableGameComponent.d.ts +5 -1
  8. package/dist/components/shared/DepositButton/DepositButton.d.ts +5 -3
  9. package/dist/components/shared/FairnessDetails/FairnessContent.d.ts +6 -3
  10. package/dist/components/shared/FairnessDetails/HistoryTable.d.ts +4 -1
  11. package/dist/components/shared/Footer/Footer.d.ts +4 -2
  12. package/dist/components/shared/GameComponent.d.ts +17 -4
  13. package/dist/components/shared/GameInfo/GameInfoModal.d.ts +5 -5
  14. package/dist/components/shared/GameInfo/gameInfoConfig.d.ts +2 -2
  15. package/dist/components/shared/GameLayout/GameLayout.d.ts +8 -4
  16. package/dist/components/shared/GameOutcomeDisplay/GameOutcomeDisplay.d.ts +4 -3
  17. package/dist/components/shared/GameProviderWrapper.d.ts +17 -9
  18. package/dist/components/shared/GameSidebar/GameSidebar.d.ts +1 -3
  19. package/dist/components/shared/GameWinPopup/GameWinPopup.d.ts +4 -3
  20. package/dist/components/shared/GenericAutobet/BetCountInput.d.ts +2 -2
  21. package/dist/components/shared/GenericAutobet/GenericAutobet.d.ts +3 -3
  22. package/dist/components/shared/HistoryPills/HistoryPills.d.ts +2 -1
  23. package/dist/components/shared/HotkeysModal/HotkeysModal.d.ts +1 -1
  24. package/dist/components/shared/Inputs/BetAmountInput/BetAmountInput.d.ts +6 -2
  25. package/dist/components/shared/Inputs/ChipInput/ChipInput.d.ts +3 -3
  26. package/dist/components/shared/Inputs/CurrencyInput/RawCurrencyInput.d.ts +2 -5
  27. package/dist/components/shared/Inputs/Input/Input.d.ts +1 -2
  28. package/dist/components/shared/Modal/Modal.d.ts +0 -2
  29. package/dist/components/shared/Select/Select.d.ts +1 -1
  30. package/dist/components/shared/Switch/Switch.d.ts +1 -1
  31. package/dist/components/shared/Toggle/Toggle.d.ts +1 -1
  32. package/dist/components/shared/context/desktop-attribute.d.ts +2 -0
  33. package/dist/components/shared/context/provide-test-contexts.d.ts +24 -0
  34. package/dist/components/shared/context/required-context.d.ts +10 -0
  35. package/dist/components/shared/context/slices/layout.context.d.ts +9 -0
  36. package/dist/components/shared/context/slices/limits.context.d.ts +17 -0
  37. package/dist/components/shared/context/slices/locale.context.d.ts +13 -0
  38. package/dist/components/shared/context/slices/preferences.context.d.ts +15 -0
  39. package/dist/components/shared/context/slices/services.context.d.ts +11 -0
  40. package/dist/components/shared/context/slices/session.context.d.ts +12 -0
  41. package/dist/components/shared/context/slices/skin.context.d.ts +43 -0
  42. package/dist/components/shared/context/slices/wallet.context.d.ts +16 -0
  43. package/dist/controllers/history.controller.d.ts +3 -8
  44. package/dist/index.d.ts +12 -1
  45. package/dist/index.mjs +3216 -3214
  46. package/dist/shared/button-feedback.d.ts +5 -13
  47. package/dist/shared/cards/Card.d.ts +1 -1
  48. package/dist/shared/cards/CardStack.d.ts +0 -1
  49. package/dist/shared/create-api-factory.d.ts +2 -2
  50. package/dist/shared/game-ui-module.d.ts +2 -2
  51. package/dist/shared/mock-bridged-game-service.d.ts +5 -5
  52. package/dist/shared/number-attribute.d.ts +3 -0
  53. package/dist/shared/profit-on-win.d.ts +6 -0
  54. package/dist/translations/language.context.d.ts +0 -7
  55. package/dist/utils/game-layout-style.d.ts +4 -6
  56. package/package.json +3 -2
  57. package/dist/components/shared/context/game.context.d.ts +0 -93
@@ -1,13 +1,5 @@
1
- import { ResolvedSound } from '../controllers/sound/sound-layer.types';
2
- export interface ButtonFeedbackContext {
3
- volume?: number;
4
- soundEffects?: {
5
- play?: (sound: ResolvedSound, volume: number) => void;
6
- };
7
- haptics?: {
8
- tap?: () => void;
9
- };
10
- }
11
- export declare const playButtonPressFeedback: (context: ButtonFeedbackContext | undefined, intensity: number) => void;
12
- export declare const playButtonClickFeedback: (context: ButtonFeedbackContext | undefined, intensity: number) => void;
13
- export declare const withButtonClickFeedback: <Args extends unknown[]>(getContext: () => ButtonFeedbackContext | undefined, callback: (...args: Args) => void, intensity?: number) => ((...args: Args) => void);
1
+ import { ServicesContextType } from '../components/shared/context/slices/services.context';
2
+ export type ButtonFeedbackContext = Pick<ServicesContextType, 'soundEffects' | 'haptics'>;
3
+ export declare const playButtonPressFeedback: (context: ButtonFeedbackContext, intensity: number) => void;
4
+ export declare const playButtonClickFeedback: (context: ButtonFeedbackContext, intensity: number) => void;
5
+ export declare const withButtonClickFeedback: <Args extends unknown[]>(getContext: () => ButtonFeedbackContext, callback: (...args: Args) => void, intensity?: number) => ((...args: Args) => void);
@@ -2,6 +2,7 @@ import { PropertyValues } from 'lit';
2
2
  import { default as OrigamiElement } from '../origami-element';
3
3
  import { Card } from '@betorigami/game-calculations';
4
4
  export declare class OrigamiCard extends OrigamiElement {
5
+ private readonly skin;
5
6
  static styles: import('lit').CSSResult[];
6
7
  card?: Card;
7
8
  faceDown: boolean;
@@ -9,7 +10,6 @@ export declare class OrigamiCard extends OrigamiElement {
9
10
  extraClass: string;
10
11
  revealed: boolean;
11
12
  instantMode: boolean;
12
- cardBackImageUrl: string | null;
13
13
  private _hasAnimatedReveal;
14
14
  cardContent: HTMLElement;
15
15
  private get prefersReducedMotion();
@@ -1,6 +1,5 @@
1
1
  import { default as OrigamiElement } from '../origami-element';
2
2
  export declare class CardStack extends OrigamiElement {
3
3
  static styles: import('lit').CSSResult[];
4
- cardBackImageUrl: string | null;
5
4
  render(): import('lit').TemplateResult<1>;
6
5
  }
@@ -1,4 +1,4 @@
1
- type ApiContext = {
1
+ export type ApiSession = {
2
2
  authToken: string;
3
3
  baseUrl: string;
4
4
  };
@@ -6,5 +6,5 @@ type ApiFactoryConfig<TApi> = {
6
6
  createReal: (authToken: string, baseUrl: string) => TApi;
7
7
  createMock: () => TApi;
8
8
  };
9
- export declare function createApiFactory<TApi>(getContext: () => ApiContext, isDemoMode: () => boolean, config: ApiFactoryConfig<TApi>): () => TApi;
9
+ export declare function createApiFactory<TApi>(getContext: () => ApiSession, isDemoMode: () => boolean, config: ApiFactoryConfig<TApi>): () => TApi;
10
10
  export {};
@@ -1,5 +1,5 @@
1
1
  import { nothing, TemplateResult } from 'lit';
2
- import { gameContextType } from '../components/shared/context/game.context';
2
+ import { LimitsContextType } from '../components/shared/context/slices/limits.context';
3
3
  import { GameInfoConfig } from '../components/shared/GameInfo/gameInfoConfig';
4
4
  import { Action, BetResult } from './bet.types';
5
5
  import { OrigamiGame } from './constants';
@@ -15,7 +15,7 @@ export interface GameUiModule {
15
15
  readonly id: OrigamiGame;
16
16
  readonly renderGame: () => TemplateResult;
17
17
  readonly gameInfo: GameInfoConfig;
18
- readonly maxMultiplier: (edge: number, gameData?: gameContextType) => number;
18
+ readonly maxMultiplier: (limits: LimitsContextType) => number;
19
19
  readonly verifierInputs: (betActionData: Action['data']) => VerifierGameOptions;
20
20
  readonly verifierQuery: (request: VerifierUrlRequest) => VerifierQueryOptions;
21
21
  readonly extractOutcome: (bet: Omit<BetResult, 'afterBalance'>) => unknown;
@@ -1,4 +1,5 @@
1
- import { PlayResult, RandomNumberGenerator } from '@betorigami/game-calculations';
1
+ import { default as Big } from 'big.js';
2
+ import { PlayRequest, PlayResult } from '@betorigami/game-calculations';
2
3
  import { Action, BetResult } from './bet.types';
3
4
  export type MockGameResult = {
4
5
  success: true;
@@ -8,9 +9,7 @@ export type MockGameResult = {
8
9
  error: string;
9
10
  };
10
11
  export type GameEngine = {
11
- play(generator: RandomNumberGenerator, action: {
12
- readonly type: string;
13
- } & Record<string, unknown>, previousActions?: readonly PlayResult[]): PlayResult;
12
+ play(request: PlayRequest): PlayResult;
14
13
  };
15
14
  export declare abstract class MockBridgedGameService {
16
15
  protected abstract readonly gameId: string;
@@ -18,7 +17,7 @@ export declare abstract class MockBridgedGameService {
18
17
  protected abstract readonly minRandomValue: number;
19
18
  protected abstract readonly maxRandomValue: number;
20
19
  protected readonly edge: number;
21
- protected abstract createGameEngine(edge: number): GameEngine;
20
+ protected abstract createGameEngine(): GameEngine;
22
21
  protected abstract toActionData(playResult: PlayResult): Action['data'];
23
22
  private currentBalance;
24
23
  private activeBet;
@@ -28,6 +27,7 @@ export declare abstract class MockBridgedGameService {
28
27
  private amount;
29
28
  protected constructor(initialBalance: number);
30
29
  setRandomSequence(values: number[]): void;
30
+ protected roundStake(unroundedStake: Big): Big;
31
31
  protected startGame(input: {
32
32
  amount: string;
33
33
  gameInputs: {
@@ -0,0 +1,3 @@
1
+ import { ComplexAttributeConverter } from 'lit';
2
+ export declare const numberAttribute: (fallback: number) => ComplexAttributeConverter<number>;
3
+ export declare const nullableNumberAttribute: ComplexAttributeConverter<number | null>;
@@ -0,0 +1,6 @@
1
+ import { default as Big } from 'big.js';
2
+ export declare const calculateProfitOnWin: ({ betAmount, multiplier, maxPayout }: {
3
+ betAmount: Big;
4
+ multiplier: Big;
5
+ maxPayout: Big;
6
+ }) => Big;
@@ -1,9 +1,2 @@
1
1
  export type Language = 'ar' | 'de' | 'en' | 'en-soc' | 'es' | 'fi' | 'fr' | 'hi' | 'id' | 'ja' | 'ko' | 'pl' | 'pt' | 'ru' | 'tr' | 'vi' | 'zh';
2
- export interface LanguageContextType {
3
- language: Language;
4
- setLanguage: (language: Language) => void;
5
- }
6
- export declare const languageContext: {
7
- __context__: LanguageContextType;
8
- };
9
2
  export declare const DEFAULT_LANGUAGE: Language;
@@ -1,9 +1,7 @@
1
+ import { LayoutContextType } from '../components/shared/context/slices/layout.context';
1
2
  /**
2
- * Calculates the game layout style based on viewport dimensions and game data
3
- * @param gameData - The game data containing scale and mainWidth properties
3
+ * Calculates the game layout style based on viewport dimensions and the layout context
4
+ * @param layout - The layout context containing the scale and isDesktop properties
4
5
  * @returns The calculated CSS style string for the game layout
5
6
  */
6
- export declare function calculateGameLayoutStyle(gameData: {
7
- scale: number;
8
- mainWidth: number;
9
- }): string;
7
+ export declare function calculateGameLayoutStyle(layout: LayoutContextType): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betorigami/game-ui-shared",
3
- "version": "1.7.0",
3
+ "version": "2.0.1",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "The Lit components, controllers, translations and wire types shared by every Origami game UI",
@@ -25,7 +25,8 @@
25
25
  "lit": "^3.3.0"
26
26
  },
27
27
  "dependencies": {
28
- "@betorigami/game-calculations": "10.0.0",
28
+ "@betorigami/game-calculations": "11.0.1",
29
+ "@betorigami/guard": "^2.0.7",
29
30
  "lottie-web": "^5.13.0",
30
31
  "web-haptics": "^0.0.6"
31
32
  },
@@ -1,93 +0,0 @@
1
- import { default as Big } from 'big.js';
2
- import { HapticsController } from '../../../controllers/haptics.controller';
3
- import { HistoryController } from '../../../controllers/history.controller';
4
- import { SoundEffectsController } from '../../../controllers/sound/sound-effects.controller';
5
- import { SupportedEdgePercentages, Currency } from '../../../shared/constants';
6
- import { Language } from '../../../translations';
7
- import { UiLockContent } from '../UiLock/UiLockContent';
8
- export type gameContextType = {
9
- betAmount: string;
10
- updateBetAmount: (newAmount: Big) => void;
11
- updateBalance: (newAmount: Big) => void;
12
- currency: Currency;
13
- currencyDecimals: number;
14
- payoutDecimals: number;
15
- showCurrencyAsText: boolean;
16
- balance: number;
17
- scale: number;
18
- baseUrl: string;
19
- authToken: string;
20
- publicKey: string;
21
- hotkeysOpenEnabled: boolean;
22
- showMaxBetButton: boolean;
23
- volume: number;
24
- instantBetEnabled: boolean;
25
- mainWidth: number;
26
- updateMainWidth: (width: number) => void;
27
- updateHotkeysOpenEnabled: (enabled: boolean) => void;
28
- updateShowMaxBetButton: (enabled: boolean) => void;
29
- updateVolume: (volume: number) => void;
30
- updateInstantBetEnabled: (enabled: boolean) => void;
31
- language: Language;
32
- autobetNumberOfBets: number;
33
- updateAutobetNumberOfBets: (numberOfBets: number) => void;
34
- soundEffects?: SoundEffectsController;
35
- historyController?: HistoryController;
36
- haptics?: HapticsController;
37
- lobbyUrl: string | null;
38
- depositUrl?: string;
39
- hasLoadedBalance: boolean;
40
- maxPayout: number | null;
41
- minBet: number | null;
42
- maxBet: number | null;
43
- edge: SupportedEdgePercentages;
44
- uiLock: UiLockContent | null;
45
- footerPosition: 'ABOVE' | 'BELOW';
46
- logoUrl: string | null;
47
- alwaysEnableMaxBetButton: boolean;
48
- gcCurrencyIconSvgUrl: string | null;
49
- scCurrencyIconSvgUrl: string | null;
50
- customMinesBackgroundSvgUrl: string | null;
51
- customMinesGemSvgUrl: string | null;
52
- customMinesBombSvgUrl: string | null;
53
- customMinesTileSvgUrl: string | null;
54
- customMinesAutobetSelectedTileSvgUrl: string | null;
55
- customKenoBackgroundSvgUrl: string | null;
56
- customKenoGemSvgUrl: string | null;
57
- customKenoNonMatchTileSvgUrl: string | null;
58
- customKenoTileSvgUrl: string | null;
59
- customKenoSelectedTileSvgUrl: string | null;
60
- customRouletteBackgroundSvgUrl: string | null;
61
- roulettePreventOppositeBets: boolean;
62
- customDiceBackgroundSvgUrl: string | null;
63
- diceMinMultiplier: number | null;
64
- advancedDiceMinMultiplier: number | null;
65
- customAdvancedDiceBackgroundSvgUrl: string | null;
66
- customPlinkoBackgroundSvgUrl: string | null;
67
- customPlinkoEdgeColor: string | null;
68
- customPlinkoCenterColor: string | null;
69
- customBaccaratBackgroundSvgUrl: string | null;
70
- baccaratPreventOppositeBets: boolean;
71
- customLimboBackgroundSvgUrl: string | null;
72
- customWheelBackgroundSvgUrl: string | null;
73
- customWheelCenterSvgUrl: string | null;
74
- customWheelCenterPadding: number | null;
75
- customDiamondsBackgroundSvgUrl: string | null;
76
- customBlackjackBackgroundSvgUrl: string | null;
77
- customBlitzBackgroundSvgUrl: string | null;
78
- blitzMinPickCount: number | null;
79
- blitzMaxPickCount: number | null;
80
- customCardBackSvgUrl: string | null;
81
- customCardRedColor: string | null;
82
- customCardBlackColor: string | null;
83
- customFooterLobbySvgUrl: string | null;
84
- customFooterVolumeSvgUrl: string | null;
85
- customFooterGameInfoSvgUrl: string | null;
86
- customFooterInstantBetSvgUrl: string | null;
87
- customFooterHotkeysSvgUrl: string | null;
88
- customFooterProvablyFairSvgUrl: string | null;
89
- };
90
- export declare const DEFAULT_GAME_CONTEXT: gameContextType;
91
- export declare const gameContext: {
92
- __context__: gameContextType;
93
- };