@smartico/public-api 0.0.416 → 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.
@@ -0,0 +1,44 @@
1
+ import { UserBalanceType } from './UserBalanceType';
2
+ /** Activity-log entry type as returned on the v2 wire (`type_id`). */
3
+ export declare enum ActivityLogActivities {
4
+ Gems = 1,
5
+ Diamonds = 2,
6
+ Points = 3,
7
+ LevelChanged = 4,
8
+ Bonus = 5,
9
+ PrizeDrop = 6,
10
+ Minigame = 7,
11
+ RaffleTicket = 8,
12
+ Avatar = 9,
13
+ Task = 10,
14
+ Mission = 11,
15
+ Badge = 12,
16
+ TangiblePrize = 13,
17
+ Jackpot = 14,
18
+ Spin = 15,
19
+ NoPrize = 16,
20
+ Leaderboard = 17,
21
+ Tournament = 18,
22
+ ClanTournament = 19
23
+ }
24
+ export declare enum WalletChangeType {
25
+ Add = 1,
26
+ Deduct = 2,
27
+ Set = 3
28
+ }
29
+ export declare enum LevelChangeType {
30
+ Increase = 1,
31
+ Decrease = 2
32
+ }
33
+ /** Wire ctx_1 for Mission / Badge / Task — see SMR-44986. */
34
+ export declare enum AchievementChangeType {
35
+ Complete = 1,
36
+ Unlock = 2
37
+ }
38
+ /** Wire ctx_1 for Jackpot rows — SMR-44986. */
39
+ export declare enum JackpotContextValue {
40
+ Registration = 1,
41
+ Win = 3
42
+ }
43
+ export declare const isWalletActivityTypeId: (typeId: number) => boolean;
44
+ export declare const activityTypeIdToBalanceType: (typeId: ActivityLogActivities) => UserBalanceType;
@@ -0,0 +1,4 @@
1
+ import { UserBalanceType } from './UserBalanceType';
2
+ import { TActivityLogEntry } from '../WSAPI/WSAPITypes';
3
+ export declare const mapActivityLogHistory: (logHistory: unknown[]) => TActivityLogEntry[];
4
+ export declare const resolveWalletDisplayType: (entry: TActivityLogEntry) => UserBalanceType;
@@ -0,0 +1,26 @@
1
+ export interface ActivityLogPublicMeta {
2
+ name?: string;
3
+ image_url?: string;
4
+ image?: string;
5
+ url?: string;
6
+ avatar_url?: string;
7
+ avatar_id?: string;
8
+ icon_url?: string;
9
+ position?: number;
10
+ }
11
+ export interface ActivityLogMeta {
12
+ image_url?: string;
13
+ image?: string;
14
+ url?: string;
15
+ avatar_url?: string;
16
+ avatar_id?: string;
17
+ icon_url?: string;
18
+ name?: string;
19
+ position?: number;
20
+ score?: number;
21
+ user_points_balance_before?: number;
22
+ points_requested?: number;
23
+ user_points_ever?: number;
24
+ public_meta?: ActivityLogPublicMeta;
25
+ public_map?: ActivityLogPublicMeta;
26
+ }
@@ -5,4 +5,6 @@ export interface GetActivityLogRequest extends ProtocolMessage {
5
5
  endTimeSeconds: number;
6
6
  limit: number;
7
7
  offset: number;
8
+ /** Optional v2 filter — {@link ActivityLogActivities} values to include. */
9
+ types?: number[];
8
10
  }
@@ -1,7 +1,10 @@
1
1
  import { ProtocolResponse } from '../Base/ProtocolResponse';
2
2
  import { ActivityLogEntry } from './ActivityLogEntry';
3
- import { TActivityLog } from '../WSAPI/WSAPITypes';
3
+ import { TActivityLog, TActivityLogEntry } from '../WSAPI/WSAPITypes';
4
4
  export interface GetActivityLogResponse extends ProtocolResponse {
5
5
  logHistory: ActivityLogEntry[];
6
6
  }
