@smartico/public-api 0.0.362 → 0.0.363

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.
@@ -3420,16 +3420,7 @@ class WSAPI {
3420
3420
  * **Visitor mode: not supported**
3421
3421
  */
3422
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);
3423
+ return OCache.use(onUpdateContextKey.AvatarsList, ECacheContext.WSAPI, () => this.api.avatarsGetListT(this.userExtId), CACHE_DATA_SEC);
3433
3424
  }
3434
3425
  /**
3435
3426
  * Returns the list of AI-customized avatars for the current user.
@@ -3446,11 +3437,7 @@ class WSAPI {
3446
3437
  * **Visitor mode: not supported**
3447
3438
  */
3448
3439
  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);
3440
+ return OCache.use(onUpdateContextKey.AvatarsCustomized, ECacheContext.WSAPI, () => this.api.avatarsGetCustomizedT(this.userExtId), CACHE_DATA_SEC);
3454
3441
  }
3455
3442
  /**
3456
3443
  * Returns the list of AI customization prompts (styles) available for avatar customization.
@@ -3467,15 +3454,11 @@ class WSAPI {
3467
3454
  * **Visitor mode: not supported**
3468
3455
  */
3469
3456
  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);
3457
+ return OCache.use(onUpdateContextKey.AvatarPrompts, ECacheContext.WSAPI, () => this.api.avatarsGetPromptsT(this.userExtId), CACHE_DATA_SEC);
3475
3458
  }
3476
3459
  /**
3477
3460
  * 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)
3461
+ * Pass `avatar_url` (the `TAvatarDefinition.url` path or a CDN URL for AI-customized avatars)
3479
3462
  * and `avatar_real_id` from the avatar catalog.
3480
3463
  * After a successful call, the avatar list cache is cleared so the next `getAvatarsList()` call reflects `is_in_use`.
3481
3464
  *
@@ -3485,7 +3468,7 @@ class WSAPI {
3485
3468
  * const avatar = avatars.find((a) => !a.hide_until_achieved || a.is_given);
3486
3469
  * if (avatar) {
3487
3470
  * _smartico.api.setAvatar({
3488
- * avatar_url: avatar.public_meta.url,
3471
+ * avatar_url: avatar.url,
3489
3472
  * avatar_real_id: avatar.avatar_real_id,
3490
3473
  * }).then((result) => {
3491
3474
  * console.log(result);
@@ -3591,7 +3574,7 @@ class WSAPI {
3591
3574
  * ```
3592
3575
  */
