@getenginex/sdk-igaming 0.8.0 → 0.9.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 +12 -0
- package/dist/index.cjs +274 -263
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -7
- package/dist/index.d.ts +17 -7
- package/dist/index.js +273 -263
- package/dist/index.js.map +1 -1
- package/dist/testing/index.cjs +3 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.js +3 -1
- package/dist/testing/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,175 @@ 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
|
+
maximum_conversion: z2.optional(money())
|
|
186
187
|
})
|
|
187
188
|
)
|
|
188
189
|
});
|
|
189
190
|
var stackingPolicy = () => wire({
|
|
190
191
|
version: count(),
|
|
191
|
-
exclusive_in_group:
|
|
192
|
-
multiple_in_group:
|
|
192
|
+
exclusive_in_group: z2.optional(wire({ stacking_group_key: text() })),
|
|
193
|
+
multiple_in_group: z2.optional(wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
|
|
193
194
|
});
|
|
194
195
|
var reward = () => wire({
|
|
195
196
|
reward_key: text(),
|
|
@@ -197,49 +198,49 @@ var reward = () => wire({
|
|
|
197
198
|
reward_kind_version: count(),
|
|
198
199
|
execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
|
|
199
200
|
execution_profile_version: count(),
|
|
200
|
-
balance_credit:
|
|
201
|
-
provider_managed_balance:
|
|
202
|
-
casino_free_spins:
|
|
201
|
+
balance_credit: z2.optional(balanceCredit()),
|
|
202
|
+
provider_managed_balance: z2.optional(wire({ provider_code: text() })),
|
|
203
|
+
casino_free_spins: z2.optional(
|
|
203
204
|
wire({
|
|
204
205
|
provider_code: text(),
|
|
205
|
-
casino_scope:
|
|
206
|
+
casino_scope: z2.optional(casinoSelector()),
|
|
206
207
|
quantity: count(),
|
|
207
|
-
denomination:
|
|
208
|
+
denomination: z2.optional(money()),
|
|
208
209
|
currency: campaignCurrency(),
|
|
209
|
-
grant_window:
|
|
210
|
+
grant_window: z2.optional(timeWindow()),
|
|
210
211
|
proceeds_class: proceedsClass(),
|
|
211
|
-
maximum_winnings:
|
|
212
|
+
maximum_winnings: z2.optional(money())
|
|
212
213
|
})
|
|
213
214
|
),
|
|
214
|
-
sports_bonus_bet:
|
|
215
|
+
sports_bonus_bet: z2.optional(
|
|
215
216
|
wire({
|
|
216
217
|
provider_code: text(),
|
|
217
|
-
sportsbook_scope:
|
|
218
|
-
amount:
|
|
218
|
+
sportsbook_scope: z2.optional(sportsSelector()),
|
|
219
|
+
amount: z2.optional(money()),
|
|
219
220
|
quantity: count(),
|
|
220
|
-
validity:
|
|
221
|
+
validity: z2.optional(validity())
|
|
221
222
|
})
|
|
222
223
|
),
|
|
223
|
-
sports_bet_coverage:
|
|
224
|
+
sports_bet_coverage: z2.optional(
|
|
224
225
|
wire({
|
|
225
226
|
provider_code: text(),
|
|
226
|
-
qualifying_bet_scope:
|
|
227
|
-
coverage_cap:
|
|
228
|
-
validity:
|
|
227
|
+
qualifying_bet_scope: z2.optional(sportsSelector()),
|
|
228
|
+
coverage_cap: z2.optional(money()),
|
|
229
|
+
validity: z2.optional(validity())
|
|
229
230
|
})
|
|
230
231
|
),
|
|
231
|
-
use_policy:
|
|
232
|
-
wagering_policy:
|
|
233
|
-
stacking_policy:
|
|
234
|
-
restricted_position_selection_policy:
|
|
232
|
+
use_policy: z2.optional(usePolicy()),
|
|
233
|
+
wagering_policy: z2.optional(wageringPolicy()),
|
|
234
|
+
stacking_policy: z2.optional(stackingPolicy()),
|
|
235
|
+
restricted_position_selection_policy: z2.optional(
|
|
235
236
|
wire({
|
|
236
237
|
version: count(),
|
|
237
|
-
priority_then_earliest_expiry:
|
|
238
|
+
priority_then_earliest_expiry: z2.optional(wire({ selection_priority: z2.optional(z2.number()) }))
|
|
238
239
|
})
|
|
239
240
|
)
|
|
240
241
|
});
|
|
241
242
|
var localizedContent = () => wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
|
|
242
|
-
var content = () => wire({ default_locale: text(), supported_locales: list(
|
|
243
|
+
var content = () => wire({ default_locale: text(), supported_locales: list(z2.string()), localized_content: list(localizedContent()) });
|
|
243
244
|
var offerSchema = /* @__PURE__ */ lazy(
|
|
244
245
|
() => wire({
|
|
245
246
|
campaign_id: text(),
|
|
@@ -247,33 +248,33 @@ var offerSchema = /* @__PURE__ */ lazy(
|
|
|
247
248
|
publication_id: text(),
|
|
248
249
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
249
250
|
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:
|
|
251
|
+
enrollment_window: z2.optional(timeWindow()),
|
|
252
|
+
qualification_window: z2.optional(timeWindow()),
|
|
253
|
+
claim_window: z2.optional(timeWindow()),
|
|
254
|
+
entry_policy: z2.optional(policy("ENTRY_POLICY_CODE_")),
|
|
255
|
+
reward_claim_policy: z2.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
|
|
256
|
+
qualification: z2.optional(qualification()),
|
|
257
|
+
reward: z2.optional(reward()),
|
|
258
|
+
publication_starts_at: z2.optional(z2.string()),
|
|
259
|
+
publication_ends_at: z2.optional(z2.string()),
|
|
260
|
+
content: z2.optional(content())
|
|
260
261
|
})
|
|
261
262
|
);
|
|
262
263
|
function grantMoney(value, currency) {
|
|
263
264
|
return { amount: value?.amount ?? 0, currency: value?.currency || currency };
|
|
264
265
|
}
|
|
265
|
-
var rewardGrant = () =>
|
|
266
|
+
var rewardGrant = () => z2.pipe(
|
|
266
267
|
wire({
|
|
267
268
|
state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
|
|
268
|
-
granted:
|
|
269
|
-
balance:
|
|
270
|
-
converted:
|
|
271
|
-
expires_at:
|
|
272
|
-
wagering:
|
|
273
|
-
wire({ required:
|
|
269
|
+
granted: z2.optional(money()),
|
|
270
|
+
balance: z2.optional(money()),
|
|
271
|
+
converted: z2.optional(money()),
|
|
272
|
+
expires_at: z2.optional(z2.string()),
|
|
273
|
+
wagering: z2.optional(
|
|
274
|
+
wire({ required: z2.optional(money()), accumulated: z2.optional(money()), completed_at: z2.optional(z2.string()) })
|
|
274
275
|
)
|
|
275
276
|
}),
|
|
276
|
-
|
|
277
|
+
z2.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
|
|
277
278
|
const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
|
|
278
279
|
const out = {
|
|
279
280
|
state,
|
|
@@ -293,40 +294,40 @@ var rewardGrant = () => z.pipe(
|
|
|
293
294
|
})
|
|
294
295
|
);
|
|
295
296
|
var participationSchema = /* @__PURE__ */ lazy(
|
|
296
|
-
() =>
|
|
297
|
+
() => z2.pipe(
|
|
297
298
|
wire({
|
|
298
299
|
id: text(),
|
|
299
300
|
campaign_id: text(),
|
|
300
301
|
campaign_version_id: text(),
|
|
301
302
|
reward_key: text(),
|
|
302
|
-
qualification_snapshot:
|
|
303
|
+
qualification_snapshot: z2.optional(qualification()),
|
|
303
304
|
// 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:
|
|
305
|
+
enrolled: z2.optional(empty()),
|
|
306
|
+
qualifying: z2.optional(empty()),
|
|
307
|
+
qualified: z2.optional(wire({ qualified_at: z2.optional(z2.string()) })),
|
|
308
|
+
reward_pending: z2.optional(empty()),
|
|
309
|
+
completed: z2.optional(wire({ completed_at: z2.optional(z2.string()) })),
|
|
310
|
+
reward_failed: z2.optional(empty()),
|
|
311
|
+
expired: z2.optional(wire({ expired_at: z2.optional(z2.string()) })),
|
|
312
|
+
cancelled: z2.optional(empty()),
|
|
313
|
+
reward_grant: z2.optional(rewardGrant()),
|
|
314
|
+
snapshot: z2.optional(
|
|
314
315
|
wire({
|
|
315
|
-
reward:
|
|
316
|
-
content:
|
|
317
|
-
terms_acceptance:
|
|
316
|
+
reward: z2.optional(reward()),
|
|
317
|
+
content: z2.optional(content()),
|
|
318
|
+
terms_acceptance: z2.optional(
|
|
318
319
|
wire({
|
|
319
320
|
locale: text(),
|
|
320
321
|
terms_revision: text(),
|
|
321
322
|
terms_digest_sha256_hex: text(),
|
|
322
|
-
accepted_at:
|
|
323
|
+
accepted_at: z2.optional(z2.string())
|
|
323
324
|
})
|
|
324
325
|
)
|
|
325
326
|
})
|
|
326
327
|
)
|
|
327
328
|
}),
|
|
328
329
|
// The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
|
|
329
|
-
|
|
330
|
+
z2.transform(
|
|
330
331
|
({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
|
|
331
332
|
const out = { ...rest, status: "unspecified" };
|
|
332
333
|
if (enrolled) out.status = "enrolled";
|
|
@@ -348,7 +349,7 @@ var participationSchema = /* @__PURE__ */ lazy(
|
|
|
348
349
|
)
|
|
349
350
|
)
|
|
350
351
|
);
|
|
351
|
-
var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor:
|
|
352
|
+
var cursorPageSchema = (key, item) => wire({ [key]: list(item), next_cursor: z2.optional(z2.string()) });
|
|
352
353
|
var offersPage = /* @__PURE__ */ lazy(() => cursorPageSchema("offers", offerSchema()));
|
|
353
354
|
var participationsPage = /* @__PURE__ */ lazy(() => cursorPageSchema("participations", participationSchema()));
|
|
354
355
|
var offerEnvelope = /* @__PURE__ */ lazy(() => wire({ offer: offerSchema() }));
|
|
@@ -361,64 +362,64 @@ function toCursorPage(key, data) {
|
|
|
361
362
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
362
363
|
return page;
|
|
363
364
|
}
|
|
364
|
-
var nullableDate = () =>
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
var nullableDate = () => z2.pipe(
|
|
366
|
+
z2.nullish(z2.string()),
|
|
367
|
+
z2.transform((value) => value ?? void 0)
|
|
367
368
|
);
|
|
368
369
|
function compact(value) {
|
|
369
370
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
370
371
|
}
|
|
371
372
|
var overviewSchema = /* @__PURE__ */ lazy(
|
|
372
|
-
() =>
|
|
373
|
+
() => z2.pipe(
|
|
373
374
|
wire({
|
|
374
375
|
currencies: list(
|
|
375
|
-
|
|
376
|
+
z2.pipe(
|
|
376
377
|
wire({
|
|
377
378
|
currency: currencyOrEmpty(),
|
|
378
|
-
decimal_places:
|
|
379
|
+
decimal_places: z2.number(),
|
|
379
380
|
restricted_total: minorUnits(),
|
|
380
381
|
expiring_7d: minorUnits(),
|
|
381
|
-
open_positions:
|
|
382
|
+
open_positions: z2.number(),
|
|
382
383
|
next_expires_at: nullableDate(),
|
|
383
384
|
converted: minorUnits(),
|
|
384
|
-
converted_campaigns:
|
|
385
|
+
converted_campaigns: z2.number()
|
|
385
386
|
}),
|
|
386
|
-
|
|
387
|
+
z2.transform(compact)
|
|
387
388
|
)
|
|
388
389
|
),
|
|
389
390
|
as_of: nullableDate()
|
|
390
391
|
}),
|
|
391
|
-
|
|
392
|
+
z2.transform(compact)
|
|
392
393
|
)
|
|
393
394
|
);
|
|
394
395
|
var positionsPage = /* @__PURE__ */ lazy(
|
|
395
396
|
() => wire({
|
|
396
397
|
rows: list(
|
|
397
|
-
|
|
398
|
+
z2.pipe(
|
|
398
399
|
wire({
|
|
399
|
-
position_id:
|
|
400
|
-
campaign_id:
|
|
400
|
+
position_id: z2.string(),
|
|
401
|
+
campaign_id: z2.string(),
|
|
401
402
|
currency: currencyOrEmpty(),
|
|
402
|
-
decimal_places:
|
|
403
|
+
decimal_places: z2.number(),
|
|
403
404
|
granted: minorUnits(),
|
|
404
405
|
restricted: minorUnits(),
|
|
405
406
|
converted: minorUnits(),
|
|
406
407
|
required: minorUnits(),
|
|
407
408
|
wagered: minorUnits(),
|
|
408
409
|
remaining: minorUnits(),
|
|
409
|
-
state:
|
|
410
|
+
state: z2.string(),
|
|
410
411
|
// The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
|
|
411
|
-
terminal_action:
|
|
412
|
-
|
|
413
|
-
|
|
412
|
+
terminal_action: z2.pipe(
|
|
413
|
+
z2.nullish(z2.string()),
|
|
414
|
+
z2.transform((value) => value ? value.toLowerCase() : void 0)
|
|
414
415
|
),
|
|
415
416
|
expires_at: nullableDate(),
|
|
416
417
|
created_at: nullableDate()
|
|
417
418
|
}),
|
|
418
|
-
|
|
419
|
+
z2.transform((row) => compact(row))
|
|
419
420
|
)
|
|
420
421
|
),
|
|
421
|
-
next_cursor:
|
|
422
|
+
next_cursor: z2.optional(z2.string())
|
|
422
423
|
})
|
|
423
424
|
);
|
|
424
425
|
var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
|
|
@@ -512,51 +513,51 @@ function createBonusApi(transport) {
|
|
|
512
513
|
}
|
|
513
514
|
var gameSchema = /* @__PURE__ */ lazy(
|
|
514
515
|
() => 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:
|
|
516
|
+
id: z2.string(),
|
|
517
|
+
name: z2.string(),
|
|
518
|
+
provider: z2.string(),
|
|
519
|
+
category: z2.string(),
|
|
520
|
+
type: z2.string(),
|
|
521
|
+
thumbnail: z2.string(),
|
|
522
|
+
is_new: z2.boolean(),
|
|
523
|
+
is_popular: z2.boolean(),
|
|
524
|
+
is_live: z2.boolean(),
|
|
525
|
+
demo_available: z2.boolean(),
|
|
526
|
+
rtp: z2.number(),
|
|
527
|
+
volatility: z2.string(),
|
|
528
|
+
priority: z2.number()
|
|
528
529
|
})
|
|
529
530
|
);
|
|
530
531
|
var categoriesSchema = /* @__PURE__ */ lazy(
|
|
531
|
-
() =>
|
|
532
|
-
wire({ slug:
|
|
532
|
+
() => z2.array(
|
|
533
|
+
wire({ slug: z2.string(), name: z2.string(), icon: z2.string(), game_count: z2.number(), priority: z2.number() })
|
|
533
534
|
)
|
|
534
535
|
);
|
|
535
536
|
var providersSchema = /* @__PURE__ */ lazy(
|
|
536
|
-
() =>
|
|
537
|
+
() => z2.array(wire({ id: z2.string(), name: z2.string(), game_count: z2.number() }))
|
|
537
538
|
);
|
|
538
539
|
var launchSchema = /* @__PURE__ */ lazy(
|
|
539
|
-
() =>
|
|
540
|
+
() => z2.pipe(
|
|
540
541
|
wire({
|
|
541
|
-
session_id:
|
|
542
|
-
game_url:
|
|
542
|
+
session_id: z2.string().check(z2.minLength(1)),
|
|
543
|
+
game_url: z2.string().check(z2.minLength(1)),
|
|
543
544
|
// 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:
|
|
545
|
+
launch_target: z2.optional(z2.string()),
|
|
546
|
+
provider_code: z2.optional(z2.string()),
|
|
547
|
+
expires_at: z2.optional(z2.string())
|
|
547
548
|
}),
|
|
548
549
|
// Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
|
|
549
550
|
// before the field existed: an iframe.
|
|
550
|
-
|
|
551
|
+
z2.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
|
|
551
552
|
)
|
|
552
553
|
);
|
|
553
554
|
var sessionSchema = /* @__PURE__ */ lazy(
|
|
554
555
|
() => wire({
|
|
555
|
-
id:
|
|
556
|
-
game_id:
|
|
557
|
-
game_name:
|
|
558
|
-
provider:
|
|
559
|
-
start_time:
|
|
556
|
+
id: z2.string(),
|
|
557
|
+
game_id: z2.string(),
|
|
558
|
+
game_name: z2.string(),
|
|
559
|
+
provider: z2.string(),
|
|
560
|
+
start_time: z2.string(),
|
|
560
561
|
total_bet: money$1(),
|
|
561
562
|
total_win: money$1(),
|
|
562
563
|
status: protoEnum("SESSION_STATUS_")
|
|
@@ -564,27 +565,27 @@ var sessionSchema = /* @__PURE__ */ lazy(
|
|
|
564
565
|
);
|
|
565
566
|
var transactionSchema = /* @__PURE__ */ lazy(
|
|
566
567
|
() => wire({
|
|
567
|
-
id:
|
|
568
|
-
game_id:
|
|
569
|
-
game_name:
|
|
570
|
-
round_id:
|
|
568
|
+
id: z2.string(),
|
|
569
|
+
game_id: z2.string(),
|
|
570
|
+
game_name: z2.string(),
|
|
571
|
+
round_id: z2.string(),
|
|
571
572
|
type: protoEnum("CASINO_TRANSACTION_TYPE_"),
|
|
572
573
|
amount: minorUnits(),
|
|
573
574
|
currency: currencyCode(),
|
|
574
575
|
currency_decimal_places: decimalPlaces(),
|
|
575
|
-
created_at:
|
|
576
|
+
created_at: z2.string()
|
|
576
577
|
})
|
|
577
578
|
);
|
|
578
579
|
var winnersSchema = /* @__PURE__ */ lazy(
|
|
579
|
-
() =>
|
|
580
|
+
() => z2.array(
|
|
580
581
|
wire({
|
|
581
|
-
player:
|
|
582
|
+
player: z2.string(),
|
|
582
583
|
amount: minorUnits(),
|
|
583
584
|
currency: currencyCode(),
|
|
584
585
|
currency_decimal_places: decimalPlaces(),
|
|
585
|
-
game_id:
|
|
586
|
-
game_name:
|
|
587
|
-
won_at:
|
|
586
|
+
game_id: z2.string(),
|
|
587
|
+
game_name: z2.string(),
|
|
588
|
+
won_at: z2.string()
|
|
588
589
|
})
|
|
589
590
|
)
|
|
590
591
|
);
|
|
@@ -674,28 +675,34 @@ function pageInputProblem(name, input) {
|
|
|
674
675
|
return void 0;
|
|
675
676
|
}
|
|
676
677
|
function optionalTimestamp() {
|
|
677
|
-
return
|
|
678
|
-
|
|
679
|
-
|
|
678
|
+
return z2.pipe(
|
|
679
|
+
z2.nullish(z2.string().check(z2.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
680
|
+
z2.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
|
|
680
681
|
);
|
|
681
682
|
}
|
|
682
683
|
function optionalText() {
|
|
683
|
-
return
|
|
684
|
-
|
|
685
|
-
|
|
684
|
+
return z2.pipe(
|
|
685
|
+
z2.nullish(z2.string()),
|
|
686
|
+
z2.transform((value) => value == null || value === "" ? null : value)
|
|
686
687
|
);
|
|
687
688
|
}
|
|
688
689
|
function nullableList(item) {
|
|
689
|
-
return
|
|
690
|
-
|
|
691
|
-
|
|
690
|
+
return z2.pipe(
|
|
691
|
+
z2.nullish(z2.array(item)),
|
|
692
|
+
z2.transform((value) => value ?? [])
|
|
692
693
|
);
|
|
693
694
|
}
|
|
694
695
|
|
|
695
696
|
// src/modules/loyalty.ts
|
|
696
|
-
var
|
|
697
|
-
|
|
698
|
-
|
|
697
|
+
var ParsedBenefits = class {
|
|
698
|
+
constructor(value) {
|
|
699
|
+
this.value = value;
|
|
700
|
+
}
|
|
701
|
+
value;
|
|
702
|
+
};
|
|
703
|
+
var tierBenefits = () => z2.pipe(
|
|
704
|
+
z2.nullish(z2.string()),
|
|
705
|
+
z2.transform((text2, ctx) => {
|
|
699
706
|
if (text2 == null || text2.trim() === "") return null;
|
|
700
707
|
let parsed;
|
|
701
708
|
try {
|
|
@@ -703,46 +710,49 @@ var tierBenefits = () => z.pipe(
|
|
|
703
710
|
} catch {
|
|
704
711
|
parsed = void 0;
|
|
705
712
|
}
|
|
706
|
-
if (typeof parsed === "object" && parsed !== null
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
713
|
+
if (typeof parsed === "object" && parsed !== null) return new ParsedBenefits(parsed);
|
|
714
|
+
ctx.issues.push({
|
|
715
|
+
code: "custom",
|
|
716
|
+
message: "tier_benefits_json is not a JSON object or array",
|
|
717
|
+
input: void 0
|
|
718
|
+
});
|
|
719
|
+
return z2.NEVER;
|
|
710
720
|
})
|
|
711
721
|
);
|
|
712
722
|
var loyaltySchema = /* @__PURE__ */ lazy(
|
|
713
|
-
() =>
|
|
723
|
+
() => z2.pipe(
|
|
714
724
|
wire({
|
|
715
725
|
total_points_earned: integerText(),
|
|
716
726
|
current_points: integerText(),
|
|
717
727
|
points_redeemed: integerText(),
|
|
718
728
|
current_tier: optionalText(),
|
|
719
729
|
tier_points: integerText(),
|
|
720
|
-
lifetime_wagered:
|
|
721
|
-
lifetime_deposited:
|
|
730
|
+
lifetime_wagered: z2._default(minorUnits(), 0),
|
|
731
|
+
lifetime_deposited: z2._default(minorUnits(), 0),
|
|
722
732
|
tier_benefits_json: tierBenefits(),
|
|
723
733
|
tier_expires_at: optionalTimestamp()
|
|
724
734
|
}),
|
|
725
|
-
|
|
726
|
-
const benefits =
|
|
735
|
+
z2.transform(({ tierBenefitsJson, ...rest }) => {
|
|
736
|
+
const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
|
|
727
737
|
return { ...rest, tierBenefits: benefits };
|
|
728
738
|
})
|
|
729
739
|
)
|
|
730
740
|
);
|
|
731
741
|
var redeemSchema = /* @__PURE__ */ lazy(
|
|
732
|
-
() =>
|
|
742
|
+
() => z2.pipe(
|
|
733
743
|
wire({
|
|
734
|
-
success:
|
|
735
|
-
message:
|
|
744
|
+
success: z2.optional(z2.boolean()),
|
|
745
|
+
message: z2.optional(z2.string()),
|
|
736
746
|
redeemed_points: integerText(),
|
|
737
|
-
value:
|
|
747
|
+
value: z2.nullish(minorUnits()),
|
|
738
748
|
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
739
|
-
currency:
|
|
740
|
-
|
|
741
|
-
|
|
749
|
+
currency: z2.pipe(
|
|
750
|
+
z2.nullish(currencyOrEmpty()),
|
|
751
|
+
z2.transform((value) => value == null || value === "" ? null : value)
|
|
742
752
|
),
|
|
743
753
|
bonus_id: optionalText()
|
|
744
754
|
}),
|
|
745
|
-
|
|
755
|
+
z2.transform((data) => ({
|
|
746
756
|
success: data.success,
|
|
747
757
|
message: data.message,
|
|
748
758
|
redeemedPoints: data.redeemedPoints,
|
|
@@ -786,12 +796,12 @@ function createLoyaltyApi(transport) {
|
|
|
786
796
|
};
|
|
787
797
|
}
|
|
788
798
|
function openUnion(values) {
|
|
789
|
-
return
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
799
|
+
return z2.pipe(
|
|
800
|
+
z2.pipe(
|
|
801
|
+
z2.string(),
|
|
802
|
+
z2.transform((value) => value.toLowerCase())
|
|
793
803
|
),
|
|
794
|
-
|
|
804
|
+
z2.enum(values)
|
|
795
805
|
);
|
|
796
806
|
}
|
|
797
807
|
|
|
@@ -802,14 +812,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
|
802
812
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
803
813
|
var missionSchema = /* @__PURE__ */ lazy(
|
|
804
814
|
() => wire({
|
|
805
|
-
id:
|
|
806
|
-
name:
|
|
807
|
-
description:
|
|
815
|
+
id: z2.string(),
|
|
816
|
+
name: z2.string(),
|
|
817
|
+
description: z2._default(z2.string(), ""),
|
|
808
818
|
mission_type: openUnion(MISSION_TYPES),
|
|
809
819
|
objective_type: openUnion(OBJECTIVE_TYPES),
|
|
810
820
|
target_value: integerText(),
|
|
811
821
|
target_game_category: optionalText(),
|
|
812
|
-
target_games: nullableList(
|
|
822
|
+
target_games: nullableList(z2.string()),
|
|
813
823
|
reward_type: openUnion(REWARD_TYPES),
|
|
814
824
|
reward_value: minorUnits(),
|
|
815
825
|
valid_from: optionalTimestamp(),
|
|
@@ -817,16 +827,16 @@ var missionSchema = /* @__PURE__ */ lazy(
|
|
|
817
827
|
})
|
|
818
828
|
);
|
|
819
829
|
var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
820
|
-
() =>
|
|
830
|
+
() => z2.pipe(
|
|
821
831
|
wire({
|
|
822
832
|
missions: nullableList(
|
|
823
833
|
wire({
|
|
824
|
-
id:
|
|
825
|
-
mission_id:
|
|
826
|
-
mission_name:
|
|
834
|
+
id: z2.string(),
|
|
835
|
+
mission_id: z2.string(),
|
|
836
|
+
mission_name: z2._default(z2.string(), ""),
|
|
827
837
|
current_progress: integerText(),
|
|
828
838
|
target_value: integerText(),
|
|
829
|
-
progress_percentage:
|
|
839
|
+
progress_percentage: z2.number(),
|
|
830
840
|
status: openUnion(USER_MISSION_STATUSES),
|
|
831
841
|
reward_type: openUnion(REWARD_TYPES),
|
|
832
842
|
reward_value: minorUnits(),
|
|
@@ -835,7 +845,7 @@ var userMissionsSchema = /* @__PURE__ */ lazy(
|
|
|
835
845
|
})
|
|
836
846
|
)
|
|
837
847
|
}),
|
|
838
|
-
|
|
848
|
+
z2.transform((data) => data.missions)
|
|
839
849
|
)
|
|
840
850
|
);
|
|
841
851
|
function createMissionsApi(transport) {
|
|
@@ -865,25 +875,25 @@ function createMissionsApi(transport) {
|
|
|
865
875
|
}
|
|
866
876
|
var DEFAULT_PER_PAGE = 20;
|
|
867
877
|
var HISTORY_PATH = "/referrals/history";
|
|
868
|
-
var count2 = () =>
|
|
869
|
-
var money3 = () =>
|
|
870
|
-
|
|
871
|
-
|
|
878
|
+
var count2 = () => z2._default(z2.number().check(z2.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
|
|
879
|
+
var money3 = () => z2.pipe(
|
|
880
|
+
z2.nullish(wire({ minor_units: minorUnits(), currency: z2._default(currencyOrEmpty(), "") })),
|
|
881
|
+
z2.transform(
|
|
872
882
|
(value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
|
|
873
883
|
)
|
|
874
884
|
);
|
|
875
|
-
var rulesSchema = () =>
|
|
876
|
-
|
|
885
|
+
var rulesSchema = () => z2.pipe(
|
|
886
|
+
z2.nullish(
|
|
877
887
|
wire({
|
|
878
888
|
reward: money3(),
|
|
879
889
|
minimum_real_net_loss: money3(),
|
|
880
890
|
referee_window_days: count2(),
|
|
881
891
|
hold_hours: count2(),
|
|
882
|
-
wagering_multiplier:
|
|
892
|
+
wagering_multiplier: z2._default(z2.string(), ""),
|
|
883
893
|
maximum_conversion: money3()
|
|
884
894
|
})
|
|
885
895
|
),
|
|
886
|
-
|
|
896
|
+
z2.transform((rules) => {
|
|
887
897
|
if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
|
|
888
898
|
return {
|
|
889
899
|
reward: rules.reward,
|
|
@@ -896,12 +906,12 @@ var rulesSchema = () => z.pipe(
|
|
|
896
906
|
})
|
|
897
907
|
);
|
|
898
908
|
var infoSchema = /* @__PURE__ */ lazy(
|
|
899
|
-
() =>
|
|
909
|
+
() => z2.pipe(
|
|
900
910
|
wire({
|
|
901
|
-
enabled:
|
|
911
|
+
enabled: z2._default(z2.boolean(), false),
|
|
902
912
|
referral_code: optionalText(),
|
|
903
913
|
rules: rulesSchema(),
|
|
904
|
-
totals:
|
|
914
|
+
totals: z2._default(
|
|
905
915
|
wire({
|
|
906
916
|
registered: count2(),
|
|
907
917
|
deposited: count2(),
|
|
@@ -914,7 +924,7 @@ var infoSchema = /* @__PURE__ */ lazy(
|
|
|
914
924
|
{ registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
|
|
915
925
|
)
|
|
916
926
|
}),
|
|
917
|
-
|
|
927
|
+
z2.transform(
|
|
918
928
|
({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
|
|
919
929
|
)
|
|
920
930
|
)
|
|
@@ -923,16 +933,16 @@ function remainingOf(target, loss) {
|
|
|
923
933
|
const missing = BigInt(target.amount) - BigInt(loss.amount);
|
|
924
934
|
return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
|
|
925
935
|
}
|
|
926
|
-
var progressSchema = () =>
|
|
927
|
-
|
|
936
|
+
var progressSchema = () => z2.pipe(
|
|
937
|
+
z2.nullish(
|
|
928
938
|
wire({
|
|
929
|
-
deposit_done:
|
|
939
|
+
deposit_done: z2._default(z2.boolean(), false),
|
|
930
940
|
real_net_loss: money3(),
|
|
931
941
|
target: money3(),
|
|
932
942
|
remaining: money3()
|
|
933
943
|
})
|
|
934
944
|
),
|
|
935
|
-
|
|
945
|
+
z2.transform((progress) => {
|
|
936
946
|
if (progress == null || progress.target === null) return null;
|
|
937
947
|
const { target } = progress;
|
|
938
948
|
const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
|
|
@@ -949,9 +959,9 @@ function statusOf(playerStatus, legacy) {
|
|
|
949
959
|
if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
|
|
950
960
|
return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
|
|
951
961
|
}
|
|
952
|
-
var referralSchema = () =>
|
|
962
|
+
var referralSchema = () => z2.pipe(
|
|
953
963
|
wire({
|
|
954
|
-
id:
|
|
964
|
+
id: z2.string(),
|
|
955
965
|
referee_name: optionalText(),
|
|
956
966
|
status: optionalText(),
|
|
957
967
|
player_status: optionalText(),
|
|
@@ -959,7 +969,7 @@ var referralSchema = () => z.pipe(
|
|
|
959
969
|
deadline_at: optionalTimestamp(),
|
|
960
970
|
progress: progressSchema()
|
|
961
971
|
}),
|
|
962
|
-
|
|
972
|
+
z2.transform(
|
|
963
973
|
(r) => ({
|
|
964
974
|
id: r.id,
|
|
965
975
|
refereeName: r.refereeName,
|
|
@@ -974,7 +984,7 @@ var historySchema = /* @__PURE__ */ lazy(
|
|
|
974
984
|
() => wire({
|
|
975
985
|
referral_code: optionalText(),
|
|
976
986
|
referrals: nullableList(referralSchema()),
|
|
977
|
-
pagination:
|
|
987
|
+
pagination: z2.optional(wire({ page: count2(), limit: count2(), total_items: count2() }))
|
|
978
988
|
})
|
|
979
989
|
);
|
|
980
990
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1014,12 +1024,12 @@ function createReferralsApi(transport) {
|
|
|
1014
1024
|
}
|
|
1015
1025
|
var HTTP_URL = "Expected an absolute http(s) URL";
|
|
1016
1026
|
var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
1017
|
-
() =>
|
|
1027
|
+
() => z2.pipe(
|
|
1018
1028
|
wire({
|
|
1019
1029
|
// 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
|
-
|
|
1030
|
+
operator_token: z2.string(),
|
|
1031
|
+
launch_url: z2.string().check(
|
|
1032
|
+
z2.refine(
|
|
1023
1033
|
(value) => {
|
|
1024
1034
|
try {
|
|
1025
1035
|
const { protocol } = new URL(value);
|
|
@@ -1031,10 +1041,10 @@ var sessionSchema2 = /* @__PURE__ */ lazy(
|
|
|
1031
1041
|
{ message: HTTP_URL }
|
|
1032
1042
|
)
|
|
1033
1043
|
),
|
|
1034
|
-
expires_in_seconds:
|
|
1044
|
+
expires_in_seconds: z2.number().check(z2.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
|
|
1035
1045
|
}),
|
|
1036
1046
|
// The clock is read when the response is interpreted (= moment of the response).
|
|
1037
|
-
|
|
1047
|
+
z2.transform(({ launchUrl, expiresInSeconds }) => ({
|
|
1038
1048
|
launchUrl,
|
|
1039
1049
|
expiresInSeconds,
|
|
1040
1050
|
expiresAt: Date.now() + expiresInSeconds * 1e3
|