7
- export declare const ActivityLogTransform: (items: ActivityLogEntry[]) => TActivityLog[];
7
+ /** Maps wire rows to wallet-only {@link TActivityLog} — legacy consumer contract. */
8
+ export declare const ActivityLogTransform: (items: ActivityLogEntry[] | unknown[]) => TActivityLog[];
9
+ /** Maps wire rows to the full v2 {@link TActivityLogEntry} shape. */
10
+ export declare const ActivityLogV2Transform: (items: ActivityLogEntry[] | unknown[]) => TActivityLogEntry[];
@@ -1,5 +1,8 @@
1
1
  export * from './GetActivityLogRequest';
2
2
  export * from './GetActivityLogResponse';
3
3
  export * from './ActivityLogEntry';
4
+ export * from './ActivityLogActivities';
5
+ export * from './ActivityLogMeta';
6
+ export * from './ActivityLogMapper';
4
7
  export * from './PointChangeSourceType';
5
8
  export * from './UserBalanceType';
@@ -11,7 +11,7 @@ import { GetTournamentInfoResponse, GetTournamentsResponse, TournamentRegisterRe
11
11
  import { LeaderBoardDetails, LeaderBoardPeriodType } from './Leaderboard';
12
12
  import { GetLevelMapResponse } from './Level';
13
13
  import { WSAPI } from './WSAPI/WSAPI';
14
- import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TRaffleDraw, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TClans, TClanInfo, TClanJoinResult, TClanTournamentPlayers } from './WSAPI/WSAPITypes';
14
+ import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TActivityLog, TActivityLogEntry, TRaffleDraw, TAvatarDefinition, TAvatarCustomized, TAvatarPrompt, TClans, TClanInfo, TClanJoinResult, TClanTournamentPlayers } from './WSAPI/WSAPITypes';
15
15
  import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
16
16
  import { GetJackpotsPotsResponse, GetJackpotsResponse, JackpotsOptinResponse, JackpotsOptoutResponse } from './Jackpots';
17
17
  import { GetCustomSectionsResponse } from './CustomSections';
@@ -232,6 +232,8 @@ declare class SmarticoAPI {
232
232
  limit: number;
233
233
  }): Promise<GetRaffleWonPrizesResponse>;
234
234
  getActivityLog(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number, limit: number, offset: number): Promise<GetActivityLogResponse>;
235
+ getActivityLogV2(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number, limit: number, offset: number, types?: number[]): Promise<GetActivityLogResponse>;
235
236
  getActivityLogT(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number, from?: number, to?: number): Promise<TActivityLog[]>;
237
+ getActivityLogV2T(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number, from?: number, to?: number, types?: number[]): Promise<TActivityLogEntry[]>;
236
238
  }
237
239
  export { SmarticoAPI, MessageSender };
