@getenginex/sdk-igaming 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,176 +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 z4._default(z4.array(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())
335
+ sportsbook_contribution_odds: z4.optional(oddsPolicy()),
336
+ maximum_conversion: z4.optional(money())
186
337
  })
187
338
  )
188
339
  });
189
340
  var stackingPolicy = () => wire({
190
341
  version: count(),
191
- exclusive_in_group: z2.optional(wire({ stacking_group_key: text() })),
192
- 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() }))
193
344
  });
194
345
  var reward = () => wire({
195
346
  reward_key: text(),
@@ -197,83 +348,83 @@ var reward = () => wire({
197
348
  reward_kind_version: count(),
198
349
  execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
199
350
  execution_profile_version: count(),
200
- balance_credit: z2.optional(balanceCredit()),
201
- provider_managed_balance: z2.optional(wire({ provider_code: text() })),
202
- 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(
203
354
  wire({
204
355
  provider_code: text(),
205
- casino_scope: z2.optional(casinoSelector()),
356
+ casino_scope: z4.optional(casinoSelector()),
206
357
  quantity: count(),
207
- denomination: z2.optional(money()),
358
+ denomination: z4.optional(money()),
208
359
  currency: campaignCurrency(),
209
- grant_window: z2.optional(timeWindow()),
360
+ grant_window: z4.optional(timeWindow()),
210
361
  proceeds_class: proceedsClass(),
211
- maximum_winnings: z2.optional(money())
362
+ maximum_winnings: z4.optional(money())
212
363
  })
213
364
  ),
214
- sports_bonus_bet: z2.optional(
365
+ sports_bonus_bet: z4.optional(
215
366
  wire({
216
367
  provider_code: text(),
217
- sportsbook_scope: z2.optional(sportsSelector()),
218
- amount: z2.optional(money()),
368
+ sportsbook_scope: z4.optional(sportsSelector()),
369
+ amount: z4.optional(money()),
219
370
  quantity: count(),
220
- validity: z2.optional(validity())
371
+ validity: z4.optional(validity())
221
372
  })
222
373
  ),
223
- sports_bet_coverage: z2.optional(
374
+ sports_bet_coverage: z4.optional(
224
375
  wire({
225
376
  provider_code: text(),
226
- qualifying_bet_scope: z2.optional(sportsSelector()),
227
- coverage_cap: z2.optional(money()),
228
- validity: z2.optional(validity())
377
+ qualifying_bet_scope: z4.optional(sportsSelector()),
378
+ coverage_cap: z4.optional(money()),
379
+ validity: z4.optional(validity())
229
380
  })
230
381
  ),
231
- use_policy: z2.optional(usePolicy()),
232
- wagering_policy: z2.optional(wageringPolicy()),
233
- stacking_policy: z2.optional(stackingPolicy()),
234
- 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(
235
386
  wire({
236
387
  version: count(),
237
- 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()) }))
238
389
  })
239
390
  )
240
391
  });
241
392
  var localizedContent = () => wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
242
- var content = () => wire({ default_locale: text(), supported_locales: list(z2.string()), localized_content: list(localizedContent()) });
243
- 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(
244
395
  () => wire({
245
396
  campaign_id: text(),
246
397
  campaign_version_id: text(),
247
398
  publication_id: text(),
248
399
  product_scope: protoEnum("PRODUCT_SCOPE_"),
249
400
  timezone: text(),
250
- enrollment_window: z2.optional(timeWindow()),
251
- qualification_window: z2.optional(timeWindow()),
252
- claim_window: z2.optional(timeWindow()),
253
- entry_policy: z2.optional(policy("ENTRY_POLICY_CODE_")),
254
- reward_claim_policy: z2.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
255
- qualification: z2.optional(qualification()),
256
- reward: z2.optional(reward()),
257
- publication_starts_at: z2.optional(z2.string()),
258
- publication_ends_at: z2.optional(z2.string()),
259
- 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())
260
411
  })
261
412
  );
262
413
  function grantMoney(value, currency) {
263
414
  return { amount: value?.amount ?? 0, currency: value?.currency || currency };
264
415
  }
265
- var rewardGrant = () => z2.pipe(
416
+ var rewardGrant = () => z4.pipe(
266
417
  wire({
267
418
  state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
268
- granted: z2.optional(money()),
269
- balance: z2.optional(money()),
270
- converted: z2.optional(money()),
271
- expires_at: z2.optional(z2.string()),
272
- wagering: z2.optional(
273
- 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()) })
274
425
  )
275
426
  }),
276
- z2.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
427
+ z4.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
277
428
  const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
278
429
  const out = {
279
430
  state,
@@ -293,40 +444,40 @@ var rewardGrant = () => z2.pipe(
293
444
  })
294
445
  );
