@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.
@@ -2,6 +2,8 @@ export interface PublicProperties {
2
2
  core_user_language?: string;
3
3
  ach_points_balance?: number;
4
4
  ach_points_ever?: number;
5
+ ach_gems_balance?: number;
6
+ ach_diamonds_balance?: number;
5
7
  ach_level_current_id?: number;
6
8
  ach_level_current?: string;
7
9
  core_is_test_account?: boolean;
@@ -1,5 +1,9 @@
1
1
  import { SAWTemplate } from './SAWTemplate';
2
2
  declare class SAWUtils {
3
- static canPlay: (t: SAWTemplate, balance: number) => boolean;
3
+ static canPlay: (t: SAWTemplate, user_balances: {
4
+ ach_points_balance: number;
5
+ ach_gems_balance: number;
6
+ ach_diamonds_balance: number;
7
+ }) => boolean;
4
8
  }
5
9
  export { SAWUtils };
@@ -481,9 +481,11 @@ declare enum TournamentRegistrationType {
481
481
  OPT_IN = 2,
482
482
  BUY_IN_POINTS = 3,
483
483
  MANUAL_APPROVAL = 4,
484
- REQUIRES_QUALIFICATION = 5
484
+ REQUIRES_QUALIFICATION = 5,
485
+ BUY_IN_GEMS = 15,
486
+ BUY_IN_DIAMONDS = 16
485
487
  }
486
- export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'UNKNOWN';
488
+ export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'BUY_IN_GEMS' | 'BUY_IN_DIAMONDS' | 'UNKNOWN';
487
489
  declare enum TournamentInstanceStatus {
488
490
  PUBLISHED = 1,
489
491
  REGISTER = 2,
@@ -759,6 +761,10 @@ export interface TMiniGameTemplate {
759
761
  saw_buyin_type: SAWBuyInTypeName;
760
762
  /** in case of charging type 'Points', what is the points amount will be deducted from user balance */
761
763
  buyin_cost_points: number;
764
+ /** in case of charging type 'Gems', what is the gems amount will be deducted from user balance */
765
+ buyin_cost_gems: number;
766
+ /** in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance */
767
+ buyin_cost_diamonds: number;
762
768
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
763
769
  spin_count?: number;
764
770
  /** if the game is limit to the number of spins that user can do during period of time, this property shows the epoch time in UTC when the next attempt will be available */
@@ -930,7 +936,11 @@ export interface TTournament {
930
936
  /** Tournament duration in millisecnnds */
931
937
  duration_ms: number;
932
938
  /** Cost of registration in the tournament in gamification points */
933
- registration_cost_points: number;
939
+ registration_cost_points?: number;
940
+ /** Cost of registration in the tournament in gems */
941
+ registration_cost_gems?: number;
942
+ /** Cost of registration in the tournament in diamonds */
943
+ registration_cost_diamonds?: number;
934
944
  /** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
935
945
  is_active: boolean;
936
946
  /** Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet */
@@ -4,8 +4,10 @@ export declare enum TournamentRegistrationType {
4
4
  OPT_IN = 2,
5
5
  BUY_IN_POINTS = 3,
6
6
  MANUAL_APPROVAL = 4,
7
- REQUIRES_QUALIFICATION = 5
7
+ REQUIRES_QUALIFICATION = 5,
8
+ BUY_IN_GEMS = 15,
9
+ BUY_IN_DIAMONDS = 16
8
10
  }
9
- export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'UNKNOWN';
11
+ export type TournamentRegistrationTypeName = 'AUTO' | 'OPT_IN' | 'BUY_IN_POINTS' | 'MANUAL_APPROVAL' | 'REQUIRES_QUALIFICATION' | 'BUY_IN_GEMS' | 'BUY_IN_DIAMONDS' | 'UNKNOWN';
10
12
  /** @hidden */
11
13
  export declare const TournamentRegistrationTypeGetName: (type: TournamentRegistrationType) => TournamentRegistrationTypeName;
@@ -119,7 +119,11 @@ export interface TMiniGameTemplate {
119
119
  /** How the user is charged for each game attempt e.g. Free, Points or Spin attempts */
120
120
  saw_buyin_type: SAWBuyInTypeName;
121
121
  /** in case of charging type 'Points', what is the points amount will be deducted from user balance */
122
- buyin_cost_points: number;
122
+ buyin_cost_points?: number;
123
+ /** in case of charging type 'Gems', what is the gems amount will be deducted from user balance */
124
+ buyin_cost_gems?: number;
125
+ /** in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance */
126
+ buyin_cost_diamonds?: number;
123
127
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
124
128
  spin_count?: number;
125
129
  /** if the game is limit to the number of spins that user can do during period of time, this property shows the epoch time in UTC when the next attempt will be available */
@@ -313,7 +317,11 @@ export interface TTournament {
313
317
  /** Tournament duration in millisecnnds */
314
318
  duration_ms: number;
315
319
  /** Cost of registration in the tournament in gamification points */
316
- registration_cost_points: number;
320
+ registration_cost_points?: number;
321
+ /** Cost of registration in the tournament in gems */
322
+ registration_cost_gems?: number;
323
+ /** Cost of registration in the tournament in diamonds */
324
+ registration_cost_diamonds?: number;
317
325
  /** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
318
326
  is_active: boolean;
319
327
  /** Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet */
package/dist/index.js CHANGED
@@ -291,7 +291,7 @@ var SAWBuyInTypeNamed = function SAWBuyInTypeNamed(type) {
291
291
  };
292
292
 
293
293
  var SAWUtils = function SAWUtils() {};
294
- SAWUtils.canPlay = function (t, balance) {
294
+ SAWUtils.canPlay = function (t, user_balances) {
295
295
  if (t === null || t === undefined) {
296
296
  return false;
297
297
  }
@@ -308,6 +308,12 @@ SAWUtils.canPlay = function (t, balance) {
308
308
  case exports.SAWBuyInType.Gems:
309
309
  case exports.SAWBuyInType.Diamonds:
310
310
  {
311
+ var balance = user_balances.ach_points_balance;
312
+ if (t.saw_buyin_type_id === exports.SAWBuyInType.Gems) {
313
+ balance = user_balances.ach_gems_balance;
314
+ } else if (t.saw_buyin_type_id === exports.SAWBuyInType.Diamonds) {
315
+ balance = user_balances.ach_diamonds_balance;
316
+ }
311
317
  return t.buyin_cost_points <= balance;
312
318
  }
313
319
  default:
@@ -413,7 +419,7 @@ var MiniGamePrizeTypeNamed = function MiniGamePrizeTypeNamed(type) {
413
419
  var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
414
420
  return items.map(function (r) {
415
421
  var _r$saw_skin_ui_defini;
416
- var x = {
422
+ var x = _extends({
417
423
  id: r.saw_template_id,
418
424
  name: r.saw_template_ui_definition.name,
419
425
  description: r.saw_template_ui_definition.description,
@@ -422,8 +428,14 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
422
428
  no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
423
429
  jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
424
430
  saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
425
- saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
426
- buyin_cost_points: r.buyin_cost_points,
431
+ saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id)
432
+ }, r.saw_buyin_type_id === exports.SAWBuyInType.Points ? {
433
+ buyin_cost_points: r.buyin_cost_points
434
+ } : {}, r.saw_buyin_type_id === exports.SAWBuyInType.Gems ? {
435
+ buyin_cost_gems: r.buyin_cost_points
436
+ } : {}, r.saw_buyin_type_id === exports.SAWBuyInType.Diamonds ? {
437
+ buyin_cost_diamonds: r.buyin_cost_points
438
+ } : {}, {
427
439
  jackpot_add_on_attempt: r.jackpot_add_on_attempt,
428
440
  jackpot_current: r.jackpot_current,
429
441
  spin_count: r.spin_count,
@@ -475,7 +487,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
475
487
  };
476
488
  return y;
477
489
  })
478
- };
490
+ });
479
491
  return x;
480
492
  });
481
493
  };
@@ -1343,12 +1355,14 @@ exports.TournamentRegistrationType = void 0;
1343
1355
  TournamentRegistrationType[TournamentRegistrationType["BUY_IN_POINTS"] = 3] = "BUY_IN_POINTS";
1344
1356
  TournamentRegistrationType[TournamentRegistrationType["MANUAL_APPROVAL"] = 4] = "MANUAL_APPROVAL";
1345
1357
  TournamentRegistrationType[TournamentRegistrationType["REQUIRES_QUALIFICATION"] = 5] = "REQUIRES_QUALIFICATION";
1358
+ TournamentRegistrationType[TournamentRegistrationType["BUY_IN_GEMS"] = 15] = "BUY_IN_GEMS";
1359
+ TournamentRegistrationType[TournamentRegistrationType["BUY_IN_DIAMONDS"] = 16] = "BUY_IN_DIAMONDS";
1346
1360
  // BUY_IN_CASH = 5???,
1347
1361
  })(exports.TournamentRegistrationType || (exports.TournamentRegistrationType = {}));
1348
1362
  /** @hidden */
1349
1363
  var TournamentRegistrationTypeGetName = function TournamentRegistrationTypeGetName(type) {
1350
1364
  var _TournamentRegistrati;
1351
- return (_TournamentRegistrati = {}, _TournamentRegistrati[exports.TournamentRegistrationType.AUTO] = 'AUTO', _TournamentRegistrati[exports.TournamentRegistrationType.BUY_IN_POINTS] = 'BUY_IN_POINTS', _TournamentRegistrati[exports.TournamentRegistrationType.MANUAL_APPROVAL] = 'MANUAL_APPROVAL', _TournamentRegistrati[exports.TournamentRegistrationType.OPT_IN] = 'OPT_IN', _TournamentRegistrati[exports.TournamentRegistrationType.REQUIRES_QUALIFICATION] = 'REQUIRES_QUALIFICATION', _TournamentRegistrati)[type] || 'UNKNOWN';
1365
+ return (_TournamentRegistrati = {}, _TournamentRegistrati[exports.TournamentRegistrationType.AUTO] = 'AUTO', _TournamentRegistrati[exports.TournamentRegistrationType.BUY_IN_POINTS] = 'BUY_IN_POINTS', _TournamentRegistrati[exports.TournamentRegistrationType.MANUAL_APPROVAL] = 'MANUAL_APPROVAL', _TournamentRegistrati[exports.TournamentRegistrationType.OPT_IN] = 'OPT_IN', _TournamentRegistrati[exports.TournamentRegistrationType.REQUIRES_QUALIFICATION] = 'REQUIRES_QUALIFICATION', _TournamentRegistrati[exports.TournamentRegistrationType.BUY_IN_GEMS] = 'BUY_IN_GEMS', _TournamentRegistrati[exports.TournamentRegistrationType.BUY_IN_DIAMONDS] = 'BUY_IN_DIAMONDS', _TournamentRegistrati)[type] || 'UNKNOWN';
1352
1366
  };
1353
1367
 
1354
1368
  /** @hidden */
@@ -1383,7 +1397,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1383
1397
  return items.filter(function (r) {
1384
1398
  return r.tournamentId >= 1;
1385
1399
  }).map(function (r) {
1386
- var x = {
1400
+ var x = _extends({
1387
1401
  instance_id: r.tournamentInstanceId,
1388
1402
  tournament_id: r.tournamentId,
1389
1403
  name: r.publicMeta.name,
@@ -1406,8 +1420,14 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1406
1420
  players_min_count: r.playersMinCount,
1407
1421
  players_max_count: r.playersMaxCount,
1408
1422
  registration_status: TournamentRegistrationStatusNamed(r.tournamentRegistrationStatus),
1409
- registration_type: TournamentRegistrationTypeGetName(r.registrationType),
1410
- registration_cost_points: r.buyInAmount,
1423
+ registration_type: TournamentRegistrationTypeGetName(r.registrationType)
1424
+ }, r.registrationType === exports.TournamentRegistrationType.BUY_IN_POINTS ? {
1425
+ registration_cost_points: r.buyInAmount
1426
+ } : {}, r.registrationType === exports.TournamentRegistrationType.BUY_IN_GEMS ? {
1427
+ registration_cost_gems: r.buyInAmount
1428
+ } : {}, r.registrationType === exports.TournamentRegistrationType.BUY_IN_DIAMONDS ? {
1429
+ registration_cost_diamonds: r.buyInAmount
1430
+ } : {}, {
1411
1431
  duration_ms: r.durationMs,
1412
1432
  is_active: TournamentUtils.isActive(r),
1413
1433
  is_can_register: TournamentUtils.isCanRegister(r),
@@ -1417,7 +1437,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1417
1437
  is_upcoming: TournamentUtils.isUpcoming(r),
1418
1438
  min_scores_win: r.minScoreToWin,
1419
1439
  hide_leaderboard_min_scores: r.hideLeaderboardsMinScores
1420
- };
1440
+ });
1421
1441
  if (r.prizeStructure) {
1422
1442
  x.prizes = r.prizeStructure.prizes.map(function (p) {
1423
1443
  return TournamentUtils.getPrizeTransformed(p);