@smartico/public-api 0.0.324 → 0.0.326

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 (42) hide show
  1. package/dist/Base/ClassId.d.ts +2 -0
  2. package/dist/MiniGames/AttemptPeriodType.d.ts +6 -0
  3. package/dist/MiniGames/SAWPrize.d.ts +2 -0
  4. package/dist/MiniGames/index.d.ts +1 -0
  5. package/dist/PointsHistory/GetPointsHistoryRequest.d.ts +6 -0
  6. package/dist/PointsHistory/GetPointsHistoryResponse.d.ts +7 -0
  7. package/dist/PointsHistory/PointChangeSourceType.d.ts +19 -0
  8. package/dist/PointsHistory/PointsHistoryLog.d.ts +21 -0
  9. package/dist/PointsHistory/UserBalanceType.d.ts +5 -0
  10. package/dist/PointsHistory/index.d.ts +5 -0
  11. package/dist/SmarticoAPI.d.ts +13 -2
  12. package/dist/WSAPI/WSAPI.d.ts +83 -1
  13. package/dist/WSAPI/WSAPITypes.d.ts +28 -2
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +295 -74
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.modern.mjs +199 -3
  18. package/dist/index.modern.mjs.map +1 -1
  19. package/docs/README.md +4 -0
  20. package/docs/classes/WSAPI.md +107 -0
  21. package/docs/enums/AttemptPeriodType.md +25 -0
  22. package/docs/enums/PointChangeSourceType.md +103 -0
  23. package/docs/enums/UserBalanceType.md +19 -0
  24. package/docs/interfaces/SAWPrize.md +6 -0
  25. package/docs/interfaces/TMiniGamePrize.md +8 -0
  26. package/docs/interfaces/TPointsHistoryLog.md +68 -0
  27. package/package.json +1 -1
  28. package/src/Base/ClassId.ts +3 -0
  29. package/src/MiniGames/AttemptPeriodType.ts +6 -0
  30. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -0
  31. package/src/MiniGames/SAWPrize.ts +2 -0
  32. package/src/MiniGames/index.ts +2 -1
  33. package/src/PointsHistory/GetPointsHistoryRequest.ts +8 -0
  34. package/src/PointsHistory/GetPointsHistoryResponse.ts +39 -0
  35. package/src/PointsHistory/PointChangeSourceType.ts +20 -0
  36. package/src/PointsHistory/PointsHistoryLog.ts +24 -0
  37. package/src/PointsHistory/UserBalanceType.ts +6 -0
  38. package/src/PointsHistory/index.ts +6 -0
  39. package/src/SmarticoAPI.ts +64 -0
  40. package/src/WSAPI/WSAPI.ts +126 -3
  41. package/src/WSAPI/WSAPITypes.ts +28 -2
  42. package/src/index.ts +2 -1
@@ -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,
@@ -0,0 +1,6 @@
1
+ export declare enum AttemptPeriodType {
2
+ FromLastAttempt = 1,
3
+ CalendarDaysUTC = 2,
4
+ CalendarDaysUserTimeZone = 3,
5
+ Lifetime = 4
6
+ }
@@ -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
  }
@@ -29,3 +29,4 @@ export * from './PrizeModifiers';
29
29
  export * from './SAWWheelLayout';
30
30
  export * from './SAWGameDifficulty';
31
31
  export * from './SAWExposeUserSpinId';
32
+ export * from './AttemptPeriodType';
@@ -0,0 +1,6 @@
1
+ import { ProtocolMessage } from '../Base/ProtocolMessage';
2
+ export interface GetPointsHistoryRequest extends ProtocolMessage {
3
+ userId: number;
4
+ startTimeSeconds: number;
5
+ endTimeSeconds: number;
6
+ }
@@ -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;
@@ -0,0 +1,5 @@
1
+ export declare enum UserBalanceType {
2
+ Points = 0,
3
+ Gems = 1,
4
+ Diamonds = 2
5
+ }
@@ -0,0 +1,5 @@
1
+ export * from './GetPointsHistoryRequest';
2
+ export * from './GetPointsHistoryResponse';
3
+ export * from './PointsHistoryLog';
4
+ export * from './PointChangeSourceType';
5
+ export * from './UserBalanceType';
@@ -2,7 +2,7 @@ import { ClassId } from './Base/ClassId';
2
2
  import { SAWGetTemplatesResponse } from './MiniGames/SAWGetTemplatesResponse';
3
3
  import { ILogger } from './ILogger';
4
4
  import { SAWDoAknowledgeResponse, SAWDoSpinResponse, SAWPrizesHistory, SAWWinningHistoryResponse } from './MiniGames';
5
- import { GetTranslationsResponse, PublicLabelSettings, ResponseIdentify, TranslationArea } from './Core';
5
+ import { ActivityTypeLimited, GetTranslationsResponse, PublicLabelSettings, ResponseIdentify, TranslationArea } from './Core';
6
6
  import { GetLabelInfoResponse } from './Core/GetLabelInfoResponse';
7
7
  import { GetInboxMessagesResponse, InboxMessageBody, InboxReadStatus, MarkInboxMessageDeletedResponse, MarkInboxMessageReadResponse, MarkInboxMessageStarredResponse } from './Inbox';
8
8
  import { BuyStoreItemResponse, GetCategoriesStoreResponse, GetStoreHistoryResponse, GetStoreItemsResponse } from './Store';
@@ -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';
@@ -71,6 +72,14 @@ declare class SmarticoAPI {
71
72
  public_username_custom: string;
72
73
  }>;
73
74
  coreCheckSegments(user_ext_id: string, segment_id: number[]): Promise<TSegmentCheckResult[]>;
