@smartico/public-api 0.0.173 → 0.0.174

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) {
@@ -1503,6 +1522,33 @@ class WSAPI {
1503
1522
  }
1504
1523
  return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(null), CACHE_DATA_SEC);
1505
1524
  }
1525
+ /**
1526
+ * Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
1527
+ * The maximum number of items per request is limited to 20.
1528
+ * You can leave this params empty and by default it will return list of mini-games ranging from 0 to 20.
1529
+ * 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.
1530
+ * Updated templates will be passed to onUpdate callback.
1531
+ *
1532
+ * **Example**:
1533
+ * ```
1534
+ * _smartico.api.getMiniGamesHistory().then((result) => {
1535
+ * console.log(result);
1536
+ * });
1537
+ * ```
1538
+ *
1539
+ * **Visitor mode: not supported**
1540
+ */
1541
+ async getMiniGamesHistory({
1542
+ limit,
1543
+ offset,
1544
+ saw_template_id,
1545
+ onUpdate
1546
+ }) {
1547
+ if (onUpdate) {
1548
+ this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
1549
+ }
1550
+ return OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.getSawWinningHistoryT(null, limit, offset, saw_template_id), CACHE_DATA_SEC);
1551
+ }
1506
1552
  /**
1507
1553
  * Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
1508
1554
  * 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.
@@ -1929,8 +1975,8 @@ class WSAPI {
1929
1975
  * });
1930
1976
  * ```
1931
1977
  */
1932
- async getRelatedItemsForGame(related_game_id) {
1933
- const result = await this.api.getRelatedItemsForGame(null, related_game_id);
1978
+ async getRelatedItemsForGame(related_game_id, force_language) {
1979
+ const result = await this.api.getRelatedItemsForGame(null, related_game_id, force_language);
1934
1980
  return result;
1935
1981
  }
1936
1982
  }
@@ -2361,6 +2407,17 @@ class SmarticoAPI {
2361
2407
  });
2362
2408
  return _extends({}, spinAttemptResponse);
2363
2409
  }
2410
+ async getSawWinningHistory(user_ext_id, limit = 20, offset = 0, saw_template_id) {
2411
+ const message = this.buildMessage(user_ext_id, ClassId.GET_SAW_HISTORY_REQUEST, {
2412
+ limit,
2413
+ offset,
2414
+ saw_template_id
2415
+ });
2416
+ return await this.send(message, ClassId.GET_SAW_HISTORY_RESPONSE);
2417
+ }
2418
+ async getSawWinningHistoryT(user_ext_id, limit, offset, saw_template_id) {
2419
+ return SAWHistoryTransform((await this.getSawWinningHistory(user_ext_id, limit, offset, saw_template_id)).prizes);
2420
+ }
2364
2421
  async missionOptIn(user_ext_id, mission_id) {
2365
2422
  if (!mission_id) {
2366
2423
  throw new Error('Missing mission id');
@@ -2640,11 +2697,11 @@ class SmarticoAPI {
2640
2697
  getWSCalls() {
2641
2698
  return new WSAPI(this);
2642
2699
  }
2643
- async getRelatedItemsForGame(user_ext_id, related_game_id) {
2700
+ async getRelatedItemsForGame(user_ext_id, related_game_id, force_language) {
2644
2701
  const message = this.buildMessage(user_ext_id, ClassId.GET_RELATED_ACH_N_TOURNAMENTS_REQUEST, {
2645
2702
  related_game_id: related_game_id
2646
2703
  });
2647
- return await this.send(message, ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE);
2704
+ return await this.send(message, ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE, force_language);
2648
2705
  }
2649
2706
  }
2650
2707
 
@@ -3049,5 +3106,5 @@ var JackpotType;
3049
3106
  JackpotType[JackpotType["Main"] = 1] = "Main";
3050
3107
  })(JackpotType || (JackpotType = {}));
3051
3108
 
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 };
3109
+ 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
3110
  //# sourceMappingURL=index.modern.mjs.map