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