@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,301 @@
|
|
|
1
|
+
# getTournamentInstanceInfo — API (TTournamentDetailed)
|
|
2
|
+
|
|
3
|
+
> Returns the full detail of a single tournament instance — adds the player leaderboard, the full prize structure, and (for clan tournaments) the clan leaderboard and per-clan prize structure on top of everything already in `TTournament`.
|
|
4
|
+
> Import: `import { TTournamentDetailed } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getTournamentInstanceInfo, tournaments, getTournament, TTournamentDetailed, TRibbon, TANGIBLE, POINTS_ADD, POINTS_DEDUCT, POINTS_RESET, MINI_GAME_ATTEMPT, BONUS, TournamentRegistrationTypeName, TournamentRegistrationStatusName, AchRelatedGame, Fixed, Dynamic, instance_id, tournament_id, name, description, image1, image2, image2_mobile, prize_pool_short
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getTournamentInstanceInfo(tournamentInstanceId: number): Promise<TTournamentDetailed>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `tournamentInstanceId` — The `instance_id` from a `TTournament` returned by `getTournamentsList`.
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<TTournamentDetailed>`
|
|
16
|
+
`TTournamentDetailed`:
|
|
17
|
+
- `instance_id` (number) — ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run
|
|
18
|
+
- `tournament_id` (number) — ID of tournament template
|
|
19
|
+
- `name` (string) — Name of the tournament, translated to the user language
|
|
20
|
+
- `description` (string) — Description of the tournament, translated to the user language
|
|
21
|
+
- `image1` (string) — 1st image URL representing the tournament, 544×216px
|
|
22
|
+
- `image2` (string) — 2nd image URL representing the tournament, 920x200px
|
|
23
|
+
- `image2_mobile` (string) — 2nd image URL representing the tournament for mobile, 720x400px
|
|
24
|
+
- `prize_pool_short` (string) — The message indicating the prize pool of the tournament
|
|
25
|
+
- `custom_price_text` (string) — The message indicating the price to register in the tournament
|
|
26
|
+
- `segment_dont_match_message` (string) — The message that should be shown to the user when the user cannot register in tournament with error code TOURNAMENT_USER_DONT_MATCH_CONDITIONS
|
|
27
|
+
- `custom_section_id` (number) — The ID of the custom section where the tournament is assigned The list of custom sections can be retrieved using _smartico.api.getCustomSections() method
|
|
28
|
+
- `custom_data` (any) — The custom data of the tournament defined by operator. Can be a JSON object, string or number
|
|
29
|
+
- `is_featured` (boolean) — The indicator if the tournament is 'Featured'
|
|
30
|
+
- `ribbon` (TRibbon) — The ribbon of the tournament item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon, 250×300px
|
|
31
|
+
- `priority` (number) — A number is used to order the tournaments, representing their priority in the list
|
|
32
|
+
- `me` ({
|
|
33
|
+
/** The username of the current user */
|
|
34
|
+
public_username: string;
|
|
35
|
+
/** The URL to the avatar of the current user */
|
|
36
|
+
avatar_url: string;
|
|
37
|
+
/** The position of the current user in the tournament */
|
|
38
|
+
position: number;
|
|
39
|
+
/** The scores of the current user in the tournament */
|
|
40
|
+
scores: number;
|
|
41
|
+
/** The external user id of the current user */
|
|
42
|
+
user_ext_id: string;
|
|
43
|
+
/** The crm brand id of the current user */
|
|
44
|
+
crm_brand_id: number;
|
|
45
|
+
/** The user id of the current user */
|
|
46
|
+
user_id: number;
|
|
47
|
+
}) — The information about current user in the tournament if he is registered in the tournamnet
|
|
48
|
+
- `prizes` ({
|
|
49
|
+
/** The name of the prize */
|
|
50
|
+
name: string;
|
|
51
|
+
/** The description of the prize */
|
|
52
|
+
description: string;
|
|
53
|
+
/** The image of the prize, 1:1 aspect ratio */
|
|
54
|
+
image_url: string;
|
|
55
|
+
/** from-to range of the places to which this prize */
|
|
56
|
+
place_from: number;
|
|
57
|
+
place_to: number;
|
|
58
|
+
/** type of the prize: TANGIBLE, POINTS_ADD, POINTS_DEDUCT, POINTS_RESET, MINI_GAME_ATTEMPT, BONUS */
|
|
59
|
+
type: string;
|
|
60
|
+
/** if the prize is points related, indicates amount of points */
|
|
61
|
+
points?: number;
|
|
62
|
+
}[])
|
|
63
|
+
- `start_time` (number) — The time when tournament is going to start, epoch with milliseconds
|
|
64
|
+
- `end_time` (number) — The time when tournament is going to finish, epoch with milliseconds
|
|
65
|
+
- `registration_type` (TournamentRegistrationTypeName) — Type of registration in the tournament
|
|
66
|
+
- `registration_count` (number) — Number of users registered in the tournament
|
|
67
|
+
- `is_user_registered` (boolean) — flag indicating if current user is registered in the tournament
|
|
68
|
+
- `players_min_count` (number) — Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start
|
|
69
|
+
- `players_max_count` (number) — Maximum number of participant for this tournament. When reached, new users won't be able to register
|
|
70
|
+
- `registration_status` (TournamentRegistrationStatusName) — Status of registration in the tournament for current user
|
|
71
|
+
- `duration_ms` (number) — Tournament duration in millisecnnds
|
|
72
|
+
- `registration_cost_points` (number) — Cost of registration in the tournament in gamification points
|
|
73
|
+
- `registration_cost_gems` (number) — Cost of registration in the tournament in gems
|
|
74
|
+
- `registration_cost_diamonds` (number) — Cost of registration in the tournament in diamonds
|
|
75
|
+
- `is_active` (boolean) — Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED
|
|
76
|
+
- `is_can_register` (boolean) — Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet
|
|
77
|
+
- `is_cancelled` (boolean) — Indicator if tournament instance is cancelled (status CANCELLED)
|
|
78
|
+
- `is_finished` (boolean) — Indicator if tournament instance is finished (status FINISHED, CANCELLED OR FINIALIZING)
|
|
79
|
+
- `is_in_progress` (boolean) — Indicator if tournament instance is running (status STARTED)
|
|
80
|
+
- `is_upcoming` (boolean) — Indicator if tournament instance is upcoming (status PUBLISHED or REGISTER)
|
|
81
|
+
- `min_scores_win` (number) — The minimum amount of score points that the user should get in order to be qualified for the prize
|
|
82
|
+
- `hide_leaderboard_min_scores` (boolean) — When enabled, users who don’t meet the minimum qualifying score will be hidden from the Leaderboard
|
|
83
|
+
- `total_scores` (number) — Total scores across all participants in the tournament
|
|
84
|
+
- `is_clan_based` (boolean) — True when this tournament groups participants by clan
|
|
85
|
+
- `related_games` (AchRelatedGame[]) — List of casino games (or other types of entities) related to the tournament
|
|
86
|
+
- `ext_game_id` (string) — The ID of the related game
|
|
87
|
+
- `game_public_meta` ({
|
|
88
|
+
/** The name of the game */
|
|
89
|
+
name: string;
|
|
90
|
+
/** The URL to the game */
|
|
91
|
+
link: string;
|
|
92
|
+
/** The URL to the image of the game, 1:1 aspect ratio */
|
|
93
|
+
image: string;
|
|
94
|
+
/** The indicator if the game is enabled */
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
/** The list of categories of the game */
|
|
97
|
+
game_categories: string[];
|
|
98
|
+
/** The name of the game provider */
|
|
99
|
+
game_provider: string;
|
|
100
|
+
/** The URL to the mobile game */
|
|
101
|
+
mobile_spec_link: string;
|
|
102
|
+
/** The priority of the game */
|
|
103
|
+
priority?: number;
|
|
104
|
+
}) — Game public meta information
|
|
105
|
+
- `players` ({
|
|
106
|
+
/** The username of the participant */
|
|
107
|
+
public_username: string;
|
|
108
|
+
/** The URL to the avatar of the participant */
|
|
109
|
+
avatar_url: string;
|
|
110
|
+
/** The position of the participant in the tournament */
|
|
111
|
+
position: number;
|
|
112
|
+
/** The scores of the participant in the tournament */
|
|
113
|
+
scores: number;
|
|
114
|
+
/** The indicator if the participant is current user */
|
|
115
|
+
is_me: boolean;
|
|
116
|
+
/** The external user id of the participant */
|
|
117
|
+
user_ext_id: string;
|
|
118
|
+
/** The crm brand id of the participant */
|
|
119
|
+
crm_brand_id: number;
|
|
120
|
+
/** The user id of the participant */
|
|
121
|
+
user_id: number;
|
|
122
|
+
}[]) — The list of the tournament participants
|
|
123
|
+
- `clan_leaderboard` ({
|
|
124
|
+
clan_id: number;
|
|
125
|
+
public_meta: { name: string; description: string; image_url: string };
|
|
126
|
+
position: number;
|
|
127
|
+
total_score: number;
|
|
128
|
+
contributing_members: number;
|
|
129
|
+
}[] | null) — Ranked list of clans in this tournament; null for non-clan tournaments
|
|
130
|
+
- `user_clan_id` (number | null) — The clan ID the current user belongs to; null when clanless or non-clan tournament
|
|
131
|
+
- `user_position_in_clan` (number | null) — The user's rank within their own clan; null when clanless or not registered
|
|
132
|
+
- `user_score_in_clan` (number | null) — The user's score contribution to their clan; null when clanless or not registered
|
|
133
|
+
- `clan_prize_structure` ({
|
|
134
|
+
clan_place: number;
|
|
135
|
+
/** 1 = Fixed, 2 = Dynamic */
|
|
136
|
+
prize_type_id: number;
|
|
137
|
+
prize_pool_amount: number | null;
|
|
138
|
+
prize_pool_currency_code: string | null;
|
|
139
|
+
activity_type_id: number | null;
|
|
140
|
+
details_json: Record<string, any>;
|
|
141
|
+
public_meta: { name: string; description: string; image_url: string; prize_name?: string } | null;
|
|
142
|
+
tiers: {
|
|
143
|
+
player_place_from: number;
|
|
144
|
+
player_place_to: number;
|
|
145
|
+
pool_amount: number | null;
|
|
146
|
+
/** 1 = ScoreWeighted, 2 = EqualSplit; null for Fixed */
|
|
147
|
+
distribution_type: number | null;
|
|
148
|
+
activity_type_id: number;
|
|
149
|
+
details_json: Record<string, any>;
|
|
150
|
+
public_meta: { name: string; description: string; image_url: string } | null;
|
|
151
|
+
}[];
|
|
152
|
+
}[] | null) — Per-clan prize structure; null for non-clan tournaments
|
|
153
|
+
|
|
154
|
+
## Behavioral contract
|
|
155
|
+
**Preconditions**
|
|
156
|
+
Pass a valid `tournamentInstanceId` read from `TTournament.instance_id`
|
|
157
|
+
on an item returned by `getTournamentsList`. The method works
|
|
158
|
+
standalone — calling `getTournamentsList()` first is not required by
|
|
159
|
+
the SDK, but is the only stable source of valid IDs.
|
|
160
|
+
|
|
161
|
+
**Refresh model**
|
|
162
|
+
- **No subscription.** This is a one-shot promise; call again to
|
|
163
|
+
refresh.
|
|
164
|
+
- **No client cache.** Every call sends a network request and
|
|
165
|
+
returns the latest server snapshot. Safe to poll on an interval —
|
|
166
|
+
the default Smartico UI uses 3 s while the detail view is visible.
|
|
167
|
+
- **No push event** invalidates or refreshes detail state. Score
|
|
168
|
+
changes, registration count changes, lifecycle transitions — all
|
|
169
|
+
require a fresh `getTournamentInstanceInfo` call.
|
|
170
|
+
|
|
171
|
+
**Returned shape — beyond `TTournament`**
|
|
172
|
+
`TTournamentDetailed` extends `TTournament` with the following
|
|
173
|
+
additional data: a `players[]` leaderboard sorted server-side by
|
|
174
|
+
score (only members with at least one recorded score); the user's
|
|
175
|
+
own `me` block carrying their rank and score (undefined when not
|
|
176
|
+
registered or when the user has no score yet); a full per-place
|
|
177
|
+
`prizes[]` array (place range, type, points / gems / diamonds
|
|
178
|
+
amounts, image, name); and `related_games[]` if the operator has
|
|
179
|
+
associated games with this tournament. For clan tournaments
|
|
180
|
+
(`is_clan_based === true`), the response also carries
|
|
181
|
+
`clan_leaderboard[]` (ranked clans with `total_score` and
|
|
182
|
+
`contributing_members`), `clan_prize_structure[]` (per-clan-place
|
|
183
|
+
prize tiers — Fixed vs Dynamic, with ScoreWeighted /
|
|
184
|
+
EqualSplit distribution for Dynamic prizes), `user_clan_id` (the
|
|
185
|
+
user's own clan), and the advisory `user_position_in_clan` /
|
|
186
|
+
`user_score_in_clan` fields.
|
|
187
|
+
|
|
188
|
+
**Idempotency**: safe. Read-only. Each call returns the latest
|
|
189
|
+
server snapshot.
|
|
190
|
+
|
|
191
|
+
**Side effects**: none — pure metadata read.
|
|
192
|
+
|
|
193
|
+
**UI guidance**: see [UI Guide — `getTournamentInstanceInfo`](../../docs/ui/tournaments/UIGuide_getTournamentInstanceInfo.md).
|
|
194
|
+
|
|
195
|
+
**Visitor mode**: not supported. Use `getTournamentsList` for
|
|
196
|
+
the public lobby list in visitor mode; the detail endpoint requires
|
|
197
|
+
an authenticated session.
|
|
198
|
+
|
|
199
|
+
## Example
|
|
200
|
+
```ts
|
|
201
|
+
const tournaments = await window._smartico.api.getTournamentsList();
|
|
202
|
+
const tournament = tournaments[0];
|
|
203
|
+
|
|
204
|
+
console.log('[smartico] loading detail view for tournament', tournament.instance_id);
|
|
205
|
+
const detail = await window._smartico.api.getTournamentInstanceInfo(tournament.instance_id);
|
|
206
|
+
|
|
207
|
+
console.log('[smartico] render detail with', detail.players?.length ?? 0,
|
|
208
|
+
'players,', detail.prizes?.length ?? 0, 'prize tiers');
|
|
209
|
+
|
|
210
|
+
if (detail.is_clan_based && detail.clan_leaderboard) {
|
|
211
|
+
console.log('[smartico] clan tournament — render clan leaderboard tab with',
|
|
212
|
+
detail.clan_leaderboard.length, 'clans');
|
|
213
|
+
if (detail.user_clan_id != null) {
|
|
214
|
+
console.log('[smartico] user belongs to clan', detail.user_clan_id,
|
|
215
|
+
'— highlight that row in the clan leaderboard');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Live leaderboard updates — poll every 3 seconds while the detail view is open.
|
|
220
|
+
const pollId = setInterval(async () => {
|
|
221
|
+
try {
|
|
222
|
+
const fresh = await window._smartico.api.getTournamentInstanceInfo(tournament.instance_id);
|
|
223
|
+
console.log('[smartico] detail refreshed — re-render player + clan leaderboards from this new snapshot:', fresh);
|
|
224
|
+
} catch (e) {
|
|
225
|
+
console.error('[smartico] tournament detail poll failed — keep showing last snapshot, retry on next tick:', e);
|
|
226
|
+
}
|
|
227
|
+
}, 3_000);
|
|
228
|
+
// clearInterval(pollId) when the detail view closes.
|
|
229
|
+
|
|
230
|
+
if (detail.me) {
|
|
231
|
+
console.log('[smartico] current user is rank', detail.me.position,
|
|
232
|
+
'with', detail.me.scores, 'points — render the sticky "me" panel below the leaderboard');
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Example response (REAL shape)
|
|
237
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"instance_id": 585461,
|
|
241
|
+
"tournament_id": 4450,
|
|
242
|
+
"name": "Old Dragon's Hoard",
|
|
243
|
+
"description": " <style>\n /* Add your CSS here */\n .custom-rules {\n font-family: inherit;\n background-color: #2c295c !important;\n …",
|
|
244
|
+
"image1": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773753066010-1.png",
|
|
245
|
+
"image2": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773755039087-0.png",
|
|
246
|
+
"image2_mobile": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773755761006-0.png",
|
|
247
|
+
"prize_pool_short": "The Dragon's treasure",
|
|
248
|
+
"custom_data": {},
|
|
249
|
+
"is_featured": false,
|
|
250
|
+
"start_time": 1782216000000,
|
|
251
|
+
"end_time": 1782302400000,
|
|
252
|
+
"registration_count": 0,
|
|
253
|
+
"is_user_registered": false,
|
|
254
|
+
"players_min_count": 0,
|
|
255
|
+
"players_max_count": 200,
|
|
256
|
+
"registration_status": "UNKNOWN",
|
|
257
|
+
"registration_type": "BUY_IN_GEMS",
|
|
258
|
+
"registration_cost_gems": 3,
|
|
259
|
+
"duration_ms": 86400000,
|
|
260
|
+
"is_active": true,
|
|
261
|
+
"is_can_register": false,
|
|
262
|
+
"is_cancelled": false,
|
|
263
|
+
"is_finished": false,
|
|
264
|
+
"is_in_progress": true,
|
|
265
|
+
"is_upcoming": false,
|
|
266
|
+
"min_scores_win": 1,
|
|
267
|
+
"hide_leaderboard_min_scores": false,
|
|
268
|
+
"total_scores": null,
|
|
269
|
+
"is_clan_based": false,
|
|
270
|
+
"related_games": [
|
|
271
|
+
{
|
|
272
|
+
"ext_game_id": "dragon-fortune",
|
|
273
|
+
"game_public_meta": {
|
|
274
|
+
"name": "Dragon Fortune",
|
|
275
|
+
"link": "/game/dragon-fortune",
|
|
276
|
+
"image": "https://cdn.example/e93b87dfd94d462de49bc3-china.png",
|
|
277
|
+
"enabled": true,
|
|
278
|
+
"priority": 1
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
"players": [],
|
|
283
|
+
"prizes": [
|
|
284
|
+
{
|
|
285
|
+
"gems": 10,
|
|
286
|
+
"image_url": "https://cdn.example/ecec44e4c2d0555b4d8a32-Gems10.webp",
|
|
287
|
+
"name": "10 gems",
|
|
288
|
+
"id": 38778,
|
|
289
|
+
"type": "GEMS_AND_DIAMONDS_ADD",
|
|
290
|
+
"place_from": 1,
|
|
291
|
+
"place_to": 1
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Errors
|
|
298
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
299
|
+
|
|
300
|
+
## Related
|
|
301
|
+
- `getTournamentsList`
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# getTournamentsList — API (TTournament)
|
|
2
|
+
|
|
3
|
+
> Returns the list of tournaments currently visible to the user, scoped server-side to what the user's segments qualify them to see.
|
|
4
|
+
> Import: `import { TTournament } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getTournamentsList, tournaments, getTournaments, TTournament, TRibbon, TANGIBLE, POINTS_ADD, POINTS_DEDUCT, POINTS_RESET, MINI_GAME_ATTEMPT, BONUS, TournamentRegistrationTypeName, TournamentRegistrationStatusName, onUpdate, subscription, instance_id, tournament_id, name, description, image1, image2, image2_mobile, prize_pool_short
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getTournamentsList({ onUpdate }: { onUpdate?: (data: TTournament[]) => void } = {}): Promise<TTournament[]>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `params` — Optional. Omit to fetch without subscribing.
|
|
14
|
+
- `params.onUpdate` — Callback invoked with the full refreshed tournament list after every `registerInTournament` round-trip on this connection. Each call overwrites the prior callback. Never fires in visitor mode.
|
|
15
|
+
|
|
16
|
+
## Returns — `Promise<TTournament[]>`
|
|
17
|
+
Array of `TTournament`. Each item:
|
|
18
|
+
- `instance_id` (number) — ID of tournament instance. Generated every time when tournament based on specific template is scheduled for run
|
|
19
|
+
- `tournament_id` (number) — ID of tournament template
|
|
20
|
+
- `name` (string) — Name of the tournament, translated to the user language
|
|
21
|
+
- `description` (string) — Description of the tournament, translated to the user language
|
|
22
|
+
- `image1` (string) — 1st image URL representing the tournament, 544×216px
|
|
23
|
+
- `image2` (string) — 2nd image URL representing the tournament, 920x200px
|
|
24
|
+
- `image2_mobile` (string) — 2nd image URL representing the tournament for mobile, 720x400px
|
|
25
|
+
- `prize_pool_short` (string) — The message indicating the prize pool of the tournament
|
|
26
|
+
- `custom_price_text` (string) — The message indicating the price to register in the tournament
|
|
27
|
+
- `segment_dont_match_message` (string) — The message that should be shown to the user when the user cannot register in tournament with error code TOURNAMENT_USER_DONT_MATCH_CONDITIONS
|
|
28
|
+
- `custom_section_id` (number) — The ID of the custom section where the tournament is assigned The list of custom sections can be retrieved using _smartico.api.getCustomSections() method
|
|
29
|
+
- `custom_data` (any) — The custom data of the tournament defined by operator. Can be a JSON object, string or number
|
|
30
|
+
- `is_featured` (boolean) — The indicator if the tournament is 'Featured'
|
|
31
|
+
- `ribbon` (TRibbon) — The ribbon of the tournament item. Can be 'sale', 'hot', 'new', 'vip' or URL to the image in case of custom ribbon, 250×300px
|
|
32
|
+
- `priority` (number) — A number is used to order the tournaments, representing their priority in the list
|
|
33
|
+
- `me` ({
|
|
34
|
+
/** The username of the participant */
|
|
35
|
+
public_username: string;
|
|
36
|
+
/** The URL to the avatar of the participant */
|
|
37
|
+
avatar_url: string;
|
|
38
|
+
/** The position of the participant in the tournament */
|
|
39
|
+
position: number;
|
|
40
|
+
/** The scores of the participant in the tournament */
|
|
41
|
+
scores: number;
|
|
42
|
+
/** The external user id of the participant */
|
|
43
|
+
user_ext_id: string;
|
|
44
|
+
/** The crm brand id of the participant */
|
|
45
|
+
crm_brand_id: number;
|
|
46
|
+
/** The user id of the participant */
|
|
47
|
+
user_id: number;
|
|
48
|
+
}) — Info about current player in tournament
|
|
49
|
+
- `prizes` ({
|
|
50
|
+
/** The name of the prize */
|
|
51
|
+
name: string;
|
|
52
|
+
/** The description of the prize */
|
|
53
|
+
description: string;
|
|
54
|
+
/** The image of the prize, 1:1 aspect ratio */
|
|
55
|
+
image_url: string;
|
|
56
|
+
/** from-to range of the places to which this prize */
|
|
57
|
+
place_from: number;
|
|
58
|
+
place_to: number;
|
|
59
|
+
/** type of the prize: TANGIBLE, POINTS_ADD, POINTS_DEDUCT, POINTS_RESET, MINI_GAME_ATTEMPT, BONUS */
|
|
60
|
+
type: string;
|
|
61
|
+
/** if the prize is points related, indicates amount of points */
|
|
62
|
+
points?: number;
|
|
63
|
+
}[]) — Prize structure
|
|
64
|
+
- `start_time` (number) — The time when tournament is going to start, epoch with milliseconds
|
|
65
|
+
- `end_time` (number) — The time when tournament is going to finish, epoch with milliseconds
|
|
66
|
+
- `registration_type` (TournamentRegistrationTypeName) — Type of registration in the tournament
|
|
67
|
+
- `registration_count` (number) — Number of users registered in the tournament
|
|
68
|
+
- `is_user_registered` (boolean) — flag indicating if current user is registered in the tournament
|
|
69
|
+
- `players_min_count` (number) — Minimum number of participant for this tournament. If tournament doesnt have enough registrations, it will not start
|
|
70
|
+
- `players_max_count` (number) — Maximum number of participant for this tournament. When reached, new users won't be able to register
|
|
71
|
+
- `registration_status` (TournamentRegistrationStatusName) — Status of registration in the tournament for current user
|
|
72
|
+
- `duration_ms` (number) — Tournament duration in millisecnnds
|
|
73
|
+
- `registration_cost_points` (number) — Cost of registration in the tournament in gamification points
|
|
74
|
+
- `registration_cost_gems` (number) — Cost of registration in the tournament in gems
|
|
75
|
+
- `registration_cost_diamonds` (number) — Cost of registration in the tournament in diamonds
|
|
76
|
+
- `is_active` (boolean) — Indicator if tournament instance is active, means in one of the statues - PUBLISHED, REGISTED, STARTED
|
|
77
|
+
- `is_can_register` (boolean) — Indicator if user can register in this tournament instance, e.g tournament is active, max users is not reached, user is not registered yet
|
|
78
|
+
- `is_cancelled` (boolean) — Indicator if tournament instance is cancelled (status CANCELLED)
|
|
79
|
+
- `is_finished` (boolean) — Indicator if tournament instance is finished (status FINISHED, CANCELLED OR FINIALIZING)
|
|
80
|
+
- `is_in_progress` (boolean) — Indicator if tournament instance is running (status STARTED)
|
|
81
|
+
- `is_upcoming` (boolean) — Indicator if tournament instance is upcoming (status PUBLISHED or REGISTER)
|
|
82
|
+
- `min_scores_win` (number) — The minimum amount of score points that the user should get in order to be qualified for the prize
|
|
83
|
+
- `hide_leaderboard_min_scores` (boolean) — When enabled, users who don’t meet the minimum qualifying score will be hidden from the Leaderboard
|
|
84
|
+
- `total_scores` (number) — Total scores across all participants in the tournament
|
|
85
|
+
- `is_clan_based` (boolean) — True when this tournament groups participants by clan
|
|
86
|
+
|
|
87
|
+
## Behavioral contract
|
|
88
|
+
**Subscription model (`onUpdate`)**
|
|
89
|
+
The callback receives the FULL refreshed list (never a diff/patch).
|
|
90
|
+
Each subsequent call to `getTournamentsList({ onUpdate })` REPLACES
|
|
91
|
+
the prior callback — only one active subscriber at a time. Pass
|
|
92
|
+
`onUpdate: undefined` (or omit it) to keep the prior callback in
|
|
93
|
+
place; the callback is never auto-cleared.
|
|
94
|
+
|
|
95
|
+
**Update triggers** — the callback fires when:
|
|
96
|
+
|
|
97
|
+
1. `registerInTournament(...)` resolves on this connection (any
|
|
98
|
+
`err_code`). The refreshed list reflects the new
|
|
99
|
+
`is_user_registered` / `registration_status` /
|
|
100
|
+
`registration_count` on the affected tournament.
|
|
101
|
+
|
|
102
|
+
Does NOT fire for: tournament lifecycle transitions (start, finish,
|
|
103
|
+
cancellation), score updates, other users' registrations, or
|
|
104
|
+
operator-side BO edits. Those changes surface only on the next
|
|
105
|
+
cache miss (after the 30 s TTL) — poll manually if your UI needs
|
|
106
|
+
sub-30s lifecycle freshness.
|
|
107
|
+
|
|
108
|
+
**Server-side filtering** (what's excluded before the SDK sees it)
|
|
109
|
+
The server filters by visibility segment and entry segment, removes
|
|
110
|
+
tournaments past their post-finish display window, and excludes
|
|
111
|
+
tournaments not yet published. SDK consumers receive only items
|
|
112
|
+
the user is eligible to see; no client-side gating is required.
|
|
113
|
+
|
|
114
|
+
**Reading state from the returned item**
|
|
115
|
+
Drive list bucketing and CTA labels from the SDK-computed booleans
|
|
116
|
+
(`is_active`, `is_can_register`, `is_cancelled`, `is_finished`,
|
|
117
|
+
`is_in_progress`, `is_upcoming`), NOT from raw `start_time` /
|
|
118
|
+
`end_time` comparisons — the booleans encode the canonical
|
|
119
|
+
lifecycle states and already reflect server-side rules around
|
|
120
|
+
qualifying scores and late registration. `is_user_registered` is
|
|
121
|
+
independent of `is_can_register` — a registered user has
|
|
122
|
+
`is_user_registered: true` and `is_can_register: false`. The `me`
|
|
123
|
+
block (if present) carries the user's own leaderboard position and
|
|
124
|
+
score; it's undefined for unregistered users, users without any
|
|
125
|
+
recorded score, and visitor-mode sessions. The `prize_pool_short`
|
|
126
|
+
field carries the operator-supplied summary string ("$10,000",
|
|
127
|
+
"Mixed prizes") for compact card rendering; the full per-place
|
|
128
|
+
`prizes[]` breakdown is also populated here but is typically
|
|
129
|
+
rendered only in the detail view via
|
|
130
|
+
`getTournamentInstanceInfo`.
|
|
131
|
+
|
|
132
|
+
**Cross-references**
|
|
133
|
+
Tournaments with `is_clan_based: true` group participants by clan —
|
|
134
|
+
see `getClanTournamentPlayers` for fetching the players list
|
|
135
|
+
of a specific clan within a clan tournament. The detailed lobby
|
|
136
|
+
view (with full player leaderboard and prize structure) comes from
|
|
137
|
+
`getTournamentInstanceInfo`. Tournaments with
|
|
138
|
+
`custom_section_id` belong to an operator-defined custom section
|
|
139
|
+
(resolve metadata via `getCustomSections()`).
|
|
140
|
+
|
|
141
|
+
**Cache TTL**: the SDK caches the response for 30 seconds. Cache is
|
|
142
|
+
fully cleared on login / logout.
|
|
143
|
+
|
|
144
|
+
**Idempotency**: safe. Read-only. Repeated calls within the cache
|
|
145
|
+
window return a deep-cloned cached array without a network
|
|
146
|
+
round-trip.
|
|
147
|
+
|
|
148
|
+
**Side effects**: none — pure metadata read.
|
|
149
|
+
|
|
150
|
+
**UI guidance**: see [UI Guide — `getTournamentsList`](../../docs/ui/tournaments/UIGuide_getTournamentsList.md).
|
|
151
|
+
|
|
152
|
+
**Visitor mode**: supported. The same shape is returned, scoped to
|
|
153
|
+
the brand's public tournament list. Per-user fields (`me`,
|
|
154
|
+
`is_user_registered`, `registration_status`) are not meaningful.
|
|
155
|
+
The `onUpdate` callback is accepted but never fires (registration
|
|
156
|
+
mutations are not supported in visitor mode).
|
|
157
|
+
|
|
158
|
+
## Example
|
|
159
|
+
```ts
|
|
160
|
+
const tournaments = await window._smartico.api.getTournamentsList({
|
|
161
|
+
onUpdate: (refreshed) => {
|
|
162
|
+
console.log('[smartico] tournament list refreshed — re-render the lobby UI from this array, do not merge with prior state:', refreshed);
|
|
163
|
+
const justRegistered = refreshed.filter(t => t.is_user_registered);
|
|
164
|
+
console.log('[smartico] user is now registered in these tournaments:', justRegistered.map(t => t.name));
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Bucket items by lifecycle state for a tabbed UI.
|
|
169
|
+
const live = tournaments.filter(t => t.is_in_progress);
|
|
170
|
+
const upcoming = tournaments
|
|
171
|
+
.filter(t => t.is_upcoming && !t.is_user_registered)
|
|
172
|
+
.sort((a, b) => a.start_time - b.start_time);
|
|
173
|
+
const mine = tournaments.filter(t => t.is_user_registered);
|
|
174
|
+
const finished = tournaments.filter(t => t.is_finished);
|
|
175
|
+
|
|
176
|
+
console.log('[smartico] render lobby tabs with these counts: live=', live.length,
|
|
177
|
+
'upcoming=', upcoming.length, 'mine=', mine.length, 'finished=', finished.length);
|
|
178
|
+
|
|
179
|
+
// Featured tournament: pin to position 0 of the Overview/Top tabs.
|
|
180
|
+
const featured = tournaments.find(t => t.is_featured && !t.is_cancelled);
|
|
181
|
+
if (featured) {
|
|
182
|
+
console.log('[smartico] featured tournament — pin to position 0 of the Overview tab:', featured.name);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Visitor mode: onUpdate accepted but never fires; re-poll if needed.
|
|
186
|
+
// const visitorList = await window._smartico.vapi('EN').getTournamentsList();
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Example response (REAL shape)
|
|
190
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
191
|
+
```json
|
|
192
|
+
[
|
|
193
|
+
{
|
|
194
|
+
"instance_id": 585461,
|
|
195
|
+
"tournament_id": 4450,
|
|
196
|
+
"name": "Old Dragon's Hoard",
|
|
197
|
+
"description": " <style>\n /* Add your CSS here */\n .custom-rules {\n font-family: inherit;\n background-color: #2c295c !important;\n …",
|
|
198
|
+
"image1": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773753066010-1.png",
|
|
199
|
+
"image2": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773755039087-0.png",
|
|
200
|
+
"image2_mobile": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1773755761006-0.png",
|
|
201
|
+
"prize_pool_short": "The Dragon's treasure",
|
|
202
|
+
"custom_data": {},
|
|
203
|
+
"is_featured": false,
|
|
204
|
+
"start_time": 1782216000000,
|
|
205
|
+
"end_time": 1782302400000,
|
|
206
|
+
"registration_count": 0,
|
|
207
|
+
"is_user_registered": false,
|
|
208
|
+
"players_min_count": 0,
|
|
209
|
+
"players_max_count": 200,
|
|
210
|
+
"registration_status": "UNKNOWN",
|
|
211
|
+
"registration_type": "BUY_IN_GEMS",
|
|
212
|
+
"registration_cost_gems": 3,
|
|
213
|
+
"duration_ms": 86400000,
|
|
214
|
+
"is_active": true,
|
|
215
|
+
"is_can_register": false,
|
|
216
|
+
"is_cancelled": false,
|
|
217
|
+
"is_finished": false,
|
|
218
|
+
"is_in_progress": true,
|
|
219
|
+
"is_upcoming": false,
|
|
220
|
+
"min_scores_win": 1,
|
|
221
|
+
"hide_leaderboard_min_scores": false,
|
|
222
|
+
"total_scores": null,
|
|
223
|
+
"is_clan_based": false
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Errors
|
|
229
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
230
|
+
|
|
231
|
+
## Related
|
|
232
|
+
- `getTournamentInstanceInfo`
|
|
233
|
+
- `getClanTournamentPlayers`
|
|
234
|
+
- `registerInTournament`
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# getTranslations — API (TGetTranslations)
|
|
2
|
+
|
|
3
|
+
> Returns the full set of operator-defined translation key/value pairs for the label, merged across the requested language and the English baseline.
|
|
4
|
+
> Import: `import { TGetTranslations } from '@smartico/public-api'`
|
|
5
|
+
> Search terms: getTranslations, general, TGetTranslations, translations
|
|
6
|
+
|
|
7
|
+
## Signature
|
|
8
|
+
```ts
|
|
9
|
+
_smartico.api.getTranslations(lang_code: string): Promise<TGetTranslations>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Parameters
|
|
13
|
+
- `lang_code` — ISO language code (e.g. `"EN"`, `"FR"`). Defaults to `"EN"` server-side if empty.
|
|
14
|
+
|
|
15
|
+
## Returns — `Promise<TGetTranslations>`
|
|
16
|
+
`TGetTranslations`:
|
|
17
|
+
- `translations` ({ [key: string]: string }) — Flat dictionary of operator-defined translation key → translated string.
|
|
18
|
+
|
|
19
|
+
## Behavioral contract
|
|
20
|
+
**Preconditions**
|
|
21
|
+
- No prerequisite calls.
|
|
22
|
+
- `lang_code` is the ISO language code the operator uses in the BO
|
|
23
|
+
(e.g. `"EN"`, `"FR"`, `"ES"`). Case is not normalised — match what the
|
|
24
|
+
operator configured.
|
|
25
|
+
|
|
26
|
+
**EN fallback**
|
|
27
|
+
The SDK issues an English-baseline fetch first, then overlays the
|
|
28
|
+
`lang_code` translations on top. Any key the operator has only defined in
|
|
29
|
+
English (i.e. missing in the requested language) is returned with the
|
|
30
|
+
English value. Keys missing in both are absent from the map — the consumer
|
|
31
|
+
must handle missing keys (the default Smartico UI returns the key string
|
|
32
|
+
itself as the fallback text).
|
|
33
|
+
|
|
34
|
+
**What's included**
|
|
35
|
+
The SDK passes an empty `areas` filter to the server, which returns ALL
|
|
36
|
+
translation namespaces configured for the label (Gamification, Casino,
|
|
37
|
+
Trading, Affiliation, etc. — whichever are populated). For a Gamification-
|
|
38
|
+
only widget, the consumer can ignore unused namespaces — keys are flat
|
|
39
|
+
strings, not nested.
|
|
40
|
+
|
|
41
|
+
**Refresh**
|
|
42
|
+
- Cached internally per `(lang_code, label, brand)` for ~30 seconds.
|
|
43
|
+
- No push subscription. Operators editing translations in the BO will see
|
|
44
|
+
the change after the cache window expires.
|
|
45
|
+
|
|
46
|
+
**Visitor mode**: supported. Translations are label-scoped, not user-
|
|
47
|
+
scoped — `lang_code` is the sole language selector and is independent of
|
|
48
|
+
the `vapi(lang)` argument used elsewhere.
|
|
49
|
+
|
|
50
|
+
## Example
|
|
51
|
+
```ts
|
|
52
|
+
const r = await window._smartico.api.getTranslations('FR');
|
|
53
|
+
|
|
54
|
+
// Defensive lookup: fall back to the key itself if the operator hasn't
|
|
55
|
+
// defined the string.
|
|
56
|
+
const t = (k: string) => r.translations[k] ?? k;
|
|
57
|
+
|
|
58
|
+
console.log('[smartico] localized label "missions_title" →', t('missions_title'));
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Example response (REAL shape)
|
|
62
|
+
> Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"translations": {
|
|
66
|
+
"transaction-type-20": "Casino bet",
|
|
67
|
+
"cancel": "Cancel",
|
|
68
|
+
"currency_symbol_EUR": "€",
|
|
69
|
+
"transaction-type-21": "Casino win",
|
|
70
|
+
"err_11000": "Not enough points to purchase this item.",
|
|
71
|
+
"transaction-type-25": "Withdrawal Cancelled",
|
|
72
|
+
"year": "Year",
|
|
73
|
+
"transaction-type-22": "Comp points exchange",
|
|
74
|
+
"transaction-type-23": "Pending withdrawal",
|
|
75
|
+
"err_11004": "Failed to buy shop item because of item purchase condition",
|
|
76
|
+
"transaction-type-26": "Withdrawal Declined",
|
|
77
|
+
"err_11003": "Failed to buy store item because of item condition.",
|
|
78
|
+
"currency_symbol_TRY": "₺",
|
|
79
|
+
"err_11008": "You’ve reached the maximum number of bonuses allowed.",
|
|
80
|
+
"err_11006": "You've reached the maximum number of items you can buy.",
|
|
81
|
+
"sawAttemptsAvailableShort": "{value} attempts",
|
|
82
|
+
"inbx_MarkAllReadHint": "Mark all messages as read",
|
|
83
|
+
"totalPool": "total pool",
|
|
84
|
+
"placesPaid": "Places paid",
|
|
85
|
+
"sawSpinCostSpins": "{value} spins available",
|
|
86
|
+
"…": "(+804 more keys)"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Errors
|
|
92
|
+
See this method's TSDoc / the mutation pages for `err_code` handling.
|
|
93
|
+
|
|
94
|
+
## Related
|
|
95
|
+
- `TGetTranslations`
|