@smartico/public-api 0.0.348 → 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.
- package/dist/SmarticoLib/index.d.ts +1 -0
- package/dist/WSAPI/WSAPITypes.d.ts +2 -2
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +9 -3
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/interfaces/TLevel.md +8 -0
- package/docs/api/interfaces/TLevelCurrent.md +4 -0
- package/package.json +1 -1
- package/src/Level/GetLevelMapResponse.ts +11 -1
- package/src/SmarticoAPI.ts +0 -1
- package/src/SmarticoLib/index.ts +1 -0
- package/src/WSAPI/WSAPITypes.ts +2 -2
package/dist/index.modern.mjs
CHANGED
|
@@ -1931,7 +1931,8 @@ const getLeaderBoardTransform = board => {
|
|
|
1931
1931
|
};
|
|
1932
1932
|
|
|
1933
1933
|
const GetLevelMapResponseTransform = levels => {
|
|
1934
|
-
|
|
1934
|
+
if (!(levels != null && levels.levels)) return [];
|
|
1935
|
+
const mapped = levels.levels.map(l => {
|
|
1935
1936
|
var _l$level_public_meta;
|
|
1936
1937
|
return {
|
|
1937
1938
|
id: l.level_id,
|
|
@@ -1942,9 +1943,15 @@ const GetLevelMapResponseTransform = levels => {
|
|
|
1942
1943
|
visibility_points: l.level_public_meta.visibility_points ? parseInt(l.level_public_meta.visibility_points) : null,
|
|
1943
1944
|
required_level_counter_1: l.required_level_counter_1,
|
|
1944
1945
|
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)
|
|
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
|
|
1946
1948
|
};
|
|
1947
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
|
+
}));
|
|
1948
1955
|
};
|
|
1949
1956
|
|
|
1950
1957
|
/** @hidden */
|
|
@@ -4182,7 +4189,6 @@ class SmarticoAPI {
|
|
|
4182
4189
|
const userPointsEver = (_userInfo$points_ever2 = userInfo.points_ever) != null ? _userInfo$points_ever2 : 0;
|
|
4183
4190
|
const progress = nextLevel ? (userPointsEver - currentLevel.required_points) / (nextLevel.required_points - currentLevel.required_points) * 100 : 100;
|
|
4184
4191
|
return _extends({}, currentLevel, {
|
|
4185
|
-
ordinal_position: currentLevelIndex + 1,
|
|
4186
4192
|
progress: Math.min(Math.max(progress, 0), 100)
|
|
4187
4193
|
});
|
|
4188
4194
|
}
|