@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,125 @@
1
+ # claimBonus — API (TClaimBonusResult)
2
+
3
+ > Triggers manual redemption of a coupon-model bonus the user has been awarded.
4
+ > Import: `import { TClaimBonusResult } from '@smartico/public-api'`
5
+ > Search terms: claimBonus, bonuses, TClaimBonusResult, err_code, err_message
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.claimBonus(bonus_id: number): Promise<TClaimBonusResult>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `bonus_id` — The `bonus_id` from a `TBonus` returned by `getBonuses`.
14
+
15
+ ## Returns — `Promise<TClaimBonusResult>`
16
+ `TClaimBonusResult`:
17
+ - `err_code` (number) — Error code. `0` = success. See `claimBonus` TSDoc for the full table.
18
+ - `err_message` (string) — Optional error message; populated on non-zero `err_code`.
19
+ - `success` (boolean) — Unreliable on the wire — prefer `err_code === 0` as the success check.
20
+
21
+ ## Behavioral contract
22
+ **Preconditions**
23
+ Read the candidate bonus from `getBonuses` and gate the
24
+ call on `is_redeemable === true`. The SDK forwards the request
25
+ unconditionally — calling on a non-claimable bonus returns
26
+ `err_code = -1`.
27
+
28
+
29
+
30
+ **Refresh after success (and after failure)**
31
+ The SDK automatically refreshes the bonuses cache on every
32
+ response (success OR failure) and fires any `onUpdate` callback
33
+ registered via `getBonuses`'s `onUpdate`. After
34
+ `err_code === 0`, the redeemed bonus shifts from
35
+ `COUPON_ISSUED` / `REDEEM_FAILED` to `REDEEMED` on the refreshed
36
+ array, with `redeem_date` populated. After a failure, the bonus
37
+ typically lands in `REDEEM_FAILED` and remains claimable for a
38
+ retry.
39
+
40
+ **Idempotency**: NOT idempotent at the SDK level. A second call
41
+ returns `err_code = -1` once the first has succeeded — treat that
42
+ as success in the UI rather than as a real error. Guard the call
43
+ site against double-clicks (set a local "claiming" flag on click,
44
+ clear it on response).
45
+
46
+ **Side effects** (on `err_code === 0`)
47
+ - Bonus status transitions to `REDEEMED`; `redeem_date` is set.
48
+ - The operator's integration credits the player's account
49
+ externally. The SDK does not observe that credit directly —
50
+ balance updates flow over the user-properties channel from the
51
+ operator's side, not from this response.
52
+ - Server-side analytics events fire downstream (not directly
53
+ observable from the SDK).
54
+
55
+ **UI guidance**: see [UI Guide — `claimBonus`](../../docs/ui/bonuses/UIGuide_claimBonus.md).
56
+
57
+ **Visitor mode**: not supported.
58
+
59
+ ## Example
60
+ ```ts
61
+ const bonuses = await window._smartico.api.getBonuses({
62
+ onUpdate: (refreshed) => console.log('[smartico] bonuses refreshed — re-render from this array', refreshed),
63
+ });
64
+ const bonus = bonuses.find(b => b.bonus_id === bonusId);
65
+
66
+ if (!bonus) {
67
+ console.log('[smartico] bonus no longer visible — refresh list and hide CTA');
68
+ return;
69
+ }
70
+ if (!bonus.is_redeemable) {
71
+ console.log('[smartico] bonus is not claimable (auto-redeemed or already finalised) — keep CTA hidden');
72
+ return;
73
+ }
74
+
75
+ console.log('[smartico] claim starting — set in-flight flag, show loading dots on the Claim button, keep the modal open');
76
+ const r = await window._smartico.api.claimBonus(bonus.bonus_id);
77
+ console.log('[smartico] claim response received — clear in-flight flag');
78
+
79
+ if (r.err_code === 0 || r.err_code === -1) {
80
+ console.log('[smartico] claim succeeded (or was already done) — show a success toast; the getBonuses onUpdate above will fire with the refreshed list');
81
+ } else if (r.err_code === 9999) {
82
+ console.error('[smartico] uncaught server exception — show a generic error toast and allow retry');
83
+ } else {
84
+ console.error('[smartico] claim failed — surface this error message to the user; the bonus will move to REDEEM_FAILED state and remain claimable for a retry:', r.err_message);
85
+ }
86
+ ```
87
+
88
+ ### Example response (REAL shape)
89
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
90
+ ```json
91
+ {
92
+ "err_code": -1,
93
+ "err_message": "System Error, Bonus not found or already claimed"
94
+ }
95
+ ```
96
+
97
+ ## Errors
98
+ **Error codes** (in `err_code`)
99
+
100
+ The SDK currently types `err_code` as `SAWSpinErrorCode` for
101
+ historical reasons, but the values returned by this method come
102
+ from the server's general error space and are NOT mini-game codes.
103
+ Branch on the numeric values:
104
+
105
+ - `0` — success; the bonus has been redeemed and the operator's
106
+ integration has credited the player's account.
107
+ - `-1` — bonus not claimable: not found, already claimed by
108
+ another session, or its status is no longer `COUPON_ISSUED` /
109
+ `REDEEM_FAILED`. Treat as idempotent — refresh
110
+ `getBonuses` and reconcile.
111
+ - `1` — generic server error. Transient; allow retry after a brief
112
+ delay.
113
+ - `9999` — uncaught server exception. Treat as a transient failure;
114
+ surface a generic error and allow retry.
115
+ - other non-zero — generic server error. Surface `err_message` if
116
+ any.
117
+
118
+ **`success` field is unreliable**: the wire response does not
119
+ carry a `success` boolean — the field on `TClaimBonusResult` will
120
+ be `undefined` in practice. Always branch on `err_code === 0`
121
+ for the success check.
122
+
123
+ ## Related
124
+ - `getBonuses`
125
+ - `SAWSpinErrorCode`
@@ -0,0 +1,116 @@
1
+ # claimRafflePrize — API (TransformedRaffleClaimPrizeResponse)
2
+
3
+ > Claims a raffle prize the user has won.
4
+ > Import: `import { TransformedRaffleClaimPrizeResponse } from '@smartico/public-api'`
5
+ > Search terms: claimRafflePrize, raffles, TransformedRaffleClaimPrizeResponse
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.claimRafflePrize(props: { won_id: number }): Promise<TransformedRaffleClaimPrizeResponse>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `props.won_id` — The winning row's `raf_won_id` (from `TRafflePrizeWinner` returned by `getRaffleDrawRun`).
14
+
15
+ ## Returns — `Promise<TransformedRaffleClaimPrizeResponse>`
16
+ `TransformedRaffleClaimPrizeResponse`:
17
+ - `errorCode` (number) — Error code. `0` = success. See `claimRafflePrize` TSDoc for the full table.
18
+ - `errorMessage` (string) — Optional error message; populated on non-zero `errorCode`.
19
+
20
+ ## Behavioral contract
21
+ **Result shape note**: this method returns
22
+ `TransformedRaffleClaimPrizeResponse` with `errorCode` /
23
+ `errorMessage` (camelCase full-word) — different from most other
24
+ SDK result types which use `err_code` / `err_message` (snake_case
25
+ short-word). Branch on the camelCase keys when reading this
26
+ method's result.
27
+
28
+ **Preconditions**
29
+ Pass a `won_id` that identifies an unclaimed winning row for the
30
+ current user. The `won_id` comes from
31
+ `TRafflePrizeWinner.raf_won_id` returned by
32
+ `getRaffleDrawRun`.
33
+
34
+
35
+
36
+ **Claim window**
37
+ There is no server-enforced claim deadline. Won prizes remain
38
+ claimable indefinitely until the operator archives them.
39
+
40
+ **Idempotency**: NOT idempotent. A second call on the same
41
+ `won_id` returns `errorCode === 1` with `errorMessage` indicating
42
+ the prize has already been claimed. The SDK does NOT enforce an
43
+ in-flight lock. Guard the call site against double-clicks (set
44
+ a local "claiming" flag on click, clear it on response).
45
+
46
+ **Refresh after success (and after failure)**
47
+ The SDK automatically refreshes the raffles cache on every
48
+ response — both success and failure paths fire the `onUpdate`
49
+ callback registered via `getRaffles`. After `errorCode === 0`,
50
+ the affected `TRaffleDrawRun.has_unclaimed_prize` (in history)
51
+ and the winner row's `claimed_date` reflect the claim on the next
52
+ refresh.
53
+
54
+ **Side effects** (on `errorCode === 0`)
55
+ - The winner row's `claimed_date` is set server-side.
56
+ - Prize delivery is queued for the operator's integration to
57
+ process. Balance / bonus / inbox updates that result from the
58
+ delivery arrive through their own channels — not in this
59
+ response.
60
+
61
+ **Throws**
62
+ `won_id` is required — the SDK throws synchronously when missing
63
+ or falsy.
64
+
65
+ **UI guidance**: see [UI Guide — `claimRafflePrize`](../../docs/ui/raffles/UIGuide_claimRafflePrize.md).
66
+
67
+ **Visitor mode**: not meaningfully supported. The SDK does not
68
+ block the call, but visitor sessions have no win history and the
69
+ server will reject it.
70
+
71
+ ## Example
72
+ ```ts
73
+ const detail = await window._smartico.api.getRaffleDrawRun({
74
+ raffle_id: raffleId,
75
+ run_id: runId,
76
+ });
77
+ const myWin = detail.prizes.flatMap(p => p.winners).find(w => /* user match here *\/ true);
78
+
79
+ if (!myWin || !myWin.raf_won_id || myWin.claimed_date) {
80
+ console.log('[smartico] nothing to claim — keep CTA hidden');
81
+ return;
82
+ }
83
+
84
+ console.log('[smartico] claim starting — set in-flight flag, show loading dots on the Claim button, keep the modal open');
85
+ const r = await window._smartico.api.claimRafflePrize({ won_id: myWin.raf_won_id });
86
+ console.log('[smartico] claim response received — clear in-flight flag');
87
+
88
+ if (r.errorCode === 0) {
89
+ console.log('[smartico] claim succeeded — show a success toast; getRaffles onUpdate above will fire with refreshed state; prize delivery happens server-side');
90
+ } else if (r.errorCode === 1 && r.errorMessage?.toLowerCase().includes('already claimed')) {
91
+ console.log('[smartico] prize was already claimed (perhaps from another tab) — treat as success, hide the Claim CTA');
92
+ } else {
93
+ console.error('[smartico] claim failed — surface this error message to the user and allow retry:', r.errorMessage);
94
+ }
95
+ ```
96
+
97
+ ## Errors
98
+ **Error codes** (in `errorCode`)
99
+ - `0` — success; the claim is recorded and prize delivery is
100
+ queued server-side.
101
+ - `1` — generic claim failure. The `errorMessage` distinguishes
102
+ the specific cause (the server uses one error code for several
103
+ distinct conditions): the prize has already been claimed, the
104
+ `won_id` doesn't match a winning row for this user, or the user
105
+ is in a control group for this raffle. Treat `1` as a retryable
106
+ error if the message suggests a transient condition; treat as
107
+ idempotent success if the message indicates already-claimed
108
+ (the underlying state is what the consumer wants either way —
109
+ the prize is claimed).
110
+ - other non-zero — generic server error. Surface `errorMessage`
111
+ if any.
112
+
113
+ ## Related
114
+ - `getRaffleDrawRun`
115
+ - `getRaffleDrawRunsHistory`
116
+ - `getRaffles`
@@ -0,0 +1,66 @@
1
+ # deleteAllInboxMessages — API (InboxMarkMessageAction)
2
+
3
+ > Soft-deletes ALL of the user's inbox messages in one server round-trip — typically wired to a "Delete all" CTA in the inbox header (usually behind a confirm dialog given the destructive nature).
4
+ > Import: `import { InboxMarkMessageAction } from '@smartico/public-api'`
5
+ > Search terms: deleteAllInboxMessages, inbox, InboxMarkMessageAction
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.deleteAllInboxMessages(): Promise<InboxMarkMessageAction>
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `Promise<InboxMarkMessageAction>`
16
+ `InboxMarkMessageAction`:
17
+ - `err_code` (number) — Error code. `0` = success. See the calling method's TSDoc for the full error semantics (server returns generic codes; the five inbox mutations share the same shape).
18
+ - `err_message` (string) — Optional server-side error message. Present only on non-zero `err_code`; may be empty even then.
19
+
20
+ ## Behavioral contract
21
+ **Race condition note**: a new message arriving server-side
22
+ between the call and its processing is NOT deleted (the
23
+ server's delete-all operation is a snapshot in time). Subsequent
24
+ `getInboxMessages` calls show the new message.
25
+
26
+ **Refresh after success**
27
+ Same as `deleteInboxMessage` — `getInboxMessages` `onUpdate`
28
+ does not fire automatically. Replace the local list with `[]`
29
+ (or re-call `getInboxMessages`). The unread count drops to 0
30
+ (or near-0 if races) via the user-properties channel.
31
+
32
+ **Idempotency**: safe. A second call on an already-empty inbox
33
+ returns `err_code === 0` with no-op effect.
34
+
35
+ **Side effects** (on success)
36
+ - Every message flipped to deleted server-side.
37
+ - `core_inbox_unread_count` drops to 0.
38
+ - There is no SDK undelete path — recovery requires operator
39
+ intervention.
40
+
41
+ **UI guidance**: included in the
42
+ [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md)
43
+ (Bulk variant section).
44
+
45
+ **Visitor mode**: not supported.
46
+
47
+ ## Example
48
+ ```ts
49
+ // After a confirm dialog "Are you sure you want to delete all messages?"
50
+ console.log('[smartico] delete-all confirmed — show loading state on the "Delete all" button');
51
+ const r = await window._smartico.api.deleteAllInboxMessages();
52
+ if (r.err_code === 0) {
53
+ console.log('[smartico] inbox cleared — replace the local list with [], fire a "All messages deleted" toast, badge auto-drops to 0');
54
+ } else {
55
+ console.error('[smartico] delete-all failed — show a non-blocking error toast:', r.err_message);
56
+ }
57
+ ```
58
+
59
+ ## Errors
60
+ **Error codes** (in `err_code`)
61
+ - `0` — success; the entire inbox is now empty from the user's
62
+ view.
63
+ - other non-zero — server error. Surface `err_message` if any.
64
+
65
+ ## Related
66
+ - `deleteInboxMessage`
@@ -0,0 +1,60 @@
1
+ # deleteInboxMessage — API (InboxMarkMessageAction)
2
+
3
+ > Soft-deletes a single inbox message.
4
+ > Import: `import { InboxMarkMessageAction } from '@smartico/public-api'`
5
+ > Search terms: deleteInboxMessage, inbox, InboxMarkMessageAction
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.deleteInboxMessage(messageGuid: string): Promise<InboxMarkMessageAction>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `messageGuid` — The `message_guid` from a `TInboxMessage`.
14
+
15
+ ## Returns — `Promise<InboxMarkMessageAction>`
16
+ `InboxMarkMessageAction`:
17
+ - `err_code` (number) — Error code. `0` = success. See the calling method's TSDoc for the full error semantics (server returns generic codes; the five inbox mutations share the same shape).
18
+ - `err_message` (string) — Optional server-side error message. Present only on non-zero `err_code`; may be empty even then.
19
+
20
+ ## Behavioral contract
21
+ **Refresh after success**
22
+ The SDK does NOT auto-refresh `getInboxMessages`. Drop the
23
+ deleted message from your local list, or re-call
24
+ `getInboxMessages` to reload. If the deleted message was unread,
25
+ the unread count drops automatically via the user-properties
26
+ channel.
27
+
28
+ **Idempotency**: safe. A second call on an already-deleted
29
+ `messageGuid` returns `err_code === 0` (server treats it as a
30
+ no-op — already-deleted messages are filtered out).
31
+
32
+ **Side effects** (on success)
33
+ - Server-side `is_deleted` flag set to true.
34
+ - If the message was unread, `core_inbox_unread_count`
35
+ decrements via the user-properties channel.
36
+
37
+ **UI guidance**: see [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md).
38
+
39
+ **Visitor mode**: not supported.
40
+
41
+ ## Example
42
+ ```ts
43
+ // Swipe-to-delete on mobile; trash-icon click on desktop.
44
+ console.log('[smartico] delete starting — animate the row out of the list (slide left/right by 100%)');
45
+ const r = await window._smartico.api.deleteInboxMessage(message.message_guid);
46
+ if (r.err_code === 0) {
47
+ console.log('[smartico] deleted — drop the message from the local list, fire a brief "Message deleted" toast (no undo affordance — there is no undelete via the SDK)');
48
+ } else {
49
+ console.error('[smartico] delete failed — animate the row back into place and show a non-blocking error:', r.err_message);
50
+ }
51
+ ```
52
+
53
+ ## Errors
54
+ **Error codes** (in `err_code`)
55
+ - `0` — success; the message is now deleted from the user's
56
+ view.
57
+ - other non-zero — server error. Surface `err_message` if any.
58
+
59
+ ## Related
60
+ - `getInboxMessages`
@@ -0,0 +1,248 @@
1
+ # gamePickGetActiveRound — API (GamePickRound)
2
+
3
+ > Returns a single round (events, user selections, scoring rules) for a MatchX or Quiz game.
4
+ > Import: `import { GamePickRound } from '@smartico/public-api'`
5
+ > Search terms: gamePickGetActiveRound, gamepick, GamePickRound, GPRoundStatus, GamePickScoreType, GameRoundOrderType, GamePickRoundPublicMeta, GamePickEvent, SAWGPMarketType, GamePickEventMeta, QuizAnswersValueType, GamePickResolutionType, errCode, data
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.gamePickGetActiveRound(props: GamePickRoundRequestParams): Promise<GamesApiResponse<GamePickRound>>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `props.saw_template_id` — ID of the MatchX or Quiz game template.
14
+ - `props.round_id` — ID of the round to fetch.
15
+
16
+ ## Returns — `Promise<GamesApiResponse<GamePickRound>>`
17
+ Wrapped in `GamesApiResponse`: `errCode` (number — `0` = success), `errMessage?` (string), `data?` — the payload:
18
+
19
+ `GamePickRound`:
20
+ - `round_id` (number) — Unique round identifier
21
+ - `round_row_id` (number) — Sequential row ID used for ordering rounds
22
+ - `round_name` (string) — Localized display name of the round
23
+ - `round_description` (string) — Localized description of the round
24
+ - `final_screen_cta_button_title` (string) — Label for the CTA button on the final/results screen
25
+ - `final_screen_message` (string) — Message displayed on the final/results screen
26
+ - `final_screen_image_desktop` (string) — URL of the final screen image (desktop)
27
+ - `final_screen_image_mobile` (string) — URL of the final screen image (mobile)
28
+ - `promo_image` (string) — URL of the promotional image for the round
29
+ - `promo_text` (string) — Promotional text displayed with the round
30
+ - `open_date` (number) — Timestamp (ms) when the round opens for participation
31
+ - `last_bet_date` (number) — Timestamp (ms) of the last moment bets are accepted
32
+ - `resolution_date` (number) — Timestamp (ms) when the round is expected to be resolved
33
+ - `score_full_win` (number) — Points awarded for a fully correct prediction
34
+ - `score_part_win` (number) — Points awarded for a partially correct prediction
35
+ - `score_lost` (number) — Points awarded (or deducted) for an incorrect prediction
36
+ - `is_active_now` (boolean) — Whether the round is currently active for participation
37
+ - `is_resolved` (boolean) — Whether the round has been fully resolved and scored
38
+ - `round_status_id` (GPRoundStatus) — Current lifecycle status of the round
39
+ - `events_total` (number) — Total number of events in the round
40
+ - `events_resolved` (number) — Number of events that have been resolved
41
+ - `score_type_id` (GamePickScoreType) — Scoring method used for this round
42
+ - `order_events` (GameRoundOrderType) — How events are ordered for display
43
+ - `board_users_count` (number) — Maximum number of users shown on the leaderboard
44
+ - `hide_users_predictions` (boolean) — Whether other users' predictions are hidden until resolution
45
+ - `public_meta` (GamePickRoundPublicMeta) — Public metadata including translations and display settings from the BackOffice
46
+ - `round_name` (string) — Localized round name
47
+ - `round_description` (string) — Localized round description
48
+ - `promo_image` (string) — URL of the promotional image for the round
49
+ - `promo_text` (string) — Promotional text displayed with the round
50
+ - `hide_resolved_round` (boolean) — Whether to hide the round from the UI after it has been resolved
51
+ - `final_screen_image_desktop` (string) — URL of the final screen image for desktop
52
+ - `final_screen_image_mobile` (string) — URL of the final screen image for mobile
53
+ - `final_screen_message` (string) — Message displayed on the final/results screen
54
+ - `final_screen_cta_button_title` (string) — Label for the CTA button on the final screen
55
+ - `final_screen_cta_dp` (string) — Deep link triggered by the CTA button on the final screen
56
+ - `allow_edit_answers` (boolean) — Whether users can edit their answers after initial submission (within betting window)
57
+ - `_translations` ({
58
+ [key: string]: {
59
+ round_name: string;
60
+ round_description: string;
61
+ promo_image: string;
62
+ promo_text: string;
63
+ final_screen_image_desktop: string;
64
+ final_screen_image_mobile: string;
65
+ final_screen_message: string;
66
+ final_screen_cta_button_title: string;
67
+ };
68
+ }) — Per-language overrides for round display content
69
+ - `next_round_open_date` (number) — Timestamp (ms) when the next round opens, if available
70
+ - `show_users_preference` (boolean) — Whether to show aggregated user preference percentages for each outcome
71
+ - `events` (GamePickEvent[]) — List of events (matches/questions) in this round
72
+ - `gp_event_id` (number) — Unique identifier of the event
73
+ - `event_resolution_date` (string) — ISO 8601 date-time string when the event was resolved; null until resolved.
74
+ - `match_date` (string) — ISO 8601 date-time string of the match/event start time.
75
+ - `market_type_id` (SAWGPMarketType) — Market type defining the prediction format (e.g. two-team score, quiz question, custom)
76
+ - `event_meta` (GamePickEventMeta) — Event metadata containing team names, images, sport type, and question details
77
+ - `answers` ({
78
+ /** Answer identifier value sent on submission */
79
+ value: string;
80
+ /** Localized display text of the answer */
81
+ text: string;
82
+ /** Per-language overrides for the answer text */
83
+ _translations: {
84
+ [key: string]: {
85
+ text: string;
86
+ };
87
+ };
88
+ }[]) — List of possible answer options for the quiz question
89
+ - `question_image` (string) — URL of an image associated with the question
90
+ - `result` (QuizAnswersValueType) — Correct answer value after resolution
91
+ - `custom_question` (string) — Custom question text displayed to the user
92
+ - `event_name` (string) — Display name of the event/match
93
+ - `team1_name` (string) — Name of the first team (home)
94
+ - `team1_image` (string) — URL of the first team's logo image
95
+ - `team2_name` (string) — Name of the second team (away)
96
+ - `team2_image` (string) — URL of the second team's logo image
97
+ - `team1_result` (number) — Actual result score for team 1 after resolution
98
+ - `team2_result` (number) — Actual result score for team 2 after resolution
99
+ - `sport_type_id` (number) — Betradar sport type ID for the event
100
+ - `is_canceled` (boolean) — Whether the event has been canceled
101
+ - `auto_resolve_enabled` (boolean) — Whether auto-resolution from live data feed is enabled
102
+ - `auto_resolve_date` (string) — ISO date string for when auto-resolution is expected
103
+ - `team1_auto_result` (number) — Auto-resolved score for team 1 from live data feed
104
+ - `team2_auto_result` (number) — Auto-resolved score for team 2 from live data feed
105
+ - `auto_result` (string) — Auto-resolved answer value from live data feed (for quiz events)
106
+ - `_translations` ({
107
+ [key: string]: {
108
+ team1_name: string;
109
+ team2_name: string;
110
+ event_name: string;
111
+ custom_question: string;
112
+ };
113
+ }) — Per-language overrides for team names, event name, and custom question
114
+ - `user_placed_bet` (boolean) — Whether the current user has submitted a prediction for this event
115
+ - `team1_user_selection` (number | { from: number; to: number }) — User's predicted score for team 1 (MatchX only). Can be a number or a range object
116
+ - `team2_user_selection` (number | { from: number; to: number }) — User's predicted score for team 2 (MatchX only). Can be a number or a range object
117
+ - `user_selection` (QuizAnswersValueType) — User's selected answer (Quiz only). Value depends on market type (e.g. '1', '2', 'x', 'yes', 'no')
118
+ - `resolution_type_id` (GamePickResolutionType) — How the user's prediction was scored after resolution
119
+ - `resolution_score` (number) — Points awarded for this event based on prediction accuracy
120
+ - `is_open_for_bets` (boolean) — Whether this event is still accepting predictions
121
+ - `odds_details` ({ odd_value: { [key: string]: number } }) — Betting odds details for the event outcomes
122
+ - `question_image` (string) — URL of a question-specific image (quiz events)
123
+ - `user_score` (number) — Current user's total score in this round
124
+ - `user_placed_bet` (boolean) — Whether the current user has submitted any predictions in this round
125
+ - `has_open_for_bet_events` (boolean) — Whether there are events still open for betting
126
+ - `has_not_submitted_changes` (boolean) — Whether the user has unsaved changes to their predictions
127
+
128
+ ## Behavioral contract
129
+ **Preconditions**
130
+ - User must be authenticated. Visitor mode not supported.
131
+ - `saw_template_id` and `round_id` are mandatory — the SDK throws if either
132
+ is missing.
133
+
134
+
135
+
136
+ **Refresh**
137
+ - No cache; every call is live.
138
+ - Re-call after `gamePickSubmitSelection` or
139
+ `gamePickSubmitSelectionQuiz` to surface the persisted predictions.
140
+ - Poll while the user is on the prediction screen if event resolution
141
+ updates are needed (typically every 30–60 s).
142
+
143
+ **Visitor mode**: not supported.
144
+
145
+ **UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md).
146
+
147
+ ## Example
148
+ ```ts
149
+ const r = await window._smartico.api.gamePickGetActiveRound({
150
+ saw_template_id: 1083,
151
+ round_id: 31652,
152
+ });
153
+
154
+ if (r.errCode === 0 && r.data) {
155
+ 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);
156
+ } else {
157
+ console.error('[smartico] round fetch failed — bounce back to the lobby and refresh:', r.errMessage);
158
+ }
159
+ ```
160
+
161
+ ### Example response (REAL shape)
162
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
163
+ ```json
164
+ {
165
+ "errCode": 0,
166
+ "data": {
167
+ "round_id": 42115,
168
+ "round_row_id": 2,
169
+ "public_meta": {
170
+ "round_name": "Group stage 15-28 June",
171
+ "_translations": {
172
+ "BR": {},
173
+ "TH": {}
174
+ },
175
+ "allow_edit_answers": true,
176
+ "final_screen_cta_dp": "dp:ok",
177
+ "hide_resolved_round": false
178
+ },
179
+ "score_type_id": 1,
180
+ "open_date": 1782200297406,
181
+ "last_bet_date": 1782691140000,
182
+ "is_active_now": true,
183
+ "is_resolved": false,
184
+ "round_status_id": -1,
185
+ "score_full_win": 0,
186
+ "score_part_win": 0,
187
+ "score_lost": 0,
188
+ "events_total": "28",
189
+ "events_resolved": "1",
190
+ "show_users_preference": true,
191
+ "order_events": 1,
192
+ "board_users_count": 20,
193
+ "hide_users_predictions": false,
194
+ "round_name": "Group stage 15-28 June",
195
+ "user_score": 0,
196
+ "user_placed_bet": false,
197
+ "events": [
198
+ {
199
+ "gp_event_id": 147400,
200
+ "market_type_id": 4,
201
+ "event_meta": {
202
+ "event_name": "World Cup",
203
+ "team1_name": "Czech Republic",
204
+ "team2_name": "Mexico",
205
+ "is_canceled": false,
206
+ "team1_image": "https://cdn.example/games/teams-images/1299262.png",
207
+ "team2_image": "https://cdn.example/games/teams-images/4781.png",
208
+ "sport_type_id": 1,
209
+ "question_image": "https://cdn.example/5ff1fc35b419e43886d227-Artboard3.png",
210
+ "scores_manually_adjusted": false
211
+ },
212
+ "event_resolution_date": null,
213
+ "match_date": "2026-06-25T01:00:00.000Z",
214
+ "odds_details": {
215
+ "odd_value": {
216
+ "1": 22,
217
+ "2": 35,
218
+ "x": 43
219
+ }
220
+ },
221
+ "user_placed_bet": false,
222
+ "resolution_score": 0,
223
+ "is_open_for_bets": true,
224
+ "resolution_type_id": 0
225
+ }
226
+ ],
227
+ "has_open_for_bet_events": true,
228
+ "has_not_submitted_changes": false
229
+ }
230
+ }
231
+ ```
232
+
233
+ ## Errors
234
+ **Error codes** (in `errCode`)
235
+ - `0` — success.
236
+ - `4` — round / event not found (e.g. round resolved after the last
237
+ `gamePickGetActiveRounds` poll); non-fatal — retry after a fresh active-
238
+ rounds fetch.
239
+ - `100002` — template not found.
240
+ - `100000` — auth hash invalid.
241
+ - `100004` — generic server error.
242
+
243
+ ## Related
244
+ - `gamePickGetActiveRounds`
245
+ - `gamePickSubmitSelection`
246
+ - `gamePickSubmitSelectionQuiz`
247
+ - `GamesApiResponse`
248
+ - `GamePickRound`