@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
@@ -3,15 +3,31 @@ import { JackpotContributionType } from "./JackpotContributionType";
3
3
  import { JackpotPot } from "./JackpotPot";
4
4
  import { JackpotPublicMeta } from "./JackpotPublicMeta";
5
5
  import { JackpotType } from "./JackpotType";
6
+ /**
7
+ * JackpotDetails the information about Jackpot template
8
+ * It also includes JackpotPot object that holds the current value of the jackpot
9
+ * Flag is_opted_in indicates if the current user is opted in to the jackpot
10
+ */
6
11
  interface JackpotDetails {
12
+ /** ID of the jackpot template */
7
13
  jp_template_id: number;
14
+ /** type of jackpot logic */
8
15
  jp_type_id: JackpotType;
16
+ /** UI information of jackpot, like name, description, etc. */
9
17
  jp_public_meta: JackpotPublicMeta;
18
+ /** base currency of the jackpot */
10
19
  jp_currency: string;
20
+ /** wallet currency of currently logged in user */
21
+ user_currency: string;
22
+ /** list of related games that are eligible for the jackpot */
11
23
  related_games?: AchRelatedGame[];
24
+ /** type of the user contribution to the jackpot */
12
25
  contribution_type: JackpotContributionType;
26
+ /** value of the user contribution. Fixed amount or percentage of bet depending on the contribution type */
13
27
  contribution_value: number;
28
+ /** information of current value of the jackpot */
14
29
  pot: JackpotPot;
30
+ /** indication if the current user is opted in to the jackpot */
15
31
  is_opted_in: boolean;
16
32
  }
17
33
  export { JackpotDetails };
@@ -1,7 +1,13 @@
1
1
  interface JackpotPot {
2
+ /** ID of the jackpot template */
2
3
  jp_template_id: number;
4
+ /** ID of the jackpot pot */
3
5
  jp_pot_id: number;
6
+ /** currency of the jackpot pot in the Jackput base currency */
4
7
  current_pot_amount: number;
8
+ /** currency of the jackpot pot in the user wallet currency */
9
+ current_pot_amount_user_currency: number;
10
+ /** the date/time when this pot exploded */
5
11
  explode_date_ts: number;
6
12
  }
7
13
  export { JackpotPot };
@@ -1,11 +1,18 @@
1
1
  import { JackpotHtmlTemplate } from './JackpotHtmlTemplate';
2
2
  interface JackpotPublicMeta {
3
+ /** name of the jackpot */
3
4
  name: string;
5
+ /** description/rules of the jackpot */
4
6
  description: string;
7
+ /** image url of the jackpot */
5
8
  image_url: string;
9
+ /** HTML template for the winner of the jackpt */
6
10
  winner_template: JackpotHtmlTemplate;
11
+ /** HTML template for the not winner of the jackpot */
7
12
  not_winner_template: JackpotHtmlTemplate;
13
+ /** custom value of placeholder1 defined by operator and can be used in the HTML templates */
8
14
  placeholder1: string;
15
+ /** custom value of placeholder2 defined by operator and can be used in the HTML templates */
9
16
  placeholder2: string;
10
17
  }
11
18
  export { JackpotPublicMeta };
