@smartico/public-api 0.0.327 → 0.0.329

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.
@@ -113,6 +113,8 @@ export declare enum ClassId {
113
113
  RAF_GET_DRAW_HISTORY_RESPONSE = 907,
114
114
  RAF_CLAIM_PRIZE_REQUEST = 908,
115
115
  RAF_CLAIM_PRIZE_RESPONSE = 909,
116
+ RAF_OPTIN_REQUEST = 910,
117
+ RAF_OPTIN_RESPONSE = 911,
116
118
  REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ = 1003,
117
119
  REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP = 2003,
118
120
  CLIENT_DEBUG_REQUEST = 77777,
@@ -34,6 +34,14 @@ interface Raffle {
34
34
  * Number of tickets that are already given to all users for this raffle
35
35
  */
36
36
  current_tickets_count: number;
37
+ /**
38
+ * If true, the user has opted-in to the raffle.
39
+ */
40
+ user_opted_in: boolean;
41
+ /**
42
+ * If true, the user needs to opt-in to the raffle before they can participate.
43
+ */
44
+ requires_optin: boolean;
37
45
  /**
38
46
  * List of draws that are available for this raffle.
39
47
  * For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022,
@@ -0,0 +1,6 @@
1
+ import { ProtocolMessage } from "../Base/ProtocolMessage";
2
+ export interface RaffleOptinRequest extends ProtocolMessage {
3
+ raffle_id: number;
4
+ draw_id: number;
5
+ raffle_run_id: number;
6
+ }
@@ -0,0 +1,3 @@
1
+ import { ProtocolResponse } from "../Base/ProtocolResponse";
2
+ export interface RaffleOptinResponse extends ProtocolResponse {
3
+ }
@@ -13,3 +13,5 @@ export * from './GetRaffleDrawRunsHistoryResponse';
13
13
  export * from './RaffleClaimPrizeRequest';
14
14
  export * from './RaffleClaimPrizeResponse';
15
15
  export * from './RaffleDrawPublicMeta';
16
+ export * from './RaffleOptinRequest';
17
+ export * from './RaffleOptinResponse';
@@ -22,7 +22,7 @@ import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse'
22
22
  import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
23
23
  import { GetPointsHistoryResponse } from './PointsHistory';
24
24
  import { InboxCategories } from './Inbox/InboxCategories';
25
- import { GetDrawRunResponse, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeResponse } from './Raffle';
25
+ import { GetDrawRunResponse, GetRaffleDrawRunsHistoryResponse, RaffleClaimPrizeResponse, RaffleOptinResponse } from './Raffle';
26
26
  import { GetJackpotWinnersResponse, JackpotWinnerHistory } from './Jackpots/GetJackpotWinnersResponse';
27
27
  import { GetJackpotEligibleGamesResponse, TGetJackpotEligibleGamesResponse } from './Jackpots/GetJackpotEligibleGamesResponse';
28
28
  interface Tracker {
@@ -168,6 +168,11 @@ declare class SmarticoAPI {
168
168
  claimRafflePrize(user_ext_id: string, props: {
169
169
  won_id: number;
170
170
  }): Promise<RaffleClaimPrizeResponse>;
171
+ raffleOptin(user_ext_id: string, props: {
172
+ raffle_id: number;
173
+ draw_id: number;
174
+ raffle_run_id: number;
175
+ }): Promise<RaffleOptinResponse>;
171
176
  getPointsHistory(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number): Promise<GetPointsHistoryResponse>;
172
177
  getPointsHistoryT(user_ext_id: string, startTimeSeconds: number, endTimeSeconds: number): Promise<TPointsHistoryLog[]>;
173
178
  }
@@ -1,6 +1,6 @@
1
1
  import { ActivityTypeLimited } from '../Core';
2
2
  import { SmarticoAPI } from '../SmarticoAPI';
3
- import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TPointsHistoryLog } from './WSAPITypes';
3
+ import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreItemResult, TGetTranslations, TInboxMessage, TInboxMessageBody, TLevel, TMiniGamePlayResult, TMiniGameTemplate, TMissionClaimRewardResult, TMissionOptInResult, TMissionOrBadge, TSegmentCheckResult, TStoreCategory, TStoreItem, TTournament, TTournamentDetailed, TTournamentRegistrationResult, TUICustomSection, TUserProfile, UserLevelExtraCountersT, TBonus, TClaimBonusResult, TMiniGamePlayBatchResult, TSawHistory, TRaffle, TRaffleDraw, TRaffleDrawRun, TransformedRaffleClaimPrizeResponse, TLevelCurrent, TPointsHistoryLog, TRaffleOptinResponse } from './WSAPITypes';
4
4
  import { LeaderBoardPeriodType } from '../Leaderboard';
5
5
  import { JackpotDetails, JackpotWinnerHistory, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
6
6
  import { GetRelatedAchTourResponse } from '../Missions/GetRelatedAchTourResponse';
@@ -803,4 +803,14 @@ export declare class WSAPI {
803
803
  claimRafflePrize(props: {
804
804
  won_id: number;
805
805
  }): Promise<TransformedRaffleClaimPrizeResponse>;
806
+ /**
807
+ * Requests an opt-in for the specified raffle. Returns the err_code.
808
+ *
809
+ * **Visitor mode: not supported**
810
+ */
811
+ requestRaffleOptin(props: {
812
+ raffle_id: number;
813
+ draw_id: number;
814
+ raffle_run_id: number;
815
+ }): Promise<TRaffleOptinResponse>;
806
816
  }
@@ -935,6 +935,14 @@ export interface TRaffle {
935
935
  * Number of tickets that are already given to all users for this raffle
936
936
  */
937
937
  current_tickets_count: number;
938
+ /**
939
+ * If true, the user has opted-in to the raffle.
940
+ */
941
+ user_opted_in: boolean;
942
+ /**
943
+ * If true, the user needs to opt-in to the raffle before they can participate.
944
+ */
945
+ requires_optin: boolean;
938
946
  /**
939
947
  * List of draws that are available for this raffle.
940
948
  * For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022,
@@ -1205,4 +1213,10 @@ export interface TPointsHistoryLog {
1205
1213
  /** Source type ID indicating what triggered this change */
1206
1214
  source_type_id: PointChangeSourceType;
1207
1215
  }
1216
+ export interface TRaffleOptinResponse {
1217
+ /** Error code that represents outcome of the opt-in attempt. Opt-in succeed in case err_code is 0 */
1218
+ err_code: number;
1219
+ /** Optional error message */
1220
+ err_message?: string;
1221
+ }
1208
1222
  export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './Tournaments';
14
14
  export * from './Level';
15
15
  export * from './Quiz';
16
16
  export * from './Jackpots';
17
+ export * from './Raffle';
17
18
  export * from './OCache';
18
19
  export * from './Bonuses';
19
20
  export * from './CustomSections';
package/dist/index.js CHANGED
@@ -137,6 +137,8 @@ exports.ClassId = void 0;
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,
@@ -1350,7 +1352,7 @@ MissionUtils.replaceTagsFavMissionTask = function (_ref) {
1350
1352
  suggestedGames = value.map(function (v) {
1351
1353
  var cleaned = v.replace(/_/g, ' ').toLowerCase();
1352
1354
  return cleaned.charAt(0).toUpperCase() + cleaned.slice(1);
1353
- }).join(' ,');
1355
+ }).join(', ');
1354
1356
  }