295
446
  var participationSchema = /* @__PURE__ */ lazy(
296
- () => z2.pipe(
447
+ () => z4.pipe(
297
448
  wire({
298
449
  id: text(),
299
450
  campaign_id: text(),
300
451
  campaign_version_id: text(),
301
452
  reward_key: text(),
302
- qualification_snapshot: z2.optional(qualification()),
453
+ qualification_snapshot: z4.optional(qualification()),
303
454
  // oneof `state`: only one of the cases is filled in.
304
- enrolled: z2.optional(empty()),
305
- qualifying: z2.optional(empty()),
306
- qualified: z2.optional(wire({ qualified_at: z2.optional(z2.string()) })),
307
- reward_pending: z2.optional(empty()),
308
- completed: z2.optional(wire({ completed_at: z2.optional(z2.string()) })),
309
- reward_failed: z2.optional(empty()),
310
- expired: z2.optional(wire({ expired_at: z2.optional(z2.string()) })),
311
- cancelled: z2.optional(empty()),
312
- reward_grant: z2.optional(rewardGrant()),
313
- 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(
314
465
  wire({
315
- reward: z2.optional(reward()),
316
- content: z2.optional(content()),
317
- terms_acceptance: z2.optional(
466
+ reward: z4.optional(reward()),
467
+ content: z4.optional(content()),
468
+ terms_acceptance: z4.optional(
318
469
  wire({
319
470
  locale: text(),
320
471
  terms_revision: text(),
321
472
  terms_digest_sha256_hex: text(),
322
- accepted_at: z2.optional(z2.string())
473
+ accepted_at: z4.optional(z4.string())
323
474
  })
324
475
  )
325
476
  })
326
477
  )
327
478
  }),
328
479
  // The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
329
- z2.transform(
480
+ z4.transform(
330
481
  ({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
331
482
  const out = { ...rest, status: "unspecified" };
332
483
  if (enrolled) out.status = "enrolled";
@@ -348,77 +499,77 @@ var participationSchema = /* @__PURE__ */ lazy(
348
499
  )
349
500
  )
350
501
  );
351
- var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor: z2.optional(z2.string()) });
352
- 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()));
353
504
  var participationsPage = /* @__PURE__ */ lazy(() => cursorPageSchema("participations", participationSchema()));
354
- var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema() }));
505
+ var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema2() }));
355
506
  var participationEnvelope = /* @__PURE__ */ lazy(() => wire({ participation: participationSchema() }));
356
507
  var promoCodeOfferSchema = /* @__PURE__ */ lazy(
357
- () => wire({ offer: offerSchema(), localized_content: localizedContent() })
508
+ () => wire({ offer: offerSchema2(), localized_content: localizedContent() })
358
509
  );
359
510
  function toCursorPage(key, data) {
360
511
  const page = { items: data[key] };
361
512
  if (data.nextCursor) page.nextCursor = data.nextCursor;
362
513
  return page;
363
514
  }
