@smartico/public-api 0.0.70 → 0.0.71

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/README.md CHANGED
@@ -23,6 +23,21 @@ _smartico.api.levelsGet().then( levels => {
23
23
 
24
24
  ```
25
25
 
26
+ Some methods can be called with onUpdate callback, which is executed when there are changes in the underlying data.
27
+ Example:
28
+
29
+ ```javascript
30
+
31
+ var miniGamesUpdates = (games) => {
32
+ console.log('There are ' + games.length + ' games available now');
33
+ }
34
+
35
+ _smartico.api.getMiniGames( { onUpdate: miniGamesUpdates} ).then( games => {
36
+ console.log('There are ' + games.length + ' games available');
37
+ });
38
+
39
+ ```
40
+
26
41
  See the [API documentation](docs/classes/WSAPI.md) for all available methods and returning data.
27
42
 
28
43
 
@@ -13,7 +13,7 @@ export declare class WSAPI {
13
13
  /** Returns all the missions available the current user.
14
14
  * The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
15
15
  * The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
16
- getMissions({ onUpdate }: {
16
+ getMissions({ onUpdate }?: {
17
17
  onUpdate?: (data: TMissionOrBadge[]) => void;
18
18
  }): Promise<TMissionOrBadge[]>;
19
19
  /** Returns all the badges available the current user */
@@ -24,8 +24,8 @@ export declare class WSAPI {
24
24
  getStoreCategories(): Promise<TStoreItem[]>;
25
25
  /** Returns the list of mini-games available for user
26
26
  * The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
27
- * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one . Updated templates will be passed to onUpdate callback. */
28
- getMiniGames({ onUpdate }: {
27
+ * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one. Updated templates will be passed to onUpdate callback. */
28
+ getMiniGames({ onUpdate }?: {
29
29
  onUpdate?: (data: TMiniGameTemplate[]) => void;
30
30
  }): Promise<TMiniGameTemplate[]>;
31
31
  /** Plays the specified by template_id mini-game on behalf of user and returns prize_id or err_code */
@@ -33,7 +33,7 @@ export declare class WSAPI {
33
33
  /** Returns all the active instances of tournaments
34
34
  * The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
35
35
  * The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
36
- getTournamentsList({ onUpdate }: {
36
+ getTournamentsList({ onUpdate }?: {
37
37
  onUpdate?: (data: TTournament[]) => void;
38
38
  }): Promise<TTournament[]>;
39
39
  /** Returns details information of specific tournament instance, the response will includ tournamnet info and the leaderboard of players */
package/dist/index.js CHANGED
@@ -873,8 +873,9 @@ var WSAPI = /*#__PURE__*/function () {
873
873
  * The returned missions is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMissions with a new onUpdate callback, the old one will be overwritten by the new one.
874
874
  * The onUpdate callback will be called on mission OptIn and the updated missions will be passed to it. */
875
875
  ;
876
- _proto.getMissions = function getMissions(_ref) {
877
- var onUpdate = _ref.onUpdate;
876
+ _proto.getMissions = function getMissions(_temp) {
877
+ var _ref = _temp === void 0 ? {} : _temp,
878
+ onUpdate = _ref.onUpdate;
878
879
  try {
879
880
  var _this3 = this;
880
881
  if (onUpdate) {
@@ -913,10 +914,11 @@ var WSAPI = /*#__PURE__*/function () {
913
914
  }
914
915
  /** Returns the list of mini-games available for user
915
916
  * The returned list of mini-games is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getMiniGames with a new onUpdate callback, the old one will be overwritten by the new one.
916
- * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one . Updated templates will be passed to onUpdate callback. */
917
+ * The onUpdate callback will be called on available spin count change, if mini-game has increasing jackpot per spin or wined prize is spin/jackpot and if max count of the available user spin equal one. Updated templates will be passed to onUpdate callback. */
917
918
  ;
918
- _proto.getMiniGames = function getMiniGames(_ref2) {
919
- var onUpdate = _ref2.onUpdate;
919
+ _proto.getMiniGames = function getMiniGames(_temp2) {
920
+ var _ref2 = _temp2 === void 0 ? {} : _temp2,
921
+ onUpdate = _ref2.onUpdate;
920
922
  try {
921
923
  var _this7 = this;
922
924
  if (onUpdate) {
@@ -949,8 +951,9 @@ var WSAPI = /*#__PURE__*/function () {
949
951
  * The returned list is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getTournamentsList with a new onUpdate callback, the old one will be overwritten by the new one.
950
952
  * The onUpdate callback will be called when the user has registered in a tournament. Updated list will be passed to onUpdate callback.*/
951
953
  ;
952
- _proto.getTournamentsList = function getTournamentsList(_ref3) {
953
- var onUpdate = _ref3.onUpdate;
954
+ _proto.getTournamentsList = function getTournamentsList(_temp3) {
955
+ var _ref3 = _temp3 === void 0 ? {} : _temp3,
956
+ onUpdate = _ref3.onUpdate;
954
957
  try {
955
958
  var _this9 = this;
956
959
  if (onUpdate) {
@@ -990,7 +993,7 @@ var WSAPI = /*#__PURE__*/function () {
990
993
  _proto.updateOnPrizeWin = function updateOnPrizeWin(data) {
991
994
  try {
992
995
  var _this12 = this;
993
- var _temp2 = function () {
996
+ var _temp5 = function () {
994
997
  if (data.errCode === exports.SAWSpinErrorCode.SAW_OK) {
995
998
  return Promise.resolve(OCache.use(onUpdateContextKey.Saw, ECacheContext.WSAPI, function () {
996
999
  return _this12.api.sawGetTemplatesT(null);
@@ -1004,18 +1007,18 @@ var WSAPI = /*#__PURE__*/function () {
1004
1007
  var prizeType = (_template$prizes$find = template.prizes.find(function (p) {
1005
1008
  return p.id === data.saw_prize_id;
1006
1009
  })) == null ? void 0 : _template$prizes$find.prize_type;
1007
- var _temp = function () {
1010
+ var _temp4 = function () {
1008
1011
  if (template.jackpot_add_on_attempt || template.spin_count === 1 || prizeType === exports.MiniGamePrizeTypeName.JACKPOT || prizeType === exports.MiniGamePrizeTypeName.SPIN) {
1009
1012
  return Promise.resolve(_this12.api.sawGetTemplatesT(null)).then(function (updatedTemplates) {
1010
1013
  _this12.updateEntity(onUpdateContextKey.Saw, updatedTemplates);
1011
1014
  });
1012
1015
  }
1013
1016
  }();
1014
- if (_temp && _temp.then) return _temp.then(function () {});
1017
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
1015
1018
  });
1016
1019
  }
1017
1020
  }();
1018
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
1021
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(function () {}) : void 0);
1019
1022
  } catch (e) {
1020
1023
  return Promise.reject(e);
1021
1024
  }