@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.
@@ -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,5 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { AvatarPrompt } from './AvatarPrompt';
3
+ export interface GetAvatarPromptsResponse extends ProtocolResponse {
4
+ prompts: AvatarPrompt[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { AvatarCustomized } from './AvatarCustomized';
3
+ export interface GetAvatarsCustomizedResponse extends ProtocolResponse {
4
+ avatars: AvatarCustomized[];
5
+ }
@@ -0,0 +1,5 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { AvatarDefinition } from './AvatarDefinition';
3
+ export interface GetAvatarsListResponse extends ProtocolResponse {
4
+ avatars: AvatarDefinition[];
5
+ }
@@ -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';
@@ -23,6 +23,7 @@ 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, GetAvatarsCustomizedResponse, GetAvatarPromptsResponse, SetAvatarResponse } from './Avatars';
26
27
  import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
27
28
  import { GetJackpotEligibleGamesResponse, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
28
29
  import { GamesApiResponse, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamePickGameInfo } from './WSAPI/WSAPITypes';
@@ -173,6 +174,10 @@ declare class SmarticoAPI {
173
174
  gpGetGameInfo(saw_template_id: number): Promise<GamesApiResponse<GamePickGameInfo>>;
174
175
  gpGetTranslations(saw_template_id: number): Promise<GamesApiResponse<any>>;
175
176
  gpGetRoundInfoForUser(saw_template_id: number, round_id: number, int_user_id: number): Promise<GamesApiResponse<GamePickRound>>;
177
+ avatarsGetList(user_ext_id: string): Promise<GetAvatarsListResponse>;
178
+ avatarsGetCustomized(user_ext_id: string): Promise<GetAvatarsCustomizedResponse>;
179
+ avatarsGetPrompts(user_ext_id: string): Promise<GetAvatarPromptsResponse>;
180
+ avatarSetAvatar(user_ext_id: string, avatar_id: string, avatar_real_id: number): Promise<SetAvatarResponse>;
176
181
  getWSCalls(): WSAPI;
177
182
  getRelatedItemsForGame(user_ext_id: string, related_game_id: string): Promise<GetRelatedAchTourResponse>;
178
183
  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 image path from `TAvatarDefinition.public_meta.url` 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.public_meta.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,77 @@ 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
+ */
1758
+ export interface TAvatarDefinition {
1759
+ /** Unique identifier of the avatar */
1760
+ avatar_real_id: number;
1761
+ /** Whether this avatar is the default one */
1762
+ is_default: boolean;
1763
+ /** If true, avatar is hidden until user achieves/unlocks it */
1764
+ hide_until_achieved: boolean;
1765
+ /** Display priority — lower value means higher position in the grid */
1766
+ priority: number;
1767
+ /** Public metadata containing the avatar image URL and optional description */
1768
+ public_meta: {
1769
+ /** Optional description of the avatar */
1770
+ description?: string;
1771
+ /** Image path/URL of the avatar */
1772
+ url: string;
1773
+ };
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
+ /** Full CDN URL of the avatar image, built from avatar_domain + public_meta.url */
1788
+ avatar_url: string;
1789
+ }
1790
+ /**
1791
+ * TAvatarCustomized describes an AI-customized version of a base avatar
1792
+ */
1793
+ export interface TAvatarCustomized {
1794
+ /** The avatar_real_id of the base avatar this customization was generated from */
1795
+ avatar_real_id: number;
1796
+ /** Full CDN URL of the AI-generated customized avatar image */
1797
+ url: string;
1798
+ /** ISO date string when the customization was created */
1799
+ dt_created: string;
1800
+ }
1801
+ /**
1802
+ * TAvatarPrompt describes an AI style prompt available for avatar customization
1803
+ */
1804
+ export interface TAvatarPrompt {
1805
+ /** Unique identifier of the AI customization prompt */
1806
+ prompt_id: number;
1807
+ /** Public metadata for the prompt */
1808
+ public_meta: {
1809
+ /** Display name of the prompt style (e.g. "Cartoon", "Watercolor") */
1810
+ name: string;
1811
+ /** URL of the prompt style icon image */
1812
+ icon_url: string;
1813
+ };
1814
+ /** Currency type used to pay for this customization (0=points, 1=gems, 2=diamonds) */
1815
+ cost_currency_type_id: number;
1816
+ /** Cost amount in the given currency */
1817
+ cost_value: number;
1818
+ }
1819
+ /**
1820
+ * TSetAvatarResult describes the response of call to _smartico.api.setAvatar() method
1821
+ */
1822
+ export interface TSetAvatarResult {
1823
+ /** Error code that represents outcome of the set avatar request. Successful if err_code is 0 */
1824
+ err_code: number;
1825
+ /** Optional error message */
1826
+ err_message?: string;
1827
+ }
1755
1828
  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';