@getenginex/sdk-igaming 0.9.0 → 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 +8 -0
- package/README.md +4 -3
- package/dist/index.cjs +580 -315
- 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 +580 -315
- 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 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:
|
|
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,77 @@ 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
511
|
const page = { items: data[key] };
|
|
362
512
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
363
513
|
return page;
|
|
364
514
|
}
|
|
365
|
-
var nullableDate = () =>
|
|
366
|
-
|
|
367
|
-
|
|
515
|
+
var nullableDate = () => z4.pipe(
|
|
516
|
+
z4.nullish(z4.string()),
|
|
517
|
+
z4.transform((value) => value ?? void 0)
|
|
368
518
|
);
|
|
369
519
|
function compact(value) {
|
|
370
520
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
371
521
|
}
|
|
372
522
|
var overviewSchema = /* @__PURE__ */ lazy(
|
|
373
|
-
() =>
|
|
523
|
+
() => z4.pipe(
|
|
374
524
|
wire({
|
|
375
525
|
currencies: list(
|
|
376
|
-
|
|
526
|
+
z4.pipe(
|
|
377
527
|
wire({
|
|
378
528
|
currency: currencyOrEmpty(),
|
|
379
|
-
decimal_places:
|
|
529
|
+
decimal_places: z4.number(),
|
|
380
530
|
restricted_total: minorUnits(),
|
|
381
531
|
expiring_7d: minorUnits(),
|
|
382
|
-
open_positions:
|
|
532
|
+
open_positions: z4.number(),
|
|
383
533
|
next_expires_at: nullableDate(),
|
|
384
534
|
converted: minorUnits(),
|
|
385
|
-
converted_campaigns:
|
|
535
|
+
converted_campaigns: z4.number()
|
|
386
536
|
}),
|
|
387
|
-
|
|
537
|
+
z4.transform(compact)
|
|
388
538
|
)
|
|
389
539
|
),
|
|
390
540
|
as_of: nullableDate()
|
|
391
541
|
}),
|
|
392
|
-
|
|
542
|
+
z4.transform(compact)
|
|
393
543
|
)
|
|
394
544
|
);
|
|
395
545
|
var positionsPage = /* @__PURE__ */ lazy(
|
|
396
546
|
() => wire({
|
|
397
547
|
rows: list(
|
|
398
|
-
|
|
548
|
+
z4.pipe(
|
|
399
549
|
wire({
|
|
400
|
-
position_id:
|
|
401
|
-
campaign_id:
|
|
550
|
+
position_id: z4.string(),
|
|
551
|
+
campaign_id: z4.string(),
|
|
402
552
|
currency: currencyOrEmpty(),
|
|
403
|
-
decimal_places:
|
|
553
|
+
decimal_places: z4.number(),
|
|
404
554
|
granted: minorUnits(),
|
|
405
555
|
restricted: minorUnits(),
|
|
406
556
|
converted: minorUnits(),
|
|
407
557
|
required: minorUnits(),
|
|
408
558
|
wagered: minorUnits(),
|
|
409
559
|
remaining: minorUnits(),
|
|
410
|
-
state:
|
|
560
|
+
state: z4.string(),
|
|
411
561
|
// The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
|
|
412
|
-
terminal_action:
|
|
413
|
-
|
|
414
|
-
|
|
562
|
+
terminal_action: z4.pipe(
|
|
563
|
+
z4.nullish(z4.string()),
|
|
564
|
+
z4.transform((value) => value ? value.toLowerCase() : void 0)
|
|
415
565
|
),
|
|
416
566
|
expires_at: nullableDate(),
|
|
417
567
|
created_at: nullableDate()
|
|
418
568
|
}),
|
|
419
|
-
|
|
569
|
+
z4.transform((row) => compact(row))
|
|
420
570
|
)
|
|
421
571
|
),
|
|
422
|
-
next_cursor:
|
|
572
|
+
next_cursor: z4.optional(z4.string())
|
|
423
573
|
})
|
|
424
574
|
);
|
|
425
575
|
var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
|
|
@@ -513,51 +663,51 @@ function createBonusApi(transport) {
|
|
|
513
663
|
}
|
|
514
664
|
var gameSchema = /* @__PURE__ */ lazy(
|
|
515
665
|
() => 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:
|
|
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()
|
|
529
679
|
})
|
|
530
680
|
);
|
|
531
681
|
var categoriesSchema = /* @__PURE__ */ lazy(
|
|
532
|
-
() =>
|
|
533
|
-
wire({ slug:
|
|
682
|
+
() => z4.array(
|
|
683
|
+
wire({ slug: z4.string(), name: z4.string(), icon: z4.string(), game_count: z4.number(), priority: z4.number() })
|
|
534
684
|
)
|
|
535
685
|
);
|
|
536
686
|
var providersSchema = /* @__PURE__ */ lazy(
|
|
537
|
-
() =>
|
|
687
|
+
() => z4.array(wire({ id: z4.string(), name: z4.string(), game_count: z4.number() }))
|
|
538
688
|
);
|
|
539
689
|
var launchSchema = /* @__PURE__ */ lazy(
|
|
540
|
-
() =>
|
|
690
|
+
() => z4.pipe(
|
|
541
691
|
wire({
|
|
542
|
-
session_id:
|
|
543
|
-
game_url:
|
|
692
|
+
session_id: z4.string().check(z4.minLength(1)),
|
|
693
|
+
game_url: z4.string().check(z4.minLength(1)),
|
|
544
694
|
// 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:
|
|
695
|
+
launch_target: z4.optional(z4.string()),
|
|
696
|
+
provider_code: z4.optional(z4.string()),
|
|
697
|
+
expires_at: z4.optional(z4.string())
|
|
548
698
|
}),
|
|
549
699
|
// Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
|
|
550
700
|
// before the field existed: an iframe.
|
|
551
|
-
|
|
701
|
+
z4.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
|
|
552
702
|
)
|
|
553
703
|
);
|
|
554
704
|
var sessionSchema = /* @__PURE__ */ lazy(
|
|
555
705
|
() => wire({
|
|
556
|
-
id:
|
|
557
|
-
game_id:
|
|
558
|
-
game_name:
|
|
559
|
-
provider:
|
|
560
|
-
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(),
|
|
561
711
|
total_bet: money$1(),
|
|
562
712
|
total_win: money$1(),
|
|
563
713
|
status: protoEnum("SESSION_STATUS_")
|
|
@@ -565,49 +715,155 @@ var sessionSchema = /* @__PURE__ */ lazy(
|
|
|
565
715
|
);
|
|
566
716
|
var transactionSchema = /* @__PURE__ */ lazy(
|
|
567
717
|
() => wire({
|
|
568
|
-
id:
|
|
569
|
-
game_id:
|
|
570
|
-
game_name:
|
|
571
|
-
round_id:
|
|
718
|
+
id: z4.string(),
|
|
719
|
+
game_id: z4.string(),
|
|
720
|
+
game_name: z4.string(),
|
|
721
|
+
round_id: z4.string(),
|
|
572
722
|
type: protoEnum("CASINO_TRANSACTION_TYPE_"),
|
|
573
723
|
amount: minorUnits(),
|
|
574
724
|
currency: currencyCode(),
|
|
575
725
|
currency_decimal_places: decimalPlaces(),
|
|
576
|
-
created_at:
|
|
726
|
+
created_at: z4.string()
|
|
577
727
|
})
|
|
578
728
|
);
|
|
579
729
|
var winnersSchema = /* @__PURE__ */ lazy(
|
|
580
|
-
() =>
|
|
730
|
+
() => z4.array(
|
|
581
731
|
wire({
|
|
582
|
-
player:
|
|
732
|
+
player: z4.string(),
|
|
583
733
|
amount: minorUnits(),
|
|
584
734
|
currency: currencyCode(),
|
|
585
735
|
currency_decimal_places: decimalPlaces(),
|
|
586
|
-
game_id:
|
|
587
|
-
game_name:
|
|
588
|
-
won_at:
|
|
736
|
+
game_id: z4.string(),
|
|
737
|
+
game_name: z4.string(),
|
|
738
|
+
won_at: z4.string()
|
|
589
739
|
})
|
|
590
740
|
)
|
|
591
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
|
+
}
|
|
592
840
|
function createCasinoApi(transport) {
|
|
593
841
|
return {
|
|
594
|
-
listGames: (input, options) =>
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
+
},
|
|
611
867
|
listCategories: (_params, options) => transport.request({ method: "GET", path: "/games/categories", schema: categoriesSchema(), options }),
|
|
612
868
|
listProviders: (_params, options) => transport.request({ method: "GET", path: "/games/providers", schema: providersSchema(), options }),
|
|
613
869
|
getGame: ({ gameId }, options) => transport.request({
|
|
@@ -616,10 +872,16 @@ function createCasinoApi(transport) {
|
|
|
616
872
|
schema: gameSchema(),
|
|
617
873
|
options
|
|
618
874
|
}),
|
|
619
|
-
launchGame: ({ gameId, mode, isMobile, returnUrl, language }, options) => transport.request({
|
|
875
|
+
launchGame: ({ gameId, mode, isMobile, returnUrl, depositUrl, language }, options) => transport.request({
|
|
620
876
|
method: "POST",
|
|
621
877
|
path: `/games/${encodeURIComponent(gameId)}/launch`,
|
|
622
|
-
body: {
|
|
878
|
+
body: {
|
|
879
|
+
is_demo: mode === "demo",
|
|
880
|
+
is_mobile: isMobile === true,
|
|
881
|
+
return_url: returnUrl,
|
|
882
|
+
deposit_url: depositUrl,
|
|
883
|
+
language
|
|
884
|
+
},
|
|
623
885
|
auth: "required",
|
|
624
886
|
// The response carries the URL with the game session token: never through `warn` mode's recovery
|
|
625
887
|
// (which would deliver a raw field and the response to `onValidationIssue`).
|
|
@@ -654,55 +916,57 @@ function createCasinoApi(transport) {
|
|
|
654
916
|
auth: "required",
|
|
655
917
|
schema: winnersSchema(),
|
|
656
918
|
options
|
|
657
|
-
})
|
|
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
|
+
}
|
|
658
959
|
};
|
|
659
960
|
}
|
|
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
961
|
var ParsedBenefits = class {
|
|
698
962
|
constructor(value) {
|
|
699
963
|
this.value = value;
|
|
700
964
|
}
|
|
701
965
|
value;
|
|
702
966
|
};
|
|
703
|
-
var tierBenefits = () =>
|
|
704
|
-
|
|
705
|
-
|
|
967
|
+
var tierBenefits = () => z4.pipe(
|
|
968
|
+
z4.nullish(z4.string()),
|
|
969
|
+
z4.transform((text2, ctx) => {
|
|
706
970
|
if (text2 == null || text2.trim() === "") return null;
|
|
707
971
|
let parsed;
|
|
708
972
|
try {
|
|
@@ -716,43 +980,43 @@ var tierBenefits = () => z2.pipe(
|
|
|
716
980
|
message: "tier_benefits_json is not a JSON object or array",
|
|
717
981
|
input: void 0
|
|
718
982
|
});
|
|
719
|
-
return
|
|
983
|
+
return z4.NEVER;
|
|
720
984
|
})
|
|
721
985
|
);
|
|
722
986
|
var loyaltySchema = /* @__PURE__ */ lazy(
|
|
723
|
-
() =>
|
|
987
|
+
() => z4.pipe(
|
|
724
988
|
wire({
|
|
725
989
|
total_points_earned: integerText(),
|
|
726
990
|
current_points: integerText(),
|
|
727
991
|
points_redeemed: integerText(),
|
|
728
992
|
current_tier: optionalText(),
|
|
729
993
|
tier_points: integerText(),
|
|
730
|
-
lifetime_wagered:
|
|
731
|
-
lifetime_deposited:
|
|
994
|
+
lifetime_wagered: z4._default(minorUnits(), 0),
|
|
995
|
+
lifetime_deposited: z4._default(minorUnits(), 0),
|
|
732
996
|
tier_benefits_json: tierBenefits(),
|
|
733
997
|
tier_expires_at: optionalTimestamp()
|
|
734
998
|
}),
|
|
735
|
-
|
|
999
|
+
z4.transform(({ tierBenefitsJson, ...rest }) => {
|
|
736
1000
|
const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
|
|
737
1001
|
return { ...rest, tierBenefits: benefits };
|
|
738
1002
|
})
|
|
739
1003
|
)
|
|
740
1004
|
);
|
|
741
1005
|
var redeemSchema = /* @__PURE__ */ lazy(
|
|
742
|
-
() =>
|
|
1006
|
+
() => z4.pipe(
|
|
743
1007
|
wire({
|
|
744
|
-
success:
|
|
745
|
-
message:
|
|
1008
|
+
success: z4.optional(z4.boolean()),
|
|
1009
|
+
message: z4.optional(z4.string()),
|
|
746
1010
|
redeemed_points: integerText(),
|
|
747
|
-
value:
|
|
1011
|
+
value: z4.nullish(minorUnits()),
|
|
748
1012
|
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
749
|
-
currency:
|
|
750
|
-
|
|
751
|
-
|
|
1013
|
+
currency: z4.pipe(
|
|
1014
|
+
z4.nullish(currencyOrEmpty()),
|
|
1015
|
+
z4.transform((value) => value == null || value === "" ? null : value)
|
|
752
1016
|
),
|
|
753
1017
|
bonus_id: optionalText()
|
|
754
1018
|
}),
|
|
755
|
-
|
|
1019
|
+
z4.transform((data) => ({
|
|
756
1020
|
success: data.success,
|
|
757
1021
|
message: data.message,
|
|
758
1022
|
redeemedPoints: data.redeemedPoints,
|
|
@@ -796,12 +1060,12 @@ function createLoyaltyApi(transport) {
|
|
|
796
1060
|
};
|
|
797
1061
|
}
|
|
798
1062
|
function openUnion(values) {
|
|
799
|
-
return
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
1063
|
+
return z4.pipe(
|
|
1064
|
+
z4.pipe(
|
|
1065
|
+
z4.string(),
|
|
1066
|
+
z4.transform((value) => value.toLowerCase())
|
|
803
1067
|
),
|
|
804
|
-
|
|
1068
|
+
z4.enum(values)
|
|
805
1069
|
);
|
|
806
1070
|
}
|
|
807
1071
|
|
|
@@ -812,14 +1076,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
|
812
1076
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
813
1077
|
var missionSchema = /* @__PURE__ */ lazy(
|
|
814
1078
|
() => wire({
|
|
815
|
-
id:
|
|
816
|
-
name:
|
|
817
|
-
description:
|
|
1079
|
+
id: z4.string(),
|
|
1080
|
+
name: z4.string(),
|
|
1081
|
+
description: z4._default(z4.string(), ""),
|
|
818
1082
|
mission_type: openUnion(MISSION_TYPES),
|
|
819
1083
|
objective_type: openUnion(OBJECTIVE_TYPES),
|
|
820
1084
|
target_value: integerText(),
|
|
821
1085
|
target_game_category: optionalText(),
|
|
822
|
-
target_games: nullableList(
|
|
1086
|
+
target_games: nullableList(z4.string()),
|
|
823
1087
|
reward_type: openUnion(REWARD_TYPES),
|
|
824
1088
|
reward_value: minorUnits(),
|
|
825
1089
|
valid_from: optionalTimestamp(),
|
|
@@ -827,16 +1091,16 @@ var missionSchema = /* @__PURE__ */ lazy(
|
|
|
827
1091
|
})
|
|
828
1092
|
);
|
|
829
1093
|
var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
830
|
-
() =>
|
|
1094
|
+
() => z4.pipe(
|
|
831
1095
|
wire({
|
|
832
1096
|
missions: nullableList(
|
|
833
1097
|
wire({
|
|
834
|
-
id:
|
|
835
|
-
mission_id:
|
|
836
|
-
mission_name:
|
|
1098
|
+
id: z4.string(),
|
|
1099
|
+
mission_id: z4.string(),
|
|
1100
|
+
mission_name: z4._default(z4.string(), ""),
|
|
837
1101
|
current_progress: integerText(),
|
|
838
1102
|
target_value: integerText(),
|
|
839
|
-
progress_percentage:
|
|
1103
|
+
progress_percentage: z4.number(),
|
|
840
1104
|
status: openUnion(USER_MISSION_STATUSES),
|
|
841
1105
|
reward_type: openUnion(REWARD_TYPES),
|
|
842
1106
|
reward_value: minorUnits(),
|
|
@@ -845,7 +1109,7 @@ var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
|
845
1109
|
})
|
|
846
1110
|
)
|
|
847
1111
|
}),
|
|
848
|
-
|
|
1112
|
+
z4.transform((data) => data.missions)
|
|
849
1113
|
)
|
|
850
1114
|
);
|
|
851
1115
|
function createMissionsApi(transport) {
|
|
@@ -875,25 +1139,25 @@ function createMissionsApi(transport) {
|
|
|
875
1139
|
}
|
|
876
1140
|
var DEFAULT_PER_PAGE = 20;
|
|
877
1141
|
var HISTORY_PATH = "/referrals/history";
|
|
878
|
-
var count2 = () =>
|
|
879
|
-
var money3 = () =>
|
|
880
|
-
|
|
881
|
-
|
|
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(
|
|
882
1146
|
(value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
|
|
883
1147
|
)
|
|
884
1148
|
);
|
|
885
|
-
var rulesSchema = () =>
|
|
886
|
-
|
|
1149
|
+
var rulesSchema = () => z4.pipe(
|
|
1150
|
+
z4.nullish(
|
|
887
1151
|
wire({
|
|
888
1152
|
reward: money3(),
|
|
889
1153
|
minimum_real_net_loss: money3(),
|
|
890
1154
|
referee_window_days: count2(),
|
|
891
1155
|
hold_hours: count2(),
|
|
892
|
-
wagering_multiplier:
|
|
1156
|
+
wagering_multiplier: z4._default(z4.string(), ""),
|
|
893
1157
|
maximum_conversion: money3()
|
|
894
1158
|
})
|
|
895
1159
|
),
|
|
896
|
-
|
|
1160
|
+
z4.transform((rules) => {
|
|
897
1161
|
if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
|
|
898
1162
|
return {
|
|
899
1163
|
reward: rules.reward,
|
|
@@ -906,12 +1170,12 @@ var rulesSchema = () => z2.pipe(
|
|
|
906
1170
|
})
|
|
907
1171
|
);
|
|
908
1172
|
var infoSchema = /* @__PURE__ */ lazy(
|
|
909
|
-
() =>
|
|
1173
|
+
() => z4.pipe(
|
|
910
1174
|
wire({
|
|
911
|
-
enabled:
|
|
1175
|
+
enabled: z4._default(z4.boolean(), false),
|
|
912
1176
|
referral_code: optionalText(),
|
|
913
1177
|
rules: rulesSchema(),
|
|
914
|
-
totals:
|
|
1178
|
+
totals: z4._default(
|
|
915
1179
|
wire({
|
|
916
1180
|
registered: count2(),
|
|
917
1181
|
deposited: count2(),
|
|
@@ -924,7 +1188,7 @@ var infoSchema = /* @__PURE__ */ lazy(
|
|
|
924
1188
|
{ registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
|
|
925
1189
|
)
|
|
926
1190
|
}),
|
|
927
|
-
|
|
1191
|
+
z4.transform(
|
|
928
1192
|
({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
|
|
929
1193
|
)
|
|
930
1194
|
)
|
|
@@ -933,16 +1197,16 @@ function remainingOf(target, loss) {
|
|
|
933
1197
|
const missing = BigInt(target.amount) - BigInt(loss.amount);
|
|
934
1198
|
return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
|
|
935
1199
|
}
|
|
936
|
-
var progressSchema = () =>
|
|
937
|
-
|
|
1200
|
+
var progressSchema = () => z4.pipe(
|
|
1201
|
+
z4.nullish(
|
|
938
1202
|
wire({
|
|
939
|
-
deposit_done:
|
|
1203
|
+
deposit_done: z4._default(z4.boolean(), false),
|
|
940
1204
|
real_net_loss: money3(),
|
|
941
1205
|
target: money3(),
|
|
942
1206
|
remaining: money3()
|
|
943
1207
|
})
|
|
944
1208
|
),
|
|
945
|
-
|
|
1209
|
+
z4.transform((progress) => {
|
|
946
1210
|
if (progress == null || progress.target === null) return null;
|
|
947
1211
|
const { target } = progress;
|
|
948
1212
|
const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
|
|
@@ -959,9 +1223,9 @@ function statusOf(playerStatus, legacy) {
|
|
|
959
1223
|
if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
|
|
960
1224
|
return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
|
|
961
1225
|
}
|
|
962
|
-
var referralSchema = () =>
|
|
1226
|
+
var referralSchema = () => z4.pipe(
|
|
963
1227
|
wire({
|
|
964
|
-
id:
|
|
1228
|
+
id: z4.string(),
|
|
965
1229
|
referee_name: optionalText(),
|
|
966
1230
|
status: optionalText(),
|
|
967
1231
|
player_status: optionalText(),
|
|
@@ -969,7 +1233,7 @@ var referralSchema = () => z2.pipe(
|
|
|
969
1233
|
deadline_at: optionalTimestamp(),
|
|
970
1234
|
progress: progressSchema()
|
|
971
1235
|
}),
|
|
972
|
-
|
|
1236
|
+
z4.transform(
|
|
973
1237
|
(r) => ({
|
|
974
1238
|
id: r.id,
|
|
975
1239
|
refereeName: r.refereeName,
|
|
@@ -984,7 +1248,7 @@ var historySchema = /* @__PURE__ */ lazy(
|
|
|
984
1248
|
() => wire({
|
|
985
1249
|
referral_code: optionalText(),
|
|
986
1250
|
referrals: nullableList(referralSchema()),
|
|
987
|
-
pagination:
|
|
1251
|
+
pagination: z4.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
|
|
988
1252
|
})
|
|
989
1253
|
);
|
|
990
1254
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1024,12 +1288,12 @@ function createReferralsApi(transport) {
|
|
|
1024
1288
|
}
|
|
1025
1289
|
var HTTP_URL = "Expected an absolute http(s) URL";
|
|
1026
1290
|
var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
1027
|
-
() =>
|
|
1291
|
+
() => z4.pipe(
|
|
1028
1292
|
wire({
|
|
1029
1293
|
// 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
|
-
|
|
1294
|
+
operator_token: z4.string(),
|
|
1295
|
+
launch_url: z4.string().check(
|
|
1296
|
+
z4.refine(
|
|
1033
1297
|
(value) => {
|
|
1034
1298
|
try {
|
|
1035
1299
|
const { protocol } = new URL(value);
|
|
@@ -1041,10 +1305,10 @@ var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
|
1041
1305
|
{ message: HTTP_URL }
|
|
1042
1306
|
)
|
|
1043
1307
|
),
|
|
1044
|
-
expires_in_seconds:
|
|
1308
|
+
expires_in_seconds: z4.number().check(z4.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
|
|
1045
1309
|
}),
|
|
1046
1310
|
// The clock is read when the response is interpreted (= moment of the response).
|
|
1047
|
-
|
|
1311
|
+
z4.transform(({ launchUrl, expiresInSeconds }) => ({
|
|
1048
1312
|
launchUrl,
|
|
1049
1313
|
expiresInSeconds,
|
|
1050
1314
|
expiresAt: Date.now() + expiresInSeconds * 1e3
|
|
@@ -1075,7 +1339,8 @@ function createIgaming(client) {
|
|
|
1075
1339
|
missions: createMissionsApi(transport),
|
|
1076
1340
|
loyalty: createLoyaltyApi(transport),
|
|
1077
1341
|
referrals: createReferralsApi(transport),
|
|
1078
|
-
sportsbook: createSportsbookApi(transport)
|
|
1342
|
+
sportsbook: createSportsbookApi(transport),
|
|
1343
|
+
bets: createBetsApi(transport)
|
|
1079
1344
|
};
|
|
1080
1345
|
if (typeof extension.registerProductClient !== "function") {
|
|
1081
1346
|
throw new EnginexError({
|