1355
1357
  }
1356
1358
  if (operatorsPos.includes(operator)) {
@@ -1983,6 +1985,8 @@ var raffleTransform = function raffleTransform(items) {
1983
1985
  end_date: item.end_date_ts,
1984
1986
  max_tickets_count: item.max_tickets_count,
1985
1987
  current_tickets_count: item.current_tickets_count,
1988
+ user_opted_in: item.user_opted_in,
1989
+ requires_optin: item.requires_optin,
1986
1990
  draws: drawTransform(item.draws)
1987
1991
  };
1988
1992
  });
@@ -2016,7 +2020,7 @@ var drawRunTransform = function drawRunTransform(res) {
2016
2020
  };
2017
2021
  };
2018
2022
 
2019
- var RaffleDrawInstanceState;
2023
+ exports.RaffleDrawInstanceState = void 0;
2020
2024
  (function (RaffleDrawInstanceState) {
2021
2025
  /** Draw is open for the tickets collection */
2022
2026
  RaffleDrawInstanceState[RaffleDrawInstanceState["Open"] = 1] = "Open";
@@ -2024,8 +2028,8 @@ var RaffleDrawInstanceState;
2024
2028
  RaffleDrawInstanceState[RaffleDrawInstanceState["WinnerSelection"] = 2] = "WinnerSelection";
2025
2029
  /** Draw is executed and the winners are selected */
2026
2030
  RaffleDrawInstanceState[RaffleDrawInstanceState["Executed"] = 3] = "Executed";
2027
- })(RaffleDrawInstanceState || (RaffleDrawInstanceState = {}));
2028
- var RaffleDrawTypeExecution;
2031
+ })(exports.RaffleDrawInstanceState || (exports.RaffleDrawInstanceState = {}));
2032
+ exports.RaffleDrawTypeExecution = void 0;
2029
2033
  (function (RaffleDrawTypeExecution) {
2030
2034
  /** Draw is executed only once */
2031
2035
  RaffleDrawTypeExecution[RaffleDrawTypeExecution["ExecDate"] = 0] = "ExecDate";
@@ -2037,7 +2041,7 @@ var RaffleDrawTypeExecution;
2037
2041
  * often with larger prizes or more importance.
2038
2042
  */
2039
2043
  RaffleDrawTypeExecution[RaffleDrawTypeExecution["Grand"] = 2] = "Grand";
2040
- })(RaffleDrawTypeExecution || (RaffleDrawTypeExecution = {}));
2044
+ })(exports.RaffleDrawTypeExecution || (exports.RaffleDrawTypeExecution = {}));
2041
2045
 
