@smartico/public-api 0.0.348 → 0.0.350

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.
@@ -70,6 +70,12 @@ export declare enum ClassId {
70
70
  GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE = 544,
71
71
  GET_POINT_HISTORY_REQUEST = 545,
72
72
  GET_POINT_HISTORY_RESPONSE = 546,
73
+ GET_AVATARS_LIST_REQUEST = 560,
74
+ GET_AVATARS_LIST_RESPONSE = 561,
75
+ GET_AVATARS_CUSTOMIZED_REQUEST = 562,
76
+ GET_AVATARS_CUSTOMIZED_RESPONSE = 563,
77
+ GET_AVATAR_PROMPTS_REQUEST = 564,
78
+ GET_AVATAR_PROMPTS_RESPONSE = 565,
73
79
  GET_BONUSES_REQUEST = 600,
74
80
  GET_BONUSES_RESPONSE = 601,
75
81
  CLAIM_BONUS_REQUEST = 602,
@@ -47,6 +47,7 @@ declare enum PublicLabelSettings {
47
47
  GAMIFICATION_WIDGET_BG_OPACITY = "GAMIFICATION_WIDGET_BG_OPACITY",
48
48
  GAMIFICATION_POPUP_BG_OPACITY = "GAMIFICATION_POPUP_BG_OPACITY",
49
49
  GAMIFICATION_POPUP_BG_BLUR = "GAMIFICATION_POPUP_BG_BLUR",
50
+ FRONT_DISABLE_POPUP_INBOX_ON_URLS = "FRONT_DISABLE_POPUP_INBOX_ON_URLS",
50
51
  GAMIFICATION_LEVELS_LOGIC2 = "GAMIFICATION_LEVELS_LOGIC2",
51
52
  GAMIFICATION_LEVELS_LOGIC3 = "GAMIFICATION_LEVELS_LOGIC3",
52
53
  AVATAR_CUSTOM_IMAGE_MAX_ID = "AVATAR_CUSTOM_IMAGE_MAX_ID",
@@ -184,6 +185,10 @@ declare enum ClassId {
184
185
  ACHIEVEMENT_CLAIM_PRIZE_RESPONSE = 540,
185
186
  ACH_SHOP_ITEM_HISTORY_REQUEST = 541,
186
187
  ACH_SHOP_ITEM_HISTORY_RESPONSE = 542,
188
+ GET_AVATARS_LIST_REQUEST = 560,
189
+ GET_AVATARS_LIST_RESPONSE = 561,
190
+ GET_AVATAR_PROMPTS_REQUEST = 564,
191
+ GET_AVATAR_PROMPTS_RESPONSE = 565,
187
192
  GET_BONUSES_REQUEST = 600,
188
193
  GET_BONUSES_RESPONSE = 601,
189
194
  CLAIM_BONUS_REQUEST = 602,
@@ -17,12 +17,11 @@ export declare class WSAPI {
17
17
  /** @private */
18
18
  clearCaches(): void;
19
19
  /** Returns information about current user
20
- *
20
+ * Pay attention that this method is synchronous and returns the user profile object immediately, not a promise.
21
21
  * **Example**:
22
22
  * ```
23
- * _smartico.api.getUserProfile(result => {
24
- * console.log(result);
25
- * });
23
+ * var p = _smartico.api.getUserProfile);
24
+ * console.log(p);
26
25
  * ```
27
26
  * **Visitor mode: not supported**
28
27
  * */
@@ -260,13 +260,13 @@ export interface TLevel {
260
260
  * Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
261
261
  */
262
262
  custom_data: string;
263
+ /** The ordinal position of the level */
264
+ ordinal_position: number;
263
265
  }
264
266
  /**
265
267
  * TLevelCurrent describes the information of each level defined in the system along with ordinal position and progress of the current level
266
268
  */
267
269
  export interface TLevelCurrent extends TLevel {
268
- /** The ordinal position of the level */
269
- ordinal_position: number;
270
270
  /** The progress of the user towards next level in the percents to complete */
271
271
  progress: number;
272
272
  }
package/dist/index.js CHANGED
@@ -86,6 +86,12 @@ exports.ClassId = void 0;
86
86
  ClassId[ClassId["GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE"] = 544] = "GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE";
87
87
  ClassId[ClassId["GET_POINT_HISTORY_REQUEST"] = 545] = "GET_POINT_HISTORY_REQUEST";
88
88
  ClassId[ClassId["GET_POINT_HISTORY_RESPONSE"] = 546] = "GET_POINT_HISTORY_RESPONSE";
89
+ ClassId[ClassId["GET_AVATARS_LIST_REQUEST"] = 560] = "GET_AVATARS_LIST_REQUEST";
90
+ ClassId[ClassId["GET_AVATARS_LIST_RESPONSE"] = 561] = "GET_AVATARS_LIST_RESPONSE";
91
+ ClassId[ClassId["GET_AVATARS_CUSTOMIZED_REQUEST"] = 562] = "GET_AVATARS_CUSTOMIZED_REQUEST";
92
+ ClassId[ClassId["GET_AVATARS_CUSTOMIZED_RESPONSE"] = 563] = "GET_AVATARS_CUSTOMIZED_RESPONSE";
93
+ ClassId[ClassId["GET_AVATAR_PROMPTS_REQUEST"] = 564] = "GET_AVATAR_PROMPTS_REQUEST";
94
+ ClassId[ClassId["GET_AVATAR_PROMPTS_RESPONSE"] = 565] = "GET_AVATAR_PROMPTS_RESPONSE";
89
95
  /*
90
96
  !Important, if adding new messages that are 'acting' on behalf of the client,
91
97
  you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
@@ -1925,7 +1931,8 @@ var getLeaderBoardTransform = function getLeaderBoardTransform(board) {
1925
1931
  };
1926
1932
 
1927
1933
  var GetLevelMapResponseTransform = function GetLevelMapResponseTransform(levels) {
1928
- return levels == null ? void 0 : levels.levels.map(function (l) {
1934
+ if (!(levels != null && levels.levels)) return [];
1935
+ var mapped = levels.levels.map(function (l) {
1929
1936
  var _l$level_public_meta;
1930
1937
  return {
1931
1938
  id: l.level_id,
@@ -1936,9 +1943,21 @@ var GetLevelMapResponseTransform = function GetLevelMapResponseTransform(levels)
1936
1943
  visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points) : null,
1937
1944
  required_level_counter_1: l.required_level_counter_1,
1938
1945
  required_level_counter_2: l.required_level_counter_2,
1939
- 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
1940
1948
  };
1941
1949
  });
1950
+ var ordinalById = new Map();
1951
+ [].concat(mapped).sort(function (a, b) {
1952
+ return a.required_points - b.required_points;
1953
+ }).forEach(function (l, index) {
1954
+ return ordinalById.set(l.id, index + 1);
1955
+ });
1956
+ return mapped.map(function (l) {
1957
+ return _extends({}, l, {
1958
+ ordinal_position: ordinalById.get(l.id)
1959
+ });
1960
+ });
1942
1961
  };
1943
1962
 
1944
1963
  /** @hidden */
@@ -2261,12 +2280,11 @@ var WSAPI = /*#__PURE__*/function () {
2261
2280
  OCache.clearAll();
2262
2281
  }
2263
2282
  /** Returns information about current user
2264
- *
2283
+ * Pay attention that this method is synchronous and returns the user profile object immediately, not a promise.
2265
2284
  * **Example**:
2266
2285
  * ```
2267
- * _smartico.api.getUserProfile(result => {
2268
- * console.log(result);
2269
- * });
2286
+ * var p = _smartico.api.getUserProfile);
2287
+ * console.log(p);
2270
2288
  * ```
2271
2289
  * **Visitor mode: not supported**
2272
2290
  * */;
@@ -5041,7 +5059,6 @@ var SmarticoAPI = /*#__PURE__*/function () {
5041
5059
  var userPointsEver = (_userInfo$points_ever2 = userInfo.points_ever) != null ? _userInfo$points_ever2 : 0;
5042
5060
  var progress = nextLevel ? (userPointsEver - currentLevel.required_points) / (nextLevel.required_points - currentLevel.required_points) * 100 : 100;
5043
5061
  return _extends({}, currentLevel, {
5044
- ordinal_position: currentLevelIndex + 1,
5045
5062
  progress: Math.min(Math.max(progress, 0), 100)
5046
5063
  });
5047
5064
  });