@smartico/public-api 0.0.380 → 0.0.382

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 (178) 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/MiniGames/SAWGameType.d.ts +3 -1
  7. package/dist/MiniGames/SAWTemplateUI.d.ts +7 -0
  8. package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
  9. package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
  10. package/dist/Raffle/index.d.ts +2 -0
  11. package/dist/SmarticoAPI.d.ts +6 -1
  12. package/dist/SmarticoLib/index.d.ts +5 -1
  13. package/dist/WSAPI/WSAPIAvatars.d.ts +267 -49
  14. package/dist/WSAPI/WSAPIBonuses.d.ts +224 -10
  15. package/dist/WSAPI/WSAPIGamePick.d.ts +538 -253
  16. package/dist/WSAPI/WSAPIGeneral.d.ts +156 -14
  17. package/dist/WSAPI/WSAPIInbox.d.ts +547 -58
  18. package/dist/WSAPI/WSAPIJackpots.d.ts +292 -57
  19. package/dist/WSAPI/WSAPILeaderBoard.d.ts +127 -13
  20. package/dist/WSAPI/WSAPIMiniGames.d.ts +465 -49
  21. package/dist/WSAPI/WSAPIRaffles.d.ts +576 -52
  22. package/dist/WSAPI/WSAPITournaments.d.ts +3 -3
  23. package/dist/WSAPI/WSAPITypes.d.ts +243 -132
  24. package/dist/WSAPI/WSAPIUser.d.ts +193 -43
  25. package/dist/index.js +3412 -616
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.modern.mjs +3395 -609
  28. package/dist/index.modern.mjs.map +1 -1
  29. package/docs/Callbacks.md +162 -0
  30. package/docs/SmarticoObject.md +445 -0
  31. package/docs/Transforms.md +99 -0
  32. package/docs/api/README.md +26 -0
  33. package/docs/api/classes/WSAPIAvatars.md +282 -54
  34. package/docs/api/classes/WSAPIBonuses.md +233 -12
  35. package/docs/api/classes/WSAPIClans.md +380 -10
  36. package/docs/api/classes/WSAPIGamePick.md +555 -26
  37. package/docs/api/classes/WSAPIGeneral.md +165 -16
  38. package/docs/api/classes/WSAPIInbox.md +588 -64
  39. package/docs/api/classes/WSAPIJackpots.md +320 -66
  40. package/docs/api/classes/WSAPILeaderBoard.md +133 -15
  41. package/docs/api/classes/WSAPIMiniGames.md +501 -64
  42. package/docs/api/classes/WSAPIMissions.md +58 -79
  43. package/docs/api/classes/WSAPIRaffles.md +647 -69
  44. package/docs/api/classes/WSAPIStore.md +83 -108
  45. package/docs/api/classes/WSAPITournaments.md +495 -28
  46. package/docs/api/classes/WSAPIUser.md +520 -83
  47. package/docs/api/documents/Callbacks.md +162 -0
  48. package/docs/api/documents/SmarticoObject.md +445 -0
  49. package/docs/api/documents/Transforms.md +99 -0
  50. package/docs/api/enumerations/BonusStatus-1.md +11 -6
  51. package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
  52. package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
  53. package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
  54. package/docs/api/interfaces/AvatarCustomized.md +25 -0
  55. package/docs/api/interfaces/AvatarDefinition.md +94 -0
  56. package/docs/api/interfaces/AvatarPrompt.md +45 -0
  57. package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
  58. package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
  59. package/docs/api/interfaces/Clan.md +4 -0
  60. package/docs/api/interfaces/ClanInfo.md +109 -0
  61. package/docs/api/interfaces/ClanMember.md +53 -0
  62. package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
  63. package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
  64. package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
  65. package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
  66. package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
  67. package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
  68. package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
  69. package/docs/api/interfaces/JackpotDetails.md +14 -15
  70. package/docs/api/interfaces/JackpotPot.md +9 -6
  71. package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
  72. package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
  73. package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
  74. package/docs/api/interfaces/PointsLog.md +43 -0
  75. package/docs/api/interfaces/RaffleWonPrize.md +59 -0
  76. package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
  77. package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
  78. package/docs/api/interfaces/TAchCategory.md +2 -7
  79. package/docs/api/interfaces/TAvatarCustomized.md +4 -4
  80. package/docs/api/interfaces/TAvatarDefinition.md +13 -14
  81. package/docs/api/interfaces/TAvatarPrompt.md +6 -6
  82. package/docs/api/interfaces/TBonus.md +16 -8
  83. package/docs/api/interfaces/TBuyStoreItemResult.md +4 -29
  84. package/docs/api/interfaces/TClaimBonusResult.md +5 -5
  85. package/docs/api/interfaces/TClan.md +8 -4
  86. package/docs/api/interfaces/TClanInfo.md +47 -0
  87. package/docs/api/interfaces/TClanJoinResult.md +11 -1
  88. package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
  89. package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
  90. package/docs/api/interfaces/TClans.md +3 -1
  91. package/docs/api/interfaces/TGetTranslations.md +4 -0
  92. package/docs/api/interfaces/TInboxMessage.md +14 -6
  93. package/docs/api/interfaces/TInboxMessageBody.md +18 -12
  94. package/docs/api/interfaces/TLevel.md +17 -20
  95. package/docs/api/interfaces/TLevelCurrent.md +19 -18
  96. package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
  97. package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
  98. package/docs/api/interfaces/TMissionClaimRewardResult.md +1 -9
  99. package/docs/api/interfaces/TMissionOptInResult.md +1 -5
  100. package/docs/api/interfaces/TMissionOrBadge.md +4 -7
  101. package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
  102. package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
  103. package/docs/api/interfaces/TSetAvatarResult.md +3 -3
  104. package/docs/api/interfaces/TStoreItem.md +3 -13
  105. package/docs/api/interfaces/TTournament.md +1 -1
  106. package/docs/api/interfaces/TTournamentDetailed.md +1 -1
  107. package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
  108. package/docs/api/interfaces/TUICustomSection.md +23 -19
  109. package/docs/api/interfaces/TUserProfile.md +18 -16
  110. package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
  111. package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
  112. package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
  113. package/docs/native/ADDING_METHODS.md +7 -2
  114. package/docs/native/PROTOCOL.md +337 -0
  115. package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
  116. package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
  117. package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
  118. package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
  119. package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
  120. package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
  121. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
  122. package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
  123. package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
  124. package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
  125. package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
  126. package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
  127. package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
  128. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
  129. package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
  130. package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
  131. package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
  132. package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
  133. package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
  134. package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
  135. package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
  136. package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
  137. package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
  138. package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
  139. package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
  140. package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
  141. package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
  142. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
  143. package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
  144. package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
  145. package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
  146. package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
  147. package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
  148. package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
  149. package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
  150. package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
  151. package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
  152. package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
  153. package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
  154. package/docs/ui/user/UIGuide_getLevels.md +47 -42
  155. package/package.json +1 -1
  156. package/src/Base/ClassId.ts +2 -0
  157. package/src/Jackpots/JackpotDetails.ts +14 -15
  158. package/src/Jackpots/JackpotPot.ts +10 -6
  159. package/src/MiniGames/SAWGameType.ts +3 -0
  160. package/src/MiniGames/SAWTemplateUI.ts +10 -0
  161. package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
  162. package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
  163. package/src/Raffle/index.ts +3 -1
  164. package/src/SmarticoAPI.ts +14 -1
  165. package/src/SmarticoLib/index.ts +4 -0
  166. package/src/WSAPI/WSAPIAvatars.ts +267 -49
  167. package/src/WSAPI/WSAPIBonuses.ts +224 -10
  168. package/src/WSAPI/WSAPIGamePick.ts +538 -253
  169. package/src/WSAPI/WSAPIGeneral.ts +156 -14
  170. package/src/WSAPI/WSAPIInbox.ts +545 -56
  171. package/src/WSAPI/WSAPIJackpots.ts +297 -61
  172. package/src/WSAPI/WSAPILeaderBoard.ts +127 -13
  173. package/src/WSAPI/WSAPIMiniGames.ts +465 -49
  174. package/src/WSAPI/WSAPIRaffles.ts +592 -64
  175. package/src/WSAPI/WSAPITournaments.ts +3 -3
  176. package/src/WSAPI/WSAPITypes.ts +243 -132
  177. package/src/WSAPI/WSAPIUser.ts +193 -43
  178. package/tsconfig.json +9 -1
package/dist/index.js CHANGED
@@ -153,6 +153,8 @@ exports.ClassId = void 0;
153
153
  ClassId[ClassId["RAF_CLAIM_PRIZE_RESPONSE"] = 909] = "RAF_CLAIM_PRIZE_RESPONSE";
154
154
  ClassId[ClassId["RAF_OPTIN_REQUEST"] = 916] = "RAF_OPTIN_REQUEST";
155
155
  ClassId[ClassId["RAF_OPTIN_RESPONSE"] = 917] = "RAF_OPTIN_RESPONSE";
156
+ ClassId[ClassId["RAF_GET_WON_PRIZES_REQUEST"] = 920] = "RAF_GET_WON_PRIZES_REQUEST";
157
+ ClassId[ClassId["RAF_GET_WON_PRIZES_RESPONSE"] = 921] = "RAF_GET_WON_PRIZES_RESPONSE";
156
158
  /*
157
159
  RAF_GET_TICKETS_REQUEST = 902,
158
160
  RAF_GET_TICKETS_RESPONSE = 903,
@@ -386,6 +388,7 @@ exports.SAWGameType = void 0;
386
388
  SAWGameType[SAWGameType["Voyager"] = 10] = "Voyager";
387
389
  SAWGameType[SAWGameType["Plinko"] = 11] = "Plinko";
388
390
  SAWGameType[SAWGameType["CoinFlip"] = 12] = "CoinFlip";
391
+ SAWGameType[SAWGameType["CustomMinigame"] = 13] = "CustomMinigame";
389
392
  })(exports.SAWGameType || (exports.SAWGameType = {}));
390
393
  exports.SAWGameTypeName = void 0;
391
394
  (function (SAWGameTypeName) {
@@ -401,12 +404,13 @@ exports.SAWGameTypeName = void 0;
401
404
  SAWGameTypeName["Voyager"] = "voyager";
402
405
  SAWGameTypeName["Plinko"] = "plinko";
403
406
  SAWGameTypeName["CoinFlip"] = "coin_flip";
407
+ SAWGameTypeName["CustomMinigame"] = "custom_minigame";
404
408
  SAWGameTypeName["Unknown"] = "unknown";
405
409
  })(exports.SAWGameTypeName || (exports.SAWGameTypeName = {}));
406
410
  /** @hidden */
407
411
  var SAWGameTypeNamed = function SAWGameTypeNamed(type) {
408
412
  var _SAWGameType$SpinAWhe;
409
- return (_SAWGameType$SpinAWhe = {}, _SAWGameType$SpinAWhe[exports.SAWGameType.SpinAWheel] = exports.SAWGameTypeName.SpinAWheel, _SAWGameType$SpinAWhe[exports.SAWGameType.ScratchCard] = exports.SAWGameTypeName.ScratchCard, _SAWGameType$SpinAWhe[exports.SAWGameType.MatchX] = exports.SAWGameTypeName.MatchX, _SAWGameType$SpinAWhe[exports.SAWGameType.GiftBox] = exports.SAWGameTypeName.GiftBox, _SAWGameType$SpinAWhe[exports.SAWGameType.PrizeDrop] = exports.SAWGameTypeName.PrizeDrop, _SAWGameType$SpinAWhe[exports.SAWGameType.Quiz] = exports.SAWGameTypeName.Quiz, _SAWGameType$SpinAWhe[exports.SAWGameType.LootboxWeekdays] = exports.SAWGameTypeName.LootboxWeekdays, _SAWGameType$SpinAWhe[exports.SAWGameType.LootboxCalendarDays] = exports.SAWGameTypeName.LootboxCalendarDays, _SAWGameType$SpinAWhe[exports.SAWGameType.TreasureHunt] = exports.SAWGameTypeName.TreasureHunt, _SAWGameType$SpinAWhe[exports.SAWGameType.Voyager] = exports.SAWGameTypeName.Voyager, _SAWGameType$SpinAWhe[exports.SAWGameType.Plinko] = exports.SAWGameTypeName.Plinko, _SAWGameType$SpinAWhe[exports.SAWGameType.CoinFlip] = exports.SAWGameTypeName.CoinFlip, _SAWGameType$SpinAWhe)[type] || exports.SAWGameTypeName.Unknown;
413
+ return (_SAWGameType$SpinAWhe = {}, _SAWGameType$SpinAWhe[exports.SAWGameType.SpinAWheel] = exports.SAWGameTypeName.SpinAWheel, _SAWGameType$SpinAWhe[exports.SAWGameType.ScratchCard] = exports.SAWGameTypeName.ScratchCard, _SAWGameType$SpinAWhe[exports.SAWGameType.MatchX] = exports.SAWGameTypeName.MatchX, _SAWGameType$SpinAWhe[exports.SAWGameType.GiftBox] = exports.SAWGameTypeName.GiftBox, _SAWGameType$SpinAWhe[exports.SAWGameType.PrizeDrop] = exports.SAWGameTypeName.PrizeDrop, _SAWGameType$SpinAWhe[exports.SAWGameType.Quiz] = exports.SAWGameTypeName.Quiz, _SAWGameType$SpinAWhe[exports.SAWGameType.LootboxWeekdays] = exports.SAWGameTypeName.LootboxWeekdays, _SAWGameType$SpinAWhe[exports.SAWGameType.LootboxCalendarDays] = exports.SAWGameTypeName.LootboxCalendarDays, _SAWGameType$SpinAWhe[exports.SAWGameType.TreasureHunt] = exports.SAWGameTypeName.TreasureHunt, _SAWGameType$SpinAWhe[exports.SAWGameType.Voyager] = exports.SAWGameTypeName.Voyager, _SAWGameType$SpinAWhe[exports.SAWGameType.Plinko] = exports.SAWGameTypeName.Plinko, _SAWGameType$SpinAWhe[exports.SAWGameType.CoinFlip] = exports.SAWGameTypeName.CoinFlip, _SAWGameType$SpinAWhe[exports.SAWGameType.CustomMinigame] = exports.SAWGameTypeName.CustomMinigame, _SAWGameType$SpinAWhe)[type] || exports.SAWGameTypeName.Unknown;
410
414
  };
411
415
 
412
416
  exports.SAWExposeUserSpinId = void 0;
@@ -2476,7 +2480,7 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2476
2480
  *
2477
2481
  * **Inbox unread count** — `core_inbox_unread_count` on this profile
2478
2482
  * is push-updated in real time (under 1 second). For an inbox badge,
2479
- * prefer this field over {@link getInboxUnreadCount} (which is cached
2483
+ * prefer this field over `getInboxUnreadCount` (which is cached
2480
2484
  * for 30 s) — same value, fresher signal.
2481
2485
  *
2482
2486
  * **Language**: `core_user_language` reflects the server's stored
@@ -2546,15 +2550,75 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2546
2550
  throw new Error('Tracker is not initialized, cannot getUserProfile');
2547
2551
  }
2548
2552
  }
2549
- /** Check if user belongs to specific segments
2550
- * **Example**:
2551
- * ```
2552
- * _smartico.api.checkSegmentMatch(1).then((result) => {
2553
- * console.log(result);
2553
+ /**
2554
+ * Checks whether the current user matches a single segment, returning
2555
+ * `true` / `false` directly. Use this as a decision primitive to gate
2556
+ * UI surfaces (e.g. show a "VIP lounge" tab only when the user is in
2557
+ * the VIP segment), or to drive segment-specific CTA copy.
2558
+ *
2559
+ * Every call is a server round-trip — there is no SDK-side cache. For
2560
+ * checking multiple segments in one round-trip, use
2561
+ * {@link checkSegmentListMatch} instead.
2562
+ *
2563
+ * @remarks
2564
+ * **Refresh model**
2565
+ * - **No client cache.** Every call sends a request; the SDK does not
2566
+ * memoize results.
2567
+ * - **No push event** notifies the consumer when segment membership
2568
+ * flips (the user crosses a qualification threshold, or the
2569
+ * operator changes the segment definition). Membership changes
2570
+ * become visible only on the next `checkSegmentMatch` call.
2571
+ * - **Behavioral segments (configured against BigQuery) have batch
2572
+ * lag** — even if the user's activity has changed (deposit, wager,
2573
+ * etc.), the segment-membership result may not reflect that change
2574
+ * until the next batch evaluation run (typically up to several
2575
+ * hours).
2576
+ *
2577
+ * **Rate limit** (important)
2578
+ * The server caps `checkSegment*` calls at **10 requests per
2579
+ * 60-second window**, with a minimum gap of **~5 seconds between
2580
+ * consecutive calls**. Avoid calling on every render — cache the
2581
+ * result client-side for the session, or until you have a reason to
2582
+ * believe the user's state changed (e.g. after a deposit completes,
2583
+ * a level changes via {@link getUserProfile}'s `props_change`, or a
2584
+ * specific custom event fires).
2585
+ *
2586
+ * **`is_matching: false` is ambiguous on the server** — both "the
2587
+ * segment doesn't exist for this label" and "the user doesn't
2588
+ * qualify" return `false` with no distinguishing signal. Pass IDs
2589
+ * you've verified are valid for your label.
2590
+ *
2591
+ * **Idempotency**: safe. Read-only. No side effects (no analytics
2592
+ * events, no DB writes).
2593
+ *
2594
+ * **Visitor mode**: not supported.
2595
+ *
2596
+ * @param segment_id The segment ID. Segment IDs are label-scoped;
2597
+ * the same numeric ID can refer to different
2598
+ * segments under different labels. Use the IDs
2599
+ * configured for your label.
2600
+ * @returns `true` if the user currently matches the
2601
+ * segment, `false` otherwise. `false` also covers
2602
+ * the "segment doesn't exist for this label"
2603
+ * case — these are not distinguishable.
2604
+ *
2605
+ * @example
2606
+ * ```ts
2607
+ * const isVip = await window._smartico.api.checkSegmentMatch(vipSegmentId);
2608
+ * if (isVip) {
2609
+ * console.log('[smartico] user is in VIP segment — render the VIP-only widget surface');
2610
+ * } else {
2611
+ * console.log('[smartico] user not in VIP segment (or segment id misconfigured) — hide the VIP surface');
2612
+ * }
2613
+ *
2614
+ * // Cache the result for the session; re-check after material user-state changes.
2615
+ * window._smartico.on('props_change', async (changed) => {
2616
+ * if ('ach_points_ever' in changed || 'ach_level_current_id' in changed) {
2617
+ * const fresh = await window._smartico.api.checkSegmentMatch(vipSegmentId);
2618
+ * console.log('[smartico] user state changed — VIP membership now:', fresh);
2619
+ * }
2554
2620
  * });
2555
2621
  * ```
2556
- *
2557
- * **Visitor mode: not supported**
2558
2622
  */;
2559
2623
  _proto.checkSegmentMatch = function checkSegmentMatch(segment_id) {
2560
2624
  try {
@@ -2572,14 +2636,67 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2572
2636
  return Promise.reject(e);
2573
2637
  }
2574
2638
  }
2575
- /** Check if user belongs to specific list of segments
2576
- * **Example**:
2577
- * ```
2578
- * _smartico.api.checkSegmentListMatch([1, 2, 3]).then((result) => {
2579
- * console.log(result);
2580
- * });
2639
+ /**
2640
+ * Checks the current user's membership in multiple segments in a
2641
+ * single server round-trip — returns a `TSegmentCheckResult[]` with
2642
+ * one entry per *unique* segment ID. Use this instead of looping
2643
+ * {@link checkSegmentMatch} when you need to evaluate several
2644
+ * segments at once (e.g. multi-segment composite gating, A/B-style
2645
+ * cohort detection).
2646
+ *
2647
+ * @remarks
2648
+ * **Response order is NOT guaranteed**
2649
+ * The server returns results in an unspecified order — different
2650
+ * from the input array. Always correlate by the `segment_id` field on
2651
+ * each `TSegmentCheckResult` rather than by array position. The
2652
+ * returned array length may also be smaller than the input array
2653
+ * (duplicate IDs are silently de-duplicated server-side).
2654
+ *
2655
+ * **Single round-trip**
2656
+ * The entire `segment_ids` array is sent in one request. Two segments
2657
+ * cost the same as one in terms of network latency and rate-limit
2658
+ * consumption (one call = one rate-limit slot, regardless of how many
2659
+ * segments).
2660
+ *
2661
+ * **Shared semantics with `checkSegmentMatch`**
2662
+ * Both methods wrap the same underlying server endpoint and share
2663
+ * the same caching, refresh, rate-limit, and ambiguity behavior. See
2664
+ * {@link checkSegmentMatch} for: no client cache · no push event for
2665
+ * membership changes · behavioral segments have batch lag · rate
2666
+ * limit (10 requests / 60 s, ~5 s minimum gap between calls) ·
2667
+ * `is_matching: false` doesn't distinguish "not in segment" from
2668
+ * "segment doesn't exist for this label".
2669
+ *
2670
+ * **Idempotency**: safe. Read-only. No side effects.
2671
+ *
2672
+ * **Visitor mode**: not supported.
2673
+ *
2674
+ * @param segment_ids Array of segment IDs to check. Duplicates are
2675
+ * silently de-duplicated server-side. Segment IDs
2676
+ * are label-scoped — use the IDs configured for
2677
+ * your label.
2678
+ * @returns Array of `{ segment_id, is_matching }` results.
2679
+ * Order is NOT guaranteed; correlate by
2680
+ * `segment_id`. Length may be less than the input
2681
+ * when duplicate IDs were sent.
2682
+ *
2683
+ * @example
2684
+ * ```ts
2685
+ * const segmentIds = [vipSegmentId, newPlayerSegmentId, freeRollSegmentId];
2686
+ * const results = await window._smartico.api.checkSegmentListMatch(segmentIds);
2687
+ *
2688
+ * // Always correlate by segment_id — the response order is unspecified.
2689
+ * const byId = new Map(results.map(r => [r.segment_id, r.is_matching]));
2690
+ *
2691
+ * if (byId.get(vipSegmentId)) {
2692
+ * console.log('[smartico] user is in VIP segment — render VIP surface');
2693
+ * }
2694
+ * if (byId.get(newPlayerSegmentId) && byId.get(freeRollSegmentId)) {
2695
+ * console.log('[smartico] new player AND eligible for free roll — show the welcome promo');
2696
+ * }
2697
+ *
2698
+ * // Cache the result map for the session; refresh on material state changes.
2581
2699
  * ```
2582
- * **Visitor mode: not supported**
2583
2700
  */
2584
2701
  ;
2585
2702
  _proto.checkSegmentListMatch = function checkSegmentListMatch(segment_ids) {
@@ -2759,7 +2876,7 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2759
2876
  * The SDK exposes raw numeric values; the meaning of each counter
2760
2877
  * (deposit amount, wager amount, lifetime spend, etc.) is fully
2761
2878
  * operator-defined per label. Resolve labels for display via
2762
- * {@link getTranslations} — the operator's display strings are
2879
+ * `getTranslations` — the operator's display strings are
2763
2880
  * stored under the translation keys `levelsCounter1Name` and
2764
2881
  * `levelsCounter2Name`.
2765
2882
  *
@@ -2825,36 +2942,68 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2825
2942
  }
2826
2943
  }
2827
2944
  /**
2828
- * Returns the activity log for a user within a specified time range.
2829
- * The response includes both points changes and gems/diamonds changes.
2830
- * Each log entry contains information about the change amount, balance, and source.
2831
- * The returned list is cached for 30 seconds.
2832
- * You can pass the onUpdate callback as a parameter, it will be called every time the activity log is updated and will provide the updated list of activity logs for the last 10 minutes.
2945
+ * Returns the user's unified balance-change history — every points, gems, and
2946
+ * diamonds transaction within the requested time window, ordered newest-first.
2947
+ * Use to power an "Activity" / "History" tab showing wins, claims, purchases,
2948
+ * level-up rewards, and operator adjustments.
2833
2949
  *
2834
- * **Example**:
2835
- * ```
2836
- * const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
2837
- * const endTime = Math.floor(Date.now() / 1000); // now
2838
- *
2839
- * _smartico.api.getActivityLog({
2840
- * startTimeSeconds: startTime,
2841
- * endTimeSeconds: endTime,
2842
- * from: 0,
2843
- * to: 50,
2844
- * onUpdate: (data) => console.log('Updated:', data)
2845
- * }).then((result) => {
2846
- * console.log(result);
2847
- * });
2848
- * ```
2950
+ * The returned shape is the same regardless of currency type — `type` (see
2951
+ * {@link UserBalanceType}) distinguishes points / gems / diamonds and
2952
+ * `source_type_id` (see {@link PointChangeSourceType}) names the originating
2953
+ * event.
2849
2954
  *
2850
- * **Visitor mode: not supported**
2955
+ * @remarks
2956
+ * **Preconditions**
2957
+ * - User must be authenticated. Visitor mode is not guarded at the SDK level
2958
+ * but is not meaningful — activity is per-user.
2959
+ *
2960
+ * **Pagination — `from` / `to` are offset + ceiling, not timestamps**
2961
+ * The SDK derives `offset = from`, `limit = min(to - from, 50)` — the server
2962
+ * hard-caps a single response at 50 entries. For infinite scroll, advance
2963
+ * `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
2964
+ * are epoch seconds bounding the window the server scans.
2965
+ *
2966
+ * **Subscription model (`onUpdate`)**
2967
+ * The callback fires when the user's `ach_points_balance`,
2968
+ * `ach_gems_balance`, or `ach_diamonds_balance` changes (i.e. whenever a
2969
+ * wallet event lands). The pushed payload is a FIXED re-fetch of the
2970
+ * **last 10 minutes / first 50 entries** — it does NOT honor the original
2971
+ * call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to`. Consumers
2972
+ * maintaining a long historical view must re-call `getActivityLog` with
2973
+ * their own params after receiving an `onUpdate` notification.
2974
+ *
2975
+ * **Refresh**
2976
+ * - The SDK caches results for 30 seconds.
2977
+ * - Push triggers fire only on balance changes; transactions that don't
2978
+ * alter a balance (theoretical zero-amount entries) won't refresh.
2979
+ *
2980
+ * **Visitor mode**: not meaningful (no per-user history available).
2981
+ *
2982
+ * **UI guidance**: see [UI Guide — `getActivityLog`](../../docs/ui/user/UIGuide_getActivityLog.md).
2851
2983
  *
2852
- * @param params - Activity log parameters
2853
- * @param params.startTimeSeconds - Start time in seconds (epoch timestamp)
2854
- * @param params.endTimeSeconds - End time in seconds (epoch timestamp)
2855
- * @param params.from - Start index of records to return
2856
- * @param params.to - End index of records to return
2857
- * @param params.onUpdate - Optional callback function that will be called when the activity log is updated
2984
+ * @returns Array of {@link TActivityLog} ordered newest-first.
2985
+ *
2986
+ * @example
2987
+ * ```ts
2988
+ * const now = Math.floor(Date.now() / 1000);
2989
+ * const start = now - 86400 * 30; // 30 days
2990
+ *
2991
+ * const log = await window._smartico.api.getActivityLog({
2992
+ * startTimeSeconds: start,
2993
+ * endTimeSeconds: now,
2994
+ * from: 0,
2995
+ * to: 50,
2996
+ * onUpdate: (refreshed) => {
2997
+ * console.log('[smartico] wallet changed — refreshed payload is last 10 min / 50 entries:', refreshed.length, 'rows');
2998
+ * // If the consumer is showing a full 30-day view, re-call getActivityLog with the original params here.
2999
+ * },
3000
+ * });
3001
+ *
3002
+ * for (const row of log) {
3003
+ * const sign = row.amount >= 0 ? '+' : '';
3004
+ * console.log('[smartico] activity row — render with', row.type === 0 ? 'points' : row.type === 1 ? 'gems' : 'diamonds', 'icon, color by sign:', sign + row.amount, 'balance after:', row.balance, 'source:', row.source_type_id);
3005
+ * }
3006
+ * ```
2858
3007
  */
2859
3008
  ;
