@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.
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/CustomSections/AchCustomSection.d.ts +2 -1
- package/dist/CustomSections/UICustomSection.d.ts +1 -0
- package/dist/MiniGames/AttemptPeriodType.d.ts +6 -0
- package/dist/MiniGames/SAWPrize.d.ts +2 -0
- package/dist/MiniGames/index.d.ts +1 -0
- package/dist/PointsHistory/GetPointsHistoryRequest.d.ts +6 -0
- package/dist/PointsHistory/GetPointsHistoryResponse.d.ts +7 -0
- package/dist/PointsHistory/PointChangeSourceType.d.ts +19 -0
- package/dist/PointsHistory/PointsHistoryLog.d.ts +21 -0
- package/dist/PointsHistory/UserBalanceType.d.ts +5 -0
- package/dist/PointsHistory/index.d.ts +5 -0
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPI.d.ts +34 -1
- package/dist/WSAPI/WSAPITypes.d.ts +30 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +224 -74
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +128 -3
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +4 -0
- package/docs/classes/WSAPI.md +41 -0
- package/docs/enums/AchCustomSectionType.md +6 -0
- package/docs/enums/AttemptPeriodType.md +25 -0
- package/docs/enums/PointChangeSourceType.md +103 -0
- package/docs/enums/UserBalanceType.md +19 -0
- package/docs/interfaces/SAWPrize.md +6 -0
- package/docs/interfaces/TMiniGamePrize.md +8 -0
- package/docs/interfaces/TPointsHistoryLog.md +68 -0
- package/docs/interfaces/TUICustomSection.md +8 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +3 -0
- package/src/CustomSections/AchCustomSection.ts +1 -0
- package/src/CustomSections/UICustomSection.ts +7 -0
- package/src/MiniGames/AttemptPeriodType.ts +6 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
- package/src/MiniGames/SAWPrize.ts +2 -0
- package/src/MiniGames/index.ts +2 -1
- package/src/PointsHistory/GetPointsHistoryRequest.ts +8 -0
- package/src/PointsHistory/GetPointsHistoryResponse.ts +39 -0
- package/src/PointsHistory/PointChangeSourceType.ts +20 -0
- package/src/PointsHistory/PointsHistoryLog.ts +24 -0
- package/src/PointsHistory/UserBalanceType.ts +6 -0
- package/src/PointsHistory/index.ts +6 -0
- package/src/SmarticoAPI.ts +29 -0
- package/src/WSAPI/WSAPI.ts +64 -2
- package/src/WSAPI/WSAPITypes.ts +30 -2
- package/src/index.ts +2 -1
package/dist/Base/ClassId.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export declare enum ClassId {
|
|
|
68
68
|
ACH_SHOP_ITEM_HISTORY_RESPONSE = 542,
|
|
69
69
|
GET_RELATED_ACH_N_TOURNAMENTS_REQUEST = 543,
|
|
70
70
|
GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE = 544,
|
|
71
|
+
GET_POINT_HISTORY_REQUEST = 545,
|
|
72
|
+
GET_POINT_HISTORY_RESPONSE = 546,
|
|
71
73
|
GET_BONUSES_REQUEST = 600,
|
|
72
74
|
GET_BONUSES_RESPONSE = 601,
|
|
73
75
|
CLAIM_BONUS_REQUEST = 602,
|
|
@@ -10,7 +10,8 @@ export declare enum AchCustomSectionType {
|
|
|
10
10
|
LOOTBOX_WEEKLY = 10,
|
|
11
11
|
LOOTBOX_CALENDAR_DAYS = 11,
|
|
12
12
|
TREASURE_HUNT = 12,
|
|
13
|
-
RAFFLE = 13
|
|
13
|
+
RAFFLE = 13,
|
|
14
|
+
BADGES = 14
|
|
14
15
|
}
|
|
15
16
|
export declare enum AchCustomLayoutTheme {
|
|
16
17
|
VALENTINES_LIGHT = "valentines-light",
|
|
@@ -16,5 +16,6 @@ export interface UICustomSection {
|
|
|
16
16
|
ach_tournament_id?: number;
|
|
17
17
|
show_raw_data?: boolean;
|
|
18
18
|
liquid_template?: number;
|
|
19
|
+
ach_category_ids?: number[];
|
|
19
20
|
}
|
|
20
21
|
export declare const UICustomSectionTransform: (response: GetCustomSectionsResponse) => TUICustomSection[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AttemptPeriodType } from './AttemptPeriodType';
|
|
1
2
|
import { SAWPrizeType } from './SAWPrizeType';
|
|
2
3
|
import { SAWPrizeUI } from './SAWPrizeUI';
|
|
3
4
|
export interface SAWPrize {
|
|
@@ -20,4 +21,5 @@ export interface SAWPrize {
|
|
|
20
21
|
prize_details_json?: {
|
|
21
22
|
[key: string]: any;
|
|
22
23
|
};
|
|
24
|
+
max_give_period_type_id?: AttemptPeriodType;
|
|
23
25
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProtocolResponse } from '../Base/ProtocolResponse';
|
|
2
|
+
import { PointsHistoryLog } from './PointsHistoryLog';
|
|
3
|
+
import { TPointsHistoryLog } from '../WSAPI/WSAPITypes';
|
|
4
|
+
export interface GetPointsHistoryResponse extends ProtocolResponse {
|
|
5
|
+
logHistory: PointsHistoryLog[];
|
|
6
|
+
}
|
|
7
|
+
export declare const PointsHistoryTransform: (items: PointsHistoryLog[]) => TPointsHistoryLog[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare 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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PointChangeSourceType } from './PointChangeSourceType';
|
|
2
|
+
import { UserBalanceType } from './UserBalanceType';
|
|
3
|
+
export interface PointsLog {
|
|
4
|
+
create_date: number;
|
|
5
|
+
user_ext_id: string;
|
|
6
|
+
crm_brand_id: number;
|
|
7
|
+
points_collected: number;
|
|
8
|
+
user_points_ever: number;
|
|
9
|
+
user_points_balance: number;
|
|
10
|
+
source_type_id: PointChangeSourceType;
|
|
11
|
+
}
|
|
12
|
+
export interface GemsDiamondsLog {
|
|
13
|
+
create_date: number;
|
|
14
|
+
user_ext_id: string;
|
|
15
|
+
crm_brand_id: number;
|
|
16
|
+
type: UserBalanceType;
|
|
17
|
+
amount: number;
|
|
18
|
+
balance: number;
|
|
19
|
+
source_type_id: PointChangeSourceType;
|
|
20
|
+
}
|
|
21
|
+
export type PointsHistoryLog = PointsLog | GemsDiamondsLog;
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -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 } from './WSAPI/WSAPITypes';
|
|
14
|
+
import { TInboxMessage, TInboxMessageBody, TLevel, TMiniGameTemplate, TMissionOrBadge, TStoreCategory, TAchCategory, TStoreItem, TTournament, TTournamentDetailed, LeaderBoardDetailsT, UserLevelExtraCountersT, TSegmentCheckResult, TUICustomSection, TBonus, TRaffle, TLevelCurrent, TPointsHistoryLog } 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';
|
|
@@ -20,6 +20,7 @@ import { SAWDoSpinBatchResponse } from './MiniGames/SAWDoSpinBatchResponse';
|
|
|
20
20
|
import { SAWDoAcknowledgeBatchResponse } from './MiniGames/SAWDoAcknowledgeBatchResponse';
|
|
21
21
|
import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
|
|
22
22
|
import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
|
|
23
|
+
import { GetPointsHistoryResponse } from './PointsHistory';
|
|
23
24
|
import { InboxCategories } from './Inbox/InboxCategories';
|
|
24
25
|
import { GetDrawRunResponse, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeResponse } from './Raffle';
|
|
25
26
|
import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
|
|
@@ -167,5 +168,7 @@ declare class SmarticoAPI {
|
|
|
167
168
|
claimRafflePrize(user_ext_id: string, props: {
|
|
168
169
|
won_id: number;
|
|
169
170
|
}): Promise<RaffleClaimPrizeResponse>;
|
|
171
|
+
getPointsHistory(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number): Promise<GetPointsHistoryResponse>;
|
|
172
|
+
getPointsHistoryT(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number): Promise<TPointsHistoryLog[]>;
|
|
170
173
|
}
|
|
171
174
|
export { SmarticoAPI, MessageSender };
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActivityTypeLimited } from '../Core';
|
|
2
2
|
import { SmarticoAPI } from '../SmarticoAPI';
|
|
3
|
-
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent } from './WSAPITypes';
|
|
3
|
+
import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TPointsHistoryLog } from './WSAPITypes';
|
|
4
4
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
5
5
|
import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
|
|
6
6
|
import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
|
|
@@ -545,6 +545,38 @@ export declare class WSAPI {
|
|
|
545
545
|
activityType: ActivityTypeLimited | number;
|
|
546
546
|
action?: string;
|
|
547
547
|
}): void;
|
|
548
|
+
/**
|
|
549
|
+
* Returns the points history for a user within a specified time range.
|
|
550
|
+
* The response includes both points changes and gems/diamonds changes.
|
|
551
|
+
* Each log entry contains information about the change amount, balance, and source.
|
|
552
|
+
* The returned list is cached for 30 seconds.
|
|
553
|
+
* 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.
|
|
554
|
+
*
|
|
555
|
+
* **Example**:
|
|
556
|
+
* ```
|
|
557
|
+
* const startTime = Math.floor(Date.now() / 1000) - 86400 * 30; // 30 days ago
|
|
558
|
+
* const endTime = Math.floor(Date.now() / 1000); // now
|
|
559
|
+
*
|
|
560
|
+
* _smartico.api.getPointsHistory({
|
|
561
|
+
* startTimeSeconds: startTime,
|
|
562
|
+
* endTimeSeconds: endTime,
|
|
563
|
+
* onUpdate: (data) => console.log('Updated:', data)
|
|
564
|
+
* }).then((result) => {
|
|
565
|
+
* console.log(result);
|
|
566
|
+
* });
|
|
567
|
+
* ```
|
|
568
|
+
*
|
|
569
|
+
* **Visitor mode: not supported**
|
|
570
|
+
*
|
|
571
|
+
* @param params.startTimeSeconds - Start time in seconds (epoch timestamp)
|
|
572
|
+
* @param params.endTimeSeconds - End time in seconds (epoch timestamp)
|
|
573
|
+
* @param params.onUpdate - Optional callback function that will be called when the points history is updated
|
|
574
|
+
*/
|
|
575
|
+
getPointsHistory({ startTimeSeconds, endTimeSeconds, onUpdate, }: {
|
|
576
|
+
startTimeSeconds: number;
|
|
577
|
+
endTimeSeconds: number;
|
|
578
|
+
onUpdate?: (data: TPointsHistoryLog[]) => void;
|
|
579
|
+
}): Promise<TPointsHistoryLog[]>;
|
|
548
580
|
private updateOnSpin;
|
|
549
581
|
private reloadMiniGameTemplate;
|
|
550
582
|
private updateMissions;
|
|
@@ -555,6 +587,7 @@ export declare class WSAPI {
|
|
|
555
587
|
private updateInboxUnreadCount;
|
|
556
588
|
private updateInboxMessages;
|
|
557
589
|
private updateRaffles;
|
|
590
|
+
private notifyPointsHistoryUpdate;
|
|
558
591
|
private updateEntity;
|
|
559
592
|
private jackpotClearCache;
|
|
560
593
|
/** Returns list of Jackpots that are active in the systen and matching to the filter definition.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuyStoreItemErrorCode } from '../Store';
|
|
2
|
-
import { MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWAskForUsername, SAWBuyInTypeName, SAWGameLayout, SAWGameTypeName, SAWSpinErrorCode, SAWTemplate, SAWTemplateUI } from '../MiniGames';
|
|
2
|
+
import { AttemptPeriodType, MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWAskForUsername, SAWBuyInTypeName, SAWGameLayout, SAWGameTypeName, SAWSpinErrorCode, SAWTemplate, SAWTemplateUI } from '../MiniGames';
|
|
3
3
|
import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from '../Tournaments';
|
|
4
4
|
import { AchievementAvailabilityStatus, BadgesTimeLimitStates } from '../Missions';
|
|
5
5
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
@@ -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 } from '../Raffle';
|
|
10
|
+
import { PointChangeSourceType } from '../PointsHistory/PointChangeSourceType';
|
|
11
|
+
import { UserBalanceType } from '../PointsHistory/UserBalanceType';
|
|
10
12
|
type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
|
|
11
13
|
/**
|
|
12
14
|
* TMiniGamePrize describes the information of prize in the array of prizes in the TMiniGameTemplate
|
|
@@ -74,6 +76,8 @@ export interface TMiniGamePrize {
|
|
|
74
76
|
hide_prize_from_history?: boolean;
|
|
75
77
|
/** Requirements to claim the prize (lootbox specific)*/
|
|
76
78
|
requirements_to_get_prize?: string;
|
|
79
|
+
/** The period type for the prize to be given: Time from last attempt, Calendar days UTC, Calendar days user time zone, Lifetime */
|
|
80
|
+
max_give_period_type_id?: AttemptPeriodType;
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
79
83
|
* TMiniGamePlayResult describes the response of call to _smartico.api.playMiniGame(template_id) method
|
|
@@ -824,6 +828,8 @@ export interface TUICustomSection {
|
|
|
824
828
|
show_raw_data?: boolean;
|
|
825
829
|
/** Liquid template id to be used for Liquid templates */
|
|
826
830
|
liquid_template?: number;
|
|
831
|
+
/** List of IDs of the categories where the badge item is assigned, information about categories can be retrieved with getAchCategories method */
|
|
832
|
+
ach_category_ids?: number[];
|
|
827
833
|
}
|
|
828
834
|
export interface TBonus {
|
|
829
835
|
/** ID of the bonus */
|
|
@@ -1177,4 +1183,26 @@ export interface TransformedRaffleClaimPrizeResponse {
|
|
|
1177
1183
|
/** Error message, will be exposed only if ErrorCode is not 0 */
|
|
1178
1184
|
errorMessage?: string;
|
|
1179
1185
|
}
|
|
1180
|
-
|
|
1186
|
+
/**
|
|
1187
|
+
* TPointsHistoryLog describes a unified history log entry for points, gems, or diamonds changes.
|
|
1188
|
+
* The structure is the same regardless of balance type, making it easy to iterate and display.
|
|
1189
|
+
*/
|
|
1190
|
+
export interface TPointsHistoryLog {
|
|
1191
|
+
/** Date when the change was created (epoch timestamp in seconds) */
|
|
1192
|
+
create_date: number;
|
|
1193
|
+
/** External user ID */
|
|
1194
|
+
user_ext_id: string;
|
|
1195
|
+
/** CRM brand ID */
|
|
1196
|
+
crm_brand_id: number;
|
|
1197
|
+
/** Type of balance: Points = 0, Gems = 1, Diamonds = 2 */
|
|
1198
|
+
type: UserBalanceType;
|
|
1199
|
+
/** Amount changed (positive or negative) */
|
|
1200
|
+
amount: number;
|
|
1201
|
+
/** Current balance after this change */
|
|
1202
|
+
balance: number;
|
|
1203
|
+
/** Total ever collected (only relevant for type points) */
|
|
1204
|
+
total_ever?: number;
|
|
1205
|
+
/** Source type ID indicating what triggered this change */
|
|
1206
|
+
source_type_id: PointChangeSourceType;
|
|
1207
|
+
}
|
|
1208
|
+
export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType };
|
package/dist/index.d.ts
CHANGED