@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.
package/docs/README.md CHANGED
@@ -101,7 +101,7 @@
101
101
 
102
102
  ### TournamentRegistrationTypeName
103
103
 
104
- Ƭ **TournamentRegistrationTypeName**: ``"AUTO"`` \| ``"OPT_IN"`` \| ``"BUY_IN_POINTS"`` \| ``"MANUAL_APPROVAL"`` \| ``"REQUIRES_QUALIFICATION"`` \| ``"UNKNOWN"``
104
+ Ƭ **TournamentRegistrationTypeName**: ``"AUTO"`` \| ``"OPT_IN"`` \| ``"BUY_IN_POINTS"`` \| ``"MANUAL_APPROVAL"`` \| ``"REQUIRES_QUALIFICATION"`` \| ``"BUY_IN_GEMS"`` \| ``"BUY_IN_DIAMONDS"`` \| ``"UNKNOWN"``
105
105
 
106
106
  ## Functions
107
107
 
@@ -54,12 +54,28 @@ ___
54
54
 
55
55
  ### buyin\_cost\_points
56
56
 
57
- • **buyin\_cost\_points**: `number`
57
+ `Optional` **buyin\_cost\_points**: `number`
58
58
 
59
59
  in case of charging type 'Points', what is the points amount will be deducted from user balance
60
60
 
61
61
  ___
62
62
 
63
+ ### buyin\_cost\_gems
64
+
65
+ • `Optional` **buyin\_cost\_gems**: `number`
66
+
67
+ in case of charging type 'Gems', what is the gems amount will be deducted from user balance
68
+
69
+ ___
70
+
71
+ ### buyin\_cost\_diamonds
72
+
73
+ • `Optional` **buyin\_cost\_diamonds**: `number`
74
+
75
+ in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance
76
+
77
+ ___
78
+
63
79
  ### spin\_count
64
80
 
65
81
  • `Optional` **spin\_count**: `number`
@@ -230,12 +230,28 @@ ___
230
230
 
231
231
  ### registration\_cost\_points
232
232
 
233
- • **registration\_cost\_points**: `number`
233
+ `Optional` **registration\_cost\_points**: `number`
234
234
 
235
235
  Cost of registration in the tournament in gamification points
236
236
 
237
237
  ___
238
238
 
239
+ ### registration\_cost\_gems
240
+
241
+ • `Optional` **registration\_cost\_gems**: `number`
242
+
243
+ Cost of registration in the tournament in gems
244
+
245
+ ___
246
+
247
+ ### registration\_cost\_diamonds
248
+
249
+ • `Optional` **registration\_cost\_diamonds**: `number`
250
+
251
+ Cost of registration in the tournament in diamonds
252
+
253
+ ___
254
+
239
255
  ### is\_active
240
256
 
241
257
  • **is\_active**: `boolean`
@@ -301,7 +301,7 @@ ___
301
301
 
302
302
  ### registration\_cost\_points
303
303
 
304
- • **registration\_cost\_points**: `number`
304
+ `Optional` **registration\_cost\_points**: `number`
305
305
 
306
306
  Cost of registration in the tournament in gamification points
307
307
 
@@ -311,6 +311,30 @@ Cost of registration in the tournament in gamification points
311
311
 
312
312
  ___
313
313
 