2860
3009
  _proto.getActivityLog = function getActivityLog(_ref) {
@@ -2897,6 +3046,57 @@ var WSAPIGeneral = /*#__PURE__*/function (_WSAPIUser) {
2897
3046
  }
2898
3047
  _inheritsLoose(WSAPIGeneral, _WSAPIUser);
2899
3048
  var _proto = WSAPIGeneral.prototype;
3049
+ /**
3050
+ * Returns the operator-configured "custom sections" the current user is eligible
3051
+ * to see. Custom sections are nav-level entries the operator builds in the BO —
3052
+ * HTML pages, themed mission grids, store / raffle / tournament category pages,
3053
+ * lootbox calendars, redirect links, and Liquid-templated dashboards — each
3054
+ * surfaced with its own icon and label.
3055
+ *
3056
+ * Use the response to build the side menu / bottom-bar / nav grid of a
3057
+ * gamification widget. Each section's `section_type_id` (see
3058
+ * {@link AchCustomSectionType}) tells the consumer which page component to mount
3059
+ * when the user opens the section.
3060
+ *
3061
+ * @remarks
3062
+ * **Preconditions**
3063
+ * - No prerequisite calls. Typically fetched once at app boot to build the
3064
+ * navigation skeleton.
3065
+ *
3066
+ * **Server-side eligibility filtering**
3067
+ * Sections are filtered server-side by the user's segments / level / brand and
3068
+ * the section's `active_from_date` / `active_till_date` window. Sections the
3069
+ * user is ineligible for are omitted from the response entirely — there is no
3070
+ * "locked" state to render.
3071
+ *
3072
+ * **Ordering**
3073
+ * Response is server-ordered. Render in the order received; do NOT re-sort
3074
+ * client-side (the operator's order is the intended nav order).
3075
+ *
3076
+ * **Refresh**
3077
+ * - The SDK caches results for 30 seconds.
3078
+ * - No push subscription. Re-call after a segment / level change might
3079
+ * make new sections eligible, or just rely on the 30 s cache turnover.
3080
+ *
3081
+ * **Visitor mode**: supported.
3082
+ *
3083
+ * **UI guidance**: see [UI Guide — `getCustomSections`](../../docs/ui/general/UIGuide_getCustomSections.md).
3084
+ *
3085
+ * @returns Array of {@link TUICustomSection} — empty if the label has no
3086
+ * active custom sections or the user is ineligible for all of them.
3087
+ *
3088
+ * @example
3089
+ * ```ts
3090
+ * const sections = await window._smartico.api.getCustomSections();
3091
+ *
3092
+ * for (const s of sections) {
3093
+ * console.log('[smartico] nav entry', s.menu_name, 'type', s.section_type_id, '→ mount the matching page component');
3094
+ * // Render s.menu_img (64x64) as the nav icon and s.menu_name as the label.
3095
+ * // For section_type_id === AchCustomSectionType.REDIRECT_LINK, do NOT mount a page —
3096
+ * // resolve s.url_or_dp on click (DP string or external URL).
3097
+ * }
3098
+ * ```
3099
+ */
2900
3100
  _proto.getCustomSections = function getCustomSections() {
2901
3101
  try {
2902
3102
  var _this = this;
@@ -2908,7 +3108,59 @@ var WSAPIGeneral = /*#__PURE__*/function (_WSAPIUser) {
2908
3108
  }
2909
3109
  }
2910
3110
  /**
2911
- * Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
3111
+ * Returns the full set of operator-defined translation key/value pairs for the
3112
+ * label, merged across the requested language and the English baseline.
3113
+ *
3114
+ * Translation keys are free-form strings defined by the operator in the BO. The
3115
+ * SDK consumer treats the result as a flat dictionary: `translations[key]`. If
3116
+ * the key is missing entirely, do NOT trust `undefined` semantics — defensively
3117
+ * fall back to the key string itself or a hardcoded literal.
3118
+ *
3119
+ * @remarks
3120
+ * **Preconditions**
3121
+ * - No prerequisite calls.
3122
+ * - `lang_code` is the ISO language code the operator uses in the BO
3123
+ * (e.g. `"EN"`, `"FR"`, `"ES"`). Case is not normalised — match what the
3124
+ * operator configured.
3125
+ *
3126
+ * **EN fallback**
3127
+ * The SDK issues an English-baseline fetch first, then overlays the
3128
+ * `lang_code` translations on top. Any key the operator has only defined in
3129
+ * English (i.e. missing in the requested language) is returned with the
3130
+ * English value. Keys missing in both are absent from the map — the consumer
3131
+ * must handle missing keys (the default Smartico UI returns the key string
3132
+ * itself as the fallback text).
3133
+ *
3134
+ * **What's included**
3135
+ * The SDK passes an empty `areas` filter to the server, which returns ALL
3136
+ * translation namespaces configured for the label (Gamification, Casino,
3137
+ * Trading, Affiliation, etc. — whichever are populated). For a Gamification-
3138
+ * only widget, the consumer can ignore unused namespaces — keys are flat
3139
+ * strings, not nested.
3140
+ *
3141
+ * **Refresh**
3142
+ * - Cached internally per `(lang_code, label, brand)` for ~30 seconds.
3143
+ * - No push subscription. Operators editing translations in the BO will see
3144
+ * the change after the cache window expires.
3145
+ *
3146
+ * **Visitor mode**: supported. Translations are label-scoped, not user-
3147
+ * scoped — `lang_code` is the sole language selector and is independent of
3148
+ * the `vapi(lang)` argument used elsewhere.
3149
+ *
3150
+ * @param lang_code ISO language code (e.g. `"EN"`, `"FR"`). Defaults to
3151
+ * `"EN"` server-side if empty.
3152
+ * @returns {@link TGetTranslations} — `{ translations: { [key]: string } }`.
3153
+ *
3154
+ * @example
3155
+ * ```ts
3156
+ * const r = await window._smartico.api.getTranslations('FR');
3157
+ *
3158
+ * // Defensive lookup: fall back to the key itself if the operator hasn't
3159
+ * // defined the string.
3160
+ * const t = (k: string) => r.translations[k] ?? k;
3161
+ *
3162
+ * console.log('[smartico] localized label "missions_title" →', t('missions_title'));
3163
+ * ```
2912
3164
  */
2913
3165
  ;
2914
3166
  _proto.getTranslations = function getTranslations(lang_code) {
@@ -2924,21 +3176,60 @@ var WSAPIGeneral = /*#__PURE__*/function (_WSAPIUser) {
2924
3176
  }
2925
3177
  }
2926
3178
  /**
2927
- * Returns all the related tournaments and missions for the provided game id for the current user
2928
- * The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
3179
+ * Returns the missions and tournaments associated with a casino / sportsbook
3180
+ * game in the operator's games catalog — the reverse of "given this mission,
3181
+ * which games count for it" — so you can surface "play this game to progress
3182
+ * mission X" / "tournament Y features this game" badges on game tiles or
3183
+ * detail screens.
2929
3184
  *
2930
- * **Example**:
2931
- * ```
2932
- * _smartico.api.getRelatedItemsForGame('gold-slot2').then((result) => {
2933
- * console.log(result);
2934
- * });
2935
- * ```
3185
+ * The shape mirrors `getMissions` (`UserAchievement[]`) and `getTournamentsList`
3186
+ * (`Tournament[]`) — same wire types, no reduced subset.
2936
3187
  *
2937
- * **Example in the Visitor mode**:
2938
- * ```
2939
- * _smartico.vapi('EN').getRelatedItemsForGame('gold-slot2').then((result) => {
2940
- * console.log(result);
2941
- * });
3188
+ * @remarks
3189
+ * **Preconditions**
3190
+ * - `related_game_id` must be a Games Catalog ID (the same external string the
3191
+ * operator uses in the catalog at
3192
+ * {@link https://help.smartico.ai/welcome/technical-guides/games-catalog-api}).
3193
+ *
3194
+ * **Server-side eligibility filtering**
3195
+ * Missions and tournaments are filtered by the user's segments / level / brand
3196
+ * before being returned. A user who is ineligible for a mission segment will
3197
+ * NOT see that mission in the result even if it lists the game. The same
3198
+ * filtering applies to tournaments. Treat the response as "what this user
3199
+ * should see" — no client-side eligibility pass needed.
3200
+ *
3201
+ * **No cache**
3202
+ * Every call is a live server round-trip. Missions/tournaments are operator-
3203
+ * mutated state (opt-in, completion, expiry) that changes during a session;
3204
+ * caching staler than the user's last action would mis-render eligibility.
3205
+ * Avoid building a consumer-side cache for UI-critical paths.
3206
+ *
3207
+ * **Refresh**
3208
+ * - Re-call when the user navigates to a new game tile / detail surface.
3209
+ * - Re-call after the user opts into / completes a related mission to refresh
3210
+ * the "play this game" badge.
3211
+ *
3212
+ * **Visitor mode**: supported via `_smartico.vapi(lang).getRelatedItemsForGame(...)`.
3213
+ *
3214
+ * **UI guidance**: see [UI Guide — `getRelatedItemsForGame`](../../docs/ui/general/UIGuide_getRelatedItemsForGame.md).
3215
+ *
3216
+ * @param related_game_id External Games Catalog ID of the game (e.g. `"gold-slot2"`).
3217
+ * @returns {@link GetRelatedAchTourResponse} — `{ achievements, tournaments? }`.
3218
+ * `tournaments` may be `undefined` (treat as empty); both arrays may be empty
3219
+ * when no eligible entities reference the game.
3220
+ *
3221
+ * @example
3222
+ * ```ts
3223
+ * const r = await window._smartico.api.getRelatedItemsForGame('gold-slot2');
3224
+ *
3225
+ * const missions = r.achievements ?? [];
3226
+ * const tournaments = r.tournaments ?? [];
3227
+ *
3228
+ * if (missions.length === 0 && tournaments.length === 0) {
3229
+ * console.log('[smartico] no related missions / tournaments — hide the related badge on the game tile');
3230
+ * } else {
3231
+ * console.log('[smartico] related entities:', missions.length, 'missions /', tournaments.length, 'tournaments — show a "X missions / Y tournaments" badge');
3232
+ * }
2942
3233
  * ```
2943
3234
  */
2944
3235
  ;
@@ -3552,12 +3843,125 @@ var WSAPIBonuses = /*#__PURE__*/function (_WSAPIMissions) {
3552
3843
  _inheritsLoose(WSAPIBonuses, _WSAPIMissions);
3553
3844
  var _proto = WSAPIBonuses.prototype;
3554
3845
  /**
3555
- * Returns all the bonuses for the current user
3556
- * The returned bonuses are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
3557
- * Note that each time you call getBonuses with a new onUpdate callback, the old one will be overwritten by the new one.
3558
- * The onUpdate callback will be called on bonus claimed and the updated bonuses will be passed to it.
3846
+ * Returns the bonuses awarded to the current user — both pending
3847
+ * (player-claim required) and already-redeemed. Each bonus carries
3848
+ * a `bonus_status_id` ({@link BonusStatus}) describing its lifecycle
3849
+ * stage and an `is_redeemable` flag that signals whether the
3850
+ * consumer must trigger a manual {@link claimBonus} call.
3851
+ *
3852
+ * Bonuses originate from many sources (CRM rules, mission/tournament
3853
+ * rewards, store redemptions, mini-game prizes, manual operator
3854
+ * awards) and all surface through this single list. The consumer
3855
+ * cannot distinguish the source server-side without operator
3856
+ * coordination.
3559
3857
  *
3560
- * **Visitor mode: not supported**
3858
+ * @remarks
3859
+ * **Subscription model (`onUpdate`)**
3860
+ * The callback receives the FULL refreshed bonuses list (never a
3861
+ * diff/patch). Each subsequent call to `getBonuses({ onUpdate })`
3862
+ * REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
3863
+ * it) to keep the prior callback in place; the callback is never
3864
+ * auto-cleared.
3865
+ *
3866
+ * **Update triggers** — the callback fires after every
3867
+ * {@link claimBonus} call resolves on this connection (success OR
3868
+ * failure). This is the ONLY trigger.
3869
+ *
3870
+ * Does NOT fire when: a new bonus is awarded server-side
3871
+ * (CRM rule, mission completion, store purchase, etc.), a bonus
3872
+ * expires, or an operator manually issues / cancels a bonus. Those
3873
+ * changes surface only on the next cache miss (after the 30 s TTL).
3874
+ * Re-call `getBonuses()` manually if your UI needs near-live state
3875
+ * for server-driven awards.
3876
+ *
3877
+ * **Reading state from the returned bonus**
3878
+ * Drive UI bucketing from `bonus_status_id` (enum {@link BonusStatus}):
3879
+ *
3880
+ * - `COUPON_ISSUED` (2) — actionable; player must claim. Pair with
3881
+ * `is_redeemable === true` to gate the Claim button.
3882
+ * - `REDEEM_FAILED` (4) — also actionable; the previous claim
3883
+ * attempt failed but the bonus is still valid. Surface a retry CTA
3884
+ * — the default Smartico UI treats this identically to
3885
+ * `COUPON_ISSUED` from the player's perspective.
3886
+ * - `REDEEMED` (3) — historical; show in a "claimed" tab.
3887
+ * - `New` (1), `COUPON_ISSUE_FAILED` (5), `EXPIRED` (6) — these
3888
+ * should not normally reach the client and are typically filtered
3889
+ * out by operator-side widget configuration; if they do appear,
3890
+ * they have no player-actionable state.
3891
+ *
3892
+ * `is_redeemable` is the authoritative gate for showing the Claim
3893
+ * button — it's `true` only when the bonus is in a claimable status
3894
+ * AND the operator's integration uses a coupon model (where the
3895
+ * player must explicitly trigger delivery). Auto-redeemed bonuses
3896
+ * arrive already in `REDEEMED` state with `is_redeemable: false`.
3897
+ *
3898
+ * **Field hierarchy — display amount**
3899
+ * Bonuses carry both template-level (`label_bonus_template_meta_map.description`)
3900
+ * and instance-level (`bonus_meta_map.uiAmount`) display strings.
3901
+ * Prefer `bonus_meta_map.uiAmount` when present — it's the dynamic
3902
+ * amount computed at issuance time (e.g. from a dynamic-bonus
3903
+ * formula). Fall back to `label_bonus_template_meta_map.description`
3904
+ * (which can include HTML; sanitize before injecting).
3905
+ *
3906
+ * **Date format**
3907
+ * `create_date` and `redeem_date` are ISO 8601 UTC strings WITHOUT
3908
+ * a timezone suffix (`"YYYY-MM-DDTHH:MM:SS"`). Parse as UTC and
3909
+ * display in the user's local timezone. `redeem_date` is absent
3910
+ * until the bonus reaches `REDEEMED` status.
3911
+ *
3912
+ * **Cache TTL**: the SDK caches the response for 30 seconds. Cache
3913
+ * is fully cleared on login / logout.
3914
+ *
3915
+ * **Idempotency / Side effects**: safe. Read-only.
3916
+ *
3917
+ * **UI guidance**: see [UI Guide — `getBonuses`](../../docs/ui/bonuses/UIGuide_getBonuses.md).
3918
+ *
3919
+ * **Visitor mode**: not supported.
3920
+ *
3921
+ * @param params Optional. Omit to fetch without subscribing.
3922
+ * @param params.onUpdate Callback invoked with the full refreshed
3923
+ * bonuses list after every
3924
+ * {@link claimBonus} resolves. Each call
3925
+ * to `getBonuses` overwrites the prior
3926
+ * callback.
3927
+ * @returns Promise resolving to the bonuses list.
3928
+ * Empty array if no bonuses are visible.
3929
+ *
3930
+ * @example
3931
+ * ```ts
3932
+ * const bonuses = await window._smartico.api.getBonuses({
3933
+ * onUpdate: (refreshed) => {
3934
+ * console.log('[smartico] bonuses refreshed (after claimBonus) — re-render the bonuses UI from this array:', refreshed);
3935
+ * },
3936
+ * });
3937
+ *
3938
+ * // Bucket into pending vs redeemed tabs. The default Smartico UI groups
3939
+ * // COUPON_ISSUED + REDEEM_FAILED into the same "Pending" tab.
3940
+ * const pending = bonuses.filter(b =>
3941
+ * b.bonus_status_id === 2 || b.bonus_status_id === 4 // COUPON_ISSUED or REDEEM_FAILED
3942
+ * );
3943
+ * const redeemed = bonuses.filter(b => b.bonus_status_id === 3); // REDEEMED
3944
+ *
3945
+ * console.log('[smartico] render bonus tabs: pending=', pending.length, 'redeemed=', redeemed.length);
3946
+ *
3947
+ * // Render each pending bonus card; show Claim button only when redeemable.
3948
+ * for (const b of pending) {
3949
+ * const amount = b.bonus_meta_map?.uiAmount || b.label_bonus_template_meta_map?.description;
3950
+ * if (b.is_redeemable) {
3951
+ * console.log('[smartico] render Claim button for bonus', b.bonus_id, '— amount:', amount);
3952
+ * } else {
3953
+ * console.log('[smartico] render bonus as informational (no Claim button) — amount:', amount);
3954
+ * }
3955
+ * }
3956
+ *
3957
+ * // Server-awarded bonuses (e.g. from a CRM campaign) do NOT push;
3958
+ * // poll if you need near-live awareness.
3959
+ * setInterval(async () => {
3960
+ * const fresh = await window._smartico.api.getBonuses();
3961
+ * const newCount = fresh.filter(b => b.bonus_status_id === 2 || b.bonus_status_id === 4).length;
3962
+ * console.log('[smartico] poll tick — pending bonuses now:', newCount);
3963
+ * }, 30_000);
3964
+ * ```
3561
3965
  */
3562
3966
  _proto.getBonuses = function getBonuses(_temp) {
3563
3967
  var _ref = _temp === void 0 ? {} : _temp,
@@ -3575,12 +3979,113 @@ var WSAPIBonuses = /*#__PURE__*/function (_WSAPIMissions) {
3575
3979
  }
3576
3980
  }
3577
3981
  /**
3578
- * Claim the bonus by bonus_id. Returns the err_code in case of success or error.
3579
- * Note that this method can be used only on integrations where originally failed bonus can be claimed again.
3580
- * For example, user won a bonus in the mini-game, but Operator rejected this bonus.
3581
- * This bonus will be available for the user to claim again.
3982
+ * Triggers manual redemption of a coupon-model bonus the user has
3983
+ * been awarded. For bonuses with `is_redeemable === true` returned
3984
+ * by {@link getBonuses}, this is the call that asks the operator's
3985
+ * integration to actually credit the bonus to the player's account.
3986
+ * Bonuses on integrations that auto-redeem arrive already in
3987
+ * `REDEEMED` state and do not require this call.
3582
3988
  *
3583
- * **Visitor mode: not supported**
3989
+ * Use this for `bonus_status_id` of `COUPON_ISSUED` (2) as the
3990
+ * first-time claim, and for `REDEEM_FAILED` (4) as a retry after a
3991
+ * prior unsuccessful attempt.
3992
+ *
3993
+ * @remarks
3994
+ * **Preconditions**
3995
+ * Read the candidate bonus from {@link getBonuses} and gate the
3996
+ * call on `is_redeemable === true`. The SDK forwards the request
3997
+ * unconditionally — calling on a non-claimable bonus returns
3998
+ * `err_code = -1`.
3999
+ *
4000
+ * **Error codes** (in `err_code`)
4001
+ *
4002
+ * The SDK currently types `err_code` as {@link SAWSpinErrorCode} for
4003
+ * historical reasons, but the values returned by this method come
4004
+ * from the server's general error space and are NOT mini-game codes.
4005
+ * Branch on the numeric values:
4006
+ *
4007
+ * - `0` — success; the bonus has been redeemed and the operator's
4008
+ * integration has credited the player's account.
4009
+ * - `-1` — bonus not claimable: not found, already claimed by
4010
+ * another session, or its status is no longer `COUPON_ISSUED` /
4011
+ * `REDEEM_FAILED`. Treat as idempotent — refresh
4012
+ * {@link getBonuses} and reconcile.
4013
+ * - `1` — generic server error. Transient; allow retry after a brief
4014
+ * delay.
4015
+ * - `9999` — uncaught server exception. Treat as a transient failure;
4016
+ * surface a generic error and allow retry.
4017
+ * - other non-zero — generic server error. Surface `err_message` if
4018
+ * any.
4019
+ *
4020
+ * **`success` field is unreliable**: the wire response does not
4021
+ * carry a `success` boolean — the field on `TClaimBonusResult` will
4022
+ * be `undefined` in practice. Always branch on `err_code === 0`
4023
+ * for the success check.
4024
+ *
4025
+ * **Refresh after success (and after failure)**
4026
+ * The SDK automatically refreshes the bonuses cache on every
4027
+ * response (success OR failure) and fires any `onUpdate` callback
4028
+ * registered via {@link getBonuses}'s `onUpdate`. After
4029
+ * `err_code === 0`, the redeemed bonus shifts from
4030
+ * `COUPON_ISSUED` / `REDEEM_FAILED` to `REDEEMED` on the refreshed
4031
+ * array, with `redeem_date` populated. After a failure, the bonus
4032
+ * typically lands in `REDEEM_FAILED` and remains claimable for a
4033
+ * retry.
4034
+ *
4035
+ * **Idempotency**: NOT idempotent at the SDK level. A second call
4036
+ * returns `err_code = -1` once the first has succeeded — treat that
4037
+ * as success in the UI rather than as a real error. Guard the call
4038
+ * site against double-clicks (set a local "claiming" flag on click,
4039
+ * clear it on response).
4040
+ *
4041
+ * **Side effects** (on `err_code === 0`)
4042
+ * - Bonus status transitions to `REDEEMED`; `redeem_date` is set.
4043
+ * - The operator's integration credits the player's account
4044
+ * externally. The SDK does not observe that credit directly —
4045
+ * balance updates flow over the user-properties channel from the
4046
+ * operator's side, not from this response.
4047
+ * - Server-side analytics events fire downstream (not directly
4048
+ * observable from the SDK).
4049
+ *
4050
+ * **UI guidance**: see [UI Guide — `claimBonus`](../../docs/ui/bonuses/UIGuide_claimBonus.md).
4051
+ *
4052
+ * **Visitor mode**: not supported.
4053
+ *
4054
+ * @param bonus_id The `bonus_id` from a `TBonus` returned by
4055
+ * {@link getBonuses}.
4056
+ * @returns `{ err_code, err_message, success? }`; success when
4057
+ * `err_code === 0` (or `err_code === -1` when treated as
4058
+ * idempotent no-op). The `success` field is unreliable —
4059
+ * ignore it.
4060
+ *
4061
+ * @example
4062
+ * ```ts
4063
+ * const bonuses = await window._smartico.api.getBonuses({
4064
+ * onUpdate: (refreshed) => console.log('[smartico] bonuses refreshed — re-render from this array', refreshed),
4065
+ * });
4066
+ * const bonus = bonuses.find(b => b.bonus_id === bonusId);
4067
+ *
4068
+ * if (!bonus) {
4069
+ * console.log('[smartico] bonus no longer visible — refresh list and hide CTA');
4070
+ * return;
4071
+ * }
4072
+ * if (!bonus.is_redeemable) {
4073
+ * console.log('[smartico] bonus is not claimable (auto-redeemed or already finalised) — keep CTA hidden');
4074
+ * return;
4075
+ * }
4076
+ *
4077
+ * console.log('[smartico] claim starting — set in-flight flag, show loading dots on the Claim button, keep the modal open');
4078
+ * const r = await window._smartico.api.claimBonus(bonus.bonus_id);
4079
+ * console.log('[smartico] claim response received — clear in-flight flag');
4080
+ *
4081
+ * if (r.err_code === 0 || r.err_code === -1) {
4082
+ * console.log('[smartico] claim succeeded (or was already done) — show a success toast; the getBonuses onUpdate above will fire with the refreshed list');
4083
+ * } else if (r.err_code === 9999) {
4084
+ * console.error('[smartico] uncaught server exception — show a generic error toast and allow retry');
4085
+ * } else {
4086
+ * 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);
4087
+ * }
4088
+ * ```
3584
4089
  */
3585
4090
  ;
3586
4091
  _proto.claimBonus = function claimBonus(bonus_id) {
@@ -4747,7 +5252,7 @@ var WSAPITournaments = /*#__PURE__*/function (_WSAPIStore) {
4747
5252
  *
4748
5253
  * For clan tournaments (`is_clan_based === true`), the user must
4749
5254
  * already belong to a clan before calling. If they don't, prompt them
4750
- * to pick a clan first via {@link joinClan}, then call
5255
+ * to pick a clan first via `joinClan`, then call
4751
5256
  * `registerInTournament` after the clan-join resolves. See "Error
4752
5257
  * codes" `1010` below for the server-side safety net.
4753
5258
  *
@@ -4756,8 +5261,8 @@ var WSAPITournaments = /*#__PURE__*/function (_WSAPIStore) {
4756
5261
  * tournament lobby refresh fires.
4757
5262
  * - `1010` — `TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN`: clan-based
4758
5263
  * tournament and the user has no clan. Surface the clan-pick flow
4759
- * (e.g. open a clan-pick modal driven by {@link getClans} +
4760
- * {@link joinClan}), then retry registration.
5264
+ * (e.g. open a clan-pick modal driven by `getClans` +
5265
+ * `joinClan`), then retry registration.
4761
5266
  * - `30001` — `TOURNAMENT_INSTANCE_NOT_FOUND`: instance ID is invalid
4762
5267
  * or the tournament was deleted. Refresh the lobby via
4763
5268
  * `getTournamentsList()` and hide the entry from the UI.
@@ -5372,23 +5877,81 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5372
5877
  return Promise.reject(e);
5373
5878
  }
5374
5879
  }
5375
- /** Returns list of Jackpots that are active in the system and matching to the filter definition.
5376
- * If filter is not provided, all active jackpots will be returned.
5377
- * Filter can be used to get jackpots related to specific game or specific jackpot template.
5378
- * You can call this method every second in order to get up to date information about current value of the jackpot(s) and present them to the end-users
5880
+ /**
5881
+ * Returns the user-eligible jackpots active for the label, fused with their live
5882
+ * pot values. Each entry carries the static template (name, description, opt-in
5883
+ * state, eligible games, currency) plus a freshly-fetched `pot` snapshot.
5379
5884
  *
5380
- * **Example**:
5381
- * ```
5382
- * _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
5383
- * console.log(result);
5384
- * });
5385
- * ```
5885
+ * Designed to be polled at high frequency (every 1 second is fine) — the SDK
5886
+ * splits the response into a 30-second template cache and a 1-second pot-value
5887
+ * cache so consumers can render a live-counting pot amount without hammering
5888
+ * the server for the static template data.
5386
5889
  *
5387
- * **Example in the Visitor mode**:
5388
- * ```
5389
- * _smartico.vapi('EN').jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
5390
- * console.log(result);
5391
- * });
5890
+ * @remarks
5891
+ * **Preconditions**
5892
+ * - No prerequisite calls.
5893
+ * - Visitor mode supported via `_smartico.vapi(lang).jackpotGet(...)`.
5894
+ *
5895
+ * **Server-side eligibility filtering**
5896
+ * Jackpots are filtered server-side by the user's segments before being
5897
+ * returned. Templates the user is ineligible for never appear in this
5898
+ * response — there is no "locked" state to render. An empty result for a
5899
+ * known-good user typically means none of the configured templates match
5900
+ * the user's segments / level / brand.
5901
+ *
5902
+ * **Filter behavior**
5903
+ * Passing `related_game_id` returns only jackpots linked to that game (from
5904
+ * the operator's games catalog). Passing `jp_template_id` returns just that
5905
+ * single template. With no filter, all active templates the user is
5906
+ * eligible for are returned. Changing the filter between calls flushes both
5907
+ * the template cache and the pot cache.
5908
+ *
5909
+ * **Two-tier cache**
5910
+ * - Template definitions: 30 s cache. Re-fetched on filter change or when
5911
+ * opt-in / opt-out / a jackpot-win push lands.
5912
+ * - Pot values: 1 s cache. Re-fetched on every call past the 1-second
5913
+ * window so a 1 Hz poll renders a smoothly counting pot.
5914
+ *
5915
+ * **`jp_public_meta.custom_data`**
5916
+ * Server returns this as a JSON-encoded string; the SDK parses it inline so
5917
+ * consumers always receive either a parsed object or the raw string.
5918
+ *
5919
+ * **Personal vs MultiUser jackpots** (see {@link JackpotType})
5920
+ * - `MultiUser` (1) — shared pot; `registration_count` reflects real opted-in
5921
+ * user count; temperature transitions fire push events.
5922
+ * - `Personal` (2) — independent per-user pot; `registration_count` is
5923
+ * always 1; temperature push events are suppressed.
5924
+ *
5925
+ * **Refresh**
5926
+ * - `jp_status_id`, segment changes, and operator template edits surface
5927
+ * after the 30 s template cache TTL.
5928
+ * - Opt-in / opt-out / jackpot-win push events all clear the template and
5929
+ * pot caches — the next call re-fetches.
5930
+ *
5931
+ * **Visitor mode**: supported.
5932
+ *
5933
+ * **UI guidance**: see [UI Guide — `jackpotGet`](../../docs/ui/jackpots/UIGuide_jackpotGet.md).
5934
+ *
5935
+ * @param filter Optional filter narrowing the result set.
5936
+ * @param filter.related_game_id Limit to jackpots linked to this game ID
5937
+ * (from the operator's games catalog).
5938
+ * @param filter.jp_template_id Limit to a single template.
5939
+ * @returns Array of {@link JackpotDetails} — empty if the user is eligible
5940
+ * for no active jackpots.
5941
+ *
5942
+ * @example
5943
+ * ```ts
5944
+ * // Poll every second for live pot counter
5945
+ * setInterval(async () => {
5946
+ * const jackpots = await window._smartico.api.jackpotGet();
5947
+ * for (const jp of jackpots) {
5948
+ * 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);
5949
+ * }
5950
+ * }, 1000);
5951
+ *
5952
+ * // Filtered fetch for a specific game tile
5953
+ * const linked = await window._smartico.api.jackpotGet({ related_game_id: 'gold-slot2' });
5954
+ * console.log('[smartico] linked jackpots for game:', linked.length);
5392
5955
  * ```
5393
5956
  */
5394
5957
  ;
@@ -5456,18 +6019,68 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5456
6019
  }
5457
6020
  }
5458
6021
  /**
5459
- * Opt-in currently logged in user to the jackpot with the specified jp_template_id.
5460
- * You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
6022
+ * Opts the authenticated user into a jackpot. From this point on, the user
6023
+ * contributes to the pot (per the template's `contribution_type` and
6024
+ * `contribution_value`) and is eligible to win when the pot explodes.
5461
6025
  *
5462
- * **Example**:
5463
- * ```
5464
- * _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
5465
- * console.log('Opted in to the jackpot');
5466
- * });
5467
- * ```
6026
+ * On success the SDK clears the jackpot caches — the next
6027
+ * {@link jackpotGet} call returns the updated `is_opted_in: true` and an
6028
+ * incremented `registration_count`.
5468
6029
  *
5469
- * **Visitor mode: not supported**
6030
+ * @remarks
6031
+ * **Preconditions**
6032
+ * - User must be authenticated. Visitor mode not supported.
6033
+ * - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
6034
+ * - The jackpot must currently be active and the user must be in its
6035
+ * eligibility segment. Ineligible jackpots are filtered out of
6036
+ * {@link jackpotGet} entirely, so a card the user sees is opt-in-able.
6037
+ *
6038
+ * **Error handling**
6039
+ * The server returns a non-zero `errCode` with a human-readable `errMsg`
6040
+ * for any failure. Common causes:
6041
+ * - User is in a control group.
6042
+ * - Jackpot template is not active (status changed since the user opened
6043
+ * the card).
6044
+ * - User is already opted in (the SDK has no client-side guard against a
6045
+ * double-tap; the server enforces).
6046
+ * - DB race / generic server error.
6047
+ *
6048
+ * The SDK does NOT enumerate distinct numeric codes for each cause — branch
6049
+ * on `errCode === 0` for success and surface `errMsg` as-is for failures.
6050
+ *
6051
+ * **Idempotency / re-opt-in semantics**
6052
+ * - **Already opted in** → returns non-zero `errCode` ("User already opted in").
6053
+ * - **Previously opted in then opted out** → succeeds silently; the server
6054
+ * re-activates the registration. This is not an error path — a user can
6055
+ * freely cycle opt-in / opt-out.
6056
+ *
6057
+ * **Refresh after success**
6058
+ * - The SDK clears the template, pot, and winners caches.
6059
+ * - The next {@link jackpotGet} call returns `is_opted_in: true` for this
6060
+ * template.
6061
+ *
6062
+ * **Side effects**
6063
+ * Fires a `JACKPOT_OPT_IN` engagement event (visible to operator-side
6064
+ * automation rules). Does NOT immediately move points / gems — contributions
6065
+ * happen per-bet via the user's gameplay, not on opt-in.
6066
+ *
6067
+ * **Visitor mode**: not supported.
6068
+ *
6069
+ * **UI guidance**: see [UI Guide — `jackpotOptIn`](../../docs/ui/jackpots/UIGuide_jackpotOptIn.md).
5470
6070
  *
6071
+ * @param filter.jp_template_id ID of the jackpot template to join.
6072
+ * @returns {@link JackpotsOptinResponse} — `errCode === 0` on success.
6073
+ *
6074
+ * @example
6075
+ * ```ts
6076
+ * const r = await window._smartico.api.jackpotOptIn({ jp_template_id: 42 });
6077
+ *
6078
+ * if (r.errCode === 0) {
6079
+ * console.log('[smartico] opted in — refresh jackpot card to show opt-out CTA');
6080
+ * } else {
6081
+ * console.error('[smartico] opt-in failed — show this message in an error toast:', r.errMsg);
6082
+ * }
6083
+ * ```
5471
6084
  */
5472
6085
  ;
5473
6086
  _proto.jackpotOptIn = function jackpotOptIn(filter) {
@@ -5482,18 +6095,63 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5482
6095
  }
5483
6096
  }
5484
6097
  /**
5485
- * Opt-out currently logged in user from the jackpot with the specified jp_template_id.
5486
- * You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
6098
+ * Opts the authenticated user out of a jackpot. From this point on the user
6099
+ * no longer contributes to the pot and is not eligible to win.
5487
6100
  *
5488
- * **Example**:
5489
- * ```
5490
- * _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
5491
- * console.log('Opted out from the jackpot');
5492
- * });
5493
- * ```
6101
+ * The user can re-join later via {@link jackpotOptIn} — opt-out is not
6102
+ * permanent.
5494
6103
  *
5495
- * **Visitor mode: not supported**
6104
+ * @remarks
6105
+ * **Preconditions**
6106
+ * - User must be authenticated. Visitor mode not supported.
6107
+ * - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
6108
+ *
6109
+ * **Error handling**
6110
+ * The server returns a non-zero `errCode` with a human-readable `errMsg` for
6111
+ * any failure. Common causes:
6112
+ * - User has never opted in OR is already opted out — server returns
6113
+ * non-zero `errCode` for the "already opted out" case. Calling opt-out
6114
+ * on a jackpot the user has never registered for typically returns
6115
+ * success (the server finds no registration row to update).
6116
+ * - DB race / generic server error.
6117
+ *
6118
+ * Unlike {@link jackpotOptIn}, opt-out does NOT check the template's status
6119
+ * — the user can opt out of a jackpot that has been deactivated by the
6120
+ * operator.
6121
+ *
6122
+ * **Idempotency**
6123
+ * - First opt-out → success.
6124
+ * - Second opt-out → non-zero `errCode` ("Already opted out").
6125
+ * - Opt-out of a never-joined jackpot → typically succeeds silently
6126
+ * (no registration row to act on).
6127
+ *
6128
+ * **Refresh after success**
6129
+ * - The SDK clears the template, pot, and winners caches.
6130
+ * - The next {@link jackpotGet} call returns `is_opted_in: false` for this
6131
+ * template and a decremented `registration_count`.
5496
6132
  *
6133
+ * **Side effects**
6134
+ * Fires a `JACKPOT_OPT_OUT` engagement event for operator-side automation
6135
+ * rules. The user's existing contributions to the current pot remain in
6136
+ * place — opt-out stops future contributions but does not refund past ones.
6137
+ *
6138
+ * **Visitor mode**: not supported.
6139
+ *
6140
+ * **UI guidance**: see [UI Guide — `jackpotOptOut`](../../docs/ui/jackpots/UIGuide_jackpotOptOut.md).
6141
+ *
6142
+ * @param filter.jp_template_id ID of the jackpot template to leave.
6143
+ * @returns {@link JackpotsOptoutResponse} — `errCode === 0` on success.
6144
+ *
6145
+ * @example
6146
+ * ```ts
6147
+ * const r = await window._smartico.api.jackpotOptOut({ jp_template_id: 42 });
6148
+ *
6149
+ * if (r.errCode === 0) {
6150
+ * console.log('[smartico] opted out — refresh jackpot card to show join CTA');
6151
+ * } else {
6152
+ * console.error('[smartico] opt-out failed — show this message in an error toast:', r.errMsg);
6153
+ * }
6154
+ * ```
5497
6155
  */
5498
6156
  ;
5499
6157
  _proto.jackpotOptOut = function jackpotOptOut(filter) {
@@ -5508,25 +6166,64 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5508
6166
  }
5509
6167
  }
