@smartico/public-api 0.0.252 → 0.0.253
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/Jackpots/GetJackpotWinnersRequest.d.ts +10 -0
- package/dist/Jackpots/GetJackpotWinnersResponse.d.ts +20 -0
- package/dist/Jackpots/index.d.ts +2 -0
- package/dist/Raffle/GetDrawRunResponse.d.ts +2 -0
- package/dist/Raffle/GetRaffleDrawRunsHistoryResponse.d.ts +2 -0
- package/dist/Raffle/GetRafflesResponse.d.ts +10 -0
- package/dist/Raffle/RaffleClaimPrizeResponse.d.ts +4 -0
- package/dist/Raffle/RaffleDraw.d.ts +2 -2
- package/dist/SmarticoAPI.d.ts +17 -5
- package/dist/WSAPI/WSAPI.d.ts +94 -8
- package/dist/WSAPI/WSAPITypes.d.ts +272 -0
- package/dist/index.js +559 -199
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +322 -14
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +140 -0
- package/docs/classes/WSAPI.md +102 -12
- package/docs/enums/RaffleDrawInstanceState.md +25 -0
- package/docs/enums/RaffleDrawTypeExecution.md +27 -0
- package/docs/interfaces/GetJackpotWinnersRequest.md +91 -0
- package/docs/interfaces/GetJackpotWinnersResponse.md +73 -0
- package/docs/interfaces/JackpotWinnerHistory.md +25 -0
- package/docs/interfaces/RaffleClaimPrizeResponse.md +3 -3
- package/docs/interfaces/RaffleDraw.md +2 -2
- package/docs/interfaces/TRaffle.md +101 -0
- package/docs/interfaces/TRaffleDraw.md +181 -0
- package/docs/interfaces/TRaffleDrawRun.md +125 -0
- package/docs/interfaces/TRafflePrize.md +159 -0
- package/docs/interfaces/TRafflePrizeWinner.md +50 -0
- package/docs/interfaces/TRaffleTicket.md +13 -0
- package/docs/interfaces/TransformedRaffleClaimPrizeResponse.md +17 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +2 -1
- package/src/Jackpots/GetJackpotWinnersRequest.ts +12 -0
- package/src/Jackpots/GetJackpotWinnersResponse.ts +33 -0
- package/src/Jackpots/index.ts +2 -0
- package/src/Raffle/GetDrawRunResponse.ts +30 -0
- package/src/Raffle/GetRaffleDrawRunsHistoryResponse.ts +23 -0
- package/src/Raffle/GetRafflesResponse.ts +97 -0
- package/src/Raffle/RaffleClaimPrizeResponse.ts +16 -1
- package/src/Raffle/RaffleDraw.ts +2 -2
- package/src/SmarticoAPI.ts +45 -24
- package/src/WSAPI/WSAPI.ts +144 -9
- package/src/WSAPI/WSAPITypes.ts +307 -0
package/dist/index.modern.mjs
CHANGED
|
@@ -123,6 +123,8 @@ var ClassId;
|
|
|
123
123
|
ClassId[ClassId["JP_OPTOUT_REQUEST"] = 806] = "JP_OPTOUT_REQUEST";
|
|
124
124
|
ClassId[ClassId["JP_OPTOUT_RESPONSE"] = 807] = "JP_OPTOUT_RESPONSE";
|
|
125
125
|
ClassId[ClassId["JP_WIN_PUSH"] = 808] = "JP_WIN_PUSH";
|
|
126
|
+
ClassId[ClassId["JP_GET_WINNERS_REQUEST"] = 809] = "JP_GET_WINNERS_REQUEST";
|
|
127
|
+
ClassId[ClassId["JP_GET_WINNERS_RESPONSE"] = 810] = "JP_GET_WINNERS_RESPONSE";
|
|
126
128
|
ClassId[ClassId["RAF_GET_RAFFLES_REQUEST"] = 902] = "RAF_GET_RAFFLES_REQUEST";
|
|
127
129
|
ClassId[ClassId["RAF_GET_RAFFLES_RESPONSE"] = 903] = "RAF_GET_RAFFLES_RESPONSE";
|
|
128
130
|
ClassId[ClassId["RAF_GET_DRAW_RUN_REQUEST"] = 904] = "RAF_GET_DRAW_RUN_REQUEST";
|
|
@@ -1606,10 +1608,179 @@ const GetLevelMapResponseTransform = levels => {
|
|
|
1606
1608
|
});
|
|
1607
1609
|
};
|
|
1608
1610
|
|
|
1611
|
+
const ticketsTransform = items => {
|
|
1612
|
+
return items.map(item => {
|
|
1613
|
+
return {
|
|
1614
|
+
ticekt_id: item.id,
|
|
1615
|
+
ticket_id_string: item.s
|
|
1616
|
+
};
|
|
1617
|
+
});
|
|
1618
|
+
};
|
|
1619
|
+
const winnersTransform = items => {
|
|
1620
|
+
return items.map(item => {
|
|
1621
|
+
return {
|
|
1622
|
+
id: item.user_id,
|
|
1623
|
+
username: item.public_username,
|
|
1624
|
+
avatar_url: item.avatar_url,
|
|
1625
|
+
ticket: {
|
|
1626
|
+
ticekt_id: item.ticket.id,
|
|
1627
|
+
ticket_id_string: item.ticket.s
|
|
1628
|
+
},
|
|
1629
|
+
raf_won_id: item.raf_won_id,
|
|
1630
|
+
claimed_date: item.claimed_date
|
|
1631
|
+
};
|
|
1632
|
+
});
|
|
1633
|
+
};
|
|
1634
|
+
const prizeTransform = items => {
|
|
1635
|
+
return items.map(item => {
|
|
1636
|
+
return {
|
|
1637
|
+
id: item.prize_id,
|
|
1638
|
+
name: item.public_meta.name,
|
|
1639
|
+
description: item.public_meta.description,
|
|
1640
|
+
image_url: item.public_meta.image_url,
|
|
1641
|
+
prizes_per_run: item.prizes_per_run,
|
|
1642
|
+
prizes_per_run_actual: item.prizes_per_run_actual,
|
|
1643
|
+
chances_to_win_perc: item.chances_to_win_perc,
|
|
1644
|
+
min_required_total_tickets: item.min_required_total_tickets,
|
|
1645
|
+
cap_prizes_per_run: item.cap_prizes_per_run,
|
|
1646
|
+
priority: item.priority,
|
|
1647
|
+
stock_items_per_draw: item.stock_items_per_draw,
|
|
1648
|
+
should_claim: item.should_claim,
|
|
1649
|
+
winners: winnersTransform(item.winners),
|
|
1650
|
+
requires_claim: item.requires_claim,
|
|
1651
|
+
min_required_tickets_for_user: item.min_required_tickets_for_user
|
|
1652
|
+
};
|
|
1653
|
+
});
|
|
1654
|
+
};
|
|
1655
|
+
const drawTransform = items => {
|
|
1656
|
+
return items.map(item => {
|
|
1657
|
+
return {
|
|
1658
|
+
id: item.draw_id,
|
|
1659
|
+
name: item.public_meta.name,
|
|
1660
|
+
description: item.public_meta.description,
|
|
1661
|
+
image_url: item.public_meta.image_url,
|
|
1662
|
+
image_url_mobile: item.public_meta.image_url_mobile,
|
|
1663
|
+
icon_url: item.public_meta.icon_url,
|
|
1664
|
+
background_image_url: item.public_meta.background_image_url,
|
|
1665
|
+
background_image_url_mobile: item.public_meta.background_image_url_mobile,
|
|
1666
|
+
is_grand: item.public_meta.is_grand,
|
|
1667
|
+
prizes: prizeTransform(item.prizes),
|
|
1668
|
+
current_state: item.current_state,
|
|
1669
|
+
run_id: item.run_id,
|
|
1670
|
+
execution_type: item.execution_type,
|
|
1671
|
+
execution_ts: item.execution_ts,
|
|
1672
|
+
previous_run_ts: item.previous_run_ts,
|
|
1673
|
+
previous_run_id: item.previous_run_id,
|
|
1674
|
+
ticket_start_ts: item.ticket_start_ts,
|
|
1675
|
+
allow_multi_prize_per_ticket: item.allow_multi_prize_per_ticket,
|
|
1676
|
+
total_tickets_count: item.total_tickets_count,
|
|
1677
|
+
my_tickets_count: item.my_tickets_count,
|
|
1678
|
+
my_last_tickets: ticketsTransform(item.my_last_tickets)
|
|
1679
|
+
};
|
|
1680
|
+
});
|
|
1681
|
+
};
|
|
1682
|
+
const raffleTransform = items => {
|
|
1683
|
+
return items.map(item => {
|
|
1684
|
+
return {
|
|
1685
|
+
id: item.raffle_id,
|
|
1686
|
+
name: item.public_meta.name,
|
|
1687
|
+
description: item.public_meta.description,
|
|
1688
|
+
custom_section_id: item.public_meta.custom_section_id,
|
|
1689
|
+
image_url: item.public_meta.image_url,
|
|
1690
|
+
image_url_mobile: item.public_meta.image_url_mobile,
|
|
1691
|
+
custom_data: item.public_meta.custom_data,
|
|
1692
|
+
start_date: item.start_date_ts,
|
|
1693
|
+
end_date: item.end_date_ts,
|
|
1694
|
+
max_tickets_count: item.max_tickets_count,
|
|
1695
|
+
current_tickets_count: item.current_tickets_count,
|
|
1696
|
+
draws: drawTransform(item.draws)
|
|
1697
|
+
};
|
|
1698
|
+
});
|
|
1699
|
+
};
|
|
1700
|
+
|
|
1701
|
+
const drawRunTransform = res => {
|
|
1702
|
+
return {
|
|
1703
|
+
id: res.draw.draw_id,
|
|
1704
|
+
name: res.draw.public_meta.name,
|
|
1705
|
+
description: res.draw.public_meta.description,
|
|
1706
|
+
image_url: res.draw.public_meta.image_url,
|
|
1707
|
+
image_url_mobile: res.draw.public_meta.image_url_mobile,
|
|
1708
|
+
icon_url: res.draw.public_meta.icon_url,
|
|
1709
|
+
background_image_url: res.draw.public_meta.background_image_url,
|
|
1710
|
+
background_image_url_mobile: res.draw.public_meta.background_image_url_mobile,
|
|
1711
|
+
is_grand: res.draw.public_meta.is_grand,
|
|
1712
|
+
prizes: prizeTransform(res.draw.prizes),
|
|
1713
|
+
current_state: res.draw.current_state,
|
|
1714
|
+
run_id: res.draw.run_id,
|
|
1715
|
+
execution_type: res.draw.execution_type,
|
|
1716
|
+
execution_ts: res.draw.execution_ts,
|
|
1717
|
+
previous_run_ts: res.draw.previous_run_ts,
|
|
1718
|
+
previous_run_id: res.draw.previous_run_id,
|
|
1719
|
+
ticket_start_ts: res.draw.ticket_start_ts,
|
|
1720
|
+
allow_multi_prize_per_ticket: res.draw.allow_multi_prize_per_ticket,
|
|
1721
|
+
total_tickets_count: res.draw.total_tickets_count,
|
|
1722
|
+
my_tickets_count: res.draw.my_tickets_count,
|
|
1723
|
+
my_last_tickets: ticketsTransform(res.draw.my_last_tickets)
|
|
1724
|
+
};
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
var RaffleDrawInstanceState;
|
|
1728
|
+
(function (RaffleDrawInstanceState) {
|
|
1729
|
+
/** Draw is open for the tickets collection */
|
|
1730
|
+
RaffleDrawInstanceState[RaffleDrawInstanceState["Open"] = 1] = "Open";
|
|
1731
|
+
/** Winner selection is in progress */
|
|
1732
|
+
RaffleDrawInstanceState[RaffleDrawInstanceState["WinnerSelection"] = 2] = "WinnerSelection";
|
|
1733
|
+
/** Draw is executed and the winners are selected */
|
|
1734
|
+
RaffleDrawInstanceState[RaffleDrawInstanceState["Executed"] = 3] = "Executed";
|
|
1735
|
+
})(RaffleDrawInstanceState || (RaffleDrawInstanceState = {}));
|
|
1736
|
+
var RaffleDrawTypeExecution;
|
|
1737
|
+
(function (RaffleDrawTypeExecution) {
|
|
1738
|
+
/** Draw is executed only once */
|
|
1739
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["ExecDate"] = 0] = "ExecDate";
|
|
1740
|
+
/** Draw is executed on a recurring basis */
|
|
1741
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Recurring"] = 1] = "Recurring";
|
|
1742
|
+
/**
|
|
1743
|
+
* Draw is executed once and is marked as grand.
|
|
1744
|
+
* This means it is a special or significant draw,
|
|
1745
|
+
* often with larger prizes or more importance.
|
|
1746
|
+
*/
|
|
1747
|
+
RaffleDrawTypeExecution[RaffleDrawTypeExecution["Grand"] = 2] = "Grand";
|
|
1748
|
+
})(RaffleDrawTypeExecution || (RaffleDrawTypeExecution = {}));
|
|
1749
|
+
|
|
1750
|
+
const drawRunHistoryTransform = res => {
|
|
1751
|
+
return res.draw_runs.map(item => {
|
|
1752
|
+
return {
|
|
1753
|
+
id: item.draw_id,
|
|
1754
|
+
run_id: item.run_id,
|
|
1755
|
+
name: item.public_meta.name,
|
|
1756
|
+
description: item.public_meta.description,
|
|
1757
|
+
image_url: item.public_meta.image_url,
|
|
1758
|
+
image_url_mobile: item.public_meta.image_url_mobile,
|
|
1759
|
+
icon_url: item.public_meta.icon_url,
|
|
1760
|
+
background_image_url: item.public_meta.background_image_url,
|
|
1761
|
+
background_image_url_mobile: item.public_meta.background_image_url_mobile,
|
|
1762
|
+
is_grand: item.public_meta.is_grand,
|
|
1763
|
+
execution_ts: item.execution_ts,
|
|
1764
|
+
actual_execution_ts: item.actual_execution_ts,
|
|
1765
|
+
ticket_start_ts: item.ticket_start_ts,
|
|
1766
|
+
is_winner: item.is_winner,
|
|
1767
|
+
has_unclaimed_prize: item.has_unclaimed_prize
|
|
1768
|
+
};
|
|
1769
|
+
});
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1772
|
+
const raffleClaimPrizeResponseTransform = info => {
|
|
1773
|
+
return {
|
|
1774
|
+
errorCode: info.errCode,
|
|
1775
|
+
errorMessage: info.errMsg
|
|
1776
|
+
};
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1609
1779
|
/** @hidden */
|
|
1610
1780
|
const CACHE_DATA_SEC = 30;
|
|
1611
1781
|
const JACKPOT_TEMPLATE_CACHE_SEC = 30;
|
|
1612
1782
|
const JACKPOT_POT_CACHE_SEC = 1;
|
|
1783
|
+
const JACKPOT_WINNERS_CACHE_SEC = 30;
|
|
1613
1784
|
/** @hidden */
|
|
1614
1785
|
var onUpdateContextKey;
|
|
1615
1786
|
(function (onUpdateContextKey) {
|
|
@@ -1631,6 +1802,8 @@ var onUpdateContextKey;
|
|
|
1631
1802
|
onUpdateContextKey["CustomSections"] = "customSections";
|
|
1632
1803
|
onUpdateContextKey["Bonuses"] = "bonuses";
|
|
1633
1804
|
onUpdateContextKey["SAWHistory"] = "sawHistory";
|
|
1805
|
+
onUpdateContextKey["JackpotWinners"] = "jackpotWinners";
|
|
1806
|
+
onUpdateContextKey["Raffles"] = "raffles";
|
|
1634
1807
|
})(onUpdateContextKey || (onUpdateContextKey = {}));
|
|
1635
1808
|
/** @group General API */
|
|
1636
1809
|
class WSAPI {
|
|
@@ -1668,6 +1841,10 @@ class WSAPI {
|
|
|
1668
1841
|
this.reloadMiniGameTemplate();
|
|
1669
1842
|
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.SAWHistory);
|
|
1670
1843
|
});
|
|
1844
|
+
on(ClassId.RAF_CLAIM_PRIZE_RESPONSE, () => {
|
|
1845
|
+
this.updateRaffles();
|
|
1846
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Raffles);
|
|
1847
|
+
});
|
|
1671
1848
|
}
|
|
1672
1849
|
}
|
|
1673
1850
|
/** @private */
|
|
@@ -2317,6 +2494,10 @@ class WSAPI {
|
|
|
2317
2494
|
const payload = await this.api.getInboxMessagesT(null);
|
|
2318
2495
|
this.updateEntity(onUpdateContextKey.InboxMessages, payload);
|
|
2319
2496
|
}
|
|
2497
|
+
async updateRaffles() {
|
|
2498
|
+
const payload = await this.api.getRafflesT(null);
|
|
2499
|
+
this.updateEntity(onUpdateContextKey.Raffles, payload);
|
|
2500
|
+
}
|
|
2320
2501
|
async updateEntity(contextKey, payload) {
|
|
2321
2502
|
OCache.set(contextKey, payload, ECacheContext.WSAPI);
|
|
2322
2503
|
const onUpdate = this.onUpdateCallback.get(contextKey);
|
|
@@ -2327,6 +2508,7 @@ class WSAPI {
|
|
|
2327
2508
|
async jackpotClearCache() {
|
|
2328
2509
|
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Jackpots);
|
|
2329
2510
|
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.Pots);
|
|
2511
|
+
OCache.clear(ECacheContext.WSAPI, onUpdateContextKey.JackpotWinners);
|
|
2330
2512
|
}
|
|
2331
2513
|
/** Returns list of Jackpots that are active in the systen and matching to the filter definition.
|
|
2332
2514
|
* If filter is not provided, all active jackpots will be returned.
|
|
@@ -2422,6 +2604,28 @@ class WSAPI {
|
|
|
2422
2604
|
const result = await this.api.jackpotOptOut(null, filter);
|
|
2423
2605
|
return result;
|
|
2424
2606
|
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Returns the winners of the jackpot with the specified jp_template_id.
|
|
2609
|
+
*
|
|
2610
|
+
* **Example**:
|
|
2611
|
+
* ```
|
|
2612
|
+
* _smartico.api.getJackpotWinners({
|
|
2613
|
+
* jp_template_id: 123,
|
|
2614
|
+
* }).then((result) => {
|
|
2615
|
+
* console.log(result);
|
|
2616
|
+
* });
|
|
2617
|
+
* ```
|
|
2618
|
+
*
|
|
2619
|
+
* **Visitor mode: not supported**
|
|
2620
|
+
*
|
|
2621
|
+
*/
|
|
2622
|
+
async getJackpotWinners({
|
|
2623
|
+
limit,
|
|
2624
|
+
offset,
|
|
2625
|
+
jp_template_id
|
|
2626
|
+
}) {
|
|
2627
|
+
return OCache.use(onUpdateContextKey.JackpotWinners, ECacheContext.WSAPI, () => this.api.getJackpotWinnersT(null, limit, offset, jp_template_id), JACKPOT_WINNERS_CACHE_SEC);
|
|
2628
|
+
}
|
|
2425
2629
|
/**
|
|
2426
2630
|
* Returns all the related tournaments and missions for the provided game id for the current user
|
|
2427
2631
|
* The provided Game ID should correspond to the ID from the Games Catalog - https://help.smartico.ai/welcome/technical-guides/games-catalog-api
|
|
@@ -2444,17 +2648,93 @@ class WSAPI {
|
|
|
2444
2648
|
const result = await this.api.getRelatedItemsForGame(null, related_game_id);
|
|
2445
2649
|
return result;
|
|
2446
2650
|
}
|
|
2447
|
-
|
|
2448
|
-
|
|
2651
|
+
/**
|
|
2652
|
+
* Returns the list of Raffles available for user
|
|
2653
|
+
* The returned list of Raffles is cached for 30 seconds. But you can pass the onUpdate callback as a parameter. Note that each time you call getRaffles with a new onUpdate callback, the old one will be overwritten by the new one.
|
|
2654
|
+
* The onUpdate callback will be called on claiming prize. Updated Raffles will be passed to onUpdate callback.
|
|
2655
|
+
*
|
|
2656
|
+
* **Example**:
|
|
2657
|
+
* ```
|
|
2658
|
+
* _smartico.api.getRaffles().then((result) => {
|
|
2659
|
+
* console.log(result);
|
|
2660
|
+
* });
|
|
2661
|
+
* ```
|
|
2662
|
+
*
|
|
2663
|
+
* **Visitor mode: not supported**
|
|
2664
|
+
*
|
|
2665
|
+
*/
|
|
2666
|
+
async getRaffles({
|
|
2667
|
+
onUpdate
|
|
2668
|
+
} = {}) {
|
|
2669
|
+
if (onUpdate) {
|
|
2670
|
+
this.onUpdateCallback.set(onUpdateContextKey.Raffles, onUpdate);
|
|
2671
|
+
}
|
|
2672
|
+
return OCache.use(onUpdateContextKey.Raffles, ECacheContext.WSAPI, () => this.api.getRafflesT(null), CACHE_DATA_SEC);
|
|
2449
2673
|
}
|
|
2450
|
-
|
|
2451
|
-
|
|
2674
|
+
/**
|
|
2675
|
+
* Returns draw run for provided raffle_id and run_id
|
|
2676
|
+
*
|
|
2677
|
+
*
|
|
2678
|
+
* **Example**:
|
|
2679
|
+
* ```
|
|
2680
|
+
* _smartico.api.getRaffleDrawRun({raffle_id:156, run_id: 145}).then((result) => {
|
|
2681
|
+
* console.log(result);
|
|
2682
|
+
* });
|
|
2683
|
+
* ```
|
|
2684
|
+
*
|
|
2685
|
+
* **Visitor mode: not supported**
|
|
2686
|
+
*
|
|
2687
|
+
*/
|
|
2688
|
+
async getRaffleDrawRun(props) {
|
|
2689
|
+
const res = await this.api.getRaffleDrawRun(null, props);
|
|
2690
|
+
if (!props.raffle_id || !props.run_id) {
|
|
2691
|
+
throw new Error('both raffle_id and run_id are required');
|
|
2692
|
+
}
|
|
2693
|
+
return drawRunTransform(res);
|
|
2452
2694
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2695
|
+
/**
|
|
2696
|
+
* 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
|
|
2697
|
+
*
|
|
2698
|
+
*
|
|
2699
|
+
* **Example**:
|
|
2700
|
+
* ```
|
|
2701
|
+
* _smartico.api.getRaffleDrawRunHistory({raffle_id:156, draw_id: 432}).then((result) => {
|
|
2702
|
+
* console.log(result);
|
|
2703
|
+
* });
|
|
2704
|
+
* ```
|
|
2705
|
+
*
|
|
2706
|
+
* **Visitor mode: not supported**
|
|
2707
|
+
*
|
|
2708
|
+
*/
|
|
2709
|
+
async getRaffleDrawRunsHistory(props) {
|
|
2710
|
+
const res = await this.api.getRaffleDrawRunsHistory(null, props);
|
|
2711
|
+
if (!props.raffle_id) {
|
|
2712
|
+
throw new Error('raffle_id is required');
|
|
2713
|
+
}
|
|
2714
|
+
return drawRunHistoryTransform(res);
|
|
2455
2715
|
}
|
|
2456
|
-
|
|
2457
|
-
|
|
2716
|
+
/**
|
|
2717
|
+
* Returns error code, and error Message after calling the function, error message 0 - means that the request was successful
|
|
2718
|
+
*
|
|
2719
|
+
*
|
|
2720
|
+
* **Example**:
|
|
2721
|
+
* ```
|
|
2722
|
+
* _smartico.api.claimRafflePrize({won_id:251}).then((result) => {
|
|
2723
|
+
* console.log(result);
|
|
2724
|
+
* });
|
|
2725
|
+
* ```
|
|
2726
|
+
*
|
|
2727
|
+
* **Visitor mode: not supported**
|
|
2728
|
+
*
|
|
2729
|
+
*/
|
|
2730
|
+
async claimRafflePrize(props) {
|
|
2731
|
+
if (!props.won_id) {
|
|
2732
|
+
throw new Error('won_id is required');
|
|
2733
|
+
}
|
|
2734
|
+
const res = await this.api.claimRafflePrize(null, {
|
|
2735
|
+
won_id: props.won_id
|
|
2736
|
+
});
|
|
2737
|
+
return raffleClaimPrizeResponseTransform(res);
|
|
2458
2738
|
}
|
|
2459
2739
|
}
|
|
2460
2740
|
|
|
@@ -2546,6 +2826,20 @@ var BonusStatus;
|
|
|
2546
2826
|
BonusStatus[BonusStatus["EXPIRED"] = 6] = "EXPIRED";
|
|
2547
2827
|
})(BonusStatus || (BonusStatus = {}));
|
|
2548
2828
|
|
|
2829
|
+
/**
|
|
2830
|
+
* @ignore
|
|
2831
|
+
*/
|
|
2832
|
+
const GetJackpotWinnersResponseTransform = items => {
|
|
2833
|
+
return items.map(item => {
|
|
2834
|
+
const winnerInfo = {
|
|
2835
|
+
winner: item.winner,
|
|
2836
|
+
win_date_ts: item.win_date_ts,
|
|
2837
|
+
jp_pot_id: item.jp_pot_id
|
|
2838
|
+
};
|
|
2839
|
+
return winnerInfo;
|
|
2840
|
+
});
|
|
2841
|
+
};
|
|
2842
|
+
|
|
2549
2843
|
const PUBLIC_API_URL = 'https://papi{ENV_ID}.smartico.ai/services/public';
|
|
2550
2844
|
const C_SOCKET_PROD = 'wss://api{ENV_ID}.smartico.ai/websocket/services';
|
|
2551
2845
|
const AVATAR_DOMAIN = 'https://img{ENV_ID}.smr.vc';
|
|
@@ -2794,6 +3088,17 @@ class SmarticoAPI {
|
|
|
2794
3088
|
const message = this.buildMessage(user_ext_id, ClassId.JP_OPTOUT_REQUEST, payload);
|
|
2795
3089
|
return await this.send(message, ClassId.JP_OPTOUT_RESPONSE);
|
|
2796
3090
|
}
|
|
3091
|
+
async getJackpotWinners(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
3092
|
+
const message = this.buildMessage(user_ext_id, ClassId.JP_GET_WINNERS_REQUEST, {
|
|
3093
|
+
limit,
|
|
3094
|
+
offset,
|
|
3095
|
+
jp_template_id
|
|
3096
|
+
});
|
|
3097
|
+
return await this.send(message, ClassId.JP_GET_WINNERS_RESPONSE);
|
|
3098
|
+
}
|
|
3099
|
+
async getJackpotWinnersT(user_ext_id, limit = 20, offset = 0, jp_template_id) {
|
|
3100
|
+
return GetJackpotWinnersResponseTransform((await this.getJackpotWinners(user_ext_id, limit, offset, jp_template_id)).winners);
|
|
3101
|
+
}
|
|
2797
3102
|
async sawGetTemplates(user_ext_id, force_language, is_visitor_mode = false) {
|
|
2798
3103
|
const message = this.buildMessage(user_ext_id, ClassId.SAW_GET_SPINS_REQUEST, {
|
|
2799
3104
|
is_visitor_mode
|
|
@@ -3183,20 +3488,23 @@ class SmarticoAPI {
|
|
|
3183
3488
|
});
|
|
3184
3489
|
return await this.send(message, ClassId.GET_RELATED_ACH_N_TOURNAMENTS_RESPONSE);
|
|
3185
3490
|
}
|
|
3491
|
+
async getRafflesT(user_ext_id) {
|
|
3492
|
+
return raffleTransform((await this.getRaffles(user_ext_id)).items);
|
|
3493
|
+
}
|
|
3186
3494
|
async getRaffles(user_ext_id) {
|
|
3187
3495
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_RAFFLES_REQUEST);
|
|
3188
3496
|
return await this.send(message, ClassId.RAF_GET_RAFFLES_RESPONSE);
|
|
3189
3497
|
}
|
|
3190
|
-
async
|
|
3498
|
+
async getRaffleDrawRun(user_ext_id, payload) {
|
|
3191
3499
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_DRAW_RUN_REQUEST, payload);
|
|
3192
3500
|
return await this.send(message, ClassId.RAF_GET_DRAW_RUN_RESPONSE);
|
|
3193
3501
|
}
|
|
3194
|
-
async getRaffleDrawRunsHistory(user_ext_id,
|
|
3195
|
-
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_DRAW_HISTORY_REQUEST,
|
|
3502
|
+
async getRaffleDrawRunsHistory(user_ext_id, props) {
|
|
3503
|
+
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_DRAW_HISTORY_REQUEST, props);
|
|
3196
3504
|
return await this.send(message, ClassId.RAF_GET_DRAW_HISTORY_RESPONSE);
|
|
3197
3505
|
}
|
|
3198
|
-
async claimRafflePrize(user_ext_id,
|
|
3199
|
-
const message = this.buildMessage(user_ext_id, ClassId.RAF_CLAIM_PRIZE_REQUEST,
|
|
3506
|
+
async claimRafflePrize(user_ext_id, props) {
|
|
3507
|
+
const message = this.buildMessage(user_ext_id, ClassId.RAF_CLAIM_PRIZE_REQUEST, props);
|
|
3200
3508
|
return await this.send(message, ClassId.RAF_CLAIM_PRIZE_RESPONSE);
|
|
3201
3509
|
}
|
|
3202
3510
|
}
|
|
@@ -3609,5 +3917,5 @@ var JackpotType;
|
|
|
3609
3917
|
JackpotType[JackpotType["Personal"] = 2] = "Personal";
|
|
3610
3918
|
})(JackpotType || (JackpotType = {}));
|
|
3611
3919
|
|
|
3612
|
-
export { AchCategoryTransform, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityTypeLimited, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, JackpotContributionType, JackpotType, LeaderBoardPeriodType, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, OCache, OpenLinksType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWGPMarketType, SAWGameLayout, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UserAchievementTransform, getLeaderBoardTransform, marketsInfo, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, tournamentInfoItemTransform };
|
|
3920
|
+
export { AchCategoryTransform, AchievementAvailabilityStatus, AchievementStatus, AchievementTaskType, AchievementType, ActivityTypeLimited, BonusItemsTransform, BonusStatus, BuyStoreItemErrorCode, ClassId, CookieStore, CoreUtils, ECacheContext, GetJackpotWinnersResponseTransform, GetLevelMapResponseTransform, InboxCategories, InboxMessageBodyTransform, InboxMessageType, InboxMessagesTransform, JackpotContributionType, JackpotType, LeaderBoardPeriodType, MiniGamePrizeTypeName, MiniGamePrizeTypeNamed, OCache, OpenLinksType, PrizeModifiers, PrizeModifiersKeysNames, PublicLabelSettings, QuizAnswersValueType, QuizMarketPerSport, QuizSportType, SAWAcknowledgeType, SAWAcknowledgeTypeName, SAWAcknowledgeTypeNamed, SAWAskForUsername, SAWBuyInType, SAWBuyInTypeName, SAWBuyInTypeNamed, SAWGPMarketType, SAWGameLayout, SAWGameType, SAWGameTypeName, SAWGameTypeNamed, SAWHistoryTransform, SAWPrizeType, SAWSpinErrorCode, SAWTemplatesTransform, SAWUtils, SAWWheelLayout, SAWWinSoundFiles, SAWWinSoundType, ScheduledMissionType, SmarticoAPI, StoreCategoryTransform, StoreItemPurchaseType, StoreItemPurchasedTransform, StoreItemTransform, StoreItemType, StoreItemTypeName, StoreItemTypeNamed, TournamentInstanceStatus, TournamentInstanceStatusName, TournamentItemsTransform, TournamentRegistrationError, TournamentRegistrationStatus, TournamentRegistrationStatusName, TournamentRegistrationStatusNamed, TournamentRegistrationType, TournamentRegistrationTypeGetName, TournamentType, TournamentUtils, TranslationArea, UserAchievementTransform, getLeaderBoardTransform, marketsInfo, quizAnswerAwayTeamReplacementText, quizAnswerHomeTeamReplacementText, quizAnswersTrKeys, quizDrawReplacementText, quizEvenReplacementText, quizNoGoalsReplacementText, quizNoReplacementText, quizOddReplacementText, quizOrReplacementText, quizSupportedSports, quizYesReplacementText, tournamentInfoItemTransform };
|
|
3613
3921
|
//# sourceMappingURL=index.modern.mjs.map
|