@smartico/public-api 0.0.136 → 0.0.138

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 (57) hide show
  1. package/dist/Jackpots/JackpotDetails.d.ts +16 -0
  2. package/dist/Jackpots/JackpotPot.d.ts +6 -0
  3. package/dist/Jackpots/JackpotPublicMeta.d.ts +7 -0
  4. package/dist/MiniGames/SAWTemplateUI.d.ts +2 -2
  5. package/dist/SmarticoAPI.d.ts +1 -1
  6. package/dist/SmarticoLib/index.d.ts +4 -2
  7. package/dist/Store/GetStoreHistoryRequest.d.ts +1 -1
  8. package/dist/Store/GetStoreHistoryResponse.d.ts +1 -1
  9. package/dist/WSAPI/WSAPI.d.ts +42 -11
  10. package/dist/WSAPI/WSAPITypes.d.ts +1 -0
  11. package/dist/index.js +51 -22
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.modern.mjs +43 -13
  14. package/dist/index.modern.mjs.map +1 -1
  15. package/docs/README.md +19 -1
  16. package/docs/classes/WSAPI.md +93 -11
  17. package/docs/enums/JackpotContributionType.md +13 -0
  18. package/docs/enums/JackpotType.md +7 -0
  19. package/docs/enums/LeaderBoardPeriodType.md +19 -0
  20. package/docs/enums/SAWGameTypeName.md +6 -0
  21. package/docs/interfaces/AchRelatedGame-1.md +28 -0
  22. package/docs/interfaces/AchRelatedGame.md +14 -12
  23. package/docs/interfaces/GetJackpotsPotsRequest.md +43 -0
  24. package/docs/interfaces/GetJackpotsPotsResponse.md +63 -0
  25. package/docs/interfaces/GetJackpotsRequest.md +49 -0
  26. package/docs/interfaces/GetJackpotsResponse.md +63 -0
  27. package/docs/interfaces/JackPotWinner.md +31 -0
  28. package/docs/interfaces/JackpotDetails.md +85 -0
  29. package/docs/interfaces/JackpotHtmlTemplate.md +13 -0
  30. package/docs/interfaces/JackpotPot.md +41 -0
  31. package/docs/interfaces/JackpotPublicMeta.md +57 -0
  32. package/docs/interfaces/JackpotWinPush.md +49 -0
  33. package/docs/interfaces/JackpotsOptinRequest.md +43 -0
  34. package/docs/interfaces/JackpotsOptinResponse.md +57 -0
  35. package/docs/interfaces/JackpotsOptoutRequest.md +43 -0
  36. package/docs/interfaces/JackpotsOptoutResponse.md +57 -0
  37. package/docs/interfaces/LeaderBoardDetailsT.md +1 -1
  38. package/docs/interfaces/TAchCategory.md +6 -0
  39. package/docs/interfaces/TMiniGameTemplate.md +2 -0
  40. package/docs/interfaces/TMissionOrBadge.md +6 -7
  41. package/docs/interfaces/TStoreCategory.md +6 -0
  42. package/docs/interfaces/TTournament.md +6 -0
  43. package/docs/interfaces/TTournamentDetailed.md +11 -1
  44. package/package.json +1 -1
  45. package/src/Base/AchRelatedGame.ts +3 -1
  46. package/src/Jackpots/JackpotDetails.ts +16 -0
  47. package/src/Jackpots/JackpotPot.ts +7 -1
  48. package/src/Jackpots/JackpotPublicMeta.ts +7 -0
  49. package/src/MiniGames/SAWTemplateUI.ts +2 -2
  50. package/src/SmarticoAPI.ts +5 -6
  51. package/src/SmarticoLib/index.ts +4 -2
  52. package/src/Store/GetStoreHistoryRequest.ts +1 -1
  53. package/src/Store/GetStoreHistoryResponse.ts +1 -1
  54. package/src/Tournaments/Tournament.ts +1 -0
  55. package/src/WSAPI/WSAPI.ts +42 -13
  56. package/src/WSAPI/WSAPITypes.ts +2 -0
  57. package/tsconfig.json +3 -0
@@ -6,7 +6,6 @@ import { SmarticoAPI } from "../SmarticoAPI";
6
6
  import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUserProfile, UserLevelExtraCountersT } from "./WSAPITypes";
7
7
  import { LeaderBoardPeriodType } from "../Leaderboard";
8
8
  import { JackpotDetails, JackpotPot, JackpotWinPush, JackpotsOptinResponse, JackpotsOptoutResponse } from "../Jackpots";
9
- import { AchRelatedGame } from "src/Base/AchRelatedGame";
10
9
 
11
10
  /** @hidden */
12
11
  const CACHE_DATA_SEC = 30;
@@ -51,7 +50,7 @@ export class WSAPI {
51
50
  on(ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, () => this.updateInboxMessages());
52
51
  on(ClassId.LOGOUT_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
53
52
  on(ClassId.IDENTIFY_RESPONSE, () => OCache.clearContext(ECacheContext.WSAPI));
54
- on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache())
53
+ on(ClassId.JP_WIN_PUSH, (data: JackpotWinPush) => this.jackpotClearCache());
55
54
  }
