@betorigami/games 3.4.9 → 3.4.10

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.
@@ -32,6 +32,6 @@ export declare class BaccaratGame extends ChipTableGameComponent {
32
32
  private handleBetExecution;
33
33
  toggleAutobet(event: AutobetToggleEvent): Promise<void>;
34
34
  baccaratPlay(): Promise<void>;
35
- protected executeAutobet(_autobetSettings: AutobetSettingsWithId, _currentBetAmount: string): Promise<GameBetResult>;
35
+ protected executeAutobet(autobetSettings: AutobetSettingsWithId, _currentBetAmount: string): Promise<GameBetResult>;
36
36
  render(): import('lit').TemplateResult<1>;
37
37
  }
@@ -1,4 +1,4 @@
1
- import { Language, StartBetResponse, Currency } from '@betorigami/game-ui-shared';
1
+ import { Language, AutobetApiSettings, StartBetResponse, Currency } from '@betorigami/game-ui-shared';
2
2
  export type BaccaratSelection = {
3
3
  position: 'PLAYER' | 'BANKER' | 'TIE';
4
4
  amount: string;
@@ -8,6 +8,9 @@ export type BaccaratStartArgs = {
8
8
  currency: Currency;
9
9
  amount: string;
10
10
  selections: BaccaratSelection[];
11
+ meta?: {
12
+ autobetSettings: AutobetApiSettings;
13
+ };
11
14
  };
12
15
  export declare class BaccaratApi {
13
16
  private authToken;
package/dist/index.mjs CHANGED
@@ -20886,7 +20886,7 @@ class BaccaratApi {
20886
20886
  }
20887
20887
  async startBet(oe) {
20888
20888
  try {
20889
- const Me = { currency: oe.currency, amount: oe.amount, gameInputs: { bets: oe.selections.map((Vt) => ({ type: Vt.position, amount: Vt.amount })) } }, Oe = await fetch(`${this.baseUrl}/play`, { method: "POST", signal: AbortSignal.timeout(Qe$1), headers: { "Content-Type": "application/json", Authorization: `Bearer ${this.authToken}`, "X-Origami-Trace": cp() }, body: JSON.stringify(Me) }), vt = await Oe.json();
20889
+ const Me = { currency: oe.currency, amount: oe.amount, gameInputs: { bets: oe.selections.map((Vt) => ({ type: Vt.position, amount: Vt.amount })) }, meta: oe.meta }, Oe = await fetch(`${this.baseUrl}/play`, { method: "POST", signal: AbortSignal.timeout(Qe$1), headers: { "Content-Type": "application/json", Authorization: `Bearer ${this.authToken}`, "X-Origami-Trace": cp() }, body: JSON.stringify(Me) }), vt = await Oe.json();
20890
20890
  if (Oe.ok && vt.id) return { success: !0, data: vt };
20891
20891
  const Mt = Zc(vt);
20892
20892
  return { success: !1, error: l$1(Gh(Mt), oe.language), errorCode: Mt };
@@ -21519,22 +21519,22 @@ let BaccaratGame = class extends Ba {
21519
21519
  const Ut = Mt.multiplier, Da = Ut >= 1;
21520
21520
  this.resultMultiplier = Ut, this.betId = Mt.betId, this.payout = Mt.payout, this.gameWinPopupShowing = Da, Ut > 1 && this.playWinFeedback(), this.addToHistory(Ut, Da, Mt.betId), this.updateHistoryWithBet(te);
21521
21521
  }
21522
- async handleBetExecution() {
21522
+ async handleBetExecution(te) {
21523
21523
  if (this.instantModeForCurrentBet = this.gameData?.instantBetEnabled ?? !1, !this.gameData?.currency) return { success: !1, error: l$1("alerts.gameError", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21524
21524
  if (this.derivedChips.size === 0) return { success: !1, error: l$1("games.baccarat.selectChip", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21525
21525
  if (this.isMaxPayoutExceeded(this.chipEvents)) return { success: !1, error: l$1("alerts.maxPayoutExceeded", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21526
- const { selections: te, totalAmount: oe } = BaccaratUtils.buildSelectionsAndTotal(this.derivedChips), Me = oe.toFixed(8);
21526
+ const { selections: oe, totalAmount: Me } = BaccaratUtils.buildSelectionsAndTotal(this.derivedChips), Oe = Me.toFixed(8);
21527
21527
  this.resetForNextBet(() => {
21528
21528
  this.currentRound = null, this.resultMultiplier = null, this.gameWinPopupShowing = !1, this.payout = null;
21529
21529
  });
21530
- const Oe = Big(this.gameData.balance);
21530
+ const vt = Big(this.gameData.balance);
21531
21531
  try {
21532
- if (this.isDemoMode && Oe.lt(oe)) return { success: !1, error: l$1("alerts.insufficientBalance", this.gameData?.language || w$2), errorCode: Sa.INSUFFICIENT_BALANCE };
21533
- this.preDeductStake(Oe, oe);
21534
- const vt = await this.placeBet(() => this.baccaratApi.startBet({ language: this.gameData.language, amount: Me, currency: this.gameData.currency, selections: te }));
21535
- return vt.success ? (await this.processBetResult(vt.data, Oe, oe), vt) : (this.gameData.updateBalance(Oe), vt);
21536
- } catch (vt) {
21537
- return this.gameData.updateBalance(Oe), { success: !1, error: vt instanceof Error ? vt.message : l$1("alerts.gameError", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21532
+ if (this.isDemoMode && vt.lt(Me)) return { success: !1, error: l$1("alerts.insufficientBalance", this.gameData?.language || w$2), errorCode: Sa.INSUFFICIENT_BALANCE };
21533
+ this.preDeductStake(vt, Me);
21534
+ const Mt = await this.placeBet(() => this.baccaratApi.startBet({ language: this.gameData.language, amount: Oe, currency: this.gameData.currency, selections: oe, meta: te ? yp(te) : void 0 }));
21535
+ return Mt.success ? (await this.processBetResult(Mt.data, vt, Me), Mt) : (this.gameData.updateBalance(vt), Mt);
21536
+ } catch (Mt) {
21537
+ return this.gameData.updateBalance(vt), { success: !1, error: Mt instanceof Error ? Mt.message : l$1("alerts.gameError", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21538
21538
  }
21539
21539
  }
21540
21540
  async toggleAutobet(te) {
@@ -21549,7 +21549,7 @@ let BaccaratGame = class extends Ba {
21549
21549
  async executeAutobet(te, oe) {
21550
21550
  try {
21551
21551
  if (this.gameWinPopupShowing = !1, this.derivedChips.size === 0) return { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: l$1("games.baccarat.selectChip", this.gameData?.language || w$2), errorCode: Sa.UNKNOWN };
21552
- const Me = await this.handleBetExecution();
21552
+ const Me = await this.handleBetExecution(te);
21553
21553
  if (!Me.success) return this.checkSessionExpired(Me.errorCode ?? Sa.UNKNOWN), { pnl: Big(0), gameOutcome: "Draw", hasError: !0, errorMessage: Me.error || l$1("alerts.errorProcessingBet", this.gameData?.language || w$2), errorCode: Me.errorCode ?? Sa.UNKNOWN };
21554
21554
  const Oe = Me.data, vt = Big(Oe.payout ?? 0).minus(Oe.amount ?? 0), Mt = up(Number(Oe.multiplier));
21555
21555
  return await this.awaitRevealSettle(Mt === "Win"), await this.holdResultDisplay(), this.gameWinPopupShowing = !1, { pnl: vt, gameOutcome: Mt, hasError: !1 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betorigami/games",
3
- "version": "3.4.9",
3
+ "version": "3.4.10",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",