@smartico/public-api 0.0.380 → 0.0.381

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