@smartico/public-api 0.0.132 → 0.0.133

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.
@@ -34,8 +34,6 @@ export declare enum ClassId {
34
34
  RELOAD_ACHIEVEMENTS_EVENT = 504,
35
35
  GET_LEADERS_BOARD_REQUEST = 505,
36
36
  GET_LEADERS_BOARD_RESPONSE = 506,
37
- GET_ACTIVITY_LOG_REQUEST = 507,
38
- GET_ACTIVITY_LOG_RESPONSE = 508,
39
37
  GET_SHOP_ITEMS_REQUEST = 509,
40
38
  GET_SHOP_ITEMS_RESPONSE = 510,
41
39
  BUY_SHOP_ITEM_REQUEST = 511,
@@ -5,5 +5,6 @@ declare class IntUtils {
5
5
  static replaceAll(value: string, regex: string, replacement: string | number): string;
6
6
  static escapeRegExp(v: string): string;
7
7
  static JsonOrText: (str: string) => any;
8
+ static isWithinPeriod: (timestamp: number, period: 'today' | 'thisWeek' | 'thisMonth') => boolean;
8
9
  }
9
10
  export { IntUtils };
@@ -5,5 +5,7 @@ interface JackpotPublicMeta {
5
5
  image_url: string;
6
6
  winner_template: JackpotHtmlTemplate;
7
7
  not_winner_template: JackpotHtmlTemplate;
8
+ placeholder1: string;
9
+ placeholder2: string;
8
10
  }
9
11
  export { JackpotPublicMeta };
@@ -4,7 +4,8 @@ export declare enum SAWGameType {
4
4
  ScratchCard = 2,
5
5
  MatchX = 3,
6
6
  GiftBox = 4,
7
- PrizeDrop = 5
7
+ PrizeDrop = 5,
8
+ Quiz = 6
8
9
  }
9
10
  export declare enum SAWGameTypeName {
10
11
  SpinAWheel = "wheel",
@@ -12,6 +13,7 @@ export declare enum SAWGameTypeName {
12
13
  MatchX = "matchx",
13
14
  GiftBox = "giftbox",
14
15
  PrizeDrop = "prizedrop",
16
+ Quiz = "quiz",
15
17
  Unknown = "unknown"
16
18
  }
17
19
  /** @hidden */
@@ -18,6 +18,7 @@ export interface UserAchievement {
18
18
  time_limit_ms?: number;
19
19
  progress?: number;
20
20
  complete_date?: string;
21
+ complete_date_ts?: number;
21
22
  unlock_date?: string;
22
23
  milliseconds_till_available?: number;
23
24
  completed_tasks?: number;
@@ -30,5 +31,8 @@ export interface UserAchievement {
30
31
  ach_completed_id?: number;
31
32
  requires_prize_claim?: boolean;
32
33
  prize_claimed_date_ts?: number;
34
+ completed_today?: boolean;
35
+ completed_this_week?: boolean;
36
+ completed_this_month?: boolean;
33
37
  }
34
38
  export declare const UserAchievementTransform: (items: UserAchievement[]) => TMissionOrBadge[];
@@ -150,8 +150,6 @@ declare enum ClassId {
150
150
  RELOAD_ACHIEVEMENTS_EVENT = 504,
151
151
  GET_LEADERS_BOARD_REQUEST = 505,
152
152
  GET_LEADERS_BOARD_RESPONSE = 506,
153
- GET_ACTIVITY_LOG_REQUEST = 507,
154
- GET_ACTIVITY_LOG_RESPONSE = 508,
155
153
  GET_SHOP_ITEMS_REQUEST = 509,
156
154
  GET_SHOP_ITEMS_RESPONSE = 510,
157
155
  BUY_SHOP_ITEM_REQUEST = 511,
@@ -3,6 +3,9 @@ import { StoreItem } from "./StoreItem";
3
3
  interface StoreItemPurchased extends StoreItem {
4
4
  purchase_ts: number;
5
5
  purchase_points_amount: number;
6
+ purchased_today?: boolean;
7
+ purchased_this_week?: boolean;
8
+ purchased_this_month?: boolean;
6
9
  }
7
10
  export declare const StoreItemPurchasedTransform: (items: StoreItemPurchased[]) => TStoreItem[];
8
11
  export { StoreItemPurchased };
@@ -1,7 +1,7 @@
1
1
  import { SmarticoAPI } from "../SmarticoAPI";
2
2
  import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
3
3
  import { LeaderBoardPeriodType } from "../Leaderboard";
4
- import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from "src/Jackpots";
4
+ import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from "../Jackpots";
5
5
  /** @group General API */
6
6
  export declare class WSAPI {
7
7
  private api;
@@ -76,6 +76,7 @@ export interface TMiniGameTemplate {
76
76
  promo_text: string;
77
77
  /** The custom data of the mini-game defined by operator in the BackOffice. Can be a JSON object, string or number */
78
78
  custom_data: any;
79
+ /** List of prizes for mini-games */
79
80
  prizes: TMiniGamePrize[];
80
81
  }
81
82
  /**
@@ -286,8 +287,11 @@ export interface TTournamentDetailed extends TTournament {
286
287
  * TStoreCategory describes the store category item. Each store item can be assigned to 1 or more categories
287
288
  */
288
289
  export interface TStoreCategory {
290
+ /**ID of the store category */
289
291
  id: number;
292
+ /**Name of the store category */
290
293
  name: string;
294
+ /**Order of the store category among other categories. Default value is 1 */
291
295
  order: number;
292
296
  }
293
297
  /**
@@ -332,13 +336,22 @@ export interface TStoreItem {
332
336
  purchase_ts?: number;
333
337
  /** The amount of points you can purchase an item */
334
338
  purchase_points_amount?: number;
339
+ /** Flag for store item indicating that it was purchased today */
340
+ purchased_today?: boolean;
341
+ /** Flag for store item indicating that it was purchased this week */
342
+ purchased_this_week?: boolean;
343
+ /** Flag for store item indicating that it was purchased this month */
344
+ purchased_this_month?: boolean;
335
345
  }
336
346
  /**
337
347
  * TAchCategory describes the badge category item. Each badge item can be assigned to 1 or more categories
338
348
  */
339
349
  export interface TAchCategory {
350
+ /**ID of the badge category */
340
351
  id: number;
352
+ /**Name of the badge category */
341
353
  name: string;
354
+ /**Order of the badge category among other categories. Default value is 1 */
342
355
  order: number;
343
356
  }
344
357
  /**
@@ -410,6 +423,12 @@ export interface TMissionOrBadge {
410
423
  requires_prize_claim?: boolean;
411
424
  /** The date/timestamp indicating when the prize was claimed by the user */
412
425
  prize_claimed_date_ts?: number;
426
+ /** Flag for mission/badge indicating that mission/badge completed today */
427
+ completed_today?: boolean;
428
+ /** Flag for mission/badge indicating that mission/badge completed this week */
429
+ completed_this_week?: boolean;
430
+ /** Flag for mission/badge indicating that mission/badge completed this month */
431
+ completed_this_month?: boolean;
413
432
  }
414
433
  export interface AchRelatedGame {
415
434
  /** The ID of the related game */
package/dist/index.js CHANGED
@@ -38,8 +38,6 @@ exports.ClassId = void 0;
38
38
  ClassId[ClassId["RELOAD_ACHIEVEMENTS_EVENT"] = 504] = "RELOAD_ACHIEVEMENTS_EVENT";
39
39
  ClassId[ClassId["GET_LEADERS_BOARD_REQUEST"] = 505] = "GET_LEADERS_BOARD_REQUEST";
40
40
  ClassId[ClassId["GET_LEADERS_BOARD_RESPONSE"] = 506] = "GET_LEADERS_BOARD_RESPONSE";
41
- ClassId[ClassId["GET_ACTIVITY_LOG_REQUEST"] = 507] = "GET_ACTIVITY_LOG_REQUEST";
42
- ClassId[ClassId["GET_ACTIVITY_LOG_RESPONSE"] = 508] = "GET_ACTIVITY_LOG_RESPONSE";
43
41
  ClassId[ClassId["GET_SHOP_ITEMS_REQUEST"] = 509] = "GET_SHOP_ITEMS_REQUEST";
44
42
  ClassId[ClassId["GET_SHOP_ITEMS_RESPONSE"] = 510] = "GET_SHOP_ITEMS_RESPONSE";
45
43
  ClassId[ClassId["BUY_SHOP_ITEM_REQUEST"] = 511] = "BUY_SHOP_ITEM_REQUEST";
@@ -186,6 +184,26 @@ IntUtils.JsonOrText = function (str) {
186
184
  }
187
185
  return str;
188
186
  };
187
+ IntUtils.isWithinPeriod = function (timestamp, period) {
188
+ var now = new Date();
189
+ var completedDate = new Date(timestamp * 1000);
190
+ switch (period) {
191
+ case 'today':
192
+ return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth() && now.getDate() === completedDate.getDate();
193
+ case "thisWeek":
194
+ var startOfWeek = new Date(now);
195
+ startOfWeek.setDate(now.getDate() - now.getDay());
196
+ startOfWeek.setHours(0, 0, 0, 0);
197
+ var endOfWeek = new Date(startOfWeek);
198
+ endOfWeek.setDate(startOfWeek.getDate() + 6);
199
+ endOfWeek.setHours(23, 59, 59, 999);
200
+ return completedDate >= startOfWeek && completedDate <= endOfWeek;
201
+ case "thisMonth":
202
+ return now.getFullYear() === completedDate.getFullYear() && now.getMonth() === completedDate.getMonth();
203
+ default:
204
+ return false;
205
+ }
206
+ };
189
207
 
190
208
  /** @hidden */
191
209
  exports.SAWBuyInType = void 0;
@@ -254,6 +272,7 @@ exports.SAWGameType = void 0;
254
272
  SAWGameType[SAWGameType["MatchX"] = 3] = "MatchX";
255
273
  SAWGameType[SAWGameType["GiftBox"] = 4] = "GiftBox";
256
274
  SAWGameType[SAWGameType["PrizeDrop"] = 5] = "PrizeDrop";
275
+ SAWGameType[SAWGameType["Quiz"] = 6] = "Quiz";
257
276
  })(exports.SAWGameType || (exports.SAWGameType = {}));
258
277
  exports.SAWGameTypeName = void 0;
259
278
  (function (SAWGameTypeName) {
@@ -262,12 +281,13 @@ exports.SAWGameTypeName = void 0;
262
281
  SAWGameTypeName["MatchX"] = "matchx";
263
282
  SAWGameTypeName["GiftBox"] = "giftbox";
264
283
  SAWGameTypeName["PrizeDrop"] = "prizedrop";
284
+ SAWGameTypeName["Quiz"] = "quiz";
265
285
  SAWGameTypeName["Unknown"] = "unknown";
266
286
  })(exports.SAWGameTypeName || (exports.SAWGameTypeName = {}));
267
287
  /** @hidden */
268
288
  var SAWGameTypeNamed = function SAWGameTypeNamed(type) {
269
289
  var _SAWGameType$SpinAWhe;
270
- return (_SAWGameType$SpinAWhe = {}, _SAWGameType$SpinAWhe[exports.SAWGameType.SpinAWheel] = exports.SAWGameTypeName.SpinAWheel, _SAWGameType$SpinAWhe[exports.SAWGameType.ScratchCard] = exports.SAWGameTypeName.ScratchCard, _SAWGameType$SpinAWhe[exports.SAWGameType.MatchX] = exports.SAWGameTypeName.MatchX, _SAWGameType$SpinAWhe[exports.SAWGameType.GiftBox] = exports.SAWGameTypeName.GiftBox, _SAWGameType$SpinAWhe[exports.SAWGameType.PrizeDrop] = exports.SAWGameTypeName.PrizeDrop, _SAWGameType$SpinAWhe)[type] || exports.SAWGameTypeName.Unknown;
290
+ return (_SAWGameType$SpinAWhe = {}, _SAWGameType$SpinAWhe[exports.SAWGameType.SpinAWheel] = exports.SAWGameTypeName.SpinAWheel, _SAWGameType$SpinAWhe[exports.SAWGameType.ScratchCard] = exports.SAWGameTypeName.ScratchCard, _SAWGameType$SpinAWhe[exports.SAWGameType.MatchX] = exports.SAWGameTypeName.MatchX, _SAWGameType$SpinAWhe[exports.SAWGameType.GiftBox] = exports.SAWGameTypeName.GiftBox, _SAWGameType$SpinAWhe[exports.SAWGameType.PrizeDrop] = exports.SAWGameTypeName.PrizeDrop, _SAWGameType$SpinAWhe[exports.SAWGameType.Quiz] = exports.SAWGameTypeName.Quiz, _SAWGameType$SpinAWhe)[type] || exports.SAWGameTypeName.Unknown;
271
291
  };
272
292
 
273
293
  /** @hidden */
@@ -678,6 +698,9 @@ var StoreItemPurchasedTransform = function StoreItemPurchasedTransform(items) {
678
698
  return r.id >= 1;
679
699
  }).map(function (r) {
680
700
  var _StoreItemType$Bonus$, _r$categoryIds;
701
+ var purchasedToday = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'today') : false;
702
+ var purchasedThisWeek = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisWeek') : false;
703
+ var purchasedThisMonth = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisMonth') : false;
681
704
  var x = {
682
705
  id: r.id,
683
706
  name: r.itemPublicMeta.name,
@@ -694,7 +717,10 @@ var StoreItemPurchasedTransform = function StoreItemPurchasedTransform(items) {
694
717
  category_ids: (_r$categoryIds = r.categoryIds) != null ? _r$categoryIds : [],
695
718
  pool: r.shopPool,
696
719
  purchase_ts: r.purchase_ts,
697
- purchase_points_amount: r.purchase_points_amount
720
+ purchase_points_amount: r.purchase_points_amount,
721
+ purchased_today: purchasedToday,
722
+ purchased_this_week: purchasedThisWeek,
723
+ purchased_this_month: purchasedThisMonth
698
724
  };
699
725
  return x;
700
726
  });
@@ -727,6 +753,9 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
727
753
  return r.ach_id >= 1;
728
754
  }).map(function (r) {
729
755
  var _r$ach_categories;
756
+ var completedToday = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'today') : false;
757
+ var completedThisWeek = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisWeek') : false;
758
+ var completedThisMonth = r.complete_date_ts ? IntUtils.isWithinPeriod(r.complete_date_ts, 'thisMonth') : false;
730
759
  var x = {
731
760
  id: r.ach_id,
732
761
  name: r.ach_public_meta.name,
@@ -778,7 +807,10 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
778
807
  category_ids: (_r$ach_categories = r.ach_categories) != null ? _r$ach_categories : [],
779
808
  ach_completed_id: r.ach_completed_id,
780
809
  requires_prize_claim: r.requires_prize_claim,
781
- prize_claimed_date_ts: r.prize_claimed_date_ts
810
+ prize_claimed_date_ts: r.prize_claimed_date_ts,
811
+ completed_today: completedToday,
812
+ completed_this_week: completedThisWeek,
813
+ completed_this_month: completedThisMonth
782
814
  };
783
815
  return x;
784
816
  });