@smartico/public-api 0.0.142 → 0.0.144
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/README.md +14 -1
- package/dist/CustomSections/AchCustomSection.d.ts +27 -0
- package/dist/CustomSections/GetCustomSectionsRequest.d.ts +3 -0
- package/dist/CustomSections/GetCustomSectionsResponse.d.ts +7 -0
- package/dist/CustomSections/UICustomSection.d.ts +15 -0
- package/dist/CustomSections/index.d.ts +4 -0
- package/dist/Missions/AchievementPublicMeta.d.ts +1 -0
- package/dist/Missions/UserAchievement.d.ts +1 -0
- package/dist/Quiz/MarketsAnswers.d.ts +38 -0
- package/dist/Quiz/MarketsInfo.d.ts +4 -12
- package/dist/Quiz/MarketsPerSport.d.ts +4 -4
- package/dist/Quiz/MarketsType.d.ts +1 -1
- package/dist/Quiz/index.d.ts +1 -1
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPI.d.ts +22 -1
- package/dist/WSAPI/WSAPITypes.d.ts +25 -0
- package/dist/index.js +310 -203
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +199 -109
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +1 -0
- package/docs/classes/WSAPI.md +28 -0
- package/docs/interfaces/TMissionOrBadge.md +8 -0
- package/docs/interfaces/TUICustomSection.md +81 -0
- package/package.json +1 -1
- package/src/Core/CoreUtils.ts +2 -2
- package/src/CustomSections/AchCustomSection.ts +30 -0
- package/src/CustomSections/GetCustomSectionsRequest.ts +5 -0
- package/src/CustomSections/GetCustomSectionsResponse.ts +7 -0
- package/src/CustomSections/UICustomSection.ts +34 -0
- package/src/CustomSections/index.ts +4 -0
- package/src/Missions/AchievementPublicMeta.ts +1 -0
- package/src/Missions/UserAchievement.ts +3 -1
- package/src/Quiz/MarketsAnswers.ts +40 -0
- package/src/Quiz/MarketsInfo.ts +50 -59
- package/src/Quiz/MarketsPerSport.ts +29 -29
- package/src/Quiz/MarketsType.ts +1 -1
- package/src/Quiz/index.ts +1 -1
- package/src/SmarticoAPI.ts +12 -2
- package/src/WSAPI/WSAPI.ts +26 -1
- package/src/WSAPI/WSAPITypes.ts +27 -0
- package/src/Quiz/MarketsAnswersType.ts +0 -22
package/src/SmarticoAPI.ts
CHANGED
|
@@ -17,12 +17,13 @@ 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, UserLevelExtraCountersT, TSegmentCheckResult } from "./WSAPI/WSAPITypes";
|
|
20
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection } from "./WSAPI/WSAPITypes";
|
|
21
21
|
import { getLeaderBoardTransform } from "./Leaderboard/LeaderBoards";
|
|
22
22
|
import { GetAchievementsUserInfoResponse } from "./Core/GetAchievementsUserInfoResponse";
|
|
23
23
|
import { CheckSegmentMatchResponse } from "./Core/CheckSegmentMatchResponse";
|
|
24
24
|
import { CheckSegmentMatchRequest } from "./Core/CheckSegmentMatchRequest";
|
|
25
25
|
import { GetJackpotsPotsRequest, GetJackpotsPotsResponse, GetJackpotsRequest, GetJackpotsResponse, JackpotDetails, JackpotPot, JackpotsOptinRequest, JackpotsOptinResponse, JackpotsOptoutRequest, JackpotsOptoutResponse } from "./Jackpots";
|
|
26
|
+
import { GetCustomSectionsRequest, GetCustomSectionsResponse, UICustomSectionTransform } from "./CustomSections";
|
|
26
27
|
|
|
27
28
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
28
29
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
@@ -627,6 +628,15 @@ class SmarticoAPI {
|
|
|
627
628
|
return GetLevelMapResponseTransform(await this.levelsGet(user_ext_id));
|
|
628
629
|
}
|
|
629
630
|
|
|
631
|
+
public async getCustomSections(user_ext_id: string): Promise<GetCustomSectionsResponse> {
|
|
632
|
+
const message = this.buildMessage<GetCustomSectionsRequest, GetCustomSectionsResponse>(user_ext_id, ClassId.GET_CUSTOM_SECTIONS_REQUEST);
|
|
633
|
+
return await this.send<GetCustomSectionsResponse>(message, ClassId.GET_CUSTOM_SECTIONS_RESPONSE);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
public async getCustomSectionsT(user_ext_id: string): Promise<TUICustomSection[]> {
|
|
637
|
+
return UICustomSectionTransform(Object.values((await this.getCustomSections(user_ext_id)).customSections));
|
|
638
|
+
}
|
|
639
|
+
|
|
630
640
|
public async getTranslationsT(user_ext_id: string, lang_code: string, areas: TranslationArea[], cacheSec: number = 60): Promise<GetTranslationsResponse> {
|
|
631
641
|
return await this.coreGetTranslations(user_ext_id, lang_code, areas, 30);
|
|
632
642
|
}
|
|
@@ -720,7 +730,7 @@ class SmarticoAPI {
|
|
|
720
730
|
return await this.send<MarkInboxMessageDeletedResponse>(message, ClassId.MARK_INBOX_DELETED_RESPONSE);
|
|
721
731
|
}
|
|
722
732
|
|
|
723
|
-
|
|
733
|
+
|
|
724
734
|
public getWSCalls(): WSAPI {
|
|
725
735
|
return new WSAPI(this);
|
|
726
736
|
}
|
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, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
6
|
+
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
|
|
7
7
|
import { LeaderBoardPeriodType } from "../Leaderboard";
|
|
8
8
|
import { JackpotDetails, JackpotPot, JackpotWinPush, JackpotsOptinResponse, JackpotsOptoutRequest, JackpotsOptoutResponse } from "../Jackpots";
|
|
9
9
|
|
|
@@ -30,6 +30,7 @@ enum onUpdateContextKey {
|
|
|
30
30
|
StoreHistory = 'storeHistory',
|
|
31
31
|
Jackpots = 'jackpots',
|
|
32
32
|
Pots = 'Pots',
|
|
33
|
+
CustomSections = 'customSections'
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
|
|
@@ -200,6 +201,7 @@ export class WSAPI {
|
|
|
200
201
|
* _smartico.vapi('EN').getStoreItems().then((result) => {
|
|
201
202
|
* console.log(result);
|
|
202
203
|
* });
|
|
204
|
+
* ```
|
|
203
205
|
*/
|
|
204
206
|
|
|
205
207
|
public async getStoreItems(): Promise<TStoreItem[]> {
|
|
@@ -243,6 +245,7 @@ export class WSAPI {
|
|
|
243
245
|
* _smartico.vapi('EN').getStoreCategories().then((result) => {
|
|
244
246
|
* console.log(result);
|
|
245
247
|
* });
|
|
248
|
+
* ```
|
|
246
249
|
*/
|
|
247
250
|
public async getStoreCategories(): Promise<TStoreCategory[]> {
|
|
248
251
|
return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
|
|
@@ -292,6 +295,28 @@ export class WSAPI {
|
|
|
292
295
|
return OCache.use(onUpdateContextKey.AchCategories, ECacheContext.WSAPI, () => this.api.achGetCategoriesT(null), CACHE_DATA_SEC);
|
|
293
296
|
}
|
|
294
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Returns list of custom sections
|
|
300
|
+
*
|
|
301
|
+
* **Example**:
|
|
302
|
+
* ```
|
|
303
|
+
* _smartico.api.getCustomSections().then((result) => {
|
|
304
|
+
* console.log(result);
|
|
305
|
+
* });
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* **Example in the Visitor mode**:
|
|
309
|
+
* ```
|
|
310
|
+
* _smartico.vapi('EN').getCustomSections().then((result) => {
|
|
311
|
+
* console.log(result);
|
|
312
|
+
* });
|
|
313
|
+
* ```
|
|
314
|
+
*
|
|
315
|
+
* */
|
|
316
|
+
public async getCustomSections(): Promise<TUICustomSection[]> {
|
|
317
|
+
return OCache.use(onUpdateContextKey.CustomSections, ECacheContext.WSAPI, () => this.api.getCustomSectionsT(null), CACHE_DATA_SEC);
|
|
318
|
+
}
|
|
319
|
+
|
|
295
320
|
/**
|
|
296
321
|
* Returns the list of mini-games available for user
|
|
297
322
|
* 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.
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { MiniGamePrizeTypeName, SAWBuyInTypeName, SAWGameTypeName, SAWSpinErrorC
|
|
|
3
3
|
import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from "../Tournaments";
|
|
4
4
|
import { AchCategory } from "../Missions";
|
|
5
5
|
import { LeaderBoardPeriodType } from "../Leaderboard";
|
|
6
|
+
import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from "../CustomSections";
|
|
6
7
|
|
|
7
8
|
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string
|
|
8
9
|
|
|
@@ -498,6 +499,9 @@ export interface TMissionOrBadge {
|
|
|
498
499
|
|
|
499
500
|
/** Flag for mission/badge indicating that mission/badge completed this month */
|
|
500
501
|
completed_this_month?: boolean;
|
|
502
|
+
|
|
503
|
+
/** ID of specific Custom Section type */
|
|
504
|
+
custom_section_type_id?: number;
|
|
501
505
|
}
|
|
502
506
|
|
|
503
507
|
export interface AchRelatedGame {
|
|
@@ -663,4 +667,27 @@ export interface UserLevelExtraCountersT {
|
|
|
663
667
|
export interface TSegmentCheckResult {
|
|
664
668
|
segment_id: number;
|
|
665
669
|
is_matching: boolean;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
export interface TUICustomSection {
|
|
673
|
+
/** The body of the custom section */
|
|
674
|
+
body?: string;
|
|
675
|
+
/** The image of the custom section */
|
|
676
|
+
menu_img?: string;
|
|
677
|
+
/** The name of the custom section */
|
|
678
|
+
menu_name?: string;
|
|
679
|
+
/** Custom images for custom section */
|
|
680
|
+
custom_skin_images?: string;
|
|
681
|
+
/** The particular type of custom section, can be Missions, Tournaments, Lootbox and etc */
|
|
682
|
+
section_type_id?: AchCustomSectionType;
|
|
683
|
+
/** Theme of the custom section */
|
|
684
|
+
theme?: AchCustomLayoutTheme;
|
|
685
|
+
/** Custom css for the custom section */
|
|
686
|
+
generic_custom_css?: string;
|
|
687
|
+
/** Tabs that can be shown in custom section, e.g Overview, No Overview, All tabs */
|
|
688
|
+
mission_tabs_options?: AchMissionsTabsOptions;
|
|
689
|
+
/** Filter that allow to show missions by criteria */
|
|
690
|
+
overview_missions_filter?: AchOverviewMissionsFilter;
|
|
691
|
+
/** Quantity of missions to be shown in overview */
|
|
692
|
+
overview_missions_count?: number;
|
|
666
693
|
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export enum MarketsValueType {
|
|
2
|
-
HomeTeam = '1',
|
|
3
|
-
AwayTeam = '2',
|
|
4
|
-
Draw = 'x',
|
|
5
|
-
HomeTeamHomeTeam = '1/1',
|
|
6
|
-
HomeTeamDraw = '1/x',
|
|
7
|
-
HomeTeamAwayTeam = '1/2',
|
|
8
|
-
DrawHomeTeam = 'x/1',
|
|
9
|
-
DrawDraw = 'x/x',
|
|
10
|
-
DrawAwayTeam = 'x/2',
|
|
11
|
-
AwayTeamHomeTeam = '2/1',
|
|
12
|
-
AwayTeamDraw = '2/x',
|
|
13
|
-
AwayTeamAwayTeam = '2/2',
|
|
14
|
-
Yes = 'yes',
|
|
15
|
-
No = 'no',
|
|
16
|
-
Odd = 'odd',
|
|
17
|
-
Even = 'even',
|
|
18
|
-
HomeOdd = '1/odd',
|
|
19
|
-
HomeEven = '1/even',
|
|
20
|
-
AwayOdd = '2/odd',
|
|
21
|
-
AwayEven = '2/even',
|
|
22
|
-
}
|