@getenginex/sdk-igaming 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,48 @@
1
1
  import { EnginexError } from '@getenginex/sdk';
2
2
  import * as extension from '@getenginex/sdk/extension';
3
- import { lazy, wire, decimalPlaces, currencyCode, money as money$1, moneyText } from '@getenginex/sdk/extension';
4
- import * as z2 from 'zod/mini';
3
+ import { lazy, wire, decimalPlaces, currencyCode, money as money$1, strictValue, moneyText } from '@getenginex/sdk/extension';
4
+ import * as z4 from 'zod/mini';
5
5
 
6
6
  // src/client.ts
7
+
8
+ // src/internal/input.ts
9
+ function rejectInput(transport, message, route) {
10
+ return Promise.reject(
11
+ transport.reportError({ code: "CONFIGURATION_ERROR", message, status: 0 }, { ...route, attempt: 0 })
12
+ );
13
+ }
14
+ function pageInputProblem(name, input) {
15
+ if (input === void 0) return void 0;
16
+ if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be an object.`;
17
+ const { page, perPage } = input;
18
+ if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
19
+ return `${name}: page must be an integer \u2265 1.`;
20
+ if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > 100))
21
+ return `${name}: perPage must be an integer from 1 to 100.`;
22
+ return void 0;
23
+ }
24
+ function optionalTimestamp() {
25
+ return z4.pipe(
26
+ z4.nullish(z4.string().check(z4.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
27
+ z4.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
28
+ );
29
+ }
30
+ function optionalText() {
31
+ return z4.pipe(
32
+ z4.nullish(z4.string()),
33
+ z4.transform((value) => value == null || value === "" ? null : value)
34
+ );
35
+ }
36
+ function nullableList(item) {
37
+ return z4.pipe(
38
+ z4.nullish(z4.array(item)),
39
+ z4.transform((value) => value ?? [])
40
+ );
41
+ }
7
42
  function protoEnum(prefix) {
8
- return z2.pipe(
9
- z2.optional(z2.union([z2.string(), z2.number()])),
10
- z2.transform((value) => {
43
+ return z4.pipe(
44
+ z4.optional(z4.union([z4.string(), z4.number()])),
45
+ z4.transform((value) => {
11
46
  if (value === void 0 || value === 0) return "unspecified";
12
47
  if (typeof value === "number") return String(value);
13
48
  return (value.startsWith(prefix) ? value.slice(prefix.length) : value).toLowerCase();
@@ -20,177 +55,292 @@ function minorUnits() {
20
55
  function currencyOrEmpty() {
21
56
  return currencyCode({ allowEmpty: true });
22
57
  }
58
+ var NON_NEGATIVE_MONEY = "Expected money in minor units: a non-negative integer within the safe range of number";
59
+ function nonNegativeMinorUnits() {
60
+ return z4.pipe(
61
+ strictValue(
62
+ (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0 || typeof v === "string" && /^\d+$/.test(v) && Number.isSafeInteger(Number(v)),
63
+ NON_NEGATIVE_MONEY
64
+ ),
65
+ // `|| 0`: a JSON `-0` comes out as `0`.
66
+ z4.transform((v) => Number(v) || 0)
67
+ );
68
+ }
23
69
  var INTEGER_TEXT = "Expected an integer within the safe range of number";
24
70
  function integerText() {
25
- return z2.pipe(
26
- z2.union([
27
- z2.string().check(
28
- z2.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
71
+ return z4.pipe(
72
+ z4.union([
73
+ z4.string().check(
74
+ z4.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
29
75
  ),
30
- z2.number().check(z2.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
76
+ z4.number().check(z4.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
31
77
  ]),
32
- z2.transform(Number)
78
+ z4.transform(Number)
33
79
  );
34
80
  }
35
81
  function text() {
36
- return z2._default(z2.string(), "");
82
+ return z4._default(z4.string(), "");
37
83
  }
38
84
  function count() {
39
- return z2._default(z2.number(), 0);
85
+ return z4._default(z4.number(), 0);
40
86
  }
41
87
  function list(item) {
42
- return z2._default(z2.array(item), []);
88
+ return nullableList(item);
43
89
  }
44
90
  function durationSeconds() {
45
- return z2.pipe(
46
- z2.string().check(z2.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
47
- z2.transform((value) => Number(value.slice(0, -1)))
91
+ return z4.pipe(
92
+ z4.string().check(z4.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
93
+ z4.transform((value) => Number(value.slice(0, -1)))
48
94
  );
49
95
  }
50
96
 
51
- // src/modules/bonus.ts
52
- var campaignCurrency = () => z2._default(currencyOrEmpty(), "");
53
- var money = () => wire({ amount: z2._default(minorUnits(), 0), currency: campaignCurrency() });
54
- var timeWindow = () => wire({ starts_at: z2.optional(z2.string()), ends_at: z2.optional(z2.string()) });
55
- var ratio = () => wire({ decimal: z2.optional(z2.string()), basis_points: z2.optional(z2.number()), maximum_scale: count() });
97
+ // src/modules/bets.ts
98
+ var betFields = () => ({
99
+ id: z4.string(),
100
+ status: protoEnum("BET_STATUS_"),
101
+ stake: nonNegativeMinorUnits(),
102
+ potential_return: nonNegativeMinorUnits(),
103
+ total_odds: z4.number(),
104
+ created_at: optionalTimestamp()
105
+ });
106
+ var betSchema = /* @__PURE__ */ lazy(() => wire(betFields()));
107
+ var betDetailsSchema = /* @__PURE__ */ lazy(
108
+ () => wire({
109
+ ...betFields(),
110
+ selections: nullableList(
111
+ wire({
112
+ event_name: z4.string(),
113
+ market_name: z4.string(),
114
+ selection_name: z4.string(),
115
+ odds: z4.number(),
116
+ result: protoEnum("SELECTION_RESULT_")
117
+ })
118
+ )
119
+ })
120
+ );
121
+ var offerSchema = /* @__PURE__ */ lazy(
122
+ () => wire({
123
+ bet_id: z4.string(),
124
+ available: z4.boolean(),
125
+ cashout_amount: nonNegativeMinorUnits(),
126
+ expires_at: optionalTimestamp()
127
+ })
128
+ );
129
+ var cashoutSchema = /* @__PURE__ */ lazy(
130
+ () => wire({ bet_id: z4.string(), cashout_amount: nonNegativeMinorUnits(), status: z4.string() })
131
+ );
132
+ var LIST_ROUTE = { method: "GET", path: "/bets" };
133
+ var GET_ROUTE = { method: "GET", path: "/bets/{betId}" };
134
+ var OFFER_ROUTE = { method: "GET", path: "/bets/{betId}/cashout" };
135
+ var CASHOUT_ROUTE = { method: "POST", path: "/bets/{betId}/cashout" };
136
+ var MAX_IDEMPOTENCY_KEY = 255;
137
+ function betIdProblem(name, input) {
138
+ if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be { betId }.`;
139
+ const { betId } = input;
140
+ return typeof betId === "string" && betId.trim() !== "" ? void 0 : `${name}: betId must be non-empty text.`;
141
+ }
142
+ function idempotencyKeyProblem(options) {
143
+ const key = options?.idempotencyKey;
144
+ if (key === void 0 || key === "") return void 0;
145
+ if (typeof key !== "string" || key !== key.trim() || key.length > MAX_IDEMPOTENCY_KEY)
146
+ return `bets.cashout: idempotencyKey must be text without surrounding spaces, up to ${MAX_IDEMPOTENCY_KEY} characters.`;
147
+ return void 0;
148
+ }
149
+ var betPath = (betId, suffix = "") => `/bets/${encodeURIComponent(betId)}${suffix}`;
150
+ function createBetsApi(transport) {
151
+ return {
152
+ list: (input, options) => {
153
+ const problem = pageInputProblem("bets.list", input);
154
+ if (problem !== void 0) return rejectInput(transport, problem, LIST_ROUTE);
155
+ return transport.requestPage({
156
+ ...LIST_ROUTE,
157
+ page: input?.page,
158
+ perPage: input?.perPage,
159
+ perPageParam: "limit",
160
+ auth: "required",
161
+ item: betSchema(),
162
+ options
163
+ });
164
+ },
165
+ get: (input, options) => {
166
+ const problem = betIdProblem("bets.get", input);
167
+ if (problem !== void 0) return rejectInput(transport, problem, GET_ROUTE);
168
+ return transport.request({
169
+ method: "GET",
170
+ path: betPath(input.betId),
171
+ auth: "required",
172
+ schema: betDetailsSchema(),
173
+ options
174
+ });
175
+ },
176
+ getCashoutOffer: (input, options) => {
177
+ const problem = betIdProblem("bets.getCashoutOffer", input);
178
+ if (problem !== void 0) return rejectInput(transport, problem, OFFER_ROUTE);
179
+ return transport.request({
180
+ method: "GET",
181
+ path: betPath(input.betId, "/cashout"),
182
+ auth: "required",
183
+ schema: offerSchema(),
184
+ options
185
+ });
186
+ },
187
+ cashout: (input, options) => {
188
+ const problem = betIdProblem("bets.cashout", input) ?? idempotencyKeyProblem(options);
189
+ if (problem !== void 0) return rejectInput(transport, problem, CASHOUT_ROUTE);
190
+ return transport.request({
191
+ method: "POST",
192
+ path: betPath(input.betId, "/cashout"),
193
+ auth: "required",
194
+ // No body: the gateway's idempotency middleware fingerprints the (empty) body, so a replay always matches.
195
+ idempotent: true,
196
+ schema: cashoutSchema(),
197
+ options
198
+ });
199
+ }
200
+ };
201
+ }
202
+ var campaignCurrency = () => z4._default(currencyOrEmpty(), "");
203
+ var money = () => wire({ amount: z4._default(minorUnits(), 0), currency: campaignCurrency() });
204
+ var timeWindow = () => wire({ starts_at: z4.optional(z4.string()), ends_at: z4.optional(z4.string()) });
205
+ var ratio = () => wire({ decimal: z4.optional(z4.string()), basis_points: z4.optional(z4.number()), maximum_scale: count() });
56
206
  var empty = () => wire({});
