@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.
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/Raffle/RaffleOptinRequest.d.ts +6 -0
- package/dist/Raffle/RaffleOptinResponse.d.ts +3 -0
- package/dist/Raffle/index.d.ts +2 -0
- package/dist/SmarticoAPI.d.ts +6 -1
- package/dist/WSAPI/WSAPI.d.ts +11 -1
- package/dist/WSAPI/WSAPITypes.d.ts +6 -0
- package/dist/index.js +49 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +29 -4
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +23 -0
- package/docs/interfaces/RaffleOptinRequest.md +55 -0
- package/docs/interfaces/RaffleOptinResponse.md +57 -0
- package/docs/interfaces/TRaffleOptinResponse.md +17 -0
- package/docs/interfaces/TStoreItem.md +2 -2
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/Raffle/RaffleOptinRequest.ts +7 -0
- package/src/Raffle/RaffleOptinResponse.ts +5 -0
- package/src/Raffle/index.ts +2 -0
- package/src/SmarticoAPI.ts +12 -1
- package/src/WSAPI/WSAPI.ts +29 -4
- package/src/WSAPI/WSAPITypes.ts +49 -43
package/dist/Base/ClassId.d.ts
CHANGED
|
@@ -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,
|
package/dist/Raffle/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -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
|
}
|
|
@@ -1205,4 +1205,10 @@ export interface TPointsHistoryLog {
|
|
|
1205
1205
|
/** Source type ID indicating what triggered this change */
|
|
1206
1206
|
source_type_id: PointChangeSourceType;
|
|
1207
1207
|
}
|
|
1208
|
+
export interface TRaffleOptinResponse {
|
|
1209
|
+
/** Error code that represents outcome of the opt-in attempt. Opt-in succeed in case err_code is 0 */
|
|
1210
|
+
err_code: number;
|
|
1211
|
+
/** Optional error message */
|
|
1212
|
+
err_message?: string;
|
|
1213
|
+
}
|
|
1208
1214
|
export { SAWAcknowledgeTypeName, PrizeModifiers, SAWTemplateUI, InboxCategories, AchCustomSectionType, SAWAskForUsername, SAWGameLayout, PointChangeSourceType, UserBalanceType };
|
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,
|
|
@@ -2172,8 +2174,7 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2172
2174
|
OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
2173
2175
|
});
|
|
2174
2176
|
on(exports.ClassId.RAF_CLAIM_PRIZE_RESPONSE, function () {
|
|
2175
|
-
_this.updateRaffles();
|
|
2176
|
-
OCache.clear(exports.ECacheContext.WSAPI, onUpdateContextKey.Raffles);
|
|
2177
|
+
return _this.updateRaffles();
|
|
2177
2178
|
});
|
|
2178
2179
|
on(exports.ClassId.GET_INBOX_MESSAGES_RESPONSE, function (res) {
|
|
2179
2180
|
if (res.unread_count !== undefined && res.unread_count !== null) {
|
|
@@ -2189,6 +2190,9 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2189
2190
|
_this.notifyPointsHistoryUpdate();
|
|
2190
2191
|
}
|
|
2191
2192
|
});
|
|
2193
|
+
on(exports.ClassId.RAF_OPTIN_RESPONSE, function () {
|
|
2194
|
+
return _this.updateRaffles();
|
|
2195
|
+
});
|
|
2192
2196
|
}
|
|
2193
2197
|
}
|
|
2194
2198
|
/** @private */
|
|
@@ -3717,6 +3721,34 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
3717
3721
|
} catch (e) {
|
|
3718
3722
|
return Promise.reject(e);
|
|
3719
3723
|
}
|
|
3724
|
+
}
|
|
3725
|
+
/**
|
|
3726
|
+
* Requests an opt-in for the specified raffle. Returns the err_code.
|
|
3727
|
+
*
|
|
3728
|
+
* **Visitor mode: not supported**
|
|
3729
|
+
*/
|
|
3730
|
+
;
|
|
3731
|
+
_proto.requestRaffleOptin = function requestRaffleOptin(props) {
|
|
3732
|
+
try {
|
|
3733
|
+
var _this60 = this;
|
|
3734
|
+
if (!props.raffle_id) {
|
|
3735
|
+
throw new Error('raffle_id is required');
|
|
3736
|
+
}
|
|
3737
|
+
if (!props.draw_id) {
|
|
3738
|
+
throw new Error('draw_id is required');
|
|
3739
|
+
}
|
|
3740
|
+
if (!props.raffle_run_id) {
|
|
3741
|
+
throw new Error('raffle_run_id is required');
|
|
3742
|
+
}
|
|
3743
|
+
return Promise.resolve(_this60.api.raffleOptin(null, props)).then(function (r) {
|
|
3744
|
+
return {
|
|
3745
|
+
err_code: r.errCode,
|
|
3746
|
+
err_message: r.errMsg
|
|
3747
|
+
};
|
|
3748
|
+
});
|
|
3749
|
+
} catch (e) {
|
|
3750
|
+
return Promise.reject(e);
|
|
3751
|
+
}
|
|
3720
3752
|
};
|
|
3721
3753
|
return WSAPI;
|
|
3722
3754
|
}();
|
|
@@ -5181,23 +5213,32 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
5181
5213
|
return Promise.reject(e);
|
|
5182
5214
|
}
|
|
5183
5215
|
};
|
|
5184
|
-
_proto.
|
|
5216
|
+
_proto.raffleOptin = function raffleOptin(user_ext_id, props) {
|
|
5185
5217
|
try {
|
|
5186
5218
|
var _this74 = this;
|
|
5187
|
-
var message = _this74.buildMessage(user_ext_id, exports.ClassId.
|
|
5219
|
+
var message = _this74.buildMessage(user_ext_id, exports.ClassId.RAF_OPTIN_REQUEST, props);
|
|
5220
|
+
return Promise.resolve(_this74.send(message, exports.ClassId.RAF_OPTIN_RESPONSE));
|
|
5221
|
+
} catch (e) {
|
|
5222
|
+
return Promise.reject(e);
|
|
5223
|
+
}
|
|
5224
|
+
};
|
|
5225
|
+
_proto.getPointsHistory = function getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds) {
|
|
5226
|
+
try {
|
|
5227
|
+
var _this75 = this;
|
|
5228
|
+
var message = _this75.buildMessage(user_ext_id, exports.ClassId.GET_POINT_HISTORY_REQUEST, {
|
|
5188
5229
|
startTimeSeconds: startTimeSeconds,
|
|
5189
5230
|
endTimeSeconds: endTimeSeconds
|
|
5190
5231
|
});
|
|
5191
|
-
return Promise.resolve(
|
|
5232
|
+
return Promise.resolve(_this75.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
|
|
5192
5233
|
} catch (e) {
|
|
5193
5234
|
return Promise.reject(e);
|
|
5194
5235
|
}
|
|
5195
5236
|
};
|
|
5196
5237
|
_proto.getPointsHistoryT = function getPointsHistoryT(user_ext_id, startTimeSeconds, endTimeSeconds) {
|
|
5197
5238
|
try {
|
|
5198
|
-
var
|
|
5199
|
-
return Promise.resolve(
|
|
5200
|
-
return PointsHistoryTransform(
|
|
5239
|
+
var _this76 = this;
|
|
5240
|
+
return Promise.resolve(_this76.getPointsHistory(user_ext_id, startTimeSeconds, endTimeSeconds)).then(function (_this76$getPointsHist) {
|
|
5241
|
+
return PointsHistoryTransform(_this76$getPointsHist.logHistory);
|
|
5201
5242
|
});
|
|
5202
5243
|
} catch (e) {
|
|
5203
5244
|
return Promise.reject(e);
|