314
+ ### registration\_cost\_gems
315
+
316
+ • `Optional` **registration\_cost\_gems**: `number`
317
+
318
+ Cost of registration in the tournament in gems
319
+
320
+ #### Inherited from
321
+
322
+ [TTournament](TTournament.md).[registration_cost_gems](TTournament.md#registration_cost_gems)
323
+
324
+ ___
325
+
326
+ ### registration\_cost\_diamonds
327
+
328
+ • `Optional` **registration\_cost\_diamonds**: `number`
329
+
330
+ Cost of registration in the tournament in diamonds
331
+
332
+ #### Inherited from
333
+
334
+ [TTournament](TTournament.md).[registration_cost_diamonds](TTournament.md#registration_cost_diamonds)
335
+
336
+ ___
337
+
314
338
  ### is\_active
315
339
 
316
340
  • **is\_active**: `boolean`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.261",
3
+ "version": "0.0.263",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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;
@@ -2,7 +2,7 @@ import { IntUtils } from '../IntUtils';
2
2
  import { TMiniGamePrize, TMiniGameTemplate } from '../WSAPI/WSAPITypes';
3
3
  import { ProtocolResponse } from './../Base/ProtocolResponse';
4
4
  import { SAWAcknowledgeTypeNamed } from './SAWAcknowledgeType';
5
- import { SAWBuyInTypeNamed } from './SAWBuyInType';
5
+ import { SAWBuyInType, SAWBuyInTypeNamed } from './SAWBuyInType';
6
6
  import { SAWGameTypeNamed } from './SAWGameType';
7
7
  import { MiniGamePrizeTypeName, MiniGamePrizeTypeNamed } from './SAWPrizeType';
8
8
  import { SAWTemplate } from './SAWTemplate';
@@ -27,7 +27,9 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
27
27
  jackpot_symbol: r.saw_template_ui_definition.jackpot_symbol,
28
28
  saw_game_type: SAWGameTypeNamed(r.saw_game_type_id),
29
29
  saw_buyin_type: SAWBuyInTypeNamed(r.saw_buyin_type_id),
30
- buyin_cost_points: r.buyin_cost_points,
30
+ ...(r.saw_buyin_type_id === SAWBuyInType.Points ? { buyin_cost_points: r.buyin_cost_points } : {}),
31
+ ...(r.saw_buyin_type_id === SAWBuyInType.Gems ? { buyin_cost_gems: r.buyin_cost_points } : {}),
32
+ ...(r.saw_buyin_type_id === SAWBuyInType.Diamonds ? { buyin_cost_diamonds: r.buyin_cost_points } : {}),
31
33
  jackpot_add_on_attempt: r.jackpot_add_on_attempt,
32
34
  jackpot_current: r.jackpot_current,
33
35
  spin_count: r.spin_count,
@@ -2,7 +2,7 @@ import { SAWBuyInType } from './SAWBuyInType';
2
2
  import { SAWTemplate } from './SAWTemplate';
3
3
 
4
4
  class SAWUtils {
5
- public static canPlay = (t: SAWTemplate, balance: number): boolean => {
5
+ public static canPlay = (t: SAWTemplate, user_balances: {ach_points_balance: number, ach_gems_balance: number, ach_diamonds_balance: number}): boolean => {
6
6
  if (t === null || t === undefined) {
7
7
  return false;
8
8
  }
@@ -17,6 +17,12 @@ class SAWUtils {
17
17
  case SAWBuyInType.Points:
18
18
  case SAWBuyInType.Gems:
19
19
  case SAWBuyInType.Diamonds: {
20
+ let balance = user_balances.ach_points_balance;
21
+ if (t.saw_buyin_type_id === SAWBuyInType.Gems) {
22
+ balance = user_balances.ach_gems_balance;
23
+ } else if (t.saw_buyin_type_id === SAWBuyInType.Diamonds) {
24
+ balance = user_balances.ach_diamonds_balance;
25
+ }
20
26
  return t.buyin_cost_points <= balance;
21
27
  }
22
28
 
@@ -484,6 +484,8 @@ declare enum TournamentRegistrationType {
484
484
  BUY_IN_POINTS = 3,
485
485
  MANUAL_APPROVAL = 4,
486
486
  REQUIRES_QUALIFICATION = 5,
487
+ BUY_IN_GEMS = 15,
488
+ BUY_IN_DIAMONDS = 16,
487
489
  }
488
490
  /*
489
491
  AUTO – The user is automatically registered upon their first qualifying action; no manual action is required.
@@ -498,6 +500,8 @@ export type TournamentRegistrationTypeName =
498
500
  | 'BUY_IN_POINTS'
499
501
  | 'MANUAL_APPROVAL'
500
502
  | 'REQUIRES_QUALIFICATION'
503
+ | 'BUY_IN_GEMS'
504
+ | 'BUY_IN_DIAMONDS'
501
505
  | 'UNKNOWN';
502
506
  declare enum TournamentInstanceStatus {
503
507
  PUBLISHED = 1,
@@ -774,6 +778,10 @@ export interface TMiniGameTemplate {
774
778
  saw_buyin_type: SAWBuyInTypeName;
775
779
  /** in case of charging type 'Points', what is the points amount will be deducted from user balance */
776
780
  buyin_cost_points: number;
781
+ /** in case of charging type 'Gems', what is the gems amount will be deducted from user balance */
782
+ buyin_cost_gems: number;
783
+ /** in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance */
784
+ buyin_cost_diamonds: number;
777
785
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
778
786
  spin_count?: number;
779
787
  /** 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 */
@@ -945,7 +953,11 @@ export interface TTournament {
945
953
  /** Tournament duration in millisecnnds */
946
954
  duration_ms: number;
947
955
  /** Cost of registration in the tournament in gamification points */
948
- registration_cost_points: number;
956
+ registration_cost_points?: number;
957
+ /** Cost of registration in the tournament in gems */
958
+ registration_cost_gems?: number;
959
+ /** Cost of registration in the tournament in diamonds */
960
+ registration_cost_diamonds?: number;
949
961
  /** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
950
962
  is_active: boolean;
951
963
  /** Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet */
@@ -98,7 +98,9 @@ export const TournamentItemsTransform = (items: Tournament[]): TTournament[] =>
98
98
  registration_status: TournamentRegistrationStatusNamed(r.tournamentRegistrationStatus),
99
99
 
100
100
  registration_type: TournamentRegistrationTypeGetName(r.registrationType),
101
- registration_cost_points: r.buyInAmount,
101
+ ...(r.registrationType === TournamentRegistrationType.BUY_IN_POINTS ? { registration_cost_points: r.buyInAmount } : {}),
102
+ ...(r.registrationType === TournamentRegistrationType.BUY_IN_GEMS ? { registration_cost_gems: r.buyInAmount } : {}),
103
+ ...(r.registrationType === TournamentRegistrationType.BUY_IN_DIAMONDS ? { registration_cost_diamonds: r.buyInAmount } : {}),
102
104
  duration_ms: r.durationMs,
103
105
 
104
106
  is_active: TournamentUtils.isActive(r),
@@ -5,6 +5,8 @@ export enum TournamentRegistrationType {
5
5
  BUY_IN_POINTS = 3,
6
6
  MANUAL_APPROVAL = 4,
7
7
  REQUIRES_QUALIFICATION = 5,
8
+ BUY_IN_GEMS = 15,
9
+ BUY_IN_DIAMONDS = 16,
8
10
  // BUY_IN_CASH = 5???,
9
11
  }
10
12
 
@@ -14,6 +16,8 @@ export type TournamentRegistrationTypeName =
14
16
  | 'BUY_IN_POINTS'
15
17
  | 'MANUAL_APPROVAL'
16
18
  | 'REQUIRES_QUALIFICATION'
19
+ | 'BUY_IN_GEMS'
20
+ | 'BUY_IN_DIAMONDS'
17
21
  | 'UNKNOWN';
18
22
 
19
23
  /** @hidden */
@@ -24,5 +28,7 @@ export const TournamentRegistrationTypeGetName = (type: TournamentRegistrationTy
24
28
  [TournamentRegistrationType.MANUAL_APPROVAL]: 'MANUAL_APPROVAL',
25
29
  [TournamentRegistrationType.OPT_IN]: 'OPT_IN',
26
30
  [TournamentRegistrationType.REQUIRES_QUALIFICATION]: 'REQUIRES_QUALIFICATION',
31
+ [TournamentRegistrationType.BUY_IN_GEMS]: 'BUY_IN_GEMS',
32
+ [TournamentRegistrationType.BUY_IN_DIAMONDS]: 'BUY_IN_DIAMONDS',
27
33
  }[type] || 'UNKNOWN') as any as TournamentRegistrationTypeName;
28
34
  };
@@ -24,14 +24,16 @@ export class TournamentUtils {
24
24
  return true;
25
25
  }
26
26
  return (
27
- !tournament.isUserRegistered &&
28
- (tournament.playersMaxCount !== tournament.registrationCount ||
27
+ !tournament.isUserRegistered && (
28
+ tournament.playersMaxCount !== tournament.registrationCount ||
29
29
  tournament.playersMaxCount === null ||
30
- tournament.playersMaxCount === 0) &&
31
- tournament.registrationType !== TournamentRegistrationType.AUTO &&
32
- (tournament.tournamentInstanceStatus === TournamentInstanceStatus.REGISTER ||
33
- (tournament.tournamentInstanceStatus === TournamentInstanceStatus.STARTED &&
34
- tournament.allowLateRegistration))
30
+ tournament.playersMaxCount === 0
31
+ ) &&
32
+ tournament.registrationType !== TournamentRegistrationType.AUTO && (
33
+ tournament.tournamentInstanceStatus === TournamentInstanceStatus.REGISTER || (
34
+ tournament.tournamentInstanceStatus === TournamentInstanceStatus.STARTED && tournament.allowLateRegistration
35
+ )
36
+ )
35
37
  );
36
38
  }
37
39
  return false;
@@ -127,7 +127,11 @@ export interface TMiniGameTemplate {
127
127
  saw_buyin_type: SAWBuyInTypeName;
128
128
 
129
129
  /** in case of charging type 'Points', what is the points amount will be deducted from user balance */
130
- buyin_cost_points: number;
130
+ buyin_cost_points?: number;
131
+ /** in case of charging type 'Gems', what is the gems amount will be deducted from user balance */
132
+ buyin_cost_gems?: number;
133
+ /** in case of charging type 'Diamonds', what is the diamonds amount will be deducted from user balance */
134
+ buyin_cost_diamonds?: number;
131
135
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
132
136
  spin_count?: number;
133
137
 
@@ -342,7 +346,11 @@ export interface TTournament {
342
346
  duration_ms: number;
343
347
 
344
348
  /** Cost of registration in the tournament in gamification points */
345
- registration_cost_points: number;
349
+ registration_cost_points?: number;
350
+ /** Cost of registration in the tournament in gems */
351
+ registration_cost_gems?: number;
352
+ /** Cost of registration in the tournament in diamonds */
353
+ registration_cost_diamonds?: number;
346
354
 
347
355
  /** Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED */
348
356
  is_active: boolean;