@getenginex/sdk-igaming 0.5.0 → 0.6.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 +24 -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 +39 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +725 -691
- package/dist/index.d.ts +725 -691
- package/dist/index.js +39 -28
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +45 -45
- package/dist/query/index.d.ts +45 -45
- package/dist/query/index.js.map +1 -1
- package/dist/testing/index.cjs +11 -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 +11 -5
- package/dist/testing/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,765 +1,765 @@
|
|
|
1
1
|
import { CursorPageInput, CallOptions, CursorPage, Page, NoParams, 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
|
-
* @category
|
|
581
|
+
* The player's participation in a campaign, with the reward and the texts as they were when they joined.
|
|
582
|
+
* @category Bonus
|
|
583
583
|
*/
|
|
584
584
|
interface CampaignParticipation {
|
|
585
|
-
/**
|
|
585
|
+
/** Participation id, for {@link BonusApi.claim} and {@link BonusApi.getParticipation}. */
|
|
586
586
|
id: string;
|
|
587
|
-
/**
|
|
587
|
+
/** Campaign id. */
|
|
588
588
|
campaignId: string;
|
|
589
|
-
/**
|
|
589
|
+
/** Campaign version the player joined. */
|
|
590
590
|
campaignVersionId: string;
|
|
591
|
-
/**
|
|
591
|
+
/** Reward key. */
|
|
592
592
|
rewardKey: string;
|
|
593
|
-
/**
|
|
593
|
+
/** Required qualification (a copy from the time of joining). */
|
|
594
594
|
qualificationSnapshot?: CampaignQualification;
|
|
595
|
-
/**
|
|
595
|
+
/** Status. */
|
|
596
596
|
status: CampaignParticipationStatus;
|
|
597
|
-
/**
|
|
597
|
+
/** When it qualified (`status: 'qualified'`). */
|
|
598
598
|
qualifiedAt?: string;
|
|
599
|
-
/**
|
|
599
|
+
/** When the reward was granted (`status: 'completed'`). */
|
|
600
600
|
completedAt?: string;
|
|
601
|
-
/**
|
|
601
|
+
/** When it expired (`status: 'expired'`). */
|
|
602
602
|
expiredAt?: string;
|
|
603
|
-
/**
|
|
603
|
+
/** Reward, texts and terms acceptance as of the time of joining. */
|
|
604
604
|
snapshot?: {
|
|
605
|
-
/**
|
|
605
|
+
/** Reward. */
|
|
606
606
|
reward?: CampaignReward;
|
|
607
|
-
/**
|
|
607
|
+
/** Texts. */
|
|
608
608
|
content?: CampaignContent;
|
|
609
|
-
/**
|
|
609
|
+
/** Terms acceptance, if there was one. */
|
|
610
610
|
termsAcceptance?: CampaignTermsAcceptanceRecord;
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
|
-
*
|
|
615
|
-
* @category
|
|
614
|
+
* Terms acceptance of the campaign, sent on opt-in or on promo code redemption.
|
|
615
|
+
* @category Bonus
|
|
616
616
|
*/
|
|
617
617
|
interface CampaignTermsAcceptance {
|
|
618
|
-
/**
|
|
618
|
+
/** Language of the terms shown ({@link CampaignLocalizedContent.locale}). */
|
|
619
619
|
locale: string;
|
|
620
|
-
/**
|
|
620
|
+
/** Revision of the terms shown ({@link CampaignLocalizedContent.termsRevision}). */
|
|
621
621
|
termsRevision: string;
|
|
622
622
|
}
|
|
623
623
|
/**
|
|
624
|
-
*
|
|
625
|
-
* @category
|
|
624
|
+
* Input of {@link BonusApi.optIn}.
|
|
625
|
+
* @category Bonus
|
|
626
626
|
*/
|
|
627
627
|
interface OptInInput {
|
|
628
|
-
/**
|
|
628
|
+
/** Campaign id ({@link CampaignOffer.campaignId}). */
|
|
629
629
|
campaignId: string;
|
|
630
|
-
/**
|
|
630
|
+
/** Version shown to the player ({@link CampaignOffer.campaignVersionId}). */
|
|
631
631
|
campaignVersionId: string;
|
|
632
|
-
/**
|
|
632
|
+
/** Acceptance of the terms shown. */
|
|
633
633
|
termsAcceptance?: CampaignTermsAcceptance;
|
|
634
634
|
}
|
|
635
635
|
/**
|
|
636
|
-
*
|
|
637
|
-
* @category
|
|
636
|
+
* Offer of a promo code, returned by {@link BonusApi.resolvePromoCode}.
|
|
637
|
+
* @category Bonus
|
|
638
638
|
*/
|
|
639
639
|
interface PromoCodeOffer {
|
|
640
|
-
/**
|
|
640
|
+
/** The offer. */
|
|
641
641
|
offer: CampaignOffer;
|
|
642
|
-
/**
|
|
642
|
+
/** The texts in the requested language. */
|
|
643
643
|
localizedContent: CampaignLocalizedContent;
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
|
-
*
|
|
647
|
-
* @category
|
|
646
|
+
* Bonus campaigns and promo codes. Only `listPublicOffers` is public; the other methods require login.
|
|
647
|
+
* @category Bonus
|
|
648
648
|
*/
|
|
649
649
|
interface BonusApi {
|
|
650
650
|
/**
|
|
651
|
-
*
|
|
652
|
-
*
|
|
651
|
+
* Public catalog of offers (storefront, no login): it only describes the campaigns; eligibility,
|
|
652
|
+
* joining and participations require login. Cursor-paginated.
|
|
653
653
|
* @example
|
|
654
654
|
* const { items, nextCursor } = await igaming.bonus.listPublicOffers({ pageSize: 20 })
|
|
655
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
656
|
-
* `UNAUTHENTICATED` (401)
|
|
655
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for a `pageSize` that is not a positive integer;
|
|
656
|
+
* `UNAUTHENTICATED` (401) if the gateway does not resolve the operator by the domain.
|
|
657
657
|
*/
|
|
658
658
|
listPublicOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
|
|
659
659
|
/**
|
|
660
|
-
*
|
|
660
|
+
* Offers available to the logged-in player. Cursor-paginated.
|
|
661
661
|
* @example
|
|
662
662
|
* const { items } = await igaming.bonus.listOffers()
|
|
663
663
|
* const optIns = items.filter((o) => o.entryPolicy?.code === 'opt_in')
|
|
664
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
664
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
|
|
665
665
|
*/
|
|
666
666
|
listOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
|
|
667
667
|
/**
|
|
668
|
-
*
|
|
668
|
+
* An offer available to the player.
|
|
669
669
|
* @example
|
|
670
670
|
* const offer = await igaming.bonus.getOffer({ campaignId })
|
|
671
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
672
|
-
*
|
|
671
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) if the campaign does not exist or is not
|
|
672
|
+
* available; `INVALID_ARGUMENT` (400) if `campaignId` is not a UUID; `UNAUTHENTICATED` without a session.
|
|
673
673
|
*/
|
|
674
674
|
getOffer(input: {
|
|
675
675
|
campaignId: string;
|
|
676
676
|
}, options?: CallOptions): Promise<CampaignOffer>;
|
|
677
677
|
/**
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
678
|
+
* Joins an `opt_in` campaign. **Idempotent**: it sends `Idempotency-Key` — generated on
|
|
679
|
+
* every call, or the one in `options.idempotencyKey` — and keeps it on the retry after renewing the session; to
|
|
680
|
+
* repeat after `NETWORK_ERROR`/`TIMEOUT` without joining twice, generate the key beforehand and pass the
|
|
681
|
+
* same one on both attempts. The response is always validated in strict mode.
|
|
682
682
|
* @example
|
|
683
683
|
* const participation = await igaming.bonus.optIn(
|
|
684
684
|
* { campaignId: offer.campaignId, campaignVersionId: offer.campaignVersionId, termsAcceptance: { locale: 'pt-BR', termsRevision: text.termsRevision } },
|
|
685
685
|
* { idempotencyKey: key },
|
|
686
686
|
* )
|
|
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
|
-
*
|
|
687
|
+
* @throws {EnginexError} `BONUS_NOT_ELIGIBLE` if the player cannot join; `BONUS_EXPIRED` outside
|
|
688
|
+
* the entry window (the gateway still returns these two with HTTP 500: identify by the code);
|
|
689
|
+
* `BONUS_NOT_FOUND` (404); `ALREADY_EXISTS`/`BONUS_ALREADY_CLAIMED` (409) if the player already
|
|
690
|
+
* participates; `KYC_REQUIRED`/`FAILED_PRECONDITION` (422) for a precondition (e.g. KYC, terms);
|
|
691
|
+
* `INVALID_ARGUMENT` (400) for ids that are not UUIDs or a malformed idempotency key;
|
|
692
|
+
* `KEY_IN_USE` (409) with the same key still being processed; `PAYLOAD_MISMATCH` (422) if the key
|
|
693
|
+
* was already used with another body; `VALIDATION_ERROR` if the response comes outside the format (the entry
|
|
694
|
+
* may have happened: check `listParticipations`); `UNAUTHENTICATED` without a session.
|
|
695
695
|
*/
|
|
696
696
|
optIn(input: OptInInput, options?: CallOptions): Promise<CampaignParticipation>;
|
|
697
697
|
/**
|
|
698
|
-
*
|
|
699
|
-
* **
|
|
700
|
-
*
|
|
698
|
+
* Redeems the reward of a qualified participation (campaigns with `player_claim`).
|
|
699
|
+
* **Idempotent**, like {@link BonusApi.optIn}: repeat with the same `idempotencyKey` so as not to
|
|
700
|
+
* redeem twice. The response is always validated in strict mode.
|
|
701
701
|
* @example
|
|
702
702
|
* 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
|
-
*
|
|
703
|
+
* @throws {EnginexError} `BONUS_ALREADY_CLAIMED` (409) if the reward was already redeemed;
|
|
704
|
+
* `BONUS_EXPIRED` outside the redemption window and `BONUS_NOT_ELIGIBLE` if it has not qualified yet (HTTP
|
|
705
|
+
* 500 on the gateway: identify by the code); `FAILED_PRECONDITION`/`KYC_REQUIRED` (422);
|
|
706
|
+
* `BONUS_NOT_FOUND` (404); `INVALID_ARGUMENT` (400) for an id that is not a UUID; `KEY_IN_USE` (409);
|
|
707
|
+
* `PAYLOAD_MISMATCH` (422); `VALIDATION_ERROR` if the response comes outside the format (the redemption may
|
|
708
|
+
* have happened: check `getParticipation`); `UNAUTHENTICATED` without a session.
|
|
709
709
|
*/
|
|
710
710
|
claim(input: {
|
|
711
711
|
participationId: string;
|
|
712
712
|
}, options?: CallOptions): Promise<CampaignParticipation>;
|
|
713
713
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
714
|
+
* Shows the offer of a promo code before redemption (name, description and terms in the requested language).
|
|
715
|
+
* 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
716
|
* @example
|
|
717
717
|
* 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
|
-
*
|
|
718
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) for a nonexistent or inactive code;
|
|
719
|
+
* `BONUS_EXPIRED`/`BONUS_NOT_ELIGIBLE` (HTTP 500 on the gateway: identify by the code);
|
|
720
|
+
* `RESOURCE_EXHAUSTED` (429) due to the attempt limit (see `e.retryAfter`); `UNAVAILABLE` (503)
|
|
721
|
+
* if the gateway's limiter is down (the route fails closed for safety); `UNAUTHENTICATED` without a session.
|
|
722
722
|
*/
|
|
723
723
|
resolvePromoCode(input: {
|
|
724
724
|
code: string;
|
|
725
725
|
locale: string;
|
|
726
726
|
}, options?: CallOptions): Promise<PromoCodeOffer>;
|
|
727
727
|
/**
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
|
-
*
|
|
728
|
+
* Redeems a promo code: joins the code's campaign. **Idempotent** (the gateway requires the key):
|
|
729
|
+
* repeat with the same `idempotencyKey` so as not to redeem twice. The response is always validated
|
|
730
|
+
* in strict mode. The code goes only in the body.
|
|
731
731
|
* @example
|
|
732
732
|
* const participation = await igaming.bonus.redeemPromoCode(
|
|
733
733
|
* { code: 'BEMVINDO', termsAcceptance: { locale: 'pt-BR', termsRevision: localizedContent.termsRevision } },
|
|
734
734
|
* { idempotencyKey: key },
|
|
735
735
|
* )
|
|
736
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
737
|
-
* `BONUS_ALREADY_CLAIMED` (409)
|
|
738
|
-
* (HTTP 500
|
|
739
|
-
* `RESOURCE_EXHAUSTED` (429)
|
|
740
|
-
* `resolvePromoCode` (
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
*
|
|
736
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) for a nonexistent code;
|
|
737
|
+
* `BONUS_ALREADY_CLAIMED` (409) if the player already used the code; `BONUS_EXPIRED`/`BONUS_NOT_ELIGIBLE`
|
|
738
|
+
* (HTTP 500 on the gateway: identify by the code); `KYC_REQUIRED`/`FAILED_PRECONDITION` (422);
|
|
739
|
+
* `RESOURCE_EXHAUSTED` (429) due to the per-player promo code attempt limit, the same as
|
|
740
|
+
* `resolvePromoCode` (see `e.retryAfter`); `UNAVAILABLE` (503) if the gateway's limiter is
|
|
741
|
+
* down (the route fails closed for safety); `INVALID_ARGUMENT` (400) for a malformed idempotency
|
|
742
|
+
* key; `VALIDATION_ERROR` if the response comes outside the format (the redemption may have happened:
|
|
743
|
+
* check `listParticipations`); `UNAUTHENTICATED` without a session.
|
|
744
744
|
*/
|
|
745
745
|
redeemPromoCode(input: {
|
|
746
746
|
code: string;
|
|
747
747
|
termsAcceptance?: CampaignTermsAcceptance;
|
|
748
748
|
}, options?: CallOptions): Promise<CampaignParticipation>;
|
|
749
749
|
/**
|
|
750
|
-
*
|
|
750
|
+
* The player's participations. Cursor-paginated.
|
|
751
751
|
* @example
|
|
752
752
|
* const { items } = await igaming.bonus.listParticipations()
|
|
753
753
|
* const claimable = items.filter((p) => p.status === 'qualified')
|
|
754
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
754
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
|
|
755
755
|
*/
|
|
756
756
|
listParticipations(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignParticipation>>;
|
|
757
757
|
/**
|
|
758
|
-
*
|
|
758
|
+
* One of the player's participations.
|
|
759
759
|
* @example
|
|
760
760
|
* const p = await igaming.bonus.getParticipation({ participationId })
|
|
761
|
-
* @throws {EnginexError} `BONUS_NOT_FOUND` (404)
|
|
762
|
-
* `INVALID_ARGUMENT` (400)
|
|
761
|
+
* @throws {EnginexError} `BONUS_NOT_FOUND` (404) if it does not exist (or belongs to another player);
|
|
762
|
+
* `INVALID_ARGUMENT` (400) if the id is not a UUID; `UNAUTHENTICATED` without a session.
|
|
763
763
|
*/
|
|
764
764
|
getParticipation(input: {
|
|
765
765
|
participationId: string;
|
|
@@ -767,788 +767,822 @@ interface BonusApi {
|
|
|
767
767
|
}
|
|
768
768
|
|
|
769
769
|
/**
|
|
770
|
-
*
|
|
771
|
-
* @category
|
|
770
|
+
* Casino catalog game (`GET /games`, `GET /games/{id}`).
|
|
771
|
+
* @category Casino
|
|
772
772
|
*/
|
|
773
773
|
interface Game {
|
|
774
|
-
/**
|
|
774
|
+
/** Game id, for {@link CasinoApi.getGame} and {@link CasinoApi.launchGame}. */
|
|
775
775
|
id: string;
|
|
776
|
-
/**
|
|
776
|
+
/** Display name. */
|
|
777
777
|
name: string;
|
|
778
778
|
/**
|
|
779
|
-
*
|
|
780
|
-
*
|
|
779
|
+
* Provider id (the same as {@link GameProvider.id}). Treat it as an opaque identifier: depending on the
|
|
780
|
+
* aggregator, it may be a code or the name itself (e.g. `Pragmatic Play`).
|
|
781
781
|
*/
|
|
782
782
|
provider: string;
|
|
783
|
-
/**
|
|
783
|
+
/** Category slug (the same as {@link GameCategory.slug}), e.g. `slots`. */
|
|
784
784
|
category: string;
|
|
785
|
-
/**
|
|
785
|
+
/** Game type, as the provider reports it (e.g. `slot`, `blackjack`, `roulette`); may come empty. */
|
|
786
786
|
type: string;
|
|
787
|
-
/**
|
|
787
|
+
/** Cover image URL; may come empty. */
|
|
788
788
|
thumbnail: string;
|
|
789
|
-
/**
|
|
789
|
+
/** Marked as new in the catalog. */
|
|
790
790
|
isNew: boolean;
|
|
791
|
-
/**
|
|
791
|
+
/** Marked as popular in the catalog. */
|
|
792
792
|
isPopular: boolean;
|
|
793
|
-
/**
|
|
793
|
+
/** Live game (live casino). */
|
|
794
794
|
isLive: boolean;
|
|
795
|
-
/**
|
|
795
|
+
/** Supports demo mode (`launchGame({ mode: 'demo' })`). */
|
|
796
796
|
demoAvailable: boolean;
|
|
797
|
-
/**
|
|
797
|
+
/** Return to player reported by the provider, as a percentage (e.g. `96.5`); `0` when not reported. */
|
|
798
798
|
rtp: number;
|
|
799
|
-
/**
|
|
799
|
+
/** Volatility reported by the provider (e.g. `low`, `medium`, `high`); may come empty. */
|
|
800
800
|
volatility: string;
|
|
801
|
-
/**
|
|
801
|
+
/** Sort priority set by the operator (lowest first). */
|
|
802
802
|
priority: number;
|
|
803
803
|
}
|
|
804
804
|
/**
|
|
805
|
-
*
|
|
806
|
-
* (
|
|
807
|
-
* @category
|
|
805
|
+
* Ordering of {@link CasinoApi.listGames}: `popular` (most played), `new` (newest) or `az`
|
|
806
|
+
* (alphabetical). Omitted: the operator's default order.
|
|
807
|
+
* @category Casino
|
|
808
808
|
*/
|
|
809
809
|
type GameSort = 'popular' | 'new' | 'az';
|
|
810
810
|
/**
|
|
811
|
-
*
|
|
812
|
-
* @category
|
|
811
|
+
* Filters and pagination of {@link CasinoApi.listGames}.
|
|
812
|
+
* @category Casino
|
|
813
813
|
*/
|
|
814
814
|
interface ListGamesInput {
|
|
815
|
-
/** Slug
|
|
815
|
+
/** Slug of a category from {@link CasinoApi.listCategories}. An unknown slug brings no games. */
|
|
816
816
|
category?: string;
|
|
817
|
-
/** Id
|
|
817
|
+
/** Id of a provider from {@link CasinoApi.listProviders}. */
|
|
818
818
|
provider?: string;
|
|
819
|
-
/**
|
|
819
|
+
/** Search by game name, up to 100 characters (above that, `INVALID_ARGUMENT`). */
|
|
820
820
|
search?: string;
|
|
821
821
|
/**
|
|
822
|
-
*
|
|
823
|
-
* ids.
|
|
822
|
+
* Restricts the listing to these games (e.g. to validate favorites or recents saved in the app), up to 100
|
|
823
|
+
* ids. Inactive games or ones outside the operator's catalog simply do not come back.
|
|
824
824
|
*/
|
|
825
825
|
ids?: string[];
|
|
826
|
-
/**
|
|
826
|
+
/** Ordering. An unknown value is ignored by the gateway. */
|
|
827
827
|
sort?: GameSort;
|
|
828
|
-
/**
|
|
828
|
+
/** Page (starts at 1). Gateway default: 1. */
|
|
829
829
|
page?: number;
|
|
830
|
-
/**
|
|
830
|
+
/** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
|
|
831
831
|
perPage?: number;
|
|
832
832
|
}
|
|
833
833
|
/**
|
|
834
|
-
*
|
|
835
|
-
* @category
|
|
834
|
+
* Catalog category with active games (`GET /games/categories`).
|
|
835
|
+
* @category Casino
|
|
836
836
|
*/
|
|
837
837
|
interface GameCategory {
|
|
838
|
-
/** Slug,
|
|
838
|
+
/** Slug, for the `category` filter of {@link CasinoApi.listGames}. */
|
|
839
839
|
slug: string;
|
|
840
|
-
/**
|
|
840
|
+
/** Display name. */
|
|
841
841
|
name: string;
|
|
842
|
-
/**
|
|
842
|
+
/** Icon set by the operator (name or URL, depending on the setup); may come empty. */
|
|
843
843
|
icon: string;
|
|
844
|
-
/**
|
|
844
|
+
/** Number of active games in the category. */
|
|
845
845
|
gameCount: number;
|
|
846
|
-
/**
|
|
846
|
+
/** Sort priority set by the operator (lowest first). */
|
|
847
847
|
priority: number;
|
|
848
848
|
}
|
|
849
849
|
/**
|
|
850
|
-
*
|
|
851
|
-
* @category
|
|
850
|
+
* Game provider with active games (`GET /games/providers`).
|
|
851
|
+
* @category Casino
|
|
852
852
|
*/
|
|
853
853
|
interface GameProvider {
|
|
854
854
|
/**
|
|
855
|
-
* Id,
|
|
856
|
-
*
|
|
855
|
+
* Id, for the `provider` filter of {@link CasinoApi.listGames}. Opaque identifier: it may be a
|
|
856
|
+
* code or the name itself (e.g. `Pragmatic Play`); pass it as it came.
|
|
857
857
|
*/
|
|
858
858
|
id: string;
|
|
859
|
-
/**
|
|
859
|
+
/** Display name. */
|
|
860
860
|
name: string;
|
|
861
|
-
/**
|
|
861
|
+
/** Number of games. */
|
|
862
862
|
gameCount: number;
|
|
863
863
|
}
|
|
864
864
|
/**
|
|
865
|
-
*
|
|
866
|
-
* @category
|
|
865
|
+
* Input of {@link CasinoApi.launchGame}.
|
|
866
|
+
* @category Casino
|
|
867
867
|
*/
|
|
868
868
|
interface LaunchGameInput {
|
|
869
|
-
/**
|
|
869
|
+
/** Game id ({@link Game.id}). */
|
|
870
870
|
gameId: string;
|
|
871
|
-
/** `real` (
|
|
871
|
+
/** `real` (default) bets with the player's balance; `demo` opens demo mode, if the game supports it ({@link Game.demoAvailable}). */
|
|
872
872
|
mode?: 'real' | 'demo';
|
|
873
|
-
/**
|
|
873
|
+
/** Opens the mobile version of the game, when the provider has one. Default: `false`. */
|
|
874
874
|
isMobile?: boolean;
|
|
875
875
|
/**
|
|
876
|
-
* URL
|
|
877
|
-
*
|
|
878
|
-
* (SSR/Node)
|
|
876
|
+
* Absolute URL (http/https) the game returns to on exit (the app's lobby). When omitted, the gateway
|
|
877
|
+
* uses the request's `Origin` (or `Referer`) — the browser always sends it; on server calls
|
|
878
|
+
* (SSR/Node) pass it explicitly.
|
|
879
879
|
*/
|
|
880
880
|
returnUrl?: string;
|
|
881
881
|
/**
|
|
882
|
-
*
|
|
883
|
-
*
|
|
882
|
+
* Game language (e.g. `pt-BR`). When omitted, the gateway uses the request's `Accept-Language`, which the SDK
|
|
883
|
+
* fills in with the client's `locale` (see `enginex.setLocale`).
|
|
884
884
|
*/
|
|
885
885
|
language?: string;
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
|
-
*
|
|
888
|
+
* How the provider requires the game to be opened ({@link GameLaunch.launchTarget}): `iframe` (embedded in
|
|
889
|
+
* the app's page), `redirect` (navigate the current tab to the game) or `new_tab` (open it in a new
|
|
890
|
+
* tab or window). A new value the SDK does not know yet may arrive: handle the default case (e.g. as
|
|
891
|
+
* `new_tab`, which works for any provider).
|
|
892
|
+
* @category Casino
|
|
893
|
+
*/
|
|
894
|
+
type LaunchTarget = 'iframe' | 'redirect' | 'new_tab' | (string & {});
|
|
895
|
+
/**
|
|
896
|
+
* Game opened by {@link CasinoApi.launchGame}.
|
|
889
897
|
*
|
|
890
|
-
* **
|
|
891
|
-
* (
|
|
892
|
-
* @category
|
|
898
|
+
* **Sensitive:** `gameUrl` carries the player's game session token. Use it only to open the game
|
|
899
|
+
* (as {@link GameLaunch.launchTarget} says) and never log it to logs, analytics, error tracking, nor store it.
|
|
900
|
+
* @category Casino
|
|
893
901
|
*/
|
|
894
902
|
interface GameLaunch {
|
|
895
|
-
/**
|
|
903
|
+
/** Game session id (the same as {@link GameSession.id}). */
|
|
896
904
|
sessionId: string;
|
|
897
905
|
/**
|
|
898
|
-
* URL
|
|
899
|
-
*
|
|
906
|
+
* Game URL, with the game session token — do not log it. It may be absolute or relative
|
|
907
|
+
* to the gateway, depending on the provider; it is never empty (a response without a URL is `VALIDATION_ERROR`).
|
|
900
908
|
*/
|
|
901
909
|
gameUrl: string;
|
|
910
|
+
/**
|
|
911
|
+
* How to open `gameUrl`: some providers refuse to run inside an iframe and need `redirect` or `new_tab`.
|
|
912
|
+
* A response without it (an older gateway, or a custom mock) arrives as `iframe`, what the SDK documented
|
|
913
|
+
* before the gateway sent this field.
|
|
914
|
+
*/
|
|
915
|
+
launchTarget: LaunchTarget;
|
|
916
|
+
/** Code of the game's provider (e.g. `pragmatic-play`), as the gateway sends it; absent when it does not. */
|
|
917
|
+
providerCode?: string;
|
|
918
|
+
/** Expiry of the game URL, ISO 8601 (UTC), when the provider reports one: open the game before it. */
|
|
919
|
+
expiresAt?: string;
|
|
902
920
|
}
|
|
903
921
|
/**
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
* @category
|
|
922
|
+
* Status of a game session, without the gateway's `SESSION_STATUS_` prefix and in lowercase. A new
|
|
923
|
+
* value the SDK does not know yet may arrive: handle the default case.
|
|
924
|
+
* @category Casino
|
|
907
925
|
*/
|
|
908
926
|
type GameSessionStatus = 'active' | 'ended' | 'unspecified' | (string & {});
|
|
909
927
|
/**
|
|
910
|
-
*
|
|
911
|
-
* @category
|
|
928
|
+
* The player's game session (`GET /games/sessions`). Opening a game ends the previous active session.
|
|
929
|
+
* @category Casino
|
|
912
930
|
*/
|
|
913
931
|
interface GameSession {
|
|
914
|
-
/**
|
|
932
|
+
/** Session id. */
|
|
915
933
|
id: string;
|
|
916
|
-
/**
|
|
934
|
+
/** Game id. */
|
|
917
935
|
gameId: string;
|
|
918
|
-
/**
|
|
936
|
+
/** Game name. */
|
|
919
937
|
gameName: string;
|
|
920
|
-
/**
|
|
938
|
+
/** Provider id. */
|
|
921
939
|
provider: string;
|
|
922
|
-
/**
|
|
940
|
+
/** Session start, ISO 8601 (UTC). */
|
|
923
941
|
startTime: string;
|
|
924
|
-
/** Total
|
|
942
|
+
/** Total wagered in the session, in minor units of the operator's currency. */
|
|
925
943
|
totalBet: number;
|
|
926
|
-
/** Total
|
|
944
|
+
/** Total won in the session, in minor units of the operator's currency. */
|
|
927
945
|
totalWin: number;
|
|
928
|
-
/**
|
|
946
|
+
/** Status, e.g. `active`. */
|
|
929
947
|
status: GameSessionStatus;
|
|
930
948
|
}
|
|
931
949
|
/**
|
|
932
|
-
*
|
|
933
|
-
* `reversal`
|
|
934
|
-
*
|
|
935
|
-
* @category
|
|
950
|
+
* Type of a casino movement (lowercase, without the `CASINO_TRANSACTION_TYPE_` prefix).
|
|
951
|
+
* `reversal` reverses an already credited prize (debits the player); `refund` returns a bet. A new
|
|
952
|
+
* value the SDK does not know yet may arrive: handle the default case.
|
|
953
|
+
* @category Casino
|
|
936
954
|
*/
|
|
937
955
|
type CasinoTransactionType = 'bet' | 'win' | 'refund' | 'jackpot' | 'free_spin' | 'reversal' | 'unspecified' | (string & {});
|
|
938
956
|
/**
|
|
939
|
-
*
|
|
940
|
-
* @category
|
|
957
|
+
* Movement of a casino round (`GET /games/history`).
|
|
958
|
+
* @category Casino
|
|
941
959
|
*/
|
|
942
960
|
interface CasinoTransaction {
|
|
943
|
-
/**
|
|
961
|
+
/** Movement id. */
|
|
944
962
|
id: string;
|
|
945
|
-
/**
|
|
963
|
+
/** Game id. */
|
|
946
964
|
gameId: string;
|
|
947
|
-
/**
|
|
965
|
+
/** Game name. */
|
|
948
966
|
gameName: string;
|
|
949
|
-
/**
|
|
967
|
+
/** Round id (the bet and the prize of the same round share it). */
|
|
950
968
|
roundId: string;
|
|
951
|
-
/**
|
|
969
|
+
/** Type, e.g. `bet`, `win`. */
|
|
952
970
|
type: CasinoTransactionType;
|
|
953
|
-
/**
|
|
971
|
+
/** Value in minor units of `currency` (the gateway sends it as text; the SDK converts). */
|
|
954
972
|
amount: number;
|
|
955
|
-
/**
|
|
973
|
+
/** Currency code, e.g. `BRL`. */
|
|
956
974
|
currency: string;
|
|
957
|
-
/**
|
|
975
|
+
/** Decimal places of the currency (e.g. `2` for BRL), to format `amount`. */
|
|
958
976
|
currencyDecimalPlaces: number;
|
|
959
|
-
/**
|
|
977
|
+
/** Movement date, ISO 8601 (UTC). */
|
|
960
978
|
createdAt: string;
|
|
961
979
|
}
|
|
962
980
|
/**
|
|
963
|
-
*
|
|
964
|
-
* @category
|
|
981
|
+
* Pagination of {@link CasinoApi.listSessions} and {@link CasinoApi.getHistory}.
|
|
982
|
+
* @category Casino
|
|
965
983
|
*/
|
|
966
984
|
interface CasinoPageInput {
|
|
967
|
-
/**
|
|
985
|
+
/** Page (starts at 1). Gateway default: 1. */
|
|
968
986
|
page?: number;
|
|
969
|
-
/**
|
|
987
|
+
/** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
|
|
970
988
|
perPage?: number;
|
|
971
989
|
}
|
|
972
990
|
/**
|
|
973
|
-
*
|
|
974
|
-
* @category
|
|
991
|
+
* Filters of {@link CasinoApi.getBiggestWinners}.
|
|
992
|
+
* @category Casino
|
|
975
993
|
*/
|
|
976
994
|
interface GetBiggestWinnersInput {
|
|
977
|
-
/**
|
|
995
|
+
/** How many winners (the casino service caps it; its default: 10). */
|
|
978
996
|
limit?: number;
|
|
979
|
-
/**
|
|
997
|
+
/** Window in days up to now. Omitted: the casino service's default. */
|
|
980
998
|
days?: number;
|
|
981
999
|
}
|
|
982
1000
|
/**
|
|
983
|
-
*
|
|
984
|
-
* @category
|
|
1001
|
+
* Biggest prize of a round, for the casino home ranking (`GET /games/biggest-winners`).
|
|
1002
|
+
* @category Casino
|
|
985
1003
|
*/
|
|
986
1004
|
interface BiggestWinner {
|
|
987
|
-
/**
|
|
1005
|
+
/** Player name already masked by the gateway (e.g. `Jo***`); the player id never comes. */
|
|
988
1006
|
player: string;
|
|
989
|
-
/**
|
|
1007
|
+
/** Prize in minor units of `currency`. */
|
|
990
1008
|
amount: number;
|
|
991
|
-
/**
|
|
1009
|
+
/** Currency code, e.g. `BRL`. */
|
|
992
1010
|
currency: string;
|
|
993
|
-
/**
|
|
1011
|
+
/** Decimal places of the currency, to format `amount`. */
|
|
994
1012
|
currencyDecimalPlaces: number;
|
|
995
|
-
/**
|
|
1013
|
+
/** Game id. */
|
|
996
1014
|
gameId: string;
|
|
997
|
-
/**
|
|
1015
|
+
/** Game name. */
|
|
998
1016
|
gameName: string;
|
|
999
|
-
/**
|
|
1017
|
+
/** Prize date, ISO 8601 (UTC). */
|
|
1000
1018
|
wonAt: string;
|
|
1001
1019
|
}
|
|
1002
1020
|
/**
|
|
1003
|
-
*
|
|
1004
|
-
* `listProviders`, `getGame`)
|
|
1005
|
-
* @category
|
|
1021
|
+
* Catalog, game launch and casino history. The catalog (`listGames`, `listCategories`,
|
|
1022
|
+
* `listProviders`, `getGame`) is public; the other methods require login.
|
|
1023
|
+
* @category Casino
|
|
1006
1024
|
*/
|
|
1007
1025
|
interface CasinoApi {
|
|
1008
1026
|
/**
|
|
1009
|
-
*
|
|
1010
|
-
* login (
|
|
1027
|
+
* Games of the operator's catalog, paginated and filterable. Public: it does not send the session, even with
|
|
1028
|
+
* login (the catalog does not depend on the player).
|
|
1011
1029
|
*
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1030
|
+
* Maintenance, a provider switch, temporary unavailability or an operator without a casino do **not**
|
|
1031
|
+
* become errors: the gateway answers 200 and reports the reason in an `availability` field next to the list,
|
|
1032
|
+
* which this SDK version does not expose yet. In those cases the list may come empty, without an error; show
|
|
1033
|
+
* a generic empty state.
|
|
1016
1034
|
* @example
|
|
1017
1035
|
* const page = await igaming.casino.listGames({ category: 'slots', sort: 'popular', perPage: 24 })
|
|
1018
1036
|
* page.items.forEach((game) => renderCard(game.name, game.thumbnail))
|
|
1019
|
-
* @throws {EnginexError} `INVALID_ARGUMENT` (400)
|
|
1020
|
-
* 100 `ids`; `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1021
|
-
*
|
|
1037
|
+
* @throws {EnginexError} `INVALID_ARGUMENT` (400) for `search` above 100 characters or more than
|
|
1038
|
+
* 100 `ids`; `UNAVAILABLE`/`PROVIDER_ERROR` (503) only when the call to the casino
|
|
1039
|
+
* service itself fails.
|
|
1022
1040
|
*/
|
|
1023
1041
|
listGames(input?: ListGamesInput, options?: CallOptions): Promise<Page<Game>>;
|
|
1024
1042
|
/**
|
|
1025
|
-
*
|
|
1043
|
+
* Categories with active games, to build lobby tabs/filters. Public.
|
|
1026
1044
|
* @example
|
|
1027
1045
|
* const categories = await igaming.casino.listCategories()
|
|
1028
1046
|
* categories.sort((a, b) => a.priority - b.priority)
|
|
1029
|
-
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1030
|
-
*
|
|
1047
|
+
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
|
|
1048
|
+
* service fails.
|
|
1031
1049
|
*/
|
|
1032
1050
|
listCategories(params?: NoParams, options?: CallOptions): Promise<GameCategory[]>;
|
|
1033
1051
|
/**
|
|
1034
|
-
*
|
|
1052
|
+
* Providers with active games. Public.
|
|
1035
1053
|
* @example
|
|
1036
1054
|
* const providers = await igaming.casino.listProviders()
|
|
1037
|
-
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503)
|
|
1038
|
-
*
|
|
1055
|
+
* @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
|
|
1056
|
+
* service fails.
|
|
1039
1057
|
*/
|
|
1040
1058
|
listProviders(params?: NoParams, options?: CallOptions): Promise<GameProvider[]>;
|
|
1041
1059
|
/**
|
|
1042
|
-
*
|
|
1060
|
+
* A catalog game. Public.
|
|
1043
1061
|
* @example
|
|
1044
1062
|
* const game = await igaming.casino.getGame({ gameId: 'g-1' })
|
|
1045
|
-
* @throws {EnginexError} `GAME_NOT_FOUND` (404)
|
|
1063
|
+
* @throws {EnginexError} `GAME_NOT_FOUND` (404) if the id does not exist in the operator's catalog.
|
|
1046
1064
|
*/
|
|
1047
1065
|
getGame(input: {
|
|
1048
1066
|
gameId: string;
|
|
1049
1067
|
}, options?: CallOptions): Promise<Game>;
|
|
1050
1068
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1069
|
+
* Opens a game: creates the game session (ending the previous one, if any) and returns the URL and how to
|
|
1070
|
+
* 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
|
|
1071
|
+
* call opens a new session.
|
|
1054
1072
|
*
|
|
1055
|
-
* **
|
|
1056
|
-
* hook (`onRequest`/`onResponse`/`onError`)
|
|
1057
|
-
*
|
|
1073
|
+
* **The returned URL carries the game session token.** The SDK delivers it only in the return value: no
|
|
1074
|
+
* hook (`onRequest`/`onResponse`/`onError`) nor `onValidationIssue` receives it, and the response is always
|
|
1075
|
+
* validated in strict mode. Do not log it to logs, analytics or error tracking.
|
|
1058
1076
|
* @example
|
|
1059
|
-
* const
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1063
|
-
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1077
|
+
* const launch = await igaming.casino.launchGame({ gameId: game.id, isMobile: isPhone() })
|
|
1078
|
+
* // If gameUrl comes relative, resolve it against the gateway origin.
|
|
1079
|
+
* switch (launch.launchTarget) {
|
|
1080
|
+
* case 'iframe':
|
|
1081
|
+
* iframe.src = launch.gameUrl
|
|
1082
|
+
* break
|
|
1083
|
+
* case 'redirect':
|
|
1084
|
+
* window.location.assign(launch.gameUrl)
|
|
1085
|
+
* break
|
|
1086
|
+
* default: {
|
|
1087
|
+
* // 'new_tab', and any target the SDK does not know yet. Opened after an `await`, the tab may be
|
|
1088
|
+
* // blocked as a popup (`window.open` returns null): fall back to the current tab.
|
|
1089
|
+
* const tab = window.open(launch.gameUrl, '_blank')
|
|
1090
|
+
* if (tab) tab.opener = null
|
|
1091
|
+
* else window.location.assign(launch.gameUrl)
|
|
1092
|
+
* }
|
|
1093
|
+
* }
|
|
1094
|
+
* @throws {EnginexError} `GAME_NOT_FOUND` (404) for a nonexistent game; `FAILED_PRECONDITION` (422)
|
|
1095
|
+
* for an inactive game; `SELF_EXCLUDED` (422), `COOLING_OFF` or `ACCOUNT_BLOCKED` when responsible
|
|
1096
|
+
* gaming blocks the player (outside demo mode); `UNAVAILABLE` (503) when the casino cannot
|
|
1097
|
+
* verify the player's restrictions; `PROVIDER_ERROR` (503) and `CASINO_UNAVAILABLE`
|
|
1098
|
+
* (codes defined in `enginex-commons` for provider/casino failures; treat them as
|
|
1099
|
+
* unavailability); `VALIDATION_ERROR` if the response comes without `sessionId` or without `gameUrl`;
|
|
1100
|
+
* `INTERNAL_ERROR` (502) when the provider gave no way to open the game;
|
|
1101
|
+
* `UNAUTHENTICATED` without a session. `COOLING_OFF`, `ACCOUNT_BLOCKED` and `CASINO_UNAVAILABLE` arrive with
|
|
1102
|
+
* HTTP 500 (the gateway does not map them yet): identify by the code, not by the status.
|
|
1069
1103
|
*/
|
|
1070
1104
|
launchGame(input: LaunchGameInput, options?: CallOptions): Promise<GameLaunch>;
|
|
1071
1105
|
/**
|
|
1072
|
-
*
|
|
1106
|
+
* The player's game sessions, from newest to oldest, paginated.
|
|
1073
1107
|
* @example
|
|
1074
1108
|
* const { items } = await igaming.casino.listSessions({ perPage: 10 })
|
|
1075
1109
|
* const active = items.find((s) => s.status === 'active')
|
|
1076
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1110
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session.
|
|
1077
1111
|
*/
|
|
1078
1112
|
listSessions(input?: CasinoPageInput, options?: CallOptions): Promise<Page<GameSession>>;
|
|
1079
1113
|
/**
|
|
1080
|
-
*
|
|
1114
|
+
* The player's round history (bets, prizes, reversals), paginated.
|
|
1081
1115
|
* @example
|
|
1082
1116
|
* const page = await igaming.casino.getHistory({ page: 1, perPage: 20 })
|
|
1083
1117
|
* page.items.forEach((tx) => console.log(tx.roundId, tx.type, tx.amount, tx.currency))
|
|
1084
|
-
* @throws {EnginexError} `INTERNAL_ERROR` (500)
|
|
1085
|
-
*
|
|
1118
|
+
* @throws {EnginexError} `INTERNAL_ERROR` (500) if the history has a currency the gateway does not
|
|
1119
|
+
* know; `UNAUTHENTICATED` without a session.
|
|
1086
1120
|
*/
|
|
1087
1121
|
getHistory(input?: CasinoPageInput, options?: CallOptions): Promise<Page<CasinoTransaction>>;
|
|
1088
1122
|
/**
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1123
|
+
* Biggest prizes of a round in the operator's casino (home ranking), with the player's name
|
|
1124
|
+
* masked. Requires login.
|
|
1091
1125
|
* @example
|
|
1092
1126
|
* const winners = await igaming.casino.getBiggestWinners({ limit: 10, days: 7 })
|
|
1093
|
-
* @throws {EnginexError} `INTERNAL_ERROR` (500)
|
|
1094
|
-
* `UNAUTHENTICATED`
|
|
1127
|
+
* @throws {EnginexError} `INTERNAL_ERROR` (500) if a prize comes with an unknown currency;
|
|
1128
|
+
* `UNAUTHENTICATED` without a session.
|
|
1095
1129
|
*/
|
|
1096
1130
|
getBiggestWinners(input?: GetBiggestWinnersInput, options?: CallOptions): Promise<BiggestWinner[]>;
|
|
1097
1131
|
}
|
|
1098
1132
|
|
|
1099
1133
|
/**
|
|
1100
|
-
*
|
|
1101
|
-
*
|
|
1102
|
-
*
|
|
1103
|
-
* @category
|
|
1134
|
+
* Type of points redemption. The `bonus.proto` mentions `bonus`, `cash` and `free_bet`, but the backend
|
|
1135
|
+
* treats the field as free text and the contract does not say which ones the operator enables: the SDK sends the value
|
|
1136
|
+
* as received (it only refuses empty) and the server decides.
|
|
1137
|
+
* @category Loyalty
|
|
1104
1138
|
*/
|
|
1105
1139
|
type RedemptionType = 'bonus' | 'cash' | 'free_bet' | (string & {});
|
|
1106
1140
|
/**
|
|
1107
|
-
*
|
|
1108
|
-
* @category
|
|
1141
|
+
* The player's loyalty status (`GET /loyalty`).
|
|
1142
|
+
* @category Loyalty
|
|
1109
1143
|
*/
|
|
1110
1144
|
interface LoyaltyStatus {
|
|
1111
|
-
/** Total
|
|
1145
|
+
/** Total points earned (integer). */
|
|
1112
1146
|
totalPointsEarned: number;
|
|
1113
|
-
/**
|
|
1147
|
+
/** Points available for redemption (integer). */
|
|
1114
1148
|
currentPoints: number;
|
|
1115
|
-
/**
|
|
1149
|
+
/** Points already redeemed (integer). */
|
|
1116
1150
|
pointsRedeemed: number;
|
|
1117
|
-
/**
|
|
1151
|
+
/** 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
1152
|
currentTier: string | null;
|
|
1119
|
-
/**
|
|
1153
|
+
/** Points that count toward the tier (integer); the calculation rule is not reported by the contract. */
|
|
1120
1154
|
tierPoints: number;
|
|
1121
|
-
/** Total
|
|
1155
|
+
/** Total wagered over the player's lifetime, in minor units (the contract field is called `*_cents`; the currency does not come with it). */
|
|
1122
1156
|
lifetimeWagered: number;
|
|
1123
|
-
/** Total
|
|
1157
|
+
/** Total deposited over the player's lifetime, in minor units (the currency does not come with it). */
|
|
1124
1158
|
lifetimeDeposited: number;
|
|
1125
1159
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
* `onValidationIssue`
|
|
1160
|
+
* Benefits of the current tier, read from the JSON text the gateway passes along. The format is defined
|
|
1161
|
+
* by the operator (the contract only says "benefits of the current tier"): check before displaying. `null`
|
|
1162
|
+
* when it comes empty or absent, and also when it is not a valid JSON object (in this case
|
|
1163
|
+
* `onValidationIssue` is notified, without the content).
|
|
1130
1164
|
*/
|
|
1131
1165
|
tierBenefits: Record<string, unknown> | null;
|
|
1132
|
-
/**
|
|
1166
|
+
/** When the tier expires (ISO 8601, UTC); `null` when the gateway does not send it. */
|
|
1133
1167
|
tierExpiresAt: string | null;
|
|
1134
1168
|
}
|
|
1135
1169
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
* @category
|
|
1170
|
+
* Input of {@link LoyaltyApi.redeem}.
|
|
1171
|
+
* @category Loyalty
|
|
1138
1172
|
*/
|
|
1139
1173
|
interface RedeemPointsInput {
|
|
1140
|
-
/**
|
|
1174
|
+
/** Points to redeem: a safe integer > 0. */
|
|
1141
1175
|
points: number;
|
|
1142
|
-
/**
|
|
1176
|
+
/** Redemption type (non-empty text). */
|
|
1143
1177
|
redemptionType: RedemptionType;
|
|
1144
1178
|
}
|
|
1145
1179
|
/**
|
|
1146
|
-
*
|
|
1147
|
-
* @category
|
|
1180
|
+
* Result of {@link LoyaltyApi.redeem}.
|
|
1181
|
+
* @category Loyalty
|
|
1148
1182
|
*/
|
|
1149
1183
|
interface RedeemedPoints {
|
|
1150
|
-
/**
|
|
1184
|
+
/** Points actually redeemed (integer). */
|
|
1151
1185
|
redeemedPoints: number;
|
|
1152
|
-
/**
|
|
1186
|
+
/** Redemption value in minor units of `currency`; `null` when the gateway does not send it. */
|
|
1153
1187
|
value: number | null;
|
|
1154
|
-
/**
|
|
1188
|
+
/** Currency of `value`; `null` when absent. */
|
|
1155
1189
|
currency: string | null;
|
|
1156
|
-
/** Id
|
|
1190
|
+
/** Id of the bonus generated, when the redemption was into a bonus; `null` otherwise. */
|
|
1157
1191
|
bonusId: string | null;
|
|
1158
1192
|
}
|
|
1159
1193
|
/**
|
|
1160
|
-
*
|
|
1161
|
-
* @category
|
|
1194
|
+
* The player's loyalty (points and tier). Both methods require login.
|
|
1195
|
+
* @category Loyalty
|
|
1162
1196
|
*/
|
|
1163
1197
|
interface LoyaltyApi {
|
|
1164
1198
|
/**
|
|
1165
|
-
*
|
|
1199
|
+
* The player's points balance, tier and benefits.
|
|
1166
1200
|
* @example
|
|
1167
1201
|
* const loyalty = await igaming.loyalty.get()
|
|
1168
1202
|
* console.log(loyalty.currentPoints, loyalty.currentTier, loyalty.tierBenefits)
|
|
1169
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1170
|
-
* `VALIDATION_ERROR`
|
|
1203
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session. With `validation: 'strict'`,
|
|
1204
|
+
* `VALIDATION_ERROR` if `tier_benefits_json` is not a JSON object.
|
|
1171
1205
|
*/
|
|
1172
1206
|
get(params?: NoParams, options?: CallOptions): Promise<LoyaltyStatus>;
|
|
1173
1207
|
/**
|
|
1174
|
-
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1208
|
+
* Exchanges points for a bonus, cash or a free bet. It sends `Idempotency-Key` (generated per call
|
|
1209
|
+
* or the one in `options.idempotencyKey`, kept on the retry after renewing the session), **but the gateway does not
|
|
1210
|
+
* apply the idempotency middleware on this route yet**: a double click may redeem twice.
|
|
1211
|
+
* Lock the button until the call finishes.
|
|
1178
1212
|
* @example
|
|
1179
1213
|
* const result = await igaming.loyalty.redeem({ points: 500, redemptionType: 'bonus' })
|
|
1180
1214
|
* console.log(result.redeemedPoints, result.bonusId)
|
|
1181
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1182
|
-
* `redemptionType`
|
|
1183
|
-
*
|
|
1184
|
-
*
|
|
1185
|
-
* `validation: 'warn'`; `message`
|
|
1186
|
-
* `UNKNOWN`
|
|
1187
|
-
*
|
|
1215
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `points` is not an integer > 0 or
|
|
1216
|
+
* `redemptionType` is empty; `INSUFFICIENT_BALANCE` or `FAILED_PRECONDITION` when the service
|
|
1217
|
+
* refuses the redemption (always identify by `error.code`); `UNKNOWN` with `status` 200 if the gateway
|
|
1218
|
+
* answers without confirming the redemption (`success: false`, absent or malformed; it also applies in
|
|
1219
|
+
* `validation: 'warn'`; `message` is the gateway's when it comes, otherwise the SDK's). General rule:
|
|
1220
|
+
* `UNKNOWN` with a 2xx `status` = unconfirmed operation: re-read the state ({@link LoyaltyApi.get})
|
|
1221
|
+
* before trying again. `UNAUTHENTICATED` without a session.
|
|
1188
1222
|
*/
|
|
1189
1223
|
redeem(input: RedeemPointsInput, options?: CallOptions): Promise<RedeemedPoints>;
|
|
1190
1224
|
}
|
|
1191
1225
|
|
|
1192
1226
|
/**
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
* @category
|
|
1227
|
+
* Mission periodicity: `daily`, `weekly`, `event` or `permanent`. The backend stores free text:
|
|
1228
|
+
* handle the default case (a new value arrives raw in `validation: 'warn'`).
|
|
1229
|
+
* @category Missions
|
|
1196
1230
|
*/
|
|
1197
1231
|
type MissionType = 'daily' | 'weekly' | 'event' | 'permanent' | (string & {});
|
|
1198
1232
|
/**
|
|
1199
|
-
*
|
|
1200
|
-
* (
|
|
1201
|
-
*
|
|
1202
|
-
*
|
|
1203
|
-
* @category
|
|
1233
|
+
* What the player must do: `wager` (bet), `bet_count` (number of bets), `win_amount`
|
|
1234
|
+
* (win), `play_game` (play the target games) or `deposit` (deposit). The contract
|
|
1235
|
+
* does not state the unit of `targetValue`; the "Missions" page gives an unconfirmed assumption per
|
|
1236
|
+
* type.
|
|
1237
|
+
* @category Missions
|
|
1204
1238
|
*/
|
|
1205
1239
|
type MissionObjectiveType = 'wager' | 'bet_count' | 'win_amount' | 'play_game' | 'deposit' | (string & {});
|
|
1206
1240
|
/**
|
|
1207
|
-
*
|
|
1208
|
-
*
|
|
1209
|
-
* @category
|
|
1241
|
+
* Reward type: `bonus`, `free_spins`, `points` or `free_bet`. The contract does not
|
|
1242
|
+
* state the unit of `rewardValue`; the "Missions" page gives an unconfirmed assumption per type.
|
|
1243
|
+
* @category Missions
|
|
1210
1244
|
*/
|
|
1211
1245
|
type MissionRewardType = 'bonus' | 'free_spins' | 'points' | 'free_bet' | (string & {});
|
|
1212
1246
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
* @category
|
|
1247
|
+
* Status of the player's mission: `in_progress`, `completed`, `expired` or `claimed`.
|
|
1248
|
+
* @category Missions
|
|
1215
1249
|
*/
|
|
1216
1250
|
type UserMissionStatus = 'in_progress' | 'completed' | 'expired' | 'claimed' | (string & {});
|
|
1217
1251
|
/**
|
|
1218
|
-
*
|
|
1219
|
-
* @category
|
|
1252
|
+
* Active operator mission (`GET /missions`).
|
|
1253
|
+
* @category Missions
|
|
1220
1254
|
*/
|
|
1221
1255
|
interface Mission {
|
|
1222
|
-
/**
|
|
1256
|
+
/** Mission id (the same as {@link UserMission.missionId}). */
|
|
1223
1257
|
id: string;
|
|
1224
|
-
/**
|
|
1258
|
+
/** Display name. */
|
|
1225
1259
|
name: string;
|
|
1226
|
-
/**
|
|
1260
|
+
/** Description; may come empty. */
|
|
1227
1261
|
description: string;
|
|
1228
|
-
/**
|
|
1262
|
+
/** Periodicity. */
|
|
1229
1263
|
missionType: MissionType;
|
|
1230
|
-
/**
|
|
1264
|
+
/** Objective. */
|
|
1231
1265
|
objectiveType: MissionObjectiveType;
|
|
1232
1266
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
*
|
|
1235
|
-
* `bet_count`/`play_game`);
|
|
1267
|
+
* Target, an integer. The gateway contract does not state the unit (an assumption, unconfirmed:
|
|
1268
|
+
* minor units of the currency for `wager`/`win_amount`/`deposit`, a count for
|
|
1269
|
+
* `bet_count`/`play_game`); confirm with the operator before displaying.
|
|
1236
1270
|
*/
|
|
1237
1271
|
targetValue: number;
|
|
1238
|
-
/** Slug
|
|
1272
|
+
/** Slug of the game category that counts toward the target; `null` when there is no restriction. */
|
|
1239
1273
|
targetGameCategory: string | null;
|
|
1240
|
-
/** Ids
|
|
1274
|
+
/** Ids of the games that count toward the target; `[]` when there is no restriction. */
|
|
1241
1275
|
targetGames: string[];
|
|
1242
|
-
/**
|
|
1276
|
+
/** Reward type. */
|
|
1243
1277
|
rewardType: MissionRewardType;
|
|
1244
|
-
/**
|
|
1278
|
+
/** Reward value, an integer. The contract does not state the unit (an assumption on the "Missions" page, unconfirmed). */
|
|
1245
1279
|
rewardValue: number;
|
|
1246
|
-
/**
|
|
1280
|
+
/** Start of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
|
|
1247
1281
|
validFrom: string | null;
|
|
1248
|
-
/**
|
|
1282
|
+
/** End of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
|
|
1249
1283
|
validTo: string | null;
|
|
1250
1284
|
}
|
|
1251
1285
|
/**
|
|
1252
|
-
*
|
|
1253
|
-
* @category
|
|
1286
|
+
* The player's progress on a mission (`GET /my/missions`).
|
|
1287
|
+
* @category Missions
|
|
1254
1288
|
*/
|
|
1255
1289
|
interface UserMission {
|
|
1256
|
-
/**
|
|
1290
|
+
/** Progress id (of the player's mission in the period). */
|
|
1257
1291
|
id: string;
|
|
1258
|
-
/**
|
|
1292
|
+
/** Mission id ({@link Mission.id}). */
|
|
1259
1293
|
missionId: string;
|
|
1260
|
-
/**
|
|
1294
|
+
/** Mission name. */
|
|
1261
1295
|
missionName: string;
|
|
1262
|
-
/**
|
|
1296
|
+
/** Current progress, an integer; presumed to be the same unit as `targetValue` (not confirmed by the contract). */
|
|
1263
1297
|
currentProgress: number;
|
|
1264
|
-
/**
|
|
1298
|
+
/** Target, an integer. */
|
|
1265
1299
|
targetValue: number;
|
|
1266
|
-
/**
|
|
1300
|
+
/** Progress as a percentage, a number (e.g. `37.5`); computed by the service, may exceed `100`. */
|
|
1267
1301
|
progressPercentage: number;
|
|
1268
|
-
/**
|
|
1302
|
+
/** Status. */
|
|
1269
1303
|
status: UserMissionStatus;
|
|
1270
|
-
/**
|
|
1304
|
+
/** Reward type. */
|
|
1271
1305
|
rewardType: MissionRewardType;
|
|
1272
|
-
/**
|
|
1306
|
+
/** Reward value, an integer. */
|
|
1273
1307
|
rewardValue: number;
|
|
1274
|
-
/**
|
|
1308
|
+
/** End of the period (ISO 8601, UTC); `null` when the gateway does not send it. */
|
|
1275
1309
|
periodEnd: string | null;
|
|
1276
|
-
/**
|
|
1310
|
+
/** When it was completed (ISO 8601, UTC); `null` while not completed. */
|
|
1277
1311
|
completedAt: string | null;
|
|
1278
1312
|
}
|
|
1279
1313
|
/**
|
|
1280
|
-
*
|
|
1281
|
-
* @category
|
|
1314
|
+
* Input of {@link MissionsApi.list}.
|
|
1315
|
+
* @category Missions
|
|
1282
1316
|
*/
|
|
1283
1317
|
interface ListMissionsInput {
|
|
1284
|
-
/**
|
|
1318
|
+
/** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
|
|
1285
1319
|
page?: number;
|
|
1286
|
-
/**
|
|
1320
|
+
/** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
|
|
1287
1321
|
perPage?: number;
|
|
1288
1322
|
}
|
|
1289
1323
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
* @category
|
|
1324
|
+
* Operator missions and the player's progress. Both methods require login. There is no `claim()`: the
|
|
1325
|
+
* reward is automatic (inferred; see the "Missions" page).
|
|
1326
|
+
* @category Missions
|
|
1293
1327
|
*/
|
|
1294
1328
|
interface MissionsApi {
|
|
1295
1329
|
/**
|
|
1296
|
-
*
|
|
1330
|
+
* Active operator missions, paginated. The gateway lists only the active ones and has no filter by type.
|
|
1297
1331
|
* @example
|
|
1298
1332
|
* const page = await igaming.missions.list({ perPage: 20 })
|
|
1299
1333
|
* page.items.forEach((mission) => renderMission(mission.name, mission.targetValue))
|
|
1300
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1301
|
-
* `perPage`
|
|
1334
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
|
|
1335
|
+
* a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session.
|
|
1302
1336
|
*/
|
|
1303
1337
|
list(input?: ListMissionsInput, options?: CallOptions): Promise<Page<Mission>>;
|
|
1304
1338
|
/**
|
|
1305
|
-
*
|
|
1339
|
+
* The player's progress on the active missions, without pagination.
|
|
1306
1340
|
* @example
|
|
1307
1341
|
* const mine = await igaming.missions.listMine()
|
|
1308
1342
|
* const open = mine.filter((m) => m.status === 'in_progress')
|
|
1309
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1343
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session.
|
|
1310
1344
|
*/
|
|
1311
1345
|
listMine(params?: NoParams, options?: CallOptions): Promise<UserMission[]>;
|
|
1312
1346
|
}
|
|
1313
1347
|
|
|
1314
1348
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* "
|
|
1349
|
+
* Status of a referral: `pending`, `qualified`, `completed` or `expired` (the gateway's `REFERRAL_STATUS_*`,
|
|
1350
|
+
* in lowercase). The contract does not describe what takes a referral from one status to another (the
|
|
1351
|
+
* "Referrals" page only has assumptions). Handle the default case: a new value arrives raw in
|
|
1318
1352
|
* `validation: 'warn'`.
|
|
1319
|
-
* @category
|
|
1353
|
+
* @category Referrals
|
|
1320
1354
|
*/
|
|
1321
1355
|
type ReferralStatus = 'pending' | 'qualified' | 'completed' | 'expired' | 'unspecified' | (string & {});
|
|
1322
1356
|
/**
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
* @category
|
|
1357
|
+
* The player's referral code, link and totals (`GET /referrals`). Money values in minor units
|
|
1358
|
+
* (integers): the gateway sends them as a float in major units and the SDK converts.
|
|
1359
|
+
* @category Referrals
|
|
1326
1360
|
*/
|
|
1327
1361
|
interface ReferralInfo {
|
|
1328
|
-
/**
|
|
1362
|
+
/** The player's referral code; `null` when the gateway sends it empty. */
|
|
1329
1363
|
code: string | null;
|
|
1330
|
-
/**
|
|
1364
|
+
/** Referral link ready to share; `null` when the gateway sends it empty. */
|
|
1331
1365
|
link: string | null;
|
|
1332
|
-
/** Total
|
|
1366
|
+
/** Total referrals (integer). */
|
|
1333
1367
|
totalReferrals: number;
|
|
1334
|
-
/**
|
|
1368
|
+
/** Completed referrals (integer). */
|
|
1335
1369
|
completedReferrals: number;
|
|
1336
|
-
/**
|
|
1370
|
+
/** Pending referrals (integer). */
|
|
1337
1371
|
pendingReferrals: number;
|
|
1338
|
-
/** Total
|
|
1372
|
+
/** Total earned from referrals, in minor units (the currency does not come with it). */
|
|
1339
1373
|
totalEarned: number;
|
|
1340
|
-
/**
|
|
1374
|
+
/** Bonus per referral, in minor units (the currency does not come with it). */
|
|
1341
1375
|
bonusPerReferral: number;
|
|
1342
|
-
/**
|
|
1376
|
+
/** Referee's minimum deposit, in minor units (the currency does not come with it). */
|
|
1343
1377
|
minDeposit: number;
|
|
1344
1378
|
}
|
|
1345
1379
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
*
|
|
1348
|
-
* @category
|
|
1380
|
+
* A referral from the history (`GET /referrals/history`). Referee data: the email only comes out
|
|
1381
|
+
* masked and the gateway's `referee_id` is not exposed.
|
|
1382
|
+
* @category Referrals
|
|
1349
1383
|
*/
|
|
1350
1384
|
interface Referral {
|
|
1351
|
-
/**
|
|
1385
|
+
/** Referral id. */
|
|
1352
1386
|
id: string;
|
|
1353
|
-
/**
|
|
1387
|
+
/** Referee's name, as the gateway sends it; `null` when empty. It is personal data: do not log it. */
|
|
1354
1388
|
refereeName: string | null;
|
|
1355
1389
|
/**
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
* `null`
|
|
1390
|
+
* Referee's masked email: first character of the local part and one `*` per remaining character,
|
|
1391
|
+
* whole domain (`ana@exemplo.com` → `a**@exemplo.com`; a 1-character local part becomes `*`).
|
|
1392
|
+
* `null` when the gateway sends empty or something that is not an email. The raw email is never exposed.
|
|
1359
1393
|
*/
|
|
1360
1394
|
refereeEmailMasked: string | null;
|
|
1361
|
-
/**
|
|
1395
|
+
/** Referral code used. */
|
|
1362
1396
|
code: string;
|
|
1363
|
-
/**
|
|
1397
|
+
/** Status. */
|
|
1364
1398
|
status: ReferralStatus;
|
|
1365
|
-
/**
|
|
1399
|
+
/** Referrer's bonus, in minor units. */
|
|
1366
1400
|
referrerBonus: number;
|
|
1367
|
-
/**
|
|
1401
|
+
/** Referee's bonus, in minor units. */
|
|
1368
1402
|
refereeBonus: number;
|
|
1369
|
-
/**
|
|
1403
|
+
/** When the referral was created (ISO 8601, UTC); `null` if the gateway does not send it. */
|
|
1370
1404
|
createdAt: string | null;
|
|
1371
|
-
/**
|
|
1405
|
+
/** When it was completed (ISO 8601, UTC); `null` while not completed. */
|
|
1372
1406
|
completedAt: string | null;
|
|
1373
|
-
/**
|
|
1407
|
+
/** When it expires (ISO 8601, UTC); `null` when it does not expire or the gateway does not send it. */
|
|
1374
1408
|
expiresAt: string | null;
|
|
1375
1409
|
}
|
|
1376
1410
|
/**
|
|
1377
|
-
*
|
|
1378
|
-
* @category
|
|
1411
|
+
* Input of {@link ReferralsApi.listHistory}.
|
|
1412
|
+
* @category Referrals
|
|
1379
1413
|
*/
|
|
1380
1414
|
interface ListReferralsInput {
|
|
1381
|
-
/**
|
|
1415
|
+
/** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
|
|
1382
1416
|
page?: number;
|
|
1383
|
-
/**
|
|
1417
|
+
/** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
|
|
1384
1418
|
perPage?: number;
|
|
1385
1419
|
}
|
|
1386
1420
|
/**
|
|
1387
|
-
*
|
|
1388
|
-
* @category
|
|
1421
|
+
* Page of the referral history, with the totals across all pages.
|
|
1422
|
+
* @category Referrals
|
|
1389
1423
|
*/
|
|
1390
1424
|
type ReferralHistory = Page<Referral> & {
|
|
1391
|
-
/**
|
|
1425
|
+
/** How many referrals are completed, across all pages (integer). */
|
|
1392
1426
|
completedCount: number;
|
|
1393
|
-
/** Total
|
|
1427
|
+
/** Total earned from referrals, in minor units (the currency does not come with it). */
|
|
1394
1428
|
totalEarned: number;
|
|
1395
1429
|
};
|
|
1396
1430
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
* @category
|
|
1431
|
+
* Input of {@link ReferralsApi.register}.
|
|
1432
|
+
* @category Referrals
|
|
1399
1433
|
*/
|
|
1400
1434
|
interface RegisterReferralInput {
|
|
1401
|
-
/**
|
|
1435
|
+
/** Another player's referral code (non-empty text; leading and trailing spaces are removed). */
|
|
1402
1436
|
code: string;
|
|
1403
1437
|
}
|
|
1404
1438
|
/**
|
|
1405
|
-
*
|
|
1406
|
-
* @category
|
|
1439
|
+
* Referral registered by {@link ReferralsApi.register}.
|
|
1440
|
+
* @category Referrals
|
|
1407
1441
|
*/
|
|
1408
1442
|
interface RegisteredReferral {
|
|
1409
|
-
/**
|
|
1443
|
+
/** Referral id. */
|
|
1410
1444
|
id: string;
|
|
1411
|
-
/**
|
|
1445
|
+
/** Referral code registered. */
|
|
1412
1446
|
code: string;
|
|
1413
|
-
/**
|
|
1447
|
+
/** Initial status (probably `pending`; the contract does not say). */
|
|
1414
1448
|
status: ReferralStatus;
|
|
1415
|
-
/**
|
|
1449
|
+
/** Referee's bonus, in minor units. */
|
|
1416
1450
|
refereeBonus: number;
|
|
1417
|
-
/**
|
|
1451
|
+
/** When it was created (ISO 8601, UTC); `null` if the gateway does not send it. */
|
|
1418
1452
|
createdAt: string | null;
|
|
1419
1453
|
}
|
|
1420
1454
|
/**
|
|
1421
|
-
*
|
|
1422
|
-
* `auth.register({ referralCode })
|
|
1423
|
-
* @category
|
|
1455
|
+
* The player's referrals. All three methods require login. Whoever is signing up passes the code in the core's
|
|
1456
|
+
* `auth.register({ referralCode })`; the `register` here is for someone who already has an account.
|
|
1457
|
+
* @category Referrals
|
|
1424
1458
|
*/
|
|
1425
1459
|
interface ReferralsApi {
|
|
1426
1460
|
/**
|
|
1427
|
-
*
|
|
1461
|
+
* The player's referral code, link and totals.
|
|
1428
1462
|
* @example
|
|
1429
1463
|
* const referral = await igaming.referrals.get()
|
|
1430
1464
|
* console.log(referral.code, referral.link, referral.totalEarned)
|
|
1431
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1432
|
-
*
|
|
1465
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in `validation: 'strict'`
|
|
1466
|
+
* if a money value is not a finite number or if a counter is not an integer ≥ 0.
|
|
1433
1467
|
*/
|
|
1434
1468
|
get(params?: NoParams, options?: CallOptions): Promise<ReferralInfo>;
|
|
1435
1469
|
/**
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1470
|
+
* Referral history, paginated. Pagination comes inside `data` (not in the envelope's `meta`):
|
|
1471
|
+
* the SDK builds the `Page` and computes `totalPages` (`0` without items); a page beyond the end returns
|
|
1438
1472
|
* `items: []`.
|
|
1439
1473
|
* @example
|
|
1440
1474
|
* const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
|
|
1441
1475
|
* items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
|
|
1442
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1443
|
-
* `perPage`
|
|
1444
|
-
* `validation: 'strict'`
|
|
1476
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) for a `page` that is not an integer ≥ 1 or
|
|
1477
|
+
* a `perPage` outside 1–100 or not an integer; `UNAUTHENTICATED` without a session; `VALIDATION_ERROR` in
|
|
1478
|
+
* `validation: 'strict'` if the status is unknown or the money is not a finite number.
|
|
1445
1479
|
*/
|
|
1446
1480
|
listHistory(input?: ListReferralsInput, options?: CallOptions): Promise<ReferralHistory>;
|
|
1447
1481
|
/**
|
|
1448
|
-
*
|
|
1482
|
+
* Registers another player's referral code on the logged-in account (after signup). Answers
|
|
1449
1483
|
* HTTP 201.
|
|
1450
1484
|
* @example
|
|
1451
1485
|
* const result = await igaming.referrals.register({ code: 'ANA123' })
|
|
1452
1486
|
* console.log(result.status, result.refereeBonus)
|
|
1453
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR` (
|
|
1454
|
-
* `UNAUTHENTICATED`
|
|
1455
|
-
*
|
|
1487
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` (without a request) if `code` is not non-empty text;
|
|
1488
|
+
* `UNAUTHENTICATED` without a session; the service refuses a nonexistent, already used or out-of-rule code:
|
|
1489
|
+
* decide by `error.code` (the contract does not list the codes).
|
|
1456
1490
|
*/
|
|
1457
1491
|
register(input: RegisterReferralInput, options?: CallOptions): Promise<RegisteredReferral>;
|
|
1458
1492
|
}
|
|
1459
1493
|
|
|
1460
1494
|
/**
|
|
1461
|
-
*
|
|
1495
|
+
* FIRST sportsbook session created by {@link SportsbookApi.createSession}.
|
|
1462
1496
|
*
|
|
1463
|
-
* **
|
|
1464
|
-
*
|
|
1497
|
+
* **Sensitive:** `launchUrl` carries the player's operator token (`operatorToken`). Use it only to
|
|
1498
|
+
* open the sportsbook (iframe) and never log it to logs, analytics, error tracking.
|
|
1465
1499
|
* @category Sportsbook
|
|
1466
1500
|
*/
|
|
1467
1501
|
interface SportsbookSession {
|
|
1468
1502
|
/**
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1503
|
+
* FIRST sportsbook URL already with the operator token in the query — do not log it. Always
|
|
1504
|
+
* absolute (http/https); a response with anything else is `VALIDATION_ERROR`.
|
|
1471
1505
|
*/
|
|
1472
1506
|
launchUrl: string;
|
|
1473
|
-
/**
|
|
1507
|
+
/** Session validity from the response, in seconds (always greater than zero). */
|
|
1474
1508
|
expiresInSeconds: number;
|
|
1475
1509
|
/**
|
|
1476
|
-
*
|
|
1477
|
-
*
|
|
1510
|
+
* Expiration instant in milliseconds since the epoch (like `Date.now()`): the client's clock at the
|
|
1511
|
+
* moment of the response plus `expiresInSeconds * 1000`. Reuse the session until `expiresAt - 30_000`.
|
|
1478
1512
|
*/
|
|
1479
1513
|
expiresAt: number;
|
|
1480
1514
|
}
|
|
1481
1515
|
/**
|
|
1482
|
-
*
|
|
1483
|
-
* `enginex.config.getSportsbook()
|
|
1516
|
+
* FIRST sportsbook (`GET /first/session`). The provider and the configuration come from
|
|
1517
|
+
* the core's `enginex.config.getSportsbook()`.
|
|
1484
1518
|
* @category Sportsbook
|
|
1485
1519
|
*/
|
|
1486
1520
|
interface SportsbookApi {
|
|
1487
1521
|
/**
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* `enginex.config.getSportsbook()`
|
|
1522
|
+
* Creates the FIRST session for the logged-in player: returns the sportsbook URL (with the
|
|
1523
|
+
* operator token) to load in an iframe. Requires login. There is no cache in the SDK: each call generates a new
|
|
1524
|
+
* token; reuse the session until `expiresAt - 30_000` and call
|
|
1525
|
+
* `enginex.config.getSportsbook()` first to confirm `enabled && provider === 'first'`.
|
|
1492
1526
|
*
|
|
1493
|
-
* **
|
|
1494
|
-
* (`onRequest`/`onResponse`/`onError`)
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1527
|
+
* **The returned URL carries the operator token.** The SDK delivers it only in the return value: no hook
|
|
1528
|
+
* (`onRequest`/`onResponse`/`onError`) nor `onValidationIssue` receives it, and the response is always
|
|
1529
|
+
* validated in strict mode. The separate token (`operator_token`) is never exposed. Do not log the URL
|
|
1530
|
+
* to logs, analytics or error tracking.
|
|
1497
1531
|
* @example
|
|
1498
1532
|
* const sb = await enginex.config.getSportsbook()
|
|
1499
1533
|
* if (sb.enabled && sb.provider === 'first') {
|
|
1500
1534
|
* const { launchUrl, expiresAt } = await igaming.sportsbook.createSession()
|
|
1501
1535
|
* iframe.src = launchUrl
|
|
1502
1536
|
* }
|
|
1503
|
-
* @throws {EnginexError} `UNAUTHENTICATED`
|
|
1504
|
-
*
|
|
1505
|
-
*
|
|
1506
|
-
*
|
|
1507
|
-
* http(s)
|
|
1537
|
+
* @throws {EnginexError} `UNAUTHENTICATED` without a session; the gateway envelope's code when FIRST
|
|
1538
|
+
* is not enabled for the operator (HTTP 400) and `UNAVAILABLE` (503) when the FIRST configuration is
|
|
1539
|
+
* incomplete, the session service is down or the bets service's sportsbook configuration
|
|
1540
|
+
* is not available; `VALIDATION_ERROR` if `launch_url` is not an
|
|
1541
|
+
* absolute http(s) URL or `expires_in_seconds` is not greater than zero.
|
|
1508
1542
|
*/
|
|
1509
1543
|
createSession(params?: NoParams, options?: CallOptions): Promise<SportsbookSession>;
|
|
1510
1544
|
}
|
|
1511
1545
|
|
|
1512
1546
|
/**
|
|
1513
|
-
*
|
|
1514
|
-
*
|
|
1547
|
+
* iGaming namespaces of an SDK client, returned by {@link createIgaming}. Every request
|
|
1548
|
+
* goes through the app's client: same session, token renewal, tenant, locale, hooks, validation and
|
|
1515
1549
|
* `dispose()`.
|
|
1516
|
-
* @category
|
|
1550
|
+
* @category Client
|
|
1517
1551
|
*/
|
|
1518
1552
|
interface IgamingClient {
|
|
1519
|
-
/**
|
|
1553
|
+
/** Catalog, game launch and casino history. */
|
|
1520
1554
|
casino: CasinoApi;
|
|
1521
|
-
/**
|
|
1555
|
+
/** Bonus campaigns (offers, opt-in, redemption) and promo codes. */
|
|
1522
1556
|
bonus: BonusApi;
|
|
1523
|
-
/**
|
|
1557
|
+
/** Operator missions and the player's progress. */
|
|
1524
1558
|
missions: MissionsApi;
|
|
1525
|
-
/**
|
|
1559
|
+
/** Loyalty: points balance, tier, benefits and redemption. */
|
|
1526
1560
|
loyalty: LoyaltyApi;
|
|
1527
|
-
/**
|
|
1561
|
+
/** Referrals: code and link, history (the referee's email masked) and code registration. */
|
|
1528
1562
|
referrals: ReferralsApi;
|
|
1529
|
-
/**
|
|
1563
|
+
/** FIRST sportsbook: session to open the sportsbook in an iframe. */
|
|
1530
1564
|
sportsbook: SportsbookApi;
|
|
1531
1565
|
}
|
|
1532
1566
|
/**
|
|
1533
|
-
*
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1567
|
+
* Creates the iGaming namespaces on top of a `@getenginex/sdk` client. It creates no session, tenant or
|
|
1568
|
+
* transport of its own and makes no request: call it once per client (in the browser, one per app;
|
|
1569
|
+
* on the server, one per request, together with the client).
|
|
1536
1570
|
*
|
|
1537
|
-
*
|
|
1538
|
-
*
|
|
1539
|
-
* @param client -
|
|
1571
|
+
* After `enginex.dispose()`, `createIgaming` still accepts the client, but every iGaming method
|
|
1572
|
+
* rejects with `CONFIGURATION_ERROR`, like the core methods.
|
|
1573
|
+
* @param client - The client returned by `createEnginexClient` (the object itself, not a copy).
|
|
1540
1574
|
* @example
|
|
1541
1575
|
* import { createEnginexClient } from '@getenginex/sdk'
|
|
1542
1576
|
* import { createIgaming } from '@getenginex/sdk-igaming'
|
|
1543
1577
|
*
|
|
1544
1578
|
* export const enginex = createEnginexClient({ locale: 'pt-BR' })
|
|
1545
1579
|
* export const igaming = createIgaming(enginex)
|
|
1546
|
-
* @throws {EnginexError} `CONFIGURATION_ERROR`
|
|
1547
|
-
* `createEnginexClient` (
|
|
1548
|
-
*
|
|
1549
|
-
*
|
|
1550
|
-
* @category
|
|
1580
|
+
* @throws {EnginexError} `CONFIGURATION_ERROR` if `client` is not a client created by
|
|
1581
|
+
* `createEnginexClient` (e.g. an arbitrary object or a `{ ...enginex }` copy), or if it was created
|
|
1582
|
+
* by an incompatible copy of `@getenginex/sdk` (install a single core version). Identify
|
|
1583
|
+
* with `isEnginexError(error, 'CONFIGURATION_ERROR')`.
|
|
1584
|
+
* @category Client
|
|
1551
1585
|
*/
|
|
1552
1586
|
declare function createIgaming(client: EnginexClient): IgamingClient;
|
|
1553
1587
|
|
|
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 };
|
|
1588
|
+
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 LaunchTarget, 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 };
|