@getenginex/sdk-igaming 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +260 -259
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +259 -259
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EnginexError } from '@getenginex/sdk';
|
|
2
2
|
import * as extension from '@getenginex/sdk/extension';
|
|
3
3
|
import { lazy, wire, decimalPlaces, currencyCode, money as money$1, moneyText } from '@getenginex/sdk/extension';
|
|
4
|
-
import
|
|
4
|
+
import * as z2 from 'zod/mini';
|
|
5
5
|
|
|
6
6
|
// src/client.ts
|
|
7
7
|
function protoEnum(prefix) {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return z2.pipe(
|
|
9
|
+
z2.optional(z2.union([z2.string(), z2.number()])),
|
|
10
|
+
z2.transform((value) => {
|
|
11
11
|
if (value === void 0 || value === 0) return "unspecified";
|
|
12
12
|
if (typeof value === "number") return String(value);
|
|
13
13
|
return (value.startsWith(prefix) ? value.slice(prefix.length) : value).toLowerCase();
|
|
@@ -22,174 +22,174 @@ function currencyOrEmpty() {
|
|
|
22
22
|
}
|
|
23
23
|
var INTEGER_TEXT = "Expected an integer within the safe range of number";
|
|
24
24
|
function integerText() {
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return z2.pipe(
|
|
26
|
+
z2.union([
|
|
27
|
+
z2.string().check(
|
|
28
|
+
z2.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
|
|
29
29
|
),
|
|
30
|
-
|
|
30
|
+
z2.number().check(z2.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
|
|
31
31
|
]),
|
|
32
|
-
|
|
32
|
+
z2.transform(Number)
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
function text() {
|
|
36
|
-
return
|
|
36
|
+
return z2._default(z2.string(), "");
|
|
37
37
|
}
|
|
38
38
|
function count() {
|
|
39
|
-
return
|
|
39
|
+
return z2._default(z2.number(), 0);
|
|
40
40
|
}
|
|
41
41
|
function list(item) {
|
|
42
|
-
return
|
|
42
|
+
return z2._default(z2.array(item), []);
|
|
43
43
|
}
|
|
44
44
|
function durationSeconds() {
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
return z2.pipe(
|
|
46
|
+
z2.string().check(z2.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
|
|
47
|
+
z2.transform((value) => Number(value.slice(0, -1)))
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// src/modules/bonus.ts
|
|
52
|
-
var campaignCurrency = () =>
|
|
53
|
-
var money = () => wire({ amount:
|
|
54
|
-
var timeWindow = () => wire({ starts_at:
|
|
55
|
-
var ratio = () => wire({ decimal:
|
|
52
|
+
var campaignCurrency = () => z2._default(currencyOrEmpty(), "");
|
|
53
|
+
var money = () => wire({ amount: z2._default(minorUnits(), 0), currency: campaignCurrency() });
|
|
54
|
+
var timeWindow = () => wire({ starts_at: z2.optional(z2.string()), ends_at: z2.optional(z2.string()) });
|
|
55
|
+
var ratio = () => wire({ decimal: z2.optional(z2.string()), basis_points: z2.optional(z2.number()), maximum_scale: count() });
|
|
56
56
|
var empty = () => wire({});
|
|
57
57
|
var policy = (prefix) => wire({ code: protoEnum(prefix), version: count() });
|
|
58
58
|
var casinoSelector = () => wire({
|
|
59
59
|
provider_instance_id: text(),
|
|
60
|
-
software_ids: list(
|
|
61
|
-
game_ids: list(
|
|
62
|
-
category_codes: list(
|
|
60
|
+
software_ids: list(z2.string()),
|
|
61
|
+
game_ids: list(z2.string()),
|
|
62
|
+
category_codes: list(z2.string())
|
|
63
63
|
});
|
|
64
64
|
var sportsSelector = () => wire({
|
|
65
|
-
sport_codes: list(
|
|
66
|
-
competition_ids: list(
|
|
67
|
-
event_ids: list(
|
|
68
|
-
market_codes: list(
|
|
69
|
-
live:
|
|
65
|
+
sport_codes: list(z2.string()),
|
|
66
|
+
competition_ids: list(z2.string()),
|
|
67
|
+
event_ids: list(z2.string()),
|
|
68
|
+
market_codes: list(z2.string()),
|
|
69
|
+
live: z2.optional(z2.boolean()),
|
|
70
70
|
bet_types: list(protoEnum("SPORTS_BET_TYPE_"))
|
|
71
71
|
});
|
|
72
72
|
var qualification = () => wire({
|
|
73
73
|
version: count(),
|
|
74
|
-
immediate:
|
|
75
|
-
user_event:
|
|
74
|
+
immediate: z2.optional(empty()),
|
|
75
|
+
user_event: z2.optional(
|
|
76
76
|
wire({
|
|
77
77
|
event_code: text(),
|
|
78
78
|
event_version: count(),
|
|
79
79
|
source_authority: text(),
|
|
80
|
-
identity_fields: list(
|
|
80
|
+
identity_fields: list(z2.string())
|
|
81
81
|
})
|
|
82
82
|
),
|
|
83
|
-
deposit_settled:
|
|
83
|
+
deposit_settled: z2.optional(
|
|
84
84
|
wire({
|
|
85
85
|
currency: campaignCurrency(),
|
|
86
|
-
eligible_method_codes: list(
|
|
86
|
+
eligible_method_codes: list(z2.string()),
|
|
87
87
|
first_deposit_policy: protoEnum("FIRST_DEPOSIT_POLICY_"),
|
|
88
|
-
minimum_settled_net_amount:
|
|
89
|
-
maximum_settled_net_amount:
|
|
88
|
+
minimum_settled_net_amount: z2.optional(money()),
|
|
89
|
+
maximum_settled_net_amount: z2.optional(money()),
|
|
90
90
|
amount_basis: protoEnum("DEPOSIT_AMOUNT_BASIS_")
|
|
91
91
|
})
|
|
92
92
|
),
|
|
93
|
-
activity_aggregate:
|
|
93
|
+
activity_aggregate: z2.optional(
|
|
94
94
|
wire({
|
|
95
95
|
basis: protoEnum("BASIS_"),
|
|
96
96
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
97
97
|
currency: campaignCurrency(),
|
|
98
|
-
window:
|
|
98
|
+
window: z2.optional(durationSeconds()),
|
|
99
99
|
timezone: text(),
|
|
100
|
-
late_event_grace:
|
|
101
|
-
casino:
|
|
102
|
-
sportsbook:
|
|
100
|
+
late_event_grace: z2.optional(durationSeconds()),
|
|
101
|
+
casino: z2.optional(casinoSelector()),
|
|
102
|
+
sportsbook: z2.optional(sportsSelector())
|
|
103
103
|
})
|
|
104
104
|
)
|
|
105
105
|
});
|
|
106
106
|
var validity = () => wire({
|
|
107
|
-
no_expiry:
|
|
108
|
-
absolute_expiry:
|
|
109
|
-
duration_from_grant:
|
|
107
|
+
no_expiry: z2.optional(empty()),
|
|
108
|
+
absolute_expiry: z2.optional(wire({ expires_at: z2.optional(z2.string()) })),
|
|
109
|
+
duration_from_grant: z2.optional(wire({ duration: z2.optional(durationSeconds()) }))
|
|
110
110
|
});
|
|
111
111
|
var rounding = () => protoEnum("ROUNDING_MODE_");
|
|
112
112
|
var proceedsClass = () => protoEnum("PROCEEDS_CLASS_");
|
|
113
113
|
var percent = () => wire({
|
|
114
|
-
percentage:
|
|
114
|
+
percentage: z2.optional(ratio()),
|
|
115
115
|
rounding: rounding(),
|
|
116
|
-
minimum_reward:
|
|
117
|
-
maximum_reward:
|
|
116
|
+
minimum_reward: z2.optional(money()),
|
|
117
|
+
maximum_reward: z2.optional(money())
|
|
118
118
|
});
|
|
119
119
|
var balanceCredit = () => wire({
|
|
120
|
-
fixed_amount:
|
|
121
|
-
percent_of_source_amount:
|
|
122
|
-
aggregate_rebate:
|
|
120
|
+
fixed_amount: z2.optional(wire({ amount: z2.optional(money()) })),
|
|
121
|
+
percent_of_source_amount: z2.optional(percent()),
|
|
122
|
+
aggregate_rebate: z2.optional(
|
|
123
123
|
wire({
|
|
124
|
-
percentage:
|
|
124
|
+
percentage: z2.optional(ratio()),
|
|
125
125
|
rounding: rounding(),
|
|
126
|
-
minimum_basis:
|
|
127
|
-
maximum_reward:
|
|
126
|
+
minimum_basis: z2.optional(money()),
|
|
127
|
+
maximum_reward: z2.optional(money())
|
|
128
128
|
})
|
|
129
129
|
),
|
|
130
130
|
balance_class: protoEnum("BALANCE_CLASS_"),
|
|
131
131
|
proceeds_class: proceedsClass(),
|
|
132
|
-
validity:
|
|
132
|
+
validity: z2.optional(validity())
|
|
133
133
|
});
|
|
134
|
-
var maximumBet = () => wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum:
|
|
134
|
+
var maximumBet = () => wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z2.optional(money()) });
|
|
135
135
|
var oddsPolicy = () => wire({
|
|
136
136
|
mode: protoEnum("MODE_"),
|
|
137
|
-
minimum_total_odds_decimal:
|
|
138
|
-
minimum_odds_per_leg_decimal:
|
|
139
|
-
minimum_legs:
|
|
140
|
-
maximum_legs:
|
|
137
|
+
minimum_total_odds_decimal: z2.optional(z2.string()),
|
|
138
|
+
minimum_odds_per_leg_decimal: z2.optional(z2.string()),
|
|
139
|
+
minimum_legs: z2.optional(z2.number()),
|
|
140
|
+
maximum_legs: z2.optional(z2.number())
|
|
141
141
|
});
|
|
142
142
|
var cashoutMode = () => protoEnum("RESTRICTED_CASHOUT_MODE_");
|
|
143
143
|
var usePolicy = () => wire({
|
|
144
144
|
version: count(),
|
|
145
|
-
funds_consumption:
|
|
146
|
-
casino:
|
|
147
|
-
sportsbook:
|
|
145
|
+
funds_consumption: z2.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
|
|
146
|
+
casino: z2.optional(wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z2.optional(maximumBet()) })),
|
|
147
|
+
sportsbook: z2.optional(
|
|
148
148
|
wire({
|
|
149
149
|
allowed_scopes: list(sportsSelector()),
|
|
150
150
|
excluded_scopes: list(sportsSelector()),
|
|
151
|
-
maximum_bet:
|
|
152
|
-
funding_odds:
|
|
151
|
+
maximum_bet: z2.optional(maximumBet()),
|
|
152
|
+
funding_odds: z2.optional(oddsPolicy()),
|
|
153
153
|
cashout_mode: cashoutMode()
|
|
154
154
|
})
|
|
155
155
|
),
|
|
156
|
-
casino_and_sportsbook:
|
|
156
|
+
casino_and_sportsbook: z2.optional(
|
|
157
157
|
wire({
|
|
158
158
|
allowed_casino_scopes: list(casinoSelector()),
|
|
159
159
|
allowed_sportsbook_scopes: list(sportsSelector()),
|
|
160
160
|
excluded_sportsbook_scopes: list(sportsSelector()),
|
|
161
|
-
maximum_casino_bet:
|
|
162
|
-
maximum_sportsbook_bet:
|
|
163
|
-
sportsbook_funding_odds:
|
|
161
|
+
maximum_casino_bet: z2.optional(maximumBet()),
|
|
162
|
+
maximum_sportsbook_bet: z2.optional(maximumBet()),
|
|
163
|
+
sportsbook_funding_odds: z2.optional(oddsPolicy()),
|
|
164
164
|
sportsbook_cashout_mode: cashoutMode()
|
|
165
165
|
})
|
|
166
166
|
),
|
|
167
|
-
payout_allocation:
|
|
167
|
+
payout_allocation: z2.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
|
|
168
168
|
});
|
|
169
169
|
var wageringPolicy = () => wire({
|
|
170
170
|
version: count(),
|
|
171
|
-
none:
|
|
172
|
-
multiplier:
|
|
171
|
+
none: z2.optional(empty()),
|
|
172
|
+
multiplier: z2.optional(
|
|
173
173
|
wire({
|
|
174
174
|
requirement_basis: protoEnum("REQUIREMENT_BASIS_"),
|
|
175
|
-
multiplier:
|
|
175
|
+
multiplier: z2.optional(ratio()),
|
|
176
176
|
contribution_rates: list(
|
|
177
177
|
wire({
|
|
178
|
-
casino:
|
|
179
|
-
sportsbook:
|
|
180
|
-
rate:
|
|
178
|
+
casino: z2.optional(casinoSelector()),
|
|
179
|
+
sportsbook: z2.optional(sportsSelector()),
|
|
180
|
+
rate: z2.optional(ratio())
|
|
181
181
|
})
|
|
182
182
|
),
|
|
183
|
-
deadline:
|
|
183
|
+
deadline: z2.optional(validity()),
|
|
184
184
|
rounding: rounding(),
|
|
185
|
-
sportsbook_contribution_odds:
|
|
185
|
+
sportsbook_contribution_odds: z2.optional(oddsPolicy())
|
|
186
186
|
})
|
|
187
187
|
)
|
|
188
188
|
});
|
|
189
189
|
var stackingPolicy = () => wire({
|
|
190
190
|
version: count(),
|
|
191
|
-
exclusive_in_group:
|
|
192
|
-
multiple_in_group:
|
|
191
|
+
exclusive_in_group: z2.optional(wire({ stacking_group_key: text() })),
|
|
192
|
+
multiple_in_group: z2.optional(wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
|
|
193
193
|
});
|
|
194
194
|
var reward = () => wire({
|
|
195
195
|
reward_key: text(),
|
|
@@ -197,49 +197,49 @@ var reward = () => wire({
|
|
|
197
197
|
reward_kind_version: count(),
|
|
198
198
|
execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
|
|
199
199
|
execution_profile_version: count(),
|
|
200
|
-
balance_credit:
|
|
201
|
-
provider_managed_balance:
|
|
202
|
-
casino_free_spins:
|
|
200
|
+
balance_credit: z2.optional(balanceCredit()),
|
|
201
|
+
provider_managed_balance: z2.optional(wire({ provider_code: text() })),
|
|
202
|
+
casino_free_spins: z2.optional(
|
|
203
203
|
wire({
|
|
204
204
|
provider_code: text(),
|
|
205
|
-
casino_scope:
|
|
205
|
+
casino_scope: z2.optional(casinoSelector()),
|
|
206
206
|
quantity: count(),
|
|
207
|
-
denomination:
|
|
207
|
+
denomination: z2.optional(money()),
|
|
208
208
|
currency: campaignCurrency(),
|
|
209
|
-
grant_window:
|
|
209
|
+
grant_window: z2.optional(timeWindow()),
|
|
210
210
|
proceeds_class: proceedsClass(),
|
|
211
|
-
maximum_winnings:
|
|
211
|
+
maximum_winnings: z2.optional(money())
|
|
212
212
|
})
|
|
213
213
|
),
|
|
214
|
-
sports_bonus_bet:
|
|
214
|
+
sports_bonus_bet: z2.optional(
|
|
215
215
|
wire({
|
|
216
216
|
provider_code: text(),
|
|
217
|
-
sportsbook_scope:
|
|
218
|
-
amount:
|
|
217
|
+
sportsbook_scope: z2.optional(sportsSelector()),
|
|
218
|
+
amount: z2.optional(money()),
|
|
219
219
|
quantity: count(),
|
|
220
|
-
validity:
|
|
220
|
+
validity: z2.optional(validity())
|
|
221
221
|
})
|
|
222
222
|
),
|
|
223
|
-
sports_bet_coverage:
|
|
223
|
+
sports_bet_coverage: z2.optional(
|
|
224
224
|
wire({
|
|
225
225
|
provider_code: text(),
|
|
226
|
-
qualifying_bet_scope:
|
|
227
|
-
coverage_cap:
|
|
228
|
-
validity:
|
|
226
|
+
qualifying_bet_scope: z2.optional(sportsSelector()),
|
|
227
|
+
coverage_cap: z2.optional(money()),
|
|
228
|
+
validity: z2.optional(validity())
|
|
229
229
|
})
|
|
230
230
|
),
|
|
231
|
-
use_policy:
|
|
232
|
-
wagering_policy:
|
|
233
|
-
stacking_policy:
|
|
234
|
-
restricted_position_selection_policy:
|
|
231
|
+
use_policy: z2.optional(usePolicy()),
|
|
232
|
+
wagering_policy: z2.optional(wageringPolicy()),
|
|
233
|
+
stacking_policy: z2.optional(stackingPolicy()),
|
|
234
|
+
restricted_position_selection_policy: z2.optional(
|
|
235
235
|
wire({
|
|
236
236
|
version: count(),
|
|
237
|
-
priority_then_earliest_expiry:
|
|
237
|
+
priority_then_earliest_expiry: z2.optional(wire({ selection_priority: z2.optional(z2.number()) }))
|
|
238
238
|
})
|
|
239
239
|
)
|
|
240
240
|
});
|
|
241
241
|
var localizedContent = () => wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
|
|
242
|
-
var content = () => wire({ default_locale: text(), supported_locales: list(
|
|
242
|
+
var content = () => wire({ default_locale: text(), supported_locales: list(z2.string()), localized_content: list(localizedContent()) });
|
|
243
243
|
var offerSchema = /* @__PURE__ */ lazy(
|
|
244
244
|
() => wire({
|
|
245
245
|
campaign_id: text(),
|
|
@@ -247,33 +247,33 @@ var offerSchema = /* @__PURE__ */ lazy(
|
|
|
247
247
|
publication_id: text(),
|
|
248
248
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
249
249
|
timezone: text(),
|
|
250
|
-
enrollment_window:
|
|
251
|
-
qualification_window:
|
|
252
|
-
claim_window:
|
|
253
|
-
entry_policy:
|
|
254
|
-
reward_claim_policy:
|
|
255
|
-
qualification:
|
|
256
|
-
reward:
|
|
257
|
-
publication_starts_at:
|
|
258
|
-
publication_ends_at:
|
|
259
|
-
content:
|
|
250
|
+
enrollment_window: z2.optional(timeWindow()),
|
|
251
|
+
qualification_window: z2.optional(timeWindow()),
|
|
252
|
+
claim_window: z2.optional(timeWindow()),
|
|
253
|
+
entry_policy: z2.optional(policy("ENTRY_POLICY_CODE_")),
|
|
254
|
+
reward_claim_policy: z2.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
|
|
255
|
+
qualification: z2.optional(qualification()),
|
|
256
|
+
reward: z2.optional(reward()),
|
|
257
|
+
publication_starts_at: z2.optional(z2.string()),
|
|
258
|
+
publication_ends_at: z2.optional(z2.string()),
|
|
259
|
+
content: z2.optional(content())
|
|
260
260
|
})
|
|
261
261
|
);
|
|
262
262
|
function grantMoney(value, currency) {
|
|
263
263
|
return { amount: value?.amount ?? 0, currency: value?.currency || currency };
|
|
264
264
|
}
|
|
265
|
-
var rewardGrant = () =>
|
|
265
|
+
var rewardGrant = () => z2.pipe(
|
|
266
266
|
wire({
|
|
267
267
|
state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
|
|
268
|
-
granted:
|
|
269
|
-
balance:
|
|
270
|
-
converted:
|
|
271
|
-
expires_at:
|
|
272
|
-
wagering:
|
|
273
|
-
wire({ required:
|
|
268
|
+
granted: z2.optional(money()),
|
|
269
|
+
balance: z2.optional(money()),
|
|
270
|
+
converted: z2.optional(money()),
|
|
271
|
+
expires_at: z2.optional(z2.string()),
|
|
272
|
+
wagering: z2.optional(
|
|
273
|
+
wire({ required: z2.optional(money()), accumulated: z2.optional(money()), completed_at: z2.optional(z2.string()) })
|
|
274
274
|
)
|
|
275
275
|
}),
|
|
276
|
-
|
|
276
|
+
z2.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
|
|
277
277
|
const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
|
|
278
278
|
const out = {
|
|
279
279
|
state,
|
|
@@ -293,40 +293,40 @@ var rewardGrant = () => z.pipe(
|
|
|
293
293
|
})
|
|
294
294
|
);
|
|
295
295
|
var participationSchema = /* @__PURE__ */ lazy(
|
|
296
|
-
() =>
|
|
296
|
+
() => z2.pipe(
|
|
297
297
|
wire({
|
|
298
298
|
id: text(),
|
|
299
299
|
campaign_id: text(),
|
|
300
300
|
campaign_version_id: text(),
|
|
301
301
|
reward_key: text(),
|
|
302
|
-
qualification_snapshot:
|
|
302
|
+
qualification_snapshot: z2.optional(qualification()),
|
|
303
303
|
// oneof `state`: only one of the cases is filled in.
|
|
304
|
-
enrolled:
|
|
305
|
-
qualifying:
|
|
306
|
-
qualified:
|
|
307
|
-
reward_pending:
|
|
308
|
-
completed:
|
|
309
|
-
reward_failed:
|
|
310
|
-
expired:
|
|
311
|
-
cancelled:
|
|
312
|
-
reward_grant:
|
|
313
|
-
snapshot:
|
|
304
|
+
enrolled: z2.optional(empty()),
|
|
305
|
+
qualifying: z2.optional(empty()),
|
|
306
|
+
qualified: z2.optional(wire({ qualified_at: z2.optional(z2.string()) })),
|
|
307
|
+
reward_pending: z2.optional(empty()),
|
|
308
|
+
completed: z2.optional(wire({ completed_at: z2.optional(z2.string()) })),
|
|
309
|
+
reward_failed: z2.optional(empty()),
|
|
310
|
+
expired: z2.optional(wire({ expired_at: z2.optional(z2.string()) })),
|
|
311
|
+
cancelled: z2.optional(empty()),
|
|
312
|
+
reward_grant: z2.optional(rewardGrant()),
|
|
313
|
+
snapshot: z2.optional(
|
|
314
314
|
wire({
|
|
315
|
-
reward:
|
|
316
|
-
content:
|
|
317
|
-
terms_acceptance:
|
|
315
|
+
reward: z2.optional(reward()),
|
|
316
|
+
content: z2.optional(content()),
|
|
317
|
+
terms_acceptance: z2.optional(
|
|
318
318
|
wire({
|
|
319
319
|
locale: text(),
|
|
320
320
|
terms_revision: text(),
|
|
321
321
|
terms_digest_sha256_hex: text(),
|
|
322
|
-
accepted_at:
|
|
322
|
+
accepted_at: z2.optional(z2.string())
|
|
323
323
|
})
|
|
324
324
|
)
|
|
325
325
|
})
|
|
326
326
|
)
|
|
327
327
|
}),
|
|
328
328
|
// The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
|
|
329
|
-
|
|
329
|
+
z2.transform(
|
|
330
330
|
({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
|
|
331
331
|
const out = { ...rest, status: "unspecified" };
|
|
332
332
|
if (enrolled) out.status = "enrolled";
|
|
@@ -348,7 +348,7 @@ var participationSchema = /* @__PURE__ */ lazy(
|
|
|
348
348
|
)
|
|
349
349
|
)
|
|
350
350
|
);
|
|
351
|
-
var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor:
|
|
351
|
+
var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor: z2.optional(z2.string()) });
|
|
352
352
|
var offersPage = /* @__PURE__ */ lazy(() => cursorPageSchema("offers", offerSchema()));
|
|
353
353
|
var participationsPage = /* @__PURE__ */ lazy(() => cursorPageSchema("participations", participationSchema()));
|
|
354
354
|
var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema() }));
|
|
@@ -361,64 +361,64 @@ function toCursorPage(key, data) {
|
|
|
361
361
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
362
362
|
return page;
|
|
363
363
|
}
|
|
364
|
-
var nullableDate = () =>
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
var nullableDate = () => z2.pipe(
|
|
365
|
+
z2.nullish(z2.string()),
|
|
366
|
+
z2.transform((value) => value ?? void 0)
|
|
367
367
|
);
|
|
368
368
|
function compact(value) {
|
|
369
369
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
370
370
|
}
|
|
371
371
|
var overviewSchema = /* @__PURE__ */ lazy(
|
|
372
|
-
() =>
|
|
372
|
+
() => z2.pipe(
|
|
373
373
|
wire({
|
|
374
374
|
currencies: list(
|
|
375
|
-
|
|
375
|
+
z2.pipe(
|
|
376
376
|
wire({
|
|
377
377
|
currency: currencyOrEmpty(),
|
|
378
|
-
decimal_places:
|
|
378
|
+
decimal_places: z2.number(),
|
|
379
379
|
restricted_total: minorUnits(),
|
|
380
380
|
expiring_7d: minorUnits(),
|
|
381
|
-
open_positions:
|
|
381
|
+
open_positions: z2.number(),
|
|
382
382
|
next_expires_at: nullableDate(),
|
|
383
383
|
converted: minorUnits(),
|
|
384
|
-
converted_campaigns:
|
|
384
|
+
converted_campaigns: z2.number()
|
|
385
385
|
}),
|
|
386
|
-
|
|
386
|
+
z2.transform(compact)
|
|
387
387
|
)
|
|
388
388
|
),
|
|
389
389
|
as_of: nullableDate()
|
|
390
390
|
}),
|
|
391
|
-
|
|
391
|
+
z2.transform(compact)
|
|
392
392
|
)
|
|
393
393
|
);
|
|
394
394
|
var positionsPage = /* @__PURE__ */ lazy(
|
|
395
395
|
() => wire({
|
|
396
396
|
rows: list(
|
|
397
|
-
|
|
397
|
+
z2.pipe(
|
|
398
398
|
wire({
|
|
399
|
-
position_id:
|
|
400
|
-
campaign_id:
|
|
399
|
+
position_id: z2.string(),
|
|
400
|
+
campaign_id: z2.string(),
|
|
401
401
|
currency: currencyOrEmpty(),
|
|
402
|
-
decimal_places:
|
|
402
|
+
decimal_places: z2.number(),
|
|
403
403
|
granted: minorUnits(),
|
|
404
404
|
restricted: minorUnits(),
|
|
405
405
|
converted: minorUnits(),
|
|
406
406
|
required: minorUnits(),
|
|
407
407
|
wagered: minorUnits(),
|
|
408
408
|
remaining: minorUnits(),
|
|
409
|
-
state:
|
|
409
|
+
state: z2.string(),
|
|
410
410
|
// The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
|
|
411
|
-
terminal_action:
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
terminal_action: z2.pipe(
|
|
412
|
+
z2.nullish(z2.string()),
|
|
413
|
+
z2.transform((value) => value ? value.toLowerCase() : void 0)
|
|
414
414
|
),
|
|
415
415
|
expires_at: nullableDate(),
|
|
416
416
|
created_at: nullableDate()
|
|
417
417
|
}),
|
|
418
|
-
|
|
418
|
+
z2.transform((row) => compact(row))
|
|
419
419
|
)
|
|
420
420
|
),
|
|
421
|
-
next_cursor:
|
|
421
|
+
next_cursor: z2.optional(z2.string())
|
|
422
422
|
})
|
|
423
423
|
);
|
|
424
424
|
var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
|
|
@@ -512,51 +512,51 @@ function createBonusApi(transport) {
|
|
|
512
512
|
}
|
|
513
513
|
var gameSchema = /* @__PURE__ */ lazy(
|
|
514
514
|
() => wire({
|
|
515
|
-
id:
|
|
516
|
-
name:
|
|
517
|
-
provider:
|
|
518
|
-
category:
|
|
519
|
-
type:
|
|
520
|
-
thumbnail:
|
|
521
|
-
is_new:
|
|
522
|
-
is_popular:
|
|
523
|
-
is_live:
|
|
524
|
-
demo_available:
|
|
525
|
-
rtp:
|
|
526
|
-
volatility:
|
|
527
|
-
priority:
|
|
515
|
+
id: z2.string(),
|
|
516
|
+
name: z2.string(),
|
|
517
|
+
provider: z2.string(),
|
|
518
|
+
category: z2.string(),
|
|
519
|
+
type: z2.string(),
|
|
520
|
+
thumbnail: z2.string(),
|
|
521
|
+
is_new: z2.boolean(),
|
|
522
|
+
is_popular: z2.boolean(),
|
|
523
|
+
is_live: z2.boolean(),
|
|
524
|
+
demo_available: z2.boolean(),
|
|
525
|
+
rtp: z2.number(),
|
|
526
|
+
volatility: z2.string(),
|
|
527
|
+
priority: z2.number()
|
|
528
528
|
})
|
|
529
529
|
);
|
|
530
530
|
var categoriesSchema = /* @__PURE__ */ lazy(
|
|
531
|
-
() =>
|
|
532
|
-
wire({ slug:
|
|
531
|
+
() => z2.array(
|
|
532
|
+
wire({ slug: z2.string(), name: z2.string(), icon: z2.string(), game_count: z2.number(), priority: z2.number() })
|
|
533
533
|
)
|
|
534
534
|
);
|
|
535
535
|
var providersSchema = /* @__PURE__ */ lazy(
|
|
536
|
-
() =>
|
|
536
|
+
() => z2.array(wire({ id: z2.string(), name: z2.string(), game_count: z2.number() }))
|
|
537
537
|
);
|
|
538
538
|
var launchSchema = /* @__PURE__ */ lazy(
|
|
539
|
-
() =>
|
|
539
|
+
() => z2.pipe(
|
|
540
540
|
wire({
|
|
541
|
-
session_id:
|
|
542
|
-
game_url:
|
|
541
|
+
session_id: z2.string().check(z2.minLength(1)),
|
|
542
|
+
game_url: z2.string().check(z2.minLength(1)),
|
|
543
543
|
// Any text: a target the SDK does not know yet must not fail the (strict) launch.
|
|
544
|
-
launch_target:
|
|
545
|
-
provider_code:
|
|
546
|
-
expires_at:
|
|
544
|
+
launch_target: z2.optional(z2.string()),
|
|
545
|
+
provider_code: z2.optional(z2.string()),
|
|
546
|
+
expires_at: z2.optional(z2.string())
|
|
547
547
|
}),
|
|
548
548
|
// Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
|
|
549
549
|
// before the field existed: an iframe.
|
|
550
|
-
|
|
550
|
+
z2.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
|
|
551
551
|
)
|
|
552
552
|
);
|
|
553
553
|
var sessionSchema = /* @__PURE__ */ lazy(
|
|
554
554
|
() => wire({
|
|
555
|
-
id:
|
|
556
|
-
game_id:
|
|
557
|
-
game_name:
|
|
558
|
-
provider:
|
|
559
|
-
start_time:
|
|
555
|
+
id: z2.string(),
|
|
556
|
+
game_id: z2.string(),
|
|
557
|
+
game_name: z2.string(),
|
|
558
|
+
provider: z2.string(),
|
|
559
|
+
start_time: z2.string(),
|
|
560
560
|
total_bet: money$1(),
|
|
561
561
|
total_win: money$1(),
|
|
562
562
|
status: protoEnum("SESSION_STATUS_")
|
|
@@ -564,27 +564,27 @@ var sessionSchema = /* @__PURE__ */ lazy(
|
|
|
564
564
|
);
|
|
565
565
|
var transactionSchema = /* @__PURE__ */ lazy(
|
|
566
566
|
() => wire({
|
|
567
|
-
id:
|
|
568
|
-
game_id:
|
|
569
|
-
game_name:
|
|
570
|
-
round_id:
|
|
567
|
+
id: z2.string(),
|
|
568
|
+
game_id: z2.string(),
|
|
569
|
+
game_name: z2.string(),
|
|
570
|
+
round_id: z2.string(),
|
|
571
571
|
type: protoEnum("CASINO_TRANSACTION_TYPE_"),
|
|
572
572
|
amount: minorUnits(),
|
|
573
573
|
currency: currencyCode(),
|
|
574
574
|
currency_decimal_places: decimalPlaces(),
|
|
575
|
-
created_at:
|
|
575
|
+
created_at: z2.string()
|
|
576
576
|
})
|
|
577
577
|
);
|
|
578
578
|
var winnersSchema = /* @__PURE__ */ lazy(
|
|
579
|
-
() =>
|
|
579
|
+
() => z2.array(
|
|
580
580
|
wire({
|
|
581
|
-
player:
|
|
581
|
+
player: z2.string(),
|
|
582
582
|
amount: minorUnits(),
|
|
583
583
|
currency: currencyCode(),
|
|
584
584
|
currency_decimal_places: decimalPlaces(),
|
|
585
|
-
game_id:
|
|
586
|
-
game_name:
|
|
587
|
-
won_at:
|
|
585
|
+
game_id: z2.string(),
|
|
586
|
+
game_name: z2.string(),
|
|
587
|
+
won_at: z2.string()
|
|
588
588
|
})
|
|
589
589
|
)
|
|
590
590
|
);
|
|
@@ -674,28 +674,28 @@ function pageInputProblem(name, input) {
|
|
|
674
674
|
return void 0;
|
|
675
675
|
}
|
|
676
676
|
function optionalTimestamp() {
|
|
677
|
-
return
|
|
678
|
-
|
|
679
|
-
|
|
677
|
+
return z2.pipe(
|
|
678
|
+
z2.nullish(z2.string().check(z2.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
679
|
+
z2.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
|
|
680
680
|
);
|
|
681
681
|
}
|
|
682
682
|
function optionalText() {
|
|
683
|
-
return
|
|
684
|
-
|
|
685
|
-
|
|
683
|
+
return z2.pipe(
|
|
684
|
+
z2.nullish(z2.string()),
|
|
685
|
+
z2.transform((value) => value == null || value === "" ? null : value)
|
|
686
686
|
);
|
|
687
687
|
}
|
|
688
688
|
function nullableList(item) {
|
|
689
|
-
return
|
|
690
|
-
|
|
691
|
-
|
|
689
|
+
return z2.pipe(
|
|
690
|
+
z2.nullish(z2.array(item)),
|
|
691
|
+
z2.transform((value) => value ?? [])
|
|
692
692
|
);
|
|
693
693
|
}
|
|
694
694
|
|
|
695
695
|
// src/modules/loyalty.ts
|
|
696
|
-
var tierBenefits = () =>
|
|
697
|
-
|
|
698
|
-
|
|
696
|
+
var tierBenefits = () => z2.pipe(
|
|
697
|
+
z2.nullish(z2.string()),
|
|
698
|
+
z2.transform((text2, ctx) => {
|
|
699
699
|
if (text2 == null || text2.trim() === "") return null;
|
|
700
700
|
let parsed;
|
|
701
701
|
try {
|
|
@@ -706,43 +706,43 @@ var tierBenefits = () => z.pipe(
|
|
|
706
706
|
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed))
|
|
707
707
|
return parsed;
|
|
708
708
|
ctx.issues.push({ code: "custom", message: "tier_benefits_json is not a JSON object", input: void 0 });
|
|
709
|
-
return
|
|
709
|
+
return z2.NEVER;
|
|
710
710
|
})
|
|
711
711
|
);
|
|
712
712
|
var loyaltySchema = /* @__PURE__ */ lazy(
|
|
713
|
-
() =>
|
|
713
|
+
() => z2.pipe(
|
|
714
714
|
wire({
|
|
715
715
|
total_points_earned: integerText(),
|
|
716
716
|
current_points: integerText(),
|
|
717
717
|
points_redeemed: integerText(),
|
|
718
718
|
current_tier: optionalText(),
|
|
719
719
|
tier_points: integerText(),
|
|
720
|
-
lifetime_wagered:
|
|
721
|
-
lifetime_deposited:
|
|
720
|
+
lifetime_wagered: z2._default(minorUnits(), 0),
|
|
721
|
+
lifetime_deposited: z2._default(minorUnits(), 0),
|
|
722
722
|
tier_benefits_json: tierBenefits(),
|
|
723
723
|
tier_expires_at: optionalTimestamp()
|
|
724
724
|
}),
|
|
725
|
-
|
|
725
|
+
z2.transform(({ tierBenefitsJson, ...rest }) => {
|
|
726
726
|
const benefits = typeof tierBenefitsJson === "object" && tierBenefitsJson !== null && !Array.isArray(tierBenefitsJson) ? tierBenefitsJson : null;
|
|
727
727
|
return { ...rest, tierBenefits: benefits };
|
|
728
728
|
})
|
|
729
729
|
)
|
|
730
730
|
);
|
|
731
731
|
var redeemSchema = /* @__PURE__ */ lazy(
|
|
732
|
-
() =>
|
|
732
|
+
() => z2.pipe(
|
|
733
733
|
wire({
|
|
734
|
-
success:
|
|
735
|
-
message:
|
|
734
|
+
success: z2.optional(z2.boolean()),
|
|
735
|
+
message: z2.optional(z2.string()),
|
|
736
736
|
redeemed_points: integerText(),
|
|
737
|
-
value:
|
|
737
|
+
value: z2.nullish(minorUnits()),
|
|
738
738
|
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
739
|
-
currency:
|
|
740
|
-
|
|
741
|
-
|
|
739
|
+
currency: z2.pipe(
|
|
740
|
+
z2.nullish(currencyOrEmpty()),
|
|
741
|
+
z2.transform((value) => value == null || value === "" ? null : value)
|
|
742
742
|
),
|
|
743
743
|
bonus_id: optionalText()
|
|
744
744
|
}),
|
|
745
|
-
|
|
745
|
+
z2.transform((data) => ({
|
|
746
746
|
success: data.success,
|
|
747
747
|
message: data.message,
|
|
748
748
|
redeemedPoints: data.redeemedPoints,
|
|
@@ -786,12 +786,12 @@ function createLoyaltyApi(transport) {
|
|
|
786
786
|
};
|
|
787
787
|
}
|
|
788
788
|
function openUnion(values) {
|
|
789
|
-
return
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
789
|
+
return z2.pipe(
|
|
790
|
+
z2.pipe(
|
|
791
|
+
z2.string(),
|
|
792
|
+
z2.transform((value) => value.toLowerCase())
|
|
793
793
|
),
|
|
794
|
-
|
|
794
|
+
z2.enum(values)
|
|
795
795
|
);
|
|
796
796
|
}
|
|
797
797
|
|
|
@@ -802,14 +802,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
|
802
802
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
803
803
|
var missionSchema = /* @__PURE__ */ lazy(
|
|
804
804
|
() => wire({
|
|
805
|
-
id:
|
|
806
|
-
name:
|
|
807
|
-
description:
|
|
805
|
+
id: z2.string(),
|
|
806
|
+
name: z2.string(),
|
|
807
|
+
description: z2._default(z2.string(), ""),
|
|
808
808
|
mission_type: openUnion(MISSION_TYPES),
|
|
809
809
|
objective_type: openUnion(OBJECTIVE_TYPES),
|
|
810
810
|
target_value: integerText(),
|
|
811
811
|
target_game_category: optionalText(),
|
|
812
|
-
target_games: nullableList(
|
|
812
|
+
target_games: nullableList(z2.string()),
|
|
813
813
|
reward_type: openUnion(REWARD_TYPES),
|
|
814
814
|
reward_value: minorUnits(),
|
|
815
815
|
valid_from: optionalTimestamp(),
|
|
@@ -817,16 +817,16 @@ var missionSchema = /* @__PURE__ */ lazy(
|
|
|
817
817
|
})
|
|
818
818
|
);
|
|
819
819
|
var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
820
|
-
() =>
|
|
820
|
+
() => z2.pipe(
|
|
821
821
|
wire({
|
|
822
822
|
missions: nullableList(
|
|
823
823
|
wire({
|
|
824
|
-
id:
|
|
825
|
-
mission_id:
|
|
826
|
-
mission_name:
|
|
824
|
+
id: z2.string(),
|
|
825
|
+
mission_id: z2.string(),
|
|
826
|
+
mission_name: z2._default(z2.string(), ""),
|
|
827
827
|
current_progress: integerText(),
|
|
828
828
|
target_value: integerText(),
|
|
829
|
-
progress_percentage:
|
|
829
|
+
progress_percentage: z2.number(),
|
|
830
830
|
status: openUnion(USER_MISSION_STATUSES),
|
|
831
831
|
reward_type: openUnion(REWARD_TYPES),
|
|
832
832
|
reward_value: minorUnits(),
|
|
@@ -835,7 +835,7 @@ var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
|
835
835
|
})
|
|
836
836
|
)
|
|
837
837
|
}),
|
|
838
|
-
|
|
838
|
+
z2.transform((data) => data.missions)
|
|
839
839
|
)
|
|
840
840
|
);
|
|
841
841
|
function createMissionsApi(transport) {
|
|
@@ -865,25 +865,25 @@ function createMissionsApi(transport) {
|
|
|
865
865
|
}
|
|
866
866
|
var DEFAULT_PER_PAGE = 20;
|
|
867
867
|
var HISTORY_PATH = "/referrals/history";
|
|
868
|
-
var count2 = () =>
|
|
869
|
-
var money3 = () =>
|
|
870
|
-
|
|
871
|
-
|
|
868
|
+
var count2 = () => z2._default(z2.number().check(z2.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
|
|
869
|
+
var money3 = () => z2.pipe(
|
|
870
|
+
z2.nullish(wire({ minor_units: minorUnits(), currency: z2._default(currencyOrEmpty(), "") })),
|
|
871
|
+
z2.transform(
|
|
872
872
|
(value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
|
|
873
873
|
)
|
|
874
874
|
);
|
|
875
|
-
var rulesSchema = () =>
|
|
876
|
-
|
|
875
|
+
var rulesSchema = () => z2.pipe(
|
|
876
|
+
z2.nullish(
|
|
877
877
|
wire({
|
|
878
878
|
reward: money3(),
|
|
879
879
|
minimum_real_net_loss: money3(),
|
|
880
880
|
referee_window_days: count2(),
|
|
881
881
|
hold_hours: count2(),
|
|
882
|
-
wagering_multiplier:
|
|
882
|
+
wagering_multiplier: z2._default(z2.string(), ""),
|
|
883
883
|
maximum_conversion: money3()
|
|
884
884
|
})
|
|
885
885
|
),
|
|
886
|
-
|
|
886
|
+
z2.transform((rules) => {
|
|
887
887
|
if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
|
|
888
888
|
return {
|
|
889
889
|
reward: rules.reward,
|
|
@@ -896,12 +896,12 @@ var rulesSchema = () => z.pipe(
|
|
|
896
896
|
})
|
|
897
897
|
);
|
|
898
898
|
var infoSchema = /* @__PURE__ */ lazy(
|
|
899
|
-
() =>
|
|
899
|
+
() => z2.pipe(
|
|
900
900
|
wire({
|
|
901
|
-
enabled:
|
|
901
|
+
enabled: z2._default(z2.boolean(), false),
|
|
902
902
|
referral_code: optionalText(),
|
|
903
903
|
rules: rulesSchema(),
|
|
904
|
-
totals:
|
|
904
|
+
totals: z2._default(
|
|
905
905
|
wire({
|
|
906
906
|
registered: count2(),
|
|
907
907
|
deposited: count2(),
|
|
@@ -914,7 +914,7 @@ var infoSchema = /* @__PURE__ */ lazy(
|
|
|
914
914
|
{ registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
|
|
915
915
|
)
|
|
916
916
|
}),
|
|
917
|
-
|
|
917
|
+
z2.transform(
|
|
918
918
|
({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
|
|
919
919
|
)
|
|
920
920
|
)
|
|
@@ -923,16 +923,16 @@ function remainingOf(target, loss) {
|
|
|
923
923
|
const missing = BigInt(target.amount) - BigInt(loss.amount);
|
|
924
924
|
return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
|
|
925
925
|
}
|
|
926
|
-
var progressSchema = () =>
|
|
927
|
-
|
|
926
|
+
var progressSchema = () => z2.pipe(
|
|
927
|
+
z2.nullish(
|
|
928
928
|
wire({
|
|
929
|
-
deposit_done:
|
|
929
|
+
deposit_done: z2._default(z2.boolean(), false),
|
|
930
930
|
real_net_loss: money3(),
|
|
931
931
|
target: money3(),
|
|
932
932
|
remaining: money3()
|
|
933
933
|
})
|
|
934
934
|
),
|
|
935
|
-
|
|
935
|
+
z2.transform((progress) => {
|
|
936
936
|
if (progress == null || progress.target === null) return null;
|
|
937
937
|
const { target } = progress;
|
|
938
938
|
const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
|
|
@@ -949,9 +949,9 @@ function statusOf(playerStatus, legacy) {
|
|
|
949
949
|
if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
|
|
950
950
|
return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
|
|
951
951
|
}
|
|
952
|
-
var referralSchema = () =>
|
|
952
|
+
var referralSchema = () => z2.pipe(
|
|
953
953
|
wire({
|
|
954
|
-
id:
|
|
954
|
+
id: z2.string(),
|
|
955
955
|
referee_name: optionalText(),
|
|
956
956
|
status: optionalText(),
|
|
957
957
|
player_status: optionalText(),
|
|
@@ -959,7 +959,7 @@ var referralSchema = () => z.pipe(
|
|
|
959
959
|
deadline_at: optionalTimestamp(),
|
|
960
960
|
progress: progressSchema()
|
|
961
961
|
}),
|
|
962
|
-
|
|
962
|
+
z2.transform(
|
|
963
963
|
(r) => ({
|
|
964
964
|
id: r.id,
|
|
965
965
|
refereeName: r.refereeName,
|
|
@@ -974,7 +974,7 @@ var historySchema = /* @__PURE__ */ lazy(
|
|
|
974
974
|
() => wire({
|
|
975
975
|
referral_code: optionalText(),
|
|
976
976
|
referrals: nullableList(referralSchema()),
|
|
977
|
-
pagination:
|
|
977
|
+
pagination: z2.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
|
|
978
978
|
})
|
|
979
979
|
);
|
|
980
980
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1014,12 +1014,12 @@ function createReferralsApi(transport) {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
var HTTP_URL = "Expected an absolute http(s) URL";
|
|
1016
1016
|
var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
1017
|
-
() =>
|
|
1017
|
+
() => z2.pipe(
|
|
1018
1018
|
wire({
|
|
1019
1019
|
// The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
|
|
1020
|
-
operator_token:
|
|
1021
|
-
launch_url:
|
|
1022
|
-
|
|
1020
|
+
operator_token: z2.string(),
|
|
1021
|
+
launch_url: z2.string().check(
|
|
1022
|
+
z2.refine(
|
|
1023
1023
|
(value) => {
|
|
1024
1024
|
try {
|
|
1025
1025
|
const { protocol } = new URL(value);
|
|
@@ -1031,10 +1031,10 @@ var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
|
1031
1031
|
{ message: HTTP_URL }
|
|
1032
1032
|
)
|
|
1033
1033
|
),
|
|
1034
|
-
expires_in_seconds:
|
|
1034
|
+
expires_in_seconds: z2.number().check(z2.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
|
|
1035
1035
|
}),
|
|
1036
1036
|
// The clock is read when the response is interpreted (= moment of the response).
|
|
1037
|
-
|
|
1037
|
+
z2.transform(({ launchUrl, expiresInSeconds }) => ({
|
|
1038
1038
|
launchUrl,
|
|
1039
1039
|
expiresInSeconds,
|
|
1040
1040
|
expiresAt: Date.now() + expiresInSeconds * 1e3
|