@smartico/public-api 0.0.327 → 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;
@@ -4206,6 +4227,10 @@ class SmarticoAPI {
4206
4227
  const message = this.buildMessage(user_ext_id, ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
4207
4228
  return await this.send(message, ClassId.RAF_CLAIM_PRIZE_RESPONSE);
4208
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
+ }
4209
4234
  async getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
4210
4235
  const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
4211
4236
  startTimeSeconds,