@smartico/public-api 0.0.325 → 0.0.327

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 (48) hide show
  1. package/dist/Base/ClassId.d.ts +2 -0
  2. package/dist/CustomSections/AchCustomSection.d.ts +2 -1
  3. package/dist/CustomSections/UICustomSection.d.ts +1 -0
  4. package/dist/MiniGames/AttemptPeriodType.d.ts +6 -0
  5. package/dist/MiniGames/SAWPrize.d.ts +2 -0
  6. package/dist/MiniGames/index.d.ts +1 -0
  7. package/dist/PointsHistory/GetPointsHistoryRequest.d.ts +6 -0
  8. package/dist/PointsHistory/GetPointsHistoryResponse.d.ts +7 -0
  9. package/dist/PointsHistory/PointChangeSourceType.d.ts +19 -0
  10. package/dist/PointsHistory/PointsHistoryLog.d.ts +21 -0
  11. package/dist/PointsHistory/UserBalanceType.d.ts +5 -0
  12. package/dist/PointsHistory/index.d.ts +5 -0
  13. package/dist/SmarticoAPI.d.ts +4 -1
  14. package/dist/WSAPI/WSAPI.d.ts +34 -1
  15. package/dist/WSAPI/WSAPITypes.d.ts +30 -2
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +224 -74
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.modern.mjs +128 -3
  20. package/dist/index.modern.mjs.map +1 -1
  21. package/docs/README.md +4 -0
  22. package/docs/classes/WSAPI.md +41 -0
  23. package/docs/enums/AchCustomSectionType.md +6 -0
  24. package/docs/enums/AttemptPeriodType.md +25 -0
  25. package/docs/enums/PointChangeSourceType.md +103 -0
  26. package/docs/enums/UserBalanceType.md +19 -0
  27. package/docs/interfaces/SAWPrize.md +6 -0
  28. package/docs/interfaces/TMiniGamePrize.md +8 -0
  29. package/docs/interfaces/TPointsHistoryLog.md +68 -0
  30. package/docs/interfaces/TUICustomSection.md +8 -0
  31. package/package.json +1 -1
  32. package/src/Base/ClassId.ts +3 -0
  33. package/src/CustomSections/AchCustomSection.ts +1 -0
  34. package/src/CustomSections/UICustomSection.ts +7 -0
  35. package/src/MiniGames/AttemptPeriodType.ts +6 -0
  36. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  37. package/src/MiniGames/SAWPrize.ts +2 -0
  38. package/src/MiniGames/index.ts +2 -1
  39. package/src/PointsHistory/GetPointsHistoryRequest.ts +8 -0
  40. package/src/PointsHistory/GetPointsHistoryResponse.ts +39 -0
  41. package/src/PointsHistory/PointChangeSourceType.ts +20 -0
  42. package/src/PointsHistory/PointsHistoryLog.ts +24 -0
  43. package/src/PointsHistory/UserBalanceType.ts +6 -0
  44. package/src/PointsHistory/index.ts +6 -0
  45. package/src/SmarticoAPI.ts +29 -0
  46. package/src/WSAPI/WSAPI.ts +64 -2
  47. package/src/WSAPI/WSAPITypes.ts +30 -2
  48. package/src/index.ts +2 -1
package/docs/README.md CHANGED
@@ -13,6 +13,7 @@
13
13
  - [JackPotTemparature](enums/JackPotTemparature.md)
14
14
  - [JackpotType](enums/JackpotType.md)
15
15
  - [LeaderBoardPeriodType](enums/LeaderBoardPeriodType.md)
16
+ - [AttemptPeriodType](enums/AttemptPeriodType.md)
16
17
  - [PrizeModifiers](enums/PrizeModifiers.md)
17
18
  - [SAWAcknowledgeType](enums/SAWAcknowledgeType.md)
18
19
  - [SAWAcknowledgeTypeName](enums/SAWAcknowledgeTypeName.md)
@@ -31,6 +32,8 @@
31
32
  - [SAWWheelLayout](enums/SAWWheelLayout.md)
32
33
  - [SAWWinSoundType](enums/SAWWinSoundType.md)
33
34
  - [AchievementAvailabilityStatus](enums/AchievementAvailabilityStatus.md)
