@smartico/public-api 0.0.361 → 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.
@@ -0,0 +1,5 @@
1
+ export declare enum AvatarCustomizeErrorCode {
2
+ AVATAR_USER_LIMIT = 12001,
3
+ AVATAR_LABEL_LIMIT = 12002
4
+ }
5
+ export declare const AvatarCustomizeErrorMessage: Record<AvatarCustomizeErrorCode, string>;
@@ -0,0 +1,8 @@
1
+ export interface AvatarCustomized {
2
+ /** The avatar real id that this customization belongs to */
3
+ avatar_real_id: number;
4
+ /** CDN URL of the AI-customized avatar image */
5
+ url: string;
6
+ /** ISO date string when the customization was created */
7
+ dt_created: string;
8
+ }
@@ -0,0 +1,30 @@
1
+ export interface AvatarDefinition {
2
+ /** Unique identifier of the avatar */
3
+ avatar_real_id: number;
4
+ /** Whether this avatar is the default one */
5
+ is_default: boolean;
6
+ /** If true, avatar is hidden until user achieves/unlocks it */
7
+ hide_until_achieved: boolean;
8
+ /** Display priority — lower value means higher position */
9
+ priority: number;
10
+ /** Public metadata containing the avatar image URL and optional description */
11
+ public_meta: {
12
+ /** Optional description of the avatar */
13
+ description?: string;
14
+ /** Image path/URL of the avatar */
15
+ url: string;
16
+ };
17
+ /**
18
+ * Source type of the avatar.
19
+ * 0 = free (always available), other values = earned/purchased
20
+ */
21
+ avatar_source_type_id: number;
22
+ /** ISO date string from which the avatar becomes available */
23
+ active_from_date?: string;
24
+ /** ISO date string until which the avatar is available */
25
+ active_till_date?: string;
26
+ /** Whether the avatar has been granted/given to the current user */
27
+ is_given: boolean;
28
+ /** Whether this avatar is currently in use by the user */
29
+ is_in_use?: boolean;
30
+ }
@@ -0,0 +1,15 @@
1
+ export interface AvatarPrompt {
2
+ /** Unique identifier of the AI customization prompt */
3
+ prompt_id: number;
4
+ /** Public metadata for the prompt */
5
+ public_meta: {
6
+ /** Display name of the prompt style (e.g. "Cartoon", "Watercolor") */
7
+ name: string;
8
+ /** URL of the prompt style icon image */
9
+ icon_url: string;
10
+ };
11
+ /** Currency type used to pay for this customization (0=points, 1=gems, 2=diamonds) */
12
+ cost_currency_type_id: number;
13
+ /** Cost amount in the given currency */
14
+ cost_value: number;
15
+ }
@@ -0,0 +1,7 @@
1
+ import { TAvatarPrompt } from '../WSAPI/WSAPITypes';
2
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
3
+ import { AvatarPrompt } from './AvatarPrompt';
4
+ export interface GetAvatarPromptsResponse extends ProtocolResponse {
5
+ prompts: AvatarPrompt[];
6
+ }
7
+ export declare const avatarPromptTransform: (items: AvatarPrompt[], avatarDomain: string) => TAvatarPrompt[];
@@ -0,0 +1,7 @@
1
+ import { TAvatarCustomized } from '../WSAPI/WSAPITypes';
2
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
3
+ import { AvatarCustomized } from './AvatarCustomized';
4
+ export interface GetAvatarsCustomizedResponse extends ProtocolResponse {
5
+ avatars: AvatarCustomized[];
6
+ }
7
+ export declare const avatarCustomizedTransform: (items: AvatarCustomized[], avatarDomain: string) => TAvatarCustomized[];
@@ -0,0 +1,7 @@
1
+ import { TAvatarDefinition } from '../WSAPI/WSAPITypes';
2
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
3
+ import { AvatarDefinition } from './AvatarDefinition';
4
+ export interface GetAvatarsListResponse extends ProtocolResponse {
5
+ avatars: AvatarDefinition[];
6
+ }
7
+ export declare const avatarDefinitionTransform: (items: AvatarDefinition[], avatarDomain: string) => TAvatarDefinition[];
@@ -0,0 +1,7 @@
1
+ import { ProtocolRequest } from '../Base/ProtocolRequest';
2
+ export interface SetAvatarRequest extends ProtocolRequest {
3
+ /** The avatar image URL or path to set */
4
+ avatar_id: string;
5
+ /** The avatar_real_id from the avatar catalog */
6
+ avatar_real_id: number;
7
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ export interface SetAvatarResponse extends ProtocolResponse {
3
+ /** The resolved avatar URL after applying the avatar */
4
+ avatar_id: string;
5
+ }
@@ -0,0 +1,9 @@
1
+ export * from './AvatarCustomizeErrorCode';
2
+ export * from './AvatarDefinition';
3
+ export * from './AvatarCustomized';
4
+ export * from './AvatarPrompt';
5
+ export * from './GetAvatarsListResponse';
6
+ export * from './GetAvatarsCustomizedResponse';
7
+ export * from './GetAvatarPromptsResponse';
8
+ export * from './SetAvatarRequest';
9
+ export * from './SetAvatarResponse';
@@ -11,7 +11,7 @@ import { GetTournamentInfoResponse, GetTournamentsResponse, TournamentRegisterRe
11
11
  import { LeaderBoardDetails, LeaderBoardPeriodType } from './Leaderboard';
12
12
  import { GetLevelMapResponse } from './Level';
13
13
  import { WSAPI } from './WSAPI/WSAPI';
14
- import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TRaffleDraw } from './WSAPI/WSAPITypes';
14
+ import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TRaffleDraw, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt } from './WSAPI/WSAPITypes';
15
15
  import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
