@getenginex/sdk-igaming 0.7.0 → 0.8.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.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var sdk = require('@getenginex/sdk');
4
4
  var extension = require('@getenginex/sdk/extension');
5
- var mini = require('zod/mini');
5
+ var z2 = require('zod/mini');
6
6
 
7
7
  function _interopNamespace(e) {
8
8
  if (e && e.__esModule) return e;
@@ -23,12 +23,13 @@ function _interopNamespace(e) {
23
23
  }
24
24
 
25
25
  var extension__namespace = /*#__PURE__*/_interopNamespace(extension);
26
+ var z2__namespace = /*#__PURE__*/_interopNamespace(z2);
26
27
 
27
28
  // src/client.ts
28
29
  function protoEnum(prefix) {
29
- return mini.z.pipe(
30
- mini.z.optional(mini.z.union([mini.z.string(), mini.z.number()])),
31
- mini.z.transform((value) => {
30
+ return z2__namespace.pipe(
31
+ z2__namespace.optional(z2__namespace.union([z2__namespace.string(), z2__namespace.number()])),
32
+ z2__namespace.transform((value) => {
32
33
  if (value === void 0 || value === 0) return "unspecified";
33
34
  if (typeof value === "number") return String(value);
34
35
  return (value.startsWith(prefix) ? value.slice(prefix.length) : value).toLowerCase();
@@ -43,188 +44,174 @@ function currencyOrEmpty() {
43
44
  }
44
45
  var INTEGER_TEXT = "Expected an integer within the safe range of number";
45
46
  function integerText() {
46
- return mini.z.pipe(
47
- mini.z.union([
48
- mini.z.string().check(
49
- mini.z.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
47
+ return z2__namespace.pipe(
48
+ z2__namespace.union([
49
+ z2__namespace.string().check(
50
+ z2__namespace.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
50
51
  ),
51
- mini.z.number().check(mini.z.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
52
+ z2__namespace.number().check(z2__namespace.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
52
53
  ]),
53
- mini.z.transform(Number)
54
+ z2__namespace.transform(Number)
54
55
  );
55
56
  }
56
57
  function text() {
57
- return mini.z._default(mini.z.string(), "");
58
+ return z2__namespace._default(z2__namespace.string(), "");
58
59
  }
59
60
  function count() {
60
- return mini.z._default(mini.z.number(), 0);
61
+ return z2__namespace._default(z2__namespace.number(), 0);
61
62
  }
62
63
  function list(item) {
63
- return mini.z._default(mini.z.array(item), []);
64
+ return z2__namespace._default(z2__namespace.array(item), []);
64
65
  }
65
66
  function durationSeconds() {
66
- return mini.z.pipe(
67
- mini.z.string().check(mini.z.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
68
- mini.z.transform((value) => Number(value.slice(0, -1)))
69
- );
70
- }
71
- var MAJOR_UNITS = "Expected a value in major units (a finite number) that fits in whole minor units";
72
- function majorToMinorUnits(value) {
73
- const minor = Math.sign(value) * Math.round(Math.abs(value) * 100);
74
- return minor === 0 ? 0 : minor;
75
- }
76
- function majorUnits() {
77
- return mini.z.pipe(
78
- extension.strictValue(
79
- (value) => typeof value === "number" && Number.isSafeInteger(majorToMinorUnits(value)),
80
- MAJOR_UNITS
81
- ),
82
- mini.z.transform((value) => majorToMinorUnits(value))
67
+ return z2__namespace.pipe(
68
+ z2__namespace.string().check(z2__namespace.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
69
+ z2__namespace.transform((value) => Number(value.slice(0, -1)))
83
70
  );
84
71
  }
85
72
 
86
73
  // src/modules/bonus.ts
87
- var campaignCurrency = () => mini.z._default(currencyOrEmpty(), "");
88
- var money = () => extension.wire({ amount: mini.z._default(minorUnits(), 0), currency: campaignCurrency() });
89
- var timeWindow = () => extension.wire({ starts_at: mini.z.optional(mini.z.string()), ends_at: mini.z.optional(mini.z.string()) });
90
- var ratio = () => extension.wire({ decimal: mini.z.optional(mini.z.string()), basis_points: mini.z.optional(mini.z.number()), maximum_scale: count() });
74
+ var campaignCurrency = () => z2__namespace._default(currencyOrEmpty(), "");
75
+ var money = () => extension.wire({ amount: z2__namespace._default(minorUnits(), 0), currency: campaignCurrency() });
76
+ var timeWindow = () => extension.wire({ starts_at: z2__namespace.optional(z2__namespace.string()), ends_at: z2__namespace.optional(z2__namespace.string()) });
77
+ var ratio = () => extension.wire({ decimal: z2__namespace.optional(z2__namespace.string()), basis_points: z2__namespace.optional(z2__namespace.number()), maximum_scale: count() });
91
78
  var empty = () => extension.wire({});
92
79
  var policy = (prefix) => extension.wire({ code: protoEnum(prefix), version: count() });
93
80
  var casinoSelector = () => extension.wire({
94
81
  provider_instance_id: text(),
95
- software_ids: list(mini.z.string()),
96
- game_ids: list(mini.z.string()),
97
- category_codes: list(mini.z.string())
82
+ software_ids: list(z2__namespace.string()),
83
+ game_ids: list(z2__namespace.string()),
84
+ category_codes: list(z2__namespace.string())
98
85
  });
99
86
  var sportsSelector = () => extension.wire({
100
- sport_codes: list(mini.z.string()),
101
- competition_ids: list(mini.z.string()),
102
- event_ids: list(mini.z.string()),
103
- market_codes: list(mini.z.string()),
104
- live: mini.z.optional(mini.z.boolean()),
87
+ sport_codes: list(z2__namespace.string()),
88
+ competition_ids: list(z2__namespace.string()),
89
+ event_ids: list(z2__namespace.string()),
90
+ market_codes: list(z2__namespace.string()),
91
+ live: z2__namespace.optional(z2__namespace.boolean()),
105
92
  bet_types: list(protoEnum("SPORTS_BET_TYPE_"))
106
93
  });
107
94
  var qualification = () => extension.wire({
108
95
  version: count(),
109
- immediate: mini.z.optional(empty()),
110
- user_event: mini.z.optional(
96
+ immediate: z2__namespace.optional(empty()),
97
+ user_event: z2__namespace.optional(
111
98
  extension.wire({
112
99
  event_code: text(),
113
100
  event_version: count(),
114
101
  source_authority: text(),
115
- identity_fields: list(mini.z.string())
102
+ identity_fields: list(z2__namespace.string())
116
103
  })
117
104
  ),
118
- deposit_settled: mini.z.optional(
105
+ deposit_settled: z2__namespace.optional(
119
106
  extension.wire({
120
107
  currency: campaignCurrency(),
121
- eligible_method_codes: list(mini.z.string()),
108
+ eligible_method_codes: list(z2__namespace.string()),
122
109
  first_deposit_policy: protoEnum("FIRST_DEPOSIT_POLICY_"),
123
- minimum_settled_net_amount: mini.z.optional(money()),
124
- maximum_settled_net_amount: mini.z.optional(money()),
110
+ minimum_settled_net_amount: z2__namespace.optional(money()),
111
+ maximum_settled_net_amount: z2__namespace.optional(money()),
125
112
  amount_basis: protoEnum("DEPOSIT_AMOUNT_BASIS_")
126
113
  })
127
114
  ),
128
- activity_aggregate: mini.z.optional(
115
+ activity_aggregate: z2__namespace.optional(
129
116
  extension.wire({
130
117
  basis: protoEnum("BASIS_"),
131
118
  product_scope: protoEnum("PRODUCT_SCOPE_"),
132
119
  currency: campaignCurrency(),
133
- window: mini.z.optional(durationSeconds()),
120
+ window: z2__namespace.optional(durationSeconds()),
134
121
  timezone: text(),
135
- late_event_grace: mini.z.optional(durationSeconds()),
136
- casino: mini.z.optional(casinoSelector()),
137
- sportsbook: mini.z.optional(sportsSelector())
122
+ late_event_grace: z2__namespace.optional(durationSeconds()),
123
+ casino: z2__namespace.optional(casinoSelector()),
124
+ sportsbook: z2__namespace.optional(sportsSelector())
138
125
  })
139
126
  )
140
127
  });
141
128
  var validity = () => extension.wire({
142
- no_expiry: mini.z.optional(empty()),
143
- absolute_expiry: mini.z.optional(extension.wire({ expires_at: mini.z.optional(mini.z.string()) })),
144
- duration_from_grant: mini.z.optional(extension.wire({ duration: mini.z.optional(durationSeconds()) }))
129
+ no_expiry: z2__namespace.optional(empty()),
130
+ absolute_expiry: z2__namespace.optional(extension.wire({ expires_at: z2__namespace.optional(z2__namespace.string()) })),
131
+ duration_from_grant: z2__namespace.optional(extension.wire({ duration: z2__namespace.optional(durationSeconds()) }))
145
132
  });
146
133
  var rounding = () => protoEnum("ROUNDING_MODE_");
147
134
  var proceedsClass = () => protoEnum("PROCEEDS_CLASS_");
148
135
  var percent = () => extension.wire({
149
- percentage: mini.z.optional(ratio()),
136
+ percentage: z2__namespace.optional(ratio()),
150
137
  rounding: rounding(),
151
- minimum_reward: mini.z.optional(money()),
152
- maximum_reward: mini.z.optional(money())
138
+ minimum_reward: z2__namespace.optional(money()),
139
+ maximum_reward: z2__namespace.optional(money())
153
140
  });
154
141
  var balanceCredit = () => extension.wire({
155
- fixed_amount: mini.z.optional(extension.wire({ amount: mini.z.optional(money()) })),
156
- percent_of_source_amount: mini.z.optional(percent()),
157
- aggregate_rebate: mini.z.optional(
142
+ fixed_amount: z2__namespace.optional(extension.wire({ amount: z2__namespace.optional(money()) })),
143
+ percent_of_source_amount: z2__namespace.optional(percent()),
144
+ aggregate_rebate: z2__namespace.optional(
158
145
  extension.wire({
159
- percentage: mini.z.optional(ratio()),
146
+ percentage: z2__namespace.optional(ratio()),
160
147
  rounding: rounding(),
161
- minimum_basis: mini.z.optional(money()),
162
- maximum_reward: mini.z.optional(money())
148
+ minimum_basis: z2__namespace.optional(money()),
149
+ maximum_reward: z2__namespace.optional(money())
163
150
  })
164
151
  ),
165
152
  balance_class: protoEnum("BALANCE_CLASS_"),
166
153
  proceeds_class: proceedsClass(),
167
- validity: mini.z.optional(validity())
154
+ validity: z2__namespace.optional(validity())
168
155
  });
169
- var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: mini.z.optional(money()) });
156
+ var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z2__namespace.optional(money()) });
170
157
  var oddsPolicy = () => extension.wire({
171
158
  mode: protoEnum("MODE_"),
172
- minimum_total_odds_decimal: mini.z.optional(mini.z.string()),
173
- minimum_odds_per_leg_decimal: mini.z.optional(mini.z.string()),
174
- minimum_legs: mini.z.optional(mini.z.number()),
175
- maximum_legs: mini.z.optional(mini.z.number())
159
+ minimum_total_odds_decimal: z2__namespace.optional(z2__namespace.string()),
160
+ minimum_odds_per_leg_decimal: z2__namespace.optional(z2__namespace.string()),
161
+ minimum_legs: z2__namespace.optional(z2__namespace.number()),
162
+ maximum_legs: z2__namespace.optional(z2__namespace.number())
176
163
  });
177
164
  var cashoutMode = () => protoEnum("RESTRICTED_CASHOUT_MODE_");
178
165
  var usePolicy = () => extension.wire({
179
166
  version: count(),
180
- funds_consumption: mini.z.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
181
- casino: mini.z.optional(extension.wire({ allowed_scopes: list(casinoSelector()), maximum_bet: mini.z.optional(maximumBet()) })),
182
- sportsbook: mini.z.optional(
167
+ funds_consumption: z2__namespace.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
168
+ casino: z2__namespace.optional(extension.wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z2__namespace.optional(maximumBet()) })),
169
+ sportsbook: z2__namespace.optional(
183
170
  extension.wire({
184
171
  allowed_scopes: list(sportsSelector()),
185
172
  excluded_scopes: list(sportsSelector()),
186
- maximum_bet: mini.z.optional(maximumBet()),
187
- funding_odds: mini.z.optional(oddsPolicy()),
173
+ maximum_bet: z2__namespace.optional(maximumBet()),
174
+ funding_odds: z2__namespace.optional(oddsPolicy()),
188
175
  cashout_mode: cashoutMode()
189
176
  })
190
177
  ),
191
- casino_and_sportsbook: mini.z.optional(
178
+ casino_and_sportsbook: z2__namespace.optional(
192
179
  extension.wire({
193
180
  allowed_casino_scopes: list(casinoSelector()),
194
181
  allowed_sportsbook_scopes: list(sportsSelector()),
195
182
  excluded_sportsbook_scopes: list(sportsSelector()),
196
- maximum_casino_bet: mini.z.optional(maximumBet()),
197
- maximum_sportsbook_bet: mini.z.optional(maximumBet()),
198
- sportsbook_funding_odds: mini.z.optional(oddsPolicy()),
183
+ maximum_casino_bet: z2__namespace.optional(maximumBet()),
184
+ maximum_sportsbook_bet: z2__namespace.optional(maximumBet()),
185
+ sportsbook_funding_odds: z2__namespace.optional(oddsPolicy()),
199
186
  sportsbook_cashout_mode: cashoutMode()
200
187
  })
201
188
  ),
202
- payout_allocation: mini.z.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
189
+ payout_allocation: z2__namespace.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
203
190
  });
204
191
  var wageringPolicy = () => extension.wire({
205
192
  version: count(),
206
- none: mini.z.optional(empty()),
207
- multiplier: mini.z.optional(
193
+ none: z2__namespace.optional(empty()),
194
+ multiplier: z2__namespace.optional(
208
195
  extension.wire({
209
196
  requirement_basis: protoEnum("REQUIREMENT_BASIS_"),
210
- multiplier: mini.z.optional(ratio()),
197
+ multiplier: z2__namespace.optional(ratio()),
211
198
  contribution_rates: list(
212
199
  extension.wire({
213
- casino: mini.z.optional(casinoSelector()),
214
- sportsbook: mini.z.optional(sportsSelector()),
215
- rate: mini.z.optional(ratio())
200
+ casino: z2__namespace.optional(casinoSelector()),
201
+ sportsbook: z2__namespace.optional(sportsSelector()),
202
+ rate: z2__namespace.optional(ratio())
216
203
  })
217
204
  ),
218
- deadline: mini.z.optional(validity()),
205
+ deadline: z2__namespace.optional(validity()),
219
206
  rounding: rounding(),
220
- sportsbook_contribution_odds: mini.z.optional(oddsPolicy())
207
+ sportsbook_contribution_odds: z2__namespace.optional(oddsPolicy())
221
208
  })
222
209
  )
223
210
  });
224
211
  var stackingPolicy = () => extension.wire({
225
212
  version: count(),
226
- exclusive_in_group: mini.z.optional(extension.wire({ stacking_group_key: text() })),
227
- multiple_in_group: mini.z.optional(extension.wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
213
+ exclusive_in_group: z2__namespace.optional(extension.wire({ stacking_group_key: text() })),
214
+ multiple_in_group: z2__namespace.optional(extension.wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
228
215
  });
229
216
  var reward = () => extension.wire({
230
217
  reward_key: text(),
@@ -232,49 +219,49 @@ var reward = () => extension.wire({
232
219
  reward_kind_version: count(),
233
220
  execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
234
221
  execution_profile_version: count(),
235
- balance_credit: mini.z.optional(balanceCredit()),
236
- provider_managed_balance: mini.z.optional(extension.wire({ provider_code: text() })),
237
- casino_free_spins: mini.z.optional(
222
+ balance_credit: z2__namespace.optional(balanceCredit()),
223
+ provider_managed_balance: z2__namespace.optional(extension.wire({ provider_code: text() })),
224
+ casino_free_spins: z2__namespace.optional(
238
225
  extension.wire({
239
226
  provider_code: text(),
240
- casino_scope: mini.z.optional(casinoSelector()),
227
+ casino_scope: z2__namespace.optional(casinoSelector()),
241
228
  quantity: count(),
242
- denomination: mini.z.optional(money()),
229
+ denomination: z2__namespace.optional(money()),
243
230
  currency: campaignCurrency(),
244
- grant_window: mini.z.optional(timeWindow()),
231
+ grant_window: z2__namespace.optional(timeWindow()),
245
232
  proceeds_class: proceedsClass(),
246
- maximum_winnings: mini.z.optional(money())
233
+ maximum_winnings: z2__namespace.optional(money())
247
234
  })
248
235
  ),
249
- sports_bonus_bet: mini.z.optional(
236
+ sports_bonus_bet: z2__namespace.optional(
250
237
  extension.wire({
251
238
  provider_code: text(),
252
- sportsbook_scope: mini.z.optional(sportsSelector()),
253
- amount: mini.z.optional(money()),
239
+ sportsbook_scope: z2__namespace.optional(sportsSelector()),
240
+ amount: z2__namespace.optional(money()),
254
241
  quantity: count(),
255
- validity: mini.z.optional(validity())
242
+ validity: z2__namespace.optional(validity())
256
243
  })
257
244
  ),
258
- sports_bet_coverage: mini.z.optional(
245
+ sports_bet_coverage: z2__namespace.optional(
259
246
  extension.wire({
260
247
  provider_code: text(),
261
- qualifying_bet_scope: mini.z.optional(sportsSelector()),
262
- coverage_cap: mini.z.optional(money()),
263
- validity: mini.z.optional(validity())
248
+ qualifying_bet_scope: z2__namespace.optional(sportsSelector()),
249
+ coverage_cap: z2__namespace.optional(money()),
250
+ validity: z2__namespace.optional(validity())
264
251
  })
265
252
  ),
266
- use_policy: mini.z.optional(usePolicy()),
267
- wagering_policy: mini.z.optional(wageringPolicy()),
268
- stacking_policy: mini.z.optional(stackingPolicy()),
269
- restricted_position_selection_policy: mini.z.optional(
253
+ use_policy: z2__namespace.optional(usePolicy()),
254
+ wagering_policy: z2__namespace.optional(wageringPolicy()),
255
+ stacking_policy: z2__namespace.optional(stackingPolicy()),
256
+ restricted_position_selection_policy: z2__namespace.optional(
270
257
  extension.wire({
271
258
  version: count(),
272
- priority_then_earliest_expiry: mini.z.optional(extension.wire({ selection_priority: mini.z.optional(mini.z.number()) }))
259
+ priority_then_earliest_expiry: z2__namespace.optional(extension.wire({ selection_priority: z2__namespace.optional(z2__namespace.number()) }))
273
260
  })
274
261
  )
275
262
  });
276
263
  var localizedContent = () => extension.wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
277
- var content = () => extension.wire({ default_locale: text(), supported_locales: list(mini.z.string()), localized_content: list(localizedContent()) });
264
+ var content = () => extension.wire({ default_locale: text(), supported_locales: list(z2__namespace.string()), localized_content: list(localizedContent()) });
278
265
  var offerSchema = /* @__PURE__ */ extension.lazy(
279
266
  () => extension.wire({
280
267
  campaign_id: text(),
@@ -282,33 +269,33 @@ var offerSchema = /* @__PURE__ */ extension.lazy(
282
269
  publication_id: text(),
283
270
  product_scope: protoEnum("PRODUCT_SCOPE_"),
284
271
  timezone: text(),
285
- enrollment_window: mini.z.optional(timeWindow()),
286
- qualification_window: mini.z.optional(timeWindow()),
287
- claim_window: mini.z.optional(timeWindow()),
288
- entry_policy: mini.z.optional(policy("ENTRY_POLICY_CODE_")),
289
- reward_claim_policy: mini.z.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
290
- qualification: mini.z.optional(qualification()),
291
- reward: mini.z.optional(reward()),
292
- publication_starts_at: mini.z.optional(mini.z.string()),
293
- publication_ends_at: mini.z.optional(mini.z.string()),
294
- content: mini.z.optional(content())
272
+ enrollment_window: z2__namespace.optional(timeWindow()),
273
+ qualification_window: z2__namespace.optional(timeWindow()),
274
+ claim_window: z2__namespace.optional(timeWindow()),
275
+ entry_policy: z2__namespace.optional(policy("ENTRY_POLICY_CODE_")),
276
+ reward_claim_policy: z2__namespace.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
277
+ qualification: z2__namespace.optional(qualification()),
278
+ reward: z2__namespace.optional(reward()),
279
+ publication_starts_at: z2__namespace.optional(z2__namespace.string()),
280
+ publication_ends_at: z2__namespace.optional(z2__namespace.string()),
281
+ content: z2__namespace.optional(content())
295
282
  })
296
283
  );
297
284
  function grantMoney(value, currency) {
298
285
  return { amount: value?.amount ?? 0, currency: value?.currency || currency };
299
286
  }
300
- var rewardGrant = () => mini.z.pipe(
287
+ var rewardGrant = () => z2__namespace.pipe(
301
288
  extension.wire({
302
289
  state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
303
- granted: mini.z.optional(money()),
304
- balance: mini.z.optional(money()),
305
- converted: mini.z.optional(money()),
306
- expires_at: mini.z.optional(mini.z.string()),
307
- wagering: mini.z.optional(
308
- extension.wire({ required: mini.z.optional(money()), accumulated: mini.z.optional(money()), completed_at: mini.z.optional(mini.z.string()) })
290
+ granted: z2__namespace.optional(money()),
291
+ balance: z2__namespace.optional(money()),
292
+ converted: z2__namespace.optional(money()),
293
+ expires_at: z2__namespace.optional(z2__namespace.string()),
294
+ wagering: z2__namespace.optional(
295
+ extension.wire({ required: z2__namespace.optional(money()), accumulated: z2__namespace.optional(money()), completed_at: z2__namespace.optional(z2__namespace.string()) })
309
296
  )
310
297
  }),
311
- mini.z.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
298
+ z2__namespace.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
312
299
  const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
313
300
  const out = {
314
301
  state,
@@ -328,40 +315,40 @@ var rewardGrant = () => mini.z.pipe(
328
315
  })
329
316
  );
330
317
  var participationSchema = /* @__PURE__ */ extension.lazy(
331
- () => mini.z.pipe(
318
+ () => z2__namespace.pipe(
332
319
  extension.wire({
333
320
  id: text(),
334
321
  campaign_id: text(),
335
322
  campaign_version_id: text(),
336
323
  reward_key: text(),
337
- qualification_snapshot: mini.z.optional(qualification()),
324
+ qualification_snapshot: z2__namespace.optional(qualification()),
338
325
  // oneof `state`: only one of the cases is filled in.
339
- enrolled: mini.z.optional(empty()),
340
- qualifying: mini.z.optional(empty()),
341
- qualified: mini.z.optional(extension.wire({ qualified_at: mini.z.optional(mini.z.string()) })),
342
- reward_pending: mini.z.optional(empty()),
343
- completed: mini.z.optional(extension.wire({ completed_at: mini.z.optional(mini.z.string()) })),
344
- reward_failed: mini.z.optional(empty()),
345
- expired: mini.z.optional(extension.wire({ expired_at: mini.z.optional(mini.z.string()) })),
346
- cancelled: mini.z.optional(empty()),
347
- reward_grant: mini.z.optional(rewardGrant()),
348
- snapshot: mini.z.optional(
326
+ enrolled: z2__namespace.optional(empty()),
327
+ qualifying: z2__namespace.optional(empty()),
328
+ qualified: z2__namespace.optional(extension.wire({ qualified_at: z2__namespace.optional(z2__namespace.string()) })),
329
+ reward_pending: z2__namespace.optional(empty()),
330
+ completed: z2__namespace.optional(extension.wire({ completed_at: z2__namespace.optional(z2__namespace.string()) })),
331
+ reward_failed: z2__namespace.optional(empty()),
332
+ expired: z2__namespace.optional(extension.wire({ expired_at: z2__namespace.optional(z2__namespace.string()) })),
333
+ cancelled: z2__namespace.optional(empty()),
334
+ reward_grant: z2__namespace.optional(rewardGrant()),
335
+ snapshot: z2__namespace.optional(
349
336
  extension.wire({
350
- reward: mini.z.optional(reward()),
351
- content: mini.z.optional(content()),
352
- terms_acceptance: mini.z.optional(
337
+ reward: z2__namespace.optional(reward()),
338
+ content: z2__namespace.optional(content()),
339
+ terms_acceptance: z2__namespace.optional(
353
340
  extension.wire({
354
341
  locale: text(),
355
342
  terms_revision: text(),
356
343
  terms_digest_sha256_hex: text(),
357
- accepted_at: mini.z.optional(mini.z.string())
344
+ accepted_at: z2__namespace.optional(z2__namespace.string())
358
345
  })
359
346
  )
360
347
  })
361
348
  )
362
349
  }),
363
350
  // The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
364
- mini.z.transform(
351
+ z2__namespace.transform(
365
352
  ({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
366
353
  const out = { ...rest, status: "unspecified" };
367
354
  if (enrolled) out.status = "enrolled";
@@ -383,7 +370,7 @@ var participationSchema = /* @__PURE__ */ extension.lazy(
383
370
  )
384
371
  )
385
372
  );
386
- var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor: mini.z.optional(mini.z.string()) });
373
+ var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor: z2__namespace.optional(z2__namespace.string()) });
387
374
  var offersPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("offers", offerSchema()));
388
375
  var participationsPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("participations", participationSchema()));
389
376
  var offerEnvelope = /* @__PURE__ */ extension.lazy(() => extension.wire({ offer: offerSchema() }));
@@ -396,64 +383,64 @@ function toCursorPage(key, data) {
396
383
  if (data.nextCursor) page.nextCursor = data.nextCursor;
397
384
  return page;
398
385
  }
399
- var nullableDate = () => mini.z.pipe(
400
- mini.z.nullish(mini.z.string()),
401
- mini.z.transform((value) => value ?? void 0)
386
+ var nullableDate = () => z2__namespace.pipe(
387
+ z2__namespace.nullish(z2__namespace.string()),
388
+ z2__namespace.transform((value) => value ?? void 0)
402
389
  );
403
390
  function compact(value) {
404
391
  return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
405
392
  }
406
393
  var overviewSchema = /* @__PURE__ */ extension.lazy(
407
- () => mini.z.pipe(
394
+ () => z2__namespace.pipe(
408
395
  extension.wire({
409
396
  currencies: list(
410
- mini.z.pipe(
397
+ z2__namespace.pipe(
411
398
  extension.wire({
412
399
  currency: currencyOrEmpty(),
413
- decimal_places: mini.z.number(),
400
+ decimal_places: z2__namespace.number(),
414
401
  restricted_total: minorUnits(),
415
402
  expiring_7d: minorUnits(),
416
- open_positions: mini.z.number(),
403
+ open_positions: z2__namespace.number(),
417
404
  next_expires_at: nullableDate(),
418
405
  converted: minorUnits(),
419
- converted_campaigns: mini.z.number()
406
+ converted_campaigns: z2__namespace.number()
420
407
  }),
421
- mini.z.transform(compact)
408
+ z2__namespace.transform(compact)
422
409
  )
423
410
  ),
424
411
  as_of: nullableDate()
425
412
  }),
426
- mini.z.transform(compact)
413
+ z2__namespace.transform(compact)
427
414
  )
428
415
  );
429
416
  var positionsPage = /* @__PURE__ */ extension.lazy(
430
417
  () => extension.wire({
431
418
  rows: list(
432
- mini.z.pipe(
419
+ z2__namespace.pipe(
433
420
  extension.wire({
434
- position_id: mini.z.string(),
435
- campaign_id: mini.z.string(),
421
+ position_id: z2__namespace.string(),
422
+ campaign_id: z2__namespace.string(),
436
423
  currency: currencyOrEmpty(),
437
- decimal_places: mini.z.number(),
424
+ decimal_places: z2__namespace.number(),
438
425
  granted: minorUnits(),
439
426
  restricted: minorUnits(),
440
427
  converted: minorUnits(),
441
428
  required: minorUnits(),
442
429
  wagered: minorUnits(),
443
430
  remaining: minorUnits(),
444
- state: mini.z.string(),
431
+ state: z2__namespace.string(),
445
432
  // The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
446
- terminal_action: mini.z.pipe(
447
- mini.z.nullish(mini.z.string()),
448
- mini.z.transform((value) => value ? value.toLowerCase() : void 0)
433
+ terminal_action: z2__namespace.pipe(
434
+ z2__namespace.nullish(z2__namespace.string()),
435
+ z2__namespace.transform((value) => value ? value.toLowerCase() : void 0)
449
436
  ),
450
437
  expires_at: nullableDate(),
451
438
  created_at: nullableDate()
452
439
  }),
453
- mini.z.transform((row) => compact(row))
440
+ z2__namespace.transform((row) => compact(row))
454
441
  )
455
442
  ),
456
- next_cursor: mini.z.optional(mini.z.string())
443
+ next_cursor: z2__namespace.optional(z2__namespace.string())
457
444
  })
458
445
  );
459
446
  var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
@@ -547,51 +534,51 @@ function createBonusApi(transport) {
547
534
  }
548
535
  var gameSchema = /* @__PURE__ */ extension.lazy(
549
536
  () => extension.wire({
550
- id: mini.z.string(),
551
- name: mini.z.string(),
552
- provider: mini.z.string(),
553
- category: mini.z.string(),
554
- type: mini.z.string(),
555
- thumbnail: mini.z.string(),
556
- is_new: mini.z.boolean(),
557
- is_popular: mini.z.boolean(),
558
- is_live: mini.z.boolean(),
559
- demo_available: mini.z.boolean(),
560
- rtp: mini.z.number(),
561
- volatility: mini.z.string(),
562
- priority: mini.z.number()
537
+ id: z2__namespace.string(),
538
+ name: z2__namespace.string(),
539
+ provider: z2__namespace.string(),
540
+ category: z2__namespace.string(),
541
+ type: z2__namespace.string(),
542
+ thumbnail: z2__namespace.string(),
543
+ is_new: z2__namespace.boolean(),
544
+ is_popular: z2__namespace.boolean(),
545
+ is_live: z2__namespace.boolean(),
546
+ demo_available: z2__namespace.boolean(),
547
+ rtp: z2__namespace.number(),
548
+ volatility: z2__namespace.string(),
549
+ priority: z2__namespace.number()
563
550
  })
564
551
  );
565
552
  var categoriesSchema = /* @__PURE__ */ extension.lazy(
566
- () => mini.z.array(
567
- extension.wire({ slug: mini.z.string(), name: mini.z.string(), icon: mini.z.string(), game_count: mini.z.number(), priority: mini.z.number() })
553
+ () => z2__namespace.array(
554
+ extension.wire({ slug: z2__namespace.string(), name: z2__namespace.string(), icon: z2__namespace.string(), game_count: z2__namespace.number(), priority: z2__namespace.number() })
568
555
  )
569
556
  );
570
557
  var providersSchema = /* @__PURE__ */ extension.lazy(
571
- () => mini.z.array(extension.wire({ id: mini.z.string(), name: mini.z.string(), game_count: mini.z.number() }))
558
+ () => z2__namespace.array(extension.wire({ id: z2__namespace.string(), name: z2__namespace.string(), game_count: z2__namespace.number() }))
572
559
  );
573
560
  var launchSchema = /* @__PURE__ */ extension.lazy(
574
- () => mini.z.pipe(
561
+ () => z2__namespace.pipe(
575
562
  extension.wire({
576
- session_id: mini.z.string().check(mini.z.minLength(1)),
577
- game_url: mini.z.string().check(mini.z.minLength(1)),
563
+ session_id: z2__namespace.string().check(z2__namespace.minLength(1)),
564
+ game_url: z2__namespace.string().check(z2__namespace.minLength(1)),
578
565
  // Any text: a target the SDK does not know yet must not fail the (strict) launch.
579
- launch_target: mini.z.optional(mini.z.string()),
580
- provider_code: mini.z.optional(mini.z.string()),
581
- expires_at: mini.z.optional(mini.z.string())
566
+ launch_target: z2__namespace.optional(z2__namespace.string()),
567
+ provider_code: z2__namespace.optional(z2__namespace.string()),
568
+ expires_at: z2__namespace.optional(z2__namespace.string())
582
569
  }),
583
570
  // Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
584
571
  // before the field existed: an iframe.
585
- mini.z.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
572
+ z2__namespace.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
586
573
  )
587
574
  );
588
575
  var sessionSchema = /* @__PURE__ */ extension.lazy(
589
576
  () => extension.wire({
590
- id: mini.z.string(),
591
- game_id: mini.z.string(),
592
- game_name: mini.z.string(),
593
- provider: mini.z.string(),
594
- start_time: mini.z.string(),
577
+ id: z2__namespace.string(),
578
+ game_id: z2__namespace.string(),
579
+ game_name: z2__namespace.string(),
580
+ provider: z2__namespace.string(),
581
+ start_time: z2__namespace.string(),
595
582
  total_bet: extension.money(),
596
583
  total_win: extension.money(),
597
584
  status: protoEnum("SESSION_STATUS_")
@@ -599,27 +586,27 @@ var sessionSchema = /* @__PURE__ */ extension.lazy(
599
586
  );
600
587
  var transactionSchema = /* @__PURE__ */ extension.lazy(
601
588
  () => extension.wire({
602
- id: mini.z.string(),
603
- game_id: mini.z.string(),
604
- game_name: mini.z.string(),
605
- round_id: mini.z.string(),
589
+ id: z2__namespace.string(),
590
+ game_id: z2__namespace.string(),
591
+ game_name: z2__namespace.string(),
592
+ round_id: z2__namespace.string(),
606
593
  type: protoEnum("CASINO_TRANSACTION_TYPE_"),
607
594
  amount: minorUnits(),
608
595
  currency: extension.currencyCode(),
609
596
  currency_decimal_places: extension.decimalPlaces(),
610
- created_at: mini.z.string()
597
+ created_at: z2__namespace.string()
611
598
  })
612
599
  );
613
600
  var winnersSchema = /* @__PURE__ */ extension.lazy(
614
- () => mini.z.array(
601
+ () => z2__namespace.array(
615
602
  extension.wire({
616
- player: mini.z.string(),
603
+ player: z2__namespace.string(),
617
604
  amount: minorUnits(),
618
605
  currency: extension.currencyCode(),
619
606
  currency_decimal_places: extension.decimalPlaces(),
620
- game_id: mini.z.string(),
621
- game_name: mini.z.string(),
622
- won_at: mini.z.string()
607
+ game_id: z2__namespace.string(),
608
+ game_name: z2__namespace.string(),
609
+ won_at: z2__namespace.string()
623
610
  })
624
611
  )
625
612
  );
@@ -709,28 +696,28 @@ function pageInputProblem(name, input) {
709
696
  return void 0;
710
697
  }
711
698
  function optionalTimestamp() {
712
- return mini.z.pipe(
713
- mini.z.nullish(mini.z.string().check(mini.z.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
714
- mini.z.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
699
+ return z2__namespace.pipe(
700
+ z2__namespace.nullish(z2__namespace.string().check(z2__namespace.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
701
+ z2__namespace.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
715
702
  );
716
703
  }
717
704
  function optionalText() {
718
- return mini.z.pipe(
719
- mini.z.nullish(mini.z.string()),
720
- mini.z.transform((value) => value == null || value === "" ? null : value)
705
+ return z2__namespace.pipe(
706
+ z2__namespace.nullish(z2__namespace.string()),
707
+ z2__namespace.transform((value) => value == null || value === "" ? null : value)
721
708
  );
722
709
  }
723
710
  function nullableList(item) {
724
- return mini.z.pipe(
725
- mini.z.nullish(mini.z.array(item)),
726
- mini.z.transform((value) => value ?? [])
711
+ return z2__namespace.pipe(
712
+ z2__namespace.nullish(z2__namespace.array(item)),
713
+ z2__namespace.transform((value) => value ?? [])
727
714
  );
728
715
  }
729
716
 
730
717
  // src/modules/loyalty.ts
731
- var tierBenefits = () => mini.z.pipe(
732
- mini.z.nullish(mini.z.string()),
733
- mini.z.transform((text2, ctx) => {
718
+ var tierBenefits = () => z2__namespace.pipe(
719
+ z2__namespace.nullish(z2__namespace.string()),
720
+ z2__namespace.transform((text2, ctx) => {
734
721
  if (text2 == null || text2.trim() === "") return null;
735
722
  let parsed;
736
723
  try {
@@ -741,43 +728,43 @@ var tierBenefits = () => mini.z.pipe(
741
728
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed))
742
729
  return parsed;
743
730
  ctx.issues.push({ code: "custom", message: "tier_benefits_json is not a JSON object", input: void 0 });
744
- return mini.z.NEVER;
731
+ return z2__namespace.NEVER;
745
732
  })
746
733
  );
747
734
  var loyaltySchema = /* @__PURE__ */ extension.lazy(
748
- () => mini.z.pipe(
735
+ () => z2__namespace.pipe(
749
736
  extension.wire({
750
737
  total_points_earned: integerText(),
751
738
  current_points: integerText(),
752
739
  points_redeemed: integerText(),
753
740
  current_tier: optionalText(),
754
741
  tier_points: integerText(),
755
- lifetime_wagered: mini.z._default(minorUnits(), 0),
756
- lifetime_deposited: mini.z._default(minorUnits(), 0),
742
+ lifetime_wagered: z2__namespace._default(minorUnits(), 0),
743
+ lifetime_deposited: z2__namespace._default(minorUnits(), 0),
757
744
  tier_benefits_json: tierBenefits(),
758
745
  tier_expires_at: optionalTimestamp()
759
746
  }),
760
- mini.z.transform(({ tierBenefitsJson, ...rest }) => {
747
+ z2__namespace.transform(({ tierBenefitsJson, ...rest }) => {
761
748
  const benefits = typeof tierBenefitsJson === "object" && tierBenefitsJson !== null && !Array.isArray(tierBenefitsJson) ? tierBenefitsJson : null;
762
749
  return { ...rest, tierBenefits: benefits };
763
750
  })
764
751
  )
765
752
  );
766
753
  var redeemSchema = /* @__PURE__ */ extension.lazy(
767
- () => mini.z.pipe(
754
+ () => z2__namespace.pipe(
768
755
  extension.wire({
769
- success: mini.z.optional(mini.z.boolean()),
770
- message: mini.z.optional(mini.z.string()),
756
+ success: z2__namespace.optional(z2__namespace.boolean()),
757
+ message: z2__namespace.optional(z2__namespace.string()),
771
758
  redeemed_points: integerText(),
772
- value: mini.z.nullish(minorUnits()),
759
+ value: z2__namespace.nullish(minorUnits()),
773
760
  // Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
774
- currency: mini.z.pipe(
775
- mini.z.nullish(currencyOrEmpty()),
776
- mini.z.transform((value) => value == null || value === "" ? null : value)
761
+ currency: z2__namespace.pipe(
762
+ z2__namespace.nullish(currencyOrEmpty()),
763
+ z2__namespace.transform((value) => value == null || value === "" ? null : value)
777
764
  ),
778
765
  bonus_id: optionalText()
779
766
  }),
780
- mini.z.transform((data) => ({
767
+ z2__namespace.transform((data) => ({
781
768
  success: data.success,
782
769
  message: data.message,
783
770
  redeemedPoints: data.redeemedPoints,
@@ -821,12 +808,12 @@ function createLoyaltyApi(transport) {
821
808
  };
822
809
  }
823
810
  function openUnion(values) {
824
- return mini.z.pipe(
825
- mini.z.pipe(
826
- mini.z.string(),
827
- mini.z.transform((value) => value.toLowerCase())
811
+ return z2__namespace.pipe(
812
+ z2__namespace.pipe(
813
+ z2__namespace.string(),
814
+ z2__namespace.transform((value) => value.toLowerCase())
828
815
  ),
829
- mini.z.enum(values)
816
+ z2__namespace.enum(values)
830
817
  );
831
818
  }
832
819
 
@@ -837,14 +824,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
837
824
  var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
838
825
  var missionSchema = /* @__PURE__ */ extension.lazy(
839
826
  () => extension.wire({
840
- id: mini.z.string(),
841
- name: mini.z.string(),
842
- description: mini.z._default(mini.z.string(), ""),
827
+ id: z2__namespace.string(),
828
+ name: z2__namespace.string(),
829
+ description: z2__namespace._default(z2__namespace.string(), ""),
843
830
  mission_type: openUnion(MISSION_TYPES),
844
831
  objective_type: openUnion(OBJECTIVE_TYPES),
845
832
  target_value: integerText(),
846
833
  target_game_category: optionalText(),
847
- target_games: nullableList(mini.z.string()),
834
+ target_games: nullableList(z2__namespace.string()),
848
835
  reward_type: openUnion(REWARD_TYPES),
849
836
  reward_value: minorUnits(),
850
837
  valid_from: optionalTimestamp(),
@@ -852,16 +839,16 @@ var missionSchema = /* @__PURE__ */ extension.lazy(
852
839
  })
853
840
  );
854
841
  var userMissionsSchema = /* @__PURE__ */ extension.lazy(
855
- () => mini.z.pipe(
842
+ () => z2__namespace.pipe(
856
843
  extension.wire({
857
844
  missions: nullableList(
858
845
  extension.wire({
859
- id: mini.z.string(),
860
- mission_id: mini.z.string(),
861
- mission_name: mini.z._default(mini.z.string(), ""),
846
+ id: z2__namespace.string(),
847
+ mission_id: z2__namespace.string(),
848
+ mission_name: z2__namespace._default(z2__namespace.string(), ""),
862
849
  current_progress: integerText(),
863
850
  target_value: integerText(),
864
- progress_percentage: mini.z.number(),
851
+ progress_percentage: z2__namespace.number(),
865
852
  status: openUnion(USER_MISSION_STATUSES),
866
853
  reward_type: openUnion(REWARD_TYPES),
867
854
  reward_value: minorUnits(),
@@ -870,7 +857,7 @@ var userMissionsSchema = /* @__PURE__ */ extension.lazy(
870
857
  })
871
858
  )
872
859
  }),
873
- mini.z.transform((data) => data.missions)
860
+ z2__namespace.transform((data) => data.missions)
874
861
  )
875
862
  );
876
863
  function createMissionsApi(transport) {
@@ -898,150 +885,122 @@ function createMissionsApi(transport) {
898
885
  })
899
886
  };
900
887
  }
901
- var STATUSES = ["pending", "qualified", "completed", "expired", "unspecified"];
902
- var status = () => mini.z.pipe(protoEnum("REFERRAL_STATUS_"), mini.z.enum(STATUSES));
903
888
  var DEFAULT_PER_PAGE = 20;
904
- var count2 = () => mini.z._default(mini.z.number().check(mini.z.refine((value) => Number.isInteger(value) && value >= 0, "invalid counter")), 0);
905
889
  var HISTORY_PATH = "/referrals/history";
906
- var REGISTER_ROUTE = { method: "POST", path: "/referrals/register" };
907
- function maskEmail(value) {
908
- if (typeof value !== "string") return null;
909
- const email = value.trim();
910
- const parts = email.split("@");
911
- if (parts.length !== 2 || /\s/.test(email)) return null;
912
- const [local, domain] = parts;
913
- if (local === "" || domain === "") return null;
914
- const chars = Array.from(local);
915
- return `${chars.length === 1 ? "*" : chars[0] + "*".repeat(chars.length - 1)}@${domain}`;
916
- }
890
+ var count2 = () => z2__namespace._default(z2__namespace.number().check(z2__namespace.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
891
+ var money3 = () => z2__namespace.pipe(
892
+ z2__namespace.nullish(extension.wire({ minor_units: minorUnits(), currency: z2__namespace._default(currencyOrEmpty(), "") })),
893
+ z2__namespace.transform(
894
+ (value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
895
+ )
896
+ );
897
+ var rulesSchema = () => z2__namespace.pipe(
898
+ z2__namespace.nullish(
899
+ extension.wire({
900
+ reward: money3(),
901
+ minimum_real_net_loss: money3(),
902
+ referee_window_days: count2(),
903
+ hold_hours: count2(),
904
+ wagering_multiplier: z2__namespace._default(z2__namespace.string(), ""),
905
+ maximum_conversion: money3()
906
+ })
907
+ ),
908
+ z2__namespace.transform((rules) => {
909
+ if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
910
+ return {
911
+ reward: rules.reward,
912
+ minimumRealNetLoss: rules.minimumRealNetLoss,
913
+ refereeWindowDays: rules.refereeWindowDays,
914
+ holdHours: rules.holdHours,
915
+ wageringMultiplier: rules.wageringMultiplier,
916
+ maximumConversion: rules.maximumConversion
917
+ };
918
+ })
919
+ );
917
920
  var infoSchema = /* @__PURE__ */ extension.lazy(
918
- () => mini.z.pipe(
921
+ () => z2__namespace.pipe(
919
922
  extension.wire({
923
+ enabled: z2__namespace._default(z2__namespace.boolean(), false),
920
924
  referral_code: optionalText(),
921
- referral_link: optionalText(),
922
- total_referrals: count2(),
923
- completed_referrals: count2(),
924
- pending_referrals: count2(),
925
- total_earned: majorUnits(),
926
- bonus_per_referral: majorUnits(),
927
- min_deposit: majorUnits()
925
+ rules: rulesSchema(),
926
+ totals: z2__namespace._default(
927
+ extension.wire({
928
+ registered: count2(),
929
+ deposited: count2(),
930
+ in_hold: count2(),
931
+ paid: count2(),
932
+ not_eligible: count2(),
933
+ expired: count2(),
934
+ cancelled: count2()
935
+ }),
936
+ { registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
937
+ )
928
938
  }),
929
- mini.z.transform(
930
- ({ referralCode, referralLink, ...rest }) => ({
931
- code: referralCode,
932
- link: referralLink,
933
- ...rest
934
- })
939
+ z2__namespace.transform(
940
+ ({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
935
941
  )
936
942
  )
937
943
  );
938
- var MinorAmount = class {
939
- constructor(value) {
940
- this.value = value;
941
- }
942
- value;
943
- };
944
- var minorAmount = () => mini.z.pipe(
945
- majorUnits(),
946
- mini.z.transform((value) => new MinorAmount(value))
947
- );
948
- var BUILT = /* @__PURE__ */ new WeakSet();
949
- var referralSchema = /* @__PURE__ */ extension.lazy(
950
- () => mini.z.pipe(
944
+ function remainingOf(target, loss) {
945
+ const missing = BigInt(target.amount) - BigInt(loss.amount);
946
+ return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
947
+ }
948
+ var progressSchema = () => z2__namespace.pipe(
949
+ z2__namespace.nullish(
951
950
  extension.wire({
952
- id: mini.z.string(),
953
- referee_id: mini.z.optional(mini.z.string()),
954
- referee_email: mini.z.nullish(mini.z.string()),
955
- referee_name: optionalText(),
956
- referral_code: mini.z._default(mini.z.string(), ""),
957
- status: status(),
958
- referrer_bonus: minorAmount(),
959
- referee_bonus: minorAmount(),
960
- created_at: optionalTimestamp(),
961
- completed_at: optionalTimestamp(),
962
- expires_at: optionalTimestamp()
963
- }),
964
- mini.z.transform((r) => {
965
- const referrerBonus = r.referrerBonus;
966
- const refereeBonus = r.refereeBonus;
967
- if (!(referrerBonus instanceof MinorAmount) || !(refereeBonus instanceof MinorAmount)) return null;
968
- const item = {
969
- id: r.id,
970
- refereeName: r.refereeName,
971
- refereeEmailMasked: maskEmail(r.refereeEmail),
972
- code: r.referralCode,
973
- status: r.status,
974
- referrerBonus: referrerBonus.value,
975
- refereeBonus: refereeBonus.value,
976
- createdAt: r.createdAt,
977
- completedAt: r.completedAt,
978
- expiresAt: r.expiresAt
979
- };
980
- BUILT.add(item);
981
- return item;
951
+ deposit_done: z2__namespace._default(z2__namespace.boolean(), false),
952
+ real_net_loss: money3(),
953
+ target: money3(),
954
+ remaining: money3()
982
955
  })
983
- )
956
+ ),
957
+ z2__namespace.transform((progress) => {
958
+ if (progress == null || progress.target === null) return null;
959
+ const { target } = progress;
960
+ const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
961
+ return {
962
+ depositDone: progress.depositDone,
963
+ realNetLoss,
964
+ target,
965
+ remaining: progress.remaining ?? remainingOf(target, realNetLoss)
966
+ };
967
+ })
984
968
  );
985
- function rawReferral(value) {
986
- if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
987
- const snake = {};
988
- for (const [key, field] of Object.entries(value)) snake[key.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`)] = field;
989
- const result = referralSchema().safeParse(snake);
990
- return result.success ? result.data : null;
991
- }
992
- function historyItems(list2) {
993
- if (!Array.isArray(list2)) return [];
994
- const items = [];
995
- for (const entry of list2) {
996
- const item = typeof entry === "object" && entry !== null && BUILT.has(entry) ? entry : rawReferral(entry);
997
- if (item !== null) items.push(item);
998
- }
999
- return items;
969
+ var LEGACY_STATUS = { COMPLETED: "paid", EXPIRED: "expired", PENDING: "registered" };
970
+ function statusOf(playerStatus, legacy) {
971
+ if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
972
+ return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
1000
973
  }
1001
- var reportedTotal = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : 0;
974
+ var referralSchema = () => z2__namespace.pipe(
975
+ extension.wire({
976
+ id: z2__namespace.string(),
977
+ referee_name: optionalText(),
978
+ status: optionalText(),
979
+ player_status: optionalText(),
980
+ created_at: optionalTimestamp(),
981
+ deadline_at: optionalTimestamp(),
982
+ progress: progressSchema()
983
+ }),
984
+ z2__namespace.transform(
985
+ (r) => ({
986
+ id: r.id,
987
+ refereeName: r.refereeName,
988
+ status: statusOf(r.playerStatus, r.status),
989
+ createdAt: r.createdAt,
990
+ deadlineAt: r.deadlineAt,
991
+ progress: r.progress
992
+ })
993
+ )
994
+ );
1002
995
  var historySchema = /* @__PURE__ */ extension.lazy(
1003
996
  () => extension.wire({
997
+ referral_code: optionalText(),
1004
998
  referrals: nullableList(referralSchema()),
1005
- completed_count: count2(),
1006
- total_earned: majorUnits(),
1007
- pagination: mini.z.optional(
1008
- extension.wire({
1009
- page: count2(),
1010
- page_size: count2(),
1011
- total_items: count2(),
1012
- total_pages: count2()
1013
- })
1014
- )
999
+ pagination: z2__namespace.optional(extension.wire({ page: count2(), limit: count2(), total_items: count2() }))
1015
1000
  })
1016
1001
  );
1017
- var registeredSchema = /* @__PURE__ */ extension.lazy(
1018
- () => mini.z.pipe(
1019
- extension.wire({
1020
- id: mini.z.string(),
1021
- referral_code: mini.z._default(mini.z.string(), ""),
1022
- status: status(),
1023
- referee_bonus: mini.z._default(majorUnits(), 0),
1024
- created_at: optionalTimestamp()
1025
- }),
1026
- mini.z.transform(
1027
- (r) => ({
1028
- id: r.id,
1029
- code: r.referralCode,
1030
- status: r.status,
1031
- refereeBonus: r.refereeBonus,
1032
- createdAt: r.createdAt
1033
- })
1034
- )
1035
- )
1036
- );
1037
1002
  var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
1038
- function registerInputProblem(input) {
1039
- if (typeof input !== "object" || input === null || Array.isArray(input))
1040
- return "referrals.register: input must be an object { code }.";
1041
- const { code } = input;
1042
- if (typeof code !== "string" || code.trim() === "") return "referrals.register: code must be non-empty text.";
1043
- return void 0;
1044
- }
1003
+ var reportedTotal = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : 0;
1045
1004
  function createReferralsApi(transport) {
1046
1005
  return {
1047
1006
  get: (_params, options) => transport.request({ method: "GET", path: "/referrals", auth: "required", schema: infoSchema(), options }),
@@ -1057,12 +1016,11 @@ function createReferralsApi(transport) {
1057
1016
  auth: "required",
1058
1017
  schema: historySchema(),
1059
1018
  options
1060
- }).then(({ referrals, completedCount, totalEarned, pagination }) => {
1061
- const items = historyItems(referrals);
1062
- const received = Array.isArray(referrals) ? referrals.length : 0;
1019
+ }).then(({ referralCode, referrals, pagination }) => {
1020
+ const items = Array.isArray(referrals) ? referrals : [];
1063
1021
  const page = positiveInt(pagination?.page, requestedPage ?? 1);
1064
- const perPage = positiveInt(pagination?.pageSize, requestedPerPage ?? DEFAULT_PER_PAGE);
1065
- const seen = received > 0 ? (page - 1) * perPage + received : 0;
1022
+ const perPage = positiveInt(pagination?.limit, requestedPerPage ?? DEFAULT_PER_PAGE);
1023
+ const seen = items.length > 0 ? (page - 1) * perPage + items.length : 0;
1066
1024
  const totalItems = Math.max(reportedTotal(pagination?.totalItems), seen);
1067
1025
  return {
1068
1026
  items,
@@ -1070,32 +1028,20 @@ function createReferralsApi(transport) {
1070
1028
  perPage,
1071
1029
  totalItems,
1072
1030
  totalPages: totalItems > 0 ? Math.ceil(totalItems / perPage) : 0,
1073
- completedCount,
1074
- totalEarned
1031
+ code: referralCode
1075
1032
  };
1076
1033
  });
1077
- },
1078
- register: (input, options) => {
1079
- const problem = registerInputProblem(input);
1080
- if (problem !== void 0) return rejectInput(transport, problem, REGISTER_ROUTE);
1081
- return transport.request({
1082
- ...REGISTER_ROUTE,
1083
- body: { referral_code: input.code.trim() },
1084
- auth: "required",
1085
- schema: registeredSchema(),
1086
- options
1087
- });
1088
1034
  }
1089
1035
  };
1090
1036
  }
1091
1037
  var HTTP_URL = "Expected an absolute http(s) URL";
1092
1038
  var sessionSchema2 = /* @__PURE__ */ extension.lazy(
1093
- () => mini.z.pipe(
1039
+ () => z2__namespace.pipe(
1094
1040
  extension.wire({
1095
1041
  // The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
1096
- operator_token: mini.z.string(),
1097
- launch_url: mini.z.string().check(
1098
- mini.z.refine(
1042
+ operator_token: z2__namespace.string(),
1043
+ launch_url: z2__namespace.string().check(
1044
+ z2__namespace.refine(
1099
1045
  (value) => {
1100
1046
  try {
1101
1047
  const { protocol } = new URL(value);
@@ -1107,10 +1053,10 @@ var sessionSchema2 = /* @__PURE__ */ extension.lazy(
1107
1053
  { message: HTTP_URL }
1108
1054
  )
1109
1055
  ),
1110
- expires_in_seconds: mini.z.number().check(mini.z.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1056
+ expires_in_seconds: z2__namespace.number().check(z2__namespace.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
1111
1057
  }),
1112
1058
  // The clock is read when the response is interpreted (= moment of the response).
1113
- mini.z.transform(({ launchUrl, expiresInSeconds }) => ({
1059
+ z2__namespace.transform(({ launchUrl, expiresInSeconds }) => ({
1114
1060
  launchUrl,
1115
1061
  expiresInSeconds,
1116
1062
  expiresAt: Date.now() + expiresInSeconds * 1e3