@smartico/public-api 0.0.262 → 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,6 +1,6 @@
1
1
  import { SAWTemplate } from './SAWTemplate';
2
2
  declare class SAWUtils {
3
- static canPlay: (t: SAWTemplate, user: {
3
+ static canPlay: (t: SAWTemplate, user_balances: {
4
4
  ach_points_balance: number;
5
5
  ach_gems_balance: number;
6
6
  ach_diamonds_balance: number;
@@ -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, user) {
294
+ SAWUtils.canPlay = function (t, user_balances) {
295
295
  if (t === null || t === undefined) {
296
296
  return false;
297
297
  }
@@ -308,11 +308,11 @@ SAWUtils.canPlay = function (t, user) {
308
308
  case exports.SAWBuyInType.Gems:
309
309
  case exports.SAWBuyInType.Diamonds:
310
310
  {
311
- var balance = user.ach_points_balance;
311
+ var balance = user_balances.ach_points_balance;
312
312
  if (t.saw_buyin_type_id === exports.SAWBuyInType.Gems) {
313
- balance = user.ach_gems_balance;
313
+ balance = user_balances.ach_gems_balance;
314
314
  } else if (t.saw_buyin_type_id === exports.SAWBuyInType.Diamonds) {
315
- balance = user.ach_diamonds_balance;
315
+ balance = user_balances.ach_diamonds_balance;
316
316
  }
317
317
  return t.buyin_cost_points <= balance;
318
318
  }
@@ -419,7 +419,7 @@ var MiniGamePrizeTypeNamed = function MiniGamePrizeTypeNamed(type) {
419
419
  var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
420
420
  return items.map(function (r) {
421
421
  var _r$saw_skin_ui_defini;
422
- var x = {
422
+ var x = _extends({
423
423
  id: r.saw_template_id,
424
424
  name: r.saw_template_ui_definition.name,
425
425
  description: r.saw_template_ui_definition.description,
@@ -428,8 +428,14 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
428
428
  no_attempts_message: r.saw_template_ui_definition.no_attempts_message,
429
429
  jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
430
430
  saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
431
- saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
432
- 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
+ } : {}, {
433
439
  jackpot_add_on_attempt: r.jackpot_add_on_attempt,
434
440
  jackpot_current: r.jackpot_current,
435
441
  spin_count: r.spin_count,
@@ -481,7 +487,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
481
487
  };
482
488
  return y;
483
489
  })
484
- };
490
+ });
485
491
  return x;
486
492
  });
487
493
  };
@@ -1349,12 +1355,14 @@ exports.TournamentRegistrationType = void 0;
1349
1355
  TournamentRegistrationType[TournamentRegistrationType["BUY_IN_POINTS"] = 3] = "BUY_IN_POINTS";
1350
1356
  TournamentRegistrationType[TournamentRegistrationType["MANUAL_APPROVAL"] = 4] = "MANUAL_APPROVAL";
1351
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";
1352
1360
  // BUY_IN_CASH = 5???,
1353
1361
  })(exports.TournamentRegistrationType || (exports.TournamentRegistrationType = {}));
1354
1362
  /** @hidden */
1355
1363
  var TournamentRegistrationTypeGetName = function TournamentRegistrationTypeGetName(type) {
1356
1364
  var _TournamentRegistrati;
1357
- 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';
1358
1366
  };
1359
1367
 
1360
1368
  /** @hidden */
@@ -1389,7 +1397,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1389
1397
  return items.filter(function (r) {
1390
1398
  return r.tournamentId >= 1;
1391
1399
  }).map(function (r) {
1392
- var x = {
1400
+ var x = _extends({
1393
1401
  instance_id: r.tournamentInstanceId,
1394
1402
  tournament_id: r.tournamentId,
1395
1403
  name: r.publicMeta.name,
@@ -1412,8 +1420,14 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1412
1420
  players_min_count: r.playersMinCount,
1413
1421
  players_max_count: r.playersMaxCount,
1414
1422
  registration_status: TournamentRegistrationStatusNamed(r.tournamentRegistrationStatus),
1415
- registration_type: TournamentRegistrationTypeGetName(r.registrationType),
1416
- 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
+ } : {}, {
1417
1431
  duration_ms: r.durationMs,
1418
1432
  is_active: TournamentUtils.isActive(r),
1419
1433
  is_can_register: TournamentUtils.isCanRegister(r),
@@ -1423,7 +1437,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
1423
1437
  is_upcoming: TournamentUtils.isUpcoming(r),
1424
1438
  min_scores_win: r.minScoreToWin,
1425
1439
  hide_leaderboard_min_scores: r.hideLeaderboardsMinScores
1426
- };
1440
+ });
1427
1441
  if (r.prizeStructure) {
1428
1442
  x.prizes = r.prizeStructure.prizes.map(function (p) {
1429
1443
  return TournamentUtils.getPrizeTransformed(p);