@smartico/public-api 0.0.386 → 0.0.388

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.
Files changed (44) hide show
  1. package/README.md +2 -2
  2. package/dist/Avatars/AvatarCustomizeErrorCode.d.ts +7 -1
  3. package/dist/Avatars/AvatarCustomizeResponse.d.ts +16 -0
  4. package/dist/Avatars/index.d.ts +1 -0
  5. package/dist/CustomSections/AchCustomSection.d.ts +2 -1
  6. package/dist/Missions/UserAchievementTask.d.ts +4 -0
  7. package/dist/SmarticoAPI.d.ts +15 -2
  8. package/dist/WSAPI/WSAPIAvatars.d.ts +103 -0
  9. package/dist/WSAPI/WSAPILeaderBoard.d.ts +76 -10
  10. package/dist/WSAPI/WSAPITypes.d.ts +22 -5
  11. package/dist/index.js +441 -149
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.modern.mjs +280 -29
  14. package/dist/index.modern.mjs.map +1 -1
  15. package/docs/SmarticoObject.md +15 -0
  16. package/docs/api/README.md +2 -0
  17. package/docs/api/classes/WSAPIAvatars.md +135 -0
  18. package/docs/api/classes/WSAPIClans.md +3 -5
  19. package/docs/api/classes/WSAPILeaderBoard.md +86 -10
  20. package/docs/api/documents/SmarticoObject.md +15 -0
  21. package/docs/api/enumerations/AvatarCustomizeErrorCode.md +21 -0
  22. package/docs/api/enumerations/JoinClanErrorCode.md +16 -17
  23. package/docs/api/interfaces/AvatarCustomizeResponse.md +31 -0
  24. package/docs/api/interfaces/LeaderBoardDetailsT.md +19 -0
  25. package/docs/api/interfaces/LeaderBoardUserT.md +14 -2
  26. package/docs/api/interfaces/TAvatarPrompt.md +2 -2
  27. package/docs/api/interfaces/TMissionOrBadgeTask.md +16 -0
  28. package/docs/api/interfaces/UserAchievementTask.md +16 -0
  29. package/docs/native/PROTOCOL.md +37 -7
  30. package/docs/ui/avatars/UIGuide_avatarsCustomize.md +69 -0
  31. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +15 -0
  32. package/package.json +1 -1
  33. package/src/Avatars/AvatarCustomizeErrorCode.ts +7 -5
  34. package/src/Avatars/AvatarCustomizeResponse.ts +17 -0
  35. package/src/Avatars/index.ts +1 -0
  36. package/src/CustomSections/AchCustomSection.ts +1 -0
  37. package/src/Leaderboard/LeaderBoards.ts +9 -12
  38. package/src/Missions/UserAchievement.ts +2 -0
  39. package/src/Missions/UserAchievementTask.ts +4 -0
  40. package/src/SmarticoAPI.ts +84 -3
  41. package/src/WSAPI/WSAPIAvatars.ts +121 -0
  42. package/src/WSAPI/WSAPILeaderBoard.ts +91 -14
  43. package/src/WSAPI/WSAPITypes.ts +22 -5
  44. package/tsconfig.json +3 -1
package/README.md CHANGED
@@ -74,9 +74,9 @@ The SDK surface is split across one class per feature area, joined by an interna
74
74
  | **Jackpots** | [`WSAPIJackpots`](docs/api/classes/WSAPIJackpots.md) | `jackpotGet`, `jackpotOptIn`, `jackpotOptOut`, `getJackpotWinners`, `getJackpotEligibleGames` | [`jackpotGet`](docs/ui/jackpots/UIGuide_jackpotGet.md) · [`jackpotOptIn`](docs/ui/jackpots/UIGuide_jackpotOptIn.md) · [`jackpotOptOut`](docs/ui/jackpots/UIGuide_jackpotOptOut.md) · [`getJackpotWinners`](docs/ui/jackpots/UIGuide_getJackpotWinners.md) · [`getJackpotEligibleGames`](docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md) |
