@smartico/public-api 0.0.379 → 0.0.381

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 (219) hide show
  1. package/.nvmrc +1 -1
  2. package/CLAUDE.md +103 -0
  3. package/README.md +53 -2
  4. package/dist/Base/ClassId.d.ts +2 -0
  5. package/dist/Jackpots/JackpotDetails.d.ts +14 -15
  6. package/dist/Jackpots/JackpotPot.d.ts +10 -6
  7. package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
  8. package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
  9. package/dist/Raffle/index.d.ts +2 -0
  10. package/dist/SmarticoAPI.d.ts +6 -1
  11. package/dist/SmarticoLib/index.d.ts +5 -1
  12. package/dist/Store/BuyStoreItemErrorCode.d.ts +9 -1
  13. package/dist/Tournaments/TournamentRegistrationError.d.ts +3 -1
  14. package/dist/WSAPI/WSAPI.d.ts +13 -1235
  15. package/dist/WSAPI/WSAPIAvatars.d.ts +296 -0
  16. package/dist/WSAPI/WSAPIBase.d.ts +71 -0
  17. package/dist/WSAPI/WSAPIBonuses.d.ts +240 -0
  18. package/dist/WSAPI/WSAPIClans.d.ts +388 -0
  19. package/dist/WSAPI/WSAPIGamePick.d.ts +593 -0
  20. package/dist/WSAPI/WSAPIGeneral.d.ts +172 -0
  21. package/dist/WSAPI/WSAPIInbox.d.ts +615 -0
  22. package/dist/WSAPI/WSAPIJackpots.d.ts +344 -0
  23. package/dist/WSAPI/WSAPILeaderBoard.d.ts +139 -0
  24. package/dist/WSAPI/WSAPIMiniGames.d.ts +510 -0
  25. package/dist/WSAPI/WSAPIMissions.d.ts +517 -0
  26. package/dist/WSAPI/WSAPIRaffles.d.ts +643 -0
  27. package/dist/WSAPI/WSAPIStore.d.ts +656 -0
  28. package/dist/WSAPI/WSAPITournaments.d.ts +501 -0
  29. package/dist/WSAPI/WSAPITypes.d.ts +376 -205
  30. package/dist/WSAPI/WSAPIUser.d.ts +533 -0
  31. package/dist/index.js +6745 -1661
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.modern.mjs +6324 -1342
  34. package/dist/index.modern.mjs.map +1 -1
  35. package/docs/Callbacks.md +162 -0
  36. package/docs/SmarticoObject.md +445 -0
  37. package/docs/Transforms.md +99 -0
  38. package/docs/api/README.md +82 -2
  39. package/docs/api/classes/WSAPIAvatars.md +344 -0
  40. package/docs/api/classes/WSAPIBonuses.md +271 -0
  41. package/docs/api/classes/WSAPIClans.md +436 -0
  42. package/docs/api/classes/WSAPIGamePick.md +710 -0
  43. package/docs/api/classes/WSAPIGeneral.md +212 -0
  44. package/docs/api/classes/WSAPIInbox.md +801 -0
  45. package/docs/api/classes/WSAPIJackpots.md +439 -0
  46. package/docs/api/classes/WSAPILeaderBoard.md +157 -0
  47. package/docs/api/classes/WSAPIMiniGames.md +612 -0
  48. package/docs/api/classes/WSAPIMissions.md +590 -0
  49. package/docs/api/classes/WSAPIRaffles.md +773 -0
  50. package/docs/api/classes/WSAPIStore.md +719 -0
  51. package/docs/api/classes/WSAPITournaments.md +571 -0
  52. package/docs/api/classes/WSAPIUser.md +637 -0
  53. package/docs/api/documents/Callbacks.md +162 -0
  54. package/docs/api/documents/SmarticoObject.md +445 -0
  55. package/docs/api/documents/Transforms.md +99 -0
  56. package/docs/api/enumerations/AchievementClaimPeriodTypeId.md +13 -0
  57. package/docs/api/enumerations/BonusStatus-1.md +11 -6
  58. package/docs/api/enumerations/BuyStoreItemErrorCode.md +32 -0
  59. package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
  60. package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
  61. package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
  62. package/docs/api/interfaces/AvatarCustomized.md +25 -0
  63. package/docs/api/interfaces/AvatarDefinition.md +94 -0
  64. package/docs/api/interfaces/AvatarPrompt.md +45 -0
  65. package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
  66. package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
  67. package/docs/api/interfaces/Clan.md +4 -0
  68. package/docs/api/interfaces/ClanInfo.md +109 -0
  69. package/docs/api/interfaces/ClanMember.md +53 -0
  70. package/docs/api/interfaces/ClanPrizePublicMeta.md +41 -0
  71. package/docs/api/interfaces/ClanPrizeStructureEntry.md +7 -1
  72. package/docs/api/interfaces/ClanPublicMeta.md +4 -0
  73. package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
  74. package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
  75. package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
  76. package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
  77. package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
  78. package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
  79. package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
  80. package/docs/api/interfaces/JackpotDetails.md +14 -15
  81. package/docs/api/interfaces/JackpotPot.md +9 -6
  82. package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
  83. package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
  84. package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
  85. package/docs/api/interfaces/PointsLog.md +43 -0
  86. package/docs/api/interfaces/RaffleWonPrize.md +59 -0
  87. package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
  88. package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
  89. package/docs/api/interfaces/SAWTemplateUI.md +10 -0
  90. package/docs/api/interfaces/TAchCategory.md +14 -4
  91. package/docs/api/interfaces/TAvatarCustomized.md +4 -4
  92. package/docs/api/interfaces/TAvatarDefinition.md +13 -14
  93. package/docs/api/interfaces/TAvatarPrompt.md +6 -6
  94. package/docs/api/interfaces/TBonus.md +16 -8
  95. package/docs/api/interfaces/TBuyStoreItemResult.md +4 -11
  96. package/docs/api/interfaces/TClaimBonusResult.md +5 -5
  97. package/docs/api/interfaces/TClan.md +8 -4
  98. package/docs/api/interfaces/TClanInfo.md +47 -0
  99. package/docs/api/interfaces/TClanJoinResult.md +11 -1
  100. package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
  101. package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
  102. package/docs/api/interfaces/TClans.md +3 -1
  103. package/docs/api/interfaces/TGetTranslations.md +4 -0
  104. package/docs/api/interfaces/TInboxMessage.md +14 -6
  105. package/docs/api/interfaces/TInboxMessageBody.md +18 -12
  106. package/docs/api/interfaces/TLevel.md +17 -20
  107. package/docs/api/interfaces/TLevelCurrent.md +19 -18
  108. package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
  109. package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
  110. package/docs/api/interfaces/TMissionClaimRewardResult.md +6 -3
  111. package/docs/api/interfaces/TMissionOptInResult.md +6 -3
  112. package/docs/api/interfaces/TMissionOrBadge.md +5 -4
  113. package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
  114. package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
  115. package/docs/api/interfaces/TSetAvatarResult.md +3 -3
  116. package/docs/api/interfaces/TStoreItem.md +11 -1
  117. package/docs/api/interfaces/TTournament.md +1 -1
  118. package/docs/api/interfaces/TTournamentDetailed.md +9 -1
  119. package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
  120. package/docs/api/interfaces/TUICustomSection.md +23 -19
  121. package/docs/api/interfaces/TUserProfile.md +18 -16
  122. package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
  123. package/docs/api/interfaces/UserAchievement.md +1 -1
  124. package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
  125. package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
  126. package/docs/native/ADDING_METHODS.md +7 -2
  127. package/docs/native/PROTOCOL.md +337 -0
  128. package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
  129. package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
  130. package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
  131. package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
  132. package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
  133. package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
  134. package/docs/ui/clans/UIGuide_getClanInfo.md +153 -0
  135. package/docs/ui/clans/UIGuide_getClans.md +172 -0
  136. package/docs/ui/clans/UIGuide_joinClan.md +196 -0
  137. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
  138. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
  139. package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
  140. package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
  141. package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
  142. package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
  143. package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
  144. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
  145. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
  146. package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
  147. package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
  148. package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
  149. package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
  150. package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
  151. package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
  152. package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
  153. package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
  154. package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
  155. package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
  156. package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
  157. package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
  158. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
  159. package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
  160. package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
  161. package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
  162. package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
  163. package/docs/ui/missions/UIGuide_getAchCategories.md +17 -0
  164. package/docs/ui/missions/UIGuide_getBadges.md +237 -0
  165. package/docs/ui/missions/UIGuide_getMissions.md +268 -0
  166. package/docs/ui/missions/UIGuide_requestMissionClaimReward.md +21 -0
  167. package/docs/ui/missions/UIGuide_requestMissionOptIn.md +16 -0
  168. package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
  169. package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
  170. package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
  171. package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
  172. package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
  173. package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
  174. package/docs/ui/store/UIGuide_buyStoreItem.md +133 -0
  175. package/docs/ui/store/UIGuide_getStoreCategories.md +19 -0
  176. package/docs/ui/store/UIGuide_getStoreItems.md +264 -0
  177. package/docs/ui/store/UIGuide_getStorePurchasedItems.md +122 -0
  178. package/docs/ui/tournaments/UIGuide_getClanTournamentPlayers.md +140 -0
  179. package/docs/ui/tournaments/UIGuide_getTournamentInstanceInfo.md +265 -0
  180. package/docs/ui/tournaments/UIGuide_getTournamentsList.md +236 -0
  181. package/docs/ui/tournaments/UIGuide_registerInTournament.md +156 -0
  182. package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
  183. package/docs/ui/user/UIGuide_getLevels.md +167 -0
  184. package/docs/ui/user/UIGuide_getUserProfile.md +213 -0
  185. package/package.json +3 -3
  186. package/scripts/postdoc-cleanup.js +195 -0
  187. package/src/Base/ClassId.ts +2 -0
  188. package/src/Jackpots/JackpotDetails.ts +14 -15
  189. package/src/Jackpots/JackpotPot.ts +10 -6
  190. package/src/Missions/MissionsUtils.ts +5 -2
  191. package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
  192. package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
  193. package/src/Raffle/index.ts +3 -1
  194. package/src/SmarticoAPI.ts +14 -1
  195. package/src/SmarticoLib/index.ts +4 -0
  196. package/src/Store/BuyStoreItemErrorCode.ts +8 -0
  197. package/src/Store/StoreItem.ts +1 -0
  198. package/src/Store/StoreItemPurchased.ts +1 -0
  199. package/src/Store/StoreItemType.ts +1 -1
  200. package/src/Tournaments/TournamentRegistrationError.ts +4 -0
  201. package/src/WSAPI/WSAPI.ts +27 -2007
  202. package/src/WSAPI/WSAPIAvatars.ts +345 -0
  203. package/src/WSAPI/WSAPIBase.ts +93 -0
  204. package/src/WSAPI/WSAPIBonuses.ts +268 -0
  205. package/src/WSAPI/WSAPIClans.ts +417 -0
  206. package/src/WSAPI/WSAPIGamePick.ts +667 -0
  207. package/src/WSAPI/WSAPIGeneral.ts +199 -0
  208. package/src/WSAPI/WSAPIInbox.ts +711 -0
  209. package/src/WSAPI/WSAPIJackpots.ts +448 -0
  210. package/src/WSAPI/WSAPILeaderBoard.ts +154 -0
  211. package/src/WSAPI/WSAPIMiniGames.ts +597 -0
  212. package/src/WSAPI/WSAPIMissions.ts +572 -0
  213. package/src/WSAPI/WSAPIRaffles.ts +703 -0
  214. package/src/WSAPI/WSAPIStore.ts +732 -0
  215. package/src/WSAPI/WSAPITournaments.ts +541 -0
  216. package/src/WSAPI/WSAPITypes.ts +376 -207
  217. package/src/WSAPI/WSAPIUser.ts +606 -0
  218. package/tsconfig.json +26 -2
  219. package/docs/api/classes/WSAPI.md +0 -1927
