@smartico/public-api 0.0.385 → 0.0.387

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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/Avatars/AvatarCustomizeErrorCode.d.ts +7 -1
  3. package/dist/Avatars/AvatarCustomizeResponse.d.ts +16 -0
  4. package/dist/Avatars/index.d.ts +1 -0
  5. package/dist/Clans/JoinClanErrorCode.d.ts +21 -11
  6. package/dist/Missions/UserAchievementTask.d.ts +4 -0
  7. package/dist/SmarticoAPI.d.ts +11 -0
  8. package/dist/Tournaments/TournamentRegistrationError.d.ts +32 -2
  9. package/dist/WSAPI/WSAPIAvatars.d.ts +103 -0
  10. package/dist/WSAPI/WSAPIClans.d.ts +3 -5
  11. package/dist/WSAPI/WSAPILeaderBoard.d.ts +3 -11
  12. package/dist/WSAPI/WSAPIMissions.d.ts +6 -0
  13. package/dist/WSAPI/WSAPITypes.d.ts +6 -2
  14. package/dist/WSAPI/WSAPIUser.d.ts +27 -16
  15. package/dist/index.js +362 -127
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.modern.mjs +270 -55
  18. package/dist/index.modern.mjs.map +1 -1
  19. package/docs/SmarticoObject.md +15 -0
  20. package/docs/api/README.md +2 -0
  21. package/docs/api/classes/WSAPIAvatars.md +135 -0
  22. package/docs/api/classes/WSAPIClans.md +3 -5
  23. package/docs/api/classes/WSAPILeaderBoard.md +3 -11
  24. package/docs/api/classes/WSAPIMissions.md +9 -0
  25. package/docs/api/classes/WSAPIUser.md +27 -16
  26. package/docs/api/documents/SmarticoObject.md +15 -0
  27. package/docs/api/enumerations/AvatarCustomizeErrorCode.md +21 -0
  28. package/docs/api/enumerations/JoinClanErrorCode.md +16 -17
  29. package/docs/api/enumerations/TournamentRegistrationError.md +47 -2
  30. package/docs/api/interfaces/AvatarCustomizeResponse.md +31 -0
  31. package/docs/api/interfaces/TAvatarPrompt.md +2 -2
  32. package/docs/api/interfaces/TMissionOrBadgeTask.md +16 -0
  33. package/docs/api/interfaces/UserAchievementTask.md +16 -0
  34. package/docs/native/PROTOCOL.md +3 -1
  35. package/docs/ui/avatars/UIGuide_avatarsCustomize.md +69 -0
  36. package/docs/ui/clans/UIGuide_joinClan.md +1 -2
  37. package/docs/ui/leaderboard/UIGuide_getLeaderBoard.md +15 -14
  38. package/package.json +1 -1
  39. package/src/Avatars/AvatarCustomizeErrorCode.ts +7 -5
  40. package/src/Avatars/AvatarCustomizeResponse.ts +17 -0
  41. package/src/Avatars/index.ts +1 -0
  42. package/src/Clans/JoinClanErrorCode.ts +20 -14
  43. package/src/Missions/UserAchievement.ts +2 -0
  44. package/src/Missions/UserAchievementTask.ts +4 -0
  45. package/src/SmarticoAPI.ts +53 -0
  46. package/src/Tournaments/TournamentRegistrationError.ts +32 -4
  47. package/src/WSAPI/WSAPI.ts +3 -1
  48. package/src/WSAPI/WSAPIAvatars.ts +121 -0
  49. package/src/WSAPI/WSAPIClans.ts +3 -5
  50. package/src/WSAPI/WSAPILeaderBoard.ts +7 -12
  51. package/src/WSAPI/WSAPIMissions.ts +12 -0
  52. package/src/WSAPI/WSAPITypes.ts +6 -2
  53. package/src/WSAPI/WSAPIUser.ts +27 -16
  54. package/tsconfig.json +3 -1
@@ -108,6 +108,14 @@ login payload and (optionally) the language. Both are being consolidated into
108
108
  Logs the current user out, forgets the session, and reconnects as anonymous.
109
109
  Fires the `logout` callback on success.
110
110
 
