@smartico/public-api 0.0.326 → 0.0.328

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.
@@ -137,6 +137,8 @@ var ClassId;
137
137
  ClassId[ClassId["RAF_GET_DRAW_HISTORY_RESPONSE"] = 907] = "RAF_GET_DRAW_HISTORY_RESPONSE";
138
138
  ClassId[ClassId["RAF_CLAIM_PRIZE_REQUEST"] = 908] = "RAF_CLAIM_PRIZE_REQUEST";
139
139
  ClassId[ClassId["RAF_CLAIM_PRIZE_RESPONSE"] = 909] = "RAF_CLAIM_PRIZE_RESPONSE";
140
+ ClassId[ClassId["RAF_OPTIN_REQUEST"] = 910] = "RAF_OPTIN_REQUEST";
141
+ ClassId[ClassId["RAF_OPTIN_RESPONSE"] = 911] = "RAF_OPTIN_RESPONSE";
140
142
  /*
141
143
  RAF_GET_TICKETS_REQUEST = 902,
142
144
  RAF_GET_TICKETS_RESPONSE = 903,
@@ -2145,10 +2147,7 @@ class WSAPI {
2145
2147
  this.reloadMiniGameTemplate();
2146
2148
  OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
2147
2149
  });
2148
- on(ClassId.RAF_CLAIM_PRIZE_RESPONSE, () => {
2149
- this.updateRaffles();
2150
- OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Raffles);
2151
- });
2150
+ on(ClassId.RAF_CLAIM_PRIZE_RESPONSE, () => this.updateRaffles());
2152
2151
  on(ClassId.GET_INBOX_MESSAGES_RESPONSE, res => {
2153
2152
  if (res.unread_count !== undefined && res.unread_count !== null) {
2154
2153
  this.updateInboxUnreadCount(res.unread_count);
@@ -2163,6 +2162,7 @@ class WSAPI {
2163
2162
  this.notifyPointsHistoryUpdate();
2164
2163
  }
2165
2164
  });
2165
+ on(ClassId.RAF_OPTIN_RESPONSE, () => this.updateRaffles());
2166
2166
  }
2167
2167
  }
2168
2168
  /** @private */
@@ -3258,6 +3258,27 @@ class WSAPI {
3258
3258
  });
3259
3259
  return raffleClaimPrizeResponseTransform(res);
3260
3260
  }
3261
+ /**
3262
+ * Requests an opt-in for the specified raffle. Returns the err_code.
3263
+ *
3264
+ * **Visitor mode: not supported**
3265
+ */
3266
+ async requestRaffleOptin(props) {
3267
+ if (!props.raffle_id) {
3268
+ throw new Error('raffle_id is required');
3269
+ }
3270
+ if (!props.draw_id) {
3271
+ throw new Error('draw_id is required');
3272
+ }
3273
+ if (!props.raffle_run_id) {
3274
+ throw new Error('raffle_run_id is required');
3275
+ }
3276
+ const r = await this.api.raffleOptin(null, props);
3277
+ return {
3278
+ err_code: r.errCode,
3279
+ err_message: r.errMsg
3280
+ };
3281
+ }
3261
3282
  }
3262
3283
 
3263
3284
  var AchCustomSectionType;
@@ -3274,6 +3295,7 @@ var AchCustomSectionType;
3274
3295
  AchCustomSectionType[AchCustomSectionType["LOOTBOX_CALENDAR_DAYS"] = 11] = "LOOTBOX_CALENDAR_DAYS";
3275
3296
  AchCustomSectionType[AchCustomSectionType["TREASURE_HUNT"] = 12] = "TREASURE_HUNT";
3276
3297
  AchCustomSectionType[AchCustomSectionType["RAFFLE"] = 13] = "RAFFLE";
3298
+ AchCustomSectionType[AchCustomSectionType["BADGES"] = 14] = "BADGES";
3277
3299
  })(AchCustomSectionType || (AchCustomSectionType = {}));
3278
3300
  var AchCustomLayoutTheme;
3279
3301
  (function (AchCustomLayoutTheme) {
@@ -3333,6 +3355,8 @@ const UICustomSectionTransform = response => {
3333
3355
  ach_tournament_id: r.ach_tournament_id,
3334
3356
  show_raw_data: r.show_raw_data,
3335
3357
  liquid_template: r.liquid_template
3358
+ } : {}, r.section_type_id === AchCustomSectionType.BADGES ? {
3359
+ ach_category_ids: r.ach_category_ids
3336
3360
  } : {});
3337
3361
  items.push(x);
3338
3362
  }
@@ -4203,6 +4227,10 @@ class SmarticoAPI {
4203
4227
  const message = this.buildMessage(user_ext_id, ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
4204
4228
  return await this.send(message, ClassId.RAF_CLAIM_PRIZE_RESPONSE);
4205
4229
  }
4230
+ async raffleOptin(user_ext_id, props) {
4231
+ const message = this.buildMessage(user_ext_id, ClassId.RAF_OPTIN_REQUEST, props);
4232
+ return await this.send(message, ClassId.RAF_OPTIN_RESPONSE);
4233
+ }
4206
4234
  async getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
4207
4235
  const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
4208
4236
  startTimeSeconds,