@smartico/public-api 0.0.277 → 0.0.279

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.
@@ -26,6 +26,7 @@ export interface SAWTemplate {
26
26
  skin_folder: string;
27
27
  skin_css: string;
28
28
  use_new_popups?: boolean;
29
+ lottie_animation_speed?: number;
29
30
  };
30
31
  expose_game_stat_on_api?: boolean;
31
32
  requires_prize_claim?: boolean;
@@ -178,6 +178,9 @@ export declare class WSAPI {
178
178
  * Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
179
179
  * The maximum number of items per request is limited to 20.
180
180
  * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
181
+ * The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
182
+ * Note that each time you call getStorePurchasedItems with a new onUpdate callback, the old one will be overwritten by the new one.
183
+ * The onUpdate callback will be called on purchase of the store item and the last 20 items will be passed to it.
181
184
  *
182
185
  * **Example**:
183
186
  * ```
@@ -465,6 +468,7 @@ export declare class WSAPI {
465
468
  private updateMissions;
466
469
  private updateBonuses;
467
470
  private updateTournaments;
471
+ private updateStorePurchasedItems;
468
472
  private updateInboxMessages;
469
473
  private updateRaffles;
470
474
  private updateEntity;
@@ -126,7 +126,12 @@ export interface TMiniGameTemplate {
126
126
  buyin_cost_diamonds?: number;
127
127
  /** in case of charging type 'Spin attempts', shows the current number of spin attempts that user has */
128
128
  spin_count?: number;
129
- /** if the game is limit to the number of spins that user can do during period of time, this property shows the epoch time in UTC when the next attempt will be available */
129
+ /**
130
+ * if the game is limit to the number of spins that user can do during period of time,
131
+ * this property shows the epoch time in UTC when the next attempt will be available.
132
+ * Note that you need to enable 'Show time to the next available spin' setting on mini-game template in the backoffice
133
+ * Important: this field will not be populated if “Max number of attempts a user can do” is set to value different from 1
134
+ * */
130
135
  next_available_spin_ts: number;
131
136
  /** The message that should be shown to the user when he cannot play the game, server rejected attempt with error code SAWSpinErrorCode.SAW_FAILED_MAX_SPINS_REACHED */
132
137
  over_limit_message: string;
package/dist/index.js CHANGED
@@ -1913,6 +1913,9 @@ var WSAPI = /*#__PURE__*/function () {
1913
1913
  on(exports.ClassId.TOURNAMENT_REGISTER_RESPONSE, function () {
1914
1914
  return _this.updateTournaments();
1915
1915
  });
1916
+ on(exports.ClassId.BUY_SHOP_ITEM_RESPONSE, function () {
1917
+ return _this.updateStorePurchasedItems();
1918
+ });
1916
1919
  on(exports.ClassId.CLIENT_ENGAGEMENT_EVENT_NEW, function () {
1917
1920
  return _this.updateInboxMessages();
1918
1921
  });
@@ -2251,6 +2254,9 @@ var WSAPI = /*#__PURE__*/function () {
2251
2254
  * Returns purchased items based on the provided parameters. "Limit" and "offset" indicate the range of items to be fetched.
2252
2255
  * The maximum number of items per request is limited to 20.
2253
2256
  * You can leave this params empty and by default it will return list of purchased items ranging from 0 to 20.
2257
+ * The returned store items are cached for 30 seconds. But you can pass the onUpdate callback as a parameter.
2258
+ * Note that each time you call getStorePurchasedItems with a new onUpdate callback, the old one will be overwritten by the new one.
2259
+ * The onUpdate callback will be called on purchase of the store item and the last 20 items will be passed to it.
2254
2260
  *
2255
2261
  * **Example**:
2256
2262
  * ```
@@ -2866,31 +2872,41 @@ var WSAPI = /*#__PURE__*/function () {
2866
2872
  return Promise.reject(e);
2867
2873
  }
2868
2874
  };
