@smartico/public-api 0.0.261 → 0.0.262

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.
@@ -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: {
4
+ ach_points_balance: number;
5
+ ach_gems_balance: number;
6
+ ach_diamonds_balance: number;
7
+ }) => boolean;
4
8
  }
5
9
  export { SAWUtils };
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) {
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.ach_points_balance;
312
+ if (t.saw_buyin_type_id === exports.SAWBuyInType.Gems) {
313
+ balance = user.ach_gems_balance;
314
+ } else if (t.saw_buyin_type_id === exports.SAWBuyInType.Diamonds) {
315
+ balance = user.ach_diamonds_balance;
316
+ }
311
317
  return t.buyin_cost_points <= balance;
312
318
  }
313
319
  default: