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