@smartico/public-api 0.0.283 → 0.0.285
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/Jackpots/JackpotPublicMeta.d.ts +1 -1
- package/dist/MiniGames/SAWGameDifficulty.d.ts +12 -0
- package/dist/MiniGames/SAWPrizeUI.d.ts +1 -0
- package/dist/MiniGames/SAWTemplateUI.d.ts +2 -0
- package/dist/Raffle/Raffle.d.ts +1 -1
- package/dist/Raffle/RaffleDraw.d.ts +16 -11
- package/dist/Raffle/RafflePrize.d.ts +15 -14
- package/dist/Raffle/RaffleTicket.d.ts +6 -0
- package/dist/WSAPI/WSAPI.d.ts +37 -8
- package/dist/WSAPI/WSAPITypes.d.ts +11 -0
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +39 -8
- package/dist/index.modern.mjs.map +1 -1
- package/docs/classes/WSAPI.md +36 -8
- package/docs/interfaces/JackpotPublicMeta.md +1 -1
- package/docs/interfaces/RaffleDraw.md +13 -10
- package/docs/interfaces/RafflePrize.md +18 -16
- package/docs/interfaces/RafflePublicMeta.md +1 -1
- package/docs/interfaces/RaffleTicket.md +4 -0
- package/docs/interfaces/SAWPrizeUI.md +6 -0
- package/docs/interfaces/TMiniGameTemplate.md +18 -0
- package/docs/interfaces/TRaffleTicket.md +4 -0
- package/package.json +1 -1
- package/src/Jackpots/JackpotPublicMeta.ts +1 -1
- package/src/MiniGames/SAWGameDifficulty.ts +22 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +2 -0
- package/src/MiniGames/SAWPrizeUI.ts +1 -0
- package/src/MiniGames/SAWTemplateUI.ts +2 -0
- package/src/Raffle/Raffle.ts +1 -1
- package/src/Raffle/RaffleClaimPrizeResponse.ts +1 -4
- package/src/Raffle/RaffleDraw.ts +17 -15
- package/src/Raffle/RafflePrize.ts +18 -17
- package/src/Raffle/RaffleTicket.ts +6 -2
- package/src/WSAPI/WSAPI.ts +38 -8
- package/src/WSAPI/WSAPITypes.ts +11 -3
package/docs/classes/WSAPI.md
CHANGED
|
@@ -1084,13 +1084,20 @@ The returned list of Raffles is cached for 30 seconds. But you can pass the onUp
|
|
|
1084
1084
|
The onUpdate callback will be called on claiming prize. Updated Raffles will be passed to onUpdate callback.
|
|
1085
1085
|
|
|
1086
1086
|
**Example**:
|
|
1087
|
+
|
|
1087
1088
|
```
|
|
1088
1089
|
_smartico.api.getRaffles().then((result) => {
|
|
1089
1090
|
console.log(result);
|
|
1090
1091
|
});
|
|
1091
1092
|
```
|
|
1092
1093
|
|
|
1093
|
-
**Visitor mode
|
|
1094
|
+
**Example in the Visitor mode**:
|
|
1095
|
+
|
|
1096
|
+
```
|
|
1097
|
+
_smartico.vapi('EN').getRaffles().then((result) => {
|
|
1098
|
+
console.log(result);
|
|
1099
|
+
});
|
|
1100
|
+
```
|
|
1094
1101
|
|
|
1095
1102
|
#### Parameters
|
|
1096
1103
|
|
|
@@ -1112,13 +1119,20 @@ ___
|
|
|
1112
1119
|
Returns draw run for provided raffle_id and run_id
|
|
1113
1120
|
|
|
1114
1121
|
**Example**:
|
|
1115
|
-
|
|
1116
|
-
|
|
1122
|
+
|
|
1123
|
+
```javascript
|
|
1124
|
+
_smartico.api.getRaffleDrawRun({raffle_id: 156, run_id: 145}).then((result) => {
|
|
1117
1125
|
console.log(result);
|
|
1118
1126
|
});
|
|
1119
1127
|
```
|
|
1120
1128
|
|
|
1121
|
-
**Visitor mode
|
|
1129
|
+
**Example in the Visitor mode**:
|
|
1130
|
+
|
|
1131
|
+
```javascript
|
|
1132
|
+
_smartico.vapi('EN').getRaffleDrawRun({ raffle_id: 156, run_id: 145 }).then((result) => {
|
|
1133
|
+
console.log(result);
|
|
1134
|
+
});
|
|
1135
|
+
```
|
|
1122
1136
|
|
|
1123
1137
|
#### Parameters
|
|
1124
1138
|
|
|
@@ -1141,13 +1155,20 @@ ___
|
|
|
1141
1155
|
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
|
|
1142
1156
|
|
|
1143
1157
|
**Example**:
|
|
1144
|
-
|
|
1158
|
+
|
|
1159
|
+
```javascript
|
|
1145
1160
|
_smartico.api.getRaffleDrawRunHistory({raffle_id:156, draw_id: 432}).then((result) => {
|
|
1146
1161
|
console.log(result);
|
|
1147
1162
|
});
|
|
1148
1163
|
```
|
|
1149
1164
|
|
|
1150
|
-
**Visitor mode
|
|
1165
|
+
**Example in the Visitor mode**:
|
|
1166
|
+
|
|
1167
|
+
```javascript
|
|
1168
|
+
_smartico.vapi('EN').getRaffleDrawRunHistory({ raffle_id: 156, draw_id: 432 }).then((result) => {
|
|
1169
|
+
console.log(result);
|
|
1170
|
+
});
|
|
1171
|
+
```
|
|
1151
1172
|
|
|
1152
1173
|
#### Parameters
|
|
1153
1174
|
|
|
@@ -1170,13 +1191,20 @@ ___
|
|
|
1170
1191
|
Returns error code, and error Message after calling the function, error message 0 - means that the request was successful
|
|
1171
1192
|
|
|
1172
1193
|
**Example**:
|
|
1173
|
-
|
|
1194
|
+
|
|
1195
|
+
```javascript
|
|
1174
1196
|
_smartico.api.claimRafflePrize({won_id:251}).then((result) => {
|
|
1175
1197
|
console.log(result);
|
|
1176
1198
|
});
|
|
1177
1199
|
```
|
|
1178
1200
|
|
|
1179
|
-
**Visitor mode
|
|
1201
|
+
**Example in the Visitor mode**:
|
|
1202
|
+
|
|
1203
|
+
```javascript
|
|
1204
|
+
_smartico.vapi('EN').claimRafflePrize({ won_id: 251 }).then((result) => {
|
|
1205
|
+
console.log(result);
|
|
1206
|
+
});
|
|
1207
|
+
```
|
|
1180
1208
|
|
|
1181
1209
|
#### Parameters
|
|
1182
1210
|
|
|
@@ -64,4 +64,4 @@ ___
|
|
|
64
64
|
|
|
65
65
|
Custom data as string or JSON string that can be used in API to build custom UI
|
|
66
66
|
You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
67
|
-
Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
67
|
+
Read more here - <https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes>
|
|
@@ -48,6 +48,7 @@ ___
|
|
|
48
48
|
• **execution\_type**: [`RaffleDrawTypeExecution`](../enums/RaffleDrawTypeExecution.md)
|
|
49
49
|
|
|
50
50
|
Type of the draw execution, indicating how and when the draw is executed.
|
|
51
|
+
|
|
51
52
|
- ExecDate: Draw is executed only once at a specific date and time.
|
|
52
53
|
- Recurring: Draw is executed on a recurring basis (e.g., daily, weekly).
|
|
53
54
|
- Grand: Draw is executed once and is marked as grand, often with larger prizes or more importance.
|
|
@@ -83,9 +84,9 @@ ___
|
|
|
83
84
|
• **ticket\_start\_ts**: `number`
|
|
84
85
|
|
|
85
86
|
Date/time starting from which the tickets will participate in the upcoming draw
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
This value need to be taken into account with next_execute_ts field value, for example
|
|
88
|
+
Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
|
|
89
|
+
(internally this value is calculated as next_execute_ts - ticket_start_date)
|
|
89
90
|
|
|
90
91
|
___
|
|
91
92
|
|
|
@@ -93,13 +94,13 @@ ___
|
|
|
93
94
|
|
|
94
95
|
• **allow\_multi\_prize\_per\_ticket**: `boolean`
|
|
95
96
|
|
|
96
|
-
Field is indicating if same ticket can win multiple prizes in the same draw
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
Field is indicating if same ticket can win multiple prizes in the same draw
|
|
98
|
+
For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook
|
|
99
|
+
If this field is true, then one ticket can win all 3 prizes (depending on the chances of course),
|
|
100
|
+
if false, then one ticket can win only one prize.
|
|
101
|
+
The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes)
|
|
102
|
+
If specific prize has multiple values, e.g. we have 3 iPhones,
|
|
103
|
+
then the same ticket can win only one prize of a kind, but can win multiple prizes of different kind (if allow_multi_prize_per_ticket is true)
|
|
103
104
|
|
|
104
105
|
___
|
|
105
106
|
|
|
@@ -123,3 +124,5 @@ ___
|
|
|
123
124
|
### my\_last\_tickets
|
|
124
125
|
|
|
125
126
|
• **my\_last\_tickets**: [`RaffleTicket`](RaffleTicket.md)[]
|
|
127
|
+
|
|
128
|
+
List of last 5 tickets are collected by current user for this instance of draw.
|
|
@@ -35,20 +35,22 @@ ___
|
|
|
35
35
|
|
|
36
36
|
The actual number of prizes for the current instance.
|
|
37
37
|
This value is taking into account follwing values:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
|
|
39
|
+
- min_required_total_tickets,
|
|
40
|
+
- add_one_prize_per_each_x_tickets
|
|
41
|
+
- stock_items_per_draw
|
|
42
|
+
- total_tickets_count (from Draw instance)
|
|
43
|
+
- cap_prizes_per_run
|
|
43
44
|
For example:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
|
|
46
|
+
- prizes_per_run = 1
|
|
47
|
+
- min_required_total_tickets = 1000
|
|
48
|
+
- add_one_prize_per_each_x_tickets = 1000
|
|
49
|
+
- stock_items_per_draw = 5
|
|
50
|
+
- total_tickets_count = 7000
|
|
51
|
+
- cap_prizes_per_run = 6
|
|
52
|
+
prizes_per_run_actual will be 5, because
|
|
53
|
+
7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
|
|
52
54
|
|
|
53
55
|
___
|
|
54
56
|
|
|
@@ -56,8 +58,8 @@ ___
|
|
|
56
58
|
|
|
57
59
|
• **chances\_to\_win\_perc**: `number`
|
|
58
60
|
|
|
59
|
-
The chances to win the prize by current player.
|
|
60
|
-
Calculated as the ratio of the number of tickets collected by the current player to the
|
|
61
|
+
The chances to win the prize by current player.
|
|
62
|
+
Calculated as the ratio of the number of tickets collected by the current player to the
|
|
61
63
|
total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
|
|
62
64
|
|
|
63
65
|
___
|
|
@@ -107,7 +109,7 @@ ___
|
|
|
107
109
|
• `Optional` **cap\_prizes\_per\_run**: `number`
|
|
108
110
|
|
|
109
111
|
The maximum number of prizes that can be given within one instance/run of draw.
|
|
110
|
-
For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
|
|
112
|
+
For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
|
|
111
113
|
cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000.
|
|
112
114
|
In this case, the prizes_per_run_actual will be limited by 3
|
|
113
115
|
|
|
@@ -56,4 +56,4 @@ ___
|
|
|
56
56
|
|
|
57
57
|
Custom data as string or JSON string that can be used in API to build custom UI
|
|
58
58
|
You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
59
|
-
Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
59
|
+
Read more here - <https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes>
|
|
@@ -226,3 +226,21 @@ ___
|
|
|
226
226
|
### show\_prize\_history
|
|
227
227
|
|
|
228
228
|
• `Optional` **show\_prize\_history**: `boolean`
|
|
229
|
+
|
|
230
|
+
When enabled the prize history icon is visible on a certain template
|
|
231
|
+
|
|
232
|
+
___
|
|
233
|
+
|
|
234
|
+
### max\_number\_of\_attempts
|
|
235
|
+
|
|
236
|
+
• `Optional` **max\_number\_of\_attempts**: `number`
|
|
237
|
+
|
|
238
|
+
The maximum number of attempts that user can do during period of time
|
|
239
|
+
|
|
240
|
+
___
|
|
241
|
+
|
|
242
|
+
### max\_spins\_period\_ms
|
|
243
|
+
|
|
244
|
+
• `Optional` **max\_spins\_period\_ms**: `number`
|
|
245
|
+
|
|
246
|
+
The period of time in milliseconds during which the user can do the maximum number of attempts
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ interface JackpotPublicMeta {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
19
19
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
20
|
-
* Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
20
|
+
* Read more here - <https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes>
|
|
21
21
|
*/
|
|
22
22
|
custom_data: string;
|
|
23
23
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export enum SAWGameDifficultyType {
|
|
2
|
+
EASY = 1,
|
|
3
|
+
MEDIUM = 2,
|
|
4
|
+
HARD = 3,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum SAWGameDifficultyTypeName {
|
|
8
|
+
EASY = 'easy',
|
|
9
|
+
MEDIUM = 'medium',
|
|
10
|
+
HARD = 'hard',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** @hidden */
|
|
14
|
+
export const SawGameDifficultyTypeNamed = (type: SAWGameDifficultyType): SAWGameDifficultyTypeName => {
|
|
15
|
+
return (
|
|
16
|
+
{
|
|
17
|
+
[SAWGameDifficultyType.EASY]: SAWGameDifficultyTypeName.EASY,
|
|
18
|
+
[SAWGameDifficultyType.MEDIUM]: SAWGameDifficultyTypeName.MEDIUM,
|
|
19
|
+
[SAWGameDifficultyType.HARD]: SAWGameDifficultyTypeName.HARD,
|
|
20
|
+
}[type]
|
|
21
|
+
);
|
|
22
|
+
};
|
|
@@ -45,6 +45,8 @@ export const SAWTemplatesTransform = (items: SAWTemplate[]): TMiniGameTemplate[]
|
|
|
45
45
|
custom_section_id: r.saw_template_ui_definition.custom_section_id,
|
|
46
46
|
saw_template_ui_definition: r.saw_template_ui_definition,
|
|
47
47
|
show_prize_history: r.show_prize_history,
|
|
48
|
+
max_number_of_attempts: r.maxSpinsCount,
|
|
49
|
+
max_spins_period_ms: r.maxSpinsPediodMs,
|
|
48
50
|
|
|
49
51
|
prizes: r.prizes.map((p) => {
|
|
50
52
|
const y: TMiniGamePrize = {
|
|
@@ -8,6 +8,7 @@ export interface SAWPrizeUI {
|
|
|
8
8
|
name_original?: string; // keeps original name, how it came from the servers. This is needed for the Jackpot value replacemenet
|
|
9
9
|
hide_prize_popup: boolean; // if true, prize popup on Prize Drop will not be shown
|
|
10
10
|
aknowledge_message?: string;
|
|
11
|
+
aknowledge_message_lose?: string; // voyager specific
|
|
11
12
|
sectors?: number[];
|
|
12
13
|
acknowledge_type?: SAWAcknowledgeType;
|
|
13
14
|
acknowledge_dp?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SAWAskForUsername } from './SAWAskForUsername';
|
|
2
|
+
import { SAWGameDifficultyType } from './SAWGameDifficulty';
|
|
2
3
|
import { SAWGameLayout } from './SAWGameLayout';
|
|
3
4
|
import { SAWWheelLayout } from './SAWWheelLayout';
|
|
4
5
|
|
|
@@ -63,4 +64,5 @@ export interface SAWTemplateUI {
|
|
|
63
64
|
|
|
64
65
|
wheel_layout?: SAWWheelLayout;
|
|
65
66
|
background_music_volume?: number;
|
|
67
|
+
game_difficulty: SAWGameDifficultyType;
|
|
66
68
|
}
|
package/src/Raffle/Raffle.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface RafflePublicMeta {
|
|
|
17
17
|
/**
|
|
18
18
|
* Custom data as string or JSON string that can be used in API to build custom UI
|
|
19
19
|
* You can request from Smartico to define fields for your specific case that will be managed from Smartico BackOffice
|
|
20
|
-
* Read more here - https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes
|
|
20
|
+
* Read more here - <https://help.smartico.ai/welcome/products/general-concepts/custom-fields-attributes>
|
|
21
21
|
*/
|
|
22
22
|
custom_data: string;
|
|
23
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransformedRaffleClaimPrizeResponse } from "../WSAPI/WSAPITypes";
|
|
2
2
|
import { ProtocolResponse } from "../Base/ProtocolResponse";
|
|
3
3
|
|
|
4
|
-
export interface RaffleClaimPrizeResponse extends ProtocolResponse {
|
|
4
|
+
export interface RaffleClaimPrizeResponse extends ProtocolResponse {
|
|
5
5
|
errCode: number
|
|
6
6
|
errMsg?: string
|
|
7
7
|
}
|
|
@@ -13,6 +13,3 @@ export const raffleClaimPrizeResponseTransform = (info: RaffleClaimPrizeResponse
|
|
|
13
13
|
errorMessage: info.errMsg
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
package/src/Raffle/RaffleDraw.ts
CHANGED
|
@@ -50,6 +50,7 @@ interface RaffleDraw {
|
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Type of the draw execution, indicating how and when the draw is executed.
|
|
53
|
+
*
|
|
53
54
|
* - ExecDate: Draw is executed only once at a specific date and time.
|
|
54
55
|
* - Recurring: Draw is executed on a recurring basis (e.g., daily, weekly).
|
|
55
56
|
* - Grand: Draw is executed once and is marked as grand, often with larger prizes or more importance.
|
|
@@ -65,21 +66,22 @@ interface RaffleDraw {
|
|
|
65
66
|
/** Unique ID of the previusly executed draw (if there is such) */
|
|
66
67
|
previous_run_id?: number;
|
|
67
68
|
|
|
68
|
-
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
69
|
+
/**
|
|
70
|
+
* Date/time starting from which the tickets will participate in the upcoming draw
|
|
71
|
+
* This value need to be taken into account with next_execute_ts field value, for example
|
|
72
|
+
* Next draw is at 10:00, ticket_start_date is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
|
|
73
|
+
* (internally this value is calculated as next_execute_ts - ticket_start_date)
|
|
73
74
|
*/
|
|
74
75
|
ticket_start_ts: number;
|
|
75
76
|
|
|
76
|
-
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
77
|
+
/**
|
|
78
|
+
* Field is indicating if same ticket can win multiple prizes in the same draw
|
|
79
|
+
* For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook
|
|
80
|
+
* If this field is true, then one ticket can win all 3 prizes (depending on the chances of course),
|
|
81
|
+
* if false, then one ticket can win only one prize.
|
|
82
|
+
* The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes)
|
|
83
|
+
* If specific prize has multiple values, e.g. we have 3 iPhones,
|
|
84
|
+
* then the same ticket can win only one prize of a kind, but can win multiple prizes of different kind (if allow_multi_prize_per_ticket is true)
|
|
83
85
|
*/
|
|
84
86
|
allow_multi_prize_per_ticket: boolean;
|
|
85
87
|
|
|
@@ -95,9 +97,9 @@ interface RaffleDraw {
|
|
|
95
97
|
*/
|
|
96
98
|
my_tickets_count: number;
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
/**
|
|
101
|
+
* List of last 5 tickets are collected by current user for this instance of draw.
|
|
102
|
+
*/
|
|
101
103
|
my_last_tickets: RaffleTicket[];
|
|
102
104
|
}
|
|
103
105
|
|
|
@@ -34,28 +34,29 @@ interface RafflePrize {
|
|
|
34
34
|
/**
|
|
35
35
|
* The actual number of prizes for the current instance.
|
|
36
36
|
* This value is taking into account follwing values:
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* - min_required_total_tickets,
|
|
39
|
+
* - add_one_prize_per_each_x_tickets
|
|
40
|
+
* - stock_items_per_draw
|
|
41
|
+
* - total_tickets_count (from Draw instance)
|
|
42
|
+
* - cap_prizes_per_run
|
|
42
43
|
* For example:
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
44
|
+
*
|
|
45
|
+
* - prizes_per_run = 1
|
|
46
|
+
* - min_required_total_tickets = 1000
|
|
47
|
+
* - add_one_prize_per_each_x_tickets = 1000
|
|
48
|
+
* - stock_items_per_draw = 5
|
|
49
|
+
* - total_tickets_count = 7000
|
|
50
|
+
* - cap_prizes_per_run = 6
|
|
51
|
+
* prizes_per_run_actual will be 5, because
|
|
52
|
+
* 7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
|
|
51
53
|
*/
|
|
52
54
|
prizes_per_run_actual: number;
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* Calculated as the ratio of the number of tickets collected by the current player to the
|
|
58
|
+
* The chances to win the prize by current player.
|
|
59
|
+
* Calculated as the ratio of the number of tickets collected by the current player to the
|
|
59
60
|
* total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
|
|
60
61
|
*/
|
|
61
62
|
chances_to_win_perc: number;
|
|
@@ -91,7 +92,7 @@ interface RafflePrize {
|
|
|
91
92
|
|
|
92
93
|
/**
|
|
93
94
|
* The maximum number of prizes that can be given within one instance/run of draw.
|
|
94
|
-
* For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
|
|
95
|
+
* For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
|
|
95
96
|
* cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000.
|
|
96
97
|
* In this case, the prizes_per_run_actual will be limited by 3
|
|
97
98
|
*/
|
package/src/WSAPI/WSAPI.ts
CHANGED
|
@@ -1166,13 +1166,20 @@ export class WSAPI {
|
|
|
1166
1166
|
* The onUpdate callback will be called on claiming prize. Updated Raffles will be passed to onUpdate callback.
|
|
1167
1167
|
*
|
|
1168
1168
|
* **Example**:
|
|
1169
|
+
*
|
|
1169
1170
|
* ```
|
|
1170
1171
|
* _smartico.api.getRaffles().then((result) => {
|
|
1171
1172
|
* console.log(result);
|
|
1172
1173
|
* });
|
|
1173
1174
|
* ```
|
|
1174
1175
|
*
|
|
1175
|
-
* **Visitor mode
|
|
1176
|
+
* **Example in the Visitor mode**:
|
|
1177
|
+
*
|
|
1178
|
+
* ```
|
|
1179
|
+
* _smartico.vapi('EN').getRaffles().then((result) => {
|
|
1180
|
+
* console.log(result);
|
|
1181
|
+
* });
|
|
1182
|
+
* ```
|
|
1176
1183
|
*
|
|
1177
1184
|
*/
|
|
1178
1185
|
|
|
@@ -1189,13 +1196,21 @@ export class WSAPI {
|
|
|
1189
1196
|
*
|
|
1190
1197
|
*
|
|
1191
1198
|
* **Example**:
|
|
1192
|
-
*
|
|
1193
|
-
*
|
|
1199
|
+
*
|
|
1200
|
+
* ```javascript
|
|
1201
|
+
* _smartico.api.getRaffleDrawRun({raffle_id: 156, run_id: 145}).then((result) => {
|
|
1194
1202
|
* console.log(result);
|
|
1195
1203
|
* });
|
|
1196
1204
|
* ```
|
|
1197
1205
|
*
|
|
1198
|
-
* **Visitor mode
|
|
1206
|
+
* **Example in the Visitor mode**:
|
|
1207
|
+
*
|
|
1208
|
+
*
|
|
1209
|
+
* ```javascript
|
|
1210
|
+
* _smartico.vapi('EN').getRaffleDrawRun({ raffle_id: 156, run_id: 145 }).then((result) => {
|
|
1211
|
+
* console.log(result);
|
|
1212
|
+
* });
|
|
1213
|
+
* ```
|
|
1199
1214
|
*
|
|
1200
1215
|
*/
|
|
1201
1216
|
|
|
@@ -1214,13 +1229,20 @@ export class WSAPI {
|
|
|
1214
1229
|
*
|
|
1215
1230
|
*
|
|
1216
1231
|
* **Example**:
|
|
1217
|
-
*
|
|
1232
|
+
*
|
|
1233
|
+
* ```javascript
|
|
1218
1234
|
* _smartico.api.getRaffleDrawRunHistory({raffle_id:156, draw_id: 432}).then((result) => {
|
|
1219
1235
|
* console.log(result);
|
|
1220
1236
|
* });
|
|
1221
1237
|
* ```
|
|
1222
1238
|
*
|
|
1223
|
-
* **Visitor mode
|
|
1239
|
+
* **Example in the Visitor mode**:
|
|
1240
|
+
*
|
|
1241
|
+
* ```javascript
|
|
1242
|
+
* _smartico.vapi('EN').getRaffleDrawRunHistory({ raffle_id: 156, draw_id: 432 }).then((result) => {
|
|
1243
|
+
* console.log(result);
|
|
1244
|
+
* });
|
|
1245
|
+
* ```
|
|
1224
1246
|
*
|
|
1225
1247
|
*/
|
|
1226
1248
|
|
|
@@ -1239,19 +1261,27 @@ export class WSAPI {
|
|
|
1239
1261
|
*
|
|
1240
1262
|
*
|
|
1241
1263
|
* **Example**:
|
|
1242
|
-
*
|
|
1264
|
+
*
|
|
1265
|
+
* ```javascript
|
|
1243
1266
|
* _smartico.api.claimRafflePrize({won_id:251}).then((result) => {
|
|
1244
1267
|
* console.log(result);
|
|
1245
1268
|
* });
|
|
1246
1269
|
* ```
|
|
1247
1270
|
*
|
|
1248
|
-
* **Visitor mode
|
|
1271
|
+
* **Example in the Visitor mode**:
|
|
1272
|
+
*
|
|
1273
|
+
* ```javascript
|
|
1274
|
+
* _smartico.vapi('EN').claimRafflePrize({ won_id: 251 }).then((result) => {
|
|
1275
|
+
* console.log(result);
|
|
1276
|
+
* });
|
|
1277
|
+
* ```
|
|
1249
1278
|
*
|
|
1250
1279
|
*/
|
|
1251
1280
|
public async claimRafflePrize(props: { won_id: number }): Promise<TransformedRaffleClaimPrizeResponse> {
|
|
1252
1281
|
if (!props.won_id) {
|
|
1253
1282
|
throw new Error('won_id is required');
|
|
1254
1283
|
}
|
|
1284
|
+
|
|
1255
1285
|
const res = await this.api.claimRafflePrize(null, { won_id: props.won_id });
|
|
1256
1286
|
return raffleClaimPrizeResponseTransform(res);
|
|
1257
1287
|
}
|
package/src/WSAPI/WSAPITypes.ts
CHANGED
|
@@ -181,8 +181,12 @@ export interface TMiniGameTemplate {
|
|
|
181
181
|
|
|
182
182
|
/** The UI definition of the mini-game */
|
|
183
183
|
saw_template_ui_definition: SAWTemplateUI;
|
|
184
|
-
|
|
184
|
+
/** When enabled the prize history icon is visible on a certain template */
|
|
185
185
|
show_prize_history?:boolean;
|
|
186
|
+
/** The maximum number of attempts that user can do during period of time */
|
|
187
|
+
max_number_of_attempts?: number;
|
|
188
|
+
/** The period of time in milliseconds during which the user can do the maximum number of attempts */
|
|
189
|
+
max_spins_period_ms?: number;
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
/**
|
|
@@ -963,9 +967,13 @@ export interface TRaffle {
|
|
|
963
967
|
}
|
|
964
968
|
|
|
965
969
|
export interface TRaffleTicket {
|
|
966
|
-
|
|
970
|
+
/**
|
|
971
|
+
* Int presentation of the ticket
|
|
972
|
+
*/
|
|
967
973
|
ticekt_id: number;
|
|
968
|
-
|
|
974
|
+
/**
|
|
975
|
+
* String presentation of the ticket
|
|
976
|
+
*/
|
|
969
977
|
ticket_id_string: string;
|
|
970
978
|
}
|
|
971
979
|
|