@smartico/public-api 0.0.173 → 0.0.175

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.
@@ -108,6 +108,8 @@ var ClassId;
108
108
  ClassId[ClassId["SAW_DO_SPIN_BATCH_RESPONSE"] = 713] = "SAW_DO_SPIN_BATCH_RESPONSE";
109
109
  ClassId[ClassId["SAW_AKNOWLEDGE_BATCH_REQUEST"] = 714] = "SAW_AKNOWLEDGE_BATCH_REQUEST";
110
110
  ClassId[ClassId["SAW_AKNOWLEDGE_BATCH_RESPONSE"] = 715] = "SAW_AKNOWLEDGE_BATCH_RESPONSE";
111
+ ClassId[ClassId["GET_SAW_HISTORY_REQUEST"] = 716] = "GET_SAW_HISTORY_REQUEST";
112
+ ClassId[ClassId["GET_SAW_HISTORY_RESPONSE"] = 717] = "GET_SAW_HISTORY_RESPONSE";
111
113
  /*
112
114
  !Important, if adding new messages that are 'acting' on behalf of the client,
113
115
  you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
@@ -378,7 +380,10 @@ const SAWTemplatesTransform = items => {
378
380
  acknowledge_action_title: p.saw_prize_ui_definition.acknowledge_action_title,
379
381
  pool: p.pool,
380
382
  pool_initial: p.pool_initial,
381
- wins_count: p.wins_count
383
+ wins_count: p.wins_count,
384
+ weekdays: p.weekdays,
385
+ active_from_ts: p.active_from_ts,
386
+ active_till_ts: p.active_till_ts
382
387
  };
383
388
  return y;
384
389
  })
@@ -421,6 +426,20 @@ const SAWWinSoundFiles = {
421
426
  [SAWWinSoundType.HighlyPositive]: 'saw-highly-positive.m4a'
422
427
  };
423
428
 
429
+ const SAWHistoryTransform = items => {
430
+ return items.map(r => {
431
+ const x = {
432
+ template: r.template,
433
+ saw_template_id: r.saw_template_id,
434
+ saw_prize_id: r.saw_prize_id,
435
+ prize_amount: r.prize_amount,
436
+ client_request_id: r.client_request_id,
437
+ is_claimed: r.is_claimed
438
+ };
439
+ return x;
440
+ });
441
+ };
442
+
424
443
  class NodeCache {
425
444
  constructor() {
426
445
  if (NodeCache.ttlChecker === undefined) {
@@ -1193,6 +1212,7 @@ class WSAPI {
1193
1212
  on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
1194
1213
  on(ClassId.JP_WIN_PUSH, data => this.jackpotClearCache());
1195
1214
  on(ClassId.JP_OPTOUT_RESPONSE, data => this.jackpotClearCache());
1215
+ on(ClassId.JP_OPTIN_RESPONSE, data => this.jackpotClearCache());
1196
1216
  on(ClassId.CLAIM_BONUS_RESPONSE, () => this.updateBonuses());
1197
1217
  on(ClassId.SAW_DO_SPIN_BATCH_RESPONSE, () => this.updateOnAddSpin());
1198
1218
  }
@@ -1503,6 +1523,33 @@ class WSAPI {
1503
1523
  }
1504
1524
  return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
1505
1525
  }
1526
+ /**
1527
+ * Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
1528
+ * The maximum number of items per request is limited to 20.
1529
+ * You can leave this params empty and by default it will return list of mini-games ranging from 0 to 20.
1530
+ * The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGamesHistory with a new onUpdate callback, the old one will be overwritten by the new one.
1531
+ * Updated templates will be passed to onUpdate callback.
1532
+ *
1533
+ * **Example**:
1534
+ * ```
1535
+ * _smartico.api.getMiniGamesHistory().then((result) => {
1536
+ * console.log(result);
1537
+ * });
1538
+ * ```
1539
+ *
1540
+ * **Visitor mode: not supported**
1541
+ */
1542
+ async getMiniGamesHistory({
1543
+ limit,
1544
+ offset,
1545
+ saw_template_id,
1546
+ onUpdate
1547
+ }) {
1548
+ if (onUpdate) {
1549
+ this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
1550
+ }
1551
+ return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.getSawWinningHistoryT(null, limit, offset, saw_template_id), CACHE_DATA_SEC);
1552
+ }
1506
1553
  /**
1507
1554
  * Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
1508
1555
  * After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
@@ -2361,6 +2408,17 @@ class SmarticoAPI {
2361
2408
  });
2362
2409
  return _extends({}, spinAttemptResponse);
2363
2410
  }
2411
+ async getSawWinningHistory(user_ext_id, limit = 20, offset = 0, saw_template_id) {
2412
+ const message = this.buildMessage(user_ext_id, ClassId.GET_SAW_HISTORY_REQUEST, {
2413
+ limit,
2414
+ offset,
2415
+ saw_template_id
2416
+ });
2417
+ return await this.send(message, ClassId.GET_SAW_HISTORY_RESPONSE);
2418
+ }
2419
+ async getSawWinningHistoryT(user_ext_id, limit, offset, saw_template_id) {
2420
+ return SAWHistoryTransform((await this.getSawWinningHistory(user_ext_id, limit, offset, saw_template_id)).prizes);
2421
+ }
2364
2422
  async missionOptIn(user_ext_id, mission_id) {
2365
2423
  if (!mission_id) {
2366
2424
  throw new Error('Missing mission id');
@@ -3047,7 +3105,8 @@ var JackPotTemparature;
3047
3105
  var JackpotType;
3048
3106
  (function (JackpotType) {
3049
3107
  JackpotType[JackpotType["Main"] = 1] = "Main";
3108
+ JackpotType[JackpotType["Personal"] = 2] = "Personal";
3050
3109
  })(JackpotType || (JackpotType = {}));
3051
3110
 
3052
- export { AchCategoryTransform, AchievementStatus, AchievementTaskType, AchievementType, ActivityTypeLimited, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetLevelMapResponseTransform, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, JackpotContributionType, JackpotType, LeaderBoardPeriodType, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, OCache, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, SAWAcknowledgeType, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWGPMarketType, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWinSoundFiles, SAWWinSoundType, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UserAchievementTransform, marketsInfo, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, tournamentInfoItemTransform };
3111
+ export { AchCategoryTransform, AchievementStatus, AchievementTaskType, AchievementType, ActivityTypeLimited, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetLevelMapResponseTransform, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, JackpotContributionType, JackpotType, LeaderBoardPeriodType, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, OCache, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, SAWAcknowledgeType, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWGPMarketType, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWinSoundFiles, SAWWinSoundType, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UserAchievementTransform, marketsInfo, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, tournamentInfoItemTransform };
3053
3112
  //# sourceMappingURL=index.modern.mjs.map