@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.
- package/dist/Base/ClassId.d.ts +6 -0
- package/dist/SmarticoLib/index.d.ts +5 -0
- package/dist/WSAPI/WSAPI.d.ts +3 -4
- package/dist/WSAPI/WSAPITypes.d.ts +2 -2
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +18 -7
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPI.md +3 -4
- package/docs/api/interfaces/TLevel.md +8 -0
- package/docs/api/interfaces/TLevelCurrent.md +4 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +7 -0
- package/src/Level/GetLevelMapResponse.ts +11 -1
- package/src/SmarticoAPI.ts +0 -1
- package/src/SmarticoLib/index.ts +5 -0
- package/src/WSAPI/WSAPI.ts +3 -4
- package/src/WSAPI/WSAPITypes.ts +2 -2
package/dist/index.modern.mjs
CHANGED
|
@@ -86,6 +86,12 @@ var ClassId;
|
|
|
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
|
|
@@ -1931,7 +1937,8 @@ const getLeaderBoardTransform = board => {
|
|
|
1931
1937
|
};
|
|
1932
1938
|
|
|
1933
1939
|
const GetLevelMapResponseTransform = levels => {
|
|
1934
|
-
|
|
1940
|
+
if (!(levels != null && levels.levels)) return [];
|
|
1941
|
+
const mapped = levels.levels.map(l => {
|
|
1935
1942
|
var _l$level_public_meta;
|
|
1936
1943
|
return {
|
|
1937
1944
|
id: l.level_id,
|
|
@@ -1942,9 +1949,15 @@ const GetLevelMapResponseTransform = levels => {
|
|
|
1942
1949
|
visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points) : null,
|
|
1943
1950
|
required_level_counter_1: l.required_level_counter_1,
|
|
1944
1951
|
required_level_counter_2: l.required_level_counter_2,
|
|
1945
|
-
custom_data: IntUtils.JsonOrText((_l$level_public_meta = l.level_public_meta) == null ? void 0 : _l$level_public_meta.custom_data)
|
|
1952
|
+
custom_data: IntUtils.JsonOrText((_l$level_public_meta = l.level_public_meta) == null ? void 0 : _l$level_public_meta.custom_data),
|
|
1953
|
+
ordinal_position: 0
|
|
1946
1954
|
};
|
|
1947
1955
|
});
|
|
1956
|
+
const ordinalById = new Map();
|
|
1957
|
+
[...mapped].sort((a, b) => a.required_points - b.required_points).forEach((l, index) => ordinalById.set(l.id, index + 1));
|
|
1958
|
+
return mapped.map(l => _extends({}, l, {
|
|
1959
|
+
ordinal_position: ordinalById.get(l.id)
|
|
1960
|
+
}));
|
|
1948
1961
|
};
|
|
1949
1962
|
|
|
1950
1963
|
/** @hidden */
|
|
@@ -2235,12 +2248,11 @@ class WSAPI {
|
|
|
2235
2248
|
OCache.clearAll();
|
|
2236
2249
|
}
|
|
2237
2250
|
/** Returns information about current user
|
|
2238
|
-
*
|
|
2251
|
+
* Pay attention that this method is synchronous and returns the user profile object immediately, not a promise.
|
|
2239
2252
|
* **Example**:
|
|
2240
2253
|
* ```
|
|
2241
|
-
* _smartico.api.getUserProfile
|
|
2242
|
-
*
|
|
2243
|
-
* });
|
|
2254
|
+
* var p = _smartico.api.getUserProfile);
|
|
2255
|
+
* console.log(p);
|
|
2244
2256
|
* ```
|
|
2245
2257
|
* **Visitor mode: not supported**
|
|
2246
2258
|
* */
|
|
@@ -4182,7 +4194,6 @@ class SmarticoAPI {
|
|
|
4182
4194
|
const userPointsEver = (_userInfo$points_ever2 = userInfo.points_ever) != null ? _userInfo$points_ever2 : 0;
|
|
4183
4195
|
const progress = nextLevel ? (userPointsEver - currentLevel.required_points) / (nextLevel.required_points - currentLevel.required_points) * 100 : 100;
|
|
4184
4196
|
return _extends({}, currentLevel, {
|
|
4185
|
-
ordinal_position: currentLevelIndex + 1,
|
|
4186
4197
|
progress: Math.min(Math.max(progress, 0), 100)
|
|
4187
4198
|
});
|
|
4188
4199
|
}
|