5510
6168
  /**
5511
- * Returns jackpot winners for the given `jp_template_id` (paginated on the server).
5512
- * Default page size on the wire is 20; use `limit`, `offset`, and repeated calls to load more.
5513
- * The full protocol response also includes `has_more`; this method returns only the `winners` array.
6169
+ * Returns past winners of a specific jackpot template, paginated. Use to
6170
+ * power a "Recent winners" panel inside the jackpot detail modal.
5514
6171
  *
5515
- * **Example**:
5516
- * ```
5517
- * _smartico.api.getJackpotWinners({
5518
- * jp_template_id: 123,
5519
- * }).then((result) => {
5520
- * console.log(result);
5521
- * });
5522
- * ```
6172
+ * **Important**: respect the `expose_winners_over_api` flag on the jackpot's
6173
+ * {@link JackpotDetails} before calling this method. The server-side handler
6174
+ * does NOT enforce that flag — it is a UI-only gate. Custom UIs that ignore
6175
+ * the flag will display winners the operator intended to keep private.
5523
6176
  *
5524
- * **Visitor mode: not supported**
6177
+ * @remarks
6178
+ * **Preconditions**
6179
+ * - User must be authenticated. Visitor mode not supported.
6180
+ * - `jp_template_id` is mandatory — the SDK throws synchronously if missing.
6181
+ * - The consumer SHOULD check
6182
+ * {@link JackpotDetails.expose_winners_over_api} before calling, since
6183
+ * the server does not enforce it.
6184
+ *
6185
+ * **Pagination**
6186
+ * Server default page size is 20. Pass `limit` and `offset` to paginate
6187
+ * (e.g. infinite-scroll). The wire response carries a `has_more` flag, but
6188
+ * this SDK method returns only the `winners` array — detect end-of-list by
6189
+ * a returned array shorter than `limit`.
6190
+ *
6191
+ * **Currency caveat**
6192
+ * Winner amounts in the response (`winner.winning_amount_jp_currency`) are
6193
+ * in the jackpot's NATIVE currency, NOT the user's wallet currency. If a
6194
+ * user-currency display is needed, the consumer must convert client-side.
6195
+ *
6196
+ * **Refresh**
6197
+ * - The SDK caches per `jp_template_id` for 30 seconds.
6198
+ * - Caches clear on jackpot-win push events and on opt-in / opt-out.
6199
+ *
6200
+ * **Error handling**
6201
+ * Non-zero `errCode` on control-group users or generic server errors. The
6202
+ * SDK does NOT enumerate distinct codes — branch on `errCode === 0` and
6203
+ * surface `errMsg` on failure.
6204
+ *
6205
+ * **Visitor mode**: not supported.
6206
+ *
6207
+ * **UI guidance**: see [UI Guide — `getJackpotWinners`](../../docs/ui/jackpots/UIGuide_getJackpotWinners.md).
6208
+ *
6209
+ * @returns Array of {@link JackpotWinnerHistory} entries newest-first.
6210
+ *
6211
+ * @example
6212
+ * ```ts
6213
+ * const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
6214
+ *
6215
+ * if (!jp || !jp.expose_winners_over_api) {
6216
+ * console.log('[smartico] winners hidden by operator config — hide the winners tab');
6217
+ * return;
6218
+ * }
5525
6219
  *
5526
- * @param params - Jackpot winners parameters
5527
- * @param params.jp_template_id - Jackpot template id (required; throws if missing)
5528
- * @param params.limit - Page size (server default 20 when omitted)
5529
- * @param params.offset - Offset into the winner list
6220
+ * const winners = await window._smartico.api.getJackpotWinners({
6221
+ * jp_template_id: 42,
6222
+ * limit: 20,
6223
+ * offset: 0,
6224
+ * });
6225
+ * console.log('[smartico] render', winners.length, 'recent winner rows (amounts in', jp.jp_currency + ')');
6226
+ * ```
5530
6227
  */
5531
6228
  ;
5532
6229
  _proto.getJackpotWinners = function getJackpotWinners(_ref) {
@@ -5543,29 +6240,67 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5543
6240
  }
5544
6241
  }
5545
6242
  /**
5546
- * Returns the eligible games for the jackpot with the specified jp_template_id.
6243
+ * Returns the casino games eligible to contribute to a specific jackpot —
6244
+ * the catalog the user must play to grow the pot. Use to power an
6245
+ * "Eligible games" carousel inside the jackpot detail modal.
5547
6246
  *
5548
- * **Example**:
5549
- * ```
5550
- * _smartico.api.getJackpotEligibleGames({ jp_template_id: 123 }).then((result) => {
5551
- * console.log(result);
5552
- * });
5553
- * ```
6247
+ * **Shortcut**: when the jackpot's
6248
+ * {@link JackpotDetails.ach_related_game_allow_all} flag is `true`, every
6249
+ * game in the operator catalog contributes — there's no point calling this
6250
+ * method (the result would be the full catalog). The default Smartico UI
6251
+ * hides the Eligible Games tab entirely in that case.
5554
6252
  *
5555
- * **Visitor mode: not supported**
6253
+ * @remarks
6254
+ * **Preconditions**
6255
+ * - User must be authenticated. Visitor mode not supported.
6256
+ * - `jp_template_id` is mandatory.
5556
6257
  *
5557
- */
5558
- ;
5559
- _proto.getJackpotEligibleGames = function getJackpotEligibleGames(_ref2) {
5560
- var jp_template_id = _ref2.jp_template_id,
5561
- onUpdate = _ref2.onUpdate;
5562
- try {
5563
- var _this6 = this;
5564
- if (onUpdate) {
5565
- _this6.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
5566
- }
5567
- return Promise.resolve(OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, exports.ECacheContext.WSAPI, function () {
5568
- return _this6.api.getJackpotEligibleGamesT(_this6.userExtId, {
6258
+ * **`onUpdate` caveat**
6259
+ * The `onUpdate` callback is accepted to match the SDK's subscription
6260
+ * contract but is NOT auto-invoked by any current server push. It will only
6261
+ * fire if a consumer (or a future SDK version) explicitly pushes an update.
6262
+ * Treat it as a no-op for now.
6263
+ *
6264
+ * **Refresh**
6265
+ * - The SDK caches per `jp_template_id` for 30 seconds.
6266
+ * - Cache does NOT clear on opt-in / opt-out / jackpot-win — eligible-game
6267
+ * lists rarely change during a session. Wait for the 30 s TTL.
6268
+ *
6269
+ * **Error handling**
6270
+ * Non-zero `errCode` on control-group users or generic server errors.
6271
+ * Branch on `errCode === 0` and surface `errMsg` on failure.
6272
+ *
6273
+ * **Visitor mode**: not supported.
6274
+ *
6275
+ * **UI guidance**: see [UI Guide — `getJackpotEligibleGames`](../../docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md).
6276
+ *
6277
+ * @returns {@link TGetJackpotEligibleGamesResponse} —
6278
+ * `{ eligible_games: JackpotEligibleGame[] }`.
6279
+ *
6280
+ * @example
6281
+ * ```ts
6282
+ * const [jp] = await window._smartico.api.jackpotGet({ jp_template_id: 42 });
6283
+ *
6284
+ * if (jp?.ach_related_game_allow_all) {
6285
+ * console.log('[smartico] all games eligible — hide the eligible-games tab');
6286
+ * return;
6287
+ * }
6288
+ *
6289
+ * const r = await window._smartico.api.getJackpotEligibleGames({ jp_template_id: 42 });
6290
+ * console.log('[smartico] render', r.eligible_games.length, 'eligible game tiles');
6291
+ * ```
6292
+ */
6293
+ ;
6294
+ _proto.getJackpotEligibleGames = function getJackpotEligibleGames(_ref2) {
6295
+ var jp_template_id = _ref2.jp_template_id,
6296
+ onUpdate = _ref2.onUpdate;
6297
+ try {
6298
+ var _this6 = this;
6299
+ if (onUpdate) {
6300
+ _this6.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
6301
+ }
6302
+ return Promise.resolve(OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, exports.ECacheContext.WSAPI, function () {
6303
+ return _this6.api.getJackpotEligibleGamesT(_this6.userExtId, {
5569
6304
  jp_template_id: jp_template_id
5570
6305
  });
5571
6306
  }, JACKPOT_ELIGIBLE_GAMES_CACHE_SEC));
@@ -5594,26 +6329,112 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5594
6329
  }
5595
6330
  }
5596
6331
  /**
5597
- * Returns the list of Raffles available for user
5598
- * The returned list of Raffles is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getRaffles with a new onUpdate callback, the old one will be overwritten by the new one.
5599
- * The onUpdate callback will be called on claiming prize. Updated Raffles will be passed to onUpdate callback.
6332
+ * Returns all raffles visible to the current user, each carrying an
6333
+ * embedded `draws[]` array with per-draw state (current state, ticket
6334
+ * counts, opt-in status, prize structure). Use this to power a
6335
+ * raffles lobby screen and to drive per-draw CTAs (opt-in, view
6336
+ * winners, claim).
6337
+ *
6338
+ * The embedded `draws[i]` objects are sufficient for rendering all
6339
+ * draw cards — winner details with usernames / avatars require a
6340
+ * follow-up {@link getRaffleDrawRun} call (the embedded form carries
6341
+ * only `winners_total` / `winners_limit` / `winners_offset` metadata,
6342
+ * not individual winner rows).
5600
6343
  *
5601
- * **Example**:
6344
+ * @remarks
6345
+ * **Subscription model (`onUpdate`)**
6346
+ * The callback receives the FULL refreshed raffle list (never a
6347
+ * diff/patch). Each subsequent call to `getRaffles({ onUpdate })`
6348
+ * REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
6349
+ * it) to keep the prior callback in place; the callback is never
6350
+ * auto-cleared.
5602
6351
  *
5603
- * ```
5604
- * _smartico.api.getRaffles().then((result) => {
5605
- * console.log(result);
5606
- * });
5607
- * ```
6352
+ * **Update triggers** — the callback fires when:
5608
6353
  *
5609
- * **Example in the Visitor mode**:
6354
+ * 1. {@link claimRafflePrize} resolves on this connection (any
6355
+ * response code) — the refreshed list reflects the new
6356
+ * `has_unclaimed_prize` / `claimed_date` state.
6357
+ * 2. {@link requestRaffleOptin} resolves on this connection (any
6358
+ * response code) — the refreshed list reflects the new
6359
+ * `user_opted_in` state on the affected draw.
6360
+ *
6361
+ * Does NOT fire for: server-side draw executions, ticket increments
6362
+ * (other users earning tickets), or operator-side raffle/draw config
6363
+ * changes. Those changes surface only on the next cache miss (after
6364
+ * the 30 s TTL) — poll manually if your UI needs sub-30s freshness
6365
+ * during an in-progress draw.
6366
+ *
6367
+ * **Reading state from the returned raffle**
6368
+ * - `current_tickets_count` vs `max_tickets_count` drives the
6369
+ * `ticket_cap_visualization` banner (enum
6370
+ * {@link RaffleTicketCapVisualization}: `Empty` = no banner,
6371
+ * `Counter` = show "X tickets remaining", `Message` = show
6372
+ * sold-out message).
6373
+ * - Within each draw, `current_state`
6374
+ * ({@link RaffleDrawInstanceState}) buckets the draw into Open
6375
+ * (accepting tickets), WinnerSelection (currently drawing), or
6376
+ * Executed (winners selected).
6377
+ * - `execution_type` ({@link RaffleDrawTypeExecution}) distinguishes
6378
+ * one-shot (`ExecDate`), repeating (`Recurring`), or special
6379
+ * one-shot (`Grand`) draws. Recurring draws share a stable
6380
+ * `draws[i].id` (the schedule definition) across runs — `run_id`
6381
+ * is the per-execution instance.
5610
6382
  *
5611
- * ```
5612
- * _smartico.vapi('EN').getRaffles().then((result) => {
5613
- * console.log(result);
6383
+ * **Cache TTL**: the SDK caches the response for 30 seconds. Cache
6384
+ * is fully cleared on login / logout. The server also invalidates
6385
+ * the SDK cache when a draw executes on the server side.
6386
+ *
6387
+ * **Idempotency / Side effects**: safe. Read-only.
6388
+ *
6389
+ * **UI guidance**: see [UI Guide — `getRaffles`](../../docs/ui/raffles/UIGuide_getRaffles.md).
6390
+ *
6391
+ * **Visitor mode**: supported. The same shape is returned, scoped
6392
+ * to the brand's public raffles. Per-user fields (`my_tickets_count`,
6393
+ * `my_last_tickets`, `user_opted_in`) are not meaningful for
6394
+ * visitors. The `onUpdate` callback is accepted but never fires
6395
+ * because the mutation methods that trigger it
6396
+ * ({@link claimRafflePrize}, {@link requestRaffleOptin}) are not
6397
+ * available / not effective in visitor mode.
6398
+ *
6399
+ * @param params Optional. Omit to fetch without subscribing.
6400
+ * @param params.onUpdate Callback invoked with the full refreshed
6401
+ * raffles list after every
6402
+ * {@link claimRafflePrize} or
6403
+ * {@link requestRaffleOptin} round-trip
6404
+ * on this connection.
6405
+ * @returns Promise resolving to the raffles list.
6406
+ *
6407
+ * @example
6408
+ * ```ts
6409
+ * const raffles = await window._smartico.api.getRaffles({
6410
+ * onUpdate: (refreshed) => {
6411
+ * console.log('[smartico] raffles refreshed (after claim/optin) — re-render from this array:', refreshed);
6412
+ * },
5614
6413
  * });
5615
- * ```
5616
6414
  *
6415
+ * for (const raffle of raffles) {
6416
+ * console.log('[smartico] render raffle', raffle.id, '—', raffle.name, ':', raffle.draws.length, 'draws');
6417
+ *
6418
+ * // Bucket draws: active/upcoming first (sorted by execution_ts ASC), then executed last.
6419
+ * const sorted = [...raffle.draws].sort((a, b) => {
6420
+ * const aDone = a.current_state === 3; // Executed
6421
+ * const bDone = b.current_state === 3;
6422
+ * if (aDone !== bDone) return aDone ? 1 : -1; // executed sink to the bottom
6423
+ * return a.execution_ts - b.execution_ts;
6424
+ * });
6425
+ *
6426
+ * for (const d of sorted) {
6427
+ * if (d.requires_optin && !d.user_opted_in && d.is_active && d.current_state !== 3) {
6428
+ * console.log('[smartico] draw', d.run_id, '— show OPT IN CTA (requires_optin + not yet opted in + still active)');
6429
+ * }
6430
+ * if (d.current_state === 3) {
6431
+ * console.log('[smartico] draw', d.run_id, 'executed — fetch winner details via getRaffleDrawRun');
6432
+ * }
6433
+ * }
6434
+ * }
6435
+ *
6436
+ * // For winner detail on an executed draw, call getRaffleDrawRun separately.
6437
+ * ```
5617
6438
  */
5618
6439
  ;
5619
6440
  _proto.getRaffles = function getRaffles(_temp) {
@@ -5632,27 +6453,106 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5632
6453
  }
5633
6454
  }
5634
6455
  /**
5635
- * Returns draw run for provided raffle_id and run_id.
5636
- * You can pass winners_from and winners_to parameters to get a specific range of winners. Default is 0-20.
6456
+ * Returns the full detail of a single raffle draw run — same shape
6457
+ * as the embedded `TRaffleDraw` in {@link getRaffles}, but populated
6458
+ * with paginated `prizes[].winners[]` rows including usernames and
6459
+ * avatars. Use this to render a draw detail / winners screen, or to
6460
+ * page through the winner list of an executed draw.
5637
6461
  *
6462
+ * Each call is a fresh server round-trip — there is no client cache.
6463
+ * Re-call to refresh.
5638
6464
  *
5639
- * **Example**:
6465
+ * @remarks
6466
+ * **Preconditions**
6467
+ * Pass `raffle_id` (the parent raffle's `id`) and `run_id` (the
6468
+ * specific run instance — `TRaffleDraw.run_id` from
6469
+ * {@link getRaffles}'s embedded draws). Note that
6470
+ * `TRaffleDraw.id` is the *schedule_id* (stable across runs of a
6471
+ * recurring draw) — that's NOT what this method takes; it takes the
6472
+ * per-instance `run_id`.
5640
6473
  *
5641
- * ```javascript
5642
- * _smartico.api.getRaffleDrawRun({raffle_id: 156, run_id: 145}).then((result) => {
5643
- * console.log(result);
5644
- * });
5645
- * ```
6474
+ * **Refresh model**
6475
+ * - **No subscription.** One-shot promise.
6476
+ * - **No client cache.** Every call sends a network request.
6477
+ * - **No push event** refreshes the response. Live winner-list
6478
+ * updates require a fresh call.
6479
+ * - The default Smartico UI polls this method on a variable cadence
6480
+ * while a draw is in flight: every 3 s during `WinnerSelection`,
6481
+ * every 10 s when the countdown is under 5 minutes, every 30 s
6482
+ * otherwise.
6483
+ *
6484
+ * **Winner pagination**
6485
+ * `winners_from` / `winners_to` define a half-open range of winner
6486
+ * indices. The default window is `0–20` (20 winners). The server
6487
+ * caps the window at 50 rows per call — passing a larger range
6488
+ * silently truncates. For "load more" pagination, advance
6489
+ * `winners_from` by the prior page size and pass the same
6490
+ * `winners_to` offset. `winners_total` on the returned
6491
+ * `TRaffleDraw` is the authoritative total count for pagination.
6492
+ *
6493
+ * The current user's own winning rows (if any) are server-sorted
6494
+ * to the top of the result.
6495
+ *
6496
+ * **Throws**
6497
+ * Both `raffle_id` and `run_id` are required — the SDK throws
6498
+ * synchronously when either is missing or falsy.
6499
+ *
6500
+ * **Idempotency / Side effects**: safe. Read-only.
6501
+ *
6502
+ * **UI guidance**: see [UI Guide — `getRaffleDrawRun`](../../docs/ui/raffles/UIGuide_getRaffleDrawRun.md).
6503
+ *
6504
+ * **Visitor mode**: supported.
6505
+ *
6506
+ * @param props.raffle_id The parent raffle's `id` (from `TRaffle.id`).
6507
+ * @param props.run_id The draw run instance ID (from
6508
+ * `TRaffleDraw.run_id`, not `TRaffleDraw.id`).
6509
+ * @param props.winners_from First winner index to return (0-based).
6510
+ * Defaults to `0`.
6511
+ * @param props.winners_to Last winner index (exclusive).
6512
+ * Defaults to `20`. Server caps the
6513
+ * window at 50 rows per call.
6514
+ * @returns Promise resolving to `TRaffleDraw`
6515
+ * with `prizes[].winners[]` populated
6516
+ * and `winners_total` set.
5646
6517
  *
5647
- * **Example in the Visitor mode**:
6518
+ * @example
6519
+ * ```ts
6520
+ * const raffles = await window._smartico.api.getRaffles();
6521
+ * const raffle = raffles[0];
6522
+ * const draw = raffle.draws.find(d => d.current_state === 3); // Executed
5648
6523
  *
6524
+ * if (!draw) {
6525
+ * console.log('[smartico] no executed draw — skip detail view');
6526
+ * return;
6527
+ * }
5649
6528
  *
5650
- * ```javascript
5651
- * _smartico.vapi('EN').getRaffleDrawRun({ raffle_id: 156, run_id: 145 }).then((result) => {
5652
- * console.log(result);
6529
+ * // First page of winners.
6530
+ * const detail = await window._smartico.api.getRaffleDrawRun({
6531
+ * raffle_id: raffle.id,
6532
+ * run_id: draw.run_id, // NOTE: run_id, NOT draw.id
6533
+ * winners_from: 0,
6534
+ * winners_to: 20,
5653
6535
  * });
5654
- * ```
5655
6536
  *
6537
+ * for (const prize of detail.prizes) {
6538
+ * console.log('[smartico] prize', prize.name, '— winners on this page:', prize.winners.length);
6539
+ * const myWin = prize.winners.find(w => w.username === currentUsername); // or another match
6540
+ * if (myWin) {
6541
+ * console.log('[smartico] current user won this prize — surface a Claim CTA if not yet claimed');
6542
+ * }
6543
+ * }
6544
+ *
6545
+ * // Load more — pagination via winners_from / winners_to.
6546
+ * if ((detail.winners_total ?? 0) > 20) {
6547
+ * const next = await window._smartico.api.getRaffleDrawRun({
6548
+ * raffle_id: raffle.id,
6549
+ * run_id: draw.run_id,
6550
+ * winners_from: 20,
6551
+ * winners_to: 40,
6552
+ * });
6553
+ * console.log('[smartico] page 2 loaded — append', next.prizes.flatMap(p => p.winners).length, 'winners');
6554
+ * }
6555
+ * ```
5656
6556
  */
5657
6557
  ;
5658
6558
  _proto.getRaffleDrawRun = function getRaffleDrawRun(props) {
@@ -5667,25 +6567,76 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5667
6567
  }
5668
6568
  }
5669
6569
  /**
5670
- * Returns history of draw runs for the provided raffle_id and draw_id, if the draw_id is not provided will return history of all the draws for the provided raffle_id
6570
+ * Returns the history of past-executed draw runs for a raffle —
6571
+ * optionally scoped to a single recurring draw schedule. Each row
6572
+ * is a previously-executed run with its scheduled and
6573
+ * actual-execution timestamps, the user's win status, and an
6574
+ * unclaimed-prize flag for surfacing a Claim CTA on history rows.
6575
+ *
6576
+ * @remarks
6577
+ * **Preconditions**
6578
+ * `raffle_id` is required. `draw_id` is optional — when omitted,
6579
+ * the response includes history for ALL draws of the raffle; when
6580
+ * supplied, it scopes to that one draw's recurring history. The
6581
+ * `draw_id` to pass is `TRaffleDraw.id` (the schedule_id, stable
6582
+ * across runs), not `run_id`.
6583
+ *
6584
+ * **Server-side filtering**
6585
+ * Draws configured by the operator to hide their history are
6586
+ * excluded from the response automatically. Cancelled runs are
6587
+ * also excluded.
6588
+ *
6589
+ * **Sort order**
6590
+ * Server returns rows by scheduled `execution_ts` descending
6591
+ * (newest first). No client-side sort required.
6592
+ *
6593
+ * **Refresh model**
6594
+ * - **No subscription.** One-shot promise.
6595
+ * - **No client cache.** Every call hits the server.
6596
+ * - **No push event** refreshes the response. Re-call manually to
6597
+ * pick up newly-executed runs or `has_unclaimed_prize` flips
6598
+ * after a {@link claimRafflePrize} call.
6599
+ *
6600
+ * **Idempotency / Side effects**: safe. Read-only.
6601
+ *
6602
+ * **UI guidance**: see [UI Guide — `getRaffleDrawRunsHistory`](../../docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md).
5671
6603
  *
6604
+ * **Visitor mode**: supported. The same shape is returned with
6605
+ * `is_winner` and `has_unclaimed_prize` always `false` for visitors.
5672
6606
  *
5673
- * **Example**:
6607
+ * @param props.raffle_id The parent raffle's `id` (from `TRaffle.id`).
6608
+ * Required.
6609
+ * @param props.draw_id Optional — the draw's schedule_id
6610
+ * (`TRaffleDraw.id`). When set, scopes the
6611
+ * history to that one draw's runs. When
6612
+ * omitted, includes all draws of the raffle.
6613
+ * @returns Promise resolving to a `TRaffleDrawRun[]`
6614
+ * ordered newest-first. Empty if no executed
6615
+ * runs exist.
5674
6616
  *
5675
- * ```javascript
5676
- * _smartico.api.getRaffleDrawRunsHistory({ raffle_id: 156, draw_id: 432 }).then((result) => {
5677
- * console.log(result);
6617
+ * @example
6618
+ * ```ts
6619
+ * const raffles = await window._smartico.api.getRaffles();
6620
+ * const raffle = raffles[0];
6621
+ *
6622
+ * // History across all draws of the raffle.
6623
+ * const allHistory = await window._smartico.api.getRaffleDrawRunsHistory({
6624
+ * raffle_id: raffle.id,
5678
6625
  * });
5679
- * ```
5680
6626
  *
5681
- * **Example in the Visitor mode**:
6627
+ * // Highlight rows where the user has an unclaimed prize.
6628
+ * const unclaimed = allHistory.filter(r => r.has_unclaimed_prize);
6629
+ * if (unclaimed.length > 0) {
6630
+ * console.log('[smartico] surface a "Claim" CTA on these', unclaimed.length, 'history rows:', unclaimed.map(r => r.run_id));
6631
+ * }
5682
6632
  *
5683
- * ```javascript
5684
- * _smartico.vapi('EN').getRaffleDrawRunsHistory({ raffle_id: 156, draw_id: 432 }).then((result) => {
5685
- * console.log(result);
6633
+ * // Scoped history of one recurring draw (use draw.id, the schedule_id).
6634
+ * const oneDrawHistory = await window._smartico.api.getRaffleDrawRunsHistory({
6635
+ * raffle_id: raffle.id,
6636
+ * draw_id: raffle.draws[0].id, // schedule_id (stable across recurring runs)
5686
6637
  * });
6638
+ * console.log('[smartico] render history rows for the daily draw — newest first:', oneDrawHistory.length, 'rows');
5687
6639
  * ```
5688
- *
5689
6640
  */
5690
6641
  ;
5691
6642
  _proto.getRaffleDrawRunsHistory = function getRaffleDrawRunsHistory(props) {
@@ -5702,25 +6653,113 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5702
6653
  }
5703
6654
  }
5704
6655
  /**
5705
- * Returns `err_code` and `err_message` after the call; `err_code` 0 means the request succeeded.
6656
+ * Claims a raffle prize the user has won. Call this when the user
6657
+ * has a winning row with `should_claim === true` and an unclaimed
6658
+ * `won_id` (read from a `TRafflePrizeWinner` on a
6659
+ * {@link getRaffleDrawRun} result, or surfaced by `has_unclaimed_prize`
6660
+ * on a {@link getRaffleDrawRunsHistory} row that the consumer drills
6661
+ * into).
5706
6662
  *
6663
+ * On success (`errorCode === 0`), the server records the claim and
6664
+ * triggers prize delivery through the operator's integration —
6665
+ * delivery is server-side, not part of this response.
5707
6666
  *
5708
- * **Example**:
6667
+ * @remarks
6668
+ * **Result shape note**: this method returns
6669
+ * `TransformedRaffleClaimPrizeResponse` with `errorCode` /
6670
+ * `errorMessage` (camelCase full-word) — different from most other
6671
+ * SDK result types which use `err_code` / `err_message` (snake_case
6672
+ * short-word). Branch on the camelCase keys when reading this
6673
+ * method's result.
5709
6674
  *
5710
- * ```javascript
5711
- * _smartico.api.claimRafflePrize({won_id:251}).then((result) => {
5712
- * console.log(result);
5713
- * });
5714
- * ```
6675
+ * **Preconditions**
6676
+ * Pass a `won_id` that identifies an unclaimed winning row for the
6677
+ * current user. The `won_id` comes from
6678
+ * `TRafflePrizeWinner.raf_won_id` returned by
6679
+ * {@link getRaffleDrawRun}.
6680
+ *
6681
+ * **Error codes** (in `errorCode`)
6682
+ * - `0` — success; the claim is recorded and prize delivery is
6683
+ * queued server-side.
6684
+ * - `1` — generic claim failure. The `errorMessage` distinguishes
6685
+ * the specific cause (the server uses one error code for several
6686
+ * distinct conditions): the prize has already been claimed, the
6687
+ * `won_id` doesn't match a winning row for this user, or the user
6688
+ * is in a control group for this raffle. Treat `1` as a retryable
6689
+ * error if the message suggests a transient condition; treat as
6690
+ * idempotent success if the message indicates already-claimed
6691
+ * (the underlying state is what the consumer wants either way —
6692
+ * the prize is claimed).
6693
+ * - other non-zero — generic server error. Surface `errorMessage`
6694
+ * if any.
6695
+ *
6696
+ * **Claim window**
6697
+ * There is no server-enforced claim deadline. Won prizes remain
6698
+ * claimable indefinitely until the operator archives them.
6699
+ *
6700
+ * **Idempotency**: NOT idempotent. A second call on the same
6701
+ * `won_id` returns `errorCode === 1` with `errorMessage` indicating
6702
+ * the prize has already been claimed. The SDK does NOT enforce an
6703
+ * in-flight lock. Guard the call site against double-clicks (set
6704
+ * a local "claiming" flag on click, clear it on response).
5715
6705
  *
5716
- * **Example in the Visitor mode**:
6706
+ * **Refresh after success (and after failure)**
6707
+ * The SDK automatically refreshes the raffles cache on every
6708
+ * response — both success and failure paths fire the `onUpdate`
6709
+ * callback registered via {@link getRaffles}. After `errorCode === 0`,
6710
+ * the affected `TRaffleDrawRun.has_unclaimed_prize` (in history)
6711
+ * and the winner row's `claimed_date` reflect the claim on the next
6712
+ * refresh.
6713
+ *
6714
+ * **Side effects** (on `errorCode === 0`)
6715
+ * - The winner row's `claimed_date` is set server-side.
6716
+ * - Prize delivery is queued for the operator's integration to
6717
+ * process. Balance / bonus / inbox updates that result from the
6718
+ * delivery arrive through their own channels — not in this
6719
+ * response.
6720
+ *
6721
+ * **Throws**
6722
+ * `won_id` is required — the SDK throws synchronously when missing
6723
+ * or falsy.
6724
+ *
6725
+ * **UI guidance**: see [UI Guide — `claimRafflePrize`](../../docs/ui/raffles/UIGuide_claimRafflePrize.md).
6726
+ *
6727
+ * **Visitor mode**: not meaningfully supported. The SDK does not
6728
+ * block the call, but visitor sessions have no win history and the
6729
+ * server will reject it.
6730
+ *
6731
+ * @param props.won_id The winning row's `raf_won_id` (from
6732
+ * `TRafflePrizeWinner` returned by
6733
+ * {@link getRaffleDrawRun}).
6734
+ * @returns `{ errorCode, errorMessage? }`; success when
6735
+ * `errorCode === 0`. Note camelCase keys (see "Result
6736
+ * shape note" above).
5717
6737
  *
5718
- * ```javascript
5719
- * _smartico.vapi('EN').claimRafflePrize({ won_id: 251 }).then((result) => {
5720
- * console.log(result);
6738
+ * @example
6739
+ * ```ts
6740
+ * const detail = await window._smartico.api.getRaffleDrawRun({
6741
+ * raffle_id: raffleId,
6742
+ * run_id: runId,
5721
6743
  * });
5722
- * ```
6744
+ * const myWin = detail.prizes.flatMap(p => p.winners).find(w => /* user match here *\/ true);
5723
6745
  *
6746
+ * if (!myWin || !myWin.raf_won_id || myWin.claimed_date) {
6747
+ * console.log('[smartico] nothing to claim — keep CTA hidden');
6748
+ * return;
6749
+ * }
6750
+ *
6751
+ * console.log('[smartico] claim starting — set in-flight flag, show loading dots on the Claim button, keep the modal open');
6752
+ * const r = await window._smartico.api.claimRafflePrize({ won_id: myWin.raf_won_id });
6753
+ * console.log('[smartico] claim response received — clear in-flight flag');
6754
+ *
6755
+ * if (r.errorCode === 0) {
6756
+ * console.log('[smartico] claim succeeded — show a success toast; getRaffles onUpdate above will fire with refreshed state; prize delivery happens server-side');
6757
+ * } else if (r.errorCode === 1 && r.errorMessage?.toLowerCase().includes('already claimed')) {
6758
+ * console.log('[smartico] prize was already claimed (perhaps from another tab) — treat as success, hide the Claim CTA');
6759
+ * } else {
6760
+ * console.error('[smartico] claim failed — surface this error message to the user and allow retry:', r.errorMessage);
6761
+ * }
6762
+ * ```
5724
6763
  */
5725
6764
  ;
5726
6765
  _proto.claimRafflePrize = function claimRafflePrize(props) {
@@ -5737,9 +6776,104 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5737
6776
  }
5738
6777
  }
5739
6778
  /**
5740
- * Requests an opt-in for the specified raffle. Returns the err_code.
6779
+ * Opts the current user into a specific raffle draw run. Required
6780
+ * for draws where `TRaffleDraw.requires_optin === true` — without
6781
+ * opt-in, the user's tickets do NOT participate in that run, even
6782
+ * if they hold tickets for the raffle.
5741
6783
  *
5742
- * **Visitor mode: not supported**
6784
+ * Opt-in is per-run: a recurring draw's next run requires a fresh
6785
+ * opt-in. The user's `TRaffleDraw.user_opted_in` flag reflects the
6786
+ * current state for the current run only.
6787
+ *
6788
+ * @remarks
6789
+ * **Preconditions**
6790
+ * Read the candidate draw from {@link getRaffles}'s embedded
6791
+ * `draws[]` and gate the call on
6792
+ * `requires_optin === true && !user_opted_in && is_active &&
6793
+ * current_state !== Executed`. Calling without these guards may
6794
+ * return a non-zero `err_code`.
6795
+ *
6796
+ * **Argument mapping** — the three IDs come from different fields:
6797
+ * - `raffle_id` — the parent raffle's `TRaffle.id`
6798
+ * - `draw_id` — `TRaffleDraw.id` (schedule_id, stable across runs)
6799
+ * - `raffle_run_id` — `TRaffleDraw.run_id` (instance ID for this
6800
+ * specific run)
6801
+ *
6802
+ * **Error codes** (in `err_code`)
6803
+ * - `0` — success; the user is opted into this run. Tickets
6804
+ * collected after the run's `ticket_start_ts` will participate.
6805
+ * - `1` — generic opt-in failure. The `err_message` distinguishes
6806
+ * the specific cause: the draw doesn't require opt-in
6807
+ * (`requires_optin === false`), `raffle_id` doesn't match the
6808
+ * `draw_id`, the user is already opted in (or the draw has
6809
+ * completed), or the user is in a control group for this raffle.
6810
+ * - other non-zero — generic server error. Surface `err_message`.
6811
+ *
6812
+ * **Idempotency**: NOT idempotent. A second call on the same
6813
+ * `raffle_run_id` returns `err_code === 1` with `err_message`
6814
+ * indicating the user is already opted in. Treat as success in
6815
+ * the UI — the underlying state is what the consumer wants.
6816
+ * Guard the call site against double-clicks.
6817
+ *
6818
+ * **Refresh after success (and after failure)**
6819
+ * The SDK automatically refreshes the raffles cache on every
6820
+ * response and fires the `onUpdate` callback registered via
6821
+ * {@link getRaffles}. After `err_code === 0`, the affected draw's
6822
+ * `user_opted_in` flips to `true` on the refreshed list.
6823
+ *
6824
+ * **Side effects** (on `err_code === 0`)
6825
+ * - The user is registered for this run. Tickets earned within
6826
+ * the run's eligibility window will participate in the draw.
6827
+ * - No balance change. No CRM-side rewards. Opt-in is a metadata
6828
+ * operation only.
6829
+ *
6830
+ * **Throws**
6831
+ * `raffle_id`, `draw_id`, and `raffle_run_id` are all required —
6832
+ * the SDK throws synchronously when any is missing or falsy.
6833
+ *
6834
+ * **UI guidance**: see [UI Guide — `requestRaffleOptin`](../../docs/ui/raffles/UIGuide_requestRaffleOptin.md).
6835
+ *
6836
+ * **Visitor mode**: not supported.
6837
+ *
6838
+ * @param props.raffle_id The parent raffle's `id`.
6839
+ * @param props.draw_id The draw's schedule_id (`TRaffleDraw.id`).
6840
+ * @param props.raffle_run_id The run instance ID (`TRaffleDraw.run_id`).
6841
+ * @returns `{ err_code, err_message? }`; success
6842
+ * when `err_code === 0` (treat
6843
+ * "already opted in" as idempotent
6844
+ * success).
6845
+ *
6846
+ * @example
6847
+ * ```ts
6848
+ * const raffles = await window._smartico.api.getRaffles({
6849
+ * onUpdate: (refreshed) => console.log('[smartico] raffles refreshed — re-render', refreshed),
6850
+ * });
6851
+ * const raffle = raffles[0];
6852
+ * const draw = raffle.draws.find(d =>
6853
+ * d.requires_optin && !d.user_opted_in && d.is_active && d.current_state !== 3
6854
+ * );
6855
+ *
6856
+ * if (!draw) {
6857
+ * console.log('[smartico] no opt-in-required draw available — keep CTA hidden');
6858
+ * return;
6859
+ * }
6860
+ *
6861
+ * console.log('[smartico] opt-in starting — set in-flight flag, show loading dots on the Opt-in button');
6862
+ * const r = await window._smartico.api.requestRaffleOptin({
6863
+ * raffle_id: raffle.id,
6864
+ * draw_id: draw.id, // schedule_id, NOT run_id
6865
+ * raffle_run_id: draw.run_id,
6866
+ * });
6867
+ * console.log('[smartico] opt-in response received — clear in-flight flag');
6868
+ *
6869
+ * if (r.err_code === 0) {
6870
+ * console.log('[smartico] opted in successfully — show "Fully opted in" state on the draw card; onUpdate above will fire with user_opted_in: true');
6871
+ * } else if (r.err_code === 1 && r.err_message?.toLowerCase().includes('already opted in')) {
6872
+ * console.log('[smartico] already opted in (perhaps from another tab) — treat as success, show "Fully opted in"');
6873
+ * } else {
6874
+ * console.error('[smartico] opt-in failed — surface this error to the user:', r.err_message);
6875
+ * }
6876
+ * ```
5743
6877
  */
5744
6878
  ;
5745
6879
  _proto.requestRaffleOptin = function requestRaffleOptin(props) {
@@ -5763,6 +6897,142 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
5763
6897
  } catch (e) {
5764
6898
  return Promise.reject(e);
5765
6899
  }
6900
+ }
6901
+ /**
6902
+ * Returns every prize the current user has won within a single raffle —
6903
+ * across ALL of that raffle's draws, newest-won first — in one paginated
6904
+ * call. Use this to power a "my prizes" screen for a raffle (prize name,
6905
+ * prize image, the user's name/avatar) without walking
6906
+ * {@link getRaffleDrawRunsHistory} and then paging
6907
+ * {@link getRaffleDrawRun}'s per-draw winner lists.
6908
+ *
6909
+ * Each row carries its own `raf_won_id`, which IS the `won_id` to pass to
6910
+ * {@link claimRafflePrize}: a row with `requires_claim === true` and no
6911
+ * `claimed_date` is directly claimable.
6912
+ *
6913
+ * @remarks
6914
+ * **Authentication required**
6915
+ * Works only for an identified (logged-in) user. Visitor / anonymous
6916
+ * sessions are rejected — call this only after identify.
6917
+ *
6918
+ * **Preconditions**
6919
+ * `raffle_id` is required — the SDK throws synchronously when it is
6920
+ * missing or falsy.
6921
+ *
6922
+ * **Coverage & sort order**
6923
+ * Includes the user's wins from every draw of the raffle — recurring,
6924
+ * one-shot, and grand draws, across all historical runs. Rows are ordered
6925
+ * newest-win first; there is no "unclaimed first" ordering, so sort
6926
+ * client-side if you want claimable prizes at the top.
6927
+ *
6928
+ * **Pagination**
6929
+ * `offset` / `limit` page the `won_prizes[]` rows (the SDK defaults to
6930
+ * `0` / `20`). `total` is the authoritative full count of the user's wins
6931
+ * for this raffle across all draws — drive "load more" from it
6932
+ * (`offset + won_prizes.length < total`). An `offset` past the end returns
6933
+ * an empty `won_prizes[]` with the real `total` and `errCode 0` — not an
6934
+ * error. The server does NOT clamp `limit`, so always pass an explicit,
6935
+ * sane page size.
6936
+ *
6937
+ * **Rate limit**
6938
+ * The server caps this at roughly 30 calls per minute with a ~5-second
6939
+ * minimum gap between calls. Fetch on screen open and on explicit "load
6940
+ * more" — don't poll it on a timer.
6941
+ *
6942
+ * **Error codes** (in `errCode`)
6943
+ * - `0` — success. Also returned with an empty `won_prizes[]` and
6944
+ * `total 0` when the user has no wins, or is not eligible to see this
6945
+ * raffle.
6946
+ * - `1` — generic server error; surface `errMsg` if present.
6947
+ *
6948
+ * There are no granular codes — an unknown raffle, an ineligible user,
6949
+ * and "no wins" all surface as `errCode 0` with an empty list.
6950
+ *
6951
+ * **Reading the result**
6952
+ * - Null-check `user` before reading it — it is `null` whenever
6953
+ * `won_prizes` is empty.
6954
+ * - For the avatar, use `user.avatar_id` (already a full URL for a system
6955
+ * avatar, otherwise an avatar token to resolve against the widget's
6956
+ * avatar domain); `user.avatar_url` is always `null`.
6957
+ * - Render `public_username` as-is (it is server-masked for privacy, e.g.
6958
+ * `"32:r*****"`) and substitute a "You" label for the current user.
6959
+ * - Treat `claimed_date` as the claim flag: `null` until claimed, then
6960
+ * epoch ms.
6961
+ *
6962
+ * **Idempotency / Side effects**: safe and read-only — one-shot promise,
6963
+ * no client cache, no subscription. The server caches the response
6964
+ * briefly; a successful {@link claimRafflePrize} invalidates that cache,
6965
+ * so a follow-up call reflects the new `claimed_date`. This method does
6966
+ * NOT refresh the {@link getRaffles} list or fire its `onUpdate` — re-call
6967
+ * manually to pick up newly-won prizes or a `claimed_date` flip.
6968
+ *
6969
+ * **UI guidance**: see [UI Guide — `getRaffleWonPrizes`](../../docs/ui/raffles/UIGuide_getRaffleWonPrizes.md).
6970
+ *
6971
+ * **Visitor mode**: not supported (see "Authentication required").
6972
+ *
6973
+ * @param props.raffle_id The parent raffle's `id` (from `TRaffle.id`). Required.
6974
+ * @param props.offset Zero-based index of the first row to return. Defaults to `0`.
6975
+ * @param props.limit Page size. Defaults to `20`.
6976
+ * @returns Promise resolving to {@link GetRaffleWonPrizesResponse}
6977
+ * (`user`, this page of `won_prizes`, and `total`;
6978
+ * `errCode 0` on success).
6979
+ *
6980
+ * @example
6981
+ * ```ts
6982
+ * const raffles = await window._smartico.api.getRaffles();
6983
+ * const raffle = raffles[0];
6984
+ *
6985
+ * // First page of the user's won prizes for this raffle.
6986
+ * const page = await window._smartico.api.getRaffleWonPrizes({
6987
+ * raffle_id: raffle.id,
6988
+ * offset: 0,
6989
+ * limit: 20,
6990
+ * });
6991
+ *
6992
+ * if (page.errCode !== 0) {
6993
+ * console.error('[smartico] could not load won prizes — show a retry state:', page.errMsg);
6994
+ * return;
6995
+ * }
6996
+ * if (page.won_prizes.length === 0) {
6997
+ * console.log('[smartico] no wins in this raffle (or not eligible) — render the empty state');
6998
+ * return;
6999
+ * }
7000
+ *
7001
+ * console.log('[smartico]', page.user?.public_username, 'won', page.total, 'prizes total');
7002
+ * for (const prize of page.won_prizes) {
7003
+ * console.log('[smartico] render prize card —', prize.public_meta.name, prize.public_meta.image_url);
7004
+ * if (prize.requires_claim && !prize.claimed_date) {
7005
+ * console.log('[smartico] show a Claim CTA — on click call claimRafflePrize({ won_id:', prize.raf_won_id, '})');
7006
+ * }
7007
+ * }
7008
+ *
7009
+ * // Load more.
7010
+ * if (page.offset + page.won_prizes.length < page.total) {
7011
+ * const next = await window._smartico.api.getRaffleWonPrizes({
7012
+ * raffle_id: raffle.id,
7013
+ * offset: page.offset + page.limit,
7014
+ * limit: 20,
7015
+ * });
7016
+ * console.log('[smartico] appended', next.won_prizes.length, 'more prizes');
7017
+ * }
7018
+ * ```
7019
+ */
7020
+ ;
7021
+ _proto.getRaffleWonPrizes = function getRaffleWonPrizes(props) {
7022
+ try {
7023
+ var _props$offset, _props$limit;
7024
+ var _this7 = this;
7025
+ if (!props.raffle_id) {
7026
+ throw new Error('raffle_id is required');
7027
+ }
7028
+ return Promise.resolve(_this7.api.getRaffleWonPrizes(_this7.userExtId, {
7029
+ raffle_id: props.raffle_id,
7030
+ offset: (_props$offset = props.offset) != null ? _props$offset : 0,
7031
+ limit: (_props$limit = props.limit) != null ? _props$limit : 20
7032
+ }));
7033
+ } catch (e) {
7034
+ return Promise.reject(e);
7035
+ }
5766
7036
  };