@@ -36,6 +36,7 @@ export declare enum onUpdateContextKey {
36
36
  CurrentLevel = "currentLevel",
37
37
  InboxUnreadCount = "inboxUnreadCount",
38
38
  ActivityLog = "activityLog",
39
+ ActivityLogV2 = "activityLogV2",
39
40
  AvatarsList = "avatarsList",
40
41
  AvatarsCustomized = "avatarsCustomized",
41
42
  AvatarPrompts = "avatarPrompts"
@@ -7,6 +7,8 @@ import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, Ach
7
7
  import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
8
8
  import { InboxCategories } from '../Inbox/InboxCategories';
9
9
  import { RaffleDrawInstanceState, RaffleDrawTypeExecution, RaffleTicketCapVisualization } from '../Raffle';
10
+ import { ActivityLogActivities } from '../ActivityLog/ActivityLogActivities';
11
+ import { ActivityLogMeta } from '../ActivityLog/ActivityLogMeta';
10
12
  import { PointChangeSourceType } from '../ActivityLog/PointChangeSourceType';
11
13
  import { UserBalanceType } from '../ActivityLog/UserBalanceType';
12
14
  import { SAWGPMarketType } from '../GamePick/MarketsType';
@@ -1698,6 +1700,30 @@ export interface TActivityLog {
1698
1700
  /** Source type ID indicating what triggered this change */
1699
1701
  source_type_id: PointChangeSourceType;
1700
1702
  }
1703
+ /**
1704
+ * Full activity-log row returned by {@link WSAPIUser.getActivityLogV2}.
1705
+ * Includes wallet changes and non-wallet activities (missions, badges, levels, …).
1706
+ */
1707
+ export interface TActivityLogEntry {
1708
+ entry_key: string;
1709
+ create_date: number;
1710
+ user_ext_id: string;
1711
+ crm_brand_id: number;
1712
+ type: UserBalanceType;
1713
+ amount: number;
1714
+ balance: number;
1715
+ total_ever?: number;
1716
+ source_type_id: PointChangeSourceType;
1717
+ activity_type_id?: ActivityLogActivities;
1718
+ context_value_1?: number;
1719
+ meta?: ActivityLogMeta;
1720
+ source_entity_name?: string;
1721
+ source_entity_id?: number;
1722
+ source_reference_id?: number;
1723
+ source_root_id?: number;
1724
+ is_wallet_entry: boolean;
1725
+ is_level_entry?: boolean;
1726
+ }
1701
1727
  /**
1702
1728
  * Result of `_smartico.api.requestRaffleOptin({raffle_id, draw_id, raffle_run_id})`.
1703
1729
  */
@@ -1,4 +1,4 @@
1
- import { TActivityLog, TLevel, TLevelCurrent, TSegmentCheckResult, TUserProfile, UserLevelExtraCountersT } from './WSAPITypes';
1
+ import { TActivityLog, TActivityLogEntry, TLevel, TLevelCurrent, TSegmentCheckResult, TUserProfile, UserLevelExtraCountersT } from './WSAPITypes';
2
2
  import { WSAPIBase } from './WSAPIBase';
3
3
  /** @group User */
4
4
  export declare class WSAPIUser extends WSAPIBase {
@@ -544,4 +544,27 @@ export declare class WSAPIUser extends WSAPIBase {
544
544
  * refresh re-fetches the same window and updates its matching composite cache key. */
545
545
  private activityLogOnUpdateParams;
546
546
  protected notifyActivityLogUpdate(): Promise<void>;
547
+ /**
548
+ * Returns the full activity log (v2) — wallet changes **and** non-wallet
549
+ * activities (missions, badges, levels, tournaments, avatars, …).
550
+ *
551
+ * **Backwards compatibility**: existing integrations should keep using
552
+ * {@link getActivityLog}, which returns wallet-only {@link TActivityLog}
553
+ * rows with the original field contract unchanged.
554
+ *
555
+ * **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
556
+ * (server caps a single response at 50 entries).
557
+ *
558
+ * **Filtering** — pass `types` with {@link ActivityLogActivities} values to
559
+ * request a server-side subset (e.g. missions only). Omit for all activity types.
560
+ *
561
+ * @returns Array of {@link TActivityLogEntry} ordered newest-first.
562
+ */
563
+ getActivityLogV2({ startTimeSeconds, endTimeSeconds, from, to, types, }: {
564
+ startTimeSeconds: number;
565
+ endTimeSeconds: number;
566
+ from: number;
567
+ to: number;
568
+ types?: number[];
569
+ }): Promise<TActivityLogEntry[]>;
547
570
  }
package/dist/index.d.ts CHANGED
@@ -4,7 +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
+ export type { TAchCategory, TActivityLog, TActivityLogEntry, 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';
8
8
  export * from './Analytics';
9
9
  export * from './Core';
10
10
  export * from './UserProfile';