75
+ /**
76
+ * Reports an engagement impression event (when engagement content is displayed to the user).
77
+ */
78
+ reportEngagementImpression(user_ext_id: string, engagement_uid: string, activityType: ActivityTypeLimited | number): void;
79
+ /**
80
+ * Reports an engagement action event (when user clicks/interacts with engagement content).
81
+ */
82
+ reportEngagementAction(user_ext_id: string, engagement_uid: string, activityType: ActivityTypeLimited | number, action?: string): void;
74
83
  jackpotGet(user_ext_id: string, filter?: {
75
84
  related_game_id?: string;
76
85
  jp_template_id?: number;
@@ -159,5 +168,7 @@ declare class SmarticoAPI {
159
168
  claimRafflePrize(user_ext_id: string, props: {
160
169
  won_id: number;
161
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[]>;
162
173
  }
163
174
  export { SmarticoAPI, MessageSender };
@@ -1,5 +1,6 @@
1
+ import { ActivityTypeLimited } from '../Core';
1
2
  import { SmarticoAPI } from '../SmarticoAPI';
2
- 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';
3
4
  import { LeaderBoardPeriodType } from '../Leaderboard';
4
5
  import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
5
6
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
@@ -496,6 +497,86 @@ export declare class WSAPI {
496
497
  * Requests translations for the given language. Returns the object including translation key/translation value pairs. All possible translation keys defined in the back office.
497
498
  */
498
499
  getTranslations(lang_code: string): Promise<TGetTranslations>;
500
+ /**
501
+ * Reports an impression event for an engagement (when engagement content is displayed to the user).
502
+ * Use this method to track when users view engagement content such as inbox messages, popups.
503
+ * When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType.
504
+ *
505
+ * **Example**:
506
+ * ```
507
+ * _smartico.api.reportImpressionEvent({
508
+ * engagement_uid: 'abc123-def456',
509
+ * activityType: 31 // Inbox
510
+ * });
511
+ * ```
512
+ *
513
+ * **Visitor mode: not supported**
514
+ *
515
+ * @param params.engagement_uid - Unique identifier for the engagement
516
+ * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
517
+ */
518
+ reportImpressionEvent({ engagement_uid, activityType, }: {
519
+ engagement_uid: string;
520
+ activityType: ActivityTypeLimited | number;
521
+ }): void;
522
+ /**
523
+ * Reports a click/action event for an engagement (when user interacts with engagement content).
524
+ * Use this method to track when users click on or interact with engagement content such as inbox messages, popups.
525
+ * When using for Inbox cases, you need to use message guid as engagement_uid, and pass 31 as activityType, and pass the action/deeplink that was triggered by the user interaction as action.
526
+ *
527
+ *
528
+ * **Example**:
529
+ * ```
530
+ * _smartico.api.reportClickEvent({
531
+ * engagement_uid: 'abc123-def456',
532
+ * activityType: 31 // Inbox,
533
+ * action: 'dp:gf_missions'
534
+ * });
535
+ * ```
536
+ *
537
+ * **Visitor mode: not supported**
538
+ *
539
+ * @param params.engagement_uid - Unique identifier for the engagement
540
+ * @param params.activityType - Type of engagement activity (Popup=30, Inbox=31)
541
+ * @param params.action - Optional action/deeplink that was triggered by the user interaction
542
+ */
543
+ reportClickEvent({ engagement_uid, activityType, action, }: {
544
+ engagement_uid: string;
545
+ activityType: ActivityTypeLimited | number;
546
+ action?: string;
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[]>;
499
580
  private updateOnSpin;
500
581
  private reloadMiniGameTemplate;
501
582
  private updateMissions;
@@ -506,6 +587,7 @@ export declare class WSAPI {
506
587
  private updateInboxUnreadCount;
507
588
  private updateInboxMessages;
508
589
  private updateRaffles;
590
+ private notifyPointsHistoryUpdate;
509
591
  private updateEntity;
510
592
  private jackpotClearCache;
511
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
@@ -1177,4 +1181,26 @@ export interface TransformedRaffleClaimPrizeResponse {
1177
1181
  /** Error message, will be exposed only if ErrorCode is not 0 */
1178
1182
  errorMessage?: string;
1179
1183
  }
1180
- export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout };
1184
+ /**
1185
+ * TPointsHistoryLog describes a unified history log entry for points, gems, or diamonds changes.
1186
+ * The structure is the same regardless of balance type, making it easy to iterate and display.
1187
+ */
1188
+ export interface TPointsHistoryLog {
1189
+ /** Date when the change was created (epoch timestamp in seconds) */
1190
+ create_date: number;
1191
+ /** External user ID */
1192
+ user_ext_id: string;
1193
+ /** CRM brand ID */
1194
+ crm_brand_id: number;
1195
+ /** Type of balance: Points = 0, Gems = 1, Diamonds = 2 */
1196
+ type: UserBalanceType;
1197
+ /** Amount changed (positive or negative) */
1198
+ amount: number;
1199
+ /** Current balance after this change */
1200
+ balance: number;
1201
+ /** Total ever collected (only relevant for type points) */
1202
+ total_ever?: number;
1203
+ /** Source type ID indicating what triggered this change */
1204
+ source_type_id: PointChangeSourceType;
1205
+ }
1206
+ export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType };
package/dist/index.d.ts CHANGED
@@ -17,3 +17,4 @@ export * from './Jackpots';
17
17
  export * from './OCache';
18
18
  export * from './Bonuses';
19
19
  export * from './CustomSections';
20
+ export * from './PointsHistory';