@smartico/public-api 0.0.384 → 0.0.386
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/dist/Clans/JoinClanErrorCode.d.ts +21 -11
- package/dist/Tournaments/TournamentRegistrationError.d.ts +32 -2
- package/dist/WSAPI/WSAPIClans.d.ts +3 -5
- package/dist/WSAPI/WSAPILeaderBoard.d.ts +3 -11
- package/dist/WSAPI/WSAPIMissions.d.ts +6 -0
- package/dist/WSAPI/WSAPIUser.d.ts +27 -16
- package/dist/index.js +112 -50
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +112 -50
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPILeaderBoard.md +3 -11
- package/docs/api/classes/WSAPIMissions.md +9 -0
- package/docs/api/classes/WSAPIUser.md +27 -16
- package/docs/api/enumerations/TournamentRegistrationError.md +47 -2
- package/docs/ui/clans/UIGuide_joinClan.md +1 -2
- package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +15 -14
- package/package.json +1 -1
- package/src/Clans/JoinClanErrorCode.ts +20 -14
- package/src/Inbox/InboxMessage.ts +3 -0
- package/src/Tournaments/Tournament.ts +1 -1
- package/src/Tournaments/TournamentRegistrationError.ts +32 -4
- package/src/WSAPI/WSAPI.ts +3 -1
- package/src/WSAPI/WSAPIClans.ts +3 -5
- package/src/WSAPI/WSAPIJackpots.ts +3 -0
- package/src/WSAPI/WSAPILeaderBoard.ts +7 -12
- package/src/WSAPI/WSAPIMiniGames.ts +3 -0
- package/src/WSAPI/WSAPIMissions.ts +12 -0
- package/src/WSAPI/WSAPIUser.ts +27 -16
|
@@ -1,22 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes returned in `errCode` by the `joinClan` method (also carried
|
|
3
|
+
* on `TClanJoinResult`). These are terse value definitions for lookup; the
|
|
4
|
+
* full per-code narrative and UI handling lives in the `joinClan` method
|
|
5
|
+
* TSDoc, which owns the error table.
|
|
6
|
+
*/
|
|
1
7
|
export declare enum JoinClanErrorCode {
|
|
2
|
-
/**
|
|
8
|
+
/** Success — join completed; entry fee (if any) deducted. */
|
|
3
9
|
JOIN_CLAN_OK = 0,
|
|
4
|
-
/**
|
|
10
|
+
/** Request was malformed (missing or invalid parameters). */
|
|
5
11
|
JOIN_CLAN_INVALID_PARAMETERS = 1000,
|
|
6
|
-
/**
|
|
12
|
+
/** Clan doesn't exist for this label. Archived clans are also reported as `1001`. */
|
|
7
13
|
JOIN_CLAN_NOT_FOUND = 1001,
|
|
8
|
-
/**
|
|
14
|
+
/** Clan is full — member capacity reached. */
|
|
9
15
|
JOIN_CLAN_FULL = 1002,
|
|
10
|
-
/**
|
|
16
|
+
/** Insufficient balance for the entry fee (points / gems / diamonds). */
|
|
11
17
|
JOIN_CLAN_INSUFFICIENT_FUNDS = 1003,
|
|
12
|
-
/** User doesn't
|
|
18
|
+
/** User doesn't meet the clan's entry segment or conditions. */
|
|
13
19
|
JOIN_CLAN_SEGMENT_MISMATCH = 1004,
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* User is not in a clan. Note: a `registerInTournament` response code
|
|
22
|
+
* that shares this enum — never returned by `joinClan`.
|
|
23
|
+
*/
|
|
15
24
|
JOIN_CLAN_USER_IS_NOT_IN_CLAN = 1005,
|
|
16
|
-
/** User is within the
|
|
25
|
+
/** User is within the clan-switch cooldown window (switch only). */
|
|
17
26
|
JOIN_CLAN_COOLDOWN_ACTIVE = 1006,
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Clan joined after tournament start. Note: a `registerInTournament`
|
|
29
|
+
* response code that shares this enum — never returned by `joinClan`.
|
|
30
|
+
*/
|
|
21
31
|
JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START = 1011
|
|
22
32
|
}
|
|
@@ -1,14 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error codes returned in `err_code` by the `registerInTournament` method.
|
|
3
|
+
*
|
|
4
|
+
* These are terse value definitions for lookup. The full per-code narrative —
|
|
5
|
+
* when each fires and how the consumer's UI should react — lives in the
|
|
6
|
+
* `registerInTournament` method TSDoc, which owns the error table.
|
|
7
|
+
*
|
|
8
|
+
* Note the numbering break: the gems / diamonds codes are 6-digit
|
|
9
|
+
* (`300010` / `300011`) while the rest of the tournament block is 5-digit;
|
|
10
|
+
* they were appended after the original `30001`–`30009` range was occupied.
|
|
11
|
+
* Branch on the exact numeric value, not on digit count.
|
|
12
|
+
*/
|
|
1
13
|
export declare enum TournamentRegistrationError {
|
|
14
|
+
/** Success — registration persisted; buy-in (if any) deducted. */
|
|
2
15
|
NO_ERROR = 0,
|
|
16
|
+
/** Clan-based tournament and the user does not belong to a clan yet. */
|
|
3
17
|
TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN = 1010,
|
|
18
|
+
/** Instance id is invalid or the tournament was deleted. */
|
|
4
19
|
TOURNAMENT_INSTANCE_NOT_FOUND = 30001,
|
|
20
|
+
/** Insufficient points balance for a points-priced buy-in. */
|
|
5
21
|
TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS = 30002,
|
|
22
|
+
/** Tournament is no longer in a registerable state (finished, cancelled, finalizing, or not yet open). */
|
|
6
23
|
TOURNAMENT_INSTANCE_NOT_IN_STATE = 30003,
|
|
24
|
+
/** User is already registered; treat as an idempotent success. */
|
|
7
25
|
TOURNAMENT_ALREADY_REGISTERED = 30004,
|
|
26
|
+
/** User does not satisfy the tournament's segment / entry conditions. */
|
|
8
27
|
TOURNAMENT_USER_DONT_MATCH_CONDITIONS = 30005,
|
|
28
|
+
/** User is not registered; anomalous on a register call (usually a server-side race). */
|
|
9
29
|
TOURNAMENT_USER_NOT_REGISTERED = 30006,
|
|
30
|
+
/** Registration status transition is not allowed (e.g. re-registering a finished tournament). */
|
|
10
31
|
TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS = 30007,
|
|
32
|
+
/** Tournament filled up — maximum registrations reached. */
|
|
11
33
|
TOURNAMENT_MAX_REGISTRATIONS_REACHED = 30008,
|
|
12
|
-
|
|
13
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The user's wallet currency could not be resolved. Emitted server-side
|
|
36
|
+
* during tournament score processing, NOT during registration — it is
|
|
37
|
+
* never returned by `registerInTournament`. Included for completeness.
|
|
38
|
+
*/
|
|
39
|
+
TOURNAMENT_INVALID_USER_CURRENCY = 30009,
|
|
40
|
+
/** Insufficient gems balance for a gems-priced buy-in. */
|
|
41
|
+
TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS = 300010,
|
|
42
|
+
/** Insufficient diamonds balance for a diamonds-priced buy-in. */
|
|
43
|
+
TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS = 300011
|
|
14
44
|
}
|
|
@@ -280,12 +280,10 @@ export declare class WSAPIClans extends WSAPITournaments {
|
|
|
280
280
|
* tournament requires the user to be in a clan first.
|
|
281
281
|
* - `1006` (`JOIN_CLAN_COOLDOWN_ACTIVE`) — user is inside the
|
|
282
282
|
* switch-cooldown window from a previous clan join (default
|
|
283
|
-
* 7 days, configurable per label).
|
|
283
|
+
* 7 days, configurable per label). Only reachable when the user is
|
|
284
|
+
* already in a *different* clan (this call is then a clan switch);
|
|
285
|
+
* a first-time join never returns `1006`. Surface the
|
|
284
286
|
* `TClans.cooldown_until` expiry in the disabled CTA.
|
|
285
|
-
* - `1007` (`JOIN_CLAN_ARCHIVED`) — defined on the public enum but
|
|
286
|
-
* the server does NOT emit this code in practice (archived clans
|
|
287
|
-
* are reported as `1001`). Handle it as a synonym for `1001`
|
|
288
|
-
* defensively, but do not rely on it.
|
|
289
287
|
* - `1011` (`JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START`) — this
|
|
290
288
|
* method does NOT return `1011` directly. The code fires on
|
|
291
289
|
* {@link registerInTournament} responses when the user joined
|
|
@@ -48,15 +48,8 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
|
|
|
48
48
|
* the array is the prize for place 1, the second for place 2, and
|
|
49
49
|
* so on. The array length is the number of paid places.
|
|
50
50
|
*
|
|
51
|
-
* **Cache TTL
|
|
52
|
-
* The SDK caches
|
|
53
|
-
* key — calling `getLeaderBoard(DAILY)` followed by
|
|
54
|
-
* `getLeaderBoard(WEEKLY)` within the same 30 s window returns the
|
|
55
|
-
* cached DAILY result for the WEEKLY call. Same applies to
|
|
56
|
-
* switching `getPreviousPeriod`. To force a fresh fetch when
|
|
57
|
-
* switching periods or current/previous, call
|
|
58
|
-
* `_smartico.api.clearCaches()` before the second call, or simply
|
|
59
|
-
* wait out the TTL.
|
|
51
|
+
* **Cache TTL**
|
|
52
|
+
* The SDK caches each response for 30 seconds.
|
|
60
53
|
*
|
|
61
54
|
* **Period boundaries**
|
|
62
55
|
* The server finalizes each period on a server-configurable
|
|
@@ -126,8 +119,7 @@ export declare class WSAPILeaderBoard extends WSAPIGamePick {
|
|
|
126
119
|
* }
|
|
127
120
|
* }
|
|
128
121
|
*
|
|
129
|
-
* // Switch to previous period view —
|
|
130
|
-
* await window._smartico.api.clearCaches();
|
|
122
|
+
* // Switch to previous period view — cached separately from the current period.
|
|
131
123
|
* const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
|
|
132
124
|
* console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
|
|
133
125
|
*
|
|
@@ -177,8 +177,14 @@ export declare class WSAPIMissions extends WSAPIGeneral {
|
|
|
177
177
|
* **Idempotency / Side effects**: fetch-only; safe to call repeatedly.
|
|
178
178
|
* The cache layer deduplicates concurrent calls within the TTL window.
|
|
179
179
|
*
|
|
180
|
+
* **Visitor mode**: not supported. Badges are an authenticated-only
|
|
181
|
+
* feature; calling this on the visitor-mode handle (`_smartico.vapi`)
|
|
182
|
+
* throws synchronously rather than silently returning an empty list.
|
|
183
|
+
*
|
|
180
184
|
* **UI guidance**: see [UI Guide — `getBadges`](../../docs/ui/missions/UIGuide_getBadges.md).
|
|
181
185
|
*
|
|
186
|
+
* @throws `Error("getBadges is not available in visitor mode")` when
|
|
187
|
+
* called from a visitor-mode session.
|
|
182
188
|
* @returns Promise resolving to `TMissionOrBadge[]`. Every item has
|
|
183
189
|
* `type === 'badge'`. Cached for 30 s under the `Badges` key.
|
|
184
190
|
*
|
|
@@ -334,12 +334,25 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
334
334
|
* `ach_points_ever` and {@link getLevels} would also work, but
|
|
335
335
|
* `progress` saves the math.
|
|
336
336
|
*
|
|
337
|
-
* **Cache TTL
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
337
|
+
* **Cache TTL & freshness**
|
|
338
|
+
* The response is cached for 30 seconds, but the SDK automatically
|
|
339
|
+
* drops that cache whenever a user-properties update arrives — the
|
|
340
|
+
* same live channel that backs {@link getUserProfile}. The practical
|
|
341
|
+
* effect depends on the label's leveling logic:
|
|
342
|
+
* - **Points-based or operator-manual leveling**: a points or level
|
|
343
|
+
* change flows through the user-properties channel, so the cache is
|
|
344
|
+
* busted at that moment and the next `getCurrentLevel()` call
|
|
345
|
+
* returns up-to-date data without waiting out the TTL.
|
|
346
|
+
* - **Counter-based leveling** (level driven by sliding-window
|
|
347
|
+
* counters such as deposit or wagering totals over a recent window —
|
|
348
|
+
* see {@link getUserLevelExtraCounters}): ordinary progress changes
|
|
349
|
+
* are recomputed by a periodic server job and do NOT emit a
|
|
350
|
+
* user-properties update, so they become visible on this method only
|
|
351
|
+
* after the 30 s TTL expires (or after `_smartico.api.clearCaches()`).
|
|
352
|
+
*
|
|
353
|
+
* Avoid calling `clearCaches()` on the points/manual path — it's
|
|
354
|
+
* unnecessary there (the cache is already refreshed on the property
|
|
355
|
+
* update) and forces a slower extra round-trip.
|
|
343
356
|
*
|
|
344
357
|
* **Leveling logic**
|
|
345
358
|
* The semantics of how a user advances depends on the label's
|
|
@@ -367,10 +380,10 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
367
380
|
* console.log('[smartico] render level badge — name:', level.name,
|
|
368
381
|
* 'progress:', Math.round(level.progress), '%');
|
|
369
382
|
*
|
|
370
|
-
* // Detect level-up via getUserProfile's push channel.
|
|
383
|
+
* // Detect level-up via getUserProfile's push channel. No clearCaches()
|
|
384
|
+
* // needed — the SDK already drops the level cache on this update.
|
|
371
385
|
* window._smartico.on('props_change', async (changed) => {
|
|
372
386
|
* if ('ach_level_current_id' in changed) {
|
|
373
|
-
* await window._smartico.api.clearCaches(); // bust the 30 s cache
|
|
374
387
|
* const fresh = await window._smartico.api.getCurrentLevel();
|
|
375
388
|
* console.log('[smartico] user levelled up — animate badge to new level:', fresh.name);
|
|
376
389
|
* }
|
|
@@ -403,14 +416,12 @@ export declare class WSAPIUser extends WSAPIBase {
|
|
|
403
416
|
* `levelsCounter2Name`.
|
|
404
417
|
*
|
|
405
418
|
* **Refresh cadence**
|
|
406
|
-
* Sliding-window counters are recomputed by a server-side
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* {@link getUserProfile}'s `ach_level_current_id`, call
|
|
413
|
-
* `_smartico.api.clearCaches()` to force a fresh fetch.
|
|
419
|
+
* Sliding-window counters are recomputed by a periodic server-side
|
|
420
|
+
* job. Its rebuild cadence is operator-configured per brand —
|
|
421
|
+
* commonly daily, though it can be set more frequent — so level
|
|
422
|
+
* transitions driven by counter changes surface with a latency tied
|
|
423
|
+
* to that rebuild schedule after the underlying activity (e.g. a
|
|
424
|
+
* deposit), not in real time.
|
|
414
425
|
*
|
|
415
426
|
* **Idempotency**: safe. Read-only. Repeated calls within the cache
|
|
416
427
|
* window return a deep-cloned cached value without a network
|
package/dist/index.js
CHANGED
|
@@ -911,6 +911,9 @@ var InboxMessagesTransform = function InboxMessagesTransform(items) {
|
|
|
911
911
|
};
|
|
912
912
|
|
|
913
913
|
var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
|
|
914
|
+
if (!item) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
914
917
|
var x = {
|
|
915
918
|
action: item.action,
|
|
916
919
|
icon: item.image,
|
|
@@ -1880,7 +1883,7 @@ TournamentUtils.getPrizeTransformed = function (prize) {
|
|
|
1880
1883
|
|
|
1881
1884
|
var TournamentItemsTransform = function TournamentItemsTransform(items) {
|
|
1882
1885
|
return items.filter(function (r) {
|
|
1883
|
-
return r.tournamentId >= 1;
|
|
1886
|
+
return r != null && r.tournamentId >= 1;
|
|
1884
1887
|
}).map(function (r) {
|
|
1885
1888
|
var x = _extends({
|
|
1886
1889
|
instance_id: r.tournamentInstanceId,
|
|
@@ -2019,20 +2022,50 @@ var tournamentInfoItemTransform = function tournamentInfoItemTransform(t) {
|
|
|
2019
2022
|
return response;
|
|
2020
2023
|
};
|
|
2021
2024
|
|
|
2025
|
+
/**
|
|
2026
|
+
* Error codes returned in `err_code` by the `registerInTournament` method.
|
|
2027
|
+
*
|
|
2028
|
+
* These are terse value definitions for lookup. The full per-code narrative —
|
|
2029
|
+
* when each fires and how the consumer's UI should react — lives in the
|
|
2030
|
+
* `registerInTournament` method TSDoc, which owns the error table.
|
|
2031
|
+
*
|
|
2032
|
+
* Note the numbering break: the gems / diamonds codes are 6-digit
|
|
2033
|
+
* (`300010` / `300011`) while the rest of the tournament block is 5-digit;
|
|
2034
|
+
* they were appended after the original `30001`–`30009` range was occupied.
|
|
2035
|
+
* Branch on the exact numeric value, not on digit count.
|
|
2036
|
+
*/
|
|
2022
2037
|
exports.TournamentRegistrationError = void 0;
|
|
2023
2038
|
(function (TournamentRegistrationError) {
|
|
2039
|
+
/** Success — registration persisted; buy-in (if any) deducted. */
|
|
2024
2040
|
TournamentRegistrationError[TournamentRegistrationError["NO_ERROR"] = 0] = "NO_ERROR";
|
|
2041
|
+
/** Clan-based tournament and the user does not belong to a clan yet. */
|
|
2025
2042
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN"] = 1010] = "TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN";
|
|
2043
|
+
/** Instance id is invalid or the tournament was deleted. */
|
|
2026
2044
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_FOUND"] = 30001] = "TOURNAMENT_INSTANCE_NOT_FOUND";
|
|
2045
|
+
/** Insufficient points balance for a points-priced buy-in. */
|
|
2027
2046
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS"] = 30002] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS";
|
|
2047
|
+
/** Tournament is no longer in a registerable state (finished, cancelled, finalizing, or not yet open). */
|
|
2028
2048
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_IN_STATE"] = 30003] = "TOURNAMENT_INSTANCE_NOT_IN_STATE";
|
|
2049
|
+
/** User is already registered; treat as an idempotent success. */
|
|
2029
2050
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_ALREADY_REGISTERED"] = 30004] = "TOURNAMENT_ALREADY_REGISTERED";
|
|
2051
|
+
/** User does not satisfy the tournament's segment / entry conditions. */
|
|
2030
2052
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_DONT_MATCH_CONDITIONS"] = 30005] = "TOURNAMENT_USER_DONT_MATCH_CONDITIONS";
|
|
2053
|
+
/** User is not registered; anomalous on a register call (usually a server-side race). */
|
|
2031
2054
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_NOT_REGISTERED"] = 30006] = "TOURNAMENT_USER_NOT_REGISTERED";
|
|
2055
|
+
/** Registration status transition is not allowed (e.g. re-registering a finished tournament). */
|
|
2032
2056
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS"] = 30007] = "TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS";
|
|
2057
|
+
/** Tournament filled up — maximum registrations reached. */
|
|
2033
2058
|
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_MAX_REGISTRATIONS_REACHED"] = 30008] = "TOURNAMENT_MAX_REGISTRATIONS_REACHED";
|
|
2034
|
-
|
|
2035
|
-
|
|
2059
|
+
/**
|
|
2060
|
+
* The user's wallet currency could not be resolved. Emitted server-side
|
|
2061
|
+
* during tournament score processing, NOT during registration — it is
|
|
2062
|
+
* never returned by `registerInTournament`. Included for completeness.
|
|
2063
|
+
*/
|
|
2064
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INVALID_USER_CURRENCY"] = 30009] = "TOURNAMENT_INVALID_USER_CURRENCY";
|
|
2065
|
+
/** Insufficient gems balance for a gems-priced buy-in. */
|
|
2066
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS"] = 300010] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS";
|
|
2067
|
+
/** Insufficient diamonds balance for a diamonds-priced buy-in. */
|
|
2068
|
+
TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS"] = 300011] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS";
|
|
2036
2069
|
})(exports.TournamentRegistrationError || (exports.TournamentRegistrationError = {}));
|
|
2037
2070
|
|
|
2038
2071
|
exports.TournamentType = void 0;
|
|
@@ -2802,12 +2835,25 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
|
|
|
2802
2835
|
* `ach_points_ever` and {@link getLevels} would also work, but
|
|
2803
2836
|
* `progress` saves the math.
|
|
2804
2837
|
*
|
|
2805
|
-
* **Cache TTL
|
|
2806
|
-
*
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
*
|
|
2810
|
-
*
|
|
2838
|
+
* **Cache TTL & freshness**
|
|
2839
|
+
* The response is cached for 30 seconds, but the SDK automatically
|
|
2840
|
+
* drops that cache whenever a user-properties update arrives — the
|
|
2841
|
+
* same live channel that backs {@link getUserProfile}. The practical
|
|
2842
|
+
* effect depends on the label's leveling logic:
|
|
2843
|
+
* - **Points-based or operator-manual leveling**: a points or level
|
|
2844
|
+
* change flows through the user-properties channel, so the cache is
|
|
2845
|
+
* busted at that moment and the next `getCurrentLevel()` call
|
|
2846
|
+
* returns up-to-date data without waiting out the TTL.
|
|
2847
|
+
* - **Counter-based leveling** (level driven by sliding-window
|
|
2848
|
+
* counters such as deposit or wagering totals over a recent window —
|
|
2849
|
+
* see {@link getUserLevelExtraCounters}): ordinary progress changes
|
|
2850
|
+
* are recomputed by a periodic server job and do NOT emit a
|
|
2851
|
+
* user-properties update, so they become visible on this method only
|
|
2852
|
+
* after the 30 s TTL expires (or after `_smartico.api.clearCaches()`).
|
|
2853
|
+
*
|
|
2854
|
+
* Avoid calling `clearCaches()` on the points/manual path — it's
|
|
2855
|
+
* unnecessary there (the cache is already refreshed on the property
|
|
2856
|
+
* update) and forces a slower extra round-trip.
|
|
2811
2857
|
*
|
|
2812
2858
|
* **Leveling logic**
|
|
2813
2859
|
* The semantics of how a user advances depends on the label's
|
|
@@ -2835,10 +2881,10 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
|
|
|
2835
2881
|
* console.log('[smartico] render level badge — name:', level.name,
|
|
2836
2882
|
* 'progress:', Math.round(level.progress), '%');
|
|
2837
2883
|
*
|
|
2838
|
-
* // Detect level-up via getUserProfile's push channel.
|
|
2884
|
+
* // Detect level-up via getUserProfile's push channel. No clearCaches()
|
|
2885
|
+
* // needed — the SDK already drops the level cache on this update.
|
|
2839
2886
|
* window._smartico.on('props_change', async (changed) => {
|
|
2840
2887
|
* if ('ach_level_current_id' in changed) {
|
|
2841
|
-
* await window._smartico.api.clearCaches(); // bust the 30 s cache
|
|
2842
2888
|
* const fresh = await window._smartico.api.getCurrentLevel();
|
|
2843
2889
|
* console.log('[smartico] user levelled up — animate badge to new level:', fresh.name);
|
|
2844
2890
|
* }
|
|
@@ -2881,14 +2927,12 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
|
|
|
2881
2927
|
* `levelsCounter2Name`.
|
|
2882
2928
|
*
|
|
2883
2929
|
* **Refresh cadence**
|
|
2884
|
-
* Sliding-window counters are recomputed by a server-side
|
|
2885
|
-
*
|
|
2886
|
-
*
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2890
|
-
* {@link getUserProfile}'s `ach_level_current_id`, call
|
|
2891
|
-
* `_smartico.api.clearCaches()` to force a fresh fetch.
|
|
2930
|
+
* Sliding-window counters are recomputed by a periodic server-side
|
|
2931
|
+
* job. Its rebuild cadence is operator-configured per brand —
|
|
2932
|
+
* commonly daily, though it can be set more frequent — so level
|
|
2933
|
+
* transitions driven by counter changes surface with a latency tied
|
|
2934
|
+
* to that rebuild schedule after the underlying activity (e.g. a
|
|
2935
|
+
* deposit), not in real time.
|
|
2892
2936
|
*
|
|
2893
2937
|
* **Idempotency**: safe. Read-only. Repeated calls within the cache
|
|
2894
2938
|
* window return a deep-cloned cached value without a network
|
|
@@ -3438,8 +3482,14 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
|
|
|
3438
3482
|
* **Idempotency / Side effects**: fetch-only; safe to call repeatedly.
|
|
3439
3483
|
* The cache layer deduplicates concurrent calls within the TTL window.
|
|
3440
3484
|
*
|
|
3485
|
+
* **Visitor mode**: not supported. Badges are an authenticated-only
|
|
3486
|
+
* feature; calling this on the visitor-mode handle (`_smartico.vapi`)
|
|
3487
|
+
* throws synchronously rather than silently returning an empty list.
|
|
3488
|
+
*
|
|
3441
3489
|
* **UI guidance**: see [UI Guide — `getBadges`](../../docs/ui/missions/UIGuide_getBadges.md).
|
|
3442
3490
|
*
|
|
3491
|
+
* @throws `Error("getBadges is not available in visitor mode")` when
|
|
3492
|
+
* called from a visitor-mode session.
|
|
3443
3493
|
* @returns Promise resolving to `TMissionOrBadge[]`. Every item has
|
|
3444
3494
|
* `type === 'badge'`. Cached for 30 s under the `Badges` key.
|
|
3445
3495
|
*
|
|
@@ -3484,6 +3534,12 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
|
|
|
3484
3534
|
_proto.getBadges = function getBadges() {
|
|
3485
3535
|
try {
|
|
3486
3536
|
var _this2 = this;
|
|
3537
|
+
// Badges are an authenticated-only feature. The visitor-mode WSAPI
|
|
3538
|
+
// instance (`_smartico.vapi`) is constructed without a tracker, so the
|
|
3539
|
+
// server would silently return nothing; throw a clear error instead.
|
|
3540
|
+
if (!_this2.api.tracker) {
|
|
3541
|
+
throw new Error('getBadges is not available in visitor mode');
|
|
3542
|
+
}
|
|
3487
3543
|
return Promise.resolve(OCache.use(onUpdateContextKey.Badges, exports.ECacheContext.WSAPI, function () {
|
|
3488
3544
|
return _this2.api.badgetsGetItemsT(_this2.userExtId);
|
|
3489
3545
|
}, CACHE_DATA_SEC));
|
|
@@ -5728,12 +5784,10 @@ var WSAPIClans = /*#__PURE__*/function (_WSAPITournaments) {
|
|
|
5728
5784
|
* tournament requires the user to be in a clan first.
|
|
5729
5785
|
* - `1006` (`JOIN_CLAN_COOLDOWN_ACTIVE`) — user is inside the
|
|
5730
5786
|
* switch-cooldown window from a previous clan join (default
|
|
5731
|
-
* 7 days, configurable per label).
|
|
5787
|
+
* 7 days, configurable per label). Only reachable when the user is
|
|
5788
|
+
* already in a *different* clan (this call is then a clan switch);
|
|
5789
|
+
* a first-time join never returns `1006`. Surface the
|
|
5732
5790
|
* `TClans.cooldown_until` expiry in the disabled CTA.
|
|
5733
|
-
* - `1007` (`JOIN_CLAN_ARCHIVED`) — defined on the public enum but
|
|
5734
|
-
* the server does NOT emit this code in practice (archived clans
|
|
5735
|
-
* are reported as `1001`). Handle it as a synonym for `1001`
|
|
5736
|
-
* defensively, but do not rely on it.
|
|
5737
5791
|
* - `1011` (`JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START`) — this
|
|
5738
5792
|
* method does NOT return `1011` directly. The code fires on
|
|
5739
5793
|
* {@link registerInTournament} responses when the user joined
|
|
@@ -5968,6 +6022,9 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
|
|
|
5968
6022
|
return Promise.resolve(OCache.use(onUpdateContextKey.Jackpots, exports.ECacheContext.WSAPI, function () {
|
|
5969
6023
|
try {
|
|
5970
6024
|
return Promise.resolve(_this2.api.jackpotGet(_this2.userExtId, filter)).then(function (_jackpots) {
|
|
6025
|
+
if (!(_jackpots != null && _jackpots.items)) {
|
|
6026
|
+
return [];
|
|
6027
|
+
}
|
|
5971
6028
|
var _pots = _jackpots.items.map(function (jp) {
|
|
5972
6029
|
return jp.pot;
|
|
5973
6030
|
});
|
|
@@ -7629,6 +7686,9 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
|
|
|
7629
7686
|
var index = templates.findIndex(function (t) {
|
|
7630
7687
|
return t.id === data.saw_template_id;
|
|
7631
7688
|
});
|
|
7689
|
+
if (index === -1) {
|
|
7690
|
+
return;
|
|
7691
|
+
}
|
|
7632
7692
|
templates[index].spin_count = data.spin_count;
|
|
7633
7693
|
_this6.updateEntity(onUpdateContextKey.Saw, templates);
|
|
7634
7694
|
});
|
|
@@ -8760,15 +8820,8 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
|
|
|
8760
8820
|
* the array is the prize for place 1, the second for place 2, and
|
|
8761
8821
|
* so on. The array length is the number of paid places.
|
|
8762
8822
|
*
|
|
8763
|
-
* **Cache TTL
|
|
8764
|
-
* The SDK caches
|
|
8765
|
-
* key — calling `getLeaderBoard(DAILY)` followed by
|
|
8766
|
-
* `getLeaderBoard(WEEKLY)` within the same 30 s window returns the
|
|
8767
|
-
* cached DAILY result for the WEEKLY call. Same applies to
|
|
8768
|
-
* switching `getPreviousPeriod`. To force a fresh fetch when
|
|
8769
|
-
* switching periods or current/previous, call
|
|
8770
|
-
* `_smartico.api.clearCaches()` before the second call, or simply
|
|
8771
|
-
* wait out the TTL.
|
|
8823
|
+
* **Cache TTL**
|
|
8824
|
+
* The SDK caches each response for 30 seconds.
|
|
8772
8825
|
*
|
|
8773
8826
|
* **Period boundaries**
|
|
8774
8827
|
* The server finalizes each period on a server-configurable
|
|
@@ -8838,8 +8891,7 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
|
|
|
8838
8891
|
* }
|
|
8839
8892
|
* }
|
|
8840
8893
|
*
|
|
8841
|
-
* // Switch to previous period view —
|
|
8842
|
-
* await window._smartico.api.clearCaches();
|
|
8894
|
+
* // Switch to previous period view — cached separately from the current period.
|
|
8843
8895
|
* const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
|
|
8844
8896
|
* console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
|
|
8845
8897
|
*
|
|
@@ -8850,7 +8902,10 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
|
|
|
8850
8902
|
_proto.getLeaderBoard = function getLeaderBoard(periodType, getPreviousPeriod) {
|
|
8851
8903
|
try {
|
|
8852
8904
|
var _this = this;
|
|
8853
|
-
|
|
8905
|
+
// Cache per (periodType, current/previous) so switching tabs or
|
|
8906
|
+
// current↔previous within the TTL doesn't return a colliding board.
|
|
8907
|
+
var cacheKey = onUpdateContextKey.LeaderBoards + ":" + periodType + ":" + (getPreviousPeriod ? 1 : 0);
|
|
8908
|
+
return Promise.resolve(OCache.use(cacheKey, exports.ECacheContext.WSAPI, function () {
|
|
8854
8909
|
return _this.api.leaderboardsGetT(_this.userExtId, periodType, getPreviousPeriod);
|
|
8855
8910
|
}, CACHE_DATA_SEC));
|
|
8856
8911
|
} catch (e) {
|
|
@@ -9683,6 +9738,7 @@ var WSAPI = /*#__PURE__*/function (_WSAPIInbox) {
|
|
|
9683
9738
|
if ((data == null || (_data$props3 = data.props) == null ? void 0 : _data$props3.ach_points_balance) !== undefined || (data == null || (_data$props4 = data.props) == null ? void 0 : _data$props4.ach_gems_balance) !== undefined || (data == null || (_data$props5 = data.props) == null ? void 0 : _data$props5.ach_diamonds_balance) !== undefined) {
|
|
9684
9739
|
_this.notifyActivityLogUpdate();
|
|
9685
9740
|
}
|
|
9741
|
+
OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.CurrentLevel);
|
|
9686
9742
|
});
|
|
9687
9743
|
on(exports.ClassId.RAF_OPTIN_RESPONSE, function () {
|
|
9688
9744
|
return _this.updateRaffles();
|
|
@@ -12275,31 +12331,37 @@ exports.AvatarCustomizeErrorCode = void 0;
|
|
|
12275
12331
|
})(exports.AvatarCustomizeErrorCode || (exports.AvatarCustomizeErrorCode = {}));
|
|
12276
12332
|
var AvatarCustomizeErrorMessage = (_AvatarCustomizeError = {}, _AvatarCustomizeError[exports.AvatarCustomizeErrorCode.AVATAR_USER_LIMIT] = 'You have exceeded number of custom avatars creation, please try later', _AvatarCustomizeError[exports.AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT] = 'The custom avatars are not available, please try again later', _AvatarCustomizeError);
|
|
12277
12333
|
|
|
12278
|
-
|
|
12279
|
-
*
|
|
12280
|
-
*
|
|
12334
|
+
/**
|
|
12335
|
+
* Error codes returned in `errCode` by the `joinClan` method (also carried
|
|
12336
|
+
* on `TClanJoinResult`). These are terse value definitions for lookup; the
|
|
12337
|
+
* full per-code narrative and UI handling lives in the `joinClan` method
|
|
12338
|
+
* TSDoc, which owns the error table.
|
|
12281
12339
|
*/
|
|
12282
12340
|
exports.JoinClanErrorCode = void 0;
|
|
12283
12341
|
(function (JoinClanErrorCode) {
|
|
12284
|
-
/**
|
|
12342
|
+
/** Success — join completed; entry fee (if any) deducted. */
|
|
12285
12343
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_OK"] = 0] = "JOIN_CLAN_OK";
|
|
12286
|
-
/**
|
|
12344
|
+
/** Request was malformed (missing or invalid parameters). */
|
|
12287
12345
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_INVALID_PARAMETERS"] = 1000] = "JOIN_CLAN_INVALID_PARAMETERS";
|
|
12288
|
-
/**
|
|
12346
|
+
/** Clan doesn't exist for this label. Archived clans are also reported as `1001`. */
|
|
12289
12347
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_NOT_FOUND"] = 1001] = "JOIN_CLAN_NOT_FOUND";
|
|
12290
|
-
/**
|
|
12348
|
+
/** Clan is full — member capacity reached. */
|
|
12291
12349
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_FULL"] = 1002] = "JOIN_CLAN_FULL";
|
|
12292
|
-
/**
|
|
12350
|
+
/** Insufficient balance for the entry fee (points / gems / diamonds). */
|
|
12293
12351
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_INSUFFICIENT_FUNDS"] = 1003] = "JOIN_CLAN_INSUFFICIENT_FUNDS";
|
|
12294
|
-
/** User doesn't
|
|
12352
|
+
/** User doesn't meet the clan's entry segment or conditions. */
|
|
12295
12353
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_SEGMENT_MISMATCH"] = 1004] = "JOIN_CLAN_SEGMENT_MISMATCH";
|
|
12296
|
-
/**
|
|
12354
|
+
/**
|
|
12355
|
+
* User is not in a clan. Note: a `registerInTournament` response code
|
|
12356
|
+
* that shares this enum — never returned by `joinClan`.
|
|
12357
|
+
*/
|
|
12297
12358
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_USER_IS_NOT_IN_CLAN"] = 1005] = "JOIN_CLAN_USER_IS_NOT_IN_CLAN";
|
|
12298
|
-
/** User is within the
|
|
12359
|
+
/** User is within the clan-switch cooldown window (switch only). */
|
|
12299
12360
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_COOLDOWN_ACTIVE"] = 1006] = "JOIN_CLAN_COOLDOWN_ACTIVE";
|
|
12300
|
-
/**
|
|
12301
|
-
|
|
12302
|
-
|
|
12361
|
+
/**
|
|
12362
|
+
* Clan joined after tournament start. Note: a `registerInTournament`
|
|
12363
|
+
* response code that shares this enum — never returned by `joinClan`.
|
|
12364
|
+
*/
|
|
12303
12365
|
JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
|
|
12304
12366
|
})(exports.JoinClanErrorCode || (exports.JoinClanErrorCode = {}));
|
|
12305
12367
|
|