364
- var nullableDate = () => z2.pipe(
365
- z2.nullish(z2.string()),
366
- z2.transform((value) => value ?? void 0)
515
+ var nullableDate = () => z4.pipe(
516
+ z4.nullish(z4.string()),
517
+ z4.transform((value) => value ?? void 0)
367
518
  );
368
519
  function compact(value) {
369
520
  return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
370
521
  }
371
522
  var overviewSchema = /* @__PURE__ */ lazy(
372
- () => z2.pipe(
523
+ () => z4.pipe(
373
524
  wire({
374
525
  currencies: list(
375
- z2.pipe(
526
+ z4.pipe(
376
527
  wire({
377
528
  currency: currencyOrEmpty(),
378
- decimal_places: z2.number(),
529
+ decimal_places: z4.number(),
379
530
  restricted_total: minorUnits(),
380
531
  expiring_7d: minorUnits(),
381
- open_positions: z2.number(),
532
+ open_positions: z4.number(),
382
533
  next_expires_at: nullableDate(),
383
534
  converted: minorUnits(),
384
- converted_campaigns: z2.number()
535
+ converted_campaigns: z4.number()
385
536
  }),
386
- z2.transform(compact)
537
+ z4.transform(compact)
387
538
  )
388
539
  ),
389
540
  as_of: nullableDate()
390
541
  }),
391
- z2.transform(compact)
542
+ z4.transform(compact)
392
543
  )
393
544
  );
394
545
  var positionsPage = /* @__PURE__ */ lazy(
395
546
  () => wire({
396
547
  rows: list(
397
- z2.pipe(
548
+ z4.pipe(
398
549
  wire({
399
- position_id: z2.string(),
400
- campaign_id: z2.string(),
550
+ position_id: z4.string(),
551
+ campaign_id: z4.string(),
401
552
  currency: currencyOrEmpty(),
402
- decimal_places: z2.number(),
553
+ decimal_places: z4.number(),
403
554
  granted: minorUnits(),
404
555
  restricted: minorUnits(),
405
556
  converted: minorUnits(),
406
557
  required: minorUnits(),
407
558
  wagered: minorUnits(),
408
559
  remaining: minorUnits(),
409
- state: z2.string(),
560
+ state: z4.string(),
410
561
  // The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
411
- terminal_action: z2.pipe(
412
- z2.nullish(z2.string()),
413
- z2.transform((value) => value ? value.toLowerCase() : void 0)
562
+ terminal_action: z4.pipe(
563
+ z4.nullish(z4.string()),
564
+ z4.transform((value) => value ? value.toLowerCase() : void 0)
414
565
  ),
415
566
  expires_at: nullableDate(),
416
567
  created_at: nullableDate()
417
568
  }),
418
- z2.transform((row) => compact(row))
569
+ z4.transform((row) => compact(row))
419
570
  )
420
571
  ),
421
- next_cursor: z2.optional(z2.string())
572
+ next_cursor: z4.optional(z4.string())
422
573
  })
423
574
  );
424
575
  var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
@@ -512,51 +663,51 @@ function createBonusApi(transport) {
512
663
  }
513
664
  var gameSchema = /* @__PURE__ */ lazy(
514
665
  () => wire({
515
- id: z2.string(),
516
- name: z2.string(),
517
- provider: z2.string(),
518
- category: z2.string(),
519
- type: z2.string(),
520
- thumbnail: z2.string(),
521
- is_new: z2.boolean(),
522
- is_popular: z2.boolean(),
523
- is_live: z2.boolean(),
524
- demo_available: z2.boolean(),
525
- rtp: z2.number(),
526
- volatility: z2.string(),
527
- priority: z2.number()
666
+ id: z4.string(),
667
+ name: z4.string(),
668
+ provider: z4.string(),
669
+ category: z4.string(),
670
+ type: z4.string(),
671
+ thumbnail: z4.string(),
672
+ is_new: z4.boolean(),
673
+ is_popular: z4.boolean(),
674
+ is_live: z4.boolean(),
675
+ demo_available: z4.boolean(),
676
+ rtp: z4.number(),
677
+ volatility: z4.string(),
678
+ priority: z4.number()
528
679
  })
529
680
  );
530
681
  var categoriesSchema = /* @__PURE__ */ lazy(
531
- () => z2.array(
532
- wire({ slug: z2.string(), name: z2.string(), icon: z2.string(), game_count: z2.number(), priority: z2.number() })
682
+ () => z4.array(
683
+ wire({ slug: z4.string(), name: z4.string(), icon: z4.string(), game_count: z4.number(), priority: z4.number() })
533
684
  )
534
685
  );
535
686
  var providersSchema = /* @__PURE__ */ lazy(
536
- () => z2.array(wire({ id: z2.string(), name: z2.string(), game_count: z2.number() }))
687
+ () => z4.array(wire({ id: z4.string(), name: z4.string(), game_count: z4.number() }))
537
688
  );
538
689
  var launchSchema = /* @__PURE__ */ lazy(
539
- () => z2.pipe(
690
+ () => z4.pipe(
540
691
  wire({
541
- session_id: z2.string().check(z2.minLength(1)),
542
- game_url: z2.string().check(z2.minLength(1)),
692
+ session_id: z4.string().check(z4.minLength(1)),
693
+ game_url: z4.string().check(z4.minLength(1)),
543
694
  // Any text: a target the SDK does not know yet must not fail the (strict) launch.
544
- launch_target: z2.optional(z2.string()),
545
- provider_code: z2.optional(z2.string()),
546
- expires_at: z2.optional(z2.string())
695
+ launch_target: z4.optional(z4.string()),
696
+ provider_code: z4.optional(z4.string()),
697
+ expires_at: z4.optional(z4.string())
547
698
  }),
548
699
  // Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
549
700
  // before the field existed: an iframe.
550
- z2.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
701
+ z4.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
551
702
  )
552
703
  );
553
704
  var sessionSchema = /* @__PURE__ */ lazy(
554
705
  () => wire({
555
- id: z2.string(),
556
- game_id: z2.string(),
557
- game_name: z2.string(),
558
- provider: z2.string(),
559
- start_time: z2.string(),
706
+ id: z4.string(),
707
+ game_id: z4.string(),
708
+ game_name: z4.string(),
709
+ provider: z4.string(),
710
+ start_time: z4.string(),
560
711
  total_bet: money$1(),
561
712
  total_win: money$1(),
562
713
  status: protoEnum("SESSION_STATUS_")
@@ -564,49 +715,155 @@ var sessionSchema = /* @__PURE__ */ lazy(
564
715
  );
565
716
  var transactionSchema = /* @__PURE__ */ lazy(
566
717
  () => wire({
567
- id: z2.string(),
568
- game_id: z2.string(),
569
- game_name: z2.string(),
570
- round_id: z2.string(),
718
+ id: z4.string(),
719
+ game_id: z4.string(),
720
+ game_name: z4.string(),
721
+ round_id: z4.string(),
571
722
  type: protoEnum("CASINO_TRANSACTION_TYPE_"),
572
723
  amount: minorUnits(),
573
724
  currency: currencyCode(),
574
725
  currency_decimal_places: decimalPlaces(),
575
- created_at: z2.string()
726
+ created_at: z4.string()
576
727
  })
577
728
  );
578
729
  var winnersSchema = /* @__PURE__ */ lazy(
579
- () => z2.array(
730
+ () => z4.array(
580
731
  wire({
581
- player: z2.string(),
732
+ player: z4.string(),
582
733
  amount: minorUnits(),
583
734
  currency: currencyCode(),
584
735
  currency_decimal_places: decimalPlaces(),
585
- game_id: z2.string(),
586
- game_name: z2.string(),
587
- won_at: z2.string()
736
+ game_id: z4.string(),
737
+ game_name: z4.string(),
738
+ won_at: z4.string()
588
739
  })
589
740
  )
590
741
  );
742
+ var gamesEnvelopeSchema = /* @__PURE__ */ lazy(
743
+ () => wire({
744
+ availability: z4.pipe(
745
+ z4.nullish(
746
+ wire({
747
+ // The gateway reports an unset status as `available`; the SDK does the same for an absent/empty one.
748
+ status: z4.pipe(
749
+ z4.nullish(z4.string()),
750
+ z4.transform((value) => value ? value.toLowerCase() : "available")
751
+ ),
752
+ primary_provider_code: optionalText(),
753
+ missing: nullableList(z4.string())
754
+ })
755
+ ),
756
+ z4.transform((value) => value ?? null)
757
+ )
758
+ })
759
+ );
760
+ var CURRENCY = /^[A-Z]{3}$/;
761
+ var DECIMAL_PLACES_MAX = 20;
762
+ var jackpotSchema = /* @__PURE__ */ lazy(
763
+ () => z4.pipe(
764
+ z4.object({
765
+ id: z4.string().check(z4.refine((value) => value.trim() !== "")),
766
+ name: z4.string().check(z4.refine((value) => value.trim() !== "")),
767
+ currency: z4.string().check(z4.regex(CURRENCY)),
768
+ amount_minor: z4.union([
769
+ z4.string().check(z4.refine((value) => /^(0|[1-9]\d*)$/.test(value) && Number.isSafeInteger(Number(value)))),
770
+ z4.number().check(z4.refine((value) => Number.isSafeInteger(value) && value >= 0))
771
+ ]),
772
+ decimal_places: z4.number().check(z4.refine((value) => Number.isInteger(value) && value >= 0 && value <= DECIMAL_PLACES_MAX))
773
+ }),
774
+ z4.transform((raw) => ({
775
+ id: raw.id,
776
+ name: raw.name,
777
+ currency: raw.currency,
778
+ amount: Number(raw.amount_minor) || 0,
779
+ currencyDecimalPlaces: raw.decimal_places
780
+ }))
781
+ )
782
+ );
783
+ var jackpotsSchema = /* @__PURE__ */ lazy(
784
+ () => wire({ items: nullableList(z4.unknown()), featured_id: optionalText() })
785
+ );
786
+ var jackpotGamesSchema = /* @__PURE__ */ lazy(
787
+ () => z4.pipe(
788
+ wire({
789
+ games: nullableList(gameSchema()),
790
+ mode: z4.pipe(
791
+ z4.string(),
792
+ z4.transform((value) => value.toLowerCase())
793
+ ),
794
+ pagination: wire({
795
+ page: z4.number(),
796
+ per_page: z4.number(),
797
+ has_next: z4.boolean(),
798
+ next_cursor: optionalText()
799
+ })
800
+ }),
801
+ z4.transform(({ games, mode, pagination }) => ({
802
+ items: games,
803
+ mode,
804
+ page: pagination.page,
805
+ perPage: pagination.perPage,
806
+ // A page that says there is more but has no cursor cannot be followed: it is the last one.
807
+ hasNext: pagination.hasNext && pagination.nextCursor !== null,
808
+ nextCursor: pagination.hasNext ? pagination.nextCursor : null
809
+ }))
810
+ )
811
+ );
812
+ var DEVICES = ["mobile", "desktop"];
813
+ var GAMES_ROUTE = { method: "GET", path: "/games" };
814
+ var JACKPOTS_ROUTE = { method: "GET", path: "/games/jackpots" };
815
+ var JACKPOT_GAMES_ROUTE = { method: "GET", path: "/games/jackpots/{jackpotId}/games" };
816
+ var JACKPOT_GAMES_MAX = 48;
817
+ function deviceProblem(name, device) {
818
+ return device === void 0 || DEVICES.includes(device) ? void 0 : `${name}: device must be 'mobile' or 'desktop' (or omitted).`;
819
+ }
820
+ function currencyProblem(name, currency) {
821
+ return typeof currency === "string" && CURRENCY.test(currency) ? void 0 : `${name}: currency must be an ISO 4217 code in uppercase (e.g. BRL).`;
822
+ }
823
+ function jackpotGamesProblem(input) {
824
+ const name = "casino.listJackpotGames";
825
+ if (typeof input !== "object" || input === null || Array.isArray(input))
826
+ return `${name}: input must be an object { jackpotId, currency }.`;
827
+ const { jackpotId, currency, device, page, perPage, cursor } = input;
828
+ if (typeof jackpotId !== "string" || jackpotId.trim() === "") return `${name}: jackpotId must be non-empty text.`;
829
+ const problem = currencyProblem(name, currency) ?? deviceProblem(name, device);
830
+ if (problem !== void 0) return problem;
831
+ if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
832
+ return `${name}: page must be an integer \u2265 1.`;
833
+ if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > JACKPOT_GAMES_MAX))
834
+ return `${name}: perPage must be an integer from 1 to ${JACKPOT_GAMES_MAX}.`;
835
+ if (cursor !== void 0 && typeof cursor !== "string") return `${name}: cursor must be text.`;
836
+ if (typeof page === "number" && page > 1 && (cursor === void 0 || cursor === ""))
837
+ return `${name}: a page above 1 requires the previous page's nextCursor.`;
838
+ return void 0;
839
+ }
591
840
  function createCasinoApi(transport) {
592
841
  return {
593
- listGames: (input, options) => transport.requestPage({
594
- method: "GET",
595
- path: "/games",
596
- query: {
597
- category: input?.category,
598
- provider: input?.provider,
599
- search: input?.search,
600
- ids: input?.ids?.length ? input.ids.join(",") : void 0,
601
- sort: input?.sort
602
- },
603
- page: input?.page,
604
- perPage: input?.perPage,
605
- perPageParam: "limit",
606
- auth: "none",
607
- item: gameSchema(),
608
- options
609
- }),
842
+ listGames: async (input, options) => {
843
+ const problem = deviceProblem("casino.listGames", input?.device);
844
+ if (problem !== void 0) return rejectInput(transport, problem, GAMES_ROUTE);
845
+ const spec = {
846
+ ...GAMES_ROUTE,
847
+ query: {
848
+ category: input?.category,
849
+ provider: input?.provider,
850
+ search: input?.search,
851
+ ids: input?.ids?.length ? input.ids.join(",") : void 0,
852
+ sort: input?.sort,
853
+ device: input?.device
854
+ },
855
+ page: input?.page,
856
+ perPage: input?.perPage,
857
+ perPageParam: "limit",
858
+ auth: "none",
859
+ item: gameSchema(),
860
+ options
861
+ };
862
+ if (typeof transport.requestPageWithEnvelope !== "function")
863
+ return { ...await transport.requestPage(spec), availability: null };
864
+ const { page, envelope } = await transport.requestPageWithEnvelope({ ...spec, envelope: gamesEnvelopeSchema() });
865
+ return { ...page, availability: envelope.availability };
866
+ },
610
867
  listCategories: (_params, options) => transport.request({ method: "GET", path: "/games/categories", schema: categoriesSchema(), options }),
611
868
  listProviders: (_params, options) => transport.request({ method: "GET", path: "/games/providers", schema: providersSchema(), options }),
612
869
  getGame: ({ gameId }, options) => transport.request({
@@ -615,10 +872,16 @@ function createCasinoApi(transport) {
615
872
  schema: gameSchema(),
616
873
  options
617
874
  }),
618
- launchGame: ({ gameId, mode, isMobile, returnUrl, language }, options) => transport.request({
875
+ launchGame: ({ gameId, mode, isMobile, returnUrl, depositUrl, language }, options) => transport.request({
619
876
  method: "POST",
620
877
  path: `/games/${encodeURIComponent(gameId)}/launch`,
621
- body: { is_demo: mode === "demo", is_mobile: isMobile === true, return_url: returnUrl, language },
878
+ body: {
879
+ is_demo: mode === "demo",
880
+ is_mobile: isMobile === true,
881
+ return_url: returnUrl,
882
+ deposit_url: depositUrl,
883
+ language
884
+ },
622
885
  auth: "required",
623
886
  // The response carries the URL with the game session token: never through `warn` mode's recovery
624
887
  // (which would deliver a raw field and the response to `onValidationIssue`).
@@ -653,49 +916,57 @@ function createCasinoApi(transport) {
653
916
  auth: "required",
654
917
  schema: winnersSchema(),
655
918
  options
656
- })
919
+ }),
920
+ listJackpots: async (input, options) => {
921
+ const currency = input?.currency;
922
+ const problem = currencyProblem("casino.listJackpots", currency);
923
+ if (problem !== void 0) return rejectInput(transport, problem, JACKPOTS_ROUTE);
924
+ const raw = await transport.request({
925
+ ...JACKPOTS_ROUTE,
926
+ query: { currency },
927
+ auth: "none",
928
+ schema: jackpotsSchema(),
929
+ options
930
+ });
931
+ const items = [];
932
+ for (const entry of Array.isArray(raw.items) ? raw.items : []) {
933
+ const parsed = z4.safeParse(jackpotSchema(), entry);
934
+ if (!parsed.success || parsed.data.currency !== currency) continue;
935
+ if (items.some((item) => item.id === parsed.data.id)) continue;
936
+ items.push(parsed.data);
937
+ }
938
+ const featured = typeof raw.featuredId === "string" ? raw.featuredId : null;
939
+ return { items, featuredId: items.some((item) => item.id === featured) ? featured : null };
940
+ },
941
+ listJackpotGames: (input, options) => {
942
+ const problem = jackpotGamesProblem(input);
943
+ if (problem !== void 0) return rejectInput(transport, problem, JACKPOT_GAMES_ROUTE);
944
+ return transport.request({
945
+ method: "GET",
946
+ path: `/games/jackpots/${encodeURIComponent(input.jackpotId)}/games`,
947
+ query: {
948
+ currency: input.currency,
949
+ device: input.device,
950
+ page: input.page,
951
+ limit: input.perPage,
952
+ cursor: input.cursor === "" ? void 0 : input.cursor
953
+ },
954
+ auth: "none",
955
+ schema: jackpotGamesSchema(),
956
+ options
957
+ });
958
+ }
657
959
  };
658
960
  }
659
-
660
- // src/internal/input.ts
661
- function rejectInput(transport, message, route) {
662
- return Promise.reject(
663
- transport.reportError({ code: "CONFIGURATION_ERROR", message, status: 0 }, { ...route, attempt: 0 })
664
- );
665
- }
666
- function pageInputProblem(name, input) {
667
- if (input === void 0) return void 0;
668
- if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be an object.`;
669
- const { page, perPage } = input;
670
- if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
671
- return `${name}: page must be an integer \u2265 1.`;
672
- if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > 100))
673
- return `${name}: perPage must be an integer from 1 to 100.`;
674
- return void 0;
675
- }
676
- function optionalTimestamp() {
677
- return z2.pipe(
678
- z2.nullish(z2.string().check(z2.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
679
- z2.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
680
- );
681
- }
682
- function optionalText() {
683
- return z2.pipe(
684
- z2.nullish(z2.string()),
685
- z2.transform((value) => value == null || value === "" ? null : value)
686
- );
687
- }
688
- function nullableList(item) {
689
- return z2.pipe(
690
- z2.nullish(z2.array(item)),
691
- z2.transform((value) => value ?? [])
692
- );
693
- }
694
-
695
- // src/modules/loyalty.ts
696
- var tierBenefits = () => z2.pipe(
697
- z2.nullish(z2.string()),
698
- z2.transform((text2, ctx) => {
961
+ var ParsedBenefits = class {
962
+ constructor(value) {
963
+ this.value = value;
964
+ }
965
+ value;
966
+ };
967
+ var tierBenefits = () => z4.pipe(
968
+ z4.nullish(z4.string()),
969
+ z4.transform((text2, ctx) => {
699
970
  if (text2 == null || text2.trim() === "") return null;
700
971
  let parsed;
701
972
  try {
@@ -703,46 +974,49 @@ var tierBenefits = () => z2.pipe(
703
974
  } catch {
704
975
  parsed = void 0;
705
976
  }
706
- if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed))
707
- return parsed;
708
- ctx.issues.push({ code: "custom", message: "tier_benefits_json is not a JSON object", input: void 0 });
709
- return z2.NEVER;
977
+ if (typeof parsed === "object" && parsed !== null) return new ParsedBenefits(parsed);
978
+ ctx.issues.push({
979
+ code: "custom",
980
+ message: "tier_benefits_json is not a JSON object or array",
981
+ input: void 0
982
+ });
983
+ return z4.NEVER;
710
984
  })
711
985
  );
712
986
  var loyaltySchema = /* @__PURE__ */ lazy(
713
- () => z2.pipe(
987
+ () => z4.pipe(
714
988
  wire({
715
989
  total_points_earned: integerText(),
716
990
  current_points: integerText(),
717
991
  points_redeemed: integerText(),
718
992
  current_tier: optionalText(),
719
993
  tier_points: integerText(),
720
- lifetime_wagered: z2._default(minorUnits(), 0),
721
- lifetime_deposited: z2._default(minorUnits(), 0),
994
+ lifetime_wagered: z4._default(minorUnits(), 0),
995
+ lifetime_deposited: z4._default(minorUnits(), 0),
722
996
  tier_benefits_json: tierBenefits(),
723
997
  tier_expires_at: optionalTimestamp()
724
998
  }),
725
- z2.transform(({ tierBenefitsJson, ...rest }) => {
726
- const benefits = typeof tierBenefitsJson === "object" && tierBenefitsJson !== null && !Array.isArray(tierBenefitsJson) ? tierBenefitsJson : null;
999
+ z4.transform(({ tierBenefitsJson, ...rest }) => {
1000
+ const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
727
1001
  return { ...rest, tierBenefits: benefits };
728
1002
  })
729
1003
  )
730
1004
  );
731
1005
  var redeemSchema = /* @__PURE__ */ lazy(
732
- () => z2.pipe(
1006
+ () => z4.pipe(
733
1007
  wire({
734
- success: z2.optional(z2.boolean()),
735
- message: z2.optional(z2.string()),
1008
+ success: z4.optional(z4.boolean()),
1009
+ message: z4.optional(z4.string()),
736
1010
  redeemed_points: integerText(),
737
- value: z2.nullish(minorUnits()),
1011
+ value: z4.nullish(minorUnits()),
738
1012
  // Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
739
- currency: z2.pipe(
740
- z2.nullish(currencyOrEmpty()),
741
- z2.transform((value) => value == null || value === "" ? null : value)
1013
+ currency: z4.pipe(
1014
+ z4.nullish(currencyOrEmpty()),
1015
+ z4.transform((value) => value == null || value === "" ? null : value)
742
1016
  ),
743
1017
  bonus_id: optionalText()
744
1018
  }),
745
- z2.transform((data) => ({
1019
+ z4.transform((data) => ({
746
1020
  success: data.success,
747
1021
  message: data.message,
748
1022
  redeemedPoints: data.redeemedPoints,
@@ -786,12 +1060,12 @@ function createLoyaltyApi(transport) {
786
1060
  };
787
1061
  }
788
1062
  function openUnion(values) {
789
- return z2.pipe(
790
- z2.pipe(
791
- z2.string(),
792
- z2.transform((value) => value.toLowerCase())
1063
+ return z4.pipe(
1064
+ z4.pipe(
1065
+ z4.string(),
1066
+ z4.transform((value) => value.toLowerCase())
793
1067
  ),
794
- z2.enum(values)
1068
+ z4.enum(values)
795
1069
  );
796
1070
  }
797
1071
 
@@ -802,14 +1076,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
802
1076
  var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
803
1077
  var missionSchema = /* @__PURE__ */ lazy(
804
1078
  () => wire({
805
- id: z2.string(),
806
- name: z2.string(),
807
- description: z2._default(z2.string(), ""),
1079
+ id: z4.string(),
1080
+ name: z4.string(),
1081
+ description: z4._default(z4.string(), ""),
808
1082
  mission_type: openUnion(MISSION_TYPES),
809
1083
  objective_type: openUnion(OBJECTIVE_TYPES),
810
1084
  target_value: integerText(),
811
1085
  target_game_category: optionalText(),
812
- target_games: nullableList(z2.string()),
1086
+ target_games: nullableList(z4.string()),
813
1087
  reward_type: openUnion(REWARD_TYPES),
814
1088
  reward_value: minorUnits(),
815
1089
  valid_from: optionalTimestamp(),
@@ -817,16 +1091,16 @@ var missionSchema = /* @__PURE__ */ lazy(
817
1091
  })
818
1092
  );
819
1093
  var userMissionsSchema = /* @__PURE__ */ lazy(
820
- () => z2.pipe(
1094
+ () => z4.pipe(
821
1095
  wire({
822
1096
  missions: nullableList(
823
1097
  wire({
824
- id: z2.string(),
825
- mission_id: z2.string(),
826
- mission_name: z2._default(z2.string(), ""),
1098
+ id: z4.string(),
1099
+ mission_id: z4.string(),
1100
+ mission_name: z4._default(z4.string(), ""),
827
1101
  current_progress: integerText(),
828
1102
  target_value: integerText(),
829
- progress_percentage: z2.number(),
1103
+ progress_percentage: z4.number(),
830
1104
  status: openUnion(USER_MISSION_STATUSES),
831
1105
  reward_type: openUnion(REWARD_TYPES),
832
1106
  reward_value: minorUnits(),
@@ -835,7 +1109,7 @@ var userMissionsSchema = /* @__PURE__ */ lazy(
835
1109
  })
836
1110
  )
837
1111
  }),
838
- z2.transform((data) => data.missions)
1112
+ z4.transform((data) => data.missions)
839
1113
  )
840
1114
  );
841
1115
  function createMissionsApi(transport) {
@@ -865,25 +1139,25 @@ function createMissionsApi(transport) {
865
1139
  }
866
1140
  var DEFAULT_PER_PAGE = 20;
867
1141
  var HISTORY_PATH = "/referrals/history";
868
- var count2 = () => z2._default(z2.number().check(z2.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
869
- var money3 = () => z2.pipe(
870
- z2.nullish(wire({ minor_units: minorUnits(), currency: z2._default(currencyOrEmpty(), "") })),
871
- z2.transform(
1142
+ var count2 = () => z4._default(z4.number().check(z4.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
1143
+ var money3 = () => z4.pipe(
1144
+ z4.nullish(wire({ minor_units: minorUnits(), currency: z4._default(currencyOrEmpty(), "") })),
1145
+ z4.transform(
872
1146
  (value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
873
1147
  )
874
1148
  );
875
- var rulesSchema = () => z2.pipe(
876
- z2.nullish(
1149
+ var rulesSchema = () => z4.pipe(
1150
+ z4.nullish(
877
1151
  wire({
878
1152
  reward: money3(),
879
1153
  minimum_real_net_loss: money3(),
880
1154
  referee_window_days: count2(),
881
1155
  hold_hours: count2(),
882
- wagering_multiplier: z2._default(z2.string(), ""),
1156
+ wagering_multiplier: z4._default(z4.string(), ""),
883
1157
  maximum_conversion: money3()
884
1158
  })
885
1159
  ),
886
- z2.transform((rules) => {
1160
+ z4.transform((rules) => {
887
1161
  if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
888
1162
  return {
889
1163
  reward: rules.reward,
@@ -896,12 +1170,12 @@ var rulesSchema = () => z2.pipe(
896
1170
  })
897
1171
  );
898
1172
  var infoSchema = /* @__PURE__ */ lazy(
899
- () => z2.pipe(
1173
+ () => z4.pipe(
900
1174
  wire({
901
- enabled: z2._default(z2.boolean(), false),
1175
+ enabled: z4._default(z4.boolean(), false),
902
1176
  referral_code: optionalText(),
903
1177
  rules: rulesSchema(),
904
- totals: z2._default(
1178
+ totals: z4._default(
905
1179
  wire({
906
1180
  registered: count2(),
907
1181
  deposited: count2(),
@@ -914,7 +1188,7 @@ var infoSchema = /* @__PURE__ */ lazy(
914
1188
  { registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
915
1189
  )
916
1190
  }),
917
- z2.transform(
1191
+ z4.transform(
918
1192
  ({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
919
1193
  )
920
1194
  )
@@ -923,16 +1197,16 @@ function remainingOf(target, loss) {
923
1197
  const missing = BigInt(target.amount) - BigInt(loss.amount);
924
1198
  return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
925
1199
  }
926
- var progressSchema = () => z2.pipe(
927
- z2.nullish(
1200
+ var progressSchema = () => z4.pipe(
1201
+ z4.nullish(
928
1202
  wire({
929
- deposit_done: z2._default(z2.boolean(), false),
1203
+ deposit_done: z4._default(z4.boolean(), false),
930
1204
  real_net_loss: money3(),
931
1205
  target: money3(),
932
1206
  remaining: money3()
933
1207
  })
934
1208
  ),
935
- z2.transform((progress) => {
1209
+ z4.transform((progress) => {
936
1210
  if (progress == null || progress.target === null) return null;
937
1211
  const { target } = progress;
938
1212
  const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
@@ -949,9 +1223,9 @@ function statusOf(playerStatus, legacy) {
949
1223
  if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
950
1224
  return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
951
1225
  }
952
- var referralSchema = () => z2.pipe(
1226
+ var referralSchema = () => z4.pipe(
953
1227
  wire({
954
- id: z2.string(),
1228
+ id: z4.string(),
955
1229
  referee_name: optionalText(),
956
1230
  status: optionalText(),
957
1231
  player_status: optionalText(),
@@ -959,7 +1233,7 @@ var referralSchema = () => z2.pipe(
959
1233
  deadline_at: optionalTimestamp(),
960
1234
  progress: progressSchema()
961
1235
  }),
962
- z2.transform(
1236
+ z4.transform(
963
1237
  (r) => ({
964
1238
  id: r.id,
965
1239
  refereeName: r.refereeName,
@@ -974,7 +1248,7 @@ var historySchema = /* @__PURE__ */ lazy(
974
1248
  () => wire({
975
1249
  referral_code: optionalText(),
976
1250
  referrals: nullableList(referralSchema()),
977
- pagination: z2.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
1251
+ pagination: z4.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
978
1252
  })
979
1253
  );
980
1254
  var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
@@ -1014,12 +1288,12 @@ function createReferralsApi(transport) {
1014
1288
  }
1015
1289
  var HTTP_URL = "Expected an absolute http(s) URL";
1016
1290
  var sessionSchema2 = /* @__PURE__ */ lazy(
1017
- () => z2.pipe(
1291
+ () => z4.pipe(
1018
1292
  wire({
1019
1293
  // The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
1020
- operator_token: z2.string(),
1021
- launch_url: z2.string().check(
1022
- z2.refine(
1294
+ operator_token: z4.string(),
1295
+ launch_url: z4.string().check(
1296
+ z4.refine(
1023
1297
  (value) => {
1024
1298
  try {
1025
1299
  const { protocol } = new URL(value);
@@ -1031,10 +1305,10 @@ var sessionSchema2 = /* @__PURE__ */ lazy(
1031
1305
  { message: HTTP_URL }
1032
1306
  )
1033
1307
  ),
1034
- expires_in_seconds: z2.number().check(z2.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1308
+ expires_in_seconds: z4.number().check(z4.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1035
1309
  }),
1036
1310
  // The clock is read when the response is interpreted (= moment of the response).
1037
- z2.transform(({ launchUrl, expiresInSeconds }) => ({
1311
+ z4.transform(({ launchUrl, expiresInSeconds }) => ({
1038
1312
  launchUrl,
1039
1313
  expiresInSeconds,
1040
1314
  expiresAt: Date.now() + expiresInSeconds * 1e3
@@ -1065,7 +1339,8 @@ function createIgaming(client) {
1065
1339
  missions: createMissionsApi(transport),
1066
1340
  loyalty: createLoyaltyApi(transport),
1067
1341
  referrals: createReferralsApi(transport),
1068
- sportsbook: createSportsbookApi(transport)
1342
+ sportsbook: createSportsbookApi(transport),
1343
+ bets: createBetsApi(transport)
1069
1344
  };
1070
1345
  if (typeof extension.registerProductClient !== "function") {
1071
1346
  throw new EnginexError({