@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,92 @@
1
+ # getUserLevelExtraCounters — API (UserLevelExtraCountersT)
2
+
3
+ > Returns the user's current values for the two label-defined "extra counters" used by sliding-window leveling logic.
4
+ > Import: `import { UserLevelExtraCountersT } from '@smartico/public-api'`
5
+ > Search terms: getUserLevelExtraCounters, user, UserLevelExtraCountersT, level_counter_1, level_counter_2
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getUserLevelExtraCounters(): Promise<UserLevelExtraCountersT>
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `Promise<UserLevelExtraCountersT>`
16
+ `UserLevelExtraCountersT`:
17
+ - `level_counter_1` (number) — Current value of the user's first level counter. Operator-defined semantics per label. `undefined` on points-only labels.
18
+ - `level_counter_2` (number) — Current value of the user's second level counter. Operator-defined semantics per label. `undefined` on points-only labels.
19
+
20
+ ## Behavioral contract
21
+ **When this matters**
22
+ Only labels configured for sliding-window leveling populate the
23
+ counter fields. On the default points-only leveling model, both
24
+ `level_counter_1` and `level_counter_2` are `undefined`. Detect
25
+ a points-only label by either counter being `undefined`.
26
+
27
+ **Counter semantics — operator-defined**
28
+ The SDK exposes raw numeric values; the meaning of each counter
29
+ (deposit amount, wager amount, lifetime spend, etc.) is fully
30
+ operator-defined per label. Resolve labels for display via
31
+ `getTranslations` — the operator's display strings are
32
+ stored under the translation keys `levelsCounter1Name` and
33
+ `levelsCounter2Name`.
34
+
35
+ **Refresh cadence**
36
+ Sliding-window counters are recomputed by a periodic server-side
37
+ job. Its rebuild cadence is operator-configured per brand —
38
+ commonly daily, though it can be set more frequent — so level
39
+ transitions driven by counter changes surface with a latency tied
40
+ to that rebuild schedule after the underlying activity (e.g. a
41
+ deposit), not in real time.
42
+
43
+ **Idempotency**: safe. Read-only. Repeated calls within the cache
44
+ window return a deep-cloned cached value without a network
45
+ round-trip.
46
+
47
+ **Side effects**: none — pure read.
48
+
49
+ **Visitor mode**: not supported.
50
+
51
+ ## Example
52
+ ```ts
53
+ const [counters, levels, profile] = await Promise.all([
54
+ window._smartico.api.getUserLevelExtraCounters(),
55
+ window._smartico.api.getLevels(),
56
+ Promise.resolve(window._smartico.api.getUserProfile()),
57
+ ]);
58
+
59
+ // Quick detection: undefined means this label doesn't use sliding-window leveling.
60
+ if (counters.level_counter_1 === undefined) {
61
+ console.log('[smartico] points-only label — skip counter UI; show points progress only');
62
+ return;
63
+ }
64
+
65
+ // Find the next level and render a 3-bar progress block.
66
+ const currentIdx = levels.findIndex(l => l.id === profile.ach_level_current_id);
67
+ const next = levels[currentIdx + 1];
68
+ if (next) {
69
+ console.log('[smartico] render points bar:', profile.ach_points_ever, '/', next.required_points);
70
+ if (next.required_level_counter_1) {
71
+ console.log('[smartico] render counter 1 bar:', counters.level_counter_1, '/', next.required_level_counter_1);
72
+ }
73
+ if (next.required_level_counter_2) {
74
+ console.log('[smartico] render counter 2 bar:', counters.level_counter_2, '/', next.required_level_counter_2);
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Example response (REAL shape)
80
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
81
+ ```json
82
+ {
83
+ "level_counter_1": null,
84
+ "level_counter_2": null
85
+ }
86
+ ```
87
+
88
+ ## Errors
89
+ See this method's TSDoc / the mutation pages for `err_code` handling.
90
+
91
+ ## Related
92
+ - `getLevels`
@@ -0,0 +1,184 @@
1
+ # getUserProfile — API (TUserProfile)
2
+
3
+ > Returns the current user's public profile — the source of truth for balances (points / gems / diamonds), the current level ID, the display username + avatar, language, public tags, and the inbox unread count.
4
+ > Import: `import { TUserProfile } from '@smartico/public-api'`
5
+ > Search terms: getUserProfile, user, getPublicProps, getProfile, balance, points, TUserProfile, core_public_tags, ach_points_ever, core_clan_is_kicked, user_last_session_push_state, aff_referred_by_friend_ext_user_id, core_inbox_unread_count, core_user_language, ach_level_current
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.getUserProfile(): TUserProfile
10
+ ```
11
+
12
+ ## Parameters
13
+ _None._
14
+
15
+ ## Returns — `TUserProfile`
16
+ `TUserProfile`:
17
+ - `core_user_language` (string) — Language code stored server-side for the user (e.g. `"en"`, `"de"`).
18
+ - `ach_points_balance` (number) — Current spendable points balance — decremented by store purchases, tournament buy-ins, and clan entry fees.
19
+ - `ach_points_ever` (number) — All-time cumulative points earned. Monotonic — NOT decremented by store purchases or clan/tournament fees.
20
+ - `ach_gems_balance` (number) — Current gems balance (secondary currency).
21
+ - `ach_diamonds_balance` (number) — Current diamonds balance (tertiary currency).
22
+ - `core_public_tags` (string[]) — Server-stored public tags on the user (uppercase strings). Modify via `_smartico.updatePublicTags(operation, tags)`.
23
+ - `ach_level_current_id` (number) — FK into the level ladder; resolve via `getCurrentLevel()` or `getLevels()`.
24
+ - `core_is_test_account` (boolean) — `true` when the user is flagged as a test account.
25
+ - `avatar_url` (string) — Resolved CDN URL for the user's avatar.
26
+ - `public_username` (string) — Display username (operator-defined alias).
27
+ - `core_inbox_unread_count` (number) — Unread inbox messages count. Push-updated in real time.
28
+ - `core_recommended_deposit_amount` (number) — AI-recommended deposit amount for this user. Undefined when no recommendation is currently available.
29
+ - `core_recommended_casino_bet_amount` (number) — AI-recommended casino bet amount for this user. Undefined when no recommendation is currently available.
30
+ - `ach_level_current` (string) — Display name of the user's current level (e.g. `"Silver"`); resolve the id via `getCurrentLevel()`.
31
+ - `ach_gamification_in_control_group` (boolean) — `true` when the user is in the gamification A/B control group (gamification UI suppressed).
32
+ - `user_id` (number) — Smartico-internal numeric user id.
33
+ - `user_country` (string) — ISO country code of the user (e.g. `"BG"`).
34
+ - `core_wallet_currency` (string) — Wallet currency code (e.g. `"EUR"`).
35
+ - `core_registration_date` (number) — Registration timestamp (epoch ms); `0` when unknown.
36
+ - `user_last_session_push_state` (string) — Last-session browser push-permission state (e.g. `"BLOCKED"`, `"GRANTED"`).
37
+ - `acc_bonus_abuser` (boolean) — `true` when the account is flagged as a bonus abuser.
38
+ - `avatar_id` (string) — Selected avatar id (catalogue avatar or AI-variant base).
39
+ - `avatar_real_id` (number) — `avatar_real_id` of the selected avatar; `0` when none.
40
+ - `core_avatar_real_id` (number | null) — `avatar_real_id` of the user's core avatar; null when unset.
41
+ - `core_clan_id` (string) — Current clan id (string); empty/null when not in a clan.
42
+ - `core_clan_is_kicked` (boolean | null) — `true` when the user was kicked from their clan; null when not applicable.
43
+ - `core_clan_kicked_out_id` (number | null) — Id of the clan the user was kicked from; null when not applicable.
44
+ - `aff_referred_by_friend_ext_user_id` (string | null) — ext_user_id of the friend who referred this user; null when none.
45
+ - `aff_refer_friend_url` (string | null) — Refer-a-friend share URL; null when the feature is disabled.
46
+ - `aff_refered_friends_count` (number) — Count of friends this user has referred.
47
+
48
+ ## Behavioral contract
49
+ **Preconditions**
50
+ The tracker must be initialised — calling this before the identify
51
+ round-trip completes throws (`"Tracker is not initialized, cannot
52
+ getUserProfile"`). Safe ways to wait for readiness:
53
+ - register `_smartico.on('identify', (errCode, props) => ...)` —
54
+ fires once after a successful identify with the full props
55
+ - register `_smartico.on('props_change', () => ...)` — fires first
56
+ at identify with the full snapshot, then on every push update
57
+
58
+ **What's kept live (push-updated)**
59
+ Balance fields (`ach_points_balance`, `ach_gems_balance`,
60
+ `ach_diamonds_balance`, `ach_points_ever`), `ach_level_current_id`,
61
+ `core_public_tags`, `core_inbox_unread_count`, `core_user_language`,
62
+ `avatar_url`, `public_username`, and the AI-driven recommended-amount
63
+ fields all flow over the SDK's user-properties update channel as
64
+ partial updates — the snapshot is patched in place when any of them
65
+ change server-side. Re-call `getUserProfile()` (or watch
66
+ `props_change`) to observe new values.
67
+
68
+ **Reading state from the returned profile**
69
+ Balances (`ach_points_balance`, `ach_gems_balance`,
70
+ `ach_diamonds_balance`) are the canonical source for affordability
71
+ checks across the SDK — compare against `entry_fee_amount` (clans),
72
+ `registration_cost_points` / `_gems` / `_diamonds` (tournaments), and
73
+ `price` / `discounted_price` + `purchase_type` (store items).
74
+ `ach_points_ever` is monotonic — store purchases deduct from
75
+ `ach_points_balance` but NEVER from `ach_points_ever`, so it remains
76
+ useful for level-progress math (`required_points` on the next
77
+ `getLevels` entry minus `ach_points_ever`). `ach_level_current_id`
78
+ is the FK into the level ladder — resolve metadata via
79
+ `getCurrentLevel` (richer, includes progress %) or
80
+ `getLevels` (full ladder lookup table).
81
+
82
+ **Inbox unread count** — `core_inbox_unread_count` on this profile
83
+ is push-updated in real time (under 1 second). For an inbox badge,
84
+ prefer this field over `getInboxUnreadCount` (which is cached
85
+ for 30 s) — same value, fresher signal.
86
+
87
+ **Language**: `core_user_language` reflects the server's stored
88
+ language. If the consumer just called `_smartico.changeLanguage(...)`,
89
+ the field may briefly lag the local intent until the server push
90
+ arrives. Use `_smartico.getPublicProps()` for the
91
+ client-fallback-applied version if instant accuracy matters.
92
+
93
+ **Idempotency / Side effects**: trivially safe — no network call,
94
+ no state mutation.
95
+
96
+ **UI guidance**: see [UI Guide — `getUserProfile`](../../docs/ui/user/UIGuide_getUserProfile.md).
97
+
98
+ **Visitor mode**: not supported — throws. Visitor sessions do not
99
+ have a public-profile snapshot.
100
+
101
+ ## Example
102
+ ```ts
103
+ // Wait for identify before calling.
104
+ window._smartico.on('identify', (errCode) => {
105
+ if (errCode !== 0) return;
106
+ const profile = window._smartico.api.getUserProfile();
107
+ console.log('[smartico] initial profile loaded — render the user widget:', profile);
108
+ });
109
+
110
+ // Stay in sync with live updates.
111
+ window._smartico.on('props_change', (changed) => {
112
+ // `changed` is the partial keys for this push (full snapshot at identify).
113
+ const profile = window._smartico.api.getUserProfile();
114
+ console.log('[smartico] profile updated — re-render any widgets bound to:', Object.keys(changed),
115
+ '— balances now:', profile.ach_points_balance, profile.ach_gems_balance, profile.ach_diamonds_balance);
116
+
117
+ // React to specific fields.
118
+ if ('ach_level_current_id' in changed) {
119
+ console.log('[smartico] level changed — call getCurrentLevel() for richer detail, animate the level badge');
120
+ }
121
+ if ('core_inbox_unread_count' in changed) {
122
+ console.log('[smartico] inbox unread count changed — update the badge to:', profile.core_inbox_unread_count);
123
+ }
124
+ });
125
+
126
+ // Affordability gating example — used inside a clan / tournament / store CTA handler.
127
+ const profile = window._smartico.api.getUserProfile();
128
+ const item = await window._smartico.api.getStoreItems().then(items => items[0]);
129
+ const price = item.discounted_price ?? item.price;
130
+ const balance = {
131
+ points: profile.ach_points_balance,
132
+ gems: profile.ach_gems_balance,
133
+ diamonds: profile.ach_diamonds_balance,
134
+ }[item.purchase_type];
135
+ if (balance < price) {
136
+ console.log('[smartico] insufficient', item.purchase_type, '— disable Buy and show deficit', price - balance);
137
+ }
138
+ ```
139
+
140
+ ### Example response (REAL shape)
141
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
142
+ ```json
143
+ {
144
+ "core_public_tags": [
145
+ "SMARTICO.DEV"
146
+ ],
147
+ "ach_points_ever": 690,
148
+ "core_clan_is_kicked": null,
149
+ "user_last_session_push_state": "BLOCKED",
150
+ "aff_referred_by_friend_ext_user_id": null,
151
+ "core_inbox_unread_count": 0,
152
+ "core_user_language": "EN",
153
+ "ach_level_current": "Silver",
154
+ "ach_gems_balance": 10,
155
+ "ach_level_current_id": 698,
156
+ "user_country": "BG",
157
+ "ach_points_balance": 326,
158
+ "core_registration_date": 0,
159
+ "core_recommended_deposit_amount": 0,
160
+ "core_recommended_casino_bet_amount": 0,
161
+ "ach_gamification_in_control_group": false,
162
+ "core_avatar_real_id": null,
163
+ "core_wallet_currency": "UNKNOWN",
164
+ "ach_diamonds_balance": 1,
165
+ "aff_refer_friend_url": null,
166
+ "acc_bonus_abuser": false,
167
+ "aff_refered_friends_count": 0,
168
+ "core_clan_kicked_out_id": null,
169
+ "core_clan_id": "",
170
+ "core_is_test_account": false,
171
+ "user_id": 361368543,
172
+ "avatar_id": "https://cdn.example/avatars/12/00000000-0000-0000-0000-000000000000.png",
173
+ "avatar_real_id": 12,
174
+ "public_username": "Antonio",
175
+ "avatar_url": "https://cdn.example/avatars/12/00000000-0000-0000-0000-000000000000.png"
176
+ }
177
+ ```
178
+
179
+ ## Errors
180
+ See this method's TSDoc / the mutation pages for `err_code` handling.
181
+
182
+ ## Related
183
+ - `getLevels`
184
+ - `getCurrentLevel`
@@ -0,0 +1,173 @@
1
+ # jackpotGet — API (JackpotDetails)
2
+
3
+ > Returns the user-eligible jackpots active for the label, fused with their live pot values.
4
+ > Import: `import { JackpotDetails } from '@smartico/public-api'`
5
+ > Search terms: jackpotGet, jackpots, JackpotDetails, JackpotType, JackpotPublicMeta, JackpotHtmlTemplate, JackpotContributionType, JackpotPot, JackPotTemparature, jp_template_id, jp_type_id, jp_public_meta, jp_currency, user_currency, related_games, contribution_type, contribution_value
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.jackpotGet(filter?: { related_game_id?: string; jp_template_id?: number }): Promise<JackpotDetails[]>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `filter` — Optional filter narrowing the result set.
14
+ - `filter.related_game_id` — Limit to jackpots linked to this game ID (from the operator's games catalog).
15
+ - `filter.jp_template_id` — Limit to a single template.
16
+
17
+ ## Returns — `Promise<JackpotDetails[]>`
18
+ Array of `JackpotDetails`. Each item:
19
+ - `jp_template_id` (number) — Stable numeric ID of the template; pass to opt-in / opt-out / winners / eligible-games methods.
20
+ - `jp_type_id` (JackpotType) — Whether the jackpot has a shared pot or one independent per user; see `JackpotType`.
21
+ - `jp_public_meta` (JackpotPublicMeta) — Display data: name, description, image_url, winner / not-winner HTML templates, custom_data (JSON-parsed).
22
+ - `name` (string) — name of the jackpot
23
+ - `description` (string) — description/rules of the jackpot
24
+ - `image_url` (string) — image url of the jackpot
25
+ - `winner_template` (JackpotHtmlTemplate) — HTML template for the winner of the jackpt
26
+ - `id` (string)
27
+ - `content` (string)
28
+ - `not_winner_template` (JackpotHtmlTemplate) — HTML template for the not winner of the jackpot
29
+ - `id` (string)
30
+ - `content` (string)
31
+ - `placeholder1` (string) — custom value of placeholder1 defined by operator and can be used in the HTML templates
32
+ - `placeholder2` (string) — custom value of placeholder2 defined by operator and can be used in the HTML templates
33
+ - `custom_data` (string) — Custom data as string or JSON string that can be used in API to build custom UI You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice Read more here - <https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes>
34
+ - `jp_currency` (string) — Native jackpot currency (ISO 4217). Used for winner-history amounts.
35
+ - `user_currency` (string) — Current user's wallet currency. Used to display the pot via `pot.current_pot_amount_user_currency`.
36
+ - `contribution_type` (JackpotContributionType) — Whether the contribution is a fixed amount or a percentage of the bet; see `JackpotContributionType`.
37
+ - `contribution_value` (number) — Amount of contribution per qualifying bet — fixed value or percentage depending on `contribution_type`.
38
+ - `pot` (JackpotPot) — Live pot snapshot (amount, temperature, last explosion timestamp).
39
+ - `jp_template_id` (number) — Template ID this pot belongs to.
40
+ - `jp_pot_id` (number) — Stable numeric ID of the current pot instance (rotates when the pot explodes).
41
+ - `current_pot_amount` (number) — Current pot amount in the jackpot's native currency (`jp_currency`).
42
+ - `current_pot_amount_user_currency` (number) — Current pot amount converted to the user's wallet currency (`user_currency`).
43
+ - `explode_date_ts` (number) — Unix ms timestamp of when this pot last exploded; `0` if it has never exploded.
44
+ - `current_pot_temperature` (JackPotTemparature) — Heat band of the pot relative to its explosion range; see `JackPotTemparature`.
45
+ - `is_opted_in` (boolean) — `true` when the current user is currently opted in.
46
+ - `ach_related_game_allow_all` (boolean) — `true` when every game in the operator catalog contributes; if `true`, skip `getJackpotEligibleGames`.
47
+ - `registration_count` (number) — Number of users currently opted in; always `1` for `JackpotType.Personal`.
48
+ - `expose_winners_over_api` (boolean) — Operator flag: whether the winners list should be displayed. Enforced client-side only — gate `getJackpotWinners` calls on this.
49
+
50
+ ## Behavioral contract
51
+ **Preconditions**
52
+ - No prerequisite calls.
53
+ - Visitor mode supported via `_smartico.vapi(lang).jackpotGet(...)`.
54
+
55
+ **Server-side eligibility filtering**
56
+ Jackpots are filtered server-side by the user's segments before being
57
+ returned. Templates the user is ineligible for never appear in this
58
+ response — there is no "locked" state to render. An empty result for a
59
+ known-good user typically means none of the configured templates match
60
+ the user's segments / level / brand.
61
+
62
+ **Filter behavior**
63
+ Passing `related_game_id` returns only jackpots linked to that game (from
64
+ the operator's games catalog). Passing `jp_template_id` returns just that
65
+ single template. With no filter, all active templates the user is
66
+ eligible for are returned. Changing the filter between calls flushes both
67
+ the template cache and the pot cache.
68
+
69
+ **Two-tier cache**
70
+ - Template definitions: 30 s cache. Re-fetched on filter change or when
71
+ opt-in / opt-out / a jackpot-win push lands.
72
+ - Pot values: 1 s cache. Re-fetched on every call past the 1-second
73
+ window so a 1 Hz poll renders a smoothly counting pot.
74
+
75
+ **`jp_public_meta.custom_data`**
76
+ Server returns this as a JSON-encoded string; the SDK parses it inline so
77
+ consumers always receive either a parsed object or the raw string.
78
+
79
+ **Personal vs MultiUser jackpots** (see `JackpotType`)
80
+ - `MultiUser` (1) — shared pot; `registration_count` reflects real opted-in
81
+ user count; temperature transitions fire push events.
82
+ - `Personal` (2) — independent per-user pot; `registration_count` is
83
+ always 1; temperature push events are suppressed.
84
+
85
+ **Refresh**
86
+ - `jp_status_id`, segment changes, and operator template edits surface
87
+ after the 30 s template cache TTL.
88
+ - Opt-in / opt-out / jackpot-win push events all clear the template and
89
+ pot caches — the next call re-fetches.
90
+
91
+ **Visitor mode**: supported.
92
+
93
+ **UI guidance**: see [UI Guide — `jackpotGet`](../../docs/ui/jackpots/UIGuide_jackpotGet.md).
94
+
95
+ ## Example
96
+ ```ts
97
+ // Poll every second for live pot counter
98
+ setInterval(async () => {
99
+ const jackpots = await window._smartico.api.jackpotGet();
100
+ for (const jp of jackpots) {
101
+ console.log('[smartico] update pot widget for', jp.jp_public_meta.name, '— amount:', jp.pot.current_pot_amount_user_currency, jp.user_currency, '— temperature:', jp.pot.current_pot_temperature);
102
+ }
103
+ }, 1000);
104
+
105
+ // Filtered fetch for a specific game tile
106
+ const linked = await window._smartico.api.jackpotGet({ related_game_id: 'gold-slot2' });
107
+ console.log('[smartico] linked jackpots for game:', linked.length);
108
+ ```
109
+
110
+ ### Example response (REAL shape)
111
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
112
+ ```json
113
+ [
114
+ {
115
+ "jp_template_id": 6,
116
+ "jp_type_id": 1,
117
+ "jp_public_meta": {
118
+ "image_url": "https://cdn.example/f8b68a18473c437e32a860-Jackpot1.jpg",
119
+ "placeholder1": null,
120
+ "placeholder2": null,
121
+ "name": "Minor",
122
+ "description": "1% on top of your bet amount will be contributed to the Jackpot",
123
+ "not_winner_template": {
124
+ "id": "0",
125
+ "content": ""
126
+ },
127
+ "priority": "1",
128
+ "winner_template": {
129
+ "id": "0",
130
+ "content": ""
131
+ },
132
+ "custom_data": {}
133
+ },
134
+ "jp_currency": "EUR",
135
+ "user_currency": "EUR",
136
+ "related_games": [],
137
+ "contribution_type": 2,
138
+ "contribution_value": 0.2,
139
+ "pot": {
140
+ "jp_template_id": 6,
141
+ "jp_pot_id": 306140,
142
+ "user_id": null,
143
+ "current_pot_amount": 12.28367028,
144
+ "current_pot_amount_user_currency": 12.28367028,
145
+ "explode_date_ts": null,
146
+ "current_pot_temperature": 2
147
+ },
148
+ "is_opted_in": false,
149
+ "is_auto_opt_in": true,
150
+ "ach_related_game_allow_all": true,
151
+ "registration_count": 17262,
152
+ "contribution_rules": [
153
+ {
154
+ "ruleId": 1,
155
+ "jpTemplateId": 6,
156
+ "type": 2,
157
+ "extEntityIds": [
158
+ "1111"
159
+ ],
160
+ "contributionValue": 4
161
+ }
162
+ ],
163
+ "expose_winners_over_api": false
164
+ }
165
+ ]
166
+ ```
167
+
168
+ ## Errors
169
+ See this method's TSDoc / the mutation pages for `err_code` handling.
170
+
171
+ ## Related
172
+ - `JackpotType`
173
+ - `JackpotDetails`
@@ -0,0 +1,94 @@
1
+ # jackpotOptIn — API (JackpotsOptinResponse)
2
+
3
+ > Opts the authenticated user into a jackpot.
4
+ > Import: `import { JackpotsOptinResponse } from '@smartico/public-api'`
5
+ > Search terms: jackpotOptIn, jackpots, JackpotsOptinResponse, errCode, errMsg, cid, ts, uuid, payload, duration
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.jackpotOptIn(filter: { jp_template_id: number }): Promise<JackpotsOptinResponse>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `filter.jp_template_id` — ID of the jackpot template to join.
14
+
15
+ ## Returns — `Promise<JackpotsOptinResponse>`
16
+ `JackpotsOptinResponse`:
17
+ - `cid` (number)
18
+ - `ts` (number)
19
+ - `uuid` (string)
20
+ - `errCode` (number)
21
+ - `errMsg` (string)
22
+
23
+ ## Behavioral contract
24
+ **Preconditions**
25
+ - User must be authenticated. Visitor mode not supported.
26
+ - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
27
+ - The jackpot must currently be active and the user must be in its
28
+ eligibility segment. Ineligible jackpots are filtered out of
29
+ `jackpotGet` entirely, so a card the user sees is opt-in-able.
30
+
31
+ **Error handling**
32
+ The server returns a non-zero `errCode` with a human-readable `errMsg`
33
+ for any failure. Common causes:
34
+ - User is in a control group.
35
+ - Jackpot template is not active (status changed since the user opened
36
+ the card).
37
+ - User is already opted in (the SDK has no client-side guard against a
38
+ double-tap; the server enforces).
39
+ - DB race / generic server error.
40
+
41
+ The SDK does NOT enumerate distinct numeric codes for each cause — branch
42
+ on `errCode === 0` for success and surface `errMsg` as-is for failures.
43
+
44
+ **Idempotency / re-opt-in semantics**
45
+ - **Already opted in** → returns non-zero `errCode` ("User already opted in").
46
+ - **Previously opted in then opted out** → succeeds silently; the server
47
+ re-activates the registration. This is not an error path — a user can
48
+ freely cycle opt-in / opt-out.
49
+
50
+ **Refresh after success**
51
+ - The SDK clears the template, pot, and winners caches.
52
+ - The next `jackpotGet` call returns `is_opted_in: true` for this
53
+ template.
54
+
55
+ **Side effects**
56
+ Fires a `JACKPOT_OPT_IN` engagement event (visible to operator-side
57
+ automation rules). Does NOT immediately move points / gems — contributions
58
+ happen per-bet via the user's gameplay, not on opt-in.
59
+
60
+ **Visitor mode**: not supported.
61
+
62
+ **UI guidance**: see [UI Guide — `jackpotOptIn`](../../docs/ui/jackpots/UIGuide_jackpotOptIn.md).
63
+
64
+ ## Example
65
+ ```ts
66
+ const r = await window._smartico.api.jackpotOptIn({ jp_template_id: 42 });
67
+
68
+ if (r.errCode === 0) {
69
+ console.log('[smartico] opted in — refresh jackpot card to show opt-out CTA');
70
+ } else {
71
+ console.error('[smartico] opt-in failed — show this message in an error toast:', r.errMsg);
72
+ }
73
+ ```
74
+
75
+ ### Example response (REAL shape)
76
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
77
+ ```json
78
+ {
79
+ "errCode": 1,
80
+ "errMsg": "JP User already opted in to Jackpot",
81
+ "cid": 805,
82
+ "ts": 1782287009179,
83
+ "uuid": "00000000-0000-0000-0000-000000000000",
84
+ "payload": null,
85
+ "duration": null
86
+ }
87
+ ```
88
+
89
+ ## Errors
90
+ See this method's TSDoc / the mutation pages for `err_code` handling.
91
+
92
+ ## Related
93
+ - `jackpotGet`
94
+ - `JackpotsOptinResponse`
@@ -0,0 +1,92 @@
1
+ # jackpotOptOut — API (JackpotsOptoutResponse)
2
+
3
+ > Opts the authenticated user out of a jackpot.
4
+ > Import: `import { JackpotsOptoutResponse } from '@smartico/public-api'`
5
+ > Search terms: jackpotOptOut, jackpots, JackpotsOptoutResponse, errCode, errMsg, cid, ts, uuid, payload, duration
6
+
7
+ ## Signature
8
+ ```ts
9
+ _smartico.api.jackpotOptOut(filter: { jp_template_id: number }): Promise<JackpotsOptoutResponse>
10
+ ```
11
+
12
+ ## Parameters
13
+ - `filter.jp_template_id` — ID of the jackpot template to leave.
14
+
15
+ ## Returns — `Promise<JackpotsOptoutResponse>`
16
+ `JackpotsOptoutResponse`:
17
+ - `cid` (number)
18
+ - `ts` (number)
19
+ - `uuid` (string)
20
+ - `errCode` (number)
21
+ - `errMsg` (string)
22
+
23
+ ## Behavioral contract
24
+ **Preconditions**
25
+ - User must be authenticated. Visitor mode not supported.
26
+ - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
27
+
28
+ **Error handling**
29
+ The server returns a non-zero `errCode` with a human-readable `errMsg` for
30
+ any failure. Common causes:
31
+ - User has never opted in OR is already opted out — server returns
32
+ non-zero `errCode` for the "already opted out" case. Calling opt-out
33
+ on a jackpot the user has never registered for typically returns
34
+ success (the server finds no registration row to update).
35
+ - DB race / generic server error.
36
+
37
+ Unlike `jackpotOptIn`, opt-out does NOT check the template's status
38
+ — the user can opt out of a jackpot that has been deactivated by the
39
+ operator.
40
+
41
+ **Idempotency**
42
+ - First opt-out → success.
43
+ - Second opt-out → non-zero `errCode` ("Already opted out").
44
+ - Opt-out of a never-joined jackpot → typically succeeds silently
45
+ (no registration row to act on).
46
+
47
+ **Refresh after success**
48
+ - The SDK clears the template, pot, and winners caches.
49
+ - The next `jackpotGet` call returns `is_opted_in: false` for this
50
+ template and a decremented `registration_count`.
51
+
52
+ **Side effects**
53
+ Fires a `JACKPOT_OPT_OUT` engagement event for operator-side automation
54
+ rules. The user's existing contributions to the current pot remain in
55
+ place — opt-out stops future contributions but does not refund past ones.
56
+
57
+ **Visitor mode**: not supported.
58
+
59
+ **UI guidance**: see [UI Guide — `jackpotOptOut`](../../docs/ui/jackpots/UIGuide_jackpotOptOut.md).
60
+
61
+ ## Example
62
+ ```ts
63
+ const r = await window._smartico.api.jackpotOptOut({ jp_template_id: 42 });
64
+
65
+ if (r.errCode === 0) {
66
+ console.log('[smartico] opted out — refresh jackpot card to show join CTA');
67
+ } else {
68
+ console.error('[smartico] opt-out failed — show this message in an error toast:', r.errMsg);
69
+ }
70
+ ```
71
+
72
+ ### Example response (REAL shape)
73
+ > Where this real payload differs from the typed Returns above (TS interface vs raw wire), the REAL shape is the runtime truth.
74
+ ```json
75
+ {
76
+ "errCode": 0,
77
+ "errMsg": "",
78
+ "cid": 807,
79
+ "ts": 1782229816688,
80
+ "uuid": "00000000-0000-0000-0000-000000000000",
81
+ "payload": null,
82
+ "duration": null
83
+ }
84
+ ```
85
+
86
+ ## Errors
87
+ See this method's TSDoc / the mutation pages for `err_code` handling.
88
+
89
+ ## Related
90
+ - `jackpotOptIn`
91
+ - `jackpotGet`
92
+ - `JackpotsOptoutResponse`