@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.
Files changed (153) hide show
  1. package/.claude/skills/api-tsdoc/SKILL.md +675 -0
  2. package/.claude/skills/api-tsdoc-final/SKILL.md +266 -0
  3. package/.claude/skills/api-tsdoc-howto/SKILL.md +143 -0
  4. package/dist/MiniGames/SAWTemplate.d.ts +4 -0
  5. package/dist/NodeCache.d.ts +1 -0
  6. package/dist/OCache.d.ts +7 -0
  7. package/dist/SmarticoGlobal.d.ts +0 -6
  8. package/dist/WSAPI/WSAPITypes.d.ts +43 -0
  9. package/dist/WSAPI/WSAPIUser.d.ts +3 -0
  10. package/dist/index.js +92 -33
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.mjs +60 -10
  13. package/dist/index.modern.mjs.map +1 -1
  14. package/docs/api/interfaces/TUserProfile.md +136 -0
  15. package/docs/capabilities/_responses/buyStoreItem.json +4 -0
  16. package/docs/capabilities/_responses/claimBonus.json +4 -0
  17. package/docs/capabilities/_responses/gamePickGetActiveRound.json +95 -0
  18. package/docs/capabilities/_responses/gamePickGetActiveRounds.json +191 -0
  19. package/docs/capabilities/_responses/gamePickGetBoard.json +47 -0
  20. package/docs/capabilities/_responses/gamePickGetGameInfo.json +355 -0
  21. package/docs/capabilities/_responses/gamePickGetHistory.json +191 -0
  22. package/docs/capabilities/_responses/gamePickGetUserInfo.json +14 -0
  23. package/docs/capabilities/_responses/getAchCategories.json +12 -0
  24. package/docs/capabilities/_responses/getActivityLog.json +1 -0
  25. package/docs/capabilities/_responses/getAvatarPrompts.json +16 -0
  26. package/docs/capabilities/_responses/getAvatarsCustomized.json +12 -0
  27. package/docs/capabilities/_responses/getAvatarsList.json +24 -0
  28. package/docs/capabilities/_responses/getBadges.json +98 -0
  29. package/docs/capabilities/_responses/getBonuses.json +18 -0
  30. package/docs/capabilities/_responses/getClanInfo.json +39 -0
  31. package/docs/capabilities/_responses/getClans.json +35 -0
  32. package/docs/capabilities/_responses/getCurrentLevel.json +20 -0
  33. package/docs/capabilities/_responses/getCustomSections.json +25 -0
  34. package/docs/capabilities/_responses/getInboxMessageBody.json +7 -0
  35. package/docs/capabilities/_responses/getInboxMessages.json +18 -0
  36. package/docs/capabilities/_responses/getInboxUnreadCount.json +1 -0
  37. package/docs/capabilities/_responses/getJackpotEligibleGames.json +20 -0
  38. package/docs/capabilities/_responses/getJackpotWinners.json +28 -0
  39. package/docs/capabilities/_responses/getLeaderBoard.json +45 -0
  40. package/docs/capabilities/_responses/getLevels.json +40 -0
  41. package/docs/capabilities/_responses/getMiniGames.json +208 -0
  42. package/docs/capabilities/_responses/getMiniGamesHistory.json +1 -0
  43. package/docs/capabilities/_responses/getMissions.json +117 -0
  44. package/docs/capabilities/_responses/getRaffleDrawRun.json +62 -0
  45. package/docs/capabilities/_responses/getRaffleDrawRunsHistory.json +34 -0
  46. package/docs/capabilities/_responses/getRaffles.json +140 -0
  47. package/docs/capabilities/_responses/getStoreCategories.json +12 -0
  48. package/docs/capabilities/_responses/getStoreItems.json +47 -0
  49. package/docs/capabilities/_responses/getStorePurchasedItems.json +49 -0
  50. package/docs/capabilities/_responses/getTournamentInstanceInfo.json +75 -0
  51. package/docs/capabilities/_responses/getTournamentsList.json +66 -0
  52. package/docs/capabilities/_responses/getTranslations.json +25 -0
  53. package/docs/capabilities/_responses/getUserLevelExtraCounters.json +4 -0
  54. package/docs/capabilities/_responses/getUserProfile.json +34 -0
  55. package/docs/capabilities/_responses/jackpotGet.json +113 -0
  56. package/docs/capabilities/_responses/jackpotOptIn.json +9 -0
  57. package/docs/capabilities/_responses/jackpotOptOut.json +9 -0
  58. package/docs/capabilities/_responses/markAllInboxMessagesAsRead.json +4 -0
  59. package/docs/capabilities/_responses/markInboxMessageAsRead.json +4 -0
  60. package/docs/capabilities/_responses/markUnmarkInboxMessageAsFavorite.json +4 -0
  61. package/docs/capabilities/_responses/miniGameWinAcknowledgeRequest.json +10 -0
  62. package/docs/capabilities/_responses/playMiniGame.json +6 -0
  63. package/docs/capabilities/_responses/playMiniGameBatch.json +9 -0
  64. package/docs/capabilities/_responses/registerInTournament.json +4 -0
  65. package/docs/capabilities/_responses/requestMissionOptIn.json +4 -0
  66. package/docs/capabilities/_responses/setAvatar.json +4 -0
  67. package/docs/capabilities/avatarsCustomize.md +115 -0
  68. package/docs/capabilities/buyStoreItem.md +179 -0
  69. package/docs/capabilities/checkSegmentListMatch.md +69 -0
  70. package/docs/capabilities/checkSegmentMatch.md +74 -0
  71. package/docs/capabilities/claimBonus.md +125 -0
  72. package/docs/capabilities/claimRafflePrize.md +116 -0
  73. package/docs/capabilities/deleteAllInboxMessages.md +66 -0
  74. package/docs/capabilities/deleteInboxMessage.md +60 -0
  75. package/docs/capabilities/gamePickGetActiveRound.md +248 -0
  76. package/docs/capabilities/gamePickGetActiveRounds.md +259 -0
  77. package/docs/capabilities/gamePickGetBoard.md +202 -0
  78. package/docs/capabilities/gamePickGetGameInfo.md +318 -0
  79. package/docs/capabilities/gamePickGetHistory.md +244 -0
  80. package/docs/capabilities/gamePickGetRoundInfoForUser.md +189 -0
  81. package/docs/capabilities/gamePickGetUserInfo.md +91 -0
  82. package/docs/capabilities/gamePickSubmitSelection.md +222 -0
  83. package/docs/capabilities/gamePickSubmitSelectionQuiz.md +198 -0
  84. package/docs/capabilities/getAchCategories.md +119 -0
  85. package/docs/capabilities/getActivityLog.md +108 -0
  86. package/docs/capabilities/getAvatarPrompts.md +81 -0
  87. package/docs/capabilities/getAvatarsCustomized.md +96 -0
  88. package/docs/capabilities/getAvatarsList.md +101 -0
  89. package/docs/capabilities/getBadges.md +237 -0
  90. package/docs/capabilities/getBonuses.md +159 -0
  91. package/docs/capabilities/getClanInfo.md +164 -0
  92. package/docs/capabilities/getClanTournamentPlayers.md +112 -0
  93. package/docs/capabilities/getClans.md +168 -0
  94. package/docs/capabilities/getCurrentLevel.md +123 -0
  95. package/docs/capabilities/getCustomSections.md +96 -0
  96. package/docs/capabilities/getInboxMessageBody.md +87 -0
  97. package/docs/capabilities/getInboxMessages.md +146 -0
  98. package/docs/capabilities/getInboxUnreadCount.md +54 -0
  99. package/docs/capabilities/getJackpotEligibleGames.md +93 -0
  100. package/docs/capabilities/getJackpotWinners.md +113 -0
  101. package/docs/capabilities/getLeaderBoard.md +187 -0
  102. package/docs/capabilities/getLeaderBoards.md +88 -0
  103. package/docs/capabilities/getLevels.md +118 -0
  104. package/docs/capabilities/getMiniGames.md +295 -0
  105. package/docs/capabilities/getMiniGamesHistory.md +183 -0
  106. package/docs/capabilities/getMissions.md +253 -0
  107. package/docs/capabilities/getRaffleDrawRun.md +210 -0
  108. package/docs/capabilities/getRaffleDrawRunsHistory.md +116 -0
  109. package/docs/capabilities/getRaffleWonPrizes.md +153 -0
  110. package/docs/capabilities/getRaffles.md +249 -0
  111. package/docs/capabilities/getRelatedItemsForGame.md +236 -0
  112. package/docs/capabilities/getStoreCategories.md +128 -0
  113. package/docs/capabilities/getStoreItems.md +260 -0
  114. package/docs/capabilities/getStorePurchasedItems.md +280 -0
  115. package/docs/capabilities/getTournamentInstanceInfo.md +301 -0
  116. package/docs/capabilities/getTournamentsList.md +234 -0
  117. package/docs/capabilities/getTranslations.md +95 -0
  118. package/docs/capabilities/getUserLevelExtraCounters.md +92 -0
  119. package/docs/capabilities/getUserProfile.md +184 -0
  120. package/docs/capabilities/jackpotGet.md +173 -0
  121. package/docs/capabilities/jackpotOptIn.md +94 -0
  122. package/docs/capabilities/jackpotOptOut.md +92 -0
  123. package/docs/capabilities/joinClan.md +169 -0
  124. package/docs/capabilities/markAllInboxMessagesAsRead.md +72 -0
  125. package/docs/capabilities/markInboxMessageAsRead.md +69 -0
  126. package/docs/capabilities/markUnmarkInboxMessageAsFavorite.md +75 -0
  127. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +98 -0
  128. package/docs/capabilities/playMiniGame.md +217 -0
  129. package/docs/capabilities/playMiniGameBatch.md +129 -0
  130. package/docs/capabilities/registerInTournament.md +187 -0
  131. package/docs/capabilities/reportClickEvent.md +74 -0
  132. package/docs/capabilities/reportImpressionEvent.md +67 -0
  133. package/docs/capabilities/requestMissionClaimReward.md +117 -0
  134. package/docs/capabilities/requestMissionOptIn.md +98 -0
  135. package/docs/capabilities/requestRaffleOptin.md +108 -0
  136. package/docs/capabilities/setAvatar.md +132 -0
  137. package/docs/capabilities/smarticoCallbacks.md +165 -0
  138. package/docs/capabilities/smarticoGlobal.md +62 -0
  139. package/package.json +3 -2
  140. package/readme-smartico-dev.md +208 -0
  141. package/scripts/capture-responses-browser.mjs +301 -0
  142. package/scripts/gen-capabilities.js +368 -0
  143. package/scripts/run-public-api.mjs +105 -0
  144. package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
  145. package/src/MiniGames/SAWTemplate.ts +5 -0
  146. package/src/NodeCache.ts +8 -0
  147. package/src/OCache.ts +17 -0
  148. package/src/SmarticoGlobal.ts +0 -7
  149. package/src/WSAPI/WSAPI.ts +3 -3
  150. package/src/WSAPI/WSAPIJackpots.ts +4 -1
  151. package/src/WSAPI/WSAPIMiniGames.ts +1 -1
  152. package/src/WSAPI/WSAPITypes.ts +44 -0
  153. package/src/WSAPI/WSAPIUser.ts +30 -5
