@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
@@ -16,80 +16,239 @@ import { WSAPILeaderBoard } from './WSAPILeaderBoard';
16
16
  /** @group Inbox */
17
17
  export class WSAPIInbox extends WSAPILeaderBoard {
18
18
  /**
19
- * Reports an impression event for an engagement (when engagement content is displayed to the user).
20
- * Use this method to track when users view engagement content such as inbox messages, popups.
21
- * When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType.
19
+ * Records that an engagement (inbox message, popup) was displayed to
20
+ * the user. Use this to drive engagement analytics — every visible
21
+ * inbox message should fire one impression event per render
22
+ * occurrence, and every popup display should fire one.
22
23
  *
23
- * **Example**:
24
- * ```
25
- * _smartico.api.reportImpressionEvent({
26
- * engagement_uid: 'abc123-def456',
27
- * activityType: 31 // Inbox
28
- * });
29
- * ```
24
+ * **Fire-and-forget**: the call is asynchronous and one-way — there
25
+ * is no response promise to await and no error reporting. The SDK
26
+ * swallows transport failures silently. Returns `void`.
27
+ *
28
+ * @remarks
29
+ * **When to call**
30
+ * - Inbox: when a message becomes visible (the user opens / scrolls
31
+ * it into view). The default Smartico UI fires this when the
32
+ * message detail expands, alongside
33
+ * {@link markInboxMessageAsRead}.
34
+ * - Popup: when the popup content is shown to the user.
35
+ *
36
+ * **Activity types**
37
+ * Pass {@link ActivityTypeLimited.Inbox} (`31`) for inbox messages,
38
+ * {@link ActivityTypeLimited.Popup} (`30`) for popups. Other values
39
+ * are not used by the engagement-impression channel.
40
+ *
41
+ * **Idempotency**: the server records every impression event —
42
+ * repeated calls add to the impression count. Don't fire it on
43
+ * every re-render; fire it once per logical "display" event
44
+ * (modal open, list-row scroll-into-view, popup show).
45
+ *
46
+ * **Side effects**: server-side increments the engagement's
47
+ * `impression_count` and updates `last_impression_date`. The
48
+ * counter is observable via operator analytics; the SDK consumer
49
+ * receives no signal back.
30
50
  *
31
- * **Visitor mode: not supported**
51
+ * **Visitor mode**: not supported.
32
52
  *
33
- * @param params - Event parameters
34
- * @param params.engagement_uid - Unique identifier for the engagement
35
- * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
53
+ * @example
54
+ * ```ts
55
+ * // When the user opens an inbox message in the detail view.
56
+ * window._smartico.api.reportImpressionEvent({
57
+ * engagement_uid: message.message_guid,
58
+ * activityType: 31, // ActivityTypeLimited.Inbox
59
+ * });
60
+ * console.log('[smartico] inbox impression reported for', message.message_guid, '— no response to await, fire-and-forget');
61
+ * ```
36
62
  */
37
63
  public reportImpressionEvent({
38
64
  engagement_uid,
39
65
  activityType,
40
66
  }: {
67
+ /** For inbox: the message's `message_guid` from `getInboxMessages`. For popups: the popup's GUID from the popup display callback. */
41
68
  engagement_uid: string;
69
+ /** `ActivityTypeLimited.Inbox` (`31`) for inbox; `Popup` (`30`) for popups. */
42
70
  activityType: ActivityTypeLimited | number;
43
71
  }): void {
44
72
  this.api.reportEngagementImpression(this.userExtId, engagement_uid, activityType);
45
73
  }
46
74
 
47
75
  /**
48
- * Reports a click/action event for an engagement (when user interacts with engagement content).
49
- * Use this method to track when users click on or interact with engagement content such as inbox messages, popups.
50
- * 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.
76
+ * Records that the user interacted with an engagement — typically
77
+ * tapping a CTA button, following a deep-link, or clicking a popup
78
+ * action. Use this to drive engagement analytics on what users
79
+ * actually act on (vs what they merely see —
80
+ * {@link reportImpressionEvent}).
51
81
  *
52
- * **Example**:
53
- * ```
54
- * _smartico.api.reportClickEvent({
55
- * engagement_uid: 'abc123-def456',
56
- * activityType: 31 // Inbox
57
- * action: 'dp:gf_missions'
58
- * });
59
- * ```
82
+ * **Fire-and-forget**: the call is asynchronous and one-way — there
83
+ * is no response promise to await and no error reporting. The SDK
84
+ * swallows transport failures silently. Returns `void`.
85
+ *
86
+ * @remarks
87
+ * **When to call**
88
+ * - Inbox: when the user taps a CTA button on a message or follows
89
+ * a deep-link inside the message body. Pass the deep-link or URL
90
+ * as `action`.
91
+ * - Popup: when the user clicks a popup action button.
60
92
  *
61
- * **Visitor mode: not supported**
93
+ * **Activity types**
94
+ * Pass {@link ActivityTypeLimited.Inbox} (`31`) for inbox,
95
+ * {@link ActivityTypeLimited.Popup} (`30`) for popups.
62
96
  *
63
- * @param params - Event parameters
64
- * @param params.engagement_uid - Unique identifier for the engagement
65
- * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
66
- * @param params.action - Optional action/deeplink that was triggered by the user interaction
97
+ * **`action` payload**
98
+ * Pass the deep-link or URL that the user triggered (e.g.
99
+ * `'dp:gf_missions'`, `'https://example.com/promo'`). The SDK
100
+ * forwards the string to the server for analytics — it does not
101
+ * execute the deep-link. To execute deep-links safely, call
102
+ * `_smartico.dp(action)` separately.
103
+ *
104
+ * **Idempotency**: the server records every click event —
105
+ * repeated calls add to the count. Fire once per logical user
106
+ * action.
107
+ *
108
+ * **Side effects**: server-side updates the engagement's
109
+ * `last_action` field; observable via operator analytics. The SDK
110
+ * consumer receives no signal back.
111
+ *
112
+ * **Visitor mode**: not supported.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * // When the user taps a CTA button in an inbox message.
117
+ * window._smartico.api.reportClickEvent({
118
+ * engagement_uid: message.message_guid,
119
+ * activityType: 31, // ActivityTypeLimited.Inbox
120
+ * action: 'dp:gf_missions',
121
+ * });
122
+ * window._smartico.dp('dp:gf_missions'); // separately execute the deep-link
123
+ * ```
67
124
  */
68
125
  public reportClickEvent({
69
126
  engagement_uid,
70
127
  activityType,
71
128
  action,
72
129
  }: {
130
+ /** For inbox: the message's `message_guid` from `getInboxMessages`. */
73
131
  engagement_uid: string;
132
+ /** `ActivityTypeLimited.Inbox` (`31`) for inbox; `Popup` (`30`) for popups. */
74
133
  activityType: ActivityTypeLimited | number;
134
+ /** The deep-link / URL the user triggered (optional but recommended for analytics fidelity). */
75
135
  action?: string;
76
136
  }): void {
77
137
  this.api.reportEngagementAction(this.userExtId, engagement_uid, activityType, action);
78
138
  }
79
139
 
80
- /** Returns inbox messages based on the provided parameters. "From" and "to" indicate the range of messages to be fetched.
81
- * The maximum number of messages per request is limited to 20.
82
- * An indicator "onlyFavorite" can be passed to get only messages marked as favorites.
83
- * An indicator "read_status" can be passed to get only messages marked as read or unread.
84
- * You can leave this params empty and by default it will return list of messages ranging from 0 to 20.
85
- * This function returns a list of messages without the body of each message.
86
- * 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.
87
- * All other action like mark as read, favorite, delete, etc. can be done using this message GUID.
88
- * 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.
140
+ /**
141
+ * Returns the user's inbox messages — newest first — with optional
142
+ * filtering by category, favorite status, and read state. Each
143
+ * `TInboxMessage` is a lightweight envelope (`message_guid`,
144
+ * `sent_date`, `read`, `favorite`, `category_id`, `expire_on_dt`);
145
+ * fetch the rich body (title, preview, icon, html_body, buttons)
146
+ * separately via {@link getInboxMessageBody}.
147
+ *
148
+ * Use this to power an inbox list screen. Subscribe via `onUpdate`
149
+ * to react to newly-arrived messages pushed by the server (from
150
+ * campaigns, automation rules, manual operator sends).
151
+ *
152
+ * @remarks
153
+ * **Subscription model (`onUpdate`)**
154
+ * The callback receives the FULL refreshed message list (never a
155
+ * diff/patch). Each subsequent call to `getInboxMessages({ onUpdate })`
156
+ * REPLACES the prior callback. Pass `onUpdate: undefined` (or omit
157
+ * it) to keep the prior callback in place; the callback is never
158
+ * auto-cleared.
159
+ *
160
+ * **Update triggers** — the callback fires ONLY when:
161
+ *
162
+ * 1. A new message is pushed by the server (campaign / automation /
163
+ * operator send). The refreshed list includes the new message
164
+ * at the top.
165
+ *
166
+ * Does NOT fire for: `markInboxMessageAsRead`,
167
+ * `markAllInboxMessagesAsRead`,
168
+ * `markUnmarkInboxMessageAsFavorite`, `deleteInboxMessage`,
169
+ * `deleteAllInboxMessages`. After a mutation, re-call
170
+ * `getInboxMessages` manually if your UI needs the refreshed list
171
+ * — or maintain optimistic state locally.
172
+ *
173
+ * **Pagination**
174
+ * `from` (defaults to `0`) and `to` (defaults to `20`) define a
175
+ * half-open range of message indices. The server caps the page at
176
+ * **20 messages per request** — passing `to - from > 20` silently
177
+ * truncates to 20. For "load more" pagination, advance `from` by
178
+ * the prior page size on each subsequent call.
89
179
  *
90
- * **Visitor mode: not supported**
180
+ * **Filters**
181
+ * All filters are ANDed server-side. Omitting a filter means "no
182
+ * constraint" on that dimension:
183
+ * - `categoryId` ({@link InboxCategories}): `General` (0),
184
+ * `Platform` (1), `Personal` (2). Omit to get all categories.
185
+ * - `onlyFavorite: true` returns only starred messages.
186
+ * Omit / `false` returns all (starred and not).
187
+ * - `read_status` ({@link InboxReadStatus}): `UnreadOnly` (1) or
188
+ * `ReadOnly` (2). Omit to get both.
91
189
  *
92
- * @param params
190
+ * **Server-side filtering** (always applied)
191
+ * Expired messages (`expire_on_dt` in the past) and
192
+ * soft-deleted messages are excluded server-side. Consumers do not
193
+ * need to filter for these.
194
+ *
195
+ * **No client cache**: every call sends a fresh server round-trip.
196
+ * To avoid redundant fetches in your UI, hold the result in
197
+ * application state and re-fetch on `onUpdate` fires or explicit
198
+ * user-driven refresh.
199
+ *
200
+ * **Idempotency / Side effects**: safe. Read-only.
201
+ *
202
+ * **UI guidance**: see [UI Guide — `getInboxMessages`](../../docs/ui/inbox/UIGuide_getInboxMessages.md).
203
+ *
204
+ * **Visitor mode**: not supported.
205
+ *
206
+ * @param params Optional filters + subscription.
207
+ * @param params.from First message index (0-based). Defaults
208
+ * to `0`.
209
+ * @param params.to Last message index (exclusive).
210
+ * Defaults to `20`. Server caps the page
211
+ * at 20.
212
+ * @param params.onlyFavorite When `true`, returns only favorite
213
+ * (starred) messages.
214
+ * @param params.categoryId When set, returns only messages in this
215
+ * category ({@link InboxCategories}).
216
+ * @param params.read_status When set, scopes to read or unread
217
+ * only ({@link InboxReadStatus}).
218
+ * @param params.onUpdate Callback invoked with the full
219
+ * refreshed list when a new message
220
+ * arrives.
221
+ *
222
+ * @returns Promise resolving to up to 20 `TInboxMessage` envelopes.
223
+ * Empty array when the user has no messages matching the
224
+ * filter.
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * const messages = await window._smartico.api.getInboxMessages({
229
+ * onUpdate: (refreshed) => {
230
+ * console.log('[smartico] new inbox message arrived — re-render the list from this array, new message is at index 0:', refreshed);
231
+ * },
232
+ * });
233
+ *
234
+ * // For each message, fetch its body for the list view (title, preview, icon).
235
+ * for (const msg of messages) {
236
+ * const body = await window._smartico.api.getInboxMessageBody(msg.message_guid);
237
+ * console.log('[smartico] render message', msg.message_guid,
238
+ * '— title:', body.title,
239
+ * '— preview:', body.preview_body,
240
+ * '— read:', msg.read,
241
+ * '— favorite:', msg.favorite);
242
+ * }
243
+ *
244
+ * // "Load more" pagination — advance from by the prior page size.
245
+ * const page2 = await window._smartico.api.getInboxMessages({ from: 20, to: 40 });
246
+ * console.log('[smartico] page 2:', page2.length, 'messages');
247
+ *
248
+ * // Filter examples.
249
+ * const onlyStarred = await window._smartico.api.getInboxMessages({ onlyFavorite: true });
250
+ * const onlyUnread = await window._smartico.api.getInboxMessages({ read_status: 1 }); // InboxReadStatus.UnreadOnly
251
+ * ```
93
252
  */
94
253
  public async getInboxMessages({
95
254
  from,
@@ -113,10 +272,53 @@ export class WSAPIInbox extends WSAPILeaderBoard {
113
272
  }
114
273
 
115
274
  /**
116
- * Returns inbox unread count.
275
+ * Returns the user's current unread inbox message count — a single
276
+ * integer suitable for driving a header badge. Optionally subscribe
277
+ * to live updates via `onUpdate`.
278
+ *
279
+ * For most UIs, prefer `core_inbox_unread_count` from
280
+ * {@link getUserProfile} instead: it carries the same value, is
281
+ * push-updated in real time via the user-properties channel, and
282
+ * doesn't require a separate cache. This method is useful when you
283
+ * want a dedicated subscription tied to the inbox surface rather
284
+ * than the broader user-properties channel.
117
285
  *
118
- * **Visitor mode: not supported**
119
- * @param params
286
+ * @remarks
287
+ * **Subscription model**
288
+ * `onUpdate` fires whenever the cached value changes — either on a
289
+ * push from the user-properties channel (new message arrival,
290
+ * mark-as-read, delete) or after an inbox-list fetch that returns
291
+ * a fresh count.
292
+ *
293
+ * **Cache TTL**: 30 seconds. The cached value is patched in place
294
+ * by push events (no full re-fetch on every push), so the
295
+ * `onUpdate` callback reflects server state with sub-second latency
296
+ * regardless of the TTL.
297
+ *
298
+ * **Idempotency / Side effects**: safe. Read-only.
299
+ *
300
+ * **Visitor mode**: not supported.
301
+ *
302
+ * @param params Optional subscription bag.
303
+ * @param params.onUpdate Callback invoked with the new unread
304
+ * count whenever it changes (push-driven).
305
+ * @returns Promise resolving to the current unread
306
+ * count (integer, includes `0`).
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * // Static read for an initial badge render.
311
+ * const count = await window._smartico.api.getInboxUnreadCount();
312
+ * console.log('[smartico] inbox badge initial count:', count);
313
+ *
314
+ * // Live subscription for badge updates.
315
+ * await window._smartico.api.getInboxUnreadCount({
316
+ * onUpdate: (newCount) => {
317
+ * console.log('[smartico] inbox count changed — update the badge to:', newCount,
318
+ * '— hide badge entirely when 0, show raw integer otherwise (no "99+" cap in the default UI)');
319
+ * },
320
+ * });
321
+ * ```
120
322
  */
121
323
  public async getInboxUnreadCount({ onUpdate }: { onUpdate?: (unread_count: number) => void } = {}): Promise<number> {
122
324
  if (onUpdate) {
@@ -131,18 +333,114 @@ export class WSAPIInbox extends WSAPILeaderBoard {
131
333
  }
132
334
 
133
335
  /**
134
- * Returns the message body of the specified message guid.
336
+ * Returns the rich body of a single inbox message — title, preview
337
+ * text, icon, click action, optional rich HTML body, and optional
338
+ * buttons. Call this after fetching the envelope list via
339
+ * {@link getInboxMessages} to render either a list-item preview or
340
+ * a full detail view.
341
+ *
342
+ * The message body is served from a CDN — not over the WebSocket —
343
+ * so latency depends on CDN proximity rather than WS round-trip
344
+ * time. There is NO client-side cache; every call is a fresh
345
+ * HTTP fetch. Browser HTTP caching applies (Cache-Control headers
346
+ * from the CDN), but the SDK does not memoize the result.
347
+ *
348
+ * @remarks
349
+ * **Rich vs simple messages**
350
+ * The shape of the returned body branches on the `action` field:
351
+ * - When `action === 'dp:inbox'`, the message has a rich HTML body
352
+ * (`html_body`) and may have up to 2 action `buttons`. Use these
353
+ * for a full-detail rendering.
354
+ * - For any other `action` (deep-link like `'dp:deposit'` or a URL),
355
+ * the message is a simple notification — `html_body` and
356
+ * `buttons` will be `undefined` regardless of what's in the
357
+ * underlying CDN payload. Render `title` + `preview_body` + a
358
+ * single CTA driving the `action`.
359
+ *
360
+ * **The `action` field**
361
+ * For both shapes, `action` carries either a deep-link
362
+ * (`'dp:gf_missions'`) or a plain URL. Pass it to `_smartico.dp()`
363
+ * for safe execution — that helper handles URL vs deep-link
364
+ * routing.
365
+ *
366
+ * **Idempotency / Side effects**: safe. Read-only HTTP fetch.
367
+ *
368
+ * **UI guidance**: see [UI Guide — `getInboxMessageBody`](../../docs/ui/inbox/UIGuide_getInboxMessageBody.md).
135
369
  *
136
- * **Visitor mode: not supported**
370
+ * **Visitor mode**: not supported.
371
+ *
372
+ * @param messageGuid The `message_guid` from a `TInboxMessage`
373
+ * returned by {@link getInboxMessages}.
374
+ * @returns Promise resolving to `TInboxMessageBody`.
375
+ *
376
+ * @example
377
+ * ```ts
378
+ * const body = await window._smartico.api.getInboxMessageBody(messageGuid);
379
+ *
380
+ * console.log('[smartico] render message — title:', body.title,
381
+ * '— preview:', body.preview_body,
382
+ * '— icon:', body.icon);
383
+ *
384
+ * if (body.action === 'dp:inbox' && body.html_body) {
385
+ * console.log('[smartico] rich message — render the html_body in a sandboxed iframe; render up to 2 action buttons:',
386
+ * body.buttons?.length ?? 0);
387
+ * } else {
388
+ * console.log('[smartico] simple message — show preview_body + single CTA wired to:', body.action,
389
+ * '— execute via _smartico.dp(body.action)');
390
+ * }
391
+ * ```
137
392
  */
138
393
  public async getInboxMessageBody(messageGuid: string): Promise<TInboxMessageBody> {
139
394
  return await this.api.getInboxMessageBodyT(messageGuid);
140
395
  }
141
396
 
142
397
  /**
143
- * Requests to mark inbox message with specified guid as read
398
+ * Marks a single inbox message as read. Server-side this flips the
399
+ * message's `is_read` flag and decrements the user's unread count
400
+ * (the change propagates back via the user-properties channel —
401
+ * subscribers to {@link getInboxUnreadCount}'s `onUpdate` and
402
+ * {@link getUserProfile}'s `core_inbox_unread_count` see it within
403
+ * ~1 second).
404
+ *
405
+ * @remarks
406
+ * **Error codes** (in `err_code`)
407
+ * - `0` — success; the message is now marked read. Idempotent — a
408
+ * second call on the same `messageGuid` also returns `0`.
409
+ * - other non-zero — server error. Surface `err_message` if any.
410
+ *
411
+ * **Refresh after success**
412
+ * The SDK does NOT auto-refresh {@link getInboxMessages} (no
413
+ * `onUpdate` callback fires after this mutation). The unread-count
414
+ * channel ({@link getInboxUnreadCount}, `core_inbox_unread_count`)
415
+ * DOES auto-update — subscribers to it see the new count
416
+ * automatically. If your inbox list UI shows the `read` field, you
417
+ * have two options: re-call `getInboxMessages` after the mutation,
418
+ * or update the local copy optimistically.
144
419
  *
145
- * **Visitor mode: not supported**
420
+ * **Idempotency**: safe. Repeated calls return `err_code === 0`.
421
+ *
422
+ * **Side effects** (on success)
423
+ * - Server-side `is_read` flag set to true.
424
+ * - Server-side `core_inbox_unread_count` decremented (if the
425
+ * message was previously unread).
426
+ *
427
+ * **UI guidance**: see [UI Guide — `markInboxMessageAsRead`](../../docs/ui/inbox/UIGuide_markInboxMessageAsRead.md).
428
+ *
429
+ * **Visitor mode**: not supported.
430
+ *
431
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
432
+ * @returns `{ err_code, err_message }`; success when
433
+ * `err_code === 0`.
434
+ *
435
+ * @example
436
+ * ```ts
437
+ * const r = await window._smartico.api.markInboxMessageAsRead(message.message_guid);
438
+ * if (r.err_code === 0) {
439
+ * console.log('[smartico] marked as read — optimistically flip the local read indicator; the inbox badge auto-decrements via the user-properties channel');
440
+ * } else {
441
+ * console.error('[smartico] mark-as-read failed — keep the local state as-is and show a non-blocking error if appropriate:', r.err_message);
442
+ * }
443
+ * ```
146
444
  */
147
445
  public async markInboxMessageAsRead(messageGuid: string): Promise<InboxMarkMessageAction> {
148
446
  const r = await this.api.markInboxMessageRead(this.userExtId, messageGuid);
@@ -154,9 +452,57 @@ export class WSAPIInbox extends WSAPILeaderBoard {
154
452
  }
155
453
 
156
454
  /**
157
- * Requests to mark all inbox messages as read
455
+ * Marks ALL of the user's inbox messages as read in one server
456
+ * round-trip — typically wired to a "Mark all as read" CTA in the
457
+ * inbox header.
158
458
  *
159
- * **Visitor mode: not supported**
459
+ * The operation is global to the user — NOT filtered by the
460
+ * current view (active category tab, favorite filter, etc.). Every
461
+ * unread message in the user's inbox flips to read.
462
+ *
463
+ * @remarks
464
+ * **Error codes** (in `err_code`)
465
+ * - `0` — success; all currently-unread messages flipped to read.
466
+ * - other non-zero — server error. Surface `err_message` if any.
467
+ *
468
+ * **Race condition note**: a new message arriving server-side
469
+ * between the call and its processing remains unread (the
470
+ * server's mark-all operation is a snapshot in time). Subsequent
471
+ * `getInboxMessages` calls show the new message as unread.
472
+ *
473
+ * **Refresh after success**
474
+ * Same as {@link markInboxMessageAsRead} — `getInboxMessages`
475
+ * `onUpdate` does NOT fire automatically, but the unread-count
476
+ * channel does (the badge will drop to 0, or to the count of any
477
+ * new messages that arrived during processing).
478
+ *
479
+ * **Idempotency**: safe. A second call on an already-all-read
480
+ * inbox returns `err_code === 0` with no-op effect.
481
+ *
482
+ * **Side effects** (on success)
483
+ * - Every unread message flipped to read.
484
+ * - `core_inbox_unread_count` drops to 0 (or near 0 if races).
485
+ *
486
+ * **UI guidance**: included in the
487
+ * [UI Guide — `markInboxMessageAsRead`](../../docs/ui/inbox/UIGuide_markInboxMessageAsRead.md)
488
+ * (Bulk variant section).
489
+ *
490
+ * **Visitor mode**: not supported.
491
+ *
492
+ * @returns `{ err_code, err_message }`; success when
493
+ * `err_code === 0`.
494
+ *
495
+ * @example
496
+ * ```ts
497
+ * console.log('[smartico] mark-all-read starting — set in-flight flag on the "Mark all read" button, show loading dots');
498
+ * const r = await window._smartico.api.markAllInboxMessagesAsRead();
499
+ * console.log('[smartico] mark-all-read response — clear in-flight flag');
500
+ * if (r.err_code === 0) {
501
+ * console.log('[smartico] all messages marked read — optimistically flip every local read indicator; badge auto-drops via user-properties channel');
502
+ * } else {
503
+ * console.error('[smartico] mark-all failed — surface a non-blocking error:', r.err_message);
504
+ * }
505
+ * ```
160
506
  */
161
507
  public async markAllInboxMessagesAsRead(): Promise<InboxMarkMessageAction> {
162
508
  const r = await this.api.markAllInboxMessageRead(this.userExtId);
@@ -168,9 +514,57 @@ export class WSAPIInbox extends WSAPILeaderBoard {
168
514
  }
169
515
 
170
516
  /**
171
- * Requests to mark inbox message with specified guid as favorite. Pass mark true to add message to favorite and false to remove.
517
+ * Toggles a message's favorite (starred) state — pass `mark: true`
518
+ * to favorite, `mark: false` to unfavorite. Use to power a star
519
+ * icon click handler on the inbox list.
520
+ *
521
+ * @remarks
522
+ * **Error codes** (in `err_code`)
523
+ * - `0` — success; the message's favorite state flipped to the
524
+ * requested value.
525
+ * - other non-zero — server error. Surface `err_message` if any.
526
+ *
527
+ * **Refresh after success**
528
+ * The SDK does NOT auto-refresh {@link getInboxMessages}. To
529
+ * reflect the new state in the UI, update the local copy of the
530
+ * affected `TInboxMessage` (set `favorite` to the new value) or
531
+ * re-call `getInboxMessages`.
532
+ *
533
+ * **Idempotency**: safe. `mark: true` on an already-favorite
534
+ * message returns `err_code === 0` (no-op). Same for `mark: false`
535
+ * on a non-favorite.
172
536
  *
173
- * **Visitor mode: not supported**
537
+ * **Side effects** (on success)
538
+ * - Server-side `is_starred` flag set to the requested value.
539
+ * - No effect on read state, unread count, or other fields.
540
+ *
541
+ * **UI guidance**: see [UI Guide — `markUnmarkInboxMessageAsFavorite`](../../docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md).
542
+ *
543
+ * **Visitor mode**: not supported.
544
+ *
545
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
546
+ * @param mark `true` to favorite, `false` to unfavorite.
547
+ * @returns `{ err_code, err_message }`; success when
548
+ * `err_code === 0`.
549
+ *
550
+ * @example
551
+ * ```ts
552
+ * // Toggle handler — flip the local state optimistically, then
553
+ * // call the server, and revert if the call fails.
554
+ * const target = !message.favorite;
555
+ * console.log('[smartico] optimistically flip the star to', target, '— it will revert if the server rejects');
556
+ *
557
+ * const r = await window._smartico.api.markUnmarkInboxMessageAsFavorite(
558
+ * message.message_guid,
559
+ * target,
560
+ * );
561
+ *
562
+ * if (r.err_code === 0) {
563
+ * console.log('[smartico] favorite toggled — keep the local state and show a brief "Added to favorites" / "Removed from favorites" toast');
564
+ * } else {
565
+ * console.error('[smartico] favorite toggle failed — revert the local state and show an error toast:', r.err_message);
566
+ * }
567
+ * ```
174
568
  */
175
569
  public async markUnmarkInboxMessageAsFavorite(messageGuid: string, mark: boolean): Promise<InboxMarkMessageAction> {
176
570
  const r = await this.api.markUnmarkInboxMessageAsFavorite(this.userExtId, messageGuid, mark);
@@ -182,9 +576,52 @@ export class WSAPIInbox extends WSAPILeaderBoard {
182
576
  }
183
577
 
184
578
  /**
185
- * Requests to delete inbox message
579
+ * Soft-deletes a single inbox message. After deletion, the message
580
+ * is excluded from future {@link getInboxMessages} responses
581
+ * server-side, but its row is retained for analytics — there is no
582
+ * "undelete" path via the SDK.
583
+ *
584
+ * @remarks
585
+ * **Error codes** (in `err_code`)
586
+ * - `0` — success; the message is now deleted from the user's
587
+ * view.
588
+ * - other non-zero — server error. Surface `err_message` if any.
589
+ *
590
+ * **Refresh after success**
591
+ * The SDK does NOT auto-refresh {@link getInboxMessages}. Drop the
592
+ * deleted message from your local list, or re-call
593
+ * `getInboxMessages` to reload. If the deleted message was unread,
594
+ * the unread count drops automatically via the user-properties
595
+ * channel.
596
+ *
597
+ * **Idempotency**: safe. A second call on an already-deleted
598
+ * `messageGuid` returns `err_code === 0` (server treats it as a
599
+ * no-op — already-deleted messages are filtered out).
600
+ *
601
+ * **Side effects** (on success)
602
+ * - Server-side `is_deleted` flag set to true.
603
+ * - If the message was unread, `core_inbox_unread_count`
604
+ * decrements via the user-properties channel.
605
+ *
606
+ * **UI guidance**: see [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md).
607
+ *
608
+ * **Visitor mode**: not supported.
186
609
  *
187
- * **Visitor mode: not supported**
610
+ * @param messageGuid The `message_guid` from a `TInboxMessage`.
611
+ * @returns `{ err_code, err_message }`; success when
612
+ * `err_code === 0`.
613
+ *
614
+ * @example
615
+ * ```ts
616
+ * // Swipe-to-delete on mobile; trash-icon click on desktop.
617
+ * console.log('[smartico] delete starting — animate the row out of the list (slide left/right by 100%)');
618
+ * const r = await window._smartico.api.deleteInboxMessage(message.message_guid);
619
+ * if (r.err_code === 0) {
620
+ * 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)');
621
+ * } else {
622
+ * console.error('[smartico] delete failed — animate the row back into place and show a non-blocking error:', r.err_message);
623
+ * }
624
+ * ```
188
625
  */
189
626
 
190
627
  public async deleteInboxMessage(messageGuid: string): Promise<InboxMarkMessageAction> {
@@ -197,9 +634,61 @@ export class WSAPIInbox extends WSAPILeaderBoard {
197
634
  }
198
635
 
199
636
  /**
200
- * Requests to delete all inbox messages
637
+ * Soft-deletes ALL of the user's inbox messages in one server
638
+ * round-trip — typically wired to a "Delete all" CTA in the inbox
639
+ * header (usually behind a confirm dialog given the destructive
640
+ * nature).
641
+ *
642
+ * The operation is global to the user — NOT filtered by the
643
+ * current view (active category tab, favorite filter, etc.). Every
644
+ * non-deleted message in the user's inbox flips to deleted.
645
+ *
646
+ * @remarks
647
+ * **Error codes** (in `err_code`)
648
+ * - `0` — success; the entire inbox is now empty from the user's
649
+ * view.
650
+ * - other non-zero — server error. Surface `err_message` if any.
651
+ *
652
+ * **Race condition note**: a new message arriving server-side
653
+ * between the call and its processing is NOT deleted (the
654
+ * server's delete-all operation is a snapshot in time). Subsequent
655
+ * `getInboxMessages` calls show the new message.
656
+ *
657
+ * **Refresh after success**
658
+ * Same as {@link deleteInboxMessage} — `getInboxMessages` `onUpdate`
659
+ * does not fire automatically. Replace the local list with `[]`
660
+ * (or re-call `getInboxMessages`). The unread count drops to 0
661
+ * (or near-0 if races) via the user-properties channel.
201
662
  *
202
- * **Visitor mode: not supported**
663
+ * **Idempotency**: safe. A second call on an already-empty inbox
664
+ * returns `err_code === 0` with no-op effect.
665
+ *
666
+ * **Side effects** (on success)
667
+ * - Every message flipped to deleted server-side.
668
+ * - `core_inbox_unread_count` drops to 0.
669
+ * - There is no SDK undelete path — recovery requires operator
670
+ * intervention.
671
+ *
672
+ * **UI guidance**: included in the
673
+ * [UI Guide — `deleteInboxMessage`](../../docs/ui/inbox/UIGuide_deleteInboxMessage.md)
674
+ * (Bulk variant section).
675
+ *
676
+ * **Visitor mode**: not supported.
677
+ *
678
+ * @returns `{ err_code, err_message }`; success when
679
+ * `err_code === 0`.
680
+ *
681
+ * @example
682
+ * ```ts
683
+ * // After a confirm dialog "Are you sure you want to delete all messages?"
684
+ * console.log('[smartico] delete-all confirmed — show loading state on the "Delete all" button');
685
+ * const r = await window._smartico.api.deleteAllInboxMessages();
686
+ * if (r.err_code === 0) {
687
+ * console.log('[smartico] inbox cleared — replace the local list with [], fire a "All messages deleted" toast, badge auto-drops to 0');
688
+ * } else {
689
+ * console.error('[smartico] delete-all failed — show a non-blocking error toast:', r.err_message);
690
+ * }
691
+ * ```
203
692
  */
204
693
 
205
694
  public async deleteAllInboxMessages(): Promise<InboxMarkMessageAction> {