@smartico/public-api 0.0.380 → 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 (174) hide show
  1. package/CLAUDE.md +103 -0
  2. package/README.md +32 -10
  3. package/dist/Base/ClassId.d.ts +2 -0
  4. package/dist/Jackpots/JackpotDetails.d.ts +14 -15
  5. package/dist/Jackpots/JackpotPot.d.ts +10 -6
  6. package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
  7. package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
  8. package/dist/Raffle/index.d.ts +2 -0
  9. package/dist/SmarticoAPI.d.ts +6 -1
  10. package/dist/SmarticoLib/index.d.ts +5 -1
  11. package/dist/WSAPI/WSAPIAvatars.d.ts +267 -49
  12. package/dist/WSAPI/WSAPIBonuses.d.ts +224 -10
  13. package/dist/WSAPI/WSAPIGamePick.d.ts +538 -253
  14. package/dist/WSAPI/WSAPIGeneral.d.ts +156 -14
  15. package/dist/WSAPI/WSAPIInbox.d.ts +547 -58
  16. package/dist/WSAPI/WSAPIJackpots.d.ts +292 -57
  17. package/dist/WSAPI/WSAPILeaderBoard.d.ts +127 -13
  18. package/dist/WSAPI/WSAPIMiniGames.d.ts +465 -49
  19. package/dist/WSAPI/WSAPIRaffles.d.ts +576 -52
  20. package/dist/WSAPI/WSAPITournaments.d.ts +3 -3
  21. package/dist/WSAPI/WSAPITypes.d.ts +243 -132
  22. package/dist/WSAPI/WSAPIUser.d.ts +193 -43
  23. package/dist/index.js +3409 -615
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.modern.mjs +3391 -608
  26. package/dist/index.modern.mjs.map +1 -1
  27. package/docs/Callbacks.md +162 -0
  28. package/docs/SmarticoObject.md +445 -0
  29. package/docs/Transforms.md +99 -0
  30. package/docs/api/README.md +26 -0
  31. package/docs/api/classes/WSAPIAvatars.md +282 -54
  32. package/docs/api/classes/WSAPIBonuses.md +233 -12
  33. package/docs/api/classes/WSAPIClans.md +380 -10
  34. package/docs/api/classes/WSAPIGamePick.md +555 -26
  35. package/docs/api/classes/WSAPIGeneral.md +165 -16
  36. package/docs/api/classes/WSAPIInbox.md +588 -64
  37. package/docs/api/classes/WSAPIJackpots.md +320 -66
  38. package/docs/api/classes/WSAPILeaderBoard.md +133 -15
  39. package/docs/api/classes/WSAPIMiniGames.md +501 -64
  40. package/docs/api/classes/WSAPIMissions.md +58 -79
  41. package/docs/api/classes/WSAPIRaffles.md +647 -69
  42. package/docs/api/classes/WSAPIStore.md +83 -108
  43. package/docs/api/classes/WSAPITournaments.md +495 -28
  44. package/docs/api/classes/WSAPIUser.md +520 -83
  45. package/docs/api/documents/Callbacks.md +162 -0
  46. package/docs/api/documents/SmarticoObject.md +445 -0
  47. package/docs/api/documents/Transforms.md +99 -0
  48. package/docs/api/enumerations/BonusStatus-1.md +11 -6
  49. package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
  50. package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
  51. package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
  52. package/docs/api/interfaces/AvatarCustomized.md +25 -0
  53. package/docs/api/interfaces/AvatarDefinition.md +94 -0
  54. package/docs/api/interfaces/AvatarPrompt.md +45 -0
  55. package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
  56. package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
  57. package/docs/api/interfaces/Clan.md +4 -0
  58. package/docs/api/interfaces/ClanInfo.md +109 -0
  59. package/docs/api/interfaces/ClanMember.md +53 -0
  60. package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
  61. package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
  62. package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
  63. package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
  64. package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
  65. package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
  66. package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
  67. package/docs/api/interfaces/JackpotDetails.md +14 -15
  68. package/docs/api/interfaces/JackpotPot.md +9 -6
  69. package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
  70. package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
  71. package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
  72. package/docs/api/interfaces/PointsLog.md +43 -0
  73. package/docs/api/interfaces/RaffleWonPrize.md +59 -0
  74. package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
  75. package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
  76. package/docs/api/interfaces/TAchCategory.md +2 -7
  77. package/docs/api/interfaces/TAvatarCustomized.md +4 -4
  78. package/docs/api/interfaces/TAvatarDefinition.md +13 -14
  79. package/docs/api/interfaces/TAvatarPrompt.md +6 -6
  80. package/docs/api/interfaces/TBonus.md +16 -8
  81. package/docs/api/interfaces/TBuyStoreItemResult.md +4 -29
  82. package/docs/api/interfaces/TClaimBonusResult.md +5 -5
  83. package/docs/api/interfaces/TClan.md +8 -4
  84. package/docs/api/interfaces/TClanInfo.md +47 -0
  85. package/docs/api/interfaces/TClanJoinResult.md +11 -1
  86. package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
  87. package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
  88. package/docs/api/interfaces/TClans.md +3 -1
  89. package/docs/api/interfaces/TGetTranslations.md +4 -0
  90. package/docs/api/interfaces/TInboxMessage.md +14 -6
  91. package/docs/api/interfaces/TInboxMessageBody.md +18 -12
  92. package/docs/api/interfaces/TLevel.md +17 -20
  93. package/docs/api/interfaces/TLevelCurrent.md +19 -18
  94. package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
  95. package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
  96. package/docs/api/interfaces/TMissionClaimRewardResult.md +1 -9
  97. package/docs/api/interfaces/TMissionOptInResult.md +1 -5
  98. package/docs/api/interfaces/TMissionOrBadge.md +4 -7
  99. package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
  100. package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
  101. package/docs/api/interfaces/TSetAvatarResult.md +3 -3
  102. package/docs/api/interfaces/TStoreItem.md +3 -13
  103. package/docs/api/interfaces/TTournament.md +1 -1
  104. package/docs/api/interfaces/TTournamentDetailed.md +1 -1
  105. package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
  106. package/docs/api/interfaces/TUICustomSection.md +23 -19
  107. package/docs/api/interfaces/TUserProfile.md +18 -16
  108. package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
  109. package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
  110. package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
  111. package/docs/native/ADDING_METHODS.md +7 -2
  112. package/docs/native/PROTOCOL.md +337 -0
  113. package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
  114. package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
  115. package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
  116. package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
  117. package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
  118. package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
  119. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
  120. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
  121. package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
  122. package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
  123. package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
  124. package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
  125. package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
  126. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
  127. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
  128. package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
  129. package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
  130. package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
  131. package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
  132. package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
  133. package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
  134. package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
  135. package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
  136. package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
  137. package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
  138. package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
  139. package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
  140. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
  141. package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
  142. package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
  143. package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
  144. package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
  145. package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
  146. package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
  147. package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
  148. package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
  149. package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
  150. package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
  151. package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
  152. package/docs/ui/user/UIGuide_getLevels.md +47 -42
  153. package/package.json +1 -1
  154. package/src/Base/ClassId.ts +2 -0
  155. package/src/Jackpots/JackpotDetails.ts +14 -15
  156. package/src/Jackpots/JackpotPot.ts +10 -6
  157. package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
  158. package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
  159. package/src/Raffle/index.ts +3 -1
  160. package/src/SmarticoAPI.ts +14 -1
  161. package/src/SmarticoLib/index.ts +4 -0
  162. package/src/WSAPI/WSAPIAvatars.ts +267 -49
  163. package/src/WSAPI/WSAPIBonuses.ts +224 -10
  164. package/src/WSAPI/WSAPIGamePick.ts +538 -253
  165. package/src/WSAPI/WSAPIGeneral.ts +156 -14
  166. package/src/WSAPI/WSAPIInbox.ts +545 -56
  167. package/src/WSAPI/WSAPIJackpots.ts +297 -61
  168. package/src/WSAPI/WSAPILeaderBoard.ts +127 -13
  169. package/src/WSAPI/WSAPIMiniGames.ts +465 -49
  170. package/src/WSAPI/WSAPIRaffles.ts +592 -64
  171. package/src/WSAPI/WSAPITournaments.ts +3 -3
  172. package/src/WSAPI/WSAPITypes.ts +243 -132
  173. package/src/WSAPI/WSAPIUser.ts +193 -43
  174. package/tsconfig.json +9 -1
