@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,146 @@
1
+ # getInboxMessages — API (TInboxMessage)
2
+
3
+ > Returns the user's inbox messages — newest first — with optional filtering by category, favorite status, and read state.
4
+ > Import: `import { TInboxMessage } from '@smartico/public-api'`
5
+ > Search terms: getInboxMessages, inbox, TInboxMessage, InboxCategories, onUpdate, subscription, sent_date, message_guid, read, favorite, category_id, expire_on_dt
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getInboxMessages({
10
+ from,
11
+ to,
12
+ onlyFavorite,
13
+ categoryId,
14
+ read_status,
15
+ onUpdate,
16
+ }: {
17
+ from?: number;
18
+ to?: number;
19
+ onlyFavorite?: boolean;
20
+ categoryId?: InboxCategories;
21
+ read_status?: InboxReadStatus;
22
+ onUpdate?: (data: TInboxMessage[]) => void;
23
+ } = {}): Promise<TInboxMessage[]>
24
+ ```
25
+
26
+ ## Parameters
27
+ - `params` — Optional filters + subscription.
28
+ - `params.from` — First message index (0-based). Defaults to `0`.
29
+ - `params.to` — Last message index (exclusive). Defaults to `20`. Server caps the page at 20.
30
+ - `params.onlyFavorite` — When `true`, returns only favorite (starred) messages.
31
+ - `params.categoryId` — When set, returns only messages in this category (`InboxCategories`).
32
+ - `params.read_status` — When set, scopes to read or unread only (`InboxReadStatus`).
33
+ - `params.onUpdate` — Callback invoked with the full refreshed list when a new message arrives.
34
+
35
+ ## Returns — `Promise<TInboxMessage[]>`
36
+ Array of `TInboxMessage`. Each item:
37
+ - `message_guid` (string) — Unique identifier of the message. Pass to `getInboxMessageBody` and the mark / favorite / delete mutations.
38
+ - `sent_date` (string) — Date-time the message was sent, as a `"dd/MM/yyyy HH:mm:ss"` string (server local — NOT ISO-8601, so `new Date(sent_date)` will not parse it).
39
+ - `read` (boolean) — `true` when the message has been marked read.
40
+ - `favorite` (boolean) — `true` when the message has been starred (favorited).
41
+ - `category_id` (InboxCategories) — Operator-assigned category (`InboxCategories`).
42
+ - `expire_on_dt` (number) — Expiry timestamp as Unix-ms epoch. Server filters out expired messages from list responses — consumers rarely see this set unless the expiry is upcoming.
43
+
44
+ ## Behavioral contract
45
+ **Subscription model (`onUpdate`)**
46
+ The callback receives the FULL refreshed message list (never a
47
+ diff/patch). Each subsequent call to `getInboxMessages({ onUpdate })`
48
+ REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
49
+ it) to keep the prior callback in place; the callback is never
50
+ auto-cleared.
51
+
52
+ **Update triggers** — the callback fires ONLY when:
53
+
54
+ 1. A new message is pushed by the server (campaign / automation /
55
+ operator send). The refreshed list includes the new message
56
+ at the top.
57
+
58
+ Does NOT fire for: `markInboxMessageAsRead`,
59
+ `markAllInboxMessagesAsRead`,
60
+ `markUnmarkInboxMessageAsFavorite`, `deleteInboxMessage`,
61
+ `deleteAllInboxMessages`. After a mutation, re-call
62
+ `getInboxMessages` manually if your UI needs the refreshed list
63
+ — or maintain optimistic state locally.
64
+
65
+ **Pagination**
66
+ `from` (defaults to `0`) and `to` (defaults to `20`) define a
67
+ half-open range of message indices. The server caps the page at
68
+ **20 messages per request** — passing `to - from > 20` silently
69
+ truncates to 20. For "load more" pagination, advance `from` by
70
+ the prior page size on each subsequent call.
71
+
72
+ **Filters**
73
+ All filters are ANDed server-side. Omitting a filter means "no
74
+ constraint" on that dimension:
75
+ - `categoryId` (`InboxCategories`): `General` (0),
76
+ `Platform` (1), `Personal` (2). Omit to get all categories.
77
+ - `onlyFavorite: true` returns only starred messages.
78
+ Omit / `false` returns all (starred and not).
79
+ - `read_status` (`InboxReadStatus`): `UnreadOnly` (1) or
80
+ `ReadOnly` (2). Omit to get both.
81
+
82
+ **Server-side filtering** (always applied)
83
+ Expired messages (`expire_on_dt` in the past) and
84
+ soft-deleted messages are excluded server-side. Consumers do not
85
+ need to filter for these.
86
+
87
+ **No client cache**: every call sends a fresh server round-trip.
88
+ To avoid redundant fetches in your UI, hold the result in
89
+ application state and re-fetch on `onUpdate` fires or explicit
90
+ user-driven refresh.
91
+
92
+ **Idempotency / Side effects**: safe. Read-only.
93
+
94
+ **UI guidance**: see [UI Guide — `getInboxMessages`](../../docs/ui/inbox/UIGuide_getInboxMessages.md).
95
+
96
+ **Visitor mode**: not supported.
97
+
98
+ ## Example
99
+ ```ts
100
+ const messages = await window._smartico.api.getInboxMessages({
101
+ onUpdate: (refreshed) => {
102
+ console.log('[smartico] new inbox message arrived — re-render the list from this array, new message is at index 0:', refreshed);
103
+ },
104
+ });
105
+
106
+ // For each message, fetch its body for the list view (title, preview, icon).
107
+ for (const msg of messages) {
108
+ const body = await window._smartico.api.getInboxMessageBody(msg.message_guid);
109
+ console.log('[smartico] render message', msg.message_guid,
110
+ '— title:', body.title,
111
+ '— preview:', body.preview_body,
112
+ '— read:', msg.read,
113
+ '— favorite:', msg.favorite);
114
+ }
115
+
116
+ // "Load more" pagination — advance from by the prior page size.
117
+ const page2 = await window._smartico.api.getInboxMessages({ from: 20, to: 40 });
118
+ console.log('[smartico] page 2:', page2.length, 'messages');
119
+
120
+ // Filter examples.
121
+ const onlyStarred = await window._smartico.api.getInboxMessages({ onlyFavorite: true });
122
+ const onlyUnread = await window._smartico.api.getInboxMessages({ read_status: 1 }); // InboxReadStatus.UnreadOnly
123
+ ```
124
+
125
+ ### Example response (REAL shape)
126
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
127
+ ```json
128
+ [
129
+ {
130
+ "sent_date": "24/06/2026 07:43:31",
131
+ "message_guid": "00000000-0000-0000-0000-000000000000",
132
+ "read": true,
133
+ "favorite": false,
134
+ "category_id": 0,
135
+ "expire_on_dt": 1784879011491
136
+ }
137
+ ]
138
+ ```
139
+
140
+ ## Errors
141
+ See this method's TSDoc / the mutation pages for `err_code` handling.
142
+
143
+ ## Related
144
+ - `getInboxMessageBody`
145
+ - `InboxCategories`
146
+ - `InboxReadStatus`
@@ -0,0 +1,54 @@
1
+ # getInboxUnreadCount — API
2
+
3
+ > Returns the user's current unread inbox message count — a single integer suitable for driving a header badge.
4
+ > Import: `import { /* types */ } from '@smartico/public-api'`
5
+ > Search terms: getInboxUnreadCount, inbox, onUpdate, subscription
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getInboxUnreadCount({ onUpdate }: { onUpdate?: (unread_count: number) => void } = {}): Promise<number>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `params` — Optional subscription bag.
14
+ - `params.onUpdate` — Callback invoked with the new unread count whenever it changes (push-driven).
15
+
16
+ ## Returns
17
+ Resolves to `number`.
18
+
19
+ ## Behavioral contract
20
+ **Subscription model**
21
+ `onUpdate` fires whenever the cached value changes — either on a
22
+ push from the user-properties channel (new message arrival,
23
+ mark-as-read, delete) or after an inbox-list fetch that returns
24
+ a fresh count.
25
+
26
+ **Cache TTL**: 30 seconds. The cached value is patched in place
27
+ by push events (no full re-fetch on every push), so the
28
+ `onUpdate` callback reflects server state with sub-second latency
29
+ regardless of the TTL.
30
+
31
+ **Idempotency / Side effects**: safe. Read-only.
32
+
33
+ **Visitor mode**: not supported.
34
+
35
+ ## Example
36
+ ```ts
37
+ // Static read for an initial badge render.
38
+ const count = await window._smartico.api.getInboxUnreadCount();
39
+ console.log('[smartico] inbox badge initial count:', count);
40
+
41
+ // Live subscription for badge updates.
42
+ await window._smartico.api.getInboxUnreadCount({
43
+ onUpdate: (newCount) => {
44
+ console.log('[smartico] inbox count changed — update the badge to:', newCount,
45
+ '— hide badge entirely when 0, show raw integer otherwise (no "99+" cap in the default UI)');
46
+ },
47
+ });
48
+ ```
49
+
50
+ ## Errors
51
+ See this method's TSDoc / the mutation pages for `err_code` handling.
52
+
53
+ ## Related
54
+ - `getUserProfile`
@@ -0,0 +1,93 @@
1
+ # getJackpotEligibleGames — API (TGetJackpotEligibleGamesResponse)
2
+
3
+ > Returns the casino games eligible to contribute to a specific jackpot — the catalog the user must play to grow the pot.
4
+ > Import: `import { TGetJackpotEligibleGamesResponse } from '@smartico/public-api'`
5
+ > Search terms: getJackpotEligibleGames, jackpots, TGetJackpotEligibleGamesResponse, JackpotEligibleGame, onUpdate, subscription, eligible_games
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getJackpotEligibleGames({ jp_template_id, onUpdate } : {
10
+ /** Jackpot template ID (required). */
11
+ jp_template_id: number,
12
+ /** Optional callback; not auto-invoked today. */
13
+ onUpdate?: () => void,
14
+ }): Promise<TGetJackpotEligibleGamesResponse>
15
+ ```
16
+
17
+ ## Parameters
18
+ _None._
19
+
20
+ ## Returns — `Promise<TGetJackpotEligibleGamesResponse>`
21
+ `TGetJackpotEligibleGamesResponse`:
22
+ - `eligible_games` (JackpotEligibleGame[])
23
+ - `game_id` (number) — ID of the game on Smartico side
24
+ - `ext_game_id` (string) — ID of the game on operator side
25
+ - `name` (string) — Name of the game
26
+ - `link` (string) — Link to the game
27
+ - `image` (string) — Image of the game
28
+ - `enabled` (boolean) — Whether the game is enabled
29
+ - `game_categories` (string[]) — Categories of the game
30
+ - `game_provider` (string) — Provider of the game
31
+ - `mobile_spec_link` (string) — The link to the mobile game
32
+ - `priority` (number) — The priority of the game
33
+
34
+ ## Behavioral contract
35
+ **Preconditions**
36
+ - User must be authenticated. Visitor mode not supported.
37
+ - `jp_template_id` is mandatory.
38
+
39
+ **`onUpdate` caveat**
40
+ The `onUpdate` callback is accepted to match the SDK's subscription
41
+ contract but is NOT auto-invoked by any current server push. It will only
42
+ fire if a consumer (or a future SDK version) explicitly pushes an update.
43
+ Treat it as a no-op for now.
44
+
45
+ **Refresh**
46
+ - The SDK caches per `jp_template_id` for 30 seconds.
47
+ - Cache does NOT clear on opt-in / opt-out / jackpot-win — eligible-game
48
+ lists rarely change during a session. Wait for the 30 s TTL.
49
+
50
+ **Error handling**
51
+ Non-zero `errCode` on control-group users or generic server errors.
52
+ Branch on `errCode === 0` and surface `errMsg` on failure.
53
+
54
+ **Visitor mode**: not supported.
55
+
56
+ **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
57
+
58
+ ## Example
59
+ ```ts
60
+ const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
61
+
62
+ if (jp?.ach_related_game_allow_all) {
63
+ console.log('[smartico] all games eligible — hide the eligible-games tab');
64
+ return;
65
+ }
66
+
67
+ const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
68
+ console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
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
+ "eligible_games": [
76
+ {
77
+ "game_id": 2106041136,
78
+ "ext_game_id": "666",
79
+ "name": "Deadman's Luck",
80
+ "image": "https://cdn.example/d67393a1c13d95219e6d03-SlotLogowithSkulls.png",
81
+ "enabled": true,
82
+ "priority": 1
83
+ }
84
+ ]
85
+ }
86
+ ```
87
+
88
+ ## Errors
89
+ See this method's TSDoc / the mutation pages for `err_code` handling.
90
+
91
+ ## Related
92
+ - `JackpotDetails.ach_related_game_allow_all`
93
+ - `TGetJackpotEligibleGamesResponse`
@@ -0,0 +1,113 @@
1
+ # getJackpotWinners — API (JackpotWinnerHistory)
2
+
3
+ > Returns past winners of a specific jackpot template, paginated.
4
+ > Import: `import { JackpotWinnerHistory } from '@smartico/public-api'`
5
+ > Search terms: getJackpotWinners, jackpots, JackpotWinnerHistory, JackPotWinner, winner, win_date_ts, jp_pot_id
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getJackpotWinners({
10
+ limit,
11
+ offset,
12
+ jp_template_id,
13
+ }: {
14
+ /** Page size (default 20). */
15
+ limit?: number;
16
+ /** Pagination offset (default 0). */
17
+ offset?: number;
18
+ /** Jackpot template ID (required). */
19
+ jp_template_id?: number;
20
+ }): Promise<JackpotWinnerHistory[]>
21
+ ```
22
+
23
+ ## Parameters
24
+ _None._
25
+
26
+ ## Returns — `Promise<JackpotWinnerHistory[]>`
27
+ Array of `JackpotWinnerHistory`. Each item:
28
+ - `jp_pot_id` (number) — Id of the jackpot pot
29
+ - `win_date_ts` (number) — Date of winning in milliseconds
30
+ - `winner` (JackPotWinner) — Info about jackpot winner
31
+ - `is_me` (boolean) — Flag indicating that this winner is the currently logged in user
32
+ - `public_username` (string) — Name of the winner, note that for all users except is_me, the name is masked by default, but masking can be disabled by request to Smartico AM team
33
+ - `winning_amount_jp_currency` (number) — Won amount in the Jackpot currency
34
+ - `winning_amount_wallet_currency` (number) — Won amount in the user Wallet currency
35
+ - `winning_position` (number) — Position of the winner. Relevant for jackpots where there could be multiple winners
36
+ - `avatar_id` (string) — Avatar of the winner
37
+
38
+ ## Behavioral contract
39
+ **Preconditions**
40
+ - User must be authenticated. Visitor mode not supported.
41
+ - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
42
+ - The consumer SHOULD check
43
+ `JackpotDetails.expose_winners_over_api` before calling, since
44
+ the server does not enforce it.
45
+
46
+ **Pagination**
47
+ Server default page size is 20. Pass `limit` and `offset` to paginate
48
+ (e.g. infinite-scroll). The wire response carries a `has_more` flag, but
49
+ this SDK method returns only the `winners` array — detect end-of-list by
50
+ a returned array shorter than `limit`.
51
+
52
+ **Currency caveat**
53
+ Winner amounts in the response (`winner.winning_amount_jp_currency`) are
54
+ in the jackpot's NATIVE currency, NOT the user's wallet currency. If a
55
+ user-currency display is needed, the consumer must convert client-side.
56
+
57
+ **Refresh**
58
+ - The SDK caches per `jp_template_id` for 30 seconds.
59
+ - Caches clear on jackpot-win push events and on opt-in / opt-out.
60
+
61
+ **Error handling**
62
+ Non-zero `errCode` on control-group users or generic server errors. The
63
+ SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
64
+ surface `errMsg` on failure.
65
+
66
+ **Visitor mode**: not supported.
67
+
68
+ **UI guidance**: see [UI Guide — `getJackpotWinners`](../../docs/ui/jackpots/UIGuide_getJackpotWinners.md).
69
+
70
+ ## Example
71
+ ```ts
72
+ const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
73
+
74
+ if (!jp || !jp.expose_winners_over_api) {
75
+ console.log('[smartico] winners hidden by operator config — hide the winners tab');
76
+ return;
77
+ }
78
+
79
+ const winners = await window._smartico.api.getJackpotWinners({
80
+ jp_template_id: 42,
81
+ limit: 20,
82
+ offset: 0,
83
+ });
84
+ console.log('[smartico] render', winners.length, 'recent winner rows (amounts in', jp.jp_currency + ')');
85
+ ```
86
+
87
+ ### Example response (REAL shape)
88
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
89
+ ```json
90
+ [
91
+ {
92
+ "winner": {
93
+ "is_me": false,
94
+ "public_username": "731:*****",
95
+ "winning_amount_jp_currency": 16.720332488,
96
+ "winning_amount_wallet_currency": 98.525768722,
97
+ "winning_position": 1,
98
+ "avatar_id": "183751796",
99
+ "avatar_real_id": null
100
+ },
101
+ "win_date_ts": 1782295329703,
102
+ "jp_pot_id": 306053
103
+ }
104
+ ]
105
+ ```
106
+
107
+ ## Errors
108
+ See this method's TSDoc / the mutation pages for `err_code` handling.
109
+
110
+ ## Related
111
+ - `JackpotDetails`
112
+ - `JackpotDetails.expose_winners_over_api`
113
+ - `JackpotWinnerHistory`
@@ -0,0 +1,187 @@
1
+ # getLeaderBoard — API (LeaderBoardDetailsT)
2
+
3
+ > Returns the operator-configured standalone leaderboard for the given period type — top-20 ranked entries, the current user's own entry (when authenticated), and the configured prize table.
4
+ > Import: `import { LeaderBoardDetailsT } from '@smartico/public-api'`
5
+ > Search terms: getLeaderBoard, leaderboard, getLeaderboard, LeaderBoardDetailsT, LeaderBoardPeriodType, LeaderBoardsRewardsT, LeaderBoardUserT, board_id, name, description, rules, period_type_id, version_id, create_date, rewards
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getLeaderBoard(periodType: LeaderBoardPeriodType, getPreviousPeriod?: boolean | number): Promise<LeaderBoardDetailsT>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `periodType` — The board's period type (`LeaderBoardPeriodType`). Selects which pre-configured board to fetch; the board itself is bound to one period by the operator.
14
+ - `getPreviousPeriod` — Which period to fetch. `false` (default) = current in-progress period; `true` = the most recent finalized snapshot; a number `n` = the n-th previous snapshot (`1` = previous, `2` = the one before, …).
15
+
16
+ ## Returns — `Promise<LeaderBoardDetailsT>`
17
+ `LeaderBoardDetailsT`:
18
+ - `board_id` (number) — Stable ID of the leaderboard.
19
+ - `name` (string) — Operator-defined display name.
20
+ - `description` (string) — Operator-defined description (HTML allowed).
21
+ - `rules` (string) — Operator-defined rules / terms (HTML allowed).
22
+ - `period_type_id` (LeaderBoardPeriodType) — Period type this board is bound to (`LeaderBoardPeriodType`).
23
+ - `version_id` (number) — Snapshot version. `0` for the live current period; a positive value identifies a finalized previous-period snapshot (see `getPreviousPeriod`).
24
+ - `create_date` (number) — Snapshot creation timestamp (Unix ms). `0` for the live current period; the finalization time for a previous-period snapshot.
25
+ - `rewards` (LeaderBoardsRewardsT[]) — Per-place prize table; the array length is the number of paid places.
26
+ - `place` (number) — Place number (1-based).
27
+ - `points` (number) — Gamification points awarded to the user occupying this place at period finalization.
28
+ - `users` (LeaderBoardUserT[]) — Top-20 ranked entries (server-capped), sorted by `position` ASC. Empty when fetched via `getLeaderBoards()` (metadata-only list).
29
+ - `public_username` (string) — Display username (operator-defined alias).
30
+ - `avatar_url` (string) — Resolved CDN URL for the participant's avatar. May be empty when the participant has no custom avatar — fall back to a level-based default using `level_id`.
31
+ - `level_id` (number) — The participant's level id — use it to resolve a level-based default avatar when `avatar_url` is empty.
32
+ - `position` (number) — Rank in the leaderboard (DENSE_RANK over all participants). `-1` on the `me` entry signals "unranked / outside the window".
33
+ - `points` (number) — Participant's points for this period.
34
+ - `is_me` (boolean) — `true` when this row is the current authenticated user. Always `true` on the `me` entry.
35
+ - `me` (LeaderBoardUserT) — Current user's own entry. `undefined` for visitor sessions. For authenticated users, `position === -1` means the user is unranked / outside the ranked window.
36
+ - `public_username` (string) — Display username (operator-defined alias).
37
+ - `avatar_url` (string) — Resolved CDN URL for the participant's avatar. May be empty when the participant has no custom avatar — fall back to a level-based default using `level_id`.
38
+ - `level_id` (number) — The participant's level id — use it to resolve a level-based default avatar when `avatar_url` is empty.
39
+ - `position` (number) — Rank in the leaderboard (DENSE_RANK over all participants). `-1` on the `me` entry signals "unranked / outside the window".
40
+ - `points` (number) — Participant's points for this period.
41
+ - `is_me` (boolean) — `true` when this row is the current authenticated user. Always `true` on the `me` entry.
42
+
43
+ ## Behavioral contract
44
+ **Return value note** — the runtime may return `undefined` if no
45
+ board is configured for the requested `periodType`, despite the
46
+ static return type being `Promise<LeaderBoardDetailsT>`. Defend
47
+ against that case in consumer code.
48
+
49
+ **Preconditions**
50
+ Pass a `periodType` from `LeaderBoardPeriodType`(`DAILY = 1`, `WEEKLY = 2`, `MONTHLY = 3`). Pass
51
+ `getPreviousPeriod: true` to fetch the most-recently-ended
52
+ period's snapshot (yesterday's / last week's / last month's
53
+ results) instead of the current live period. To reach older
54
+ snapshots, pass a number instead of a boolean: `1` = previous
55
+ period, `2` = the one before that, and so on (`0` / `false` =
56
+ current). Use the snapshot's `create_date` / `version_id` to label
57
+ which historical run a previous-period board is. How far back
58
+ snapshots are retained is operator-configured.
59
+
60
+ **Top-20 cap**
61
+ The server hard-caps `users[]` at 20 entries, ordered by
62
+ `position` ASC. Position values are server-computed (DENSE_RANK
63
+ over all participants); the truncation at 20 is for transport
64
+ size only — `position` may exceed 20 elsewhere.
65
+
66
+ **The `me` field**
67
+ Always populated for authenticated users (even when they have
68
+ zero points in the period). `me.position === -1` is the signal
69
+ that the user is active but ranked outside the top 20 (or has no
70
+ activity yet). `me` is `undefined` for visitor-mode sessions.
71
+
72
+ **Rewards are points only**
73
+ `rewards[].points` are gamification points credited to the user's
74
+ balance when the period finalizes. The leaderboard never awards
75
+ gems, diamonds, store items, or bonuses. The first element of
76
+ the array is the prize for place 1, the second for place 2, and
77
+ so on. The array length is the number of paid places.
78
+
79
+ **Cache TTL**
80
+ The SDK caches each response for 30 seconds.
81
+
82
+ **Period boundaries**
83
+ The server finalizes each period on a server-configurable
84
+ schedule: DAILY at midnight + operator-defined offset; WEEKLY
85
+ at the start of Monday; MONTHLY on the 1st of each month. At
86
+ finalization, the server distributes the configured `rewards[]`
87
+ points to the top placeholders and resets the live board. After
88
+ finalization, `getLeaderBoard(periodType, false)` returns the
89
+ NEW (empty) period's board; call with
90
+ `getPreviousPeriod: true` to see the just-ended standings.
91
+
92
+ **Refresh model**
93
+ - One-shot fetch (no subscription).
94
+ - No push event refreshes the cache; finalization at the period
95
+ boundary is NOT pushed to the client.
96
+ - Poll manually if the consumer needs near-live state during an
97
+ in-progress period.
98
+
99
+ **Idempotency / Side effects**: safe. Read-only.
100
+
101
+ **UI guidance**: see [UI Guide — `getLeaderBoard`](../../docs/ui/leaderboard/UIGuide_getLeaderBoard.md).
102
+
103
+ **Visitor mode**: supported. The same shape is returned, scoped
104
+ to the brand's public leaderboard. `me` is `undefined` for
105
+ visitors.
106
+
107
+ ## Example
108
+ ```ts
109
+ import { LeaderBoardPeriodType } from '@smartico/public-api';
110
+
111
+ const board = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY);
112
+
113
+ if (!board) {
114
+ console.log('[smartico] no weekly board configured for this label — hide the leaderboard surface');
115
+ return;
116
+ }
117
+
118
+ console.log('[smartico] render leaderboard tab —', board.name, '—', board.users.length, 'ranked entries (top 20 max)');
119
+
120
+ // Render prize table.
121
+ for (const reward of board.rewards) {
122
+ console.log('[smartico] prize row — place', reward.place, '→', reward.points, 'points');
123
+ }
124
+
125
+ // "Me" panel — sticky row showing the current user's rank.
126
+ if (board.me) {
127
+ if (board.me.position === -1) {
128
+ console.log('[smartico] user is unranked — show "You are unranked, earn points to enter the leaderboard"');
129
+ } else if (board.me.position > 20) {
130
+ console.log('[smartico] user is ranked', board.me.position, 'but outside the visible top-20 — show sticky "me" row with', board.me.points, 'points');
131
+ } else {
132
+ console.log('[smartico] user is in the top 20 at position', board.me.position, '— highlight their row in the main list');
133
+ }
134
+ }
135
+
136
+ // Switch to previous period view — cached separately from the current period.
137
+ const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
138
+ console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
139
+
140
+ // Visitor-mode equivalent — me is always undefined.
141
+ // const visitorBoard = await window._smartico.vapi('EN').getLeaderBoard(LeaderBoardPeriodType.DAILY);
142
+ ```
143
+
144
+ ### Example response (REAL shape)
145
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
146
+ ```json
147
+ {
148
+ "board_id": 143,
149
+ "name": "Daily Leaderboard",
150
+ "description": "This <b>Leaderboard</b> is showing the names and current scores of the leading competitors of the day.<br>\nYou can put any text here to describe this Leaderb…",
151
+ "rules": "Leaderboards are the simplest form of tournaments. Easy to set up in 5 minutes or less. Boards only calculate gamification point progress, and award points f…",
152
+ "period_type_id": 1,
153
+ "version_id": 0,
154
+ "create_date": 0,
155
+ "rewards": [
156
+ {
157
+ "place": 1,
158
+ "points": 100
159
+ }
160
+ ],
161
+ "users": [
162
+ {
163
+ "public_username": "Matt*****",
164
+ "avatar_url": "https://cdn.example/avatar/344499363",
165
+ "level_id": 700,
166
+ "position": 1,
167
+ "points": 2155,
168
+ "is_me": false
169
+ }
170
+ ],
171
+ "me": {
172
+ "public_username": "Antonio",
173
+ "avatar_url": "https://cdn.example/avatars/12/00000000-0000-0000-0000-000000000000.png",
174
+ "level_id": 698,
175
+ "position": -1,
176
+ "points": 0,
177
+ "is_me": true
178
+ }
179
+ }
180
+ ```
181
+
182
+ ## Errors
183
+ See this method's TSDoc / the mutation pages for `err_code` handling.
184
+
185
+ ## Related
186
+ - `getLeaderBoards`
187
+ - `LeaderBoardPeriodType`
@@ -0,0 +1,88 @@
1
+ # getLeaderBoards — API (LeaderBoardDetailsT)
2
+
3
+ > Returns the list of leaderboards the operator has configured for this label — **metadata only, without participants**.
4
+ > Import: `import { LeaderBoardDetailsT } from '@smartico/public-api'`
5
+ > Search terms: getLeaderBoards, leaderboard, getLeaderboards, LeaderBoardDetailsT, LeaderBoardPeriodType, LeaderBoardsRewardsT, LeaderBoardUserT
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getLeaderBoards(): Promise<LeaderBoardDetailsT[]>
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `Promise<LeaderBoardDetailsT[]>`
16
+ Array of `LeaderBoardDetailsT`. Each item:
17
+ - `board_id` (number) — Stable ID of the leaderboard.
18
+ - `name` (string) — Operator-defined display name.
19
+ - `description` (string) — Operator-defined description (HTML allowed).
20
+ - `rules` (string) — Operator-defined rules / terms (HTML allowed).
21
+ - `period_type_id` (LeaderBoardPeriodType) — Period type this board is bound to (`LeaderBoardPeriodType`).
22
+ - `version_id` (number) — Snapshot version. `0` for the live current period; a positive value identifies a finalized previous-period snapshot (see `getPreviousPeriod`).
23
+ - `create_date` (number) — Snapshot creation timestamp (Unix ms). `0` for the live current period; the finalization time for a previous-period snapshot.
24
+ - `rewards` (LeaderBoardsRewardsT[]) — Per-place prize table; the array length is the number of paid places.
25
+ - `place` (number) — Place number (1-based).
26
+ - `points` (number) — Gamification points awarded to the user occupying this place at period finalization.
27
+ - `users` (LeaderBoardUserT[]) — Top-20 ranked entries (server-capped), sorted by `position` ASC. Empty when fetched via `getLeaderBoards()` (metadata-only list).
28
+ - `public_username` (string) — Display username (operator-defined alias).
29
+ - `avatar_url` (string) — Resolved CDN URL for the participant's avatar. May be empty when the participant has no custom avatar — fall back to a level-based default using `level_id`.
30
+ - `level_id` (number) — The participant's level id — use it to resolve a level-based default avatar when `avatar_url` is empty.
31
+ - `position` (number) — Rank in the leaderboard (DENSE_RANK over all participants). `-1` on the `me` entry signals "unranked / outside the window".
32
+ - `points` (number) — Participant's points for this period.
33
+ - `is_me` (boolean) — `true` when this row is the current authenticated user. Always `true` on the `me` entry.
34
+ - `me` (LeaderBoardUserT) — Current user's own entry. `undefined` for visitor sessions. For authenticated users, `position === -1` means the user is unranked / outside the ranked window.
35
+ - `public_username` (string) — Display username (operator-defined alias).
36
+ - `avatar_url` (string) — Resolved CDN URL for the participant's avatar. May be empty when the participant has no custom avatar — fall back to a level-based default using `level_id`.
37
+ - `level_id` (number) — The participant's level id — use it to resolve a level-based default avatar when `avatar_url` is empty.
38
+ - `position` (number) — Rank in the leaderboard (DENSE_RANK over all participants). `-1` on the `me` entry signals "unranked / outside the window".
39
+ - `points` (number) — Participant's points for this period.
40
+ - `is_me` (boolean) — `true` when this row is the current authenticated user. Always `true` on the `me` entry.
41
+
42
+ ## Behavioral contract
43
+ **Returned shape**
44
+ An array of `LeaderBoardDetailsT`, one per configured board, ordered by
45
+ `period_type_id` ascending (DAILY, WEEKLY, MONTHLY, …). On every entry
46
+ `users` is an empty array and `me` is `undefined` — this call never
47
+ carries participant data. Read `period_type_id` from each entry and pass
48
+ it to `getLeaderBoard` to load that board's standings.
49
+
50
+ **Empty result**
51
+ Resolves to an empty array when the label has no leaderboards configured
52
+ — treat that as "hide the leaderboard surface".
53
+
54
+ **Cache TTL**
55
+ Cached for 30 seconds under a dedicated key (independent of
56
+ `getLeaderBoard`'s per-period cache). Repeated calls within the
57
+ window return the cached list without a round-trip.
58
+
59
+ **Refresh model**: one-shot fetch — no subscription, no push. Board
60
+ configuration changes surface on the next cache miss.
61
+
62
+ **Idempotency / Side effects**: safe. Read-only.
63
+
64
+ **Visitor mode**: supported. Returns the brand's public board list.
65
+
66
+ ## Example
67
+ ```ts
68
+ const boards = await window._smartico.api.getLeaderBoards();
69
+
70
+ if (boards.length === 0) {
71
+ console.log('[smartico] no leaderboards configured — hide the leaderboard surface');
72
+ return;
73
+ }
74
+
75
+ // Render one tab per board from the lightweight list (no players yet).
76
+ console.log('[smartico] render leaderboard tabs:', boards.map(b => b.name));
77
+
78
+ // When the user opens a tab, load that board's standings on demand.
79
+ const first = boards[0];
80
+ const full = await window._smartico.api.getLeaderBoard(first.period_type_id);
81
+ console.log('[smartico] loaded standings for', first.name, '—', full?.users.length ?? 0, 'players');
82
+ ```
83
+
84
+ ## Errors
85
+ See this method's TSDoc / the mutation pages for `err_code` handling.
86
+
87
+ ## Related
88
+ - `getLeaderBoard`