111
+ ### `checkSuccessfullyIdentify()`
112
+
113
+ Returns `true` once the SDK is initialized **and** a user has been
114
+ successfully identified, `false` otherwise. Use it as a synchronous gate
115
+ before calling user-scoped `_smartico.api.*` methods (e.g. `getUserProfile()`),
116
+ as an alternative to waiting on the `identify` callback. Returns `false` in
117
+ visitor mode.
118
+
111
119
  ### `changeLanguage(language)`
112
120
 
113
121
  Switches the active language. The code is normalized to a 2-letter form
@@ -396,6 +404,13 @@ Returns `true` on mobile user agents.
396
404
  Parse the current page URL / URL hash into an object (helpers for reading
397
405
  query / hash parameters).
398
406
 
407
+ ### `sendServerError(message)` · `sendServerDebug(message)`
408
+
409
+ Forward a client-side message to Smartico's servers for support correlation —
410
+ `sendServerError` for error conditions, `sendServerDebug` for diagnostic
411
+ detail. Useful when reporting an integration issue so the message lands
412
+ alongside your session server-side. No-ops if the SDK isn't initialized.
413
+
399
414
  ---
400
415
 
401
416
  ## Setup notes
@@ -10,6 +10,7 @@
10
10
 
11
11
  - [PointChangeSourceType](enumerations/PointChangeSourceType.md)
12
12
  - [UserBalanceType](enumerations/UserBalanceType.md)
13
+ - [AvatarCustomizeErrorCode](enumerations/AvatarCustomizeErrorCode.md)
13
14
  - [BonusStatus](enumerations/BonusStatus.md)
14
15
  - [JoinClanErrorCode](enumerations/JoinClanErrorCode.md)
15
16
  - [ActivityTypeLimited](enumerations/ActivityTypeLimited.md)
@@ -78,6 +79,7 @@
78
79
 
79
80
  - [PointsLog](interfaces/PointsLog.md)
80
81
  - [GemsDiamondsLog](interfaces/GemsDiamondsLog.md)
82
+ - [AvatarCustomizeResponse](interfaces/AvatarCustomizeResponse.md)
81
83
  - [AvatarCustomized](interfaces/AvatarCustomized.md)
82
84
  - [AvatarDefinition](interfaces/AvatarDefinition.md)
83
85
  - [AvatarPrompt](interfaces/AvatarPrompt.md)