5767
7037
  return WSAPIRaffles;
5768
7038
  }(WSAPIJackpots);
@@ -5775,24 +7045,98 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
5775
7045
  _inheritsLoose(WSAPIMiniGames, _WSAPIRaffles);
5776
7046
  var _proto = WSAPIMiniGames.prototype;
5777
7047
  /**
5778
- * Returns the list of mini-games configured for the current user (not filtered by spin availability or Widget visibility).
5779
- * The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
5780
- * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or won prize is spin/jackpot and if max count of the available user spins equals one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
7048
+ * Returns all mini-game templates ("SAW" = Spin And Win — the
7049
+ * umbrella term for wheel-spin, scratch-card, lootbox, gift-box,
7050
+ * treasure-hunt, plinko, coin-flip, quiz, and several other formats)
7051
+ * configured for the label. Optionally subscribes to live updates
7052
+ * via `onUpdate`: the callback fires whenever the user's
7053
+ * `spin_count` changes, jackpot grows, a manual spin is issued, or
7054
+ * a spin response lands.
7055
+ *
7056
+ * The list is NOT filtered by spin availability — every configured
7057
+ * template is returned, including ones the user cannot currently
7058
+ * play. The `visibile_when_can_spin` flag on each template hints
7059
+ * which to hide in a default lobby view (consumer-side filter).
5781
7060
  *
5782
- * **Example**:
5783
- * ```
5784
- * _smartico.api.getMiniGames().then((result) => {
5785
- * console.log(result);
5786
- * });
5787
- * ```
7061
+ * @remarks
7062
+ * **Subscription model (`onUpdate`)**
7063
+ * The callback receives the FULL refreshed template list (never a
7064
+ * diff/patch). Each subsequent call to `getMiniGames({ onUpdate })`
7065
+ * REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
7066
+ * it) to keep the prior callback in place; the callback is never
7067
+ * auto-cleared.
5788
7068
  *
5789
- * **Example in the Visitor mode**:
5790
- * ```
5791
- * _smartico.vapi('EN').getMiniGames().then((result) => {
5792
- * console.log(result);
7069
+ * **Update triggers** — the callback fires when:
7070
+ *
7071
+ * 1. The server pushes a `spin_count` change (campaign award,
7072
+ * store purchase, BO manual issuance, mission reward).
7073
+ * 2. Any {@link playMiniGame} or {@link playMiniGameBatch}
7074
+ * resolves on this connection — the cached array refreshes
7075
+ * with updated `spin_count`, `jackpot_current`, and any new
7076
+ * `next_available_spin_ts`.
7077
+ * 3. Acknowledge responses land (via auto-acknowledge or
7078
+ * {@link miniGameWinAcknowledgeRequest}).
7079
+ *
7080
+ * Jackpot growth is observable on the refreshed `jackpot_current`
7081
+ * field — the SDK inlines the live value into template `name` /
7082
+ * `promo_text` / prize `name` via a `{{jackpot}}` template
7083
+ * substitution at fetch time.
7084
+ *
7085
+ * **Game-type variants**
7086
+ * All twelve `SAWGameType` values (`SpinAWheel`, `ScratchCard`,
7087
+ * `MatchX`, `GiftBox`, `PrizeDrop`, `Quiz`, `LootboxWeekdays`,
7088
+ * `LootboxCalendarDays`, `TreasureHunt`, `Voyager`, `Plinko`,
7089
+ * `CoinFlip`) surface through the same template shape. Most are
7090
+ * played via {@link playMiniGame}; the exceptions are:
7091
+ * - `PrizeDrop` — server-push only; the consumer does NOT call
7092
+ * `playMiniGame`. Prizes arrive via the prize-drop push channel.
7093
+ * - `MatchX` / `Quiz` — predictions are submitted via a separate
7094
+ * games server (not this SDK); the SAW spin is fired
7095
+ * server-internally to deduct the buy-in.
7096
+ *
7097
+ * **Cache TTL**: the SDK caches the response for 30 seconds. Cache
7098
+ * is fully cleared on login / logout.
7099
+ *
7100
+ * **Idempotency / Side effects**: safe. Read-only.
7101
+ *
7102
+ * **UI guidance**: see [UI Guide — `getMiniGames`](../../docs/ui/minigames/UIGuide_getMiniGames.md).
7103
+ *
7104
+ * **Visitor mode**: supported. Only templates configured with
7105
+ * `is_visitor_mode = true` in the BO are returned for anonymous
7106
+ * sessions. Spins from these templates may also be played (visitor
7107
+ * mode is the one mini-game flow that does support play — see
7108
+ * {@link playMiniGame} for the visitor-stop semantics).
7109
+ *
7110
+ * @param params Optional. Omit to fetch without subscribing.
7111
+ * @param params.onUpdate Callback invoked with the full refreshed
7112
+ * template array after any spin-count
7113
+ * change, spin response, or acknowledge
7114
+ * response on this connection.
7115
+ * @returns Promise resolving to the template
7116
+ * array. Empty if no templates are
7117
+ * visible to the user.
7118
+ *
7119
+ * @example
7120
+ * ```ts
7121
+ * const games = await window._smartico.api.getMiniGames({
7122
+ * onUpdate: (refreshed) => {
7123
+ * console.log('[smartico] mini-game templates refreshed — re-render lobby from this array:', refreshed);
7124
+ * },
5793
7125
  * });
5794
- * ```
5795
7126
  *
7127
+ * // Filter the lobby view per the visibility flag.
7128
+ * const visible = games.filter(g =>
7129
+ * !g.visibile_when_can_spin || (g.spin_count && g.spin_count > 0)
7130
+ * );
7131
+ *
7132
+ * for (const g of visible) {
7133
+ * console.log('[smartico] render game card', g.id, '—', g.name,
7134
+ * '— type:', g.saw_game_type,
7135
+ * '— buy-in:', g.saw_buyin_type,
7136
+ * '— spins available:', g.spin_count ?? 0,
7137
+ * '— jackpot:', g.jackpot_current, g.jackpot_symbol);
7138
+ * }
7139
+ * ```
5796
7140
  */
5797
7141
  _proto.getMiniGames = function getMiniGames(_temp) {
5798
7142
  var _ref = _temp === void 0 ? {} : _temp,
@@ -5810,19 +7154,73 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
5810
7154
  }
5811
7155
  }
5812
7156
  /**
5813
- * Returns the list of mini-games based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
5814
- * The maximum number of items per request is limited to 20.
5815
- * You can leave this params empty and by default it will return list of mini-games ranging from 0 to 20.
5816
- * The returned list of mini-games history is cached for 30 seconds.
7157
+ * Returns a paginated, newest-first list of the user's past
7158
+ * mini-game spins — each row carries the won prize ID, the
7159
+ * client-side `request_id` used for the spin, and a
7160
+ * server-recorded `is_claimed` flag (`true` if the spin has been
7161
+ * acknowledged). Optionally filter to a single template via
7162
+ * `saw_template_id`.
7163
+ *
7164
+ * Use this to power a "My prizes" / win-history surface, or to
7165
+ * recover unacknowledged spins (rows with `is_claimed === false`
7166
+ * carry a `client_request_id` you can pass to
7167
+ * {@link miniGameWinAcknowledgeRequest}).
5817
7168
  *
5818
- * **Example**:
5819
- * ```
5820
- * _smartico.api.getMiniGamesHistory().then((result) => {
5821
- * console.log(result);
5822
- * });
5823
- * ```
7169
+ * @remarks
7170
+ * **Pagination**
7171
+ * `limit` defaults to 20, `offset` defaults to 0. Sort order is
7172
+ * `create_date` DESC (newest first) — no client-side re-sort
7173
+ * required. For "load more" pagination, advance `offset` by the
7174
+ * page size on each subsequent call.
7175
+ *
7176
+ * The underlying protocol carries a `hasMore` boolean on the
7177
+ * response, but the SDK strips it from the public surface —
7178
+ * detect end of list when the returned array length is less than
7179
+ * `limit`.
7180
+ *
7181
+ * **`is_claimed` semantics**
7182
+ * Maps directly to the server's "acknowledge_date is non-null"
7183
+ * state. A spin where the auto-acknowledge fire-and-forget
7184
+ * succeeded shows `is_claimed: true`; a spin where the
7185
+ * acknowledge was lost (network drop) or where the user is on an
7186
+ * explicit-acknowledge flow shows `is_claimed: false` with a
7187
+ * usable `client_request_id`. A server-side fallback job
7188
+ * auto-acknowledges stale rows every ~60 seconds — so even
7189
+ * "lost" prizes are eventually delivered without consumer action.
7190
+ *
7191
+ * **Cache TTL**: the SDK caches the response for 30 seconds.
7192
+ * Cache is invalidated implicitly when a new spin or acknowledge
7193
+ * response lands.
7194
+ *
7195
+ * **Idempotency / Side effects**: safe. Read-only.
7196
+ *
7197
+ * **UI guidance**: see [UI Guide — `getMiniGamesHistory`](../../docs/ui/minigames/UIGuide_getMiniGamesHistory.md).
5824
7198
  *
5825
- * **Visitor mode: not supported**
7199
+ * **Visitor mode**: not supported.
7200
+ *
7201
+ * @param params Optional pagination + filter bag.
7202
+ * @param params.limit Page size. Defaults to 20.
7203
+ * @param params.offset Number of rows to skip. Defaults to 0.
7204
+ * @param params.saw_template_id When set, scopes the history to
7205
+ * a single template's spins.
7206
+ *
7207
+ * @returns Promise resolving to `TSawHistory[]` in newest-first
7208
+ * order. Empty when the user has no history.
7209
+ *
7210
+ * @example
7211
+ * ```ts
7212
+ * const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
7213
+ *
7214
+ * // Show unacknowledged spins with a Claim CTA.
7215
+ * const unacknowledged = history.filter(h => !h.is_claimed);
7216
+ * console.log('[smartico] surface a "Claim" CTA on these', unacknowledged.length, 'history rows:',
7217
+ * unacknowledged.map(h => h.client_request_id));
7218
+ *
7219
+ * // Load-more pagination — advance offset by the prior page size.
7220
+ * const page2 = await window._smartico.api.getMiniGamesHistory({ limit: 20, offset: 20 });
7221
+ * console.log('[smartico] page 2 loaded —', page2.length, 'more rows;',
7222
+ * page2.length < 20 ? 'end of list reached, hide "Load more"' : 'keep "Load more" visible');
7223
+ * ```
5826
7224
  */
5827
7225
  ;
5828
7226
  _proto.getMiniGamesHistory = function getMiniGamesHistory(_ref2) {
@@ -5839,18 +7237,164 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
5839
7237
  }
5840
7238
  }