2042
2046
  /** @hidden */
2043
2047
  var drawRunHistoryTransform = function drawRunHistoryTransform(res) {
@@ -2172,8 +2176,7 @@ var WSAPI = /*#__PURE__*/function () {
2172
2176
  OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
2173
2177
  });
2174
2178
  on(exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE, function () {
2175
- _this.updateRaffles();
2176
- OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.Raffles);
2179
+ return _this.updateRaffles();
2177
2180
  });
2178
2181
  on(exports.ClassId.GET_INBOX_MESSAGES_RESPONSE, function (res) {
2179
2182
  if (res.unread_count !== undefined && res.unread_count !== null) {
@@ -2189,6 +2192,9 @@ var WSAPI = /*#__PURE__*/function () {
2189
2192
  _this.notifyPointsHistoryUpdate();
2190
2193
  }
2191
2194
  });
2195
+ on(exports.ClassId.RAF_OPTIN_RESPONSE, function () {
2196
+ return _this.updateRaffles();
2197
+ });
2192
2198
  }
2193
2199
  }
2194
2200
  /** @private */
@@ -3717,6 +3723,34 @@ var WSAPI = /*#__PURE__*/function () {
3717
3723
  } catch (e) {
3718
3724
  return Promise.reject(e);
3719
3725
  }
3726
+ }
3727
+ /**
3728
+ * Requests an opt-in for the specified raffle. Returns the err_code.
3729
+ *
3730
+ * **Visitor mode: not supported**
3731
+ */
3732
+ ;
3733
+ _proto.requestRaffleOptin = function requestRaffleOptin(props) {
3734
+ try {
3735
+ var _this60 = this;
3736
+ if (!props.raffle_id) {
3737
+ throw new Error('raffle_id is required');
3738
+ }
3739
+ if (!props.draw_id) {
3740
+ throw new Error('draw_id is required');
3741
+ }
3742
+ if (!props.raffle_run_id) {
3743
+ throw new Error('raffle_run_id is required');
3744
+ }
3745
+ return Promise.resolve(_this60.api.raffleOptin(null, props)).then(function (r) {
3746
+ return {
3747
+ err_code: r.errCode,
3748
+ err_message: r.errMsg
3749
+ };
3750
+ });
3751
+ } catch (e) {
3752
+ return Promise.reject(e);
3753
+ }
3720
3754
  };