57
207
  var policy = (prefix) => wire({ code: protoEnum(prefix), version: count() });
58
208
  var casinoSelector = () => wire({
59
209
  provider_instance_id: text(),
60
- software_ids: list(z2.string()),
61
- game_ids: list(z2.string()),
62
- category_codes: list(z2.string())
210
+ software_ids: list(z4.string()),
211
+ game_ids: list(z4.string()),
212
+ category_codes: list(z4.string())
63
213
  });
64
214
  var sportsSelector = () => wire({
65
- sport_codes: list(z2.string()),
66
- competition_ids: list(z2.string()),
67
- event_ids: list(z2.string()),
68
- market_codes: list(z2.string()),
69
- live: z2.optional(z2.boolean()),
215
+ sport_codes: list(z4.string()),
216
+ competition_ids: list(z4.string()),
217
+ event_ids: list(z4.string()),
218
+ market_codes: list(z4.string()),
219
+ live: z4.optional(z4.boolean()),
70
220
  bet_types: list(protoEnum("SPORTS_BET_TYPE_"))
71
221
  });
72
222
  var qualification = () => wire({
73
223
  version: count(),
74
- immediate: z2.optional(empty()),
75
- user_event: z2.optional(
224
+ immediate: z4.optional(empty()),
225
+ user_event: z4.optional(
76
226
  wire({
77
227
  event_code: text(),
78
228
  event_version: count(),
79
229
  source_authority: text(),
80
- identity_fields: list(z2.string())
230
+ identity_fields: list(z4.string())
81
231
  })
82
232
  ),
83
- deposit_settled: z2.optional(
233
+ deposit_settled: z4.optional(
84
234
  wire({
85
235
  currency: campaignCurrency(),
86
- eligible_method_codes: list(z2.string()),
236
+ eligible_method_codes: list(z4.string()),
87
237
  first_deposit_policy: protoEnum("FIRST_DEPOSIT_POLICY_"),
88
- minimum_settled_net_amount: z2.optional(money()),
89
- maximum_settled_net_amount: z2.optional(money()),
238
+ minimum_settled_net_amount: z4.optional(money()),
239
+ maximum_settled_net_amount: z4.optional(money()),
90
240
  amount_basis: protoEnum("DEPOSIT_AMOUNT_BASIS_")
91
241
  })
92
242
  ),
93
- activity_aggregate: z2.optional(
243
+ activity_aggregate: z4.optional(
94
244
  wire({
95
245
  basis: protoEnum("BASIS_"),
96
246
  product_scope: protoEnum("PRODUCT_SCOPE_"),
97
247
  currency: campaignCurrency(),
98
- window: z2.optional(durationSeconds()),
248
+ window: z4.optional(durationSeconds()),
99
249
  timezone: text(),
100
- late_event_grace: z2.optional(durationSeconds()),
101
- casino: z2.optional(casinoSelector()),
102
- sportsbook: z2.optional(sportsSelector())
250
+ late_event_grace: z4.optional(durationSeconds()),
251
+ casino: z4.optional(casinoSelector()),
252
+ sportsbook: z4.optional(sportsSelector())
103
253
  })
104
254
  )
105
255
  });
106
256
  var validity = () => wire({
107
- no_expiry: z2.optional(empty()),
108
- absolute_expiry: z2.optional(wire({ expires_at: z2.optional(z2.string()) })),
109
- duration_from_grant: z2.optional(wire({ duration: z2.optional(durationSeconds()) }))
257
+ no_expiry: z4.optional(empty()),
258
+ absolute_expiry: z4.optional(wire({ expires_at: z4.optional(z4.string()) })),
259
+ duration_from_grant: z4.optional(wire({ duration: z4.optional(durationSeconds()) }))
110
260
  });
111
261
  var rounding = () => protoEnum("ROUNDING_MODE_");
112
262
  var proceedsClass = () => protoEnum("PROCEEDS_CLASS_");
113
263
  var percent = () => wire({
114
- percentage: z2.optional(ratio()),
264
+ percentage: z4.optional(ratio()),
115
265
  rounding: rounding(),
116
- minimum_reward: z2.optional(money()),
117
- maximum_reward: z2.optional(money())
266
+ minimum_reward: z4.optional(money()),
267
+ maximum_reward: z4.optional(money())
118
268
  });
119
269
  var balanceCredit = () => wire({
120
- fixed_amount: z2.optional(wire({ amount: z2.optional(money()) })),
121
- percent_of_source_amount: z2.optional(percent()),
122
- aggregate_rebate: z2.optional(
270
+ fixed_amount: z4.optional(wire({ amount: z4.optional(money()) })),
271
+ percent_of_source_amount: z4.optional(percent()),
272
+ aggregate_rebate: z4.optional(
123
273
  wire({
124
- percentage: z2.optional(ratio()),
274
+ percentage: z4.optional(ratio()),
125
275
  rounding: rounding(),
126
- minimum_basis: z2.optional(money()),
127
- maximum_reward: z2.optional(money())
276
+ minimum_basis: z4.optional(money()),
277
+ maximum_reward: z4.optional(money())
128
278
  })
129
279
  ),
130
280
  balance_class: protoEnum("BALANCE_CLASS_"),
131
281
  proceeds_class: proceedsClass(),
132
- validity: z2.optional(validity())
282
+ validity: z4.optional(validity())
133
283
  });
134
- var maximumBet = () => wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z2.optional(money()) });
284
+ var maximumBet = () => wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z4.optional(money()) });
135
285
  var oddsPolicy = () => wire({
136
286
  mode: protoEnum("MODE_"),
137
- minimum_total_odds_decimal: z2.optional(z2.string()),
138
- minimum_odds_per_leg_decimal: z2.optional(z2.string()),
139
- minimum_legs: z2.optional(z2.number()),
140
- maximum_legs: z2.optional(z2.number())
287
+ minimum_total_odds_decimal: z4.optional(z4.string()),
288
+ minimum_odds_per_leg_decimal: z4.optional(z4.string()),
289
+ minimum_legs: z4.optional(z4.number()),
290
+ maximum_legs: z4.optional(z4.number())
141
291
  });
