@betorigami/games 3.4.13 → 3.4.14
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.
|
@@ -10,7 +10,7 @@ export declare class MinesGame extends GameComponent {
|
|
|
10
10
|
private isLoading;
|
|
11
11
|
private isSelectingRandomTile;
|
|
12
12
|
private isCheckingForSession;
|
|
13
|
-
private
|
|
13
|
+
private readonly reveals;
|
|
14
14
|
static styles: import('lit').CSSResult[];
|
|
15
15
|
private _minesManualEl?;
|
|
16
16
|
private _minesAutoEl?;
|
|
@@ -37,6 +37,9 @@ export declare class MinesGame extends GameComponent {
|
|
|
37
37
|
minesManualStart(): Promise<void>;
|
|
38
38
|
minesChooseRandomTile(): Promise<void>;
|
|
39
39
|
minesNext(selectedTile: number): Promise<void>;
|
|
40
|
+
private isRoundOpen;
|
|
41
|
+
private canReveal;
|
|
42
|
+
private applyReveal;
|
|
40
43
|
minesCashout(): Promise<void>;
|
|
41
44
|
onManualOrAutoChange(): void;
|
|
42
45
|
onMinesCountChange(): void;
|
|
@@ -9,7 +9,8 @@ export declare class MinesGrid extends OrigamiElement {
|
|
|
9
9
|
minesState: Partial<MinesState> | null;
|
|
10
10
|
hasWon: boolean;
|
|
11
11
|
hitBomb: boolean;
|
|
12
|
-
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
loadingTiles: readonly number[];
|
|
13
14
|
private _getTileInfo;
|
|
14
15
|
private calculateTileState;
|
|
15
16
|
render(): import('lit').TemplateResult<1>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
export declare class PendingRevealsController implements ReactiveController {
|
|
3
|
+
private readonly host;
|
|
4
|
+
private pending;
|
|
5
|
+
private tiles;
|
|
6
|
+
constructor(host: ReactiveControllerHost);
|
|
7
|
+
hostConnected(): void;
|
|
8
|
+
get pendingTiles(): readonly number[];
|
|
9
|
+
get hasPending(): boolean;
|
|
10
|
+
isPending(tile: number): boolean;
|
|
11
|
+
track<T>(tile: number, request: Promise<T>, apply: (result: T) => void): Promise<T>;
|
|
12
|
+
allApplied(): Promise<void>;
|
|
13
|
+
private setPending;
|
|
14
|
+
}
|
package/dist/index.mjs
CHANGED
|
@@ -12190,28 +12190,6 @@ const Xs = (ee) => {
|
|
|
12190
12190
|
-webkit-overflow-scrolling: touch;
|
|
12191
12191
|
}
|
|
12192
12192
|
}
|
|
12193
|
-
|
|
12194
|
-
.loading-overlay {
|
|
12195
|
-
position: absolute;
|
|
12196
|
-
inset: 0;
|
|
12197
|
-
z-index: 9999;
|
|
12198
|
-
display: var(--loading-overlay-display);
|
|
12199
|
-
background: var(--loading-background, var(--background-tertiary));
|
|
12200
|
-
transition: transform 0.3s ease-out;
|
|
12201
|
-
will-change: transform;
|
|
12202
|
-
}
|
|
12203
|
-
|
|
12204
|
-
.loading-overlay.loaded {
|
|
12205
|
-
pointer-events: none;
|
|
12206
|
-
transform: translateY(-100%);
|
|
12207
|
-
}
|
|
12208
|
-
|
|
12209
|
-
@media (prefers-reduced-motion: reduce) {
|
|
12210
|
-
.loading-overlay {
|
|
12211
|
-
transition: none;
|
|
12212
|
-
}
|
|
12213
|
-
}
|
|
12214
|
-
|
|
12215
12193
|
`;
|
|
12216
12194
|
var Fh = Object.defineProperty, Nh = Object.getOwnPropertyDescriptor, b$1 = (ee, ne, oe, It) => {
|
|
12217
12195
|
for (var Rt, di = It > 1 ? void 0 : It ? Nh(ne, oe) : ne, ui = ee.length - 1; ui >= 0; ui--) (Rt = ee[ui]) && (di = (It ? Rt(ne, oe, di) : Rt(di)) || di);
|
|
@@ -12259,7 +12237,7 @@ let y$2 = class extends T$2 {
|
|
|
12259
12237
|
super.disconnectedCallback(), this.removeEventListener("lock-ui", this.handleLockUi), this.cleanupResizeObserver(), this._soundEffects.destroy(), this._haptics.destroy();
|
|
12260
12238
|
}
|
|
12261
12239
|
updated(ee) {
|
|
12262
|
-
super.updated(ee), ee.has("baseUrl") && this.fetchPublicKey(), this.publish();
|
|
12240
|
+
super.updated(ee), ee.has("baseUrl") && this.fetchPublicKey(), this.toggleAttribute("loaded", this.hasLoadedBalance), this.publish();
|
|
12263
12241
|
}
|
|
12264
12242
|
get isDemoMode() {
|
|
12265
12243
|
return !this.authToken || !this.baseUrl;
|
|
@@ -12351,7 +12329,6 @@ let y$2 = class extends T$2 {
|
|
|
12351
12329
|
`;
|
|
12352
12330
|
return b$4`
|
|
12353
12331
|
<div style=${this.isDesktop ? ne : ""}>${ee}</div>
|
|
12354
|
-
<div class=${e$1({ "loading-overlay": !0, loaded: this.hasLoadedBalance })}></div>
|
|
12355
12332
|
`;
|
|
12356
12333
|
}
|
|
12357
12334
|
};
|
|
@@ -14045,7 +14022,7 @@ var __defProp$15 = Object.defineProperty, __getOwnPropDesc$15 = Object.getOwnPro
|
|
|
14045
14022
|
const MINES_COLUMN_COUNT = 5, MINES_ROW_COUNT = Math.ceil(MINES_TILES_COUNT / MINES_COLUMN_COUNT), MINES_TILE_ROWS = Array.from({ length: MINES_ROW_COUNT }, (ee, ne) => Array.from({ length: MINES_COLUMN_COUNT }, (oe, It) => ne * MINES_COLUMN_COUNT + It + 1).filter((oe) => oe <= MINES_TILES_COUNT));
|
|
14046
14023
|
let MinesGrid = class extends T$2 {
|
|
14047
14024
|
constructor() {
|
|
14048
|
-
super(...arguments), this.skin = new w$2(this, Ct), this.isAuto = !1, this.autobetSelectedTiles = [], this.autobetInProgress = !1, this.minesState = null, this.hasWon = !1, this.hitBomb = !1, this.loadingTiles = [];
|
|
14025
|
+
super(...arguments), this.skin = new w$2(this, Ct), this.isAuto = !1, this.autobetSelectedTiles = [], this.autobetInProgress = !1, this.minesState = null, this.hasWon = !1, this.hitBomb = !1, this.disabled = !1, this.loadingTiles = [];
|
|
14049
14026
|
}
|
|
14050
14027
|
_getTileInfo(ee) {
|
|
14051
14028
|
const ne = this.minesState?.state === MinesFlowState.VIEWING_RESULTS, oe = this.minesState?.mineLocations?.includes(ee) ?? !1, It = this.minesState?.selectedTiles?.includes(ee) ?? !1;
|
|
@@ -14070,7 +14047,7 @@ let MinesGrid = class extends T$2 {
|
|
|
14070
14047
|
return b$4`
|
|
14071
14048
|
<origami-mines-tile
|
|
14072
14049
|
class=${e$1({ "is-revealed-gem": Pa && !ea && Ua, "full-icon": !!this.skin.value.customMinesTileSvgUrl || ui === MinesTileState.AUTOBET_SELECTED && !!this.skin.value.customMinesAutobetSelectedTileSvgUrl })}
|
|
14073
|
-
?disabled=${ne || this.autobetInProgress}
|
|
14050
|
+
?disabled=${ne || this.autobetInProgress || this.disabled}
|
|
14074
14051
|
.tileId=${Rt}
|
|
14075
14052
|
.state=${ui}
|
|
14076
14053
|
.delayReveal=${this.hitBomb && !this.isAuto}
|
|
@@ -14085,7 +14062,7 @@ let MinesGrid = class extends T$2 {
|
|
|
14085
14062
|
`;
|
|
14086
14063
|
}
|
|
14087
14064
|
};
|
|
14088
|
-
MinesGrid.styles = [M$1, minesGridStyles], __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "isAuto", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "autobetSelectedTiles", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "autobetInProgress", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "minesState", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "hasWon", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "hitBomb", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "loadingTiles", 2), MinesGrid = __decorateClass$15([t$3("origami-mines-grid"), pa], MinesGrid);
|
|
14065
|
+
MinesGrid.styles = [M$1, minesGridStyles], __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "isAuto", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "autobetSelectedTiles", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "autobetInProgress", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "minesState", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "hasWon", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "hitBomb", 2), __decorateClass$15([n$4({ type: Boolean })], MinesGrid.prototype, "disabled", 2), __decorateClass$15([n$4({ attribute: !1 })], MinesGrid.prototype, "loadingTiles", 2), MinesGrid = __decorateClass$15([t$3("origami-mines-grid"), pa], MinesGrid);
|
|
14089
14066
|
const limboMultiplierStyles = i$a`
|
|
14090
14067
|
:host {
|
|
14091
14068
|
display: flex;
|
|
@@ -26082,6 +26059,39 @@ class MockMinesApi {
|
|
|
26082
26059
|
return Number.isInteger(ne) && ne >= 1 && ne <= MINES_TILES_COUNT;
|
|
26083
26060
|
}
|
|
26084
26061
|
}
|
|
26062
|
+
const settled = () => {
|
|
26063
|
+
};
|
|
26064
|
+
class PendingRevealsController {
|
|
26065
|
+
constructor(ne) {
|
|
26066
|
+
this.pending = [], this.tiles = [], this.host = ne, ne.addController(this);
|
|
26067
|
+
}
|
|
26068
|
+
hostConnected() {
|
|
26069
|
+
}
|
|
26070
|
+
get pendingTiles() {
|
|
26071
|
+
return this.tiles;
|
|
26072
|
+
}
|
|
26073
|
+
get hasPending() {
|
|
26074
|
+
return this.pending.length > 0;
|
|
26075
|
+
}
|
|
26076
|
+
isPending(ne) {
|
|
26077
|
+
return this.pending.some((oe) => oe.tile === ne);
|
|
26078
|
+
}
|
|
26079
|
+
async track(ne, oe, It) {
|
|
26080
|
+
const Rt = oe.then((ui) => (It(ui), ui)), di = { tile: ne, applied: Rt.then(settled, settled) };
|
|
26081
|
+
this.setPending([...this.pending, di]);
|
|
26082
|
+
try {
|
|
26083
|
+
return await Rt;
|
|
26084
|
+
} finally {
|
|
26085
|
+
this.setPending(this.pending.filter((ui) => ui !== di));
|
|
26086
|
+
}
|
|
26087
|
+
}
|
|
26088
|
+
async allApplied() {
|
|
26089
|
+
await Promise.all(this.pending.map((ne) => ne.applied));
|
|
26090
|
+
}
|
|
26091
|
+
setPending(ne) {
|
|
26092
|
+
this.pending = ne, this.tiles = ne.map((oe) => oe.tile), this.host.requestUpdate();
|
|
26093
|
+
}
|
|
26094
|
+
}
|
|
26085
26095
|
var __defProp$e = Object.defineProperty, __getOwnPropDesc$e = Object.getOwnPropertyDescriptor, __decorateClass$e = (ee, ne, oe, It) => {
|
|
26086
26096
|
for (var Rt, di = It > 1 ? void 0 : It ? __getOwnPropDesc$e(ne, oe) : ne, ui = ee.length - 1; ui >= 0; ui--) (Rt = ee[ui]) && (di = (It ? Rt(ne, oe, di) : Rt(di)) || di);
|
|
26087
26097
|
return It && di && __defProp$e(ne, oe, di), di;
|
|
@@ -26102,7 +26112,7 @@ class ValueWatcher {
|
|
|
26102
26112
|
}
|
|
26103
26113
|
let MinesGame = class extends Vt {
|
|
26104
26114
|
constructor() {
|
|
26105
|
-
super(), this.limits = new w$2(this, lt$1), this.layout = new w$2(this, Ot), this.minesCount = 3, this.autobetSelectedTiles = [], this.minesData = null, this.isLoading = !1, this.isSelectingRandomTile = !1, this.isCheckingForSession = !0, this.
|
|
26115
|
+
super(), this.limits = new w$2(this, lt$1), this.layout = new w$2(this, Ot), this.minesCount = 3, this.autobetSelectedTiles = [], this.minesData = null, this.isLoading = !1, this.isSelectingRandomTile = !1, this.isCheckingForSession = !0, this.reveals = new PendingRevealsController(this), this.sessionWatcher = new ValueWatcher(([ee, ne], [oe, It]) => {
|
|
26106
26116
|
(!!oe && !!It || !!ee && !!ne) && (this.isCheckingForSession = !0, this.getMinesActiveBet());
|
|
26107
26117
|
}), this._getMinesApi = Lp(() => this.session.value, () => this.session.value.isDemoMode, { createReal: (ee, ne) => new MinesApi(ee, ne), createMock: () => new MockMinesApi(() => this.limits.value.edge, () => this.wallet.value.balance) }), this.minesClickHandler = async (ee) => {
|
|
26108
26118
|
const ne = ee.detail.tile;
|
|
@@ -26219,16 +26229,19 @@ let MinesGame = class extends Vt {
|
|
|
26219
26229
|
}
|
|
26220
26230
|
}
|
|
26221
26231
|
async minesNext(ee) {
|
|
26222
|
-
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
|
|
26227
|
-
|
|
26228
|
-
|
|
26229
|
-
|
|
26230
|
-
|
|
26231
|
-
|
|
26232
|
+
const ne = this.minesData?.id;
|
|
26233
|
+
if (ne === void 0 || this.isLoading || this.reveals.isPending(ee) || !this.canReveal(ne)) return;
|
|
26234
|
+
const oe = await this.reveals.track(ee, this.getMinesApi().selectTile({ betId: ne, selectedTiles: [ee] }), (It) => this.applyReveal(ne, ee, It));
|
|
26235
|
+
oe.success || (await this.reveals.allApplied(), this.canReveal(ne) && this.handleGameplayFailure(oe.errorCode));
|
|
26236
|
+
}
|
|
26237
|
+
isRoundOpen(ee) {
|
|
26238
|
+
return this.minesData?.id === ee && !this.minesData.settled;
|
|
26239
|
+
}
|
|
26240
|
+
canReveal(ee) {
|
|
26241
|
+
return !this.wallet.value.uiLock && this.isRoundOpen(ee);
|
|
26242
|
+
}
|
|
26243
|
+
applyReveal(ee, ne, oe) {
|
|
26244
|
+
oe.success && this.minesData && this.isRoundOpen(ee) && (this.minesData = mergeSelectTileResponse(this.minesData, oe), oe.state.mineLocations.includes(ne) ? this.playTileSound("bomb") : this.playGemReveal(oe.state.numGemsFound, MINES_TILES_COUNT - this.minesCount), oe.settled && (this.wallet.value.updateBalance(oe.afterBalance), oe.state.outcome === MinesGameOutcome.WIN && this.playWinFeedback(), this.updateHistoryWithBet({ id: oe.id, amount: oe.amount.toNumber(), payout: oe.payout.toNumber() })));
|
|
26232
26245
|
}
|
|
26233
26246
|
async minesCashout() {
|
|
26234
26247
|
this.isLoading = !0;
|
|
@@ -26280,7 +26293,7 @@ let MinesGame = class extends Vt {
|
|
|
26280
26293
|
?inputsDisabled=${this.areInputsDisabled}
|
|
26281
26294
|
?isLoading=${this.isLoading}
|
|
26282
26295
|
?isSelectingRandomTile=${this.isSelectingRandomTile}
|
|
26283
|
-
?isTileLoading=${this.
|
|
26296
|
+
?isTileLoading=${this.reveals.hasPending}
|
|
26284
26297
|
@mines-manual-start=${this.minesManualStart}
|
|
26285
26298
|
@mines-cashout=${this.minesCashout}
|
|
26286
26299
|
@mines-choose-random-tile=${this.minesChooseRandomTile}
|
|
@@ -26306,7 +26319,8 @@ let MinesGame = class extends Vt {
|
|
|
26306
26319
|
.hasWon=${ne}
|
|
26307
26320
|
?hitBomb=${di}
|
|
26308
26321
|
?autobetInProgress=${this.autobetInProgress}
|
|
26309
|
-
|
|
26322
|
+
?disabled=${this.isLoading}
|
|
26323
|
+
.loadingTiles=${this.reveals.pendingTiles}
|
|
26310
26324
|
@mines-tile-selected=${this.minesClickHandler}
|
|
26311
26325
|
></origami-mines-grid>
|
|
26312
26326
|
${oe ? b$4`
|
|
@@ -26326,7 +26340,7 @@ let MinesGame = class extends Vt {
|
|
|
26326
26340
|
`;
|
|
26327
26341
|
}
|
|
26328
26342
|
};
|
|
26329
|
-
MinesGame.styles = [...Vt.styles, minesGameStyles], __decorateClass$e([r$4()], MinesGame.prototype, "minesCount", 2), __decorateClass$e([r$4()], MinesGame.prototype, "autobetSelectedTiles", 2), __decorateClass$e([r$4()], MinesGame.prototype, "minesData", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isLoading", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isSelectingRandomTile", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isCheckingForSession", 2), __decorateClass$e([
|
|
26343
|
+
MinesGame.styles = [...Vt.styles, minesGameStyles], __decorateClass$e([r$4()], MinesGame.prototype, "minesCount", 2), __decorateClass$e([r$4()], MinesGame.prototype, "autobetSelectedTiles", 2), __decorateClass$e([r$4()], MinesGame.prototype, "minesData", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isLoading", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isSelectingRandomTile", 2), __decorateClass$e([r$4()], MinesGame.prototype, "isCheckingForSession", 2), __decorateClass$e([e$5("origami-mines-manual")], MinesGame.prototype, "_minesManualEl", 2), __decorateClass$e([e$5("origami-mines-auto")], MinesGame.prototype, "_minesAutoEl", 2), __decorateClass$e([ce("manualOrAuto")], MinesGame.prototype, "onManualOrAutoChange", 1), __decorateClass$e([ce("minesCount")], MinesGame.prototype, "onMinesCountChange", 1), __decorateClass$e([ce("autobetInProgress")], MinesGame.prototype, "onAutobetChange", 1), MinesGame = __decorateClass$e([t$3("origami-mines-game")], MinesGame);
|
|
26330
26344
|
const minesUiModule = legacyUiModule({ id: P.MINES, renderGame: () => b$4`<origami-mines-game></origami-mines-game>`, gameInfo: minesGameInfo, maxMultiplier: ({ edge: ee }) => 5200300 * (100 - ee) / 100, verifierInputs: (ee) => {
|
|
26331
26345
|
const ne = ee.MINES;
|
|
26332
26346
|
return ne !== void 0 && "minesCount" in ne ? { minesCount: ne.minesCount } : {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betorigami/games",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.14",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"lottie-web": "^5.13.0",
|
|
30
30
|
"matter-js": "^0.18.0",
|
|
31
31
|
"web-haptics": "^0.0.6",
|
|
32
|
-
"@betorigami/game-ui-shared": "2.0.
|
|
33
|
-
"@betorigami/game-ui-wheel": "1.1.
|
|
32
|
+
"@betorigami/game-ui-shared": "2.0.1",
|
|
33
|
+
"@betorigami/game-ui-wheel": "1.1.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@playwright/test": "^1.53.0",
|