@smartico/public-api 0.0.361 → 0.0.362
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/Avatars/AvatarCustomizeErrorCode.d.ts +5 -0
- package/dist/Avatars/AvatarCustomized.d.ts +8 -0
- package/dist/Avatars/AvatarDefinition.d.ts +30 -0
- package/dist/Avatars/AvatarPrompt.d.ts +15 -0
- package/dist/Avatars/GetAvatarPromptsResponse.d.ts +5 -0
- package/dist/Avatars/GetAvatarsCustomizedResponse.d.ts +5 -0
- package/dist/Avatars/GetAvatarsListResponse.d.ts +5 -0
- package/dist/Avatars/SetAvatarRequest.d.ts +7 -0
- package/dist/Avatars/SetAvatarResponse.d.ts +5 -0
- package/dist/Avatars/index.d.ts +9 -0
- package/dist/SmarticoAPI.d.ts +5 -0
- package/dist/WSAPI/WSAPI.d.ts +74 -1
- package/dist/WSAPI/WSAPITypes.d.ts +73 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +289 -93
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +144 -4
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Avatars/AvatarCustomizeErrorCode.ts +9 -0
- package/src/Avatars/AvatarCustomized.ts +8 -0
- package/src/Avatars/AvatarDefinition.ts +30 -0
- package/src/Avatars/AvatarPrompt.ts +15 -0
- package/src/Avatars/GetAvatarPromptsResponse.ts +6 -0
- package/src/Avatars/GetAvatarsCustomizedResponse.ts +6 -0
- package/src/Avatars/GetAvatarsListResponse.ts +6 -0
- package/src/Avatars/SetAvatarRequest.ts +8 -0
- package/src/Avatars/SetAvatarResponse.ts +6 -0
- package/src/Avatars/index.ts +9 -0
- package/src/SmarticoAPI.ts +24 -0
- package/src/WSAPI/WSAPI.ts +133 -0
- package/src/WSAPI/WSAPITypes.ts +77 -0
- package/src/index.ts +2 -1
package/dist/index.modern.mjs
CHANGED
|
@@ -2218,6 +2218,9 @@ var onUpdateContextKey;
|
|
|
2218
2218
|
onUpdateContextKey["CurrentLevel"] = "currentLevel";
|
|
2219
2219
|
onUpdateContextKey["InboxUnreadCount"] = "inboxUnreadCount";
|
|
2220
2220
|
onUpdateContextKey["ActivityLog"] = "activityLog";
|
|
2221
|
+
onUpdateContextKey["AvatarsList"] = "avatarsList";
|
|
2222
|
+
onUpdateContextKey["AvatarsCustomized"] = "avatarsCustomized";
|
|
2223
|
+
onUpdateContextKey["AvatarPrompts"] = "avatarPrompts";
|
|
2221
2224
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
2222
2225
|
/** @group General API */
|
|
2223
2226
|
class WSAPI {
|
|
@@ -3401,6 +3404,114 @@ class WSAPI {
|
|
|
3401
3404
|
}
|
|
3402
3405
|
return this.api.gpGetRoundInfoForUser(props.saw_template_id, props.round_id, props.int_user_id);
|
|
3403
3406
|
}
|
|
3407
|
+
/**
|
|
3408
|
+
* Returns the list of avatars available in the catalog for the current user.
|
|
3409
|
+
* The response includes both free avatars and earned/purchased ones.
|
|
3410
|
+
* Avatars with `hide_until_achieved = true` and `is_given = false` should be hidden from the user.
|
|
3411
|
+
* The result is cached for 30 seconds.
|
|
3412
|
+
*
|
|
3413
|
+
* **Example**:
|
|
3414
|
+
* ```
|
|
3415
|
+
* _smartico.api.getAvatarsList().then((result) => {
|
|
3416
|
+
* console.log(result);
|
|
3417
|
+
* });
|
|
3418
|
+
* ```
|
|
3419
|
+
*
|
|
3420
|
+
* **Visitor mode: not supported**
|
|
3421
|
+
*/
|
|
3422
|
+
async getAvatarsList() {
|
|
3423
|
+
var _this = this;
|
|
3424
|
+
return OCache.use(onUpdateContextKey.AvatarsList, ECacheContext.WSAPI, async function () {
|
|
3425
|
+
const response = await _this.api.avatarsGetList(_this.userExtId);
|
|
3426
|
+
return (response.avatars || []).map(a => {
|
|
3427
|
+
var _a$public_meta, _a$public_meta2;
|
|
3428
|
+
return _extends({}, a, {
|
|
3429
|
+
avatar_url: _this.api.avatarDomain && (_a$public_meta = a.public_meta) != null && _a$public_meta.url ? a.public_meta.url.startsWith('http') ? a.public_meta.url : `${_this.api.avatarDomain}${a.public_meta.url}` : ((_a$public_meta2 = a.public_meta) == null ? void 0 : _a$public_meta2.url) || ''
|
|
3430
|
+
});
|
|
3431
|
+
});
|
|
3432
|
+
}, CACHE_DATA_SEC);
|
|
3433
|
+
}
|
|
3434
|
+
/**
|
|
3435
|
+
* Returns the list of AI-customized avatars for the current user.
|
|
3436
|
+
* Each entry represents a previously generated AI customization for a specific base avatar.
|
|
3437
|
+
* The result is cached for 30 seconds.
|
|
3438
|
+
*
|
|
3439
|
+
* **Example**:
|
|
3440
|
+
* ```
|
|
3441
|
+
* _smartico.api.getAvatarsCustomized().then((result) => {
|
|
3442
|
+
* console.log(result);
|
|
3443
|
+
* });
|
|
3444
|
+
* ```
|
|
3445
|
+
*
|
|
3446
|
+
* **Visitor mode: not supported**
|
|
3447
|
+
*/
|
|
3448
|
+
async getAvatarsCustomized() {
|
|
3449
|
+
var _this2 = this;
|
|
3450
|
+
return OCache.use(onUpdateContextKey.AvatarsCustomized, ECacheContext.WSAPI, async function () {
|
|
3451
|
+
const response = await _this2.api.avatarsGetCustomized(_this2.userExtId);
|
|
3452
|
+
return response.avatars || [];
|
|
3453
|
+
}, CACHE_DATA_SEC);
|
|
3454
|
+
}
|
|
3455
|
+
/**
|
|
3456
|
+
* Returns the list of AI customization prompts (styles) available for avatar customization.
|
|
3457
|
+
* Each prompt represents a visual style that can be applied to a base avatar.
|
|
3458
|
+
* The result is cached for 30 seconds.
|
|
3459
|
+
*
|
|
3460
|
+
* **Example**:
|
|
3461
|
+
* ```
|
|
3462
|
+
* _smartico.api.getAvatarPrompts().then((result) => {
|
|
3463
|
+
* console.log(result);
|
|
3464
|
+
* });
|
|
3465
|
+
* ```
|
|
3466
|
+
*
|
|
3467
|
+
* **Visitor mode: not supported**
|
|
3468
|
+
*/
|
|
3469
|
+
async getAvatarPrompts() {
|
|
3470
|
+
var _this3 = this;
|
|
3471
|
+
return OCache.use(onUpdateContextKey.AvatarPrompts, ECacheContext.WSAPI, async function () {
|
|
3472
|
+
const response = await _this3.api.avatarsGetPrompts(_this3.userExtId);
|
|
3473
|
+
return response.prompts || [];
|
|
3474
|
+
}, CACHE_DATA_SEC);
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
3477
|
+
* Sets the specified avatar as the active avatar for the current user.
|
|
3478
|
+
* Pass `avatar_url` (the image path from `TAvatarDefinition.public_meta.url` or a CDN URL for AI-customized avatars)
|
|
3479
|
+
* and `avatar_real_id` from the avatar catalog.
|
|
3480
|
+
* After a successful call, the avatar list cache is cleared so the next `getAvatarsList()` call reflects `is_in_use`.
|
|
3481
|
+
*
|
|
3482
|
+
* **Example**:
|
|
3483
|
+
* ```
|
|
3484
|
+
* _smartico.api.getAvatarsList().then((avatars) => {
|
|
3485
|
+
* const avatar = avatars.find((a) => !a.hide_until_achieved || a.is_given);
|
|
3486
|
+
* if (avatar) {
|
|
3487
|
+
* _smartico.api.setAvatar({
|
|
3488
|
+
* avatar_url: avatar.public_meta.url,
|
|
3489
|
+
* avatar_real_id: avatar.avatar_real_id,
|
|
3490
|
+
* }).then((result) => {
|
|
3491
|
+
* console.log(result);
|
|
3492
|
+
* });
|
|
3493
|
+
* }
|
|
3494
|
+
* });
|
|
3495
|
+
* ```
|
|
3496
|
+
*
|
|
3497
|
+
* **Visitor mode: not supported**
|
|
3498
|
+
*/
|
|
3499
|
+
async setAvatar(props) {
|
|
3500
|
+
var _r$errCode;
|
|
3501
|
+
if (!props.avatar_url) {
|
|
3502
|
+
throw new Error('avatar_url is required');
|
|
3503
|
+
}
|
|
3504
|
+
if (!props.avatar_real_id) {
|
|
3505
|
+
throw new Error('avatar_real_id is required');
|
|
3506
|
+
}
|
|
3507
|
+
const r = await this.api.avatarSetAvatar(this.userExtId, props.avatar_url, props.avatar_real_id);
|
|
3508
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.AvatarsList);
|
|
3509
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.AvatarsCustomized);
|
|
3510
|
+
return {
|
|
3511
|
+
err_code: (_r$errCode = r.errCode) != null ? _r$errCode : 0,
|
|
3512
|
+
err_message: r.errMsg
|
|
3513
|
+
};
|
|
3514
|
+
}
|
|
3404
3515
|
async updateOnSpin(data) {
|
|
3405
3516
|
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(this.userExtId), CACHE_DATA_SEC);
|
|
3406
3517
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
@@ -3480,7 +3591,7 @@ class WSAPI {
|
|
|
3480
3591
|
* ```
|
|
3481
3592
|
*/
|
|
3482
3593
|
async jackpotGet(filter) {
|
|
3483
|
-
var
|
|
3594
|
+
var _this4 = this;
|
|
3484
3595
|
const signature = `${filter == null ? void 0 : filter.jp_template_id}:${filter == null ? void 0 : filter.related_game_id}`;
|
|
3485
3596
|
if (signature !== this.jackpotGetSignature) {
|
|
3486
3597
|
this.jackpotGetSignature = signature;
|
|
@@ -3489,7 +3600,7 @@ class WSAPI {
|
|
|
3489
3600
|
let jackpots = [];
|
|
3490
3601
|
let pots = [];
|
|
3491
3602
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
3492
|
-
const _jackpots = await
|
|
3603
|
+
const _jackpots = await _this4.api.jackpotGet(_this4.userExtId, filter);
|
|
3493
3604
|
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
3494
3605
|
_jackpots.items.forEach(jp => {
|
|
3495
3606
|
jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
|
|
@@ -3500,7 +3611,7 @@ class WSAPI {
|
|
|
3500
3611
|
if (jackpots.length > 0) {
|
|
3501
3612
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
3502
3613
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
3503
|
-
return (await
|
|
3614
|
+
return (await _this4.api.potGet(_this4.userExtId, {
|
|
3504
3615
|
jp_template_ids
|
|
3505
3616
|
})).items;
|
|
3506
3617
|
}, JACKPOT_POT_CACHE_SEC);
|
|
@@ -4844,6 +4955,25 @@ class SmarticoAPI {
|
|
|
4844
4955
|
params
|
|
4845
4956
|
});
|
|
4846
4957
|
}
|
|
4958
|
+
async avatarsGetList(user_ext_id) {
|
|
4959
|
+
const message = this.buildMessage(user_ext_id, ClassId.GET_AVATARS_LIST_REQUEST);
|
|
4960
|
+
return await this.send(message, ClassId.GET_AVATARS_LIST_RESPONSE);
|
|
4961
|
+
}
|
|
4962
|
+
async avatarsGetCustomized(user_ext_id) {
|
|
4963
|
+
const message = this.buildMessage(user_ext_id, ClassId.GET_AVATARS_CUSTOMIZED_REQUEST);
|
|
4964
|
+
return await this.send(message, ClassId.GET_AVATARS_CUSTOMIZED_RESPONSE);
|
|
4965
|
+
}
|
|
4966
|
+
async avatarsGetPrompts(user_ext_id) {
|
|
4967
|
+
const message = this.buildMessage(user_ext_id, ClassId.GET_AVATAR_PROMPTS_REQUEST);
|
|
4968
|
+
return await this.send(message, ClassId.GET_AVATAR_PROMPTS_RESPONSE);
|
|
4969
|
+
}
|
|
4970
|
+
async avatarSetAvatar(user_ext_id, avatar_id, avatar_real_id) {
|
|
4971
|
+
const message = this.buildMessage(user_ext_id, ClassId.CLIENT_SET_AVATAR_REQUEST, {
|
|
4972
|
+
avatar_id,
|
|
4973
|
+
avatar_real_id
|
|
4974
|
+
});
|
|
4975
|
+
return await this.send(message, ClassId.CLIENT_SET_AVATAR_RESPONSE);
|
|
4976
|
+
}
|
|
4847
4977
|
getWSCalls() {
|
|
4848
4978
|
return new WSAPI(this);
|
|
4849
4979
|
}
|
|
@@ -5366,5 +5496,15 @@ var JackpotType;
|
|
|
5366
5496
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
5367
5497
|
})(JackpotType || (JackpotType = {}));
|
|
5368
5498
|
|
|
5369
|
-
|
|
5499
|
+
var AvatarCustomizeErrorCode;
|
|
5500
|
+
(function (AvatarCustomizeErrorCode) {
|
|
5501
|
+
AvatarCustomizeErrorCode[AvatarCustomizeErrorCode["AVATAR_USER_LIMIT"] = 12001] = "AVATAR_USER_LIMIT";
|
|
5502
|
+
AvatarCustomizeErrorCode[AvatarCustomizeErrorCode["AVATAR_LABEL_LIMIT"] = 12002] = "AVATAR_LABEL_LIMIT";
|
|
5503
|
+
})(AvatarCustomizeErrorCode || (AvatarCustomizeErrorCode = {}));
|
|
5504
|
+
const AvatarCustomizeErrorMessage = {
|
|
5505
|
+
[AvatarCustomizeErrorCode.AVATAR_USER_LIMIT]: 'You have exceeded number of custom avatars creation, please try later',
|
|
5506
|
+
[AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT]: 'The custom avatars are not available, please try again later'
|
|
5507
|
+
};
|
|
5508
|
+
|
|
5509
|
+
export { AchCategoryTransform, AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityLogTransform, ActivityTypeLimited, AnalyticsInboxSubScreenNameId, AnalyticsInterfaceType, AnalyticsScreenNameId, AnalyticsTournamentsLobbySubScreenNameId, AttemptPeriodType, AvatarCustomizeErrorCode, AvatarCustomizeErrorMessage, BadgesTimeLimitStates, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetJackpotEligibleGamesResponseTransform, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, InboxReadStatus, JackPotTemparature, JackpotContributionType, JackpotType, LeaderBoardPeriodType, LiquidEntityData, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, MissionCategory, MissionUtils, OCache, OpenLinksType, PointChangeSourceType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWExposeUserSpinId, SAWExposeUserSpinIdName, SAWExposeUserSpinIdNamed, SAWGPMarketType, SAWGameDifficultyType, SAWGameDifficultyTypeName, SAWGameLayout, SAWGameLayoutName, SAWGameLayoutNamed, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, SawGameDifficultyTypeNamed, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UICustomSectionTransform, UserAchievementTransform, UserBalanceType, WSAPI, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
5370
5510
|
//# sourceMappingURL=index.modern.mjs.map
|