@smartico/public-api 0.0.216 → 0.0.217
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 +4 -0
- package/dist/Raffle/GetDrawResponse.d.ts +5 -0
- package/dist/Raffle/GetDrawRunRequest.d.ts +5 -0
- package/dist/Raffle/GetDrawRunResponse.d.ts +5 -0
- package/dist/Raffle/GetRafflesRequest.d.ts +4 -0
- package/dist/Raffle/GetRafflesResponse.d.ts +5 -0
- package/dist/Raffle/Raffle.d.ts +34 -0
- package/dist/Raffle/RaffleDraw.d.ts +70 -0
- package/dist/Raffle/RafflePrize.d.ts +97 -0
- package/dist/Raffle/RafflePrizeWinner.d.ts +9 -0
- package/dist/Raffle/RaffleTicket.d.ts +5 -0
- package/dist/Raffle/index.d.ts +9 -0
- package/dist/SmarticoAPI.d.ts +2 -0
- package/dist/WSAPI/WSAPI.d.ts +2 -0
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +18 -1
- package/dist/index.modern.mjs.map +1 -1
- package/docs/README.md +9 -0
- package/docs/classes/WSAPI.md +11 -1
- package/docs/interfaces/GetDrawRunRequest.md +49 -0
- package/docs/interfaces/GetDrawRunResponse.md +63 -0
- package/docs/interfaces/GetRafflesRequest.md +37 -0
- package/docs/interfaces/GetRafflesResponse.md +63 -0
- package/docs/interfaces/Raffle.md +59 -0
- package/docs/interfaces/RaffleDraw.md +124 -0
- package/docs/interfaces/RafflePrize.md +137 -0
- package/docs/interfaces/RafflePrizeWinner.md +31 -0
- package/docs/interfaces/RaffleTicket.md +13 -0
- package/package.json +1 -1
- package/src/Base/ClassId.ts +13 -0
- package/src/MiniGames/SAWGetTemplatesResponse.ts +1 -1
- package/src/Raffle/GetDrawRunRequest.ts +6 -0
- package/src/Raffle/GetDrawRunResponse.ts +6 -0
- package/src/Raffle/GetRafflesRequest.ts +5 -0
- package/src/Raffle/GetRafflesResponse.ts +6 -0
- package/src/Raffle/Raffle.ts +41 -0
- package/src/Raffle/RaffleDraw.ts +92 -0
- package/src/Raffle/RafflePrize.ts +117 -0
- package/src/Raffle/RafflePrizeWinner.ts +11 -0
- package/src/Raffle/RaffleTicket.ts +9 -0
- package/src/Raffle/index.ts +9 -0
- package/src/SmarticoAPI.ts +11 -0
- package/src/WSAPI/WSAPI.ts +6 -0
- package/tsconfig.json +1 -0
package/dist/Base/ClassId.d.ts
CHANGED
|
@@ -99,6 +99,10 @@ export declare enum ClassId {
|
|
|
99
99
|
JP_OPTOUT_REQUEST = 806,
|
|
100
100
|
JP_OPTOUT_RESPONSE = 807,
|
|
101
101
|
JP_WIN_PUSH = 808,
|
|
102
|
+
RAF_GET_RAFFLES_REQUEST = 900,
|
|
103
|
+
RAF_GET_RAFFLES_RESPONSE = 901,
|
|
104
|
+
RAF_GET_DRAW_REQUEST = 904,
|
|
105
|
+
RAF_GET_DRAW_RESPONSE = 905,
|
|
102
106
|
REGISTER_PUSH_NOTIFICATIONS_TOKEN_REQ = 1003,
|
|
103
107
|
REGISTER_PUSH_NOTIFICATIONS_TOKEN_RESP = 2003,
|
|
104
108
|
CLIENT_DEBUG_REQUEST = 77777,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RaffleDraw } from "./RaffleDraw";
|
|
2
|
+
interface RafflePublicMeta {
|
|
3
|
+
/** Name of the raffle */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Description of the raffle */
|
|
6
|
+
description: string;
|
|
7
|
+
/** ID of the custom section that is linked to the raffle in the Gamification widget */
|
|
8
|
+
custom_section_id: number;
|
|
9
|
+
/** URL of the image that represents the raffle */
|
|
10
|
+
image_url: string;
|
|
11
|
+
}
|
|
12
|
+
interface Raffle {
|
|
13
|
+
/** ID of the Raffle template */
|
|
14
|
+
raffle_id: number;
|
|
15
|
+
/** Meta information about raffle for the presentation on UI */
|
|
16
|
+
public_meta: RafflePublicMeta;
|
|
17
|
+
/** Date of start */
|
|
18
|
+
start_date_ts: number;
|
|
19
|
+
/** Date of end */
|
|
20
|
+
end_date_ts: number;
|
|
21
|
+
/** Maximum numer of tickets that can be given to all users for the whole period of raffle */
|
|
22
|
+
max_tickets_count: number;
|
|
23
|
+
/**
|
|
24
|
+
* Number of tickets that are already given to all users for this raffle
|
|
25
|
+
*/
|
|
26
|
+
current_tickets_count: number;
|
|
27
|
+
/**
|
|
28
|
+
* List of draws that are available for this raffle.
|
|
29
|
+
* For example, if the raffle is containg one hourly draw, one daily draw and one draw on fixed date like 01/01/2022,
|
|
30
|
+
* Then the list will always return 3 draws, no matter if the draws are already executed or they are in the future.
|
|
31
|
+
*/
|
|
32
|
+
draws: RaffleDraw[];
|
|
33
|
+
}
|
|
34
|
+
export { Raffle };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RafflePrize } from "./RafflePrize";
|
|
2
|
+
import { RaffleTicket } from "./RaffleTicket";
|
|
3
|
+
interface RaffleDrawPublicMeta {
|
|
4
|
+
/** Name of the draw, e.g. 'Daily draw' */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Description of the draw */
|
|
7
|
+
description: string;
|
|
8
|
+
/** URL of the image that represents the draw */
|
|
9
|
+
image_url: string;
|
|
10
|
+
}
|
|
11
|
+
declare enum RaffleDrawInstanceState {
|
|
12
|
+
/** Draw is open for the tickets collection */
|
|
13
|
+
Open = 1,
|
|
14
|
+
/** Winner selection is in progress */
|
|
15
|
+
WinnerSelection = 2,
|
|
16
|
+
/** Draw is executed and the winners are selected */
|
|
17
|
+
Executed = 3
|
|
18
|
+
}
|
|
19
|
+
interface RaffleDraw {
|
|
20
|
+
/**
|
|
21
|
+
* Id of the Draw definition, for the repetative draws (e.g. daily), this number will be the same for all draws that are repeating daily
|
|
22
|
+
* (internal name: schedule_id)
|
|
23
|
+
*/
|
|
24
|
+
draw_id: number;
|
|
25
|
+
/** Meta information of the Draw for the presentaiton in UI */
|
|
26
|
+
public_meta: RaffleDrawPublicMeta;
|
|
27
|
+
/** Information about prizes in the draw */
|
|
28
|
+
prizes: RafflePrize[];
|
|
29
|
+
/**
|
|
30
|
+
* State of current instance of Draw
|
|
31
|
+
*/
|
|
32
|
+
current_state: RaffleDrawInstanceState;
|
|
33
|
+
/**
|
|
34
|
+
* Field indicates the ID of the latest instance/run of draw
|
|
35
|
+
*/
|
|
36
|
+
run_id: number;
|
|
37
|
+
/** Date/time of the draw execution */
|
|
38
|
+
execution_ts: number;
|
|
39
|
+
/** Date of the previously executed draw (if there is such) */
|
|
40
|
+
previous_run_ts?: number;
|
|
41
|
+
/** Unique ID of the previusly executed draw (if there is such) */
|
|
42
|
+
previous_run_id?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Date/time starting from which the tickets will participate in the upcoming draw
|
|
45
|
+
* This value need to be taken into account with next_execute_ts field value, for example
|
|
46
|
+
* Next draw is at 10:00, tickets_time_back_ts is 9:00, so all tickets that are collected after 9:00 will participate in the draw at 10:00
|
|
47
|
+
* (internally this value is calculated as next_execute_ts - time_back_period_ms)
|
|
48
|
+
*/
|
|
49
|
+
tickets_time_back_ts: number;
|
|
50
|
+
/** Field is indicating if same ticket can win multiple prizes in the same draw
|
|
51
|
+
* For example there are 3 types of prizes in the draw - iPhone, iPad, MacBook
|
|
52
|
+
* If this field is true, then one ticket can win all 3 prizes (depending on the chances of course),
|
|
53
|
+
* if false, then one ticket can win only one prize.
|
|
54
|
+
* The distribution of the prizes is start from top (assuming on top are the most valuable prizes) to bottom (less valuable prizes)
|
|
55
|
+
* If specific prize has multiple values, e.g. we have 3 iPhones,
|
|
56
|
+
* 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)
|
|
57
|
+
*/
|
|
58
|
+
allow_multi_prize_per_ticket: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The number of tickets that are already given to all users for this instance of draw.
|
|
61
|
+
* In other words tickets that are collected between tickets_time_back_ts and current time (or till current_execution_ts is the instance is executed).
|
|
62
|
+
*/
|
|
63
|
+
total_tickets_count: number;
|
|
64
|
+
/**
|
|
65
|
+
* The number of tickets collected by current user for this instance of draw.
|
|
66
|
+
*/
|
|
67
|
+
my_tickets_count: number;
|
|
68
|
+
my_last_tickets: RaffleTicket[];
|
|
69
|
+
}
|
|
70
|
+
export { RaffleDraw };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { RafflePrizeWinner } from "./RafflePrizeWinner";
|
|
2
|
+
interface RafflePrizePublicMeta {
|
|
3
|
+
/** Name of the prize */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Description of the prize */
|
|
6
|
+
description: string;
|
|
7
|
+
/** URL of the image that represents the prize */
|
|
8
|
+
image_url: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Represents a prize in a draw.
|
|
12
|
+
*/
|
|
13
|
+
interface RafflePrize {
|
|
14
|
+
/**
|
|
15
|
+
* The unique identifier for the prize definition
|
|
16
|
+
*/
|
|
17
|
+
prize_id: string;
|
|
18
|
+
/**
|
|
19
|
+
* Meta information about the prize for presentation in the UI.
|
|
20
|
+
*/
|
|
21
|
+
public_meta: RafflePrizePublicMeta;
|
|
22
|
+
/**
|
|
23
|
+
* The number of prizes available per run of the draw.
|
|
24
|
+
* E.g. if the draw is run daily, this is the number of prizes available each day, for example 3 iPhones.
|
|
25
|
+
*/
|
|
26
|
+
prizes_per_run: number;
|
|
27
|
+
/**
|
|
28
|
+
* The actual number of prizes for the current instance.
|
|
29
|
+
* This value is taking into account follwing values:
|
|
30
|
+
* - min_required_total_tickets,
|
|
31
|
+
* - add_one_prize_per_each_x_tickets
|
|
32
|
+
* - stock_items_per_draw
|
|
33
|
+
* - total_tickets_count (from Draw instance)
|
|
34
|
+
* - cap_prizes_per_run
|
|
35
|
+
* For example:
|
|
36
|
+
* - prizes_per_run = 1
|
|
37
|
+
* - min_required_total_tickets = 1000
|
|
38
|
+
* - add_one_prize_per_each_x_tickets = 1000
|
|
39
|
+
* - stock_items_per_draw = 5
|
|
40
|
+
* - total_tickets_count = 7000
|
|
41
|
+
* - cap_prizes_per_run = 6
|
|
42
|
+
* prizes_per_run_actual will be 5, because
|
|
43
|
+
* 7000 tickets are collected, so 7 iPhones are available, but the cap is 6 and the stock is 5.
|
|
44
|
+
*/
|
|
45
|
+
prizes_per_run_actual: number;
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* The chances to win the prize by current player.
|
|
49
|
+
* Calculated as the ratio of the number of tickets collected by the current player to the
|
|
50
|
+
* total number of tickets collected by all players and multiplied by number of actual prizes of this kind.
|
|
51
|
+
*/
|
|
52
|
+
chances_to_win_perc: number;
|
|
53
|
+
/**
|
|
54
|
+
* The minimum number of total tickets collected during draw period required to unlock the prize.
|
|
55
|
+
* If the number of tickets collected is less than this value, the prize is not available.
|
|
56
|
+
* Under total tickets we understand the number of tickets collected by all users.
|
|
57
|
+
* The 'draw period' is the time between the tickets_time_back_ts value of the draw and the current time.
|
|
58
|
+
*/
|
|
59
|
+
min_required_total_tickets?: number;
|
|
60
|
+
/**
|
|
61
|
+
* One additional prize will be awarded for each X tickets.
|
|
62
|
+
* E.g. if the prize is 1 iPhone and the value is set to 1000, then for every 1000 tickets collected, an additional iPhone is awarded.
|
|
63
|
+
* If min_required_total_tickets is set to 1000, then next iPhone is awarded when 2000 tickets are collected, and so on.
|
|
64
|
+
* If min_required_total_tickets is not set, then the next iPhone will be awarded when 1000 tickets are collected.
|
|
65
|
+
*/
|
|
66
|
+
add_one_prize_per_each_x_tickets?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Indicates whether the prize requires a claim action from the user.
|
|
69
|
+
*/
|
|
70
|
+
requires_claim: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The minimum number of tickets a user must have to be eligible for the prize.
|
|
73
|
+
* For example iPhone prize may require 10 tickets to be collected, only users with 10 or more tickets will be eligible for the prize.
|
|
74
|
+
* More tickets are better, as they increase the chances of winning.
|
|
75
|
+
*/
|
|
76
|
+
min_required_tickets_for_user: number;
|
|
77
|
+
/**
|
|
78
|
+
* The maximum number of prizes that can be given withing one instance/run of draw.
|
|
79
|
+
* For example the prize is iPhone and add_one_prize_per_each_x_tickets is set to 1000,
|
|
80
|
+
* cap_prizes_per_run is set to 3, and the total number of tickets collected is 7000.
|
|
81
|
+
* In this case, the prizes_per_run_actual will be limitted by 3
|
|
82
|
+
*/
|
|
83
|
+
cap_prizes_per_run?: number;
|
|
84
|
+
/**
|
|
85
|
+
* The priority of the prize. The low number means higher priority (e.g. 1 is higher priority than 2).
|
|
86
|
+
* If there are multiple prizes available, the prize with the highest priority (lowest number) will be awarded first.
|
|
87
|
+
*/
|
|
88
|
+
priority: number;
|
|
89
|
+
/**
|
|
90
|
+
* Optional field that indicates total remaining number of the prize for all draws of the type.
|
|
91
|
+
* For example, the Daily draw has 1 iPhone daily, and the total number of iPhones is 10.
|
|
92
|
+
* the stock_items_per_draw will be decreasing by 1 each day (assuming there is enough tickets and it is won every day), and when it reaches 0, the prize is not available anymore.
|
|
93
|
+
*/
|
|
94
|
+
stock_items_per_draw?: number;
|
|
95
|
+
winners: RafflePrizeWinner[];
|
|
96
|
+
}
|
|
97
|
+
export { RafflePrize };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './GetDrawRunRequest';
|
|
2
|
+
export * from './GetDrawRunResponse';
|
|
3
|
+
export * from './GetRafflesRequest';
|
|
4
|
+
export * from './GetRafflesResponse';
|
|
5
|
+
export * from './Raffle';
|
|
6
|
+
export * from './RaffleDraw';
|
|
7
|
+
export * from './RafflePrize';
|
|
8
|
+
export * from './RafflePrizeWinner';
|
|
9
|
+
export * from './RaffleTicket';
|
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { ClaimBonusResponse, GetBonusesResponse } from './Bonuses';
|
|
|
19
19
|
import { SAWDoSpinBatchResponse } from './MiniGames/SAWDoSpinBatchResponse';
|
|
20
20
|
import { SAWDoAcknowledgeBatchResponse } from './MiniGames/SAWDoAcknowledgeBatchResponse';
|
|
21
21
|
import { GetRelatedAchTourResponse } from './Missions/GetRelatedAchTourResponse';
|
|
22
|
+
import { GetRafflesResponse } from './Raffle/GetRafflesResponse';
|
|
22
23
|
interface Tracker {
|
|
23
24
|
label_api_key: string;
|
|
24
25
|
userPublicProps: any;
|
|
@@ -127,5 +128,6 @@ declare class SmarticoAPI {
|
|
|
127
128
|
deleteAllInboxMessages(user_ext_id: string): Promise<MarkInboxMessageDeletedResponse>;
|
|
128
129
|
getWSCalls(): WSAPI;
|
|
129
130
|
getRelatedItemsForGame(user_ext_id: string, related_game_id: string): Promise<GetRelatedAchTourResponse>;
|
|
131
|
+
getRaffles(user_ext_id: string): Promise<GetRafflesResponse>;
|
|
130
132
|
}
|
|
131
133
|
export { SmarticoAPI, MessageSender };
|
package/dist/WSAPI/WSAPI.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { InboxMarkMessageAction, LeaderBoardDetailsT, TAchCategory, TBuyStoreIte
|
|
|
3
3
|
import { LeaderBoardPeriodType } from '../Leaderboard';
|
|
4
4
|
import { JackpotDetails, JackpotsOptinResponse, JackpotsOptoutResponse } from '../Jackpots';
|
|
5
5
|
import { GetRelatedAchTourResponse } from 'src/Missions/GetRelatedAchTourResponse';
|
|
6
|
+
import { GetRafflesResponse } from '../Raffle/GetRafflesResponse';
|
|
6
7
|
/** @group General API */
|
|
7
8
|
export declare class WSAPI {
|
|
8
9
|
private api;
|
|
@@ -541,4 +542,5 @@ export declare class WSAPI {
|
|
|
541
542
|
* ```
|
|
542
543
|
*/
|
|
543
544
|
getRelatedItemsForGame(related_game_id: string): Promise<GetRelatedAchTourResponse>;
|
|
545
|
+
getRaffles(): Promise<GetRafflesResponse>;
|
|
544
546
|
}
|
package/dist/index.js
CHANGED
|
@@ -123,6 +123,15 @@ exports.ClassId = void 0;
|
|
|
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["RAF_GET_RAFFLES_REQUEST"] = 900] = "RAF_GET_RAFFLES_REQUEST";
|
|
127
|
+
ClassId[ClassId["RAF_GET_RAFFLES_RESPONSE"] = 901] = "RAF_GET_RAFFLES_RESPONSE";
|
|
128
|
+
ClassId[ClassId["RAF_GET_DRAW_REQUEST"] = 904] = "RAF_GET_DRAW_REQUEST";
|
|
129
|
+
ClassId[ClassId["RAF_GET_DRAW_RESPONSE"] = 905] = "RAF_GET_DRAW_RESPONSE";
|
|
130
|
+
/*
|
|
131
|
+
RAF_GET_TICKETS_REQUEST = 902,
|
|
132
|
+
RAF_GET_TICKETS_RESPONSE = 903,
|
|
133
|
+
RAF_CLAIM_PRIZE_REQUEST = 906,
|
|
134
|
+
*/
|
|
126
135
|
/*
|
|
127
136
|
!Important, if adding new messages that are 'acting' on behalf of the client,
|
|
128
137
|
you need to include them in the CLASS_ID_IGNORE_FOR_SIMULATION
|
|
@@ -413,6 +422,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
|
|
|
413
422
|
saw_template_ui_definition: r.saw_template_ui_definition,
|
|
414
423
|
show_prize_history: r.show_prize_history,
|
|
415
424
|
prizes: r.prizes.map(function (p) {
|
|
425
|
+
var _p$saw_prize_ui_defin;
|
|
416
426
|
var y = {
|
|
417
427
|
id: p.saw_prize_id,
|
|
418
428
|
name: p.saw_prize_ui_definition.name,
|
|
@@ -439,7 +449,7 @@ var SAWTemplatesTransform = function SAWTemplatesTransform(items) {
|
|
|
439
449
|
relative_period_timezone: p.relative_period_timezone,
|
|
440
450
|
is_surcharge: p.is_surcharge,
|
|
441
451
|
is_deleted: p.is_deleted,
|
|
442
|
-
custom_data: IntUtils.JsonOrText(
|
|
452
|
+
custom_data: IntUtils.JsonOrText((_p$saw_prize_ui_defin = p.saw_prize_ui_definition) == null ? void 0 : _p$saw_prize_ui_defin.custom_data),
|
|
443
453
|
prize_modifiers: p.saw_prize_ui_definition.prize_modifiers,
|
|
444
454
|
allow_split_decimal: p.saw_prize_ui_definition.allow_split_decimal,
|
|
445
455
|
hide_prize_from_history: p.saw_prize_ui_definition.hide_prize_from_history
|
|
@@ -2703,6 +2713,14 @@ var WSAPI = /*#__PURE__*/function () {
|
|
|
2703
2713
|
return Promise.reject(e);
|
|
2704
2714
|
}
|
|
2705
2715
|
};
|
|
2716
|
+
_proto.getRaffles = function getRaffles() {
|
|
2717
|
+
try {
|
|
2718
|
+
var _this46 = this;
|
|
2719
|
+
return Promise.resolve(_this46.api.getRaffles(null));
|
|
2720
|
+
} catch (e) {
|
|
2721
|
+
return Promise.reject(e);
|
|
2722
|
+
}
|
|
2723
|
+
};
|
|
2706
2724
|
return WSAPI;
|
|
2707
2725
|
}();
|
|
2708
2726
|
|
|
@@ -3875,6 +3893,15 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
3875
3893
|
return Promise.reject(e);
|
|
3876
3894
|
}
|
|
3877
3895
|
};
|
|
3896
|
+
_proto.getRaffles = function getRaffles(user_ext_id) {
|
|
3897
|
+
try {
|
|
3898
|
+
var _this63 = this;
|
|
3899
|
+
var message = _this63.buildMessage(user_ext_id, exports.ClassId.RAF_GET_RAFFLES_REQUEST);
|
|
3900
|
+
return Promise.resolve(_this63.send(message, exports.ClassId.RAF_GET_DRAW_RESPONSE));
|
|
3901
|
+
} catch (e) {
|
|
3902
|
+
return Promise.reject(e);
|
|
3903
|
+
}
|
|
3904
|
+
};
|
|
3878
3905
|
return SmarticoAPI;
|
|
3879
3906
|
}();
|
|
3880
3907
|
|