@smartico/public-api 0.0.278 → 0.0.280

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 (64) hide show
  1. package/dist/MiniGames/SAWBuyInType.d.ts +0 -1
  2. package/dist/MiniGames/SAWGameType.d.ts +0 -1
  3. package/dist/MiniGames/SAWPrizeType.d.ts +0 -1
  4. package/dist/Missions/index.d.ts +1 -0
  5. package/dist/Tournaments/Tournament.d.ts +3 -2
  6. package/dist/Tournaments/TournamentRegistrationStatus.d.ts +0 -1
  7. package/dist/Tournaments/TournamentRegistrationType.d.ts +0 -1
  8. package/dist/WSAPI/WSAPI.d.ts +4 -0
  9. package/dist/WSAPI/WSAPITypes.d.ts +26 -1
  10. package/dist/index.js +109 -98
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.mjs +61 -58
  13. package/dist/index.modern.mjs.map +1 -1
  14. package/docs/README.md +103 -0
  15. package/docs/classes/SAWUtils.md +27 -0
  16. package/docs/classes/WSAPI.md +5 -2
  17. package/docs/enums/AchCustomLayoutTheme.md +25 -0
  18. package/docs/enums/AchMissionsTabsOptions.md +19 -0
  19. package/docs/enums/AchOverviewMissionsFilter.md +31 -0
  20. package/docs/enums/BonusStatus-1.md +49 -0
  21. package/docs/enums/BonusStatus.md +37 -0
  22. package/docs/enums/SAWAcknowledgeType.md +25 -0
  23. package/docs/enums/SAWBuyInType.md +31 -0
  24. package/docs/enums/SAWGameType.md +61 -0
  25. package/docs/enums/SAWPrizeType.md +61 -0
  26. package/docs/enums/SAWWheelLayout.md +25 -0
  27. package/docs/enums/SAWWinSoundType.md +31 -0
  28. package/docs/enums/TournamentRegistrationStatus.md +43 -0
  29. package/docs/enums/TournamentRegistrationType.md +43 -0
  30. package/docs/interfaces/BonusMetaMap.md +9 -0
  31. package/docs/interfaces/BonusTemplateMetaMap.md +25 -0
  32. package/docs/interfaces/SAWAcknowledgeSpinPushRequest.md +79 -0
  33. package/docs/interfaces/SAWDoAknowledgeRequest.md +43 -0
  34. package/docs/interfaces/SAWDoAknowledgeResponse.md +43 -0
  35. package/docs/interfaces/SAWDoSpinRequest.md +79 -0
  36. package/docs/interfaces/SAWDoSpinResponse.md +87 -0
  37. package/docs/interfaces/SAWEventSawPush.md +55 -0
  38. package/docs/interfaces/SAWGetTemplatesRequest.md +79 -0
  39. package/docs/interfaces/SAWGetTemplatesResponse.md +63 -0
  40. package/docs/interfaces/SAWPrize.md +107 -0
  41. package/docs/interfaces/SAWPrizeDropAknowledgeRequest.md +55 -0
  42. package/docs/interfaces/SAWPrizeDropAknowledgeResponse.md +43 -0
  43. package/docs/interfaces/SAWPrizeDropWinPush.md +67 -0
  44. package/docs/interfaces/SAWPrizeUI.md +157 -0
  45. package/docs/interfaces/SAWPrizesHistory.md +49 -0
  46. package/docs/interfaces/SAWSpinsCountPush.md +49 -0
  47. package/docs/interfaces/SAWTemplate.md +154 -0
  48. package/docs/interfaces/SAWTemplateUI.md +1 -1
  49. package/docs/interfaces/SAWWinningHistoryRequest.md +61 -0
  50. package/docs/interfaces/SAWWinningHistoryResponse.md +69 -0
  51. package/docs/interfaces/TBonus.md +3 -3
  52. package/docs/interfaces/TSawHistory.md +1 -1
  53. package/docs/interfaces/TUICustomSection.md +3 -3
  54. package/package.json +1 -1
  55. package/src/MiniGames/SAWBuyInType.ts +0 -1
  56. package/src/MiniGames/SAWGameType.ts +0 -2
  57. package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -1
  58. package/src/MiniGames/SAWPrizeType.ts +0 -1
  59. package/src/Missions/index.ts +1 -0
  60. package/src/Tournaments/Tournament.ts +4 -2
  61. package/src/Tournaments/TournamentRegistrationStatus.ts +0 -1
  62. package/src/Tournaments/TournamentRegistrationType.ts +0 -1
  63. package/src/WSAPI/WSAPI.ts +10 -16
  64. package/src/WSAPI/WSAPITypes.ts +30 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartico/public-api",
3
- "version": "0.0.278",
3
+ "version": "0.0.280",
4
4
  "description": "Smartico public API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,3 @@