2869
- _proto.updateInboxMessages = function updateInboxMessages() {
2875
+ _proto.updateStorePurchasedItems = function updateStorePurchasedItems() {
2870
2876
  try {
2871
2877
  var _this40 = this;
2872
- return Promise.resolve(_this40.api.getInboxMessagesT(null)).then(function (payload) {
2873
- _this40.updateEntity(onUpdateContextKey.InboxMessages, payload);
2878
+ return Promise.resolve(_this40.api.storeGetPurchasedItemsT(null, 20, 0)).then(function (payload) {
2879
+ _this40.updateEntity(onUpdateContextKey.StoreHistory, payload);
2874
2880
  });
2875
2881
  } catch (e) {
2876
2882
  return Promise.reject(e);
2877
2883
  }
2878
2884
  };
2879
- _proto.updateRaffles = function updateRaffles() {
2885
+ _proto.updateInboxMessages = function updateInboxMessages() {
2880
2886
  try {
2881
2887
  var _this41 = this;
2882
- return Promise.resolve(_this41.api.getRafflesT(null)).then(function (payload) {
2883
- _this41.updateEntity(onUpdateContextKey.Raffles, payload);
2888
+ return Promise.resolve(_this41.api.getInboxMessagesT(null)).then(function (payload) {
2889
+ _this41.updateEntity(onUpdateContextKey.InboxMessages, payload);
2884
2890
  });
2885
2891
  } catch (e) {
2886
2892
  return Promise.reject(e);
2887
2893
  }
2888
2894
  };
2889
- _proto.updateEntity = function updateEntity(contextKey, payload) {
2895
+ _proto.updateRaffles = function updateRaffles() {
2890
2896
  try {
2891
2897
  var _this42 = this;
2898
+ return Promise.resolve(_this42.api.getRafflesT(null)).then(function (payload) {
2899
+ _this42.updateEntity(onUpdateContextKey.Raffles, payload);
2900
+ });
2901
+ } catch (e) {
2902
+ return Promise.reject(e);
2903
+ }
2904
+ };
2905
+ _proto.updateEntity = function updateEntity(contextKey, payload) {
2906
+ try {
2907
+ var _this43 = this;
2892
2908
  OCache.set(contextKey, payload, exports.ECacheContext.WSAPI);
2893
- var onUpdate = _this42.onUpdateCallback.get(contextKey);
2909
+ var onUpdate = _this43.onUpdateCallback.get(contextKey);
2894
2910
  if (onUpdate) {
2895
2911
  onUpdate(payload);
2896
2912
  }
@@ -2931,17 +2947,17 @@ var WSAPI = /*#__PURE__*/function () {
2931
2947
  ;
2932
2948
  _proto.jackpotGet = function jackpotGet(filter) {
2933
2949
  try {
2934
- var _this43 = this;
2950
+ var _this44 = this;
2935
2951
  var signature = (filter == null ? void 0 : filter.jp_template_id) + ":" + (filter == null ? void 0 : filter.related_game_id);
2936
- if (signature !== _this43.jackpotGetSignature) {
2937
- _this43.jackpotGetSignature = signature;
2938
- _this43.jackpotClearCache();
2952
+ if (signature !== _this44.jackpotGetSignature) {
2953
+ _this44.jackpotGetSignature = signature;
2954
+ _this44.jackpotClearCache();
2939
2955
  }
2940
2956
  var jackpots = [];
2941
2957
  var pots = [];
2942
2958
  return Promise.resolve(OCache.use(onUpdateContextKey.Jackpots, exports.ECacheContext.WSAPI, function () {
2943
2959
  try {
2944
- return Promise.resolve(_this43.api.jackpotGet(null, filter)).then(function (_jackpots) {
2960
+ return Promise.resolve(_this44.api.jackpotGet(null, filter)).then(function (_jackpots) {
2945
2961
  var _pots = _jackpots.items.map(function (jp) {
2946
2962
  return jp.pot;
2947
2963
  });
@@ -2973,10 +2989,10 @@ var WSAPI = /*#__PURE__*/function () {
2973
2989
  var jp_template_ids = jackpots.map(function (jp) {
2974
2990
  return jp.jp_template_id;
2975
2991
  });
2976
- return Promise.resolve(_this43.api.potGet(null, {
2992
+ return Promise.resolve(_this44.api.potGet(null, {
2977
2993
  jp_template_ids: jp_template_ids
2978
- })).then(function (_this43$api$potGet) {
2979
- return _this43$api$potGet.items;
2994
+ })).then(function (_this44$api$potGet) {
2995
+ return _this44$api$potGet.items;
2980
2996
  });
2981
2997
  } catch (e) {
2982
2998
  return Promise.reject(e);
@@ -3009,11 +3025,11 @@ var WSAPI = /*#__PURE__*/function () {
3009
3025
  ;
3010
3026
  _proto.jackpotOptIn = function jackpotOptIn(filter) {
3011
3027
  try {
3012
- var _this44 = this;
3028
+ var _this45 = this;
3013
3029
  if (!filter.jp_template_id) {
3014
3030
  throw new Error('jp_template_id is required in jackpotOptIn');
3015
3031
  }
3016
- return Promise.resolve(_this44.api.jackpotOptIn(null, filter));
3032
+ return Promise.resolve(_this45.api.jackpotOptIn(null, filter));
3017
3033
  } catch (e) {
3018
3034
  return Promise.reject(e);
3019
3035
  }
@@ -3035,11 +3051,11 @@ var WSAPI = /*#__PURE__*/function () {
3035
3051
  ;
3036
3052
  _proto.jackpotOptOut = function jackpotOptOut(filter) {
3037
3053
  try {
3038
- var _this45 = this;
3054
+ var _this46 = this;
3039
3055
  if (!filter.jp_template_id) {
3040
3056
  throw new Error('jp_template_id is required in jackpotOptOut');
3041
3057
  }
3042
- return Promise.resolve(_this45.api.jackpotOptOut(null, filter));
3058
+ return Promise.resolve(_this46.api.jackpotOptOut(null, filter));
3043
3059
  } catch (e) {
3044
3060
  return Promise.reject(e);
3045
3061
  }
@@ -3065,9 +3081,9 @@ var WSAPI = /*#__PURE__*/function () {
3065
3081
  offset = _ref10.offset,
3066
3082
  jp_template_id = _ref10.jp_template_id;
3067
3083
  try {
3068
- var _this46 = this;
3084
+ var _this47 = this;
3069
3085
  return Promise.resolve(OCache.use(onUpdateContextKey.JackpotWinners + jp_template_id, exports.ECacheContext.WSAPI, function () {
3070
- return _this46.api.getJackpotWinnersT(null, limit, offset, jp_template_id);
3086
+ return _this47.api.getJackpotWinnersT(null, limit, offset, jp_template_id);
3071
3087
  }, JACKPOT_WINNERS_CACHE_SEC));
3072
3088
  } catch (e) {
3073
3089
  return Promise.reject(e);
@@ -3091,12 +3107,12 @@ var WSAPI = /*#__PURE__*/function () {
3091
3107
  var jp_template_id = _ref11.jp_template_id,
3092
3108
  onUpdate = _ref11.onUpdate;
3093
3109
  try {
3094
- var _this47 = this;
3110
+ var _this48 = this;
3095
3111
  if (onUpdate) {
3096
- _this47.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
3112
+ _this48.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
3097
3113
  }
3098
3114
  return Promise.resolve(OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, exports.ECacheContext.WSAPI, function () {
3099
- return _this47.api.getJackpotEligibleGamesT(null, {
3115
+ return _this48.api.getJackpotEligibleGamesT(null, {
3100
3116
  jp_template_id: jp_template_id
3101
3117
  });
3102
3118
  }, JACKPOT_ELIGIBLE_GAMES_CACHE_SEC));
@@ -3125,8 +3141,8 @@ var WSAPI = /*#__PURE__*/function () {
3125
3141
  ;
3126
3142
  _proto.getRelatedItemsForGame = function getRelatedItemsForGame(related_game_id) {
3127
3143
  try {
3128
- var _this48 = this;
3129
- return Promise.resolve(_this48.api.getRelatedItemsForGame(null, related_game_id));
3144
+ var _this49 = this;
3145
+ return Promise.resolve(_this49.api.getRelatedItemsForGame(null, related_game_id));
3130
3146
  } catch (e) {
3131
3147
  return Promise.reject(e);
3132
3148
  }
@@ -3151,12 +3167,12 @@ var WSAPI = /*#__PURE__*/function () {
3151
3167
  var _ref12 = _temp11 === void 0 ? {} : _temp11,
3152
3168
  onUpdate = _ref12.onUpdate;
3153
3169
  try {
3154
- var _this49 = this;
3170
+ var _this50 = this;
3155
3171
  if (onUpdate) {
3156
- _this49.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
3172
+ _this50.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
3157
3173
  }
3158
3174
  return Promise.resolve(OCache.use(onUpdateContextKey.Raffles, exports.ECacheContext.WSAPI, function () {
3159
- return _this49.api.getRafflesT(null);
3175
+ return _this50.api.getRafflesT(null);
3160
3176
  }, CACHE_DATA_SEC));
3161
3177
  } catch (e) {
3162
3178
  return Promise.reject(e);
@@ -3179,8 +3195,8 @@ var WSAPI = /*#__PURE__*/function () {
3179
3195
  ;
3180
3196
  _proto.getRaffleDrawRun = function getRaffleDrawRun(props) {
3181
3197
  try {
3182
- var _this50 = this;
3183
- return Promise.resolve(_this50.api.getRaffleDrawRun(null, props)).then(function (res) {
3198
+ var _this51 = this;
3199
+ return Promise.resolve(_this51.api.getRaffleDrawRun(null, props)).then(function (res) {
3184
3200
  if (!props.raffle_id || !props.run_id) {
3185
3201
  throw new Error('both raffle_id and run_id are required');
3186
3202
  }
@@ -3207,8 +3223,8 @@ var WSAPI = /*#__PURE__*/function () {
3207
3223
  ;
3208
3224
  _proto.getRaffleDrawRunsHistory = function getRaffleDrawRunsHistory(props) {
3209
3225
  try {
3210
- var _this51 = this;
3211
- return Promise.resolve(_this51.api.getRaffleDrawRunsHistory(null, props)).then(function (res) {
3226
+ var _this52 = this;
3227
+ return Promise.resolve(_this52.api.getRaffleDrawRunsHistory(null, props)).then(function (res) {
3212
3228
  if (!props.raffle_id) {
3213
3229
  throw new Error('raffle_id is required');
3214
3230
  }
@@ -3235,11 +3251,11 @@ var WSAPI = /*#__PURE__*/function () {
3235
3251
  ;
3236
3252
  _proto.claimRafflePrize = function claimRafflePrize(props) {
3237
3253
  try {
3238
- var _this52 = this;
3254
+ var _this53 = this;
3239
3255
  if (!props.won_id) {
3240
3256
  throw new Error('won_id is required');
3241
3257
  }
3242
- return Promise.resolve(_this52.api.claimRafflePrize(null, {
3258
+ return Promise.resolve(_this53.api.claimRafflePrize(null, {
3243
3259
  won_id: props.won_id
3244
3260
  })).then(raffleClaimPrizeResponseTransform);
3245
3261
  } catch (e) {
@@ -4290,7 +4306,7 @@ var SmarticoAPI = /*#__PURE__*/function () {
4290
4306
  });
4291
4307
  return Promise.resolve(_this50.send(message, exports.ClassId.GET_LEADERS_BOARD_RESPONSE, force_language)).then(function (response) {
4292
4308
  var _response$map$boardKe, _response$map$boardKe2;
4293
- var boardKey = Object.keys(response.map).find(function (k) {
4309
+ var boardKey = Object.keys(response.map || {}).find(function (k) {
4294
4310
  return period_type_id === undefined || k === (period_type_id == null ? void 0 : period_type_id.toString());
4295
4311
  });
4296
4312
  if (boardKey === undefined) {