@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
package/dist/index.js CHANGED
@@ -1639,6 +1639,8 @@ var UserAchievementTransform = function UserAchievementTransform(items) {
1639
1639
  id: t.task_id,
1640
1640
  name: (_t$task_public_meta = t.task_public_meta) == null ? void 0 : _t$task_public_meta.name,
1641
1641
  points_reward: t.points_reward,
1642
+ gems_reward: t.gems_reward,
1643
+ diamonds_reward: t.diamonds_reward,
1642
1644
  is_completed: t.isCompleted,
1643
1645
  progress: t.userProgress,
1644
1646
  execution_count_expected: t.executionCount,
@@ -2022,20 +2024,50 @@ var tournamentInfoItemTransform = function tournamentInfoItemTransform(t) {
2022
2024
  return response;
2023
2025
  };
2024
2026
 
2027
+ /**
2028
+ * Error codes returned in `err_code` by the `registerInTournament` method.
2029
+ *
2030
+ * These are terse value definitions for lookup. The full per-code narrative —
2031
+ * when each fires and how the consumer's UI should react — lives in the
2032
+ * `registerInTournament` method TSDoc, which owns the error table.
2033
+ *
2034
+ * Note the numbering break: the gems / diamonds codes are 6-digit
2035
+ * (`300010` / `300011`) while the rest of the tournament block is 5-digit;
2036
+ * they were appended after the original `30001`–`30009` range was occupied.
2037
+ * Branch on the exact numeric value, not on digit count.
2038
+ */
2025
2039
  exports.TournamentRegistrationError = void 0;
2026
2040
  (function (TournamentRegistrationError) {
2041
+ /** Success — registration persisted; buy-in (if any) deducted. */
2027
2042
  TournamentRegistrationError[TournamentRegistrationError["NO_ERROR"] = 0] = "NO_ERROR";
2043
+ /** Clan-based tournament and the user does not belong to a clan yet. */
2028
2044
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN"] = 1010] = "TOURNAMENT_USER_CANNOT_JOIN_WITHOUT_CLAN";
2045
+ /** Instance id is invalid or the tournament was deleted. */
2029
2046
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_FOUND"] = 30001] = "TOURNAMENT_INSTANCE_NOT_FOUND";
2047
+ /** Insufficient points balance for a points-priced buy-in. */
2030
2048
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS"] = 30002] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_POINTS";
2049
+ /** Tournament is no longer in a registerable state (finished, cancelled, finalizing, or not yet open). */
2031
2050
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INSTANCE_NOT_IN_STATE"] = 30003] = "TOURNAMENT_INSTANCE_NOT_IN_STATE";
2051
+ /** User is already registered; treat as an idempotent success. */
2032
2052
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_ALREADY_REGISTERED"] = 30004] = "TOURNAMENT_ALREADY_REGISTERED";
2053
+ /** User does not satisfy the tournament's segment / entry conditions. */
2033
2054
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_DONT_MATCH_CONDITIONS"] = 30005] = "TOURNAMENT_USER_DONT_MATCH_CONDITIONS";
2055
+ /** User is not registered; anomalous on a register call (usually a server-side race). */
2034
2056
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_USER_NOT_REGISTERED"] = 30006] = "TOURNAMENT_USER_NOT_REGISTERED";
2057
+ /** Registration status transition is not allowed (e.g. re-registering a finished tournament). */
2035
2058
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS"] = 30007] = "TOURNAMENT_CANT_CHANGE_REGISTRATION_STATUS";
2059
+ /** Tournament filled up — maximum registrations reached. */
2036
2060
  TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_MAX_REGISTRATIONS_REACHED"] = 30008] = "TOURNAMENT_MAX_REGISTRATIONS_REACHED";
2037
- TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS"] = 30010] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS";
2038
- TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS"] = 30011] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS";
2061
+ /**
2062
+ * The user's wallet currency could not be resolved. Emitted server-side
2063
+ * during tournament score processing, NOT during registration — it is
2064
+ * never returned by `registerInTournament`. Included for completeness.
2065
+ */
2066
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_INVALID_USER_CURRENCY"] = 30009] = "TOURNAMENT_INVALID_USER_CURRENCY";
2067
+ /** Insufficient gems balance for a gems-priced buy-in. */
2068
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS"] = 300010] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_GEMS";
2069
+ /** Insufficient diamonds balance for a diamonds-priced buy-in. */
2070
+ TournamentRegistrationError[TournamentRegistrationError["TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS"] = 300011] = "TOURNAMENT_REGISTRATION_NOT_ENOUGH_DIAMONDS";
2039
2071
  })(exports.TournamentRegistrationError || (exports.TournamentRegistrationError = {}));
2040
2072
 
2041
2073
  exports.TournamentType = void 0;
@@ -2805,12 +2837,25 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2805
2837
  * `ach_points_ever` and {@link getLevels} would also work, but
2806
2838
  * `progress` saves the math.
2807
2839
  *
2808
- * **Cache TTL**: the SDK caches the response for 30 seconds. There is
2809
- * no push event that refreshes this cache; a server-side level change
2810
- * (visible immediately on {@link getUserProfile}'s `ach_level_current_id`
2811
- * via the user-properties update channel) becomes visible on this
2812
- * method only after the cache TTL expires, or after
2813
- * `_smartico.api.clearCaches()` is called.
2840
+ * **Cache TTL & freshness**
2841
+ * The response is cached for 30 seconds, but the SDK automatically
2842
+ * drops that cache whenever a user-properties update arrives — the
2843
+ * same live channel that backs {@link getUserProfile}. The practical
2844
+ * effect depends on the label's leveling logic:
2845
+ * - **Points-based or operator-manual leveling**: a points or level
2846
+ * change flows through the user-properties channel, so the cache is
2847
+ * busted at that moment and the next `getCurrentLevel()` call
2848
+ * returns up-to-date data without waiting out the TTL.
2849
+ * - **Counter-based leveling** (level driven by sliding-window
2850
+ * counters such as deposit or wagering totals over a recent window —
2851
+ * see {@link getUserLevelExtraCounters}): ordinary progress changes
2852
+ * are recomputed by a periodic server job and do NOT emit a
2853
+ * user-properties update, so they become visible on this method only
2854
+ * after the 30 s TTL expires (or after `_smartico.api.clearCaches()`).
2855
+ *
2856
+ * Avoid calling `clearCaches()` on the points/manual path — it's
2857
+ * unnecessary there (the cache is already refreshed on the property
2858
+ * update) and forces a slower extra round-trip.
2814
2859
  *
2815
2860
  * **Leveling logic**
2816
2861
  * The semantics of how a user advances depends on the label's
@@ -2838,10 +2883,10 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2838
2883
  * console.log('[smartico] render level badge — name:', level.name,
2839
2884
  * 'progress:', Math.round(level.progress), '%');
2840
2885
  *
2841
- * // Detect level-up via getUserProfile's push channel.
2886
+ * // Detect level-up via getUserProfile's push channel. No clearCaches()
2887
+ * // needed — the SDK already drops the level cache on this update.
2842
2888
  * window._smartico.on('props_change', async (changed) => {
2843
2889
  * if ('ach_level_current_id' in changed) {
2844
- * await window._smartico.api.clearCaches(); // bust the 30 s cache
2845
2890
  * const fresh = await window._smartico.api.getCurrentLevel();
2846
2891
  * console.log('[smartico] user levelled up — animate badge to new level:', fresh.name);
2847
2892
  * }
@@ -2884,14 +2929,12 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2884
2929
  * `levelsCounter2Name`.
2885
2930
  *
2886
2931
  * **Refresh cadence**
2887
- * Sliding-window counters are recomputed by a server-side job that
2888
- * runs roughly every 60 seconds against the operator's BigQuery
2889
- * dataset; level transitions driven by counter changes have a
2890
- * latency of up to several minutes after the underlying activity
2891
- * (e.g. a deposit). The SDK caches the response for 30 seconds; no
2892
- * push event refreshes this cache. After a level change visible on
2893
- * {@link getUserProfile}'s `ach_level_current_id`, call
2894
- * `_smartico.api.clearCaches()` to force a fresh fetch.
2932
+ * Sliding-window counters are recomputed by a periodic server-side
2933
+ * job. Its rebuild cadence is operator-configured per brand —
2934
+ * commonly daily, though it can be set more frequent — so level
2935
+ * transitions driven by counter changes surface with a latency tied
2936
+ * to that rebuild schedule after the underlying activity (e.g. a
2937
+ * deposit), not in real time.
2895
2938
  *
2896
2939
  * **Idempotency**: safe. Read-only. Repeated calls within the cache
2897
2940
  * window return a deep-cloned cached value without a network
@@ -3441,8 +3484,14 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3441
3484
  * **Idempotency / Side effects**: fetch-only; safe to call repeatedly.
3442
3485
  * The cache layer deduplicates concurrent calls within the TTL window.
3443
3486
  *
3487
+ * **Visitor mode**: not supported. Badges are an authenticated-only
3488
+ * feature; calling this on the visitor-mode handle (`_smartico.vapi`)
3489
+ * throws synchronously rather than silently returning an empty list.
3490
+ *
3444
3491
  * **UI guidance**: see [UI Guide — `getBadges`](../../docs/ui/missions/UIGuide_getBadges.md).
3445
3492
  *
3493
+ * @throws `Error("getBadges is not available in visitor mode")` when
3494
+ * called from a visitor-mode session.
3446
3495
  * @returns Promise resolving to `TMissionOrBadge[]`. Every item has
3447
3496
  * `type === 'badge'`. Cached for 30 s under the `Badges` key.
3448
3497
  *
@@ -3487,6 +3536,12 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3487
3536
  _proto.getBadges = function getBadges() {
3488
3537
  try {
3489
3538
  var _this2 = this;
3539
+ // Badges are an authenticated-only feature. The visitor-mode WSAPI
3540
+ // instance (`_smartico.vapi`) is constructed without a tracker, so the
3541
+ // server would silently return nothing; throw a clear error instead.
3542
+ if (!_this2.api.tracker) {
3543
+ throw new Error('getBadges is not available in visitor mode');
3544
+ }
3490
3545
  return Promise.resolve(OCache.use(onUpdateContextKey.Badges, exports.ECacheContext.WSAPI, function () {
3491
3546
  return _this2.api.badgetsGetItemsT(_this2.userExtId);
3492
3547
  }, CACHE_DATA_SEC));
@@ -5731,12 +5786,10 @@ var WSAPIClans = /*#__PURE__*/function (_WSAPITournaments) {
5731
5786
  * tournament requires the user to be in a clan first.
5732
5787
  * - `1006` (`JOIN_CLAN_COOLDOWN_ACTIVE`) — user is inside the
5733
5788
  * switch-cooldown window from a previous clan join (default
5734
- * 7 days, configurable per label). Surface the
5789
+ * 7 days, configurable per label). Only reachable when the user is
5790
+ * already in a *different* clan (this call is then a clan switch);
5791
+ * a first-time join never returns `1006`. Surface the
5735
5792
  * `TClans.cooldown_until` expiry in the disabled CTA.
5736
- * - `1007` (`JOIN_CLAN_ARCHIVED`) — defined on the public enum but
5737
- * the server does NOT emit this code in practice (archived clans
5738
- * are reported as `1001`). Handle it as a synonym for `1001`
5739
- * defensively, but do not rely on it.
5740
5793
  * - `1011` (`JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START`) — this
5741
5794
  * method does NOT return `1011` directly. The code fires on
5742
5795
  * {@link registerInTournament} responses when the user joined
@@ -8003,6 +8056,124 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
8003
8056
  } catch (e) {
8004
8057
  return Promise.reject(e);
8005
8058
  }
8059
+ }
8060
+ /**
8061
+ * Generates an AI-customized variant of a base avatar by applying an
8062
+ * operator-defined style prompt, returning the CDN URL of the result.
8063
+ * This is a paid, generate-only step: it does NOT change the user's
8064
+ * active avatar — pass the returned `cdn_url` to {@link setAvatar} to
8065
+ * activate it.
8066
+ *
8067
+ * @remarks
8068
+ * **Preconditions**
8069
+ * - Authenticated session required; not available in visitor mode (throws).
8070
+ * - All five fields are mandatory — the SDK throws synchronously
8071
+ * (`Error("<field> is required")`) if any is missing or zero.
8072
+ * - `prompt_id` must be one of the prompts from {@link getAvatarPrompts};
8073
+ * `avatar_url` / `avatar_real_id` identify the base avatar to style.
8074
+ *
8075
+ * **Cost**
8076
+ * Each generation costs the currency the operator configured on the
8077
+ * chosen prompt (points, gems, or diamonds — some prompts are free; read
8078
+ * `cost_currency_type_id` / `cost_value` from the {@link getAvatarPrompts}
8079
+ * entry to gate the UI before calling). The cost is charged only on
8080
+ * success; if the user can't afford it the call fails with `errCode -1`
8081
+ * and nothing is generated or charged.
8082
+ *
8083
+ * **Latency**
8084
+ * Generation runs server-side AI image synthesis and is synchronous from
8085
+ * the caller's side — expect several seconds (roughly 5–20 s) before the
8086
+ * promise resolves. There is no SDK cache and no push/subscription; show
8087
+ * a loading state for the full duration and disable the trigger to
8088
+ * prevent duplicate submissions.
8089
+ *
8090
+ * **Result & error codes**
8091
+ * On success the result has `cdn_url` set; on failure it has `errCode` /
8092
+ * `errMessage` set and no `cdn_url`. Branch on `errCode` — the generic
8093
+ * message is fixed text, not cause-specific:
8094
+ * - `12001` (`AvatarCustomizeErrorCode.AVATAR_USER_LIMIT`) — the user hit
8095
+ * their monthly per-user generation cap. Nothing is generated or charged.
8096
+ * - `12002` (`AvatarCustomizeErrorCode.AVATAR_LABEL_LIMIT`) — the brand's
8097
+ * shared monthly pool is exhausted. Nothing is generated or charged;
8098
+ * surface a "try again later" message.
8099
+ * - `-1` — generic failure: insufficient balance, an unavailable prompt,
8100
+ * or a generation error. Nothing is charged. Allow the user to retry.
8101
+ *
8102
+ * Both monthly caps are operator-configured and reset at the start of
8103
+ * each calendar month.
8104
+ *
8105
+ * **Side effects (on success)**
8106
+ * The generated variant is persisted to the user's customization history
8107
+ * and counts toward the monthly caps **whether or not** it is later
8108
+ * activated — generation is not reversible. The SDK clears the
8109
+ * {@link getAvatarsCustomized} cache so the next call surfaces the new
8110
+ * variant. The user's active avatar is unchanged until you call
8111
+ * {@link setAvatar} with the returned `cdn_url`.
8112
+ *
8113
+ * **Idempotency**: not idempotent — each successful call generates (and
8114
+ * charges for) a new variant. Guard the call site against double-clicks.
8115
+ *
8116
+ * **UI guidance**: see [UI Guide — `avatarsCustomize`](../../docs/ui/avatars/UIGuide_avatarsCustomize.md).
8117
+ *
8118
+ * **Visitor mode**: not supported (throws).
8119
+ *
8120
+ * @param props.label_id Numeric Smartico label (brand) ID the user belongs to.
8121
+ * @param props.user_id Numeric Smartico user ID.
8122
+ * @param props.prompt_id Style-prompt ID (`prompt_id`) from {@link getAvatarPrompts}.
8123
+ * @param props.avatar_url CDN URL of the base avatar to customize.
8124
+ * @param props.avatar_real_id `avatar_real_id` of the base avatar.
8125
+ * @returns {@link AvatarCustomizeResponse} — `cdn_url` set on success;
8126
+ * `errCode` / `errMessage` set on failure.
8127
+ *
8128
+ * @example
8129
+ * ```ts
8130
+ * // label_id / user_id identify the Smartico user being customized.
8131
+ * const prompts = await window._smartico.api.getAvatarPrompts();
8132
+ * const prompt = prompts[0];
8133
+ *
8134
+ * console.log('[smartico] generating avatar — show a spinner for ~5-20s and disable the Generate button');
8135
+ * const result = await window._smartico.api.avatarsCustomize({
8136
+ * label_id,
8137
+ * user_id,
8138
+ * prompt_id: prompt.prompt_id,
8139
+ * avatar_url: baseAvatar.avatar_url,
8140
+ * avatar_real_id: baseAvatar.avatar_real_id,
8141
+ * });
8142
+ *
8143
+ * if (result.cdn_url) {
8144
+ * console.log('[smartico] generation succeeded — preview this URL, then call setAvatar to apply it:', result.cdn_url);
8145
+ * // await window._smartico.api.setAvatar({ avatar_url: result.cdn_url, avatar_real_id: baseAvatar.avatar_real_id });
8146
+ * } else if (result.errCode === 12001) {
8147
+ * console.error('[smartico] user monthly limit reached — show "you have used all your custom avatars this month"');
8148
+ * } else if (result.errCode === 12002) {
8149
+ * console.error('[smartico] brand monthly pool exhausted — show "custom avatars are unavailable right now, try later"');
8150
+ * } else {
8151
+ * console.error('[smartico] generation failed (e.g. not enough balance) — let the user retry:', result.errMessage);
8152
+ * }
8153
+ * ```
8154
+ */
8155
+ ;
8156
+ _proto.avatarsCustomize = function avatarsCustomize(props) {
8157
+ try {
8158
+ var _this5 = this;
8159
+ var required = ['label_id', 'user_id', 'prompt_id', 'avatar_url', 'avatar_real_id'];
8160
+ for (var _i = 0, _required = required; _i < _required.length; _i++) {
8161
+ var field = _required[_i];
8162
+ if (!props[field]) {
8163
+ throw new Error(field + " is required");
8164
+ }
8165
+ }
8166
+ return Promise.resolve(_this5.api.avatarsCustomize(props)).then(function (r) {
8167
+ // On success a new variant is persisted server-side — drop the cached
8168
+ // list so the next getAvatarsCustomized() surfaces it.
8169
+ if (r.cdn_url) {
8170
+ OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.AvatarsCustomized);
8171
+ }
8172
+ return r;
8173
+ });
8174
+ } catch (e) {
8175
+ return Promise.reject(e);
8176
+ }
8006
8177
  };
8007
8178
  return WSAPIAvatars;
8008
8179
  }(WSAPIMiniGames);
@@ -8769,15 +8940,8 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
8769
8940
  * the array is the prize for place 1, the second for place 2, and
8770
8941
  * so on. The array length is the number of paid places.
8771
8942
  *
8772
- * **Cache TTL — single shared key (known limitation)**
8773
- * The SDK caches the response for 30 seconds under a SINGLE shared
8774
- * key — calling `getLeaderBoard(DAILY)` followed by
8775
- * `getLeaderBoard(WEEKLY)` within the same 30 s window returns the
8776
- * cached DAILY result for the WEEKLY call. Same applies to
8777
- * switching `getPreviousPeriod`. To force a fresh fetch when
8778
- * switching periods or current/previous, call
8779
- * `_smartico.api.clearCaches()` before the second call, or simply
8780
- * wait out the TTL.
8943
+ * **Cache TTL**
8944
+ * The SDK caches each response for 30 seconds.
8781
8945
  *
8782
8946
  * **Period boundaries**
8783
8947
  * The server finalizes each period on a server-configurable
@@ -8847,8 +9011,7 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
8847
9011
  * }
