@smartico/public-api 0.0.261 → 0.0.263

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.
@@ -263,7 +263,7 @@ const SAWBuyInTypeNamed = type => {
263
263
  };
264
264
 
265
265
  class SAWUtils {}
266
- SAWUtils.canPlay = (t, balance) => {
266
+ SAWUtils.canPlay = (t, user_balances) => {
267
267
  if (t === null || t === undefined) {
268
268
  return false;
269
269
  }
@@ -280,6 +280,12 @@ SAWUtils.canPlay = (t, balance) => {
280
280
  case SAWBuyInType.Gems:
281
281
  case SAWBuyInType.Diamonds:
282
282
  {
283
+ let balance = user_balances.ach_points_balance;
284
+ if (t.saw_buyin_type_id === SAWBuyInType.Gems) {
285
+ balance = user_balances.ach_gems_balance;
286
+ } else if (t.saw_buyin_type_id === SAWBuyInType.Diamonds) {
287
+ balance = user_balances.ach_diamonds_balance;
288
+ }
283
289
  return t.buyin_cost_points <= balance;
284
290
  }
285
291
  default:
@@ -408,7 +414,7 @@ const MiniGamePrizeTypeNamed = type => {
408
414
  const SAWTemplatesTransform = items => {
409
415
  return items.map(r => {
410
416
  var _r$saw_skin_ui_defini;
411
- const x = {
417
+ const x = _extends({
412
418
  id: r.saw_template_id,
413
419
  name: r.saw_template_ui_definition.name,
414
420
  description: r.saw_template_ui_definition.description,
@@ -417,8 +423,14 @@ const SAWTemplatesTransform = items => {
417
423
  no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
418
424
  jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
419
425
  saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
420
- saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
421
- buyin_cost_points: r.buyin_cost_points,
426
+ saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id)
427
+ }, r.saw_buyin_type_id === SAWBuyInType.Points ? {
428
+ buyin_cost_points: r.buyin_cost_points
429
+ } : {}, r.saw_buyin_type_id === SAWBuyInType.Gems ? {
430
+ buyin_cost_gems: r.buyin_cost_points
431
+ } : {}, r.saw_buyin_type_id === SAWBuyInType.Diamonds ? {
432
+ buyin_cost_diamonds: r.buyin_cost_points
433
+ } : {}, {
422
434
  jackpot_add_on_attempt: r.jackpot_add_on_attempt,
423
435
  jackpot_current: r.jackpot_current,
424
436
  spin_count: r.spin_count,
@@ -470,7 +482,7 @@ const SAWTemplatesTransform = items => {
470
482
  };
471
483
  return y;
472
484
  })
473
- };
485
+ });
474
486
  return x;
475
487
  });
476
488
  };
@@ -1321,6 +1333,8 @@ var TournamentRegistrationType;
1321
1333
  TournamentRegistrationType[TournamentRegistrationType["BUY_IN_POINTS"] = 3] = "BUY_IN_POINTS";
1322
1334
  TournamentRegistrationType[TournamentRegistrationType["MANUAL_APPROVAL"] = 4] = "MANUAL_APPROVAL";
1323
1335
  TournamentRegistrationType[TournamentRegistrationType["REQUIRES_QUALIFICATION"] = 5] = "REQUIRES_QUALIFICATION";
1336
+ TournamentRegistrationType[TournamentRegistrationType["BUY_IN_GEMS"] = 15] = "BUY_IN_GEMS";
1337
+ TournamentRegistrationType[TournamentRegistrationType["BUY_IN_DIAMONDS"] = 16] = "BUY_IN_DIAMONDS";
1324
1338
  // BUY_IN_CASH = 5???,
1325
1339
  })(TournamentRegistrationType || (TournamentRegistrationType = {}));
1326
1340
  /** @hidden */
@@ -1330,7 +1344,9 @@ const TournamentRegistrationTypeGetName = type => {
1330
1344
  [TournamentRegistrationType.BUY_IN_POINTS]: 'BUY_IN_POINTS',
1331
1345
  [TournamentRegistrationType.MANUAL_APPROVAL]: 'MANUAL_APPROVAL',
1332
1346
  [TournamentRegistrationType.OPT_IN]: 'OPT_IN',
1333
- [TournamentRegistrationType.REQUIRES_QUALIFICATION]: 'REQUIRES_QUALIFICATION'
1347
+ [TournamentRegistrationType.REQUIRES_QUALIFICATION]: 'REQUIRES_QUALIFICATION',
1348
+ [TournamentRegistrationType.BUY_IN_GEMS]: 'BUY_IN_GEMS',
1349
+ [TournamentRegistrationType.BUY_IN_DIAMONDS]: 'BUY_IN_DIAMONDS'
1334
1350
  }[type] || 'UNKNOWN';
1335
1351
  };
1336
1352
 
@@ -1371,7 +1387,7 @@ const TournamentRegistrationStatusNamed = type => {
1371
1387
 
1372
1388
  const TournamentItemsTransform = items => {
1373
1389
  return items.filter(r => r.tournamentId >= 1).map(r => {
1374
- const x = {
1390
+ const x = _extends({
1375
1391
  instance_id: r.tournamentInstanceId,
1376
1392
  tournament_id: r.tournamentId,
1377
1393
  name: r.publicMeta.name,
@@ -1394,8 +1410,14 @@ const TournamentItemsTransform = items => {
1394
1410
  players_min_count: r.playersMinCount,
1395
1411
  players_max_count: r.playersMaxCount,
1396
1412
  registration_status: TournamentRegistrationStatusNamed(r.tournamentRegistrationStatus),
1397
- registration_type: TournamentRegistrationTypeGetName(r.registrationType),
1398
- registration_cost_points: r.buyInAmount,
1413
+ registration_type: TournamentRegistrationTypeGetName(r.registrationType)
1414
+ }, r.registrationType === TournamentRegistrationType.BUY_IN_POINTS ? {
1415
+ registration_cost_points: r.buyInAmount
1416
+ } : {}, r.registrationType === TournamentRegistrationType.BUY_IN_GEMS ? {
1417
+ registration_cost_gems: r.buyInAmount
1418
+ } : {}, r.registrationType === TournamentRegistrationType.BUY_IN_DIAMONDS ? {
1419
+ registration_cost_diamonds: r.buyInAmount
1420
+ } : {}, {
1399
1421
  duration_ms: r.durationMs,
1400
1422
  is_active: TournamentUtils.isActive(r),
1401
1423
  is_can_register: TournamentUtils.isCanRegister(r),
@@ -1405,7 +1427,7 @@ const TournamentItemsTransform = items => {
1405
1427
  is_upcoming: TournamentUtils.isUpcoming(r),
1406
1428
  min_scores_win: r.minScoreToWin,
1407
1429
  hide_leaderboard_min_scores: r.hideLeaderboardsMinScores
1408
- };
1430
+ });
1409
1431
  if (r.prizeStructure) {
1410
1432
  x.prizes = r.prizeStructure.prizes.map(p => TournamentUtils.getPrizeTransformed(p));
1411
1433
  }