@@ -342,3 +342,138 @@ switch (r.err_code) {
342
342
  ```
343
343
 
344
344
  ***
345
+
346
+ ### avatarsCustomize()
347
+
348
+ > **avatarsCustomize**(`props`): `Promise`\<[`AvatarCustomizeResponse`](../interfaces/AvatarCustomizeResponse.md)\>
349
+
350
+ Generates an AI-customized variant of a base avatar by applying an
351
+ operator-defined style prompt, returning the CDN URL of the result.
352
+ This is a paid, generate-only step: it does NOT change the user's
353
+ active avatar — pass the returned `cdn_url` to [setAvatar](#setavatar) to
354
+ activate it.
355
+
356
+ #### Parameters
357
+
358
+ ##### props
359
+
360
+ ###### label_id
361
+
362
+ `number`
363
+
364
+ Numeric Smartico label (brand) ID the user belongs to.
365
+
366
+ ###### user_id
367
+
368
+ `number`
369
+
370
+ Numeric Smartico user ID.
371
+
372
+ ###### prompt_id
373
+
374
+ `number`
375
+
376
+ Style-prompt ID (`prompt_id`) from [getAvatarPrompts](#getavatarprompts).
377
+
378
+ ###### avatar_url
379
+
380
+ `string`
381
+
382
+ CDN URL of the base avatar to customize.
383
+
384
+ ###### avatar_real_id
385
+
386
+ `number`
387
+
388
+ `avatar_real_id` of the base avatar.
389
+
390
+ #### Returns
391
+
392
+ `Promise`\<[`AvatarCustomizeResponse`](../interfaces/AvatarCustomizeResponse.md)\>
393
+
394
+ [AvatarCustomizeResponse](../interfaces/AvatarCustomizeResponse.md) — `cdn_url` set on success;
395
+ `errCode` / `errMessage` set on failure.
396
+
397
+ #### Remarks
398
+
399
+ **Preconditions**
400
+ - Authenticated session required; not available in visitor mode (throws).
401
+ - All five fields are mandatory — the SDK throws synchronously
402
+ (`Error("<field> is required")`) if any is missing or zero.
403
+ - `prompt_id` must be one of the prompts from [getAvatarPrompts](#getavatarprompts);
404
+ `avatar_url` / `avatar_real_id` identify the base avatar to style.
405
+
406
+ **Cost**
407
+ Each generation costs the currency the operator configured on the
408
+ chosen prompt (points, gems, or diamonds — some prompts are free; read
409
+ `cost_currency_type_id` / `cost_value` from the [getAvatarPrompts](#getavatarprompts)
410
+ entry to gate the UI before calling). The cost is charged only on
411
+ success; if the user can't afford it the call fails with `errCode -1`
412
+ and nothing is generated or charged.
413
+
414
+ **Latency**
415
+ Generation runs server-side AI image synthesis and is synchronous from
416
+ the caller's side — expect several seconds (roughly 5–20 s) before the
417
+ promise resolves. There is no SDK cache and no push/subscription; show
418
+ a loading state for the full duration and disable the trigger to
419
+ prevent duplicate submissions.
420
+
421
+ **Result & error codes**
422
+ On success the result has `cdn_url` set; on failure it has `errCode` /
423
+ `errMessage` set and no `cdn_url`. Branch on `errCode` — the generic
424
+ message is fixed text, not cause-specific:
425
+ - `12001` (`AvatarCustomizeErrorCode.AVATAR_USER_LIMIT`) — the user hit
426
+ their monthly per-user generation cap. Nothing is generated or charged.
427
+ - `12002` (`AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT`) — the brand's
428
+ shared monthly pool is exhausted. Nothing is generated or charged;
429
+ surface a "try again later" message.
430
+ - `-1` — generic failure: insufficient balance, an unavailable prompt,
431
+ or a generation error. Nothing is charged. Allow the user to retry.
432
+
433
+ Both monthly caps are operator-configured and reset at the start of
434
+ each calendar month.
435
+
436
+ **Side effects (on success)**
437
+ The generated variant is persisted to the user's customization history
438
+ and counts toward the monthly caps **whether or not** it is later
439
+ activated — generation is not reversible. The SDK clears the
440
+ [getAvatarsCustomized](#getavatarscustomized) cache so the next call surfaces the new
441
+ variant. The user's active avatar is unchanged until you call
442
+ [setAvatar](#setavatar) with the returned `cdn_url`.
443
+
444
+ **Idempotency**: not idempotent — each successful call generates (and
445
+ charges for) a new variant. Guard the call site against double-clicks.
446
+
447
+ **UI guidance**: see [UI Guide — `avatarsCustomize`](../_media/UIGuide_avatarsCustomize.md).
448
+
449
+ **Visitor mode**: not supported (throws).
450
+
451
+ #### Example
452
+
453
+ ```ts
454
+ // label_id / user_id identify the Smartico user being customized.
455
+ const prompts = await window._smartico.api.getAvatarPrompts();
456
+ const prompt = prompts[0];
457
+
458
+ console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
459
+ const result = await window._smartico.api.avatarsCustomize({
460
+ label_id,
461
+ user_id,
462
+ prompt_id: prompt.prompt_id,
463
+ avatar_url: baseAvatar.avatar_url,
464
+ avatar_real_id: baseAvatar.avatar_real_id,
465
+ });
466
+
467
+ if (result.cdn_url) {
468
+ console.log('[smartico] generation succeeded — preview this URL, then call setAvatar to apply it:', result.cdn_url);
469
+ // await window._smartico.api.setAvatar({ avatar_url: result.cdn_url, avatar_real_id: baseAvatar.avatar_real_id });
470
+ } else if (result.errCode === 12001) {
471
+ console.error('[smartico] user monthly limit reached — show "you have used all your custom avatars this month"');
472
+ } else if (result.errCode === 12002) {
473
+ console.error('[smartico] brand monthly pool exhausted — show "custom avatars are unavailable right now, try later"');
474
+ } else {
475
+ console.error('[smartico] generation failed (e.g. not enough balance) — let the user retry:', result.errMessage);
476
+ }
477
+ ```
478
+
479
+ ***
@@ -334,12 +334,10 @@ below.
334
334
  tournament requires the user to be in a clan first.
335
335
  - `1006` (`JOIN_CLAN_COOLDOWN_ACTIVE`) — user is inside the
336
336
  switch-cooldown window from a previous clan join (default
337
- 7 days, configurable per label). Surface the
337
+ 7 days, configurable per label). Only reachable when the user is
338
+ already in a *different* clan (this call is then a clan switch);
339
+ a first-time join never returns `1006`. Surface the
338
340
  `TClans.cooldown_until` expiry in the disabled CTA.
339
- - `1007` (`JOIN_CLAN_ARCHIVED`) — defined on the public enum but
340
- the server does NOT emit this code in practice (archived clans
341
- are reported as `1001`). Handle it as a synonym for `1001`
342
- defensively, but do not rely on it.
343
341
  - `1011` (`JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START`) — this
344
342
  method does NOT return `1011` directly. The code fires on
345
343
  [registerInTournament](WSAPITournaments.md#registerintournament) responses when the user joined
@@ -80,15 +80,8 @@ gems, diamonds, store items, or bonuses. The first element of
80
80
  the array is the prize for place 1, the second for place 2, and
81
81
  so on. The array length is the number of paid places.
82
82
 
83
- **Cache TTL — single shared key (known limitation)**
84
- The SDK caches the response for 30 seconds under a SINGLE shared
85
- key — calling `getLeaderBoard(DAILY)` followed by
86
- `getLeaderBoard(WEEKLY)` within the same 30 s window returns the
87
- cached DAILY result for the WEEKLY call. Same applies to
88
- switching `getPreviousPeriod`. To force a fresh fetch when
89
- switching periods or current/previous, call
90
- `_smartico.api.clearCaches()` before the second call, or simply
91
- wait out the TTL.
83
+ **Cache TTL**
84
+ The SDK caches each response for 30 seconds.
92
85
 
93
86
  **Period boundaries**
94
87
  The server finalizes each period on a server-configurable
@@ -145,8 +138,7 @@ if (board.me) {
145
138
  }
146
139
  }
147
140
 
148
- // Switch to previous period view — but bust the cache first to avoid the shared-key collision.
149
- await window._smartico.api.clearCaches();
141
+ // Switch to previous period view — cached separately from the current period.
150
142
  const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
151
143
  console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
152
144
 
@@ -205,8 +205,17 @@ metadata and group badges by category.
205
205
  **Idempotency / Side effects**: fetch-only; safe to call repeatedly.
206
206
  The cache layer deduplicates concurrent calls within the TTL window.
207
207
 
208
+ **Visitor mode**: not supported. Badges are an authenticated-only
209
+ feature; calling this on the visitor-mode handle (`_smartico.vapi`)
210
+ throws synchronously rather than silently returning an empty list.
211
+
208
212
  **UI guidance**: see [UI Guide — `getBadges`](../../ui/missions/UIGuide_getBadges.md).
209
213
 
214
+ #### Throws
215
+
216
+ `Error("getBadges is not available in visitor mode")` when
217
+ called from a visitor-mode session.
218
+
210
219
  #### Example
211
220
 
212
221
  ```ts
@@ -401,12 +401,25 @@ source values directly from [getUserProfile](#getuserprofile)'s
401
401
  `ach_points_ever` and [getLevels](#getlevels) would also work, but
402
402
  `progress` saves the math.
403
403
 
404
- **Cache TTL**: the SDK caches the response for 30 seconds. There is
405
- no push event that refreshes this cache; a server-side level change
406
- (visible immediately on [getUserProfile](#getuserprofile)'s `ach_level_current_id`
407
- via the user-properties update channel) becomes visible on this
408
- method only after the cache TTL expires, or after
409
- `_smartico.api.clearCaches()` is called.
404
+ **Cache TTL & freshness**
405
+ The response is cached for 30 seconds, but the SDK automatically
406
+ drops that cache whenever a user-properties update arrives — the
407
+ same live channel that backs [getUserProfile](#getuserprofile). The practical
408
+ effect depends on the label's leveling logic:
409
+ - **Points-based or operator-manual leveling**: a points or level
410
+ change flows through the user-properties channel, so the cache is
411
+ busted at that moment and the next `getCurrentLevel()` call
412
+ returns up-to-date data without waiting out the TTL.
413
+ - **Counter-based leveling** (level driven by sliding-window
414
+ counters such as deposit or wagering totals over a recent window —
415
+ see [getUserLevelExtraCounters](#getuserlevelextracounters)): ordinary progress changes
416
+ are recomputed by a periodic server job and do NOT emit a
417
+ user-properties update, so they become visible on this method only
418
+ after the 30 s TTL expires (or after `_smartico.api.clearCaches()`).
419
+
420
+ Avoid calling `clearCaches()` on the points/manual path — it's
421
+ unnecessary there (the cache is already refreshed on the property
422
+ update) and forces a slower extra round-trip.
410
423
 
411
424
  **Leveling logic**
412
425
  The semantics of how a user advances depends on the label's
@@ -432,10 +445,10 @@ const level = await window._smartico.api.getCurrentLevel();
432
445
  console.log('[smartico] render level badge — name:', level.name,
433
446
  'progress:', Math.round(level.progress), '%');
434
447
 
435
- // Detect level-up via getUserProfile's push channel.
448
+ // Detect level-up via getUserProfile's push channel. No clearCaches()
449
+ // needed — the SDK already drops the level cache on this update.
436
450
  window._smartico.on('props_change', async (changed) => {
437
451
  if ('ach_level_current_id' in changed) {
438
- await window._smartico.api.clearCaches(); // bust the 30 s cache
439
452
  const fresh = await window._smartico.api.getCurrentLevel();
440
453
  console.log('[smartico] user levelled up — animate badge to new level:', fresh.name);
441
454
  }
@@ -481,14 +494,12 @@ stored under the translation keys `levelsCounter1Name` and
481
494
  `levelsCounter2Name`.
482
495
 
483
496
  **Refresh cadence**
484
- Sliding-window counters are recomputed by a server-side job that
485
- runs roughly every 60 seconds against the operator's BigQuery
486
- dataset; level transitions driven by counter changes have a
487
- latency of up to several minutes after the underlying activity
488
- (e.g. a deposit). The SDK caches the response for 30 seconds; no
489
- push event refreshes this cache. After a level change visible on
490
- [getUserProfile](#getuserprofile)'s `ach_level_current_id`, call
491
- `_smartico.api.clearCaches()` to force a fresh fetch.
497
+ Sliding-window counters are recomputed by a periodic server-side
498
+ job. Its rebuild cadence is operator-configured per brand —
499
+ commonly daily, though it can be set more frequent — so level
500
+ transitions driven by counter changes surface with a latency tied
501
+ to that rebuild schedule after the underlying activity (e.g. a
502
+ deposit), not in real time.
492
503
 
493
504
  **Idempotency**: safe. Read-only. Repeated calls within the cache
494
505
  window return a deep-cloned cached value without a network
@@ -108,6 +108,14 @@ login payload and (optionally) the language. Both are being consolidated into
108
108
  Logs the current user out, forgets the session, and reconnects as anonymous.
109
109
  Fires the `logout` callback on success.
110
110
 
111
+ ### `checkSuccessfullyIdentify()`
112
+
113
+ Returns `true` once the SDK is initialized **and** a user has been
114
+ successfully identified, `false` otherwise. Use it as a synchronous gate
115
+ before calling user-scoped `_smartico.api.*` methods (e.g. `getUserProfile()`),
116
+ as an alternative to waiting on the `identify` callback. Returns `false` in
117
+ visitor mode.
118
+
111
119
  ### `changeLanguage(language)`
112
120
 
113
121
  Switches the active language. The code is normalized to a 2-letter form
@@ -396,6 +404,13 @@ Returns `true` on mobile user agents.
396
404
  Parse the current page URL / URL hash into an object (helpers for reading
397
405
  query / hash parameters).
398
406
 
407
+ ### `sendServerError(message)` · `sendServerDebug(message)`
408
+
409
+ Forward a client-side message to Smartico's servers for support correlation —
410
+ `sendServerError` for error conditions, `sendServerDebug` for diagnostic
411
+ detail. Useful when reporting an integration issue so the message lands
412
+ alongside your session server-side. No-ops if the SDK isn't initialized.
413
+
399
414
  ---
400
415
 
401
416
  ## Setup notes
@@ -0,0 +1,21 @@
1
+ # Enumeration: AvatarCustomizeErrorCode
2
+
3
+ Limit error codes returned in `errCode` by the `avatarsCustomize` method.
4
+ See the `avatarsCustomize` TSDoc for the full table (including the generic
5
+ `-1` failure, which has no named member here).
6
+
7
+ ## Enumeration Members
8
+
9
+ ### AVATAR\_USER\_LIMIT
10
+
11
+ > **AVATAR\_USER\_LIMIT**: `12001`
12
+
13
+ The user has reached the operator-configured per-user monthly cap on custom-avatar generations.
14
+
15
+ ***
16
+
17
+ ### AVATAR\_LABEL\_LIMIT
18
+
19
+ > **AVATAR\_LABEL\_LIMIT**: `12002`
20
+
21
+ The brand's operator-configured shared monthly pool of custom-avatar generations is exhausted.
@@ -1,12 +1,17 @@
1
1
  # Enumeration: JoinClanErrorCode
2
2
 
3
+ Error codes returned in `errCode` by the `joinClan` method (also carried
4
+ on `TClanJoinResult`). These are terse value definitions for lookup; the
5
+ full per-code narrative and UI handling lives in the `joinClan` method
6
+ TSDoc, which owns the error table.
7
+
3
8
  ## Enumeration Members
4
9
 
5
10
  ### JOIN\_CLAN\_OK
6
11
 
7
12
  > **JOIN\_CLAN\_OK**: `0`
8
13
 
9
- No error, join completed
14
+ Success — join completed; entry fee (if any) deducted.
10
15
 
11
16
  ***
12
17
 
@@ -14,7 +19,7 @@ No error, join completed
14
19
 
15
20
  > **JOIN\_CLAN\_INVALID\_PARAMETERS**: `1000`
16
21
 
17
- Invalid parameters
22
+ Request was malformed (missing or invalid parameters).
18
23
 
19
24
  ***
20
25
 
@@ -22,7 +27,7 @@ Invalid parameters
22
27
 
23
28
  > **JOIN\_CLAN\_NOT\_FOUND**: `1001`
24
29
 
25
- clan_id doesn't exist for this label
30
+ Clan doesn't exist for this label. Archived clans are also reported as `1001`.
26
31
 
27
32
  ***
28
33
 
@@ -30,7 +35,7 @@ clan_id doesn't exist for this label
30
35
 
31
36
  > **JOIN\_CLAN\_FULL**: `1002`
32
37
 
33
- members_count >= capacity_limit
38
+ Clan is full — member capacity reached.
34
39
 
35
40
  ***
36
41
 
@@ -38,7 +43,7 @@ members_count >= capacity_limit
38
43
 
39
44
  > **JOIN\_CLAN\_INSUFFICIENT\_FUNDS**: `1003`
40
45
 
41
- Not enough Points / Gems / Diamonds for entry fee
46
+ Insufficient balance for the entry fee (points / gems / diamonds).
42
47
 
43
48
  ***
44
49
 
@@ -46,7 +51,7 @@ Not enough Points / Gems / Diamonds for entry fee
46
51
 
47
52
  > **JOIN\_CLAN\_SEGMENT\_MISMATCH**: `1004`
48
53
 
49
- User doesn't satisfy entry_conditions / entry_segment_id
54
+ User doesn't meet the clan's entry segment or conditions.
50
55
 
51
56
  ***
52
57
 
@@ -54,7 +59,8 @@ User doesn't satisfy entry_conditions / entry_segment_id
54
59
 
55
60
  > **JOIN\_CLAN\_USER\_IS\_NOT\_IN\_CLAN**: `1005`
56
61
 
57
- User is not in a clan
62
+ User is not in a clan. Note: a `registerInTournament` response code
63
+ that shares this enum — never returned by `joinClan`.
58
64
 
59
65
  ***
60
66
 
@@ -62,15 +68,7 @@ User is not in a clan
62
68
 
63
69
  > **JOIN\_CLAN\_COOLDOWN\_ACTIVE**: `1006`
64
70
 
65
- User is within the CLAN_COOLDOWN_DAYS window
66
-
67
- ***
68
-
69
- ### JOIN\_CLAN\_ARCHIVED
70
-
71
- > **JOIN\_CLAN\_ARCHIVED**: `1007`
72
-
73
- clan_status_id != 1 (clan is archived)
71
+ User is within the clan-switch cooldown window (switch only).
74
72
 
75
73
  ***
76
74
 
@@ -78,4 +76,5 @@ clan_status_id != 1 (clan is archived)
78
76
 
79
77
  > **JOIN\_CLAN\_JOINED\_AFTER\_TOURNAMENT\_START**: `1011`
80
78
 
81
- Clan joined after tournament start
79
+ Clan joined after tournament start. Note: a `registerInTournament`
80
+ response code that shares this enum — never returned by `joinClan`.
@@ -1,73 +1,118 @@
1
1
  # Enumeration: TournamentRegistrationError
2
2
 
3
+ Error codes returned in `err_code` by the `registerInTournament` method.
4
+
5
+ These are terse value definitions for lookup. The full per-code narrative —
6
+ when each fires and how the consumer's UI should react — lives in the
7
+ `registerInTournament` method TSDoc, which owns the error table.
8
+
9
+ Note the numbering break: the gems / diamonds codes are 6-digit
10
+ (`300010` / `300011`) while the rest of the tournament block is 5-digit;
11
+ they were appended after the original `30001`–`30009` range was occupied.
12
+ Branch on the exact numeric value, not on digit count.
13
+
3
14
  ## Enumeration Members
4
15
 
5
16
  ### NO\_ERROR
6
17
 
7
18
  > **NO\_ERROR**: `0`
8
19
 
20
+ Success — registration persisted; buy-in (if any) deducted.
21
+
9
22
  ***
10
23
 
11
24
  ### TOURNAMENT\_USER\_CANNOT\_JOIN\_WITHOUT\_CLAN
12
25
 
13
26
  > **TOURNAMENT\_USER\_CANNOT\_JOIN\_WITHOUT\_CLAN**: `1010`
14
27
 
28
+ Clan-based tournament and the user does not belong to a clan yet.
29
+
15
30
  ***
16
31
 
17
32
  ### TOURNAMENT\_INSTANCE\_NOT\_FOUND
18
33
 
19
34
  > **TOURNAMENT\_INSTANCE\_NOT\_FOUND**: `30001`
20
35
 
36
+ Instance id is invalid or the tournament was deleted.
37
+
21
38
  ***
22
39
 
23
40
  ### TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_POINTS
24
41
 
25
42
  > **TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_POINTS**: `30002`
26
43
 
44
+ Insufficient points balance for a points-priced buy-in.
45
+
27
46
  ***
28
47
 
29
48
  ### TOURNAMENT\_INSTANCE\_NOT\_IN\_STATE
30
49
 
31
50
  > **TOURNAMENT\_INSTANCE\_NOT\_IN\_STATE**: `30003`
32
51
 
52
+ Tournament is no longer in a registerable state (finished, cancelled, finalizing, or not yet open).
53
+
33
54
  ***
34
55
 
35
56
  ### TOURNAMENT\_ALREADY\_REGISTERED
36
57
 
37
58
  > **TOURNAMENT\_ALREADY\_REGISTERED**: `30004`
38
59
 
60
+ User is already registered; treat as an idempotent success.
61
+
39
62
  ***
40
63
 
41
64
  ### TOURNAMENT\_USER\_DONT\_MATCH\_CONDITIONS
42
65
 
43
66
  > **TOURNAMENT\_USER\_DONT\_MATCH\_CONDITIONS**: `30005`
44
67
 
68
+ User does not satisfy the tournament's segment / entry conditions.
69
+
45
70
  ***
46
71
 
47
72
  ### TOURNAMENT\_USER\_NOT\_REGISTERED
48
73
 
49
74
  > **TOURNAMENT\_USER\_NOT\_REGISTERED**: `30006`
50
75
 
76
+ User is not registered; anomalous on a register call (usually a server-side race).
77
+
51
78
  ***
52
79
 
53
80
  ### TOURNAMENT\_CANT\_CHANGE\_REGISTRATION\_STATUS
54
81
 
55
82
  > **TOURNAMENT\_CANT\_CHANGE\_REGISTRATION\_STATUS**: `30007`
56
83
 
84
+ Registration status transition is not allowed (e.g. re-registering a finished tournament).
85
+
57
86
  ***
58
87
 
59
88
  ### TOURNAMENT\_MAX\_REGISTRATIONS\_REACHED
60
89
 
61
90
  > **TOURNAMENT\_MAX\_REGISTRATIONS\_REACHED**: `30008`
62
91
 
92
+ Tournament filled up — maximum registrations reached.
93
+
94
+ ***
95
+
96
+ ### TOURNAMENT\_INVALID\_USER\_CURRENCY
97
+
98
+ > **TOURNAMENT\_INVALID\_USER\_CURRENCY**: `30009`
99
+
100
+ The user's wallet currency could not be resolved. Emitted server-side
101
+ during tournament score processing, NOT during registration — it is
102
+ never returned by `registerInTournament`. Included for completeness.
103
+
63
104
  ***
64
105
 
65
106
  ### TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_GEMS
66
107
 
67
- > **TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_GEMS**: `30010`
108
+ > **TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_GEMS**: `300010`
109
+
110
+ Insufficient gems balance for a gems-priced buy-in.
68
111
 
69
112
  ***
70
113
 
71
114
  ### TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_DIAMONDS
72
115
 
73
- > **TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_DIAMONDS**: `30011`
116
+ > **TOURNAMENT\_REGISTRATION\_NOT\_ENOUGH\_DIAMONDS**: `300011`
117
+
118
+ Insufficient diamonds balance for a diamonds-priced buy-in.
@@ -0,0 +1,31 @@
1
+ # Interface: AvatarCustomizeResponse
2
+
3
+ Result of `_smartico.api.avatarsCustomize()`. On success only `cdn_url` is
4
+ set; on failure only `errCode` / `errMessage`.
5
+
6
+ ## Properties
7
+
8
+ ### cdn\_url?
9
+
10
+ > `optional` **cdn\_url?**: `string`
11
+
12
+ CDN URL of the generated avatar variant. Present on success.
13
+
14
+ ***
15
+
16
+ ### errCode?
17
+
18
+ > `optional` **errCode?**: `number`
19
+
20
+ Error code. Present on failure. Typed values are members of
21
+ [AvatarCustomizeErrorCode](../enumerations/AvatarCustomizeErrorCode.md); `-1` is a generic failure. See the
22
+ `avatarsCustomize` TSDoc for the full table.
23
+
24
+ ***
25
+
26
+ ### errMessage?
27
+
28
+ > `optional` **errMessage?**: `string`
29
+
30
+ Optional error message. Present on failure; the generic (`-1`) message
31
+ is fixed text, so branch on `errCode`, not this string.
@@ -33,7 +33,7 @@ Absolute CDN URL of the prompt's preview icon.
33
33
 
34
34
  > **cost\_currency\_type\_id**: `number`
35
35
 
36
- Currency used to pay for the customization. `0` = points, `1` = gems, `2` = diamonds.
36
+ Currency used to pay for the customization. `0` = points, `1` = gems, `2` = diamonds, `3` = free. A `cost_value` of `0` is also free.
37
37
 
38
38
  ***
39
39
 
@@ -41,4 +41,4 @@ Currency used to pay for the customization. `0` = points, `1` = gems, `2` = diam
41
41
 
42
42
  > **cost\_value**: `number`
43
43
 
44
- Cost amount in the currency named by `cost_currency_type_id`.
44
+ Cost amount in the currency named by `cost_currency_type_id`. `0` = free.
@@ -44,6 +44,22 @@ Reward for completing the task in points
44
44
 
45
45
  ***
46
46
 
47
+ ### gems\_reward?
48
+
49
+ > `optional` **gems\_reward?**: `number`
50
+
51
+ Reward for completing the task in gems
52
+
53
+ ***
54
+
55
+ ### diamonds\_reward?
56
+
57
+ > `optional` **diamonds\_reward?**: `number`
58
+
59
+ Reward for completing the task in diamonds
60
+
61
+ ***
62
+
47
63
  ### execution\_count\_expected?
48
64
 
49
65
  > `optional` **execution\_count\_expected?**: `number`
@@ -20,6 +20,22 @@
20
20
 
21
21
  ***
22
22
 
23
+ ### gems\_reward?
24
+
25
+ > `optional` **gems\_reward?**: `number`
26
+
27
+ Gems awarded when this task is completed.
28
+
29
+ ***
30
+
31
+ ### diamonds\_reward?
32
+
33
+ > `optional` **diamonds\_reward?**: `number`
34
+
35
+ Diamonds awarded when this task is completed.
36
+
37
+ ***
38
+
23
39
  ### task\_type\_id
24
40
 
25
41
  > **task\_type\_id**: [`AchievementTaskType`](../enumerations/AchievementTaskType.md)