@@ -0,0 +1,710 @@
1
+ # Class: WSAPIGamePick
2
+ ## Methods
3
+
4
+ ### gamePickGetActiveRounds()
5
+
6
+ > **gamePickGetActiveRounds**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
7
+
8
+ Returns every open round for a MatchX or Quiz game template, with the full
9
+ event list (matches / questions) and the current user's selections per event.
10
+
11
+ Use to power the rounds-lobby screen — typically a list of round cards a user
12
+ can tap into to make predictions. For a single round, use
13
+ [gamePickGetActiveRound](#gamepickgetactiveround) (lighter payload when only one round is shown).
14
+
15
+ #### Parameters
16
+
17
+ ##### props
18
+
19
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
20
+
21
+ #### Returns
22
+
23
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
24
+
25
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array.
26
+
27
+ #### Remarks
28
+
29
+ **Preconditions**
30
+ - User must be authenticated.
31
+ - `saw_template_id` must reference a MatchX or Quiz game template. The SDK
32
+ throws synchronously if it's missing.
33
+
34
+ **Transport**
35
+ Game Pick methods are HTTP REST calls to a separate Game Pick games server
36
+ (not the main WebSocket). One consequence: there is no SDK cache and no push
37
+ subscription — every call is a fresh server roundtrip.
38
+
39
+ **Round status**
40
+ Each round's `round_status_id` is a [GPRoundStatus](../enumerations/GPRoundStatus.md) value. Rounds with
41
+ status `NoEventsDefined` (1) are filtered out server-side and never appear
42
+ here. Other values: `Other` (-1, normally open), `NoMoreBetsAllowed` (2),
43
+ `AllEventsResolved_ButNotRound` (3), `RoundResolved` (4 — appears here only
44
+ briefly during transition; use [gamePickGetHistory](#gamepickgethistory) for resolved rounds).
45
+
46
+ **Error codes** (in `errCode`)
47
+ - `0` — success.
48
+ - `100002` — template not found (the `saw_template_id` doesn't reference a
49
+ MatchX/Quiz game).
50
+ - `100003` — no open rounds available for this template right now.
51
+ - `100000` — auth hash invalid; SDK session needs re-initialization.
52
+ - `100004` — generic server error.
53
+
54
+ **Refresh**
55
+ - No cache; every call is live.
56
+ - No push subscription. Poll while the user is on the screen if you need
57
+ live round-status changes (typically every 30–60 s is enough).
58
+
59
+ **Visitor mode**: not supported. The SDK throws synchronously on visitor
60
+ sessions.
61
+
62
+ **UI guidance**: see [UI Guide — `gamePickGetActiveRounds`](../_media/UIGuide_gamePickGetActiveRounds.md).
63
+
64
+ #### Example
65
+
66
+ ```ts
67
+ const r = await window._smartico.api.gamePickGetActiveRounds({ saw_template_id: 1083 });
68
+
69
+ if (r.errCode !== 0) {
70
+ console.error('[smartico] active rounds fetch failed — show empty rounds lobby:', r.errMessage);
71
+ return;
72
+ }
73
+
74
+ for (const round of r.data ?? []) {
75
+ console.log('[smartico] render a round card:', round.round_name, '— events:', round.events.length, 'user has placed bet:', round.user_placed_bet);
76
+ }
77
+ ```
78
+
79
+ ***
80
+
81
+ ### gamePickGetActiveRound()
82
+
83
+ > **gamePickGetActiveRound**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
84
+
85
+ Returns a single round (events, user selections, scoring rules) for a
86
+ MatchX or Quiz game. Use to power the round-detail / prediction-input
87
+ screen the user lands on after picking a round from the lobby.
88
+
89
+ Same shape as one entry of [gamePickGetActiveRounds](#gamepickgetactiverounds); cheaper when the
90
+ UI only shows one round at a time.
91
+
92
+ #### Parameters
93
+
94
+ ##### props
95
+
96
+ [`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md)
97
+
98
+ #### Returns
99
+
100
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
101
+
102
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of a single [GamePickRound](../interfaces/GamePickRound.md).
103
+
104
+ #### Remarks
105
+
106
+ **Preconditions**
107
+ - User must be authenticated. Visitor mode not supported.
108
+ - `saw_template_id` and `round_id` are mandatory — the SDK throws if either
109
+ is missing.
110
+
111
+ **Error codes** (in `errCode`)
112
+ - `0` — success.
113
+ - `4` — round / event not found (e.g. round resolved after the last
114
+ `gamePickGetActiveRounds` poll); non-fatal — retry after a fresh active-
115
+ rounds fetch.
116
+ - `100002` — template not found.
117
+ - `100000` — auth hash invalid.
118
+ - `100004` — generic server error.
119
+
120
+ **Refresh**
121
+ - No cache; every call is live.
122
+ - Re-call after [gamePickSubmitSelection](#gamepicksubmitselection) or
123
+ [gamePickSubmitSelectionQuiz](#gamepicksubmitselectionquiz) to surface the persisted predictions.
124
+ - Poll while the user is on the prediction screen if event resolution
125
+ updates are needed (typically every 30–60 s).
126
+
127
+ **Visitor mode**: not supported.
128
+
129
+ **UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../_media/UIGuide_gamePickGetActiveRound.md).
130
+
131
+ #### Example
132
+
133
+ ```ts
134
+ const r = await window._smartico.api.gamePickGetActiveRound({
135
+ saw_template_id: 1083,
136
+ round_id: 31652,
137
+ });
138
+
139
+ if (r.errCode === 0 && r.data) {
140
+ console.log('[smartico] render round detail page —', r.data.round_name, '— user has placed bet:', r.data.user_placed_bet, 'score so far:', r.data.user_score);
141
+ } else {
142
+ console.error('[smartico] round fetch failed — bounce back to the lobby and refresh:', r.errMessage);
143
+ }
144
+ ```
145
+
146
+ ***
147
+
148
+ ### gamePickGetHistory()
149
+
150
+ > **gamePickGetHistory**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
151
+
152
+ Returns the full round history (active + resolved) for a MatchX or Quiz game
153
+ template, newest-first. Each round carries the user's predictions plus the
154
+ server-resolved outcome on each event.
155
+
156
+ Use to power a "Past predictions" / history tab. For just the open rounds,
157
+ use [gamePickGetActiveRounds](#gamepickgetactiverounds) (faster — skips resolved data).
158
+
159
+ #### Parameters
160
+
161
+ ##### props
162
+
163
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
164
+
165
+ #### Returns
166
+
167
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)[]\>\>
168
+
169
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRound](../interfaces/GamePickRound.md) array,
170
+ newest-first.
171
+
172
+ #### Remarks
173
+
174
+ **Preconditions**
175
+ - User must be authenticated. Visitor mode not supported.
176
+
177
+ **Sort order**
178
+ Server returns rounds newest-first. No client-side sort needed.
179
+
180
+ **Per-event resolution**
181
+ Each event in the rounds carries `resolution_type_id` — values are from
182
+ [GamePickResolutionType](../enumerations/GamePickResolutionType.md): `None` (0, not yet resolved), `Lost` (2),
183
+ `PartialWin` (3), `FullWin` (4). Use these to render result badges on
184
+ each event row.
185
+
186
+ **Error codes** (in `errCode`)
187
+ - `0` — success.
188
+ - `100002` — template not found.
189
+ - `100000` — auth hash invalid.
190
+ - `100004` — generic server error.
191
+
192
+ **Refresh**
193
+ - No cache.
194
+ - No push subscription. Re-call when the user opens the history tab.
195
+
196
+ **Visitor mode**: not supported.
197
+
198
+ **UI guidance**: see [UI Guide — `gamePickGetHistory`](../_media/UIGuide_gamePickGetHistory.md).
199
+
200
+ #### Example
201
+
202
+ ```ts
203
+ const r = await window._smartico.api.gamePickGetHistory({ saw_template_id: 1083 });
204
+
205
+ for (const round of r.data ?? []) {
206
+ console.log('[smartico] history row —', round.round_name, 'score:', round.user_score, 'resolved:', round.is_resolved);
207
+ }
208
+ ```
209
+
210
+ ***
211
+
212
+ ### gamePickGetBoard()
213
+
214
+ > **gamePickGetBoard**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
215
+
216
+ Returns the leaderboard for a MatchX or Quiz game round — ranked list of
217
+ players plus the current user's entry (`my_user`). Pass `round_id: -1` for
218
+ the season / overall leaderboard across every round in the template.
219
+
220
+ #### Parameters
221
+
222
+ ##### props
223
+
224
+ [`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md)
225
+
226
+ #### Returns
227
+
228
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRoundBoard`](../interfaces/GamePickRoundBoard.md)\>\>
229
+
230
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickRoundBoard](../interfaces/GamePickRoundBoard.md).
231
+
232
+ #### Remarks
233
+
234
+ **Preconditions**
235
+ - User must be authenticated. Visitor mode not supported.
236
+
237
+ **`round_id` semantics**
238
+ - Positive `round_id` — per-round leaderboard scoped to that round's events.
239
+ - `-1` — season / overall leaderboard aggregating scores across every round
240
+ of the template.
241
+
242
+ **`my_user`**
243
+ The current user's entry is returned separately from the `users[]` array
244
+ — `my_user` may be `null` if the user has never made a prediction on this
245
+ round / template. Use it to render the user's rank in a sticky footer or
246
+ "you are here" highlight regardless of pagination.
247
+
248
+ **Username masking**
249
+ `public_username` on other players may be masked / anonymized by operator
250
+ label settings. Always pair with `avatar_url` so the user can recognize
251
+ themselves in the ranking by avatar even when usernames are hidden.
252
+
253
+ **Error codes** (in `errCode`)
254
+ - `0` — success.
255
+ - `100002` — template not found.
256
+ - `100000` — auth hash invalid.
257
+ - `100004` — generic server error.
258
+
259
+ **Refresh**
260
+ - No cache.
261
+ - No push subscription. Poll while the leaderboard is visible
262
+ (every 30–60 s) if you want live rank updates after match
263
+ resolution.
264
+
265
+ **Visitor mode**: not supported.
266
+
267
+ **UI guidance**: see [UI Guide — `gamePickGetBoard`](../_media/UIGuide_gamePickGetBoard.md).
268
+
269
+ #### Example
270
+
271
+ ```ts
272
+ const r = await window._smartico.api.gamePickGetBoard({
273
+ saw_template_id: 1083,
274
+ round_id: -1, // season leaderboard
275
+ });
276
+
277
+ if (r.errCode === 0 && r.data) {
278
+ console.log('[smartico] render leaderboard rows for top', r.data.users.length, 'players');
279
+ if (r.data.my_user) {
280
+ console.log('[smartico] pin "you are rank #' + r.data.my_user.gp_position + '" footer to bottom');
281
+ } else {
282
+ console.log('[smartico] user not ranked — render "Play a round to join the leaderboard" CTA');
283
+ }
284
+ }
285
+ ```
286
+
287
+ ***
288
+
289
+ ### gamePickSubmitSelection()
290
+
291
+ > **gamePickSubmitSelection**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
292
+
293
+ Submits all score predictions for a round in a MatchX game in one shot.
294
+ Each event in the round must carry `team1_user_selection` and
295
+ `team2_user_selection` (the predicted scores).
296
+
297
+ On the user's FIRST submit for a round, the server charges one buy-in (one
298
+ "spin" / one currency deduction based on the template's `saw_buyin_type_id`).
299
+ Subsequent edits within the same round are free and only persist changed
300
+ selections.
301
+
302
+ #### Parameters
303
+
304
+ ##### props
305
+
306
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md) & `object`
307
+
308
+ #### Returns
309
+
310
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
311
+
312
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
313
+
314
+ #### Remarks
315
+
316
+ **Preconditions**
317
+ - User must be authenticated. Visitor mode not supported.
318
+ - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
319
+ either is missing.
320
+ - Each event passed must include `gp_event_id` and the two
321
+ `team{1,2}_user_selection` fields. Missing events default to "no change".
322
+
323
+ **Error codes** (in `errCode`)
324
+ - `0` — success; the response `data` is the updated round with
325
+ `user_placed_bet === true` and `has_not_submitted_changes === false`.
326
+ - `3` (`NoBetsUpdatedOnSubmit`) — submit produced no changes, OR every event
327
+ is past its `last_bet_date` deadline. The buy-in is NOT consumed; the
328
+ current round is still returned in `data`.
329
+ - `4` — round / event not found; refresh state and retry.
330
+ - `100002` — template not found.
331
+ - `100000` — auth hash invalid.
332
+ - `100004` — generic server error.
333
+
334
+ Buy-in failures pass through the [SAWSpinErrorCode](../enumerations/SAWSpinErrorCode.md) values on first
335
+ submit:
336
+ - `40001` — no spins left (when `saw_buyin_type_id` is Spins).
337
+ - `40003` — insufficient points.
338
+ - `40004` — global max-spins cap hit.
339
+ - `40007` — template outside its active date window.
340
+ - `40009` — user excluded by segment rule.
341
+ - `40011` — insufficient gems.
342
+ - `40012` — insufficient diamonds.
343
+
344
+ **Idempotency**
345
+ Re-submitting identical selections returns `errCode: 3` (no changes); the
346
+ buy-in is consumed exactly once per round-per-user. Re-submitting after
347
+ `last_bet_date` also returns `errCode: 3` without consuming the buy-in.
348
+
349
+ **Side effects**
350
+ - First successful submit deducts the buy-in (Points / Gems / Diamonds /
351
+ one Spin) per `saw_buyin_type_id`.
352
+ - Reports a `minigame_matchx_prediction` event to the operator's event log.
353
+ - Updates the round's participant counter (`users_cnt`) and per-event
354
+ counters (`num_users`).
355
+ - Score is awarded after the operator resolves the round
356
+ ([GPRoundStatus](../enumerations/GPRoundStatus.md) = `RoundResolved`).
357
+
358
+ **Visitor mode**: not supported.
359
+
360
+ **UI guidance**: see [UI Guide — `gamePickSubmitSelection`](../_media/UIGuide_gamePickSubmitSelection.md).
361
+
362
+ #### Example
363
+
364
+ ```ts
365
+ const ar = await window._smartico.api.gamePickGetActiveRound({
366
+ saw_template_id: 1190,
367
+ round_id: 38665,
368
+ });
369
+ if (ar.errCode !== 0 || !ar.data) {
370
+ console.error('[smartico] could not fetch round to submit — show error and bounce back');
371
+ return;
372
+ }
373
+
374
+ const round = ar.data;
375
+ round.events = round.events.map(e => ({
376
+ gp_event_id: e.gp_event_id,
377
+ team1_user_selection: 1,
378
+ team2_user_selection: 0,
379
+ }));
380
+
381
+ const r = await window._smartico.api.gamePickSubmitSelection({
382
+ saw_template_id: 1190,
383
+ round,
384
+ });
385
+
386
+ switch (r.errCode) {
387
+ case 0:
388
+ console.log('[smartico] predictions saved — show confirmation, refresh leaderboard');
389
+ break;
390
+ case 3:
391
+ console.log('[smartico] nothing changed (or all events closed) — silent no-op');
392
+ break;
393
+ case 40001:
394
+ case 40003:
395
+ case 40011:
396
+ case 40012:
397
+ console.error('[smartico] insufficient balance / spins — show top-up CTA:', r.errMessage);
398
+ break;
399
+ default:
400
+ console.error('[smartico] submit failed — show generic error toast:', r.errMessage);
401
+ }
402
+ ```
403
+
404
+ ***
405
+
406
+ ### gamePickSubmitSelectionQuiz()
407
+
408
+ > **gamePickSubmitSelectionQuiz**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
409
+
410
+ Submits all quiz answers for a round in one shot. Each event in the round
411
+ must carry `user_selection` (the answer value — typically `"1"` / `"2"` /
412
+ `"x"` for 1×2 markets, `"yes"` / `"no"` for binary markets, or any
413
+ operator-defined string for custom markets).
414
+
415
+ Same first-submit buy-in behavior as [gamePickSubmitSelection](#gamepicksubmitselection) — one
416
+ buy-in is charged on the first successful submit; subsequent edits within
417
+ the same round are free.
418
+
419
+ #### Parameters
420
+
421
+ ##### props
422
+
423
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md) & `object`
424
+
425
+ #### Returns
426
+
427
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
428
+
429
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the updated round.
430
+
431
+ #### Remarks
432
+
433
+ **Preconditions**
434
+ - User must be authenticated. Visitor mode not supported.
435
+ - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
436
+ either is missing.
437
+ - Each event must include `gp_event_id` and `user_selection`. Missing
438
+ events default to "no change".
439
+
440
+ **Error codes** (in `errCode`)
441
+ - `0` — success.
442
+ - `3` (`NoBetsUpdatedOnSubmit`) — no changes, OR every event past
443
+ `last_bet_date`. Buy-in NOT consumed; current round returned in `data`.
444
+ - `4` — round / event not found.
445
+ - `100002` — template not found.
446
+ - `100000` — auth hash invalid.
447
+ - `100004` — generic server error.
448
+
449
+ Buy-in failures use the same [SAWSpinErrorCode](../enumerations/SAWSpinErrorCode.md) pass-through values
450
+ as [gamePickSubmitSelection](#gamepicksubmitselection) — see that method's TSDoc for the
451
+ `40001` / `40003` / `40004` / `40007` / `40009` / `40011` / `40012`
452
+ semantics.
453
+
454
+ **Idempotency**: identical to [gamePickSubmitSelection](#gamepicksubmitselection) — re-submit
455
+ returns `errCode: 3` and never double-charges the buy-in.
456
+
457
+ **Side effects**: identical to [gamePickSubmitSelection](#gamepicksubmitselection), with the
458
+ reported event being `minigame_quiz_prediction` instead of
459
+ `minigame_matchx_prediction`.
460
+
461
+ **Visitor mode**: not supported.
462
+
463
+ **UI guidance**: see [UI Guide — `gamePickSubmitSelectionQuiz`](../_media/UIGuide_gamePickSubmitSelectionQuiz.md).
464
+
465
+ #### Example
466
+
467
+ ```ts
468
+ const ar = await window._smartico.api.gamePickGetActiveRound({
469
+ saw_template_id: 1183,
470
+ round_id: 37974,
471
+ });
472
+ if (ar.errCode !== 0 || !ar.data) {
473
+ console.error('[smartico] could not fetch round to submit answers — show error');
474
+ return;
475
+ }
476
+
477
+ const round = ar.data;
478
+ round.events = round.events.map(e => ({
479
+ gp_event_id: e.gp_event_id,
480
+ user_selection: 'x',
481
+ }));
482
+
483
+ const r = await window._smartico.api.gamePickSubmitSelectionQuiz({
484
+ saw_template_id: 1183,
485
+ round,
486
+ });
487
+
488
+ if (r.errCode === 0) {
489
+ console.log('[smartico] quiz answers saved — show confirmation');
490
+ } else if (r.errCode === 3) {
491
+ console.log('[smartico] nothing changed — silent no-op');
492
+ } else {
493
+ console.error('[smartico] quiz submit failed:', r.errMessage);
494
+ }
495
+ ```
496
+
497
+ ***
498
+
499
+ ### gamePickGetUserInfo()
500
+
501
+ > **gamePickGetUserInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
502
+
503
+ Returns the current user's profile within the Game Pick system — display
504
+ name, avatar, balances, and last wallet-sync timestamp. The Game Pick server
505
+ maintains its own user record that mirrors the user's Smartico balances; the
506
+ mirror is updated at most once per minute, so `last_wallet_sync_time` tells
507
+ the consumer how stale the balances on the response are.
508
+
509
+ On the user's first call for a given game, the Game Pick server lazily
510
+ provisions a user record — so this method doubles as a "register the user
511
+ with this game" call.
512
+
513
+ #### Parameters
514
+
515
+ ##### props
516
+
517
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
518
+
519
+ #### Returns
520
+
521
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickUserInfo`](../interfaces/GamePickUserInfo.md)\>\>
522
+
523
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickUserInfo](../interfaces/GamePickUserInfo.md).
524
+
525
+ #### Remarks
526
+
527
+ **Preconditions**
528
+ - User must be authenticated. Visitor mode not supported.
529
+
530
+ **Balance freshness**
531
+ The balances returned here are the cached mirror — at most ~1 minute stale.
532
+ For an up-to-the-second view of Points / Gems / Diamonds, read from
533
+ [getUserProfile](WSAPIUser.md#getuserprofile) instead. Use this method's balances only for
534
+ in-Game-Pick display.
535
+
536
+ **Error codes** (in `errCode`)
537
+ - `0` — success.
538
+ - `100002` — template not found.
539
+ - `100000` — auth hash invalid.
540
+ - `100004` — generic server error.
541
+
542
+ **Refresh**
543
+ - No cache. Server-side mirror refreshes at most every 60 s.
544
+ - No push subscription.
545
+
546
+ **Visitor mode**: not supported.
547
+
548
+ **UI guidance**: see [UI Guide — `gamePickGetUserInfo`](../_media/UIGuide_gamePickGetUserInfo.md).
549
+
550
+ #### Example
551
+
552
+ ```ts
553
+ const r = await window._smartico.api.gamePickGetUserInfo({ saw_template_id: 1083 });
554
+
555
+ if (r.errCode === 0 && r.data) {
556
+ console.log('[smartico] render Game Pick header — name:', r.data.public_username, '— points:', r.data.ach_points_balance, '— synced:', r.data.last_wallet_sync_time);
557
+ }
558
+ ```
559
+
560
+ ***
561
+
562
+ ### gamePickGetGameInfo()
563
+
564
+ > **gamePickGetGameInfo**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
565
+
566
+ Returns the game template configuration plus a metadata listing of every
567
+ round (without events). Use to power the game's welcome / lobby screen —
568
+ shows the template name, buy-in cost, the user's remaining attempts, and
569
+ the full round list.
570
+
571
+ The `allRounds[]` here is a lightweight metadata-only view — to render
572
+ predictions or leaderboards, call [gamePickGetActiveRound](#gamepickgetactiveround) /
573
+ [gamePickGetActiveRounds](#gamepickgetactiverounds) / [gamePickGetBoard](#gamepickgetboard) for the rounds
574
+ the user actually opens.
575
+
576
+ #### Parameters
577
+
578
+ ##### props
579
+
580
+ [`GamePickRequestParams`](../interfaces/GamePickRequestParams.md)
581
+
582
+ #### Returns
583
+
584
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickGameInfo`](../interfaces/GamePickGameInfo.md)\>\>
585
+
586
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) of [GamePickGameInfo](../interfaces/GamePickGameInfo.md).
587
+
588
+ #### Remarks
589
+
590
+ **Preconditions**
591
+ - User must be authenticated. Visitor mode not supported.
592
+
593
+ **Buy-in semantics**
594
+ The `sawTemplate.saw_buyin_type_id` value determines which currency is
595
+ deducted on the user's first prediction in any round:
596
+ - Free — no deduction.
597
+ - Points — `buyin_cost_points` deducted from the user's points balance.
598
+ - Gems — deducted from the user's gems balance.
599
+ - Diamonds — deducted from the user's diamonds balance.
600
+ - Spins — one spin counted from `spin_count`.
601
+
602
+ **Error codes** (in `errCode`)
603
+ - `0` — success.
604
+ - `100002` — template not found.
605
+ - `100000` — auth hash invalid.
606
+ - `100004` — generic server error.
607
+
608
+ **Refresh**
609
+ - No cache.
610
+ - No push subscription. Re-call after a successful
611
+ [gamePickSubmitSelection](#gamepicksubmitselection) to refresh `spin_count`.
612
+
613
+ **Visitor mode**: not supported.
614
+
615
+ **UI guidance**: see [UI Guide — `gamePickGetGameInfo`](../_media/UIGuide_gamePickGetGameInfo.md).
616
+
617
+ #### Example
618
+
619
+ ```ts
620
+ const r = await window._smartico.api.gamePickGetGameInfo({ saw_template_id: 1189 });
621
+
622
+ if (r.errCode === 0 && r.data) {
623
+ console.log('[smartico] render Game Pick lobby — title:', r.data.sawTemplate.saw_template_ui_definition.name);
624
+ console.log('[smartico] rounds available:', r.data.allRounds.length, '— buy-in type:', r.data.sawTemplate.saw_buyin_type_id, 'cost:', r.data.sawTemplate.buyin_cost_points);
625
+ }
626
+ ```
627
+
628
+ ***
629
+
630
+ ### gamePickGetRoundInfoForUser()
631
+
632
+ > **gamePickGetRoundInfoForUser**(`props`): `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
633
+
634
+ Returns a round with another player's predictions instead of the current
635
+ user's. The target player is identified by `int_user_id` (the Game Pick
636
+ system's internal user ID, obtained from [gamePickGetBoard](#gamepickgetboard)'s
637
+ `users[].int_user_id`).
638
+
639
+ Use to power "view this player's picks" affordances opened from leaderboard
640
+ rows — community / social inspection of how a top-ranked user predicted.
641
+
642
+ #### Parameters
643
+
644
+ ##### props
645
+
646
+ [`GamePickRoundRequestParams`](../interfaces/GamePickRoundRequestParams.md) & `object`
647
+
648
+ #### Returns
649
+
650
+ `Promise`\<[`GamesApiResponse`](../interfaces/GamesApiResponse.md)\<[`GamePickRound`](../interfaces/GamePickRound.md)\>\>
651
+
652
+ Wrapped [GamesApiResponse](../interfaces/GamesApiResponse.md) with the target user's
653
+ [GamePickRound](../interfaces/GamePickRound.md).
654
+
655
+ #### Remarks
656
+
657
+ **Preconditions**
658
+ - User must be authenticated. Visitor mode not supported.
659
+ - `saw_template_id`, `round_id`, and `int_user_id` are all mandatory — SDK
660
+ throws synchronously if any is missing.
661
+ - `int_user_id` must come from a leaderboard fetch in the same game
662
+ template; it is stable within a template but not portable across
663
+ templates.
664
+
665
+ **Shape vs `gamePickGetActiveRound`**
666
+ Same [GamePickRound](../interfaces/GamePickRound.md) structure, but `user_selection` /
667
+ `team1_user_selection` / `team2_user_selection` reflect the TARGET user's
668
+ predictions instead of the caller's. Each event still carries its own
669
+ `resolution_type_id` (see [GamePickResolutionType](../enumerations/GamePickResolutionType.md)) so the UI can
670
+ render result badges per pick.
671
+
672
+ **Error codes** (in `errCode`)
673
+ - `0` — success.
674
+ - `4` — round / event / user not found.
675
+ - `100002` — template not found.
676
+ - `100000` — auth hash invalid.
677
+ - `100004` — generic server error.
678
+
679
+ **Refresh**
680
+ - No cache. Re-call when opening a different leaderboard row's
681
+ "view picks" modal.
682
+ - No push subscription.
683
+
684
+ **Visitor mode**: not supported.
685
+
686
+ **UI guidance**: see [UI Guide — `gamePickGetRoundInfoForUser`](../_media/UIGuide_gamePickGetRoundInfoForUser.md).
687
+
688
+ #### Example
689
+
690
+ ```ts
691
+ const board = await window._smartico.api.gamePickGetBoard({
692
+ saw_template_id: 1083, round_id: 31652,
693
+ });
694
+ const topPlayer = board.data?.users?.[0];
695
+ if (!topPlayer) return;
696
+
697
+ const r = await window._smartico.api.gamePickGetRoundInfoForUser({
698
+ saw_template_id: 1083,
699
+ round_id: 31652,
700
+ int_user_id: topPlayer.int_user_id,
701
+ });
702
+
703
+ if (r.errCode === 0 && r.data) {
704
+ for (const ev of r.data.events) {
705
+ console.log('[smartico] render row —', ev.event_meta.team1_name, 'vs', ev.event_meta.team2_name, '— picked:', ev.user_selection, '— resolution:', ev.resolution_type_id);
706
+ }
707
+ }
708
+ ```
709
+
710
+ ***