@smartico/public-api 0.0.362 → 0.0.364
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/GetAvatarPromptsResponse.d.ts +2 -0
- package/dist/Avatars/GetAvatarsCustomizedResponse.d.ts +2 -0
- package/dist/Avatars/GetAvatarsListResponse.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +8 -2
- package/dist/WSAPI/WSAPI.d.ts +2 -2
- package/dist/WSAPI/WSAPITypes.d.ts +14 -18
- package/dist/index.js +134 -61
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +77 -30
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Avatars/GetAvatarPromptsResponse.ts +11 -0
- package/src/Avatars/GetAvatarsCustomizedResponse.ts +9 -0
- package/src/Avatars/GetAvatarsListResponse.ts +18 -0
- package/src/Missions/MissionsUtils.ts +32 -4
- package/src/SmarticoAPI.ts +19 -1
- package/src/WSAPI/WSAPI.ts +5 -19
- package/src/WSAPI/WSAPITypes.ts +14 -18
package/dist/index.modern.mjs
CHANGED
|
@@ -1236,6 +1236,24 @@ var BadgesTimeLimitStates;
|
|
|
1236
1236
|
var _MissionUtils;
|
|
1237
1237
|
const USER_STATE_PARAMS_KEYS_GAMES = ['core_fav_game_top3', 'core_fav_game_type_top3', 'core_fav_game_provider_top3'];
|
|
1238
1238
|
const USER_STATE_PARAMS_KEYS_BET_AMOUNT = ['core_recommended_deposit_amount', 'core_recommended_casino_bet_amount', 'casino_last_bet_amount', 'casino_last_bet_amount_real', 'casino_last_bet_amount_bonus', 'acc_last_deposit_amount'];
|
|
1239
|
+
const MINOR_WORDS = new Set(['of', 'at', 'in', 'on', 'to', 'up', 'as', 'by', 'for', 'from', 'into', 'onto', 'with', 'upon', 'via', 'and', 'but', 'or', 'nor', 'so', 'yet', 'vs', 'v', 'a', 'an', 'the']);
|
|
1240
|
+
function toGameTitleCase(raw) {
|
|
1241
|
+
if (!raw) return raw;
|
|
1242
|
+
const tokens = raw.toLowerCase().split(/(\b\w+\b)/);
|
|
1243
|
+
const wordTokens = tokens.filter(t => /^\w+$/.test(t));
|
|
1244
|
+
const lastWordIdx = wordTokens.length - 1;
|
|
1245
|
+
let wordIndex = 0;
|
|
1246
|
+
return tokens.map(token => {
|
|
1247
|
+
if (!/^\w+$/.test(token)) return token;
|
|
1248
|
+
const isFirst = wordIndex === 0;
|
|
1249
|
+
const isLast = wordIndex === lastWordIdx;
|
|
1250
|
+
wordIndex++;
|
|
1251
|
+
if (isFirst || isLast || !MINOR_WORDS.has(token)) {
|
|
1252
|
+
return token.charAt(0).toUpperCase() + token.slice(1);
|
|
1253
|
+
}
|
|
1254
|
+
return token;
|
|
1255
|
+
}).join('');
|
|
1256
|
+
}
|
|
1239
1257
|
class MissionUtils {}
|
|
1240
1258
|
_MissionUtils = MissionUtils;
|
|
1241
1259
|
MissionUtils.getAvailabilityStatus = mission => {
|
|
@@ -1411,8 +1429,8 @@ MissionUtils.replaceTagsFavMissionTask = ({
|
|
|
1411
1429
|
const value = (_userStateParams$k = userStateParams[k]) == null ? void 0 : _userStateParams$k.filter(v => Boolean(v));
|
|
1412
1430
|
if (value && value.length > 0) {
|
|
1413
1431
|
suggestedGames = value.map(v => {
|
|
1414
|
-
const cleaned = v.replace(/_/g, ' ')
|
|
1415
|
-
return
|
|
1432
|
+
const cleaned = v.replace(/_/g, ' ');
|
|
1433
|
+
return toGameTitleCase(cleaned);
|
|
1416
1434
|
}).join(', ');
|
|
1417
1435
|
}
|
|
1418
1436
|
}
|
|
@@ -1422,8 +1440,7 @@ MissionUtils.replaceTagsFavMissionTask = ({
|
|
|
1422
1440
|
if (IntUtils.isNotNull(pos) && value && value[pos]) {
|
|
1423
1441
|
suggestedGames = value[pos];
|
|
1424
1442
|
if (suggestedGames) {
|
|
1425
|
-
suggestedGames = suggestedGames.replace(
|
|
1426
|
-
suggestedGames = suggestedGames.charAt(0).toUpperCase() + suggestedGames.slice(1);
|
|
1443
|
+
suggestedGames = toGameTitleCase(suggestedGames.replace(/_/g, ' '));
|
|
1427
1444
|
}
|
|
1428
1445
|
}
|
|
1429
1446
|
}
|
|
@@ -3420,16 +3437,7 @@ class WSAPI {
|
|
|
3420
3437
|
* **Visitor mode: not supported**
|
|
3421
3438
|
*/
|
|
3422
3439
|
async getAvatarsList() {
|
|
3423
|
-
|
|
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);
|
|
3440
|
+
return OCache.use(onUpdateContextKey.AvatarsList, ECacheContext.WSAPI, () => this.api.avatarsGetListT(this.userExtId), CACHE_DATA_SEC);
|
|
3433
3441
|
}
|
|
3434
3442
|
/**
|
|
3435
3443
|
* Returns the list of AI-customized avatars for the current user.
|
|
@@ -3446,11 +3454,7 @@ class WSAPI {
|
|
|
3446
3454
|
* **Visitor mode: not supported**
|
|
3447
3455
|
*/
|
|
3448
3456
|
async getAvatarsCustomized() {
|
|
3449
|
-
|
|
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);
|
|
3457
|
+
return OCache.use(onUpdateContextKey.AvatarsCustomized, ECacheContext.WSAPI, () => this.api.avatarsGetCustomizedT(this.userExtId), CACHE_DATA_SEC);
|
|
3454
3458
|
}
|
|
3455
3459
|
/**
|
|
3456
3460
|
* Returns the list of AI customization prompts (styles) available for avatar customization.
|
|
@@ -3467,15 +3471,11 @@ class WSAPI {
|
|
|
3467
3471
|
* **Visitor mode: not supported**
|
|
3468
3472
|
*/
|
|
3469
3473
|
async getAvatarPrompts() {
|
|
3470
|
-
|
|
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);
|
|
3474
|
+
return OCache.use(onUpdateContextKey.AvatarPrompts, ECacheContext.WSAPI, () => this.api.avatarsGetPromptsT(this.userExtId), CACHE_DATA_SEC);
|
|
3475
3475
|
}
|
|
3476
3476
|
/**
|
|
3477
3477
|
* Sets the specified avatar as the active avatar for the current user.
|
|
3478
|
-
* Pass `avatar_url` (the
|
|
3478
|
+
* Pass `avatar_url` (the `TAvatarDefinition.url` path or a CDN URL for AI-customized avatars)
|
|
3479
3479
|
* and `avatar_real_id` from the avatar catalog.
|
|
3480
3480
|
* After a successful call, the avatar list cache is cleared so the next `getAvatarsList()` call reflects `is_in_use`.
|
|
3481
3481
|
*
|
|
@@ -3485,7 +3485,7 @@ class WSAPI {
|
|
|
3485
3485
|
* const avatar = avatars.find((a) => !a.hide_until_achieved || a.is_given);
|
|
3486
3486
|
* if (avatar) {
|
|
3487
3487
|
* _smartico.api.setAvatar({
|
|
3488
|
-
* avatar_url: avatar.
|
|
3488
|
+
* avatar_url: avatar.url,
|
|
3489
3489
|
* avatar_real_id: avatar.avatar_real_id,
|
|
3490
3490
|
* }).then((result) => {
|
|
3491
3491
|
* console.log(result);
|
|
@@ -3591,7 +3591,7 @@ class WSAPI {
|
|
|
3591
3591
|
* ```
|
|
3592
3592
|
*/
|
|
3593
3593
|
async jackpotGet(filter) {
|
|
3594
|
-
var
|
|
3594
|
+
var _this = this;
|
|
3595
3595
|
const signature = `${filter == null ? void 0 : filter.jp_template_id}:${filter == null ? void 0 : filter.related_game_id}`;
|
|
3596
3596
|
if (signature !== this.jackpotGetSignature) {
|
|
3597
3597
|
this.jackpotGetSignature = signature;
|
|
@@ -3600,7 +3600,7 @@ class WSAPI {
|
|
|
3600
3600
|
let jackpots = [];
|
|
3601
3601
|
let pots = [];
|
|
3602
3602
|
jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
|
|
3603
|
-
const _jackpots = await
|
|
3603
|
+
const _jackpots = await _this.api.jackpotGet(_this.userExtId, filter);
|
|
3604
3604
|
const _pots = _jackpots.items.map(jp => jp.pot);
|
|
3605
3605
|
_jackpots.items.forEach(jp => {
|
|
3606
3606
|
jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
|
|
@@ -3611,7 +3611,7 @@ class WSAPI {
|
|
|
3611
3611
|
if (jackpots.length > 0) {
|
|
3612
3612
|
pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
|
|
3613
3613
|
const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
|
|
3614
|
-
return (await
|
|
3614
|
+
return (await _this.api.potGet(_this.userExtId, {
|
|
3615
3615
|
jp_template_ids
|
|
3616
3616
|
})).items;
|
|
3617
3617
|
}, JACKPOT_POT_CACHE_SEC);
|
|
@@ -4049,6 +4049,41 @@ var PointChangeSourceType;
|
|
|
4049
4049
|
PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
|
|
4050
4050
|
})(PointChangeSourceType || (PointChangeSourceType = {}));
|
|
4051
4051
|
|
|
4052
|
+
const avatarDefinitionTransform = (items, avatarDomain) => {
|
|
4053
|
+
return items.map(item => ({
|
|
4054
|
+
avatar_real_id: item.avatar_real_id,
|
|
4055
|
+
is_default: item.is_default,
|
|
4056
|
+
hide_until_achieved: item.hide_until_achieved,
|
|
4057
|
+
priority: item.priority,
|
|
4058
|
+
description: item.public_meta.description,
|
|
4059
|
+
url: item.public_meta.url,
|
|
4060
|
+
avatar_url: item.public_meta.url && !item.public_meta.url.startsWith('http') ? `${avatarDomain}${item.public_meta.url}` : item.public_meta.url,
|
|
4061
|
+
avatar_source_type_id: item.avatar_source_type_id,
|
|
4062
|
+
active_from_date: item.active_from_date,
|
|
4063
|
+
active_till_date: item.active_till_date,
|
|
4064
|
+
is_given: item.is_given,
|
|
4065
|
+
is_in_use: item.is_in_use
|
|
4066
|
+
}));
|
|
4067
|
+
};
|
|
4068
|
+
|
|
4069
|
+
const avatarCustomizedTransform = (items, avatarDomain) => {
|
|
4070
|
+
return items.map(item => ({
|
|
4071
|
+
avatar_real_id: item.avatar_real_id,
|
|
4072
|
+
url: item.url && !item.url.startsWith('http') ? `${avatarDomain}${item.url}` : item.url,
|
|
4073
|
+
dt_created: item.dt_created
|
|
4074
|
+
}));
|
|
4075
|
+
};
|
|
4076
|
+
|
|
4077
|
+
const avatarPromptTransform = (items, avatarDomain) => {
|
|
4078
|
+
return items.map(item => ({
|
|
4079
|
+
prompt_id: item.prompt_id,
|
|
4080
|
+
name: item.public_meta.name,
|
|
4081
|
+
icon_url: item.public_meta.icon_url && !item.public_meta.icon_url.startsWith('http') ? `${avatarDomain}${item.public_meta.icon_url}` : item.public_meta.icon_url,
|
|
4082
|
+
cost_currency_type_id: item.cost_currency_type_id,
|
|
4083
|
+
cost_value: item.cost_value
|
|
4084
|
+
}));
|
|
4085
|
+
};
|
|
4086
|
+
|
|
4052
4087
|
/**
|
|
4053
4088
|
* @ignore
|
|
4054
4089
|
*/
|
|
@@ -4974,6 +5009,18 @@ class SmarticoAPI {
|
|
|
4974
5009
|
});
|
|
4975
5010
|
return await this.send(message, ClassId.CLIENT_SET_AVATAR_RESPONSE);
|
|
4976
5011
|
}
|
|
5012
|
+
async avatarsGetListT(user_ext_id) {
|
|
5013
|
+
var _await$this$avatarsGe;
|
|
5014
|
+
return avatarDefinitionTransform((_await$this$avatarsGe = (await this.avatarsGetList(user_ext_id)).avatars) != null ? _await$this$avatarsGe : [], this.avatarDomain);
|
|
5015
|
+
}
|
|
5016
|
+
async avatarsGetCustomizedT(user_ext_id) {
|
|
5017
|
+
var _await$this$avatarsGe2;
|
|
5018
|
+
return avatarCustomizedTransform((_await$this$avatarsGe2 = (await this.avatarsGetCustomized(user_ext_id)).avatars) != null ? _await$this$avatarsGe2 : [], this.avatarDomain);
|
|
5019
|
+
}
|
|
5020
|
+
async avatarsGetPromptsT(user_ext_id) {
|
|
5021
|
+
var _await$this$avatarsGe3;
|
|
5022
|
+
return avatarPromptTransform((_await$this$avatarsGe3 = (await this.avatarsGetPrompts(user_ext_id)).prompts) != null ? _await$this$avatarsGe3 : [], this.avatarDomain);
|
|
5023
|
+
}
|
|
4977
5024
|
getWSCalls() {
|
|
4978
5025
|
return new WSAPI(this);
|
|
4979
5026
|
}
|
|
@@ -5506,5 +5553,5 @@ const AvatarCustomizeErrorMessage = {
|
|
|
5506
5553
|
[AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT]: 'The custom avatars are not available, please try again later'
|
|
5507
5554
|
};
|
|
5508
5555
|
|
|
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 };
|
|
5556
|
+
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, avatarCustomizedTransform, avatarDefinitionTransform, avatarPromptTransform, drawRunHistoryTransform, drawRunTransform, drawTransform, enrichUserAchievementsWithBadgeState, getLeaderBoardTransform, marketsInfo, prizeTransform, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, raffleClaimPrizeResponseTransform, raffleTransform, ticketsTransform, tournamentInfoItemTransform, winnersTransform };
|
|
5510
5557
|
//# sourceMappingURL=index.modern.mjs.map
|