16
16
  import { GetJackpotsPotsResponse, GetJackpotsResponse, JackpotsOptinResponse, JackpotsOptoutResponse } from './Jackpots';
17
17
  import { GetCustomSectionsResponse } from './CustomSections';
@@ -23,6 +23,10 @@ import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
23
23
  import { GetActivityLogResponse } from './ActivityLog';
24
24
  import { InboxCategories } from './Inbox/InboxCategories';
25
25
  import { GetDrawRunResponse, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeResponse, RaffleOptinResponse } from './Raffle';
26
+ import { GetAvatarsListResponse } from './Avatars/GetAvatarsListResponse';
27
+ import { GetAvatarsCustomizedResponse } from './Avatars/GetAvatarsCustomizedResponse';
28
+ import { GetAvatarPromptsResponse } from './Avatars/GetAvatarPromptsResponse';
29
+ import { SetAvatarResponse } from './Avatars';
26
30
  import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
27
31
  import { GetJackpotEligibleGamesResponse, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
28
32
  import { GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo } from './WSAPI/WSAPITypes';
@@ -173,6 +177,13 @@ declare class SmarticoAPI {
173
177
  gpGetGameInfo(saw_template_id: number): Promise<GamesApiResponse<GamePickGameInfo>>;
174
178
  gpGetTranslations(saw_template_id: number): Promise<GamesApiResponse<any>>;
175
179
  gpGetRoundInfoForUser(saw_template_id: number, round_id: number, int_user_id: number): Promise<GamesApiResponse<GamePickRound>>;
180
+ avatarsGetList(user_ext_id: string): Promise<GetAvatarsListResponse>;
181
+ avatarsGetCustomized(user_ext_id: string): Promise<GetAvatarsCustomizedResponse>;
182
+ avatarsGetPrompts(user_ext_id: string): Promise<GetAvatarPromptsResponse>;
183
+ avatarSetAvatar(user_ext_id: string, avatar_id: string, avatar_real_id: number): Promise<SetAvatarResponse>;
184
+ avatarsGetListT(user_ext_id: string): Promise<TAvatarDefinition[]>;
185
+ avatarsGetCustomizedT(user_ext_id: string): Promise<TAvatarCustomized[]>;
186
+ avatarsGetPromptsT(user_ext_id: string): Promise<TAvatarPrompt[]>;
176
187
  getWSCalls(): WSAPI;
177
188
  getRelatedItemsForGame(user_ext_id: string, related_game_id: string): Promise<GetRelatedAchTourResponse>;
178
189
  getRafflesT(user_ext_id: string): Promise<TRaffle[]>;
@@ -1,6 +1,6 @@
1
1
  import { ActivityTypeLimited } from '../Core';
2
2
  import { SmarticoAPI } from '../SmarticoAPI';
3
- import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TActivityLog, TRaffleOptinResponse, GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo, GamePickRequestParams, GamePickRoundRequestParams } from './WSAPITypes';
3
+ import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TActivityLog, TRaffleOptinResponse, GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo, GamePickRequestParams, GamePickRoundRequestParams, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TSetAvatarResult } from './WSAPITypes';
4
4
  import { LeaderBoardPeriodType } from '../Leaderboard';
