@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.
- package/dist/Core/GetAchievementsUserInfoRequest.d.ts +3 -0
- package/dist/Core/GetAchievementsUserInfoResponse.d.ts +5 -0
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPI.d.ts +3 -1
- package/dist/WSAPI/WSAPITypes.d.ts +8 -0
- package/dist/index.js +162 -128
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -0
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +12 -0
- package/docs/interfaces/TMissionOrBadge.md +8 -0
- package/docs/interfaces/UserLevelExtraCountersT.md +17 -0
- package/package.json +1 -1
- package/src/Core/GetAchievementsUserInfoRequest.ts +5 -0
- package/src/Core/GetAchievementsUserInfoResponse.ts +6 -0
- package/src/Missions/UserAchievement.ts +1 -0
- package/src/SmarticoAPI.ts +17 -1
- package/src/WSAPI/WSAPI.ts +7 -1
- package/src/WSAPI/WSAPITypes.ts +10 -0
package/docs/README.md
CHANGED
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
- [LeaderBoardDetailsT](interfaces/LeaderBoardDetailsT.md)
|
|
36
36
|
- [LeaderBoardsRewardsT](interfaces/LeaderBoardsRewardsT.md)
|
|
37
37
|
- [LeaderBoardUserT](interfaces/LeaderBoardUserT.md)
|
|
38
|
+
- [UserLevelExtraCountersT](interfaces/UserLevelExtraCountersT.md)
|
|
38
39
|
|
|
39
40
|
## General API
|
|
40
41
|
|
package/docs/classes/WSAPI.md
CHANGED
|
@@ -55,6 +55,18 @@ Returns all the badges available the current user
|
|
|
55
55
|
|
|
56
56
|
___
|
|
57
57
|
|
|
58
|
+
### getUserLevelExtraCounters
|
|
59
|
+
|
|
60
|
+
▸ **getUserLevelExtraCounters**(): `Promise`<[`UserLevelExtraCountersT`](../interfaces/UserLevelExtraCountersT.md)\>
|
|
61
|
+
|
|
62
|
+
Returns the extra counters for the current user level
|
|
63
|
+
|
|
64
|
+
#### Returns
|
|
65
|
+
|
|
66
|
+
`Promise`<[`UserLevelExtraCountersT`](../interfaces/UserLevelExtraCountersT.md)\>
|
|
67
|
+
|
|
68
|
+
___
|
|
69
|
+
|
|
58
70
|
### getStoreItems
|
|
59
71
|
|
|
60
72
|
▸ **getStoreItems**(): `Promise`<[`TStoreItem`](../interfaces/TStoreItem.md)[]\>
|
|
@@ -189,3 +189,11 @@ ___
|
|
|
189
189
|
• `Optional` **hint\_text**: `string`
|
|
190
190
|
|
|
191
191
|
The T&C text for the missions
|
|
192
|
+
|
|
193
|
+
___
|
|
194
|
+
|
|
195
|
+
### position
|
|
196
|
+
|
|
197
|
+
• `Optional` **position**: `number`
|
|
198
|
+
|
|
199
|
+
Priority (or position) of the mission in the UI. Low value indicates higher position in the UI
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Interface: UserLevelExtraCountersT
|
|
2
|
+
|
|
3
|
+
## Properties
|
|
4
|
+
|
|
5
|
+
### level\_counter\_1
|
|
6
|
+
|
|
7
|
+
• `Optional` **level\_counter\_1**: `number`
|
|
8
|
+
|
|
9
|
+
The counter of 1st metric used to reach the level.
|
|
10
|
+
|
|
11
|
+
___
|
|
12
|
+
|
|
13
|
+
### level\_counter\_2
|
|
14
|
+
|
|
15
|
+
• `Optional` **level\_counter\_2**: `number`
|
|
16
|
+
|
|
17
|
+
The counter of 2nd metric used to reach the level.
|
package/package.json
CHANGED
|
@@ -59,6 +59,7 @@ export const UserAchievementTransform = (items: UserAchievement[]): TMissionOrBa
|
|
|
59
59
|
custom_section_id: r.ach_public_meta.custom_section_id,
|
|
60
60
|
only_in_custom_section: r.ach_public_meta.only_in_custom_section,
|
|
61
61
|
custom_data: IntUtils.JsonOrText(r.ach_public_meta.custom_data),
|
|
62
|
+
position: r.ach_public_meta.position,
|
|
62
63
|
tasks: (r.achievementTasks || [])
|
|
63
64
|
.filter( t => t.task_type_id === AchievementTaskType.CompleteAchievement)
|
|
64
65
|
.map( t => ({
|
package/src/SmarticoAPI.ts
CHANGED
|
@@ -17,8 +17,9 @@ import { GetTournamentInfoRequest, GetTournamentInfoResponse, GetTournamentsRequ
|
|
|
17
17
|
import { GetLeaderBoardsRequest, GetLeaderBoardsResponse, LeaderBoardDetails, LeaderBoardPeriodType } from "./Leaderboard";
|
|
18
18
|
import { GetLevelMapResponse, GetLevelMapResponseTransform } from "./Level";
|
|
19
19
|
import { WSAPI } from "./WSAPI/WSAPI";
|
|
20
|
-
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT } from "./WSAPI/WSAPITypes";
|
|
20
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT } from "./WSAPI/WSAPITypes";
|
|
21
21
|
import { getLeaderBoardTransform } from "./Leaderboard/LeaderBoards";
|
|
22
|
+
import { GetAchievementsUserInfoResponse } from "./Core/GetAchievementsUserInfoResponse";
|
|
22
23
|
|
|
23
24
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
24
25
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -428,6 +429,21 @@ class SmarticoAPI {
|
|
|
428
429
|
return UserAchievementTransform((await this.missionsGetItems(user_ext_id)).achievements);
|
|
429
430
|
}
|
|
430
431
|
|
|
432
|
+
public async getUserGamificationInfo(user_ext_id: string): Promise<GetAchievementsUserInfoResponse> {
|
|
433
|
+
const message = this.buildMessage<GetAchievementMapRequest, GetAchievementsUserInfoResponse>(user_ext_id, ClassId.GET_ACHIEVEMENT_USER_REQUEST);
|
|
434
|
+
|
|
435
|
+
return await this.send<GetAchievementsUserInfoResponse>(message, ClassId.GET_ACHIEVEMENT_USER_RESPONSE);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
public async getUserGamificationInfoT(user_ext_id: string): Promise<UserLevelExtraCountersT> {
|
|
439
|
+
const response = await this.getUserGamificationInfo(user_ext_id);
|
|
440
|
+
|
|
441
|
+
return {
|
|
442
|
+
level_counter_1: response.level_counter_1,
|
|
443
|
+
level_counter_2: response.level_counter_2,
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
431
447
|
public async achGetCategories(user_ext_id: string): Promise<GetAchCategoriesResponse> {
|
|
432
448
|
|
|
433
449
|
const message = this.buildMessage<any, GetAchCategoriesResponse>(user_ext_id, ClassId.GET_ACH_CATEGORIES_REQUEST);
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { CoreUtils } from "../Core";
|
|
|
3
3
|
import { MiniGamePrizeTypeName, SAWDoSpinResponse, SAWSpinErrorCode, SAWSpinsCountPush } from "../MiniGames";
|
|
4
4
|
import { ECacheContext, OCache } from "../OCache";
|
|
5
5
|
import { SmarticoAPI } from "../SmarticoAPI";
|
|
6
|
-
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile } from "./WSAPITypes";
|
|
6
|
+
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionOptInResult, TMissionOrBadge, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
7
7
|
import { LeaderBoardPeriodType } from "src/Leaderboard";
|
|
8
8
|
|
|
9
9
|
/** @hidden */
|
|
@@ -20,6 +20,7 @@ enum onUpdateContextKey {
|
|
|
20
20
|
StoreCategories = 'storeCategories',
|
|
21
21
|
AchCategories = 'achCategories',
|
|
22
22
|
LeaderBoards = 'leaderBoards',
|
|
23
|
+
LevelExtraCounters = 'levelExtraCounters',
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
|
|
@@ -76,6 +77,11 @@ export class WSAPI {
|
|
|
76
77
|
return OCache.use(onUpdateContextKey.Badges, ECacheContext.WSAPI, () => this.api.badgetsGetItemsT(null), CACHE_DATA_SEC);
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
/** Returns the extra counters for the current user level */
|
|
81
|
+
public async getUserLevelExtraCounters(): Promise<UserLevelExtraCountersT> {
|
|
82
|
+
return OCache.use(onUpdateContextKey.LevelExtraCounters, ECacheContext.WSAPI, () => this.api.getUserGamificationInfoT(null), CACHE_DATA_SEC);
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
/** Returns all the store items available the current user */
|
|
80
86
|
public async getStoreItems(): Promise<TStoreItem[]> {
|
|
81
87
|
return OCache.use(onUpdateContextKey.StoreItems, ECacheContext.WSAPI, () => this.api.storeGetItemsT(null), CACHE_DATA_SEC);
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -449,6 +449,9 @@ export interface TMissionOrBadge {
|
|
|
449
449
|
|
|
450
450
|
/** The T&C text for the missions */
|
|
451
451
|
hint_text?: string;
|
|
452
|
+
|
|
453
|
+
/** Priority (or position) of the mission in the UI. Low value indicates higher position in the UI */
|
|
454
|
+
position?: number;
|
|
452
455
|
}
|
|
453
456
|
|
|
454
457
|
export interface AchRelatedGame {
|
|
@@ -593,3 +596,10 @@ export interface LeaderBoardUserT {
|
|
|
593
596
|
is_me: boolean;
|
|
594
597
|
}
|
|
595
598
|
|
|
599
|
+
export interface UserLevelExtraCountersT {
|
|
600
|
+
/** The counter of 1st metric used to reach the level. */
|
|
601
|
+
level_counter_1?: number,
|
|
602
|
+
/** The counter of 2nd metric used to reach the level. */
|
|
603
|
+
level_counter_2?: number,
|
|
604
|
+
}
|
|
605
|
+
|