@smartico/public-api 0.0.115 → 0.0.117

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.
@@ -637,6 +637,7 @@ const UserAchievementTransform = items => {
637
637
  custom_section_id: r.ach_public_meta.custom_section_id,
638
638
  only_in_custom_section: r.ach_public_meta.only_in_custom_section,
639
639
  custom_data: IntUtils.JsonOrText(r.ach_public_meta.custom_data),
640
+ position: r.ach_public_meta.position,
640
641
  tasks: (r.achievementTasks || []).filter(t => t.task_type_id === AchievementTaskType.CompleteAchievement).map(t => {
641
642
  var _t$task_public_meta;
642
643
  return {
@@ -963,6 +964,7 @@ var onUpdateContextKey;
963
964
  onUpdateContextKey["StoreCategories"] = "storeCategories";
964
965
  onUpdateContextKey["AchCategories"] = "achCategories";
965
966
  onUpdateContextKey["LeaderBoards"] = "leaderBoards";
967
+ onUpdateContextKey["LevelExtraCounters"] = "levelExtraCounters";
966
968
  })(onUpdateContextKey || (onUpdateContextKey = {}));
967
969
  /** @group General API */
968
970
  class WSAPI {
@@ -1013,6 +1015,10 @@ class WSAPI {
1013
1015
  async getBadges() {
1014
1016
  return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(null), CACHE_DATA_SEC);
1015
1017
  }
1018
+ /** Returns the extra counters for the current user level */
1019
+ async getUserLevelExtraCounters() {
1020
+ return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(null), CACHE_DATA_SEC);
1021
+ }
1016
1022
  /** Returns all the store items available the current user */
1017
1023
  async getStoreItems() {
1018
1024
  return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(null), CACHE_DATA_SEC);
@@ -1575,6 +1581,17 @@ class SmarticoAPI {
1575
1581
  async missionsGetItemsT(user_ext_id) {
1576
1582
  return UserAchievementTransform((await this.missionsGetItems(user_ext_id)).achievements);
1577
1583
  }
1584
+ async getUserGamificationInfo(user_ext_id) {
1585
+ const message = this.buildMessage(user_ext_id, ClassId.GET_ACHIEVEMENT_USER_REQUEST);
1586
+ return await this.send(message, ClassId.GET_ACHIEVEMENT_USER_RESPONSE);
1587
+ }
1588
+ async getUserGamificationInfoT(user_ext_id) {
1589
+ const response = await this.getUserGamificationInfo(user_ext_id);
1590
+ return {
1591
+ level_counter_1: response.level_counter_1,
1592
+ level_counter_2: response.level_counter_2
1593
+ };
1594
+ }
1578
1595
  async achGetCategories(user_ext_id) {
1579
1596
  const message = this.buildMessage(user_ext_id, ClassId.GET_ACH_CATEGORIES_REQUEST);
1580
1597
  return await this.send(message, ClassId.GET_ACH_CATEGORIES_RESPONSE);