75
75
  | **Raffles / Draws** | [`WSAPIRaffles`](docs/api/classes/WSAPIRaffles.md) | `getRaffles`, `getRaffleDrawRun`, `getRaffleDrawRunsHistory`, `claimRafflePrize`, `requestRaffleOptin`, `getRaffleWonPrizes` | [`getRaffles`](docs/ui/raffles/UIGuide_getRaffles.md) · [`getRaffleDrawRun`](docs/ui/raffles/UIGuide_getRaffleDrawRun.md) · [`getRaffleDrawRunsHistory`](docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md) · [`claimRafflePrize`](docs/ui/raffles/UIGuide_claimRafflePrize.md) · [`requestRaffleOptin`](docs/ui/raffles/UIGuide_requestRaffleOptin.md) · [`getRaffleWonPrizes`](docs/ui/raffles/UIGuide_getRaffleWonPrizes.md) |
76
76
  | **MiniGames / SAW** | [`WSAPIMiniGames`](docs/api/classes/WSAPIMiniGames.md) | `getMiniGames`, `getMiniGamesHistory`, `playMiniGame`, `miniGameWinAcknowledgeRequest`, `playMiniGameBatch` | [`getMiniGames`](docs/ui/minigames/UIGuide_getMiniGames.md) · [`getMiniGamesHistory`](docs/ui/minigames/UIGuide_getMiniGamesHistory.md) · [`playMiniGame`](docs/ui/minigames/UIGuide_playMiniGame.md) · [`playMiniGameBatch`](docs/ui/minigames/UIGuide_playMiniGameBatch.md) |
77
- | **Avatars** | [`WSAPIAvatars`](docs/api/classes/WSAPIAvatars.md) | `getAvatarsList`, `getAvatarsCustomized`, `getAvatarPrompts`, `setAvatar` | [`getAvatarsList`](docs/ui/avatars/UIGuide_getAvatarsList.md) · [`getAvatarsCustomized`](docs/ui/avatars/UIGuide_getAvatarsCustomized.md) · [`getAvatarPrompts`](docs/ui/avatars/UIGuide_getAvatarPrompts.md) · [`setAvatar`](docs/ui/avatars/UIGuide_setAvatar.md) |
77
+ | **Avatars** | [`WSAPIAvatars`](docs/api/classes/WSAPIAvatars.md) | `getAvatarsList`, `getAvatarsCustomized`, `getAvatarPrompts`, `setAvatar`, `avatarsCustomize` | [`getAvatarsList`](docs/ui/avatars/UIGuide_getAvatarsList.md) · [`getAvatarsCustomized`](docs/ui/avatars/UIGuide_getAvatarsCustomized.md) · [`getAvatarPrompts`](docs/ui/avatars/UIGuide_getAvatarPrompts.md) · [`setAvatar`](docs/ui/avatars/UIGuide_setAvatar.md) · [`avatarsCustomize`](docs/ui/avatars/UIGuide_avatarsCustomize.md) |
78
78
  | **Game Pick (sports / quiz)** | [`WSAPIGamePick`](docs/api/classes/WSAPIGamePick.md) | `gamePickGet*`, `gamePickSubmit*` (9 methods) | [`gamePickGetActiveRounds`](docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md) · [`gamePickGetActiveRound`](docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md) · [`gamePickGetHistory`](docs/ui/gamepick/UIGuide_gamePickGetHistory.md) · [`gamePickGetBoard`](docs/ui/gamepick/UIGuide_gamePickGetBoard.md) · [`gamePickSubmitSelection`](docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md) · [`gamePickSubmitSelectionQuiz`](docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md) · [`gamePickGetUserInfo`](docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md) · [`gamePickGetGameInfo`](docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md) · [`gamePickGetRoundInfoForUser`](docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md) |