5841
7239
  /**
5842
- * Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code
5843
- * After playMiniGame is called, you can call getMiniGames to get the list of mini-games.The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGame with a new onUpdate callback, the old one will be overwritten by the new one.
5844
- * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or won prize is spin/jackpot and if max count of the available user spins equals one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
7240
+ * Plays one round of a mini-game template — runs the server's
7241
+ * randomised prize selection, deducts the buy-in cost (if any),
7242
+ * and returns the won `prize_id`. After the play resolves, the SDK
7243
+ * automatically fires a server-side acknowledgement on a
7244
+ * fire-and-forget basis, marking the spin as "delivered" so the
7245
+ * prize takes effect.
7246
+ *
7247
+ * Works for all `SAWGameType` values EXCEPT:
7248
+ * - `PrizeDrop` — prizes arrive server-pushed; do NOT call
7249
+ * `playMiniGame` for this type.
7250
+ * - `MatchX` / `Quiz` — prediction submission goes through a
7251
+ * separate games server; `playMiniGame` is not the entry point.
5845
7252
  *
5846
- * **Example**:
5847
- * ```
5848
- * _smartico.api.playMiniGame(55).then((result) => {
5849
- * console.log(result);
7253
+ * @remarks
7254
+ * **Preconditions**
7255
+ * Read the candidate template from {@link getMiniGames} and check:
7256
+ * - `spin_count > 0` for spin-based templates
7257
+ * (`saw_buyin_type === 'spins'`).
7258
+ * - Sufficient balance for paid templates — points / gems /
7259
+ * diamonds from {@link getUserProfile} against
7260
+ * `buyin_cost_points` / `_gems` / `_diamonds`.
7261
+ * - `next_available_spin_ts` is in the past (or unset) — the
7262
+ * server enforces a per-period max-attempts cap.
7263
+ * - Template is currently in its active period
7264
+ * (operator-configured `activeFromDate` / `activeTillDate`).
7265
+ *
7266
+ * **Error codes** (in `err_code`, typed as {@link SAWSpinErrorCode})
7267
+ * - `0` (`SAW_OK`) — success; `prize_id` identifies the won prize
7268
+ * in `template.prizes`.
7269
+ * - `40001` (`SAW_NO_SPINS`) — user has no spin attempts for a
7270
+ * spin-based template.
7271
+ * - `40002` (`SAW_PRIZE_POOL_EMPTY`) — all prize slots in the
7272
+ * template are depleted.
7273
+ * - `40003` (`SAW_NOT_ENOUGH_POINTS`) — insufficient points for a
7274
+ * points-cost template.
7275
+ * - `40004` (`SAW_FAILED_MAX_SPINS_REACHED`) — per-period
7276
+ * max-attempts cap reached. The server's
7277
+ * `first_spin_in_period` value (exposed in
7278
+ * {@link TMiniGamePlayBatchResult}; not surfaced in the single
7279
+ * `TMiniGamePlayResult`) marks the period start.
7280
+ * - `40007` (`SAW_TEMPLATE_NOT_ACTIVE`) — template outside its
7281
+ * active time window.
7282
+ * - `40009` (`SAW_NOT_IN_SEGMENT`) — user fails the template's
7283
+ * visibility segment check, OR (for lootbox variants) the day's
7284
+ * prize pool is empty.
7285
+ * - `40011` (`SAW_NO_BALANCE_GEMS`) — insufficient gems.
7286
+ * - `40012` (`SAW_NO_BALANCE_DIAMONDS`) — insufficient diamonds.
7287
+ * - `-40001` (`SAW_VISITOR_STOP_SPIN_REQUEST`) — visitor session
7288
+ * tried to play a non-visitor-mode template. The default UI
7289
+ * silently stops the game; no prize awarded.
7290
+ * - other non-zero — generic server error. Surface `err_message`.
7291
+ *
7292
+ * **Prize handling**
7293
+ * On `err_code === 0`, `prize_id` matches an entry in
7294
+ * `template.prizes`. Look up the prize's `prize_type`
7295
+ * ({@link MiniGamePrizeTypeName}) to decide UI treatment:
7296
+ * - `'no-prize'` — the user spun but won nothing (an operator-
7297
+ * configured "loss" slot). Buy-in is still deducted.
7298
+ * - `'points'` / `'gems-and-diamonds'` / `'spin'` — value
7299
+ * credited to the user's profile / spin balance; visible on
7300
+ * the next refresh.
7301
+ * - `'bonus'` — surfaces via {@link getBonuses}.
7302
+ * - `'jackpot'` — drains the template's `jackpot_current` to the
7303
+ * user; resets the accumulator.
7304
+ * - `'raffle-ticket'` — adds tickets to the relevant raffle.
7305
+ * - `'mission'` / `'change-level'` — visible via the
7306
+ * corresponding domain methods.
7307
+ * - `'manual'` — operator delivers offline.
7308
+ *
7309
+ * **Auto-acknowledge**
7310
+ * The SDK calls the server's acknowledge endpoint immediately
7311
+ * after the spin response, on a fire-and-forget basis (not
7312
+ * awaited). This marks the spin as "delivered" so prize effects
7313
+ * take hold. If the auto-acknowledge fails (network drop), the
7314
+ * spin appears as `is_claimed: false` in
7315
+ * {@link getMiniGamesHistory}; the consumer can recover it by
7316
+ * passing the `client_request_id` to
7317
+ * {@link miniGameWinAcknowledgeRequest}. A server-side fallback
7318
+ * job auto-acknowledges stale spins every ~60 seconds, so prizes
7319
+ * are eventually delivered even without consumer action.
7320
+ *
7321
+ * **Idempotency**: NOT idempotent. A double-click sends two
7322
+ * spins and deducts the buy-in twice. The SDK does NOT guard
7323
+ * against rapid clicks at the public API level — guard the call
7324
+ * site with an in-flight flag. The server enforces a per-user
7325
+ * per-template lock that serialises concurrent requests, so two
7326
+ * simultaneous calls won't be processed in parallel, but they
7327
+ * will both be processed sequentially (i.e. both deduct).
7328
+ *
7329
+ * **Refresh after success (and after failure)**
7330
+ * The SDK automatically refreshes the templates cache on every
7331
+ * spin response and fires any `onUpdate` callback registered via
7332
+ * {@link getMiniGames} or this method. After `err_code === 0`, the
7333
+ * affected template's `spin_count` / `jackpot_current` /
7334
+ * `next_available_spin_ts` reflect the new state on the
7335
+ * refreshed array.
7336
+ *
7337
+ * **Side effects** (on `err_code === 0`)
7338
+ * - Buy-in deducted from the user's balance (points / gems /
7339
+ * diamonds / spin tickets — depending on `saw_buyin_type`).
7340
+ * Balance updates flow via the user-properties channel
7341
+ * (subscribe to {@link getUserProfile} `props_change` to
7342
+ * observe).
7343
+ * - Prize value credited per the prize's type (see "Prize
7344
+ * handling" above).
7345
+ * - A `minigame_attempt` analytics event fires server-side with
7346
+ * the result status.
7347
+ *
7348
+ * **UI guidance**: see [UI Guide — `playMiniGame`](../../docs/ui/minigames/UIGuide_playMiniGame.md).
7349
+ *
7350
+ * **Visitor mode**: not supported. Visitor sessions trying to
7351
+ * spin receive `SAW_VISITOR_STOP_SPIN_REQUEST (-40001)`.
7352
+ *
7353
+ * @param template_id The mini-game template ID (from
7354
+ * `TMiniGameTemplate.id`).
7355
+ * @param params Optional. Pass an `onUpdate` callback to
7356
+ * subscribe to subsequent template refreshes.
7357
+ * @returns `{ err_code, err_message, prize_id }` — success when
7358
+ * `err_code === 0`. `prize_id` is always populated; look
7359
+ * it up in `template.prizes` to interpret the prize.
7360
+ *
7361
+ * @example
7362
+ * ```ts
7363
+ * const games = await window._smartico.api.getMiniGames({
7364
+ * onUpdate: (refreshed) => console.log('[smartico] templates refreshed — re-render lobby', refreshed),
5850
7365
  * });
5851
- * ```
7366
+ * const game = games.find(g => g.id === templateId);
5852
7367
  *
5853
- * **Visitor mode: not supported**
7368
+ * if (!game) {
7369
+ * console.log('[smartico] template not in current list — refresh getMiniGames');
7370
+ * return;
7371
+ * }
7372
+ * if (game.saw_buyin_type === 'spins' && (game.spin_count ?? 0) === 0) {
7373
+ * console.log('[smartico] no spins available — disable Play button, show "No spins" message');
7374
+ * return;
7375
+ * }
7376
+ *
7377
+ * console.log('[smartico] play starting — set in-flight flag, start game animation (wheel spin / scratch / lootbox open / etc.)');
7378
+ * const r = await window._smartico.api.playMiniGame(game.id);
7379
+ * console.log('[smartico] play response received');
7380
+ *
7381
+ * if (r.err_code === 0) {
7382
+ * const prize = game.prizes.find(p => p.id === r.prize_id);
7383
+ * if (prize?.prize_type === 'no-prize') {
7384
+ * console.log('[smartico] user lost — animate to the no-prize slot and show "Better luck next time" modal');
7385
+ * } else {
7386
+ * console.log('[smartico] user won — animate to prize', prize?.name,
7387
+ * '— show acknowledge modal per template.acknowledge_type;',
7388
+ * 'getMiniGames onUpdate fires shortly with refreshed spin_count / jackpot');
7389
+ * }
7390
+ * } else if (r.err_code === 40004) {
7391
+ * console.error('[smartico] max spins reached — show countdown to next available spin (use playMiniGameBatch for first_spin_in_period if needed)');
7392
+ * } else if (r.err_code === -40001) {
7393
+ * console.log('[smartico] visitor stopped — silently end the game, no prize modal');
7394
+ * } else {
7395
+ * console.error('[smartico] play failed — show generic error with this message:', r.err_message);
7396
+ * }
7397
+ * ```
5854
7398
  */
5855
7399
  ;
5856
7400
  _proto.playMiniGame = function playMiniGame(template_id, _temp2) {
@@ -5875,12 +7419,63 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
5875
7419
  }
5876
7420
  }
5877
7421
  /**
5878
- * Sends the acknowledge request with specific client_request_id from minigame history in order to claim prize
5879
- * **Example**:
5880
- * ```
5881
- * _smartico.api.miniGameWinAcknowledgeRequest('2a189322-31bb-4119-b943-bx7868ff8dc3').then((result) => {
5882
- * console.log(result);
5883
- * });
7422
+ * Manually acknowledges a mini-game spin — marks the spin as
7423
+ * "delivered" so the prize takes effect server-side. Most consumers
7424
+ * do NOT need to call this method directly; {@link playMiniGame}
7425
+ * and {@link playMiniGameBatch} auto-acknowledge on success. Use
7426
+ * this only for recovery scenarios.
7427
+ *
7428
+ * @remarks
7429
+ * **When to call**
7430
+ * - **Lost auto-acknowledge** — when the WebSocket dropped between
7431
+ * the spin response and the auto-acknowledge fire-and-forget,
7432
+ * the spin shows `is_claimed: false` in
7433
+ * {@link getMiniGamesHistory}. Pass that row's
7434
+ * `client_request_id` here to deliver the prize.
7435
+ * - **Explicit-acknowledge UI** — for templates configured with
7436
+ * the `ExplicitAcknowledge` acknowledge type (operator
7437
+ * decision), the consumer's UI shows a "Claim" CTA after the
7438
+ * prize animation. Click handler calls this method with the
7439
+ * spin's `client_request_id` rather than auto-acknowledging.
7440
+ *
7441
+ * **No-op on already-acknowledged spins**
7442
+ * The server's acknowledge SQL matches on `acknowledge_date IS
7443
+ * NULL` — a duplicate call returns successfully with no effect.
7444
+ *
7445
+ * **Server-side fallback**
7446
+ * Even without ever calling this method, a server-side job
7447
+ * auto-acknowledges stale spins every ~60 seconds — so prizes are
7448
+ * eventually delivered. The `is_claimed` flag flips on the next
7449
+ * `getMiniGamesHistory` call after the job runs.
7450
+ *
7451
+ * **Idempotency**: safe. Repeated calls have no effect after the
7452
+ * first.
7453
+ *
7454
+ * **Side effects** (on first successful call for an unacknowledged
7455
+ * spin)
7456
+ * - Prize value credited per the prize's type (see
7457
+ * {@link playMiniGame} "Prize handling").
7458
+ * - The spin's `is_claimed` flag flips to `true` on the next
7459
+ * {@link getMiniGamesHistory} call.
7460
+ *
7461
+ * **Visitor mode**: not supported.
7462
+ *
7463
+ * @param request_id The `client_request_id` from a `TSawHistory`
7464
+ * row returned by {@link getMiniGamesHistory}.
7465
+ *
7466
+ * @example
7467
+ * ```ts
7468
+ * const history = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
7469
+ * const unacknowledged = history.filter(h => !h.is_claimed);
7470
+ *
7471
+ * for (const row of unacknowledged) {
7472
+ * console.log('[smartico] re-acknowledging stale spin', row.client_request_id);
7473
+ * await window._smartico.api.miniGameWinAcknowledgeRequest(row.client_request_id);
7474
+ * }
7475
+ *
7476
+ * // Re-fetch history to see the updated is_claimed flags.
7477
+ * const fresh = await window._smartico.api.getMiniGamesHistory({ limit: 20 });
7478
+ * console.log('[smartico] history after recovery —', fresh.filter(h => !h.is_claimed).length, 'still unacknowledged');
5884
7479
  * ```
5885
7480
  */
5886
7481
  ;
@@ -5893,17 +7488,108 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
5893
7488
  }
5894
7489
  }
5895
7490
  /**
5896
- * Plays the specified by template_id mini-game on behalf of user spin_count times and returns array of the prizes
5897
- * After playMiniGameBatch is called, you can call getMiniGames to get the list of mini-games. The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call playMiniGameBatch with a new onUpdate callback, the old one will be overwritten by the new one.
5898
- * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or won prize is spin/jackpot and if max count of the available user spins equals one, also if the spins were issued to the user manually in the BO. Updated templates will be passed to onUpdate callback.
7491
+ * Plays a mini-game template `spin_count` times in one round-trip.
7492
+ * Returns an array of per-spin results — each independent, each
7493
+ * with its own error code. Like {@link playMiniGame}, the SDK
7494
+ * auto-acknowledges every result on a fire-and-forget basis.
5899
7495
  *
5900
- * **Example**:
5901
- * ```
5902
- * _smartico.api.playMiniGameBatch(55, 10).then((result) => {
5903
- * console.log(result);
5904
- * });
7496
+ * Use this when a UI offers "spin N times" affordances
7497
+ * (multi-spin buttons, lootbox open-N flows). The server processes
7498
+ * each spin independently — there is no atomicity / rollback if
7499
+ * one fails.
7500
+ *
7501
+ * @remarks
7502
+ * **Result shape note** — `TMiniGamePlayBatchResult` uses
7503
+ * `errCode` / `errMessage` (camelCase) — DIFFERENT from
7504
+ * {@link TMiniGamePlayResult} which uses `err_code` / `err_message`
7505
+ * (snake_case). Branch on the camelCase keys when reading batch
7506
+ * results.
7507
+ *
7508
+ * **Per-spin independence**
7509
+ * The server iterates the requested spins and calls the prize
7510
+ * engine once per entry. If spin #2 fails with `SAW_NO_SPINS`,
7511
+ * spin #3 is still attempted — the server does NOT stop on first
7512
+ * error and does NOT roll back successful spins. Each
7513
+ * `results[i].errCode` is independent.
7514
+ *
7515
+ * Practical implication: if the user has 3 spins available and
7516
+ * requests 5, expect results 0-2 with `errCode === 0` and results
7517
+ * 3-4 with `errCode === SAW_NO_SPINS`.
7518
+ *
7519
+ * **Error codes**
7520
+ * Per-result `errCode` is from {@link SAWSpinErrorCode}. See
7521
+ * {@link playMiniGame} for the full table; the same codes apply
7522
+ * per spin.
7523
+ *
7524
+ * **`first_spin_in_period` field**
7525
+ * Populated on results where `errCode === SAW_FAILED_MAX_SPINS_REACHED`
7526
+ * (40004). The value is the epoch-ms timestamp of the user's
7527
+ * first spin in the current cooldown period. Compute the
7528
+ * countdown as:
7529
+ * `template.max_spins_period_ms - (Date.now() - first_spin_in_period)`.
7530
+ *
7531
+ * **`jackpot_amount` field**
7532
+ * Populated on results where the won prize is a jackpot
7533
+ * (`prize_type === 'jackpot'`). The amount the user just claimed
7534
+ * from the template's jackpot accumulator.
7535
+ *
7536
+ * **Auto-acknowledge**
7537
+ * The SDK fires a batch-acknowledge for all `request_id`s after
7538
+ * the batch response lands — fire-and-forget. Same recovery
7539
+ * semantics as {@link playMiniGame}: lost acknowledgements
7540
+ * become recoverable via {@link miniGameWinAcknowledgeRequest}
7541
+ * per row, and a server-side fallback job auto-acknowledges
7542
+ * stale spins every ~60 seconds.
7543
+ *
7544
+ * **Idempotency**: NOT idempotent. A double-click sends two
7545
+ * batches. Guard the call site with an in-flight flag.
7546
+ *
7547
+ * **Refresh after success (and after failure)**
7548
+ * Same as {@link playMiniGame} — the templates cache refreshes
7549
+ * and any `onUpdate` callback registered via {@link getMiniGames}
7550
+ * fires with the updated `spin_count` / `jackpot_current`.
7551
+ *
7552
+ * **Side effects** (per-spin, on `errCode === 0`)
7553
+ * Same as {@link playMiniGame} — buy-in deducted, prize value
7554
+ * credited per prize type.
7555
+ *
7556
+ * **UI guidance**: see [UI Guide — `playMiniGameBatch`](../../docs/ui/minigames/UIGuide_playMiniGameBatch.md).
7557
+ *
7558
+ * **Visitor mode**: not supported.
7559
+ *
7560
+ * @param template_id The mini-game template ID.
7561
+ * @param spin_count Number of spins to play. The server attempts
7562
+ * all `spin_count` spins — partial successes
7563
+ * are normal when the user runs out of
7564
+ * balance / spins mid-batch.
7565
+ * @param params Optional. Pass an `onUpdate` callback to
7566
+ * subscribe to subsequent template refreshes.
7567
+ * @returns `TMiniGamePlayBatchResult[]` — one entry per requested
7568
+ * spin, in request order. Note the camelCase `errCode` /
7569
+ * `errMessage` keys (see "Result shape note" above).
7570
+ *
7571
+ * @example
7572
+ * ```ts
7573
+ * const game = (await window._smartico.api.getMiniGames()).find(g => g.id === templateId);
7574
+ * if (!game) return;
7575
+ *
7576
+ * console.log('[smartico] batch play starting — set in-flight flag, animate the chosen N spins sequentially in UI');
7577
+ * const results = await window._smartico.api.playMiniGameBatch(game.id, 5);
7578
+ * console.log('[smartico] batch response received — clear in-flight flag');
7579
+ *
7580
+ * for (const [i, r] of results.entries()) {
7581
+ * if (r.errCode === 0) {
7582
+ * const prize = game.prizes.find(p => p.id === r.saw_prize_id);
7583
+ * console.log('[smartico] spin', i, 'won:', prize?.name,
7584
+ * r.jackpot_amount ? '(jackpot: ' + r.jackpot_amount + ')' : '');
7585
+ * } else if (r.errCode === 40004) {
7586
+ * const msTillNext = game.max_spins_period_ms! - (Date.now() - (r.first_spin_in_period ?? 0));
7587
+ * console.log('[smartico] spin', i, 'capped — ' + Math.ceil(msTillNext / 1000) + ' s until next allowed');
7588
+ * } else {
7589
+ * console.error('[smartico] spin', i, 'failed —', r.errCode, r.errMessage);
7590
+ * }
7591
+ * }
5905
7592
  * ```
5906
- * **Visitor mode: not supported**
5907
7593
  */
5908
7594
  ;
5909
7595
  _proto.playMiniGameBatch = function playMiniGameBatch(template_id, spin_count, _temp3) {
@@ -5971,19 +7657,63 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
5971
7657
  _inheritsLoose(WSAPIAvatars, _WSAPIMiniGames);
5972
7658
  var _proto = WSAPIAvatars.prototype;
5973
7659
  /**
5974
- * Returns the list of avatars available in the catalog for the current user.
5975
- * The response includes both free avatars and earned/purchased ones.
5976
- * Avatars with `hide_until_achieved = true` and `is_given = false` should be hidden from the user.
5977
- * The result is cached for 30 seconds.
7660
+ * Returns the avatar catalog available to the current user — every pre-defined
7661
+ * avatar configured for the label, with per-user unlock flags (`is_given`, `is_in_use`)
7662
+ * applied server-side.
5978
7663
  *
5979
- * **Example**:
5980
- * ```
5981
- * _smartico.api.getAvatarsList().then((result) => {
5982
- * console.log(result);
5983
- * });
5984
- * ```
7664
+ * The returned `avatar_url` is the absolute CDN URL (the SDK prefixes relative paths
7665
+ * with the configured avatar domain). AI-customized variants are NOT returned here —
7666
+ * those live in {@link getAvatarsCustomized}.
5985
7667
  *
5986
- * **Visitor mode: not supported**
7668
+ * @remarks
7669
+ * **Preconditions**
7670
+ * - User must be authenticated. Visitor mode is not supported.
7671
+ * - No other prerequisite calls.
7672
+ *
7673
+ * **Visibility filter** (consumer-applied)
7674
+ * Avatars with `hide_until_achieved === true && is_given === false` should be filtered
7675
+ * out of the grid — they represent surprise unlocks that should remain hidden until
7676
+ * the user earns them. The default Smartico UI drops these before rendering.
7677
+ *
7678
+ * **Lock state** (consumer-applied)
7679
+ * Lock condition: `!is_given && avatar_source_type_id !== 0`. Free avatars
7680
+ * (`avatar_source_type_id === 0`) are always selectable; non-free avatars are locked
7681
+ * until `is_given` flips to true (operator grants via campaign, mission reward, store
7682
+ * purchase, etc.).
7683
+ *
7684
+ * **Sort order**
7685
+ * Server does NOT pre-sort. Caller must sort by `priority` ascending (lower = first).
7686
+ *
7687
+ * **Refresh**
7688
+ * - The SDK caches results for 30 seconds.
7689
+ * - {@link setAvatar} clears this cache on completion; the next call re-fetches.
7690
+ * - No push subscription — there is no `onUpdate` callback for avatar methods.
7691
+ * - When `is_given` flips server-side (e.g. the user earns a new avatar), the change
7692
+ * surfaces only on the next call after the 30-second cache window expires.
7693
+ *
7694
+ * **Visitor mode**: not supported.
7695
+ *
7696
+ * **UI guidance**: see [UI Guide — `getAvatarsList`](../../docs/ui/avatars/UIGuide_getAvatarsList.md).
7697
+ *
7698
+ * @returns Array of {@link TAvatarDefinition} — empty array if the feature is disabled
7699
+ * on the label.
7700
+ *
7701
+ * @example
7702
+ * ```ts
7703
+ * const avatars = await window._smartico.api.getAvatarsList();
7704
+ *
7705
+ * // Apply the standard visibility filter and sort.
7706
+ * const visible = avatars
7707
+ * .filter((a) => !a.hide_until_achieved || a.is_given)
7708
+ * .sort((a, b) => a.priority - b.priority);
7709
+ *
7710
+ * console.log('[smartico] visible avatars:', visible.length, '— render as a grid');
7711
+ *
7712
+ * const active = visible.find((a) => a.is_in_use);
7713
+ * if (active) {
7714
+ * console.log('[smartico] currently in use — overlay a checkmark on this card:', active.avatar_real_id);
7715
+ * }
7716
+ * ```
5987
7717
  */
5988
7718
  _proto.getAvatarsList = function getAvatarsList() {
5989
7719
  try {
@@ -5996,18 +7726,70 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
5996
7726
  }
5997
7727
  }
5998
7728
  /**
5999
- * Returns the list of AI-customized avatars for the current user.
6000
- * Each entry represents a previously generated AI customization for a specific base avatar.
6001
- * The result is cached for 30 seconds.
7729
+ * Returns the user's previously generated AI-customized avatar variants.
6002
7730
  *
6003
- * **Example**:
6004
- * ```
6005
- * _smartico.api.getAvatarsCustomized().then((result) => {
6006
- * console.log(result);
6007
- * });
6008
- * ```
7731
+ * Each entry is one AI-generated image derived from a base avatar in the catalog
7732
+ * (the base is identified by `avatar_real_id` and was originally a
7733
+ * {@link TAvatarDefinition} from {@link getAvatarsList}). These variants are stored
7734
+ * server-side under the user record and persist across sessions.
6009
7735
  *
6010
- * **Visitor mode: not supported**
7736
+ * @remarks
7737
+ * **Preconditions**
7738
+ * - User must be authenticated. Visitor mode is not supported.
7739
+ * - Has meaning only after at least one successful AI customization run (see below).
7740
+ * New users get an empty array.
7741
+ *
7742
+ * **Where customized avatars come from**
7743
+ * AI customization is **not** a WebSocket method on this SDK. It is a separate HTTP
7744
+ * POST to the operator-configured `avatar-customize` endpoint that takes a base avatar
7745
+ * plus a style prompt from {@link getAvatarPrompts} and returns a generated CDN URL.
7746
+ * Once that POST resolves successfully, the new variant is persisted and surfaces in
7747
+ * the next `getAvatarsCustomized()` call. The variant URL can then be passed to
7748
+ * {@link setAvatar} to activate it.
7749
+ *
7750
+ * **Relation to `getAvatarsList`**
7751
+ * AI variants do NOT appear in {@link getAvatarsList}. Catalog and variants are two
7752
+ * separate collections — combine them client-side if the UI needs a unified view per
7753
+ * base avatar.
7754
+ *
7755
+ * **Sort order**
7756
+ * Server does NOT pre-sort. Caller typically sorts by `dt_created` descending to show
7757
+ * the newest variant first.
7758
+ *
7759
+ * **Refresh**
7760
+ * - The SDK caches results for 30 seconds.
7761
+ * - {@link setAvatar} clears this cache on completion.
7762
+ * - After a successful AI customization POST, the consumer should re-call to surface
7763
+ * the new variant — the customization endpoint is outside the SDK so the SDK cannot
7764
+ * auto-invalidate.
7765
+ * - No push subscription.
7766
+ *
7767
+ * **Visitor mode**: not supported.
7768
+ *
7769
+ * **UI guidance**: see [UI Guide — `getAvatarsCustomized`](../../docs/ui/avatars/UIGuide_getAvatarsCustomized.md).
7770
+ *
7771
+ * @returns Array of {@link TAvatarCustomized} — empty if the user has never run AI
7772
+ * customization, or if the feature is disabled on the label.
7773
+ *
7774
+ * @example
7775
+ * ```ts
7776
+ * const variants = await window._smartico.api.getAvatarsCustomized();
7777
+ *
7778
+ * // Group by the base avatar so the UI can show "this base has 3 AI variants".
7779
+ * const byBase = new Map<number, typeof variants>();
7780
+ * for (const v of variants) {
7781
+ * const list = byBase.get(v.avatar_real_id) ?? [];
7782
+ * list.push(v);
7783
+ * byBase.set(v.avatar_real_id, list);
7784
+ * }
7785
+ *
7786
+ * // Newest-first within each base.
7787
+ * for (const list of byBase.values()) {
7788
+ * list.sort((a, b) => b.dt_created.localeCompare(a.dt_created));
7789
+ * }
7790
+ *
7791
+ * console.log('[smartico] AI variants by base avatar — render as a carousel under each base');
7792
+ * ```
6011
7793
  */
6012
7794
  ;
6013
7795
  _proto.getAvatarsCustomized = function getAvatarsCustomized() {
@@ -6021,18 +7803,53 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
6021
7803
  }
6022
7804
  }
6023
7805
  /**
6024
- * Returns the list of AI customization prompts (styles) available for avatar customization.
6025
- * Each prompt represents a visual style that can be applied to a base avatar.
6026
- * The result is cached for 30 seconds.
7806
+ * Returns the catalog of AI style prompts available for avatar customization.
6027
7807
  *
6028
- * **Example**:
6029
- * ```
6030
- * _smartico.api.getAvatarPrompts().then((result) => {
6031
- * console.log(result);
6032
- * });
6033
- * ```
7808
+ * Each entry is a "style" the user can apply to a base avatar (e.g. "Cartoon",
7809
+ * "Watercolor", "Cyberpunk"). Prompts carry a cost expressed in points, gems, or
7810
+ * diamonds — applying a prompt deducts the cost server-side as part of the AI
7811
+ * generation request.
6034
7812
  *
6035
- * **Visitor mode: not supported**
7813
+ * @remarks
7814
+ * **Preconditions**
7815
+ * - User must be authenticated. Visitor mode is not supported.
7816
+ * - No other prerequisite calls. The customization UI typically calls this on demand
7817
+ * when the user opens the style picker, not on app boot.
7818
+ *
7819
+ * **Cost handling**
7820
+ * Each prompt declares `cost_currency_type_id` (0 = points, 1 = gems, 2 = diamonds)
7821
+ * and `cost_value` (amount). The deduction happens server-side inside the
7822
+ * `avatar-customize` HTTP POST (the AI generation request, which is NOT part of this
7823
+ * SDK). The client should compare `cost_value` against the live balance from
7824
+ * {@link getUserProfile} to disable prompts the user cannot afford, but the server is
7825
+ * the source of truth and will reject under-funded requests authoritatively.
7826
+ *
7827
+ * **Refresh**
7828
+ * - The SDK caches results for 30 seconds.
7829
+ * - Not invalidated by {@link setAvatar} (prompts are catalog metadata, independent
7830
+ * of the user's active avatar).
7831
+ * - No push subscription.
7832
+ *
7833
+ * **Visitor mode**: not supported.
7834
+ *
7835
+ * **UI guidance**: see [UI Guide — `getAvatarPrompts`](../../docs/ui/avatars/UIGuide_getAvatarPrompts.md).
7836
+ *
7837
+ * @returns Array of {@link TAvatarPrompt} — empty if the AI customization feature is
7838
+ * disabled on the label.
7839
+ *
7840
+ * @example
7841
+ * ```ts
7842
+ * const [prompts, profile] = await Promise.all([
7843
+ * window._smartico.api.getAvatarPrompts(),
7844
+ * window._smartico.api.getUserProfile(),
7845
+ * ]);
7846
+ *
7847
+ * for (const p of prompts) {
7848
+ * // The consumer reads the matching balance from profile based on
7849
+ * // p.cost_currency_type_id (0=points, 1=gems, 2=diamonds).
7850
+ * console.log('[smartico] prompt', p.name, '— cost', p.cost_value, 'currency_type', p.cost_currency_type_id);
7851
+ * }
7852
+ * ```
6036
7853
  */
6037
7854
  ;
6038
7855
  _proto.getAvatarPrompts = function getAvatarPrompts() {
@@ -6046,27 +7863,114 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
6046
7863
  }
6047
7864
  }