@@ -36,8 +36,8 @@ export interface SAWTemplateUI {
36
36
  custom_section_id?: number;
37
37
  only_in_custom_section?: boolean;
38
38
  custom_data: any;
39
- placeholder_1?: string;
40
- placeholder_2?: string;
39
+ placeholder1?: string;
40
+ placeholder2?: string;
41
41
  prize_drop_template?: {
42
42
  id: string;
43
43
  content: string;
@@ -84,7 +84,7 @@ declare class SmarticoAPI {
84
84
  storeGetCategories(user_ext_id: string): Promise<GetCategoriesStoreResponse>;
85
85
  storeGetCategoriesT(user_ext_id: string): Promise<TStoreCategory[]>;
86
86
  storeGetPurchasedItems(user_ext_id: string, limit?: number, offset?: number): Promise<GetStoreHistoryResponse>;
87
- storeGetPurchasedItemsT(user_ext_id: string, from?: number, to?: number): Promise<TStoreItem[]>;
87
+ storeGetPurchasedItemsT(user_ext_id: string, limit?: number, offset?: number): Promise<TStoreItem[]>;
88
88
  missionsGetItems(user_ext_id: string): Promise<GetAchievementMapResponse>;
89
89
  missionsGetItemsT(user_ext_id: string): Promise<TMissionOrBadge[]>;
90
90
  getUserGamificationInfo(user_ext_id: string): Promise<GetAchievementsUserInfoResponse>;
@@ -408,8 +408,8 @@ export interface SAWTemplateUI {
408
408
  custom_section_id?: number;
409
409
  only_in_custom_section?: boolean;
410
410
  custom_data: any;
411
- placeholder_1?: string;
412
- placeholder_2?: string;
411
+ placeholder1?: string;
412
+ placeholder2?: string;
413
413
  prize_drop_template?: {
414
414
  id: string;
415
415
  content: string;
@@ -512,6 +512,8 @@ export interface TournamentPublicMeta {
512
512
  image_url?: string;
513
513
  /** 2nd image */
514
514
  image_url2?: string;
515
+ /** 2nd image for mobile */
516
+ image_url2_mobile?: string;
515
517
  /** Description, html capable */
516
518
  description?: string;
517
519
  /** Short explanation of prize pool */
@@ -1,5 +1,5 @@
1
1
  import { ProtocolMessage } from "../Base/ProtocolMessage";
2
2
  export interface GetStoreHistoryRequest extends ProtocolMessage {
3
- offset?: number;
4
3
  limit?: number;
4
+ offset?: number;
5
5
  }
@@ -2,5 +2,5 @@ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
2
  import { StoreItemPurchased } from "./StoreItemPurchased";
3
3
  export interface GetStoreHistoryResponse extends ProtocolResponse {
4
4
  items: StoreItemPurchased[];
5
- hasMore: boolean;
5
+ hasMore?: boolean;
6
6
  }
@@ -93,17 +93,19 @@ export declare class WSAPI {
93
93
  buyStoreItem(item_id: number): Promise<TBuyStoreItemResult>;
94
94
  /** Returns store categories */
95
95
  getStoreCategories(): Promise<TStoreCategory[]>;
96
- /** Returns store purchased items based on the provided parameters. "From" and "to" indicate the range of items to be fetched.
97
- * The maximum number of messages per request is limited to 20.
98
- * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
99
- * This functions return list of purchased items.
100
- * 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. */
101
- /**
102
- * @param params
103
- */
104
- storeGetPurchasedItems({ from, to, onUpdate }?: {
105
- from?: number;
106
- to?: number;
96
+ /** Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
97
+ * The maximum number of items per request is limited to 20.
98
+ * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
99
+ * Example usage:
100
+ * ```
101
+ * _smartico.api.getStorePurchasedItems().then((result) => {
102
+ * console.log(result);
103
+ * });
104
+ * ```
105
+ */
106
+ getStorePurchasedItems({ limit, offset, onUpdate }?: {
107
+ limit?: number;
108
+ offset?: number;
107
109
  onUpdate?: (data: TStoreItem[]) => void;
108
110
  }): Promise<TStoreItem[]>;
109
111
  /** Returns missions & badges categories */
@@ -179,13 +181,42 @@ export declare class WSAPI {
179
181
  private updateInboxMessages;
180
182
  private updateEntity;
181
183
  private jackpotClearCache;
184
+ /** Returns list of Jackpots that are active in the systen and matching to the filter definition.
185
+ * If filter is not provided, all active jackpots will be returned.
186
+ * Filter can be used to get jackpots related to specific game or specific jackpot template.
187
+ * 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
188
+ * Example usage:
189
+ * ```
190
+ * _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
191
+ * console.log(result);
192
+ * });
193
+ * ```
194
+ */
182
195
  jackpotGet(filter?: {
183
196
  related_game_id?: string;
184
197
  jp_template_id?: number;
185
198
  }): Promise<JackpotDetails[]>;
199
+ /** Opt-in currently logged in user to the jackpot with the specified jp_template_id.
200
+ * You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
201
+ * Example usage:
202
+ * ```
203
+ * _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
204
+ * console.log('Opted in to the jackpot');
205
+ * });
206
+ * ```
207
+ */
186
208
  jackpotOptIn(filter: {
187
209
  jp_template_id: number;
188
210
  }): Promise<JackpotsOptinResponse>;
211
+ /** Opt-out currently logged in user from the jackpot with the specified jp_template_id.
212
+ * You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
213
+ * Example usage:
214
+ * ```
215
+ * _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
216
+ * console.log('Opted out from the jackpot');
217
+ * });
218
+ * ```
219
+ */
189
220
  jackpotOptOut(filter: {
190
221
  jp_template_id: number;
191
222
  }): Promise<JackpotsOptoutResponse>;
@@ -160,6 +160,7 @@ export interface TTournament {
160
160
  description: string;
161
161
  image1: string;
162
162
  image2: string;
163
+ image2_mobile: string;
163
164
  prize_pool_short: string;
164
165
  custom_price_text: string;
165
166
  /** The message that should be shown to the user when the user cannot register in tournament with error code TOURNAMENT_USER_DONT_MATCH_CONDITIONS */
package/dist/index.js CHANGED
@@ -900,6 +900,7 @@ var TournamentItemsTransform = function TournamentItemsTransform(items) {
900
900
  segment_dont_match_message: r.publicMeta.segment_dont_match_message,
901
901
  image1: r.publicMeta.image_url,
902
902
  image2: r.publicMeta.image_url2,
903
+ image2_mobile: r.publicMeta.image_url2_mobile,
903
904
  prize_pool_short: r.publicMeta.prize_pool_short,
904
905
  custom_price_text: r.publicMeta.custom_price_text,
905
906
  custom_section_id: r.publicMeta.custom_section_id,
@@ -1346,26 +1347,30 @@ var WSAPI = /*#__PURE__*/function () {
1346
1347
  return Promise.reject(e);
1347
1348
  }
1348
1349
  }
1349
- /** Returns store purchased items based on the provided parameters. "From" and "to" indicate the range of items to be fetched.
1350
- * The maximum number of messages per request is limited to 20.
1350
+ /** Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
1351
+ * The maximum number of items per request is limited to 20.
1351
1352
  * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
1352
- * This functions return list of purchased items.
1353
- * 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. */
1354
- /**
1355
- * @param params
1353
+ * Example usage:
1354
+ * ```
1355
+ * _smartico.api.getStorePurchasedItems().then((result) => {
1356
+ * console.log(result);
1357
+ * });
1358
+ * ```
1356
1359
  */
1357
1360
  ;
1358
- _proto.storeGetPurchasedItems = function storeGetPurchasedItems(_temp2) {
1361
+ _proto.getStorePurchasedItems = function getStorePurchasedItems(_temp2) {
1359
1362
  var _ref2 = _temp2 === void 0 ? {} : _temp2,
1360
- from = _ref2.from,
1361
- to = _ref2.to,
1363
+ limit = _ref2.limit,
1364
+ offset = _ref2.offset,
1362
1365
  onUpdate = _ref2.onUpdate;
1363
1366
  try {
1364
1367
  var _this11 = this;
1365
1368
  if (onUpdate) {
1366
1369
  _this11.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
1367
1370
  }
1368
- return Promise.resolve(_this11.api.storeGetPurchasedItemsT(null, from, to));
1371
+ return Promise.resolve(OCache.use(onUpdateContextKey.StoreHistory, exports.ECacheContext.WSAPI, function () {
1372
+ return _this11.api.storeGetPurchasedItemsT(null, limit, offset);
1373
+ }, CACHE_DATA_SEC));
1369
1374
  } catch (e) {
1370
1375
  return Promise.reject(e);
1371
1376
  }
@@ -1727,7 +1732,19 @@ var WSAPI = /*#__PURE__*/function () {
1727
1732
  } catch (e) {
1728
1733
  return Promise.reject(e);
1729
1734
  }
1730
- };
1735
+ }
1736
+ /** Returns list of Jackpots that are active in the systen and matching to the filter definition.
1737
+ * If filter is not provided, all active jackpots will be returned.
1738
+ * Filter can be used to get jackpots related to specific game or specific jackpot template.
1739
+ * 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
1740
+ * Example usage:
1741
+ * ```
1742
+ * _smartico.api.jackpotGet({ related_game_id: 'wooko-slot' }).then((result) => {
1743
+ * console.log(result);
1744
+ * });
1745
+ * ```
1746
+ */
1747
+ ;
1731
1748
  _proto.jackpotGet = function jackpotGet(filter) {
1732
1749
  try {
1733
1750
  var _this36 = this;
@@ -1785,7 +1802,17 @@ var WSAPI = /*#__PURE__*/function () {
1785
1802
  } catch (e) {
1786
1803
  return Promise.reject(e);
1787
1804
  }
1788
- };
1805
+ }
1806
+ /** Opt-in currently logged in user to the jackpot with the specified jp_template_id.
1807
+ * You may call jackpotGet method after doing optin to see that user is opted in to the jackpot.
1808
+ * Example usage:
1809
+ * ```
1810
+ * _smartico.api.jackpotOptIn({ jp_template_id: 123 }).then((result) => {
1811
+ * console.log('Opted in to the jackpot');
1812
+ * });
1813
+ * ```
1814
+ */
1815
+ ;
1789
1816
  _proto.jackpotOptIn = function jackpotOptIn(filter) {
1790
1817
  try {
1791
1818
  var _this37 = this;
@@ -1800,7 +1827,17 @@ var WSAPI = /*#__PURE__*/function () {
1800
1827
  } catch (e) {
1801
1828
  return Promise.reject(e);
1802
1829
  }
1803
- };
1830
+ }
1831
+ /** Opt-out currently logged in user from the jackpot with the specified jp_template_id.
1832
+ * You may call jackpotGet method after doing optout to see that user is not opted in to the jackpot.
1833
+ * Example usage:
1834
+ * ```
1835
+ * _smartico.api.jackpotOptOut({ jp_template_id: 123 }).then((result) => {
1836
+ * console.log('Opted out from the jackpot');
1837
+ * });
1838
+ * ```
1839
+ */
1840
+ ;
1804
1841
  _proto.jackpotOptOut = function jackpotOptOut(filter) {
1805
1842
  try {
1806
1843
  var _this38 = this;
@@ -2399,17 +2436,9 @@ var SmarticoAPI = /*#__PURE__*/function () {
2399
2436
  return Promise.reject(e);
2400
2437
  }
2401
2438
  };
2402
- _proto.storeGetPurchasedItemsT = function storeGetPurchasedItemsT(user_ext_id, from, to) {
2403
- if (from === void 0) {
2404
- from = 0;
2405
- }
2406
- if (to === void 0) {
2407
- to = 20;
2408
- }
2439
+ _proto.storeGetPurchasedItemsT = function storeGetPurchasedItemsT(user_ext_id, limit, offset) {
2409
2440
  try {
2410
2441
  var _this26 = this;
2411
- var limit = to - from > 20 ? 20 : to - from;
2412
- var offset = from;
2413
2442
  return Promise.resolve(_this26.storeGetPurchasedItems(user_ext_id, limit, offset)).then(function (_this26$storeGetPurch) {
2414
2443
  return StoreItemPurchasedTransform(_this26$storeGetPurch.items);
2415
2444
  });