79
- | **Leaderboard** | [`WSAPILeaderBoard`](docs/api/classes/WSAPILeaderBoard.md) | `getLeaderBoard` | [`getLeaderBoard`](docs/ui/leaderboard/UIGuide_getLeaderBoard.md) |
79
+ | **Leaderboard** | [`WSAPILeaderBoard`](docs/api/classes/WSAPILeaderBoard.md) | `getLeaderBoard`, `getLeaderBoards` | [`getLeaderBoard`](docs/ui/leaderboard/UIGuide_getLeaderBoard.md) |
80
80
  | **Inbox / Messages / Engagement** | [`WSAPIInbox`](docs/api/classes/WSAPIInbox.md) | `getInboxMessages`, `getInboxUnreadCount`, `getInboxMessageBody`, `markInboxMessageAsRead`, `markAllInboxMessagesAsRead`, `markUnmarkInboxMessageAsFavorite`, `deleteInboxMessage`, `deleteAllInboxMessages`, `reportImpressionEvent`, `reportClickEvent` | [`getInboxMessages`](docs/ui/inbox/UIGuide_getInboxMessages.md) · [`getInboxMessageBody`](docs/ui/inbox/UIGuide_getInboxMessageBody.md) · [`markInboxMessageAsRead`](docs/ui/inbox/UIGuide_markInboxMessageAsRead.md) · [`markUnmarkInboxMessageAsFavorite`](docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md) · [`deleteInboxMessage`](docs/ui/inbox/UIGuide_deleteInboxMessage.md) |
81
81
 
82
82
  The shared return / param types live in [`WSAPITypes`](docs/api/classes/WSAPITypes.md). For the full type / enum / interface listing, see [`docs/api/globals.md`](docs/api/globals.md).
@@ -1,5 +1,11 @@
1
+ /**
2
+ * Limit error codes returned in `errCode` by the `avatarsCustomize` method.
3
+ * See the `avatarsCustomize` TSDoc for the full table (including the generic
4
+ * `-1` failure, which has no named member here).
5
+ */
1
6
  export declare enum AvatarCustomizeErrorCode {
7
+ /** The user has reached the operator-configured per-user monthly cap on custom-avatar generations. */
2
8
  AVATAR_USER_LIMIT = 12001,
9
+ /** The brand's operator-configured shared monthly pool of custom-avatar generations is exhausted. */
3
10
  AVATAR_LABEL_LIMIT = 12002
4
11
  }