@@ -0,0 +1,112 @@
1
+ # getClanTournamentPlayers — API (TClanTournamentPlayers)
2
+
3
+ > Returns the ranked players of a specific clan within a clan-based tournament instance.
4
+ > Import: `import { TClanTournamentPlayers } from '@smartico/public-api'`
5
+ > Search terms: getClanTournamentPlayers, tournaments, TClanTournamentPlayers
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getClanTournamentPlayers(tournamentInstanceId: number, clanId: number): Promise<TClanTournamentPlayers>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `tournamentInstanceId` — The tournament `instance_id` from a clan-based `TTournament`.
14
+ - `clanId` — The clan ID from `TTournamentDetailed.clan_leaderboard[].clan_id`.
15
+
16
+ ## Returns — `Promise<TClanTournamentPlayers>`
17
+ `TClanTournamentPlayers`:
18
+ - `clan_id` (number) — Clan ID
19
+ - `clan_public_meta` ({ name: string; image_url: string }) — Clan display metadata
20
+ - `players` ({
21
+ user_id: number;
22
+ public_username: string;
23
+ avatar_id: string;
24
+ avatar_real_id: number;
25
+ avatar_url?: string;
26
+ position: number;
27
+ scores: number;
28
+ is_me: boolean;
29
+ clean_ext_user_id: string;
30
+ }[]) — Top players of this clan ranked by score DESC
31
+
32
+ ## Behavioral contract
33
+ **Preconditions**
34
+ Pass a valid `tournamentInstanceId` (read from `TTournament.instance_id`
35
+ returned by `getTournamentsList`) and a `clanId` (read from
36
+ `TTournamentDetailed.clan_leaderboard[].clan_id` returned by
37
+ `getTournamentInstanceInfo`). The tournament should be
38
+ clan-based (`is_clan_based === true`); calling this against a
39
+ non-clan tournament typically returns an empty `players` array.
40
+
41
+ **Refresh model**
42
+ - **No subscription.** This is a one-shot promise.
43
+ - **No client cache.** Every call hits the server.
44
+ - **No push event** refreshes the response. Live updates to clan
45
+ member rankings require a fresh call.
46
+ - The default Smartico UI fetches this once when the user opens the
47
+ clan-drill-down modal and does NOT refresh while the modal is
48
+ open. If your UI needs live updates, re-call on an interval; the
49
+ clan leaderboard at the parent level (via
50
+ `getTournamentInstanceInfo`) does refresh via its own
51
+ polling cadence.
52
+
53
+ **Returned shape**
54
+ `TClanTournamentPlayers` carries the requested clan's identity
55
+ (`clan_id`, `clan_public_meta.name`, `clan_public_meta.image_url`)
56
+ alongside the `players[]` array — each entry has `position`,
57
+ `scores`, `public_username`, `clean_ext_user_id`, `avatar_id`,
58
+ `avatar_real_id`, the resolved `avatar_url`, `user_id`, and the
59
+ `is_me` flag identifying the current user's row. The `clan_id` and
60
+ `clan_public_meta` on the response echo the input clan — the
61
+ default Smartico UI ignores them and renders the header from the
62
+ caller-side `ClanLeaderboardEntry` object, but they're available
63
+ for consumers that don't already have that context.
64
+
65
+ **Username display**: prefer `clean_ext_user_id` when set, falling
66
+ back to `public_username`. The default Smartico UI uses
67
+ `clean_ext_user_id || public_username || ''`.
68
+
69
+ **Idempotency**: safe. Read-only. Each call returns the latest
70
+ server snapshot.
71
+
72
+ **Side effects**: none — pure metadata read.
73
+
74
+ **UI guidance**: see [UI Guide — `getClanTournamentPlayers`](../../docs/ui/tournaments/UIGuide_getClanTournamentPlayers.md).
75
+
76
+ **Visitor mode**: not supported.
77
+
78
+ ## Example
79
+ ```ts
80
+ const detail = await window._smartico.api.getTournamentInstanceInfo(tournamentInstanceId);
81
+ if (!detail.is_clan_based || !detail.clan_leaderboard) {
82
+ console.log('[smartico] not a clan tournament — skip clan drill-down');
83
+ return;
84
+ }
85
+
86
+ // User clicked a clan row in the leaderboard.
87
+ const clickedClan = detail.clan_leaderboard[0];
88
+
89
+ console.log('[smartico] opening clan drill-down — show modal skeleton while loading');
90
+ const result = await window._smartico.api.getClanTournamentPlayers(
91
+ tournamentInstanceId,
92
+ clickedClan.clan_id,
93
+ );
94
+
95
+ if (result.players.length === 0) {
96
+ console.log('[smartico] clan has no ranked players yet — render empty state ("No leaders yet")');
97
+ } else {
98
+ console.log('[smartico] render clan member rows with .is-me highlight on the current user;',
99
+ result.players.length, 'players ranked');
100
+ const me = result.players.find(p => p.is_me);
101
+ if (me) {
102
+ console.log('[smartico] current user rank in this clan:', me.position, 'score:', me.scores);
103
+ }
104
+ }
105
+ ```
106
+
107
+ ## Errors
108
+ See this method's TSDoc / the mutation pages for `err_code` handling.
109
+
110
+ ## Related
111
+ - `getTournamentsList`
112
+ - `getTournamentInstanceInfo`
@@ -0,0 +1,168 @@
1
+ # getClans — API (TClans)
2
+
3
+ > Returns the active clans visible to the current user along with the user's own membership state (`user_clan_id`, `cooldown_until`, `join_date`).
4
+ > Import: `import { TClans } from '@smartico/public-api'`
5
+ > Search terms: getClans, clans, TClans, TClan, onUpdate, subscription, user_clan_id, cooldown_until, join_date
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getClans({ onUpdate }: { onUpdate?: (data: TClans) => void } = {}): Promise<TClans>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `params` — Optional. Omit to fetch without subscribing.
14
+ - `params.onUpdate` — Callback invoked with the full refreshed `TClans` payload whenever the 30 s cache expires and a subsequent fetch lands. Each call to `getClans` overwrites the prior callback.
15
+
16
+ ## Returns — `Promise<TClans>`
17
+ `TClans`:
18
+ - `clans` (TClan[]) — List of active clans available to the user
19
+ - `clan_id` (number) — Clan ID
20
+ - `public_meta` ({
21
+ name: string;
22
+ description: string;
23
+ image_url: string;
24
+ }) — Translated clan metadata
25
+ - `member_count` (number) — Current number of members in clan
26
+ - `capacity_limit` (number) — Max number of members allowed in clan
27
+ - `entry_fee_currency_type_id` (number) — Currency type for `entry_fee_amount`. `0` = points, `1` = gems, `2` = diamonds, `3` = free (no fee).
28
+ - `entry_fee_amount` (number) — Entry fee amount in the currency indicated by `entry_fee_currency_type_id`. `0` (or `entry_fee_currency_type_id === 3`) means the clan is free to join.
29
+ - `rating_position` (number) — Global rank among all active clans in the label, by `rating_score` DESC. `1` = highest-rated. May skip positions when some clans are hidden by per-user visibility (e.g. user sees positions 1, 3, 7).
30
+ - `rating_score` (number) — Clan rating score (higher is better).
31
+ - `user_clan_id` (number | null) — The clan ID the current user belongs to; null if clanless
32
+ - `cooldown_until` (string | null) — Switch-cooldown expiry as ISO 8601 UTC string ("YYYY-MM-DDTHH:MM:SS" with no timezone suffix; interpret as UTC). `null` when no cooldown. User-level: while set, the user cannot join any clan.
33
+ - `join_date` (number | null) — Epoch ms when the current user joined their clan; null if clanless
34
+
35
+ ## Behavioral contract
36
+ **Subscription model (`onUpdate`)**
37
+ The callback receives the FULL refreshed `TClans` payload (never a
38
+ diff/patch). Each subsequent call to `getClans({ onUpdate })`
39
+ REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
40
+ it) to keep the prior callback in place; the callback is never
41
+ auto-cleared.
42
+
43
+ **Update triggers** — note that, unlike most other subscription
44
+ methods in the SDK, this callback is **poll-driven only**. There
45
+ is NO server push that refreshes the clans list. The callback
46
+ fires when:
47
+
48
+ 1. The 30-second cache TTL expires and a subsequent `getClans()`
49
+ call (from the consumer) triggers a fresh fetch.
50
+
51
+ Consequence: clan-membership changes (other users joining your
52
+ clan, an operator-driven kick, a clan being archived) surface
53
+ only on the next consumer-driven fetch. If your UI needs
54
+ near-live state, poll `getClans()` on an interval; or re-call
55
+ after a `joinClan` resolves to pick up the new
56
+ `user_clan_id` immediately.
57
+
58
+ **Reading state from the returned payload**
59
+ Drive list rendering from `clans[]` (already sorted). Identify
60
+ the user's own clan via `clan.clan_id === user_clan_id`
61
+ (`null` for clanless users). Detect an active switch-cooldown
62
+ with `cooldown_until !== null` — when set, the user cannot join
63
+ any clan until the cooldown expires, even clans they could
64
+ normally join. The cooldown is **user-level**, not per-clan.
65
+
66
+ `cooldown_until` is an ISO 8601 UTC datetime string with no
67
+ timezone suffix (`"YYYY-MM-DDTHH:MM:SS"`). Parse as UTC:
68
+ `new Date(cooldown_until + 'Z')` or `moment.utc(cooldown_until)`.
69
+ Display in the user's local time. The default cooldown period
70
+ is configured per label by the operator (typically 7 days).
71
+
72
+ `rating_position` is a global rank computed server-side across
73
+ all active clans in the label (1 = highest-rated). Because some
74
+ clans may be hidden by per-user segment visibility, positions
75
+ the user sees may skip (e.g. 1, 3, 7) — don't assume the array
76
+ spans a contiguous range.
77
+
78
+ The `entry_fee_currency_type_id` enum on each clan uses values
79
+ `0` = points, `1` = gems, `2` = diamonds, `3` = free. Compare
80
+ `entry_fee_amount` against the user's matching balance (from
81
+ `getUserProfile`) to drive Join button affordability.
82
+
83
+ **Cache TTL**: the SDK caches the response for 30 seconds. Cache
84
+ is fully cleared on login / logout.
85
+
86
+ **Idempotency**: safe. Read-only. Repeated calls within the
87
+ cache window return a deep-cloned cached payload without a
88
+ network round-trip.
89
+
90
+ **Side effects**: none — pure metadata read.
91
+
92
+ **UI guidance**: see [UI Guide — `getClans`](../../docs/ui/clans/UIGuide_getClans.md).
93
+
94
+ **Visitor mode**: not supported.
95
+
96
+ ## Example
97
+ ```ts
98
+ const result = await window._smartico.api.getClans({
99
+ onUpdate: (refreshed) => {
100
+ console.log('[smartico] clans payload refreshed (poll-driven; ~30 s cadence) — re-render the clan list from this payload:', refreshed);
101
+ },
102
+ });
103
+
104
+ console.log('[smartico] user is', result.user_clan_id == null ? 'clanless' : 'in clan ' + result.user_clan_id);
105
+
106
+ // Cooldown handling — affects ALL clans, not a specific one.
107
+ if (result.cooldown_until) {
108
+ const cooldownEndsUtc = new Date(result.cooldown_until + 'Z');
109
+ console.log('[smartico] switch-cooldown active — disable all Join buttons until', cooldownEndsUtc.toLocaleString(),
110
+ '(local). Render the cooldown end on the disabled button label.');
111
+ }
112
+
113
+ // Render clans — already sorted by rating_position ASC.
114
+ for (const clan of result.clans) {
115
+ const isMine = clan.clan_id === result.user_clan_id;
116
+ const isFull = clan.member_count >= clan.capacity_limit;
117
+
118
+ if (isMine) {
119
+ console.log('[smartico] highlight clan', clan.clan_id, 'as "Your clan"; CTA label "Your clan", no-op');
120
+ } else if (result.cooldown_until) {
121
+ console.log('[smartico] clan', clan.clan_id, '— Join blocked by user cooldown; show disabled button with cooldown end date');
122
+ } else if (isFull) {
123
+ console.log('[smartico] clan', clan.clan_id, '— Clan full; show disabled "Clan is full" button');
124
+ } else {
125
+ const label = clan.entry_fee_amount === 0 || clan.entry_fee_currency_type_id === 3
126
+ ? 'Join free'
127
+ : `Join (${clan.entry_fee_amount} ${['Points','Gems','Diamonds'][clan.entry_fee_currency_type_id]})`;
128
+ console.log('[smartico] clan', clan.clan_id, '— render enabled Join button labelled', label);
129
+ }
130
+ }
131
+
132
+ // After a successful joinClan(), re-call getClans manually — no push refresh.
133
+ // const r = await window._smartico.api.joinClan(targetClanId);
134
+ // if (r.errCode === 0) await window._smartico.api.getClans();
135
+ ```
136
+
137
+ ### Example response (REAL shape)
138
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
139
+ ```json
140
+ {
141
+ "clans": [
142
+ {
143
+ "clan_id": 6,
144
+ "public_meta": {
145
+ "name": "Joker Clan",
146
+ "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…",
147
+ "image_url": "https://cdn.example/00000000-0000-0000-0000-000000000000/entity-image-1780057181857-1.png"
148
+ },
149
+ "member_count": 885,
150
+ "capacity_limit": 1000,
151
+ "entry_fee_currency_type_id": 0,
152
+ "entry_fee_amount": 100,
153
+ "rating_position": 1,
154
+ "rating_score": 90
155
+ }
156
+ ],
157
+ "user_clan_id": null,
158
+ "cooldown_until": null,
159
+ "join_date": null
160
+ }
161
+ ```
162
+
163
+ ## Errors
164
+ See this method's TSDoc / the mutation pages for `err_code` handling.
165
+
166
+ ## Related
167
+ - `joinClan`
168
+ - `getUserProfile`
@@ -0,0 +1,123 @@
1
+ # getCurrentLevel — API (TLevelCurrent)
2
+
3
+ > Returns the user's current level — every `TLevel` field plus a computed `progress` percentage toward the next level.
4
+ > Import: `import { TLevelCurrent } from '@smartico/public-api'`
5
+ > Search terms: getCurrentLevel, user, getUserLevel, TLevelCurrent, id, name, description, image, required_points, visibility_points, required_level_counter_1, required_level_counter_2
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getCurrentLevel(): Promise<TLevelCurrent>
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `Promise<TLevelCurrent>`
16
+ `TLevelCurrent`:
17
+ - `id` (number) — Stable ID of the level.
18
+ - `name` (string) — Display name of the level, pre-translated to the user's language.
19
+ - `description` (string) — Display description of the level, pre-translated to the user's language.
20
+ - `image` (string) — URL of the level image (256x256 px source).
21
+ - `required_points` (number) — Total `ach_points_ever` required to reach this level.
22
+ - `visibility_points` (number) — Visibility threshold — clients hide the level from the user until `ach_points_ever >= visibility_points`. `null` means always visible.
23
+ - `required_level_counter_1` (number) — Required value of the first level counter for sliding-window leveling. `null` on points-only labels. See `UserLevelExtraCountersT`.
24
+ - `required_level_counter_2` (number) — Required value of the second level counter for sliding-window leveling. `null` on points-only labels.
25
+ - `custom_data` (string) — Operator-defined custom data. The SDK auto-parses JSON-looking strings, so at runtime this is `any` despite the `string` type.
26
+ - `ordinal_position` (number) — 1-based position in the ladder (matches the order of the returned array, which is sorted by `required_points` ASC).
27
+ - `progress` (number) — Progress to the next level as a 0–100 integer percentage. `100` at the highest level.
28
+
29
+ ## Behavioral contract
30
+ **How `progress` is computed**
31
+ The SDK derives `progress` as the *delta-from-current-level-floor*:
32
+ `(ach_points_ever − current.required_points) / (next.required_points
33
+ − current.required_points) × 100`, clamped to `[0, 100]`. At the
34
+ highest level (no next level), `progress` is `100`. Reading the
35
+ source values directly from `getUserProfile`'s
36
+ `ach_points_ever` and `getLevels` would also work, but
37
+ `progress` saves the math.
38
+
39
+ **Cache TTL & freshness**
40
+ The response is cached for 30 seconds, but the SDK automatically
41
+ drops that cache whenever a user-properties update arrives — the
42
+ same live channel that backs `getUserProfile`. The practical
43
+ effect depends on the label's leveling logic:
44
+ - **Points-based or operator-manual leveling**: a points or level
45
+ change flows through the user-properties channel, so the cache is
46
+ busted at that moment and the next `getCurrentLevel()` call
47
+ returns up-to-date data without waiting out the TTL.
48
+ - **Counter-based leveling** (level driven by sliding-window
49
+ counters such as deposit or wagering totals over a recent window —
50
+ see `getUserLevelExtraCounters`): ordinary progress changes
51
+ are recomputed by a periodic server job and do NOT emit a
52
+ user-properties update, so they become visible on this method only
53
+ after the 30 s TTL expires (or after `_smartico.api.clearCaches()`).
54
+
55
+ Avoid calling `clearCaches()` on the points/manual path — it's
56
+ unnecessary there (the cache is already refreshed on the property
57
+ update) and forces a slower extra round-trip.
58
+
59
+ **Leveling logic**
60
+ The semantics of how a user advances depends on the label's
61
+ leveling logic (configured per brand): points-only (the default),
62
+ sliding-window with extra counters (uses
63
+ `getUserLevelExtraCounters`), or fully-manual operator
64
+ assignment. The `progress` percentage on this method assumes the
65
+ points-only model — it's not meaningful for manual-only labels
66
+ where level changes are operator-driven rather than points-driven.
67
+
68
+ **Idempotency**: safe. Read-only. Repeated calls within the cache
69
+ window return a deep-cloned cached value without a network
70
+ round-trip.
71
+
72
+ **Side effects**: none — pure read.
73
+
74
+ **Visitor mode**: not supported.
75
+
76
+ ## Example
77
+ ```ts
78
+ const level = await window._smartico.api.getCurrentLevel();
79
+ console.log('[smartico] render level badge — name:', level.name,
80
+ 'progress:', Math.round(level.progress), '%');
81
+
82
+ // Detect level-up via getUserProfile's push channel. No clearCaches()
83
+ // needed — the SDK already drops the level cache on this update.
84
+ window._smartico.on('props_change', async (changed) => {
85
+ if ('ach_level_current_id' in changed) {
86
+ const fresh = await window._smartico.api.getCurrentLevel();
87
+ console.log('[smartico] user levelled up — animate badge to new level:', fresh.name);
88
+ }
89
+ });
90
+ ```
91
+
92
+ ### Example response (REAL shape)
93
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
94
+ ```json
95
+ {
96
+ "id": 698,
97
+ "name": "Silver",
98
+ "description": "Now you’re playing! Enjoy exclusive missions and exciting rewards.",
99
+ "image": "https://cdn.example/665b45d5a01e2191288091-3silver.png",
100
+ "required_points": 500,
101
+ "visibility_points": 0,
102
+ "required_level_counter_1": null,
103
+ "required_level_counter_2": null,
104
+ "custom_data": {
105
+ "reward": "1000 EUR + 300 Free Spins",
106
+ "image_inactive": "https://cdn.example/bdf58fecfda5a1b9627f8f-LevelLevel3Enabledfalse.png",
107
+ "image_active": "https://cdn.example/90a40da1c5e201f8fa1d3c-LevelLevel3Enabledtrue.png",
108
+ "rakeback": 5,
109
+ "has_vip_club": true,
110
+ "cashback": 2
111
+ },
112
+ "ordinal_position": 3,
113
+ "progress": 38
114
+ }
115
+ ```
116
+
117
+ ## Errors
118
+ See this method's TSDoc / the mutation pages for `err_code` handling.
119
+
120
+ ## Related
121
+ - `getUserProfile`
122
+ - `getLevels`
123
+ - `getUserLevelExtraCounters`
@@ -0,0 +1,96 @@
1
+ # getCustomSections — API (TUICustomSection)
2
+
3
+ > Returns the operator-configured "custom sections" the current user is eligible to see.
4
+ > Import: `import { TUICustomSection } from '@smartico/public-api'`
5
+ > Search terms: getCustomSections, general, TUICustomSection, AchCustomSectionType, AchCustomLayoutTheme, AchMissionsTabsOptions, AchOverviewMissionsFilter, LiquidEntityData, id, body, menu_img, menu_name, section_type_id, liquid_entity_data, liquid_template
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getCustomSections(): Promise<TUICustomSection[]>
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `Promise<TUICustomSection[]>`
16
+ Array of `TUICustomSection`. Each item:
17
+ - `id` (number) — Stable numeric ID of the section.
18
+ - `body` (string) — Raw HTML body for `HTML_PAGE` sections; Liquid template body for `LEVELS` (Liquid) sections.
19
+ - `menu_img` (string) — CDN URL of the section's nav icon, 64x64 px square.
20
+ - `menu_name` (string) — Display name shown next to the nav icon. Pre-translated server-side.
21
+ - `custom_skin_images` (string) — JSON-serialized list of skin image overrides for themed sections (e.g. `MISSION_CUSTOM_LAYOUT`).
22
+ - `section_type_id` (AchCustomSectionType) — Dispatch key — see `AchCustomSectionType`.
23
+ - `theme` (AchCustomLayoutTheme) — Themed-layout name for `MISSION_CUSTOM_LAYOUT` sections; see `AchCustomLayoutTheme`.
24
+ - `generic_custom_css` (string) — Custom CSS for themed layouts.
25
+ - `mission_tabs_options` (AchMissionsTabsOptions) — Which tabs to render for `MISSIONS_CATEGORY` sections; see `AchMissionsTabsOptions`.
26
+ - `overview_missions_filter` (AchOverviewMissionsFilter) — Mission-filter rule for the Overview tab; see `AchOverviewMissionsFilter`.
27
+ - `overview_missions_count` (number) — Maximum number of missions shown in the Overview tab.
28
+ - `url_or_dp` (string) — Click target for `REDIRECT_LINK` sections — either a Smartico DP string (`dp:…`) or an external URL.
29
+ - `liquid_entity_data` (LiquidEntityData[]) — Data-context selectors for Liquid templates; see `LiquidEntityData`.
30
+ - `ach_tournament_id` (number) — Tournament ID for a single-tournament Liquid template (`LiquidEntityData.Tournament`).
31
+ - `show_raw_data` (boolean) — Operator debug flag — when `true`, Liquid renders raw context data instead of the templated HTML.
32
+ - `liquid_template` (number) — Liquid template ID resolved server-side; the rendered body is delivered in `body`.
33
+ - `ach_category_ids` (number[]) — Category IDs the section filters badges by — correlate with `getAchCategories()`.
34
+ - `shop_category_ids` (number[]) — Category IDs the section filters store items by — correlate with `getStoreCategories()`.
35
+ - `raffle_id` (number) — Raffle ID for `RAFFLE` sections (and `LiquidEntityData.SingleRaffle` Liquid templates).
36
+
37
+ ## Behavioral contract
38
+ **Preconditions**
39
+ - No prerequisite calls. Typically fetched once at app boot to build the
40
+ navigation skeleton.
41
+
42
+ **Server-side eligibility filtering**
43
+ Sections are filtered server-side by the user's segments / level / brand and
44
+ the section's `active_from_date` / `active_till_date` window. Sections the
45
+ user is ineligible for are omitted from the response entirely — there is no
46
+ "locked" state to render.
47
+
48
+ **Ordering**
49
+ Response is server-ordered. Render in the order received; do NOT re-sort
50
+ client-side (the operator's order is the intended nav order).
51
+
52
+ **Refresh**
53
+ - The SDK caches results for 30 seconds.
54
+ - No push subscription. Re-call after a segment / level change might
55
+ make new sections eligible, or just rely on the 30 s cache turnover.
56
+
57
+ **Visitor mode**: supported.
58
+
59
+ **UI guidance**: see [UI Guide — `getCustomSections`](../../docs/ui/general/UIGuide_getCustomSections.md).
60
+
61
+ ## Example
62
+ ```ts
63
+ const sections = await window._smartico.api.getCustomSections();
64
+
65
+ for (const s of sections) {
66
+ console.log('[smartico] nav entry', s.menu_name, 'type', s.section_type_id, '→ mount the matching page component');
67
+ // Render s.menu_img (64x64) as the nav icon and s.menu_name as the label.
68
+ // For section_type_id === AchCustomSectionType.REDIRECT_LINK, do NOT mount a page —
69
+ // resolve s.url_or_dp on click (DP string or external URL).
70
+ }
71
+ ```
72
+
73
+ ### Example response (REAL shape)
74
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
75
+ ```json
76
+ [
77
+ {
78
+ "id": 625,
79
+ "body": "<!-- Google Font -->\n<link href=\"https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,100..900;1,100..900&display=swap\" rel=\"stylesheet\">\n\n<style…",
80
+ "menu_img": "https://cdn.example/9f1d1ae8915eef1f5db75c-Storeitemcopy21ice.png",
81
+ "menu_name": "Custom overview",
82
+ "section_type_id": 4,
83
+ "liquid_entity_data": [
84
+ 1
85
+ ],
86
+ "liquid_template": 1
87
+ }
88
+ ]
89
+ ```
90
+
91
+ ## Errors
92
+ See this method's TSDoc / the mutation pages for `err_code` handling.
93
+
94
+ ## Related
95
+ - `AchCustomSectionType`
96
+ - `TUICustomSection`
@@ -0,0 +1,87 @@
1
+ # getInboxMessageBody — API (TInboxMessageBody)
2
+
3
+ > Returns the rich body of a single inbox message — title, preview text, icon, click action, optional rich HTML body, and optional buttons.
4
+ > Import: `import { TInboxMessageBody } from '@smartico/public-api'`
5
+ > Search terms: getInboxMessageBody, inbox, TInboxMessageBody, Button, action, icon, title, preview_body, custom_data
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `messageGuid` — The `message_guid` from a `TInboxMessage` returned by `getInboxMessages`.
14
+
15
+ ## Returns — `Promise<TInboxMessageBody>`
16
+ `TInboxMessageBody`:
17
+ - `title` (string) — Display title.
18
+ - `preview_body` (string) — Short preview text (typically rendered alongside the title in list items).
19
+ - `icon` (string) — Message icon URL (128×128 px recommended).
20
+ - `action` (string) — Click-action — either a deep-link (e.g. `'dp:deposit'`) or a plain URL. The literal `'dp:inbox'` indicates the message has a rich `html_body`; for any other value `html_body` and `buttons` are absent. Pass to `_smartico.dp(action)` for safe execution.
21
+ - `html_body` (string) — Rich HTML body. Populated only when `action === 'dp:inbox'`.
22
+ - `buttons` ({
23
+ /** Button click-action (deep-link or URL). */
24
+ action: string;
25
+ /** Button label. */
26
+ text: string;
27
+ }[]) — Up to 2 additional action buttons. Populated only when `action === 'dp:inbox'`.
28
+ - `custom_data` (string) — Operator-defined custom data. The SDK auto-parses JSON-looking strings, so at runtime this is `any` despite the `string` type.
29
+
30
+ ## Behavioral contract
31
+ **Rich vs simple messages**
32
+ The shape of the returned body branches on the `action` field:
33
+ - When `action === 'dp:inbox'`, the message has a rich HTML body
34
+ (`html_body`) and may have up to 2 action `buttons`. Use these
35
+ for a full-detail rendering.
36
+ - For any other `action` (deep-link like `'dp:deposit'` or a URL),
37
+ the message is a simple notification — `html_body` and
38
+ `buttons` will be `undefined` regardless of what's in the
39
+ underlying CDN payload. Render `title` + `preview_body` + a
40
+ single CTA driving the `action`.
41
+
42
+ **The `action` field**
43
+ For both shapes, `action` carries either a deep-link
44
+ (`'dp:gf_missions'`) or a plain URL. Pass it to `_smartico.dp()`
45
+ for safe execution — that helper handles URL vs deep-link
46
+ routing.
47
+
48
+ **Idempotency / Side effects**: safe. Read-only HTTP fetch.
49
+
50
+ **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
51
+
52
+ **Visitor mode**: not supported.
53
+
54
+ ## Example
55
+ ```ts
56
+ const body = await window._smartico.api.getInboxMessageBody(messageGuid);
57
+
58
+ console.log('[smartico] render message — title:', body.title,
59
+ '— preview:', body.preview_body,
60
+ '— icon:', body.icon);
61
+
62
+ if (body.action === 'dp:inbox' && body.html_body) {
63
+ console.log('[smartico] rich message — render the html_body in a sandboxed iframe; render up to 2 action buttons:',
64
+ body.buttons?.length ?? 0);
65
+ } else {
66
+ console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
67
+ '— execute via _smartico.dp(body.action)');
68
+ }
69
+ ```
70
+
71
+ ### Example response (REAL shape)
72
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
73
+ ```json
74
+ {
75
+ "action": "dp:close",
76
+ "icon": "https://cdn.example/d0f46ded3f7c9439fa0239-home-gems.webp",
77
+ "title": "Congratulations!",
78
+ "preview_body": "You have received 10 Gems to your balance!",
79
+ "custom_data": {}
80
+ }
81
+ ```
82
+
83
+ ## Errors
84
+ See this method's TSDoc / the mutation pages for `err_code` handling.
85
+
86
+ ## Related
87
+ - `getInboxMessages`