1
- /** @hidden */
2
1
  export enum SAWBuyInType {
3
2
  Free = 1,
4
3
  Points = 2,
@@ -1,5 +1,3 @@
1
- /** @hidden */
2
-
3
1
  export enum SAWGameType {
4
2
  SpinAWheel = 1,
5
3
  ScratchCard = 2,
@@ -4,7 +4,7 @@ import { ProtocolResponse } from './../Base/ProtocolResponse';
4
4
  import { SAWAcknowledgeTypeNamed } from './SAWAcknowledgeType';
5
5
  import { SAWBuyInType, SAWBuyInTypeNamed } from './SAWBuyInType';
6
6
  import { SAWGameTypeNamed } from './SAWGameType';
7
- import { MiniGamePrizeTypeName, MiniGamePrizeTypeNamed } from './SAWPrizeType';
7
+ import { MiniGamePrizeTypeNamed } from './SAWPrizeType';
8
8
  import { SAWTemplate } from './SAWTemplate';
9
9
 
10
10
  export interface SAWGetTemplatesResponse extends ProtocolResponse {
@@ -1,4 +1,3 @@
1
- /** @hidden */
2
1
  export enum SAWPrizeType {
3
2
  NO_PRIZE = 1,
4
3
  POINTS = 2,
@@ -18,3 +18,4 @@ export * from './GetAchCategoriesRequest';
18
18
  export * from './AchClaimPrizeRequest';
19
19
  export * from './AchClaimPrizeResponse';
20
20
  export * from './AchievementAvailabilityStatus';
21
+ export * from './GetRelatedAchTourResponse';
@@ -8,7 +8,9 @@ import {
8
8
  import { TournamentType } from './TournamentType';
9
9
  import { TournamentPublicMeta } from './TournamentPublicMeta';
10
10
  import { TTournament } from '../WSAPI/WSAPITypes';
11
- import { TournamentPlayer, TournamentPrize, TournamentUtils } from '.';
11
+ import { TournamentPlayer } from './TournamentPlayer';
12
+ import { TournamentPrize } from './TournamentPrize';
13
+ import { TournamentUtils } from './TournamentUtils';
12
14
  import { IntUtils } from '../IntUtils';
13
15
  import { AchRelatedGame } from '../Base/AchRelatedGame';
14
16
 
@@ -64,7 +66,7 @@ export interface Tournament {
64
66
  related_games?: AchRelatedGame[];
65
67
  /** The minimum amount of score points that the user should get in order to be qualified for the prize */
66
68
  minScoreToWin?: number;
67
- /** When enabled, users who dont meet the minimum qualifying score will be hidden from the Leaderboard. */
69
+ /** When enabled, users who don't meet the minimum qualifying score will be hidden from the Leaderboard. */
68
70
  hideLeaderboardsMinScores?: boolean;
69
71
  }
70
72
 
@@ -1,4 +1,3 @@
1
- /** @hidden */
2
1
  export enum TournamentRegistrationStatus {
3
2
  NOT_REGISTERED = 0,
4
3
  REGISTERED = 1,
@@ -1,4 +1,3 @@
1
- /** @hidden */
2
1
  export enum TournamentRegistrationType {
3
2
  AUTO = 1,
4
3
  OPT_IN = 2,
@@ -1,13 +1,7 @@
1
1
  import { ClassId } from '../Base/ClassId';
2
2
  import { CoreUtils } from '../Core';
3
3
  import {
4
- MiniGamePrizeTypeName,
5
- SAWDoSpinResponse,
6
- SAWGetTemplatesResponse,
7
- SAWSpinErrorCode,
8
4
  SAWSpinsCountPush,
9
- SAWWinningHistoryRequest,
10
- SAWWinningHistoryResponse,
11
5
  } from '../MiniGames';
12
6
  import { ECacheContext, OCache } from '../OCache';
13
7
  import { SmarticoAPI } from '../SmarticoAPI';
@@ -53,24 +47,15 @@ import {
53
47
  JackpotsOptoutRequest,
54
48
  JackpotsOptoutResponse,
55
49
  } from '../Jackpots';
56
- import { GetTournamentsResponse } from '../Tournaments';
57
- import { GetAchievementMapResponse } from '../Missions';
58
50
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
59
- import { drawTransform, GetRafflesResponse, prizeTransform, ticketsTransform } from '../Raffle/GetRafflesResponse';
60
51
  import { InboxCategories } from '../Inbox/InboxCategories';
61
52
  import {
62
53
  drawRunHistoryTransform,
63
54
  drawRunTransform,
64
- GetDrawRunRequest,
65
- GetDrawRunResponse,
66
- GetRaffleDrawRunsHistoryRequest,
67
- GetRaffleDrawRunsHistoryResponse,
68
- RaffleClaimPrizeRequest,
69
- RaffleClaimPrizeResponse,
70
55
  raffleClaimPrizeResponseTransform,
71
56
  } from '../Raffle';
72
57
  import { IntUtils } from '../IntUtils';
73
- import { JackpotEligibleGame, TGetJackpotEligibleGamesResponse } from '../Jackpots/GetJackpotEligibleGamesResponse';
58
+ import { TGetJackpotEligibleGamesResponse } from '../Jackpots/GetJackpotEligibleGamesResponse';
74
59
 
75
60
  /** @hidden */
76
61
  const CACHE_DATA_SEC = 30;
@@ -129,6 +114,7 @@ export class WSAPI {
129
114
  on(ClassId.ACHIEVEMENT_CLAIM_PRIZE_RESPONSE, () => this.updateMissions());
130
115
  on(ClassId.RELOAD_ACHIEVEMENTS_EVENT, () => this.updateMissions());
131
116
  on(ClassId.TOURNAMENT_REGISTER_RESPONSE, () => this.updateTournaments());
117
+ on(ClassId.BUY_SHOP_ITEM_RESPONSE, () => this.updateStorePurchasedItems());
132
118
  on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
133
119
  on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
134
120
  on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
@@ -405,6 +391,9 @@ export class WSAPI {
405
391
  * Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
406
392
  * The maximum number of items per request is limited to 20.
407
393
  * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
394
+ * The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
395
+ * Note that each time you call getStorePurchasedItems with a new onUpdate callback, the old one will be overwritten by the new one.
396
+ * The onUpdate callback will be called on purchase of the store item and the last 20 items will be passed to it.
408
397
  *
409
398
  * **Example**:
410
399
  * ```
@@ -924,6 +913,11 @@ export class WSAPI {
924
913
  this.updateEntity(onUpdateContextKey.TournamentList, payload);
925
914
  }
926
915
 
916
+ private async updateStorePurchasedItems() {
917
+ const payload = await this.api.storeGetPurchasedItemsT(null, 20, 0);
918
+ this.updateEntity(onUpdateContextKey.StoreHistory, payload);
919
+ }
920
+
927
921
  private async updateInboxMessages() {
928
922
  const payload = await this.api.getInboxMessagesT(null);
929
923
  this.updateEntity(onUpdateContextKey.InboxMessages, payload);
@@ -1,15 +1,12 @@
1
1
  import { BuyStoreItemErrorCode } from '../Store';
2
- import { MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWDoAknowledgeResponse, SAWGameLayout, SAWGameType, SAWGameTypeName, SAWPrize, SAWSpinErrorCode, SAWTemplate, SAWTemplateUI, SAWWheelLayout } from '../MiniGames';
3
- import { Tournament, TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from '../Tournaments';
4
- import { AchCategory, AchievementAvailabilityStatus, UserAchievement } from '../Missions';
2
+ import { MiniGamePrizeTypeName, SAWAcknowledgeTypeName, SAWAskForUsername, SAWBuyInTypeName, SAWGameLayout, SAWGameTypeName, SAWSpinErrorCode, SAWTemplate, SAWTemplateUI } from '../MiniGames';
3
+ import { TournamentRegistrationError, TournamentRegistrationStatusName, TournamentRegistrationTypeName } from '../Tournaments';
4
+ import { AchievementAvailabilityStatus } from '../Missions';
5
5
  import { LeaderBoardPeriodType } from '../Leaderboard';
6
6
  import { AchCustomLayoutTheme, AchCustomSectionType, AchMissionsTabsOptions, AchOverviewMissionsFilter } from '../CustomSections';
7
- import { BonusStatus , BonusTemplateMetaMap, BonusMetaMap} from '../Bonuses';
8
7
  import { PrizeModifiers } from '../MiniGames/PrizeModifiers';
9
8
  import { InboxCategories } from '../Inbox/InboxCategories';
10
9
  import { RaffleDrawInstanceState, RaffleDrawTypeExecution } from '../Raffle';
11
- import { JackPotWinner } from '../Jackpots/JackPotWinner';
12
- import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
13
10
 
14
11
 
15
12
  type TRibbon = 'sale' | 'hot' | 'new' | 'vip' | string;
@@ -859,6 +856,33 @@ export interface TBonus {
859
856
  bonus_meta_map?: BonusMetaMap;
860
857
  }
861
858
 
859
+ export enum BonusStatus {
860
+ /** The bonus is newly created (shouldn't be shown to the client) */
861
+ New = 1,
862
+ /** The bonus is issued and available for redemption but has not been redeemed yet */
863
+ COUPON_ISSUED = 2,
864
+ /** The bonus has been successfully redeemed */
865
+ REDEEMED = 3,
866
+ /** The bonus is still valid, but a previous redemption attempt failed */
867
+ REDEEM_FAILED = 4,
868
+ /** Failed to issue the bonus (shouldn't be shown to the client) */
869
+ COUPON_ISSUE_FAILED = 5,
870
+ /** The bonus was issued but has expired and can no longer be redeemed (shouldn't be shown to the client) */
871
+ EXPIRED = 6,
872
+ }
873
+ export interface BonusTemplateMetaMap {
874
+ /** Description of the bonus template*/
875
+ description: string;
876
+ /** Acknowledge message setup in the bonus template*/
877
+ acknowledge: string;
878
+ /** Image URL of the bonus template*/
879
+ image_url: string;
880
+ }
881
+ export interface BonusMetaMap {
882
+ /** Label and description of the bonus sent to the player*/
883
+ uiAmount?: string;
884
+ }
885
+
862
886
  /**
863
887
  * TClaimBonusResult describes the response of call to _smartico.api.claimBonus(bonus_id) method
864
888
  */