@smartico/public-api 0.0.360 → 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/Store/StoreItem.d.ts +1 -1
- 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 +312 -97
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +161 -8
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/interfaces/StoreItem.md +2 -2
- 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/Store/StoreItem.ts +2 -2
- package/src/Store/StoreItemPurchased.ts +14 -1
- 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
|
@@ -1026,7 +1026,7 @@ const mapPurchaseType$1 = purchaseType => {
|
|
|
1026
1026
|
};
|
|
1027
1027
|
const StoreItemTransform = items => {
|
|
1028
1028
|
return items.filter(r => r.id >= 1).map(r => {
|
|
1029
|
-
var _r$itemPublicMeta$pri, _r$categoryIds;
|
|
1029
|
+
var _r$itemPublicMeta$pri, _r$categoryIds, _r$relatedGames;
|
|
1030
1030
|
const x = _extends({
|
|
1031
1031
|
id: r.id,
|
|
1032
1032
|
name: r.itemPublicMeta.name,
|
|
@@ -1055,7 +1055,7 @@ const StoreItemTransform = items => {
|
|
|
1055
1055
|
}, r.itemPublicMeta.cant_buy_message ? {
|
|
1056
1056
|
cant_buy_message: r.itemPublicMeta.cant_buy_message
|
|
1057
1057
|
} : {}, {
|
|
1058
|
-
related_games: (r.
|
|
1058
|
+
related_games: (((_r$relatedGames = r.relatedGames) == null ? void 0 : _r$relatedGames.filter(g => g.game_public_meta.enabled)) || []).map((g, i) => ({
|
|
1059
1059
|
ext_game_id: g.ext_game_id,
|
|
1060
1060
|
game_public_meta: {
|
|
1061
1061
|
name: g.game_public_meta.name,
|
|
@@ -1085,7 +1085,7 @@ const mapPurchaseType = purchaseType => {
|
|
|
1085
1085
|
};
|
|
1086
1086
|
const StoreItemPurchasedTransform = items => {
|
|
1087
1087
|
return items.filter(r => r.id >= 1).map(r => {
|
|
1088
|
-
var _r$itemPublicMeta$pri, _r$categoryIds;
|
|
1088
|
+
var _r$itemPublicMeta$pri, _r$categoryIds, _r$relatedGames;
|
|
1089
1089
|
const purchasedToday = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'today') : false;
|
|
1090
1090
|
const purchasedThisWeek = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisWeek') : false;
|
|
1091
1091
|
const purchasedThisMonth = r.purchase_ts ? IntUtils.isWithinPeriod(r.purchase_ts, 'thisMonth') : false;
|
|
@@ -1111,7 +1111,20 @@ const StoreItemPurchasedTransform = items => {
|
|
|
1111
1111
|
purchased_today: purchasedToday,
|
|
1112
1112
|
purchased_this_week: purchasedThisWeek,
|
|
1113
1113
|
purchased_this_month: purchasedThisMonth,
|
|
1114
|
-
custom_data: r.itemPublicMeta.custom_data
|
|
1114
|
+
custom_data: r.itemPublicMeta.custom_data,
|
|
1115
|
+
related_games: (((_r$relatedGames = r.relatedGames) == null ? void 0 : _r$relatedGames.filter(g => g.game_public_meta.enabled)) || []).map((g, i) => ({
|
|
1116
|
+
ext_game_id: g.ext_game_id,
|
|
1117
|
+
game_public_meta: {
|
|
1118
|
+
name: g.game_public_meta.name,
|
|
1119
|
+
link: g.game_public_meta.link,
|
|
1120
|
+
image: g.game_public_meta.image,
|
|
1121
|
+
enabled: g.game_public_meta.enabled,
|
|
1122
|
+
game_categories: g.game_public_meta.game_categories,
|
|
1123
|
+
game_provider: g.game_public_meta.game_provider,
|
|
1124
|
+
mobile_spec_link: g.game_public_meta.mobile_spec_link,
|
|
1125
|
+
priority: i + 1
|
|
1126
|
+
}
|
|
1127
|
+
}))
|
|
1115
1128
|
};
|
|
1116
1129
|
return x;
|
|
1117
1130
|
});
|
|
@@ -2205,6 +2218,9 @@ var onUpdateContextKey;
|
|
|
2205
2218
|
onUpdateContextKey["CurrentLevel"] = "currentLevel";
|
|
2206
2219
|
onUpdateContextKey["InboxUnreadCount"] = "inboxUnreadCount";
|
|
2207
2220
|
onUpdateContextKey["ActivityLog"] = "activityLog";
|
|
2221
|
+
onUpdateContextKey["AvatarsList"] = "avatarsList";
|
|
2222
|
+
onUpdateContextKey["AvatarsCustomized"] = "avatarsCustomized";
|
|
2223
|
+
onUpdateContextKey["AvatarPrompts"] = "avatarPrompts";
|
|
2208
2224
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
2209
2225
|
/** @group General API */
|
|
2210
2226
|
class WSAPI {
|
|
@@ -3388,6 +3404,114 @@ class WSAPI {
|
|
|
3388
3404
|
}
|
|
3389
3405
|
return this.api.gpGetRoundInfoForUser(props.saw_template_id, props.round_id, props.int_user_id);
|
|
3390
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
|
+
}
|
|
3391
3515
|
async updateOnSpin(data) {
|
|
3392
3516
|
const templates = await OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, () => this.api.sawGetTemplatesT(this.userExtId), CACHE_DATA_SEC);
|
|
3393
3517
|
const index = templates.findIndex(t => t.id === data.saw_template_id);
|
|
@@ -3467,7 +3591,7 @@ class WSAPI {
|
|
|
3467
3591
|
* ```
|
|
3468
3592
|
*/
|
|
3469
3593
|
async jackpotGet(filter) {
|
|
3470
|
-
var
|
|
3594
|
+
var _this4 = this;
|
|
3471
3595
|
const signature = `${filter == null ? void 0 : filter.jp_template_id}:${filter == null ? void 0 : filter.related_game_id}`;
|
|
3472
3596
|
if (signature !== this.jackpotGetSignature) {
|
|
3473
3597
|
this.jackpotGetSignature = signature;
|
|
@@ -3476,7 +3600,7 @@ class WSAPI {
|
|
|
3476
3600
|
let jackpots = [];
|
|
3477
3601
|
let pots = [];
|
|
3478
3602
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
3479
|
-
const _jackpots = await
|
|
3603
|
+
const _jackpots = await _this4.api.jackpotGet(_this4.userExtId, filter);
|
|
3480
3604
|
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
3481
3605
|
_jackpots.items.forEach(jp => {
|
|
3482
3606
|
jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
|
|
@@ -3487,7 +3611,7 @@ class WSAPI {
|
|
|
3487
3611
|
if (jackpots.length > 0) {
|
|
3488
3612
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
3489
3613
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
3490
|
-
return (await
|
|
3614
|
+
return (await _this4.api.potGet(_this4.userExtId, {
|
|
3491
3615
|
jp_template_ids
|
|
3492
3616
|
})).items;
|
|
3493
3617
|
}, JACKPOT_POT_CACHE_SEC);
|
|
@@ -4831,6 +4955,25 @@ class SmarticoAPI {
|
|
|
4831
4955
|
params
|
|
4832
4956
|
});
|
|
4833
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
|
+
}
|
|
4834
4977
|
getWSCalls() {
|
|
4835
4978
|
return new WSAPI(this);
|
|
4836
4979
|
}
|
|
@@ -5353,5 +5496,15 @@ var JackpotType;
|
|
|
5353
5496
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
5354
5497
|
})(JackpotType || (JackpotType = {}));
|
|
5355
5498
|
|
|
5356
|
-
|
|
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 };
|
|
5357
5510
|
//# sourceMappingURL=index.modern.mjs.map
|