@@ -0,0 +1,114 @@
1
+ # UI Guide — `requestRaffleOptin`
2
+
3
+ ## Overview
4
+ - Action-focused mutation. The user is on a draw card / detail
5
+ page for a draw with `requires_optin === true`, and they click
6
+ "Opt in".
7
+ - Success (`err_code === 0`) means the user is registered for this
8
+ run. Tickets earned within the run's eligibility window will
9
+ participate in the draw.
10
+ - Opt-in is **per-run** — recurring draws require a fresh opt-in
11
+ for each new run.
12
+
13
+ ## Argument mapping
14
+
15
+ The three IDs come from different fields on the embedded draw:
16
+
17
+ | Argument | Source |
18
+ |---|---|
19
+ | `raffle_id` | `TRaffle.id` (the parent raffle) |
20
+ | `draw_id` | `TRaffleDraw.id` (schedule_id, **stable** across recurring runs) |
21
+ | `raffle_run_id` | `TRaffleDraw.run_id` (per-execution instance ID) |
22
+
23
+ Don't confuse `draw.id` with `draw.run_id` — both are needed.
24
+
25
+ ## Loading state
26
+
27
+ - **Trigger**: set an in-flight flag (`optingIn = true`)
28
+ immediately on click.
29
+ - **Visual**: replace the button label with animated dots; disable
30
+ the button.
31
+ - **Reset**: clear the flag on response.
32
+
33
+ ## Idempotency UI guard
34
+
35
+ The SDK does NOT prevent double-clicks. A second call on the same
36
+ `raffle_run_id` returns `err_code === 1` with `err_message`
37
+ indicating the user is already opted in. Guard the call site:
38
+
39
+ ```ts
40
+ const [optingIn, setOptingIn] = useState(false);
41
+
42
+ const onOptIn = async (draw: TRaffleDraw) => {
43
+ if (optingIn) return; // in-flight guard
44
+ if (draw.user_opted_in) return; // already opted in
45
+ setOptingIn(true);
46
+ const r = await window._smartico.api.requestRaffleOptin({
47
+ raffle_id: raffleId,
48
+ draw_id: draw.id, // schedule_id, NOT run_id
49
+ raffle_run_id: draw.run_id,
50
+ });
51
+ setOptingIn(false);
52
+ handleResponse(r);
53
+ };
54
+ ```
55
+
56
+ Treat `err_code === 1` with an "already opted in" message as
57
+ **idempotent success** in the UI.
58
+
59
+ ## Action button decision matrix
60
+
61
+ CTA label per state on the draw card (evaluate in priority order):
62
+
63
+ | Condition | CTA |
64
+ |---|---|
65
+ | `current_state === Executed` (3) | No opt-in CTA (draw is finished) |
66
+ | `current_state === WinnerSelection` (2) | No opt-in CTA (drawing in progress) |
67
+ | `!requires_optin` | No opt-in CTA (tickets participate automatically) |
68
+ | `requires_optin && user_opted_in` | Disabled "Fully opted in" pill (informational) |
69
+ | `requires_optin && !user_opted_in && is_active && current_state !== Executed` | Enabled "Opt in" button |
70
+ | `requires_optin && !is_active` | No opt-in CTA (draw is inactive) |
71
+
72
+ After opt-in success, `user_opted_in` flips to `true` on the next
73
+ `getRaffles` refresh (which fires automatically via `onUpdate`).
74
+
75
+ ## Per-error-code handling
76
+
77
+ | `err_code` | Action |
78
+ |---|---|
79
+ | `0` (success) | Show "Fully opted in" pill; success toast optional |
80
+ | `1` + "already opted in" | Treat as success — same UI as above |
81
+ | `1` + "no need to opt-in" | Hide the opt-in CTA — the draw doesn't actually require it |
82
+ | `1` + "raffle id does not match" | Show a generic error toast; this is a programming bug — verify the IDs being passed |
83
+ | `1` + control-group message | Show a gating message ("Not eligible") |
84
+ | Other non-zero | Generic error toast with `err_message`. Allow retry. |
85
+
86
+ ## Refresh after response
87
+
88
+ The SDK auto-refreshes the raffles cache on every opt-in response
89
+ (success OR failure). The `onUpdate` callback registered via
90
+ [`getRaffles`](../../api/classes/WSAPIRaffles.md#getraffles) fires
91
+ with the refreshed list — `user_opted_in` reflects the new state.
92
+ **Don't manually call `getRaffles()` after the opt-in response.**
93
+
94
+ ## Animations / transitions
95
+
96
+ - **Loading dots**: 3-dot animation on the button while in flight.
97
+ - **Success state flip**: button transitions from "Opt in" to
98
+ "Fully opted in" (~150 ms ease-out). The default Smartico UI
99
+ uses a 500 ms delay before re-fetching, then the state flip is
100
+ observed on the refreshed list.
101
+ - **No celebration animation** — opt-in is a quiet success.
102
+
103
+ ## Mobile vs desktop
104
+
105
+ - **Loading state**: identical (dots).
106
+ - **CTA placement**: desktop usually inline on the draw row; mobile
107
+ may use a sticky CTA at the bottom of the draw detail.
108
+
109
+ ## Performance
110
+
111
+ - Single round-trip per click.
112
+ - The `getRaffles` auto-refresh after the response is a separate
113
+ network call (the cache is invalidated). For UIs that already
114
+ have fresh state, this is redundant but harmless.
@@ -0,0 +1,130 @@
1
+ # UI Guide — `getActivityLog`
2
+
3
+ ## Overview
4
+ - Returns the user's unified balance-change history — every points / gems /
5
+ diamonds transaction in the requested window, newest-first.
6
+ - Power an "Activity" / "History" tab showing wins, claims, purchases,
7
+ level-up rewards, and operator adjustments.
8
+ - 30 s SDK cache + push refresh on every wallet change (with a caveat —
9
+ see below).
10
+
11
+ ## List view organization
12
+
13
+ Single flat list, server-sorted newest-first by `create_date`. The default
14
+ Smartico UI groups rows visually by calendar day (e.g. "Today", "Yesterday",
15
+ "24 May").
16
+
17
+ ### Time-period filter chips
18
+
19
+ The default Smartico UI exposes these filters on top:
20
+
21
+ | Chip | `startTimeSeconds` | `endTimeSeconds` |
22
+ |---|---|---|
23
+ | Today | today 00:00 local | now + 60 s |
24
+ | This week | Monday 00:00 local | now + 60 s |
25
+ | Previous week | Prev Monday 00:00 | Prev Sunday 23:59:59 |
26
+ | Last 24 h (default) | now − 86400 | now + 60 s |
27
+
28
+ Custom UIs can pick any window; the server scans the full range.
29
+
30
+ ## Item card / row
31
+
32
+ Fields rendered per row:
33
+
34
+ | Field | Source | Notes |
35
+ |---|---|---|
36
+ | Currency icon | `type` (`UserBalanceType`) | points / gems / diamonds icon |
37
+ | Amount | `amount` | Prepend `+` if positive; color green when `>= 0`, red when negative |
38
+ | Balance after | `balance` | Right-aligned column |
39
+ | Source label | `source_type_id` (`PointChangeSourceType`) | See mapping table below |
40
+ | Timestamp | `create_date` (epoch s × 1000) | Relative ("2h ago") or HH:MM |
41
+
42
+ ## Source label mapping
43
+
44
+ For consistency with the default Smartico UI, group source IDs into these
45
+ display buckets:
46
+
47
+ | `PointChangeSourceType` | Display label |
48
+ |---|---|
49
+ | `Journey` (1), `ManualAdjustment` (6), `AutomationRule` (12), `API` (18) | "Marketing" |
50
+ | `AchievementTaskCompletion` (2) | "Mission Task" |
51
+ | `AchievementCompletion` (3) | "Mission" |
52
+ | `LevelsStructureChange` (4) | "Level" |
53
+ | `StorePurchase` (5) | "Store" |
54
+ | `Leaderboard` (7) | "Leaderboard" |
55
+ | `Tournament` (11), `TournamentRegistration` (13), `TournamentRegistrationCancellation` (14) | "Tournament" |
56
+ | `RefundPoints` (15) | "Refund" |
57
+ | `PlayMiniGame` (16), `WinMiniGame` (17) | "Mini-Game" |
58
+ | `DynamicFormula` (19) | "Formula" |
59
+ | `Raffle` (21) | "Raffle" |
60
+ | `Avatars` (22) | "Avatar" |
61
+ | *(any unknown)* | "Other" |
62
+
63
+ ## Pagination
64
+
65
+ `from` and `to` are offset + ceiling, NOT timestamps:
66
+
67
+ - `offset = from`
68
+ - `limit = min(to - from, 50)` — server hard-caps at 50 rows per request.
69
+
70
+ For infinite scroll, advance `from` by 50 each page. Detect end of list when
71
+ the returned array length is less than the requested page size.
72
+
73
+ ## Subscription model — `onUpdate` caveat
74
+
75
+ The `onUpdate` callback fires whenever the user's points / gems / diamonds
76
+ balance changes. **The pushed payload is a FIXED re-fetch** of:
77
+
78
+ - `startTimeSeconds = now - 600` (last 10 minutes)
79
+ - `endTimeSeconds = now`
80
+ - `from = 0`, `to = 50`
81
+
82
+ It does NOT use the original call's parameters. Consumers maintaining a long
83
+ historical view (e.g. 30 days) should treat `onUpdate` as a "new transactions
84
+ arrived" hint and re-call `getActivityLog` with their own params:
85
+
86
+ ```ts
87
+ const log = await window._smartico.api.getActivityLog({
88
+ startTimeSeconds: thirtyDaysAgo,
89
+ endTimeSeconds: now,
90
+ from: 0, to: 50,
91
+ onUpdate: async (refreshed) => {
92
+ console.log('[smartico] wallet changed — refreshed last-10-min payload arrived');
93
+ // To keep the 30-day view current, re-fetch with the original params:
94
+ const fresh = await window._smartico.api.getActivityLog({
95
+ startTimeSeconds: thirtyDaysAgo,
96
+ endTimeSeconds: Math.floor(Date.now() / 1000),
97
+ from: 0, to: 50,
98
+ });
99
+ console.log('[smartico] re-rendered full 30-day list with', fresh.length, 'rows');
100
+ },
101
+ });
102
+ ```
103
+
104
+ ## Empty / loading / error states
105
+
106
+ - **Empty**: "No activity in this period" — common for new users or
107
+ narrow time windows.
108
+ - **Loading (cold fetch)**: skeleton list (5 placeholder rows).
109
+ - **Error**: keep prior list if any; non-blocking banner.
110
+
111
+ ## Refresh
112
+
113
+ - 30 s SDK cache absorbs rapid tab switches.
114
+ - Push triggers fire on every wallet change; the SDK handles invalidation
115
+ internally.
116
+ - For the user's CURRENT balance (not the activity log), read
117
+ [`getUserProfile`](../../api/classes/WSAPIUser.md#getuserprofile) — the
118
+ activity log is for historical detail, not for the current balance widget.
119
+
120
+ ## Mobile vs desktop
121
+
122
+ - **Desktop**: row shows activity icon · source label · amount · balance · time.
123
+ - **Mobile**: row stacks activity + source label on the left, amount + balance
124
+ on the right.
125
+
126
+ ## Performance
127
+
128
+ - 30 s cache + push invalidation makes repeated tab opens cheap.
129
+ - 50-row page limit — paginate via `from` for full history.
130
+ - Don't poll — the `onUpdate` callback handles change detection.
@@ -1,13 +1,14 @@
1
1
  # UI Guide — `getLevels`
2
2
 
3
3
  ## Overview
4
+
4
5
  - Returns the full level ladder for the label — one `TLevel` per
5
- active level, server-sorted by `required_points` ASC.
6
+ active level, server-sorted by `required_points` ASC.
6
7
  - Use as a lookup table to resolve `ach_level_current_id` from
7
- [`getUserProfile`](../../api/classes/WSAPIUser.md#getuserprofile)
8
- into a richer level object, or as the source for a level map UI.
8
+ `[getUserProfile](../../api/classes/WSAPIUser.md#getuserprofile)`
9
+ into a richer level object, or as the source for a level map UI.
9
10
  - Loading indicator: skip on cache hit (30 s); show a brief shimmer
10
- on cold fetch (typically 100–300 ms).
11
+ on cold fetch (typically 100–300 ms).
11
12
 
12
13
  ## List view organization
13
14
 
@@ -41,23 +42,25 @@ of filtering them out.
41
42
 
42
43
  Fields rendered per tile:
43
44
 
44
- | Field | Use |
45
- |---|---|
46
- | `image` | Tile icon (square, 256×256 px source). |
47
- | `name` | Tile heading. |
48
- | `description` | Optional sub-text under the heading; the default UI shows this in the detail modal, not on the tile. |
49
- | `required_points` | Threshold display: `"{N} pts to reach"` or progress bar. |
50
- | `ordinal_position` | Tile order; matches array order. |
45
+
46
+ | Field | Use |
47
+ | ------------------ | ---------------------------------------------------------------------------------------------------- |
48
+ | `image` | Tile icon (square, 256×256 px source). |
49
+ | `name` | Tile heading. |
50
+ | `description` | Optional sub-text under the heading; the default UI shows this in the detail modal, not on the tile. |
51
+ | `required_points` | Threshold display: `"{N} pts to reach"` or progress bar. |
52
+ | `ordinal_position` | Tile order; matches array order. |
53
+
51
54
 
52
55
  **Locked vs unlocked treatment** — apply a `disabled` class to tiles
53
56
  where the user hasn't met the threshold:
54
57
 
55
58
  - Points-only leveling (most labels): `disabled = ach_points_ever < required_points`
56
59
  - Sliding-window leveling: also check
57
- `level_counter_1 < required_level_counter_1` (and `_2`) from
58
- [`getUserLevelExtraCounters`](../../api/classes/WSAPIUser.md#getuserlevelextracounters).
60
+ `level_counter_1 < required_level_counter_1` (and `_2`) from
61
+ `[getUserLevelExtraCounters](../../api/classes/WSAPIUser.md#getuserlevelextracounters)`.
59
62
  - Manual-only leveling: `disabled` unless the level matches the
60
- user's current `ach_level_current_id`.
63
+ user's current `ach_level_current_id`.
61
64
 
62
65
  The default Smartico UI uses CSS-only treatment for locked tiles —
63
66
  no padlock icon, no greyscale by default. Brands can add those via
@@ -70,8 +73,8 @@ When the user taps a tile, open a modal showing:
70
73
  - Hero image (`image`)
71
74
  - Title (`name`), description (`description`)
72
75
  - Progress block: for the user's current level, three stacked
73
- progress bars (points / counter 1 / counter 2) — see "Sliding-window
74
- leveling" below. For other levels, just the requirement display.
76
+ progress bars (points / counter 1 / counter 2) — see "Sliding-window
77
+ leveling" below. For other levels, just the requirement display.
75
78
  - Custom fields rendered from `custom_data` (operator-defined).
76
79
 
77
80
  `custom_data` is typed as `string` but at runtime is `any` — the SDK
@@ -95,7 +98,7 @@ The operator names the counters via translation keys
95
98
  (`levelsCounter1Name`, `levelsCounter2Name`) — typical values are
96
99
  "Total Deposits", "Total Wagering", etc. The SDK does not expose the
97
100
  operator's chosen labels; resolve them via
98
- [`getTranslations`](../../api/classes/WSAPIGeneral.md#gettranslations).
101
+ `[getTranslations](../../api/classes/WSAPIGeneral.md#gettranslations)`.
99
102
 
100
103
  On points-only labels, both `required_level_counter_*` fields are
101
104
  `null` — skip rendering the counter rows.
@@ -105,58 +108,60 @@ On points-only labels, both `required_level_counter_*` fields are
105
108
  Two formulas are in use; pick whichever fits your design:
106
109
 
107
110
  - **From-zero (default Smartico UI uses this)**:
108
- `ach_points_ever / next_level.required_points × 100`. Shows
109
- "absolute" progress; never decreases as the user gains points.
111
+ `ach_points_ever / next_level.required_points × 100`. Shows
112
+ "absolute" progress; never decreases as the user gains points.
110
113
  - **From-current-level-floor (SDK uses this in
111
- [`getCurrentLevel`](../../api/classes/WSAPIUser.md#getcurrentlevel))**:
112
- `(ach_points_ever − current.required_points) / (next.required_points
113
- − current.required_points) × 100`. Resets to 0 when the user levels
114
- up; better for "how far through this level" UX.
114
+ `[getCurrentLevel](../../api/classes/WSAPIUser.md#getcurrentlevel)`)**:
115
+ `(ach_points_ever − current.required_points) / (next.required_points − current.required_points) × 100`. Resets to 0 when the user levels
116
+ up; better for "how far through this level" UX.
115
117
 
116
118
  Both bound at 100; at the max level the bar shows full.
117
119
 
118
120
  ## Image / asset specs
119
121
 
120
- | Field | Aspect | Notes |
121
- |---|---|---|
122
+
123
+ | Field | Aspect | Notes |
124
+ | ------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------ |
122
125
  | `image` | 1:1 (square), 256×256 px documented source | Render in a square tile container; fallback: text-only tile with the level name if `image` is missing. |
123
126
 
127
+
124
128
  ## Empty / loading / error states
125
129
 
126
130
  - **Loading (cold fetch)**: render a skeleton grid (3–6 placeholder
127
- tiles) sized to the eventual layout.
131
+ tiles) sized to the eventual layout.
128
132
  - **Loading (cache hit)**: do not render a loading state — the
129
- promise resolves within a microtask.
133
+ promise resolves within a microtask.
130
134
  - **Empty result**: `[]` means no levels are configured for the
131
- label. Hide the level UI entirely (or render a neutral
132
- "no levels configured" placeholder).
135
+ label. Hide the level UI entirely (or render a neutral
136
+ "no levels configured" placeholder).
133
137
  - **Error**: keep the prior list visible if any; show a small
134
- non-blocking error banner; retry on next user-driven action.
138
+ non-blocking error banner; retry on next user-driven action.
135
139
 
136
140
  ## Animations / transitions
137
141
 
138
142
  - **Tile entry**: stagger fade-in (~30 ms per tile) on first render.
139
143
  - **Level-up celebration**: when `ach_level_current_id` flips on a
140
- push (detect via [`getUserProfile`](../../api/classes/WSAPIUser.md#getuserprofile)'s
141
- `props_change`), animate the newly-reached tile (scale-up,
142
- shine sweep). The default Smartico UI does this on the header
143
- badge, not on the level-map tiles.
144
+ push (detect via `[getUserProfile](../../api/classes/WSAPIUser.md#getuserprofile)`'s
145
+ `props_change`), animate the newly-reached tile (scale-up,
146
+ shine sweep). The default Smartico UI does this on the header
147
+ badge, not on the level-map tiles.
144
148
 
145
149
  ## Mobile vs desktop
146
150
 
147
151
  - **Grid columns**: desktop responsive (3–5 columns depending on
148
- viewport); mobile 2 columns.
152
+ viewport); mobile 2 columns.
149
153
  - **Detail view**: desktop opens as a centered modal with backdrop
150
- dim; mobile opens as a full-screen sheet.
154
+ dim; mobile opens as a full-screen sheet.
151
155
  - **Counter rows in detail**: identical on both — three stacked
152
- progress bars on Logic 2 labels.
156
+ progress bars on Logic 2 labels.
153
157
 
154
158
  ## Performance
155
159
 
156
160
  - The 30 s cache deduplicates rapid refetches; a poll loop hitting
157
- `getLevels()` every 5 s effectively translates to one network
158
- round-trip per 30 s.
161
+ `getLevels()` every 5 s effectively translates to one network
162
+ round-trip per 30 s.
159
163
  - `getLevels` is suitable to call once at app boot and cache the
160
- array in your own state (re-fetch only when the user's level
161
- changes per `props_change`, since the operator-driven ladder
162
- rarely changes mid-session).
164
+ array in your own state (re-fetch only when the user's level
165
+ changes per `props_change`, since the operator-driven ladder
166
+ rarely changes mid-session).
167
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.380",
3
+ "version": "0.0.381",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -185,6 +185,8 @@ export enum ClassId {
185
185
  RAF_CLAIM_PRIZE_RESPONSE = 909,
186
186
  RAF_OPTIN_REQUEST = 916,
187
187
  RAF_OPTIN_RESPONSE = 917,
188
+ RAF_GET_WON_PRIZES_REQUEST = 920,
189
+ RAF_GET_WON_PRIZES_RESPONSE = 921,
188
190
  /*
189
191
  RAF_GET_TICKETS_REQUEST = 902,
190
192
  RAF_GET_TICKETS_RESPONSE = 903,
@@ -4,34 +4,33 @@ import { JackpotPublicMeta } from './JackpotPublicMeta';
4
4
  import { JackpotType } from './JackpotType';
5
5
 
6
6
  /**
7
- * JackpotDetails the information about Jackpot template
8
- * It also includes JackpotPot object that holds the current value of the jackpot
9
- * Flag is_opted_in indicates if the current user is opted in to the jackpot
7
+ * One jackpot template the user is eligible for, with its live pot snapshot.
8
+ * Returned by `jackpotGet()`.
10
9
  */
11
10
  interface JackpotDetails {
12
- /** ID of the jackpot template */
11
+ /** Stable numeric ID of the template; pass to opt-in / opt-out / winners / eligible-games methods. */
13
12
  jp_template_id: number;
14
- /** Type of jackpot logic */
13
+ /** Whether the jackpot has a shared pot or one independent per user; see {@link JackpotType}. */
15
14
  jp_type_id: JackpotType;
16
- /** UI information of jackpot, like name, description, etc. */
15
+ /** Display data: name, description, image_url, winner / not-winner HTML templates, custom_data (JSON-parsed). */
17
16
  jp_public_meta: JackpotPublicMeta;
18
- /** Base currency of the jackpot */
17
+ /** Native jackpot currency (ISO 4217). Used for winner-history amounts. */
19
18
  jp_currency: string;
20
- /** Wallet currency of currently logged in user */
19
+ /** Current user's wallet currency. Used to display the pot via `pot.current_pot_amount_user_currency`. */
21
20
  user_currency: string;
22
- /** Type of the user contribution to the jackpot */
21
+ /** Whether the contribution is a fixed amount or a percentage of the bet; see {@link JackpotContributionType}. */
23
22
  contribution_type: JackpotContributionType;
24
- /** Value of the user contribution. Fixed amount or percentage of bet depending on the contribution type */
23
+ /** Amount of contribution per qualifying bet — fixed value or percentage depending on `contribution_type`. */
25
24
  contribution_value: number;
26
- /** Information of current value of the jackpot */
25
+ /** Live pot snapshot (amount, temperature, last explosion timestamp). */
27
26
  pot: JackpotPot;
28
- /** Indication if the current user is opted in to the jackpot */
27
+ /** `true` when the current user is currently opted in. */
29
28
  is_opted_in: boolean;
30
- /** Indicates whether all games are eligible for the jackpot */
29
+ /** `true` when every game in the operator catalog contributes; if `true`, skip `getJackpotEligibleGames`. */
31
30
  ach_related_game_allow_all: boolean;
32
- /** The number of users who have opted in to participate in the jackpot */
31
+ /** Number of users currently opted in; always `1` for `JackpotType.Personal`. */
33
32
  registration_count: number;
34
- /** Show winners in widget and over API */
33
+ /** Operator flag: whether the winners list should be displayed. Enforced client-side only — gate `getJackpotWinners` calls on this. */
35
34
  expose_winners_over_api: boolean;
36
35
  }
37
36
 
@@ -9,18 +9,22 @@ enum JackPotTemparature {
9
9
  BURNING = 3,
10
10
  }
11
11
 
12
+ /**
13
+ * Live snapshot of one jackpot pot's value and temperature.
14
+ * Embedded on `JackpotDetails.pot`; refreshed at the 1 s SDK cache TTL.
15
+ */
12
16
  interface JackpotPot {
13
- /** ID of the jackpot template */
17
+ /** Template ID this pot belongs to. */
14
18
  jp_template_id: number;
15
- /** ID of the jackpot pot */
19
+ /** Stable numeric ID of the current pot instance (rotates when the pot explodes). */
16
20
  jp_pot_id: number;
17
- /** currency of the jackpot pot in the Jackput base currency */
21
+ /** Current pot amount in the jackpot's native currency (`jp_currency`). */
18
22
  current_pot_amount: number;
19
- /** currency of the jackpot pot in the user wallet currency */
23
+ /** Current pot amount converted to the user's wallet currency (`user_currency`). */
20
24
  current_pot_amount_user_currency: number;
21
- /** the date/time when this pot exploded */
25
+ /** Unix ms timestamp of when this pot last exploded; `0` if it has never exploded. */
22
26
  explode_date_ts: number;
23
- /** current pot temperature */
27
+ /** Heat band of the pot relative to its explosion range; see {@link JackPotTemparature}. */
24
28
  current_pot_temperature: JackPotTemparature;
25
29
  }
26
30
 
@@ -0,0 +1,12 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+
3
+ export interface GetRaffleWonPrizesRequest extends ProtocolMessage {
4
+ /** ID of the raffle to fetch the current user's won prizes for. */
5
+ raffle_id: number;
6
+
7
+ /** Zero-based index of the first won-prize row to return (pagination). */
8
+ offset: number;
9
+
10
+ /** Maximum number of won-prize rows to return (pagination). */
11
+ limit: number;
12
+ }
@@ -0,0 +1,56 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+
3
+ /** Presentation meta for a won prize. */
4
+ export interface RaffleWonPrizePublicMeta {
5
+ /** Name of the prize, e.g. '1 $'. */
6
+ name: string;
7
+ /** Indicates whether the chance to win should be hidden in the UI. */
8
+ hide_chance_to_win: boolean;
9
+ /** URL of the image that represents the prize. */
10
+ image_url: string;
11
+ }
12
+
13
+ /** A single prize the user won within the raffle. */
14
+ export interface RaffleWonPrize {
15
+ /** Unique ID of the winning row (pass to `claimRafflePrize` when `requires_claim` is `true`). */
16
+ raf_won_id: number;
17
+ /** ID of the prize definition. */
18
+ prize_id: number;
19
+ /** Run-instance ID of the draw that awarded this prize. */
20
+ raffle_run_id: number;
21
+ /** Schedule ID of the draw that awarded this prize. */
22
+ draw_id: number;
23
+ /** Presentation meta (name / image). */
24
+ public_meta: RaffleWonPrizePublicMeta;
25
+ /** Whether this prize requires a claim action from the user. */
26
+ requires_claim: boolean;
27
+ /** Epoch ms when the prize was claimed; `null` when not yet claimed. */
28
+ claimed_date: number | null;
29
+ }
30
+
31
+ /** The user the won-prizes list belongs to. */
32
+ export interface RaffleWonPrizeUser {
33
+ /** Internal user ID. */
34
+ user_id: number;
35
+ /** Avatar image: a full URL for a system avatar, otherwise an avatar token to resolve against the widget's avatar domain. */
36
+ avatar_id: string;
37
+ /** Numeric ID of the user's selected avatar definition. */
38
+ avatar_real_id: number;
39
+ /** Public username; server-masked for other users (e.g. `"32:r*****"`). */
40
+ public_username?: string;
41
+ /** Always `null` on the wire — use `avatar_id`. */
42
+ avatar_url?: string | null;
43
+ }
44
+
45
+ export interface GetRaffleWonPrizesResponse extends ProtocolResponse {
46
+ /** The user the won prizes belong to; `null` when `won_prizes` is empty. */
47
+ user: RaffleWonPrizeUser | null;
48
+ /** Page of won prizes for the requested raffle, newest-first. */
49
+ won_prizes: RaffleWonPrize[];
50
+ /** Total number of won prizes for this user/raffle across all draws (for pagination). */
51
+ total: number;
52
+ /** Zero-based offset of this page (echoes the resolved request). */
53
+ offset: number;
54
+ /** Page size (echoes the resolved request). */
55
+ limit: number;
56
+ }
@@ -14,4 +14,6 @@ export * from './RaffleClaimPrizeRequest';
14
14
  export * from './RaffleClaimPrizeResponse';
15
15
  export * from './RaffleDrawPublicMeta';
16
16
  export * from './RaffleOptinRequest';
17
- export * from './RaffleOptinResponse';
17
+ export * from './RaffleOptinResponse';
18
+ export * from './GetRaffleWonPrizesRequest';
19
+ export * from './GetRaffleWonPrizesResponse';
@@ -139,7 +139,7 @@ import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
139
139
  import { GetActivityLogRequest, GetActivityLogResponse, ActivityLogTransform } from './ActivityLog';
140
140
  import { GetClanListRequest, GetClanListResponse, GetClanInfoRequest, GetClanInfoResponse, JoinClanRequest, JoinClanResponse } from './Clans';
141
141
  import { InboxCategories } from './Inbox/InboxCategories';
142
- import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse, drawRunTransform } from './Raffle';
142
+ import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse, RaffleOptinRequest, RaffleOptinResponse, drawRunTransform, GetRaffleWonPrizesRequest, GetRaffleWonPrizesResponse } from './Raffle';
143
143
  import { GetAvatarsListResponse, avatarDefinitionTransform } from './Avatars/GetAvatarsListResponse';
144
144
  import { GetAvatarsCustomizedResponse, avatarCustomizedTransform } from './Avatars/GetAvatarsCustomizedResponse';
145
145
  import { GetAvatarPromptsResponse, avatarPromptTransform } from './Avatars/GetAvatarPromptsResponse';
@@ -1641,6 +1641,19 @@ class SmarticoAPI {
1641
1641
 
1642
1642
  }
1643
1643
 
1644
+ public async getRaffleWonPrizes(
1645
+ user_ext_id: string,
1646
+ props: { raffle_id: number; offset: number; limit: number },
1647
+ ): Promise<GetRaffleWonPrizesResponse> {
1648
+ const message = this.buildMessage<GetRaffleWonPrizesRequest, GetRaffleWonPrizesResponse>(
1649
+ user_ext_id,
1650
+ ClassId.RAF_GET_WON_PRIZES_REQUEST,
1651
+ props,
1652
+ );
1653
+
1654
+ return await this.send<GetRaffleWonPrizesResponse>(message, ClassId.RAF_GET_WON_PRIZES_RESPONSE);
1655
+ }
1656
+
1644
1657
  public async getActivityLog(
1645
1658
  user_ext_id: string,
1646
1659
  startTimeSeconds: number,
@@ -2127,10 +2127,12 @@ declare enum EWidgetType {
2127
2127
  }
2128
2128
  declare enum EXTERNAL_CALLBACK_KEY {
2129
2129
  INIT = 'init',
2130
+ LABEL_INIT_COMPLETED = 'label_init_completed',
2130
2131
  IDENTIFY = 'identify',
2131
2132
  LOGIN = 'login',
2132
2133
  LOGOUT = 'logout',
2133
2134
  USER_PROPS_CHANGE = 'props_change',
2135
+ PAGE_NAVIGATION = 'page_navigation',
2134
2136
  SESSION_BASED_DP_DETECTED = 'session_based_dp_detected',
2135
2137
  GF_CLOSING = 'gf_closing',
2136
2138
  GF_STARTING = 'gf_starting',
@@ -2140,6 +2142,8 @@ declare enum EXTERNAL_CALLBACK_KEY {
2140
2142
  PROTOCOL_ERROR = 'protocol_error',
2141
2143
  MNIGAME_WIN = 'mini_game_win',
2142
2144
  ACH_GAME_OPENING = 'ach_game_opening',
2145
+ JACKPOT_WIN = 'jackpot_win',
2146
+ GF_UX = 'gf_ux',
2143
2147
  }
2144
2148
  declare enum DpType {
2145
2149
  AskPushPermissions = 'ask_push_permissions',