@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.
- package/dist/Base/ClassId.d.ts +2 -0
- package/dist/CustomSections/AchCustomSection.d.ts +2 -1
- package/dist/CustomSections/UICustomSection.d.ts +1 -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 +8 -0
- package/dist/index.js +52 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +32 -4
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +3 -0
- package/docs/classes/WSAPI.md +23 -0
- package/docs/enums/AchCustomSectionType.md +6 -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/docs/interfaces/TUICustomSection.md +8 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -0
- package/src/CustomSections/AchCustomSection.ts +1 -0
- package/src/CustomSections/UICustomSection.ts +7 -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 +51 -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,
|
|
@@ -10,7 +10,8 @@ export declare enum AchCustomSectionType {
|
|
|
10
10
|
LOOTBOX_WEEKLY = 10,
|
|
11
11
|
LOOTBOX_CALENDAR_DAYS = 11,
|
|
12
12
|
TREASURE_HUNT = 12,
|
|
13
|
-
RAFFLE = 13
|
|
13
|
+
RAFFLE = 13,
|
|
14
|
+
BADGES = 14
|
|
14
15
|
}
|
|
15
16
|
export declare enum AchCustomLayoutTheme {
|
|
16
17
|
VALENTINES_LIGHT = "valentines-light",
|
|
@@ -16,5 +16,6 @@ export interface UICustomSection {
|
|
|
16
16
|
ach_tournament_id?: number;
|
|
17
17
|
show_raw_data?: boolean;
|
|
18
18
|
liquid_template?: number;
|
|
19
|
+
ach_category_ids?: number[];
|
|
19
20
|
}
|
|
20
21
|
export declare const UICustomSectionTransform: (response: GetCustomSectionsResponse) => TUICustomSection[];
|
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
|
}
|
|
@@ -828,6 +828,8 @@ export interface TUICustomSection {
|
|
|
828
828
|
show_raw_data?: boolean;
|
|
829
829
|
/** Liquid template id to be used for Liquid templates */
|
|
830
830
|
liquid_template?: number;
|
|
831
|
+
/** List of IDs of the categories where the badge item is assigned, information about categories can be retrieved with getAchCategories method */
|
|
832
|
+
ach_category_ids?: number[];
|
|
831
833
|
}
|
|
832
834
|
export interface TBonus {
|
|
833
835
|
/** ID of the bonus */
|
|
@@ -1203,4 +1205,10 @@ export interface TPointsHistoryLog {
|
|
|
1203
1205
|
/** Source type ID indicating what triggered this change */
|
|
1204
1206
|
source_type_id: PointChangeSourceType;
|
|
1205
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
|
+
}
|
|
1206
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
|
}();
|
|
@@ -3735,6 +3767,7 @@ exports.AchCustomSectionType = void 0;
|
|
|
3735
3767
|
AchCustomSectionType[AchCustomSectionType["LOOTBOX_CALENDAR_DAYS"] = 11] = "LOOTBOX_CALENDAR_DAYS";
|
|
3736
3768
|
AchCustomSectionType[AchCustomSectionType["TREASURE_HUNT"] = 12] = "TREASURE_HUNT";
|
|
3737
3769
|
AchCustomSectionType[AchCustomSectionType["RAFFLE"] = 13] = "RAFFLE";
|
|
3770
|
+
AchCustomSectionType[AchCustomSectionType["BADGES"] = 14] = "BADGES";
|
|
3738
3771
|
})(exports.AchCustomSectionType || (exports.AchCustomSectionType = {}));
|
|
3739
3772
|
exports.AchCustomLayoutTheme = void 0;
|
|
3740
3773
|
(function (AchCustomLayoutTheme) {
|
|
@@ -3794,6 +3827,8 @@ var UICustomSectionTransform = function UICustomSectionTransform(response) {
|
|
|
3794
3827
|
ach_tournament_id: r.ach_tournament_id,
|
|
3795
3828
|
show_raw_data: r.show_raw_data,
|
|
3796
3829
|
liquid_template: r.liquid_template
|
|
3830
|
+
} : {}, r.section_type_id === exports.AchCustomSectionType.BADGES ? {
|
|
3831
|
+
ach_category_ids: r.ach_category_ids
|
|
3797
3832
|
} : {});
|
|
3798
3833
|
items.push(x);
|
|
3799
3834
|
}
|
|
@@ -5178,23 +5213,32 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
5178
5213
|
return Promise.reject(e);
|
|
5179
5214
|
}
|
|
5180
5215
|
};
|
|
5181
|
-
_proto.
|
|
5216
|
+
_proto.raffleOptin = function raffleOptin(user_ext_id, props) {
|
|
5182
5217
|
try {
|
|
5183
5218
|
var _this74 = this;
|
|
5184
|
-
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, {
|
|
5185
5229
|
startTimeSeconds: startTimeSeconds,
|
|
5186
5230
|
endTimeSeconds: endTimeSeconds
|
|
5187
5231
|
});
|
|
5188
|
-
return Promise.resolve(
|
|
5232
|
+
return Promise.resolve(_this75.send(message, exports.ClassId.GET_POINT_HISTORY_RESPONSE));
|
|
5189
5233
|
} catch (e) {
|
|
5190
5234
|
return Promise.reject(e);
|
|
5191
5235
|
}
|
|
5192
5236
|
};
|
|
5193
5237
|
_proto.getPointsHistoryT = function getPointsHistoryT(user_ext_id, startTimeSeconds, endTimeSeconds) {
|
|
5194
5238
|
try {
|
|
5195
|
-
var
|
|
5196
|
-
return Promise.resolve(
|
|
5197
|
-
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);
|
|
5198
5242
|
});
|
|
5199
5243
|
} catch (e) {
|
|
5200
5244
|
return Promise.reject(e);
|