@smartico/public-api 0.0.418 → 0.0.420

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 (35) hide show
  1. package/dist/ActivityLog/ActivityLogActivities.d.ts +2 -1
  2. package/dist/ActivityLog/GetActivityLogRequest.d.ts +1 -1
  3. package/dist/ActivityLog/PointChangeSourceType.d.ts +3 -1
  4. package/dist/Base/ClassId.d.ts +1 -0
  5. package/dist/SmarticoAPI.d.ts +4 -4
  6. package/dist/WSAPI/WSAPIMiniGames.d.ts +4 -4
  7. package/dist/WSAPI/WSAPIUser.d.ts +20 -6
  8. package/dist/index.js +51 -25
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.modern.mjs +51 -25
  11. package/dist/index.modern.mjs.map +1 -1
  12. package/docs/api/README.md +5 -0
  13. package/docs/api/classes/WSAPIJackpots.md +3 -1
  14. package/docs/api/classes/WSAPIMiniGames.md +7 -2
  15. package/docs/api/classes/WSAPIUser.md +49 -0
  16. package/docs/api/enumerations/ActivityLogActivities.md +123 -0
  17. package/docs/api/enumerations/PointChangeSourceType.md +6 -0
  18. package/docs/api/interfaces/ActivityLogMeta.md +37 -0
  19. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelRequest.md +47 -0
  20. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelResponse.md +41 -0
  21. package/docs/api/interfaces/SAWTemplateUI.md +1 -1
  22. package/docs/api/interfaces/TActivityLogEntry.md +100 -0
  23. package/docs/capabilities/getActivityLogV2.md +62 -0
  24. package/docs/capabilities/getJackpotWinners.md +3 -1
  25. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +1 -1
  26. package/docs/native/PROTOCOL.md +33 -1
  27. package/package.json +1 -1
  28. package/src/ActivityLog/ActivityLogActivities.ts +1 -0
  29. package/src/ActivityLog/GetActivityLogRequest.ts +1 -3
  30. package/src/ActivityLog/PointChangeSourceType.ts +2 -0
  31. package/src/Base/ClassId.ts +2 -0
  32. package/src/SmarticoAPI.ts +11 -2
  33. package/src/WSAPI/WSAPIMiniGames.ts +4 -4
  34. package/src/WSAPI/WSAPIUser.ts +37 -11
  35. package/tsconfig.json +4 -1
@@ -172,6 +172,7 @@ var ClassId;
172
172
  */
173
173
  ClassId[ClassId["REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ"] = 1003] = "REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ";
174
174
  ClassId[ClassId["REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP"] = 2003] = "REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP";
175
+ ClassId[ClassId["FORM_SHOW_PUSH"] = 1050] = "FORM_SHOW_PUSH";
175
176
  ClassId[ClassId["CLIENT_DEBUG_REQUEST"] = 77777] = "CLIENT_DEBUG_REQUEST";