3721
3755
  return WSAPI;
3722
3756
  }();
@@ -5181,23 +5215,32 @@ var SmarticoAPI = /*#__PURE__*/function () {
5181
5215
  return Promise.reject(e);
5182
5216
  }
5183
5217
  };
5184
- _proto.getPointsHistory = function getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
5218
+ _proto.raffleOptin = function raffleOptin(user_ext_id, props) {
5185
5219
  try {
5186
5220
  var _this74 = this;
5187
- var message = _this74.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
5221
+ var message = _this74.buildMessage(user_ext_id, exports.ClassId.RAF_OPTIN_REQUEST, props);
5222
+ return Promise.resolve(_this74.send(message, exports.ClassId.RAF_OPTIN_RESPONSE));
5223
+ } catch (e) {
5224
+ return Promise.reject(e);
5225
+ }
5226
+ };
5227
+ _proto.getPointsHistory = function getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
5228
+ try {
5229
+ var _this75 = this;
5230
+ var message = _this75.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
5188
5231
  startTimeSeconds: startTimeSeconds,
5189
5232
  endTimeSeconds: endTimeSeconds
5190
5233
  });
5191
- return Promise.resolve(_this74.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
5234
+ return Promise.resolve(_this75.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
5192
5235
  } catch (e) {
5193
5236
  return Promise.reject(e);
5194
5237
  }
5195
5238
  };
5196
5239
  _proto.getPointsHistoryT = function getPointsHistoryT(user_ext_id, startTimeSeconds, endTimeSeconds) {
5197
5240
  try {
5198
- var _this75 = this;
5199
- return Promise.resolve(_this75.getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds)).then(function (_this75$getPointsHist) {
5200
- return PointsHistoryTransform(_this75$getPointsHist.logHistory);
5241
+ var _this76 = this;
5242
+ return Promise.resolve(_this76.getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds)).then(function (_this76$getPointsHist) {
5243
+ return PointsHistoryTransform(_this76$getPointsHist.logHistory);
5201
5244
  });
5202
5245
  } catch (e) {
5203
5246
  return Promise.reject(e);
@@ -5698,9 +5741,13 @@ exports.TournamentRegistrationTypeGetName = TournamentRegistrationTypeGetName;
5698
5741
  exports.TournamentUtils = TournamentUtils;
5699
5742
  exports.UICustomSectionTransform = UICustomSectionTransform;
5700
5743
  exports.UserAchievementTransform = UserAchievementTransform;
5744
+ exports.drawRunHistoryTransform = drawRunHistoryTransform;
5745
+ exports.drawRunTransform = drawRunTransform;
5746
+ exports.drawTransform = drawTransform;
5701
5747
  exports.enrichUserAchievementsWithBadgeState = enrichUserAchievementsWithBadgeState;
5702
5748
  exports.getLeaderBoardTransform = getLeaderBoardTransform;
5703
5749
  exports.marketsInfo = marketsInfo;
5750
+ exports.prizeTransform = prizeTransform;
5704
5751
  exports.quizAnswerAwayTeamReplacementText = quizAnswerAwayTeamReplacementText;
5705
5752
  exports.quizAnswerHomeTeamReplacementText = quizAnswerHomeTeamReplacementText;
5706
5753
  exports.quizAnswersTrKeys = quizAnswersTrKeys;
@@ -5712,5 +5759,9 @@ exports.quizOddReplacementText = quizOddReplacementText;
5712
5759
  exports.quizOrReplacementText = quizOrReplacementText;
5713
5760
  exports.quizSupportedSports = quizSupportedSports;
5714
5761
  exports.quizYesReplacementText = quizYesReplacementText;
5762
+ exports.raffleClaimPrizeResponseTransform = raffleClaimPrizeResponseTransform;
5763
+ exports.raffleTransform = raffleTransform;
5764
+ exports.ticketsTransform = ticketsTransform;
5715
5765
  exports.tournamentInfoItemTransform = tournamentInfoItemTransform;
5766
+ exports.winnersTransform = winnersTransform;
5716
5767
  //# sourceMappingURL=index.js.map