3593
3576
  async jackpotGet(filter) {
3594
- var _this4 = this;
3577
+ var _this = this;
3595
3578
  const signature = `${filter == null ? void 0 : filter.jp_template_id}:${filter == null ? void 0 : filter.related_game_id}`;
3596
3579
  if (signature !== this.jackpotGetSignature) {
3597
3580
  this.jackpotGetSignature = signature;
@@ -3600,7 +3583,7 @@ class WSAPI {
3600
3583
  let jackpots = [];
3601
3584
  let pots = [];
3602
3585
  jackpots = await OCache.use(onUpdateContextKey.Jackpots, ECacheContext.WSAPI, async function () {
3603
- const _jackpots = await _this4.api.jackpotGet(_this4.userExtId, filter);
3586
+ const _jackpots = await _this.api.jackpotGet(_this.userExtId, filter);
3604
3587
  const _pots = _jackpots.items.map(jp => jp.pot);
3605
3588
  _jackpots.items.forEach(jp => {
3606
3589
  jp.jp_public_meta.custom_data = IntUtils.JsonOrText(jp.jp_public_meta.custom_data);
@@ -3611,7 +3594,7 @@ class WSAPI {
3611
3594
  if (jackpots.length > 0) {
3612
3595
  pots = await OCache.use(onUpdateContextKey.Pots, ECacheContext.WSAPI, async function () {
3613
3596
  const jp_template_ids = jackpots.map(jp => jp.jp_template_id);
3614
- return (await _this4.api.potGet(_this4.userExtId, {
3597
+ return (await _this.api.potGet(_this.userExtId, {
3615
3598
  jp_template_ids
3616
3599
  })).items;
3617
3600
  }, JACKPOT_POT_CACHE_SEC);
@@ -4049,6 +4032,41 @@ var PointChangeSourceType;
4049
4032
  PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
4050
4033
  })(PointChangeSourceType || (PointChangeSourceType = {}));
4051
4034
 
4035
+ const avatarDefinitionTransform = (items, avatarDomain) => {
4036
+ return items.map(item => ({
4037
+ avatar_real_id: item.avatar_real_id,
4038
+ is_default: item.is_default,
4039
+ hide_until_achieved: item.hide_until_achieved,
4040
+ priority: item.priority,
4041
+ description: item.public_meta.description,
4042
+ url: item.public_meta.url,
4043
+ avatar_url: item.public_meta.url && !item.public_meta.url.startsWith('http') ? `${avatarDomain}${item.public_meta.url}` : item.public_meta.url,
4044
+ avatar_source_type_id: item.avatar_source_type_id,
4045
+ active_from_date: item.active_from_date,
4046
+ active_till_date: item.active_till_date,
4047
+ is_given: item.is_given,
4048
+ is_in_use: item.is_in_use
4049
+ }));
4050
+ };
4051
+
4052
+ const avatarCustomizedTransform = (items, avatarDomain) => {
4053
+ return items.map(item => ({
4054
+ avatar_real_id: item.avatar_real_id,
4055
+ url: item.url && !item.url.startsWith('http') ? `${avatarDomain}${item.url}` : item.url,
4056
+ dt_created: item.dt_created
4057
+ }));
4058
+ };
4059
+
4060
+ const avatarPromptTransform = (items, avatarDomain) => {
4061
+ return items.map(item => ({
4062
+ prompt_id: item.prompt_id,
4063
+ name: item.public_meta.name,
4064
+ 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,
4065
+ cost_currency_type_id: item.cost_currency_type_id,
4066
+ cost_value: item.cost_value
4067
+ }));
4068
+ };
4069
+
4052
4070
  /**
4053
4071
  * @ignore
4054
4072
  */
@@ -4974,6 +4992,18 @@ class SmarticoAPI {
4974
4992
  });
4975
4993
  return await this.send(message, ClassId.CLIENT_SET_AVATAR_RESPONSE);
4976
4994
  }
4995
+ async avatarsGetListT(user_ext_id) {
4996
+ var _await$this$avatarsGe;
4997
+ return avatarDefinitionTransform((_await$this$avatarsGe = (await this.avatarsGetList(user_ext_id)).avatars) != null ? _await$this$avatarsGe : [], this.avatarDomain);
4998
+ }
4999
+ async avatarsGetCustomizedT(user_ext_id) {
5000
+ var _await$this$avatarsGe2;
5001
+ return avatarCustomizedTransform((_await$this$avatarsGe2 = (await this.avatarsGetCustomized(user_ext_id)).avatars) != null ? _await$this$avatarsGe2 : [], this.avatarDomain);
5002
+ }
5003
+ async avatarsGetPromptsT(user_ext_id) {
5004
+ var _await$this$avatarsGe3;
5005
+ return avatarPromptTransform((_await$this$avatarsGe3 = (await this.avatarsGetPrompts(user_ext_id)).prompts) != null ? _await$this$avatarsGe3 : [], this.avatarDomain);
5006
+ }
4977
5007
  getWSCalls() {
4978
5008
  return new WSAPI(this);
4979
5009
  }
@@ -5506,5 +5536,5 @@ const AvatarCustomizeErrorMessage = {
5506
5536
  [AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT]: 'The custom avatars are not available, please try again later'
5507
5537
  };
5508
5538
 
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 };
5539
+ 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
5540
  //# sourceMappingURL=index.modern.mjs.map