56
55
 
57
56
  /** Returns information about current user
@@ -189,20 +188,22 @@ export class WSAPI {
189
188
  return OCache.use(onUpdateContextKey.StoreCategories, ECacheContext.WSAPI, () => this.api.storeGetCategoriesT(null), CACHE_DATA_SEC);
190
189
  }
191
190
 
192
- /** Returns store purchased items based on the provided parameters. "From" and "to" indicate the range of items to be fetched.
193
- * The maximum number of messages per request is limited to 20.
194
- * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
195
- * This functions return list of purchased items.
196
- * The "onUpdate" callback will be triggered when the user receives a new purchased item. It will provide an updated list of items, ranging from 0 to 20, to the onUpdate callback function. */
197
- /**
198
- * @param params
191
+ /** Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
192
+ * The maximum number of items per request is limited to 20.
193
+ * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
194
+ * Example usage:
195
+ * ```
196
+ * _smartico.api.getStorePurchasedItems().then((result) => {
197
+ * console.log(result);
198
+ * });
199
+ * ```
199
200
  */
200
- public async storeGetPurchasedItems({ from, to, onUpdate }: { from?: number, to?: number, onUpdate?: (data: TStoreItem[]) => void } = {}): Promise<TStoreItem[]> {
201
+
202
+ public async getStorePurchasedItems({ limit, offset, onUpdate } : { limit?: number, offset?: number, onUpdate?: (data: TStoreItem[]) => void} = {}): Promise<TStoreItem[]> {
201
203
  if (onUpdate) {
202
204
  this.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
203
205
  }
204
-
205
- return await this.api.storeGetPurchasedItemsT(null, from, to);
206
+ return OCache.use(onUpdateContextKey.StoreHistory, ECacheContext.WSAPI, () => this.api.storeGetPurchasedItemsT(null, limit, offset), CACHE_DATA_SEC);
206
207
  }
207
208
 
208
209
  /** Returns missions & badges categories */
@@ -442,7 +443,17 @@ export class WSAPI {
442
443
  OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Pots);
443
444
  }
444
445
 
445
-
446
+ /** Returns list of Jackpots that are active in the systen and matching to the filter definition.
447
+ * If filter is not provided, all active jackpots will be returned.
448
+ * Filter can be used to get jackpots related to specific game or specific jackpot template.
449
+ * You can call this method every second in order to get up to date information about current value of the jackpot(s) and present them to the end-users
450
+ * Example usage:
451
+ * ```
452
+ * _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
453
+ * console.log(result);
454
+ * });
455
+ * ```
456
+ */
446
457
  public async jackpotGet(filter?: { related_game_id?: string, jp_template_id?: number }): Promise<JackpotDetails[]> {
447
458
 
448
459
  const signature: string = `${filter?.jp_template_id}:${filter?.related_game_id}`;
@@ -485,6 +496,15 @@ export class WSAPI {
485
496
 
486
497
  }
487
498
 
499
+ /** Opt-in currently logged in user to the jackpot with the specified jp_template_id.
500
+ * You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
501
+ * Example usage:
502
+ * ```
503
+ * _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
504
+ * console.log('Opted in to the jackpot');
505
+ * });
506
+ * ```
507
+ */
488
508
  public async jackpotOptIn(filter: { jp_template_id: number }): Promise<JackpotsOptinResponse> {
489
509
 
490
510
  if (!filter.jp_template_id) {
@@ -498,6 +518,15 @@ export class WSAPI {
498
518
  return result;
499
519
  }
500
520
 
521
+ /** Opt-out currently logged in user from the jackpot with the specified jp_template_id.
522
+ * You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
523
+ * Example usage:
524
+ * ```
525
+ * _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
526
+ * console.log('Opted out from the jackpot');
527
+ * });
528
+ * ```
529
+ */
501
530
  public async jackpotOptOut(filter: { jp_template_id: number }): Promise<JackpotsOptoutResponse> {
502
531
 
503
532
  if (!filter.jp_template_id) {
@@ -190,6 +190,8 @@ export interface TTournament {
190
190
  image1: string;
191
191
  /* 2nd image URL representing the tournament */
192
192
  image2: string;
193
+ /* 2nd image URL representing the tournament for mobile */
194
+ image2_mobile: string;
193
195
  /* The message indicating the prize pool of the tournament */
194
196
  prize_pool_short: string;
195
197
  /* The message indicating the price to register in the tournament */
package/tsconfig.json CHANGED
@@ -25,6 +25,9 @@
25
25
  "src/MiniGames/SAWSpinErrorCode.ts",
26
26
  "src/Tournaments/TournamentRegistrationError.ts",
27
27
  "src/Store/BuyStoreItemErrorCode.ts",
28
+ "src/Leaderboard/LeaderBoardPeriodType.ts",
29
+ "src/Base/AchRelatedGame.ts",
30
+ "src/Jackpots/index.ts",
28
31
  ],
29
32
  "out": "docs",
30
33
  "plugin": ["typedoc-plugin-markdown", "typedoc-plugin-merge-modules"],