176
177
  /*
177
178
  !Important, if adding new messages that are 'acting' on behalf of the client,
@@ -2968,13 +2969,18 @@ class WSAPIUser extends WSAPIBase {
2968
2969
  * `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
2969
2970
  * are epoch seconds bounding the window the server scans.
2970
2971
  *
2972
+ * **Filtering** — optional server-side filters (SMR-52608):
2973
+ * - `types` — {@link ActivityLogActivities} / `type_id` values (e.g. Points=3, Gems=1)
2974
+ * - `src_types` — {@link PointChangeSourceType} / `source_type_id` values
2975
+ * Omit both for an unfiltered window.
2976
+ *
2971
2977
  * **Subscription model (`onUpdate`)**
2972
2978
  * The callback fires when the user's `ach_points_balance`,
2973
2979
  * `ach_gems_balance`, or `ach_diamonds_balance` changes (i.e. whenever a
2974
2980
  * wallet event lands). The pushed payload is a FIXED re-fetch of the
2975
2981
  * **last 10 minutes / first 50 entries** — it does NOT honor the original
2976
- * call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to`. Consumers
2977
- * maintaining a long historical view must re-call `getActivityLog` with
2982
+ * call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to` / filters.
2983
+ * Consumers maintaining a long historical view must re-call `getActivityLog` with
2978
2984
  * their own params after receiving an `onUpdate` notification.
2979
2985
  *
2980
2986
  * **Refresh**
@@ -2998,6 +3004,8 @@ class WSAPIUser extends WSAPIBase {
2998
3004
  * endTimeSeconds: now,
2999
3005
  * from: 0,
3000
3006
  * to: 50,
3007
+ * types: [1], // Gems only (ActivityLogActivities.Gems)
3008
+ * src_types: [11], // Tournament wins only (PointChangeSourceType.Tournament)
3001
3009
  * onUpdate: (refreshed) => {
3002
3010
  * console.log('[smartico] wallet changed — refreshed payload is last 10 min / 50 entries:', refreshed.length, 'rows');
3003
3011
  * // If the consumer is showing a full 30-day view, re-call getActivityLog with the original params here.
@@ -3015,9 +3023,12 @@ class WSAPIUser extends WSAPIBase {
3015
3023
  endTimeSeconds,
3016
3024
  from,
3017
3025
  to,
3026
+ types,
3027
+ src_types,
3018
3028
  onUpdate
3019
3029
  }) {
3020
- const cacheKey = `${onUpdateContextKey.ActivityLog}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}`;
3030
+ var _types$join, _src_types$join;
3031
+ const cacheKey = `${onUpdateContextKey.ActivityLog}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join = types == null ? void 0 : types.join(',')) != null ? _types$join : ''}:${(_src_types$join = src_types == null ? void 0 : src_types.join(',')) != null ? _src_types$join : ''}`;
3021
3032
  if (typeof onUpdate === 'function') {
3022
3033
  this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
3023
3034
  // Remember the requested window so a push refresh re-fetches THIS window
@@ -3026,19 +3037,22 @@ class WSAPIUser extends WSAPIBase {
3026
3037
  startTimeSeconds,
3027
3038
  endTimeSeconds,
3028
3039
  from,
3029
- to
3040
+ to,
3041
+ types,
3042
+ src_types
3030
3043
  };
3031
3044
  }
3032
- return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to), CACHE_DATA_SEC);
3045
+ return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types), CACHE_DATA_SEC);
3033
3046
  }
3034
3047
  async notifyActivityLogUpdate() {
3048
+ var _params$types$join, _params$types, _params$src_types$joi, _params$src_types;
3035
3049
  const params = this.activityLogOnUpdateParams;
3036
3050
  // No consumer has subscribed to a specific window yet — nothing to refresh.
3037
3051
  if (!params) {
3038
3052
  return;
3039
3053
  }
3040
- const payload = await this.api.getActivityLogT(this.userExtId, params.startTimeSeconds, params.endTimeSeconds, params.from, params.to);
3041
- const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}`;
3054
+ const payload = await this.api.getActivityLogT(this.userExtId, params.startTimeSeconds, params.endTimeSeconds, params.from, params.to, params.types, params.src_types);
3055
+ const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}:${(_params$types$join = (_params$types = params.types) == null ? void 0 : _params$types.join(',')) != null ? _params$types$join : ''}:${(_params$src_types$joi = (_params$src_types = params.src_types) == null ? void 0 : _params$src_types.join(',')) != null ? _params$src_types$joi : ''}`;
3042
3056
  OCache.set(cacheKey, payload, ECacheContext.WSAPI);
3043
3057
  const onUpdate = this.onUpdateCallback.get(onUpdateContextKey.ActivityLog);
3044
3058
  if (typeof onUpdate === 'function') {
@@ -3056,8 +3070,10 @@ class WSAPIUser extends WSAPIBase {
3056
3070
  * **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
3057
3071
  * (server caps a single response at 50 entries).
3058
3072
  *
3059
- * **Filtering** — pass `types` with {@link ActivityLogActivities} values to
3060
- * request a server-side subset (e.g. missions only). Omit for all activity types.
3073
+ * **Filtering** — optional server-side filters:
3074
+ * - `types` — {@link ActivityLogActivities} values (`type_id`)
3075
+ * - `src_types` — {@link PointChangeSourceType} values (`source_type_id`)
3076
+ * Omit both for all activity types / sources.
3061
3077
  *
3062
3078
  * @returns Array of {@link TActivityLogEntry} ordered newest-first.
3063
3079
  */
@@ -3066,11 +3082,12 @@ class WSAPIUser extends WSAPIBase {
3066
3082
  endTimeSeconds,
3067
3083
  from,
3068
3084
  to,
3069
- types
3085
+ types,
3086
+ src_types
3070
3087
  }) {
3071
- var _types$join;
3072
- const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join = types == null ? void 0 : types.join(',')) != null ? _types$join : ''}`;
3073
- return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types), CACHE_DATA_SEC);
3088
+ var _types$join2, _src_types$join2;
3089
+ const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join2 = types == null ? void 0 : types.join(',')) != null ? _types$join2 : ''}:${(_src_types$join2 = src_types == null ? void 0 : src_types.join(',')) != null ? _src_types$join2 : ''}`;
3090
+ return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types), CACHE_DATA_SEC);
3074
3091
  }
