@smartico/public-api 0.0.402 → 0.0.404
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/.claude/skills/api-tsdoc/SKILL.md +675 -0
- package/.claude/skills/api-tsdoc-final/SKILL.md +266 -0
- package/.claude/skills/api-tsdoc-howto/SKILL.md +143 -0
- package/dist/MiniGames/SAWTemplate.d.ts +4 -0
- package/dist/NodeCache.d.ts +1 -0
- package/dist/OCache.d.ts +7 -0
- package/dist/SmarticoGlobal.d.ts +0 -6
- package/dist/WSAPI/WSAPITypes.d.ts +43 -0
- package/dist/WSAPI/WSAPIUser.d.ts +3 -0
- package/dist/index.js +92 -33
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +60 -10
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/interfaces/TUserProfile.md +136 -0
- package/docs/capabilities/_responses/buyStoreItem.json +4 -0
- package/docs/capabilities/_responses/claimBonus.json +4 -0
- package/docs/capabilities/_responses/gamePickGetActiveRound.json +95 -0
- package/docs/capabilities/_responses/gamePickGetActiveRounds.json +191 -0
- package/docs/capabilities/_responses/gamePickGetBoard.json +47 -0
- package/docs/capabilities/_responses/gamePickGetGameInfo.json +355 -0
- package/docs/capabilities/_responses/gamePickGetHistory.json +191 -0
- package/docs/capabilities/_responses/gamePickGetUserInfo.json +14 -0
- package/docs/capabilities/_responses/getAchCategories.json +12 -0
- package/docs/capabilities/_responses/getActivityLog.json +1 -0
- package/docs/capabilities/_responses/getAvatarPrompts.json +16 -0
- package/docs/capabilities/_responses/getAvatarsCustomized.json +12 -0
- package/docs/capabilities/_responses/getAvatarsList.json +24 -0
- package/docs/capabilities/_responses/getBadges.json +98 -0
- package/docs/capabilities/_responses/getBonuses.json +18 -0
- package/docs/capabilities/_responses/getClanInfo.json +39 -0
- package/docs/capabilities/_responses/getClans.json +35 -0
- package/docs/capabilities/_responses/getCurrentLevel.json +20 -0
- package/docs/capabilities/_responses/getCustomSections.json +25 -0
- package/docs/capabilities/_responses/getInboxMessageBody.json +7 -0
- package/docs/capabilities/_responses/getInboxMessages.json +18 -0
- package/docs/capabilities/_responses/getInboxUnreadCount.json +1 -0
- package/docs/capabilities/_responses/getJackpotEligibleGames.json +20 -0
- package/docs/capabilities/_responses/getJackpotWinners.json +28 -0
- package/docs/capabilities/_responses/getLeaderBoard.json +45 -0
- package/docs/capabilities/_responses/getLevels.json +40 -0
- package/docs/capabilities/_responses/getMiniGames.json +208 -0
- package/docs/capabilities/_responses/getMiniGamesHistory.json +1 -0
- package/docs/capabilities/_responses/getMissions.json +117 -0
- package/docs/capabilities/_responses/getRaffleDrawRun.json +62 -0
- package/docs/capabilities/_responses/getRaffleDrawRunsHistory.json +34 -0
- package/docs/capabilities/_responses/getRaffles.json +140 -0
- package/docs/capabilities/_responses/getStoreCategories.json +12 -0
- package/docs/capabilities/_responses/getStoreItems.json +47 -0
- package/docs/capabilities/_responses/getStorePurchasedItems.json +49 -0
- package/docs/capabilities/_responses/getTournamentInstanceInfo.json +75 -0
- package/docs/capabilities/_responses/getTournamentsList.json +66 -0
- package/docs/capabilities/_responses/getTranslations.json +25 -0
- package/docs/capabilities/_responses/getUserLevelExtraCounters.json +4 -0
- package/docs/capabilities/_responses/getUserProfile.json +34 -0
- package/docs/capabilities/_responses/jackpotGet.json +113 -0
- package/docs/capabilities/_responses/jackpotOptIn.json +9 -0
- package/docs/capabilities/_responses/jackpotOptOut.json +9 -0
- package/docs/capabilities/_responses/markAllInboxMessagesAsRead.json +4 -0
- package/docs/capabilities/_responses/markInboxMessageAsRead.json +4 -0
- package/docs/capabilities/_responses/markUnmarkInboxMessageAsFavorite.json +4 -0
- package/docs/capabilities/_responses/miniGameWinAcknowledgeRequest.json +10 -0
- package/docs/capabilities/_responses/playMiniGame.json +6 -0
- package/docs/capabilities/_responses/playMiniGameBatch.json +9 -0
- package/docs/capabilities/_responses/registerInTournament.json +4 -0
- package/docs/capabilities/_responses/requestMissionOptIn.json +4 -0
- package/docs/capabilities/_responses/setAvatar.json +4 -0
- package/docs/capabilities/avatarsCustomize.md +115 -0
- package/docs/capabilities/buyStoreItem.md +179 -0
- package/docs/capabilities/checkSegmentListMatch.md +69 -0
- package/docs/capabilities/checkSegmentMatch.md +74 -0
- package/docs/capabilities/claimBonus.md +125 -0
- package/docs/capabilities/claimRafflePrize.md +116 -0
- package/docs/capabilities/deleteAllInboxMessages.md +66 -0
- package/docs/capabilities/deleteInboxMessage.md +60 -0
- package/docs/capabilities/gamePickGetActiveRound.md +248 -0
- package/docs/capabilities/gamePickGetActiveRounds.md +259 -0
- package/docs/capabilities/gamePickGetBoard.md +202 -0
- package/docs/capabilities/gamePickGetGameInfo.md +318 -0
- package/docs/capabilities/gamePickGetHistory.md +244 -0
- package/docs/capabilities/gamePickGetRoundInfoForUser.md +189 -0
- package/docs/capabilities/gamePickGetUserInfo.md +91 -0
- package/docs/capabilities/gamePickSubmitSelection.md +222 -0
- package/docs/capabilities/gamePickSubmitSelectionQuiz.md +198 -0
- package/docs/capabilities/getAchCategories.md +119 -0
- package/docs/capabilities/getActivityLog.md +108 -0
- package/docs/capabilities/getAvatarPrompts.md +81 -0
- package/docs/capabilities/getAvatarsCustomized.md +96 -0
- package/docs/capabilities/getAvatarsList.md +101 -0
- package/docs/capabilities/getBadges.md +237 -0
- package/docs/capabilities/getBonuses.md +159 -0
- package/docs/capabilities/getClanInfo.md +164 -0
- package/docs/capabilities/getClanTournamentPlayers.md +112 -0
- package/docs/capabilities/getClans.md +168 -0
- package/docs/capabilities/getCurrentLevel.md +123 -0
- package/docs/capabilities/getCustomSections.md +96 -0
- package/docs/capabilities/getInboxMessageBody.md +87 -0
- package/docs/capabilities/getInboxMessages.md +146 -0
- package/docs/capabilities/getInboxUnreadCount.md +54 -0
- package/docs/capabilities/getJackpotEligibleGames.md +93 -0
- package/docs/capabilities/getJackpotWinners.md +113 -0
- package/docs/capabilities/getLeaderBoard.md +187 -0
- package/docs/capabilities/getLeaderBoards.md +88 -0
- package/docs/capabilities/getLevels.md +118 -0
- package/docs/capabilities/getMiniGames.md +295 -0
- package/docs/capabilities/getMiniGamesHistory.md +183 -0
- package/docs/capabilities/getMissions.md +253 -0
- package/docs/capabilities/getRaffleDrawRun.md +210 -0
- package/docs/capabilities/getRaffleDrawRunsHistory.md +116 -0
- package/docs/capabilities/getRaffleWonPrizes.md +153 -0
- package/docs/capabilities/getRaffles.md +249 -0
- package/docs/capabilities/getRelatedItemsForGame.md +236 -0
- package/docs/capabilities/getStoreCategories.md +128 -0
- package/docs/capabilities/getStoreItems.md +260 -0
- package/docs/capabilities/getStorePurchasedItems.md +280 -0
- package/docs/capabilities/getTournamentInstanceInfo.md +301 -0
- package/docs/capabilities/getTournamentsList.md +234 -0
- package/docs/capabilities/getTranslations.md +95 -0
- package/docs/capabilities/getUserLevelExtraCounters.md +92 -0
- package/docs/capabilities/getUserProfile.md +184 -0
- package/docs/capabilities/jackpotGet.md +173 -0
- package/docs/capabilities/jackpotOptIn.md +94 -0
- package/docs/capabilities/jackpotOptOut.md +92 -0
- package/docs/capabilities/joinClan.md +169 -0
- package/docs/capabilities/markAllInboxMessagesAsRead.md +72 -0
- package/docs/capabilities/markInboxMessageAsRead.md +69 -0
- package/docs/capabilities/markUnmarkInboxMessageAsFavorite.md +75 -0
- package/docs/capabilities/miniGameWinAcknowledgeRequest.md +98 -0
- package/docs/capabilities/playMiniGame.md +217 -0
- package/docs/capabilities/playMiniGameBatch.md +129 -0
- package/docs/capabilities/registerInTournament.md +187 -0
- package/docs/capabilities/reportClickEvent.md +74 -0
- package/docs/capabilities/reportImpressionEvent.md +67 -0
- package/docs/capabilities/requestMissionClaimReward.md +117 -0
- package/docs/capabilities/requestMissionOptIn.md +98 -0
- package/docs/capabilities/requestRaffleOptin.md +108 -0
- package/docs/capabilities/setAvatar.md +132 -0
- package/docs/capabilities/smarticoCallbacks.md +165 -0
- package/docs/capabilities/smarticoGlobal.md +62 -0
- package/package.json +3 -2
- package/readme-smartico-dev.md +208 -0
- package/scripts/capture-responses-browser.mjs +301 -0
- package/scripts/gen-capabilities.js +368 -0
- package/scripts/run-public-api.mjs +105 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
- package/src/MiniGames/SAWTemplate.ts +5 -0
- package/src/NodeCache.ts +8 -0
- package/src/OCache.ts +17 -0
- package/src/SmarticoGlobal.ts +0 -7
- package/src/WSAPI/WSAPI.ts +3 -3
- package/src/WSAPI/WSAPIJackpots.ts +4 -1
- package/src/WSAPI/WSAPIMiniGames.ts +1 -1
- package/src/WSAPI/WSAPITypes.ts +44 -0
- package/src/WSAPI/WSAPIUser.ts +30 -5
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# getAvatarsList — API (TAvatarDefinition)
|
|
2
|
+
|
|
3
|
+
> Returns the avatar catalog available to the current user — every pre-defined avatar configured for the label, with per-user unlock flags (`is_given`, `is_in_use`) applied server-side.
|
|
4
|
+
> Import: `import { TAvatarDefinition } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getAvatarsList, avatars, getAvatars, TAvatarDefinition, avatar_real_id, is_default, hide_until_achieved, priority, description, url, avatar_url, avatar_source_type_id
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getAvatarsList(): Promise<TAvatarDefinition[]>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
_None._
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<TAvatarDefinition[]>`
|
|
16
|
+
Array of `TAvatarDefinition`. Each item:
|
|
17
|
+
- `avatar_real_id` (number) — Stable numeric identifier of the avatar. Primary key passed to `setAvatar()`.
|
|
18
|
+
- `is_default` (boolean) — True when this is the system default avatar for the label.
|
|
19
|
+
- `hide_until_achieved` (boolean) — When true and `is_given === false`, the avatar should be hidden from the user (surprise unlock).
|
|
20
|
+
- `priority` (number) — Display position; lower = earlier in the grid.
|
|
21
|
+
- `description` (string) — Optional description shown alongside the avatar in detail views.
|
|
22
|
+
- `url` (string) — Raw image path as returned by the server (relative or absolute).
|
|
23
|
+
- `avatar_url` (string) — Absolute CDN URL of the avatar image; built from the configured avatar domain + `url`.
|
|
24
|
+
- `avatar_source_type_id` (number) — Source type. `0` = free / always available; non-zero = earned or purchased.
|
|
25
|
+
- `active_from_date` (string) — ISO date string from which the avatar becomes available; undefined when no start window.
|
|
26
|
+
- `active_till_date` (string) — ISO date string until which the avatar is available; undefined when no end window.
|
|
27
|
+
- `is_given` (boolean) — True when the user owns / has unlocked this avatar.
|
|
28
|
+
- `is_in_use` (boolean) — True when this avatar is the user's currently active profile avatar.
|
|
29
|
+
|
|
30
|
+
## Behavioral contract
|
|
31
|
+
**Preconditions**
|
|
32
|
+
- User must be authenticated. Visitor mode is not supported.
|
|
33
|
+
- No other prerequisite calls.
|
|
34
|
+
|
|
35
|
+
**Visibility filter** (consumer-applied)
|
|
36
|
+
Avatars with `hide_until_achieved === true && is_given === false` should be filtered
|
|
37
|
+
out of the grid — they represent surprise unlocks that should remain hidden until
|
|
38
|
+
the user earns them. The default Smartico UI drops these before rendering.
|
|
39
|
+
|
|
40
|
+
**Lock state** (consumer-applied)
|
|
41
|
+
Lock condition: `!is_given && avatar_source_type_id !== 0`. Free avatars
|
|
42
|
+
(`avatar_source_type_id === 0`) are always selectable; non-free avatars are locked
|
|
43
|
+
until `is_given` flips to true (operator grants via campaign, mission reward, store
|
|
44
|
+
purchase, etc.).
|
|
45
|
+
|
|
46
|
+
**Sort order**
|
|
47
|
+
Server does NOT pre-sort. Caller must sort by `priority` ascending (lower = first).
|
|
48
|
+
|
|
49
|
+
**Refresh**
|
|
50
|
+
- The SDK caches results for 30 seconds.
|
|
51
|
+
- `setAvatar` clears this cache on completion; the next call re-fetches.
|
|
52
|
+
- No push subscription — there is no `onUpdate` callback for avatar methods.
|
|
53
|
+
- When `is_given` flips server-side (e.g. the user earns a new avatar), the change
|
|
54
|
+
surfaces only on the next call after the 30-second cache window expires.
|
|
55
|
+
|
|
56
|
+
**Visitor mode**: not supported.
|
|
57
|
+
|
|
58
|
+
**UI guidance**: see [UI Guide — `getAvatarsList`](../../docs/ui/avatars/UIGuide_getAvatarsList.md).
|
|
59
|
+
|
|
60
|
+
## Example
|
|
61
|
+
```ts
|
|
62
|
+
const avatars = await window._smartico.api.getAvatarsList();
|
|
63
|
+
|
|
64
|
+
// Apply the standard visibility filter and sort.
|
|
65
|
+
const visible = avatars
|
|
66
|
+
.filter((a) => !a.hide_until_achieved || a.is_given)
|
|
67
|
+
.sort((a, b) => a.priority - b.priority);
|
|
68
|
+
|
|
69
|
+
console.log('[smartico] visible avatars:', visible.length, '— render as a grid');
|
|
70
|
+
|
|
71
|
+
const active = visible.find((a) => a.is_in_use);
|
|
72
|
+
if (active) {
|
|
73
|
+
console.log('[smartico] currently in use — overlay a checkmark on this card:', active.avatar_real_id);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Example response (REAL shape)
|
|
78
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
79
|
+
```json
|
|
80
|
+
[
|
|
81
|
+
{
|
|
82
|
+
"avatar_real_id": 1,
|
|
83
|
+
"is_default": false,
|
|
84
|
+
"hide_until_achieved": false,
|
|
85
|
+
"priority": 1,
|
|
86
|
+
"description": "The Pink toast cat, in space, leaving rainbow trails. What else do you need?",
|
|
87
|
+
"url": "https://cdn.example/83109b74be861920197eb8-cat-space.gif",
|
|
88
|
+
"avatar_url": "https://cdn.example/83109b74be861920197eb8-cat-space.gif",
|
|
89
|
+
"avatar_source_type_id": 7,
|
|
90
|
+
"is_given": false
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Errors
|
|
96
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
97
|
+
|
|
98
|
+
## Related
|
|
99
|
+
- `getAvatarsCustomized`
|
|
100
|
+
- `setAvatar`
|
|
101
|
+
- `TAvatarDefinition`
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# getBadges — API (TMissionOrBadge)
|
|
2
|
+
|
|
3
|
+
> Returns all the badges available to the current user.
|
|
4
|
+
> Import: `import { TMissionOrBadge } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getBadges, missions, getUserBadges, TMissionOrBadge, TMissionOrBadgeTask, AchRelatedGame, TRibbon, AchievementAvailabilityStatus, AchievementClaimPeriodTypeId, BadgesTimeLimitStates, id, name, description, image, is_completed, is_locked, is_requires_optin, is_opted_in
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getBadges(): Promise<TMissionOrBadge[]>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
_None._
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<TMissionOrBadge[]>`
|
|
16
|
+
Array of `TMissionOrBadge`. Each item:
|
|
17
|
+
- `id` (number) — ID of the mission or badge
|
|
18
|
+
- `type` ('mission' | 'badge') — Type of entity. Can be 'mission' or 'badge'
|
|
19
|
+
- `name` (string) — Name of the mission or badge, translated to the user language
|
|
20
|
+
- `sub_header` (string) — Sub-header of the mission, translated to the user language
|
|
21
|
+
- `description` (string) — Description of the mission or badge, translated to the user language
|
|
22
|
+
- `reward` (string) — Description of the mission reward if defined
|
|
23
|
+
- `image` (string) — URL of the image of the mission or badge, 256x256px
|
|
24
|
+
- `is_completed` (boolean) — Indicator if the mission is completed or badge is granted
|
|
25
|
+
- `is_locked` (boolean) — Indicator if the mission is locked. Means that it's visible to the user, but he cannot progress in it until it's unlocked. Mission may optionally contain the explanation of what should be done to unlock it in the unlock_mission_description property
|
|
26
|
+
- `unlock_mission_description` (string) — Optional explaination of what should be done to unlock the mission
|
|
27
|
+
- `is_requires_optin` (boolean) — Indicator if the mission requires opt-in. Means that user should explicitly opt-in to the mission in order to start progressing in it
|
|
28
|
+
- `is_opted_in` (boolean) — Indicator if the user opted-in to the mission
|
|
29
|
+
- `time_limit_ms` (number) — The amount of time in milliseconds that user has to complete the mission
|
|
30
|
+
- `active_from_ts` (number) — Holds time from which mission will become available, for the missions that are targeted to be available from specific date/time
|
|
31
|
+
- `active_till_ts` (number) — Holds time till mission will become unavailable, for the missions that are targeted to be available from specific date/time
|
|
32
|
+
- `dt_start` (number) — The date when the mission was started, relevant for the time limited missions, also indicating opt-it date for mission that requires opt-in and unlock date for Locked mission.
|
|
33
|
+
- `progress` (number) — The progress of the mission in percents calculated as the aggregated relative percentage of all tasks
|
|
34
|
+
- `cta_action` (string) — The action that should be performed when user clicks on the mission or badge Can be URL or deep link, e.g. 'dp:deposit'. The most safe to execute CTA is to pass it to _smartico.dp(cta_action); The 'dp' function will handle the CTA and will execute it in the most safe way
|
|
35
|
+
- `cta_text` (string) — The text of the CTA button, e.g. 'Make a deposit'
|
|
36
|
+
- `custom_section_id` (number) — The ID of the custom section where the mission or badge is assigned. Resolve to section metadata via `_smartico.api.getCustomSections()`.
|
|
37
|
+
- `only_in_custom_section` (boolean) — The indicator if the mission or badge is visible only in the custom section and should be hidden from the main overview of missions/badges
|
|
38
|
+
- `custom_data` (any) — The custom data of the mission or badge defined by operator. Can be a JSON object, string or number
|
|
39
|
+
- `tasks` (TMissionOrBadgeTask[]) — The list of tasks of the mission or badge
|
|
40
|
+
- `id` (number) — ID of the task
|
|
41
|
+
- `name` (string) — Name of the task, translated to the user language
|
|
42
|
+
- `is_completed` (boolean) — Indicator if the task is completed
|
|
43
|
+
- `progress` (number) — The progress of the task in percents
|
|
44
|
+
- `points_reward` (number) — Reward for completing the task in points
|
|
45
|
+
- `gems_reward` (number) — Reward for completing the task in gems
|
|
46
|
+
- `diamonds_reward` (number) — Reward for completing the task in diamonds
|
|
47
|
+
- `execution_count_expected` (number) — 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
|
|
48
|
+
- `execution_count_actual` (number) — 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
|
|
49
|
+
- `related_games` (AchRelatedGame[]) — List of casino games (or other types of entities) related to the mission or badge
|
|
50
|
+
- `ext_game_id` (string) — The ID of the related game
|
|
51
|
+
- `game_public_meta` ({
|
|
52
|
+
/** The name of the game */
|
|
53
|
+
name: string;
|
|
54
|
+
/** The URL to the game */
|
|
55
|
+
link: string;
|
|
56
|
+
/** The URL to the image of the game, 1:1 aspect ratio */
|
|
57
|
+
image: string;
|
|
58
|
+
/** The indicator if the game is enabled */
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
/** The list of categories of the game */
|
|
61
|
+
game_categories: string[];
|
|
62
|
+
/** The name of the game provider */
|
|
63
|
+
game_provider: string;
|
|
64
|
+
/** The URL to the mobile game */
|
|
65
|
+
mobile_spec_link: string;
|
|
66
|
+
/** The priority of the game */
|
|
67
|
+
priority?: number;
|
|
68
|
+
}) — Game public meta information
|
|
69
|
+
- `category_ids` (number[]) — The list of IDs of the categories where the badge item is assigned, information about categories can be retrieved with getAchCategories method
|
|
70
|
+
- `hint_text` (string) — The T&C text for the missions
|
|
71
|
+
- `position` (number) — Priority (or position) of the mission in the UI. Low value indicates higher position in the UI
|
|
72
|
+
- `ribbon` (TRibbon) — The ribbon of the mission/badge item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon, 250x300px
|
|
73
|
+
- `ach_completed_id` (number) — Stable identifier of this specific mission completion. Undefined for badges and for missions that have not yet completed.
|
|
74
|
+
- `requires_prize_claim` (boolean) — Flag from achievement if the mission prize will be given only after user claims it
|
|
75
|
+
- `prize_claimed_date_ts` (number) — The date/timestamp indicating when the prize was claimed by the user
|
|
76
|
+
- `complete_date` (string) — Date-time the mission/badge was completed, as a `"dd/MM/yyyy HH:mm:ss"` string (server local — NOT ISO-8601, so `new Date(complete_date)` will not parse it). Prefer the epoch-ms `complete_date_ts` for date math.
|
|
77
|
+
- `complete_date_ts` (number) — Time of mission/badge being completed, this property shows the epoch time in UTC
|
|
78
|
+
- `completed_today` (boolean) — Flag for mission/badge indicating that mission/badge completed today
|
|
79
|
+
- `completed_this_week` (boolean) — Flag for mission/badge indicating that mission/badge completed this week
|
|
80
|
+
- `completed_this_month` (boolean) — Flag for mission/badge indicating that mission/badge completed this month
|
|
81
|
+
- `custom_section_type_id` (number) — ID of specific Custom Section type
|
|
82
|
+
- `max_completion_count` (number) — Max number of times the user can complete a mission in case if mission type is Recurring upon completion. NULL equals infinite.
|
|
83
|
+
- `completion_count` (number) — Current completion count for Recurring upon completion missions
|
|
84
|
+
- `next_recurrence_date_ts` (number) — The date/timestamp for recurring missions, which indicating the time remaining until the next recurrence of the mission. Note that if a mission has an "Active till" date defined, this field is not relevant after that date.
|
|
85
|
+
- `availability_status` (AchievementAvailabilityStatus) — Availability status of the mission depends on the defined time limits
|
|
86
|
+
- `claim_button_title` (string) — Title for the claim reward button
|
|
87
|
+
- `claim_button_action` (string) — Action for the claim reward button
|
|
88
|
+
- `prize_claim_expiration_date` (number) — The date/timestamp indicating when the mission claim will expire
|
|
89
|
+
- `prize_claim_period_type_id` (AchievementClaimPeriodTypeId) — The type of the prize claim period (Relative or Exact time and date)
|
|
90
|
+
- `badgeTimeLimitState` (BadgesTimeLimitStates) — Badge time limit state for badges with time restrictions
|
|
91
|
+
- `hide_locked_mission` (boolean) — Flag from achievement if the mission should be hidden when it is locked, until it's unlocked
|
|
92
|
+
|
|
93
|
+
## Behavioral contract
|
|
94
|
+
**Why no `onUpdate` callback?**
|
|
95
|
+
Unlike `getMissions({ onUpdate })`, this method does NOT accept an
|
|
96
|
+
`onUpdate` subscription. Internally the SDK never refreshes the `Badges`
|
|
97
|
+
cache from server pushes: the achievement-related push events
|
|
98
|
+
(mission opt-in / claim / reload) refresh the missions cache, NOT
|
|
99
|
+
the badges cache. The badges cache is flushed only by:
|
|
100
|
+
- its 30-second TTL
|
|
101
|
+
- a full SDK cache wipe at login / logout
|
|
102
|
+
|
|
103
|
+
**How to refresh the badge list**
|
|
104
|
+
If you need near-live badge state, poll manually after the TTL expires.
|
|
105
|
+
The first call inside the 30 s window returns the cached payload; the
|
|
106
|
+
first call after the TTL triggers a fresh server round-trip. Example:
|
|
107
|
+
```ts
|
|
108
|
+
setInterval(async () => {
|
|
109
|
+
const badges = await window._smartico.api.getBadges();
|
|
110
|
+
console.log('[smartico] badge list polled — re-render badge grid from this array', badges);
|
|
111
|
+
}, 30_000);
|
|
112
|
+
```
|
|
113
|
+
Alternatively, re-fetch on a domain event your app already handles
|
|
114
|
+
(e.g. after the user finishes a game round or claims a bonus).
|
|
115
|
+
|
|
116
|
+
**Differences from missions** (same `TMissionOrBadge` shape, different
|
|
117
|
+
feature)
|
|
118
|
+
The opt-in, claim, recurring-cycle, and unlock-description fields on
|
|
119
|
+
the returned objects are not populated for badges; treat their values
|
|
120
|
+
as undefined / default. Time windows are absolute calendar timestamps
|
|
121
|
+
(`active_from_ts` / `active_till_ts`), not opt-in-relative durations —
|
|
122
|
+
drive availability chips from the SDK-computed `badgeTimeLimitState`
|
|
123
|
+
(enum `BadgesTimeLimitStates`), not `time_limit_ms`. Locking for
|
|
124
|
+
badges is purely time-based: `is_locked` is `true` only when
|
|
125
|
+
`badgeTimeLimitState === BadgesTimeLimitStates.BeforeStartDate` (the
|
|
126
|
+
time window hasn't started yet). The primary navigation field is
|
|
127
|
+
`category_ids` — call `getAchCategories` to resolve category
|
|
128
|
+
metadata and group badges by category.
|
|
129
|
+
|
|
130
|
+
**Idempotency / Side effects**: fetch-only; safe to call repeatedly.
|
|
131
|
+
The cache layer deduplicates concurrent calls within the TTL window.
|
|
132
|
+
|
|
133
|
+
**Visitor mode**: not supported. Badges are an authenticated-only
|
|
134
|
+
feature; calling this on the visitor-mode handle (`_smartico.vapi`)
|
|
135
|
+
throws synchronously rather than silently returning an empty list.
|
|
136
|
+
|
|
137
|
+
**UI guidance**: see [UI Guide — `getBadges`](../../docs/ui/missions/UIGuide_getBadges.md).
|
|
138
|
+
|
|
139
|
+
## Example
|
|
140
|
+
```ts
|
|
141
|
+
const [badges, categories] = await Promise.all([
|
|
142
|
+
window._smartico.api.getBadges(),
|
|
143
|
+
window._smartico.api.getAchCategories(),
|
|
144
|
+
]);
|
|
145
|
+
|
|
146
|
+
console.log('[smartico] badges fetched — render grouped grid with', badges.length, 'badges across', categories.length, 'categories');
|
|
147
|
+
|
|
148
|
+
for (const category of categories) {
|
|
149
|
+
const inCategory = badges.filter(b => b.category_ids?.includes(category.id));
|
|
150
|
+
const completed = inCategory.filter(b => b.is_completed).length;
|
|
151
|
+
console.log(`[smartico] render category section "${category.name}" header showing ${completed}/${inCategory.length}`);
|
|
152
|
+
|
|
153
|
+
for (const badge of inCategory) {
|
|
154
|
+
// Use badgeTimeLimitState (not time_limit_ms) for availability chip
|
|
155
|
+
if (badge.badgeTimeLimitState === 0) { // BadgesTimeLimitStates.BeforeStartDate
|
|
156
|
+
console.log('[smartico] badge not yet started — render grayscaled card with "Starts on" chip for badge', badge.id);
|
|
157
|
+
} else if (badge.is_completed) {
|
|
158
|
+
console.log('[smartico] badge completed — render with completed styling and check-mark for badge', badge.id);
|
|
159
|
+
} else {
|
|
160
|
+
console.log('[smartico] badge in progress — render with stage counter (completed_tasks / total) for badge', badge.id);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// No onUpdate available — poll if live state matters
|
|
166
|
+
setInterval(async () => {
|
|
167
|
+
try {
|
|
168
|
+
const fresh = await window._smartico.api.getBadges();
|
|
169
|
+
console.log('[smartico] badge poll tick — diff against previous list and re-render any changed badge cards', fresh);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.error('[smartico] badge poll failed — keep showing last known state, retry on next tick:', e);
|
|
172
|
+
}
|
|
173
|
+
}, 30_000);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Example response (REAL shape)
|
|
177
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
178
|
+
```json
|
|
179
|
+
[
|
|
180
|
+
{
|
|
181
|
+
"id": 40733,
|
|
182
|
+
"name": "Deep Blue Bet",
|
|
183
|
+
"description": "Place a bet on Ocean Riches",
|
|
184
|
+
"image": "https://cdn.example/843b3b60ad20cb6df257c5-puzzle_01.webp",
|
|
185
|
+
"is_completed": true,
|
|
186
|
+
"is_locked": false,
|
|
187
|
+
"is_requires_optin": false,
|
|
188
|
+
"is_opted_in": false,
|
|
189
|
+
"time_limit_ms": null,
|
|
190
|
+
"active_from_ts": null,
|
|
191
|
+
"active_till_ts": null,
|
|
192
|
+
"dt_start": null,
|
|
193
|
+
"progress": 100,
|
|
194
|
+
"type": "badge",
|
|
195
|
+
"custom_section_id": 1128,
|
|
196
|
+
"only_in_custom_section": true,
|
|
197
|
+
"custom_data": {},
|
|
198
|
+
"position": 1,
|
|
199
|
+
"tasks": [
|
|
200
|
+
{
|
|
201
|
+
"id": 71250,
|
|
202
|
+
"name": "Place a bet on Ocean Riches",
|
|
203
|
+
"points_reward": 0,
|
|
204
|
+
"gems_reward": null,
|
|
205
|
+
"diamonds_reward": null,
|
|
206
|
+
"is_completed": true,
|
|
207
|
+
"progress": 100,
|
|
208
|
+
"execution_count_expected": 1,
|
|
209
|
+
"execution_count_actual": 1
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"related_games": [],
|
|
213
|
+
"category_ids": [],
|
|
214
|
+
"ach_completed_id": 3410338746,
|
|
215
|
+
"requires_prize_claim": false,
|
|
216
|
+
"prize_claimed_date_ts": null,
|
|
217
|
+
"complete_date": "08/06/2026 20:59:17",
|
|
218
|
+
"complete_date_ts": 1780952357322,
|
|
219
|
+
"completed_today": false,
|
|
220
|
+
"completed_this_week": false,
|
|
221
|
+
"completed_this_month": true,
|
|
222
|
+
"custom_section_type_id": 14,
|
|
223
|
+
"availability_status": 0,
|
|
224
|
+
"hide_locked_mission": true,
|
|
225
|
+
"prize_claim_expiration_date": null,
|
|
226
|
+
"prize_claim_period_type_id": null
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Errors
|
|
232
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
233
|
+
|
|
234
|
+
## Related
|
|
235
|
+
- `getMissions`
|
|
236
|
+
- `BadgesTimeLimitStates`
|
|
237
|
+
- `getAchCategories`
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# getBonuses — API (TBonus)
|
|
2
|
+
|
|
3
|
+
> Returns the bonuses awarded to the current user — both pending (player-claim required) and already-redeemed.
|
|
4
|
+
> Import: `import { TBonus } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getBonuses, bonuses, TBonus, BonusStatus, BonusTemplateMetaMap, BonusMetaMap, onUpdate, subscription, bonus_id, is_redeemable, create_date, redeem_date, label_bonus_template_id, bonus_status_id, label_bonus_template_meta_map, bonus_meta_map
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getBonuses({ onUpdate }: { onUpdate?: (data: TBonus[]) => void } = {}): Promise<TBonus[]>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `params` — Optional. Omit to fetch without subscribing.
|
|
14
|
+
- `params.onUpdate` — Callback invoked with the full refreshed bonuses list after every `claimBonus` resolves. Each call to `getBonuses` overwrites the prior callback.
|
|
15
|
+
|
|
16
|
+
## Returns — `Promise<TBonus[]>`
|
|
17
|
+
Array of `TBonus`. Each item:
|
|
18
|
+
- `bonus_id` (number) — Stable ID of the bonus.
|
|
19
|
+
- `is_redeemable` (boolean) — `true` when the bonus is in a player-claim-required state. Gate the Claim button on this; see `claimBonus` TSDoc.
|
|
20
|
+
- `create_date` (string) — Bonus creation timestamp as ISO 8601 UTC string ("YYYY-MM-DDTHH:MM:SS", no timezone suffix).
|
|
21
|
+
- `redeem_date` (string) — Bonus redemption timestamp as ISO 8601 UTC string. Absent until the bonus reaches `BonusStatus.REDEEMED`.
|
|
22
|
+
- `label_bonus_template_id` (number) — ID of the bonus template used to issue this bonus.
|
|
23
|
+
- `bonus_status_id` (BonusStatus) — Lifecycle status; see `BonusStatus`.
|
|
24
|
+
- `label_bonus_template_meta_map` (BonusTemplateMetaMap) — Template-level display metadata (operator-configured, identical across all bonuses from the same template).
|
|
25
|
+
- `description` (string) — Operator-set description / display text. May include HTML.
|
|
26
|
+
- `acknowledge` (string) — Operator-set additional message shown to the player at claim time (e.g. wagering terms). May include deep-links.
|
|
27
|
+
- `image_url` (string) — Bonus icon URL (1:1 aspect ratio recommended).
|
|
28
|
+
- `redirect_url` (string) — Optional redirect — external HTTP URL (opens in new tab) or internal deep-link (handled by the SDK's deep-link router).
|
|
29
|
+
- `bonus_meta_map` (BonusMetaMap) — Instance-level display metadata (per-issuance; carries the dynamic amount computed at award time).
|
|
30
|
+
- `uiAmount` (string) — Display-ready amount string (e.g. "€50", "100 free spins").
|
|
31
|
+
|
|
32
|
+
## Behavioral contract
|
|
33
|
+
**Subscription model (`onUpdate`)**
|
|
34
|
+
The callback receives the FULL refreshed bonuses list (never a
|
|
35
|
+
diff/patch). Each subsequent call to `getBonuses({ onUpdate })`
|
|
36
|
+
REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
|
|
37
|
+
it) to keep the prior callback in place; the callback is never
|
|
38
|
+
auto-cleared.
|
|
39
|
+
|
|
40
|
+
**Update triggers** — the callback fires after every
|
|
41
|
+
`claimBonus` call resolves on this connection (success OR
|
|
42
|
+
failure). This is the ONLY trigger.
|
|
43
|
+
|
|
44
|
+
Does NOT fire when: a new bonus is awarded server-side
|
|
45
|
+
(CRM rule, mission completion, store purchase, etc.), a bonus
|
|
46
|
+
expires, or an operator manually issues / cancels a bonus. Those
|
|
47
|
+
changes surface only on the next cache miss (after the 30 s TTL).
|
|
48
|
+
Re-call `getBonuses()` manually if your UI needs near-live state
|
|
49
|
+
for server-driven awards.
|
|
50
|
+
|
|
51
|
+
**Reading state from the returned bonus**
|
|
52
|
+
Drive UI bucketing from `bonus_status_id` (enum `BonusStatus`):
|
|
53
|
+
|
|
54
|
+
- `COUPON_ISSUED` (2) — actionable; player must claim. Pair with
|
|
55
|
+
`is_redeemable === true` to gate the Claim button.
|
|
56
|
+
- `REDEEM_FAILED` (4) — also actionable; the previous claim
|
|
57
|
+
attempt failed but the bonus is still valid. Surface a retry CTA
|
|
58
|
+
— the default Smartico UI treats this identically to
|
|
59
|
+
`COUPON_ISSUED` from the player's perspective.
|
|
60
|
+
- `REDEEMED` (3) — historical; show in a "claimed" tab.
|
|
61
|
+
- `New` (1), `COUPON_ISSUE_FAILED` (5), `EXPIRED` (6) — these
|
|
62
|
+
should not normally reach the client and are typically filtered
|
|
63
|
+
out by operator-side widget configuration; if they do appear,
|
|
64
|
+
they have no player-actionable state.
|
|
65
|
+
|
|
66
|
+
`is_redeemable` is the authoritative gate for showing the Claim
|
|
67
|
+
button — it's `true` only when the bonus is in a claimable status
|
|
68
|
+
AND the operator's integration uses a coupon model (where the
|
|
69
|
+
player must explicitly trigger delivery). Auto-redeemed bonuses
|
|
70
|
+
arrive already in `REDEEMED` state with `is_redeemable: false`.
|
|
71
|
+
|
|
72
|
+
**Field hierarchy — display amount**
|
|
73
|
+
Bonuses carry both template-level (`label_bonus_template_meta_map.description`)
|
|
74
|
+
and instance-level (`bonus_meta_map.uiAmount`) display strings.
|
|
75
|
+
Prefer `bonus_meta_map.uiAmount` when present — it's the dynamic
|
|
76
|
+
amount computed at issuance time (e.g. from a dynamic-bonus
|
|
77
|
+
formula). Fall back to `label_bonus_template_meta_map.description`
|
|
78
|
+
(which can include HTML; sanitize before injecting).
|
|
79
|
+
|
|
80
|
+
**Date format**
|
|
81
|
+
`create_date` and `redeem_date` are ISO 8601 UTC strings WITHOUT
|
|
82
|
+
a timezone suffix (`"YYYY-MM-DDTHH:MM:SS"`). Parse as UTC and
|
|
83
|
+
display in the user's local timezone. `redeem_date` is absent
|
|
84
|
+
until the bonus reaches `REDEEMED` status.
|
|
85
|
+
|
|
86
|
+
**Cache TTL**: the SDK caches the response for 30 seconds. Cache
|
|
87
|
+
is fully cleared on login / logout.
|
|
88
|
+
|
|
89
|
+
**Idempotency / Side effects**: safe. Read-only.
|
|
90
|
+
|
|
91
|
+
**UI guidance**: see [UI Guide — `getBonuses`](../../docs/ui/bonuses/UIGuide_getBonuses.md).
|
|
92
|
+
|
|
93
|
+
**Visitor mode**: not supported.
|
|
94
|
+
|
|
95
|
+
## Example
|
|
96
|
+
```ts
|
|
97
|
+
const bonuses = await window._smartico.api.getBonuses({
|
|
98
|
+
onUpdate: (refreshed) => {
|
|
99
|
+
console.log('[smartico] bonuses refreshed (after claimBonus) — re-render the bonuses UI from this array:', refreshed);
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Bucket into pending vs redeemed tabs. The default Smartico UI groups
|
|
104
|
+
// COUPON_ISSUED + REDEEM_FAILED into the same "Pending" tab.
|
|
105
|
+
const pending = bonuses.filter(b =>
|
|
106
|
+
b.bonus_status_id === 2 || b.bonus_status_id === 4 // COUPON_ISSUED or REDEEM_FAILED
|
|
107
|
+
);
|
|
108
|
+
const redeemed = bonuses.filter(b => b.bonus_status_id === 3); // REDEEMED
|
|
109
|
+
|
|
110
|
+
console.log('[smartico] render bonus tabs: pending=', pending.length, 'redeemed=', redeemed.length);
|
|
111
|
+
|
|
112
|
+
// Render each pending bonus card; show Claim button only when redeemable.
|
|
113
|
+
for (const b of pending) {
|
|
114
|
+
const amount = b.bonus_meta_map?.uiAmount || b.label_bonus_template_meta_map?.description;
|
|
115
|
+
if (b.is_redeemable) {
|
|
116
|
+
console.log('[smartico] render Claim button for bonus', b.bonus_id, '— amount:', amount);
|
|
117
|
+
} else {
|
|
118
|
+
console.log('[smartico] render bonus as informational (no Claim button) — amount:', amount);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Server-awarded bonuses (e.g. from a CRM campaign) do NOT push;
|
|
123
|
+
// poll if you need near-live awareness.
|
|
124
|
+
setInterval(async () => {
|
|
125
|
+
const fresh = await window._smartico.api.getBonuses();
|
|
126
|
+
const newCount = fresh.filter(b => b.bonus_status_id === 2 || b.bonus_status_id === 4).length;
|
|
127
|
+
console.log('[smartico] poll tick — pending bonuses now:', newCount);
|
|
128
|
+
}, 30_000);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Example response (REAL shape)
|
|
132
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
133
|
+
```json
|
|
134
|
+
[
|
|
135
|
+
{
|
|
136
|
+
"bonus_id": 910171929,
|
|
137
|
+
"is_redeemable": false,
|
|
138
|
+
"create_date": "09/06/2026 23:05:03",
|
|
139
|
+
"redeem_date": "09/06/2026 23:05:03",
|
|
140
|
+
"label_bonus_template_id": 2152,
|
|
141
|
+
"bonus_status_id": 3,
|
|
142
|
+
"label_bonus_template_meta_map": {
|
|
143
|
+
"name": "",
|
|
144
|
+
"description": "100 Euro Free Chip",
|
|
145
|
+
"image_url": "https://cdn.example/4011a701f070093978f2df-Storeitemcopy12.png"
|
|
146
|
+
},
|
|
147
|
+
"bonus_meta_map": {
|
|
148
|
+
"uiAmount": "100 EUR Big Bonus "
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Errors
|
|
155
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
156
|
+
|
|
157
|
+
## Related
|
|
158
|
+
- `BonusStatus`
|
|
159
|
+
- `claimBonus`
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# getClanInfo — API (TClanInfo)
|
|
2
|
+
|
|
3
|
+
> Returns the full detail of a single clan — adds the ranked `members[]` roster and a fresh `cooldown_until` on top of the same fields exposed on a `TClan` list entry.
|
|
4
|
+
> Import: `import { TClanInfo } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getClanInfo, clans, TClanInfo, Member, Avatar, Numeric, External, clan_id, public_meta, member_count, capacity_limit, entry_fee_currency_type_id, entry_fee_amount, rating_position, rating_score
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getClanInfo(clanId: number): Promise<TClanInfo>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `clanId` — The clan ID from `TClans.clans[i].clan_id`.
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<TClanInfo>`
|
|
16
|
+
`TClanInfo`:
|
|
17
|
+
- `clan_id` (number) — Clan ID.
|
|
18
|
+
- `public_meta` ({ name: string; description: string; image_url: string }) — Translated clan metadata (name, description, image URL).
|
|
19
|
+
- `member_count` (number) — Current number of members in clan.
|
|
20
|
+
- `capacity_limit` (number) — Max number of members allowed in clan.
|
|
21
|
+
- `entry_fee_currency_type_id` (number) — Currency type for `entry_fee_amount`. `0` = points, `1` = gems, `2` = diamonds, `3` = free.
|
|
22
|
+
- `entry_fee_amount` (number) — Entry fee amount in the currency indicated by `entry_fee_currency_type_id`.
|
|
23
|
+
- `rating_position` (number) — Global rank among all active clans in the label, by `rating_score` DESC. `1` = highest-rated.
|
|
24
|
+
- `rating_score` (number) — Clan rating score (higher is better).
|
|
25
|
+
- `cooldown_until` (string | null) — User-level switch-cooldown expiry as ISO 8601 UTC string ("YYYY-MM-DDTHH:MM:SS" with no timezone suffix). `null` when no cooldown. Same semantic as `TClans.cooldown_until` but always fresh (the list version may be up to 30 s stale).
|
|
26
|
+
- `members` ({
|
|
27
|
+
/** Member's internal user ID. */
|
|
28
|
+
user_id: number;
|
|
29
|
+
/** Member's display username. */
|
|
30
|
+
public_username: string;
|
|
31
|
+
/** Avatar identifier; resolve via `avatar_url` below or rebuild
|
|
32
|
+
* from `avatar_id` + brand avatar domain. */
|
|
33
|
+
avatar_id: string;
|
|
34
|
+
/** Numeric avatar ID (alternative identifier). */
|
|
35
|
+
avatar_real_id: number;
|
|
36
|
+
/** Pre-resolved CDN URL for the avatar. */
|
|
37
|
+
avatar_url?: string;
|
|
38
|
+
/** Member's rank within this clan; `1` = top contributor. */
|
|
39
|
+
position: number;
|
|
40
|
+
/** Member's contribution to the clan rating score. */
|
|
41
|
+
contribution_score: number;
|
|
42
|
+
/** `true` when this row is the current authenticated user. */
|
|
43
|
+
is_me?: boolean;
|
|
44
|
+
/** External user identifier (operator-provided alias);
|
|
45
|
+
* preferred over `public_username` on some surfaces. */
|
|
46
|
+
clean_ext_user_id?: string;
|
|
47
|
+
}[]) — Members of this clan, server-ordered by `contribution_score` DESC (i.e. `position` ASC).
|
|
48
|
+
|
|
49
|
+
## Behavioral contract
|
|
50
|
+
**Preconditions**
|
|
51
|
+
Pass a valid `clanId` (typically read from
|
|
52
|
+
`TClans.clans[i].clan_id` returned by `getClans`). The
|
|
53
|
+
method works standalone — `getClans()` is not required first —
|
|
54
|
+
but is the only stable source of valid IDs.
|
|
55
|
+
|
|
56
|
+
**Refresh model**
|
|
57
|
+
- **No subscription.** One-shot promise.
|
|
58
|
+
- **No client cache.** Every call sends a network request.
|
|
59
|
+
- **No push event** refreshes the detail. Member-join, kick, or
|
|
60
|
+
contribution-score changes require a fresh `getClanInfo` call.
|
|
61
|
+
|
|
62
|
+
**Returned shape — beyond `TClan`**
|
|
63
|
+
`TClanInfo` adds two things on top of the same identity / capacity
|
|
64
|
+
/ fee / rating fields you'd see on a `TClan` list entry:
|
|
65
|
+
1. A ranked `members[]` array — each entry carries `user_id`,
|
|
66
|
+
`public_username`, `avatar_id` / `avatar_real_id`, the resolved
|
|
67
|
+
`avatar_url`, the member's `position` (rank within this clan),
|
|
68
|
+
`contribution_score`, the `is_me` flag identifying the current
|
|
69
|
+
user's row, and the optional `clean_ext_user_id`. The server
|
|
70
|
+
orders members by score DESC (i.e. `position` ASC); no
|
|
71
|
+
client-side re-sort is required.
|
|
72
|
+
2. A fresh `cooldown_until` on the clan info itself. This is the
|
|
73
|
+
SAME user-level cooldown as `TClans.cooldown_until` (the
|
|
74
|
+
cooldown is global to the user, not per clan) — but `getClans`
|
|
75
|
+
returns a value cached for up to 30 s while `getClanInfo`
|
|
76
|
+
always returns the current value. If the list-cached cooldown
|
|
77
|
+
has just expired, this detail call will reflect it first.
|
|
78
|
+
|
|
79
|
+
**Username display**: in the default Smartico UI, member rows use
|
|
80
|
+
`public_username`. Some surfaces (e.g. the tournament clan
|
|
81
|
+
drill-down) prefer `clean_ext_user_id` as the primary display
|
|
82
|
+
with `public_username` as fallback — pick the convention that
|
|
83
|
+
matches your product's identity model.
|
|
84
|
+
|
|
85
|
+
**Idempotency**: safe. Read-only.
|
|
86
|
+
|
|
87
|
+
**Side effects**: none — pure metadata read.
|
|
88
|
+
|
|
89
|
+
**UI guidance**: see [UI Guide — `getClanInfo`](../../docs/ui/clans/UIGuide_getClanInfo.md).
|
|
90
|
+
|
|
91
|
+
**Visitor mode**: not supported.
|
|
92
|
+
|
|
93
|
+
## Example
|
|
94
|
+
```ts
|
|
95
|
+
const result = await window._smartico.api.getClans();
|
|
96
|
+
const clan = result.clans[0];
|
|
97
|
+
|
|
98
|
+
console.log('[smartico] loading detail for clan', clan.clan_id);
|
|
99
|
+
const detail = await window._smartico.api.getClanInfo(clan.clan_id);
|
|
100
|
+
|
|
101
|
+
console.log('[smartico] render detail with', detail.members.length, 'members');
|
|
102
|
+
|
|
103
|
+
// Find current user's row to power a sticky "me" footer.
|
|
104
|
+
const meRow = detail.members.find(m => m.is_me);
|
|
105
|
+
if (meRow) {
|
|
106
|
+
console.log('[smartico] current user rank in this clan:', meRow.position,
|
|
107
|
+
'contribution:', meRow.contribution_score, '— render sticky my-member footer');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Resolve Join CTA state using the detail's cooldown (always fresh).
|
|
111
|
+
const isMyClan = detail.clan_id === result.user_clan_id;
|
|
112
|
+
const inCooldown = detail.cooldown_until != null;
|
|
113
|
+
const isFull = detail.member_count >= detail.capacity_limit;
|
|
114
|
+
if (isMyClan) {
|
|
115
|
+
console.log('[smartico] this is the user\'s clan — render disabled "Your clan" button');
|
|
116
|
+
} else if (inCooldown) {
|
|
117
|
+
const ends = new Date(detail.cooldown_until + 'Z');
|
|
118
|
+
console.log('[smartico] user is in clan-switch cooldown until', ends.toLocaleString(),
|
|
119
|
+
'— render disabled cooldown button');
|
|
120
|
+
} else if (isFull) {
|
|
121
|
+
console.log('[smartico] clan is full — render disabled "Clan is full" button');
|
|
122
|
+
} else {
|
|
123
|
+
console.log('[smartico] joinable — render enabled Join button');
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Example response (REAL shape)
|
|
128
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"clan_id": 6,
|
|
132
|
+
"public_meta": {
|
|
133
|
+
"name": "Joker Clan",
|
|
134
|
+
"description": "Join the clan if you're a wild card and are completely out of control! Or if you just hate Bruce Wayne very much.\n\nPlay in the tournaments, grab that cash an…",
|
|
135
|
+
"image_url": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1780057181857-1.png"
|
|
136
|
+
},
|
|
137
|
+
"member_count": 885,
|
|
138
|
+
"capacity_limit": 1000,
|
|
139
|
+
"entry_fee_currency_type_id": 0,
|
|
140
|
+
"entry_fee_amount": 100,
|
|
141
|
+
"rating_position": 1,
|
|
142
|
+
"rating_score": 90,
|
|
143
|
+
"cooldown_until": null,
|
|
144
|
+
"members": [
|
|
145
|
+
{
|
|
146
|
+
"user_id": 183751733,
|
|
147
|
+
"public_username": "Daniel",
|
|
148
|
+
"avatar_id": "183751733",
|
|
149
|
+
"avatar_real_id": null,
|
|
150
|
+
"avatar_url": "https://cdn.example/avatar/183751733",
|
|
151
|
+
"position": 1,
|
|
152
|
+
"contribution_score": 456786,
|
|
153
|
+
"is_me": false,
|
|
154
|
+
"clean_ext_user_id": "0"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Errors
|
|
161
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
162
|
+
|
|
163
|
+
## Related
|
|
164
|
+
- `getClans`
|