@smartico/public-api 0.0.347 → 0.0.349

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.
@@ -144,6 +144,10 @@ var ClassId;
144
144
  RAF_GET_TICKETS_RESPONSE = 903,
145
145
  RAF_CLAIM_PRIZE_REQUEST = 906,
146
146
  */
147
+ ClassId[ClassId["BNR_GET_BANNER_PLACEMENTS_REQUEST"] = 950] = "BNR_GET_BANNER_PLACEMENTS_REQUEST";
148
+ ClassId[ClassId["BNR_GET_BANNER_PLACEMENTS_RESPONSE"] = 951] = "BNR_GET_BANNER_PLACEMENTS_RESPONSE";
149
+ ClassId[ClassId["BNR_GET_BANNER_CONTENT_REQUEST"] = 952] = "BNR_GET_BANNER_CONTENT_REQUEST";
150
+ ClassId[ClassId["BNR_GET_BANNER_CONTENT_RESPONSE"] = 953] = "BNR_GET_BANNER_CONTENT_RESPONSE";
147
151
  /*
148
152
  !Important, if adding new messages that are 'acting' on behalf of the client,
149
153
  you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
@@ -1927,7 +1931,8 @@ const getLeaderBoardTransform = board => {
1927
1931
  };
1928
1932
 
1929
1933
  const GetLevelMapResponseTransform = levels => {
1930
- return levels == null ? void 0 : levels.levels.map(l => {
1934
+ if (!(levels != null && levels.levels)) return [];
1935
+ const mapped = levels.levels.map(l => {
1931
1936
  var _l$level_public_meta;
1932
1937
  return {
1933
1938
  id: l.level_id,
@@ -1938,9 +1943,15 @@ const GetLevelMapResponseTransform = levels => {
1938
1943
  visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points) : null,
1939
1944
  required_level_counter_1: l.required_level_counter_1,
1940
1945
  required_level_counter_2: l.required_level_counter_2,
1941
- custom_data: IntUtils.JsonOrText((_l$level_public_meta = l.level_public_meta) == null ? void 0 : _l$level_public_meta.custom_data)
1946
+ custom_data: IntUtils.JsonOrText((_l$level_public_meta = l.level_public_meta) == null ? void 0 : _l$level_public_meta.custom_data),
1947
+ ordinal_position: 0
1942
1948
  };
1943
1949
  });
1950
+ const ordinalById = new Map();
1951
+ [...mapped].sort((a, b) => a.required_points - b.required_points).forEach((l, index) => ordinalById.set(l.id, index + 1));
1952
+ return mapped.map(l => _extends({}, l, {
1953
+ ordinal_position: ordinalById.get(l.id)
1954
+ }));
1944
1955
  };
1945
1956
 
1946
1957
  /** @hidden */
@@ -2312,7 +2323,7 @@ class WSAPI {
2312
2323
  async getCurrentLevel() {
2313
2324
  return OCache.use(onUpdateContextKey.CurrentLevel, ECacheContext.WSAPI, () => this.api.getLevelCurrent(null), CACHE_DATA_SEC);
2314
2325
  }
2315
- /** Returns all the missions available the current user.
2326
+ /** Returns all the missions configured for the current user (server-side scoped, not filtered by Widget visibility).
2316
2327
  * The returned missions are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
2317
2328
  * Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
2318
2329
  * The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it.
@@ -2537,7 +2548,7 @@ class WSAPI {
2537
2548
  return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.customSectionsGetT(null), CACHE_DATA_SEC);
2538
2549
  }
2539
2550
  /**
2540
- * Returns the list of mini-games available for user
2551
+ * Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
2541
2552
  * 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 getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
2542
2553
  * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
2543
2554
  *
@@ -4178,7 +4189,6 @@ class SmarticoAPI {
4178
4189
  const userPointsEver = (_userInfo$points_ever2 = userInfo.points_ever) != null ? _userInfo$points_ever2 : 0;
4179
4190
  const progress = nextLevel ? (userPointsEver - currentLevel.required_points) / (nextLevel.required_points - currentLevel.required_points) * 100 : 100;
4180
4191
  return _extends({}, currentLevel, {
4181
- ordinal_position: currentLevelIndex + 1,
4182
4192
  progress: Math.min(Math.max(progress, 0), 100)
4183
4193
  });
4184
4194
  }