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