5
5
  import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
6
6
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
@@ -886,6 +886,79 @@ export declare class WSAPI {
886
886
  gamePickGetRoundInfoForUser(props: GamePickRoundRequestParams & {
887
887
  int_user_id: number;
888
888
  }): Promise<GamesApiResponse<GamePickRound>>;
889
+ /**
890
+ * Returns the list of avatars available in the catalog for the current user.
891
+ * The response includes both free avatars and earned/purchased ones.
892
+ * Avatars with `hide_until_achieved = true` and `is_given = false` should be hidden from the user.
893
+ * The result is cached for 30 seconds.
894
+ *
895
+ * **Example**:
896
+ * ```
897
+ * _smartico.api.getAvatarsList().then((result) => {
898
+ * console.log(result);
899
+ * });
900
+ * ```
901
+ *
902
+ * **Visitor mode: not supported**
903
+ */
904
+ getAvatarsList(): Promise<TAvatarDefinition[]>;
905
+ /**
906
+ * Returns the list of AI-customized avatars for the current user.
907
+ * Each entry represents a previously generated AI customization for a specific base avatar.
908
+ * The result is cached for 30 seconds.
909
+ *
910
+ * **Example**:
911
+ * ```
912
+ * _smartico.api.getAvatarsCustomized().then((result) => {
913
+ * console.log(result);
914
+ * });
915
+ * ```
916
+ *
917
+ * **Visitor mode: not supported**
918
+ */
919
+ getAvatarsCustomized(): Promise<TAvatarCustomized[]>;
920
+ /**
921
+ * Returns the list of AI customization prompts (styles) available for avatar customization.
922
+ * Each prompt represents a visual style that can be applied to a base avatar.
923
+ * The result is cached for 30 seconds.
924
+ *
925
+ * **Example**:
926
+ * ```
927
+ * _smartico.api.getAvatarPrompts().then((result) => {
928
+ * console.log(result);
929
+ * });
930
+ * ```
931
+ *
932
+ * **Visitor mode: not supported**
933
+ */
934
+ getAvatarPrompts(): Promise<TAvatarPrompt[]>;
935
+ /**
936
+ * Sets the specified avatar as the active avatar for the current user.
937
+ * Pass `avatar_url` (the `TAvatarDefinition.url` path or a CDN URL for AI-customized avatars)
938
+ * and `avatar_real_id` from the avatar catalog.
939
+ * After a successful call, the avatar list cache is cleared so the next `getAvatarsList()` call reflects `is_in_use`.
940
+ *
941
+ * **Example**:
942
+ * ```
943
+ * _smartico.api.getAvatarsList().then((avatars) => {
944
+ * const avatar = avatars.find((a) => !a.hide_until_achieved || a.is_given);
945
+ * if (avatar) {
946
+ * _smartico.api.setAvatar({
947
+ * avatar_url: avatar.url,
948
+ * avatar_real_id: avatar.avatar_real_id,
949
+ * }).then((result) => {
950
+ * console.log(result);
951
+ * });
952
+ * }
953
+ * });
954
+ * ```
955
+ *
956
+ * **Visitor mode: not supported**
957
+ */
958
+ setAvatar(props: {
959
+ avatar_url: string;
960
+ avatar_real_id: number;
961
+ }): Promise<TSetAvatarResult>;
889
962
  private updateOnSpin;
890
963
  private reloadMiniGameTemplate;
891
964
  private updateMissions;
@@ -1752,4 +1752,73 @@ export interface GamePickRoundRequestParams extends GamePickRequestParams {
1752
1752
  /** ID of the specific round */
1753
1753
  round_id: number;
1754
1754
  }
1755
+ /**
1756
+ * TAvatarDefinition describes a single avatar available in the avatar catalog.
1757
+ * Fields from the raw `public_meta` object are flattened to the top level.
1758
+ */
1759
+ export interface TAvatarDefinition {
1760
+ /** Unique identifier of the avatar */
1761
+ avatar_real_id: number;
1762
+ /** Whether this avatar is the default one */
1763
+ is_default: boolean;
1764
+ /** If true, avatar is hidden until user achieves/unlocks it */
1765
+ hide_until_achieved: boolean;
1766
+ /** Display priority — lower value means higher position in the grid */
1767
+ priority: number;
1768
+ /** Optional description of the avatar (from public_meta) */
1769
+ description?: string;
1770
+ /** Raw image path/URL of the avatar as returned by the server (from public_meta) */
1771
+ url: string;
1772
+ /** Full CDN URL of the avatar image, built from avatar_domain + url */
1773
+ avatar_url: string;
1774
+ /**
1775
+ * Source type of the avatar.
1776
+ * 0 = free (always available to all users), other values = earned/purchased
1777
+ */
1778
+ avatar_source_type_id: number;
1779
+ /** ISO date string from which the avatar becomes available */
1780
+ active_from_date?: string;
1781
+ /** ISO date string until which the avatar is available */
1782
+ active_till_date?: string;
1783
+ /** Whether the avatar has been granted/given to the current user */
1784
+ is_given: boolean;
1785
+ /** Whether this avatar is currently in use by the user */
1786
+ is_in_use?: boolean;
1787
+ }
1788
+ /**
1789
+ * TAvatarCustomized describes an AI-customized version of a base avatar
1790
+ */
1791
+ export interface TAvatarCustomized {
1792
+ /** The avatar_real_id of the base avatar this customization was generated from */
1793
+ avatar_real_id: number;
1794
+ /** Full CDN URL of the AI-generated customized avatar image */
1795
+ url: string;
1796
+ /** ISO date string when the customization was created */
1797
+ dt_created: string;
1798
+ }
1799
+ /**
1800
+ * TAvatarPrompt describes an AI style prompt available for avatar customization.
1801
+ * Fields from the raw `public_meta` object are flattened to the top level.
1802
+ */
1803
+ export interface TAvatarPrompt {
1804
+ /** Unique identifier of the AI customization prompt */
1805
+ prompt_id: number;
1806
+ /** Display name of the prompt style, e.g. "Cartoon", "Watercolor" (from public_meta) */
1807
+ name: string;
1808
+ /** Full CDN URL of the prompt style icon image (from public_meta) */
1809
+ icon_url: string;
1810
+ /** Currency type used to pay for this customization (0=points, 1=gems, 2=diamonds) */
1811
+ cost_currency_type_id: number;
1812
+ /** Cost amount in the given currency */
1813
+ cost_value: number;
1814
+ }
1815
+ /**
1816
+ * TSetAvatarResult describes the response of call to _smartico.api.setAvatar() method
1817
+ */
1818
+ export interface TSetAvatarResult {
1819
+ /** Error code that represents outcome of the set avatar request. Successful if err_code is 0 */
1820
+ err_code: number;
1821
+ /** Optional error message */
1822
+ err_message?: string;
1823
+ }
1755
1824
  export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType, SAWGPMarketType, QuizAnswersValueType };
package/dist/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './Bonuses';
21
21
  export * from './CustomSections';
22
22
  export * from './ActivityLog';
23
23
  export * from './Base/AchRelatedGame';
24
+ export * from './Avatars';