@smartico/public-api 0.0.415 → 0.0.417

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.
@@ -2,6 +2,7 @@ import { CoreUtils } from '../Core';
2
2
  import { ECacheContext, OCache } from '../OCache';
3
3
  import {
4
4
  TActivityLog,
5
+ TActivityLogEntry,
5
6
  TLevel,
6
7
  TLevelCurrent,
7
8
  TSegmentCheckResult,
@@ -639,4 +640,43 @@ export class WSAPIUser extends WSAPIBase {
639
640
  onUpdate(payload);
640
641
  }
641
642
  }
643
+
644
+ /**
645
+ * Returns the full activity log (v2) — wallet changes **and** non-wallet
646
+ * activities (missions, badges, levels, tournaments, avatars, …).
647
+ *
648
+ * **Backwards compatibility**: existing integrations should keep using
649
+ * {@link getActivityLog}, which returns wallet-only {@link TActivityLog}
650
+ * rows with the original field contract unchanged.
651
+ *
652
+ * **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
653
+ * (server caps a single response at 50 entries).
654
+ *
655
+ * **Filtering** — pass `types` with {@link ActivityLogActivities} values to
656
+ * request a server-side subset (e.g. missions only). Omit for all activity types.
657
+ *
658
+ * @returns Array of {@link TActivityLogEntry} ordered newest-first.
659
+ */
660
+ public async getActivityLogV2({
661
+ startTimeSeconds,
662
+ endTimeSeconds,
663
+ from,
664
+ to,
665
+ types,
666
+ }: {
667
+ startTimeSeconds: number;
668
+ endTimeSeconds: number;
669
+ from: number;
670
+ to: number;
671
+ types?: number[];
672
+ }): Promise<TActivityLogEntry[]> {
673
+ const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${types?.join(',') ?? ''}`;
674
+
675
+ return await OCache.use(
676
+ cacheKey,
677
+ ECacheContext.WSAPI,
678
+ () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types),
679
+ CACHE_DATA_SEC,
680
+ );
681
+ }
642
682
  }
package/src/index.ts CHANGED
@@ -12,7 +12,7 @@ export * from './CookieStore';
12
12
  // AchRelatedGame, BonusStatus, BonusMetaMap, BonusTemplateMetaMap — are intentionally
13
13
  // omitted; import those from their domain module.)
14
14
  export type {
15
- TAchCategory, TActivityLog, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt,
15
+ TAchCategory, TActivityLog, TActivityLogEntry, TAvatarCustomized, TAvatarDefinition, TAvatarPrompt,
16
16
  TBonus, TBuyStoreItemResult, TClaimBonusResult, TClan, TClanInfo, TClanJoinResult,
17
17
  TClanTournamentPlayers, TClans, TGetTranslations, TInboxMessage, TInboxMessageBody,
18
18
  TLevel, TLevelCurrent, TMiniGamePlayBatchResult, TMiniGamePlayResult, TMiniGamePrize,