@getenginex/sdk-igaming 0.0.0-stage → 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.
@@ -0,0 +1,1588 @@
1
+ import { CursorPageInput, CallOptions, CursorPage, Page, NoParams, EnginexClient } from '@getenginex/sdk';
2
+
3
+ /**
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
+ */
8
+ interface CampaignMoney {
9
+ /** Value in minor units of `currency` (the gateway sends it as text; the SDK converts). */
10
+ amount: number;
11
+ /** Currency code, e.g. `BRL`. */
12
+ currency: string;
13
+ }
14
+ /**
15
+ * Time window (ISO 8601, UTC). A missing side is left open.
16
+ * @category Bonus
17
+ */
18
+ interface CampaignTimeWindow {
19
+ /** Start. */
20
+ startsAt?: string;
21
+ /** End. */
22
+ endsAt?: string;
23
+ }
24
+ /**
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
+ */
29
+ interface CampaignExactRatio {
30
+ /** Exact decimal value as text (do not convert to `number` if you need precision). */
31
+ decimal?: string;
32
+ /** Value in basis points: `10000` = 100%. */
33
+ basisPoints?: number;
34
+ /** Maximum decimal places of the result. */
35
+ maximumScale: number;
36
+ }
37
+ /**
38
+ * Rounding mode of a campaign calculation.
39
+ * @category Bonus
40
+ */
41
+ type CampaignRoundingMode = 'floor' | 'half_up' | 'ceiling' | 'unspecified' | (string & {});
42
+ /**
43
+ * Product where the campaign applies.
44
+ * @category Bonus
45
+ */
46
+ type CampaignProductScope = 'casino' | 'sportsbook' | 'casino_and_sportsbook' | 'unspecified' | (string & {});
47
+ /**
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
+ */
53
+ type CampaignEntryPolicyCode = 'automatic' | 'opt_in' | 'promo_code' | 'manual' | 'unspecified' | (string & {});
54
+ /**
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
+ */
59
+ type CampaignRewardClaimPolicyCode = 'automatic' | 'player_claim' | 'unspecified' | (string & {});
60
+ /**
61
+ * Reward type: balance credit, free spins, free bet or sports bet coverage.
62
+ * @category Bonus
63
+ */
64
+ type CampaignRewardKind = 'balance_credit' | 'casino_free_spins' | 'sports_bonus_bet' | 'sports_bet_coverage' | 'unspecified' | (string & {});
65
+ /**
66
+ * Versioned policy (code + version).
67
+ * @category Bonus
68
+ */
69
+ interface CampaignPolicy<C extends string> {
70
+ /** Policy code. */
71
+ code: C;
72
+ /** Policy version. @beta */
73
+ version: number;
74
+ }
75
+ /**
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
+ * @beta
79
+ * @category Bonus
80
+ */
81
+ interface CasinoActivitySelector {
82
+ /** Provider instance. */
83
+ providerInstanceId: string;
84
+ /** Provider software. */
85
+ softwareIds: string[];
86
+ /** Games. */
87
+ gameIds: string[];
88
+ /** Categories (catalog slugs). */
89
+ categoryCodes: string[];
90
+ }
91
+ /**
92
+ * Sports bet type.
93
+ * @category Bonus
94
+ */
95
+ type SportsBetType = 'single' | 'multiple' | 'system' | 'unspecified' | (string & {});
96
+ /**
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
+ * @beta
100
+ * @category Bonus
101
+ */
102
+ interface SportsActivitySelector {
103
+ /** Sports. */
104
+ sportCodes: string[];
105
+ /** Competitions. */
106
+ competitionIds: string[];
107
+ /** Events. */
108
+ eventIds: string[];
109
+ /** Markets. */
110
+ marketCodes: string[];
111
+ /** Live only (`true`), pre-match only (`false`) or both (absent). */
112
+ live?: boolean;
113
+ /** Accepted bet types. */
114
+ betTypes: SportsBetType[];
115
+ }
116
+ /**
117
+ * Qualification by a player event (e.g. completed signup).
118
+ * @category Bonus
119
+ */
120
+ interface UserEventQualification {
121
+ /** Event code. */
122
+ eventCode: string;
123
+ /** Event version. @beta */
124
+ eventVersion: number;
125
+ /** Authorized origin of the event. */
126
+ sourceAuthority: string;
127
+ /** Fields that identify the event. */
128
+ identityFields: string[];
129
+ }
130
+ /**
131
+ * Qualification by a confirmed deposit.
132
+ * @category Bonus
133
+ */
134
+ interface DepositSettledQualification {
135
+ /** Deposit currency. */
136
+ currency: string;
137
+ /** Accepted payment methods (e.g. `pix`); empty = all. */
138
+ eligibleMethodCodes: string[];
139
+ /** `required` (only the first deposit), `excluded` (never the first) or `any`. */
140
+ firstDepositPolicy: 'any' | 'required' | 'excluded' | 'unspecified' | (string & {});
141
+ /** Minimum deposit. */
142
+ minimumSettledNetAmount?: CampaignMoney;
143
+ /** Maximum deposit considered. */
144
+ maximumSettledNetAmount?: CampaignMoney;
145
+ /** Value basis (e.g. `settled_net_deposit`). */
146
+ amountBasis: string;
147
+ }
148
+ /**
149
+ * Qualification by activity accumulated over a window (e.g. net loss or total wagered).
150
+ * @category Bonus
151
+ */
152
+ interface ActivityAggregateQualification {
153
+ /** `net_loss` (net loss) or `settled_stake` (total wagered and settled). */
154
+ basis: 'net_loss' | 'settled_stake' | 'unspecified' | (string & {});
155
+ /** Product considered. */
156
+ productScope: CampaignProductScope;
157
+ /** Currency. */
158
+ currency: string;
159
+ /** Accumulation window, in seconds. */
160
+ window?: number;
161
+ /** Window time zone. */
162
+ timezone: string;
163
+ /** Tolerance for late events, in seconds. */
164
+ lateEventGrace?: number;
165
+ /** Casino slice. */
166
+ casino?: CasinoActivitySelector;
167
+ /** Sports betting slice. */
168
+ sportsbook?: SportsActivitySelector;
169
+ }
170
+ /**
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
+ */
175
+ interface CampaignQualification {
176
+ /** Definition version. @beta */
177
+ version: number;
178
+ /** Qualifies on joining. */
179
+ immediate?: Record<string, never>;
180
+ /** Qualifies with a player event. */
181
+ userEvent?: UserEventQualification;
182
+ /** Qualifies with a deposit. */
183
+ depositSettled?: DepositSettledQualification;
184
+ /** Qualifies with accumulated activity. */
185
+ activityAggregate?: ActivityAggregateQualification;
186
+ }
187
+ /**
188
+ * Reward validity: only one of the cases is filled in.
189
+ * @category Bonus
190
+ */
191
+ interface CampaignRewardValidity {
192
+ /** Does not expire. */
193
+ noExpiry?: Record<string, never>;
194
+ /** Expires on a fixed date. */
195
+ absoluteExpiry?: {
196
+ /** Expiration date, ISO 8601 (UTC). */
197
+ expiresAt?: string;
198
+ };
199
+ /** Expires some time after the grant. */
200
+ durationFromGrant?: {
201
+ /** Duration, in seconds. */
202
+ duration?: number;
203
+ };
204
+ }
205
+ /**
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
+ */
210
+ interface CampaignPercentCalculation {
211
+ /** Percentage. */
212
+ percentage?: CampaignExactRatio;
213
+ /** Rounding. */
214
+ rounding: CampaignRoundingMode;
215
+ /** Minimum reward. */
216
+ minimumReward?: CampaignMoney;
217
+ /** Maximum reward. */
218
+ maximumReward?: CampaignMoney;
219
+ }
220
+ /**
221
+ * Balance credit reward. The value comes from one of the three calculations.
222
+ * @category Bonus
223
+ */
224
+ interface BalanceCreditReward {
225
+ /** Fixed value. */
226
+ fixedAmount?: {
227
+ /** Reward value. */
228
+ amount?: CampaignMoney;
229
+ };
230
+ /** Percentage of the source value (e.g. of the deposit). */
231
+ percentOfSourceAmount?: CampaignPercentCalculation;
232
+ /** Rebate over an accumulated amount. */
233
+ aggregateRebate?: {
234
+ /** Percentage. */
235
+ percentage?: CampaignExactRatio;
236
+ /** Rounding. */
237
+ rounding: CampaignRoundingMode;
238
+ /** Minimum base for there to be a reward. */
239
+ minimumBasis?: CampaignMoney;
240
+ /** Maximum reward. */
241
+ maximumReward?: CampaignMoney;
242
+ };
243
+ /** Balance credited: `real` or `restricted` (bonus, with usage rules). */
244
+ balanceClass: 'real' | 'restricted' | 'unspecified' | (string & {});
245
+ /** Winnings from the reward: `real` or restricted until the rollover is met. */
246
+ proceedsClass: 'real' | 'restricted_until_wagering_completion' | 'unspecified' | (string & {});
247
+ /** Validity. */
248
+ validity?: CampaignRewardValidity;
249
+ }
250
+ /**
251
+ * Free spins reward.
252
+ * @category Bonus
253
+ */
254
+ interface CasinoFreeSpinsReward {
255
+ /** Spin provider. */
256
+ providerCode: string;
257
+ /** Games where the spins apply. */
258
+ casinoScope?: CasinoActivitySelector;
259
+ /** Number of spins. */
260
+ quantity: number;
261
+ /** Value of each spin. */
262
+ denomination?: CampaignMoney;
263
+ /** Currency. */
264
+ currency: string;
265
+ /** Window to use the spins. */
266
+ grantWindow?: CampaignTimeWindow;
267
+ /** Winnings from the spins: `real` or restricted until the rollover is met. */
268
+ proceedsClass: 'real' | 'restricted_until_wagering_completion' | 'unspecified' | (string & {});
269
+ /** Maximum win. */
270
+ maximumWinnings?: CampaignMoney;
271
+ }
272
+ /**
273
+ * Free sports bet reward.
274
+ * @category Bonus
275
+ */
276
+ interface SportsBonusBetReward {
277
+ /** Sportsbook provider. */
278
+ providerCode: string;
279
+ /** Where the bet applies. */
280
+ sportsbookScope?: SportsActivitySelector;
281
+ /** Value of each bet. */
282
+ amount?: CampaignMoney;
283
+ /** Number of bets. */
284
+ quantity: number;
285
+ /** Validity. */
286
+ validity?: CampaignRewardValidity;
287
+ }
288
+ /**
289
+ * Sports bet coverage reward (returns the lost bet up to a cap).
290
+ * @category Bonus
291
+ */
292
+ interface SportsBetCoverageReward {
293
+ /** Sportsbook provider. */
294
+ providerCode: string;
295
+ /** Bets covered. */
296
+ qualifyingBetScope?: SportsActivitySelector;
297
+ /** Cap of the coverage. */
298
+ coverageCap?: CampaignMoney;
299
+ /** Validity. */
300
+ validity?: CampaignRewardValidity;
301
+ }
302
+ /**
303
+ * Maximum bet with bonus balance.
304
+ * Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
305
+ * @beta
306
+ * @category Bonus
307
+ */
308
+ interface CampaignMaximumBet {
309
+ /** `product_limit_only` (only the product's limit) or `campaign_maximum` (the `campaignMaximum` one). */
310
+ mode: 'product_limit_only' | 'campaign_maximum' | 'unspecified' | (string & {});
311
+ /** Maximum bet of the campaign. */
312
+ campaignMaximum?: CampaignMoney;
313
+ }
314
+ /**
315
+ * Sports betting odds rules.
316
+ * Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
317
+ * @beta
318
+ * @category Bonus
319
+ */
320
+ interface CampaignOddsPolicy {
321
+ /** `all_product_accepted_odds` or `threshold` (uses the minimums below). */
322
+ mode: 'all_product_accepted_odds' | 'threshold' | 'unspecified' | (string & {});
323
+ /** Minimum total odds, decimal as text. */
324
+ minimumTotalOddsDecimal?: string;
325
+ /** Minimum odds per selection, decimal as text. */
326
+ minimumOddsPerLegDecimal?: string;
327
+ /** Minimum number of selections. */
328
+ minimumLegs?: number;
329
+ /** Maximum number of selections. */
330
+ maximumLegs?: number;
331
+ }
332
+ /**
333
+ * Cash out of bets made with restricted balance.
334
+ * Mirrors the bonus service protobuf and may change in 0.x (minor) versions.
335
+ * @beta
336
+ * @category Bonus
337
+ */
338
+ type CampaignCashoutMode = 'disallow_for_restricted_funding' | 'allow_without_wagering_contribution' | 'unspecified' | (string & {});
339
+ /**
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
+ * @beta
344
+ * @category Bonus
345
+ */
346
+ interface CampaignUsePolicy {
347
+ /** Version. */
348
+ version: number;
349
+ /** Consumption order: `real_then_restricted` or `restricted_then_real`. */
350
+ fundsConsumption?: CampaignPolicy<'real_then_restricted' | 'restricted_then_real' | 'unspecified' | (string & {})>;
351
+ /** Casino use. */
352
+ casino?: {
353
+ /** Allowed slices. */
354
+ allowedScopes: CasinoActivitySelector[];
355
+ /** Maximum bet. */
356
+ maximumBet?: CampaignMaximumBet;
357
+ };
358
+ /** Sports betting use. */
359
+ sportsbook?: {
360
+ /** Allowed slices. */
361
+ allowedScopes: SportsActivitySelector[];
362
+ /** Excluded slices. */
363
+ excludedScopes: SportsActivitySelector[];
364
+ /** Maximum bet. */
365
+ maximumBet?: CampaignMaximumBet;
366
+ /** Required odds. */
367
+ fundingOdds?: CampaignOddsPolicy;
368
+ /** Cash out. */
369
+ cashoutMode: CampaignCashoutMode;
370
+ };
371
+ /** Use in casino and sports betting. */
372
+ casinoAndSportsbook?: {
373
+ /** Allowed casino slices. */
374
+ allowedCasinoScopes: CasinoActivitySelector[];
375
+ /** Allowed sports slices. */
376
+ allowedSportsbookScopes: SportsActivitySelector[];
377
+ /** Excluded sports slices. */
378
+ excludedSportsbookScopes: SportsActivitySelector[];
379
+ /** Maximum casino bet. */
380
+ maximumCasinoBet?: CampaignMaximumBet;
381
+ /** Maximum sports bet. */
382
+ maximumSportsbookBet?: CampaignMaximumBet;
383
+ /** Required odds. */
384
+ sportsbookFundingOdds?: CampaignOddsPolicy;
385
+ /** Cash out. */
386
+ sportsbookCashoutMode: CampaignCashoutMode;
387
+ };
388
+ /** Split of winnings between real and restricted balance (e.g. `proportional_to_funding`). */
389
+ payoutAllocation?: CampaignPolicy<string>;
390
+ }
391
+ /**
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
+ * @beta
395
+ * @category Bonus
396
+ */
397
+ interface CampaignWageringPolicy {
398
+ /** Version. */
399
+ version: number;
400
+ /** No rollover. */
401
+ none?: Record<string, never>;
402
+ /** Rollover by multiplier (e.g. 30x the bonus). */
403
+ multiplier?: {
404
+ /** Basis: `granted_balance` (the bonus granted) or `reward_proceeds` (the reward's winnings). */
405
+ requirementBasis: 'granted_balance' | 'reward_proceeds' | 'unspecified' | (string & {});
406
+ /** Multiplier (e.g. `{ decimal: '30' }` = 30x). */
407
+ multiplier?: CampaignExactRatio;
408
+ /** How much each bet type counts toward the rollover. */
409
+ contributionRates: {
410
+ /** Casino slice. */
411
+ casino?: CasinoActivitySelector;
412
+ /** Sports slice. */
413
+ sportsbook?: SportsActivitySelector;
414
+ /** Contribution rate (10000 basis points = 100%). */
415
+ rate?: CampaignExactRatio;
416
+ }[];
417
+ /** Deadline to complete. */
418
+ deadline?: CampaignRewardValidity;
419
+ /** Rounding. */
420
+ rounding: CampaignRoundingMode;
421
+ /** Minimum odds for the sports bet to count. */
422
+ sportsbookContributionOdds?: CampaignOddsPolicy;
423
+ };
424
+ }
425
+ /**
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
+ * @beta
429
+ * @category Bonus
430
+ */
431
+ interface CampaignStackingPolicy {
432
+ /** Version. */
433
+ version: number;
434
+ /** Exclusive in the group (one active at a time). */
435
+ exclusiveInGroup?: {
436
+ /** Group. */
437
+ stackingGroupKey: string;
438
+ };
439
+ /** Several in the group, up to a maximum per player. */
440
+ multipleInGroup?: {
441
+ /** Group. */
442
+ stackingGroupKey: string;
443
+ /** Maximum active per player. */
444
+ maximumActivePerPlayer: number;
445
+ };
446
+ }
447
+ /**
448
+ * Reward of a campaign. `rewardKind` says which of the details (`balanceCredit`, `casinoFreeSpins`,
449
+ * `sportsBonusBet`, `sportsBetCoverage`, `providerManagedBalance`) is filled in.
450
+ * @category Bonus
451
+ */
452
+ interface CampaignReward {
453
+ /** Reward key in the campaign. */
454
+ rewardKey: string;
455
+ /** Reward type. */
456
+ rewardKind: CampaignRewardKind;
457
+ /** Type version. @beta */
458
+ rewardKindVersion: number;
459
+ /** Who executes the reward (e.g. `engine_managed_balance`, `provider_entitlement`). @beta */
460
+ executionProfileCode: 'engine_managed_balance' | 'provider_managed_balance' | 'provider_entitlement' | 'unspecified' | (string & {});
461
+ /** Execution profile version. @beta */
462
+ executionProfileVersion: number;
463
+ /** Balance credit. */
464
+ balanceCredit?: BalanceCreditReward;
465
+ /** Provider-managed balance. */
466
+ providerManagedBalance?: {
467
+ /** Provider. */
468
+ providerCode: string;
469
+ };
470
+ /** Free spins. */
471
+ casinoFreeSpins?: CasinoFreeSpinsReward;
472
+ /** Free sports bet. */
473
+ sportsBonusBet?: SportsBonusBetReward;
474
+ /** Sports bet coverage. */
475
+ sportsBetCoverage?: SportsBetCoverageReward;
476
+ /** Where the bonus balance can be used. */
477
+ usePolicy?: CampaignUsePolicy;
478
+ /** Rollover. */
479
+ wageringPolicy?: CampaignWageringPolicy;
480
+ /** Stacking with other campaigns. */
481
+ stackingPolicy?: CampaignStackingPolicy;
482
+ /** Consumption order among restricted balances. @beta */
483
+ restrictedPositionSelectionPolicy?: {
484
+ /** Version. */
485
+ version: number;
486
+ /** Priority and then the nearest expiration. */
487
+ priorityThenEarliestExpiry?: {
488
+ /** Selection priority. */
489
+ selectionPriority?: number;
490
+ };
491
+ };
492
+ }
493
+ /**
494
+ * Texts of a campaign in one language.
495
+ * @category Bonus
496
+ */
497
+ interface CampaignLocalizedContent {
498
+ /** Language, e.g. `pt-BR`. */
499
+ locale: string;
500
+ /** Display name. */
501
+ displayName: string;
502
+ /** Description. */
503
+ description: string;
504
+ /** Terms and conditions. */
505
+ terms: string;
506
+ /** Terms revision: send it on acceptance (`termsAcceptance.termsRevision`). */
507
+ termsRevision: string;
508
+ }
509
+ /**
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
+ */
514
+ interface CampaignContent {
515
+ /** Default language. */
516
+ defaultLocale: string;
517
+ /** Published languages. */
518
+ supportedLocales: string[];
519
+ /** Texts by language. */
520
+ localizedContent: CampaignLocalizedContent[];
521
+ }
522
+ /**
523
+ * Bonus campaign offer (a published version of the campaign).
524
+ * @category Bonus
525
+ */
526
+ interface CampaignOffer {
527
+ /** Campaign id, for {@link BonusApi.getOffer} and {@link BonusApi.optIn}. */
528
+ campaignId: string;
529
+ /** Published version, required in {@link BonusApi.optIn}. */
530
+ campaignVersionId: string;
531
+ /** Publication id. */
532
+ publicationId: string;
533
+ /** Product where it applies. */
534
+ productScope: CampaignProductScope;
535
+ /** Time zone of the windows. */
536
+ timezone: string;
537
+ /** When it is possible to join. */
538
+ enrollmentWindow?: CampaignTimeWindow;
539
+ /** When it is possible to qualify. */
540
+ qualificationWindow?: CampaignTimeWindow;
541
+ /** When it is possible to redeem (`player_claim` policy). */
542
+ claimWindow?: CampaignTimeWindow;
543
+ /** How to join: `automatic`, `opt_in`, `promo_code` or `manual`. */
544
+ entryPolicy?: CampaignPolicy<CampaignEntryPolicyCode>;
545
+ /** How to receive the reward: `automatic` or `player_claim`. */
546
+ rewardClaimPolicy?: CampaignPolicy<CampaignRewardClaimPolicyCode>;
547
+ /** What is needed to qualify. */
548
+ qualification?: CampaignQualification;
549
+ /** Reward. */
550
+ reward?: CampaignReward;
551
+ /** Publication start, ISO 8601 (UTC). */
552
+ publicationStartsAt?: string;
553
+ /** Publication end, ISO 8601 (UTC). */
554
+ publicationEndsAt?: string;
555
+ /** Texts (name, description, terms) by language. */
556
+ content?: CampaignContent;
557
+ }
558
+ /**
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
+ */
565
+ type CampaignParticipationStatus = 'enrolled' | 'qualifying' | 'qualified' | 'reward_pending' | 'completed' | 'reward_failed' | 'expired' | 'cancelled' | 'unspecified' | (string & {});
566
+ /**
567
+ * Acceptance of the terms recorded in the participation.
568
+ * @category Bonus
569
+ */
570
+ interface CampaignTermsAcceptanceRecord {
571
+ /** Language of the accepted terms. */
572
+ locale: string;
573
+ /** Accepted revision. */
574
+ termsRevision: string;
575
+ /** SHA-256 (hex) of the accepted text. */
576
+ termsDigestSha256Hex: string;
577
+ /** Acceptance date, ISO 8601 (UTC). */
578
+ acceptedAt?: string;
579
+ }
580
+ /**
581
+ * The player's participation in a campaign, with the reward and the texts as they were when they joined.
582
+ * @category Bonus
583
+ */
584
+ interface CampaignParticipation {
585
+ /** Participation id, for {@link BonusApi.claim} and {@link BonusApi.getParticipation}. */
586
+ id: string;
587
+ /** Campaign id. */
588
+ campaignId: string;
589
+ /** Campaign version the player joined. */
590
+ campaignVersionId: string;
591
+ /** Reward key. */
592
+ rewardKey: string;
593
+ /** Required qualification (a copy from the time of joining). */
594
+ qualificationSnapshot?: CampaignQualification;
595
+ /** Status. */
596
+ status: CampaignParticipationStatus;
597
+ /** When it qualified (`status: 'qualified'`). */
598
+ qualifiedAt?: string;
599
+ /** When the reward was granted (`status: 'completed'`). */
600
+ completedAt?: string;
601
+ /** When it expired (`status: 'expired'`). */
602
+ expiredAt?: string;
603
+ /** Reward, texts and terms acceptance as of the time of joining. */
604
+ snapshot?: {
605
+ /** Reward. */
606
+ reward?: CampaignReward;
607
+ /** Texts. */
608
+ content?: CampaignContent;
609
+ /** Terms acceptance, if there was one. */
610
+ termsAcceptance?: CampaignTermsAcceptanceRecord;
611
+ };
612
+ }
613
+ /**
614
+ * Terms acceptance of the campaign, sent on opt-in or on promo code redemption.
615
+ * @category Bonus
616
+ */
617
+ interface CampaignTermsAcceptance {
618
+ /** Language of the terms shown ({@link CampaignLocalizedContent.locale}). */
619
+ locale: string;
620
+ /** Revision of the terms shown ({@link CampaignLocalizedContent.termsRevision}). */
621
+ termsRevision: string;
622
+ }
623
+ /**
624
+ * Input of {@link BonusApi.optIn}.
625
+ * @category Bonus
626
+ */
627
+ interface OptInInput {
628
+ /** Campaign id ({@link CampaignOffer.campaignId}). */
629
+ campaignId: string;
630
+ /** Version shown to the player ({@link CampaignOffer.campaignVersionId}). */
631
+ campaignVersionId: string;
632
+ /** Acceptance of the terms shown. */
633
+ termsAcceptance?: CampaignTermsAcceptance;
634
+ }
635
+ /**
636
+ * Offer of a promo code, returned by {@link BonusApi.resolvePromoCode}.
637
+ * @category Bonus
638
+ */
639
+ interface PromoCodeOffer {
640
+ /** The offer. */
641
+ offer: CampaignOffer;
642
+ /** The texts in the requested language. */
643
+ localizedContent: CampaignLocalizedContent;
644
+ }
645
+ /**
646
+ * Bonus campaigns and promo codes. Only `listPublicOffers` is public; the other methods require login.
647
+ * @category Bonus
648
+ */
649
+ interface BonusApi {
650
+ /**
651
+ * Public catalog of offers (storefront, no login): it only describes the campaigns; eligibility,
652
+ * joining and participations require login. Cursor-paginated.
653
+ * @example
654
+ * const { items, nextCursor } = await igaming.bonus.listPublicOffers({ pageSize: 20 })
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
+ */
658
+ listPublicOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
659
+ /**
660
+ * Offers available to the logged-in player. Cursor-paginated.
661
+ * @example
662
+ * const { items } = await igaming.bonus.listOffers()
663
+ * const optIns = items.filter((o) => o.entryPolicy?.code === 'opt_in')
664
+ * @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
665
+ */
666
+ listOffers(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignOffer>>;
667
+ /**
668
+ * An offer available to the player.
669
+ * @example
670
+ * const offer = await igaming.bonus.getOffer({ campaignId })
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
+ */
674
+ getOffer(input: {
675
+ campaignId: string;
676
+ }, options?: CallOptions): Promise<CampaignOffer>;
677
+ /**
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
+ * @example
683
+ * const participation = await igaming.bonus.optIn(
684
+ * { campaignId: offer.campaignId, campaignVersionId: offer.campaignVersionId, termsAcceptance: { locale: 'pt-BR', termsRevision: text.termsRevision } },
685
+ * { idempotencyKey: key },
686
+ * )
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
+ */
696
+ optIn(input: OptInInput, options?: CallOptions): Promise<CampaignParticipation>;
697
+ /**
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
+ * @example
702
+ * const done = await igaming.bonus.claim({ participationId: participation.id }, { idempotencyKey: key })
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
+ */
710
+ claim(input: {
711
+ participationId: string;
712
+ }, options?: CallOptions): Promise<CampaignParticipation>;
713
+ /**
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
+ * @example
717
+ * const { offer, localizedContent } = await igaming.bonus.resolvePromoCode({ code: input.value, locale: 'pt-BR' })
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
+ */
723
+ resolvePromoCode(input: {
724
+ code: string;
725
+ locale: string;
726
+ }, options?: CallOptions): Promise<PromoCodeOffer>;
727
+ /**
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
+ * @example
732
+ * const participation = await igaming.bonus.redeemPromoCode(
733
+ * { code: 'BEMVINDO', termsAcceptance: { locale: 'pt-BR', termsRevision: localizedContent.termsRevision } },
734
+ * { idempotencyKey: key },
735
+ * )
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
+ */
745
+ redeemPromoCode(input: {
746
+ code: string;
747
+ termsAcceptance?: CampaignTermsAcceptance;
748
+ }, options?: CallOptions): Promise<CampaignParticipation>;
749
+ /**
750
+ * The player's participations. Cursor-paginated.
751
+ * @example
752
+ * const { items } = await igaming.bonus.listParticipations()
753
+ * const claimable = items.filter((p) => p.status === 'qualified')
754
+ * @throws {EnginexError} `INVALID_ARGUMENT` (400) for an invalid `pageSize`; `UNAUTHENTICATED` without a session.
755
+ */
756
+ listParticipations(input?: CursorPageInput, options?: CallOptions): Promise<CursorPage<CampaignParticipation>>;
757
+ /**
758
+ * One of the player's participations.
759
+ * @example
760
+ * const p = await igaming.bonus.getParticipation({ participationId })
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
+ */
764
+ getParticipation(input: {
765
+ participationId: string;
766
+ }, options?: CallOptions): Promise<CampaignParticipation>;
767
+ }
768
+
769
+ /**
770
+ * Casino catalog game (`GET /games`, `GET /games/{id}`).
771
+ * @category Casino
772
+ */
773
+ interface Game {
774
+ /** Game id, for {@link CasinoApi.getGame} and {@link CasinoApi.launchGame}. */
775
+ id: string;
776
+ /** Display name. */
777
+ name: string;
778
+ /**
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
+ */
782
+ provider: string;
783
+ /** Category slug (the same as {@link GameCategory.slug}), e.g. `slots`. */
784
+ category: string;
785
+ /** Game type, as the provider reports it (e.g. `slot`, `blackjack`, `roulette`); may come empty. */
786
+ type: string;
787
+ /** Cover image URL; may come empty. */
788
+ thumbnail: string;
789
+ /** Marked as new in the catalog. */
790
+ isNew: boolean;
791
+ /** Marked as popular in the catalog. */
792
+ isPopular: boolean;
793
+ /** Live game (live casino). */
794
+ isLive: boolean;
795
+ /** Supports demo mode (`launchGame({ mode: 'demo' })`). */
796
+ demoAvailable: boolean;
797
+ /** Return to player reported by the provider, as a percentage (e.g. `96.5`); `0` when not reported. */
798
+ rtp: number;
799
+ /** Volatility reported by the provider (e.g. `low`, `medium`, `high`); may come empty. */
800
+ volatility: string;
801
+ /** Sort priority set by the operator (lowest first). */
802
+ priority: number;
803
+ }
804
+ /**
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
+ */
809
+ type GameSort = 'popular' | 'new' | 'az';
810
+ /**
811
+ * Filters and pagination of {@link CasinoApi.listGames}.
812
+ * @category Casino
813
+ */
814
+ interface ListGamesInput {
815
+ /** Slug of a category from {@link CasinoApi.listCategories}. An unknown slug brings no games. */
816
+ category?: string;
817
+ /** Id of a provider from {@link CasinoApi.listProviders}. */
818
+ provider?: string;
819
+ /** Search by game name, up to 100 characters (above that, `INVALID_ARGUMENT`). */
820
+ search?: string;
821
+ /**
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
+ */
825
+ ids?: string[];
826
+ /** Ordering. An unknown value is ignored by the gateway. */
827
+ sort?: GameSort;
828
+ /** Page (starts at 1). Gateway default: 1. */
829
+ page?: number;
830
+ /** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
831
+ perPage?: number;
832
+ }
833
+ /**
834
+ * Catalog category with active games (`GET /games/categories`).
835
+ * @category Casino
836
+ */
837
+ interface GameCategory {
838
+ /** Slug, for the `category` filter of {@link CasinoApi.listGames}. */
839
+ slug: string;
840
+ /** Display name. */
841
+ name: string;
842
+ /** Icon set by the operator (name or URL, depending on the setup); may come empty. */
843
+ icon: string;
844
+ /** Number of active games in the category. */
845
+ gameCount: number;
846
+ /** Sort priority set by the operator (lowest first). */
847
+ priority: number;
848
+ }
849
+ /**
850
+ * Game provider with active games (`GET /games/providers`).
851
+ * @category Casino
852
+ */
853
+ interface GameProvider {
854
+ /**
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
+ */
858
+ id: string;
859
+ /** Display name. */
860
+ name: string;
861
+ /** Number of games. */
862
+ gameCount: number;
863
+ }
864
+ /**
865
+ * Input of {@link CasinoApi.launchGame}.
866
+ * @category Casino
867
+ */
868
+ interface LaunchGameInput {
869
+ /** Game id ({@link Game.id}). */
870
+ gameId: string;
871
+ /** `real` (default) bets with the player's balance; `demo` opens demo mode, if the game supports it ({@link Game.demoAvailable}). */
872
+ mode?: 'real' | 'demo';
873
+ /** Opens the mobile version of the game, when the provider has one. Default: `false`. */
874
+ isMobile?: boolean;
875
+ /**
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
+ */
880
+ returnUrl?: string;
881
+ /**
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
+ */
885
+ language?: string;
886
+ }
887
+ /**
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}.
897
+ *
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
901
+ */
902
+ interface GameLaunch {
903
+ /** Game session id (the same as {@link GameSession.id}). */
904
+ sessionId: string;
905
+ /**
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`).
908
+ */
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;
920
+ }
921
+ /**
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
925
+ */
926
+ type GameSessionStatus = 'active' | 'ended' | 'unspecified' | (string & {});
927
+ /**
928
+ * The player's game session (`GET /games/sessions`). Opening a game ends the previous active session.
929
+ * @category Casino
930
+ */
931
+ interface GameSession {
932
+ /** Session id. */
933
+ id: string;
934
+ /** Game id. */
935
+ gameId: string;
936
+ /** Game name. */
937
+ gameName: string;
938
+ /** Provider id. */
939
+ provider: string;
940
+ /** Session start, ISO 8601 (UTC). */
941
+ startTime: string;
942
+ /** Total wagered in the session, in minor units of the operator's currency. */
943
+ totalBet: number;
944
+ /** Total won in the session, in minor units of the operator's currency. */
945
+ totalWin: number;
946
+ /** Status, e.g. `active`. */
947
+ status: GameSessionStatus;
948
+ }
949
+ /**
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
954
+ */
955
+ type CasinoTransactionType = 'bet' | 'win' | 'refund' | 'jackpot' | 'free_spin' | 'reversal' | 'unspecified' | (string & {});
956
+ /**
957
+ * Movement of a casino round (`GET /games/history`).
958
+ * @category Casino
959
+ */
960
+ interface CasinoTransaction {
961
+ /** Movement id. */
962
+ id: string;
963
+ /** Game id. */
964
+ gameId: string;
965
+ /** Game name. */
966
+ gameName: string;
967
+ /** Round id (the bet and the prize of the same round share it). */
968
+ roundId: string;
969
+ /** Type, e.g. `bet`, `win`. */
970
+ type: CasinoTransactionType;
971
+ /** Value in minor units of `currency` (the gateway sends it as text; the SDK converts). */
972
+ amount: number;
973
+ /** Currency code, e.g. `BRL`. */
974
+ currency: string;
975
+ /** Decimal places of the currency (e.g. `2` for BRL), to format `amount`. */
976
+ currencyDecimalPlaces: number;
977
+ /** Movement date, ISO 8601 (UTC). */
978
+ createdAt: string;
979
+ }
980
+ /**
981
+ * Pagination of {@link CasinoApi.listSessions} and {@link CasinoApi.getHistory}.
982
+ * @category Casino
983
+ */
984
+ interface CasinoPageInput {
985
+ /** Page (starts at 1). Gateway default: 1. */
986
+ page?: number;
987
+ /** Items per page, from 1 to 100. Gateway default: 20 (out of range also becomes 20). */
988
+ perPage?: number;
989
+ }
990
+ /**
991
+ * Filters of {@link CasinoApi.getBiggestWinners}.
992
+ * @category Casino
993
+ */
994
+ interface GetBiggestWinnersInput {
995
+ /** How many winners (the casino service caps it; its default: 10). */
996
+ limit?: number;
997
+ /** Window in days up to now. Omitted: the casino service's default. */
998
+ days?: number;
999
+ }
1000
+ /**
1001
+ * Biggest prize of a round, for the casino home ranking (`GET /games/biggest-winners`).
1002
+ * @category Casino
1003
+ */
1004
+ interface BiggestWinner {
1005
+ /** Player name already masked by the gateway (e.g. `Jo***`); the player id never comes. */
1006
+ player: string;
1007
+ /** Prize in minor units of `currency`. */
1008
+ amount: number;
1009
+ /** Currency code, e.g. `BRL`. */
1010
+ currency: string;
1011
+ /** Decimal places of the currency, to format `amount`. */
1012
+ currencyDecimalPlaces: number;
1013
+ /** Game id. */
1014
+ gameId: string;
1015
+ /** Game name. */
1016
+ gameName: string;
1017
+ /** Prize date, ISO 8601 (UTC). */
1018
+ wonAt: string;
1019
+ }
1020
+ /**
1021
+ * Catalog, game launch and casino history. The catalog (`listGames`, `listCategories`,
1022
+ * `listProviders`, `getGame`) is public; the other methods require login.
1023
+ * @category Casino
1024
+ */
1025
+ interface CasinoApi {
1026
+ /**
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).
1029
+ *
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.
1034
+ * @example
1035
+ * const page = await igaming.casino.listGames({ category: 'slots', sort: 'popular', perPage: 24 })
1036
+ * page.items.forEach((game) => renderCard(game.name, game.thumbnail))
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.
1040
+ */
1041
+ listGames(input?: ListGamesInput, options?: CallOptions): Promise<Page<Game>>;
1042
+ /**
1043
+ * Categories with active games, to build lobby tabs/filters. Public.
1044
+ * @example
1045
+ * const categories = await igaming.casino.listCategories()
1046
+ * categories.sort((a, b) => a.priority - b.priority)
1047
+ * @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
1048
+ * service fails.
1049
+ */
1050
+ listCategories(params?: NoParams, options?: CallOptions): Promise<GameCategory[]>;
1051
+ /**
1052
+ * Providers with active games. Public.
1053
+ * @example
1054
+ * const providers = await igaming.casino.listProviders()
1055
+ * @throws {EnginexError} `UNAVAILABLE`/`PROVIDER_ERROR` (503) when the call to the casino
1056
+ * service fails.
1057
+ */
1058
+ listProviders(params?: NoParams, options?: CallOptions): Promise<GameProvider[]>;
1059
+ /**
1060
+ * A catalog game. Public.
1061
+ * @example
1062
+ * const game = await igaming.casino.getGame({ gameId: 'g-1' })
1063
+ * @throws {EnginexError} `GAME_NOT_FOUND` (404) if the id does not exist in the operator's catalog.
1064
+ */
1065
+ getGame(input: {
1066
+ gameId: string;
1067
+ }, options?: CallOptions): Promise<Game>;
1068
+ /**
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.
1072
+ *
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.
1076
+ * @example
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.
1103
+ */
1104
+ launchGame(input: LaunchGameInput, options?: CallOptions): Promise<GameLaunch>;
1105
+ /**
1106
+ * The player's game sessions, from newest to oldest, paginated.
1107
+ * @example
1108
+ * const { items } = await igaming.casino.listSessions({ perPage: 10 })
1109
+ * const active = items.find((s) => s.status === 'active')
1110
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session.
1111
+ */
1112
+ listSessions(input?: CasinoPageInput, options?: CallOptions): Promise<Page<GameSession>>;
1113
+ /**
1114
+ * The player's round history (bets, prizes, reversals), paginated.
1115
+ * @example
1116
+ * const page = await igaming.casino.getHistory({ page: 1, perPage: 20 })
1117
+ * page.items.forEach((tx) => console.log(tx.roundId, tx.type, tx.amount, tx.currency))
1118
+ * @throws {EnginexError} `INTERNAL_ERROR` (500) if the history has a currency the gateway does not
1119
+ * know; `UNAUTHENTICATED` without a session.
1120
+ */
1121
+ getHistory(input?: CasinoPageInput, options?: CallOptions): Promise<Page<CasinoTransaction>>;
1122
+ /**
1123
+ * Biggest prizes of a round in the operator's casino (home ranking), with the player's name
1124
+ * masked. Requires login.
1125
+ * @example
1126
+ * const winners = await igaming.casino.getBiggestWinners({ limit: 10, days: 7 })
1127
+ * @throws {EnginexError} `INTERNAL_ERROR` (500) if a prize comes with an unknown currency;
1128
+ * `UNAUTHENTICATED` without a session.
1129
+ */
1130
+ getBiggestWinners(input?: GetBiggestWinnersInput, options?: CallOptions): Promise<BiggestWinner[]>;
1131
+ }
1132
+
1133
+ /**
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
1138
+ */
1139
+ type RedemptionType = 'bonus' | 'cash' | 'free_bet' | (string & {});
1140
+ /**
1141
+ * The player's loyalty status (`GET /loyalty`).
1142
+ * @category Loyalty
1143
+ */
1144
+ interface LoyaltyStatus {
1145
+ /** Total points earned (integer). */
1146
+ totalPointsEarned: number;
1147
+ /** Points available for redemption (integer). */
1148
+ currentPoints: number;
1149
+ /** Points already redeemed (integer). */
1150
+ pointsRedeemed: number;
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). */
1152
+ currentTier: string | null;
1153
+ /** Points that count toward the tier (integer); the calculation rule is not reported by the contract. */
1154
+ tierPoints: number;
1155
+ /** Total wagered over the player's lifetime, in minor units (the contract field is called `*_cents`; the currency does not come with it). */
1156
+ lifetimeWagered: number;
1157
+ /** Total deposited over the player's lifetime, in minor units (the currency does not come with it). */
1158
+ lifetimeDeposited: number;
1159
+ /**
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).
1164
+ */
1165
+ tierBenefits: Record<string, unknown> | null;
1166
+ /** When the tier expires (ISO 8601, UTC); `null` when the gateway does not send it. */
1167
+ tierExpiresAt: string | null;
1168
+ }
1169
+ /**
1170
+ * Input of {@link LoyaltyApi.redeem}.
1171
+ * @category Loyalty
1172
+ */
1173
+ interface RedeemPointsInput {
1174
+ /** Points to redeem: a safe integer > 0. */
1175
+ points: number;
1176
+ /** Redemption type (non-empty text). */
1177
+ redemptionType: RedemptionType;
1178
+ }
1179
+ /**
1180
+ * Result of {@link LoyaltyApi.redeem}.
1181
+ * @category Loyalty
1182
+ */
1183
+ interface RedeemedPoints {
1184
+ /** Points actually redeemed (integer). */
1185
+ redeemedPoints: number;
1186
+ /** Redemption value in minor units of `currency`; `null` when the gateway does not send it. */
1187
+ value: number | null;
1188
+ /** Currency of `value`; `null` when absent. */
1189
+ currency: string | null;
1190
+ /** Id of the bonus generated, when the redemption was into a bonus; `null` otherwise. */
1191
+ bonusId: string | null;
1192
+ }
1193
+ /**
1194
+ * The player's loyalty (points and tier). Both methods require login.
1195
+ * @category Loyalty
1196
+ */
1197
+ interface LoyaltyApi {
1198
+ /**
1199
+ * The player's points balance, tier and benefits.
1200
+ * @example
1201
+ * const loyalty = await igaming.loyalty.get()
1202
+ * console.log(loyalty.currentPoints, loyalty.currentTier, loyalty.tierBenefits)
1203
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session. With `validation: 'strict'`,
1204
+ * `VALIDATION_ERROR` if `tier_benefits_json` is not a JSON object.
1205
+ */
1206
+ get(params?: NoParams, options?: CallOptions): Promise<LoyaltyStatus>;
1207
+ /**
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.
1212
+ * @example
1213
+ * const result = await igaming.loyalty.redeem({ points: 500, redemptionType: 'bonus' })
1214
+ * console.log(result.redeemedPoints, result.bonusId)
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.
1222
+ */
1223
+ redeem(input: RedeemPointsInput, options?: CallOptions): Promise<RedeemedPoints>;
1224
+ }
1225
+
1226
+ /**
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
1230
+ */
1231
+ type MissionType = 'daily' | 'weekly' | 'event' | 'permanent' | (string & {});
1232
+ /**
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
1238
+ */
1239
+ type MissionObjectiveType = 'wager' | 'bet_count' | 'win_amount' | 'play_game' | 'deposit' | (string & {});
1240
+ /**
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
1244
+ */
1245
+ type MissionRewardType = 'bonus' | 'free_spins' | 'points' | 'free_bet' | (string & {});
1246
+ /**
1247
+ * Status of the player's mission: `in_progress`, `completed`, `expired` or `claimed`.
1248
+ * @category Missions
1249
+ */
1250
+ type UserMissionStatus = 'in_progress' | 'completed' | 'expired' | 'claimed' | (string & {});
1251
+ /**
1252
+ * Active operator mission (`GET /missions`).
1253
+ * @category Missions
1254
+ */
1255
+ interface Mission {
1256
+ /** Mission id (the same as {@link UserMission.missionId}). */
1257
+ id: string;
1258
+ /** Display name. */
1259
+ name: string;
1260
+ /** Description; may come empty. */
1261
+ description: string;
1262
+ /** Periodicity. */
1263
+ missionType: MissionType;
1264
+ /** Objective. */
1265
+ objectiveType: MissionObjectiveType;
1266
+ /**
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.
1270
+ */
1271
+ targetValue: number;
1272
+ /** Slug of the game category that counts toward the target; `null` when there is no restriction. */
1273
+ targetGameCategory: string | null;
1274
+ /** Ids of the games that count toward the target; `[]` when there is no restriction. */
1275
+ targetGames: string[];
1276
+ /** Reward type. */
1277
+ rewardType: MissionRewardType;
1278
+ /** Reward value, an integer. The contract does not state the unit (an assumption on the "Missions" page, unconfirmed). */
1279
+ rewardValue: number;
1280
+ /** Start of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
1281
+ validFrom: string | null;
1282
+ /** End of validity (ISO 8601, UTC); `null` when the gateway sends an empty date (epoch). */
1283
+ validTo: string | null;
1284
+ }
1285
+ /**
1286
+ * The player's progress on a mission (`GET /my/missions`).
1287
+ * @category Missions
1288
+ */
1289
+ interface UserMission {
1290
+ /** Progress id (of the player's mission in the period). */
1291
+ id: string;
1292
+ /** Mission id ({@link Mission.id}). */
1293
+ missionId: string;
1294
+ /** Mission name. */
1295
+ missionName: string;
1296
+ /** Current progress, an integer; presumed to be the same unit as `targetValue` (not confirmed by the contract). */
1297
+ currentProgress: number;
1298
+ /** Target, an integer. */
1299
+ targetValue: number;
1300
+ /** Progress as a percentage, a number (e.g. `37.5`); computed by the service, may exceed `100`. */
1301
+ progressPercentage: number;
1302
+ /** Status. */
1303
+ status: UserMissionStatus;
1304
+ /** Reward type. */
1305
+ rewardType: MissionRewardType;
1306
+ /** Reward value, an integer. */
1307
+ rewardValue: number;
1308
+ /** End of the period (ISO 8601, UTC); `null` when the gateway does not send it. */
1309
+ periodEnd: string | null;
1310
+ /** When it was completed (ISO 8601, UTC); `null` while not completed. */
1311
+ completedAt: string | null;
1312
+ }
1313
+ /**
1314
+ * Input of {@link MissionsApi.list}.
1315
+ * @category Missions
1316
+ */
1317
+ interface ListMissionsInput {
1318
+ /** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
1319
+ page?: number;
1320
+ /** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
1321
+ perPage?: number;
1322
+ }
1323
+ /**
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
1327
+ */
1328
+ interface MissionsApi {
1329
+ /**
1330
+ * Active operator missions, paginated. The gateway lists only the active ones and has no filter by type.
1331
+ * @example
1332
+ * const page = await igaming.missions.list({ perPage: 20 })
1333
+ * page.items.forEach((mission) => renderMission(mission.name, mission.targetValue))
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.
1336
+ */
1337
+ list(input?: ListMissionsInput, options?: CallOptions): Promise<Page<Mission>>;
1338
+ /**
1339
+ * The player's progress on the active missions, without pagination.
1340
+ * @example
1341
+ * const mine = await igaming.missions.listMine()
1342
+ * const open = mine.filter((m) => m.status === 'in_progress')
1343
+ * @throws {EnginexError} `UNAUTHENTICATED` without a session.
1344
+ */
1345
+ listMine(params?: NoParams, options?: CallOptions): Promise<UserMission[]>;
1346
+ }
1347
+
1348
+ /**
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
1352
+ * `validation: 'warn'`.
1353
+ * @category Referrals
1354
+ */
1355
+ type ReferralStatus = 'pending' | 'qualified' | 'completed' | 'expired' | 'unspecified' | (string & {});
1356
+ /**
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
1360
+ */
1361
+ interface ReferralInfo {
1362
+ /** The player's referral code; `null` when the gateway sends it empty. */
1363
+ code: string | null;
1364
+ /** Referral link ready to share; `null` when the gateway sends it empty. */
1365
+ link: string | null;
1366
+ /** Total referrals (integer). */
1367
+ totalReferrals: number;
1368
+ /** Completed referrals (integer). */
1369
+ completedReferrals: number;
1370
+ /** Pending referrals (integer). */
1371
+ pendingReferrals: number;
1372
+ /** Total earned from referrals, in minor units (the currency does not come with it). */
1373
+ totalEarned: number;
1374
+ /** Bonus per referral, in minor units (the currency does not come with it). */
1375
+ bonusPerReferral: number;
1376
+ /** Referee's minimum deposit, in minor units (the currency does not come with it). */
1377
+ minDeposit: number;
1378
+ }
1379
+ /**
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
1383
+ */
1384
+ interface Referral {
1385
+ /** Referral id. */
1386
+ id: string;
1387
+ /** Referee's name, as the gateway sends it; `null` when empty. It is personal data: do not log it. */
1388
+ refereeName: string | null;
1389
+ /**
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.
1393
+ */
1394
+ refereeEmailMasked: string | null;
1395
+ /** Referral code used. */
1396
+ code: string;
1397
+ /** Status. */
1398
+ status: ReferralStatus;
1399
+ /** Referrer's bonus, in minor units. */
1400
+ referrerBonus: number;
1401
+ /** Referee's bonus, in minor units. */
1402
+ refereeBonus: number;
1403
+ /** When the referral was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1404
+ createdAt: string | null;
1405
+ /** When it was completed (ISO 8601, UTC); `null` while not completed. */
1406
+ completedAt: string | null;
1407
+ /** When it expires (ISO 8601, UTC); `null` when it does not expire or the gateway does not send it. */
1408
+ expiresAt: string | null;
1409
+ }
1410
+ /**
1411
+ * Input of {@link ReferralsApi.listHistory}.
1412
+ * @category Referrals
1413
+ */
1414
+ interface ListReferralsInput {
1415
+ /** Page (starts at 1; integer ≥ 1). Gateway default: 1. */
1416
+ page?: number;
1417
+ /** Items per page (integer from 1 to 100). Gateway default: 20 (out of range also becomes 20). */
1418
+ perPage?: number;
1419
+ }
1420
+ /**
1421
+ * Page of the referral history, with the totals across all pages.
1422
+ * @category Referrals
1423
+ */
1424
+ type ReferralHistory = Page<Referral> & {
1425
+ /** How many referrals are completed, across all pages (integer). */
1426
+ completedCount: number;
1427
+ /** Total earned from referrals, in minor units (the currency does not come with it). */
1428
+ totalEarned: number;
1429
+ };
1430
+ /**
1431
+ * Input of {@link ReferralsApi.register}.
1432
+ * @category Referrals
1433
+ */
1434
+ interface RegisterReferralInput {
1435
+ /** Another player's referral code (non-empty text; leading and trailing spaces are removed). */
1436
+ code: string;
1437
+ }
1438
+ /**
1439
+ * Referral registered by {@link ReferralsApi.register}.
1440
+ * @category Referrals
1441
+ */
1442
+ interface RegisteredReferral {
1443
+ /** Referral id. */
1444
+ id: string;
1445
+ /** Referral code registered. */
1446
+ code: string;
1447
+ /** Initial status (probably `pending`; the contract does not say). */
1448
+ status: ReferralStatus;
1449
+ /** Referee's bonus, in minor units. */
1450
+ refereeBonus: number;
1451
+ /** When it was created (ISO 8601, UTC); `null` if the gateway does not send it. */
1452
+ createdAt: string | null;
1453
+ }
1454
+ /**
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
1458
+ */
1459
+ interface ReferralsApi {
1460
+ /**
1461
+ * The player's referral code, link and totals.
1462
+ * @example
1463
+ * const referral = await igaming.referrals.get()
1464
+ * console.log(referral.code, referral.link, referral.totalEarned)
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.
1467
+ */
1468
+ get(params?: NoParams, options?: CallOptions): Promise<ReferralInfo>;
1469
+ /**
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
1472
+ * `items: []`.
1473
+ * @example
1474
+ * const { items, totalPages, completedCount } = await igaming.referrals.listHistory({ perPage: 20 })
1475
+ * items.forEach((r) => console.log(r.refereeEmailMasked, r.status))
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.
1479
+ */
1480
+ listHistory(input?: ListReferralsInput, options?: CallOptions): Promise<ReferralHistory>;
1481
+ /**
1482
+ * Registers another player's referral code on the logged-in account (after signup). Answers
1483
+ * HTTP 201.
1484
+ * @example
1485
+ * const result = await igaming.referrals.register({ code: 'ANA123' })
1486
+ * console.log(result.status, result.refereeBonus)
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).
1490
+ */
1491
+ register(input: RegisterReferralInput, options?: CallOptions): Promise<RegisteredReferral>;
1492
+ }
1493
+
1494
+ /**
1495
+ * FIRST sportsbook session created by {@link SportsbookApi.createSession}.
1496
+ *
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.
1499
+ * @category Sportsbook
1500
+ */
1501
+ interface SportsbookSession {
1502
+ /**
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`.
1505
+ */
1506
+ launchUrl: string;
1507
+ /** Session validity from the response, in seconds (always greater than zero). */
1508
+ expiresInSeconds: number;
1509
+ /**
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`.
1512
+ */
1513
+ expiresAt: number;
1514
+ }
1515
+ /**
1516
+ * FIRST sportsbook (`GET /first/session`). The provider and the configuration come from
1517
+ * the core's `enginex.config.getSportsbook()`.
1518
+ * @category Sportsbook
1519
+ */
1520
+ interface SportsbookApi {
1521
+ /**
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'`.
1526
+ *
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.
1531
+ * @example
1532
+ * const sb = await enginex.config.getSportsbook()
1533
+ * if (sb.enabled && sb.provider === 'first') {
1534
+ * const { launchUrl, expiresAt } = await igaming.sportsbook.createSession()
1535
+ * iframe.src = launchUrl
1536
+ * }
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.
1542
+ */
1543
+ createSession(params?: NoParams, options?: CallOptions): Promise<SportsbookSession>;
1544
+ }
1545
+
1546
+ /**
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
1549
+ * `dispose()`.
1550
+ * @category Client
1551
+ */
1552
+ interface IgamingClient {
1553
+ /** Catalog, game launch and casino history. */
1554
+ casino: CasinoApi;
1555
+ /** Bonus campaigns (offers, opt-in, redemption) and promo codes. */
1556
+ bonus: BonusApi;
1557
+ /** Operator missions and the player's progress. */
1558
+ missions: MissionsApi;
1559
+ /** Loyalty: points balance, tier, benefits and redemption. */
1560
+ loyalty: LoyaltyApi;
1561
+ /** Referrals: code and link, history (the referee's email masked) and code registration. */
1562
+ referrals: ReferralsApi;
1563
+ /** FIRST sportsbook: session to open the sportsbook in an iframe. */
1564
+ sportsbook: SportsbookApi;
1565
+ }
1566
+ /**
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).
1570
+ *
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).
1574
+ * @example
1575
+ * import { createEnginexClient } from '@getenginex/sdk'
1576
+ * import { createIgaming } from '@getenginex/sdk-igaming'
1577
+ *
1578
+ * export const enginex = createEnginexClient({ locale: 'pt-BR' })
1579
+ * export const igaming = createIgaming(enginex)
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
1585
+ */
1586
+ declare function createIgaming(client: EnginexClient): IgamingClient;
1587
+
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 };