@betorigami/game-ui-shared 2.1.0 → 4.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 +1 -1
- package/dist/components/shared/ChipTableGameComponent.d.ts +2 -0
- package/dist/components/shared/GameComponent.d.ts +9 -0
- package/dist/components/shared/GameProviderWrapper.d.ts +5 -4
- package/dist/components/shared/GenericAutobet/GenericAutobet.d.ts +1 -0
- package/dist/components/shared/context/slices/layout.context.d.ts +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +2463 -2450
- package/dist/shared/constants.d.ts +1 -0
- package/dist/shared/container-queries.styles.d.ts +3 -0
- package/dist/utils/game-layout-style.d.ts +2 -2
- package/package.json +1 -1
- package/dist/components/shared/context/desktop-attribute.d.ts +0 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ The Lit components, controllers, translations, wire types and game-module regist
|
|
|
10
10
|
import { GameComponent, RequiredContext, localeContext, getTranslation } from '@betorigami/game-ui-shared';
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
Elements read the game context through `RequiredContext`, one per slice they need (`localeContext`, `sessionContext`, `limitsContext`, `servicesContext`, `skinContext`, `preferencesContext`, `layoutContext`, `walletContext`), all provided by `<origami-game-provider-wrapper>`. Reading a slice outside the wrapper throws.
|
|
13
|
+
Elements read the game context through `RequiredContext`, one per slice they need (`localeContext`, `sessionContext`, `limitsContext`, `servicesContext`, `skinContext`, `preferencesContext`, `layoutContext`, `walletContext`), all provided by `<origami-game-provider-wrapper>`. Reading a slice outside the wrapper throws. Desktop and mobile styles go in `${desktopContainerQuery} { … }` and `${mobileContainerQuery} { … }` blocks, after the base rules they override; both query the `game-layout` container the wrapper provides. Tests give an element its slices with `provideTestContexts` and change them with `updateTestContexts`.
|
|
14
14
|
|
|
15
15
|
A game contributes itself through a `GameUiModule`:
|
|
16
16
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { default as Big } from 'big.js';
|
|
1
2
|
import { RequiredContext } from './context/required-context';
|
|
2
3
|
import { HotkeyDefinition } from '../../controllers/hotkey.controller';
|
|
3
4
|
import { ChipEvent } from '../../shared/chip-state.utils';
|
|
@@ -29,6 +30,7 @@ export declare abstract class ChipTableGameComponent extends GameComponent {
|
|
|
29
30
|
protected get maxPerClickAmount(): string;
|
|
30
31
|
protected get isDoubleDisabled(): boolean;
|
|
31
32
|
watchDerivedChips(_prev?: unknown, _next?: unknown): void;
|
|
33
|
+
protected getAutobetStake(): Big;
|
|
32
34
|
protected onBetAmountChange: (oldBetAmount: string, newBetAmount: string) => void;
|
|
33
35
|
protected adjustPerClickAmount(action: 'half' | 'double' | 'reset'): void;
|
|
34
36
|
protected handlePerClickAmountChange: (e: CustomEvent<{
|
|
@@ -20,6 +20,7 @@ export interface GameBetResult {
|
|
|
20
20
|
hasError: boolean;
|
|
21
21
|
errorCode?: ErrorCode;
|
|
22
22
|
errorMessage?: string;
|
|
23
|
+
afterBalance: Big | null;
|
|
23
24
|
}
|
|
24
25
|
export declare abstract class GameComponent extends OrigamiElement {
|
|
25
26
|
protected readonly locale: RequiredContext<{
|
|
@@ -86,6 +87,14 @@ export declare abstract class GameComponent extends OrigamiElement {
|
|
|
86
87
|
disconnectedCallback(): void;
|
|
87
88
|
toggleAutobet(event: AutobetToggleEvent): Promise<void>;
|
|
88
89
|
protected abstract executeAutobet(autobetSettings: AutobetSettingsWithId, currentBetAmount: string): Promise<GameBetResult>;
|
|
90
|
+
protected getAutobetStake(currentBetAmount: string): Big;
|
|
91
|
+
/**
|
|
92
|
+
* Stops autobet before a round the provider would reject for insufficient balance, sparing it a lock
|
|
93
|
+
* and a write it would only undo. The balance comes from the last response rather than the wallet,
|
|
94
|
+
* since a game can show a balance that trails the provider's while results are still animating. An
|
|
95
|
+
* unknown balance, or a demo session where no provider is involved, lets the round through.
|
|
96
|
+
*/
|
|
97
|
+
private canAffordAutobet;
|
|
89
98
|
protected adjustBetAmount(autobetSettings: AutobetSettingsWithId, gameOutcome: 'Win' | 'Loss' | 'Draw', originalBetAmount: string, currentBetAmount: string): string;
|
|
90
99
|
protected isPnLWithinLimits(autobetSettings: AutobetSettingsWithId, totalPnL: Big): boolean;
|
|
91
100
|
protected updateHistoryWithBet(betResult: NewBetItem): void;
|
|
@@ -17,7 +17,7 @@ export declare class GameProviderWrapper extends OrigamiElement {
|
|
|
17
17
|
maxPayout: number;
|
|
18
18
|
minBet: number;
|
|
19
19
|
maxBet: number;
|
|
20
|
-
edge: 1 | 2 | 3 |
|
|
20
|
+
edge: 1 | 2 | 3 | 4 | 8;
|
|
21
21
|
showCurrencyAsText: boolean;
|
|
22
22
|
footerPosition: 'ABOVE' | 'BELOW';
|
|
23
23
|
logoUrl: string | null;
|
|
@@ -70,7 +70,8 @@ export declare class GameProviderWrapper extends OrigamiElement {
|
|
|
70
70
|
private showMaxBetButton;
|
|
71
71
|
private volume;
|
|
72
72
|
private instantBetEnabled;
|
|
73
|
-
private
|
|
73
|
+
private documentClientWidth;
|
|
74
|
+
private documentClientHeight;
|
|
74
75
|
private publicKey;
|
|
75
76
|
private scale;
|
|
76
77
|
language: Language;
|
|
@@ -107,10 +108,10 @@ export declare class GameProviderWrapper extends OrigamiElement {
|
|
|
107
108
|
updateVolume(volume: number): void;
|
|
108
109
|
updateInstantBetEnabled(enabled: boolean): void;
|
|
109
110
|
updateAutobetNumberOfBets(numberOfBets: number): void;
|
|
110
|
-
|
|
111
|
+
updateClientSize(width: number, height: number): void;
|
|
111
112
|
updateBetAmount(newAmount: Big): void;
|
|
112
113
|
updateBalance(newAmount: Big): void;
|
|
113
|
-
private
|
|
114
|
+
private handleResize;
|
|
114
115
|
private setupResizeObserver;
|
|
115
116
|
private cleanupResizeObserver;
|
|
116
117
|
private calculateScale;
|
|
@@ -35,6 +35,7 @@ export declare class GenericAutobet extends OrigamiElement {
|
|
|
35
35
|
willUpdate(changedProperties: Map<string | symbol, unknown>): void;
|
|
36
36
|
triggerPrimaryAction(): void;
|
|
37
37
|
isPrimaryActionDisabled(): boolean;
|
|
38
|
+
private get isBetButtonDisabled();
|
|
38
39
|
private _handleWinPercentageChange;
|
|
39
40
|
private _handleLossPercentageChange;
|
|
40
41
|
private _handleStopOnProfitChange;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export declare const DESKTOP_MIN_WIDTH = 768;
|
|
2
1
|
export type LayoutContextType = {
|
|
3
2
|
isDesktop: boolean;
|
|
4
3
|
scale: number;
|
|
4
|
+
clientWidth: number;
|
|
5
|
+
clientHeight: number;
|
|
5
6
|
};
|
|
6
7
|
export declare const DEFAULT_LAYOUT_CONTEXT: LayoutContextType;
|
|
7
8
|
export declare const layoutContext: {
|
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,6 @@ export * from './components/shared/Toggle/Toggle';
|
|
|
67
67
|
export * from './components/shared/Tooltip/Tooltip.styles';
|
|
68
68
|
export * from './components/shared/Tooltip/Tooltip';
|
|
69
69
|
export * from './components/shared/context/required-context';
|
|
70
|
-
export * from './components/shared/context/desktop-attribute';
|
|
71
70
|
export * from './components/shared/context/provide-test-contexts';
|
|
72
71
|
export * from './components/shared/context/slices/layout.context';
|
|
73
72
|
export * from './components/shared/context/slices/limits.context';
|
|
@@ -109,6 +108,7 @@ export * from './shared/cards/card.utils';
|
|
|
109
108
|
export * from './shared/chip-state.utils';
|
|
110
109
|
export * from './shared/component.styles';
|
|
111
110
|
export * from './shared/constants';
|
|
111
|
+
export * from './shared/container-queries.styles';
|
|
112
112
|
export * from './shared/create-api-factory';
|
|
113
113
|
export * from './shared/event-map';
|
|
114
114
|
export * from './shared/format-monetary-amount';
|