@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.
- package/CLAUDE.md +103 -0
- package/README.md +32 -10
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/Jackpots/JackpotDetails.d.ts +14 -15
- package/dist/Jackpots/JackpotPot.d.ts +10 -6
- package/dist/Raffle/GetRaffleWonPrizesRequest.d.ts +9 -0
- package/dist/Raffle/GetRaffleWonPrizesResponse.d.ts +52 -0
- package/dist/Raffle/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +6 -1
- package/dist/SmarticoLib/index.d.ts +5 -1
- package/dist/WSAPI/WSAPIAvatars.d.ts +267 -49
- package/dist/WSAPI/WSAPIBonuses.d.ts +224 -10
- package/dist/WSAPI/WSAPIGamePick.d.ts +538 -253
- package/dist/WSAPI/WSAPIGeneral.d.ts +156 -14
- package/dist/WSAPI/WSAPIInbox.d.ts +547 -58
- package/dist/WSAPI/WSAPIJackpots.d.ts +292 -57
- package/dist/WSAPI/WSAPILeaderBoard.d.ts +127 -13
- package/dist/WSAPI/WSAPIMiniGames.d.ts +465 -49
- package/dist/WSAPI/WSAPIRaffles.d.ts +576 -52
- package/dist/WSAPI/WSAPITournaments.d.ts +3 -3
- package/dist/WSAPI/WSAPITypes.d.ts +243 -132
- package/dist/WSAPI/WSAPIUser.d.ts +193 -43
- package/dist/index.js +3409 -615
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +3391 -608
- package/dist/index.modern.mjs.map +1 -1
- package/docs/Callbacks.md +162 -0
- package/docs/SmarticoObject.md +445 -0
- package/docs/Transforms.md +99 -0
- package/docs/api/README.md +26 -0
- package/docs/api/classes/WSAPIAvatars.md +282 -54
- package/docs/api/classes/WSAPIBonuses.md +233 -12
- package/docs/api/classes/WSAPIClans.md +380 -10
- package/docs/api/classes/WSAPIGamePick.md +555 -26
- package/docs/api/classes/WSAPIGeneral.md +165 -16
- package/docs/api/classes/WSAPIInbox.md +588 -64
- package/docs/api/classes/WSAPIJackpots.md +320 -66
- package/docs/api/classes/WSAPILeaderBoard.md +133 -15
- package/docs/api/classes/WSAPIMiniGames.md +501 -64
- package/docs/api/classes/WSAPIMissions.md +58 -79
- package/docs/api/classes/WSAPIRaffles.md +647 -69
- package/docs/api/classes/WSAPIStore.md +83 -108
- package/docs/api/classes/WSAPITournaments.md +495 -28
- package/docs/api/classes/WSAPIUser.md +520 -83
- package/docs/api/documents/Callbacks.md +162 -0
- package/docs/api/documents/SmarticoObject.md +445 -0
- package/docs/api/documents/Transforms.md +99 -0
- package/docs/api/enumerations/BonusStatus-1.md +11 -6
- package/docs/api/enumerations/JoinClanErrorCode.md +81 -0
- package/docs/api/enumerations/TournamentRegistrationError.md +12 -0
- package/docs/api/functions/clanTournamentPlayersTransform.md +13 -0
- package/docs/api/interfaces/AvatarCustomized.md +25 -0
- package/docs/api/interfaces/AvatarDefinition.md +94 -0
- package/docs/api/interfaces/AvatarPrompt.md +45 -0
- package/docs/api/interfaces/BonusMetaMap-1.md +4 -1
- package/docs/api/interfaces/BonusTemplateMetaMap-1.md +9 -4
- package/docs/api/interfaces/Clan.md +4 -0
- package/docs/api/interfaces/ClanInfo.md +109 -0
- package/docs/api/interfaces/ClanMember.md +53 -0
- package/docs/api/interfaces/ClanTournamentPlayerRaw.md +67 -0
- package/docs/api/interfaces/GemsDiamondsLog.md +43 -0
- package/docs/api/interfaces/GetClanInfoResponse.md +61 -0
- package/docs/api/interfaces/GetClanTournamentPlayersResponse.md +81 -0
- package/docs/api/interfaces/GetRaffleWonPrizesRequest.md +59 -0
- package/docs/api/interfaces/GetRaffleWonPrizesResponse.md +95 -0
- package/docs/api/interfaces/InboxMarkMessageAction.md +10 -2
- package/docs/api/interfaces/JackpotDetails.md +14 -15
- package/docs/api/interfaces/JackpotPot.md +9 -6
- package/docs/api/interfaces/LeaderBoardDetailsT.md +14 -8
- package/docs/api/interfaces/LeaderBoardUserT.md +8 -5
- package/docs/api/interfaces/LeaderBoardsRewardsT.md +7 -0
- package/docs/api/interfaces/PointsLog.md +43 -0
- package/docs/api/interfaces/RaffleWonPrize.md +59 -0
- package/docs/api/interfaces/RaffleWonPrizePublicMeta.md +27 -0
- package/docs/api/interfaces/RaffleWonPrizeUser.md +43 -0
- package/docs/api/interfaces/TAchCategory.md +2 -7
- package/docs/api/interfaces/TAvatarCustomized.md +4 -4
- package/docs/api/interfaces/TAvatarDefinition.md +13 -14
- package/docs/api/interfaces/TAvatarPrompt.md +6 -6
- package/docs/api/interfaces/TBonus.md +16 -8
- package/docs/api/interfaces/TBuyStoreItemResult.md +4 -29
- package/docs/api/interfaces/TClaimBonusResult.md +5 -5
- package/docs/api/interfaces/TClan.md +8 -4
- package/docs/api/interfaces/TClanInfo.md +47 -0
- package/docs/api/interfaces/TClanJoinResult.md +11 -1
- package/docs/api/interfaces/TClanTournamentPlayer.md +55 -0
- package/docs/api/interfaces/TClanTournamentPlayersResult.md +27 -0
- package/docs/api/interfaces/TClans.md +3 -1
- package/docs/api/interfaces/TGetTranslations.md +4 -0
- package/docs/api/interfaces/TInboxMessage.md +14 -6
- package/docs/api/interfaces/TInboxMessageBody.md +18 -12
- package/docs/api/interfaces/TLevel.md +17 -20
- package/docs/api/interfaces/TLevelCurrent.md +19 -18
- package/docs/api/interfaces/TMiniGamePlayBatchResult.md +14 -6
- package/docs/api/interfaces/TMiniGamePlayResult.md +9 -4
- package/docs/api/interfaces/TMissionClaimRewardResult.md +1 -9
- package/docs/api/interfaces/TMissionOptInResult.md +1 -5
- package/docs/api/interfaces/TMissionOrBadge.md +4 -7
- package/docs/api/interfaces/TRaffleOptinResponse.md +4 -2
- package/docs/api/interfaces/TSegmentCheckResult.md +10 -0
- package/docs/api/interfaces/TSetAvatarResult.md +3 -3
- package/docs/api/interfaces/TStoreItem.md +3 -13
- package/docs/api/interfaces/TTournament.md +1 -1
- package/docs/api/interfaces/TTournamentDetailed.md +1 -1
- package/docs/api/interfaces/TTournamentRegistrationResult.md +4 -2
- package/docs/api/interfaces/TUICustomSection.md +23 -19
- package/docs/api/interfaces/TUserProfile.md +18 -16
- package/docs/api/interfaces/TransformedRaffleClaimPrizeResponse.md +6 -2
- package/docs/api/interfaces/UserLevelExtraCountersT.md +9 -2
- package/docs/api/type-aliases/ActivityLogEntry.md +3 -0
- package/docs/native/ADDING_METHODS.md +7 -2
- package/docs/native/PROTOCOL.md +337 -0
- package/docs/ui/avatars/UIGuide_getAvatarPrompts.md +100 -0
- package/docs/ui/avatars/UIGuide_getAvatarsCustomized.md +90 -0
- package/docs/ui/avatars/UIGuide_getAvatarsList.md +105 -0
- package/docs/ui/avatars/UIGuide_setAvatar.md +118 -0
- package/docs/ui/bonuses/UIGuide_claimBonus.md +144 -0
- package/docs/ui/bonuses/UIGuide_getBonuses.md +176 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRound.md +99 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetActiveRounds.md +76 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetBoard.md +81 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetGameInfo.md +78 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetHistory.md +55 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetRoundInfoForUser.md +71 -0
- package/docs/ui/gamepick/UIGuide_gamePickGetUserInfo.md +64 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelection.md +103 -0
- package/docs/ui/gamepick/UIGuide_gamePickSubmitSelectionQuiz.md +67 -0
- package/docs/ui/general/UIGuide_getCustomSections.md +137 -0
- package/docs/ui/general/UIGuide_getRelatedItemsForGame.md +140 -0
- package/docs/ui/inbox/UIGuide_deleteInboxMessage.md +135 -0
- package/docs/ui/inbox/UIGuide_getInboxMessageBody.md +133 -0
- package/docs/ui/inbox/UIGuide_getInboxMessages.md +186 -0
- package/docs/ui/inbox/UIGuide_markInboxMessageAsRead.md +122 -0
- package/docs/ui/inbox/UIGuide_markUnmarkInboxMessageAsFavorite.md +84 -0
- package/docs/ui/jackpots/UIGuide_getJackpotEligibleGames.md +73 -0
- package/docs/ui/jackpots/UIGuide_getJackpotWinners.md +83 -0
- package/docs/ui/jackpots/UIGuide_jackpotGet.md +138 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptIn.md +85 -0
- package/docs/ui/jackpots/UIGuide_jackpotOptOut.md +65 -0
- package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +166 -0
- package/docs/ui/minigames/UIGuide_getMiniGames.md +153 -0
- package/docs/ui/minigames/UIGuide_getMiniGamesHistory.md +90 -0
- package/docs/ui/minigames/UIGuide_playMiniGame.md +150 -0
- package/docs/ui/minigames/UIGuide_playMiniGameBatch.md +128 -0
- package/docs/ui/raffles/UIGuide_claimRafflePrize.md +99 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRun.md +117 -0
- package/docs/ui/raffles/UIGuide_getRaffleDrawRunsHistory.md +92 -0
- package/docs/ui/raffles/UIGuide_getRaffleWonPrizes.md +120 -0
- package/docs/ui/raffles/UIGuide_getRaffles.md +175 -0
- package/docs/ui/raffles/UIGuide_requestRaffleOptin.md +114 -0
- package/docs/ui/user/UIGuide_getActivityLog.md +130 -0
- package/docs/ui/user/UIGuide_getLevels.md +47 -42
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/Jackpots/JackpotDetails.ts +14 -15
- package/src/Jackpots/JackpotPot.ts +10 -6
- package/src/Raffle/GetRaffleWonPrizesRequest.ts +12 -0
- package/src/Raffle/GetRaffleWonPrizesResponse.ts +56 -0
- package/src/Raffle/index.ts +3 -1
- package/src/SmarticoAPI.ts +14 -1
- package/src/SmarticoLib/index.ts +4 -0
- package/src/WSAPI/WSAPIAvatars.ts +267 -49
- package/src/WSAPI/WSAPIBonuses.ts +224 -10
- package/src/WSAPI/WSAPIGamePick.ts +538 -253
- package/src/WSAPI/WSAPIGeneral.ts +156 -14
- package/src/WSAPI/WSAPIInbox.ts +545 -56
- package/src/WSAPI/WSAPIJackpots.ts +297 -61
- package/src/WSAPI/WSAPILeaderBoard.ts +127 -13
- package/src/WSAPI/WSAPIMiniGames.ts +465 -49
- package/src/WSAPI/WSAPIRaffles.ts +592 -64
- package/src/WSAPI/WSAPITournaments.ts +3 -3
- package/src/WSAPI/WSAPITypes.ts +243 -132
- package/src/WSAPI/WSAPIUser.ts +193 -43
- package/tsconfig.json +9 -1
|
@@ -53,7 +53,7 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
53
53
|
*
|
|
54
54
|
* **Inbox unread count** — `core_inbox_unread_count` on this profile
|
|
55
55
|
* is push-updated in real time (under 1 second). For an inbox badge,
|
|
56
|
-
* prefer this field over
|
|
56
|
+
* prefer this field over `getInboxUnreadCount` (which is cached
|
|
57
57
|
* for 30 s) — same value, fresher signal.
|
|
58
58
|
*
|
|
59
59
|
* **Language**: `core_user_language` reflects the server's stored
|
|
@@ -115,25 +115,138 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
117
|
getUserProfile(): TUserProfile;
|
|
118
|
-
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
118
|
+
/**
|
|
119
|
+
* Checks whether the current user matches a single segment, returning
|
|
120
|
+
* `true` / `false` directly. Use this as a decision primitive to gate
|
|
121
|
+
* UI surfaces (e.g. show a "VIP lounge" tab only when the user is in
|
|
122
|
+
* the VIP segment), or to drive segment-specific CTA copy.
|
|
123
|
+
*
|
|
124
|
+
* Every call is a server round-trip — there is no SDK-side cache. For
|
|
125
|
+
* checking multiple segments in one round-trip, use
|
|
126
|
+
* {@link checkSegmentListMatch} instead.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* **Refresh model**
|
|
130
|
+
* - **No client cache.** Every call sends a request; the SDK does not
|
|
131
|
+
* memoize results.
|
|
132
|
+
* - **No push event** notifies the consumer when segment membership
|
|
133
|
+
* flips (the user crosses a qualification threshold, or the
|
|
134
|
+
* operator changes the segment definition). Membership changes
|
|
135
|
+
* become visible only on the next `checkSegmentMatch` call.
|
|
136
|
+
* - **Behavioral segments (configured against BigQuery) have batch
|
|
137
|
+
* lag** — even if the user's activity has changed (deposit, wager,
|
|
138
|
+
* etc.), the segment-membership result may not reflect that change
|
|
139
|
+
* until the next batch evaluation run (typically up to several
|
|
140
|
+
* hours).
|
|
141
|
+
*
|
|
142
|
+
* **Rate limit** (important)
|
|
143
|
+
* The server caps `checkSegment*` calls at **10 requests per
|
|
144
|
+
* 60-second window**, with a minimum gap of **~5 seconds between
|
|
145
|
+
* consecutive calls**. Avoid calling on every render — cache the
|
|
146
|
+
* result client-side for the session, or until you have a reason to
|
|
147
|
+
* believe the user's state changed (e.g. after a deposit completes,
|
|
148
|
+
* a level changes via {@link getUserProfile}'s `props_change`, or a
|
|
149
|
+
* specific custom event fires).
|
|
150
|
+
*
|
|
151
|
+
* **`is_matching: false` is ambiguous on the server** — both "the
|
|
152
|
+
* segment doesn't exist for this label" and "the user doesn't
|
|
153
|
+
* qualify" return `false` with no distinguishing signal. Pass IDs
|
|
154
|
+
* you've verified are valid for your label.
|
|
155
|
+
*
|
|
156
|
+
* **Idempotency**: safe. Read-only. No side effects (no analytics
|
|
157
|
+
* events, no DB writes).
|
|
158
|
+
*
|
|
159
|
+
* **Visitor mode**: not supported.
|
|
160
|
+
*
|
|
161
|
+
* @param segment_id The segment ID. Segment IDs are label-scoped;
|
|
162
|
+
* the same numeric ID can refer to different
|
|
163
|
+
* segments under different labels. Use the IDs
|
|
164
|
+
* configured for your label.
|
|
165
|
+
* @returns `true` if the user currently matches the
|
|
166
|
+
* segment, `false` otherwise. `false` also covers
|
|
167
|
+
* the "segment doesn't exist for this label"
|
|
168
|
+
* case — these are not distinguishable.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* const isVip = await window._smartico.api.checkSegmentMatch(vipSegmentId);
|
|
173
|
+
* if (isVip) {
|
|
174
|
+
* console.log('[smartico] user is in VIP segment — render the VIP-only widget surface');
|
|
175
|
+
* } else {
|
|
176
|
+
* console.log('[smartico] user not in VIP segment (or segment id misconfigured) — hide the VIP surface');
|
|
177
|
+
* }
|
|
178
|
+
*
|
|
179
|
+
* // Cache the result for the session; re-check after material user-state changes.
|
|
180
|
+
* window._smartico.on('props_change', async (changed) => {
|
|
181
|
+
* if ('ach_points_ever' in changed || 'ach_level_current_id' in changed) {
|
|
182
|
+
* const fresh = await window._smartico.api.checkSegmentMatch(vipSegmentId);
|
|
183
|
+
* console.log('[smartico] user state changed — VIP membership now:', fresh);
|
|
184
|
+
* }
|
|
123
185
|
* });
|
|
124
186
|
* ```
|
|
125
|
-
*
|
|
126
|
-
* **Visitor mode: not supported**
|
|
127
187
|
*/
|
|
128
188
|
checkSegmentMatch(segment_id: number): Promise<boolean>;
|
|
129
|
-
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
189
|
+
/**
|
|
190
|
+
* Checks the current user's membership in multiple segments in a
|
|
191
|
+
* single server round-trip — returns a `TSegmentCheckResult[]` with
|
|
192
|
+
* one entry per *unique* segment ID. Use this instead of looping
|
|
193
|
+
* {@link checkSegmentMatch} when you need to evaluate several
|
|
194
|
+
* segments at once (e.g. multi-segment composite gating, A/B-style
|
|
195
|
+
* cohort detection).
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* **Response order is NOT guaranteed**
|
|
199
|
+
* The server returns results in an unspecified order — different
|
|
200
|
+
* from the input array. Always correlate by the `segment_id` field on
|
|
201
|
+
* each `TSegmentCheckResult` rather than by array position. The
|
|
202
|
+
* returned array length may also be smaller than the input array
|
|
203
|
+
* (duplicate IDs are silently de-duplicated server-side).
|
|
204
|
+
*
|
|
205
|
+
* **Single round-trip**
|
|
206
|
+
* The entire `segment_ids` array is sent in one request. Two segments
|
|
207
|
+
* cost the same as one in terms of network latency and rate-limit
|
|
208
|
+
* consumption (one call = one rate-limit slot, regardless of how many
|
|
209
|
+
* segments).
|
|
210
|
+
*
|
|
211
|
+
* **Shared semantics with `checkSegmentMatch`**
|
|
212
|
+
* Both methods wrap the same underlying server endpoint and share
|
|
213
|
+
* the same caching, refresh, rate-limit, and ambiguity behavior. See
|
|
214
|
+
* {@link checkSegmentMatch} for: no client cache · no push event for
|
|
215
|
+
* membership changes · behavioral segments have batch lag · rate
|
|
216
|
+
* limit (10 requests / 60 s, ~5 s minimum gap between calls) ·
|
|
217
|
+
* `is_matching: false` doesn't distinguish "not in segment" from
|
|
218
|
+
* "segment doesn't exist for this label".
|
|
219
|
+
*
|
|
220
|
+
* **Idempotency**: safe. Read-only. No side effects.
|
|
221
|
+
*
|
|
222
|
+
* **Visitor mode**: not supported.
|
|
223
|
+
*
|
|
224
|
+
* @param segment_ids Array of segment IDs to check. Duplicates are
|
|
225
|
+
* silently de-duplicated server-side. Segment IDs
|
|
226
|
+
* are label-scoped — use the IDs configured for
|
|
227
|
+
* your label.
|
|
228
|
+
* @returns Array of `{ segment_id, is_matching }` results.
|
|
229
|
+
* Order is NOT guaranteed; correlate by
|
|
230
|
+
* `segment_id`. Length may be less than the input
|
|
231
|
+
* when duplicate IDs were sent.
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* const segmentIds = [vipSegmentId, newPlayerSegmentId, freeRollSegmentId];
|
|
236
|
+
* const results = await window._smartico.api.checkSegmentListMatch(segmentIds);
|
|
237
|
+
*
|
|
238
|
+
* // Always correlate by segment_id — the response order is unspecified.
|
|
239
|
+
* const byId = new Map(results.map(r => [r.segment_id, r.is_matching]));
|
|
240
|
+
*
|
|
241
|
+
* if (byId.get(vipSegmentId)) {
|
|
242
|
+
* console.log('[smartico] user is in VIP segment — render VIP surface');
|
|
243
|
+
* }
|
|
244
|
+
* if (byId.get(newPlayerSegmentId) && byId.get(freeRollSegmentId)) {
|
|
245
|
+
* console.log('[smartico] new player AND eligible for free roll — show the welcome promo');
|
|
246
|
+
* }
|
|
247
|
+
*
|
|
248
|
+
* // Cache the result map for the session; refresh on material state changes.
|
|
135
249
|
* ```
|
|
136
|
-
* **Visitor mode: not supported**
|
|
137
250
|
*/
|
|
138
251
|
checkSegmentListMatch(segment_ids: number[]): Promise<TSegmentCheckResult[]>;
|
|
139
252
|
/**
|
|
@@ -285,7 +398,7 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
285
398
|
* The SDK exposes raw numeric values; the meaning of each counter
|
|
286
399
|
* (deposit amount, wager amount, lifetime spend, etc.) is fully
|
|
287
400
|
* operator-defined per label. Resolve labels for display via
|
|
288
|
-
*
|
|
401
|
+
* `getTranslations` — the operator's display strings are
|
|
289
402
|
* stored under the translation keys `levelsCounter1Name` and
|
|
290
403
|
* `levelsCounter2Name`.
|
|
291
404
|
*
|
|
@@ -341,42 +454,79 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
341
454
|
*/
|
|
342
455
|
getUserLevelExtraCounters(): Promise<UserLevelExtraCountersT>;
|
|
343
456
|
/**
|
|
344
|
-
* Returns the
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
* You can pass the onUpdate callback as a parameter, it will be called every time the activity log is updated and will provide the updated list of activity logs for the last 10 minutes.
|
|
457
|
+
* Returns the user's unified balance-change history — every points, gems, and
|
|
458
|
+
* diamonds transaction within the requested time window, ordered newest-first.
|
|
459
|
+
* Use to power an "Activity" / "History" tab showing wins, claims, purchases,
|
|
460
|
+
* level-up rewards, and operator adjustments.
|
|
349
461
|
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
462
|
+
* The returned shape is the same regardless of currency type — `type` (see
|
|
463
|
+
* {@link UserBalanceType}) distinguishes points / gems / diamonds and
|
|
464
|
+
* `source_type_id` (see {@link PointChangeSourceType}) names the originating
|
|
465
|
+
* event.
|
|
466
|
+
*
|
|
467
|
+
* @remarks
|
|
468
|
+
* **Preconditions**
|
|
469
|
+
* - User must be authenticated. Visitor mode is not guarded at the SDK level
|
|
470
|
+
* but is not meaningful — activity is per-user.
|
|
471
|
+
*
|
|
472
|
+
* **Pagination — `from` / `to` are offset + ceiling, not timestamps**
|
|
473
|
+
* The SDK derives `offset = from`, `limit = min(to - from, 50)` — the server
|
|
474
|
+
* hard-caps a single response at 50 entries. For infinite scroll, advance
|
|
475
|
+
* `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
|
|
476
|
+
* are epoch seconds bounding the window the server scans.
|
|
477
|
+
*
|
|
478
|
+
* **Subscription model (`onUpdate`)**
|
|
479
|
+
* The callback fires when the user's `ach_points_balance`,
|
|
480
|
+
* `ach_gems_balance`, or `ach_diamonds_balance` changes (i.e. whenever a
|
|
481
|
+
* wallet event lands). The pushed payload is a FIXED re-fetch of the
|
|
482
|
+
* **last 10 minutes / first 50 entries** — it does NOT honor the original
|
|
483
|
+
* call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to`. Consumers
|
|
484
|
+
* maintaining a long historical view must re-call `getActivityLog` with
|
|
485
|
+
* their own params after receiving an `onUpdate` notification.
|
|
486
|
+
*
|
|
487
|
+
* **Refresh**
|
|
488
|
+
* - The SDK caches results for 30 seconds.
|
|
489
|
+
* - Push triggers fire only on balance changes; transactions that don't
|
|
490
|
+
* alter a balance (theoretical zero-amount entries) won't refresh.
|
|
491
|
+
*
|
|
492
|
+
* **Visitor mode**: not meaningful (no per-user history available).
|
|
493
|
+
*
|
|
494
|
+
* **UI guidance**: see [UI Guide — `getActivityLog`](../../docs/ui/user/UIGuide_getActivityLog.md).
|
|
365
495
|
*
|
|
366
|
-
*
|
|
496
|
+
* @returns Array of {@link TActivityLog} ordered newest-first.
|
|
367
497
|
*
|
|
368
|
-
* @
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```ts
|
|
500
|
+
* const now = Math.floor(Date.now() / 1000);
|
|
501
|
+
* const start = now - 86400 * 30; // 30 days
|
|
502
|
+
*
|
|
503
|
+
* const log = await window._smartico.api.getActivityLog({
|
|
504
|
+
* startTimeSeconds: start,
|
|
505
|
+
* endTimeSeconds: now,
|
|
506
|
+
* from: 0,
|
|
507
|
+
* to: 50,
|
|
508
|
+
* onUpdate: (refreshed) => {
|
|
509
|
+
* console.log('[smartico] wallet changed — refreshed payload is last 10 min / 50 entries:', refreshed.length, 'rows');
|
|
510
|
+
* // If the consumer is showing a full 30-day view, re-call getActivityLog with the original params here.
|
|
511
|
+
* },
|
|
512
|
+
* });
|
|
513
|
+
*
|
|
514
|
+
* for (const row of log) {
|
|
515
|
+
* const sign = row.amount >= 0 ? '+' : '';
|
|
516
|
+
* console.log('[smartico] activity row — render with', row.type === 0 ? 'points' : row.type === 1 ? 'gems' : 'diamonds', 'icon, color by sign:', sign + row.amount, 'balance after:', row.balance, 'source:', row.source_type_id);
|
|
517
|
+
* }
|
|
518
|
+
* ```
|
|
374
519
|
*/
|
|
375
520
|
getActivityLog({ startTimeSeconds, endTimeSeconds, from, to, onUpdate, }: {
|
|
521
|
+
/** Window start in epoch seconds. */
|
|
376
522
|
startTimeSeconds: number;
|
|
523
|
+
/** Window end in epoch seconds. */
|
|
377
524
|
endTimeSeconds: number;
|
|
525
|
+
/** Pagination offset (0-based). */
|
|
378
526
|
from: number;
|
|
527
|
+
/** Pagination ceiling (exclusive); server caps `to - from` at 50. */
|
|
379
528
|
to: number;
|
|
529
|
+
/** Optional push callback; payload is a fixed 10-min / 50-entry refresh on every wallet change (see Subscription model). */
|
|
380
530
|
onUpdate?: (data: TActivityLog[]) => void;
|
|
381
531
|
}): Promise<TActivityLog[]>;
|
|
382
532
|
protected notifyActivityLogUpdate(): Promise<void>;
|