@smartico/public-api 0.0.401 → 0.0.403

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 (37) hide show
  1. package/dist/ActivityLog/ActivityLogEntry.d.ts +2 -0
  2. package/dist/Avatars/AvatarCustomized.d.ts +2 -2
  3. package/dist/GamePick/GamePickTypes.d.ts +6 -6
  4. package/dist/NodeCache.d.ts +1 -0
  5. package/dist/OCache.d.ts +7 -0
  6. package/dist/WSAPI/WSAPIAvatars.d.ts +1 -1
  7. package/dist/WSAPI/WSAPITypes.d.ts +7 -4
  8. package/dist/WSAPI/WSAPIUser.d.ts +3 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +92 -35
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.mjs +60 -12
  13. package/dist/index.modern.mjs.map +1 -1
  14. package/docs/api/classes/WSAPIAvatars.md +1 -1
  15. package/docs/api/interfaces/AvatarCustomized.md +2 -2
  16. package/docs/api/interfaces/GamePickEvent.md +4 -4
  17. package/docs/api/interfaces/GamePickUserInfo.md +2 -2
  18. package/docs/api/interfaces/GemsDiamondsLog.md +2 -0
  19. package/docs/api/interfaces/PointsLog.md +2 -0
  20. package/docs/api/interfaces/TAvatarCustomized.md +2 -2
  21. package/docs/api/interfaces/TInboxMessage.md +2 -1
  22. package/docs/api/interfaces/TMissionOrBadge.md +3 -1
  23. package/package.json +1 -1
  24. package/src/ActivityLog/ActivityLogEntry.ts +2 -0
  25. package/src/Avatars/AvatarCustomized.ts +2 -2
  26. package/src/GamePick/GamePickTypes.ts +6 -6
  27. package/src/Missions/UserAchievement.ts +2 -2
  28. package/src/NodeCache.ts +8 -0
  29. package/src/OCache.ts +17 -0
  30. package/src/Store/StoreItem.ts +1 -1
  31. package/src/WSAPI/WSAPI.ts +3 -3
  32. package/src/WSAPI/WSAPIAvatars.ts +1 -1
  33. package/src/WSAPI/WSAPIJackpots.ts +4 -1
  34. package/src/WSAPI/WSAPIMiniGames.ts +1 -1
  35. package/src/WSAPI/WSAPITypes.ts +7 -4
  36. package/src/WSAPI/WSAPIUser.ts +30 -5
  37. package/src/index.ts +20 -0
@@ -1,6 +1,7 @@
1
1
  import { PointChangeSourceType } from './PointChangeSourceType';
2
2
  import { UserBalanceType } from './UserBalanceType';