6048
7865
  /**
6049
- * Sets the specified avatar as the active avatar for the current user.
6050
- * Pass `avatar_url` (the `TAvatarDefinition.url` path or a CDN URL for AI-customized avatars)
6051
- * and `avatar_real_id` from the avatar catalog.
6052
- * After a successful call, the avatar list cache is cleared so the next `getAvatarsList()` call reflects `is_in_use`.
7866
+ * Activates the specified avatar for the current user. The chosen image becomes the
7867
+ * profile avatar — any subsequent {@link getUserProfile} call will reflect the new
7868
+ * `avatar_url`.
6053
7869
  *
6054
- * **Example**:
6055
- * ```
6056
- * _smartico.api.getAvatarsList().then((avatars) => {
6057
- * const avatar = avatars.find((a) => !a.hide_until_achieved || a.is_given);
6058
- * if (avatar) {
6059
- * _smartico.api.setAvatar({
6060
- * avatar_url: avatar.url,
6061
- * avatar_real_id: avatar.avatar_real_id,
6062
- * }).then((result) => {
6063
- * console.log(result);
6064
- * });
6065
- * }
7870
+ * Pass `avatar_url` (a {@link TAvatarDefinition.url} from the catalog or a
7871
+ * {@link TAvatarCustomized.url} from the AI-variant list) plus `avatar_real_id` of the
7872
+ * base avatar. The server validates ownership before applying — locked avatars are
7873
+ * rejected.
7874
+ *
7875
+ * @remarks
7876
+ * **Preconditions**
7877
+ * - User must be authenticated. Visitor mode is not supported.
7878
+ * - `avatar_url` must be non-empty and `avatar_real_id` must be truthy — the SDK
7879
+ * throws synchronously otherwise (the request never reaches the server).
7880
+ * - The avatar must exist in the catalog from {@link getAvatarsList} (or be an AI
7881
+ * variant of a base avatar the user already owns). Free avatars
7882
+ * (`avatar_source_type_id === 0`) and the user's currently active avatar bypass the
7883
+ * ownership check; all others require `is_given === true`.
7884
+ *
7885
+ * **Error codes** (in `err_code`)
7886
+ * - `0` — success; cache is cleared and the profile avatar updates immediately.
7887
+ * - `1` — avatar not found in the catalog. The `avatar_real_id` doesn't exist for
7888
+ * this label.
7889
+ * - `2` — avatar inactive (deactivated by the operator).
7890
+ * - `3` — outside the avatar's active time window
7891
+ * (`active_from_date` / `active_till_date`).
7892
+ * - `4` — user does not own this avatar (it isn't in their `is_given` set and isn't
7893
+ * a free / default avatar).
7894
+ * - other non-zero — generic server error; surface `err_message` if present.
7895
+ *
7896
+ * The default Smartico UI shows a hardcoded "Failed to apply avatar" toast on any
7897
+ * non-zero `err_code` and does not surface `err_message`. Custom UIs SHOULD branch
7898
+ * on the code and prefer `err_message` when present (it is the localized server
7899
+ * string).
7900
+ *
7901
+ * **Refresh after success**
7902
+ * - The SDK clears both the `getAvatarsList` and `getAvatarsCustomized` caches —
7903
+ * the next call to either returns fresh data with the new `is_in_use` flag set on
7904
+ * the chosen avatar.
7905
+ * - The server persists the new avatar URL on the user record; {@link getUserProfile}
7906
+ * reflects it on the next read in this session.
7907
+ * - **No push to other open sessions.** A second device / tab the user is logged in
7908
+ * on will not see the new avatar until it next calls {@link getUserProfile} or
7909
+ * re-identifies. Plan UI accordingly.
7910
+ *
7911
+ * **Idempotency**: safe to retry. Re-applying the same `avatar_real_id` returns
7912
+ * `err_code: 0` and produces no double side effects (no double-deduction — this
7913
+ * method does not charge any currency — and no duplicate log entries).
7914
+ *
7915
+ * **Side effects**: updates the user's stored `avatar_id` / `avatar_real_id`. Does
7916
+ * NOT cost points, gems, or diamonds — the cost lives on the separate AI
7917
+ * customization HTTP flow ({@link getAvatarPrompts}). Does NOT write a user-visible
7918
+ * entry to {@link getActivityLog}.
7919
+ *
7920
+ * **UI guidance**: see [UI Guide — `setAvatar`](../../docs/ui/avatars/UIGuide_setAvatar.md).
7921
+ *
7922
+ * **Visitor mode**: not supported.
7923
+ *
7924
+ * @param props.avatar_url Absolute CDN URL of the avatar image. Read from
7925
+ * {@link TAvatarDefinition.url} for catalog avatars or
7926
+ * {@link TAvatarCustomized.url} for AI variants.
7927
+ * @param props.avatar_real_id Numeric ID of the base avatar from
7928
+ * {@link TAvatarDefinition.avatar_real_id}. For AI
7929
+ * variants, this is the `avatar_real_id` of the base
7930
+ * they were derived from.
7931
+ * @returns {@link TSetAvatarResult} — check `err_code === 0` for success.
7932
+ *
7933
+ * @example
7934
+ * ```ts
7935
+ * const avatars = await window._smartico.api.getAvatarsList();
7936
+ * const target = avatars.find((a) => a.avatar_real_id === 7);
7937
+ *
7938
+ * if (!target) {
7939
+ * console.error('[smartico] avatar 7 not in catalog — hide the picker entry');
7940
+ * return;
7941
+ * }
7942
+ *
7943
+ * const isLocked = !target.is_given && target.avatar_source_type_id !== 0;
7944
+ * if (isLocked) {
7945
+ * console.log('[smartico] avatar is locked — show "earn this first" prompt instead of calling setAvatar');
7946
+ * return;
7947
+ * }
7948
+ *
7949
+ * const r = await window._smartico.api.setAvatar({
7950
+ * avatar_url: target.avatar_url,
7951
+ * avatar_real_id: target.avatar_real_id,
6066
7952
  * });
6067
- * ```
6068
7953
  *
6069
- * **Visitor mode: not supported**
7954
+ * switch (r.err_code) {
7955
+ * case 0:
7956
+ * console.log('[smartico] avatar applied — close picker, refresh header avatar');
7957
+ * break;
7958
+ * case 1:
7959
+ * console.error('[smartico] avatar not in catalog — refresh catalog and show error');
7960
+ * break;
7961
+ * case 2:
7962
+ * console.error('[smartico] avatar inactive — operator disabled it; hide from picker');
7963
+ * break;
7964
+ * case 3:
7965
+ * console.error('[smartico] outside time window — show "available on X" message');
7966
+ * break;
7967
+ * case 4:
7968
+ * console.error('[smartico] not owned — show unlock requirements');
7969
+ * break;
7970
+ * default:
7971
+ * console.error('[smartico] avatar apply failed — show generic error toast:', r.err_message);
7972
+ * }
7973
+ * ```
6070
7974
  */
6071
7975
  ;
6072
7976
  _proto.setAvatar = function setAvatar(props) {
@@ -6102,37 +8006,65 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6102
8006
  _inheritsLoose(WSAPIGamePick, _WSAPIAvatars);
6103
8007
  var _proto = WSAPIGamePick.prototype;
6104
8008
  /**
6105
- * Returns the active rounds for the specified MatchX or Quiz game.
6106
- * Each round includes its events (matches/questions) along with the current user's selections and scores.
6107
- *
6108
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6109
- *
6110
- * **Response** `GamesApiResponse<GamePickRound[]>`:
6111
- * - `errCode` - 0 on success
6112
- * - `data` - Array of rounds, each containing:
6113
- * - `round_id`, `round_name` - Round identifier and display name
6114
- * - `open_date`, `last_bet_date` - Timestamps (ms) for round open and betting deadline
6115
- * - `is_active_now`, `is_resolved` - Round state flags
6116
- * - `round_status_id` - Round status: -1 (active), 2 (no more bets), 3 (all events resolved), 4 (round resolved)
6117
- * - `score_full_win`, `score_part_win`, `score_lost` - Scoring rules per prediction outcome
6118
- * - `user_score` - Current user's total score in this round
6119
- * - `user_placed_bet` - Whether the user has submitted predictions
6120
- * - `has_open_for_bet_events` - Whether there are events still open for betting
6121
- * - `events[]` - Array of events with `gp_event_id`, `market_type_id`, `event_meta` (team names, images, sport), `match_date`, `is_open_for_bets`, `odds_details`, and user selection fields
6122
- *
6123
- * **Example**:
6124
- * ```
6125
- * _smartico.api.gamePickGetActiveRounds({
6126
- * saw_template_id: 1083,
6127
- * }).then((result) => {
6128
- * console.log(result.data); // GamePickRound[]
6129
- * result.data.forEach(round => {
6130
- * console.log(round.round_name, round.events.length);
6131
- * });
6132
- * });
6133
- * ```
8009
+ * Returns every open round for a MatchX or Quiz game template, with the full
8010
+ * event list (matches / questions) and the current user's selections per event.
6134
8011
  *
6135
- * **Visitor mode: not supported**
8012
+ * Use to power the rounds-lobby screen — typically a list of round cards a user
8013
+ * can tap into to make predictions. For a single round, use
8014
+ * {@link gamePickGetActiveRound} (lighter payload when only one round is shown).
8015
+ *
8016
+ * @remarks
8017
+ * **Preconditions**
8018
+ * - User must be authenticated.
8019
+ * - `saw_template_id` must reference a MatchX or Quiz game template. The SDK
8020
+ * throws synchronously if it's missing.
8021
+ *
8022
+ * **Transport**
8023
+ * Game Pick methods are HTTP REST calls to a separate Game Pick games server
8024
+ * (not the main WebSocket). One consequence: there is no SDK cache and no push
8025
+ * subscription — every call is a fresh server roundtrip.
8026
+ *
8027
+ * **Round status**
8028
+ * Each round's `round_status_id` is a {@link GPRoundStatus} value. Rounds with
8029
+ * status `NoEventsDefined` (1) are filtered out server-side and never appear
8030
+ * here. Other values: `Other` (-1, normally open), `NoMoreBetsAllowed` (2),
8031
+ * `AllEventsResolved_ButNotRound` (3), `RoundResolved` (4 — appears here only
8032
+ * briefly during transition; use {@link gamePickGetHistory} for resolved rounds).
8033
+ *
8034
+ * **Error codes** (in `errCode`)
8035
+ * - `0` — success.
8036
+ * - `100002` — template not found (the `saw_template_id` doesn't reference a
8037
+ * MatchX/Quiz game).
8038
+ * - `100003` — no open rounds available for this template right now.
8039
+ * - `100000` — auth hash invalid; SDK session needs re-initialization.
8040
+ * - `100004` — generic server error.
8041
+ *
8042
+ * **Refresh**
8043
+ * - No cache; every call is live.
8044
+ * - No push subscription. Poll while the user is on the screen if you need
8045
+ * live round-status changes (typically every 30–60 s is enough).
8046
+ *
8047
+ * **Visitor mode**: not supported. The SDK throws synchronously on visitor
8048
+ * sessions.
8049
+ *
8050
+ * **UI guidance**: see [UI Guide — `gamePickGetActiveRounds`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md).
8051
+ *
8052
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8053
+ * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array.
8054
+ *
8055
+ * @example
8056
+ * ```ts
8057
+ * const r = await window._smartico.api.gamePickGetActiveRounds({ saw_template_id: 1083 });
8058
+ *
8059
+ * if (r.errCode !== 0) {
8060
+ * console.error('[smartico] active rounds fetch failed — show empty rounds lobby:', r.errMessage);
8061
+ * return;
8062
+ * }
8063
+ *
8064
+ * for (const round of r.data ?? []) {
8065
+ * console.log('[smartico] render a round card:', round.round_name, '— events:', round.events.length, 'user has placed bet:', round.user_placed_bet);
8066
+ * }
8067
+ * ```
6136
8068
  */
6137
8069
  _proto.gamePickGetActiveRounds = function gamePickGetActiveRounds(props) {
6138
8070
  try {
@@ -6146,29 +8078,56 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6146
8078
  }
6147
8079
  }
6148
8080
  /**
6149
- * Returns a single active round for the specified MatchX or Quiz game.
6150
- * The round includes full event details with the current user's selections.
8081
+ * Returns a single round (events, user selections, scoring rules) for a
8082
+ * MatchX or Quiz game. Use to power the round-detail / prediction-input
8083
+ * screen the user lands on after picking a round from the lobby.
6151
8084
  *
6152
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6153
- * @param props.round_id - The specific round to retrieve
8085
+ * Same shape as one entry of {@link gamePickGetActiveRounds}; cheaper when the
8086
+ * UI only shows one round at a time.
6154
8087
  *
6155
- * **Response** `GamesApiResponse<GamePickRound>`:
6156
- * - `errCode` - 0 on success
6157
- * - `data` - Single round object with the same structure as in `gamePickGetActiveRounds`,
6158
- * including `events[]` with full event details, user selections, and resolution info
8088
+ * @remarks
8089
+ * **Preconditions**
8090
+ * - User must be authenticated. Visitor mode not supported.
8091
+ * - `saw_template_id` and `round_id` are mandatory — the SDK throws if either
8092
+ * is missing.
8093
+ *
8094
+ * **Error codes** (in `errCode`)
8095
+ * - `0` — success.
8096
+ * - `4` — round / event not found (e.g. round resolved after the last
8097
+ * `gamePickGetActiveRounds` poll); non-fatal — retry after a fresh active-
8098
+ * rounds fetch.
8099
+ * - `100002` — template not found.
8100
+ * - `100000` — auth hash invalid.
8101
+ * - `100004` — generic server error.
8102
+ *
8103
+ * **Refresh**
8104
+ * - No cache; every call is live.
8105
+ * - Re-call after {@link gamePickSubmitSelection} or
8106
+ * {@link gamePickSubmitSelectionQuiz} to surface the persisted predictions.
8107
+ * - Poll while the user is on the prediction screen if event resolution
8108
+ * updates are needed (typically every 30–60 s).
6159
8109
  *
6160
- * **Example**:
6161
- * ```
6162
- * _smartico.api.gamePickGetActiveRound({
6163
- * saw_template_id: 1083,
6164
- * round_id: 31652,
6165
- * }).then((result) => {
6166
- * console.log(result.data.round_name, result.data.events.length);
6167
- * console.log(result.data.user_score, result.data.user_placed_bet);
8110
+ * **Visitor mode**: not supported.
8111
+ *
8112
+ * **UI guidance**: see [UI Guide — `gamePickGetActiveRound`](../../docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md).
8113
+ *
8114
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8115
+ * @param props.round_id ID of the round to fetch.
8116
+ * @returns Wrapped {@link GamesApiResponse} of a single {@link GamePickRound}.
8117
+ *
8118
+ * @example
8119
+ * ```ts
8120
+ * const r = await window._smartico.api.gamePickGetActiveRound({
8121
+ * saw_template_id: 1083,
8122
+ * round_id: 31652,
6168
8123
  * });
6169
- * ```
6170
8124
  *
6171
- * **Visitor mode: not supported**
8125
+ * if (r.errCode === 0 && r.data) {
8126
+ * 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);
8127
+ * } else {
8128
+ * console.error('[smartico] round fetch failed — bounce back to the lobby and refresh:', r.errMessage);
8129
+ * }
8130
+ * ```
6172
8131
  */
6173
8132
  ;
6174
8133
  _proto.gamePickGetActiveRound = function gamePickGetActiveRound(props) {
@@ -6186,29 +8145,52 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6186
8145
  }
6187
8146
  }
6188
8147
  /**
6189
- * Returns the history of all rounds (including resolved ones) for the specified MatchX or Quiz game.
6190
- * Each round contains full event details with results and the current user's predictions.
8148
+ * Returns the full round history (active + resolved) for a MatchX or Quiz game
8149
+ * template, newest-first. Each round carries the user's predictions plus the
8150
+ * server-resolved outcome on each event.
6191
8151
  *
6192
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
8152
+ * Use to power a "Past predictions" / history tab. For just the open rounds,
8153
+ * use {@link gamePickGetActiveRounds} (faster — skips resolved data).
6193
8154
  *
6194
- * **Response** `GamesApiResponse<GamePickRound[]>`:
6195
- * - `errCode` - 0 on success
6196
- * - `data` - Array of rounds ordered by `round_row_id` descending (newest first).
6197
- * Each round has the same structure as in `gamePickGetActiveRounds`, including resolved events
6198
- * with `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) and `resolution_score`
8155
+ * @remarks
8156
+ * **Preconditions**
8157
+ * - User must be authenticated. Visitor mode not supported.
6199
8158
  *
6200
- * **Example**:
6201
- * ```
6202
- * _smartico.api.gamePickGetHistory({
6203
- * saw_template_id: 1083,
6204
- * }).then((result) => {
6205
- * result.data.forEach(round => {
6206
- * console.log(round.round_name, 'Score:', round.user_score, 'Resolved:', round.is_resolved);
6207
- * });
6208
- * });
6209
- * ```
8159
+ * **Sort order**
8160
+ * Server returns rounds newest-first. No client-side sort needed.
6210
8161
  *
6211
- * **Visitor mode: not supported**
8162
+ * **Per-event resolution**
8163
+ * Each event in the rounds carries `resolution_type_id` — values are from
8164
+ * {@link GamePickResolutionType}: `None` (0, not yet resolved), `Lost` (2),
8165
+ * `PartialWin` (3), `FullWin` (4). Use these to render result badges on
8166
+ * each event row.
8167
+ *
8168
+ * **Error codes** (in `errCode`)
8169
+ * - `0` — success.
8170
+ * - `100002` — template not found.
8171
+ * - `100000` — auth hash invalid.
8172
+ * - `100004` — generic server error.
8173
+ *
8174
+ * **Refresh**
8175
+ * - No cache.
8176
+ * - No push subscription. Re-call when the user opens the history tab.
8177
+ *
8178
+ * **Visitor mode**: not supported.
8179
+ *
8180
+ * **UI guidance**: see [UI Guide — `gamePickGetHistory`](../../docs/ui/gamepick/UIGuide_gamePickGetHistory.md).
8181
+ *
8182
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8183
+ * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRound} array,
8184
+ * newest-first.
8185
+ *
8186
+ * @example
8187
+ * ```ts
8188
+ * const r = await window._smartico.api.gamePickGetHistory({ saw_template_id: 1083 });
8189
+ *
8190
+ * for (const round of r.data ?? []) {
8191
+ * console.log('[smartico] history row —', round.round_name, 'score:', round.user_score, 'resolved:', round.is_resolved);
8192
+ * }
8193
+ * ```
6212
8194
  */
6213
8195
  ;
6214
8196
  _proto.gamePickGetHistory = function gamePickGetHistory(props) {
@@ -6223,36 +8205,66 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6223
8205
  }
6224
8206
  }
6225
8207
  /**
6226
- * Returns the leaderboard for a specific round within a MatchX or Quiz game.
6227
- * Use `round_id = -1` (AllRoundsGameBoardID) to get the season/overall leaderboard across all rounds.
6228
- *
6229
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6230
- * @param props.round_id - The round to get the leaderboard for. Use -1 for overall/seasonal leaderboard
6231
- *
6232
- * **Response** `GamesApiResponse<GamePickRoundBoard>`:
6233
- * - `errCode` - 0 on success
6234
- * - `data` - Leaderboard object containing:
6235
- * - Round base fields (`round_id`, `round_name`, `open_date`, `last_bet_date`, etc.)
6236
- * - `users[]` - Ranked list of players, each with:
6237
- * - `ext_user_id`, `int_user_id` - User identifiers
6238
- * - `public_username`, `avatar_url` - Display info (usernames may be masked based on label settings)
6239
- * - `gp_position` - Leaderboard rank (null if not yet ranked)
6240
- * - `resolution_score` - Total score in this round
6241
- * - `full_wins_count`, `part_wins_count`, `lost_count` - Prediction outcome counts
6242
- * - `my_user` - Current user's entry (same fields as above), or null if user hasn't participated
6243
- *
6244
- * **Example**:
6245
- * ```
6246
- * _smartico.api.gamePickGetBoard({
6247
- * saw_template_id: 1083,
6248
- * round_id: 31652,
6249
- * }).then((result) => {
6250
- * console.log('Top players:', result.data.users);
6251
- * console.log('My position:', result.data.my_user?.gp_position);
8208
+ * Returns the leaderboard for a MatchX or Quiz game round — ranked list of
8209
+ * players plus the current user's entry (`my_user`). Pass `round_id: -1` for
8210
+ * the season / overall leaderboard across every round in the template.
8211
+ *
8212
+ * @remarks
8213
+ * **Preconditions**
8214
+ * - User must be authenticated. Visitor mode not supported.
8215
+ *
8216
+ * **`round_id` semantics**
8217
+ * - Positive `round_id` — per-round leaderboard scoped to that round's events.
8218
+ * - `-1` — season / overall leaderboard aggregating scores across every round
8219
+ * of the template.
8220
+ *
8221
+ * **`my_user`**
8222
+ * The current user's entry is returned separately from the `users[]` array
8223
+ * — `my_user` may be `null` if the user has never made a prediction on this
8224
+ * round / template. Use it to render the user's rank in a sticky footer or
8225
+ * "you are here" highlight regardless of pagination.
8226
+ *
8227
+ * **Username masking**
8228
+ * `public_username` on other players may be masked / anonymized by operator
8229
+ * label settings. Always pair with `avatar_url` so the user can recognize
8230
+ * themselves in the ranking by avatar even when usernames are hidden.
8231
+ *
8232
+ * **Error codes** (in `errCode`)
8233
+ * - `0` — success.
8234
+ * - `100002` — template not found.
8235
+ * - `100000` — auth hash invalid.
8236
+ * - `100004` — generic server error.
8237
+ *
8238
+ * **Refresh**
8239
+ * - No cache.
8240
+ * - No push subscription. Poll while the leaderboard is visible
8241
+ * (every 30–60 s) if you want live rank updates after match
8242
+ * resolution.
8243
+ *
8244
+ * **Visitor mode**: not supported.
8245
+ *
8246
+ * **UI guidance**: see [UI Guide — `gamePickGetBoard`](../../docs/ui/gamepick/UIGuide_gamePickGetBoard.md).
8247
+ *
8248
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8249
+ * @param props.round_id Round ID, or `-1` for the season leaderboard.
8250
+ * @returns Wrapped {@link GamesApiResponse} of {@link GamePickRoundBoard}.
8251
+ *
8252
+ * @example
8253
+ * ```ts
8254
+ * const r = await window._smartico.api.gamePickGetBoard({
8255
+ * saw_template_id: 1083,
8256
+ * round_id: -1, // season leaderboard
6252
8257
  * });
6253
- * ```
6254
8258
  *
6255
- * **Visitor mode: not supported**
8259
+ * if (r.errCode === 0 && r.data) {
8260
+ * console.log('[smartico] render leaderboard rows for top', r.data.users.length, 'players');
8261
+ * if (r.data.my_user) {
8262
+ * console.log('[smartico] pin "you are rank #' + r.data.my_user.gp_position + '" footer to bottom');
8263
+ * } else {
8264
+ * console.log('[smartico] user not ranked — render "Play a round to join the leaderboard" CTA');
8265
+ * }
8266
+ * }
8267
+ * ```
6256
8268
  */
6257
8269
  ;
6258
8270
  _proto.gamePickGetBoard = function gamePickGetBoard(props) {
@@ -6270,43 +8282,107 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6270
8282
  }
6271
8283
  }
6272
8284
  /**
6273
- * Submits score predictions for a round in a MatchX game.
6274
- * Sends the round object with user selections for all events at once.
6275
- * Each event must include `team1_user_selection` and `team2_user_selection` representing predicted scores.
6276
- * If the user hasn't placed bets before, one game attempt (spin) will be consumed.
6277
- * Predictions can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
6278
- *
6279
- * @param props.saw_template_id - The ID of the MatchX game template
6280
- * @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `gamePickGetActiveRound`
6281
- * and modified with user predictions. Each event needs: `gp_event_id`, `team1_user_selection`, `team2_user_selection`
6282
- *
6283
- * **Response** `GamesApiResponse<GamePickRound>`:
6284
- * - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
6285
- * - `data` - Updated round with all events reflecting the submitted selections.
6286
- * `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
6287
- *
6288
- * **Example**:
6289
- * ```
6290
- * _smartico.api.gamePickGetActiveRound({
6291
- * saw_template_id: 1190,
6292
- * round_id: 38665,
6293
- * }).then((roundData) => {
6294
- * const round = roundData.data;
6295
- * round.events = round.events.map(e => ({
6296
- * gp_event_id: e.gp_event_id,
6297
- * team1_user_selection: 1,
6298
- * team2_user_selection: 0,
6299
- * }));
6300
- * _smartico.api.gamePickSubmitSelection({
6301
- * saw_template_id: 1190,
6302
- * round: round,
6303
- * }).then((result) => {
6304
- * console.log(result.data.user_placed_bet); // true
6305
- * });
8285
+ * Submits all score predictions for a round in a MatchX game in one shot.
8286
+ * Each event in the round must carry `team1_user_selection` and
8287
+ * `team2_user_selection` (the predicted scores).
8288
+ *
8289
+ * On the user's FIRST submit for a round, the server charges one buy-in (one
8290
+ * "spin" / one currency deduction based on the template's `saw_buyin_type_id`).
8291
+ * Subsequent edits within the same round are free and only persist changed
8292
+ * selections.
8293
+ *
8294
+ * @remarks
8295
+ * **Preconditions**
8296
+ * - User must be authenticated. Visitor mode not supported.
8297
+ * - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
8298
+ * either is missing.
8299
+ * - Each event passed must include `gp_event_id` and the two
8300
+ * `team{1,2}_user_selection` fields. Missing events default to "no change".
8301
+ *
8302
+ * **Error codes** (in `errCode`)
8303
+ * - `0` — success; the response `data` is the updated round with
8304
+ * `user_placed_bet === true` and `has_not_submitted_changes === false`.
8305
+ * - `3` (`NoBetsUpdatedOnSubmit`) — submit produced no changes, OR every event
8306
+ * is past its `last_bet_date` deadline. The buy-in is NOT consumed; the
8307
+ * current round is still returned in `data`.
8308
+ * - `4` — round / event not found; refresh state and retry.
8309
+ * - `100002` — template not found.
8310
+ * - `100000` — auth hash invalid.
8311
+ * - `100004` — generic server error.
8312
+ *
8313
+ * Buy-in failures pass through the {@link SAWSpinErrorCode} values on first
8314
+ * submit:
8315
+ * - `40001` — no spins left (when `saw_buyin_type_id` is Spins).
8316
+ * - `40003` — insufficient points.
8317
+ * - `40004` — global max-spins cap hit.
8318
+ * - `40007` — template outside its active date window.
8319
+ * - `40009` — user excluded by segment rule.
8320
+ * - `40011` — insufficient gems.
8321
+ * - `40012` — insufficient diamonds.
8322
+ *
8323
+ * **Idempotency**
8324
+ * Re-submitting identical selections returns `errCode: 3` (no changes); the
8325
+ * buy-in is consumed exactly once per round-per-user. Re-submitting after
8326
+ * `last_bet_date` also returns `errCode: 3` without consuming the buy-in.
8327
+ *
8328
+ * **Side effects**
8329
+ * - First successful submit deducts the buy-in (Points / Gems / Diamonds /
8330
+ * one Spin) per `saw_buyin_type_id`.
8331
+ * - Reports a `minigame_matchx_prediction` event to the operator's event log.
8332
+ * - Updates the round's participant counter (`users_cnt`) and per-event
8333
+ * counters (`num_users`).
8334
+ * - Score is awarded after the operator resolves the round
8335
+ * ({@link GPRoundStatus} = `RoundResolved`).
8336
+ *
8337
+ * **Visitor mode**: not supported.
8338
+ *
8339
+ * **UI guidance**: see [UI Guide — `gamePickSubmitSelection`](../../docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md).
8340
+ *
8341
+ * @param props.saw_template_id ID of the MatchX game template.
8342
+ * @param props.round Round object with `round_id` + `events[]`
8343
+ * carrying the user's score predictions.
8344
+ * @returns Wrapped {@link GamesApiResponse} with the updated round.
8345
+ *
8346
+ * @example
8347
+ * ```ts
8348
+ * const ar = await window._smartico.api.gamePickGetActiveRound({
8349
+ * saw_template_id: 1190,
8350
+ * round_id: 38665,
6306
8351
  * });
6307
- * ```
8352
+ * if (ar.errCode !== 0 || !ar.data) {
8353
+ * console.error('[smartico] could not fetch round to submit — show error and bounce back');
8354
+ * return;
8355
+ * }
6308
8356
  *
6309
- * **Visitor mode: not supported**
8357
+ * const round = ar.data;
8358
+ * round.events = round.events.map(e => ({
8359
+ * gp_event_id: e.gp_event_id,
8360
+ * team1_user_selection: 1,
8361
+ * team2_user_selection: 0,
8362
+ * }));
8363
+ *
8364
+ * const r = await window._smartico.api.gamePickSubmitSelection({
8365
+ * saw_template_id: 1190,
8366
+ * round,
8367
+ * });
8368
+ *
8369
+ * switch (r.errCode) {
8370
+ * case 0:
8371
+ * console.log('[smartico] predictions saved — show confirmation, refresh leaderboard');
8372
+ * break;
8373
+ * case 3:
8374
+ * console.log('[smartico] nothing changed (or all events closed) — silent no-op');
8375
+ * break;
8376
+ * case 40001:
8377
+ * case 40003:
8378
+ * case 40011:
8379
+ * case 40012:
8380
+ * console.error('[smartico] insufficient balance / spins — show top-up CTA:', r.errMessage);
8381
+ * break;
8382
+ * default:
8383
+ * console.error('[smartico] submit failed — show generic error toast:', r.errMessage);
8384
+ * }
8385
+ * ```
6310
8386
  */
6311
8387
  ;
6312
8388
  _proto.gamePickSubmitSelection = function gamePickSubmitSelection(props) {
@@ -6325,42 +8401,83 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6325
8401
  }
6326
8402
  }
