@smartico/public-api 0.0.345 → 0.0.347
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/README.md +114 -1
- package/dist/SmarticoAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPI.d.ts +4 -1
- package/dist/WSAPI/WSAPITypes.d.ts +2 -0
- package/dist/index.js +46 -24
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +17 -5
- package/dist/index.modern.mjs.map +1 -1
- package/docs/api/classes/WSAPI.md +4 -1
- package/docs/api/interfaces/TStoreItem.md +8 -0
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +16 -2
- package/src/Store/StoreItem.ts +1 -0
- package/src/WSAPI/WSAPI.ts +4 -6
- package/src/WSAPI/WSAPITypes.ts +2 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -1022,7 +1022,7 @@ const mapPurchaseType$1 = purchaseType => {
|
|
|
1022
1022
|
const StoreItemTransform = items => {
|
|
1023
1023
|
return items.filter(r => r.id >= 1).map(r => {
|
|
1024
1024
|
var _r$itemPublicMeta$pri, _r$categoryIds;
|
|
1025
|
-
const x = {
|
|
1025
|
+
const x = _extends({
|
|
1026
1026
|
id: r.id,
|
|
1027
1027
|
name: r.itemPublicMeta.name,
|
|
1028
1028
|
purchase_type: mapPurchaseType$1(r.itemPublicMeta.purchase_type),
|
|
@@ -1047,7 +1047,9 @@ const StoreItemTransform = items => {
|
|
|
1047
1047
|
custom_section_id: r.itemPublicMeta.custom_section_id,
|
|
1048
1048
|
only_in_custom_section: r.itemPublicMeta.only_in_custom_section,
|
|
1049
1049
|
custom_section_type_id: r.itemPublicMeta.custom_section_type_id
|
|
1050
|
-
}
|
|
1050
|
+
}, r.itemPublicMeta.cant_buy_message ? {
|
|
1051
|
+
cant_buy_message: r.itemPublicMeta.cant_buy_message
|
|
1052
|
+
} : {});
|
|
1051
1053
|
return x;
|
|
1052
1054
|
});
|
|
1053
1055
|
};
|
|
@@ -3235,7 +3237,8 @@ class WSAPI {
|
|
|
3235
3237
|
return OCache.use(onUpdateContextKey.Raffles, ECacheContext.WSAPI, () => this.api.getRafflesT(null), CACHE_DATA_SEC);
|
|
3236
3238
|
}
|
|
3237
3239
|
/**
|
|
3238
|
-
* Returns draw run for provided raffle_id and run_id
|
|
3240
|
+
* Returns draw run for provided raffle_id and run_id.
|
|
3241
|
+
* You can pass winners_from and winners_to parameters to get a specific range of winners. Default is 0-20.
|
|
3239
3242
|
*
|
|
3240
3243
|
*
|
|
3241
3244
|
* **Example**:
|
|
@@ -3257,11 +3260,10 @@ class WSAPI {
|
|
|
3257
3260
|
*
|
|
3258
3261
|
*/
|
|
3259
3262
|
async getRaffleDrawRun(props) {
|
|
3260
|
-
const res = await this.api.getRaffleDrawRun(null, props);
|
|
3261
3263
|
if (!props.raffle_id || !props.run_id) {
|
|
3262
3264
|
throw new Error('both raffle_id and run_id are required');
|
|
3263
3265
|
}
|
|
3264
|
-
return
|
|
3266
|
+
return await this.api.getRaffleDrawRunT(null, props.raffle_id, props.run_id, props.winners_from, props.winners_to);
|
|
3265
3267
|
}
|
|
3266
3268
|
/**
|
|
3267
3269
|
* Returns history of draw runs for the provided raffle_id and draw_id, if the draw_id is not provided will return history of all the draws for the provided raffle_id
|
|
@@ -4288,6 +4290,16 @@ class SmarticoAPI {
|
|
|
4288
4290
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_DRAW_RUN_REQUEST, payload);
|
|
4289
4291
|
return await this.send(message, ClassId.RAF_GET_DRAW_RUN_RESPONSE);
|
|
4290
4292
|
}
|
|
4293
|
+
async getRaffleDrawRunT(user_ext_id, raffle_id, run_id, winners_from = 0, winners_to = 20) {
|
|
4294
|
+
const winners_limit = winners_to - winners_from > 50 ? 50 : winners_to - winners_from;
|
|
4295
|
+
const winners_offset = winners_from;
|
|
4296
|
+
return drawRunTransform(await this.getRaffleDrawRun(user_ext_id, {
|
|
4297
|
+
raffle_id,
|
|
4298
|
+
run_id,
|
|
4299
|
+
winners_limit,
|
|
4300
|
+
winners_offset
|
|
4301
|
+
}));
|
|
4302
|
+
}
|
|
4291
4303
|
async getRaffleDrawRunsHistory(user_ext_id, props) {
|
|
4292
4304
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_DRAW_HISTORY_REQUEST, props);
|
|
4293
4305
|
return await this.send(message, ClassId.RAF_GET_DRAW_HISTORY_RESPONSE);
|