8848
9012
  * }
8849
9013
  *
8850
- * // Switch to previous period view — but bust the cache first to avoid the shared-key collision.
8851
- * await window._smartico.api.clearCaches();
9014
+ * // Switch to previous period view — cached separately from the current period.
8852
9015
  * const prev = await window._smartico.api.getLeaderBoard(LeaderBoardPeriodType.WEEKLY, true);
8853
9016
  * console.log('[smartico] previous-week standings — render with greyed-out "ended" treatment:', prev?.users.length, 'finalists');
8854
9017
  *
@@ -8859,7 +9022,10 @@ var WSAPILeaderBoard = /*#__PURE__*/function (_WSAPIGamePick) {
8859
9022
  _proto.getLeaderBoard = function getLeaderBoard(periodType, getPreviousPeriod) {
8860
9023
  try {
8861
9024
  var _this = this;
8862
- return Promise.resolve(OCache.use(onUpdateContextKey.LeaderBoards, exports.ECacheContext.WSAPI, function () {
9025
+ // Cache per (periodType, current/previous) so switching tabs or
9026
+ // current↔previous within the TTL doesn't return a colliding board.
9027
+ var cacheKey = onUpdateContextKey.LeaderBoards + ":" + periodType + ":" + (getPreviousPeriod ? 1 : 0);
9028
+ return Promise.resolve(OCache.use(cacheKey, exports.ECacheContext.WSAPI, function () {
8863
9029
  return _this.api.leaderboardsGetT(_this.userExtId, periodType, getPreviousPeriod);
8864
9030
  }, CACHE_DATA_SEC));
8865
9031
  } catch (e) {
@@ -9692,6 +9858,7 @@ var WSAPI = /*#__PURE__*/function (_WSAPIInbox) {
9692
9858
  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) {
9693
9859
  _this.notifyActivityLogUpdate();
9694
9860
  }
9861
+ OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.CurrentLevel);
9695
9862
  });
9696
9863
  on(exports.ClassId.RAF_OPTIN_RESPONSE, function () {
9697
9864
  return _this.updateRaffles();
@@ -9974,7 +10141,7 @@ var AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
9974
10141
  var DEFAULT_LANG_EN = 'EN';
9975
10142
  var SmarticoAPI = /*#__PURE__*/function () {
9976
10143
  function SmarticoAPI(label_api_key, brand_api_key, messageSender, options) {
9977
- var _options$tracker;
10144
+ var _options$tracker, _options$tracker2;
9978
10145
  if (options === void 0) {
9979
10146
  options = {};
9980
10147
  }
@@ -9988,6 +10155,7 @@ var SmarticoAPI = /*#__PURE__*/function () {
9988
10155
  this.gamesApiUrl = void 0;
9989
10156
  this.baseRgApiParams = void 0;
9990
10157
  this.avatarDomain = void 0;
10158
+ this.avatarOriginDomain = void 0;
9991
10159
  this.envId = void 0;
9992
10160
  this.logger = void 0;
9993
10161
  this.logCIDs = void 0;
@@ -10015,6 +10183,7 @@ var SmarticoAPI = /*#__PURE__*/function () {
10015
10183
  };
10016
10184
  }
10017
10185
  this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
10186
+ this.avatarOriginDomain = SmarticoAPI.getAvatarOriginUrl(label_api_key || ((_options$tracker2 = options.tracker) == null ? void 0 : _options$tracker2.label_api_key));
10018
10187
  this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
10019
10188
  }
10020
10189
  SmarticoAPI.getEnvDnsSuffix = function getEnvDnsSuffix(label_api_key) {
@@ -10076,6 +10245,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
10076
10245
  var avatarUrl = AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
10077
10246
  return SmarticoAPI.replaceSmrDomainsWithCloudfront(avatarUrl);
10078
10247
  };
10248
+ SmarticoAPI.getAvatarOriginUrl = function getAvatarOriginUrl(label_api_key) {
10249
+ return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
10250
+ };
10079
10251
  var _proto = SmarticoAPI.prototype;
10080
10252
  _proto.send = function send(message, expectCID, force_language) {
10081
10253
  try {
@@ -11344,13 +11516,46 @@ var SmarticoAPI = /*#__PURE__*/function () {
11344
11516
  return Promise.reject(e);
11345
11517
  }
11346
11518
  };
11347
- _proto.gpGetActiveRounds = function gpGetActiveRounds(saw_template_id) {
11519
+ _proto.sendAvatarApi = function sendAvatarApi(_ref6) {
11520
+ var method = _ref6.method,
11521
+ body = _ref6.body;
11348
11522
  try {
11349
11523
  var _this73 = this;
11524
+ if (!_this73.tracker) {
11525
+ throw new Error("Avatar APIs are not available in the visitor mode");
11526
+ }
11527
+ var url = _this73.avatarOriginDomain + "/" + method;
11528
+ return Promise.resolve(_catch(function () {
11529
+ return Promise.resolve(fetch(url, {
11530
+ method: 'POST',
11531
+ headers: {
11532
+ 'Accept': 'application/json',
11533
+ 'Content-Type': 'application/json'
11534
+ },
11535
+ body: JSON.stringify(body)
11536
+ })).then(function (response) {
11537
+ return Promise.resolve(response.json()).then(function (data) {
11538
+ return SmarticoAPI.replaceSmrDomainsWithCloudfront(data);
11539
+ });
11540
+ });
11541
+ }, function (e) {
11542
+ _this73.logger.error("Failed to call avatar API: " + method, {
11543
+ url: url,
11544
+ error: e.message
11545
+ });
11546
+ throw new Error("Failed to call avatar API: " + method + ". " + e.message);
11547
+ }));
11548
+ } catch (e) {
11549
+ return Promise.reject(e);
11550
+ }
11551
+ };
11552
+ _proto.gpGetActiveRounds = function gpGetActiveRounds(saw_template_id) {
11553
+ try {
11554
+ var _this74 = this;
11350
11555
  var params = {
11351
11556
  ext_game_id: saw_template_id
11352
11557
  };
11353
- return Promise.resolve(_this73.sendGamesApi({
11558
+ return Promise.resolve(_this74.sendGamesApi({
11354
11559
  method: 'active-rounds',
11355
11560
  params: params
11356
11561
  }));
@@ -11360,12 +11565,12 @@ var SmarticoAPI = /*#__PURE__*/function () {
11360
11565
  };
11361
11566
  _proto.gpGetActiveRound = function gpGetActiveRound(saw_template_id, round_id) {
11362
11567
  try {
11363
- var _this74 = this;
11568
+ var _this75 = this;
11364
11569
  var params = {
11365
11570
  ext_game_id: saw_template_id,
11366
11571
  round_id: round_id
11367
11572
  };
11368
- return Promise.resolve(_this74.sendGamesApi({
11573
+ return Promise.resolve(_this75.sendGamesApi({
11369
11574
  method: 'active-round',
11370
11575
  params: params
11371
11576
  }));
@@ -11375,11 +11580,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
11375
11580
  };
11376
11581
  _proto.gpGetGamesHistory = function gpGetGamesHistory(saw_template_id) {
11377
11582
  try {
11378
- var _this75 = this;
11583
+ var _this76 = this;
11379
11584
  var params = {
11380
11585
  ext_game_id: saw_template_id
11381
11586
  };
11382
- return Promise.resolve(_this75.sendGamesApi({
11587
+ return Promise.resolve(_this76.sendGamesApi({
11383
11588
  method: 'games-history',
11384
11589
  params: params
11385
11590
  }));
@@ -11389,12 +11594,12 @@ var SmarticoAPI = /*#__PURE__*/function () {
11389
11594
  };
11390
11595
  _proto.gpGetGameBoard = function gpGetGameBoard(saw_template_id, round_id) {
11391
11596
  try {
11392
- var _this76 = this;
11597
+ var _this77 = this;
11393
11598
  var params = {
11394
11599
  ext_game_id: saw_template_id,
11395
11600
  round_id: round_id
11396
11601
  };
11397
- return Promise.resolve(_this76.sendGamesApi({
11602
+ return Promise.resolve(_this77.sendGamesApi({
11398
11603
  method: 'game-board',
11399
11604
  params: params
11400
11605
  }));
@@ -11404,13 +11609,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
11404
11609
  };
11405
11610
  _proto.gpSubmitSelection = function gpSubmitSelection(saw_template_id, round, isQuiz) {
11406
11611
  try {
11407
- var _this77 = this;
11612
+ var _this78 = this;
11408
11613
  var method = isQuiz ? 'submit-selection-quiz' : 'submit-selection';
11409
11614
  var params = {
11410
11615
  ext_game_id: saw_template_id,
11411
11616
  round: round
11412
11617
  };
11413
- return Promise.resolve(_this77.sendGamesApi({
11618
+ return Promise.resolve(_this78.sendGamesApi({
11414
11619
  method: method,
11415
11620
  params: params,
11416
11621
  usePost: true
@@ -11421,11 +11626,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
11421
11626
  };
11422
11627
  _proto.gpGetUserInfo = function gpGetUserInfo(saw_template_id) {
11423
11628
  try {
11424
- var _this78 = this;
11629
+ var _this79 = this;
11425
11630
  var params = {
11426
11631
  ext_game_id: saw_template_id
11427
11632
  };
11428
- return Promise.resolve(_this78.sendGamesApi({
11633
+ return Promise.resolve(_this79.sendGamesApi({
11429
11634
  method: 'user-info',
11430
11635
  params: params
11431
11636
  }));
@@ -11435,11 +11640,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
11435
11640
  };
11436
11641
  _proto.gpGetGameInfo = function gpGetGameInfo(saw_template_id) {
11437
11642
  try {
11438
- var _this79 = this;
11643
+ var _this80 = this;
11439
11644
  var params = {
11440
11645
  ext_game_id: saw_template_id
11441
11646
  };
11442
- return Promise.resolve(_this79.sendGamesApi({
11647
+ return Promise.resolve(_this80.sendGamesApi({
11443
11648
  method: 'game-info',
11444
11649
  params: params
11445
11650
  }));
@@ -11449,11 +11654,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
11449
11654
  };
11450
11655
  _proto.gpGetTranslations = function gpGetTranslations(saw_template_id) {
11451
11656
  try {
11452
- var _this80 = this;
11657
+ var _this81 = this;
11453
11658
  var params = {
11454
11659
  ext_game_id: saw_template_id
11455
11660
  };
11456
- return Promise.resolve(_this80.sendGamesApi({
11661
+ return Promise.resolve(_this81.sendGamesApi({
11457
11662
  method: 'translations',
11458
11663
  params: params
11459
11664
  }));
@@ -11463,13 +11668,13 @@ var SmarticoAPI = /*#__PURE__*/function () {
11463
11668
  };
11464
11669
  _proto.gpGetRoundInfoForUser = function gpGetRoundInfoForUser(saw_template_id, round_id, int_user_id) {
11465
11670
  try {
11466
- var _this81 = this;
11671
+ var _this82 = this;
11467
11672
  var params = {
11468
11673
  ext_game_id: saw_template_id,
11469
11674
  round_id: round_id,
11470
11675
  int_user_id: int_user_id
11471
11676
  };
11472
- return Promise.resolve(_this81.sendGamesApi({
11677
+ return Promise.resolve(_this82.sendGamesApi({
11473
11678
  method: 'game-round-info-for-user',
11474
11679
  params: params
11475
11680
  }));
@@ -11479,49 +11684,69 @@ var SmarticoAPI = /*#__PURE__*/function () {
11479
11684
  };
11480
11685
  _proto.avatarsGetList = function avatarsGetList(user_ext_id) {
11481
11686
  try {
11482
- var _this82 = this;
11483
- var message = _this82.buildMessage(user_ext_id, exports.ClassId.GET_AVATARS_LIST_REQUEST);
11484
- return Promise.resolve(_this82.send(message, exports.ClassId.GET_AVATARS_LIST_RESPONSE));
11687
+ var _this83 = this;
11688
+ var message = _this83.buildMessage(user_ext_id, exports.ClassId.GET_AVATARS_LIST_REQUEST);
11689
+ return Promise.resolve(_this83.send(message, exports.ClassId.GET_AVATARS_LIST_RESPONSE));
11485
11690
  } catch (e) {
11486
11691
  return Promise.reject(e);
11487
11692
  }
11488
11693
  };
11489
11694
  _proto.avatarsGetCustomized = function avatarsGetCustomized(user_ext_id) {
11490
11695
  try {
11491
- var _this83 = this;
11492
- var message = _this83.buildMessage(user_ext_id, exports.ClassId.GET_AVATARS_CUSTOMIZED_REQUEST);
11493
- return Promise.resolve(_this83.send(message, exports.ClassId.GET_AVATARS_CUSTOMIZED_RESPONSE));
11696
+ var _this84 = this;
11697
+ var message = _this84.buildMessage(user_ext_id, exports.ClassId.GET_AVATARS_CUSTOMIZED_REQUEST);
11698
+ return Promise.resolve(_this84.send(message, exports.ClassId.GET_AVATARS_CUSTOMIZED_RESPONSE));
11494
11699
  } catch (e) {
11495
11700
  return Promise.reject(e);
11496
11701
  }
11497
11702
  };
11498
11703
  _proto.avatarsGetPrompts = function avatarsGetPrompts(user_ext_id) {
11499
11704
  try {
11500
- var _this84 = this;
11501
- var message = _this84.buildMessage(user_ext_id, exports.ClassId.GET_AVATAR_PROMPTS_REQUEST);
11502
- return Promise.resolve(_this84.send(message, exports.ClassId.GET_AVATAR_PROMPTS_RESPONSE));
11705
+ var _this85 = this;
11706
+ var message = _this85.buildMessage(user_ext_id, exports.ClassId.GET_AVATAR_PROMPTS_REQUEST);
11707
+ return Promise.resolve(_this85.send(message, exports.ClassId.GET_AVATAR_PROMPTS_RESPONSE));
11503
11708
  } catch (e) {
11504
11709
  return Promise.reject(e);
11505
11710
  }
11506
11711
  };
11507
11712
  _proto.avatarSetAvatar = function avatarSetAvatar(user_ext_id, avatar_id, avatar_real_id) {
11508
11713
  try {
11509
- var _this85 = this;
11510
- var message = _this85.buildMessage(user_ext_id, exports.ClassId.CLIENT_SET_AVATAR_REQUEST, {
11714
+ var _this86 = this;
11715
+ var message = _this86.buildMessage(user_ext_id, exports.ClassId.CLIENT_SET_AVATAR_REQUEST, {
11511
11716
  avatar_id: avatar_id,
11512
11717
  avatar_real_id: avatar_real_id
11513
11718
  });
11514
- return Promise.resolve(_this85.send(message, exports.ClassId.CLIENT_SET_AVATAR_RESPONSE));
11719
+ return Promise.resolve(_this86.send(message, exports.ClassId.CLIENT_SET_AVATAR_RESPONSE));
11720
+ } catch (e) {
11721
+ return Promise.reject(e);
11722
+ }
11723
+ };
11724
+ _proto.avatarsCustomize = function avatarsCustomize(params) {
11725
+ try {
11726
+ var _this87$tracker, _this87$tracker2;
11727
+ var _this87 = this;
11728
+ return Promise.resolve(_this87.sendAvatarApi({
11729
+ method: 'avatar-customize',
11730
+ body: {
11731
+ label_id: params.label_id,
11732
+ user_id: params.user_id,
11733
+ user_ext_id: (_this87$tracker = _this87.tracker) == null ? void 0 : _this87$tracker.getExtUserId(),
11734
+ brand_key: _this87.brand_api_key || ((_this87$tracker2 = _this87.tracker) == null || (_this87$tracker2 = _this87$tracker2.params) == null ? void 0 : _this87$tracker2.brand_key),
11735
+ prompt_id: params.prompt_id,
11736
+ avatar_url: params.avatar_url,
11737
+ avatar_real_id: params.avatar_real_id
11738
+ }
11739
+ }));
11515
11740
  } catch (e) {
11516
11741
  return Promise.reject(e);
11517
11742
  }
11518
11743
  };
11519
11744
  _proto.avatarsGetListT = function avatarsGetListT(user_ext_id) {
11520
11745
  try {
11521
- var _this86 = this;
11522
- return Promise.resolve(_this86.avatarsGetList(user_ext_id)).then(function (_this86$avatarsGetLis) {
11523
- var _this86$avatarsGetLis2;
11524
- return avatarDefinitionTransform((_this86$avatarsGetLis2 = _this86$avatarsGetLis.avatars) != null ? _this86$avatarsGetLis2 : [], _this86.avatarDomain);
11746
+ var _this88 = this;
11747
+ return Promise.resolve(_this88.avatarsGetList(user_ext_id)).then(function (_this88$avatarsGetLis) {
11748
+ var _this88$avatarsGetLis2;
11749
+ return avatarDefinitionTransform((_this88$avatarsGetLis2 = _this88$avatarsGetLis.avatars) != null ? _this88$avatarsGetLis2 : [], _this88.avatarDomain);
11525
11750
  });
11526
11751
  } catch (e) {
11527
11752
  return Promise.reject(e);
@@ -11529,10 +11754,10 @@ var SmarticoAPI = /*#__PURE__*/function () {
11529
11754
  };
11530
11755
  _proto.avatarsGetCustomizedT = function avatarsGetCustomizedT(user_ext_id) {
11531
11756
  try {
11532
- var _this87 = this;
11533
- return Promise.resolve(_this87.avatarsGetCustomized(user_ext_id)).then(function (_this87$avatarsGetCus) {
11534
- var _this87$avatarsGetCus2;
11535
- return avatarCustomizedTransform((_this87$avatarsGetCus2 = _this87$avatarsGetCus.avatars) != null ? _this87$avatarsGetCus2 : [], _this87.avatarDomain);
11757
+ var _this89 = this;
11758
+ return Promise.resolve(_this89.avatarsGetCustomized(user_ext_id)).then(function (_this89$avatarsGetCus) {
11759
+ var _this89$avatarsGetCus2;
11760
+ return avatarCustomizedTransform((_this89$avatarsGetCus2 = _this89$avatarsGetCus.avatars) != null ? _this89$avatarsGetCus2 : [], _this89.avatarDomain);
11536
11761
  });
11537
11762
  } catch (e) {
11538
11763
  return Promise.reject(e);
@@ -11540,10 +11765,10 @@ var SmarticoAPI = /*#__PURE__*/function () {
11540
11765
  };
11541
11766
  _proto.avatarsGetPromptsT = function avatarsGetPromptsT(user_ext_id) {
11542
11767
  try {
11543
- var _this88 = this;
11544
- return Promise.resolve(_this88.avatarsGetPrompts(user_ext_id)).then(function (_this88$avatarsGetPro) {
11545
- var _this88$avatarsGetPro2;
11546
- return avatarPromptTransform((_this88$avatarsGetPro2 = _this88$avatarsGetPro.prompts) != null ? _this88$avatarsGetPro2 : [], _this88.avatarDomain);
11768
+ var _this90 = this;
11769
+ return Promise.resolve(_this90.avatarsGetPrompts(user_ext_id)).then(function (_this90$avatarsGetPro) {
11770
+ var _this90$avatarsGetPro2;
11771
+ return avatarPromptTransform((_this90$avatarsGetPro2 = _this90$avatarsGetPro.prompts) != null ? _this90$avatarsGetPro2 : [], _this90.avatarDomain);
11547
11772
  });
11548
11773
  } catch (e) {
11549
11774
  return Promise.reject(e);
@@ -11554,20 +11779,20 @@ var SmarticoAPI = /*#__PURE__*/function () {
11554
11779
  };
11555
11780
  _proto.getRelatedItemsForGame = function getRelatedItemsForGame(user_ext_id, related_game_id) {
11556
11781
  try {
11557
- var _this89 = this;
11558
- var message = _this89.buildMessage(user_ext_id, exports.ClassId.GET_RELATED_ACH_N_TOURNAMENTS_REQUEST, {
11782
+ var _this91 = this;
11783
+ var message = _this91.buildMessage(user_ext_id, exports.ClassId.GET_RELATED_ACH_N_TOURNAMENTS_REQUEST, {
11559
11784
  related_game_id: related_game_id
11560
11785
  });
11561
- return Promise.resolve(_this89.send(message, exports.ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE));
11786
+ return Promise.resolve(_this91.send(message, exports.ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE));
11562
11787
  } catch (e) {
11563
11788
  return Promise.reject(e);
11564
11789
  }
11565
11790
  };
11566
11791
  _proto.getRafflesT = function getRafflesT(user_ext_id) {
11567
11792
  try {
11568
- var _this90 = this;
11569
- return Promise.resolve(_this90.getRaffles(user_ext_id)).then(function (_this90$getRaffles) {
11570
- return raffleTransform(_this90$getRaffles.items);
11793
+ var _this92 = this;
11794
+ return Promise.resolve(_this92.getRaffles(user_ext_id)).then(function (_this92$getRaffles) {
11795
+ return raffleTransform(_this92$getRaffles.items);
11571
11796
  });
11572
11797
  } catch (e) {
11573
11798
  return Promise.reject(e);
@@ -11575,18 +11800,18 @@ var SmarticoAPI = /*#__PURE__*/function () {
11575
11800
  };
11576
11801
  _proto.getRaffles = function getRaffles(user_ext_id) {
11577
11802
  try {
11578
- var _this91 = this;
11579
- var message = _this91.buildMessage(user_ext_id, exports.ClassId.RAF_GET_RAFFLES_REQUEST);
11580
- return Promise.resolve(_this91.send(message, exports.ClassId.RAF_GET_RAFFLES_RESPONSE));
11803
+ var _this93 = this;
11804
+ var message = _this93.buildMessage(user_ext_id, exports.ClassId.RAF_GET_RAFFLES_REQUEST);
11805
+ return Promise.resolve(_this93.send(message, exports.ClassId.RAF_GET_RAFFLES_RESPONSE));
11581
11806
  } catch (e) {
11582
11807
  return Promise.reject(e);
11583
11808
  }
11584
11809
  };
11585
11810
  _proto.getRaffleDrawRun = function getRaffleDrawRun(user_ext_id, payload) {
11586
11811
  try {
11587
- var _this92 = this;
11588
- var message = _this92.buildMessage(user_ext_id, exports.ClassId.RAF_GET_DRAW_RUN_REQUEST, payload);
11589
- return Promise.resolve(_this92.send(message, exports.ClassId.RAF_GET_DRAW_RUN_RESPONSE));
11812
+ var _this94 = this;
11813
+ var message = _this94.buildMessage(user_ext_id, exports.ClassId.RAF_GET_DRAW_RUN_REQUEST, payload);
11814
+ return Promise.resolve(_this94.send(message, exports.ClassId.RAF_GET_DRAW_RUN_RESPONSE));
11590
11815
  } catch (e) {
11591
11816
  return Promise.reject(e);
11592
11817
  }
@@ -11599,10 +11824,10 @@ var SmarticoAPI = /*#__PURE__*/function () {
11599
11824
  winners_to = 20;
11600
11825
  }
11601
11826
  try {
11602
- var _this93 = this;
11827
+ var _this95 = this;
11603
11828
  var winners_limit = winners_to - winners_from > 50 ? 50 : winners_to - winners_from;
11604
11829
  var winners_offset = winners_from;
11605
- return Promise.resolve(_this93.getRaffleDrawRun(user_ext_id, {
11830
+ return Promise.resolve(_this95.getRaffleDrawRun(user_ext_id, {
11606
11831
  raffle_id: raffle_id,
11607
11832
  run_id: run_id,
11608
11833
  winners_limit: winners_limit,
@@ -11614,50 +11839,50 @@ var SmarticoAPI = /*#__PURE__*/function () {
11614
11839
  };
11615
11840
  _proto.getRaffleDrawRunsHistory = function getRaffleDrawRunsHistory(user_ext_id, props) {
11616
11841
  try {
11617
- var _this94 = this;
11618
- var message = _this94.buildMessage(user_ext_id, exports.ClassId.RAF_GET_DRAW_HISTORY_REQUEST, props);
11619
- return Promise.resolve(_this94.send(message, exports.ClassId.RAF_GET_DRAW_HISTORY_RESPONSE));
11842
+ var _this96 = this;
11843
+ var message = _this96.buildMessage(user_ext_id, exports.ClassId.RAF_GET_DRAW_HISTORY_REQUEST, props);
11844
+ return Promise.resolve(_this96.send(message, exports.ClassId.RAF_GET_DRAW_HISTORY_RESPONSE));
11620
11845
  } catch (e) {
11621
11846
  return Promise.reject(e);
11622
11847
  }
11623
11848
  };
11624
11849
  _proto.claimRafflePrize = function claimRafflePrize(user_ext_id, props) {
11625
11850
  try {
11626
- var _this95 = this;
11627
- var message = _this95.buildMessage(user_ext_id, exports.ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
11628
- return Promise.resolve(_this95.send(message, exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE));
11851
+ var _this97 = this;
11852
+ var message = _this97.buildMessage(user_ext_id, exports.ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
11853
+ return Promise.resolve(_this97.send(message, exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE));
11629
11854
  } catch (e) {
11630
11855
  return Promise.reject(e);
11631
11856
  }
11632
11857
  };
11633
11858
  _proto.raffleOptin = function raffleOptin(user_ext_id, props) {
11634
11859
  try {
11635
- var _this96 = this;
11636
- var message = _this96.buildMessage(user_ext_id, exports.ClassId.RAF_OPTIN_REQUEST, props);
11637
- return Promise.resolve(_this96.send(message, exports.ClassId.RAF_OPTIN_RESPONSE));
11860
+ var _this98 = this;
11861
+ var message = _this98.buildMessage(user_ext_id, exports.ClassId.RAF_OPTIN_REQUEST, props);
11862
+ return Promise.resolve(_this98.send(message, exports.ClassId.RAF_OPTIN_RESPONSE));
11638
11863
  } catch (e) {
11639
11864
  return Promise.reject(e);
11640
11865
  }
11641
11866
  };
11642
11867
  _proto.getRaffleWonPrizes = function getRaffleWonPrizes(user_ext_id, props) {
11643
11868
  try {
11644
- var _this97 = this;
11645
- var message = _this97.buildMessage(user_ext_id, exports.ClassId.RAF_GET_WON_PRIZES_REQUEST, props);
11646
- return Promise.resolve(_this97.send(message, exports.ClassId.RAF_GET_WON_PRIZES_RESPONSE));
11869
+ var _this99 = this;
11870
+ var message = _this99.buildMessage(user_ext_id, exports.ClassId.RAF_GET_WON_PRIZES_REQUEST, props);
11871
+ return Promise.resolve(_this99.send(message, exports.ClassId.RAF_GET_WON_PRIZES_RESPONSE));
11647
11872
  } catch (e) {
11648
11873
  return Promise.reject(e);
11649
11874
  }
11650
11875
  };
11651
11876
  _proto.getActivityLog = function getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
11652
11877
  try {
11653
- var _this98 = this;
11654
- var message = _this98.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
11878
+ var _this100 = this;
11879
+ var message = _this100.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
11655
11880
  startTimeSeconds: Math.floor(startTimeSeconds),
11656
11881
  endTimeSeconds: Math.floor(endTimeSeconds),
11657
11882
  limit: limit,
11658
11883
  offset: offset
11659
11884
  });
11660
- return Promise.resolve(_this98.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
11885
+ return Promise.resolve(_this100.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
11661
11886
  } catch (e) {
11662
11887
  return Promise.reject(e);
11663
11888
  }
@@ -11670,11 +11895,11 @@ var SmarticoAPI = /*#__PURE__*/function () {
11670
11895
  to = 50;
11671
11896
  }
11672
11897
  try {
11673
- var _this99 = this;
11898
+ var _this101 = this;
11674
11899
  var limit = to - from > 50 ? 50 : to - from;
11675
11900
  var offset = from;
11676
- return Promise.resolve(_this99.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).then(function (_this99$getActivityLo) {
11677
- return ActivityLogTransform(_this99$getActivityLo.logHistory);
11901
+ return Promise.resolve(_this101.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).then(function (_this101$getActivityL) {
11902
+ return ActivityLogTransform(_this101$getActivityL.logHistory);
11678
11903
  });
11679
11904
  } catch (e) {
11680
11905
  return Promise.reject(e);
@@ -12276,46 +12501,56 @@ exports.JackpotType = void 0;
12276
12501
  JackpotType[JackpotType["Personal"] = 2] = "Personal";
12277
12502
  })(exports.JackpotType || (exports.JackpotType = {}));
12278
12503
 
12279
- var _AvatarCustomizeError;
12504
+ /**
12505
+ * Limit error codes returned in `errCode` by the `avatarsCustomize` method.
12506
+ * See the `avatarsCustomize` TSDoc for the full table (including the generic
12507
+ * `-1` failure, which has no named member here).
12508
+ */
12280
12509
  exports.AvatarCustomizeErrorCode = void 0;
12281
12510
  (function (AvatarCustomizeErrorCode) {
12511
+ /** The user has reached the operator-configured per-user monthly cap on custom-avatar generations. */
12282
12512
  AvatarCustomizeErrorCode[AvatarCustomizeErrorCode["AVATAR_USER_LIMIT"] = 12001] = "AVATAR_USER_LIMIT";
12513
+ /** The brand's operator-configured shared monthly pool of custom-avatar generations is exhausted. */
12283
12514
  AvatarCustomizeErrorCode[AvatarCustomizeErrorCode["AVATAR_LABEL_LIMIT"] = 12002] = "AVATAR_LABEL_LIMIT";
12284
12515
  })(exports.AvatarCustomizeErrorCode || (exports.AvatarCustomizeErrorCode = {}));
12285
- 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);
12286
12516
 
12287
- /*
12288
- * Possible error codes returned in JOIN_CLAN_RESPONSE.errCode (cid: 575).
12289
- * Clan-protocol-specific numeric codes defined in the handler spec.
12517
+ /**
12518
+ * Error codes returned in `errCode` by the `joinClan` method (also carried
12519
+ * on `TClanJoinResult`). These are terse value definitions for lookup; the
12520
+ * full per-code narrative and UI handling lives in the `joinClan` method
12521
+ * TSDoc, which owns the error table.
12290
12522
  */
12291
12523
  exports.JoinClanErrorCode = void 0;
12292
12524
  (function (JoinClanErrorCode) {
12293
- /** No error, join completed */
12525
+ /** Success — join completed; entry fee (if any) deducted. */
12294
12526
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_OK"] = 0] = "JOIN_CLAN_OK";
12295
- /** Invalid parameters */
12527
+ /** Request was malformed (missing or invalid parameters). */
12296
12528
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_INVALID_PARAMETERS"] = 1000] = "JOIN_CLAN_INVALID_PARAMETERS";
12297
- /** clan_id doesn't exist for this label */
12529
+ /** Clan doesn't exist for this label. Archived clans are also reported as `1001`. */
12298
12530
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_NOT_FOUND"] = 1001] = "JOIN_CLAN_NOT_FOUND";
12299
- /** members_count >= capacity_limit */
12531
+ /** Clan is full — member capacity reached. */
12300
12532
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_FULL"] = 1002] = "JOIN_CLAN_FULL";
12301
- /** Not enough Points / Gems / Diamonds for entry fee */
12533
+ /** Insufficient balance for the entry fee (points / gems / diamonds). */
12302
12534
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_INSUFFICIENT_FUNDS"] = 1003] = "JOIN_CLAN_INSUFFICIENT_FUNDS";
12303
- /** User doesn't satisfy entry_conditions / entry_segment_id */
12535
+ /** User doesn't meet the clan's entry segment or conditions. */
12304
12536
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_SEGMENT_MISMATCH"] = 1004] = "JOIN_CLAN_SEGMENT_MISMATCH";
12305
- /** User is not in a clan */
12537
+ /**
12538
+ * User is not in a clan. Note: a `registerInTournament` response code
12539
+ * that shares this enum — never returned by `joinClan`.
12540
+ */
12306
12541
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_USER_IS_NOT_IN_CLAN"] = 1005] = "JOIN_CLAN_USER_IS_NOT_IN_CLAN";
12307
- /** User is within the CLAN_COOLDOWN_DAYS window */
12542
+ /** User is within the clan-switch cooldown window (switch only). */
12308
12543
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_COOLDOWN_ACTIVE"] = 1006] = "JOIN_CLAN_COOLDOWN_ACTIVE";
12309
- /** clan_status_id != 1 (clan is archived) */
12310
- JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_ARCHIVED"] = 1007] = "JOIN_CLAN_ARCHIVED";
12311
- /** Clan joined after tournament start */
12544
+ /**
12545
+ * Clan joined after tournament start. Note: a `registerInTournament`
12546
+ * response code that shares this enum — never returned by `joinClan`.
12547
+ */
12312
12548
  JoinClanErrorCode[JoinClanErrorCode["JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START"] = 1011] = "JOIN_CLAN_JOINED_AFTER_TOURNAMENT_START";
12313
12549
  })(exports.JoinClanErrorCode || (exports.JoinClanErrorCode = {}));
12314
12550
 
12315
12551
  exports.AchCategoryTransform = AchCategoryTransform;
12316
12552
  exports.ActivityLogTransform = ActivityLogTransform;
12317
12553
  exports.AllRoundsGameBoardID = AllRoundsGameBoardID;
12318
- exports.AvatarCustomizeErrorMessage = AvatarCustomizeErrorMessage;
12319
12554
  exports.BonusItemsTransform = BonusItemsTransform;
12320
12555
  exports.CookieStore = CookieStore;
12321
12556
  exports.CoreUtils = CoreUtils;