6327
8403
  /**
6328
- * Submits answers for a round in a Quiz game.
6329
- * Sends the round object with user answers for all events at once.
6330
- * Each event must include `user_selection` with the answer value (e.g. '1', '2', 'x', 'yes', 'no' — depending on the market type).
6331
- * If the user hasn't placed bets before, one game attempt (spin) will be consumed.
6332
- * Answers can be edited until each match starts (if `allow_edit_answers` is enabled on the round).
6333
- *
6334
- * @param props.saw_template_id - The ID of the Quiz game template
6335
- * @param props.round - Round object containing `round_id` and `events[]`. Typically obtained from `gamePickGetActiveRound`
6336
- * and modified with user answers. Each event needs: `gp_event_id`, `user_selection`
6337
- *
6338
- * **Response** `GamesApiResponse<GamePickRound>`:
6339
- * - `errCode` - 0 on success. Non-zero codes indicate errors (e.g. not enough points/attempts)
6340
- * - `data` - Updated round with all events reflecting the submitted answers.
6341
- * `user_placed_bet` will be `true`, `has_not_submitted_changes` will be `false`
6342
- *
6343
- * **Example**:
6344
- * ```
6345
- * _smartico.api.gamePickGetActiveRound({
6346
- * saw_template_id: 1183,
6347
- * round_id: 37974,
6348
- * }).then((roundData) => {
6349
- * const round = roundData.data;
6350
- * round.events = round.events.map(e => ({
6351
- * gp_event_id: e.gp_event_id,
6352
- * user_selection: 'x',
6353
- * }));
6354
- * _smartico.api.gamePickSubmitSelectionQuiz({
6355
- * saw_template_id: 1183,
6356
- * round: round,
6357
- * }).then((result) => {
6358
- * console.log(result.data.user_placed_bet); // true
6359
- * });
8404
+ * Submits all quiz answers for a round in one shot. Each event in the round
8405
+ * must carry `user_selection` (the answer value — typically `"1"` / `"2"` /
8406
+ * `"x"` for 1×2 markets, `"yes"` / `"no"` for binary markets, or any
8407
+ * operator-defined string for custom markets).
8408
+ *
8409
+ * Same first-submit buy-in behavior as {@link gamePickSubmitSelection} — one
8410
+ * buy-in is charged on the first successful submit; subsequent edits within
8411
+ * the same round are free.
8412
+ *
8413
+ * @remarks
8414
+ * **Preconditions**
8415
+ * - User must be authenticated. Visitor mode not supported.
8416
+ * - `saw_template_id` and `props.round.round_id` are mandatory — SDK throws if
8417
+ * either is missing.
8418
+ * - Each event must include `gp_event_id` and `user_selection`. Missing
8419
+ * events default to "no change".
8420
+ *
8421
+ * **Error codes** (in `errCode`)
8422
+ * - `0` — success.
8423
+ * - `3` (`NoBetsUpdatedOnSubmit`) — no changes, OR every event past
8424
+ * `last_bet_date`. Buy-in NOT consumed; current round returned in `data`.
8425
+ * - `4` — round / event not found.
8426
+ * - `100002` — template not found.
8427
+ * - `100000` — auth hash invalid.
8428
+ * - `100004` — generic server error.
8429
+ *
8430
+ * Buy-in failures use the same {@link SAWSpinErrorCode} pass-through values
8431
+ * as {@link gamePickSubmitSelection} — see that method's TSDoc for the
8432
+ * `40001` / `40003` / `40004` / `40007` / `40009` / `40011` / `40012`
8433
+ * semantics.
8434
+ *
8435
+ * **Idempotency**: identical to {@link gamePickSubmitSelection} — re-submit
8436
+ * returns `errCode: 3` and never double-charges the buy-in.
8437
+ *
8438
+ * **Side effects**: identical to {@link gamePickSubmitSelection}, with the
8439
+ * reported event being `minigame_quiz_prediction` instead of
8440
+ * `minigame_matchx_prediction`.
8441
+ *
8442
+ * **Visitor mode**: not supported.
8443
+ *
8444
+ * **UI guidance**: see [UI Guide — `gamePickSubmitSelectionQuiz`](../../docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md).
8445
+ *
8446
+ * @param props.saw_template_id ID of the Quiz game template.
8447
+ * @param props.round Round object with `round_id` + `events[]`
8448
+ * carrying the user's answer selections.
8449
+ * @returns Wrapped {@link GamesApiResponse} with the updated round.
8450
+ *
8451
+ * @example
8452
+ * ```ts
8453
+ * const ar = await window._smartico.api.gamePickGetActiveRound({
8454
+ * saw_template_id: 1183,
8455
+ * round_id: 37974,
6360
8456
  * });
6361
- * ```
8457
+ * if (ar.errCode !== 0 || !ar.data) {
8458
+ * console.error('[smartico] could not fetch round to submit answers — show error');
8459
+ * return;
8460
+ * }
6362
8461
  *
6363
- * **Visitor mode: not supported**
8462
+ * const round = ar.data;
8463
+ * round.events = round.events.map(e => ({
8464
+ * gp_event_id: e.gp_event_id,
8465
+ * user_selection: 'x',
8466
+ * }));
8467
+ *
8468
+ * const r = await window._smartico.api.gamePickSubmitSelectionQuiz({
8469
+ * saw_template_id: 1183,
8470
+ * round,
8471
+ * });
8472
+ *
8473
+ * if (r.errCode === 0) {
8474
+ * console.log('[smartico] quiz answers saved — show confirmation');
8475
+ * } else if (r.errCode === 3) {
8476
+ * console.log('[smartico] nothing changed — silent no-op');
8477
+ * } else {
8478
+ * console.error('[smartico] quiz submit failed:', r.errMessage);
8479
+ * }
8480
+ * ```
6364
8481
  */
6365
8482
  ;
6366
8483
  _proto.gamePickSubmitSelectionQuiz = function gamePickSubmitSelectionQuiz(props) {
@@ -6378,36 +8495,52 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6378
8495
  return Promise.reject(e);
6379
8496
  }
6380
8497
  }
6381
- /**
6382
- * Returns the current user's profile information within the specified MatchX or Quiz game.
6383
- * The user record is synced from the Smartico platform into the games DB (synced every 1 minute).
6384
- * If the user doesn't exist in the games DB yet, it will be created automatically on first call.
6385
- *
6386
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6387
- *
6388
- * **Response** `GamesApiResponse<GamePickUserInfo>`:
6389
- * - `errCode` - 0 on success
6390
- * - `data`:
6391
- * - `ext_user_id` - External user ID (Smartico internal numeric ID)
6392
- * - `int_user_id` - Internal user ID within the games system
6393
- * - `public_username` - Display name
6394
- * - `avatar_url` - User's avatar image URL
6395
- * - `last_wallet_sync_time` - Last time the user's balance was synced from Smartico
6396
- * - `ach_points_balance` - User's current points balance
6397
- * - `ach_gems_balance` - User's current gems balance
6398
- * - `ach_diamonds_balance` - User's current diamonds balance
6399
- * - `pubic_username_set` - Whether the user has set a custom username
6400
- *
6401
- * **Example**:
6402
- * ```
6403
- * _smartico.api.gamePickGetUserInfo({
6404
- * saw_template_id: 1083,
6405
- * }).then((result) => {
6406
- * console.log(result.data.public_username, result.data.ach_points_balance);
6407
- * });
6408
- * ```
8498
+ /**
8499
+ * Returns the current user's profile within the Game Pick system — display
8500
+ * name, avatar, balances, and last wallet-sync timestamp. The Game Pick server
8501
+ * maintains its own user record that mirrors the user's Smartico balances; the
8502
+ * mirror is updated at most once per minute, so `last_wallet_sync_time` tells
8503
+ * the consumer how stale the balances on the response are.
6409
8504
  *
6410
- * **Visitor mode: not supported**
8505
+ * On the user's first call for a given game, the Game Pick server lazily
8506
+ * provisions a user record — so this method doubles as a "register the user
8507
+ * with this game" call.
8508
+ *
8509
+ * @remarks
8510
+ * **Preconditions**
8511
+ * - User must be authenticated. Visitor mode not supported.
8512
+ *
8513
+ * **Balance freshness**
8514
+ * The balances returned here are the cached mirror — at most ~1 minute stale.
8515
+ * For an up-to-the-second view of Points / Gems / Diamonds, read from
8516
+ * {@link getUserProfile} instead. Use this method's balances only for
8517
+ * in-Game-Pick display.
8518
+ *
8519
+ * **Error codes** (in `errCode`)
8520
+ * - `0` — success.
8521
+ * - `100002` — template not found.
8522
+ * - `100000` — auth hash invalid.
8523
+ * - `100004` — generic server error.
8524
+ *
8525
+ * **Refresh**
8526
+ * - No cache. Server-side mirror refreshes at most every 60 s.
8527
+ * - No push subscription.
8528
+ *
8529
+ * **Visitor mode**: not supported.
8530
+ *
8531
+ * **UI guidance**: see [UI Guide — `gamePickGetUserInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md).
8532
+ *
8533
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8534
+ * @returns Wrapped {@link GamesApiResponse} of {@link GamePickUserInfo}.
8535
+ *
8536
+ * @example
8537
+ * ```ts
8538
+ * const r = await window._smartico.api.gamePickGetUserInfo({ saw_template_id: 1083 });
8539
+ *
8540
+ * if (r.errCode === 0 && r.data) {
8541
+ * console.log('[smartico] render Game Pick header — name:', r.data.public_username, '— points:', r.data.ach_points_balance, '— synced:', r.data.last_wallet_sync_time);
8542
+ * }
8543
+ * ```
6411
8544
  */
6412
8545
  ;
6413
8546
  _proto.gamePickGetUserInfo = function gamePickGetUserInfo(props) {
@@ -6422,38 +8555,56 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6422
8555
  }
6423
8556
  }
6424
8557
  /**
6425
- * Returns the game configuration and the list of all rounds for the specified MatchX or Quiz game.
6426
- * Includes the SAW template definition, label settings, and round metadata (without events).
6427
- *
6428
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6429
- *
6430
- * **Response** `GamesApiResponse<GamePickGameInfo>`:
6431
- * - `errCode` - 0 on success
6432
- * - `data`:
6433
- * - `sawTemplate` - Game template configuration including:
6434
- * - `saw_template_id`, `saw_game_type_id` (6 = MatchX/Quiz)
6435
- * - `saw_template_ui_definition` - UI settings (name, ranking options, ask_for_username, etc.)
6436
- * - `saw_buyin_type_id` - Cost type (1=Free, 2=Points, 3=Gems, 4=Diamonds, 5=Spins)
6437
- * - `buyin_cost_points` - Cost per attempt
6438
- * - `spin_count` - Available attempts for the current user
6439
- * - `allRounds[]` - List of all rounds (metadata only, no events), each with:
6440
- * - `round_id`, `round_name`, `round_description`
6441
- * - `open_date`, `last_bet_date` - Timestamps (ms)
6442
- * - `is_active_now`, `is_resolved`, `round_status_id`
6443
- * - `labelInfo` - Label/brand configuration and settings
6444
- *
6445
- * **Example**:
6446
- * ```
6447
- * _smartico.api.gamePickGetGameInfo({
6448
- * saw_template_id: 1189,
6449
- * }).then((result) => {
6450
- * console.log(result.data.sawTemplate.saw_template_ui_definition.name);
6451
- * console.log('Rounds:', result.data.allRounds.length);
6452
- * console.log('Buy-in type:', result.data.sawTemplate.saw_buyin_type_id);
6453
- * });
6454
- * ```
8558
+ * Returns the game template configuration plus a metadata listing of every
8559
+ * round (without events). Use to power the game's welcome / lobby screen —
8560
+ * shows the template name, buy-in cost, the user's remaining attempts, and
8561
+ * the full round list.
6455
8562
  *
6456
- * **Visitor mode: not supported**
8563
+ * The `allRounds[]` here is a lightweight metadata-only view — to render
8564
+ * predictions or leaderboards, call {@link gamePickGetActiveRound} /
8565
+ * {@link gamePickGetActiveRounds} / {@link gamePickGetBoard} for the rounds
8566
+ * the user actually opens.
8567
+ *
8568
+ * @remarks
8569
+ * **Preconditions**
8570
+ * - User must be authenticated. Visitor mode not supported.
8571
+ *
8572
+ * **Buy-in semantics**
8573
+ * The `sawTemplate.saw_buyin_type_id` value determines which currency is
8574
+ * deducted on the user's first prediction in any round:
8575
+ * - Free — no deduction.
8576
+ * - Points — `buyin_cost_points` deducted from the user's points balance.
8577
+ * - Gems — deducted from the user's gems balance.
8578
+ * - Diamonds — deducted from the user's diamonds balance.
8579
+ * - Spins — one spin counted from `spin_count`.
8580
+ *
8581
+ * **Error codes** (in `errCode`)
8582
+ * - `0` — success.
8583
+ * - `100002` — template not found.
8584
+ * - `100000` — auth hash invalid.
8585
+ * - `100004` — generic server error.
8586
+ *
8587
+ * **Refresh**
8588
+ * - No cache.
8589
+ * - No push subscription. Re-call after a successful
8590
+ * {@link gamePickSubmitSelection} to refresh `spin_count`.
8591
+ *
8592
+ * **Visitor mode**: not supported.
8593
+ *
8594
+ * **UI guidance**: see [UI Guide — `gamePickGetGameInfo`](../../docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md).
8595
+ *
8596
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8597
+ * @returns Wrapped {@link GamesApiResponse} of {@link GamePickGameInfo}.
8598
+ *
8599
+ * @example
8600
+ * ```ts
8601
+ * const r = await window._smartico.api.gamePickGetGameInfo({ saw_template_id: 1189 });
8602
+ *
8603
+ * if (r.errCode === 0 && r.data) {
8604
+ * console.log('[smartico] render Game Pick lobby — title:', r.data.sawTemplate.saw_template_ui_definition.name);
8605
+ * console.log('[smartico] rounds available:', r.data.allRounds.length, '— buy-in type:', r.data.sawTemplate.saw_buyin_type_id, 'cost:', r.data.sawTemplate.buyin_cost_points);
8606
+ * }
8607
+ * ```
6457
8608
  */
6458
8609
  ;
6459
8610
  _proto.gamePickGetGameInfo = function gamePickGetGameInfo(props) {
@@ -6468,35 +8619,73 @@ var WSAPIGamePick = /*#__PURE__*/function (_WSAPIAvatars) {
6468
8619
  }
6469
8620
  }
6470
8621
  /**
6471
- * Returns round data with events and picks for a specific user (identified by their internal user ID).
6472
- * Useful for viewing another user's predictions from the leaderboard.
6473
- * The `int_user_id` can be obtained from the `gamePickGetBoard` response (`users[].int_user_id`).
6474
- *
6475
- * @param props.saw_template_id - The ID of the MatchX or Quiz game template
6476
- * @param props.round_id - The round to get info for
6477
- * @param props.int_user_id - Internal user ID of the player whose predictions to view (from leaderboard data)
6478
- *
6479
- * **Response** `GamesApiResponse<GamePickRound>`:
6480
- * - `errCode` - 0 on success
6481
- * - `data` - Round object with the target user's selections.
6482
- * Same structure as `gamePickGetActiveRound`, but `user_selection`/`team1_user_selection`/`team2_user_selection`
6483
- * fields on events reflect the specified user's picks instead of the current user's.
6484
- * Events also include `resolution_type_id` (0=None, 2=Lost, 3=PartialWin, 4=FullWin) showing how each prediction was scored
6485
- *
6486
- * **Example**:
6487
- * ```
6488
- * _smartico.api.gamePickGetRoundInfoForUser({
6489
- * saw_template_id: 1083,
6490
- * round_id: 31652,
6491
- * int_user_id: 65653810,
6492
- * }).then((result) => {
6493
- * result.data.events.forEach(e => {
6494
- * console.log(e.event_meta.team1_name, 'vs', e.event_meta.team2_name, '→', e.user_selection);
6495
- * });
8622
+ * Returns a round with another player's predictions instead of the current
8623
+ * user's. The target player is identified by `int_user_id` (the Game Pick
8624
+ * system's internal user ID, obtained from {@link gamePickGetBoard}'s
8625
+ * `users[].int_user_id`).
8626
+ *
8627
+ * Use to power "view this player's picks" affordances opened from leaderboard
8628
+ * rows — community / social inspection of how a top-ranked user predicted.
8629
+ *
8630
+ * @remarks
8631
+ * **Preconditions**
8632
+ * - User must be authenticated. Visitor mode not supported.
8633
+ * - `saw_template_id`, `round_id`, and `int_user_id` are all mandatory — SDK
8634
+ * throws synchronously if any is missing.
8635
+ * - `int_user_id` must come from a leaderboard fetch in the same game
8636
+ * template; it is stable within a template but not portable across
8637
+ * templates.
8638
+ *
8639
+ * **Shape vs `gamePickGetActiveRound`**
8640
+ * Same {@link GamePickRound} structure, but `user_selection` /
8641
+ * `team1_user_selection` / `team2_user_selection` reflect the TARGET user's
8642
+ * predictions instead of the caller's. Each event still carries its own
8643
+ * `resolution_type_id` (see {@link GamePickResolutionType}) so the UI can
8644
+ * render result badges per pick.
8645
+ *
8646
+ * **Error codes** (in `errCode`)
8647
+ * - `0` — success.
8648
+ * - `4` — round / event / user not found.
8649
+ * - `100002` — template not found.
8650
+ * - `100000` — auth hash invalid.
8651
+ * - `100004` — generic server error.
8652
+ *
8653
+ * **Refresh**
8654
+ * - No cache. Re-call when opening a different leaderboard row's
8655
+ * "view picks" modal.
8656
+ * - No push subscription.
8657
+ *
8658
+ * **Visitor mode**: not supported.
8659
+ *
8660
+ * **UI guidance**: see [UI Guide — `gamePickGetRoundInfoForUser`](../../docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md).
8661
+ *
8662
+ * @param props.saw_template_id ID of the MatchX or Quiz game template.
8663
+ * @param props.round_id ID of the round to inspect.
8664
+ * @param props.int_user_id Internal user ID from
8665
+ * `gamePickGetBoard.users[].int_user_id`.
8666
+ * @returns Wrapped {@link GamesApiResponse} with the target user's
8667
+ * {@link GamePickRound}.
8668
+ *
8669
+ * @example
8670
+ * ```ts
8671
+ * const board = await window._smartico.api.gamePickGetBoard({
8672
+ * saw_template_id: 1083, round_id: 31652,
6496
8673
  * });
6497
- * ```
8674
+ * const topPlayer = board.data?.users?.[0];
8675
+ * if (!topPlayer) return;
6498
8676
  *
6499
- * **Visitor mode: not supported**
8677
+ * const r = await window._smartico.api.gamePickGetRoundInfoForUser({
8678
+ * saw_template_id: 1083,
8679
+ * round_id: 31652,
8680
+ * int_user_id: topPlayer.int_user_id,
8681
+ * });
8682
+ *
8683
+ * if (r.errCode === 0 && r.data) {
8684
+ * for (const ev of r.data.events) {
8685
+ * console.log('[smartico] render row —', ev.event_meta.team1_name, 'vs', ev.event_meta.team2_name, '— picked:', ev.user_selection, '— resolution:', ev.resolution_type_id);
8686
+ * }
8687
+ * }
8688
+ * ```
6500
8689
  */
6501
8690
  ;
6502
8691
  _proto.gamePickGetRoundInfoForUser = function gamePickGetRoundInfoForUser(props) {
@@ -6527,21 +8716,135 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
6527
8716
  _inheritsLoose(WSAPILeaderBoard, _WSAPIGamePick);
6528
8717
  var _proto = WSAPILeaderBoard.prototype;
6529
8718
  /**
6530
- * Returns the leaderboard for the current type (default is Daily). If getPreviousPeriod is passed as true, a leaderboard for the previous period for the current type will be returned.
6531
- * For example, if the type is Weekly and getPreviousPeriod is true, a leaderboard for the previous week will be returned.
8719
+ * Returns the operator-configured standalone leaderboard for the
8720
+ * given period type — top-20 ranked entries, the current user's
8721
+ * own entry (when authenticated), and the configured prize table.
8722
+ * Use this to power a leaderboard page with daily / weekly /
8723
+ * monthly tabs.
6532
8724
  *
6533
- * **Example**:
6534
- * ```
6535
- * _smartico.api.getLeaderBoard(1).then((result) => {
6536
- * console.log(result);
6537
- * });
6538
- * ```
8725
+ * The leaderboard for each period type is configured separately by
8726
+ * the operator. A label may have any combination of DAILY, WEEKLY,
8727
+ * and MONTHLY boards configured (or none).
6539
8728
  *
6540
- * **Example in the Visitor mode**:
6541
- * ```
6542
- * _smartico.vapi('EN').getLeaderBoard(1).then((result) => {
6543
- * console.log(result);
6544
- * });
8729
+ * @remarks
8730
+ * **Return value note** — the runtime may return `undefined` if no
8731
+ * board is configured for the requested `periodType`, despite the
8732
+ * static return type being `Promise<LeaderBoardDetailsT>`. Defend
8733
+ * against that case in consumer code.
8734
+ *
8735
+ * **Preconditions**
8736
+ * Pass a `periodType` from {@link LeaderBoardPeriodType}
8737
+ * (`DAILY = 1`, `WEEKLY = 2`, `MONTHLY = 3`). Pass
8738
+ * `getPreviousPeriod: true` to fetch the most-recently-ended
8739
+ * period's snapshot (yesterday's results, last week's results,
8740
+ * last month's results) instead of the current live period. The
8741
+ * SDK only exposes one period back — older snapshots are not
8742
+ * reachable through this method.
8743
+ *
8744
+ * **Top-20 cap**
8745
+ * The server hard-caps `users[]` at 20 entries, ordered by
8746
+ * `position` ASC. Position values are server-computed (DENSE_RANK
8747
+ * over all participants); the truncation at 20 is for transport
8748
+ * size only — `position` may exceed 20 elsewhere.
8749
+ *
8750
+ * **The `me` field**
8751
+ * Always populated for authenticated users (even when they have
8752
+ * zero points in the period). `me.position === -1` is the signal
8753
+ * that the user is active but ranked outside the top 20 (or has no
8754
+ * activity yet). `me` is `undefined` for visitor-mode sessions.
8755
+ *
8756
+ * **Rewards are points only**
8757
+ * `rewards[].points` are gamification points credited to the user's
8758
+ * balance when the period finalizes. The leaderboard never awards
8759
+ * gems, diamonds, store items, or bonuses. The first element of
8760
+ * the array is the prize for place 1, the second for place 2, and
8761
+ * so on. The array length is the number of paid places.
8762
+ *
8763
+ * **Cache TTL — single shared key (known limitation)**
8764
+ * The SDK caches the response for 30 seconds under a SINGLE shared
8765
+ * key — calling `getLeaderBoard(DAILY)` followed by
8766
+ * `getLeaderBoard(WEEKLY)` within the same 30 s window returns the
8767
+ * cached DAILY result for the WEEKLY call. Same applies to
8768
+ * switching `getPreviousPeriod`. To force a fresh fetch when
8769
+ * switching periods or current/previous, call
8770
+ * `_smartico.api.clearCaches()` before the second call, or simply
8771
+ * wait out the TTL.
8772
+ *
8773
+ * **Period boundaries**
8774
+ * The server finalizes each period on a server-configurable
8775
+ * schedule: DAILY at midnight + operator-defined offset; WEEKLY
8776
+ * at the start of Monday; MONTHLY on the 1st of each month. At
8777
+ * finalization, the server distributes the configured `rewards[]`
8778
+ * points to the top placeholders and resets the live board. After
8779
+ * finalization, `getLeaderBoard(periodType, false)` returns the
8780
+ * NEW (empty) period's board; call with
8781
+ * `getPreviousPeriod: true` to see the just-ended standings.
8782
+ *
8783
+ * **Refresh model**
8784
+ * - One-shot fetch (no subscription).
8785
+ * - No push event refreshes the cache; finalization at the period
8786
+ * boundary is NOT pushed to the client.
8787
+ * - Poll manually if the consumer needs near-live state during an
8788
+ * in-progress period.
8789
+ *
8790
+ * **Idempotency / Side effects**: safe. Read-only.
8791
+ *
8792
+ * **UI guidance**: see [UI Guide — `getLeaderBoard`](../../docs/ui/leaderboard/UIGuide_getLeaderBoard.md).
8793
+ *
8794
+ * **Visitor mode**: supported. The same shape is returned, scoped
8795
+ * to the brand's public leaderboard. `me` is `undefined` for
8796
+ * visitors.
8797
+ *
8798
+ * @param periodType The board's period type
8799
+ * ({@link LeaderBoardPeriodType}).
8800
+ * Selects which pre-configured board to
8801
+ * fetch; the board itself is bound to one
8802
+ * period by the operator.
8803
+ * @param getPreviousPeriod When `true`, returns the most recent
8804
+ * finalized snapshot for that period type
8805
+ * (e.g. last week's results). Defaults to
8806
+ * `false` (current in-progress period).
8807
+ * @returns Promise resolving to `LeaderBoardDetailsT`.
8808
+ * **At runtime, may resolve to `undefined`**
8809
+ * when no board is configured for the
8810
+ * requested period type — guard against it.
8811
+ *
8812
+ * @example
8813
+ * ```ts
8814
+ * import { LeaderBoardPeriodType } from '@smartico/public-api';
8815
+ *
8816
+ * const board = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY);
8817
+ *
8818
+ * if (!board) {
8819
+ * console.log('[smartico] no weekly board configured for this label — hide the leaderboard surface');
8820
+ * return;
8821
+ * }
8822
+ *
8823
+ * console.log('[smartico] render leaderboard tab —', board.name, '—', board.users.length, 'ranked entries (top 20 max)');
8824
+ *
8825
+ * // Render prize table.
8826
+ * for (const reward of board.rewards) {
8827
+ * console.log('[smartico] prize row — place', reward.place, '→', reward.points, 'points');
8828
+ * }
8829
+ *
8830
+ * // "Me" panel — sticky row showing the current user's rank.
8831
+ * if (board.me) {
8832
+ * if (board.me.position === -1) {
8833
+ * console.log('[smartico] user is unranked — show "You are unranked, earn points to enter the leaderboard"');
8834
+ * } else if (board.me.position > 20) {
8835
+ * console.log('[smartico] user is ranked', board.me.position, 'but outside the visible top-20 — show sticky "me" row with', board.me.points, 'points');
8836
+ * } else {
8837
+ * console.log('[smartico] user is in the top 20 at position', board.me.position, '— highlight their row in the main list');
8838
+ * }
8839
+ * }
8840
+ *
8841
+ * // Switch to previous period view — but bust the cache first to avoid the shared-key collision.
8842
+ * await window._smartico.api.clearCaches();
8843
+ * const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
8844
+ * console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
8845
+ *
8846
+ * // Visitor-mode equivalent — me is always undefined.
8847
+ * // const visitorBoard = await window._smartico.vapi('EN').getLeaderBoard(LeaderBoardPeriodType.DAILY);
6545
8848
  * ```
6546
8849
  */
6547
8850
  _proto.getLeaderBoard = function getLeaderBoard(periodType, getPreviousPeriod) {
@@ -6565,23 +8868,49 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6565
8868
  _inheritsLoose(WSAPIInbox, _WSAPILeaderBoard);
6566
8869
  var _proto = WSAPIInbox.prototype;
6567
8870
  /**
6568
- * Reports an impression event for an engagement (when engagement content is displayed to the user).
6569
- * Use this method to track when users view engagement content such as inbox messages, popups.
6570
- * When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType.
8871
+ * Records that an engagement (inbox message, popup) was displayed to
8872
+ * the user. Use this to drive engagement analytics — every visible
8873
+ * inbox message should fire one impression event per render
8874
+ * occurrence, and every popup display should fire one.
6571
8875
  *
6572
- * **Example**:
6573
- * ```
6574
- * _smartico.api.reportImpressionEvent({
6575
- * engagement_uid: 'abc123-def456',
6576
- * activityType: 31 // Inbox
6577
- * });
6578
- * ```
8876
+ * **Fire-and-forget**: the call is asynchronous and one-way — there
8877
+ * is no response promise to await and no error reporting. The SDK
8878
+ * swallows transport failures silently. Returns `void`.
6579
8879
  *
6580
- * **Visitor mode: not supported**
8880
+ * @remarks
8881
+ * **When to call**
8882
+ * - Inbox: when a message becomes visible (the user opens / scrolls
8883
+ * it into view). The default Smartico UI fires this when the
8884
+ * message detail expands, alongside
8885
+ * {@link markInboxMessageAsRead}.
8886
+ * - Popup: when the popup content is shown to the user.
8887
+ *
8888
+ * **Activity types**
8889
+ * Pass {@link ActivityTypeLimited.Inbox} (`31`) for inbox messages,
8890
+ * {@link ActivityTypeLimited.Popup} (`30`) for popups. Other values
8891
+ * are not used by the engagement-impression channel.
8892
+ *
8893
+ * **Idempotency**: the server records every impression event —
8894
+ * repeated calls add to the impression count. Don't fire it on
8895
+ * every re-render; fire it once per logical "display" event
8896
+ * (modal open, list-row scroll-into-view, popup show).
8897
+ *
8898
+ * **Side effects**: server-side increments the engagement's
8899
+ * `impression_count` and updates `last_impression_date`. The
8900
+ * counter is observable via operator analytics; the SDK consumer
8901
+ * receives no signal back.
8902
+ *
8903
+ * **Visitor mode**: not supported.
6581
8904
  *
6582
- * @param params - Event parameters
6583
- * @param params.engagement_uid - Unique identifier for the engagement
6584
- * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
8905
+ * @example
8906
+ * ```ts
8907
+ * // When the user opens an inbox message in the detail view.
8908
+ * window._smartico.api.reportImpressionEvent({
8909
+ * engagement_uid: message.message_guid,
8910
+ * activityType: 31, // ActivityTypeLimited.Inbox
8911
+ * });
8912
+ * console.log('[smartico] inbox impression reported for', message.message_guid, '— no response to await, fire-and-forget');
8913
+ * ```
6585
8914
  */
6586
8915
  _proto.reportImpressionEvent = function reportImpressionEvent(_ref) {
6587
8916
  var engagement_uid = _ref.engagement_uid,
@@ -6589,25 +8918,54 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6589
8918
  this.api.reportEngagementImpression(this.userExtId, engagement_uid, activityType);
6590
8919
  }
6591
8920
  /**
6592
- * Reports a click/action event for an engagement (when user interacts with engagement content).
6593
- * Use this method to track when users click on or interact with engagement content such as inbox messages, popups.
6594
- * When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType, and pass the action/deeplink that was triggered by the user interaction as action.
8921
+ * Records that the user interacted with an engagement — typically
8922
+ * tapping a CTA button, following a deep-link, or clicking a popup
8923
+ * action. Use this to drive engagement analytics on what users
8924
+ * actually act on (vs what they merely see —
8925
+ * {@link reportImpressionEvent}).
6595
8926
  *
6596
- * **Example**:
6597
- * ```
6598
- * _smartico.api.reportClickEvent({
6599
- * engagement_uid: 'abc123-def456',
6600
- * activityType: 31 // Inbox
6601
- * action: 'dp:gf_missions'
6602
- * });
6603
- * ```
8927
+ * **Fire-and-forget**: the call is asynchronous and one-way — there
8928
+ * is no response promise to await and no error reporting. The SDK
8929
+ * swallows transport failures silently. Returns `void`.
6604
8930
  *
6605
- * **Visitor mode: not supported**
8931
+ * @remarks
8932
+ * **When to call**
8933
+ * - Inbox: when the user taps a CTA button on a message or follows
8934
+ * a deep-link inside the message body. Pass the deep-link or URL
8935
+ * as `action`.
8936
+ * - Popup: when the user clicks a popup action button.
8937
+ *
8938
+ * **Activity types**
8939
+ * Pass {@link ActivityTypeLimited.Inbox} (`31`) for inbox,
8940
+ * {@link ActivityTypeLimited.Popup} (`30`) for popups.
8941
+ *
8942
+ * **`action` payload**
8943
+ * Pass the deep-link or URL that the user triggered (e.g.
8944
+ * `'dp:gf_missions'`, `'https://example.com/promo'`). The SDK
8945
+ * forwards the string to the server for analytics — it does not
8946
+ * execute the deep-link. To execute deep-links safely, call
8947
+ * `_smartico.dp(action)` separately.
8948
+ *
8949
+ * **Idempotency**: the server records every click event —
8950
+ * repeated calls add to the count. Fire once per logical user
8951
+ * action.
8952
+ *
8953
+ * **Side effects**: server-side updates the engagement's
8954
+ * `last_action` field; observable via operator analytics. The SDK
8955
+ * consumer receives no signal back.
6606
8956
  *
6607
- * @param params - Event parameters
6608
- * @param params.engagement_uid - Unique identifier for the engagement
6609
- * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
6610
- * @param params.action - Optional action/deeplink that was triggered by the user interaction
8957
+ * **Visitor mode**: not supported.
8958
+ *
8959
+ * @example
8960
+ * ```ts
8961
+ * // When the user taps a CTA button in an inbox message.
8962
+ * window._smartico.api.reportClickEvent({
8963
+ * engagement_uid: message.message_guid,
8964
+ * activityType: 31, // ActivityTypeLimited.Inbox
8965
+ * action: 'dp:gf_missions',
8966
+ * });
8967
+ * window._smartico.dp('dp:gf_missions'); // separately execute the deep-link
8968
+ * ```
6611
8969
  */;
6612
8970
  _proto.reportClickEvent = function reportClickEvent(_ref2) {
6613
8971
  var engagement_uid = _ref2.engagement_uid,
@@ -6615,19 +8973,118 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6615
8973
  action = _ref2.action;
6616
8974
  this.api.reportEngagementAction(this.userExtId, engagement_uid, activityType, action);
6617
8975
  }
6618
- /** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
6619
- * The maximum number of messages per request is limited to 20.
6620
- * An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
6621
- * An indicator "read_status" can be passed to get only messages marked as read or unread.
6622
- * You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
6623
- * This function returns a list of messages without the body of each message.
6624
- * To get the body of the message you need to call getInboxMessageBody function and pass the message guid contained in each message of this request.
6625
- * All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
6626
- * The "onUpdate" callback will be triggered when the user receives a new message. It will provide an updated list of messages, ranging from 0 to 20, to the onUpdate callback function.
8976
+ /**
8977
+ * Returns the user's inbox messages — newest first — with optional
8978
+ * filtering by category, favorite status, and read state. Each
8979
+ * `TInboxMessage` is a lightweight envelope (`message_guid`,
8980
+ * `sent_date`, `read`, `favorite`, `category_id`, `expire_on_dt`);
8981
+ * fetch the rich body (title, preview, icon, html_body, buttons)
8982
+ * separately via {@link getInboxMessageBody}.
6627
8983
  *
6628
- * **Visitor mode: not supported**
8984
+ * Use this to power an inbox list screen. Subscribe via `onUpdate`
8985
+ * to react to newly-arrived messages pushed by the server (from
8986
+ * campaigns, automation rules, manual operator sends).
8987
+ *
8988
+ * @remarks
8989
+ * **Subscription model (`onUpdate`)**
8990
+ * The callback receives the FULL refreshed message list (never a
8991
+ * diff/patch). Each subsequent call to `getInboxMessages({ onUpdate })`
8992
+ * REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
8993
+ * it) to keep the prior callback in place; the callback is never
8994
+ * auto-cleared.
8995
+ *
8996
+ * **Update triggers** — the callback fires ONLY when:
8997
+ *
8998
+ * 1. A new message is pushed by the server (campaign / automation /
8999
+ * operator send). The refreshed list includes the new message
9000
+ * at the top.
9001
+ *
9002
+ * Does NOT fire for: `markInboxMessageAsRead`,
9003
+ * `markAllInboxMessagesAsRead`,
9004
+ * `markUnmarkInboxMessageAsFavorite`, `deleteInboxMessage`,
9005
+ * `deleteAllInboxMessages`. After a mutation, re-call
9006
+ * `getInboxMessages` manually if your UI needs the refreshed list
9007
+ * — or maintain optimistic state locally.
9008
+ *
9009
+ * **Pagination**
9010
+ * `from` (defaults to `0`) and `to` (defaults to `20`) define a
9011
+ * half-open range of message indices. The server caps the page at
9012
+ * **20 messages per request** — passing `to - from > 20` silently
9013
+ * truncates to 20. For "load more" pagination, advance `from` by
9014
+ * the prior page size on each subsequent call.
9015
+ *
9016
+ * **Filters**
9017
+ * All filters are ANDed server-side. Omitting a filter means "no
9018
+ * constraint" on that dimension:
9019
+ * - `categoryId` ({@link InboxCategories}): `General` (0),
9020
+ * `Platform` (1), `Personal` (2). Omit to get all categories.
9021
+ * - `onlyFavorite: true` returns only starred messages.
9022
+ * Omit / `false` returns all (starred and not).
9023
+ * - `read_status` ({@link InboxReadStatus}): `UnreadOnly` (1) or
9024
+ * `ReadOnly` (2). Omit to get both.
9025
+ *
9026
+ * **Server-side filtering** (always applied)
9027
+ * Expired messages (`expire_on_dt` in the past) and
9028
+ * soft-deleted messages are excluded server-side. Consumers do not
9029
+ * need to filter for these.
9030
+ *
9031
+ * **No client cache**: every call sends a fresh server round-trip.
9032
+ * To avoid redundant fetches in your UI, hold the result in
9033
+ * application state and re-fetch on `onUpdate` fires or explicit
9034
+ * user-driven refresh.
9035
+ *
9036
+ * **Idempotency / Side effects**: safe. Read-only.
9037
+ *
9038
+ * **UI guidance**: see [UI Guide — `getInboxMessages`](../../docs/ui/inbox/UIGuide_getInboxMessages.md).
9039
+ *
9040
+ * **Visitor mode**: not supported.
9041
+ *
9042
+ * @param params Optional filters + subscription.
9043
+ * @param params.from First message index (0-based). Defaults
9044
+ * to `0`.
9045
+ * @param params.to Last message index (exclusive).
9046
+ * Defaults to `20`. Server caps the page
9047
+ * at 20.
9048
+ * @param params.onlyFavorite When `true`, returns only favorite
9049
+ * (starred) messages.
9050
+ * @param params.categoryId When set, returns only messages in this
9051
+ * category ({@link InboxCategories}).
9052
+ * @param params.read_status When set, scopes to read or unread
9053
+ * only ({@link InboxReadStatus}).
9054
+ * @param params.onUpdate Callback invoked with the full
9055
+ * refreshed list when a new message
9056
+ * arrives.
9057
+ *
9058
+ * @returns Promise resolving to up to 20 `TInboxMessage` envelopes.
9059
+ * Empty array when the user has no messages matching the
9060
+ * filter.
9061
+ *
9062
+ * @example
9063
+ * ```ts
9064
+ * const messages = await window._smartico.api.getInboxMessages({
9065
+ * onUpdate: (refreshed) => {
9066
+ * console.log('[smartico] new inbox message arrived — re-render the list from this array, new message is at index 0:', refreshed);
9067
+ * },
9068
+ * });
6629
9069
  *
6630
- * @param params
9070
+ * // For each message, fetch its body for the list view (title, preview, icon).
9071
+ * for (const msg of messages) {
9072
+ * const body = await window._smartico.api.getInboxMessageBody(msg.message_guid);
9073
+ * console.log('[smartico] render message', msg.message_guid,
9074
+ * '— title:', body.title,
9075
+ * '— preview:', body.preview_body,
9076
+ * '— read:', msg.read,
9077
+ * '— favorite:', msg.favorite);
9078
+ * }
9079
+ *
9080
+ * // "Load more" pagination — advance from by the prior page size.
9081
+ * const page2 = await window._smartico.api.getInboxMessages({ from: 20, to: 40 });
9082
+ * console.log('[smartico] page 2:', page2.length, 'messages');
9083
+ *
9084
+ * // Filter examples.
9085
+ * const onlyStarred = await window._smartico.api.getInboxMessages({ onlyFavorite: true });
9086
+ * const onlyUnread = await window._smartico.api.getInboxMessages({ read_status: 1 }); // InboxReadStatus.UnreadOnly
9087
+ * ```
6631
9088
  */;
6632
9089
  _proto.getInboxMessages = function getInboxMessages(_temp) {
6633
9090
  var _ref3 = _temp === void 0 ? {} : _temp,
@@ -6648,10 +9105,53 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6648
9105
  }
6649
9106
  }
6650
9107
  /**
6651
- * Returns inbox unread count.
9108
+ * Returns the user's current unread inbox message count — a single
9109
+ * integer suitable for driving a header badge. Optionally subscribe
9110
+ * to live updates via `onUpdate`.
6652
9111
  *
6653
- * **Visitor mode: not supported**
6654
- * @param params
9112
+ * For most UIs, prefer `core_inbox_unread_count` from
9113
+ * {@link getUserProfile} instead: it carries the same value, is
9114
+ * push-updated in real time via the user-properties channel, and
9115
+ * doesn't require a separate cache. This method is useful when you
9116
+ * want a dedicated subscription tied to the inbox surface rather
9117
+ * than the broader user-properties channel.
9118
+ *
9119
+ * @remarks
9120
+ * **Subscription model**
9121
+ * `onUpdate` fires whenever the cached value changes — either on a
9122
+ * push from the user-properties channel (new message arrival,
9123
+ * mark-as-read, delete) or after an inbox-list fetch that returns
9124
+ * a fresh count.
9125
+ *
9126
+ * **Cache TTL**: 30 seconds. The cached value is patched in place
9127
+ * by push events (no full re-fetch on every push), so the
9128
+ * `onUpdate` callback reflects server state with sub-second latency
9129
+ * regardless of the TTL.
9130
+ *
9131
+ * **Idempotency / Side effects**: safe. Read-only.
9132
+ *
9133
+ * **Visitor mode**: not supported.
9134
+ *
9135
+ * @param params Optional subscription bag.
9136
+ * @param params.onUpdate Callback invoked with the new unread
9137
+ * count whenever it changes (push-driven).
9138
+ * @returns Promise resolving to the current unread
9139
+ * count (integer, includes `0`).
9140
+ *
9141
+ * @example
9142
+ * ```ts
9143
+ * // Static read for an initial badge render.
9144
+ * const count = await window._smartico.api.getInboxUnreadCount();
9145
+ * console.log('[smartico] inbox badge initial count:', count);
9146
+ *
9147
+ * // Live subscription for badge updates.
9148
+ * await window._smartico.api.getInboxUnreadCount({
9149
+ * onUpdate: (newCount) => {
9150
+ * console.log('[smartico] inbox count changed — update the badge to:', newCount,
9151
+ * '— hide badge entirely when 0, show raw integer otherwise (no "99+" cap in the default UI)');
9152
+ * },
9153
+ * });
9154
+ * ```
6655
9155
  */
6656
9156
  ;
6657
9157
  _proto.getInboxUnreadCount = function getInboxUnreadCount(_temp2) {
@@ -6670,9 +9170,62 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6670
9170
  }
6671
9171
  }