3
3
  export interface PointsLog {
4
+ /** Epoch timestamp in SECONDS (not ms — unlike most SDK timestamps). */
4
5
  create_date: number;
5
6
  user_ext_id: string;
6
7
  crm_brand_id: number;
@@ -10,6 +11,7 @@ export interface PointsLog {
10
11
  source_type_id: PointChangeSourceType;
11
12
  }
12
13
  export interface GemsDiamondsLog {
14
+ /** Epoch timestamp in SECONDS (not ms — unlike most SDK timestamps). */
13
15
  create_date: number;
14
16
  user_ext_id: string;
15
17
  crm_brand_id: number;
@@ -3,6 +3,6 @@ export interface AvatarCustomized {
3
3
  avatar_real_id: number;
4
4
  /** CDN URL of the AI-customized avatar image */
5
5
  url: string;
6
- /** ISO date string when the customization was created */
7
- dt_created: string;
6
+ /** Unix-ms timestamp when the customization was created. */
7
+ dt_created: number;
8
8
  }
@@ -201,10 +201,10 @@ export interface GamePickEventMeta extends QuizEventMeta {
201
201
  export interface GamePickEvent {
202
202
  /** Unique identifier of the event */
203
203
  gp_event_id: number;
204
- /** Timestamp (ms) when the event was resolved, null if not yet resolved */
205
- event_resolution_date: number;
206
- /** Timestamp (ms) of the match/event start time */
207
- match_date: number;
204
+ /** ISO 8601 date-time string when the event was resolved; null until resolved. */
205
+ event_resolution_date: string;
206
+ /** ISO 8601 date-time string of the match/event start time. */
207
+ match_date: string;
208
208
  /** Market type defining the prediction format (e.g. two-team score, quiz question, custom) */
209
209
  market_type_id: SAWGPMarketType;
210
210
  /** Event metadata containing team names, images, sport type, and question details */
@@ -406,8 +406,8 @@ export interface GamePickUserInfo {
406
406
  part_wins_count?: number;
407
407
  /** User's total score */
408
408
  resolution_score?: number;
409
- /** Last time the user's balance was synced from the Smartico platform */
410
- last_wallet_sync_time?: Date;
409
+ /** ISO 8601 date-time string of the last time the user's balance was synced from the Smartico platform. */
410
+ last_wallet_sync_time?: string;
411
411
  /** User's current points balance */
412
412
  ach_points_balance?: number;
413
413
  /** User's current gems balance */
@@ -5,6 +5,7 @@ declare class NodeCache {
5
5
  get(key: string): any;
6
6
  set(key: string, value: any, ttlSeconds?: number): void;
7
7
  remove(key: string): void;
8
+ removeByPrefix(prefix: string): void;
8
9
  flushAll(): void;
9
10
  }
10
11
  export { NodeCache };
package/dist/OCache.d.ts CHANGED
@@ -10,6 +10,13 @@ export declare class OCache {
10
10
  static set(oKey: any, o: any, cacheContext: ECacheContext, ttlSeconds?: number): void;
11
11
  static use<T>(oKey: any, cacheContext: ECacheContext, f: () => Promise<T>, ttlSeconds?: number): Promise<T>;
12
12
  static clear(cacheContext: ECacheContext, oKey: any): Promise<void>;
13
+ /**
14
+ * Remove every entry whose string key starts with `oKeyBase` — the bare key
15
+ * AND all per-parameter composite variants (`${oKeyBase}:…` / `${oKeyBase}<id>`).
16
+ * Use when a cache is keyed per parameter (paginated, per-template, per-window):
17
+ * an exact-key `clear(oKeyBase)` would miss every variant. `oKeyBase` must be a string.
18
+ */
19
+ static clearByPrefix(cacheContext: ECacheContext, oKeyBase: string): Promise<void>;
13
20
  static clearContext(cacheContext: ECacheContext): Promise<void>;
14
21
  static clearAll(): Promise<void>;
15
22
  }
@@ -123,7 +123,7 @@ export declare class WSAPIAvatars extends WSAPIMiniGames {
123
123
  *
124
124
  * // Newest-first within each base.
125
125
  * for (const list of byBase.values()) {
126
- * list.sort((a, b) => b.dt_created.localeCompare(a.dt_created));
126
+ * list.sort((a, b) => b.dt_created - a.dt_created);
127
127
  * }
128
128
  *
129
129
  * console.log('[smartico] AI variants by base avatar — render as a carousel under each base');
@@ -832,7 +832,9 @@ export interface TMissionOrBadge {
832
832
  requires_prize_claim?: boolean;
833
833
  /** The date/timestamp indicating when the prize was claimed by the user */
834
834
  prize_claimed_date_ts?: number;
835
- /** Time in hours that took this player to complete mission */
835
+ /** Date-time the mission/badge was completed, as a `"dd/MM/yyyy HH:mm:ss"` string
836
+ * (server local — NOT ISO-8601, so `new Date(complete_date)` will not parse it).
837
+ * Prefer the epoch-ms `complete_date_ts` for date math. */
836
838
  complete_date?: string;
837
839
  /** Time of mission/badge being completed, this property shows the epoch time in UTC */
838
840
  complete_date_ts?: number;
@@ -974,7 +976,8 @@ export interface TInboxMessage {
974
976
  /** Unique identifier of the message. Pass to `getInboxMessageBody`
975
977
  * and the mark / favorite / delete mutations. */
976
978
  message_guid: string;
977
- /** Date when the message was sent (server timestamp). */
979
+ /** Date-time the message was sent, as a `"dd/MM/yyyy HH:mm:ss"` string
980
+ * (server local — NOT ISO-8601, so `new Date(sent_date)` will not parse it). */
978
981
  sent_date: string;
979
982
  /** `true` when the message has been marked read. */
980
983
  read: boolean;
@@ -1688,8 +1691,8 @@ export interface TAvatarCustomized {
1688
1691
  avatar_real_id: number;
1689
1692
  /** Absolute CDN URL of the AI-generated image. Can be passed as `avatar_url` to `setAvatar()`. */
1690
1693
  url: string;
1691
- /** ISO date string of when the variant was generated. */
1692
- dt_created: string;
1694
+ /** Unix-ms timestamp of when the variant was generated. */
1695
+ dt_created: number;
1693
1696
  }
1694
1697
  /**
1695
1698
  * One AI style prompt for avatar customization. Returned by `getAvatarPrompts()`.
@@ -540,5 +540,8 @@ export declare class WSAPIUser extends WSAPIBase {
540
540
  /** Optional push callback; payload is a fixed 10-min / 50-entry refresh on every wallet change (see Subscription model). */
541
541
  onUpdate?: (data: TActivityLog[]) => void;
542
542
  }): Promise<TActivityLog[]>;
543
+ /** @hidden Last window passed to `getActivityLog` with an `onUpdate`, so a push
544
+ * refresh re-fetches the same window and updates its matching composite cache key. */
545
+ private activityLogOnUpdateParams;
543
546
  protected notifyActivityLogUpdate(): Promise<void>;
544
547
  }
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './SmarticoAPI';
4
4
  export * from './WSAPI/WSAPI';
5
5
  export * from './SmarticoGlobal';
6
6
  export * from './CookieStore';
7
+ export type { TAchCategory, TActivityLog, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt, TBonus, TBuyStoreItemResult, TClaimBonusResult, TClan, TClanInfo, TClanJoinResult, TClanTournamentPlayers, TClans, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TLevelCurrent, TMiniGamePlayBatchResult, TMiniGamePlayResult, TMiniGamePrize, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TMissionOrBadgeTask, TRaffle, TRaffleDraw, TRaffleDrawRun, TRaffleOptinResponse, TRafflePrize, TRafflePrizeWinner, TRaffleTicket, TSawHistory, TSegmentCheckResult, TSetAvatarResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, TransformedRaffleClaimPrizeResponse, InboxMarkMessageAction, LeaderBoardDetailsT, LeaderBoardUserT, LeaderBoardsRewardsT, UserLevelExtraCountersT, } from './WSAPI/WSAPITypes';
7
8
  export * from './Analytics';
8
9
  export * from './Core';
9
10
  export * from './UserProfile';
package/dist/index.js CHANGED
@@ -706,6 +706,13 @@ var NodeCache = /*#__PURE__*/function () {
706
706
  delete this.cache[key];
707
707
  }
708
708
  };
709
+ _proto.removeByPrefix = function removeByPrefix(prefix) {
710
+ for (var key in this.cache) {
711
+ if (this.cache.hasOwnProperty(key) && key.indexOf(prefix) === 0) {
712
+ delete this.cache[key];
713
+ }
714
+ }
715
+ };
709
716
  _proto.flushAll = function flushAll() {
710
717
  this.cache = {};
711
718
  if (this.ttlChecker) {
@@ -778,27 +785,49 @@ var OCache = /*#__PURE__*/function () {
778
785
  } catch (e) {
779
786
  return Promise.reject(e);
780
787
  }
781
- };
782
- OCache.clearContext = function clearContext(cacheContext) {
788
+ }
789
+ /**
790
+ * Remove every entry whose string key starts with `oKeyBase` — the bare key
791
+ * AND all per-parameter composite variants (`${oKeyBase}:…` / `${oKeyBase}<id>`).
792
+ * Use when a cache is keyed per parameter (paginated, per-template, per-window):
793
+ * an exact-key `clear(oKeyBase)` would miss every variant. `oKeyBase` must be a string.
794
+ */
795
+ ;
796
+ OCache.clearByPrefix = function clearByPrefix(cacheContext, oKeyBase) {
783
797
  try {
784
798
  var _this2 = this;
799
+ // `set`/`get` build keys as `<context>_<JSON.stringify(oKey)>`; JSON.stringify
800
+ // wraps a string in quotes, so dropping the trailing quote yields a prefix that
801
+ // matches both the bare `"base"` key and every `"base…"` composite key.
802
+ var prefix = cacheContext.toString() + '_' + JSON.stringify(oKeyBase).slice(0, -1);
785
803
  if (_this2.cache[cacheContext]) {
786
- _this2.cache[cacheContext].flushAll();
804
+ _this2.cache[cacheContext].removeByPrefix(prefix);
787
805
  }
788
806
  return Promise.resolve();
789
807
  } catch (e) {
790
808
  return Promise.reject(e);
791
809
  }
792
810
  };
793
- OCache.clearAll = function clearAll() {
811
+ OCache.clearContext = function clearContext(cacheContext) {
794
812
  try {
795
813
  var _this3 = this;
796
- for (var cacheContext in _this3.cache) {
797
- if (_this3.cache.hasOwnProperty(cacheContext)) {
798
- _this3.cache[cacheContext].flushAll();
814
+ if (_this3.cache[cacheContext]) {
815
+ _this3.cache[cacheContext].flushAll();
816
+ }
817
+ return Promise.resolve();
818
+ } catch (e) {
819
+ return Promise.reject(e);
820
+ }
821
+ };
822
+ OCache.clearAll = function clearAll() {
823
+ try {
824
+ var _this4 = this;
825
+ for (var cacheContext in _this4.cache) {
826
+ if (_this4.cache.hasOwnProperty(cacheContext)) {
827
+ _this4.cache[cacheContext].flushAll();
799
828
  }
800
829
  }
801
- _this3.cache = {};
830
+ _this4.cache = {};
802
831
  return Promise.resolve();
803
832
  } catch (e) {
804
833
  return Promise.reject(e);
@@ -1064,7 +1093,7 @@ var StoreItemTransform = function StoreItemTransform(items) {
1064
1093
  id: r.id,
1065
1094
  name: r.itemPublicMeta.name,
1066
1095
  purchase_type: mapPurchaseType$1(r.itemPublicMeta.purchase_type),
1067
- price: r.itemPublicMeta.price,
1096
+ price: Number(r.itemPublicMeta.price),
1068
1097
  image: r.itemPublicMeta.image_url,
1069
1098
  description: r.itemPublicMeta.description,
1070
1099
  ribbon: r.itemPublicMeta.label_tag === 'custom' ? r.itemPublicMeta.custom_label_tag : r.itemPublicMeta.label_tag,
@@ -2461,7 +2490,15 @@ var raffleClaimPrizeResponseTransform = function raffleClaimPrizeResponseTransfo
2461
2490
  /** @group User */
2462
2491
  var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2463
2492
  function WSAPIUser() {
2464
- return _WSAPIBase.apply(this, arguments) || this;
2493
+ var _this;
2494
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2495
+ args[_key] = arguments[_key];
2496
+ }
2497
+ _this = _WSAPIBase.call.apply(_WSAPIBase, [this].concat(args)) || this;
2498
+ /** @hidden Last window passed to `getActivityLog` with an `onUpdate`, so a push
2499
+ * refresh re-fetches the same window and updates its matching composite cache key. */
2500
+ _this.activityLogOnUpdateParams = void 0;
2501
+ return _this;
2465
2502
  }
2466
2503
  _inheritsLoose(WSAPIUser, _WSAPIBase);
2467
2504
  var _proto = WSAPIUser.prototype;
@@ -2658,8 +2695,8 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2658
2695
  */;
2659
2696
  _proto.checkSegmentMatch = function checkSegmentMatch(segment_id) {
2660
2697
  try {
2661
- var _this = this;
2662
- return Promise.resolve(_this.api.coreCheckSegments(_this.userExtId, [segment_id])).then(function (r) {
2698
+ var _this2 = this;
2699
+ return Promise.resolve(_this2.api.coreCheckSegments(_this2.userExtId, [segment_id])).then(function (r) {
2663
2700
  if (r && r.find(function (s) {
2664
2701
  return s.segment_id === segment_id && s.is_matching;
2665
2702
  })) {
@@ -2737,8 +2774,8 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2737
2774
  ;
2738
2775
  _proto.checkSegmentListMatch = function checkSegmentListMatch(segment_ids) {
2739
2776
  try {
2740
- var _this2 = this;
2741
- return Promise.resolve(_this2.api.coreCheckSegments(_this2.userExtId, Array.isArray(segment_ids) ? segment_ids : [segment_ids]));
2777
+ var _this3 = this;
2778
+ return Promise.resolve(_this3.api.coreCheckSegments(_this3.userExtId, Array.isArray(segment_ids) ? segment_ids : [segment_ids]));
2742
2779
  } catch (e) {
2743
2780
  return Promise.reject(e);
2744
2781
  }
@@ -2815,9 +2852,9 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2815
2852
  ;
2816
2853
  _proto.getLevels = function getLevels() {
2817
2854
  try {
2818
- var _this3 = this;
2855
+ var _this4 = this;
2819
2856
  return Promise.resolve(OCache.use(onUpdateContextKey.Levels, exports.ECacheContext.WSAPI, function () {
2820
- return _this3.api.levelsGetT(_this3.userExtId);
2857
+ return _this4.api.levelsGetT(_this4.userExtId);
2821
2858
  }, CACHE_DATA_SEC));
2822
2859
  } catch (e) {
2823
2860
  return Promise.reject(e);
@@ -2897,9 +2934,9 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2897
2934
  ;
2898
2935
  _proto.getCurrentLevel = function getCurrentLevel() {
2899
2936
  try {
2900
- var _this4 = this;
2937
+ var _this5 = this;
2901
2938
  return Promise.resolve(OCache.use(onUpdateContextKey.CurrentLevel, exports.ECacheContext.WSAPI, function () {
2902
- return _this4.api.getLevelCurrent(_this4.userExtId);
2939
+ return _this5.api.getLevelCurrent(_this5.userExtId);
2903
2940
  }, CACHE_DATA_SEC));
2904
2941
  } catch (e) {
2905
2942
  return Promise.reject(e);
@@ -2980,9 +3017,9 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
2980
3017
  ;
2981
3018
  _proto.getUserLevelExtraCounters = function getUserLevelExtraCounters() {
2982
3019
  try {
2983
- var _this5 = this;
3020
+ var _this6 = this;
2984
3021
  return Promise.resolve(OCache.use(onUpdateContextKey.LevelExtraCounters, exports.ECacheContext.WSAPI, function () {
2985
- return _this5.api.getUserGamificationInfoT(_this5.userExtId);
3022
+ return _this6.api.getUserGamificationInfoT(_this6.userExtId);
2986
3023
  }, CACHE_DATA_SEC));
2987
3024
  } catch (e) {
2988
3025
  return Promise.reject(e);
@@ -3060,12 +3097,21 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
3060
3097
  to = _ref.to,
3061
3098
  onUpdate = _ref.onUpdate;
3062
3099
  try {
3063
- var _this6 = this;
3100
+ var _this7 = this;
3101
+ var cacheKey = onUpdateContextKey.ActivityLog + ":" + startTimeSeconds + ":" + endTimeSeconds + ":" + from + ":" + to;
3064
3102
  if (typeof onUpdate === 'function') {
3065
- _this6.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
3103
+ _this7.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
3104
+ // Remember the requested window so a push refresh re-fetches THIS window
3105
+ // and writes the matching composite cache key (see notifyActivityLogUpdate).
3106
+ _this7.activityLogOnUpdateParams = {
3107
+ startTimeSeconds: startTimeSeconds,
3108
+ endTimeSeconds: endTimeSeconds,
3109
+ from: from,
3110
+ to: to
3111
+ };
3066
3112
  }
3067
- return Promise.resolve(OCache.use(onUpdateContextKey.ActivityLog, exports.ECacheContext.WSAPI, function () {
3068
- return _this6.api.getActivityLogT(_this6.userExtId, startTimeSeconds, endTimeSeconds, from, to);
3113
+ return Promise.resolve(OCache.use(cacheKey, exports.ECacheContext.WSAPI, function () {
3114
+ return _this7.api.getActivityLogT(_this7.userExtId, startTimeSeconds, endTimeSeconds, from, to);
3069
3115
  }, CACHE_DATA_SEC));
3070
3116
  } catch (e) {
3071
3117
  return Promise.reject(e);
@@ -3073,11 +3119,19 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
3073
3119
  };
3074
3120
  _proto.notifyActivityLogUpdate = function notifyActivityLogUpdate() {
3075
3121
  try {
3076
- var _this7 = this;
3077
- var startSeconds = Date.now() / 1000 - 600;
3078
- var endSeconds = Date.now() / 1000;
3079
- return Promise.resolve(_this7.api.getActivityLogT(_this7.userExtId, startSeconds, endSeconds, 0, 50)).then(function (payload) {
3080
- _this7.updateEntity(onUpdateContextKey.ActivityLog, payload);
3122
+ var _this8 = this;
3123
+ var params = _this8.activityLogOnUpdateParams;
3124
+ // No consumer has subscribed to a specific window yet — nothing to refresh.
3125
+ if (!params) {
3126
+ return Promise.resolve();
3127
+ }
3128
+ return Promise.resolve(_this8.api.getActivityLogT(_this8.userExtId, params.startTimeSeconds, params.endTimeSeconds, params.from, params.to)).then(function (payload) {
3129
+ var cacheKey = onUpdateContextKey.ActivityLog + ":" + params.startTimeSeconds + ":" + params.endTimeSeconds + ":" + params.from + ":" + params.to;
3130
+ OCache.set(cacheKey, payload, exports.ECacheContext.WSAPI);
3131
+ var onUpdate = _this8.onUpdateCallback.get(onUpdateContextKey.ActivityLog);
3132
+ if (typeof onUpdate === 'function') {
3133
+ onUpdate(payload);
3134
+ }
3081
3135
  });
3082
3136
  } catch (e) {
3083
3137
  return Promise.reject(e);
@@ -5928,7 +5982,10 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5928
5982
  try {
5929
5983
  OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.Jackpots);
5930
5984
  OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.Pots);
5931
- OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.JackpotWinners);
5985
+ // Winners + eligible-games are cached per jp_template_id (composite keys),
5986
+ // so a bare clear misses every variant — clear by prefix.
5987
+ OCache.clearByPrefix(exports.ECacheContext.WSAPI, onUpdateContextKey.JackpotWinners);
5988
+ OCache.clearByPrefix(exports.ECacheContext.WSAPI, onUpdateContextKey.JackpotEligibleGames);
5932
5989
  return Promise.resolve();
5933
5990
  } catch (e) {
5934
5991
  return Promise.reject(e);
@@ -7289,7 +7346,7 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7289
7346
  saw_template_id = _ref2.saw_template_id;
7290
7347
  try {
7291
7348
  var _this2 = this;
7292
- return Promise.resolve(OCache.use(onUpdateContextKey.SAWHistory, exports.ECacheContext.WSAPI, function () {
7349
+ return Promise.resolve(OCache.use(onUpdateContextKey.SAWHistory + ":" + (saw_template_id != null ? saw_template_id : '') + ":" + (limit != null ? limit : '') + ":" + (offset != null ? offset : ''), exports.ECacheContext.WSAPI, function () {
7293
7350
  return _this2.api.getSawWinningHistoryT(_this2.userExtId, limit, offset, saw_template_id);
7294
7351
  }, CACHE_DATA_SEC));
7295
7352
  } catch (e) {
@@ -7915,7 +7972,7 @@ var WSAPIAvatars = /*#__PURE__*/function (_WSAPIMiniGames) {
7915
7972
  *
7916
7973
  * // Newest-first within each base.
7917
7974
  * for (const list of byBase.values()) {
7918
- * list.sort((a, b) => b.dt_created.localeCompare(a.dt_created));
7975
+ * list.sort((a, b) => b.dt_created - a.dt_created);
7919
7976
  * }
7920
7977
  *
7921
7978
  * console.log('[smartico] AI variants by base avatar — render as a carousel under each base');
@@ -9940,11 +9997,11 @@ var WSAPI = /*#__PURE__*/function (_WSAPIInbox) {
9940
9997
  });
9941
9998
  on(exports.ClassId.SAW_AKNOWLEDGE_RESPONSE, function () {
9942
9999
  _this.reloadMiniGameTemplate();
9943
- OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
10000
+ OCache.clearByPrefix(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
9944
10001
  });
9945
10002
  on(exports.ClassId.SAW_DO_SPIN_RESPONSE, function () {
9946
10003
  _this.reloadMiniGameTemplate();
9947
- OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
10004
+ OCache.clearByPrefix(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
9948
10005
  });
9949
10006
  on(exports.ClassId.MISSION_OPTIN_RESPONSE, function () {
9950
10007
  return _this.updateMissions();
@@ -9985,7 +10042,7 @@ var WSAPI = /*#__PURE__*/function (_WSAPIInbox) {
9985
10042
  });
9986
10043
  on(exports.ClassId.SAW_DO_SPIN_BATCH_RESPONSE, function () {
9987
10044
  _this.reloadMiniGameTemplate();
9988
- OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
10045
+ OCache.clearByPrefix(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
9989
10046
  });
9990
10047
  on(exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE, function () {
9991
10048
  return _this.updateRaffles();