5
- export declare const AvatarCustomizeErrorMessage: Record<AvatarCustomizeErrorCode, string>;
@@ -0,0 +1,16 @@
1
+ import { AvatarCustomizeErrorCode } from './AvatarCustomizeErrorCode';
2
+ /**
3
+ * Result of `_smartico.api.avatarsCustomize()`. On success only `cdn_url` is
4
+ * set; on failure only `errCode` / `errMessage`.
5
+ */
6
+ export interface AvatarCustomizeResponse {
7
+ /** CDN URL of the generated avatar variant. Present on success. */
8
+ cdn_url?: string;
9
+ /** Error code. Present on failure. Typed values are members of
10
+ * {@link AvatarCustomizeErrorCode}; `-1` is a generic failure. See the
11
+ * `avatarsCustomize` TSDoc for the full table. */
12
+ errCode?: AvatarCustomizeErrorCode | number;
13
+ /** Optional error message. Present on failure; the generic (`-1`) message
14
+ * is fixed text, so branch on `errCode`, not this string. */
15
+ errMessage?: string;
16
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './AvatarCustomizeErrorCode';
2
+ export * from './AvatarCustomizeResponse';
2
3
  export * from './AvatarDefinition';
3
4
  export * from './AvatarCustomized';
4
5
  export * from './AvatarPrompt';
@@ -43,5 +43,6 @@ export declare enum LiquidEntityData {
43
43
  Badges = 9,
44
44
  Tournament = 10,
45
45
  Raffles = 11,
46
- SingleRaffle = 12
46
+ SingleRaffle = 12,
47
+ Clans = 13
47
48
  }
@@ -5,6 +5,10 @@ export interface UserAchievementTask {
5
5
  task_id?: number;
6
6
  task_public_meta?: AchievementTaskPublicMeta;
7
7
  points_reward?: number;
8
+ /** Gems awarded when this task is completed. */
9
+ gems_reward?: number;
10
+ /** Diamonds awarded when this task is completed. */
11
+ diamonds_reward?: number;
8
12
  task_type_id: AchievementTaskType;
9
13
  isCompleted?: boolean;
10
14
  userExecutedCount?: number;
@@ -28,6 +28,7 @@ import { GetAvatarsListResponse } from './Avatars/GetAvatarsListResponse';
28
28
  import { GetAvatarsCustomizedResponse } from './Avatars/GetAvatarsCustomizedResponse';
29
29
  import { GetAvatarPromptsResponse } from './Avatars/GetAvatarPromptsResponse';
30
30
  import { SetAvatarResponse } from './Avatars';
31
+ import { AvatarCustomizeResponse } from './Avatars/AvatarCustomizeResponse';
31
32
  import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
32
33
  import { GetJackpotEligibleGamesResponse, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
33
34
  import { GamePickGameInfo, GamePickRound, GamePickRoundBoard, GamePickUserInfo, GamesApiResponse } from './GamePick';
@@ -61,6 +62,7 @@ declare class SmarticoAPI {
61
62
  private gamesApiUrl;
62
63
  private baseRgApiParams;
63
64
  avatarDomain: string;
65
+ private avatarOriginDomain;
64
66
  private envId;
65
67
  private logger;
66
68
  private logCIDs;
@@ -76,6 +78,7 @@ declare class SmarticoAPI {
76
78
  static getPublicUrl(label_api_key: string): string;
77
79
  static getPublicWsUrl(label_api_key: string): string;
78
80
  static getAvatarUrl(label_api_key: string): string;
81
+ static getAvatarOriginUrl(label_api_key: string): string;
79
82
  private send;
80
83
  private buildMessage;
81
84
  coreReportCustomEvent(user_ext_id: string, eventType: string, payload?: any): Promise<any>;
@@ -155,8 +158,10 @@ declare class SmarticoAPI {
155
158
  tournamentsGetInfo(user_ext_id: string, tournamentInstanceId: number, force_language?: string): Promise<GetTournamentInfoResponse>;
156
159
  tournamentsGetInfoT(user_ext_id: string, tournamentInstanceId: number): Promise<TTournamentDetailed>;
157
160
  clanTournamentGetPlayers(user_ext_id: string, tournament_instance_id: number, clan_id: number, force_language?: string): Promise<TClanTournamentPlayers>;
158
- leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean, force_language?: string): Promise<LeaderBoardDetails>;
159
- leaderboardsGetT(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean): Promise<LeaderBoardDetailsT>;
161
+ leaderboardGet(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean | number, force_language?: string): Promise<LeaderBoardDetails>;
162
+ leaderboardsGetT(user_ext_id: string, period_type_id?: LeaderBoardPeriodType, prevPeriod?: boolean | number): Promise<LeaderBoardDetailsT>;
163
+ leaderboardsGetList(user_ext_id: string, force_language?: string): Promise<LeaderBoardDetails[]>;
164
+ leaderboardsGetListT(user_ext_id: string): Promise<LeaderBoardDetailsT[]>;
160
165
  levelsGet(user_ext_id: string, force_language?: string): Promise<GetLevelMapResponse>;
161
166
  levelsGetT(user_ext_id: string): Promise<TLevel[]>;
162
167
  getLevelCurrent(user_ext_id: string): Promise<TLevelCurrent>;
@@ -175,6 +180,7 @@ declare class SmarticoAPI {
175
180
  deleteAllInboxMessages(user_ext_id: string): Promise<MarkInboxMessageDeletedResponse>;
176
181
  private buildGamesApiParams;
177
182
  private sendGamesApi;
183
+ private sendAvatarApi;
178
184
  gpGetActiveRounds(saw_template_id: number): Promise<GamesApiResponse<GamePickRound[]>>;
179
185
  gpGetActiveRound(saw_template_id: number, round_id?: number): Promise<GamesApiResponse<GamePickRound>>;
180
186
  gpGetGamesHistory(saw_template_id: number): Promise<GamesApiResponse<GamePickRound[]>>;
@@ -188,6 +194,13 @@ declare class SmarticoAPI {
188
194
  avatarsGetCustomized(user_ext_id: string): Promise<GetAvatarsCustomizedResponse>;
189
195
  avatarsGetPrompts(user_ext_id: string): Promise<GetAvatarPromptsResponse>;
190
196
  avatarSetAvatar(user_ext_id: string, avatar_id: string, avatar_real_id: number): Promise<SetAvatarResponse>;
197
+ avatarsCustomize(params: {
198
+ label_id: number;
199
+ user_id: number;
200
+ prompt_id: number;
201
+ avatar_url: string;
202
+ avatar_real_id: number;
203
+ }): Promise<AvatarCustomizeResponse>;
191
204
  avatarsGetListT(user_ext_id: string): Promise<TAvatarDefinition[]>;
192
205
  avatarsGetCustomizedT(user_ext_id: string): Promise<TAvatarCustomized[]>;
193
206
  avatarsGetPromptsT(user_ext_id: string): Promise<TAvatarPrompt[]>;
@@ -1,5 +1,6 @@
1
1
  import { TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TSetAvatarResult } from './WSAPITypes';
2
2
  import { WSAPIMiniGames } from './WSAPIMiniGames';
3
+ import { AvatarCustomizeResponse } from '../Avatars/AvatarCustomizeResponse';
3
4
  /** @group Avatars */
4
5
  export declare class WSAPIAvatars extends WSAPIMiniGames {
5
6
  /**
@@ -293,4 +294,106 @@ export declare class WSAPIAvatars extends WSAPIMiniGames {
293
294
  avatar_url: string;
294
295
  avatar_real_id: number;
295
296
  }): Promise<TSetAvatarResult>;
297
+ /**
298
+ * Generates an AI-customized variant of a base avatar by applying an
299
+ * operator-defined style prompt, returning the CDN URL of the result.
300
+ * This is a paid, generate-only step: it does NOT change the user's
301
+ * active avatar — pass the returned `cdn_url` to {@link setAvatar} to
302
+ * activate it.
303
+ *
304
+ * @remarks
305
+ * **Preconditions**
306
+ * - Authenticated session required; not available in visitor mode (throws).
307
+ * - All five fields are mandatory — the SDK throws synchronously
308
+ * (`Error("<field> is required")`) if any is missing or zero.
309
+ * - `prompt_id` must be one of the prompts from {@link getAvatarPrompts};
310
+ * `avatar_url` / `avatar_real_id` identify the base avatar to style.
311
+ *
312
+ * **Cost**
313
+ * Each generation costs the currency the operator configured on the
314
+ * chosen prompt (points, gems, or diamonds — some prompts are free; read
315
+ * `cost_currency_type_id` / `cost_value` from the {@link getAvatarPrompts}
316
+ * entry to gate the UI before calling). The cost is charged only on
317
+ * success; if the user can't afford it the call fails with `errCode -1`
318
+ * and nothing is generated or charged.
319
+ *
320
+ * **Latency**
321
+ * Generation runs server-side AI image synthesis and is synchronous from
322
+ * the caller's side — expect several seconds (roughly 5–20 s) before the
323
+ * promise resolves. There is no SDK cache and no push/subscription; show
324
+ * a loading state for the full duration and disable the trigger to
325
+ * prevent duplicate submissions.
326
+ *
327
+ * **Result & error codes**
328
+ * On success the result has `cdn_url` set; on failure it has `errCode` /
329
+ * `errMessage` set and no `cdn_url`. Branch on `errCode` — the generic
330
+ * message is fixed text, not cause-specific:
331
+ * - `12001` (`AvatarCustomizeErrorCode.AVATAR_USER_LIMIT`) — the user hit
332
+ * their monthly per-user generation cap. Nothing is generated or charged.
333
+ * - `12002` (`AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT`) — the brand's
334
+ * shared monthly pool is exhausted. Nothing is generated or charged;
335
+ * surface a "try again later" message.
336
+ * - `-1` — generic failure: insufficient balance, an unavailable prompt,
337
+ * or a generation error. Nothing is charged. Allow the user to retry.
338
+ *
339
+ * Both monthly caps are operator-configured and reset at the start of
340
+ * each calendar month.
341
+ *
342
+ * **Side effects (on success)**
343
+ * The generated variant is persisted to the user's customization history
344
+ * and counts toward the monthly caps **whether or not** it is later
345
+ * activated — generation is not reversible. The SDK clears the
346
+ * {@link getAvatarsCustomized} cache so the next call surfaces the new
347
+ * variant. The user's active avatar is unchanged until you call
348
+ * {@link setAvatar} with the returned `cdn_url`.
349
+ *
350
+ * **Idempotency**: not idempotent — each successful call generates (and
351
+ * charges for) a new variant. Guard the call site against double-clicks.
352
+ *
353
+ * **UI guidance**: see [UI Guide — `avatarsCustomize`](../../docs/ui/avatars/UIGuide_avatarsCustomize.md).
354
+ *
355
+ * **Visitor mode**: not supported (throws).
356
+ *
357
+ * @param props.label_id Numeric Smartico label (brand) ID the user belongs to.
358
+ * @param props.user_id Numeric Smartico user ID.
359
+ * @param props.prompt_id Style-prompt ID (`prompt_id`) from {@link getAvatarPrompts}.
360
+ * @param props.avatar_url CDN URL of the base avatar to customize.
361
+ * @param props.avatar_real_id `avatar_real_id` of the base avatar.
362
+ * @returns {@link AvatarCustomizeResponse} — `cdn_url` set on success;
363
+ * `errCode` / `errMessage` set on failure.
364
+ *
365
+ * @example
366
+ * ```ts
367
+ * // label_id / user_id identify the Smartico user being customized.
368
+ * const prompts = await window._smartico.api.getAvatarPrompts();
369
+ * const prompt = prompts[0];
370
+ *
371
+ * console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
372
+ * const result = await window._smartico.api.avatarsCustomize({
373
+ * label_id,
374
+ * user_id,
375
+ * prompt_id: prompt.prompt_id,
376
+ * avatar_url: baseAvatar.avatar_url,
377
+ * avatar_real_id: baseAvatar.avatar_real_id,
378
+ * });
379
+ *
380
+ * if (result.cdn_url) {
381
+ * console.log('[smartico] generation succeeded — preview this URL, then call setAvatar to apply it:', result.cdn_url);
382
+ * // await window._smartico.api.setAvatar({ avatar_url: result.cdn_url, avatar_real_id: baseAvatar.avatar_real_id });
383
+ * } else if (result.errCode === 12001) {
384
+ * console.error('[smartico] user monthly limit reached — show "you have used all your custom avatars this month"');
385
+ * } else if (result.errCode === 12002) {
386
+ * console.error('[smartico] brand monthly pool exhausted — show "custom avatars are unavailable right now, try later"');
387
+ * } else {
388
+ * console.error('[smartico] generation failed (e.g. not enough balance) — let the user retry:', result.errMessage);
389
+ * }
390
+ * ```
391
+ */
392
+ avatarsCustomize(props: {
393
+ label_id: number;
394
+ user_id: number;
395
+ prompt_id: number;
396
+ avatar_url: string;
397
+ avatar_real_id: number;
398
+ }): Promise<AvatarCustomizeResponse>;
296
399
  }
@@ -12,7 +12,9 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
12
12
  *
13
13
  * The leaderboard for each period type is configured separately by
14
14
  * the operator. A label may have any combination of DAILY, WEEKLY,
15
- * and MONTHLY boards configured (or none).
15
+ * and MONTHLY boards configured (or none). To discover which boards
16
+ * exist before loading any standings, call {@link getLeaderBoards}
17
+ * (metadata only) and drive the tab selector from its `period_type_id`s.
16
18
  *
17
19
  * @remarks
18
20
  * **Return value note** — the runtime may return `undefined` if no
@@ -24,10 +26,13 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
24
26
  * Pass a `periodType` from {@link LeaderBoardPeriodType}
25
27
  * (`DAILY = 1`, `WEEKLY = 2`, `MONTHLY = 3`). Pass
26
28
  * `getPreviousPeriod: true` to fetch the most-recently-ended
27
- * period's snapshot (yesterday's results, last week's results,
28
- * last month's results) instead of the current live period. The
29
- * SDK only exposes one period back — older snapshots are not
30
- * reachable through this method.
29
+ * period's snapshot (yesterday's / last week's / last month's
30
+ * results) instead of the current live period. To reach older
31
+ * snapshots, pass a number instead of a boolean: `1` = previous
32
+ * period, `2` = the one before that, and so on (`0` / `false` =
33
+ * current). Use the snapshot's `create_date` / `version_id` to label
34
+ * which historical run a previous-period board is. How far back
35
+ * snapshots are retained is operator-configured.
31
36
  *
32
37
  * **Top-20 cap**
33
38
  * The server hard-caps `users[]` at 20 entries, ordered by
@@ -81,10 +86,11 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
81
86
  * Selects which pre-configured board to
82
87
  * fetch; the board itself is bound to one
83
88
  * period by the operator.
84
- * @param getPreviousPeriod When `true`, returns the most recent
85
- * finalized snapshot for that period type
86
- * (e.g. last week's results). Defaults to
87
- * `false` (current in-progress period).
89
+ * @param getPreviousPeriod Which period to fetch. `false` (default)
90
+ * = current in-progress period; `true` =
91
+ * the most recent finalized snapshot; a
92
+ * number `n` = the n-th previous snapshot
93
+ * (`1` = previous, `2` = the one before, …).
88
94
  * @returns Promise resolving to `LeaderBoardDetailsT`.
89
95
  * **At runtime, may resolve to `undefined`**
90
96
  * when no board is configured for the
@@ -127,5 +133,65 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
127
133
  * // const visitorBoard = await window._smartico.vapi('EN').getLeaderBoard(LeaderBoardPeriodType.DAILY);
128
134
  * ```
129
135
  */
130
- getLeaderBoard(periodType: LeaderBoardPeriodType, getPreviousPeriod?: boolean): Promise<LeaderBoardDetailsT>;
136
+ getLeaderBoard(periodType: LeaderBoardPeriodType, getPreviousPeriod?: boolean | number): Promise<LeaderBoardDetailsT>;
137
+ /**
138
+ * Returns the list of leaderboards the operator has configured for this
139
+ * label — **metadata only, without participants**. Use it to discover
140
+ * which boards exist (and their period types) so you can render the
141
+ * board/tab selector, then load a specific board's standings on demand
142
+ * with {@link getLeaderBoard}.
143
+ *
144
+ * This is the lightweight discovery counterpart to {@link getLeaderBoard}:
145
+ * it issues one round-trip that returns every board's identity, name,
146
+ * description, rules, `period_type_id`, and prize table, but **not** the
147
+ * ranked players. Fetching the full standings for one board (the top-20
148
+ * `users[]` and the caller's own `me` entry) is what {@link getLeaderBoard}
149
+ * does per period.
150
+ *
151
+ * @remarks
152
+ * **Returned shape**
153
+ * An array of `LeaderBoardDetailsT`, one per configured board, ordered by
154
+ * `period_type_id` ascending (DAILY, WEEKLY, MONTHLY, …). On every entry
155
+ * `users` is an empty array and `me` is `undefined` — this call never
156
+ * carries participant data. Read `period_type_id` from each entry and pass
157
+ * it to {@link getLeaderBoard} to load that board's standings.
158
+ *
159
+ * **Empty result**
160
+ * Resolves to an empty array when the label has no leaderboards configured
161
+ * — treat that as "hide the leaderboard surface".
162
+ *
163
+ * **Cache TTL**
164
+ * Cached for 30 seconds under a dedicated key (independent of
165
+ * {@link getLeaderBoard}'s per-period cache). Repeated calls within the
166
+ * window return the cached list without a round-trip.
167
+ *
168
+ * **Refresh model**: one-shot fetch — no subscription, no push. Board
169
+ * configuration changes surface on the next cache miss.
170
+ *
171
+ * **Idempotency / Side effects**: safe. Read-only.
172
+ *
173
+ * **Visitor mode**: supported. Returns the brand's public board list.
174
+ *
175
+ * @returns Promise resolving to the array of configured boards
176
+ * (metadata only). Empty array when none are configured.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const boards = await window._smartico.api.getLeaderBoards();
181
+ *
182
+ * if (boards.length === 0) {
183
+ * console.log('[smartico] no leaderboards configured — hide the leaderboard surface');
184
+ * return;
185
+ * }
186
+ *
187
+ * // Render one tab per board from the lightweight list (no players yet).
188
+ * console.log('[smartico] render leaderboard tabs:', boards.map(b => b.name));
189
+ *
190
+ * // When the user opens a tab, load that board's standings on demand.
191
+ * const first = boards[0];
192
+ * const full = await window._smartico.api.getLeaderBoard(first.period_type_id);
193
+ * console.log('[smartico] loaded standings for', first.name, '—', full?.users.length ?? 0, 'players');
194
+ * ```
195
+ */
196
+ getLeaderBoards(): Promise<LeaderBoardDetailsT[]>;
131
197
  }
@@ -899,6 +899,10 @@ export interface TMissionOrBadgeTask {
899
899
  progress: number;
900
900
  /** Reward for completing the task in points */
901
901
  points_reward: number;
902
+ /** Reward for completing the task in gems */
903
+ gems_reward?: number;
904
+ /** Reward for completing the task in diamonds */
905
+ diamonds_reward?: number;
902
906
  /** This is the total number of times the user needs to execute to complete task. e.g. he needs to bet 100 times. Here will be 100 */
903
907
  execution_count_expected?: number;
904
908
  /** This is the number of times the user has executed 'activity' of the task. e.g. he bet 5 times out of 100. Here will be 5 */
@@ -1040,9 +1044,16 @@ export interface LeaderBoardDetailsT {
1040
1044
  rules: string;
1041
1045
  /** Period type this board is bound to ({@link LeaderBoardPeriodType}). */
1042
1046
  period_type_id: LeaderBoardPeriodType;
1047
+ /** Snapshot version. `0` for the live current period; a positive value
1048
+ * identifies a finalized previous-period snapshot (see `getPreviousPeriod`). */
1049
+ version_id: number;
1050
+ /** Snapshot creation timestamp (Unix ms). `0` for the live current period;
1051
+ * the finalization time for a previous-period snapshot. */
1052
+ create_date: number;
1043
1053
  /** Per-place prize table; the array length is the number of paid places. */
1044
1054
  rewards: LeaderBoardsRewardsT[];
1045
- /** Top-20 ranked entries (server-capped), sorted by `position` ASC. */
1055
+ /** Top-20 ranked entries (server-capped), sorted by `position` ASC.
1056
+ * Empty when fetched via `getLeaderBoards()` (metadata-only list). */
1046
1057
  users: LeaderBoardUserT[];
1047
1058
  /** Current user's own entry. `undefined` for visitor sessions.
1048
1059
  * For authenticated users, `position === -1` means the user is
@@ -1065,14 +1076,20 @@ export interface LeaderBoardsRewardsT {
1065
1076
  export interface LeaderBoardUserT {
1066
1077
  /** Display username (operator-defined alias). */
1067
1078
  public_username: string;
1068
- /** Resolved CDN URL for the participant's avatar. */
1079
+ /** Resolved CDN URL for the participant's avatar. May be empty when the
1080
+ * participant has no custom avatar — fall back to a level-based default
1081
+ * using `level_id`. */
1069
1082
  avatar_url: string;
1083
+ /** The participant's level id — use it to resolve a level-based default
1084
+ * avatar when `avatar_url` is empty. */
1085
+ level_id: number;
1070
1086
  /** Rank in the leaderboard (DENSE_RANK over all participants).
1071
1087
  * `-1` on the `me` entry signals "unranked / outside the window". */
1072
1088
  position: number;
1073
1089
  /** Participant's points for this period. */
1074
1090
  points: number;
1075
- /** `true` when this row is the current authenticated user. */
1091
+ /** `true` when this row is the current authenticated user. Always `true`
1092
+ * on the `me` entry. */
1076
1093
  is_me: boolean;
1077
1094
  }
1078
1095
  /**
@@ -1675,9 +1692,9 @@ export interface TAvatarPrompt {
1675
1692
  name: string;
1676
1693
  /** Absolute CDN URL of the prompt's preview icon. */
1677
1694
  icon_url: string;
1678
- /** Currency used to pay for the customization. `0` = points, `1` = gems, `2` = diamonds. */
1695
+ /** Currency used to pay for the customization. `0` = points, `1` = gems, `2` = diamonds, `3` = free. A `cost_value` of `0` is also free. */
1679
1696
  cost_currency_type_id: number;
1680
- /** Cost amount in the currency named by `cost_currency_type_id`. */
1697
+ /** Cost amount in the currency named by `cost_currency_type_id`. `0` = free. */
1681
1698
  cost_value: number;
1682
1699
  }
1683
1700
  /**