@getenginex/sdk-igaming 0.5.0 → 0.7.0
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/CHANGELOG.md +40 -0
- package/README.md +44 -56
- package/dist/first-frame/index.cjs +4 -4
- package/dist/first-frame/index.cjs.map +1 -1
- package/dist/first-frame/index.d.cts +52 -52
- package/dist/first-frame/index.d.ts +52 -52
- package/dist/first-frame/index.js +4 -4
- package/dist/first-frame/index.js.map +1 -1
- package/dist/index.cjs +153 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +875 -692
- package/dist/index.d.ts +875 -692
- package/dist/index.js +153 -29
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +1 -1
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +46 -46
- package/dist/query/index.d.ts +46 -46
- package/dist/query/index.js +1 -1
- package/dist/query/index.js.map +1 -1
- package/dist/testing/index.cjs +67 -5
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +37 -37
- package/dist/testing/index.d.ts +37 -37
- package/dist/testing/index.js +67 -5
- package/dist/testing/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,1554 +1,1737 @@
|
|
|
1
|
-
import { CursorPageInput, CallOptions, CursorPage,
|
|
1
|
+
import { CursorPageInput, CallOptions, CursorPage, NoParams, Page, EnginexClient } from '@getenginex/sdk';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @category
|
|
4
|
+
* Money value of a campaign, in minor units of the currency (e.g. cents). The decimal places
|
|
5
|
+
* are the currency's (`config.currency.decimalPlaces` for the operator's currency).
|
|
6
|
+
* @category Bonus
|
|
7
7
|
*/
|
|
8
8
|
interface CampaignMoney {
|
|
9
|
-
/**
|
|
9
|
+
/** Value in minor units of `currency` (the gateway sends it as text; the SDK converts). */
|
|
10
10
|
amount: number;
|
|
11
|
-
/**
|
|
11
|
+
/** Currency code, e.g. `BRL`. */
|
|
12
12
|
currency: string;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @category
|
|
15
|
+
* Time window (ISO 8601, UTC). A missing side is left open.
|
|
16
|
+
* @category Bonus
|
|
17
17
|
*/
|
|
18
18
|
interface CampaignTimeWindow {
|
|
19
|
-
/**
|
|
19
|
+
/** Start. */
|
|
20
20
|
startsAt?: string;
|
|
21
|
-
/**
|
|
21
|
+
/** End. */
|
|
22
22
|
endsAt?: string;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
* `"0.5"`)
|
|
27
|
-
* @category
|
|
25
|
+
* Exact ratio (percentage, multiplier), in one of two forms: `decimal` (text, e.g. `"30"`,
|
|
26
|
+
* `"0.5"`) or `basisPoints` (10000 = 100%).
|
|
27
|
+
* @category Bonus
|
|
28
28
|
*/
|
|
29
29
|
interface CampaignExactRatio {
|
|
30
|
-
/**
|
|
30
|
+
/** Exact decimal value as text (do not convert to `number` if you need precision). */
|
|
31
31
|
decimal?: string;
|
|
32
|
-
/**
|
|
32
|
+
/** Value in basis points: `10000` = 100%. */
|
|
33
33
|
basisPoints?: number;
|
|
34
|
-
/**
|
|
34
|
+
/** Maximum decimal places of the result. */
|
|
35
35
|
maximumScale: number;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @category
|
|
38
|
+
* Rounding mode of a campaign calculation.
|
|
39
|
+
* @category Bonus
|
|
40
40
|
*/
|
|
41
41
|
type CampaignRoundingMode = 'floor' | 'half_up' | 'ceiling' | 'unspecified' | (string & {});
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @category
|
|
43
|
+
* Product where the campaign applies.
|
|
44
|
+
* @category Bonus
|
|
45
45
|
*/
|
|
46
46
|
type CampaignProductScope = 'casino' | 'sportsbook' | 'casino_and_sportsbook' | 'unspecified' | (string & {});
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
49
|
-
* (
|
|
50
|
-
* `manual` (
|
|
51
|
-
* @category
|
|
48
|
+
* How the player enters the campaign: `automatic` (enters on its own on meeting the qualification), `opt_in`
|
|
49
|
+
* (needs {@link BonusApi.optIn}), `promo_code` (needs {@link BonusApi.redeemPromoCode}) or
|
|
50
|
+
* `manual` (the operator adds them).
|
|
51
|
+
* @category Bonus
|
|
52
52
|
*/
|
|
53
53
|
type CampaignEntryPolicyCode = 'automatic' | 'opt_in' | 'promo_code' | 'manual' | 'unspecified' | (string & {});
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* @category
|
|
55
|
+
* How the reward is delivered: `automatic` (credited on qualifying) or `player_claim` (the player
|
|
56
|
+
* redeems it with {@link BonusApi.claim}).
|
|
57
|
+
* @category Bonus
|
|
58
58
|
*/
|
|
59
59
|
type CampaignRewardClaimPolicyCode = 'automatic' | 'player_claim' | 'unspecified' | (string & {});
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @category
|
|
61
|
+
* Reward type: balance credit, free spins, free bet or sports bet coverage.
|
|
62
|
+
* @category Bonus
|
|
63
63
|
*/
|
|
64
64
|
type CampaignRewardKind = 'balance_credit' | 'casino_free_spins' | 'sports_bonus_bet' | 'sports_bet_coverage' | 'unspecified' | (string & {});
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @category
|
|
66
|
+
* Versioned policy (code + version).
|
|
67
|
+
* @category Bonus
|
|
68
68
|
*/
|
|
69
69
|
interface CampaignPolicy<C extends string> {
|
|
70
|
-
/**
|
|
70
|
+
/** Policy code. */
|
|
71
71
|
code: C;
|
|
72
|
-
/**
|
|
72
|
+
/** Policy version. @beta */
|
|
73
73
|
version: number;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
76
|
+
* Casino activity slice (empty lists = no restriction on that criterion).
|
|
77
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
78
78
|
* @beta
|
|
79
|
-
* @category
|
|
79
|
+
* @category Bonus
|
|
80
80
|
*/
|
|
81
81
|
interface CasinoActivitySelector {
|
|
82
|
-
/**
|
|
82
|
+
/** Provider instance. */
|
|
83
83
|
providerInstanceId: string;
|
|
84
|
-
/**
|
|
84
|
+
/** Provider software. */
|
|
85
85
|
softwareIds: string[];
|
|
86
|
-
/**
|
|
86
|
+
/** Games. */
|
|
87
87
|
gameIds: string[];
|
|
88
|
-
/**
|
|
88
|
+
/** Categories (catalog slugs). */
|
|
89
89
|
categoryCodes: string[];
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @category
|
|
92
|
+
* Sports bet type.
|
|
93
|
+
* @category Bonus
|
|
94
94
|
*/
|
|
95
95
|
type SportsBetType = 'single' | 'multiple' | 'system' | 'unspecified' | (string & {});
|
|
96
96
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
97
|
+
* Sports activity slice (empty lists = no restriction on that criterion).
|
|
98
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
99
99
|
* @beta
|
|
100
|
-
* @category
|
|
100
|
+
* @category Bonus
|
|
101
101
|
*/
|
|
102
102
|
interface SportsActivitySelector {
|
|
103
|
-
/**
|
|
103
|
+
/** Sports. */
|
|
104
104
|
sportCodes: string[];
|
|
105
|
-
/**
|
|
105
|
+
/** Competitions. */
|
|
106
106
|
competitionIds: string[];
|
|
107
|
-
/**
|
|
107
|
+
/** Events. */
|
|
108
108
|
eventIds: string[];
|
|
109
|
-
/**
|
|
109
|
+
/** Markets. */
|
|
110
110
|
marketCodes: string[];
|
|
111
|
-
/**
|
|
111
|
+
/** Live only (`true`), pre-match only (`false`) or both (absent). */
|
|
112
112
|
live?: boolean;
|
|
113
|
-
/**
|
|
113
|
+
/** Accepted bet types. */
|
|
114
114
|
betTypes: SportsBetType[];
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @category
|
|
117
|
+
* Qualification by a player event (e.g. completed signup).
|
|
118
|
+
* @category Bonus
|
|
119
119
|
*/
|
|
120
120
|
interface UserEventQualification {
|
|
121
|
-
/**
|
|
121
|
+
/** Event code. */
|
|
122
122
|
eventCode: string;
|
|
123
|
-
/**
|
|
123
|
+
/** Event version. @beta */
|
|
124
124
|
eventVersion: number;
|
|
125
|
-
/**
|
|
125
|
+
/** Authorized origin of the event. */
|
|
126
126
|
sourceAuthority: string;
|
|
127
|
-
/**
|
|
127
|
+
/** Fields that identify the event. */
|
|
128
128
|
identityFields: string[];
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
132
|
-
* @category
|
|
131
|
+
* Qualification by a confirmed deposit.
|
|
132
|
+
* @category Bonus
|
|
133
133
|
*/
|
|
134
134
|
interface DepositSettledQualification {
|
|
135
|
-
/**
|
|
135
|
+
/** Deposit currency. */
|
|
136
136
|
currency: string;
|
|
137
|
-
/**
|
|
137
|
+
/** Accepted payment methods (e.g. `pix`); empty = all. */
|
|
138
138
|
eligibleMethodCodes: string[];
|
|
139
|
-
/** `required` (
|
|
139
|
+
/** `required` (only the first deposit), `excluded` (never the first) or `any`. */
|
|
140
140
|
firstDepositPolicy: 'any' | 'required' | 'excluded' | 'unspecified' | (string & {});
|
|
141
|
-
/**
|
|
141
|
+
/** Minimum deposit. */
|
|
142
142
|
minimumSettledNetAmount?: CampaignMoney;
|
|
143
|
-
/**
|
|
143
|
+
/** Maximum deposit considered. */
|
|
144
144
|
maximumSettledNetAmount?: CampaignMoney;
|
|
145
|
-
/**
|
|
145
|
+
/** Value basis (e.g. `settled_net_deposit`). */
|
|
146
146
|
amountBasis: string;
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
|
-
*
|
|
150
|
-
* @category
|
|
149
|
+
* Qualification by activity accumulated over a window (e.g. net loss or total wagered).
|
|
150
|
+
* @category Bonus
|
|
151
151
|
*/
|
|
152
152
|
interface ActivityAggregateQualification {
|
|
153
|
-
/** `net_loss` (
|
|
153
|
+
/** `net_loss` (net loss) or `settled_stake` (total wagered and settled). */
|
|
154
154
|
basis: 'net_loss' | 'settled_stake' | 'unspecified' | (string & {});
|
|
155
|
-
/**
|
|
155
|
+
/** Product considered. */
|
|
156
156
|
productScope: CampaignProductScope;
|
|
157
|
-
/**
|
|
157
|
+
/** Currency. */
|
|
158
158
|
currency: string;
|
|
159
|
-
/**
|
|
159
|
+
/** Accumulation window, in seconds. */
|
|
160
160
|
window?: number;
|
|
161
|
-
/**
|
|
161
|
+
/** Window time zone. */
|
|
162
162
|
timezone: string;
|
|
163
|
-
/**
|
|
163
|
+
/** Tolerance for late events, in seconds. */
|
|
164
164
|
lateEventGrace?: number;
|
|
165
|
-
/**
|
|
165
|
+
/** Casino slice. */
|
|
166
166
|
casino?: CasinoActivitySelector;
|
|
167
|
-
/**
|
|
167
|
+
/** Sports betting slice. */
|
|
168
168
|
sportsbook?: SportsActivitySelector;
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* @category
|
|
171
|
+
* What the player must do to qualify. Only one of the cases is filled in; `immediate`
|
|
172
|
+
* means that joining already qualifies.
|
|
173
|
+
* @category Bonus
|
|
174
174
|
*/
|
|
175
175
|
interface CampaignQualification {
|
|
176
|
-
/**
|
|
176
|
+
/** Definition version. @beta */
|
|
177
177
|
version: number;
|
|
178
|
-
/**
|
|
178
|
+
/** Qualifies on joining. */
|
|
179
179
|
immediate?: Record<string, never>;
|
|
180
|
-
/**
|
|
180
|
+
/** Qualifies with a player event. */
|
|
181
181
|
userEvent?: UserEventQualification;
|
|
182
|
-
/**
|
|
182
|
+
/** Qualifies with a deposit. */
|
|
183
183
|
depositSettled?: DepositSettledQualification;
|
|
184
|
-
/**
|
|
184
|
+
/** Qualifies with accumulated activity. */
|
|
185
185
|
activityAggregate?: ActivityAggregateQualification;
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
*
|
|
189
|
-
* @category
|
|
188
|
+
* Reward validity: only one of the cases is filled in.
|
|
189
|
+
* @category Bonus
|
|
190
190
|
*/
|
|
191
191
|
interface CampaignRewardValidity {
|
|
192
|
-
/**
|
|
192
|
+
/** Does not expire. */
|
|
193
193
|
noExpiry?: Record<string, never>;
|
|
194
|
-
/**
|
|
194
|
+
/** Expires on a fixed date. */
|
|
195
195
|
absoluteExpiry?: {
|
|
196
|
-
/**
|
|
196
|
+
/** Expiration date, ISO 8601 (UTC). */
|
|
197
197
|
expiresAt?: string;
|
|
198
198
|
};
|
|
199
|
-
/**
|
|
199
|
+
/** Expires some time after the grant. */
|
|
200
200
|
durationFromGrant?: {
|
|
201
|
-
/**
|
|
201
|
+
/** Duration, in seconds. */
|
|
202
202
|
duration?: number;
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @category
|
|
206
|
+
* Percentage calculation over a source value (e.g. 100% of the deposit up to R$ 500) or over an
|
|
207
|
+
* accumulated amount (rebate).
|
|
208
|
+
* @category Bonus
|
|
209
209
|
*/
|
|
210
210
|
interface CampaignPercentCalculation {
|
|
211
|
-
/**
|
|
211
|
+
/** Percentage. */
|
|
212
212
|
percentage?: CampaignExactRatio;
|
|
213
|
-
/**
|
|
213
|
+
/** Rounding. */
|
|
214
214
|
rounding: CampaignRoundingMode;
|
|
215
|
-
/**
|
|
215
|
+
/** Minimum reward. */
|
|
216
216
|
minimumReward?: CampaignMoney;
|
|
217
|
-
/**
|
|
217
|
+
/** Maximum reward. */
|
|
218
218
|
maximumReward?: CampaignMoney;
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
*
|
|
222
|
-
* @category
|
|
221
|
+
* Balance credit reward. The value comes from one of the three calculations.
|
|
222
|
+
* @category Bonus
|
|
223
223
|
*/
|
|
224
224
|
interface BalanceCreditReward {
|
|
225
|
-
/**
|
|
225
|
+
/** Fixed value. */
|
|
226
226
|
fixedAmount?: {
|
|
227
|
-
/**
|
|
227
|
+
/** Reward value. */
|
|
228
228
|
amount?: CampaignMoney;
|
|
229
229
|
};
|
|
230
|
-
/**
|
|
230
|
+
/** Percentage of the source value (e.g. of the deposit). */
|
|
231
231
|
percentOfSourceAmount?: CampaignPercentCalculation;
|
|
232
|
-
/** Rebate
|
|
232
|
+
/** Rebate over an accumulated amount. */
|
|
233
233
|
aggregateRebate?: {
|
|
234
|
-
/**
|
|
234
|
+
/** Percentage. */
|
|
235
235
|
percentage?: CampaignExactRatio;
|
|
236
|
-
/**
|
|
236
|
+
/** Rounding. */
|
|
237
237
|
rounding: CampaignRoundingMode;
|
|
238
|
-
/**
|
|
238
|
+
/** Minimum base for there to be a reward. */
|
|
239
239
|
minimumBasis?: CampaignMoney;
|
|
240
|
-
/**
|
|
240
|
+
/** Maximum reward. */
|
|
241
241
|
maximumReward?: CampaignMoney;
|
|
242
242
|
};
|
|
243
|
-
/**
|
|
243
|
+
/** Balance credited: `real` or `restricted` (bonus, with usage rules). */
|
|
244
244
|
balanceClass: 'real' | 'restricted' | 'unspecified' | (string & {});
|
|
245
|
-
/**
|
|
245
|
+
/** Winnings from the reward: `real` or restricted until the rollover is met. */
|
|
246
246
|
proceedsClass: 'real' | 'restricted_until_wagering_completion' | 'unspecified' | (string & {});
|
|
247
|
-
/**
|
|
247
|
+
/** Validity. */
|
|
248
248
|
validity?: CampaignRewardValidity;
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
|
-
*
|
|
252
|
-
* @category
|
|
251
|
+
* Free spins reward.
|
|
252
|
+
* @category Bonus
|
|
253
253
|
*/
|
|
254
254
|
interface CasinoFreeSpinsReward {
|
|
255
|
-
/**
|
|
255
|
+
/** Spin provider. */
|
|
256
256
|
providerCode: string;
|
|
257
|
-
/**
|
|
257
|
+
/** Games where the spins apply. */
|
|
258
258
|
casinoScope?: CasinoActivitySelector;
|
|
259
|
-
/**
|
|
259
|
+
/** Number of spins. */
|
|
260
260
|
quantity: number;
|
|
261
|
-
/**
|
|
261
|
+
/** Value of each spin. */
|
|
262
262
|
denomination?: CampaignMoney;
|
|
263
|
-
/**
|
|
263
|
+
/** Currency. */
|
|
264
264
|
currency: string;
|
|
265
|
-
/**
|
|
265
|
+
/** Window to use the spins. */
|
|
266
266
|
grantWindow?: CampaignTimeWindow;
|
|
267
|
-
/**
|
|
267
|
+
/** Winnings from the spins: `real` or restricted until the rollover is met. */
|
|
268
268
|
proceedsClass: 'real' | 'restricted_until_wagering_completion' | 'unspecified' | (string & {});
|
|
269
|
-
/**
|
|
269
|
+
/** Maximum win. */
|
|
270
270
|
maximumWinnings?: CampaignMoney;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
|
-
*
|
|
274
|
-
* @category
|
|
273
|
+
* Free sports bet reward.
|
|
274
|
+
* @category Bonus
|
|
275
275
|
*/
|
|
276
276
|
interface SportsBonusBetReward {
|
|
277
|
-
/**
|
|
277
|
+
/** Sportsbook provider. */
|
|
278
278
|
providerCode: string;
|
|
279
|
-
/**
|
|
279
|
+
/** Where the bet applies. */
|
|
280
280
|
sportsbookScope?: SportsActivitySelector;
|
|
281
|
-
/**
|
|
281
|
+
/** Value of each bet. */
|
|
282
282
|
amount?: CampaignMoney;
|
|
283
|
-
/**
|
|
283
|
+
/** Number of bets. */
|
|
284
284
|
quantity: number;
|
|
285
|
-
/**
|
|
285
|
+
/** Validity. */
|
|
286
286
|
validity?: CampaignRewardValidity;
|
|
287
287
|
}
|
|
288
288
|
/**
|
|
289
|
-
*
|
|
290
|
-
* @category
|
|
289
|
+
* Sports bet coverage reward (returns the lost bet up to a cap).
|
|
290
|
+
* @category Bonus
|
|
291
291
|
*/
|
|
292
292
|
interface SportsBetCoverageReward {
|
|
293
|
-
/**
|
|
293
|
+
/** Sportsbook provider. */
|
|
294
294
|
providerCode: string;
|
|
295
|
-
/**
|
|
295
|
+
/** Bets covered. */
|
|
296
296
|
qualifyingBetScope?: SportsActivitySelector;
|
|
297
|
-
/**
|
|
297
|
+
/** Cap of the coverage. */
|
|
298
298
|
coverageCap?: CampaignMoney;
|
|
299
|
-
/**
|
|
299
|
+
/** Validity. */
|
|
300
300
|
validity?: CampaignRewardValidity;
|
|
301
301
|
}
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
303
|
+
* Maximum bet with bonus balance.
|
|
304
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
305
305
|
* @beta
|
|
306
|
-
* @category
|
|
306
|
+
* @category Bonus
|
|
307
307
|
*/
|
|
308
308
|
interface CampaignMaximumBet {
|
|
309
|
-
/** `product_limit_only` (
|
|
309
|
+
/** `product_limit_only` (only the product's limit) or `campaign_maximum` (the `campaignMaximum` one). */
|
|
310
310
|
mode: 'product_limit_only' | 'campaign_maximum' | 'unspecified' | (string & {});
|
|
311
|
-
/**
|
|
311
|
+
/** Maximum bet of the campaign. */
|
|
312
312
|
campaignMaximum?: CampaignMoney;
|
|
313
313
|
}
|
|
314
314
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
315
|
+
* Sports betting odds rules.
|
|
316
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
317
317
|
* @beta
|
|
318
|
-
* @category
|
|
318
|
+
* @category Bonus
|
|
319
319
|
*/
|
|
320
320
|
interface CampaignOddsPolicy {
|
|
321
|
-
/** `all_product_accepted_odds`
|
|
321
|
+
/** `all_product_accepted_odds` or `threshold` (uses the minimums below). */
|
|
322
322
|
mode: 'all_product_accepted_odds' | 'threshold' | 'unspecified' | (string & {});
|
|
323
|
-
/**
|
|
323
|
+
/** Minimum total odds, decimal as text. */
|
|
324
324
|
minimumTotalOddsDecimal?: string;
|
|
325
|
-
/**
|
|
325
|
+
/** Minimum odds per selection, decimal as text. */
|
|
326
326
|
minimumOddsPerLegDecimal?: string;
|
|
327
|
-
/**
|
|
327
|
+
/** Minimum number of selections. */
|
|
328
328
|
minimumLegs?: number;
|
|
329
|
-
/**
|
|
329
|
+
/** Maximum number of selections. */
|
|
330
330
|
maximumLegs?: number;
|
|
331
331
|
}
|
|
332
332
|
/**
|
|
333
|
-
* Cash out
|
|
334
|
-
*
|
|
333
|
+
* Cash out of bets made with restricted balance.
|
|
334
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
335
335
|
* @beta
|
|
336
|
-
* @category
|
|
336
|
+
* @category Bonus
|
|
337
337
|
*/
|
|
338
338
|
type CampaignCashoutMode = 'disallow_for_restricted_funding' | 'allow_without_wagering_contribution' | 'unspecified' | (string & {});
|
|
339
339
|
/**
|
|
340
|
-
*
|
|
341
|
-
* `casinoAndSportsbook`)
|
|
342
|
-
*
|
|
340
|
+
* Where and how the bonus balance can be used. Only one of the cases (`casino`, `sportsbook`,
|
|
341
|
+
* `casinoAndSportsbook`) is filled in.
|
|
342
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
343
343
|
* @beta
|
|
344
|
-
* @category
|
|
344
|
+
* @category Bonus
|
|
345
345
|
*/
|
|
346
346
|
interface CampaignUsePolicy {
|
|
347
|
-
/**
|
|
347
|
+
/** Version. */
|
|
348
348
|
version: number;
|
|
349
|
-
/**
|
|
349
|
+
/** Consumption order: `real_then_restricted` or `restricted_then_real`. */
|
|
350
350
|
fundsConsumption?: CampaignPolicy<'real_then_restricted' | 'restricted_then_real' | 'unspecified' | (string & {})>;
|
|
351
|
-
/**
|
|
351
|
+
/** Casino use. */
|
|
352
352
|
casino?: {
|
|
353
|
-
/**
|
|
353
|
+
/** Allowed slices. */
|
|
354
354
|
allowedScopes: CasinoActivitySelector[];
|
|
355
|
-
/**
|
|
355
|
+
/** Maximum bet. */
|
|
356
356
|
maximumBet?: CampaignMaximumBet;
|
|
357
357
|
};
|
|
358
|
-
/**
|
|
358
|
+
/** Sports betting use. */
|
|
359
359
|
sportsbook?: {
|
|
360
|
-
/**
|
|
360
|
+
/** Allowed slices. */
|
|
361
361
|
allowedScopes: SportsActivitySelector[];
|
|
362
|
-
/**
|
|
362
|
+
/** Excluded slices. */
|
|
363
363
|
excludedScopes: SportsActivitySelector[];
|
|
364
|
-
/**
|
|
364
|
+
/** Maximum bet. */
|
|
365
365
|
maximumBet?: CampaignMaximumBet;
|
|
366
|
-
/**
|
|
366
|
+
/** Required odds. */
|
|
367
367
|
fundingOdds?: CampaignOddsPolicy;
|
|
368
368
|
/** Cash out. */
|
|
369
369
|
cashoutMode: CampaignCashoutMode;
|
|
370
370
|
};
|
|
371
|
-
/**
|
|
371
|
+
/** Use in casino and sports betting. */
|
|
372
372
|
casinoAndSportsbook?: {
|
|
373
|
-
/**
|
|
373
|
+
/** Allowed casino slices. */
|
|
374
374
|
allowedCasinoScopes: CasinoActivitySelector[];
|
|
375
|
-
/**
|
|
375
|
+
/** Allowed sports slices. */
|
|
376
376
|
allowedSportsbookScopes: SportsActivitySelector[];
|
|
377
|
-
/**
|
|
377
|
+
/** Excluded sports slices. */
|
|
378
378
|
excludedSportsbookScopes: SportsActivitySelector[];
|
|
379
|
-
/**
|
|
379
|
+
/** Maximum casino bet. */
|
|
380
380
|
maximumCasinoBet?: CampaignMaximumBet;
|
|
381
|
-
/**
|
|
381
|
+
/** Maximum sports bet. */
|
|
382
382
|
maximumSportsbookBet?: CampaignMaximumBet;
|
|
383
|
-
/**
|
|
383
|
+
/** Required odds. */
|
|
384
384
|
sportsbookFundingOdds?: CampaignOddsPolicy;
|
|
385
385
|
/** Cash out. */
|
|
386
386
|
sportsbookCashoutMode: CampaignCashoutMode;
|
|
387
387
|
};
|
|
388
|
-
/**
|
|
388
|
+
/** Split of winnings between real and restricted balance (e.g. `proportional_to_funding`). */
|
|
389
389
|
payoutAllocation?: CampaignPolicy<string>;
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
392
|
-
* Rollover (
|
|
393
|
-
*
|
|
392
|
+
* Rollover (wagering requirement) of the reward: `none` (no rollover) or `multiplier`.
|
|
393
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
394
394
|
* @beta
|
|
395
|
-
* @category
|
|
395
|
+
* @category Bonus
|
|
396
396
|
*/
|
|
397
397
|
interface CampaignWageringPolicy {
|
|
398
|
-
/**
|
|
398
|
+
/** Version. */
|
|
399
399
|
version: number;
|
|
400
|
-
/**
|
|
400
|
+
/** No rollover. */
|
|
401
401
|
none?: Record<string, never>;
|
|
402
|
-
/** Rollover
|
|
402
|
+
/** Rollover by multiplier (e.g. 30x the bonus). */
|
|
403
403
|
multiplier?: {
|
|
404
|
-
/**
|
|
404
|
+
/** Basis: `granted_balance` (the bonus granted) or `reward_proceeds` (the reward's winnings). */
|
|
405
405
|
requirementBasis: 'granted_balance' | 'reward_proceeds' | 'unspecified' | (string & {});
|
|
406
|
-
/**
|
|
406
|
+
/** Multiplier (e.g. `{ decimal: '30' }` = 30x). */
|
|
407
407
|
multiplier?: CampaignExactRatio;
|
|
408
|
-
/**
|
|
408
|
+
/** How much each bet type counts toward the rollover. */
|
|
409
409
|
contributionRates: {
|
|
410
|
-
/**
|
|
410
|
+
/** Casino slice. */
|
|
411
411
|
casino?: CasinoActivitySelector;
|
|
412
|
-
/**
|
|
412
|
+
/** Sports slice. */
|
|
413
413
|
sportsbook?: SportsActivitySelector;
|
|
414
|
-
/**
|
|
414
|
+
/** Contribution rate (10000 basis points = 100%). */
|
|
415
415
|
rate?: CampaignExactRatio;
|
|
416
416
|
}[];
|
|
417
|
-
/**
|
|
417
|
+
/** Deadline to complete. */
|
|
418
418
|
deadline?: CampaignRewardValidity;
|
|
419
|
-
/**
|
|
419
|
+
/** Rounding. */
|
|
420
420
|
rounding: CampaignRoundingMode;
|
|
421
|
-
/**
|
|
421
|
+
/** Minimum odds for the sports bet to count. */
|
|
422
422
|
sportsbookContributionOdds?: CampaignOddsPolicy;
|
|
423
423
|
};
|
|
424
424
|
}
|
|
425
425
|
/**
|
|
426
|
-
*
|
|
427
|
-
*
|
|
426
|
+
* Stacking with other campaigns of the same group: only one of the cases is filled in.
|
|
427
|
+
* Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
|
|
428
428
|
* @beta
|
|
429
|
-
* @category
|
|
429
|
+
* @category Bonus
|
|
430
430
|
*/
|
|
431
431
|
interface CampaignStackingPolicy {
|
|
432
|
-
/**
|
|
432
|
+
/** Version. */
|
|
433
433
|
version: number;
|
|
434
|
-
/**
|
|
434
|
+
/** Exclusive in the group (one active at a time). */
|
|
435
435
|
exclusiveInGroup?: {
|
|
436
|
-
/**
|
|
436
|
+
/** Group. */
|
|
437
437
|
stackingGroupKey: string;
|
|
438
438
|
};
|
|
439
|
-
/**
|
|
439
|
+
/** Several in the group, up to a maximum per player. */
|
|
440
440
|
multipleInGroup?: {
|
|
441
|
-
/**
|
|
441
|
+
/** Group. */
|
|
442
442
|
stackingGroupKey: string;
|
|
443
|
-
/**
|
|
443
|
+
/** Maximum active per player. */
|
|
444
444
|
maximumActivePerPlayer: number;
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
|
-
*
|
|
449
|
-
* `sportsBonusBet`, `sportsBetCoverage`, `providerManagedBalance`)
|
|
450
|
-
* @category
|
|
448
|
+
* Reward of a campaign. `rewardKind` says which of the details (`balanceCredit`, `casinoFreeSpins`,
|
|
449
|
+
* `sportsBonusBet`, `sportsBetCoverage`, `providerManagedBalance`) is filled in.
|
|
450
|
+
* @category Bonus
|
|
451
451
|
*/
|
|
452
452
|
interface CampaignReward {
|
|
453
|
-
/**
|
|
453
|
+
/** Reward key in the campaign. */
|
|
454
454
|
rewardKey: string;
|
|
455
|
-
/**
|
|
455
|
+
/** Reward type. */
|
|
456
456
|
rewardKind: CampaignRewardKind;
|
|
457
|
-
/**
|
|
457
|
+
/** Type version. @beta */
|
|
458
458
|
rewardKindVersion: number;
|
|
459
|
-
/**
|
|
459
|
+
/** Who executes the reward (e.g. `engine_managed_balance`, `provider_entitlement`). @beta */
|
|
460
460
|
executionProfileCode: 'engine_managed_balance' | 'provider_managed_balance' | 'provider_entitlement' | 'unspecified' | (string & {});
|
|
461
|
-
/**
|
|
461
|
+
/** Execution profile version. @beta */
|
|
462
462
|
executionProfileVersion: number;
|
|
463
|
-
/**
|
|
463
|
+
/** Balance credit. */
|
|
464
464
|
balanceCredit?: BalanceCreditReward;
|
|
465
|
-
/**
|
|
465
|
+
/** Provider-managed balance. */
|
|
466
466
|
providerManagedBalance?: {
|
|
467
|
-
/**
|
|
467
|
+
/** Provider. */
|
|
468
468
|
providerCode: string;
|
|
469
469
|
};
|
|
470
|
-
/**
|
|
470
|
+
/** Free spins. */
|
|
471
471
|
casinoFreeSpins?: CasinoFreeSpinsReward;
|
|
472
|
-
/**
|
|
472
|
+
/** Free sports bet. */
|
|
473
473
|
sportsBonusBet?: SportsBonusBetReward;
|
|
474
|
-
/**
|
|
474
|
+
/** Sports bet coverage. */
|
|
475
475
|
sportsBetCoverage?: SportsBetCoverageReward;
|
|
476
|
-
/**
|
|
476
|
+
/** Where the bonus balance can be used. */
|
|
477
477
|
usePolicy?: CampaignUsePolicy;
|
|
478
478
|
/** Rollover. */
|
|
479
479
|
wageringPolicy?: CampaignWageringPolicy;
|
|
480
|
-
/**
|
|
480
|
+
/** Stacking with other campaigns. */
|
|
481
481
|
stackingPolicy?: CampaignStackingPolicy;
|
|
482
|
-
/**
|
|
482
|
+
/** Consumption order among restricted balances. @beta */
|
|
483
483
|
restrictedPositionSelectionPolicy?: {
|
|
484
|
-
/**
|
|
484
|
+
/** Version. */
|
|
485
485
|
version: number;
|
|
486
|
-
/**
|
|
486
|
+
/** Priority and then the nearest expiration. */
|
|
487
487
|
priorityThenEarliestExpiry?: {
|
|
488
|
-
/**
|
|
488
|
+
/** Selection priority. */
|
|
489
489
|
selectionPriority?: number;
|
|
490
490
|
};
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
/**
|
|
494
|
-
*
|
|
495
|
-
* @category
|
|
494
|
+
* Texts of a campaign in one language.
|
|
495
|
+
* @category Bonus
|
|
496
496
|
*/
|
|
497
497
|
interface CampaignLocalizedContent {
|
|
498
|
-
/**
|
|
498
|
+
/** Language, e.g. `pt-BR`. */
|
|
499
499
|
locale: string;
|
|
500
|
-
/**
|
|
500
|
+
/** Display name. */
|
|
501
501
|
displayName: string;
|
|
502
|
-
/**
|
|
502
|
+
/** Description. */
|
|
503
503
|
description: string;
|
|
504
|
-
/**
|
|
504
|
+
/** Terms and conditions. */
|
|
505
505
|
terms: string;
|
|
506
|
-
/**
|
|
506
|
+
/** Terms revision: send it on acceptance (`termsAcceptance.termsRevision`). */
|
|
507
507
|
termsRevision: string;
|
|
508
508
|
}
|
|
509
509
|
/**
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
* @category
|
|
510
|
+
* Texts of a campaign in all published languages. Pick the one for the app's `locale` or, without it,
|
|
511
|
+
* the one for `defaultLocale`.
|
|
512
|
+
* @category Bonus
|
|
513
513
|
*/
|
|
514
514
|
interface CampaignContent {
|
|
515
|
-
/**
|
|
515
|
+
/** Default language. */
|
|
516
516
|
defaultLocale: string;
|
|
517
|
-
/**
|
|
517
|
+
/** Published languages. */
|
|
518
518
|
supportedLocales: string[];
|
|
519
|
-
/**
|
|
519
|
+
/** Texts by language. */
|
|
520
520
|
localizedContent: CampaignLocalizedContent[];
|
|
521
521
|
}
|
|
522
522
|
/**
|
|
523
|
-
*
|
|
524
|
-
* @category
|
|
523
|
+
* Bonus campaign offer (a published version of the campaign).
|
|
524
|
+
* @category Bonus
|
|
525
525
|
*/
|
|
526
526
|
interface CampaignOffer {
|
|
527
|
-
/**
|
|
527
|
+
/** Campaign id, for {@link BonusApi.getOffer} and {@link BonusApi.optIn}. */
|
|
528
528
|
campaignId: string;
|
|
529
|
-
/**
|
|
529
|
+
/** Published version, required in {@link BonusApi.optIn}. */
|
|
530
530
|
campaignVersionId: string;
|
|
531
|
-
/**
|
|
531
|
+
/** Publication id. */
|
|
532
532
|
publicationId: string;
|
|
533
|
-
/**
|
|
533
|
+
/** Product where it applies. */
|
|
534
534
|
productScope: CampaignProductScope;
|
|
535
|
-
/**
|
|
535
|
+
/** Time zone of the windows. */
|
|
536
536
|
timezone: string;
|
|
537
|
-
/**
|
|
537
|
+
/** When it is possible to join. */
|
|
538
538
|
enrollmentWindow?: CampaignTimeWindow;
|
|
539
|
-
/**
|
|
539
|
+
/** When it is possible to qualify. */
|
|
540
540
|
qualificationWindow?: CampaignTimeWindow;
|
|
541
|
-
/**
|
|
541
|
+
/** When it is possible to redeem (`player_claim` policy). */
|
|
542
542
|
claimWindow?: CampaignTimeWindow;
|
|
543
|
-
/**
|
|
543
|
+
/** How to join: `automatic`, `opt_in`, `promo_code` or `manual`. */
|
|
544
544
|
entryPolicy?: CampaignPolicy<CampaignEntryPolicyCode>;
|
|
545
|
-
/**
|
|
545
|
+
/** How to receive the reward: `automatic` or `player_claim`. */
|
|
546
546
|
rewardClaimPolicy?: CampaignPolicy<CampaignRewardClaimPolicyCode>;
|
|
547
|
-
/**
|
|
547
|
+
/** What is needed to qualify. */
|
|
548
548
|
qualification?: CampaignQualification;
|
|
549
|
-
/**
|
|
549
|
+
/** Reward. */
|
|
550
550
|
reward?: CampaignReward;
|
|
551
|
-
/**
|
|
551
|
+
/** Publication start, ISO 8601 (UTC). */
|
|
552
552
|
publicationStartsAt?: string;
|
|
553
|
-
/**
|
|
553
|
+
/** Publication end, ISO 8601 (UTC). */
|
|
554
554
|
publicationEndsAt?: string;
|
|
555
|
-
/**
|
|
555
|
+
/** Texts (name, description, terms) by language. */
|
|
556
556
|
content?: CampaignContent;
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
|
-
*
|
|
560
|
-
* (
|
|
561
|
-
* (
|
|
562
|
-
* `cancelled`.
|
|
563
|
-
* @category
|
|
559
|
+
* Status of the player's participation in a campaign: `enrolled` (joined), `qualifying`
|
|
560
|
+
* (in progress), `qualified` (done; with `player_claim`, can now redeem), `reward_pending`
|
|
561
|
+
* (reward being granted), `completed` (reward granted), `reward_failed`, `expired` or
|
|
562
|
+
* `cancelled`. A new value the SDK does not know yet may arrive: handle the default case.
|
|
563
|
+
* @category Bonus
|
|
564
564
|
*/
|
|
565
565
|
type CampaignParticipationStatus = 'enrolled' | 'qualifying' | 'qualified' | 'reward_pending' | 'completed' | 'reward_failed' | 'expired' | 'cancelled' | 'unspecified' | (string & {});
|
|
566
566
|
/**
|
|
567
|
-
*
|
|
568
|
-
* @category
|
|
567
|
+
* Acceptance of the terms recorded in the participation.
|
|
568
|
+
* @category Bonus
|
|
569
569
|
*/
|
|
570
570
|
interface CampaignTermsAcceptanceRecord {
|
|
571
|
-
/**
|
|
571
|
+
/** Language of the accepted terms. */
|
|
572
572
|
locale: string;
|
|
573
|
-
/**
|
|
573
|
+
/** Accepted revision. */
|
|
574
574
|
termsRevision: string;
|
|
575
|
-
/** SHA-256 (hex)
|
|
575
|
+
/** SHA-256 (hex) of the accepted text. */
|
|
576
576
|
termsDigestSha256Hex: string;
|
|
577
|
-
/**
|
|
577
|
+
/** Acceptance date, ISO 8601 (UTC). */
|
|
578
578
|
acceptedAt?: string;
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
|
-
*
|
|
582
|
-
*
|
|
581
|
+
* Where the bonus balance granted by a participation stands: `active` (still to wager or to use),
|
|
582
|
+
* `converted` (became real balance), `expired` or `forfeited` (e.g. lost to a withdrawal). A new value the SDK
|
|
583
|
+
* does not know yet may arrive: handle the default case.
|
|
584
|
+
* @category Bonus
|
|
585
|
+
*/
|
|
586
|
+
type CampaignRewardGrantState = 'active' | 'converted' | 'expired' | 'forfeited' | 'unspecified' | (string & {});
|
|
587
|
+
/**
|
|
588
|
+
* Rollover progress of a granted bonus.
|
|
589
|
+
* @category Bonus
|
|
590
|
+
*/
|
|
591
|
+
interface CampaignWageringProgress {
|
|
592
|
+
/** Amount to wager. */
|
|
593
|
+
required: CampaignMoney;
|
|
594
|
+
/** Amount already wagered. */
|
|
595
|
+
accumulated: CampaignMoney;
|
|
596
|
+
/** When the rollover was completed, ISO 8601 (UTC). */
|
|
597
|
+
completedAt?: string;
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* The bonus balance a participation granted. protojson leaves zeros out: a missing amount comes as `0` in the
|
|
601
|
+
* currency of the grant's other amounts (or `''` when none has one).
|
|
602
|
+
* @category Bonus
|
|
603
|
+
*/
|
|
604
|
+
interface CampaignRewardGrant {
|
|
605
|
+
/** Where the balance stands. An `active` grant keeps the bonus among the player's active ones even after the participation completed. */
|
|
606
|
+
state: CampaignRewardGrantState;
|
|
607
|
+
/** Amount granted. */
|
|
608
|
+
granted: CampaignMoney;
|
|
609
|
+
/** Bonus balance left. */
|
|
610
|
+
balance: CampaignMoney;
|
|
611
|
+
/** Amount converted to real balance. */
|
|
612
|
+
converted: CampaignMoney;
|
|
613
|
+
/** When the bonus balance expires, ISO 8601 (UTC). */
|
|
614
|
+
expiresAt?: string;
|
|
615
|
+
/** Rollover progress, when the bonus has a wagering requirement. */
|
|
616
|
+
wagering?: CampaignWageringProgress;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* The player's participation in a campaign, with the reward and the texts as they were when they joined.
|
|
620
|
+
* @category Bonus
|
|
583
621
|
*/
|
|
584
622
|
interface CampaignParticipation {
|
|
585
|
-
/**
|
|
623
|
+
/** Participation id, for {@link BonusApi.claim} and {@link BonusApi.getParticipation}. */
|
|
586
624
|
id: string;
|
|
587
|
-
/**
|
|
625
|
+
/** Campaign id. */
|
|
588
626
|
campaignId: string;
|
|
589
|
-
/**
|
|
627
|
+
/** Campaign version the player joined. */
|
|
590
628
|
campaignVersionId: string;
|
|
591
|
-
/**
|
|
629
|
+
/** Reward key. */
|
|
592
630
|
rewardKey: string;
|
|
593
|
-
/**
|
|
631
|
+
/** Required qualification (a copy from the time of joining). */
|
|
594
632
|
qualificationSnapshot?: CampaignQualification;
|
|
595
|
-
/**
|
|
633
|
+
/** Status. */
|
|
596
634
|
status: CampaignParticipationStatus;
|
|
597
|
-
/**
|
|
635
|
+
/** When it qualified (`status: 'qualified'`). */
|
|
598
636
|
qualifiedAt?: string;
|
|
599
|
-
/**
|
|
637
|
+
/** When the reward was granted (`status: 'completed'`). */
|
|
600
638
|
completedAt?: string;
|
|
601
|
-
/**
|
|
639
|
+
/** When it expired (`status: 'expired'`). */
|
|
602
640
|
expiredAt?: string;
|
|
603
|
-
/**
|
|
641
|
+
/** Reward, texts and terms acceptance as of the time of joining. */
|
|
604
642
|
snapshot?: {
|
|
605
|
-
/**
|
|
643
|
+
/** Reward. */
|
|
606
644
|
reward?: CampaignReward;
|
|
607
|
-
/**
|
|
645
|
+
/** Texts. */
|
|
608
646
|
content?: CampaignContent;
|
|
609
|
-
/**
|
|
647
|
+
/** Terms acceptance, if there was one. */
|
|
610
648
|
termsAcceptance?: CampaignTermsAcceptanceRecord;
|
|
611
649
|
};
|
|
650
|
+
/** The bonus balance granted, once the reward was credited; missing before that. */
|
|
651
|
+
rewardGrant?: CampaignRewardGrant;
|
|
612
652
|
}
|
|
613
653
|
/**
|
|
614
|
-
*
|
|
615
|
-
* @category
|
|
654
|
+
* Terms acceptance of the campaign, sent on opt-in or on promo code redemption.
|
|
655
|
+
* @category Bonus
|
|
616
656
|
*/
|
|
617
657
|
interface CampaignTermsAcceptance {
|
|
618
|
-
/**
|
|
658
|
+
/** Language of the terms shown ({@link CampaignLocalizedContent.locale}). */
|
|
619
659
|
locale: string;
|
|
620
|
-
/**
|
|
660
|
+
/** Revision of the terms shown ({@link CampaignLocalizedContent.termsRevision}). */
|
|
621
661
|
termsRevision: string;
|
|
622
662
|
}
|
|
623
663
|
/**
|
|
624
|
-
*
|
|
625
|
-
* @category
|
|
664
|
+
* Input of {@link BonusApi.optIn}.
|
|
665
|
+
* @category Bonus
|
|
626
666
|
*/
|
|
627
667
|
interface OptInInput {
|
|
628
|
-
/**
|
|
668
|
+
/** Campaign id ({@link CampaignOffer.campaignId}). */
|
|
629
669
|
campaignId: string;
|
|
630
|
-
/**
|
|
670
|
+
/** Version shown to the player ({@link CampaignOffer.campaignVersionId}). */
|
|
631
671
|
campaignVersionId: string;
|
|
632
|
-
/**
|
|
672
|
+
/** Acceptance of the terms shown. */
|
|
633
673
|
termsAcceptance?: CampaignTermsAcceptance;
|
|
634
674
|
}
|
|
635
675
|
/**
|
|
636
|
-
*
|
|
637
|
-
* @category
|
|
676
|
+
* Offer of a promo code, returned by {@link BonusApi.resolvePromoCode}.
|
|
677
|
+
* @category Bonus
|
|
638
678
|
*/
|
|
639
679
|
interface PromoCodeOffer {
|
|
640
|
-
/**
|
|
680
|
+
/** The offer. */
|
|
641
681
|
offer: CampaignOffer;
|
|
642
|
-
/**
|
|
682
|
+
/** The texts in the requested language. */
|
|
643
683
|
localizedContent: CampaignLocalizedContent;
|
|
644
684
|
}
|
|
645
685
|
/**
|
|
646
|
-
*
|
|
647
|
-
*
|
|
686
|
+
* The player's restricted bonus balance in one currency (amounts in minor units of `currency`; amounts of
|
|
687
|
+
* different currencies are never added).
|
|
688
|
+
* @category Bonus
|
|
689
|
+
*/
|
|
690
|
+
interface BonusOverviewCurrency {
|
|
691
|
+
/** Currency code, e.g. `BRL`. */
|
|
692
|
+
currency: string;
|
|
693
|
+
/** Decimal places of the currency, to format the amounts. */
|
|
694
|
+
decimalPlaces: number;
|
|
695
|
+
/** Bonus balance in open positions. */
|
|
696
|
+
restrictedTotal: number;
|
|
697
|
+
/** Part of `restrictedTotal` whose position expires in the next 7 days. */
|
|
698
|
+
expiring7d: number;
|
|
699
|
+
/** Open bonus positions. */
|
|
700
|
+
openPositions: number;
|
|
701
|
+
/** Nearest expiry among the open positions, ISO 8601 (UTC). */
|
|
702
|
+
nextExpiresAt?: string;
|
|
703
|
+
/** Bonus balance already converted to real balance. */
|
|
704
|
+
converted: number;
|
|
705
|
+
/** Campaigns with a conversion above zero. */
|
|
706
|
+
convertedCampaigns: number;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Result of {@link BonusApi.getOverview}.
|
|
710
|
+
* @category Bonus
|
|
711
|
+
*/
|
|
712
|
+
interface BonusOverview {
|
|
713
|
+
/** One line per currency; empty for a player without bonus history. */
|
|
714
|
+
currencies: BonusOverviewCurrency[];
|
|
715
|
+
/** When the figures were computed, ISO 8601 (UTC). */
|
|
716
|
+
asOf?: string;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* State of a bonus position: `open` or `terminal`. A new value may arrive.
|
|
720
|
+
* @category Bonus
|
|
721
|
+
*/
|
|
722
|
+
type BonusPositionState = 'open' | 'terminal' | (string & {});
|
|
723
|
+
/**
|
|
724
|
+
* How a terminal position ended, in lowercase: `expire`, `forfeit`, `convert` or `admin_cancel`.
|
|
725
|
+
* @category Bonus
|
|
726
|
+
*/
|
|
727
|
+
type BonusPositionTerminalAction = 'expire' | 'forfeit' | 'convert' | 'admin_cancel' | (string & {});
|
|
728
|
+
/**
|
|
729
|
+
* One bonus position of the player (the restricted balance of one grant) with its rollover progress. Amounts
|
|
730
|
+
* in minor units of `currency`.
|
|
731
|
+
* @category Bonus
|
|
732
|
+
*/
|
|
733
|
+
interface BonusPosition {
|
|
734
|
+
/** Position id. */
|
|
735
|
+
positionId: string;
|
|
736
|
+
/** Campaign id: the name to show comes from the campaign's offer (`localizedContent`). */
|
|
737
|
+
campaignId: string;
|
|
738
|
+
/** Currency code, e.g. `BRL`. */
|
|
739
|
+
currency: string;
|
|
740
|
+
/** Decimal places of the currency. */
|
|
741
|
+
decimalPlaces: number;
|
|
742
|
+
/** Amount granted. */
|
|
743
|
+
granted: number;
|
|
744
|
+
/** Bonus balance left. */
|
|
745
|
+
restricted: number;
|
|
746
|
+
/** Converted to real balance. */
|
|
747
|
+
converted: number;
|
|
748
|
+
/** Amount to wager. */
|
|
749
|
+
required: number;
|
|
750
|
+
/** Already wagered. */
|
|
751
|
+
wagered: number;
|
|
752
|
+
/** Still to wager. */
|
|
753
|
+
remaining: number;
|
|
754
|
+
/** `open` or `terminal`. */
|
|
755
|
+
state: BonusPositionState;
|
|
756
|
+
/** How it ended (terminal positions only). */
|
|
757
|
+
terminalAction?: BonusPositionTerminalAction;
|
|
758
|
+
/** When the bonus balance expires, ISO 8601 (UTC). */
|
|
759
|
+
expiresAt?: string;
|
|
760
|
+
/** When the position was created, ISO 8601 (UTC). */
|
|
761
|
+
createdAt?: string;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* Filters and pagination of {@link BonusApi.listPositions}. On the wire `pageSize` goes as `limit` (1 to 100,
|
|
765
|
+
* gateway default 25).
|
|
766
|
+
* @category Bonus
|
|
767
|
+
*/
|
|
768
|
+
interface ListBonusPositionsInput extends CursorPageInput {
|
|
769
|
+
/** Only open or only terminal positions. Default: all. */
|
|
770
|
+
state?: 'open' | 'terminal';
|
|
771
|
+
/** Currency code. Default: all. */
|
|
772
|
+
currency?: string;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Bonus campaigns and promo codes. Only `listPublicOffers` is public; the other methods require login.
|
|
776
|
+
* @category Bonus
|
|
648
777
|
*/
|
|
649
778
|
interface BonusApi {
|
|
650
779
|
/**
|
|
651
|
-
*
|
|
652
|
-
*
|
|
780
|
+
* Public catalog of offers (storefront, no login): it only describes the campaigns; eligibility,
|
|
781
|
+
* joining and participations require login. Cursor-paginated.
|
|
653
782
|
* @example
|
|
654
783
|
* const { items, nextCursor } = await igaming.bonus.listPublicOffers({ pageSize: 20 })
|
|
655
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
656
|
-
* `UNAUTHENTICATED` (401)
|
|
784
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for a `pageSize` that is not a positive integer;
|
|
785
|
+
* `UNAUTHENTICATED` (401) if the gateway does not resolve the operator by the domain.
|
|
657
786
|
*/
|
|
658
787
|
listPublicOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
|
|
659
788
|
/**
|
|
660
|
-
*
|
|
789
|
+
* Offers available to the logged-in player. Cursor-paginated.
|
|
661
790
|
* @example
|
|
662
791
|
* const { items } = await igaming.bonus.listOffers()
|
|
663
792
|
* const optIns = items.filter((o) => o.entryPolicy?.code === 'opt_in')
|
|
664
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
793
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
|
|
665
794
|
*/
|
|
666
795
|
listOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
|
|
667
796
|
/**
|
|
668
|
-
*
|
|
797
|
+
* An offer available to the player.
|
|
669
798
|
* @example
|
|
670
799
|
* const offer = await igaming.bonus.getOffer({ campaignId })
|
|
671
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
672
|
-
*
|
|
800
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) if the campaign does not exist or is not
|
|
801
|
+
* available; `INVALID_ARGUMENT` (400) if `campaignId` is not a UUID; `UNAUTHENTICATED` without a session.
|
|
673
802
|
*/
|
|
674
803
|
getOffer(input: {
|
|
675
804
|
campaignId: string;
|
|
676
805
|
}, options?: CallOptions): Promise<CampaignOffer>;
|
|
677
806
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
807
|
+
* Joins an `opt_in` campaign. **Idempotent**: it sends `Idempotency-Key` — generated on
|
|
808
|
+
* every call, or the one in `options.idempotencyKey` — and keeps it on the retry after renewing the session; to
|
|
809
|
+
* repeat after `NETWORK_ERROR`/`TIMEOUT` without joining twice, generate the key beforehand and pass the
|
|
810
|
+
* same one on both attempts. The response is always validated in strict mode.
|
|
682
811
|
* @example
|
|
683
812
|
* const participation = await igaming.bonus.optIn(
|
|
684
813
|
* { campaignId: offer.campaignId, campaignVersionId: offer.campaignVersionId, termsAcceptance: { locale: 'pt-BR', termsRevision: text.termsRevision } },
|
|
685
814
|
* { idempotencyKey: key },
|
|
686
815
|
* )
|
|
687
|
-
* @throws {EnginexError} `BONUS_NOT_ELIGIBLE`
|
|
688
|
-
*
|
|
689
|
-
* `BONUS_NOT_FOUND` (404); `ALREADY_EXISTS`/`BONUS_ALREADY_CLAIMED` (409)
|
|
690
|
-
*
|
|
691
|
-
* `INVALID_ARGUMENT` (400)
|
|
692
|
-
* `KEY_IN_USE` (409)
|
|
693
|
-
*
|
|
694
|
-
*
|
|
816
|
+
* @throws {EnginexError} `BONUS_NOT_ELIGIBLE` if the player cannot join; `BONUS_EXPIRED` outside
|
|
817
|
+
* the entry window (the gateway still returns these two with HTTP 500: identify by the code);
|
|
818
|
+
* `BONUS_NOT_FOUND` (404); `ALREADY_EXISTS`/`BONUS_ALREADY_CLAIMED` (409) if the player already
|
|
819
|
+
* participates; `KYC_REQUIRED`/`FAILED_PRECONDITION` (422) for a precondition (e.g. KYC, terms);
|
|
820
|
+
* `INVALID_ARGUMENT` (400) for ids that are not UUIDs or a malformed idempotency key;
|
|
821
|
+
* `KEY_IN_USE` (409) with the same key still being processed; `PAYLOAD_MISMATCH` (422) if the key
|
|
822
|
+
* was already used with another body; `VALIDATION_ERROR` if the response comes outside the format (the entry
|
|
823
|
+
* may have happened: check `listParticipations`); `UNAUTHENTICATED` without a session.
|
|
695
824
|
*/
|
|
696
825
|
optIn(input: OptInInput, options?: CallOptions): Promise<CampaignParticipation>;
|
|
697
826
|
/**
|
|
698
|
-
*
|
|
699
|
-
* **
|
|
700
|
-
*
|
|
827
|
+
* Redeems the reward of a qualified participation (campaigns with `player_claim`).
|
|
828
|
+
* **Idempotent**, like {@link BonusApi.optIn}: repeat with the same `idempotencyKey` so as not to
|
|
829
|
+
* redeem twice. The response is always validated in strict mode.
|
|
701
830
|
* @example
|
|
702
831
|
* const done = await igaming.bonus.claim({ participationId: participation.id }, { idempotencyKey: key })
|
|
703
|
-
* @throws {EnginexError} `BONUS_ALREADY_CLAIMED` (409)
|
|
704
|
-
* `BONUS_EXPIRED`
|
|
705
|
-
* 500
|
|
706
|
-
* `BONUS_NOT_FOUND` (404); `INVALID_ARGUMENT` (400)
|
|
707
|
-
* `PAYLOAD_MISMATCH` (422); `VALIDATION_ERROR`
|
|
708
|
-
*
|
|
832
|
+
* @throws {EnginexError} `BONUS_ALREADY_CLAIMED` (409) if the reward was already redeemed;
|
|
833
|
+
* `BONUS_EXPIRED` outside the redemption window and `BONUS_NOT_ELIGIBLE` if it has not qualified yet (HTTP
|
|
834
|
+
* 500 on the gateway: identify by the code); `FAILED_PRECONDITION`/`KYC_REQUIRED` (422);
|
|
835
|
+
* `BONUS_NOT_FOUND` (404); `INVALID_ARGUMENT` (400) for an id that is not a UUID; `KEY_IN_USE` (409);
|
|
836
|
+
* `PAYLOAD_MISMATCH` (422); `VALIDATION_ERROR` if the response comes outside the format (the redemption may
|
|
837
|
+
* have happened: check `getParticipation`); `UNAUTHENTICATED` without a session.
|
|
709
838
|
*/
|
|
710
839
|
claim(input: {
|
|
711
840
|
participationId: string;
|
|
712
841
|
}, options?: CallOptions): Promise<CampaignParticipation>;
|
|
713
842
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
843
|
+
* Shows the offer of a promo code before redemption (name, description and terms in the requested language).
|
|
844
|
+
* It does not join the campaign. The code is a secret: it goes only in the body, never in the URL or the hooks.
|
|
716
845
|
* @example
|
|
717
846
|
* const { offer, localizedContent } = await igaming.bonus.resolvePromoCode({ code: input.value, locale: 'pt-BR' })
|
|
718
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
719
|
-
* `BONUS_EXPIRED`/`BONUS_NOT_ELIGIBLE` (HTTP 500
|
|
720
|
-
* `RESOURCE_EXHAUSTED` (429)
|
|
721
|
-
*
|
|
847
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) for a nonexistent or inactive code;
|
|
848
|
+
* `BONUS_EXPIRED`/`BONUS_NOT_ELIGIBLE` (HTTP 500 on the gateway: identify by the code);
|
|
849
|
+
* `RESOURCE_EXHAUSTED` (429) due to the attempt limit (see `e.retryAfter`); `UNAVAILABLE` (503)
|
|
850
|
+
* if the gateway's limiter is down (the route fails closed for safety); `UNAUTHENTICATED` without a session.
|
|
722
851
|
*/
|
|
723
852
|
resolvePromoCode(input: {
|
|
724
853
|
code: string;
|
|
725
854
|
locale: string;
|
|
726
855
|
}, options?: CallOptions): Promise<PromoCodeOffer>;
|
|
727
856
|
/**
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
*
|
|
857
|
+
* Redeems a promo code: joins the code's campaign. **Idempotent** (the gateway requires the key):
|
|
858
|
+
* repeat with the same `idempotencyKey` so as not to redeem twice. The response is always validated
|
|
859
|
+
* in strict mode. The code goes only in the body.
|
|
731
860
|
* @example
|
|
732
861
|
* const participation = await igaming.bonus.redeemPromoCode(
|
|
733
862
|
* { code: 'BEMVINDO', termsAcceptance: { locale: 'pt-BR', termsRevision: localizedContent.termsRevision } },
|
|
734
863
|
* { idempotencyKey: key },
|
|
735
864
|
* )
|
|
736
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
737
|
-
* `BONUS_ALREADY_CLAIMED` (409)
|
|
738
|
-
* (HTTP 500
|
|
739
|
-
* `RESOURCE_EXHAUSTED` (429)
|
|
740
|
-
* `resolvePromoCode` (
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
865
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) for a nonexistent code;
|
|
866
|
+
* `BONUS_ALREADY_CLAIMED` (409) if the player already used the code; `BONUS_EXPIRED`/`BONUS_NOT_ELIGIBLE`
|
|
867
|
+
* (HTTP 500 on the gateway: identify by the code); `KYC_REQUIRED`/`FAILED_PRECONDITION` (422);
|
|
868
|
+
* `RESOURCE_EXHAUSTED` (429) due to the per-player promo code attempt limit, the same as
|
|
869
|
+
* `resolvePromoCode` (see `e.retryAfter`); `UNAVAILABLE` (503) if the gateway's limiter is
|
|
870
|
+
* down (the route fails closed for safety); `INVALID_ARGUMENT` (400) for a malformed idempotency
|
|
871
|
+
* key; `VALIDATION_ERROR` if the response comes outside the format (the redemption may have happened:
|
|
872
|
+
* check `listParticipations`); `UNAUTHENTICATED` without a session.
|
|
744
873
|
*/
|
|
745
874
|
redeemPromoCode(input: {
|
|
746
875
|
code: string;
|
|
747
876
|
termsAcceptance?: CampaignTermsAcceptance;
|
|
748
877
|
}, options?: CallOptions): Promise<CampaignParticipation>;
|
|
749
878
|
/**
|
|
750
|
-
*
|
|
879
|
+
* The player's participations. Cursor-paginated.
|
|
751
880
|
* @example
|
|
752
881
|
* const { items } = await igaming.bonus.listParticipations()
|
|
753
882
|
* const claimable = items.filter((p) => p.status === 'qualified')
|
|
754
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
883
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
|
|
755
884
|
*/
|
|
756
885
|
listParticipations(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignParticipation>>;
|
|
757
886
|
/**
|
|
758
|
-
*
|
|
887
|
+
* One of the player's participations.
|
|
759
888
|
* @example
|
|
760
889
|
* const p = await igaming.bonus.getParticipation({ participationId })
|
|
761
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
762
|
-
* `INVALID_ARGUMENT` (400)
|
|
890
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) if it does not exist (or belongs to another player);
|
|
891
|
+
* `INVALID_ARGUMENT` (400) if the id is not a UUID; `UNAUTHENTICATED` without a session.
|
|
763
892
|
*/
|
|
764
893
|
getParticipation(input: {
|
|
765
894
|
participationId: string;
|
|
766
895
|
}, options?: CallOptions): Promise<CampaignParticipation>;
|
|
896
|
+
/**
|
|
897
|
+
* The player's restricted bonus balance, one line per currency: total, what expires in 7 days, open
|
|
898
|
+
* positions and what was converted to real balance.
|
|
899
|
+
* @example
|
|
900
|
+
* const { currencies } = await igaming.bonus.getOverview()
|
|
901
|
+
* const brl = currencies.find((c) => c.currency === 'BRL')
|
|
902
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
|
|
903
|
+
* outside the format.
|
|
904
|
+
*/
|
|
905
|
+
getOverview(params?: NoParams, options?: CallOptions): Promise<BonusOverview>;
|
|
906
|
+
/**
|
|
907
|
+
* The player's bonus positions with their rollover progress, newest first. Cursor-paginated.
|
|
908
|
+
* @example
|
|
909
|
+
* const { items } = await igaming.bonus.listPositions({ state: 'open' })
|
|
910
|
+
* items.forEach((p) => showProgress(p.wagered, p.required))
|
|
911
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for a `pageSize` outside 1-100, an unknown `state` or an
|
|
912
|
+
* unsupported currency; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR`, also in `'warn'`, with money
|
|
913
|
+
* outside the format.
|
|
914
|
+
*/
|
|
915
|
+
listPositions(input?: ListBonusPositionsInput, options?: CallOptions): Promise<CursorPage<BonusPosition>>;
|
|
767
916
|
}
|
|
768
917
|
|
|
769
918
|
/**
|
|
770
|
-
*
|
|
771
|
-
* @category
|
|
919
|
+
* Casino catalog game (`GET /games`, `GET /games/{id}`).
|
|
920
|
+
* @category Casino
|
|
772
921
|
*/
|
|
773
922
|
interface Game {
|
|
774
|
-
/**
|
|
923
|
+
/** Game id, for {@link CasinoApi.getGame} and {@link CasinoApi.launchGame}. */
|
|
775
924
|
id: string;
|
|
776
|
-
/**
|
|
925
|
+
/** Display name. */
|
|
777
926
|
name: string;
|
|
778
927
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
928
|
+
* Provider id (the same as {@link GameProvider.id}). Treat it as an opaque identifier: depending on the
|
|
929
|
+
* aggregator, it may be a code or the name itself (e.g. `Pragmatic Play`).
|
|
781
930
|
*/
|
|
782
931
|
provider: string;
|
|
783
|
-
/**
|
|
932
|
+
/** Category slug (the same as {@link GameCategory.slug}), e.g. `slots`. */
|
|
784
933
|
category: string;
|
|
785
|
-
/**
|
|
934
|
+
/** Game type, as the provider reports it (e.g. `slot`, `blackjack`, `roulette`); may come empty. */
|
|
786
935
|
type: string;
|
|
787
|
-
/**
|
|
936
|
+
/** Cover image URL; may come empty. */
|
|
788
937
|
thumbnail: string;
|
|
789
|
-
/**
|
|
938
|
+
/** Marked as new in the catalog. */
|
|
790
939
|
isNew: boolean;
|
|
791
|
-
/**
|
|
940
|
+
/** Marked as popular in the catalog. */
|
|
792
941
|
isPopular: boolean;
|
|
793
|
-
/**
|
|
942
|
+
/** Live game (live casino). */
|
|
794
943
|
isLive: boolean;
|
|
795
|
-
/**
|
|
944
|
+
/** Supports demo mode (`launchGame({ mode: 'demo' })`). */
|
|
796
945
|
demoAvailable: boolean;
|
|
797
|
-
/**
|
|
946
|
+
/** Return to player reported by the provider, as a percentage (e.g. `96.5`); `0` when not reported. */
|
|
798
947
|
rtp: number;
|
|
799
|
-
/**
|
|
948
|
+
/** Volatility reported by the provider (e.g. `low`, `medium`, `high`); may come empty. */
|
|
800
949
|
volatility: string;
|
|
801
|
-
/**
|
|
950
|
+
/** Sort priority set by the operator (lowest first). */
|
|
802
951
|
priority: number;
|
|
803
952
|
}
|
|
804
953
|
/**
|
|
805
|
-
*
|
|
806
|
-
* (
|
|
807
|
-
* @category
|
|
954
|
+
* Ordering of {@link CasinoApi.listGames}: `popular` (most played), `new` (newest) or `az`
|
|
955
|
+
* (alphabetical). Omitted: the operator's default order.
|
|
956
|
+
* @category Casino
|
|
808
957
|
*/
|
|
809
958
|
type GameSort = 'popular' | 'new' | 'az';
|
|
810
959
|
/**
|
|
811
|
-
*
|
|
812
|
-
* @category
|
|
960
|
+
* Filters and pagination of {@link CasinoApi.listGames}.
|
|
961
|
+
* @category Casino
|
|
813
962
|
*/
|
|
814
963
|
interface ListGamesInput {
|
|
815
|
-
/** Slug
|
|
964
|
+
/** Slug of a category from {@link CasinoApi.listCategories}. An unknown slug brings no games. */
|
|
816
965
|
category?: string;
|
|
817
|
-
/** Id
|
|
966
|
+
/** Id of a provider from {@link CasinoApi.listProviders}. */
|
|
818
967
|
provider?: string;
|
|
819
|
-
/**
|
|
968
|
+
/** Search by game name, up to 100 characters (above that, `INVALID_ARGUMENT`). */
|
|
820
969
|
search?: string;
|
|
821
970
|
/**
|
|
822
|
-
*
|
|
823
|
-
* ids.
|
|
971
|
+
* Restricts the listing to these games (e.g. to validate favorites or recents saved in the app), up to 100
|
|
972
|
+
* ids. Inactive games or ones outside the operator's catalog simply do not come back.
|
|
824
973
|
*/
|
|
825
974
|
ids?: string[];
|
|
826
|
-
/**
|
|
975
|
+
/** Ordering. An unknown value is ignored by the gateway. */
|
|
827
976
|
sort?: GameSort;
|
|
828
|
-
/**
|
|
977
|
+
/** Page (starts at 1). Gateway default: 1. */
|
|
829
978
|
page?: number;
|
|
830
|
-
/**
|
|
979
|
+
/** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
|
|
831
980
|
perPage?: number;
|
|
832
981
|
}
|
|
833
982
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @category
|
|
983
|
+
* Catalog category with active games (`GET /games/categories`).
|
|
984
|
+
* @category Casino
|
|
836
985
|
*/
|
|
837
986
|
interface GameCategory {
|
|
838
|
-
/** Slug,
|
|
987
|
+
/** Slug, for the `category` filter of {@link CasinoApi.listGames}. */
|
|
839
988
|
slug: string;
|
|
840
|
-
/**
|
|
989
|
+
/** Display name. */
|
|
841
990
|
name: string;
|
|
842
|
-
/**
|
|
991
|
+
/** Icon set by the operator (name or URL, depending on the setup); may come empty. */
|
|
843
992
|
icon: string;
|
|
844
|
-
/**
|
|
993
|
+
/** Number of active games in the category. */
|
|
845
994
|
gameCount: number;
|
|
846
|
-
/**
|
|
995
|
+
/** Sort priority set by the operator (lowest first). */
|
|
847
996
|
priority: number;
|
|
848
997
|
}
|
|
849
998
|
/**
|
|
850
|
-
*
|
|
851
|
-
* @category
|
|
999
|
+
* Game provider with active games (`GET /games/providers`).
|
|
1000
|
+
* @category Casino
|
|
852
1001
|
*/
|
|
853
1002
|
interface GameProvider {
|
|
854
1003
|
/**
|
|
855
|
-
* Id,
|
|
856
|
-
*
|
|
1004
|
+
* Id, for the `provider` filter of {@link CasinoApi.listGames}. Opaque identifier: it may be a
|
|
1005
|
+
* code or the name itself (e.g. `Pragmatic Play`); pass it as it came.
|
|
857
1006
|
*/
|
|
858
1007
|
id: string;
|
|
859
|
-
/**
|
|
1008
|
+
/** Display name. */
|
|
860
1009
|
name: string;
|
|
861
|
-
/**
|
|
1010
|
+
/** Number of games. */
|
|
862
1011
|
gameCount: number;
|
|
863
1012
|
}
|
|
864
1013
|
/**
|
|
865
|
-
*
|
|
866
|
-
* @category
|
|
1014
|
+
* Input of {@link CasinoApi.launchGame}.
|
|
1015
|
+
* @category Casino
|
|
867
1016
|
*/
|
|
868
1017
|
interface LaunchGameInput {
|
|
869
|
-
/**
|
|
1018
|
+
/** Game id ({@link Game.id}). */
|
|
870
1019
|
gameId: string;
|
|
871
|
-
/** `real` (
|
|
1020
|
+
/** `real` (default) bets with the player's balance; `demo` opens demo mode, if the game supports it ({@link Game.demoAvailable}). */
|
|
872
1021
|
mode?: 'real' | 'demo';
|
|
873
|
-
/**
|
|
1022
|
+
/** Opens the mobile version of the game, when the provider has one. Default: `false`. */
|
|
874
1023
|
isMobile?: boolean;
|
|
875
1024
|
/**
|
|
876
|
-
* URL
|
|
877
|
-
*
|
|
878
|
-
* (SSR/Node)
|
|
1025
|
+
* Absolute URL (http/https) the game returns to on exit (the app's lobby). When omitted, the gateway
|
|
1026
|
+
* uses the request's `Origin` (or `Referer`) — the browser always sends it; on server calls
|
|
1027
|
+
* (SSR/Node) pass it explicitly.
|
|
879
1028
|
*/
|
|
880
1029
|
returnUrl?: string;
|
|
881
1030
|
/**
|
|
882
|
-
*
|
|
883
|
-
*
|
|
1031
|
+
* Game language (e.g. `pt-BR`). When omitted, the gateway uses the request's `Accept-Language`, which the SDK
|
|
1032
|
+
* fills in with the client's `locale` (see `enginex.setLocale`).
|
|
884
1033
|
*/
|
|
885
1034
|
language?: string;
|
|
886
1035
|
}
|
|
887
1036
|
/**
|
|
888
|
-
*
|
|
1037
|
+
* How the provider requires the game to be opened ({@link GameLaunch.launchTarget}): `iframe` (embedded in
|
|
1038
|
+
* the app's page), `redirect` (navigate the current tab to the game) or `new_tab` (open it in a new
|
|
1039
|
+
* tab or window). A new value the SDK does not know yet may arrive: handle the default case (e.g. as
|
|
1040
|
+
* `new_tab`, which works for any provider).
|
|
1041
|
+
* @category Casino
|
|
1042
|
+
*/
|
|
1043
|
+
type LaunchTarget = 'iframe' | 'redirect' | 'new_tab' | (string & {});
|
|
1044
|
+
/**
|
|
1045
|
+
* Game opened by {@link CasinoApi.launchGame}.
|
|
889
1046
|
*
|
|
890
|
-
* **
|
|
891
|
-
* (
|
|
892
|
-
* @category
|
|
1047
|
+
* **Sensitive:** `gameUrl` carries the player's game session token. Use it only to open the game
|
|
1048
|
+
* (as {@link GameLaunch.launchTarget} says) and never log it to logs, analytics, error tracking, nor store it.
|
|
1049
|
+
* @category Casino
|
|
893
1050
|
*/
|
|
894
1051
|
interface GameLaunch {
|
|
895
|
-
/**
|
|
1052
|
+
/** Game session id (the same as {@link GameSession.id}). */
|
|
896
1053
|
sessionId: string;
|
|
897
1054
|
/**
|
|
898
|
-
* URL
|
|
899
|
-
*
|
|
1055
|
+
* Game URL, with the game session token — do not log it. It may be absolute or relative
|
|
1056
|
+
* to the gateway, depending on the provider; it is never empty (a response without a URL is `VALIDATION_ERROR`).
|
|
900
1057
|
*/
|
|
901
1058
|
gameUrl: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* How to open `gameUrl`: some providers refuse to run inside an iframe and need `redirect` or `new_tab`.
|
|
1061
|
+
* A response without it (an older gateway, or a custom mock) arrives as `iframe`, what the SDK documented
|
|
1062
|
+
* before the gateway sent this field.
|
|
1063
|
+
*/
|
|
1064
|
+
launchTarget: LaunchTarget;
|
|
1065
|
+
/** Code of the game's provider (e.g. `pragmatic-play`), as the gateway sends it; absent when it does not. */
|
|
1066
|
+
providerCode?: string;
|
|
1067
|
+
/** Expiry of the game URL, ISO 8601 (UTC), when the provider reports one: open the game before it. */
|
|
1068
|
+
expiresAt?: string;
|
|
902
1069
|
}
|
|
903
1070
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @category
|
|
1071
|
+
* Status of a game session, without the gateway's `SESSION_STATUS_` prefix and in lowercase. A new
|
|
1072
|
+
* value the SDK does not know yet may arrive: handle the default case.
|
|
1073
|
+
* @category Casino
|
|
907
1074
|
*/
|
|
908
1075
|
type GameSessionStatus = 'active' | 'ended' | 'unspecified' | (string & {});
|
|
909
1076
|
/**
|
|
910
|
-
*
|
|
911
|
-
* @category
|
|
1077
|
+
* The player's game session (`GET /games/sessions`). Opening a game ends the previous active session.
|
|
1078
|
+
* @category Casino
|
|
912
1079
|
*/
|
|
913
1080
|
interface GameSession {
|
|
914
|
-
/**
|
|
1081
|
+
/** Session id. */
|
|
915
1082
|
id: string;
|
|
916
|
-
/**
|
|
1083
|
+
/** Game id. */
|
|
917
1084
|
gameId: string;
|
|
918
|
-
/**
|
|
1085
|
+
/** Game name. */
|
|
919
1086
|
gameName: string;
|
|
920
|
-
/**
|
|
1087
|
+
/** Provider id. */
|
|
921
1088
|
provider: string;
|
|
922
|
-
/**
|
|
1089
|
+
/** Session start, ISO 8601 (UTC). */
|
|
923
1090
|
startTime: string;
|
|
924
|
-
/** Total
|
|
1091
|
+
/** Total wagered in the session, in minor units of the operator's currency. */
|
|
925
1092
|
totalBet: number;
|
|
926
|
-
/** Total
|
|
1093
|
+
/** Total won in the session, in minor units of the operator's currency. */
|
|
927
1094
|
totalWin: number;
|
|
928
|
-
/**
|
|
1095
|
+
/** Status, e.g. `active`. */
|
|
929
1096
|
status: GameSessionStatus;
|
|
930
1097
|
}
|
|
931
1098
|
/**
|
|
932
|
-
*
|
|
933
|
-
* `reversal`
|
|
934
|
-
*
|
|
935
|
-
* @category
|
|
1099
|
+
* Type of a casino movement (lowercase, without the `CASINO_TRANSACTION_TYPE_` prefix).
|
|
1100
|
+
* `reversal` reverses an already credited prize (debits the player); `refund` returns a bet. A new
|
|
1101
|
+
* value the SDK does not know yet may arrive: handle the default case.
|
|
1102
|
+
* @category Casino
|
|
936
1103
|
*/
|
|
937
1104
|
type CasinoTransactionType = 'bet' | 'win' | 'refund' | 'jackpot' | 'free_spin' | 'reversal' | 'unspecified' | (string & {});
|
|
938
1105
|
/**
|
|
939
|
-
*
|
|
940
|
-
* @category
|
|
1106
|
+
* Movement of a casino round (`GET /games/history`).
|
|
1107
|
+
* @category Casino
|
|
941
1108
|
*/
|
|
942
1109
|
interface CasinoTransaction {
|
|
943
|
-
/**
|
|
1110
|
+
/** Movement id. */
|
|
944
1111
|
id: string;
|
|
945
|
-
/**
|
|
1112
|
+
/** Game id. */
|
|
946
1113
|
gameId: string;
|
|
947
|
-
/**
|
|
1114
|
+
/** Game name. */
|
|
948
1115
|
gameName: string;
|
|
949
|
-
/**
|
|
1116
|
+
/** Round id (the bet and the prize of the same round share it). */
|
|
950
1117
|
roundId: string;
|
|
951
|
-
/**
|
|
1118
|
+
/** Type, e.g. `bet`, `win`. */
|
|
952
1119
|
type: CasinoTransactionType;
|
|
953
|
-
/**
|
|
1120
|
+
/** Value in minor units of `currency` (the gateway sends it as text; the SDK converts). */
|
|
954
1121
|
amount: number;
|
|
955
|
-
/**
|
|
1122
|
+
/** Currency code, e.g. `BRL`. */
|
|
956
1123
|
currency: string;
|
|
957
|
-
/**
|
|
1124
|
+
/** Decimal places of the currency (e.g. `2` for BRL), to format `amount`. */
|
|
958
1125
|
currencyDecimalPlaces: number;
|
|
959
|
-
/**
|
|
1126
|
+
/** Movement date, ISO 8601 (UTC). */
|
|
960
1127
|
createdAt: string;
|
|
961
1128
|
}
|
|
962
1129
|
/**
|
|
963
|
-
*
|
|
964
|
-
* @category
|
|
1130
|
+
* Pagination of {@link CasinoApi.listSessions} and {@link CasinoApi.getHistory}.
|
|
1131
|
+
* @category Casino
|
|
965
1132
|
*/
|
|
966
1133
|
interface CasinoPageInput {
|
|
967
|
-
/**
|
|
1134
|
+
/** Page (starts at 1). Gateway default: 1. */
|
|
968
1135
|
page?: number;
|
|
969
|
-
/**
|
|
1136
|
+
/** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
|
|
970
1137
|
perPage?: number;
|
|
971
1138
|
}
|
|
972
1139
|
/**
|
|
973
|
-
*
|
|
974
|
-
* @category
|
|
1140
|
+
* Filters of {@link CasinoApi.getBiggestWinners}.
|
|
1141
|
+
* @category Casino
|
|
975
1142
|
*/
|
|
976
1143
|
interface GetBiggestWinnersInput {
|
|
977
|
-
/**
|
|
1144
|
+
/** How many winners (the casino service caps it; its default: 10). */
|
|
978
1145
|
limit?: number;
|
|
979
|
-
/**
|
|
1146
|
+
/** Window in days up to now. Omitted: the casino service's default. */
|
|
980
1147
|
days?: number;
|
|
981
1148
|
}
|
|
982
1149
|
/**
|
|
983
|
-
*
|
|
984
|
-
* @category
|
|
1150
|
+
* Biggest prize of a round, for the casino home ranking (`GET /games/biggest-winners`).
|
|
1151
|
+
* @category Casino
|
|
985
1152
|
*/
|
|
986
1153
|
interface BiggestWinner {
|
|
987
|
-
/**
|
|
1154
|
+
/** Player name already masked by the gateway (e.g. `Jo***`); the player id never comes. */
|
|
988
1155
|
player: string;
|
|
989
|
-
/**
|
|
1156
|
+
/** Prize in minor units of `currency`. */
|
|
990
1157
|
amount: number;
|
|
991
|
-
/**
|
|
1158
|
+
/** Currency code, e.g. `BRL`. */
|
|
992
1159
|
currency: string;
|
|
993
|
-
/**
|
|
1160
|
+
/** Decimal places of the currency, to format `amount`. */
|
|
994
1161
|
currencyDecimalPlaces: number;
|
|
995
|
-
/**
|
|
1162
|
+
/** Game id. */
|
|
996
1163
|
gameId: string;
|
|
997
|
-
/**
|
|
1164
|
+
/** Game name. */
|
|
998
1165
|
gameName: string;
|
|
999
|
-
/**
|
|
1166
|
+
/** Prize date, ISO 8601 (UTC). */
|
|
1000
1167
|
wonAt: string;
|
|
1001
1168
|
}
|
|
1002
1169
|
/**
|
|
1003
|
-
*
|
|
1004
|
-
* `listProviders`, `getGame`)
|
|
1005
|
-
* @category
|
|
1170
|
+
* Catalog, game launch and casino history. The catalog (`listGames`, `listCategories`,
|
|
1171
|
+
* `listProviders`, `getGame`) is public; the other methods require login.
|
|
1172
|
+
* @category Casino
|
|
1006
1173
|
*/
|
|
1007
1174
|
interface CasinoApi {
|
|
1008
1175
|
/**
|
|
1009
|
-
*
|
|
1010
|
-
* login (
|
|
1176
|
+
* Games of the operator's catalog, paginated and filterable. Public: it does not send the session, even with
|
|
1177
|
+
* login (the catalog does not depend on the player).
|
|
1011
1178
|
*
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1179
|
+
* Maintenance, a provider switch, temporary unavailability or an operator without a casino do **not**
|
|
1180
|
+
* become errors: the gateway answers 200 and reports the reason in an `availability` field next to the list,
|
|
1181
|
+
* which this SDK version does not expose yet. In those cases the list may come empty, without an error; show
|
|
1182
|
+
* a generic empty state.
|
|
1016
1183
|
* @example
|
|
1017
1184
|
* const page = await igaming.casino.listGames({ category: 'slots', sort: 'popular', perPage: 24 })
|
|
1018
1185
|
* page.items.forEach((game) => renderCard(game.name, game.thumbnail))
|
|
1019
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
1020
|
-
* 100 `ids`; `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1021
|
-
*
|
|
1186
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for `search` above 100 characters or more than
|
|
1187
|
+
* 100 `ids`; `UNAVAILABLE`/`PROVIDER_ERROR` (503) only when the call to the casino
|
|
1188
|
+
* service itself fails.
|
|
1022
1189
|
*/
|
|
1023
1190
|
listGames(input?: ListGamesInput, options?: CallOptions): Promise<Page<Game>>;
|
|
1024
1191
|
/**
|
|
1025
|
-
*
|
|
1192
|
+
* Categories with active games, to build lobby tabs/filters. Public.
|
|
1026
1193
|
* @example
|
|
1027
1194
|
* const categories = await igaming.casino.listCategories()
|
|
1028
1195
|
* categories.sort((a, b) => a.priority - b.priority)
|
|
1029
|
-
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1030
|
-
*
|
|
1196
|
+
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
|
|
1197
|
+
* service fails.
|
|
1031
1198
|
*/
|
|
1032
1199
|
listCategories(params?: NoParams, options?: CallOptions): Promise<GameCategory[]>;
|
|
1033
1200
|
/**
|
|
1034
|
-
*
|
|
1201
|
+
* Providers with active games. Public.
|
|
1035
1202
|
* @example
|
|
1036
1203
|
* const providers = await igaming.casino.listProviders()
|
|
1037
|
-
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1038
|
-
*
|
|
1204
|
+
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
|
|
1205
|
+
* service fails.
|
|
1039
1206
|
*/
|
|
1040
1207
|
listProviders(params?: NoParams, options?: CallOptions): Promise<GameProvider[]>;
|
|
1041
1208
|
/**
|
|
1042
|
-
*
|
|
1209
|
+
* A catalog game. Public.
|
|
1043
1210
|
* @example
|
|
1044
1211
|
* const game = await igaming.casino.getGame({ gameId: 'g-1' })
|
|
1045
|
-
* @throws {EnginexError} `GAME_NOT_FOUND` (404)
|
|
1212
|
+
* @throws {EnginexError} `GAME_NOT_FOUND` (404) if the id does not exist in the operator's catalog.
|
|
1046
1213
|
*/
|
|
1047
1214
|
getGame(input: {
|
|
1048
1215
|
gameId: string;
|
|
1049
1216
|
}, options?: CallOptions): Promise<Game>;
|
|
1050
1217
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1218
|
+
* Opens a game: creates the game session (ending the previous one, if any) and returns the URL and how to
|
|
1219
|
+
* open it ({@link GameLaunch.launchTarget}: in an iframe, by redirecting the tab, or in a new tab). Requires login, including in `demo` mode. It is not idempotent: each
|
|
1220
|
+
* call opens a new session.
|
|
1054
1221
|
*
|
|
1055
|
-
* **
|
|
1056
|
-
* hook (`onRequest`/`onResponse`/`onError`)
|
|
1057
|
-
*
|
|
1222
|
+
* **The returned URL carries the game session token.** The SDK delivers it only in the return value: no
|
|
1223
|
+
* hook (`onRequest`/`onResponse`/`onError`) nor `onValidationIssue` receives it, and the response is always
|
|
1224
|
+
* validated in strict mode. Do not log it to logs, analytics or error tracking.
|
|
1058
1225
|
* @example
|
|
1059
|
-
* const
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1226
|
+
* const launch = await igaming.casino.launchGame({ gameId: game.id, isMobile: isPhone() })
|
|
1227
|
+
* // If gameUrl comes relative, resolve it against the gateway origin.
|
|
1228
|
+
* switch (launch.launchTarget) {
|
|
1229
|
+
* case 'iframe':
|
|
1230
|
+
* iframe.src = launch.gameUrl
|
|
1231
|
+
* break
|
|
1232
|
+
* case 'redirect':
|
|
1233
|
+
* window.location.assign(launch.gameUrl)
|
|
1234
|
+
* break
|
|
1235
|
+
* default: {
|
|
1236
|
+
* // 'new_tab', and any target the SDK does not know yet. Opened after an `await`, the tab may be
|
|
1237
|
+
* // blocked as a popup (`window.open` returns null): fall back to the current tab.
|
|
1238
|
+
* const tab = window.open(launch.gameUrl, '_blank')
|
|
1239
|
+
* if (tab) tab.opener = null
|
|
1240
|
+
* else window.location.assign(launch.gameUrl)
|
|
1241
|
+
* }
|
|
1242
|
+
* }
|
|
1243
|
+
* @throws {EnginexError} `GAME_NOT_FOUND` (404) for a nonexistent game; `FAILED_PRECONDITION` (422)
|
|
1244
|
+
* for an inactive game; `SELF_EXCLUDED` (422), `COOLING_OFF` or `ACCOUNT_BLOCKED` when responsible
|
|
1245
|
+
* gaming blocks the player (outside demo mode); `UNAVAILABLE` (503) when the casino cannot
|
|
1246
|
+
* verify the player's restrictions; `PROVIDER_ERROR` (503) and `CASINO_UNAVAILABLE`
|
|
1247
|
+
* (codes defined in `enginex-commons` for provider/casino failures; treat them as
|
|
1248
|
+
* unavailability); `VALIDATION_ERROR` if the response comes without `sessionId` or without `gameUrl`;
|
|
1249
|
+
* `INTERNAL_ERROR` (502) when the provider gave no way to open the game;
|
|
1250
|
+
* `UNAUTHENTICATED` without a session. `COOLING_OFF`, `ACCOUNT_BLOCKED` and `CASINO_UNAVAILABLE` arrive with
|
|
1251
|
+
* HTTP 500 (the gateway does not map them yet): identify by the code, not by the status.
|
|
1069
1252
|
*/
|
|
1070
1253
|
launchGame(input: LaunchGameInput, options?: CallOptions): Promise<GameLaunch>;
|
|
1071
1254
|
/**
|
|
1072
|
-
*
|
|
1255
|
+
* The player's game sessions, from newest to oldest, paginated.
|
|
1073
1256
|
* @example
|
|
1074
1257
|
* const { items } = await igaming.casino.listSessions({ perPage: 10 })
|
|
1075
1258
|
* const active = items.find((s) => s.status === 'active')
|
|
1076
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1259
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session.
|
|
1077
1260
|
*/
|
|
1078
1261
|
listSessions(input?: CasinoPageInput, options?: CallOptions): Promise<Page<GameSession>>;
|
|
1079
1262
|
/**
|
|
1080
|
-
*
|
|
1263
|
+
* The player's round history (bets, prizes, reversals), paginated.
|
|
1081
1264
|
* @example
|
|
1082
1265
|
* const page = await igaming.casino.getHistory({ page: 1, perPage: 20 })
|
|
1083
1266
|
* page.items.forEach((tx) => console.log(tx.roundId, tx.type, tx.amount, tx.currency))
|
|
1084
|
-
* @throws {EnginexError} `INTERNAL_ERROR` (500)
|
|
1085
|
-
*
|
|
1267
|
+
* @throws {EnginexError} `INTERNAL_ERROR` (500) if the history has a currency the gateway does not
|
|
1268
|
+
* know; `UNAUTHENTICATED` without a session.
|
|
1086
1269
|
*/
|
|
1087
1270
|
getHistory(input?: CasinoPageInput, options?: CallOptions): Promise<Page<CasinoTransaction>>;
|
|
1088
1271
|
/**
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1272
|
+
* Biggest prizes of a round in the operator's casino (home ranking), with the player's name
|
|
1273
|
+
* masked. Requires login.
|
|
1091
1274
|
* @example
|
|
1092
1275
|
* const winners = await igaming.casino.getBiggestWinners({ limit: 10, days: 7 })
|
|
1093
|
-
* @throws {EnginexError} `INTERNAL_ERROR` (500)
|
|
1094
|
-
* `UNAUTHENTICATED`
|
|
1276
|
+
* @throws {EnginexError} `INTERNAL_ERROR` (500) if a prize comes with an unknown currency;
|
|
1277
|
+
* `UNAUTHENTICATED` without a session.
|
|
1095
1278
|
*/
|
|
1096
1279
|
getBiggestWinners(input?: GetBiggestWinnersInput, options?: CallOptions): Promise<BiggestWinner[]>;
|
|
1097
1280
|
}
|
|
1098
1281
|
|
|
1099
1282
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1103
|
-
* @category
|
|
1283
|
+
* Type of points redemption. The `bonus.proto` mentions `bonus`, `cash` and `free_bet`, but the backend
|
|
1284
|
+
* treats the field as free text and the contract does not say which ones the operator enables: the SDK sends the value
|
|
1285
|
+
* as received (it only refuses empty) and the server decides.
|
|
1286
|
+
* @category Loyalty
|
|
1104
1287
|
*/
|
|
1105
1288
|
type RedemptionType = 'bonus' | 'cash' | 'free_bet' | (string & {});
|
|
1106
1289
|
/**
|
|
1107
|
-
*
|
|
1108
|
-
* @category
|
|
1290
|
+
* The player's loyalty status (`GET /loyalty`).
|
|
1291
|
+
* @category Loyalty
|
|
1109
1292
|
*/
|
|
1110
1293
|
interface LoyaltyStatus {
|
|
1111
|
-
/** Total
|
|
1294
|
+
/** Total points earned (integer). */
|
|
1112
1295
|
totalPointsEarned: number;
|
|
1113
|
-
/**
|
|
1296
|
+
/** Points available for redemption (integer). */
|
|
1114
1297
|
currentPoints: number;
|
|
1115
|
-
/**
|
|
1298
|
+
/** Points already redeemed (integer). */
|
|
1116
1299
|
pointsRedeemed: number;
|
|
1117
|
-
/**
|
|
1300
|
+
/** Current tier; `null` when the gateway does not report it (empty or absent). The contract does not list the possible tiers (the operator defines them). */
|
|
1118
1301
|
currentTier: string | null;
|
|
1119
|
-
/**
|
|
1302
|
+
/** Points that count toward the tier (integer); the calculation rule is not reported by the contract. */
|
|
1120
1303
|
tierPoints: number;
|
|
1121
|
-
/** Total
|
|
1304
|
+
/** Total wagered over the player's lifetime, in minor units (the contract field is called `*_cents`; the currency does not come with it). */
|
|
1122
1305
|
lifetimeWagered: number;
|
|
1123
|
-
/** Total
|
|
1306
|
+
/** Total deposited over the player's lifetime, in minor units (the currency does not come with it). */
|
|
1124
1307
|
lifetimeDeposited: number;
|
|
1125
1308
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
* `onValidationIssue`
|
|
1309
|
+
* Benefits of the current tier, read from the JSON text the gateway passes along. The format is defined
|
|
1310
|
+
* by the operator (the contract only says "benefits of the current tier"): check before displaying. `null`
|
|
1311
|
+
* when it comes empty or absent, and also when it is not a valid JSON object (in this case
|
|
1312
|
+
* `onValidationIssue` is notified, without the content).
|
|
1130
1313
|
*/
|
|
1131
1314
|
tierBenefits: Record<string, unknown> | null;
|
|
1132
|
-
/**
|
|
1315
|
+
/** When the tier expires (ISO 8601, UTC); `null` when the gateway does not send it. */
|
|
1133
1316
|
tierExpiresAt: string | null;
|
|
1134
1317
|
}
|
|
1135
1318
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
* @category
|
|
1319
|
+
* Input of {@link LoyaltyApi.redeem}.
|
|
1320
|
+
* @category Loyalty
|
|
1138
1321
|
*/
|
|
1139
1322
|
interface RedeemPointsInput {
|
|
1140
|
-
/**
|
|
1323
|
+
/** Points to redeem: a safe integer > 0. */
|
|
1141
1324
|
points: number;
|
|
1142
|
-
/**
|
|
1325
|
+
/** Redemption type (non-empty text). */
|
|
1143
1326
|
redemptionType: RedemptionType;
|
|
1144
1327
|
}
|
|
1145
1328
|
/**
|
|
1146
|
-
*
|
|
1147
|
-
* @category
|
|
1329
|
+
* Result of {@link LoyaltyApi.redeem}.
|
|
1330
|
+
* @category Loyalty
|
|
1148
1331
|
*/
|
|
1149
1332
|
interface RedeemedPoints {
|
|
1150
|
-
/**
|
|
1333
|
+
/** Points actually redeemed (integer). */
|
|
1151
1334
|
redeemedPoints: number;
|
|
1152
|
-
/**
|
|
1335
|
+
/** Redemption value in minor units of `currency`; `null` when the gateway does not send it. */
|
|
1153
1336
|
value: number | null;
|
|
1154
|
-
/**
|
|
1337
|
+
/** Currency of `value`; `null` when absent. */
|
|
1155
1338
|
currency: string | null;
|
|
1156
|
-
/** Id
|
|
1339
|
+
/** Id of the bonus generated, when the redemption was into a bonus; `null` otherwise. */
|
|
1157
1340
|
bonusId: string | null;
|
|
1158
1341
|
}
|
|
1159
1342
|
/**
|
|
1160
|
-
*
|
|
1161
|
-
* @category
|
|
1343
|
+
* The player's loyalty (points and tier). Both methods require login.
|
|
1344
|
+
* @category Loyalty
|
|
1162
1345
|
*/
|
|
1163
1346
|
interface LoyaltyApi {
|
|
1164
1347
|
/**
|
|
1165
|
-
*
|
|
1348
|
+
* The player's points balance, tier and benefits.
|
|
1166
1349
|
* @example
|
|
1167
1350
|
* const loyalty = await igaming.loyalty.get()
|
|
1168
1351
|
* console.log(loyalty.currentPoints, loyalty.currentTier, loyalty.tierBenefits)
|
|
1169
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1170
|
-
* `VALIDATION_ERROR`
|
|
1352
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session. With `validation: 'strict'`,
|
|
1353
|
+
* `VALIDATION_ERROR` if `tier_benefits_json` is not a JSON object.
|
|
1171
1354
|
*/
|
|
1172
1355
|
get(params?: NoParams, options?: CallOptions): Promise<LoyaltyStatus>;
|
|
1173
1356
|
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1357
|
+
* Exchanges points for a bonus, cash or a free bet. It sends `Idempotency-Key` (generated per call
|
|
1358
|
+
* or the one in `options.idempotencyKey`, kept on the retry after renewing the session), **but the gateway does not
|
|
1359
|
+
* apply the idempotency middleware on this route yet**: a double click may redeem twice.
|
|
1360
|
+
* Lock the button until the call finishes.
|
|
1178
1361
|
* @example
|
|
1179
1362
|
* const result = await igaming.loyalty.redeem({ points: 500, redemptionType: 'bonus' })
|
|
1180
1363
|
* console.log(result.redeemedPoints, result.bonusId)
|
|
1181
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1182
|
-
* `redemptionType`
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
* `validation: 'warn'`; `message`
|
|
1186
|
-
* `UNKNOWN`
|
|
1187
|
-
*
|
|
1364
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `points` is not an integer > 0 or
|
|
1365
|
+
* `redemptionType` is empty; `INSUFFICIENT_BALANCE` or `FAILED_PRECONDITION` when the service
|
|
1366
|
+
* refuses the redemption (always identify by `error.code`); `UNKNOWN` with `status` 200 if the gateway
|
|
1367
|
+
* answers without confirming the redemption (`success: false`, absent or malformed; it also applies in
|
|
1368
|
+
* `validation: 'warn'`; `message` is the gateway's when it comes, otherwise the SDK's). General rule:
|
|
1369
|
+
* `UNKNOWN` with a 2xx `status` = unconfirmed operation: re-read the state ({@link LoyaltyApi.get})
|
|
1370
|
+
* before trying again. `UNAUTHENTICATED` without a session.
|
|
1188
1371
|
*/
|
|
1189
1372
|
redeem(input: RedeemPointsInput, options?: CallOptions): Promise<RedeemedPoints>;
|
|
1190
1373
|
}
|
|
1191
1374
|
|
|
1192
1375
|
/**
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
* @category
|
|
1376
|
+
* Mission periodicity: `daily`, `weekly`, `event` or `permanent`. The backend stores free text:
|
|
1377
|
+
* handle the default case (a new value arrives raw in `validation: 'warn'`).
|
|
1378
|
+
* @category Missions
|
|
1196
1379
|
*/
|
|
1197
1380
|
type MissionType = 'daily' | 'weekly' | 'event' | 'permanent' | (string & {});
|
|
1198
1381
|
/**
|
|
1199
|
-
*
|
|
1200
|
-
* (
|
|
1201
|
-
*
|
|
1202
|
-
*
|
|
1203
|
-
* @category
|
|
1382
|
+
* What the player must do: `wager` (bet), `bet_count` (number of bets), `win_amount`
|
|
1383
|
+
* (win), `play_game` (play the target games) or `deposit` (deposit). The contract
|
|
1384
|
+
* does not state the unit of `targetValue`; the "Missions" page gives an unconfirmed assumption per
|
|
1385
|
+
* type.
|
|
1386
|
+
* @category Missions
|
|
1204
1387
|
*/
|
|
1205
1388
|
type MissionObjectiveType = 'wager' | 'bet_count' | 'win_amount' | 'play_game' | 'deposit' | (string & {});
|
|
1206
1389
|
/**
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
* @category
|
|
1390
|
+
* Reward type: `bonus`, `free_spins`, `points` or `free_bet`. The contract does not
|
|
1391
|
+
* state the unit of `rewardValue`; the "Missions" page gives an unconfirmed assumption per type.
|
|
1392
|
+
* @category Missions
|
|
1210
1393
|
*/
|
|
1211
1394
|
type MissionRewardType = 'bonus' | 'free_spins' | 'points' | 'free_bet' | (string & {});
|
|
1212
1395
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
* @category
|
|
1396
|
+
* Status of the player's mission: `in_progress`, `completed`, `expired` or `claimed`.
|
|
1397
|
+
* @category Missions
|
|
1215
1398
|
*/
|
|
1216
1399
|
type UserMissionStatus = 'in_progress' | 'completed' | 'expired' | 'claimed' | (string & {});
|
|
1217
1400
|
/**
|
|
1218
|
-
*
|
|
1219
|
-
* @category
|
|
1401
|
+
* Active operator mission (`GET /missions`).
|
|
1402
|
+
* @category Missions
|
|
1220
1403
|
*/
|
|
1221
1404
|
interface Mission {
|
|
1222
|
-
/**
|
|
1405
|
+
/** Mission id (the same as {@link UserMission.missionId}). */
|
|
1223
1406
|
id: string;
|
|
1224
|
-
/**
|
|
1407
|
+
/** Display name. */
|
|
1225
1408
|
name: string;
|
|
1226
|
-
/**
|
|
1409
|
+
/** Description; may come empty. */
|
|
1227
1410
|
description: string;
|
|
1228
|
-
/**
|
|
1411
|
+
/** Periodicity. */
|
|
1229
1412
|
missionType: MissionType;
|
|
1230
|
-
/**
|
|
1413
|
+
/** Objective. */
|
|
1231
1414
|
objectiveType: MissionObjectiveType;
|
|
1232
1415
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
* `bet_count`/`play_game`);
|
|
1416
|
+
* Target, an integer. The gateway contract does not state the unit (an assumption, unconfirmed:
|
|
1417
|
+
* minor units of the currency for `wager`/`win_amount`/`deposit`, a count for
|
|
1418
|
+
* `bet_count`/`play_game`); confirm with the operator before displaying.
|
|
1236
1419
|
*/
|
|
1237
1420
|
targetValue: number;
|
|
1238
|
-
/** Slug
|
|
1421
|
+
/** Slug of the game category that counts toward the target; `null` when there is no restriction. */
|
|
1239
1422
|
targetGameCategory: string | null;
|
|
1240
|
-
/** Ids
|
|
1423
|
+
/** Ids of the games that count toward the target; `[]` when there is no restriction. */
|
|
1241
1424
|
targetGames: string[];
|
|
1242
|
-
/**
|
|
1425
|
+
/** Reward type. */
|
|
1243
1426
|
rewardType: MissionRewardType;
|
|
1244
|
-
/**
|
|
1427
|
+
/** Reward value, an integer. The contract does not state the unit (an assumption on the "Missions" page, unconfirmed). */
|
|
1245
1428
|
rewardValue: number;
|
|
1246
|
-
/**
|
|
1429
|
+
/** Start of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
|
|
1247
1430
|
validFrom: string | null;
|
|
1248
|
-
/**
|
|
1431
|
+
/** End of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
|
|
1249
1432
|
validTo: string | null;
|
|
1250
1433
|
}
|
|
1251
1434
|
/**
|
|
1252
|
-
*
|
|
1253
|
-
* @category
|
|
1435
|
+
* The player's progress on a mission (`GET /my/missions`).
|
|
1436
|
+
* @category Missions
|
|
1254
1437
|
*/
|
|
1255
1438
|
interface UserMission {
|
|
1256
|
-
/**
|
|
1439
|
+
/** Progress id (of the player's mission in the period). */
|
|
1257
1440
|
id: string;
|
|
1258
|
-
/**
|
|
1441
|
+
/** Mission id ({@link Mission.id}). */
|
|
1259
1442
|
missionId: string;
|
|
1260
|
-
/**
|
|
1443
|
+
/** Mission name. */
|
|
1261
1444
|
missionName: string;
|
|
1262
|
-
/**
|
|
1445
|
+
/** Current progress, an integer; presumed to be the same unit as `targetValue` (not confirmed by the contract). */
|
|
1263
1446
|
currentProgress: number;
|
|
1264
|
-
/**
|
|
1447
|
+
/** Target, an integer. */
|
|
1265
1448
|
targetValue: number;
|
|
1266
|
-
/**
|
|
1449
|
+
/** Progress as a percentage, a number (e.g. `37.5`); computed by the service, may exceed `100`. */
|
|
1267
1450
|
progressPercentage: number;
|
|
1268
|
-
/**
|
|
1451
|
+
/** Status. */
|
|
1269
1452
|
status: UserMissionStatus;
|
|
1270
|
-
/**
|
|
1453
|
+
/** Reward type. */
|
|
1271
1454
|
rewardType: MissionRewardType;
|
|
1272
|
-
/**
|
|
1455
|
+
/** Reward value, an integer. */
|
|
1273
1456
|
rewardValue: number;
|
|
1274
|
-
/**
|
|
1457
|
+
/** End of the period (ISO 8601, UTC); `null` when the gateway does not send it. */
|
|
1275
1458
|
periodEnd: string | null;
|
|
1276
|
-
/**
|
|
1459
|
+
/** When it was completed (ISO 8601, UTC); `null` while not completed. */
|
|
1277
1460
|
completedAt: string | null;
|
|
1278
1461
|
}
|
|
1279
1462
|
/**
|
|
1280
|
-
*
|
|
1281
|
-
* @category
|
|
1463
|
+
* Input of {@link MissionsApi.list}.
|
|
1464
|
+
* @category Missions
|
|
1282
1465
|
*/
|
|
1283
1466
|
interface ListMissionsInput {
|
|
1284
|
-
/**
|
|
1467
|
+
/** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
|
|
1285
1468
|
page?: number;
|
|
1286
|
-
/**
|
|
1469
|
+
/** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
|
|
1287
1470
|
perPage?: number;
|
|
1288
1471
|
}
|
|
1289
1472
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
* @category
|
|
1473
|
+
* Operator missions and the player's progress. Both methods require login. There is no `claim()`: the
|
|
1474
|
+
* reward is automatic (inferred; see the "Missions" page).
|
|
1475
|
+
* @category Missions
|
|
1293
1476
|
*/
|
|
1294
1477
|
interface MissionsApi {
|
|
1295
1478
|
/**
|
|
1296
|
-
*
|
|
1479
|
+
* Active operator missions, paginated. The gateway lists only the active ones and has no filter by type.
|
|
1297
1480
|
* @example
|
|
1298
1481
|
* const page = await igaming.missions.list({ perPage: 20 })
|
|
1299
1482
|
* page.items.forEach((mission) => renderMission(mission.name, mission.targetValue))
|
|
1300
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1301
|
-
* `perPage`
|
|
1483
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
|
|
1484
|
+
* a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session.
|
|
1302
1485
|
*/
|
|
1303
1486
|
list(input?: ListMissionsInput, options?: CallOptions): Promise<Page<Mission>>;
|
|
1304
1487
|
/**
|
|
1305
|
-
*
|
|
1488
|
+
* The player's progress on the active missions, without pagination.
|
|
1306
1489
|
* @example
|
|
1307
1490
|
* const mine = await igaming.missions.listMine()
|
|
1308
1491
|
* const open = mine.filter((m) => m.status === 'in_progress')
|
|
1309
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1492
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session.
|
|
1310
1493
|
*/
|
|
1311
1494
|
listMine(params?: NoParams, options?: CallOptions): Promise<UserMission[]>;
|
|
1312
1495
|
}
|
|
1313
1496
|
|
|
1314
1497
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* "
|
|
1498
|
+
* Status of a referral: `pending`, `qualified`, `completed` or `expired` (the gateway's `REFERRAL_STATUS_*`,
|
|
1499
|
+
* in lowercase). The contract does not describe what takes a referral from one status to another (the
|
|
1500
|
+
* "Referrals" page only has assumptions). Handle the default case: a new value arrives raw in
|
|
1318
1501
|
* `validation: 'warn'`.
|
|
1319
|
-
* @category
|
|
1502
|
+
* @category Referrals
|
|
1320
1503
|
*/
|
|
1321
1504
|
type ReferralStatus = 'pending' | 'qualified' | 'completed' | 'expired' | 'unspecified' | (string & {});
|
|
1322
1505
|
/**
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
* @category
|
|
1506
|
+
* The player's referral code, link and totals (`GET /referrals`). Money values in minor units
|
|
1507
|
+
* (integers): the gateway sends them as a float in major units and the SDK converts.
|
|
1508
|
+
* @category Referrals
|
|
1326
1509
|
*/
|
|
1327
1510
|
interface ReferralInfo {
|
|
1328
|
-
/**
|
|
1511
|
+
/** The player's referral code; `null` when the gateway sends it empty. */
|
|
1329
1512
|
code: string | null;
|
|
1330
|
-
/**
|
|
1513
|
+
/** Referral link ready to share; `null` when the gateway sends it empty. */
|
|
1331
1514
|
link: string | null;
|
|
1332
|
-
/** Total
|
|
1515
|
+
/** Total referrals (integer). */
|
|
1333
1516
|
totalReferrals: number;
|
|
1334
|
-
/**
|
|
1517
|
+
/** Completed referrals (integer). */
|
|
1335
1518
|
completedReferrals: number;
|
|
1336
|
-
/**
|
|
1519
|
+
/** Pending referrals (integer). */
|
|
1337
1520
|
pendingReferrals: number;
|
|
1338
|
-
/** Total
|
|
1521
|
+
/** Total earned from referrals, in minor units (the currency does not come with it). */
|
|
1339
1522
|
totalEarned: number;
|
|
1340
|
-
/**
|
|
1523
|
+
/** Bonus per referral, in minor units (the currency does not come with it). */
|
|
1341
1524
|
bonusPerReferral: number;
|
|
1342
|
-
/**
|
|
1525
|
+
/** Referee's minimum deposit, in minor units (the currency does not come with it). */
|
|
1343
1526
|
minDeposit: number;
|
|
1344
1527
|
}
|
|
1345
1528
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1348
|
-
* @category
|
|
1529
|
+
* A referral from the history (`GET /referrals/history`). Referee data: the email only comes out
|
|
1530
|
+
* masked and the gateway's `referee_id` is not exposed.
|
|
1531
|
+
* @category Referrals
|
|
1349
1532
|
*/
|
|
1350
1533
|
interface Referral {
|
|
1351
|
-
/**
|
|
1534
|
+
/** Referral id. */
|
|
1352
1535
|
id: string;
|
|
1353
|
-
/**
|
|
1536
|
+
/** Referee's name, as the gateway sends it; `null` when empty. It is personal data: do not log it. */
|
|
1354
1537
|
refereeName: string | null;
|
|
1355
1538
|
/**
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
* `null`
|
|
1539
|
+
* Referee's masked email: first character of the local part and one `*` per remaining character,
|
|
1540
|
+
* whole domain (`ana@exemplo.com` → `a**@exemplo.com`; a 1-character local part becomes `*`).
|
|
1541
|
+
* `null` when the gateway sends empty or something that is not an email. The raw email is never exposed.
|
|
1359
1542
|
*/
|
|
1360
1543
|
refereeEmailMasked: string | null;
|
|
1361
|
-
/**
|
|
1544
|
+
/** Referral code used. */
|
|
1362
1545
|
code: string;
|
|
1363
|
-
/**
|
|
1546
|
+
/** Status. */
|
|
1364
1547
|
status: ReferralStatus;
|
|
1365
|
-
/**
|
|
1548
|
+
/** Referrer's bonus, in minor units. */
|
|
1366
1549
|
referrerBonus: number;
|
|
1367
|
-
/**
|
|
1550
|
+
/** Referee's bonus, in minor units. */
|
|
1368
1551
|
refereeBonus: number;
|
|
1369
|
-
/**
|
|
1552
|
+
/** When the referral was created (ISO 8601, UTC); `null` if the gateway does not send it. */
|
|
1370
1553
|
createdAt: string | null;
|
|
1371
|
-
/**
|
|
1554
|
+
/** When it was completed (ISO 8601, UTC); `null` while not completed. */
|
|
1372
1555
|
completedAt: string | null;
|
|
1373
|
-
/**
|
|
1556
|
+
/** When it expires (ISO 8601, UTC); `null` when it does not expire or the gateway does not send it. */
|
|
1374
1557
|
expiresAt: string | null;
|
|
1375
1558
|
}
|
|
1376
1559
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
* @category
|
|
1560
|
+
* Input of {@link ReferralsApi.listHistory}.
|
|
1561
|
+
* @category Referrals
|
|
1379
1562
|
*/
|
|
1380
1563
|
interface ListReferralsInput {
|
|
1381
|
-
/**
|
|
1564
|
+
/** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
|
|
1382
1565
|
page?: number;
|
|
1383
|
-
/**
|
|
1566
|
+
/** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
|
|
1384
1567
|
perPage?: number;
|
|
1385
1568
|
}
|
|
1386
1569
|
/**
|
|
1387
|
-
*
|
|
1388
|
-
* @category
|
|
1570
|
+
* Page of the referral history, with the totals across all pages.
|
|
1571
|
+
* @category Referrals
|
|
1389
1572
|
*/
|
|
1390
1573
|
type ReferralHistory = Page<Referral> & {
|
|
1391
|
-
/**
|
|
1574
|
+
/** How many referrals are completed, across all pages (integer). */
|
|
1392
1575
|
completedCount: number;
|
|
1393
|
-
/** Total
|
|
1576
|
+
/** Total earned from referrals, in minor units (the currency does not come with it). */
|
|
1394
1577
|
totalEarned: number;
|
|
1395
1578
|
};
|
|
1396
1579
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
* @category
|
|
1580
|
+
* Input of {@link ReferralsApi.register}.
|
|
1581
|
+
* @category Referrals
|
|
1399
1582
|
*/
|
|
1400
1583
|
interface RegisterReferralInput {
|
|
1401
|
-
/**
|
|
1584
|
+
/** Another player's referral code (non-empty text; leading and trailing spaces are removed). */
|
|
1402
1585
|
code: string;
|
|
1403
1586
|
}
|
|
1404
1587
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
* @category
|
|
1588
|
+
* Referral registered by {@link ReferralsApi.register}.
|
|
1589
|
+
* @category Referrals
|
|
1407
1590
|
*/
|
|
1408
1591
|
interface RegisteredReferral {
|
|
1409
|
-
/**
|
|
1592
|
+
/** Referral id. */
|
|
1410
1593
|
id: string;
|
|
1411
|
-
/**
|
|
1594
|
+
/** Referral code registered. */
|
|
1412
1595
|
code: string;
|
|
1413
|
-
/**
|
|
1596
|
+
/** Initial status (probably `pending`; the contract does not say). */
|
|
1414
1597
|
status: ReferralStatus;
|
|
1415
|
-
/**
|
|
1598
|
+
/** Referee's bonus, in minor units. */
|
|
1416
1599
|
refereeBonus: number;
|
|
1417
|
-
/**
|
|
1600
|
+
/** When it was created (ISO 8601, UTC); `null` if the gateway does not send it. */
|
|
1418
1601
|
createdAt: string | null;
|
|
1419
1602
|
}
|
|
1420
1603
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
* `auth.register({ referralCode })
|
|
1423
|
-
* @category
|
|
1604
|
+
* The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's
|
|
1605
|
+
* `auth.register({ referralCode })`; the `register` here is for someone who already has an account.
|
|
1606
|
+
* @category Referrals
|
|
1424
1607
|
*/
|
|
1425
1608
|
interface ReferralsApi {
|
|
1426
1609
|
/**
|
|
1427
|
-
*
|
|
1610
|
+
* The player's referral code, link and totals.
|
|
1428
1611
|
* @example
|
|
1429
1612
|
* const referral = await igaming.referrals.get()
|
|
1430
1613
|
* console.log(referral.code, referral.link, referral.totalEarned)
|
|
1431
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1432
|
-
*
|
|
1614
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in `validation: 'strict'`
|
|
1615
|
+
* if a money value is not a finite number or if a counter is not an integer ≥ 0.
|
|
1433
1616
|
*/
|
|
1434
1617
|
get(params?: NoParams, options?: CallOptions): Promise<ReferralInfo>;
|
|
1435
1618
|
/**
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1619
|
+
* Referral history, paginated. Pagination comes inside `data` (not in the envelope's `meta`):
|
|
1620
|
+
* the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the end returns
|
|
1438
1621
|
* `items: []`.
|
|
1439
1622
|
* @example
|
|
1440
1623
|
* const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
|
|
1441
1624
|
* items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
|
|
1442
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1443
|
-
* `perPage`
|
|
1444
|
-
* `validation: 'strict'`
|
|
1625
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
|
|
1626
|
+
* a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in
|
|
1627
|
+
* `validation: 'strict'` if the status is unknown or the money is not a finite number.
|
|
1445
1628
|
*/
|
|
1446
1629
|
listHistory(input?: ListReferralsInput, options?: CallOptions): Promise<ReferralHistory>;
|
|
1447
1630
|
/**
|
|
1448
|
-
*
|
|
1631
|
+
* Registers another player's referral code on the logged-in account (after signup). Answers
|
|
1449
1632
|
* HTTP 201.
|
|
1450
1633
|
* @example
|
|
1451
1634
|
* const result = await igaming.referrals.register({ code: 'ANA123' })
|
|
1452
1635
|
* console.log(result.status, result.refereeBonus)
|
|
1453
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1454
|
-
* `UNAUTHENTICATED`
|
|
1455
|
-
*
|
|
1636
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `code` is not non-empty text;
|
|
1637
|
+
* `UNAUTHENTICATED` without a session; the service refuses a nonexistent, already used or out-of-rule code:
|
|
1638
|
+
* decide by `error.code` (the contract does not list the codes).
|
|
1456
1639
|
*/
|
|
1457
1640
|
register(input: RegisterReferralInput, options?: CallOptions): Promise<RegisteredReferral>;
|
|
1458
1641
|
}
|
|
1459
1642
|
|
|
1460
1643
|
/**
|
|
1461
|
-
*
|
|
1644
|
+
* FIRST sportsbook session created by {@link SportsbookApi.createSession}.
|
|
1462
1645
|
*
|
|
1463
|
-
* **
|
|
1464
|
-
*
|
|
1646
|
+
* **Sensitive:** `launchUrl` carries the player's operator token (`operatorToken`). Use it only to
|
|
1647
|
+
* open the sportsbook (iframe) and never log it to logs, analytics, error tracking.
|
|
1465
1648
|
* @category Sportsbook
|
|
1466
1649
|
*/
|
|
1467
1650
|
interface SportsbookSession {
|
|
1468
1651
|
/**
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1652
|
+
* FIRST sportsbook URL already with the operator token in the query — do not log it. Always
|
|
1653
|
+
* absolute (http/https); a response with anything else is `VALIDATION_ERROR`.
|
|
1471
1654
|
*/
|
|
1472
1655
|
launchUrl: string;
|
|
1473
|
-
/**
|
|
1656
|
+
/** Session validity from the response, in seconds (always greater than zero). */
|
|
1474
1657
|
expiresInSeconds: number;
|
|
1475
1658
|
/**
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1659
|
+
* Expiration instant in milliseconds since the epoch (like `Date.now()`): the client's clock at the
|
|
1660
|
+
* moment of the response plus `expiresInSeconds * 1000`. Reuse the session until `expiresAt - 30_000`.
|
|
1478
1661
|
*/
|
|
1479
1662
|
expiresAt: number;
|
|
1480
1663
|
}
|
|
1481
1664
|
/**
|
|
1482
|
-
*
|
|
1483
|
-
* `enginex.config.getSportsbook()
|
|
1665
|
+
* FIRST sportsbook (`GET /first/session`). The provider and the configuration come from
|
|
1666
|
+
* the core's `enginex.config.getSportsbook()`.
|
|
1484
1667
|
* @category Sportsbook
|
|
1485
1668
|
*/
|
|
1486
1669
|
interface SportsbookApi {
|
|
1487
1670
|
/**
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* `enginex.config.getSportsbook()`
|
|
1671
|
+
* Creates the FIRST session for the logged-in player: returns the sportsbook URL (with the
|
|
1672
|
+
* operator token) to load in an iframe. Requires login. There is no cache in the SDK: each call generates a new
|
|
1673
|
+
* token; reuse the session until `expiresAt - 30_000` and call
|
|
1674
|
+
* `enginex.config.getSportsbook()` first to confirm `enabled && provider === 'first'`.
|
|
1492
1675
|
*
|
|
1493
|
-
* **
|
|
1494
|
-
* (`onRequest`/`onResponse`/`onError`)
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1676
|
+
* **The returned URL carries the operator token.** The SDK delivers it only in the return value: no hook
|
|
1677
|
+
* (`onRequest`/`onResponse`/`onError`) nor `onValidationIssue` receives it, and the response is always
|
|
1678
|
+
* validated in strict mode. The separate token (`operator_token`) is never exposed. Do not log the URL
|
|
1679
|
+
* to logs, analytics or error tracking.
|
|
1497
1680
|
* @example
|
|
1498
1681
|
* const sb = await enginex.config.getSportsbook()
|
|
1499
1682
|
* if (sb.enabled && sb.provider === 'first') {
|
|
1500
1683
|
* const { launchUrl, expiresAt } = await igaming.sportsbook.createSession()
|
|
1501
1684
|
* iframe.src = launchUrl
|
|
1502
1685
|
* }
|
|
1503
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1507
|
-
* http(s)
|
|
1686
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session; the gateway envelope's code when FIRST
|
|
1687
|
+
* is not enabled for the operator (HTTP 400) and `UNAVAILABLE` (503) when the FIRST configuration is
|
|
1688
|
+
* incomplete, the session service is down or the bets service's sportsbook configuration
|
|
1689
|
+
* is not available; `VALIDATION_ERROR` if `launch_url` is not an
|
|
1690
|
+
* absolute http(s) URL or `expires_in_seconds` is not greater than zero.
|
|
1508
1691
|
*/
|
|
1509
1692
|
createSession(params?: NoParams, options?: CallOptions): Promise<SportsbookSession>;
|
|
1510
1693
|
}
|
|
1511
1694
|
|
|
1512
1695
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1696
|
+
* iGaming namespaces of an SDK client, returned by {@link createIgaming}. Every request
|
|
1697
|
+
* goes through the app's client: same session, token renewal, tenant, locale, hooks, validation and
|
|
1515
1698
|
* `dispose()`.
|
|
1516
|
-
* @category
|
|
1699
|
+
* @category Client
|
|
1517
1700
|
*/
|
|
1518
1701
|
interface IgamingClient {
|
|
1519
|
-
/**
|
|
1702
|
+
/** Catalog, game launch and casino history. */
|
|
1520
1703
|
casino: CasinoApi;
|
|
1521
|
-
/**
|
|
1704
|
+
/** Bonus campaigns (offers, opt-in, redemption) and promo codes. */
|
|
1522
1705
|
bonus: BonusApi;
|
|
1523
|
-
/**
|
|
1706
|
+
/** Operator missions and the player's progress. */
|
|
1524
1707
|
missions: MissionsApi;
|
|
1525
|
-
/**
|
|
1708
|
+
/** Loyalty: points balance, tier, benefits and redemption. */
|
|
1526
1709
|
loyalty: LoyaltyApi;
|
|
1527
|
-
/**
|
|
1710
|
+
/** Referrals: code and link, history (the referee's email masked) and code registration. */
|
|
1528
1711
|
referrals: ReferralsApi;
|
|
1529
|
-
/**
|
|
1712
|
+
/** FIRST sportsbook: session to open the sportsbook in an iframe. */
|
|
1530
1713
|
sportsbook: SportsbookApi;
|
|
1531
1714
|
}
|
|
1532
1715
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1716
|
+
* Creates the iGaming namespaces on top of a `@getenginex/sdk` client. It creates no session, tenant or
|
|
1717
|
+
* transport of its own and makes no request: call it once per client (in the browser, one per app;
|
|
1718
|
+
* on the server, one per request, together with the client).
|
|
1536
1719
|
*
|
|
1537
|
-
*
|
|
1538
|
-
*
|
|
1539
|
-
* @param client -
|
|
1720
|
+
* After `enginex.dispose()`, `createIgaming` still accepts the client, but every iGaming method
|
|
1721
|
+
* rejects with `CONFIGURATION_ERROR`, like the core methods.
|
|
1722
|
+
* @param client - The client returned by `createEnginexClient` (the object itself, not a copy).
|
|
1540
1723
|
* @example
|
|
1541
1724
|
* import { createEnginexClient } from '@getenginex/sdk'
|
|
1542
1725
|
* import { createIgaming } from '@getenginex/sdk-igaming'
|
|
1543
1726
|
*
|
|
1544
1727
|
* export const enginex = createEnginexClient({ locale: 'pt-BR' })
|
|
1545
1728
|
* export const igaming = createIgaming(enginex)
|
|
1546
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR`
|
|
1547
|
-
* `createEnginexClient` (
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
* @category
|
|
1729
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` if `client` is not a client created by
|
|
1730
|
+
* `createEnginexClient` (e.g. an arbitrary object or a `{ ...enginex }` copy), or if it was created
|
|
1731
|
+
* by an incompatible copy of `@getenginex/sdk` (install a single core version). Identify
|
|
1732
|
+
* with `isEnginexError(error, 'CONFIGURATION_ERROR')`.
|
|
1733
|
+
* @category Client
|
|
1551
1734
|
*/
|
|
1552
1735
|
declare function createIgaming(client: EnginexClient): IgamingClient;
|
|
1553
1736
|
|
|
1554
|
-
export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
|
|
1737
|
+
export { type ActivityAggregateQualification, type BalanceCreditReward, type BiggestWinner, type BonusApi, type BonusOverview, type BonusOverviewCurrency, type BonusPosition, type BonusPositionState, type BonusPositionTerminalAction, type CampaignCashoutMode, type CampaignContent, type CampaignEntryPolicyCode, type CampaignExactRatio, type CampaignLocalizedContent, type CampaignMaximumBet, type CampaignMoney, type CampaignOddsPolicy, type CampaignOffer, type CampaignParticipation, type CampaignParticipationStatus, type CampaignPercentCalculation, type CampaignPolicy, type CampaignProductScope, type CampaignQualification, type CampaignReward, type CampaignRewardClaimPolicyCode, type CampaignRewardGrant, type CampaignRewardGrantState, type CampaignRewardKind, type CampaignRewardValidity, type CampaignRoundingMode, type CampaignStackingPolicy, type CampaignTermsAcceptance, type CampaignTermsAcceptanceRecord, type CampaignTimeWindow, type CampaignUsePolicy, type CampaignWageringPolicy, type CampaignWageringProgress, type CasinoActivitySelector, type CasinoApi, type CasinoFreeSpinsReward, type CasinoPageInput, type CasinoTransaction, type CasinoTransactionType, type DepositSettledQualification, type Game, type GameCategory, type GameLaunch, type GameProvider, type GameSession, type GameSessionStatus, type GameSort, type GetBiggestWinnersInput, type IgamingClient, type LaunchGameInput, type LaunchTarget, type ListBonusPositionsInput, type ListGamesInput, type ListMissionsInput, type ListReferralsInput, type LoyaltyApi, type LoyaltyStatus, type Mission, type MissionObjectiveType, type MissionRewardType, type MissionType, type MissionsApi, type OptInInput, type PromoCodeOffer, type RedeemPointsInput, type RedeemedPoints, type RedemptionType, type Referral, type ReferralHistory, type ReferralInfo, type ReferralStatus, type ReferralsApi, type RegisterReferralInput, type RegisteredReferral, type SportsActivitySelector, type SportsBetCoverageReward, type SportsBetType, type SportsBonusBetReward, type SportsbookApi, type SportsbookSession, type UserEventQualification, type UserMission, type UserMissionStatus, createIgaming };
|