35
+ - [PointChangeSourceType](enums/PointChangeSourceType.md)
36
+ - [UserBalanceType](enums/UserBalanceType.md)
34
37
  - [RaffleDrawInstanceState](enums/RaffleDrawInstanceState.md)
35
38
  - [RaffleDrawTypeExecution](enums/RaffleDrawTypeExecution.md)
36
39
  - [BuyStoreItemErrorCode](enums/BuyStoreItemErrorCode.md)
@@ -145,6 +148,7 @@
145
148
  - [TRaffleDraw](interfaces/TRaffleDraw.md)
146
149
  - [TRaffleDrawRun](interfaces/TRaffleDrawRun.md)
147
150
  - [TransformedRaffleClaimPrizeResponse](interfaces/TransformedRaffleClaimPrizeResponse.md)
151
+ - [TPointsHistoryLog](interfaces/TPointsHistoryLog.md)
148
152
 
149
153
  ## General API
150
154
 
@@ -986,6 +986,47 @@ _smartico.api.reportClickEvent({
986
986
 
987
987
  ___
988
988
 
989
+ ### getPointsHistory
990
+
991
+ ▸ **getPointsHistory**(`«destructured»`): `Promise`\<[`TPointsHistoryLog`](../interfaces/TPointsHistoryLog.md)[]\>
992
+
993
+ Returns the points history for a user within a specified time range.
994
+ The response includes both points changes and gems/diamonds changes.
995
+ Each log entry contains information about the change amount, balance, and source.
996
+ The returned list is cached for 30 seconds.
997
+ You can pass the onUpdate callback as a parameter, it will be called every time the points history is updated and will provide the updated list of points history logs for the last 10 minutes.
998
+
999
+ **Example**:
1000
+ ```
1001
+ const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
1002
+ const endTime = Math.floor(Date.now() / 1000); // now
1003
+
1004
+ _smartico.api.getPointsHistory({
1005
+ startTimeSeconds: startTime,
1006
+ endTimeSeconds: endTime,
1007
+ onUpdate: (data) => console.log('Updated:', data)
1008
+ }).then((result) => {
1009
+ console.log(result);
1010
+ });
1011
+ ```
1012
+
1013
+ **Visitor mode: not supported**
1014
+
1015
+ #### Parameters
1016
+
1017
+ | Name | Type |
1018
+ | :------ | :------ |
1019
+ | `«destructured»` | `Object` |
1020
+ | › `startTimeSeconds` | `number` |
1021
+ | › `endTimeSeconds` | `number` |
1022
+ | › `onUpdate?` | (`data`: [`TPointsHistoryLog`](../interfaces/TPointsHistoryLog.md)[]) => `void` |
1023
+
1024
+ #### Returns
1025
+
1026
+ `Promise`\<[`TPointsHistoryLog`](../interfaces/TPointsHistoryLog.md)[]\>
1027
+
1028
+ ___
1029
+
989
1030
  ### jackpotGet
990
1031
 
991
1032
  ▸ **jackpotGet**(`filter?`): `Promise`\<[`JackpotDetails`](../interfaces/JackpotDetails.md)[]\>
@@ -71,3 +71,9 @@ ___
71
71
  ### RAFFLE
72
72
 
73
73
  • **RAFFLE** = ``13``
74
+
75
+ ___
76
+
77
+ ### BADGES
78
+
79
+ • **BADGES** = ``14``
@@ -0,0 +1,25 @@
1
+ # Enumeration: AttemptPeriodType
2
+
3
+ ## Enumeration Members
4
+
5
+ ### FromLastAttempt
6
+
7
+ • **FromLastAttempt** = ``1``
8
+
9
+ ___
10
+
11
+ ### CalendarDaysUTC
12
+
13
+ • **CalendarDaysUTC** = ``2``
14
+
15
+ ___
16
+
17
+ ### CalendarDaysUserTimeZone
18
+
19
+ • **CalendarDaysUserTimeZone** = ``3``
20
+
21
+ ___
22
+
23
+ ### Lifetime
24
+
25
+ • **Lifetime** = ``4``
@@ -0,0 +1,103 @@
1
+ # Enumeration: PointChangeSourceType
2
+
3
+ ## Enumeration Members
4
+
5
+ ### Journey
6
+
7
+ • **Journey** = ``1``
8
+
9
+ ___
10
+
11
+ ### AchievementTaskCompletion
12
+
13
+ • **AchievementTaskCompletion** = ``2``
14
+
15
+ ___
16
+
17
+ ### AchievementCompletion
18
+
19
+ • **AchievementCompletion** = ``3``
20
+
21
+ ___
22
+
23
+ ### LevelsStructureChange
24
+
25
+ • **LevelsStructureChange** = ``4``
26
+
27
+ ___
28
+
29
+ ### StorePurchase
30
+
31
+ • **StorePurchase** = ``5``
32
+
33
+ ___
34
+
35
+ ### ManualAdjustment
36
+
37
+ • **ManualAdjustment** = ``6``
38
+
39
+ ___
40
+
41
+ ### Leaderboard
42
+
43
+ • **Leaderboard** = ``7``
44
+
45
+ ___
46
+
47
+ ### Tournament
48
+
49
+ • **Tournament** = ``11``
50
+
51
+ ___
52
+
53
+ ### AutomationRule
54
+
55
+ • **AutomationRule** = ``12``
56
+
57
+ ___
58
+
59
+ ### TournamentRegistration
60
+
61
+ • **TournamentRegistration** = ``13``
62
+
63
+ ___
64
+
65
+ ### TournamentRegistrationCancellation
66
+
67
+ • **TournamentRegistrationCancellation** = ``14``
68
+
69
+ ___
70
+
71
+ ### RefundPoints
72
+
73
+ • **RefundPoints** = ``15``
74
+
75
+ ___
76
+
77
+ ### PlayMiniGame
78
+
79
+ • **PlayMiniGame** = ``16``
80
+
81
+ ___
82
+
83
+ ### WinMiniGame
84
+
85
+ • **WinMiniGame** = ``17``
86
+
87
+ ___
88
+
89
+ ### API
90
+
91
+ • **API** = ``18``
92
+
93
+ ___
94
+
95
+ ### DynamicFormula
96
+
97
+ • **DynamicFormula** = ``19``
98
+
99
+ ___
100
+
101
+ ### Raffle
102
+
103
+ • **Raffle** = ``21``
@@ -0,0 +1,19 @@
1
+ # Enumeration: UserBalanceType
2
+
3
+ ## Enumeration Members
4
+
5
+ ### Points
6
+
7
+ • **Points** = ``0``
8
+
9
+ ___
10
+
11
+ ### Gems
12
+
13
+ • **Gems** = ``1``
14
+
15
+ ___
16
+
17
+ ### Diamonds
18
+
19
+ • **Diamonds** = ``2``
@@ -105,3 +105,9 @@ ___
105
105
  #### Index signature
106
106
 
107
107
  ▪ [key: `string`]: `any`
108
+
109
+ ___
110
+
111
+ ### max\_give\_period\_type\_id
112
+
113
+ • `Optional` **max\_give\_period\_type\_id**: [`AttemptPeriodType`](../enums/AttemptPeriodType.md)
@@ -242,3 +242,11 @@ ___
242
242
  • `Optional` **requirements\_to\_get\_prize**: `string`
243
243
 
244
244
  Requirements to claim the prize (lootbox specific)
245
+
246
+ ___
247
+
248
+ ### max\_give\_period\_type\_id
249
+
250
+ • `Optional` **max\_give\_period\_type\_id**: [`AttemptPeriodType`](../enums/AttemptPeriodType.md)
251
+
252
+ The period type for the prize to be given: Time from last attempt, Calendar days UTC, Calendar days user time zone, Lifetime
@@ -0,0 +1,68 @@
1
+ # Interface: TPointsHistoryLog
2
+
3
+ TPointsHistoryLog describes a unified history log entry for points, gems, or diamonds changes.
4
+ The structure is the same regardless of balance type, making it easy to iterate and display.
5
+
6
+ ## Properties
7
+
8
+ ### create\_date
9
+
10
+ • **create\_date**: `number`
11
+
12
+ Date when the change was created (epoch timestamp in seconds)
13
+
14
+ ___
15
+
16
+ ### user\_ext\_id
17
+
18
+ • **user\_ext\_id**: `string`
19
+
20
+ External user ID
21
+
22
+ ___
23
+
24
+ ### crm\_brand\_id
25
+
26
+ • **crm\_brand\_id**: `number`
27
+
28
+ CRM brand ID
29
+
30
+ ___
31
+
32
+ ### type
33
+
34
+ • **type**: [`UserBalanceType`](../enums/UserBalanceType.md)
35
+
36
+ Type of balance: Points = 0, Gems = 1, Diamonds = 2
37
+
38
+ ___
39
+
40
+ ### amount
41
+
42
+ • **amount**: `number`
43
+
44
+ Amount changed (positive or negative)
45
+
46
+ ___
47
+
48
+ ### balance
49
+
50
+ • **balance**: `number`
51
+
52
+ Current balance after this change
53
+
54
+ ___
55
+
56
+ ### total\_ever
57
+
58
+ • `Optional` **total\_ever**: `number`
59
+
60
+ Total ever collected (only relevant for type points)
61
+
62
+ ___
63
+
64
+ ### source\_type\_id
65
+
66
+ • **source\_type\_id**: [`PointChangeSourceType`](../enums/PointChangeSourceType.md)
67
+
68
+ Source type ID indicating what triggered this change
@@ -119,3 +119,11 @@ ___
119
119
  • `Optional` **liquid\_template**: `number`
120
120
 
121
121
  Liquid template id to be used for Liquid templates
122
+
123
+ ___
124
+
125
+ ### ach\_category\_ids
126
+
127
+ • `Optional` **ach\_category\_ids**: `number`[]
128
+
129
+ List of IDs of the categories where the badge item is assigned, information about categories can be retrieved with getAchCategories method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.325",
3
+ "version": "0.0.327",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -99,6 +99,9 @@ export enum ClassId {
99
99
  GET_RELATED_ACH_N_TOURNAMENTS_REQUEST = 543,
100
100
  GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE = 544,
101
101
 
102
+ GET_POINT_HISTORY_REQUEST = 545,
103
+ GET_POINT_HISTORY_RESPONSE = 546,
104
+
102
105
  /*
103
106
  !Important, if adding new messages that are 'acting' on behalf of the client,
104
107
  you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
@@ -11,6 +11,7 @@ export enum AchCustomSectionType {
11
11
  LOOTBOX_CALENDAR_DAYS = 11,
12
12
  TREASURE_HUNT = 12,
13
13
  RAFFLE = 13,
14
+ BADGES = 14,
14
15
  }
15
16
 
16
17
  export enum AchCustomLayoutTheme {
@@ -23,6 +23,7 @@ export interface UICustomSection {
23
23
  ach_tournament_id?: number;
24
24
  show_raw_data?: boolean;
25
25
  liquid_template?: number;
26
+ ach_category_ids?: number[];
26
27
  }
27
28
 
28
29
  export const UICustomSectionTransform = (response: GetCustomSectionsResponse): TUICustomSection[] => {
@@ -54,6 +55,12 @@ export const UICustomSectionTransform = (response: GetCustomSectionsResponse): T
54
55
  }
55
56
  : {}
56
57
  ),
58
+ ...(r.section_type_id === AchCustomSectionType.BADGES
59
+ ? {
60
+ ach_category_ids: r.ach_category_ids,
61
+ }
62
+ : {}
63
+ ),
57
64
  };
58
65
 
59
66
  items.push(x);
@@ -0,0 +1,6 @@
1
+ export enum AttemptPeriodType {
2
+ FromLastAttempt = 1,
3
+ CalendarDaysUTC = 2,
4
+ CalendarDaysUserTimeZone = 3,
5
+ Lifetime = 4,
6
+ }
@@ -80,6 +80,7 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
80
80
  allow_split_decimal: p.saw_prize_ui_definition.allow_split_decimal,
81
81
  hide_prize_from_history: p.saw_prize_ui_definition.hide_prize_from_history,
82
82
  requirements_to_get_prize: p.saw_prize_ui_definition.requirements_to_get_prize,
83
+ max_give_period_type_id: p.max_give_period_type_id,
83
84
  };
84
85
  return y;
85
86
  }),
@@ -1,3 +1,4 @@
1
+ import { AttemptPeriodType } from './AttemptPeriodType';
1
2
  import { SAWPrizeType } from './SAWPrizeType';
2
3
  import { SAWPrizeUI } from './SAWPrizeUI';
3
4
 
@@ -19,4 +20,5 @@ export interface SAWPrize {
19
20
  is_surcharge?: boolean;
20
21
  is_deleted?: boolean;
21
22
  prize_details_json?: {[key: string]: any};
23
+ max_give_period_type_id?: AttemptPeriodType;
22
24
  }
@@ -28,4 +28,5 @@ export * from './SAWGameLayout';
28
28
  export * from './PrizeModifiers';
29
29
  export * from './SAWWheelLayout';
30
30
  export * from './SAWGameDifficulty'
31
- export * from './SAWExposeUserSpinId';
31
+ export * from './SAWExposeUserSpinId';
32
+ export * from './AttemptPeriodType';
@@ -0,0 +1,8 @@
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
+
3
+ export interface GetPointsHistoryRequest extends ProtocolMessage {
4
+ userId: number;
5
+ startTimeSeconds: number;
6
+ endTimeSeconds: number;
7
+ }
8
+
@@ -0,0 +1,39 @@
1
+ import { ProtocolResponse } from '../Base/ProtocolResponse';
2
+ import { PointsHistoryLog } from './PointsHistoryLog';
3
+ import { TPointsHistoryLog } from '../WSAPI/WSAPITypes';
4
+ import { UserBalanceType } from './UserBalanceType';
5
+
6
+ export interface GetPointsHistoryResponse extends ProtocolResponse {
7
+ logHistory: PointsHistoryLog[];
8
+ }
9
+
10
+ export const PointsHistoryTransform = (items: PointsHistoryLog[]): TPointsHistoryLog[] => {
11
+ if (!items) {
12
+ return [];
13
+ }
14
+
15
+ return items.map((item: any): TPointsHistoryLog => {
16
+ const itemTransformed: Partial<TPointsHistoryLog> = {
17
+ create_date: item.create_date,
18
+ user_ext_id: item.user_ext_id,
19
+ crm_brand_id: item.crm_brand_id,
20
+ source_type_id: item.source_type_id,
21
+ }
22
+
23
+ if (item.type === UserBalanceType.Diamonds || item.type === UserBalanceType.Gems) {
24
+ itemTransformed.type = item.type;
25
+ itemTransformed.amount = item.amount;
26
+ itemTransformed.balance = item.balance;
27
+ }
28
+
29
+ if (item.type === UserBalanceType.Points) {
30
+ itemTransformed.type = UserBalanceType.Points;
31
+ itemTransformed.amount = item.points_collected;
32
+ itemTransformed.balance = item.user_points_balance;
33
+ itemTransformed.total_ever = item.user_points_ever;
34
+ }
35
+
36
+ return itemTransformed as TPointsHistoryLog;
37
+ });
38
+ };
39
+
@@ -0,0 +1,20 @@
1
+ export enum PointChangeSourceType {
2
+ Journey = 1,
3
+ AchievementTaskCompletion = 2,
4
+ AchievementCompletion = 3,
5
+ LevelsStructureChange = 4,
6
+ StorePurchase = 5,
7
+ ManualAdjustment = 6,
8
+ Leaderboard = 7,
9
+ Tournament = 11,
10
+ AutomationRule = 12,
11
+ TournamentRegistration = 13,
12
+ TournamentRegistrationCancellation = 14,
13
+ RefundPoints = 15,
14
+ PlayMiniGame = 16,
15
+ WinMiniGame = 17,
16
+ API = 18,
17
+ DynamicFormula = 19,
18
+ Raffle = 21,
19
+ }
20
+
@@ -0,0 +1,24 @@
1
+ import { PointChangeSourceType } from './PointChangeSourceType';
2
+ import { UserBalanceType } from './UserBalanceType';
3
+
4
+ export interface PointsLog {
5
+ create_date: number;
6
+ user_ext_id: string;
7
+ crm_brand_id: number;
8
+ points_collected: number;
9
+ user_points_ever: number;
10
+ user_points_balance: number;
11
+ source_type_id: PointChangeSourceType;
12
+ }
13
+
14
+ export interface GemsDiamondsLog {
15
+ create_date: number;
16
+ user_ext_id: string;
17
+ crm_brand_id: number;
18
+ type: UserBalanceType;
19
+ amount: number;
20
+ balance: number;
21
+ source_type_id: PointChangeSourceType;
22
+ }
23
+
24
+ export type PointsHistoryLog = PointsLog | GemsDiamondsLog;
@@ -0,0 +1,6 @@
1
+ export enum UserBalanceType {
2
+ Points = 0,
3
+ Gems = 1,
4
+ Diamonds = 2
5
+ }
6
+
@@ -0,0 +1,6 @@
1
+ export * from './GetPointsHistoryRequest';
2
+ export * from './GetPointsHistoryResponse';
3
+ export * from './PointsHistoryLog';
4
+ export * from './PointChangeSourceType';
5
+ export * from './UserBalanceType';
6
+
@@ -98,6 +98,7 @@ import {
98
98
  TBonus,
99
99
  TRaffle,
100
100
  TLevelCurrent,
101
+ TPointsHistoryLog,
101
102
  } from './WSAPI/WSAPITypes';
102
103
  import { getLeaderBoardTransform } from './Leaderboard/LeaderBoards';
103
104
  import { GetAchievementsUserInfoResponse } from './Core/GetAchievementsUserInfoResponse';
@@ -124,6 +125,7 @@ import { GetRelatedAchTourRequest } from './Missions/GetRelatedAchTourRequest';
124
125
  import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
125
126
  import { GetRafflesResponse, raffleTransform } from './Raffle/GetRafflesResponse';
126
127
  import { GetRafflesRequest } from './Raffle/GetRafflesRequest';
128
+ import { GetPointsHistoryRequest, GetPointsHistoryResponse, PointsHistoryTransform } from './PointsHistory';
127
129
  import { InboxCategories } from './Inbox/InboxCategories';
128
130
  import { GetDrawRunRequest, GetDrawRunResponse, GetRaffleDrawRunsHistoryRequest, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeRequest, RaffleClaimPrizeResponse } from './Raffle';
129
131
  import { GetJackpotWinnersResponse, GetJackpotWinnersResponseTransform, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
@@ -1323,6 +1325,33 @@ class SmarticoAPI {
1323
1325
  return await this.send<RaffleClaimPrizeResponse>(message, ClassId.RAF_CLAIM_PRIZE_RESPONSE);
1324
1326
 
1325
1327
  }
1328
+
1329
+ public async getPointsHistory(
1330
+ user_ext_id: string,
1331
+ startTimeSeconds: number,
1332
+ endTimeSeconds: number,
1333
+ ): Promise<GetPointsHistoryResponse> {
1334
+ const message = this.buildMessage<GetPointsHistoryRequest, GetPointsHistoryResponse>(
1335
+ user_ext_id,
1336
+ ClassId.GET_POINT_HISTORY_REQUEST,
1337
+ {
1338
+ startTimeSeconds,
1339
+ endTimeSeconds,
1340
+ },
1341
+ );
1342
+
1343
+ return await this.send<GetPointsHistoryResponse>(message, ClassId.GET_POINT_HISTORY_RESPONSE);
1344
+ }
1345
+
1346
+ public async getPointsHistoryT(
1347
+ user_ext_id: string,
1348
+ startTimeSeconds: number,
1349
+ endTimeSeconds: number,
1350
+ ): Promise<TPointsHistoryLog[]> {
1351
+ return PointsHistoryTransform(
1352
+ (await this.getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds)).logHistory,
1353
+ );
1354
+ }
1326
1355
  }
1327
1356
 
1328
1357
  export { SmarticoAPI, MessageSender };
@@ -36,7 +36,8 @@ import {
36
36
  TRaffleDraw,
37
37
  TRaffleDrawRun,
38
38
  TransformedRaffleClaimPrizeResponse,
39
- TLevelCurrent
39
+ TLevelCurrent,
40
+ TPointsHistoryLog,
40
41
  } from './WSAPITypes';
41
42
  import { LeaderBoardPeriodType } from '../Leaderboard';
42
43
  import {
@@ -92,6 +93,7 @@ enum onUpdateContextKey {
92
93
  JackpotEligibleGames = 'jackpotEligibleGames',
93
94
  CurrentLevel = 'currentLevel',
94
95
  InboxUnreadCount = 'inboxUnreadCount',
96
+ PointsHistory = 'pointsHistory',
95
97
  }
96
98
 
97
99
  /** @group General API */
@@ -143,10 +145,13 @@ export class WSAPI {
143
145
  this.updateInboxUnreadCount(res.unread_count);
144
146
  }
145
147
  });
146
- on(ClassId.CLIENT_PUBLIC_PROPERTIES_CHANGED_EVENT, (data: { props: { core_inbox_unread_count: number } }) => {
148
+ on(ClassId.CLIENT_PUBLIC_PROPERTIES_CHANGED_EVENT, (data: { props: { core_inbox_unread_count?: number; ach_points_balance?: number; ach_gems_balance?: number; ach_diamonds_balance?: number } }) => {
147
149
  if (data?.props?.core_inbox_unread_count !== undefined && data?.props?.core_inbox_unread_count !== null) {
148
150
  this.updateInboxUnreadCount(data.props.core_inbox_unread_count);
149
151
  }
152
+ if (data?.props?.ach_points_balance !== undefined || data?.props?.ach_gems_balance !== undefined || data?.props?.ach_diamonds_balance !== undefined) {
153
+ this.notifyPointsHistoryUpdate();
154
+ }
150
155
  });
151
156
  }
152
157
  }
@@ -1006,6 +1011,55 @@ export class WSAPI {
1006
1011
  this.api.reportEngagementAction(null, engagement_uid, activityType, action);
1007
1012
  }
1008
1013
 
1014
+ /**
1015
+ * Returns the points history for a user within a specified time range.
1016
+ * The response includes both points changes and gems/diamonds changes.
1017
+ * Each log entry contains information about the change amount, balance, and source.
1018
+ * The returned list is cached for 30 seconds.
1019
+ * You can pass the onUpdate callback as a parameter, it will be called every time the points history is updated and will provide the updated list of points history logs for the last 10 minutes.
1020
+ *
1021
+ * **Example**:
1022
+ * ```
1023
+ * const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
1024
+ * const endTime = Math.floor(Date.now() / 1000); // now
1025
+ *
1026
+ * _smartico.api.getPointsHistory({
1027
+ * startTimeSeconds: startTime,
1028
+ * endTimeSeconds: endTime,
1029
+ * onUpdate: (data) => console.log('Updated:', data)
1030
+ * }).then((result) => {
1031
+ * console.log(result);
1032
+ * });
1033
+ * ```
1034
+ *
1035
+ * **Visitor mode: not supported**
1036
+ *
1037
+ * @param params.startTimeSeconds - Start time in seconds (epoch timestamp)
1038
+ * @param params.endTimeSeconds - End time in seconds (epoch timestamp)
1039
+ * @param params.onUpdate - Optional callback function that will be called when the points history is updated
1040
+ */
1041
+ public async getPointsHistory({
1042
+ startTimeSeconds,
1043
+ endTimeSeconds,
1044
+ onUpdate,
1045
+ }: {
1046
+ startTimeSeconds: number;
1047
+ endTimeSeconds: number;
1048
+ onUpdate?: (data: TPointsHistoryLog[]) => void;
1049
+ }): Promise<TPointsHistoryLog[]> {
1050
+
1051
+ if (onUpdate) {
1052
+ this.onUpdateCallback.set(onUpdateContextKey.PointsHistory, onUpdate);
1053
+ }
1054
+
1055
+ return await OCache.use(
1056
+ onUpdateContextKey.PointsHistory,
1057
+ ECacheContext.WSAPI,
1058
+ () => this.api.getPointsHistoryT(null, startTimeSeconds, endTimeSeconds),
1059
+ CACHE_DATA_SEC,
1060
+ );
1061
+ }
1062
+
1009
1063
  private async updateOnSpin(data: SAWSpinsCountPush) {
1010
1064
  const templates: TMiniGameTemplate[] = await OCache.use(
1011
1065
  onUpdateContextKey.Saw,
@@ -1062,6 +1116,14 @@ export class WSAPI {
1062
1116
  this.updateEntity(onUpdateContextKey.Raffles, payload);
1063
1117
  }
1064
1118
 
1119
+ private async notifyPointsHistoryUpdate() {
1120
+ const startSeconds = Date.now() / 1000 - 600;
1121
+ const endSeconds = Date.now() / 1000;
1122
+ const payload = await this.api.getPointsHistoryT(null, startSeconds , endSeconds);
1123
+
1124
+ this.updateEntity(onUpdateContextKey.PointsHistory, payload);
1125
+ }
1126
+
1065
1127
  private async updateEntity(contextKey: onUpdateContextKey, payload: any) {
1066
1128
  OCache.set(contextKey, payload, ECacheContext.WSAPI);
1067
1129