6672
9172
  /**
6673
- * Returns the message body of the specified message guid.
9173
+ * Returns the rich body of a single inbox message — title, preview
9174
+ * text, icon, click action, optional rich HTML body, and optional
9175
+ * buttons. Call this after fetching the envelope list via
9176
+ * {@link getInboxMessages} to render either a list-item preview or
9177
+ * a full detail view.
9178
+ *
9179
+ * The message body is served from a CDN — not over the WebSocket —
9180
+ * so latency depends on CDN proximity rather than WS round-trip
9181
+ * time. There is NO client-side cache; every call is a fresh
9182
+ * HTTP fetch. Browser HTTP caching applies (Cache-Control headers
9183
+ * from the CDN), but the SDK does not memoize the result.
6674
9184
  *
6675
- * **Visitor mode: not supported**
9185
+ * @remarks
9186
+ * **Rich vs simple messages**
9187
+ * The shape of the returned body branches on the `action` field:
9188
+ * - When `action === 'dp:inbox'`, the message has a rich HTML body
9189
+ * (`html_body`) and may have up to 2 action `buttons`. Use these
9190
+ * for a full-detail rendering.
9191
+ * - For any other `action` (deep-link like `'dp:deposit'` or a URL),
9192
+ * the message is a simple notification — `html_body` and
9193
+ * `buttons` will be `undefined` regardless of what's in the
9194
+ * underlying CDN payload. Render `title` + `preview_body` + a
9195
+ * single CTA driving the `action`.
9196
+ *
9197
+ * **The `action` field**
9198
+ * For both shapes, `action` carries either a deep-link
9199
+ * (`'dp:gf_missions'`) or a plain URL. Pass it to `_smartico.dp()`
9200
+ * for safe execution — that helper handles URL vs deep-link
9201
+ * routing.
9202
+ *
9203
+ * **Idempotency / Side effects**: safe. Read-only HTTP fetch.
9204
+ *
9205
+ * **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
9206
+ *
9207
+ * **Visitor mode**: not supported.
9208
+ *
9209
+ * @param messageGuid The `message_guid` from a `TInboxMessage`
9210
+ * returned by {@link getInboxMessages}.
9211
+ * @returns Promise resolving to `TInboxMessageBody`.
9212
+ *
9213
+ * @example
9214
+ * ```ts
9215
+ * const body = await window._smartico.api.getInboxMessageBody(messageGuid);
9216
+ *
9217
+ * console.log('[smartico] render message — title:', body.title,
9218
+ * '— preview:', body.preview_body,
9219
+ * '— icon:', body.icon);
9220
+ *
9221
+ * if (body.action === 'dp:inbox' && body.html_body) {
9222
+ * console.log('[smartico] rich message — render the html_body in a sandboxed iframe; render up to 2 action buttons:',
9223
+ * body.buttons?.length ?? 0);
9224
+ * } else {
9225
+ * console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
9226
+ * '— execute via _smartico.dp(body.action)');
9227
+ * }
9228
+ * ```
6676
9229
  */
6677
9230
  ;
6678
9231
  _proto.getInboxMessageBody = function getInboxMessageBody(messageGuid) {
@@ -6684,9 +9237,52 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6684
9237
  }
6685
9238
  }
6686
9239
  /**
6687
- * Requests to mark inbox message with specified guid as read
9240
+ * Marks a single inbox message as read. Server-side this flips the
9241
+ * message's `is_read` flag and decrements the user's unread count
9242
+ * (the change propagates back via the user-properties channel —
9243
+ * subscribers to {@link getInboxUnreadCount}'s `onUpdate` and
9244
+ * {@link getUserProfile}'s `core_inbox_unread_count` see it within
9245
+ * ~1 second).
6688
9246
  *
6689
- * **Visitor mode: not supported**
9247
+ * @remarks
9248
+ * **Error codes** (in `err_code`)
9249
+ * - `0` — success; the message is now marked read. Idempotent — a
9250
+ * second call on the same `messageGuid` also returns `0`.
9251
+ * - other non-zero — server error. Surface `err_message` if any.
9252
+ *
9253
+ * **Refresh after success**
9254
+ * The SDK does NOT auto-refresh {@link getInboxMessages} (no
9255
+ * `onUpdate` callback fires after this mutation). The unread-count
9256
+ * channel ({@link getInboxUnreadCount}, `core_inbox_unread_count`)
9257
+ * DOES auto-update — subscribers to it see the new count
9258
+ * automatically. If your inbox list UI shows the `read` field, you
9259
+ * have two options: re-call `getInboxMessages` after the mutation,
9260
+ * or update the local copy optimistically.
9261
+ *
9262
+ * **Idempotency**: safe. Repeated calls return `err_code === 0`.
9263
+ *
9264
+ * **Side effects** (on success)
9265
+ * - Server-side `is_read` flag set to true.
9266
+ * - Server-side `core_inbox_unread_count` decremented (if the
9267
+ * message was previously unread).
9268
+ *
9269
+ * **UI guidance**: see [UI Guide — `markInboxMessageAsRead`](../../docs/ui/inbox/UIGuide_markInboxMessageAsRead.md).
9270
+ *
9271
+ * **Visitor mode**: not supported.
9272
+ *
9273
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
9274
+ * @returns `{ err_code, err_message }`; success when
9275
+ * `err_code === 0`.
9276
+ *
9277
+ * @example
9278
+ * ```ts
9279
+ * const r = await window._smartico.api.markInboxMessageAsRead(message.message_guid);
9280
+ * if (r.err_code === 0) {
9281
+ * console.log('[smartico] marked as read — optimistically flip the local read indicator; the inbox badge auto-decrements via the user-properties channel');
9282
+ * } else {
9283
+ * console.error('[smartico] mark-as-read failed — keep the local state as-is and show a non-blocking error if appropriate:', r.err_message);
9284
+ * }
9285
+ * ```
6690
9286
  */
6691
9287
  ;
6692
9288
  _proto.markInboxMessageAsRead = function markInboxMessageAsRead(messageGuid) {
@@ -6703,9 +9299,57 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6703
9299
  }
6704
9300
  }
6705
9301
  /**
6706
- * Requests to mark all inbox messages as read
9302
+ * Marks ALL of the user's inbox messages as read in one server
9303
+ * round-trip — typically wired to a "Mark all as read" CTA in the
9304
+ * inbox header.
6707
9305
  *
6708
- * **Visitor mode: not supported**
9306
+ * The operation is global to the user — NOT filtered by the
9307
+ * current view (active category tab, favorite filter, etc.). Every
9308
+ * unread message in the user's inbox flips to read.
9309
+ *
9310
+ * @remarks
9311
+ * **Error codes** (in `err_code`)
9312
+ * - `0` — success; all currently-unread messages flipped to read.
9313
+ * - other non-zero — server error. Surface `err_message` if any.
9314
+ *
9315
+ * **Race condition note**: a new message arriving server-side
9316
+ * between the call and its processing remains unread (the
9317
+ * server's mark-all operation is a snapshot in time). Subsequent
9318
+ * `getInboxMessages` calls show the new message as unread.
9319
+ *
9320
+ * **Refresh after success**
9321
+ * Same as {@link markInboxMessageAsRead} — `getInboxMessages`
9322
+ * `onUpdate` does NOT fire automatically, but the unread-count
9323
+ * channel does (the badge will drop to 0, or to the count of any
9324
+ * new messages that arrived during processing).
9325
+ *
9326
+ * **Idempotency**: safe. A second call on an already-all-read
9327
+ * inbox returns `err_code === 0` with no-op effect.
9328
+ *
9329
+ * **Side effects** (on success)
9330
+ * - Every unread message flipped to read.
9331
+ * - `core_inbox_unread_count` drops to 0 (or near 0 if races).
9332
+ *
9333
+ * **UI guidance**: included in the
9334
+ * [UI Guide — `markInboxMessageAsRead`](../../docs/ui/inbox/UIGuide_markInboxMessageAsRead.md)
9335
+ * (Bulk variant section).
9336
+ *
9337
+ * **Visitor mode**: not supported.
9338
+ *
9339
+ * @returns `{ err_code, err_message }`; success when
9340
+ * `err_code === 0`.
9341
+ *
9342
+ * @example
9343
+ * ```ts
9344
+ * console.log('[smartico] mark-all-read starting — set in-flight flag on the "Mark all read" button, show loading dots');
9345
+ * const r = await window._smartico.api.markAllInboxMessagesAsRead();
9346
+ * console.log('[smartico] mark-all-read response — clear in-flight flag');
9347
+ * if (r.err_code === 0) {
9348
+ * console.log('[smartico] all messages marked read — optimistically flip every local read indicator; badge auto-drops via user-properties channel');
9349
+ * } else {
9350
+ * console.error('[smartico] mark-all failed — surface a non-blocking error:', r.err_message);
9351
+ * }
9352
+ * ```
6709
9353
  */
6710
9354
  ;
6711
9355
  _proto.markAllInboxMessagesAsRead = function markAllInboxMessagesAsRead() {
@@ -6722,9 +9366,57 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6722
9366
  }
6723
9367
  }
6724
9368
  /**
6725
- * Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove.
9369
+ * Toggles a message's favorite (starred) state — pass `mark: true`
9370
+ * to favorite, `mark: false` to unfavorite. Use to power a star
9371
+ * icon click handler on the inbox list.
6726
9372
  *
6727
- * **Visitor mode: not supported**
9373
+ * @remarks
9374
+ * **Error codes** (in `err_code`)
9375
+ * - `0` — success; the message's favorite state flipped to the
9376
+ * requested value.
9377
+ * - other non-zero — server error. Surface `err_message` if any.
9378
+ *
9379
+ * **Refresh after success**
9380
+ * The SDK does NOT auto-refresh {@link getInboxMessages}. To
9381
+ * reflect the new state in the UI, update the local copy of the
9382
+ * affected `TInboxMessage` (set `favorite` to the new value) or
9383
+ * re-call `getInboxMessages`.
9384
+ *
9385
+ * **Idempotency**: safe. `mark: true` on an already-favorite
9386
+ * message returns `err_code === 0` (no-op). Same for `mark: false`
9387
+ * on a non-favorite.
9388
+ *
9389
+ * **Side effects** (on success)
9390
+ * - Server-side `is_starred` flag set to the requested value.
9391
+ * - No effect on read state, unread count, or other fields.
9392
+ *
9393
+ * **UI guidance**: see [UI Guide — `markUnmarkInboxMessageAsFavorite`](../../docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md).
9394
+ *
9395
+ * **Visitor mode**: not supported.
9396
+ *
9397
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
9398
+ * @param mark `true` to favorite, `false` to unfavorite.
9399
+ * @returns `{ err_code, err_message }`; success when
9400
+ * `err_code === 0`.
9401
+ *
9402
+ * @example
9403
+ * ```ts
9404
+ * // Toggle handler — flip the local state optimistically, then
9405
+ * // call the server, and revert if the call fails.
9406
+ * const target = !message.favorite;
9407
+ * console.log('[smartico] optimistically flip the star to', target, '— it will revert if the server rejects');
9408
+ *
9409
+ * const r = await window._smartico.api.markUnmarkInboxMessageAsFavorite(
9410
+ * message.message_guid,
9411
+ * target,
9412
+ * );
9413
+ *
9414
+ * if (r.err_code === 0) {
9415
+ * console.log('[smartico] favorite toggled — keep the local state and show a brief "Added to favorites" / "Removed from favorites" toast');
9416
+ * } else {
9417
+ * console.error('[smartico] favorite toggle failed — revert the local state and show an error toast:', r.err_message);
9418
+ * }
9419
+ * ```
6728
9420
  */
6729
9421
  ;
6730
9422
  _proto.markUnmarkInboxMessageAsFavorite = function markUnmarkInboxMessageAsFavorite(messageGuid, mark) {
@@ -6741,9 +9433,52 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6741
9433
  }
6742
9434
  }
6743
9435
  /**
6744
- * Requests to delete inbox message
9436
+ * Soft-deletes a single inbox message. After deletion, the message
9437
+ * is excluded from future {@link getInboxMessages} responses
9438
+ * server-side, but its row is retained for analytics — there is no
9439
+ * "undelete" path via the SDK.
6745
9440
  *
6746
- * **Visitor mode: not supported**
9441
+ * @remarks
9442
+ * **Error codes** (in `err_code`)
9443
+ * - `0` — success; the message is now deleted from the user's
9444
+ * view.
9445
+ * - other non-zero — server error. Surface `err_message` if any.
9446
+ *
9447
+ * **Refresh after success**
9448
+ * The SDK does NOT auto-refresh {@link getInboxMessages}. Drop the
9449
+ * deleted message from your local list, or re-call
9450
+ * `getInboxMessages` to reload. If the deleted message was unread,
9451
+ * the unread count drops automatically via the user-properties
9452
+ * channel.
9453
+ *
9454
+ * **Idempotency**: safe. A second call on an already-deleted
9455
+ * `messageGuid` returns `err_code === 0` (server treats it as a
9456
+ * no-op — already-deleted messages are filtered out).
9457
+ *
9458
+ * **Side effects** (on success)
9459
+ * - Server-side `is_deleted` flag set to true.
9460
+ * - If the message was unread, `core_inbox_unread_count`
9461
+ * decrements via the user-properties channel.
9462
+ *
9463
+ * **UI guidance**: see [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md).
9464
+ *
9465
+ * **Visitor mode**: not supported.
9466
+ *
9467
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
9468
+ * @returns `{ err_code, err_message }`; success when
9469
+ * `err_code === 0`.
9470
+ *
9471
+ * @example
9472
+ * ```ts
9473
+ * // Swipe-to-delete on mobile; trash-icon click on desktop.
9474
+ * console.log('[smartico] delete starting — animate the row out of the list (slide left/right by 100%)');
9475
+ * const r = await window._smartico.api.deleteInboxMessage(message.message_guid);
9476
+ * if (r.err_code === 0) {
9477
+ * 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)');
9478
+ * } else {
9479
+ * console.error('[smartico] delete failed — animate the row back into place and show a non-blocking error:', r.err_message);
9480
+ * }
9481
+ * ```
6747
9482
  */
6748
9483
  ;
6749
9484
  _proto.deleteInboxMessage = function deleteInboxMessage(messageGuid) {
@@ -6760,9 +9495,61 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
6760
9495
  }
6761
9496
  }
6762
9497
  /**
6763
- * Requests to delete all inbox messages
9498
+ * Soft-deletes ALL of the user's inbox messages in one server
9499
+ * round-trip — typically wired to a "Delete all" CTA in the inbox
9500
+ * header (usually behind a confirm dialog given the destructive
9501
+ * nature).
6764
9502
  *
6765
- * **Visitor mode: not supported**
9503
+ * The operation is global to the user — NOT filtered by the
9504
+ * current view (active category tab, favorite filter, etc.). Every
9505
+ * non-deleted message in the user's inbox flips to deleted.
9506
+ *
9507
+ * @remarks
9508
+ * **Error codes** (in `err_code`)
9509
+ * - `0` — success; the entire inbox is now empty from the user's
9510
+ * view.
9511
+ * - other non-zero — server error. Surface `err_message` if any.
9512
+ *
9513
+ * **Race condition note**: a new message arriving server-side
9514
+ * between the call and its processing is NOT deleted (the
9515
+ * server's delete-all operation is a snapshot in time). Subsequent
9516
+ * `getInboxMessages` calls show the new message.
9517
+ *
9518
+ * **Refresh after success**
9519
+ * Same as {@link deleteInboxMessage} — `getInboxMessages` `onUpdate`
9520
+ * does not fire automatically. Replace the local list with `[]`
9521
+ * (or re-call `getInboxMessages`). The unread count drops to 0
9522
+ * (or near-0 if races) via the user-properties channel.
9523
+ *
9524
+ * **Idempotency**: safe. A second call on an already-empty inbox
9525
+ * returns `err_code === 0` with no-op effect.
9526
+ *
9527
+ * **Side effects** (on success)
9528
+ * - Every message flipped to deleted server-side.
9529
+ * - `core_inbox_unread_count` drops to 0.
9530
+ * - There is no SDK undelete path — recovery requires operator
9531
+ * intervention.
9532
+ *
9533
+ * **UI guidance**: included in the
9534
+ * [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md)
9535
+ * (Bulk variant section).
9536
+ *
9537
+ * **Visitor mode**: not supported.
9538
+ *
9539
+ * @returns `{ err_code, err_message }`; success when
9540
+ * `err_code === 0`.
9541
+ *
9542
+ * @example
9543
+ * ```ts
9544
+ * // After a confirm dialog "Are you sure you want to delete all messages?"
9545
+ * console.log('[smartico] delete-all confirmed — show loading state on the "Delete all" button');
9546
+ * const r = await window._smartico.api.deleteAllInboxMessages();
9547
+ * if (r.err_code === 0) {
9548
+ * console.log('[smartico] inbox cleared — replace the local list with [], fire a "All messages deleted" toast, badge auto-drops to 0');
9549
+ * } else {
9550
+ * console.error('[smartico] delete-all failed — show a non-blocking error toast:', r.err_message);
9551
+ * }
9552
+ * ```
6766
9553
  */
6767
9554
  ;
6768
9555
  _proto.deleteAllInboxMessages = function deleteAllInboxMessages() {
@@ -8843,16 +11630,25 @@ var SmarticoAPI = /*#__PURE__*/function () {
8843
11630
  return Promise.reject(e);
8844
11631
  }
8845
11632
  };
8846
- _proto.getActivityLog = function getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
11633
+ _proto.getRaffleWonPrizes = function getRaffleWonPrizes(user_ext_id, props) {
8847
11634
  try {
8848
11635
  var _this97 = this;
8849
- var message = _this97.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
11636
+ var message = _this97.buildMessage(user_ext_id, exports.ClassId.RAF_GET_WON_PRIZES_REQUEST, props);
11637
+ return Promise.resolve(_this97.send(message, exports.ClassId.RAF_GET_WON_PRIZES_RESPONSE));
11638
+ } catch (e) {
11639
+ return Promise.reject(e);
11640
+ }
11641
+ };
11642
+ _proto.getActivityLog = function getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
11643
+ try {
11644
+ var _this98 = this;
11645
+ var message = _this98.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
8850
11646
  startTimeSeconds: Math.floor(startTimeSeconds),
8851
11647
  endTimeSeconds: Math.floor(endTimeSeconds),
8852
11648
  limit: limit,
8853
11649
  offset: offset
8854
11650
  });
8855
- return Promise.resolve(_this97.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
11651
+ return Promise.resolve(_this98.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
8856
11652
  } catch (e) {
8857
11653
  return Promise.reject(e);
8858
11654
  }
@@ -8865,11 +11661,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
8865
11661
  to = 50;
8866
11662
  }
8867
11663
  try {
8868
- var _this98 = this;
11664
+ var _this99 = this;
8869
11665
  var limit = to - from > 50 ? 50 : to - from;
8870
11666
  var offset = from;
8871
- return Promise.resolve(_this98.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).then(function (_this98$getActivityLo) {
8872
- return ActivityLogTransform(_this98$getActivityLo.logHistory);
11667
+ return Promise.resolve(_this99.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).then(function (_this99$getActivityLo) {
11668
+ return ActivityLogTransform(_this99$getActivityLo.logHistory);
8873
11669
  });
8874
11670
  } catch (e) {
8875
11671
  return Promise.reject(e);