@smartico/public-api 0.0.383 → 0.0.385

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/dist/index.js CHANGED
@@ -911,6 +911,9 @@ var InboxMessagesTransform = function InboxMessagesTransform(items) {
911
911
  };
912
912
 
913
913
  var InboxMessageBodyTransform = function InboxMessageBodyTransform(item) {
914
+ if (!item) {
915
+ return null;
916
+ }
914
917
  var x = {
915
918
  action: item.action,
916
919
  icon: item.image,
@@ -1880,7 +1883,7 @@ TournamentUtils.getPrizeTransformed = function (prize) {
1880
1883
 
1881
1884
  var TournamentItemsTransform = function TournamentItemsTransform(items) {
1882
1885
  return items.filter(function (r) {
1883
- return r.tournamentId >= 1;
1886
+ return r != null && r.tournamentId >= 1;
1884
1887
  }).map(function (r) {
1885
1888
  var x = _extends({
1886
1889
  instance_id: r.tournamentInstanceId,
@@ -2211,7 +2214,7 @@ var WSAPIBase = /*#__PURE__*/function () {
2211
2214
  var _this = this;
2212
2215
  OCache.set(contextKey, payload, exports.ECacheContext.WSAPI);
2213
2216
  var onUpdate = _this.onUpdateCallback.get(contextKey);
2214
- if (onUpdate) {
2217
+ if (typeof onUpdate === 'function') {
2215
2218
  onUpdate(payload);
2216
2219
  }
2217
2220
  return Promise.resolve();
@@ -3014,7 +3017,7 @@ var WSAPIUser = /*#__PURE__*/function (_WSAPIBase) {
3014
3017
  onUpdate = _ref.onUpdate;
3015
3018
  try {
3016
3019
  var _this6 = this;
3017
- if (onUpdate) {
3020
+ if (typeof onUpdate === 'function') {
3018
3021
  _this6.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
3019
3022
  }
3020
3023
  return Promise.resolve(OCache.use(onUpdateContextKey.ActivityLog, exports.ECacheContext.WSAPI, function () {
@@ -3380,7 +3383,7 @@ var WSAPIMissions = /*#__PURE__*/function (_WSAPIGeneral) {
3380
3383
  onUpdate = _ref.onUpdate;
3381
3384
  try {
3382
3385
  var _this = this;
3383
- if (onUpdate) {
3386
+ if (typeof onUpdate === 'function') {
3384
3387
  _this.onUpdateCallback.set(onUpdateContextKey.Missions, onUpdate);
3385
3388
  }
3386
3389
  return Promise.resolve(OCache.use(onUpdateContextKey.Missions, exports.ECacheContext.WSAPI, function () {
@@ -3968,7 +3971,7 @@ var WSAPIBonuses = /*#__PURE__*/function (_WSAPIMissions) {
3968
3971
  onUpdate = _ref.onUpdate;
3969
3972
  try {
3970
3973
  var _this = this;
3971
- if (onUpdate) {
3974
+ if (typeof onUpdate === 'function') {
3972
3975
  _this.onUpdateCallback.set(onUpdateContextKey.Bonuses, onUpdate);
3973
3976
  }
3974
3977
  return Promise.resolve(OCache.use(onUpdateContextKey.Bonuses, exports.ECacheContext.WSAPI, function () {
@@ -4315,7 +4318,7 @@ var WSAPIStore = /*#__PURE__*/function (_WSAPIBonuses) {
4315
4318
  onUpdate = _ref.onUpdate;
4316
4319
  try {
4317
4320
  var _this2 = this;
4318
- if (onUpdate) {
4321
+ if (typeof onUpdate === 'function') {
4319
4322
  _this2.onUpdateCallback.set(onUpdateContextKey.StoreItems, onUpdate);
4320
4323
  }
4321
4324
  return Promise.resolve(OCache.use(onUpdateContextKey.StoreItems, exports.ECacheContext.WSAPI, function () {
@@ -4824,7 +4827,7 @@ var WSAPIStore = /*#__PURE__*/function (_WSAPIBonuses) {
4824
4827
  var requestLimit = limit === undefined ? 20 : limit;
4825
4828
  var requestOffset = offset === undefined ? 0 : offset;
4826
4829
  var cacheKey = _this5.storeHistoryCacheKey(requestLimit, requestOffset);
4827
- if (onUpdate) {
4830
+ if (typeof onUpdate === 'function') {
4828
4831
  _this5.onUpdateCallback.set(onUpdateContextKey.StoreHistory, onUpdate);
4829
4832
  _this5.storeHistoryOnUpdateParams = {
4830
4833
  limit: requestLimit,
@@ -5002,7 +5005,7 @@ var WSAPITournaments = /*#__PURE__*/function (_WSAPIStore) {
5002
5005
  onUpdate = _ref.onUpdate;
5003
5006
  try {
5004
5007
  var _this = this;
5005
- if (onUpdate) {
5008
+ if (typeof onUpdate === 'function') {
5006
5009
  _this.onUpdateCallback.set(onUpdateContextKey.TournamentList, onUpdate);
5007
5010
  }
5008
5011
  return Promise.resolve(OCache.use(onUpdateContextKey.TournamentList, exports.ECacheContext.WSAPI, function () {
@@ -5556,7 +5559,7 @@ var WSAPIClans = /*#__PURE__*/function (_WSAPITournaments) {
5556
5559
  onUpdate = _ref.onUpdate;
5557
5560
  try {
5558
5561
  var _this = this;
5559
- if (onUpdate) {
5562
+ if (typeof onUpdate === 'function') {
5560
5563
  _this.onUpdateCallback.set(onUpdateContextKey.Clans, onUpdate);
5561
5564
  }
5562
5565
  return Promise.resolve(OCache.use(onUpdateContextKey.Clans, exports.ECacheContext.WSAPI, function () {
@@ -5968,6 +5971,9 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
5968
5971
  return Promise.resolve(OCache.use(onUpdateContextKey.Jackpots, exports.ECacheContext.WSAPI, function () {
5969
5972
  try {
5970
5973
  return Promise.resolve(_this2.api.jackpotGet(_this2.userExtId, filter)).then(function (_jackpots) {
5974
+ if (!(_jackpots != null && _jackpots.items)) {
5975
+ return [];
5976
+ }
5971
5977
  var _pots = _jackpots.items.map(function (jp) {
5972
5978
  return jp.pot;
5973
5979
  });
@@ -6296,7 +6302,7 @@ var WSAPIJackpots = /*#__PURE__*/function (_WSAPIClans) {
6296
6302
  onUpdate = _ref2.onUpdate;
6297
6303
  try {
6298
6304
  var _this6 = this;
6299
- if (onUpdate) {
6305
+ if (typeof onUpdate === 'function') {
6300
6306
  _this6.onUpdateCallback.set(onUpdateContextKey.JackpotEligibleGames, onUpdate);
6301
6307
  }
6302
6308
  return Promise.resolve(OCache.use(onUpdateContextKey.JackpotEligibleGames + jp_template_id, exports.ECacheContext.WSAPI, function () {
@@ -6442,7 +6448,7 @@ var WSAPIRaffles = /*#__PURE__*/function (_WSAPIJackpots) {
6442
6448
  onUpdate = _ref.onUpdate;
6443
6449
  try {
6444
6450
  var _this2 = this;
6445
- if (onUpdate) {
6451
+ if (typeof onUpdate === 'function') {
6446
6452
  _this2.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
6447
6453
  }
6448
6454
  return Promise.resolve(OCache.use(onUpdateContextKey.Raffles, exports.ECacheContext.WSAPI, function () {
@@ -7143,7 +7149,7 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7143
7149
  onUpdate = _ref.onUpdate;
7144
7150
  try {
7145
7151
  var _this = this;
7146
- if (onUpdate) {
7152
+ if (typeof onUpdate === 'function') {
7147
7153
  _this.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
7148
7154
  }
7149
7155
  return Promise.resolve(OCache.use(onUpdateContextKey.Saw, exports.ECacheContext.WSAPI, function () {
@@ -7402,7 +7408,7 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7402
7408
  onUpdate = _ref3.onUpdate;
7403
7409
  try {
7404
7410
  var _this3 = this;
7405
- if (onUpdate) {
7411
+ if (typeof onUpdate === 'function') {
7406
7412
  _this3.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
7407
7413
  }
7408
7414
  return Promise.resolve(_this3.api.sawSpinRequest(_this3.userExtId, template_id)).then(function (r) {
@@ -7597,7 +7603,7 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7597
7603
  onUpdate = _ref4.onUpdate;
7598
7604
  try {
7599
7605
  var _this5 = this;
7600
- if (onUpdate) {
7606
+ if (typeof onUpdate === 'function') {
7601
7607
  _this5.onUpdateCallback.set(onUpdateContextKey.Saw, onUpdate);
7602
7608
  }
7603
7609
  return Promise.resolve(_this5.api.sawSpinBatchRequest(_this5.userExtId, template_id, spin_count)).then(function (response) {
@@ -7629,6 +7635,9 @@ var WSAPIMiniGames = /*#__PURE__*/function (_WSAPIRaffles) {
7629
7635
  var index = templates.findIndex(function (t) {
7630
7636
  return t.id === data.saw_template_id;
7631
7637
  });
7638
+ if (index === -1) {
7639
+ return;
7640
+ }
7632
7641
  templates[index].spin_count = data.spin_count;
7633
7642
  _this6.updateEntity(onUpdateContextKey.Saw, templates);
7634
7643
  });
@@ -9096,7 +9105,7 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
9096
9105
  onUpdate = _ref3.onUpdate;
9097
9106
  try {
9098
9107
  var _this = this;
9099
- if (onUpdate) {
9108
+ if (typeof onUpdate === 'function') {
9100
9109
  _this.onUpdateCallback.set(onUpdateContextKey.InboxMessages, onUpdate);
9101
9110
  }
9102
9111
  return Promise.resolve(_this.api.getInboxMessagesT(_this.userExtId, from, to, onlyFavorite, categoryId, read_status));
@@ -9159,7 +9168,7 @@ var WSAPIInbox = /*#__PURE__*/function (_WSAPILeaderBoard) {
9159
9168
  onUpdate = _ref4.onUpdate;
9160
9169
  try {
9161
9170
  var _this2 = this;
9162
- if (onUpdate) {
9171
+ if (typeof onUpdate === 'function') {
9163
9172
  _this2.onUpdateCallback.set(onUpdateContextKey.InboxUnreadCount, onUpdate);
9164
9173
  }
9165
9174
  return Promise.resolve(OCache.use(onUpdateContextKey.InboxUnreadCount, exports.ECacheContext.WSAPI, function () {