142
292
  var cashoutMode = () => protoEnum("RESTRICTED_CASHOUT_MODE_");
143
293
  var usePolicy = () => wire({
144
294
  version: count(),
145
- funds_consumption: z2.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
146
- casino: z2.optional(wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z2.optional(maximumBet()) })),
147
- sportsbook: z2.optional(
295
+ funds_consumption: z4.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
296
+ casino: z4.optional(wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z4.optional(maximumBet()) })),
297
+ sportsbook: z4.optional(
148
298
  wire({
149
299
  allowed_scopes: list(sportsSelector()),
150
300
  excluded_scopes: list(sportsSelector()),
151
- maximum_bet: z2.optional(maximumBet()),
152
- funding_odds: z2.optional(oddsPolicy()),
301
+ maximum_bet: z4.optional(maximumBet()),
302
+ funding_odds: z4.optional(oddsPolicy()),
153
303
  cashout_mode: cashoutMode()
154
304
  })
155
305
  ),
156
- casino_and_sportsbook: z2.optional(
306
+ casino_and_sportsbook: z4.optional(
157
307
  wire({
158
308
  allowed_casino_scopes: list(casinoSelector()),
159
309
  allowed_sportsbook_scopes: list(sportsSelector()),
160
310
  excluded_sportsbook_scopes: list(sportsSelector()),
161
- maximum_casino_bet: z2.optional(maximumBet()),
162
- maximum_sportsbook_bet: z2.optional(maximumBet()),
163
- sportsbook_funding_odds: z2.optional(oddsPolicy()),
311
+ maximum_casino_bet: z4.optional(maximumBet()),
312
+ maximum_sportsbook_bet: z4.optional(maximumBet()),
313
+ sportsbook_funding_odds: z4.optional(oddsPolicy()),
164
314
  sportsbook_cashout_mode: cashoutMode()
165
315
  })
166
316
  ),
167
- payout_allocation: z2.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
317
+ payout_allocation: z4.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
168
318
  });
