@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.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var sdk = require('@getenginex/sdk');
|
|
4
4
|
var extension = require('@getenginex/sdk/extension');
|
|
5
|
-
var
|
|
5
|
+
var z4 = require('zod/mini');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -23,13 +23,48 @@ function _interopNamespace(e) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var extension__namespace = /*#__PURE__*/_interopNamespace(extension);
|
|
26
|
-
var
|
|
26
|
+
var z4__namespace = /*#__PURE__*/_interopNamespace(z4);
|
|
27
27
|
|
|
28
28
|
// src/client.ts
|
|
29
|
+
|
|
30
|
+
// src/internal/input.ts
|
|
31
|
+
function rejectInput(transport, message, route) {
|
|
32
|
+
return Promise.reject(
|
|
33
|
+
transport.reportError({ code: "CONFIGURATION_ERROR", message, status: 0 }, { ...route, attempt: 0 })
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function pageInputProblem(name, input) {
|
|
37
|
+
if (input === void 0) return void 0;
|
|
38
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be an object.`;
|
|
39
|
+
const { page, perPage } = input;
|
|
40
|
+
if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
|
|
41
|
+
return `${name}: page must be an integer \u2265 1.`;
|
|
42
|
+
if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > 100))
|
|
43
|
+
return `${name}: perPage must be an integer from 1 to 100.`;
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
function optionalTimestamp() {
|
|
47
|
+
return z4__namespace.pipe(
|
|
48
|
+
z4__namespace.nullish(z4__namespace.string().check(z4__namespace.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
49
|
+
z4__namespace.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function optionalText() {
|
|
53
|
+
return z4__namespace.pipe(
|
|
54
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
55
|
+
z4__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function nullableList(item) {
|
|
59
|
+
return z4__namespace.pipe(
|
|
60
|
+
z4__namespace.nullish(z4__namespace.array(item)),
|
|
61
|
+
z4__namespace.transform((value) => value ?? [])
|
|
62
|
+
);
|
|
63
|
+
}
|
|
29
64
|
function protoEnum(prefix) {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
65
|
+
return z4__namespace.pipe(
|
|
66
|
+
z4__namespace.optional(z4__namespace.union([z4__namespace.string(), z4__namespace.number()])),
|
|
67
|
+
z4__namespace.transform((value) => {
|
|
33
68
|
if (value === void 0 || value === 0) return "unspecified";
|
|
34
69
|
if (typeof value === "number") return String(value);
|
|
35
70
|
return (value.startsWith(prefix) ? value.slice(prefix.length) : value).toLowerCase();
|
|
@@ -42,176 +77,292 @@ function minorUnits() {
|
|
|
42
77
|
function currencyOrEmpty() {
|
|
43
78
|
return extension.currencyCode({ allowEmpty: true });
|
|
44
79
|
}
|
|
80
|
+
var NON_NEGATIVE_MONEY = "Expected money in minor units: a non-negative integer within the safe range of number";
|
|
81
|
+
function nonNegativeMinorUnits() {
|
|
82
|
+
return z4__namespace.pipe(
|
|
83
|
+
extension.strictValue(
|
|
84
|
+
(v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0 || typeof v === "string" && /^\d+$/.test(v) && Number.isSafeInteger(Number(v)),
|
|
85
|
+
NON_NEGATIVE_MONEY
|
|
86
|
+
),
|
|
87
|
+
// `|| 0`: a JSON `-0` comes out as `0`.
|
|
88
|
+
z4__namespace.transform((v) => Number(v) || 0)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
45
91
|
var INTEGER_TEXT = "Expected an integer within the safe range of number";
|
|
46
92
|
function integerText() {
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
93
|
+
return z4__namespace.pipe(
|
|
94
|
+
z4__namespace.union([
|
|
95
|
+
z4__namespace.string().check(
|
|
96
|
+
z4__namespace.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
|
|
51
97
|
),
|
|
52
|
-
|
|
98
|
+
z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
|
|
53
99
|
]),
|
|
54
|
-
|
|
100
|
+
z4__namespace.transform(Number)
|
|
55
101
|
);
|
|
56
102
|
}
|
|
57
103
|
function text() {
|
|
58
|
-
return
|
|
104
|
+
return z4__namespace._default(z4__namespace.string(), "");
|
|
59
105
|
}
|
|
60
106
|
function count() {
|
|
61
|
-
return
|
|
107
|
+
return z4__namespace._default(z4__namespace.number(), 0);
|
|
62
108
|
}
|
|
63
109
|
function list(item) {
|
|
64
|
-
return
|
|
110
|
+
return z4__namespace._default(z4__namespace.array(item), []);
|
|
65
111
|
}
|
|
66
112
|
function durationSeconds() {
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
113
|
+
return z4__namespace.pipe(
|
|
114
|
+
z4__namespace.string().check(z4__namespace.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
|
|
115
|
+
z4__namespace.transform((value) => Number(value.slice(0, -1)))
|
|
70
116
|
);
|
|
71
117
|
}
|
|
72
118
|
|
|
73
|
-
// src/modules/
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
119
|
+
// src/modules/bets.ts
|
|
120
|
+
var betFields = () => ({
|
|
121
|
+
id: z4__namespace.string(),
|
|
122
|
+
status: protoEnum("BET_STATUS_"),
|
|
123
|
+
stake: nonNegativeMinorUnits(),
|
|
124
|
+
potential_return: nonNegativeMinorUnits(),
|
|
125
|
+
total_odds: z4__namespace.number(),
|
|
126
|
+
created_at: optionalTimestamp()
|
|
127
|
+
});
|
|
128
|
+
var betSchema = /* @__PURE__ */ extension.lazy(() => extension.wire(betFields()));
|
|
129
|
+
var betDetailsSchema = /* @__PURE__ */ extension.lazy(
|
|
130
|
+
() => extension.wire({
|
|
131
|
+
...betFields(),
|
|
132
|
+
selections: nullableList(
|
|
133
|
+
extension.wire({
|
|
134
|
+
event_name: z4__namespace.string(),
|
|
135
|
+
market_name: z4__namespace.string(),
|
|
136
|
+
selection_name: z4__namespace.string(),
|
|
137
|
+
odds: z4__namespace.number(),
|
|
138
|
+
result: protoEnum("SELECTION_RESULT_")
|
|
139
|
+
})
|
|
140
|
+
)
|
|
141
|
+
})
|
|
142
|
+
);
|
|
143
|
+
var offerSchema = /* @__PURE__ */ extension.lazy(
|
|
144
|
+
() => extension.wire({
|
|
145
|
+
bet_id: z4__namespace.string(),
|
|
146
|
+
available: z4__namespace.boolean(),
|
|
147
|
+
cashout_amount: nonNegativeMinorUnits(),
|
|
148
|
+
expires_at: optionalTimestamp()
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
var cashoutSchema = /* @__PURE__ */ extension.lazy(
|
|
152
|
+
() => extension.wire({ bet_id: z4__namespace.string(), cashout_amount: nonNegativeMinorUnits(), status: z4__namespace.string() })
|
|
153
|
+
);
|
|
154
|
+
var LIST_ROUTE = { method: "GET", path: "/bets" };
|
|
155
|
+
var GET_ROUTE = { method: "GET", path: "/bets/{betId}" };
|
|
156
|
+
var OFFER_ROUTE = { method: "GET", path: "/bets/{betId}/cashout" };
|
|
157
|
+
var CASHOUT_ROUTE = { method: "POST", path: "/bets/{betId}/cashout" };
|
|
158
|
+
var MAX_IDEMPOTENCY_KEY = 255;
|
|
159
|
+
function betIdProblem(name, input) {
|
|
160
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be { betId }.`;
|
|
161
|
+
const { betId } = input;
|
|
162
|
+
return typeof betId === "string" && betId.trim() !== "" ? void 0 : `${name}: betId must be non-empty text.`;
|
|
163
|
+
}
|
|
164
|
+
function idempotencyKeyProblem(options) {
|
|
165
|
+
const key = options?.idempotencyKey;
|
|
166
|
+
if (key === void 0 || key === "") return void 0;
|
|
167
|
+
if (typeof key !== "string" || key !== key.trim() || key.length > MAX_IDEMPOTENCY_KEY)
|
|
168
|
+
return `bets.cashout: idempotencyKey must be text without surrounding spaces, up to ${MAX_IDEMPOTENCY_KEY} characters.`;
|
|
169
|
+
return void 0;
|
|
170
|
+
}
|
|
171
|
+
var betPath = (betId, suffix = "") => `/bets/${encodeURIComponent(betId)}${suffix}`;
|
|
172
|
+
function createBetsApi(transport) {
|
|
173
|
+
return {
|
|
174
|
+
list: (input, options) => {
|
|
175
|
+
const problem = pageInputProblem("bets.list", input);
|
|
176
|
+
if (problem !== void 0) return rejectInput(transport, problem, LIST_ROUTE);
|
|
177
|
+
return transport.requestPage({
|
|
178
|
+
...LIST_ROUTE,
|
|
179
|
+
page: input?.page,
|
|
180
|
+
perPage: input?.perPage,
|
|
181
|
+
perPageParam: "limit",
|
|
182
|
+
auth: "required",
|
|
183
|
+
item: betSchema(),
|
|
184
|
+
options
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
get: (input, options) => {
|
|
188
|
+
const problem = betIdProblem("bets.get", input);
|
|
189
|
+
if (problem !== void 0) return rejectInput(transport, problem, GET_ROUTE);
|
|
190
|
+
return transport.request({
|
|
191
|
+
method: "GET",
|
|
192
|
+
path: betPath(input.betId),
|
|
193
|
+
auth: "required",
|
|
194
|
+
schema: betDetailsSchema(),
|
|
195
|
+
options
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
getCashoutOffer: (input, options) => {
|
|
199
|
+
const problem = betIdProblem("bets.getCashoutOffer", input);
|
|
200
|
+
if (problem !== void 0) return rejectInput(transport, problem, OFFER_ROUTE);
|
|
201
|
+
return transport.request({
|
|
202
|
+
method: "GET",
|
|
203
|
+
path: betPath(input.betId, "/cashout"),
|
|
204
|
+
auth: "required",
|
|
205
|
+
schema: offerSchema(),
|
|
206
|
+
options
|
|
207
|
+
});
|
|
208
|
+
},
|
|
209
|
+
cashout: (input, options) => {
|
|
210
|
+
const problem = betIdProblem("bets.cashout", input) ?? idempotencyKeyProblem(options);
|
|
211
|
+
if (problem !== void 0) return rejectInput(transport, problem, CASHOUT_ROUTE);
|
|
212
|
+
return transport.request({
|
|
213
|
+
method: "POST",
|
|
214
|
+
path: betPath(input.betId, "/cashout"),
|
|
215
|
+
auth: "required",
|
|
216
|
+
// No body: the gateway's idempotency middleware fingerprints the (empty) body, so a replay always matches.
|
|
217
|
+
idempotent: true,
|
|
218
|
+
schema: cashoutSchema(),
|
|
219
|
+
options
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
var campaignCurrency = () => z4__namespace._default(currencyOrEmpty(), "");
|
|
225
|
+
var money = () => extension.wire({ amount: z4__namespace._default(minorUnits(), 0), currency: campaignCurrency() });
|
|
226
|
+
var timeWindow = () => extension.wire({ starts_at: z4__namespace.optional(z4__namespace.string()), ends_at: z4__namespace.optional(z4__namespace.string()) });
|
|
227
|
+
var ratio = () => extension.wire({ decimal: z4__namespace.optional(z4__namespace.string()), basis_points: z4__namespace.optional(z4__namespace.number()), maximum_scale: count() });
|
|
78
228
|
var empty = () => extension.wire({});
|
|
79
229
|
var policy = (prefix) => extension.wire({ code: protoEnum(prefix), version: count() });
|
|
80
230
|
var casinoSelector = () => extension.wire({
|
|
81
231
|
provider_instance_id: text(),
|
|
82
|
-
software_ids: list(
|
|
83
|
-
game_ids: list(
|
|
84
|
-
category_codes: list(
|
|
232
|
+
software_ids: list(z4__namespace.string()),
|
|
233
|
+
game_ids: list(z4__namespace.string()),
|
|
234
|
+
category_codes: list(z4__namespace.string())
|
|
85
235
|
});
|
|
86
236
|
var sportsSelector = () => extension.wire({
|
|
87
|
-
sport_codes: list(
|
|
88
|
-
competition_ids: list(
|
|
89
|
-
event_ids: list(
|
|
90
|
-
market_codes: list(
|
|
91
|
-
live:
|
|
237
|
+
sport_codes: list(z4__namespace.string()),
|
|
238
|
+
competition_ids: list(z4__namespace.string()),
|
|
239
|
+
event_ids: list(z4__namespace.string()),
|
|
240
|
+
market_codes: list(z4__namespace.string()),
|
|
241
|
+
live: z4__namespace.optional(z4__namespace.boolean()),
|
|
92
242
|
bet_types: list(protoEnum("SPORTS_BET_TYPE_"))
|
|
93
243
|
});
|
|
94
244
|
var qualification = () => extension.wire({
|
|
95
245
|
version: count(),
|
|
96
|
-
immediate:
|
|
97
|
-
user_event:
|
|
246
|
+
immediate: z4__namespace.optional(empty()),
|
|
247
|
+
user_event: z4__namespace.optional(
|
|
98
248
|
extension.wire({
|
|
99
249
|
event_code: text(),
|
|
100
250
|
event_version: count(),
|
|
101
251
|
source_authority: text(),
|
|
102
|
-
identity_fields: list(
|
|
252
|
+
identity_fields: list(z4__namespace.string())
|
|
103
253
|
})
|
|
104
254
|
),
|
|
105
|
-
deposit_settled:
|
|
255
|
+
deposit_settled: z4__namespace.optional(
|
|
106
256
|
extension.wire({
|
|
107
257
|
currency: campaignCurrency(),
|
|
108
|
-
eligible_method_codes: list(
|
|
258
|
+
eligible_method_codes: list(z4__namespace.string()),
|
|
109
259
|
first_deposit_policy: protoEnum("FIRST_DEPOSIT_POLICY_"),
|
|
110
|
-
minimum_settled_net_amount:
|
|
111
|
-
maximum_settled_net_amount:
|
|
260
|
+
minimum_settled_net_amount: z4__namespace.optional(money()),
|
|
261
|
+
maximum_settled_net_amount: z4__namespace.optional(money()),
|
|
112
262
|
amount_basis: protoEnum("DEPOSIT_AMOUNT_BASIS_")
|
|
113
263
|
})
|
|
114
264
|
),
|
|
115
|
-
activity_aggregate:
|
|
265
|
+
activity_aggregate: z4__namespace.optional(
|
|
116
266
|
extension.wire({
|
|
117
267
|
basis: protoEnum("BASIS_"),
|
|
118
268
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
119
269
|
currency: campaignCurrency(),
|
|
120
|
-
window:
|
|
270
|
+
window: z4__namespace.optional(durationSeconds()),
|
|
121
271
|
timezone: text(),
|
|
122
|
-
late_event_grace:
|
|
123
|
-
casino:
|
|
124
|
-
sportsbook:
|
|
272
|
+
late_event_grace: z4__namespace.optional(durationSeconds()),
|
|
273
|
+
casino: z4__namespace.optional(casinoSelector()),
|
|
274
|
+
sportsbook: z4__namespace.optional(sportsSelector())
|
|
125
275
|
})
|
|
126
276
|
)
|
|
127
277
|
});
|
|
128
278
|
var validity = () => extension.wire({
|
|
129
|
-
no_expiry:
|
|
130
|
-
absolute_expiry:
|
|
131
|
-
duration_from_grant:
|
|
279
|
+
no_expiry: z4__namespace.optional(empty()),
|
|
280
|
+
absolute_expiry: z4__namespace.optional(extension.wire({ expires_at: z4__namespace.optional(z4__namespace.string()) })),
|
|
281
|
+
duration_from_grant: z4__namespace.optional(extension.wire({ duration: z4__namespace.optional(durationSeconds()) }))
|
|
132
282
|
});
|
|
133
283
|
var rounding = () => protoEnum("ROUNDING_MODE_");
|
|
134
284
|
var proceedsClass = () => protoEnum("PROCEEDS_CLASS_");
|
|
135
285
|
var percent = () => extension.wire({
|
|
136
|
-
percentage:
|
|
286
|
+
percentage: z4__namespace.optional(ratio()),
|
|
137
287
|
rounding: rounding(),
|
|
138
|
-
minimum_reward:
|
|
139
|
-
maximum_reward:
|
|
288
|
+
minimum_reward: z4__namespace.optional(money()),
|
|
289
|
+
maximum_reward: z4__namespace.optional(money())
|
|
140
290
|
});
|
|
141
291
|
var balanceCredit = () => extension.wire({
|
|
142
|
-
fixed_amount:
|
|
143
|
-
percent_of_source_amount:
|
|
144
|
-
aggregate_rebate:
|
|
292
|
+
fixed_amount: z4__namespace.optional(extension.wire({ amount: z4__namespace.optional(money()) })),
|
|
293
|
+
percent_of_source_amount: z4__namespace.optional(percent()),
|
|
294
|
+
aggregate_rebate: z4__namespace.optional(
|
|
145
295
|
extension.wire({
|
|
146
|
-
percentage:
|
|
296
|
+
percentage: z4__namespace.optional(ratio()),
|
|
147
297
|
rounding: rounding(),
|
|
148
|
-
minimum_basis:
|
|
149
|
-
maximum_reward:
|
|
298
|
+
minimum_basis: z4__namespace.optional(money()),
|
|
299
|
+
maximum_reward: z4__namespace.optional(money())
|
|
150
300
|
})
|
|
151
301
|
),
|
|
152
302
|
balance_class: protoEnum("BALANCE_CLASS_"),
|
|
153
303
|
proceeds_class: proceedsClass(),
|
|
154
|
-
validity:
|
|
304
|
+
validity: z4__namespace.optional(validity())
|
|
155
305
|
});
|
|
156
|
-
var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum:
|
|
306
|
+
var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z4__namespace.optional(money()) });
|
|
157
307
|
var oddsPolicy = () => extension.wire({
|
|
158
308
|
mode: protoEnum("MODE_"),
|
|
159
|
-
minimum_total_odds_decimal:
|
|
160
|
-
minimum_odds_per_leg_decimal:
|
|
161
|
-
minimum_legs:
|
|
162
|
-
maximum_legs:
|
|
309
|
+
minimum_total_odds_decimal: z4__namespace.optional(z4__namespace.string()),
|
|
310
|
+
minimum_odds_per_leg_decimal: z4__namespace.optional(z4__namespace.string()),
|
|
311
|
+
minimum_legs: z4__namespace.optional(z4__namespace.number()),
|
|
312
|
+
maximum_legs: z4__namespace.optional(z4__namespace.number())
|
|
163
313
|
});
|
|
164
314
|
var cashoutMode = () => protoEnum("RESTRICTED_CASHOUT_MODE_");
|
|
165
315
|
var usePolicy = () => extension.wire({
|
|
166
316
|
version: count(),
|
|
167
|
-
funds_consumption:
|
|
168
|
-
casino:
|
|
169
|
-
sportsbook:
|
|
317
|
+
funds_consumption: z4__namespace.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
|
|
318
|
+
casino: z4__namespace.optional(extension.wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z4__namespace.optional(maximumBet()) })),
|
|
319
|
+
sportsbook: z4__namespace.optional(
|
|
170
320
|
extension.wire({
|
|
171
321
|
allowed_scopes: list(sportsSelector()),
|
|
172
322
|
excluded_scopes: list(sportsSelector()),
|
|
173
|
-
maximum_bet:
|
|
174
|
-
funding_odds:
|
|
323
|
+
maximum_bet: z4__namespace.optional(maximumBet()),
|
|
324
|
+
funding_odds: z4__namespace.optional(oddsPolicy()),
|
|
175
325
|
cashout_mode: cashoutMode()
|
|
176
326
|
})
|
|
177
327
|
),
|
|
178
|
-
casino_and_sportsbook:
|
|
328
|
+
casino_and_sportsbook: z4__namespace.optional(
|
|
179
329
|
extension.wire({
|
|
180
330
|
allowed_casino_scopes: list(casinoSelector()),
|
|
181
331
|
allowed_sportsbook_scopes: list(sportsSelector()),
|
|
182
332
|
excluded_sportsbook_scopes: list(sportsSelector()),
|
|
183
|
-
maximum_casino_bet:
|
|
184
|
-
maximum_sportsbook_bet:
|
|
185
|
-
sportsbook_funding_odds:
|
|
333
|
+
maximum_casino_bet: z4__namespace.optional(maximumBet()),
|
|
334
|
+
maximum_sportsbook_bet: z4__namespace.optional(maximumBet()),
|
|
335
|
+
sportsbook_funding_odds: z4__namespace.optional(oddsPolicy()),
|
|
186
336
|
sportsbook_cashout_mode: cashoutMode()
|
|
187
337
|
})
|
|
188
338
|
),
|
|
189
|
-
payout_allocation:
|
|
339
|
+
payout_allocation: z4__namespace.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
|
|
190
340
|
});
|
|
191
341
|
var wageringPolicy = () => extension.wire({
|
|
192
342
|
version: count(),
|
|
193
|
-
none:
|
|
194
|
-
multiplier:
|
|
343
|
+
none: z4__namespace.optional(empty()),
|
|
344
|
+
multiplier: z4__namespace.optional(
|
|
195
345
|
extension.wire({
|
|
196
346
|
requirement_basis: protoEnum("REQUIREMENT_BASIS_"),
|
|
197
|
-
multiplier:
|
|
347
|
+
multiplier: z4__namespace.optional(ratio()),
|
|
198
348
|
contribution_rates: list(
|
|
199
349
|
extension.wire({
|
|
200
|
-
casino:
|
|
201
|
-
sportsbook:
|
|
202
|
-
rate:
|
|
350
|
+
casino: z4__namespace.optional(casinoSelector()),
|
|
351
|
+
sportsbook: z4__namespace.optional(sportsSelector()),
|
|
352
|
+
rate: z4__namespace.optional(ratio())
|
|
203
353
|
})
|
|
204
354
|
),
|
|
205
|
-
deadline:
|
|
355
|
+
deadline: z4__namespace.optional(validity()),
|
|
206
356
|
rounding: rounding(),
|
|
207
|
-
sportsbook_contribution_odds:
|
|
357
|
+
sportsbook_contribution_odds: z4__namespace.optional(oddsPolicy()),
|
|
358
|
+
maximum_conversion: z4__namespace.optional(money())
|
|
208
359
|
})
|
|
209
360
|
)
|
|
210
361
|
});
|
|
211
362
|
var stackingPolicy = () => extension.wire({
|
|
212
363
|
version: count(),
|
|
213
|
-
exclusive_in_group:
|
|
214
|
-
multiple_in_group:
|
|
364
|
+
exclusive_in_group: z4__namespace.optional(extension.wire({ stacking_group_key: text() })),
|
|
365
|
+
multiple_in_group: z4__namespace.optional(extension.wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
|
|
215
366
|
});
|
|
216
367
|
var reward = () => extension.wire({
|
|
217
368
|
reward_key: text(),
|
|
@@ -219,83 +370,83 @@ var reward = () => extension.wire({
|
|
|
219
370
|
reward_kind_version: count(),
|
|
220
371
|
execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
|
|
221
372
|
execution_profile_version: count(),
|
|
222
|
-
balance_credit:
|
|
223
|
-
provider_managed_balance:
|
|
224
|
-
casino_free_spins:
|
|
373
|
+
balance_credit: z4__namespace.optional(balanceCredit()),
|
|
374
|
+
provider_managed_balance: z4__namespace.optional(extension.wire({ provider_code: text() })),
|
|
375
|
+
casino_free_spins: z4__namespace.optional(
|
|
225
376
|
extension.wire({
|
|
226
377
|
provider_code: text(),
|
|
227
|
-
casino_scope:
|
|
378
|
+
casino_scope: z4__namespace.optional(casinoSelector()),
|
|
228
379
|
quantity: count(),
|
|
229
|
-
denomination:
|
|
380
|
+
denomination: z4__namespace.optional(money()),
|
|
230
381
|
currency: campaignCurrency(),
|
|
231
|
-
grant_window:
|
|
382
|
+
grant_window: z4__namespace.optional(timeWindow()),
|
|
232
383
|
proceeds_class: proceedsClass(),
|
|
233
|
-
maximum_winnings:
|
|
384
|
+
maximum_winnings: z4__namespace.optional(money())
|
|
234
385
|
})
|
|
235
386
|
),
|
|
236
|
-
sports_bonus_bet:
|
|
387
|
+
sports_bonus_bet: z4__namespace.optional(
|
|
237
388
|
extension.wire({
|
|
238
389
|
provider_code: text(),
|
|
239
|
-
sportsbook_scope:
|
|
240
|
-
amount:
|
|
390
|
+
sportsbook_scope: z4__namespace.optional(sportsSelector()),
|
|
391
|
+
amount: z4__namespace.optional(money()),
|
|
241
392
|
quantity: count(),
|
|
242
|
-
validity:
|
|
393
|
+
validity: z4__namespace.optional(validity())
|
|
243
394
|
})
|
|
244
395
|
),
|
|
245
|
-
sports_bet_coverage:
|
|
396
|
+
sports_bet_coverage: z4__namespace.optional(
|
|
246
397
|
extension.wire({
|
|
247
398
|
provider_code: text(),
|
|
248
|
-
qualifying_bet_scope:
|
|
249
|
-
coverage_cap:
|
|
250
|
-
validity:
|
|
399
|
+
qualifying_bet_scope: z4__namespace.optional(sportsSelector()),
|
|
400
|
+
coverage_cap: z4__namespace.optional(money()),
|
|
401
|
+
validity: z4__namespace.optional(validity())
|
|
251
402
|
})
|
|
252
403
|
),
|
|
253
|
-
use_policy:
|
|
254
|
-
wagering_policy:
|
|
255
|
-
stacking_policy:
|
|
256
|
-
restricted_position_selection_policy:
|
|
404
|
+
use_policy: z4__namespace.optional(usePolicy()),
|
|
405
|
+
wagering_policy: z4__namespace.optional(wageringPolicy()),
|
|
406
|
+
stacking_policy: z4__namespace.optional(stackingPolicy()),
|
|
407
|
+
restricted_position_selection_policy: z4__namespace.optional(
|
|
257
408
|
extension.wire({
|
|
258
409
|
version: count(),
|
|
259
|
-
priority_then_earliest_expiry:
|
|
410
|
+
priority_then_earliest_expiry: z4__namespace.optional(extension.wire({ selection_priority: z4__namespace.optional(z4__namespace.number()) }))
|
|
260
411
|
})
|
|
261
412
|
)
|
|
262
413
|
});
|
|
263
414
|
var localizedContent = () => extension.wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
|
|
264
|
-
var content = () => extension.wire({ default_locale: text(), supported_locales: list(
|
|
265
|
-
var
|
|
415
|
+
var content = () => extension.wire({ default_locale: text(), supported_locales: list(z4__namespace.string()), localized_content: list(localizedContent()) });
|
|
416
|
+
var offerSchema2 = /* @__PURE__ */ extension.lazy(
|
|
266
417
|
() => extension.wire({
|
|
267
418
|
campaign_id: text(),
|
|
268
419
|
campaign_version_id: text(),
|
|
269
420
|
publication_id: text(),
|
|
270
421
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
271
422
|
timezone: text(),
|
|
272
|
-
enrollment_window:
|
|
273
|
-
qualification_window:
|
|
274
|
-
claim_window:
|
|
275
|
-
entry_policy:
|
|
276
|
-
reward_claim_policy:
|
|
277
|
-
qualification:
|
|
278
|
-
reward:
|
|
279
|
-
publication_starts_at:
|
|
280
|
-
publication_ends_at:
|
|
281
|
-
content:
|
|
423
|
+
enrollment_window: z4__namespace.optional(timeWindow()),
|
|
424
|
+
qualification_window: z4__namespace.optional(timeWindow()),
|
|
425
|
+
claim_window: z4__namespace.optional(timeWindow()),
|
|
426
|
+
entry_policy: z4__namespace.optional(policy("ENTRY_POLICY_CODE_")),
|
|
427
|
+
reward_claim_policy: z4__namespace.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
|
|
428
|
+
qualification: z4__namespace.optional(qualification()),
|
|
429
|
+
reward: z4__namespace.optional(reward()),
|
|
430
|
+
publication_starts_at: z4__namespace.optional(z4__namespace.string()),
|
|
431
|
+
publication_ends_at: z4__namespace.optional(z4__namespace.string()),
|
|
432
|
+
content: z4__namespace.optional(content())
|
|
282
433
|
})
|
|
283
434
|
);
|
|
284
435
|
function grantMoney(value, currency) {
|
|
285
436
|
return { amount: value?.amount ?? 0, currency: value?.currency || currency };
|
|
286
437
|
}
|
|
287
|
-
var rewardGrant = () =>
|
|
438
|
+
var rewardGrant = () => z4__namespace.pipe(
|
|
288
439
|
extension.wire({
|
|
289
440
|
state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
|
|
290
|
-
granted:
|
|
291
|
-
balance:
|
|
292
|
-
converted:
|
|
293
|
-
expires_at:
|
|
294
|
-
wagering:
|
|
295
|
-
extension.wire({ required:
|
|
441
|
+
granted: z4__namespace.optional(money()),
|
|
442
|
+
balance: z4__namespace.optional(money()),
|
|
443
|
+
converted: z4__namespace.optional(money()),
|
|
444
|
+
expires_at: z4__namespace.optional(z4__namespace.string()),
|
|
445
|
+
wagering: z4__namespace.optional(
|
|
446
|
+
extension.wire({ required: z4__namespace.optional(money()), accumulated: z4__namespace.optional(money()), completed_at: z4__namespace.optional(z4__namespace.string()) })
|
|
296
447
|
)
|
|
297
448
|
}),
|
|
298
|
-
|
|
449
|
+
z4__namespace.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
|
|
299
450
|
const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
|
|
300
451
|
const out = {
|
|
301
452
|
state,
|
|
@@ -315,40 +466,40 @@ var rewardGrant = () => z2__namespace.pipe(
|
|
|
315
466
|
})
|
|
316
467
|
);
|
|
317
468
|
var participationSchema = /* @__PURE__ */ extension.lazy(
|
|
318
|
-
() =>
|
|
469
|
+
() => z4__namespace.pipe(
|
|
319
470
|
extension.wire({
|
|
320
471
|
id: text(),
|
|
321
472
|
campaign_id: text(),
|
|
322
473
|
campaign_version_id: text(),
|
|
323
474
|
reward_key: text(),
|
|
324
|
-
qualification_snapshot:
|
|
475
|
+
qualification_snapshot: z4__namespace.optional(qualification()),
|
|
325
476
|
// oneof `state`: only one of the cases is filled in.
|
|
326
|
-
enrolled:
|
|
327
|
-
qualifying:
|
|
328
|
-
qualified:
|
|
329
|
-
reward_pending:
|
|
330
|
-
completed:
|
|
331
|
-
reward_failed:
|
|
332
|
-
expired:
|
|
333
|
-
cancelled:
|
|
334
|
-
reward_grant:
|
|
335
|
-
snapshot:
|
|
477
|
+
enrolled: z4__namespace.optional(empty()),
|
|
478
|
+
qualifying: z4__namespace.optional(empty()),
|
|
479
|
+
qualified: z4__namespace.optional(extension.wire({ qualified_at: z4__namespace.optional(z4__namespace.string()) })),
|
|
480
|
+
reward_pending: z4__namespace.optional(empty()),
|
|
481
|
+
completed: z4__namespace.optional(extension.wire({ completed_at: z4__namespace.optional(z4__namespace.string()) })),
|
|
482
|
+
reward_failed: z4__namespace.optional(empty()),
|
|
483
|
+
expired: z4__namespace.optional(extension.wire({ expired_at: z4__namespace.optional(z4__namespace.string()) })),
|
|
484
|
+
cancelled: z4__namespace.optional(empty()),
|
|
485
|
+
reward_grant: z4__namespace.optional(rewardGrant()),
|
|
486
|
+
snapshot: z4__namespace.optional(
|
|
336
487
|
extension.wire({
|
|
337
|
-
reward:
|
|
338
|
-
content:
|
|
339
|
-
terms_acceptance:
|
|
488
|
+
reward: z4__namespace.optional(reward()),
|
|
489
|
+
content: z4__namespace.optional(content()),
|
|
490
|
+
terms_acceptance: z4__namespace.optional(
|
|
340
491
|
extension.wire({
|
|
341
492
|
locale: text(),
|
|
342
493
|
terms_revision: text(),
|
|
343
494
|
terms_digest_sha256_hex: text(),
|
|
344
|
-
accepted_at:
|
|
495
|
+
accepted_at: z4__namespace.optional(z4__namespace.string())
|
|
345
496
|
})
|
|
346
497
|
)
|
|
347
498
|
})
|
|
348
499
|
)
|
|
349
500
|
}),
|
|
350
501
|
// The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
|
|
351
|
-
|
|
502
|
+
z4__namespace.transform(
|
|
352
503
|
({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
|
|
353
504
|
const out = { ...rest, status: "unspecified" };
|
|
354
505
|
if (enrolled) out.status = "enrolled";
|
|
@@ -370,77 +521,77 @@ var participationSchema = /* @__PURE__ */ extension.lazy(
|
|
|
370
521
|
)
|
|
371
522
|
)
|
|
372
523
|
);
|
|
373
|
-
var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor:
|
|
374
|
-
var offersPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("offers",
|
|
524
|
+
var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor: z4__namespace.optional(z4__namespace.string()) });
|
|
525
|
+
var offersPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("offers", offerSchema2()));
|
|
375
526
|
var participationsPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("participations", participationSchema()));
|
|
376
|
-
var offerEnvelope = /* @__PURE__ */ extension.lazy(() => extension.wire({ offer:
|
|
527
|
+
var offerEnvelope = /* @__PURE__ */ extension.lazy(() => extension.wire({ offer: offerSchema2() }));
|
|
377
528
|
var participationEnvelope = /* @__PURE__ */ extension.lazy(() => extension.wire({ participation: participationSchema() }));
|
|
378
529
|
var promoCodeOfferSchema = /* @__PURE__ */ extension.lazy(
|
|
379
|
-
() => extension.wire({ offer:
|
|
530
|
+
() => extension.wire({ offer: offerSchema2(), localized_content: localizedContent() })
|
|
380
531
|
);
|
|
381
532
|
function toCursorPage(key, data) {
|
|
382
533
|
const page = { items: data[key] };
|
|
383
534
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
384
535
|
return page;
|
|
385
536
|
}
|
|
386
|
-
var nullableDate = () =>
|
|
387
|
-
|
|
388
|
-
|
|
537
|
+
var nullableDate = () => z4__namespace.pipe(
|
|
538
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
539
|
+
z4__namespace.transform((value) => value ?? void 0)
|
|
389
540
|
);
|
|
390
541
|
function compact(value) {
|
|
391
542
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
392
543
|
}
|
|
393
544
|
var overviewSchema = /* @__PURE__ */ extension.lazy(
|
|
394
|
-
() =>
|
|
545
|
+
() => z4__namespace.pipe(
|
|
395
546
|
extension.wire({
|
|
396
547
|
currencies: list(
|
|
397
|
-
|
|
548
|
+
z4__namespace.pipe(
|
|
398
549
|
extension.wire({
|
|
399
550
|
currency: currencyOrEmpty(),
|
|
400
|
-
decimal_places:
|
|
551
|
+
decimal_places: z4__namespace.number(),
|
|
401
552
|
restricted_total: minorUnits(),
|
|
402
553
|
expiring_7d: minorUnits(),
|
|
403
|
-
open_positions:
|
|
554
|
+
open_positions: z4__namespace.number(),
|
|
404
555
|
next_expires_at: nullableDate(),
|
|
405
556
|
converted: minorUnits(),
|
|
406
|
-
converted_campaigns:
|
|
557
|
+
converted_campaigns: z4__namespace.number()
|
|
407
558
|
}),
|
|
408
|
-
|
|
559
|
+
z4__namespace.transform(compact)
|
|
409
560
|
)
|
|
410
561
|
),
|
|
411
562
|
as_of: nullableDate()
|
|
412
563
|
}),
|
|
413
|
-
|
|
564
|
+
z4__namespace.transform(compact)
|
|
414
565
|
)
|
|
415
566
|
);
|
|
416
567
|
var positionsPage = /* @__PURE__ */ extension.lazy(
|
|
417
568
|
() => extension.wire({
|
|
418
569
|
rows: list(
|
|
419
|
-
|
|
570
|
+
z4__namespace.pipe(
|
|
420
571
|
extension.wire({
|
|
421
|
-
position_id:
|
|
422
|
-
campaign_id:
|
|
572
|
+
position_id: z4__namespace.string(),
|
|
573
|
+
campaign_id: z4__namespace.string(),
|
|
423
574
|
currency: currencyOrEmpty(),
|
|
424
|
-
decimal_places:
|
|
575
|
+
decimal_places: z4__namespace.number(),
|
|
425
576
|
granted: minorUnits(),
|
|
426
577
|
restricted: minorUnits(),
|
|
427
578
|
converted: minorUnits(),
|
|
428
579
|
required: minorUnits(),
|
|
429
580
|
wagered: minorUnits(),
|
|
430
581
|
remaining: minorUnits(),
|
|
431
|
-
state:
|
|
582
|
+
state: z4__namespace.string(),
|
|
432
583
|
// The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
|
|
433
|
-
terminal_action:
|
|
434
|
-
|
|
435
|
-
|
|
584
|
+
terminal_action: z4__namespace.pipe(
|
|
585
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
586
|
+
z4__namespace.transform((value) => value ? value.toLowerCase() : void 0)
|
|
436
587
|
),
|
|
437
588
|
expires_at: nullableDate(),
|
|
438
589
|
created_at: nullableDate()
|
|
439
590
|
}),
|
|
440
|
-
|
|
591
|
+
z4__namespace.transform((row) => compact(row))
|
|
441
592
|
)
|
|
442
593
|
),
|
|
443
|
-
next_cursor:
|
|
594
|
+
next_cursor: z4__namespace.optional(z4__namespace.string())
|
|
444
595
|
})
|
|
445
596
|
);
|
|
446
597
|
var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
|
|
@@ -534,51 +685,51 @@ function createBonusApi(transport) {
|
|
|
534
685
|
}
|
|
535
686
|
var gameSchema = /* @__PURE__ */ extension.lazy(
|
|
536
687
|
() => extension.wire({
|
|
537
|
-
id:
|
|
538
|
-
name:
|
|
539
|
-
provider:
|
|
540
|
-
category:
|
|
541
|
-
type:
|
|
542
|
-
thumbnail:
|
|
543
|
-
is_new:
|
|
544
|
-
is_popular:
|
|
545
|
-
is_live:
|
|
546
|
-
demo_available:
|
|
547
|
-
rtp:
|
|
548
|
-
volatility:
|
|
549
|
-
priority:
|
|
688
|
+
id: z4__namespace.string(),
|
|
689
|
+
name: z4__namespace.string(),
|
|
690
|
+
provider: z4__namespace.string(),
|
|
691
|
+
category: z4__namespace.string(),
|
|
692
|
+
type: z4__namespace.string(),
|
|
693
|
+
thumbnail: z4__namespace.string(),
|
|
694
|
+
is_new: z4__namespace.boolean(),
|
|
695
|
+
is_popular: z4__namespace.boolean(),
|
|
696
|
+
is_live: z4__namespace.boolean(),
|
|
697
|
+
demo_available: z4__namespace.boolean(),
|
|
698
|
+
rtp: z4__namespace.number(),
|
|
699
|
+
volatility: z4__namespace.string(),
|
|
700
|
+
priority: z4__namespace.number()
|
|
550
701
|
})
|
|
551
702
|
);
|
|
552
703
|
var categoriesSchema = /* @__PURE__ */ extension.lazy(
|
|
553
|
-
() =>
|
|
554
|
-
extension.wire({ slug:
|
|
704
|
+
() => z4__namespace.array(
|
|
705
|
+
extension.wire({ slug: z4__namespace.string(), name: z4__namespace.string(), icon: z4__namespace.string(), game_count: z4__namespace.number(), priority: z4__namespace.number() })
|
|
555
706
|
)
|
|
556
707
|
);
|
|
557
708
|
var providersSchema = /* @__PURE__ */ extension.lazy(
|
|
558
|
-
() =>
|
|
709
|
+
() => z4__namespace.array(extension.wire({ id: z4__namespace.string(), name: z4__namespace.string(), game_count: z4__namespace.number() }))
|
|
559
710
|
);
|
|
560
711
|
var launchSchema = /* @__PURE__ */ extension.lazy(
|
|
561
|
-
() =>
|
|
712
|
+
() => z4__namespace.pipe(
|
|
562
713
|
extension.wire({
|
|
563
|
-
session_id:
|
|
564
|
-
game_url:
|
|
714
|
+
session_id: z4__namespace.string().check(z4__namespace.minLength(1)),
|
|
715
|
+
game_url: z4__namespace.string().check(z4__namespace.minLength(1)),
|
|
565
716
|
// Any text: a target the SDK does not know yet must not fail the (strict) launch.
|
|
566
|
-
launch_target:
|
|
567
|
-
provider_code:
|
|
568
|
-
expires_at:
|
|
717
|
+
launch_target: z4__namespace.optional(z4__namespace.string()),
|
|
718
|
+
provider_code: z4__namespace.optional(z4__namespace.string()),
|
|
719
|
+
expires_at: z4__namespace.optional(z4__namespace.string())
|
|
569
720
|
}),
|
|
570
721
|
// Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
|
|
571
722
|
// before the field existed: an iframe.
|
|
572
|
-
|
|
723
|
+
z4__namespace.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
|
|
573
724
|
)
|
|
574
725
|
);
|
|
575
726
|
var sessionSchema = /* @__PURE__ */ extension.lazy(
|
|
576
727
|
() => extension.wire({
|
|
577
|
-
id:
|
|
578
|
-
game_id:
|
|
579
|
-
game_name:
|
|
580
|
-
provider:
|
|
581
|
-
start_time:
|
|
728
|
+
id: z4__namespace.string(),
|
|
729
|
+
game_id: z4__namespace.string(),
|
|
730
|
+
game_name: z4__namespace.string(),
|
|
731
|
+
provider: z4__namespace.string(),
|
|
732
|
+
start_time: z4__namespace.string(),
|
|
582
733
|
total_bet: extension.money(),
|
|
583
734
|
total_win: extension.money(),
|
|
584
735
|
status: protoEnum("SESSION_STATUS_")
|
|
@@ -586,49 +737,155 @@ var sessionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
586
737
|
);
|
|
587
738
|
var transactionSchema = /* @__PURE__ */ extension.lazy(
|
|
588
739
|
() => extension.wire({
|
|
589
|
-
id:
|
|
590
|
-
game_id:
|
|
591
|
-
game_name:
|
|
592
|
-
round_id:
|
|
740
|
+
id: z4__namespace.string(),
|
|
741
|
+
game_id: z4__namespace.string(),
|
|
742
|
+
game_name: z4__namespace.string(),
|
|
743
|
+
round_id: z4__namespace.string(),
|
|
593
744
|
type: protoEnum("CASINO_TRANSACTION_TYPE_"),
|
|
594
745
|
amount: minorUnits(),
|
|
595
746
|
currency: extension.currencyCode(),
|
|
596
747
|
currency_decimal_places: extension.decimalPlaces(),
|
|
597
|
-
created_at:
|
|
748
|
+
created_at: z4__namespace.string()
|
|
598
749
|
})
|
|
599
750
|
);
|
|
600
751
|
var winnersSchema = /* @__PURE__ */ extension.lazy(
|
|
601
|
-
() =>
|
|
752
|
+
() => z4__namespace.array(
|
|
602
753
|
extension.wire({
|
|
603
|
-
player:
|
|
754
|
+
player: z4__namespace.string(),
|
|
604
755
|
amount: minorUnits(),
|
|
605
756
|
currency: extension.currencyCode(),
|
|
606
757
|
currency_decimal_places: extension.decimalPlaces(),
|
|
607
|
-
game_id:
|
|
608
|
-
game_name:
|
|
609
|
-
won_at:
|
|
758
|
+
game_id: z4__namespace.string(),
|
|
759
|
+
game_name: z4__namespace.string(),
|
|
760
|
+
won_at: z4__namespace.string()
|
|
610
761
|
})
|
|
611
762
|
)
|
|
612
763
|
);
|
|
764
|
+
var gamesEnvelopeSchema = /* @__PURE__ */ extension.lazy(
|
|
765
|
+
() => extension.wire({
|
|
766
|
+
availability: z4__namespace.pipe(
|
|
767
|
+
z4__namespace.nullish(
|
|
768
|
+
extension.wire({
|
|
769
|
+
// The gateway reports an unset status as `available`; the SDK does the same for an absent/empty one.
|
|
770
|
+
status: z4__namespace.pipe(
|
|
771
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
772
|
+
z4__namespace.transform((value) => value ? value.toLowerCase() : "available")
|
|
773
|
+
),
|
|
774
|
+
primary_provider_code: optionalText(),
|
|
775
|
+
missing: nullableList(z4__namespace.string())
|
|
776
|
+
})
|
|
777
|
+
),
|
|
778
|
+
z4__namespace.transform((value) => value ?? null)
|
|
779
|
+
)
|
|
780
|
+
})
|
|
781
|
+
);
|
|
782
|
+
var CURRENCY = /^[A-Z]{3}$/;
|
|
783
|
+
var DECIMAL_PLACES_MAX = 20;
|
|
784
|
+
var jackpotSchema = /* @__PURE__ */ extension.lazy(
|
|
785
|
+
() => z4__namespace.pipe(
|
|
786
|
+
z4__namespace.object({
|
|
787
|
+
id: z4__namespace.string().check(z4__namespace.refine((value) => value.trim() !== "")),
|
|
788
|
+
name: z4__namespace.string().check(z4__namespace.refine((value) => value.trim() !== "")),
|
|
789
|
+
currency: z4__namespace.string().check(z4__namespace.regex(CURRENCY)),
|
|
790
|
+
amount_minor: z4__namespace.union([
|
|
791
|
+
z4__namespace.string().check(z4__namespace.refine((value) => /^(0|[1-9]\d*)$/.test(value) && Number.isSafeInteger(Number(value)))),
|
|
792
|
+
z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value) && value >= 0))
|
|
793
|
+
]),
|
|
794
|
+
decimal_places: z4__namespace.number().check(z4__namespace.refine((value) => Number.isInteger(value) && value >= 0 && value <= DECIMAL_PLACES_MAX))
|
|
795
|
+
}),
|
|
796
|
+
z4__namespace.transform((raw) => ({
|
|
797
|
+
id: raw.id,
|
|
798
|
+
name: raw.name,
|
|
799
|
+
currency: raw.currency,
|
|
800
|
+
amount: Number(raw.amount_minor) || 0,
|
|
801
|
+
currencyDecimalPlaces: raw.decimal_places
|
|
802
|
+
}))
|
|
803
|
+
)
|
|
804
|
+
);
|
|
805
|
+
var jackpotsSchema = /* @__PURE__ */ extension.lazy(
|
|
806
|
+
() => extension.wire({ items: nullableList(z4__namespace.unknown()), featured_id: optionalText() })
|
|
807
|
+
);
|
|
808
|
+
var jackpotGamesSchema = /* @__PURE__ */ extension.lazy(
|
|
809
|
+
() => z4__namespace.pipe(
|
|
810
|
+
extension.wire({
|
|
811
|
+
games: nullableList(gameSchema()),
|
|
812
|
+
mode: z4__namespace.pipe(
|
|
813
|
+
z4__namespace.string(),
|
|
814
|
+
z4__namespace.transform((value) => value.toLowerCase())
|
|
815
|
+
),
|
|
816
|
+
pagination: extension.wire({
|
|
817
|
+
page: z4__namespace.number(),
|
|
818
|
+
per_page: z4__namespace.number(),
|
|
819
|
+
has_next: z4__namespace.boolean(),
|
|
820
|
+
next_cursor: optionalText()
|
|
821
|
+
})
|
|
822
|
+
}),
|
|
823
|
+
z4__namespace.transform(({ games, mode, pagination }) => ({
|
|
824
|
+
items: games,
|
|
825
|
+
mode,
|
|
826
|
+
page: pagination.page,
|
|
827
|
+
perPage: pagination.perPage,
|
|
828
|
+
// A page that says there is more but has no cursor cannot be followed: it is the last one.
|
|
829
|
+
hasNext: pagination.hasNext && pagination.nextCursor !== null,
|
|
830
|
+
nextCursor: pagination.hasNext ? pagination.nextCursor : null
|
|
831
|
+
}))
|
|
832
|
+
)
|
|
833
|
+
);
|
|
834
|
+
var DEVICES = ["mobile", "desktop"];
|
|
835
|
+
var GAMES_ROUTE = { method: "GET", path: "/games" };
|
|
836
|
+
var JACKPOTS_ROUTE = { method: "GET", path: "/games/jackpots" };
|
|
837
|
+
var JACKPOT_GAMES_ROUTE = { method: "GET", path: "/games/jackpots/{jackpotId}/games" };
|
|
838
|
+
var JACKPOT_GAMES_MAX = 48;
|
|
839
|
+
function deviceProblem(name, device) {
|
|
840
|
+
return device === void 0 || DEVICES.includes(device) ? void 0 : `${name}: device must be 'mobile' or 'desktop' (or omitted).`;
|
|
841
|
+
}
|
|
842
|
+
function currencyProblem(name, currency) {
|
|
843
|
+
return typeof currency === "string" && CURRENCY.test(currency) ? void 0 : `${name}: currency must be an ISO 4217 code in uppercase (e.g. BRL).`;
|
|
844
|
+
}
|
|
845
|
+
function jackpotGamesProblem(input) {
|
|
846
|
+
const name = "casino.listJackpotGames";
|
|
847
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
848
|
+
return `${name}: input must be an object { jackpotId, currency }.`;
|
|
849
|
+
const { jackpotId, currency, device, page, perPage, cursor } = input;
|
|
850
|
+
if (typeof jackpotId !== "string" || jackpotId.trim() === "") return `${name}: jackpotId must be non-empty text.`;
|
|
851
|
+
const problem = currencyProblem(name, currency) ?? deviceProblem(name, device);
|
|
852
|
+
if (problem !== void 0) return problem;
|
|
853
|
+
if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
|
|
854
|
+
return `${name}: page must be an integer \u2265 1.`;
|
|
855
|
+
if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > JACKPOT_GAMES_MAX))
|
|
856
|
+
return `${name}: perPage must be an integer from 1 to ${JACKPOT_GAMES_MAX}.`;
|
|
857
|
+
if (cursor !== void 0 && typeof cursor !== "string") return `${name}: cursor must be text.`;
|
|
858
|
+
if (typeof page === "number" && page > 1 && (cursor === void 0 || cursor === ""))
|
|
859
|
+
return `${name}: a page above 1 requires the previous page's nextCursor.`;
|
|
860
|
+
return void 0;
|
|
861
|
+
}
|
|
613
862
|
function createCasinoApi(transport) {
|
|
614
863
|
return {
|
|
615
|
-
listGames: (input, options) =>
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
864
|
+
listGames: async (input, options) => {
|
|
865
|
+
const problem = deviceProblem("casino.listGames", input?.device);
|
|
866
|
+
if (problem !== void 0) return rejectInput(transport, problem, GAMES_ROUTE);
|
|
867
|
+
const spec = {
|
|
868
|
+
...GAMES_ROUTE,
|
|
869
|
+
query: {
|
|
870
|
+
category: input?.category,
|
|
871
|
+
provider: input?.provider,
|
|
872
|
+
search: input?.search,
|
|
873
|
+
ids: input?.ids?.length ? input.ids.join(",") : void 0,
|
|
874
|
+
sort: input?.sort,
|
|
875
|
+
device: input?.device
|
|
876
|
+
},
|
|
877
|
+
page: input?.page,
|
|
878
|
+
perPage: input?.perPage,
|
|
879
|
+
perPageParam: "limit",
|
|
880
|
+
auth: "none",
|
|
881
|
+
item: gameSchema(),
|
|
882
|
+
options
|
|
883
|
+
};
|
|
884
|
+
if (typeof transport.requestPageWithEnvelope !== "function")
|
|
885
|
+
return { ...await transport.requestPage(spec), availability: null };
|
|
886
|
+
const { page, envelope } = await transport.requestPageWithEnvelope({ ...spec, envelope: gamesEnvelopeSchema() });
|
|
887
|
+
return { ...page, availability: envelope.availability };
|
|
888
|
+
},
|
|
632
889
|
listCategories: (_params, options) => transport.request({ method: "GET", path: "/games/categories", schema: categoriesSchema(), options }),
|
|
633
890
|
listProviders: (_params, options) => transport.request({ method: "GET", path: "/games/providers", schema: providersSchema(), options }),
|
|
634
891
|
getGame: ({ gameId }, options) => transport.request({
|
|
@@ -637,10 +894,16 @@ function createCasinoApi(transport) {
|
|
|
637
894
|
schema: gameSchema(),
|
|
638
895
|
options
|
|
639
896
|
}),
|
|
640
|
-
launchGame: ({ gameId, mode, isMobile, returnUrl, language }, options) => transport.request({
|
|
897
|
+
launchGame: ({ gameId, mode, isMobile, returnUrl, depositUrl, language }, options) => transport.request({
|
|
641
898
|
method: "POST",
|
|
642
899
|
path: `/games/${encodeURIComponent(gameId)}/launch`,
|
|
643
|
-
body: {
|
|
900
|
+
body: {
|
|
901
|
+
is_demo: mode === "demo",
|
|
902
|
+
is_mobile: isMobile === true,
|
|
903
|
+
return_url: returnUrl,
|
|
904
|
+
deposit_url: depositUrl,
|
|
905
|
+
language
|
|
906
|
+
},
|
|
644
907
|
auth: "required",
|
|
645
908
|
// The response carries the URL with the game session token: never through `warn` mode's recovery
|
|
646
909
|
// (which would deliver a raw field and the response to `onValidationIssue`).
|
|
@@ -675,49 +938,57 @@ function createCasinoApi(transport) {
|
|
|
675
938
|
auth: "required",
|
|
676
939
|
schema: winnersSchema(),
|
|
677
940
|
options
|
|
678
|
-
})
|
|
941
|
+
}),
|
|
942
|
+
listJackpots: async (input, options) => {
|
|
943
|
+
const currency = input?.currency;
|
|
944
|
+
const problem = currencyProblem("casino.listJackpots", currency);
|
|
945
|
+
if (problem !== void 0) return rejectInput(transport, problem, JACKPOTS_ROUTE);
|
|
946
|
+
const raw = await transport.request({
|
|
947
|
+
...JACKPOTS_ROUTE,
|
|
948
|
+
query: { currency },
|
|
949
|
+
auth: "none",
|
|
950
|
+
schema: jackpotsSchema(),
|
|
951
|
+
options
|
|
952
|
+
});
|
|
953
|
+
const items = [];
|
|
954
|
+
for (const entry of Array.isArray(raw.items) ? raw.items : []) {
|
|
955
|
+
const parsed = z4__namespace.safeParse(jackpotSchema(), entry);
|
|
956
|
+
if (!parsed.success || parsed.data.currency !== currency) continue;
|
|
957
|
+
if (items.some((item) => item.id === parsed.data.id)) continue;
|
|
958
|
+
items.push(parsed.data);
|
|
959
|
+
}
|
|
960
|
+
const featured = typeof raw.featuredId === "string" ? raw.featuredId : null;
|
|
961
|
+
return { items, featuredId: items.some((item) => item.id === featured) ? featured : null };
|
|
962
|
+
},
|
|
963
|
+
listJackpotGames: (input, options) => {
|
|
964
|
+
const problem = jackpotGamesProblem(input);
|
|
965
|
+
if (problem !== void 0) return rejectInput(transport, problem, JACKPOT_GAMES_ROUTE);
|
|
966
|
+
return transport.request({
|
|
967
|
+
method: "GET",
|
|
968
|
+
path: `/games/jackpots/${encodeURIComponent(input.jackpotId)}/games`,
|
|
969
|
+
query: {
|
|
970
|
+
currency: input.currency,
|
|
971
|
+
device: input.device,
|
|
972
|
+
page: input.page,
|
|
973
|
+
limit: input.perPage,
|
|
974
|
+
cursor: input.cursor === "" ? void 0 : input.cursor
|
|
975
|
+
},
|
|
976
|
+
auth: "none",
|
|
977
|
+
schema: jackpotGamesSchema(),
|
|
978
|
+
options
|
|
979
|
+
});
|
|
980
|
+
}
|
|
679
981
|
};
|
|
680
982
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (typeof input !== "object" || input === null || Array.isArray(input)) return `${name}: input must be an object.`;
|
|
691
|
-
const { page, perPage } = input;
|
|
692
|
-
if (page !== void 0 && (typeof page !== "number" || !Number.isSafeInteger(page) || page < 1))
|
|
693
|
-
return `${name}: page must be an integer \u2265 1.`;
|
|
694
|
-
if (perPage !== void 0 && (typeof perPage !== "number" || !Number.isInteger(perPage) || perPage < 1 || perPage > 100))
|
|
695
|
-
return `${name}: perPage must be an integer from 1 to 100.`;
|
|
696
|
-
return void 0;
|
|
697
|
-
}
|
|
698
|
-
function optionalTimestamp() {
|
|
699
|
-
return z2__namespace.pipe(
|
|
700
|
-
z2__namespace.nullish(z2__namespace.string().check(z2__namespace.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
701
|
-
z2__namespace.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
function optionalText() {
|
|
705
|
-
return z2__namespace.pipe(
|
|
706
|
-
z2__namespace.nullish(z2__namespace.string()),
|
|
707
|
-
z2__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
708
|
-
);
|
|
709
|
-
}
|
|
710
|
-
function nullableList(item) {
|
|
711
|
-
return z2__namespace.pipe(
|
|
712
|
-
z2__namespace.nullish(z2__namespace.array(item)),
|
|
713
|
-
z2__namespace.transform((value) => value ?? [])
|
|
714
|
-
);
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
// src/modules/loyalty.ts
|
|
718
|
-
var tierBenefits = () => z2__namespace.pipe(
|
|
719
|
-
z2__namespace.nullish(z2__namespace.string()),
|
|
720
|
-
z2__namespace.transform((text2, ctx) => {
|
|
983
|
+
var ParsedBenefits = class {
|
|
984
|
+
constructor(value) {
|
|
985
|
+
this.value = value;
|
|
986
|
+
}
|
|
987
|
+
value;
|
|
988
|
+
};
|
|
989
|
+
var tierBenefits = () => z4__namespace.pipe(
|
|
990
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
991
|
+
z4__namespace.transform((text2, ctx) => {
|
|
721
992
|
if (text2 == null || text2.trim() === "") return null;
|
|
722
993
|
let parsed;
|
|
723
994
|
try {
|
|
@@ -725,46 +996,49 @@ var tierBenefits = () => z2__namespace.pipe(
|
|
|
725
996
|
} catch {
|
|
726
997
|
parsed = void 0;
|
|
727
998
|
}
|
|
728
|
-
if (typeof parsed === "object" && parsed !== null
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
999
|
+
if (typeof parsed === "object" && parsed !== null) return new ParsedBenefits(parsed);
|
|
1000
|
+
ctx.issues.push({
|
|
1001
|
+
code: "custom",
|
|
1002
|
+
message: "tier_benefits_json is not a JSON object or array",
|
|
1003
|
+
input: void 0
|
|
1004
|
+
});
|
|
1005
|
+
return z4__namespace.NEVER;
|
|
732
1006
|
})
|
|
733
1007
|
);
|
|
734
1008
|
var loyaltySchema = /* @__PURE__ */ extension.lazy(
|
|
735
|
-
() =>
|
|
1009
|
+
() => z4__namespace.pipe(
|
|
736
1010
|
extension.wire({
|
|
737
1011
|
total_points_earned: integerText(),
|
|
738
1012
|
current_points: integerText(),
|
|
739
1013
|
points_redeemed: integerText(),
|
|
740
1014
|
current_tier: optionalText(),
|
|
741
1015
|
tier_points: integerText(),
|
|
742
|
-
lifetime_wagered:
|
|
743
|
-
lifetime_deposited:
|
|
1016
|
+
lifetime_wagered: z4__namespace._default(minorUnits(), 0),
|
|
1017
|
+
lifetime_deposited: z4__namespace._default(minorUnits(), 0),
|
|
744
1018
|
tier_benefits_json: tierBenefits(),
|
|
745
1019
|
tier_expires_at: optionalTimestamp()
|
|
746
1020
|
}),
|
|
747
|
-
|
|
748
|
-
const benefits =
|
|
1021
|
+
z4__namespace.transform(({ tierBenefitsJson, ...rest }) => {
|
|
1022
|
+
const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
|
|
749
1023
|
return { ...rest, tierBenefits: benefits };
|
|
750
1024
|
})
|
|
751
1025
|
)
|
|
752
1026
|
);
|
|
753
1027
|
var redeemSchema = /* @__PURE__ */ extension.lazy(
|
|
754
|
-
() =>
|
|
1028
|
+
() => z4__namespace.pipe(
|
|
755
1029
|
extension.wire({
|
|
756
|
-
success:
|
|
757
|
-
message:
|
|
1030
|
+
success: z4__namespace.optional(z4__namespace.boolean()),
|
|
1031
|
+
message: z4__namespace.optional(z4__namespace.string()),
|
|
758
1032
|
redeemed_points: integerText(),
|
|
759
|
-
value:
|
|
1033
|
+
value: z4__namespace.nullish(minorUnits()),
|
|
760
1034
|
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
761
|
-
currency:
|
|
762
|
-
|
|
763
|
-
|
|
1035
|
+
currency: z4__namespace.pipe(
|
|
1036
|
+
z4__namespace.nullish(currencyOrEmpty()),
|
|
1037
|
+
z4__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
764
1038
|
),
|
|
765
1039
|
bonus_id: optionalText()
|
|
766
1040
|
}),
|
|
767
|
-
|
|
1041
|
+
z4__namespace.transform((data) => ({
|
|
768
1042
|
success: data.success,
|
|
769
1043
|
message: data.message,
|
|
770
1044
|
redeemedPoints: data.redeemedPoints,
|
|
@@ -808,12 +1082,12 @@ function createLoyaltyApi(transport) {
|
|
|
808
1082
|
};
|
|
809
1083
|
}
|
|
810
1084
|
function openUnion(values) {
|
|
811
|
-
return
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1085
|
+
return z4__namespace.pipe(
|
|
1086
|
+
z4__namespace.pipe(
|
|
1087
|
+
z4__namespace.string(),
|
|
1088
|
+
z4__namespace.transform((value) => value.toLowerCase())
|
|
815
1089
|
),
|
|
816
|
-
|
|
1090
|
+
z4__namespace.enum(values)
|
|
817
1091
|
);
|
|
818
1092
|
}
|
|
819
1093
|
|
|
@@ -824,14 +1098,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
|
824
1098
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
825
1099
|
var missionSchema = /* @__PURE__ */ extension.lazy(
|
|
826
1100
|
() => extension.wire({
|
|
827
|
-
id:
|
|
828
|
-
name:
|
|
829
|
-
description:
|
|
1101
|
+
id: z4__namespace.string(),
|
|
1102
|
+
name: z4__namespace.string(),
|
|
1103
|
+
description: z4__namespace._default(z4__namespace.string(), ""),
|
|
830
1104
|
mission_type: openUnion(MISSION_TYPES),
|
|
831
1105
|
objective_type: openUnion(OBJECTIVE_TYPES),
|
|
832
1106
|
target_value: integerText(),
|
|
833
1107
|
target_game_category: optionalText(),
|
|
834
|
-
target_games: nullableList(
|
|
1108
|
+
target_games: nullableList(z4__namespace.string()),
|
|
835
1109
|
reward_type: openUnion(REWARD_TYPES),
|
|
836
1110
|
reward_value: minorUnits(),
|
|
837
1111
|
valid_from: optionalTimestamp(),
|
|
@@ -839,16 +1113,16 @@ var missionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
839
1113
|
})
|
|
840
1114
|
);
|
|
841
1115
|
var userMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
842
|
-
() =>
|
|
1116
|
+
() => z4__namespace.pipe(
|
|
843
1117
|
extension.wire({
|
|
844
1118
|
missions: nullableList(
|
|
845
1119
|
extension.wire({
|
|
846
|
-
id:
|
|
847
|
-
mission_id:
|
|
848
|
-
mission_name:
|
|
1120
|
+
id: z4__namespace.string(),
|
|
1121
|
+
mission_id: z4__namespace.string(),
|
|
1122
|
+
mission_name: z4__namespace._default(z4__namespace.string(), ""),
|
|
849
1123
|
current_progress: integerText(),
|
|
850
1124
|
target_value: integerText(),
|
|
851
|
-
progress_percentage:
|
|
1125
|
+
progress_percentage: z4__namespace.number(),
|
|
852
1126
|
status: openUnion(USER_MISSION_STATUSES),
|
|
853
1127
|
reward_type: openUnion(REWARD_TYPES),
|
|
854
1128
|
reward_value: minorUnits(),
|
|
@@ -857,7 +1131,7 @@ var userMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
|
857
1131
|
})
|
|
858
1132
|
)
|
|
859
1133
|
}),
|
|
860
|
-
|
|
1134
|
+
z4__namespace.transform((data) => data.missions)
|
|
861
1135
|
)
|
|
862
1136
|
);
|
|
863
1137
|
function createMissionsApi(transport) {
|
|
@@ -887,25 +1161,25 @@ function createMissionsApi(transport) {
|
|
|
887
1161
|
}
|
|
888
1162
|
var DEFAULT_PER_PAGE = 20;
|
|
889
1163
|
var HISTORY_PATH = "/referrals/history";
|
|
890
|
-
var count2 = () =>
|
|
891
|
-
var money3 = () =>
|
|
892
|
-
|
|
893
|
-
|
|
1164
|
+
var count2 = () => z4__namespace._default(z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
|
|
1165
|
+
var money3 = () => z4__namespace.pipe(
|
|
1166
|
+
z4__namespace.nullish(extension.wire({ minor_units: minorUnits(), currency: z4__namespace._default(currencyOrEmpty(), "") })),
|
|
1167
|
+
z4__namespace.transform(
|
|
894
1168
|
(value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
|
|
895
1169
|
)
|
|
896
1170
|
);
|
|
897
|
-
var rulesSchema = () =>
|
|
898
|
-
|
|
1171
|
+
var rulesSchema = () => z4__namespace.pipe(
|
|
1172
|
+
z4__namespace.nullish(
|
|
899
1173
|
extension.wire({
|
|
900
1174
|
reward: money3(),
|
|
901
1175
|
minimum_real_net_loss: money3(),
|
|
902
1176
|
referee_window_days: count2(),
|
|
903
1177
|
hold_hours: count2(),
|
|
904
|
-
wagering_multiplier:
|
|
1178
|
+
wagering_multiplier: z4__namespace._default(z4__namespace.string(), ""),
|
|
905
1179
|
maximum_conversion: money3()
|
|
906
1180
|
})
|
|
907
1181
|
),
|
|
908
|
-
|
|
1182
|
+
z4__namespace.transform((rules) => {
|
|
909
1183
|
if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
|
|
910
1184
|
return {
|
|
911
1185
|
reward: rules.reward,
|
|
@@ -918,12 +1192,12 @@ var rulesSchema = () => z2__namespace.pipe(
|
|
|
918
1192
|
})
|
|
919
1193
|
);
|
|
920
1194
|
var infoSchema = /* @__PURE__ */ extension.lazy(
|
|
921
|
-
() =>
|
|
1195
|
+
() => z4__namespace.pipe(
|
|
922
1196
|
extension.wire({
|
|
923
|
-
enabled:
|
|
1197
|
+
enabled: z4__namespace._default(z4__namespace.boolean(), false),
|
|
924
1198
|
referral_code: optionalText(),
|
|
925
1199
|
rules: rulesSchema(),
|
|
926
|
-
totals:
|
|
1200
|
+
totals: z4__namespace._default(
|
|
927
1201
|
extension.wire({
|
|
928
1202
|
registered: count2(),
|
|
929
1203
|
deposited: count2(),
|
|
@@ -936,7 +1210,7 @@ var infoSchema = /* @__PURE__ */ extension.lazy(
|
|
|
936
1210
|
{ registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
|
|
937
1211
|
)
|
|
938
1212
|
}),
|
|
939
|
-
|
|
1213
|
+
z4__namespace.transform(
|
|
940
1214
|
({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
|
|
941
1215
|
)
|
|
942
1216
|
)
|
|
@@ -945,16 +1219,16 @@ function remainingOf(target, loss) {
|
|
|
945
1219
|
const missing = BigInt(target.amount) - BigInt(loss.amount);
|
|
946
1220
|
return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
|
|
947
1221
|
}
|
|
948
|
-
var progressSchema = () =>
|
|
949
|
-
|
|
1222
|
+
var progressSchema = () => z4__namespace.pipe(
|
|
1223
|
+
z4__namespace.nullish(
|
|
950
1224
|
extension.wire({
|
|
951
|
-
deposit_done:
|
|
1225
|
+
deposit_done: z4__namespace._default(z4__namespace.boolean(), false),
|
|
952
1226
|
real_net_loss: money3(),
|
|
953
1227
|
target: money3(),
|
|
954
1228
|
remaining: money3()
|
|
955
1229
|
})
|
|
956
1230
|
),
|
|
957
|
-
|
|
1231
|
+
z4__namespace.transform((progress) => {
|
|
958
1232
|
if (progress == null || progress.target === null) return null;
|
|
959
1233
|
const { target } = progress;
|
|
960
1234
|
const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
|
|
@@ -971,9 +1245,9 @@ function statusOf(playerStatus, legacy) {
|
|
|
971
1245
|
if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
|
|
972
1246
|
return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
|
|
973
1247
|
}
|
|
974
|
-
var referralSchema = () =>
|
|
1248
|
+
var referralSchema = () => z4__namespace.pipe(
|
|
975
1249
|
extension.wire({
|
|
976
|
-
id:
|
|
1250
|
+
id: z4__namespace.string(),
|
|
977
1251
|
referee_name: optionalText(),
|
|
978
1252
|
status: optionalText(),
|
|
979
1253
|
player_status: optionalText(),
|
|
@@ -981,7 +1255,7 @@ var referralSchema = () => z2__namespace.pipe(
|
|
|
981
1255
|
deadline_at: optionalTimestamp(),
|
|
982
1256
|
progress: progressSchema()
|
|
983
1257
|
}),
|
|
984
|
-
|
|
1258
|
+
z4__namespace.transform(
|
|
985
1259
|
(r) => ({
|
|
986
1260
|
id: r.id,
|
|
987
1261
|
refereeName: r.refereeName,
|
|
@@ -996,7 +1270,7 @@ var historySchema = /* @__PURE__ */ extension.lazy(
|
|
|
996
1270
|
() => extension.wire({
|
|
997
1271
|
referral_code: optionalText(),
|
|
998
1272
|
referrals: nullableList(referralSchema()),
|
|
999
|
-
pagination:
|
|
1273
|
+
pagination: z4__namespace.optional(extension.wire({ page: count2(), limit: count2(), total_items: count2() }))
|
|
1000
1274
|
})
|
|
1001
1275
|
);
|
|
1002
1276
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1036,12 +1310,12 @@ function createReferralsApi(transport) {
|
|
|
1036
1310
|
}
|
|
1037
1311
|
var HTTP_URL = "Expected an absolute http(s) URL";
|
|
1038
1312
|
var sessionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1039
|
-
() =>
|
|
1313
|
+
() => z4__namespace.pipe(
|
|
1040
1314
|
extension.wire({
|
|
1041
1315
|
// The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
|
|
1042
|
-
operator_token:
|
|
1043
|
-
launch_url:
|
|
1044
|
-
|
|
1316
|
+
operator_token: z4__namespace.string(),
|
|
1317
|
+
launch_url: z4__namespace.string().check(
|
|
1318
|
+
z4__namespace.refine(
|
|
1045
1319
|
(value) => {
|
|
1046
1320
|
try {
|
|
1047
1321
|
const { protocol } = new URL(value);
|
|
@@ -1053,10 +1327,10 @@ var sessionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
|
1053
1327
|
{ message: HTTP_URL }
|
|
1054
1328
|
)
|
|
1055
1329
|
),
|
|
1056
|
-
expires_in_seconds:
|
|
1330
|
+
expires_in_seconds: z4__namespace.number().check(z4__namespace.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
|
|
1057
1331
|
}),
|
|
1058
1332
|
// The clock is read when the response is interpreted (= moment of the response).
|
|
1059
|
-
|
|
1333
|
+
z4__namespace.transform(({ launchUrl, expiresInSeconds }) => ({
|
|
1060
1334
|
launchUrl,
|
|
1061
1335
|
expiresInSeconds,
|
|
1062
1336
|
expiresAt: Date.now() + expiresInSeconds * 1e3
|
|
@@ -1087,7 +1361,8 @@ function createIgaming(client) {
|
|
|
1087
1361
|
missions: createMissionsApi(transport),
|
|
1088
1362
|
loyalty: createLoyaltyApi(transport),
|
|
1089
1363
|
referrals: createReferralsApi(transport),
|
|
1090
|
-
sportsbook: createSportsbookApi(transport)
|
|
1364
|
+
sportsbook: createSportsbookApi(transport),
|
|
1365
|
+
bets: createBetsApi(transport)
|
|
1091
1366
|
};
|
|
1092
1367
|
if (typeof extension__namespace.registerProductClient !== "function") {
|
|
1093
1368
|
throw new sdk.EnginexError({
|