3075
3092
  }
3076
3093
 
@@ -7306,10 +7323,10 @@ class WSAPIMiniGames extends WSAPIRaffles {
7306
7323
  * (played with `acknowledge: false`), or the
7307
7324
  * `client_request_id` of a
7308
7325
  * {@link getMiniGamesHistory} row.
7309
- * @param options.lose Optional. When `true`, finalises the spin as
7310
- * lost — the prize is not credited and returns
7311
- * to the prize pool (see "Finalising as lost").
7312
- * Omit (or pass `false`) to deliver the win.
7326
+ * @param lose Optional. When `true`, finalises the spin as
7327
+ * lost — the prize is not credited and returns
7328
+ * to the prize pool (see "Finalising as lost").
7329
+ * Omit (or pass `false`) to deliver the win.
7313
7330
  *
7314
7331
  * @example
7315
7332
  * ```ts
@@ -9617,6 +9634,7 @@ var ActivityLogActivities;
9617
9634
  ActivityLogActivities[ActivityLogActivities["Leaderboard"] = 17] = "Leaderboard";
9618
9635
  ActivityLogActivities[ActivityLogActivities["Tournament"] = 18] = "Tournament";
9619
9636
  ActivityLogActivities[ActivityLogActivities["ClanTournament"] = 19] = "ClanTournament";
9637
+ ActivityLogActivities[ActivityLogActivities["Clan"] = 20] = "Clan";
9620
9638
  })(ActivityLogActivities || (ActivityLogActivities = {}));
9621
9639
 
9622
9640
  var UserBalanceType;
@@ -9701,8 +9719,10 @@ var PointChangeSourceType;
9701
9719
  PointChangeSourceType[PointChangeSourceType["WinMiniGame"] = 17] = "WinMiniGame";
9702
9720
  PointChangeSourceType[PointChangeSourceType["API"] = 18] = "API";
9703
9721
  PointChangeSourceType[PointChangeSourceType["DynamicFormula"] = 19] = "DynamicFormula";
9722
+ PointChangeSourceType[PointChangeSourceType["Jackpot"] = 20] = "Jackpot";
9704
9723
  PointChangeSourceType[PointChangeSourceType["Raffle"] = 21] = "Raffle";
9705
9724
  PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
9725
+ PointChangeSourceType[PointChangeSourceType["Clan"] = 23] = "Clan";
9706
9726
  })(PointChangeSourceType || (PointChangeSourceType = {}));
9707
9727
 
9708
9728
  const avatarDefinitionTransform = (items, avatarDomain) => {
@@ -10878,16 +10898,20 @@ class SmarticoAPI {
10878
10898
  const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_WON_PRIZES_REQUEST, props);
10879
10899
  return await this.send(message, ClassId.RAF_GET_WON_PRIZES_RESPONSE);
10880
10900
  }
10881
- async getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
10882
- const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
10901
+ async getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types) {
10902
+ const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, _extends({
10883
10903
  startTimeSeconds: Math.floor(startTimeSeconds),
10884
10904
  endTimeSeconds: Math.floor(endTimeSeconds),
10885
10905
  limit,
10886
10906
  offset
10887
- });
10907
+ }, types ? {
10908
+ types
10909
+ } : {}, src_types ? {
10910
+ src_types
10911
+ } : {}));
10888
10912
  return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
10889
10913
  }
10890
- async getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types) {
10914
+ async getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types) {
10891
10915
  const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, _extends({
10892
10916
  startTimeSeconds: Math.floor(startTimeSeconds),
10893
10917
  endTimeSeconds: Math.floor(endTimeSeconds),
@@ -10895,18 +10919,20 @@ class SmarticoAPI {
10895
10919
  offset
10896
10920
  }, types ? {
10897
10921
  types
10922
+ } : {}, src_types ? {
10923
+ src_types
10898
10924
  } : {}));
10899
10925
  return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
10900
10926
  }
10901
- async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50) {
10927
+ async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types, src_types) {
10902
10928
  const limit = to - from > 50 ? 50 : to - from;
10903
10929
  const offset = from;
10904
- return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).logHistory);
10930
+ return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory);
10905
10931
  }
10906
- async getActivityLogV2T(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types) {
10932
+ async getActivityLogV2T(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types, src_types) {
10907
10933
  const limit = to - from > 50 ? 50 : to - from;
10908
10934
  const offset = from;
10909
- return ActivityLogV2Transform((await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types)).logHistory);
10935
+ return ActivityLogV2Transform((await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory);
10910
10936
  }
10911
10937
  }
10912
10938