169
319
  var wageringPolicy = () => wire({
170
320
  version: count(),
171
- none: z2.optional(empty()),
172
- multiplier: z2.optional(
321
+ none: z4.optional(empty()),
322
+ multiplier: z4.optional(
173
323
  wire({
174
324
  requirement_basis: protoEnum("REQUIREMENT_BASIS_"),
175
- multiplier: z2.optional(ratio()),
325
+ multiplier: z4.optional(ratio()),
176
326
  contribution_rates: list(
177
327
  wire({
178
- casino: z2.optional(casinoSelector()),
179
- sportsbook: z2.optional(sportsSelector()),
180
- rate: z2.optional(ratio())
328
+ casino: z4.optional(casinoSelector()),
329
+ sportsbook: z4.optional(sportsSelector()),
330
+ rate: z4.optional(ratio())
181
331
  })
182
332
  ),
183
- deadline: z2.optional(validity()),
333
+ deadline: z4.optional(validity()),
184
334
  rounding: rounding(),
185
- sportsbook_contribution_odds: z2.optional(oddsPolicy()),
186
- maximum_conversion: z2.optional(money())
335
+ sportsbook_contribution_odds: z4.optional(oddsPolicy()),
336
+ maximum_conversion: z4.optional(money())
187
337
  })
188
338
  )
189
339
  });
190
340
  var stackingPolicy = () => wire({
191
341
  version: count(),
192
- exclusive_in_group: z2.optional(wire({ stacking_group_key: text() })),
193
- multiple_in_group: z2.optional(wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
342
+ exclusive_in_group: z4.optional(wire({ stacking_group_key: text() })),
343
+ multiple_in_group: z4.optional(wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
194
344
  });
195
345
  var reward = () => wire({
196
346
  reward_key: text(),
@@ -198,83 +348,83 @@ var reward = () => wire({
198
348
  reward_kind_version: count(),
199
349
  execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
200
350
  execution_profile_version: count(),
201
- balance_credit: z2.optional(balanceCredit()),
202
- provider_managed_balance: z2.optional(wire({ provider_code: text() })),
203
- casino_free_spins: z2.optional(
351
+ balance_credit: z4.optional(balanceCredit()),
352
+ provider_managed_balance: z4.optional(wire({ provider_code: text() })),
353
+ casino_free_spins: z4.optional(
204
354
  wire({
205
355
  provider_code: text(),
206
- casino_scope: z2.optional(casinoSelector()),
356
+ casino_scope: z4.optional(casinoSelector()),
207
357
  quantity: count(),
208
- denomination: z2.optional(money()),
358
+ denomination: z4.optional(money()),
209
359
  currency: campaignCurrency(),
210
- grant_window: z2.optional(timeWindow()),
360
+ grant_window: z4.optional(timeWindow()),
211
361
  proceeds_class: proceedsClass(),
212
- maximum_winnings: z2.optional(money())
362
+ maximum_winnings: z4.optional(money())
213
363
  })
214
364
  ),
215
- sports_bonus_bet: z2.optional(
365
+ sports_bonus_bet: z4.optional(
216
366
  wire({
217
367
  provider_code: text(),
218
- sportsbook_scope: z2.optional(sportsSelector()),
219
- amount: z2.optional(money()),
368
+ sportsbook_scope: z4.optional(sportsSelector()),
369
+ amount: z4.optional(money()),
220
370
  quantity: count(),
221
- validity: z2.optional(validity())
371
+ validity: z4.optional(validity())
222
372
  })
223
373
  ),
224
- sports_bet_coverage: z2.optional(
374
+ sports_bet_coverage: z4.optional(
225
375
  wire({
226
376
  provider_code: text(),
227
- qualifying_bet_scope: z2.optional(sportsSelector()),
228
- coverage_cap: z2.optional(money()),
229
- validity: z2.optional(validity())
377
+ qualifying_bet_scope: z4.optional(sportsSelector()),
378
+ coverage_cap: z4.optional(money()),
379
+ validity: z4.optional(validity())
230
380
  })
231
381
  ),
232
- use_policy: z2.optional(usePolicy()),
233
- wagering_policy: z2.optional(wageringPolicy()),
234
- stacking_policy: z2.optional(stackingPolicy()),
235
- restricted_position_selection_policy: z2.optional(
382
+ use_policy: z4.optional(usePolicy()),
383
+ wagering_policy: z4.optional(wageringPolicy()),
384
+ stacking_policy: z4.optional(stackingPolicy()),
385
+ restricted_position_selection_policy: z4.optional(
236
386
  wire({
237
387
  version: count(),
238
- priority_then_earliest_expiry: z2.optional(wire({ selection_priority: z2.optional(z2.number()) }))
388
+ priority_then_earliest_expiry: z4.optional(wire({ selection_priority: z4.optional(z4.number()) }))
239
389
  })
240
390
  )
241
391
  });
242
392
  var localizedContent = () => wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
243
- var content = () => wire({ default_locale: text(), supported_locales: list(z2.string()), localized_content: list(localizedContent()) });
244
- var offerSchema = /* @__PURE__ */ lazy(
393
+ var content = () => wire({ default_locale: text(), supported_locales: list(z4.string()), localized_content: list(localizedContent()) });
394
+ var offerSchema2 = /* @__PURE__ */ lazy(
245
395
  () => wire({
246
396
  campaign_id: text(),
247
397
  campaign_version_id: text(),
248
398
  publication_id: text(),
249
399
  product_scope: protoEnum("PRODUCT_SCOPE_"),
250
400
  timezone: text(),
251
- enrollment_window: z2.optional(timeWindow()),
252
- qualification_window: z2.optional(timeWindow()),
253
- claim_window: z2.optional(timeWindow()),
254
- entry_policy: z2.optional(policy("ENTRY_POLICY_CODE_")),
255
- reward_claim_policy: z2.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
256
- qualification: z2.optional(qualification()),
257
- reward: z2.optional(reward()),
258
- publication_starts_at: z2.optional(z2.string()),
259
- publication_ends_at: z2.optional(z2.string()),
260
- content: z2.optional(content())
401
+ enrollment_window: z4.optional(timeWindow()),
402
+ qualification_window: z4.optional(timeWindow()),
403
+ claim_window: z4.optional(timeWindow()),
404
+ entry_policy: z4.optional(policy("ENTRY_POLICY_CODE_")),
405
+ reward_claim_policy: z4.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
406
+ qualification: z4.optional(qualification()),
407
+ reward: z4.optional(reward()),
408
+ publication_starts_at: z4.optional(z4.string()),
409
+ publication_ends_at: z4.optional(z4.string()),
410
+ content: z4.optional(content())
261
411
  })
262
412
  );
263
413
  function grantMoney(value, currency) {
264
414
  return { amount: value?.amount ?? 0, currency: value?.currency || currency };
265
415
  }
266
- var rewardGrant = () => z2.pipe(
416
+ var rewardGrant = () => z4.pipe(
267
417
  wire({
268
418
  state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
269
- granted: z2.optional(money()),
270
- balance: z2.optional(money()),
271
- converted: z2.optional(money()),
272
- expires_at: z2.optional(z2.string()),
273
- wagering: z2.optional(
274
- wire({ required: z2.optional(money()), accumulated: z2.optional(money()), completed_at: z2.optional(z2.string()) })
419
+ granted: z4.optional(money()),
420
+ balance: z4.optional(money()),
421
+ converted: z4.optional(money()),
422
+ expires_at: z4.optional(z4.string()),
423
+ wagering: z4.optional(
424
+ wire({ required: z4.optional(money()), accumulated: z4.optional(money()), completed_at: z4.optional(z4.string()) })
275
425
  )
276
426
  }),
277
- z2.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
427
+ z4.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
278
428
  const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
279
429
  const out = {
280
430
  state,
@@ -294,40 +444,40 @@ var rewardGrant = () => z2.pipe(
294
444
  })
295
445
  );
296
446
  var participationSchema = /* @__PURE__ */ lazy(
297
- () => z2.pipe(
447
+ () => z4.pipe(
298
448
  wire({
299
449
  id: text(),
300
450
  campaign_id: text(),
301
451
  campaign_version_id: text(),
302
452
  reward_key: text(),
303
- qualification_snapshot: z2.optional(qualification()),
453
+ qualification_snapshot: z4.optional(qualification()),
304
454
  // oneof `state`: only one of the cases is filled in.
305
- enrolled: z2.optional(empty()),
306
- qualifying: z2.optional(empty()),
307
- qualified: z2.optional(wire({ qualified_at: z2.optional(z2.string()) })),
308
- reward_pending: z2.optional(empty()),
309
- completed: z2.optional(wire({ completed_at: z2.optional(z2.string()) })),
310
- reward_failed: z2.optional(empty()),
311
- expired: z2.optional(wire({ expired_at: z2.optional(z2.string()) })),
312
- cancelled: z2.optional(empty()),
313
- reward_grant: z2.optional(rewardGrant()),
314
- snapshot: z2.optional(
455
+ enrolled: z4.optional(empty()),
456
+ qualifying: z4.optional(empty()),
457
+ qualified: z4.optional(wire({ qualified_at: z4.optional(z4.string()) })),
458
+ reward_pending: z4.optional(empty()),
459
+ completed: z4.optional(wire({ completed_at: z4.optional(z4.string()) })),
460
+ reward_failed: z4.optional(empty()),
461
+ expired: z4.optional(wire({ expired_at: z4.optional(z4.string()) })),
462
+ cancelled: z4.optional(empty()),
463
+ reward_grant: z4.optional(rewardGrant()),
464
+ snapshot: z4.optional(
315
465
  wire({
316
- reward: z2.optional(reward()),
317
- content: z2.optional(content()),
318
- terms_acceptance: z2.optional(
466
+ reward: z4.optional(reward()),
467
+ content: z4.optional(content()),
468
+ terms_acceptance: z4.optional(
319
469
  wire({
320
470
  locale: text(),
321
471
  terms_revision: text(),
322
472
  terms_digest_sha256_hex: text(),
323
- accepted_at: z2.optional(z2.string())
473
+ accepted_at: z4.optional(z4.string())
324
474
  })
325
475
  )
326
476
  })
327
477
  )
328
478
  }),
329
479
  // The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
330
- z2.transform(
480
+ z4.transform(
331
481
  ({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
332
482
  const out = { ...rest, status: "unspecified" };
333
483
  if (enrolled) out.status = "enrolled";
@@ -349,77 +499,78 @@ var participationSchema = /* @__PURE__ */ lazy(
349
499
  )
350
500
  )
351
501
  );
352
- var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor: z2.optional(z2.string()) });
353
- var offersPage = /* @__PURE__ */ lazy(() => cursorPageSchema("offers", offerSchema()));
502
+ var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor: z4.optional(z4.string()) });
503
+ var offersPage = /* @__PURE__ */ lazy(() => cursorPageSchema("offers", offerSchema2()));
354
504
  var participationsPage = /* @__PURE__ */ lazy(() => cursorPageSchema("participations", participationSchema()));
355
- var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema() }));
505
+ var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema2() }));
356
506
  var participationEnvelope = /* @__PURE__ */ lazy(() => wire({ participation: participationSchema() }));
357
507
  var promoCodeOfferSchema = /* @__PURE__ */ lazy(
358
- () => wire({ offer: offerSchema(), localized_content: localizedContent() })
508
+ () => wire({ offer: offerSchema2(), localized_content: localizedContent() })
359
509
  );
360
510
  function toCursorPage(key, data) {
361
- const page = { items: data[key] };
511
+ const items = data[key];
512
+ const page = { items: Array.isArray(items) ? items : [] };
362
513
  if (data.nextCursor) page.nextCursor = data.nextCursor;
363
514
  return page;
364
515
  }
365
- var nullableDate = () => z2.pipe(
366
- z2.nullish(z2.string()),
367
- z2.transform((value) => value ?? void 0)
516
+ var nullableDate = () => z4.pipe(
517
+ z4.nullish(z4.string()),
518
+ z4.transform((value) => value ?? void 0)
368
519
  );
369
520
  function compact(value) {
370
521
  return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
371
522
  }
372
523
  var overviewSchema = /* @__PURE__ */ lazy(
373
- () => z2.pipe(
524
+ () => z4.pipe(
374
525
  wire({
375
526
  currencies: list(
376
- z2.pipe(
527
+ z4.pipe(
377
528
  wire({
378
529
  currency: currencyOrEmpty(),
379
- decimal_places: z2.number(),
530
+ decimal_places: z4.number(),
380
531
  restricted_total: minorUnits(),
381
532
  expiring_7d: minorUnits(),
382
- open_positions: z2.number(),
533
+ open_positions: z4.number(),
383
534
  next_expires_at: nullableDate(),
384
535
  converted: minorUnits(),
385
- converted_campaigns: z2.number()
536
+ converted_campaigns: z4.number()
386
537
  }),
387
- z2.transform(compact)
538
+ z4.transform(compact)
388
539
  )
389
540
  ),
390
541
  as_of: nullableDate()
391
542
  }),
392
- z2.transform(compact)
543
+ z4.transform(compact)
393
544
  )
394
545
  );
395
546
  var positionsPage = /* @__PURE__ */ lazy(
396
547
  () => wire({
397
548
  rows: list(
398
- z2.pipe(
549
+ z4.pipe(
399
550
  wire({
400
- position_id: z2.string(),
401
- campaign_id: z2.string(),
551
+ position_id: z4.string(),
552
+ campaign_id: z4.string(),
402
553
  currency: currencyOrEmpty(),
403
- decimal_places: z2.number(),
554
+ decimal_places: z4.number(),
404
555
  granted: minorUnits(),
405
556
  restricted: minorUnits(),
406
557
  converted: minorUnits(),
407
558
  required: minorUnits(),
408
559
  wagered: minorUnits(),
409
560
  remaining: minorUnits(),
410
- state: z2.string(),
561
+ state: z4.string(),
411
562
  // The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
412
- terminal_action: z2.pipe(
413
- z2.nullish(z2.string()),
414
- z2.transform((value) => value ? value.toLowerCase() : void 0)
563
+ terminal_action: z4.pipe(
564
+ z4.nullish(z4.string()),
565
+ z4.transform((value) => value ? value.toLowerCase() : void 0)
415
566
  ),
416
567
  expires_at: nullableDate(),
417
568
  created_at: nullableDate()
418
569
  }),
419
- z2.transform((row) => compact(row))
570
+ z4.transform((row) => compact(row))
420
571
  )
421
572
  ),
422
- next_cursor: z2.optional(z2.string())
573
+ next_cursor: z4.optional(z4.string())
423
574
  })
424
575
  );
425
576
  var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
@@ -513,51 +664,51 @@ function createBonusApi(transport) {
513
664
  }
514
665
  var gameSchema = /* @__PURE__ */ lazy(
515
666
  () => wire({
516
- id: z2.string(),
517
- name: z2.string(),
518
- provider: z2.string(),
519
- category: z2.string(),
520
- type: z2.string(),
521
- thumbnail: z2.string(),
522
- is_new: z2.boolean(),
523
- is_popular: z2.boolean(),
524
- is_live: z2.boolean(),
525
- demo_available: z2.boolean(),
526
- rtp: z2.number(),
527
- volatility: z2.string(),
528
- priority: z2.number()
667
+ id: z4.string(),
668
+ name: z4.string(),
669
+ provider: z4.string(),
670
+ category: z4.string(),
671
+ type: z4.string(),
672
+ thumbnail: z4.string(),
673
+ is_new: z4.boolean(),
674
+ is_popular: z4.boolean(),
675
+ is_live: z4.boolean(),
676
+ demo_available: z4.boolean(),
677
+ rtp: z4.number(),
678
+ volatility: z4.string(),
679
+ priority: z4.number()
529
680
  })
530
681
  );
531
682
  var categoriesSchema = /* @__PURE__ */ lazy(
532
- () => z2.array(
533
- wire({ slug: z2.string(), name: z2.string(), icon: z2.string(), game_count: z2.number(), priority: z2.number() })
683
+ () => nullableList(
684
+ wire({ slug: z4.string(), name: z4.string(), icon: z4.string(), game_count: z4.number(), priority: z4.number() })
534
685
  )
535
686
  );
536
687
  var providersSchema = /* @__PURE__ */ lazy(
537
- () => z2.array(wire({ id: z2.string(), name: z2.string(), game_count: z2.number() }))
688
+ () => nullableList(wire({ id: z4.string(), name: z4.string(), game_count: z4.number() }))
538
689
  );
539
690
  var launchSchema = /* @__PURE__ */ lazy(
540
- () => z2.pipe(
691
+ () => z4.pipe(
541
692
  wire({
542
- session_id: z2.string().check(z2.minLength(1)),
543
- game_url: z2.string().check(z2.minLength(1)),
693
+ session_id: z4.string().check(z4.minLength(1)),
694
+ game_url: z4.string().check(z4.minLength(1)),
544
695
  // Any text: a target the SDK does not know yet must not fail the (strict) launch.
545
- launch_target: z2.optional(z2.string()),
546
- provider_code: z2.optional(z2.string()),
547
- expires_at: z2.optional(z2.string())
696
+ launch_target: z4.optional(z4.string()),
697
+ provider_code: z4.optional(z4.string()),
698
+ expires_at: z4.optional(z4.string())
548
699
  }),
549
700
  // Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
550
701
  // before the field existed: an iframe.
551
- z2.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
702
+ z4.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
552
703
  )
553
704
  );
554
705
  var sessionSchema = /* @__PURE__ */ lazy(
555
706
  () => wire({
556
- id: z2.string(),
557
- game_id: z2.string(),
558
- game_name: z2.string(),
559
- provider: z2.string(),
560
- start_time: z2.string(),
707
+ id: z4.string(),
708
+ game_id: z4.string(),
709
+ game_name: z4.string(),
710
+ provider: z4.string(),
711
+ start_time: z4.string(),
561
712
  total_bet: money$1(),
562
713
  total_win: money$1(),
563
714
  status: protoEnum("SESSION_STATUS_")
@@ -565,49 +716,155 @@ var sessionSchema = /* @__PURE__ */ lazy(
565
716
  );
566
717
  var transactionSchema = /* @__PURE__ */ lazy(
567
718
  () => wire({
568
- id: z2.string(),
569
- game_id: z2.string(),
570
- game_name: z2.string(),
571
- round_id: z2.string(),
719
+ id: z4.string(),
720
+ game_id: z4.string(),
721
+ game_name: z4.string(),
722
+ round_id: z4.string(),
572
723
  type: protoEnum("CASINO_TRANSACTION_TYPE_"),
573
724
  amount: minorUnits(),
574
725
  currency: currencyCode(),
575
726
  currency_decimal_places: decimalPlaces(),
576
- created_at: z2.string()
727
+ created_at: z4.string()
577
728
  })
578
729
  );
579
730
  var winnersSchema = /* @__PURE__ */ lazy(
580
- () => z2.array(
731
+ () => nullableList(
581
732
  wire({
582
- player: z2.string(),
733
+ player: z4.string(),
583
734
  amount: minorUnits(),
584
735
  currency: currencyCode(),
585
736
  currency_decimal_places: decimalPlaces(),
586
- game_id: z2.string(),
587
- game_name: z2.string(),
588
- won_at: z2.string()
737
+ game_id: z4.string(),
738
+ game_name: z4.string(),
739
+ won_at: z4.string()
589
740
  })
590
741
  )
591
742
  );
743
+ var gamesEnvelopeSchema = /* @__PURE__ */ lazy(
744
+ () => wire({
745
+ availability: z4.pipe(
746
+ z4.nullish(
747
+ wire({
748
+ // The gateway reports an unset status as `available`; the SDK does the same for an absent/empty one.
749
+ status: z4.pipe(
750
+ z4.nullish(z4.string()),
751
+ z4.transform((value) => value ? value.toLowerCase() : "available")
752
+ ),
753
+ primary_provider_code: optionalText(),
754
+ missing: nullableList(z4.string())
755
+ })
756
+ ),
757
+ z4.transform((value) => value ?? null)
758
+ )
759
+ })
760
+ );
761
+ var CURRENCY = /^[A-Z]{3}$/;
762
+ var DECIMAL_PLACES_MAX = 20;
763
+ var jackpotSchema = /* @__PURE__ */ lazy(
764
+ () => z4.pipe(
765
+ z4.object({
766
+ id: z4.string().check(z4.refine((value) => value.trim() !== "")),
767
+ name: z4.string().check(z4.refine((value) => value.trim() !== "")),
768
+ currency: z4.string().check(z4.regex(CURRENCY)),
769
+ amount_minor: z4.union([
770
+ z4.string().check(z4.refine((value) => /^(0|[1-9]\d*)$/.test(value) && Number.isSafeInteger(Number(value)))),
771
+ z4.number().check(z4.refine((value) => Number.isSafeInteger(value) && value >= 0))
772
+ ]),
773
+ decimal_places: z4.number().check(z4.refine((value) => Number.isInteger(value) && value >= 0 && value <= DECIMAL_PLACES_MAX))
774
+ }),
775
+ z4.transform((raw) => ({
776
+ id: raw.id,
777
+ name: raw.name,
778
+ currency: raw.currency,
779
+ amount: Number(raw.amount_minor) || 0,
780
+ currencyDecimalPlaces: raw.decimal_places
781
+ }))
782
+ )
783
+ );
784
+ var jackpotsSchema = /* @__PURE__ */ lazy(
785
+ () => wire({ items: nullableList(z4.unknown()), featured_id: optionalText() })
786
+ );
787
+ var jackpotGamesSchema = /* @__PURE__ */ lazy(
788
+ () => z4.pipe(
789
+ wire({
790
+ games: nullableList(gameSchema()),
791
+ mode: z4.pipe(
792
+ z4.string(),
793
+ z4.transform((value) => value.toLowerCase())
794
+ ),
795
+ pagination: wire({
796
+ page: z4.number(),
797
+ per_page: z4.number(),
798
+ has_next: z4.boolean(),
799
+ next_cursor: optionalText()
800
+ })
801
+ }),
802
+ z4.transform(({ games, mode, pagination }) => ({
803
+ items: games,
804
+ mode,
805
+ page: pagination.page,
806
+ perPage: pagination.perPage,
807
+ // A page that says there is more but has no cursor cannot be followed: it is the last one.
808
+ hasNext: pagination.hasNext && pagination.nextCursor !== null,
809
+ nextCursor: pagination.hasNext ? pagination.nextCursor : null
810
+ }))
811
+ )
812
+ );
813
+ var DEVICES = ["mobile", "desktop"];
814
+ var GAMES_ROUTE = { method: "GET", path: "/games" };
815
+ var JACKPOTS_ROUTE = { method: "GET", path: "/games/jackpots" };
816
+ var JACKPOT_GAMES_ROUTE = { method: "GET", path: "/games/jackpots/{jackpotId}/games" };
817
+ var JACKPOT_GAMES_MAX = 48;
818
+ function deviceProblem(name, device) {
819
+ return device === void 0 || DEVICES.includes(device) ? void 0 : `${name}: device must be 'mobile' or 'desktop' (or omitted).`;
820
+ }
821
+ function currencyProblem(name, currency) {
822
+ return typeof currency === "string" && CURRENCY.test(currency) ? void 0 : `${name}: currency must be an ISO 4217 code in uppercase (e.g. BRL).`;
823
+ }
824
+ function jackpotGamesProblem(input) {
825
+ const name = "casino.listJackpotGames";
826
+ if (typeof input !== "object" || input === null || Array.isArray(input))
827
+ return `${name}: input must be an object { jackpotId, currency }.`;
828
+ const { jackpotId, currency, device, page, perPage, cursor } = input;
829
+ if (typeof jackpotId !== "string" || jackpotId.trim() === "") return `${name}: jackpotId must be non-empty text.`;
830
+ const problem = currencyProblem(name, currency) ?? deviceProblem(name, device);
831
+ if (problem !== void 0) return problem;
832
+ if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
833
+ return `${name}: page must be an integer \u2265 1.`;
834
+ if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > JACKPOT_GAMES_MAX))
835
+ return `${name}: perPage must be an integer from 1 to ${JACKPOT_GAMES_MAX}.`;
836
+ if (cursor !== void 0 && typeof cursor !== "string") return `${name}: cursor must be text.`;
837
+ if (typeof page === "number" && page > 1 && (cursor === void 0 || cursor === ""))
838
+ return `${name}: a page above 1 requires the previous page's nextCursor.`;
839
+ return void 0;
840
+ }
592
841
  function createCasinoApi(transport) {
593
842
  return {
594
- listGames: (input, options) => transport.requestPage({
595
- method: "GET",
596
- path: "/games",
597
- query: {
598
- category: input?.category,
599
- provider: input?.provider,
600
- search: input?.search,
601
- ids: input?.ids?.length ? input.ids.join(",") : void 0,
602
- sort: input?.sort
603
- },
604
- page: input?.page,
605
- perPage: input?.perPage,
606
- perPageParam: "limit",
607
- auth: "none",
608
- item: gameSchema(),
609
- options
610
- }),
843
+ listGames: async (input, options) => {
844
+ const problem = deviceProblem("casino.listGames", input?.device);
845
+ if (problem !== void 0) return rejectInput(transport, problem, GAMES_ROUTE);
846
+ const spec = {
847
+ ...GAMES_ROUTE,
848
+ query: {
849
+ category: input?.category,
850
+ provider: input?.provider,
851
+ search: input?.search,
852
+ ids: input?.ids?.length ? input.ids.join(",") : void 0,
853
+ sort: input?.sort,
854
+ device: input?.device
855
+ },
856
+ page: input?.page,
857
+ perPage: input?.perPage,
858
+ perPageParam: "limit",
859
+ auth: "none",
860
+ item: gameSchema(),
861
+ options
862
+ };
863
+ if (typeof transport.requestPageWithEnvelope !== "function")
864
+ return { ...await transport.requestPage(spec), availability: null };
865
+ const { page, envelope } = await transport.requestPageWithEnvelope({ ...spec, envelope: gamesEnvelopeSchema() });
866
+ return { ...page, availability: envelope.availability };
867
+ },
611
868
  listCategories: (_params, options) => transport.request({ method: "GET", path: "/games/categories", schema: categoriesSchema(), options }),
612
869
  listProviders: (_params, options) => transport.request({ method: "GET", path: "/games/providers", schema: providersSchema(), options }),
613
870
  getGame: ({ gameId }, options) => transport.request({
@@ -616,10 +873,16 @@ function createCasinoApi(transport) {
616
873
  schema: gameSchema(),
617
874
  options
618
875
  }),
619
- launchGame: ({ gameId, mode, isMobile, returnUrl, language }, options) => transport.request({
876
+ launchGame: ({ gameId, mode, isMobile, returnUrl, depositUrl, language }, options) => transport.request({
620
877
  method: "POST",
621
878
  path: `/games/${encodeURIComponent(gameId)}/launch`,
622
- body: { is_demo: mode === "demo", is_mobile: isMobile === true, return_url: returnUrl, language },
879
+ body: {
880
+ is_demo: mode === "demo",
881
+ is_mobile: isMobile === true,
882
+ return_url: returnUrl,
883
+ deposit_url: depositUrl,
884
+ language
885
+ },
623
886
  auth: "required",
624
887
  // The response carries the URL with the game session token: never through `warn` mode's recovery
625
888
  // (which would deliver a raw field and the response to `onValidationIssue`).
@@ -654,55 +917,57 @@ function createCasinoApi(transport) {
654
917
  auth: "required",
655
918
  schema: winnersSchema(),
656
919
  options
657
- })
920
+ }),
921
+ listJackpots: async (input, options) => {
922
+ const currency = input?.currency;
923
+ const problem = currencyProblem("casino.listJackpots", currency);
924
+ if (problem !== void 0) return rejectInput(transport, problem, JACKPOTS_ROUTE);
925
+ const raw = await transport.request({
926
+ ...JACKPOTS_ROUTE,
927
+ query: { currency },
928
+ auth: "none",
929
+ schema: jackpotsSchema(),
930
+ options
931
+ });
932
+ const items = [];
933
+ for (const entry of Array.isArray(raw.items) ? raw.items : []) {
934
+ const parsed = z4.safeParse(jackpotSchema(), entry);
935
+ if (!parsed.success || parsed.data.currency !== currency) continue;
936
+ if (items.some((item) => item.id === parsed.data.id)) continue;
937
+ items.push(parsed.data);
938
+ }
939
+ const featured = typeof raw.featuredId === "string" ? raw.featuredId : null;
940
+ return { items, featuredId: items.some((item) => item.id === featured) ? featured : null };
941
+ },
942
+ listJackpotGames: (input, options) => {
943
+ const problem = jackpotGamesProblem(input);
944
+ if (problem !== void 0) return rejectInput(transport, problem, JACKPOT_GAMES_ROUTE);
945
+ return transport.request({
946
+ method: "GET",
947
+ path: `/games/jackpots/${encodeURIComponent(input.jackpotId)}/games`,
948
+ query: {
949
+ currency: input.currency,
950
+ device: input.device,
951
+ page: input.page,
952
+ limit: input.perPage,
953
+ cursor: input.cursor === "" ? void 0 : input.cursor
954
+ },
955
+ auth: "none",
956
+ schema: jackpotGamesSchema(),
957
+ options
958
+ });
959
+ }
658
960
  };
659
961
  }
660
-
661
- // src/internal/input.ts
662
- function rejectInput(transport, message, route) {
663
- return Promise.reject(
664
- transport.reportError({ code: "CONFIGURATION_ERROR", message, status: 0 }, { ...route, attempt: 0 })
665
- );
666
- }
667
- function pageInputProblem(name, input) {
668
- if (input === void 0) return void 0;
669
- if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be an object.`;
670
- const { page, perPage } = input;
671
- if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
672
- return `${name}: page must be an integer \u2265 1.`;
673
- if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > 100))
674
- return `${name}: perPage must be an integer from 1 to 100.`;
675
- return void 0;
676
- }
677
- function optionalTimestamp() {
678
- return z2.pipe(
679
- z2.nullish(z2.string().check(z2.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
680
- z2.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
681
- );
682
- }
683
- function optionalText() {
684
- return z2.pipe(
685
- z2.nullish(z2.string()),
686
- z2.transform((value) => value == null || value === "" ? null : value)
687
- );
688
- }
689
- function nullableList(item) {
690
- return z2.pipe(
691
- z2.nullish(z2.array(item)),
692
- z2.transform((value) => value ?? [])
693
- );
694
- }
695
-
696
- // src/modules/loyalty.ts
697
962
  var ParsedBenefits = class {
698
963
  constructor(value) {
699
964
  this.value = value;
700
965
  }
701
966
  value;
702
967
  };
703
- var tierBenefits = () => z2.pipe(
704
- z2.nullish(z2.string()),
705
- z2.transform((text2, ctx) => {
968
+ var tierBenefits = () => z4.pipe(
969
+ z4.nullish(z4.string()),
970
+ z4.transform((text2, ctx) => {
706
971
  if (text2 == null || text2.trim() === "") return null;
707
972
  let parsed;
708
973
  try {
@@ -716,43 +981,43 @@ var tierBenefits = () => z2.pipe(
716
981
  message: "tier_benefits_json is not a JSON object or array",
717
982
  input: void 0
718
983
  });
719
- return z2.NEVER;
984
+ return z4.NEVER;
720
985
  })
721
986
  );
722
987
  var loyaltySchema = /* @__PURE__ */ lazy(
723
- () => z2.pipe(
988
+ () => z4.pipe(
724
989
  wire({
725
990
  total_points_earned: integerText(),
726
991
  current_points: integerText(),
727
992
  points_redeemed: integerText(),
728
993
  current_tier: optionalText(),
729
994
  tier_points: integerText(),
730
- lifetime_wagered: z2._default(minorUnits(), 0),
731
- lifetime_deposited: z2._default(minorUnits(), 0),
995
+ lifetime_wagered: z4._default(minorUnits(), 0),
996
+ lifetime_deposited: z4._default(minorUnits(), 0),
732
997
  tier_benefits_json: tierBenefits(),
733
998
  tier_expires_at: optionalTimestamp()
734
999
  }),
735
- z2.transform(({ tierBenefitsJson, ...rest }) => {
1000
+ z4.transform(({ tierBenefitsJson, ...rest }) => {
736
1001
  const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
737
1002
  return { ...rest, tierBenefits: benefits };
738
1003
  })
739
1004
  )
740
1005
  );
741
1006
  var redeemSchema = /* @__PURE__ */ lazy(
742
- () => z2.pipe(
1007
+ () => z4.pipe(
743
1008
  wire({
744
- success: z2.optional(z2.boolean()),
745
- message: z2.optional(z2.string()),
1009
+ success: z4.optional(z4.boolean()),
1010
+ message: z4.optional(z4.string()),
746
1011
  redeemed_points: integerText(),
747
- value: z2.nullish(minorUnits()),
1012
+ value: z4.nullish(minorUnits()),
748
1013
  // Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
749
- currency: z2.pipe(
750
- z2.nullish(currencyOrEmpty()),
751
- z2.transform((value) => value == null || value === "" ? null : value)
1014
+ currency: z4.pipe(
1015
+ z4.nullish(currencyOrEmpty()),
1016
+ z4.transform((value) => value == null || value === "" ? null : value)
752
1017
  ),
753
1018
  bonus_id: optionalText()
754
1019
  }),
755
- z2.transform((data) => ({
1020
+ z4.transform((data) => ({
756
1021
  success: data.success,
757
1022
  message: data.message,
758
1023
  redeemedPoints: data.redeemedPoints,
@@ -796,12 +1061,12 @@ function createLoyaltyApi(transport) {
796
1061
  };
797
1062
  }
798
1063
  function openUnion(values) {
799
- return z2.pipe(
800
- z2.pipe(
801
- z2.string(),
802
- z2.transform((value) => value.toLowerCase())
1064
+ return z4.pipe(
1065
+ z4.pipe(
1066
+ z4.string(),
1067
+ z4.transform((value) => value.toLowerCase())
803
1068
  ),
804
- z2.enum(values)
1069
+ z4.enum(values)
805
1070
  );
806
1071
  }
807
1072
 
@@ -812,14 +1077,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
812
1077
  var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
813
1078
  var missionSchema = /* @__PURE__ */ lazy(
814
1079
  () => wire({
815
- id: z2.string(),
816
- name: z2.string(),
817
- description: z2._default(z2.string(), ""),
1080
+ id: z4.string(),
1081
+ name: z4.string(),
1082
+ description: z4._default(z4.string(), ""),
818
1083
  mission_type: openUnion(MISSION_TYPES),
819
1084
  objective_type: openUnion(OBJECTIVE_TYPES),
820
1085
  target_value: integerText(),
821
1086
  target_game_category: optionalText(),
822
- target_games: nullableList(z2.string()),
1087
+ target_games: nullableList(z4.string()),
823
1088
  reward_type: openUnion(REWARD_TYPES),
824
1089
  reward_value: minorUnits(),
825
1090
  valid_from: optionalTimestamp(),
@@ -827,16 +1092,16 @@ var missionSchema = /* @__PURE__ */ lazy(
827
1092
  })
828
1093
  );
829
1094
  var userMissionsSchema = /* @__PURE__ */ lazy(
830
- () => z2.pipe(
1095
+ () => z4.pipe(
831
1096
  wire({
832
1097
  missions: nullableList(
833
1098
  wire({
834
- id: z2.string(),
835
- mission_id: z2.string(),
836
- mission_name: z2._default(z2.string(), ""),
1099
+ id: z4.string(),
1100
+ mission_id: z4.string(),
1101
+ mission_name: z4._default(z4.string(), ""),
837
1102
  current_progress: integerText(),
838
1103
  target_value: integerText(),
839
- progress_percentage: z2.number(),
1104
+ progress_percentage: z4.number(),
840
1105
  status: openUnion(USER_MISSION_STATUSES),
841
1106
  reward_type: openUnion(REWARD_TYPES),
842
1107
  reward_value: minorUnits(),
@@ -845,7 +1110,7 @@ var userMissionsSchema = /* @__PURE__ */ lazy(
845
1110
  })
846
1111
  )
847
1112
  }),
848
- z2.transform((data) => data.missions)
1113
+ z4.transform((data) => data.missions)
849
1114
  )
850
1115
  );
851
1116
  function createMissionsApi(transport) {
@@ -875,25 +1140,25 @@ function createMissionsApi(transport) {
875
1140
  }
876
1141
  var DEFAULT_PER_PAGE = 20;
877
1142
  var HISTORY_PATH = "/referrals/history";
878
- var count2 = () => z2._default(z2.number().check(z2.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
879
- var money3 = () => z2.pipe(
880
- z2.nullish(wire({ minor_units: minorUnits(), currency: z2._default(currencyOrEmpty(), "") })),
881
- z2.transform(
1143
+ var count2 = () => z4._default(z4.number().check(z4.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
1144
+ var money3 = () => z4.pipe(
1145
+ z4.nullish(wire({ minor_units: minorUnits(), currency: z4._default(currencyOrEmpty(), "") })),
1146
+ z4.transform(
882
1147
  (value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
883
1148
  )
884
1149
  );
885
- var rulesSchema = () => z2.pipe(
886
- z2.nullish(
1150
+ var rulesSchema = () => z4.pipe(
1151
+ z4.nullish(
887
1152
  wire({
888
1153
  reward: money3(),
889
1154
  minimum_real_net_loss: money3(),
890
1155
  referee_window_days: count2(),
891
1156
  hold_hours: count2(),
892
- wagering_multiplier: z2._default(z2.string(), ""),
1157
+ wagering_multiplier: z4._default(z4.string(), ""),
893
1158
  maximum_conversion: money3()
894
1159
  })
895
1160
  ),
896
- z2.transform((rules) => {
1161
+ z4.transform((rules) => {
897
1162
  if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
898
1163
  return {
899
1164
  reward: rules.reward,
@@ -906,12 +1171,12 @@ var rulesSchema = () => z2.pipe(
906
1171
  })
907
1172
  );
908
1173
  var infoSchema = /* @__PURE__ */ lazy(
909
- () => z2.pipe(
1174
+ () => z4.pipe(
910
1175
  wire({
911
- enabled: z2._default(z2.boolean(), false),
1176
+ enabled: z4._default(z4.boolean(), false),
912
1177
  referral_code: optionalText(),
913
1178
  rules: rulesSchema(),
914
- totals: z2._default(
1179
+ totals: z4._default(
915
1180
  wire({
916
1181
  registered: count2(),
917
1182
  deposited: count2(),
@@ -924,7 +1189,7 @@ var infoSchema = /* @__PURE__ */ lazy(
924
1189
  { registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
925
1190
  )
926
1191
  }),
927
- z2.transform(
1192
+ z4.transform(
928
1193
  ({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
929
1194
  )
930
1195
  )
@@ -933,16 +1198,16 @@ function remainingOf(target, loss) {
933
1198
  const missing = BigInt(target.amount) - BigInt(loss.amount);
934
1199
  return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
935
1200
  }
936
- var progressSchema = () => z2.pipe(
937
- z2.nullish(
1201
+ var progressSchema = () => z4.pipe(
1202
+ z4.nullish(
938
1203
  wire({
939
- deposit_done: z2._default(z2.boolean(), false),
1204
+ deposit_done: z4._default(z4.boolean(), false),
940
1205
  real_net_loss: money3(),
941
1206
  target: money3(),
942
1207
  remaining: money3()
943
1208
  })
944
1209
  ),
945
- z2.transform((progress) => {
1210
+ z4.transform((progress) => {
946
1211
  if (progress == null || progress.target === null) return null;
947
1212
  const { target } = progress;
948
1213
  const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
@@ -959,9 +1224,9 @@ function statusOf(playerStatus, legacy) {
959
1224
  if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
960
1225
  return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
961
1226
  }
962
- var referralSchema = () => z2.pipe(
1227
+ var referralSchema = () => z4.pipe(
963
1228
  wire({
964
- id: z2.string(),
1229
+ id: z4.string(),
965
1230
  referee_name: optionalText(),
966
1231
  status: optionalText(),
967
1232
  player_status: optionalText(),
@@ -969,7 +1234,7 @@ var referralSchema = () => z2.pipe(
969
1234
  deadline_at: optionalTimestamp(),
970
1235
  progress: progressSchema()
971
1236
  }),
972
- z2.transform(
1237
+ z4.transform(
973
1238
  (r) => ({
974
1239
  id: r.id,
975
1240
  refereeName: r.refereeName,
@@ -984,7 +1249,11 @@ var historySchema = /* @__PURE__ */ lazy(
984
1249
  () => wire({
985
1250
  referral_code: optionalText(),
986
1251
  referrals: nullableList(referralSchema()),
987
- pagination: z2.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
1252
+ // A nil pointer (`null`) reads as absent, like an omitted pagination.
1253
+ pagination: z4.pipe(
1254
+ z4.nullish(wire({ page: count2(), limit: count2(), total_items: count2() })),
1255
+ z4.transform((value) => value ?? void 0)
1256
+ )
988
1257
  })
989
1258
  );
990
1259
  var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
@@ -1024,12 +1293,12 @@ function createReferralsApi(transport) {
1024
1293
  }
1025
1294
  var HTTP_URL = "Expected an absolute http(s) URL";
1026
1295
  var sessionSchema2 = /* @__PURE__ */ lazy(
1027
- () => z2.pipe(
1296
+ () => z4.pipe(
1028
1297
  wire({
1029
1298
  // The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
1030
- operator_token: z2.string(),
1031
- launch_url: z2.string().check(
1032
- z2.refine(
1299
+ operator_token: z4.string(),
1300
+ launch_url: z4.string().check(
1301
+ z4.refine(
1033
1302
  (value) => {
1034
1303
  try {
1035
1304
  const { protocol } = new URL(value);
@@ -1041,10 +1310,10 @@ var sessionSchema2 = /* @__PURE__ */ lazy(
1041
1310
  { message: HTTP_URL }
1042
1311
  )
1043
1312
  ),
1044
- expires_in_seconds: z2.number().check(z2.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1313
+ expires_in_seconds: z4.number().check(z4.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1045
1314
  }),
1046
1315
  // The clock is read when the response is interpreted (= moment of the response).
1047
- z2.transform(({ launchUrl, expiresInSeconds }) => ({
1316
+ z4.transform(({ launchUrl, expiresInSeconds }) => ({
1048
1317
  launchUrl,
1049
1318
  expiresInSeconds,
1050
1319
  expiresAt: Date.now() + expiresInSeconds * 1e3
@@ -1075,7 +1344,8 @@ function createIgaming(client) {
1075
1344
  missions: createMissionsApi(transport),
1076
1345
  loyalty: createLoyaltyApi(transport),
1077
1346
  referrals: createReferralsApi(transport),
1078
- sportsbook: createSportsbookApi(transport)
1347
+ sportsbook: createSportsbookApi(transport),
1348
+ bets: createBetsApi(transport)
1079
1349
  };
1080
1350
  if (typeof extension.registerProductClient !== "function") {
1081
1351
  throw new EnginexError({