@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.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 z2 = require('zod/mini');
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -23,12 +23,13 @@ function _interopNamespace(e) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
var extension__namespace = /*#__PURE__*/_interopNamespace(extension);
|
|
26
|
+
var z2__namespace = /*#__PURE__*/_interopNamespace(z2);
|
|
26
27
|
|
|
27
28
|
// src/client.ts
|
|
28
29
|
function protoEnum(prefix) {
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
return z2__namespace.pipe(
|
|
31
|
+
z2__namespace.optional(z2__namespace.union([z2__namespace.string(), z2__namespace.number()])),
|
|
32
|
+
z2__namespace.transform((value) => {
|
|
32
33
|
if (value === void 0 || value === 0) return "unspecified";
|
|
33
34
|
if (typeof value === "number") return String(value);
|
|
34
35
|
return (value.startsWith(prefix) ? value.slice(prefix.length) : value).toLowerCase();
|
|
@@ -43,174 +44,175 @@ function currencyOrEmpty() {
|
|
|
43
44
|
}
|
|
44
45
|
var INTEGER_TEXT = "Expected an integer within the safe range of number";
|
|
45
46
|
function integerText() {
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
return z2__namespace.pipe(
|
|
48
|
+
z2__namespace.union([
|
|
49
|
+
z2__namespace.string().check(
|
|
50
|
+
z2__namespace.refine((value) => /^-?\d+$/.test(value) && Number.isSafeInteger(Number(value)), { message: INTEGER_TEXT })
|
|
50
51
|
),
|
|
51
|
-
|
|
52
|
+
z2__namespace.number().check(z2__namespace.refine((value) => Number.isSafeInteger(value), { message: INTEGER_TEXT }))
|
|
52
53
|
]),
|
|
53
|
-
|
|
54
|
+
z2__namespace.transform(Number)
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
function text() {
|
|
57
|
-
return
|
|
58
|
+
return z2__namespace._default(z2__namespace.string(), "");
|
|
58
59
|
}
|
|
59
60
|
function count() {
|
|
60
|
-
return
|
|
61
|
+
return z2__namespace._default(z2__namespace.number(), 0);
|
|
61
62
|
}
|
|
62
63
|
function list(item) {
|
|
63
|
-
return
|
|
64
|
+
return z2__namespace._default(z2__namespace.array(item), []);
|
|
64
65
|
}
|
|
65
66
|
function durationSeconds() {
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
return z2__namespace.pipe(
|
|
68
|
+
z2__namespace.string().check(z2__namespace.regex(/^-?\d+(\.\d+)?s$/, { message: 'Expected a protobuf duration, e.g. "86400s"' })),
|
|
69
|
+
z2__namespace.transform((value) => Number(value.slice(0, -1)))
|
|
69
70
|
);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
// src/modules/bonus.ts
|
|
73
|
-
var campaignCurrency = () =>
|
|
74
|
-
var money = () => extension.wire({ amount:
|
|
75
|
-
var timeWindow = () => extension.wire({ starts_at:
|
|
76
|
-
var ratio = () => extension.wire({ decimal:
|
|
74
|
+
var campaignCurrency = () => z2__namespace._default(currencyOrEmpty(), "");
|
|
75
|
+
var money = () => extension.wire({ amount: z2__namespace._default(minorUnits(), 0), currency: campaignCurrency() });
|
|
76
|
+
var timeWindow = () => extension.wire({ starts_at: z2__namespace.optional(z2__namespace.string()), ends_at: z2__namespace.optional(z2__namespace.string()) });
|
|
77
|
+
var ratio = () => extension.wire({ decimal: z2__namespace.optional(z2__namespace.string()), basis_points: z2__namespace.optional(z2__namespace.number()), maximum_scale: count() });
|
|
77
78
|
var empty = () => extension.wire({});
|
|
78
79
|
var policy = (prefix) => extension.wire({ code: protoEnum(prefix), version: count() });
|
|
79
80
|
var casinoSelector = () => extension.wire({
|
|
80
81
|
provider_instance_id: text(),
|
|
81
|
-
software_ids: list(
|
|
82
|
-
game_ids: list(
|
|
83
|
-
category_codes: list(
|
|
82
|
+
software_ids: list(z2__namespace.string()),
|
|
83
|
+
game_ids: list(z2__namespace.string()),
|
|
84
|
+
category_codes: list(z2__namespace.string())
|
|
84
85
|
});
|
|
85
86
|
var sportsSelector = () => extension.wire({
|
|
86
|
-
sport_codes: list(
|
|
87
|
-
competition_ids: list(
|
|
88
|
-
event_ids: list(
|
|
89
|
-
market_codes: list(
|
|
90
|
-
live:
|
|
87
|
+
sport_codes: list(z2__namespace.string()),
|
|
88
|
+
competition_ids: list(z2__namespace.string()),
|
|
89
|
+
event_ids: list(z2__namespace.string()),
|
|
90
|
+
market_codes: list(z2__namespace.string()),
|
|
91
|
+
live: z2__namespace.optional(z2__namespace.boolean()),
|
|
91
92
|
bet_types: list(protoEnum("SPORTS_BET_TYPE_"))
|
|
92
93
|
});
|
|
93
94
|
var qualification = () => extension.wire({
|
|
94
95
|
version: count(),
|
|
95
|
-
immediate:
|
|
96
|
-
user_event:
|
|
96
|
+
immediate: z2__namespace.optional(empty()),
|
|
97
|
+
user_event: z2__namespace.optional(
|
|
97
98
|
extension.wire({
|
|
98
99
|
event_code: text(),
|
|
99
100
|
event_version: count(),
|
|
100
101
|
source_authority: text(),
|
|
101
|
-
identity_fields: list(
|
|
102
|
+
identity_fields: list(z2__namespace.string())
|
|
102
103
|
})
|
|
103
104
|
),
|
|
104
|
-
deposit_settled:
|
|
105
|
+
deposit_settled: z2__namespace.optional(
|
|
105
106
|
extension.wire({
|
|
106
107
|
currency: campaignCurrency(),
|
|
107
|
-
eligible_method_codes: list(
|
|
108
|
+
eligible_method_codes: list(z2__namespace.string()),
|
|
108
109
|
first_deposit_policy: protoEnum("FIRST_DEPOSIT_POLICY_"),
|
|
109
|
-
minimum_settled_net_amount:
|
|
110
|
-
maximum_settled_net_amount:
|
|
110
|
+
minimum_settled_net_amount: z2__namespace.optional(money()),
|
|
111
|
+
maximum_settled_net_amount: z2__namespace.optional(money()),
|
|
111
112
|
amount_basis: protoEnum("DEPOSIT_AMOUNT_BASIS_")
|
|
112
113
|
})
|
|
113
114
|
),
|
|
114
|
-
activity_aggregate:
|
|
115
|
+
activity_aggregate: z2__namespace.optional(
|
|
115
116
|
extension.wire({
|
|
116
117
|
basis: protoEnum("BASIS_"),
|
|
117
118
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
118
119
|
currency: campaignCurrency(),
|
|
119
|
-
window:
|
|
120
|
+
window: z2__namespace.optional(durationSeconds()),
|
|
120
121
|
timezone: text(),
|
|
121
|
-
late_event_grace:
|
|
122
|
-
casino:
|
|
123
|
-
sportsbook:
|
|
122
|
+
late_event_grace: z2__namespace.optional(durationSeconds()),
|
|
123
|
+
casino: z2__namespace.optional(casinoSelector()),
|
|
124
|
+
sportsbook: z2__namespace.optional(sportsSelector())
|
|
124
125
|
})
|
|
125
126
|
)
|
|
126
127
|
});
|
|
127
128
|
var validity = () => extension.wire({
|
|
128
|
-
no_expiry:
|
|
129
|
-
absolute_expiry:
|
|
130
|
-
duration_from_grant:
|
|
129
|
+
no_expiry: z2__namespace.optional(empty()),
|
|
130
|
+
absolute_expiry: z2__namespace.optional(extension.wire({ expires_at: z2__namespace.optional(z2__namespace.string()) })),
|
|
131
|
+
duration_from_grant: z2__namespace.optional(extension.wire({ duration: z2__namespace.optional(durationSeconds()) }))
|
|
131
132
|
});
|
|
132
133
|
var rounding = () => protoEnum("ROUNDING_MODE_");
|
|
133
134
|
var proceedsClass = () => protoEnum("PROCEEDS_CLASS_");
|
|
134
135
|
var percent = () => extension.wire({
|
|
135
|
-
percentage:
|
|
136
|
+
percentage: z2__namespace.optional(ratio()),
|
|
136
137
|
rounding: rounding(),
|
|
137
|
-
minimum_reward:
|
|
138
|
-
maximum_reward:
|
|
138
|
+
minimum_reward: z2__namespace.optional(money()),
|
|
139
|
+
maximum_reward: z2__namespace.optional(money())
|
|
139
140
|
});
|
|
140
141
|
var balanceCredit = () => extension.wire({
|
|
141
|
-
fixed_amount:
|
|
142
|
-
percent_of_source_amount:
|
|
143
|
-
aggregate_rebate:
|
|
142
|
+
fixed_amount: z2__namespace.optional(extension.wire({ amount: z2__namespace.optional(money()) })),
|
|
143
|
+
percent_of_source_amount: z2__namespace.optional(percent()),
|
|
144
|
+
aggregate_rebate: z2__namespace.optional(
|
|
144
145
|
extension.wire({
|
|
145
|
-
percentage:
|
|
146
|
+
percentage: z2__namespace.optional(ratio()),
|
|
146
147
|
rounding: rounding(),
|
|
147
|
-
minimum_basis:
|
|
148
|
-
maximum_reward:
|
|
148
|
+
minimum_basis: z2__namespace.optional(money()),
|
|
149
|
+
maximum_reward: z2__namespace.optional(money())
|
|
149
150
|
})
|
|
150
151
|
),
|
|
151
152
|
balance_class: protoEnum("BALANCE_CLASS_"),
|
|
152
153
|
proceeds_class: proceedsClass(),
|
|
153
|
-
validity:
|
|
154
|
+
validity: z2__namespace.optional(validity())
|
|
154
155
|
});
|
|
155
|
-
var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum:
|
|
156
|
+
var maximumBet = () => extension.wire({ mode: protoEnum("MAXIMUM_BET_MODE_"), campaign_maximum: z2__namespace.optional(money()) });
|
|
156
157
|
var oddsPolicy = () => extension.wire({
|
|
157
158
|
mode: protoEnum("MODE_"),
|
|
158
|
-
minimum_total_odds_decimal:
|
|
159
|
-
minimum_odds_per_leg_decimal:
|
|
160
|
-
minimum_legs:
|
|
161
|
-
maximum_legs:
|
|
159
|
+
minimum_total_odds_decimal: z2__namespace.optional(z2__namespace.string()),
|
|
160
|
+
minimum_odds_per_leg_decimal: z2__namespace.optional(z2__namespace.string()),
|
|
161
|
+
minimum_legs: z2__namespace.optional(z2__namespace.number()),
|
|
162
|
+
maximum_legs: z2__namespace.optional(z2__namespace.number())
|
|
162
163
|
});
|
|
163
164
|
var cashoutMode = () => protoEnum("RESTRICTED_CASHOUT_MODE_");
|
|
164
165
|
var usePolicy = () => extension.wire({
|
|
165
166
|
version: count(),
|
|
166
|
-
funds_consumption:
|
|
167
|
-
casino:
|
|
168
|
-
sportsbook:
|
|
167
|
+
funds_consumption: z2__namespace.optional(policy("FUNDS_CONSUMPTION_POLICY_CODE_")),
|
|
168
|
+
casino: z2__namespace.optional(extension.wire({ allowed_scopes: list(casinoSelector()), maximum_bet: z2__namespace.optional(maximumBet()) })),
|
|
169
|
+
sportsbook: z2__namespace.optional(
|
|
169
170
|
extension.wire({
|
|
170
171
|
allowed_scopes: list(sportsSelector()),
|
|
171
172
|
excluded_scopes: list(sportsSelector()),
|
|
172
|
-
maximum_bet:
|
|
173
|
-
funding_odds:
|
|
173
|
+
maximum_bet: z2__namespace.optional(maximumBet()),
|
|
174
|
+
funding_odds: z2__namespace.optional(oddsPolicy()),
|
|
174
175
|
cashout_mode: cashoutMode()
|
|
175
176
|
})
|
|
176
177
|
),
|
|
177
|
-
casino_and_sportsbook:
|
|
178
|
+
casino_and_sportsbook: z2__namespace.optional(
|
|
178
179
|
extension.wire({
|
|
179
180
|
allowed_casino_scopes: list(casinoSelector()),
|
|
180
181
|
allowed_sportsbook_scopes: list(sportsSelector()),
|
|
181
182
|
excluded_sportsbook_scopes: list(sportsSelector()),
|
|
182
|
-
maximum_casino_bet:
|
|
183
|
-
maximum_sportsbook_bet:
|
|
184
|
-
sportsbook_funding_odds:
|
|
183
|
+
maximum_casino_bet: z2__namespace.optional(maximumBet()),
|
|
184
|
+
maximum_sportsbook_bet: z2__namespace.optional(maximumBet()),
|
|
185
|
+
sportsbook_funding_odds: z2__namespace.optional(oddsPolicy()),
|
|
185
186
|
sportsbook_cashout_mode: cashoutMode()
|
|
186
187
|
})
|
|
187
188
|
),
|
|
188
|
-
payout_allocation:
|
|
189
|
+
payout_allocation: z2__namespace.optional(policy("PAYOUT_ALLOCATION_POLICY_CODE_"))
|
|
189
190
|
});
|
|
190
191
|
var wageringPolicy = () => extension.wire({
|
|
191
192
|
version: count(),
|
|
192
|
-
none:
|
|
193
|
-
multiplier:
|
|
193
|
+
none: z2__namespace.optional(empty()),
|
|
194
|
+
multiplier: z2__namespace.optional(
|
|
194
195
|
extension.wire({
|
|
195
196
|
requirement_basis: protoEnum("REQUIREMENT_BASIS_"),
|
|
196
|
-
multiplier:
|
|
197
|
+
multiplier: z2__namespace.optional(ratio()),
|
|
197
198
|
contribution_rates: list(
|
|
198
199
|
extension.wire({
|
|
199
|
-
casino:
|
|
200
|
-
sportsbook:
|
|
201
|
-
rate:
|
|
200
|
+
casino: z2__namespace.optional(casinoSelector()),
|
|
201
|
+
sportsbook: z2__namespace.optional(sportsSelector()),
|
|
202
|
+
rate: z2__namespace.optional(ratio())
|
|
202
203
|
})
|
|
203
204
|
),
|
|
204
|
-
deadline:
|
|
205
|
+
deadline: z2__namespace.optional(validity()),
|
|
205
206
|
rounding: rounding(),
|
|
206
|
-
sportsbook_contribution_odds:
|
|
207
|
+
sportsbook_contribution_odds: z2__namespace.optional(oddsPolicy()),
|
|
208
|
+
maximum_conversion: z2__namespace.optional(money())
|
|
207
209
|
})
|
|
208
210
|
)
|
|
209
211
|
});
|
|
210
212
|
var stackingPolicy = () => extension.wire({
|
|
211
213
|
version: count(),
|
|
212
|
-
exclusive_in_group:
|
|
213
|
-
multiple_in_group:
|
|
214
|
+
exclusive_in_group: z2__namespace.optional(extension.wire({ stacking_group_key: text() })),
|
|
215
|
+
multiple_in_group: z2__namespace.optional(extension.wire({ stacking_group_key: text(), maximum_active_per_player: count() }))
|
|
214
216
|
});
|
|
215
217
|
var reward = () => extension.wire({
|
|
216
218
|
reward_key: text(),
|
|
@@ -218,49 +220,49 @@ var reward = () => extension.wire({
|
|
|
218
220
|
reward_kind_version: count(),
|
|
219
221
|
execution_profile_code: protoEnum("EXECUTION_PROFILE_CODE_"),
|
|
220
222
|
execution_profile_version: count(),
|
|
221
|
-
balance_credit:
|
|
222
|
-
provider_managed_balance:
|
|
223
|
-
casino_free_spins:
|
|
223
|
+
balance_credit: z2__namespace.optional(balanceCredit()),
|
|
224
|
+
provider_managed_balance: z2__namespace.optional(extension.wire({ provider_code: text() })),
|
|
225
|
+
casino_free_spins: z2__namespace.optional(
|
|
224
226
|
extension.wire({
|
|
225
227
|
provider_code: text(),
|
|
226
|
-
casino_scope:
|
|
228
|
+
casino_scope: z2__namespace.optional(casinoSelector()),
|
|
227
229
|
quantity: count(),
|
|
228
|
-
denomination:
|
|
230
|
+
denomination: z2__namespace.optional(money()),
|
|
229
231
|
currency: campaignCurrency(),
|
|
230
|
-
grant_window:
|
|
232
|
+
grant_window: z2__namespace.optional(timeWindow()),
|
|
231
233
|
proceeds_class: proceedsClass(),
|
|
232
|
-
maximum_winnings:
|
|
234
|
+
maximum_winnings: z2__namespace.optional(money())
|
|
233
235
|
})
|
|
234
236
|
),
|
|
235
|
-
sports_bonus_bet:
|
|
237
|
+
sports_bonus_bet: z2__namespace.optional(
|
|
236
238
|
extension.wire({
|
|
237
239
|
provider_code: text(),
|
|
238
|
-
sportsbook_scope:
|
|
239
|
-
amount:
|
|
240
|
+
sportsbook_scope: z2__namespace.optional(sportsSelector()),
|
|
241
|
+
amount: z2__namespace.optional(money()),
|
|
240
242
|
quantity: count(),
|
|
241
|
-
validity:
|
|
243
|
+
validity: z2__namespace.optional(validity())
|
|
242
244
|
})
|
|
243
245
|
),
|
|
244
|
-
sports_bet_coverage:
|
|
246
|
+
sports_bet_coverage: z2__namespace.optional(
|
|
245
247
|
extension.wire({
|
|
246
248
|
provider_code: text(),
|
|
247
|
-
qualifying_bet_scope:
|
|
248
|
-
coverage_cap:
|
|
249
|
-
validity:
|
|
249
|
+
qualifying_bet_scope: z2__namespace.optional(sportsSelector()),
|
|
250
|
+
coverage_cap: z2__namespace.optional(money()),
|
|
251
|
+
validity: z2__namespace.optional(validity())
|
|
250
252
|
})
|
|
251
253
|
),
|
|
252
|
-
use_policy:
|
|
253
|
-
wagering_policy:
|
|
254
|
-
stacking_policy:
|
|
255
|
-
restricted_position_selection_policy:
|
|
254
|
+
use_policy: z2__namespace.optional(usePolicy()),
|
|
255
|
+
wagering_policy: z2__namespace.optional(wageringPolicy()),
|
|
256
|
+
stacking_policy: z2__namespace.optional(stackingPolicy()),
|
|
257
|
+
restricted_position_selection_policy: z2__namespace.optional(
|
|
256
258
|
extension.wire({
|
|
257
259
|
version: count(),
|
|
258
|
-
priority_then_earliest_expiry:
|
|
260
|
+
priority_then_earliest_expiry: z2__namespace.optional(extension.wire({ selection_priority: z2__namespace.optional(z2__namespace.number()) }))
|
|
259
261
|
})
|
|
260
262
|
)
|
|
261
263
|
});
|
|
262
264
|
var localizedContent = () => extension.wire({ locale: text(), display_name: text(), description: text(), terms: text(), terms_revision: text() });
|
|
263
|
-
var content = () => extension.wire({ default_locale: text(), supported_locales: list(
|
|
265
|
+
var content = () => extension.wire({ default_locale: text(), supported_locales: list(z2__namespace.string()), localized_content: list(localizedContent()) });
|
|
264
266
|
var offerSchema = /* @__PURE__ */ extension.lazy(
|
|
265
267
|
() => extension.wire({
|
|
266
268
|
campaign_id: text(),
|
|
@@ -268,33 +270,33 @@ var offerSchema = /* @__PURE__ */ extension.lazy(
|
|
|
268
270
|
publication_id: text(),
|
|
269
271
|
product_scope: protoEnum("PRODUCT_SCOPE_"),
|
|
270
272
|
timezone: text(),
|
|
271
|
-
enrollment_window:
|
|
272
|
-
qualification_window:
|
|
273
|
-
claim_window:
|
|
274
|
-
entry_policy:
|
|
275
|
-
reward_claim_policy:
|
|
276
|
-
qualification:
|
|
277
|
-
reward:
|
|
278
|
-
publication_starts_at:
|
|
279
|
-
publication_ends_at:
|
|
280
|
-
content:
|
|
273
|
+
enrollment_window: z2__namespace.optional(timeWindow()),
|
|
274
|
+
qualification_window: z2__namespace.optional(timeWindow()),
|
|
275
|
+
claim_window: z2__namespace.optional(timeWindow()),
|
|
276
|
+
entry_policy: z2__namespace.optional(policy("ENTRY_POLICY_CODE_")),
|
|
277
|
+
reward_claim_policy: z2__namespace.optional(policy("REWARD_CLAIM_POLICY_CODE_")),
|
|
278
|
+
qualification: z2__namespace.optional(qualification()),
|
|
279
|
+
reward: z2__namespace.optional(reward()),
|
|
280
|
+
publication_starts_at: z2__namespace.optional(z2__namespace.string()),
|
|
281
|
+
publication_ends_at: z2__namespace.optional(z2__namespace.string()),
|
|
282
|
+
content: z2__namespace.optional(content())
|
|
281
283
|
})
|
|
282
284
|
);
|
|
283
285
|
function grantMoney(value, currency) {
|
|
284
286
|
return { amount: value?.amount ?? 0, currency: value?.currency || currency };
|
|
285
287
|
}
|
|
286
|
-
var rewardGrant = () =>
|
|
288
|
+
var rewardGrant = () => z2__namespace.pipe(
|
|
287
289
|
extension.wire({
|
|
288
290
|
state: protoEnum("CAMPAIGN_PLAYER_REWARD_GRANT_STATE_"),
|
|
289
|
-
granted:
|
|
290
|
-
balance:
|
|
291
|
-
converted:
|
|
292
|
-
expires_at:
|
|
293
|
-
wagering:
|
|
294
|
-
extension.wire({ required:
|
|
291
|
+
granted: z2__namespace.optional(money()),
|
|
292
|
+
balance: z2__namespace.optional(money()),
|
|
293
|
+
converted: z2__namespace.optional(money()),
|
|
294
|
+
expires_at: z2__namespace.optional(z2__namespace.string()),
|
|
295
|
+
wagering: z2__namespace.optional(
|
|
296
|
+
extension.wire({ required: z2__namespace.optional(money()), accumulated: z2__namespace.optional(money()), completed_at: z2__namespace.optional(z2__namespace.string()) })
|
|
295
297
|
)
|
|
296
298
|
}),
|
|
297
|
-
|
|
299
|
+
z2__namespace.transform(({ state, granted, balance, converted, expiresAt, wagering }) => {
|
|
298
300
|
const currency = [granted, balance, converted, wagering?.required, wagering?.accumulated].find((m) => m?.currency)?.currency ?? "";
|
|
299
301
|
const out = {
|
|
300
302
|
state,
|
|
@@ -314,40 +316,40 @@ var rewardGrant = () => mini.z.pipe(
|
|
|
314
316
|
})
|
|
315
317
|
);
|
|
316
318
|
var participationSchema = /* @__PURE__ */ extension.lazy(
|
|
317
|
-
() =>
|
|
319
|
+
() => z2__namespace.pipe(
|
|
318
320
|
extension.wire({
|
|
319
321
|
id: text(),
|
|
320
322
|
campaign_id: text(),
|
|
321
323
|
campaign_version_id: text(),
|
|
322
324
|
reward_key: text(),
|
|
323
|
-
qualification_snapshot:
|
|
325
|
+
qualification_snapshot: z2__namespace.optional(qualification()),
|
|
324
326
|
// oneof `state`: only one of the cases is filled in.
|
|
325
|
-
enrolled:
|
|
326
|
-
qualifying:
|
|
327
|
-
qualified:
|
|
328
|
-
reward_pending:
|
|
329
|
-
completed:
|
|
330
|
-
reward_failed:
|
|
331
|
-
expired:
|
|
332
|
-
cancelled:
|
|
333
|
-
reward_grant:
|
|
334
|
-
snapshot:
|
|
327
|
+
enrolled: z2__namespace.optional(empty()),
|
|
328
|
+
qualifying: z2__namespace.optional(empty()),
|
|
329
|
+
qualified: z2__namespace.optional(extension.wire({ qualified_at: z2__namespace.optional(z2__namespace.string()) })),
|
|
330
|
+
reward_pending: z2__namespace.optional(empty()),
|
|
331
|
+
completed: z2__namespace.optional(extension.wire({ completed_at: z2__namespace.optional(z2__namespace.string()) })),
|
|
332
|
+
reward_failed: z2__namespace.optional(empty()),
|
|
333
|
+
expired: z2__namespace.optional(extension.wire({ expired_at: z2__namespace.optional(z2__namespace.string()) })),
|
|
334
|
+
cancelled: z2__namespace.optional(empty()),
|
|
335
|
+
reward_grant: z2__namespace.optional(rewardGrant()),
|
|
336
|
+
snapshot: z2__namespace.optional(
|
|
335
337
|
extension.wire({
|
|
336
|
-
reward:
|
|
337
|
-
content:
|
|
338
|
-
terms_acceptance:
|
|
338
|
+
reward: z2__namespace.optional(reward()),
|
|
339
|
+
content: z2__namespace.optional(content()),
|
|
340
|
+
terms_acceptance: z2__namespace.optional(
|
|
339
341
|
extension.wire({
|
|
340
342
|
locale: text(),
|
|
341
343
|
terms_revision: text(),
|
|
342
344
|
terms_digest_sha256_hex: text(),
|
|
343
|
-
accepted_at:
|
|
345
|
+
accepted_at: z2__namespace.optional(z2__namespace.string())
|
|
344
346
|
})
|
|
345
347
|
)
|
|
346
348
|
})
|
|
347
349
|
)
|
|
348
350
|
}),
|
|
349
351
|
// The oneof becomes `status` (+ the timestamp of the case); the oneof's keys are not passed on.
|
|
350
|
-
|
|
352
|
+
z2__namespace.transform(
|
|
351
353
|
({ enrolled, qualifying, qualified, rewardPending, completed, rewardFailed, expired, cancelled, ...rest }) => {
|
|
352
354
|
const out = { ...rest, status: "unspecified" };
|
|
353
355
|
if (enrolled) out.status = "enrolled";
|
|
@@ -369,7 +371,7 @@ var participationSchema = /* @__PURE__ */ extension.lazy(
|
|
|
369
371
|
)
|
|
370
372
|
)
|
|
371
373
|
);
|
|
372
|
-
var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor:
|
|
374
|
+
var cursorPageSchema = (key, item) => extension.wire({ [key]: list(item), next_cursor: z2__namespace.optional(z2__namespace.string()) });
|
|
373
375
|
var offersPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("offers", offerSchema()));
|
|
374
376
|
var participationsPage = /* @__PURE__ */ extension.lazy(() => cursorPageSchema("participations", participationSchema()));
|
|
375
377
|
var offerEnvelope = /* @__PURE__ */ extension.lazy(() => extension.wire({ offer: offerSchema() }));
|
|
@@ -382,64 +384,64 @@ function toCursorPage(key, data) {
|
|
|
382
384
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
383
385
|
return page;
|
|
384
386
|
}
|
|
385
|
-
var nullableDate = () =>
|
|
386
|
-
|
|
387
|
-
|
|
387
|
+
var nullableDate = () => z2__namespace.pipe(
|
|
388
|
+
z2__namespace.nullish(z2__namespace.string()),
|
|
389
|
+
z2__namespace.transform((value) => value ?? void 0)
|
|
388
390
|
);
|
|
389
391
|
function compact(value) {
|
|
390
392
|
return Object.fromEntries(Object.entries(value).filter(([, v]) => v !== void 0));
|
|
391
393
|
}
|
|
392
394
|
var overviewSchema = /* @__PURE__ */ extension.lazy(
|
|
393
|
-
() =>
|
|
395
|
+
() => z2__namespace.pipe(
|
|
394
396
|
extension.wire({
|
|
395
397
|
currencies: list(
|
|
396
|
-
|
|
398
|
+
z2__namespace.pipe(
|
|
397
399
|
extension.wire({
|
|
398
400
|
currency: currencyOrEmpty(),
|
|
399
|
-
decimal_places:
|
|
401
|
+
decimal_places: z2__namespace.number(),
|
|
400
402
|
restricted_total: minorUnits(),
|
|
401
403
|
expiring_7d: minorUnits(),
|
|
402
|
-
open_positions:
|
|
404
|
+
open_positions: z2__namespace.number(),
|
|
403
405
|
next_expires_at: nullableDate(),
|
|
404
406
|
converted: minorUnits(),
|
|
405
|
-
converted_campaigns:
|
|
407
|
+
converted_campaigns: z2__namespace.number()
|
|
406
408
|
}),
|
|
407
|
-
|
|
409
|
+
z2__namespace.transform(compact)
|
|
408
410
|
)
|
|
409
411
|
),
|
|
410
412
|
as_of: nullableDate()
|
|
411
413
|
}),
|
|
412
|
-
|
|
414
|
+
z2__namespace.transform(compact)
|
|
413
415
|
)
|
|
414
416
|
);
|
|
415
417
|
var positionsPage = /* @__PURE__ */ extension.lazy(
|
|
416
418
|
() => extension.wire({
|
|
417
419
|
rows: list(
|
|
418
|
-
|
|
420
|
+
z2__namespace.pipe(
|
|
419
421
|
extension.wire({
|
|
420
|
-
position_id:
|
|
421
|
-
campaign_id:
|
|
422
|
+
position_id: z2__namespace.string(),
|
|
423
|
+
campaign_id: z2__namespace.string(),
|
|
422
424
|
currency: currencyOrEmpty(),
|
|
423
|
-
decimal_places:
|
|
425
|
+
decimal_places: z2__namespace.number(),
|
|
424
426
|
granted: minorUnits(),
|
|
425
427
|
restricted: minorUnits(),
|
|
426
428
|
converted: minorUnits(),
|
|
427
429
|
required: minorUnits(),
|
|
428
430
|
wagered: minorUnits(),
|
|
429
431
|
remaining: minorUnits(),
|
|
430
|
-
state:
|
|
432
|
+
state: z2__namespace.string(),
|
|
431
433
|
// The gateway answers `null` for an action it does not know; known ones are uppercase (`CONVERT`).
|
|
432
|
-
terminal_action:
|
|
433
|
-
|
|
434
|
-
|
|
434
|
+
terminal_action: z2__namespace.pipe(
|
|
435
|
+
z2__namespace.nullish(z2__namespace.string()),
|
|
436
|
+
z2__namespace.transform((value) => value ? value.toLowerCase() : void 0)
|
|
435
437
|
),
|
|
436
438
|
expires_at: nullableDate(),
|
|
437
439
|
created_at: nullableDate()
|
|
438
440
|
}),
|
|
439
|
-
|
|
441
|
+
z2__namespace.transform((row) => compact(row))
|
|
440
442
|
)
|
|
441
443
|
),
|
|
442
|
-
next_cursor:
|
|
444
|
+
next_cursor: z2__namespace.optional(z2__namespace.string())
|
|
443
445
|
})
|
|
444
446
|
);
|
|
445
447
|
var terms = (acceptance) => acceptance && { locale: acceptance.locale, terms_revision: acceptance.termsRevision };
|
|
@@ -533,51 +535,51 @@ function createBonusApi(transport) {
|
|
|
533
535
|
}
|
|
534
536
|
var gameSchema = /* @__PURE__ */ extension.lazy(
|
|
535
537
|
() => extension.wire({
|
|
536
|
-
id:
|
|
537
|
-
name:
|
|
538
|
-
provider:
|
|
539
|
-
category:
|
|
540
|
-
type:
|
|
541
|
-
thumbnail:
|
|
542
|
-
is_new:
|
|
543
|
-
is_popular:
|
|
544
|
-
is_live:
|
|
545
|
-
demo_available:
|
|
546
|
-
rtp:
|
|
547
|
-
volatility:
|
|
548
|
-
priority:
|
|
538
|
+
id: z2__namespace.string(),
|
|
539
|
+
name: z2__namespace.string(),
|
|
540
|
+
provider: z2__namespace.string(),
|
|
541
|
+
category: z2__namespace.string(),
|
|
542
|
+
type: z2__namespace.string(),
|
|
543
|
+
thumbnail: z2__namespace.string(),
|
|
544
|
+
is_new: z2__namespace.boolean(),
|
|
545
|
+
is_popular: z2__namespace.boolean(),
|
|
546
|
+
is_live: z2__namespace.boolean(),
|
|
547
|
+
demo_available: z2__namespace.boolean(),
|
|
548
|
+
rtp: z2__namespace.number(),
|
|
549
|
+
volatility: z2__namespace.string(),
|
|
550
|
+
priority: z2__namespace.number()
|
|
549
551
|
})
|
|
550
552
|
);
|
|
551
553
|
var categoriesSchema = /* @__PURE__ */ extension.lazy(
|
|
552
|
-
() =>
|
|
553
|
-
extension.wire({ slug:
|
|
554
|
+
() => z2__namespace.array(
|
|
555
|
+
extension.wire({ slug: z2__namespace.string(), name: z2__namespace.string(), icon: z2__namespace.string(), game_count: z2__namespace.number(), priority: z2__namespace.number() })
|
|
554
556
|
)
|
|
555
557
|
);
|
|
556
558
|
var providersSchema = /* @__PURE__ */ extension.lazy(
|
|
557
|
-
() =>
|
|
559
|
+
() => z2__namespace.array(extension.wire({ id: z2__namespace.string(), name: z2__namespace.string(), game_count: z2__namespace.number() }))
|
|
558
560
|
);
|
|
559
561
|
var launchSchema = /* @__PURE__ */ extension.lazy(
|
|
560
|
-
() =>
|
|
562
|
+
() => z2__namespace.pipe(
|
|
561
563
|
extension.wire({
|
|
562
|
-
session_id:
|
|
563
|
-
game_url:
|
|
564
|
+
session_id: z2__namespace.string().check(z2__namespace.minLength(1)),
|
|
565
|
+
game_url: z2__namespace.string().check(z2__namespace.minLength(1)),
|
|
564
566
|
// Any text: a target the SDK does not know yet must not fail the (strict) launch.
|
|
565
|
-
launch_target:
|
|
566
|
-
provider_code:
|
|
567
|
-
expires_at:
|
|
567
|
+
launch_target: z2__namespace.optional(z2__namespace.string()),
|
|
568
|
+
provider_code: z2__namespace.optional(z2__namespace.string()),
|
|
569
|
+
expires_at: z2__namespace.optional(z2__namespace.string())
|
|
568
570
|
}),
|
|
569
571
|
// Without a target (an older gateway, or a custom mock), the launch keeps the behavior the SDK documented
|
|
570
572
|
// before the field existed: an iframe.
|
|
571
|
-
|
|
573
|
+
z2__namespace.transform(({ launchTarget, ...rest }) => ({ ...rest, launchTarget: launchTarget || "iframe" }))
|
|
572
574
|
)
|
|
573
575
|
);
|
|
574
576
|
var sessionSchema = /* @__PURE__ */ extension.lazy(
|
|
575
577
|
() => extension.wire({
|
|
576
|
-
id:
|
|
577
|
-
game_id:
|
|
578
|
-
game_name:
|
|
579
|
-
provider:
|
|
580
|
-
start_time:
|
|
578
|
+
id: z2__namespace.string(),
|
|
579
|
+
game_id: z2__namespace.string(),
|
|
580
|
+
game_name: z2__namespace.string(),
|
|
581
|
+
provider: z2__namespace.string(),
|
|
582
|
+
start_time: z2__namespace.string(),
|
|
581
583
|
total_bet: extension.money(),
|
|
582
584
|
total_win: extension.money(),
|
|
583
585
|
status: protoEnum("SESSION_STATUS_")
|
|
@@ -585,27 +587,27 @@ var sessionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
585
587
|
);
|
|
586
588
|
var transactionSchema = /* @__PURE__ */ extension.lazy(
|
|
587
589
|
() => extension.wire({
|
|
588
|
-
id:
|
|
589
|
-
game_id:
|
|
590
|
-
game_name:
|
|
591
|
-
round_id:
|
|
590
|
+
id: z2__namespace.string(),
|
|
591
|
+
game_id: z2__namespace.string(),
|
|
592
|
+
game_name: z2__namespace.string(),
|
|
593
|
+
round_id: z2__namespace.string(),
|
|
592
594
|
type: protoEnum("CASINO_TRANSACTION_TYPE_"),
|
|
593
595
|
amount: minorUnits(),
|
|
594
596
|
currency: extension.currencyCode(),
|
|
595
597
|
currency_decimal_places: extension.decimalPlaces(),
|
|
596
|
-
created_at:
|
|
598
|
+
created_at: z2__namespace.string()
|
|
597
599
|
})
|
|
598
600
|
);
|
|
599
601
|
var winnersSchema = /* @__PURE__ */ extension.lazy(
|
|
600
|
-
() =>
|
|
602
|
+
() => z2__namespace.array(
|
|
601
603
|
extension.wire({
|
|
602
|
-
player:
|
|
604
|
+
player: z2__namespace.string(),
|
|
603
605
|
amount: minorUnits(),
|
|
604
606
|
currency: extension.currencyCode(),
|
|
605
607
|
currency_decimal_places: extension.decimalPlaces(),
|
|
606
|
-
game_id:
|
|
607
|
-
game_name:
|
|
608
|
-
won_at:
|
|
608
|
+
game_id: z2__namespace.string(),
|
|
609
|
+
game_name: z2__namespace.string(),
|
|
610
|
+
won_at: z2__namespace.string()
|
|
609
611
|
})
|
|
610
612
|
)
|
|
611
613
|
);
|
|
@@ -695,28 +697,34 @@ function pageInputProblem(name, input) {
|
|
|
695
697
|
return void 0;
|
|
696
698
|
}
|
|
697
699
|
function optionalTimestamp() {
|
|
698
|
-
return
|
|
699
|
-
|
|
700
|
-
|
|
700
|
+
return z2__namespace.pipe(
|
|
701
|
+
z2__namespace.nullish(z2__namespace.string().check(z2__namespace.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
702
|
+
z2__namespace.transform((value) => value == null || value === "" || Date.parse(value) === 0 ? null : value)
|
|
701
703
|
);
|
|
702
704
|
}
|
|
703
705
|
function optionalText() {
|
|
704
|
-
return
|
|
705
|
-
|
|
706
|
-
|
|
706
|
+
return z2__namespace.pipe(
|
|
707
|
+
z2__namespace.nullish(z2__namespace.string()),
|
|
708
|
+
z2__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
707
709
|
);
|
|
708
710
|
}
|
|
709
711
|
function nullableList(item) {
|
|
710
|
-
return
|
|
711
|
-
|
|
712
|
-
|
|
712
|
+
return z2__namespace.pipe(
|
|
713
|
+
z2__namespace.nullish(z2__namespace.array(item)),
|
|
714
|
+
z2__namespace.transform((value) => value ?? [])
|
|
713
715
|
);
|
|
714
716
|
}
|
|
715
717
|
|
|
716
718
|
// src/modules/loyalty.ts
|
|
717
|
-
var
|
|
718
|
-
|
|
719
|
-
|
|
719
|
+
var ParsedBenefits = class {
|
|
720
|
+
constructor(value) {
|
|
721
|
+
this.value = value;
|
|
722
|
+
}
|
|
723
|
+
value;
|
|
724
|
+
};
|
|
725
|
+
var tierBenefits = () => z2__namespace.pipe(
|
|
726
|
+
z2__namespace.nullish(z2__namespace.string()),
|
|
727
|
+
z2__namespace.transform((text2, ctx) => {
|
|
720
728
|
if (text2 == null || text2.trim() === "") return null;
|
|
721
729
|
let parsed;
|
|
722
730
|
try {
|
|
@@ -724,46 +732,49 @@ var tierBenefits = () => mini.z.pipe(
|
|
|
724
732
|
} catch {
|
|
725
733
|
parsed = void 0;
|
|
726
734
|
}
|
|
727
|
-
if (typeof parsed === "object" && parsed !== null
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
735
|
+
if (typeof parsed === "object" && parsed !== null) return new ParsedBenefits(parsed);
|
|
736
|
+
ctx.issues.push({
|
|
737
|
+
code: "custom",
|
|
738
|
+
message: "tier_benefits_json is not a JSON object or array",
|
|
739
|
+
input: void 0
|
|
740
|
+
});
|
|
741
|
+
return z2__namespace.NEVER;
|
|
731
742
|
})
|
|
732
743
|
);
|
|
733
744
|
var loyaltySchema = /* @__PURE__ */ extension.lazy(
|
|
734
|
-
() =>
|
|
745
|
+
() => z2__namespace.pipe(
|
|
735
746
|
extension.wire({
|
|
736
747
|
total_points_earned: integerText(),
|
|
737
748
|
current_points: integerText(),
|
|
738
749
|
points_redeemed: integerText(),
|
|
739
750
|
current_tier: optionalText(),
|
|
740
751
|
tier_points: integerText(),
|
|
741
|
-
lifetime_wagered:
|
|
742
|
-
lifetime_deposited:
|
|
752
|
+
lifetime_wagered: z2__namespace._default(minorUnits(), 0),
|
|
753
|
+
lifetime_deposited: z2__namespace._default(minorUnits(), 0),
|
|
743
754
|
tier_benefits_json: tierBenefits(),
|
|
744
755
|
tier_expires_at: optionalTimestamp()
|
|
745
756
|
}),
|
|
746
|
-
|
|
747
|
-
const benefits =
|
|
757
|
+
z2__namespace.transform(({ tierBenefitsJson, ...rest }) => {
|
|
758
|
+
const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
|
|
748
759
|
return { ...rest, tierBenefits: benefits };
|
|
749
760
|
})
|
|
750
761
|
)
|
|
751
762
|
);
|
|
752
763
|
var redeemSchema = /* @__PURE__ */ extension.lazy(
|
|
753
|
-
() =>
|
|
764
|
+
() => z2__namespace.pipe(
|
|
754
765
|
extension.wire({
|
|
755
|
-
success:
|
|
756
|
-
message:
|
|
766
|
+
success: z2__namespace.optional(z2__namespace.boolean()),
|
|
767
|
+
message: z2__namespace.optional(z2__namespace.string()),
|
|
757
768
|
redeemed_points: integerText(),
|
|
758
|
-
value:
|
|
769
|
+
value: z2__namespace.nullish(minorUnits()),
|
|
759
770
|
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
760
|
-
currency:
|
|
761
|
-
|
|
762
|
-
|
|
771
|
+
currency: z2__namespace.pipe(
|
|
772
|
+
z2__namespace.nullish(currencyOrEmpty()),
|
|
773
|
+
z2__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
763
774
|
),
|
|
764
775
|
bonus_id: optionalText()
|
|
765
776
|
}),
|
|
766
|
-
|
|
777
|
+
z2__namespace.transform((data) => ({
|
|
767
778
|
success: data.success,
|
|
768
779
|
message: data.message,
|
|
769
780
|
redeemedPoints: data.redeemedPoints,
|
|
@@ -807,12 +818,12 @@ function createLoyaltyApi(transport) {
|
|
|
807
818
|
};
|
|
808
819
|
}
|
|
809
820
|
function openUnion(values) {
|
|
810
|
-
return
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
821
|
+
return z2__namespace.pipe(
|
|
822
|
+
z2__namespace.pipe(
|
|
823
|
+
z2__namespace.string(),
|
|
824
|
+
z2__namespace.transform((value) => value.toLowerCase())
|
|
814
825
|
),
|
|
815
|
-
|
|
826
|
+
z2__namespace.enum(values)
|
|
816
827
|
);
|
|
817
828
|
}
|
|
818
829
|
|
|
@@ -823,14 +834,14 @@ var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
|
823
834
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
824
835
|
var missionSchema = /* @__PURE__ */ extension.lazy(
|
|
825
836
|
() => extension.wire({
|
|
826
|
-
id:
|
|
827
|
-
name:
|
|
828
|
-
description:
|
|
837
|
+
id: z2__namespace.string(),
|
|
838
|
+
name: z2__namespace.string(),
|
|
839
|
+
description: z2__namespace._default(z2__namespace.string(), ""),
|
|
829
840
|
mission_type: openUnion(MISSION_TYPES),
|
|
830
841
|
objective_type: openUnion(OBJECTIVE_TYPES),
|
|
831
842
|
target_value: integerText(),
|
|
832
843
|
target_game_category: optionalText(),
|
|
833
|
-
target_games: nullableList(
|
|
844
|
+
target_games: nullableList(z2__namespace.string()),
|
|
834
845
|
reward_type: openUnion(REWARD_TYPES),
|
|
835
846
|
reward_value: minorUnits(),
|
|
836
847
|
valid_from: optionalTimestamp(),
|
|
@@ -838,16 +849,16 @@ var missionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
838
849
|
})
|
|
839
850
|
);
|
|
840
851
|
var userMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
841
|
-
() =>
|
|
852
|
+
() => z2__namespace.pipe(
|
|
842
853
|
extension.wire({
|
|
843
854
|
missions: nullableList(
|
|
844
855
|
extension.wire({
|
|
845
|
-
id:
|
|
846
|
-
mission_id:
|
|
847
|
-
mission_name:
|
|
856
|
+
id: z2__namespace.string(),
|
|
857
|
+
mission_id: z2__namespace.string(),
|
|
858
|
+
mission_name: z2__namespace._default(z2__namespace.string(), ""),
|
|
848
859
|
current_progress: integerText(),
|
|
849
860
|
target_value: integerText(),
|
|
850
|
-
progress_percentage:
|
|
861
|
+
progress_percentage: z2__namespace.number(),
|
|
851
862
|
status: openUnion(USER_MISSION_STATUSES),
|
|
852
863
|
reward_type: openUnion(REWARD_TYPES),
|
|
853
864
|
reward_value: minorUnits(),
|
|
@@ -856,7 +867,7 @@ var userMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
|
856
867
|
})
|
|
857
868
|
)
|
|
858
869
|
}),
|
|
859
|
-
|
|
870
|
+
z2__namespace.transform((data) => data.missions)
|
|
860
871
|
)
|
|
861
872
|
);
|
|
862
873
|
function createMissionsApi(transport) {
|
|
@@ -886,25 +897,25 @@ function createMissionsApi(transport) {
|
|
|
886
897
|
}
|
|
887
898
|
var DEFAULT_PER_PAGE = 20;
|
|
888
899
|
var HISTORY_PATH = "/referrals/history";
|
|
889
|
-
var count2 = () =>
|
|
890
|
-
var money3 = () =>
|
|
891
|
-
|
|
892
|
-
|
|
900
|
+
var count2 = () => z2__namespace._default(z2__namespace.number().check(z2__namespace.refine((value) => Number.isSafeInteger(value) && value >= 0, "invalid counter")), 0);
|
|
901
|
+
var money3 = () => z2__namespace.pipe(
|
|
902
|
+
z2__namespace.nullish(extension.wire({ minor_units: minorUnits(), currency: z2__namespace._default(currencyOrEmpty(), "") })),
|
|
903
|
+
z2__namespace.transform(
|
|
893
904
|
(value) => value == null ? null : { amount: value.minorUnits, currency: value.currency }
|
|
894
905
|
)
|
|
895
906
|
);
|
|
896
|
-
var rulesSchema = () =>
|
|
897
|
-
|
|
907
|
+
var rulesSchema = () => z2__namespace.pipe(
|
|
908
|
+
z2__namespace.nullish(
|
|
898
909
|
extension.wire({
|
|
899
910
|
reward: money3(),
|
|
900
911
|
minimum_real_net_loss: money3(),
|
|
901
912
|
referee_window_days: count2(),
|
|
902
913
|
hold_hours: count2(),
|
|
903
|
-
wagering_multiplier:
|
|
914
|
+
wagering_multiplier: z2__namespace._default(z2__namespace.string(), ""),
|
|
904
915
|
maximum_conversion: money3()
|
|
905
916
|
})
|
|
906
917
|
),
|
|
907
|
-
|
|
918
|
+
z2__namespace.transform((rules) => {
|
|
908
919
|
if (rules == null || rules.reward === null || rules.minimumRealNetLoss === null) return null;
|
|
909
920
|
return {
|
|
910
921
|
reward: rules.reward,
|
|
@@ -917,12 +928,12 @@ var rulesSchema = () => mini.z.pipe(
|
|
|
917
928
|
})
|
|
918
929
|
);
|
|
919
930
|
var infoSchema = /* @__PURE__ */ extension.lazy(
|
|
920
|
-
() =>
|
|
931
|
+
() => z2__namespace.pipe(
|
|
921
932
|
extension.wire({
|
|
922
|
-
enabled:
|
|
933
|
+
enabled: z2__namespace._default(z2__namespace.boolean(), false),
|
|
923
934
|
referral_code: optionalText(),
|
|
924
935
|
rules: rulesSchema(),
|
|
925
|
-
totals:
|
|
936
|
+
totals: z2__namespace._default(
|
|
926
937
|
extension.wire({
|
|
927
938
|
registered: count2(),
|
|
928
939
|
deposited: count2(),
|
|
@@ -935,7 +946,7 @@ var infoSchema = /* @__PURE__ */ extension.lazy(
|
|
|
935
946
|
{ registered: 0, deposited: 0, inHold: 0, paid: 0, notEligible: 0, expired: 0, cancelled: 0 }
|
|
936
947
|
)
|
|
937
948
|
}),
|
|
938
|
-
|
|
949
|
+
z2__namespace.transform(
|
|
939
950
|
({ enabled, referralCode, rules, totals }) => ({ enabled, code: referralCode, rules, totals })
|
|
940
951
|
)
|
|
941
952
|
)
|
|
@@ -944,16 +955,16 @@ function remainingOf(target, loss) {
|
|
|
944
955
|
const missing = BigInt(target.amount) - BigInt(loss.amount);
|
|
945
956
|
return { amount: missing > 0n ? Number(missing) : 0, currency: target.currency };
|
|
946
957
|
}
|
|
947
|
-
var progressSchema = () =>
|
|
948
|
-
|
|
958
|
+
var progressSchema = () => z2__namespace.pipe(
|
|
959
|
+
z2__namespace.nullish(
|
|
949
960
|
extension.wire({
|
|
950
|
-
deposit_done:
|
|
961
|
+
deposit_done: z2__namespace._default(z2__namespace.boolean(), false),
|
|
951
962
|
real_net_loss: money3(),
|
|
952
963
|
target: money3(),
|
|
953
964
|
remaining: money3()
|
|
954
965
|
})
|
|
955
966
|
),
|
|
956
|
-
|
|
967
|
+
z2__namespace.transform((progress) => {
|
|
957
968
|
if (progress == null || progress.target === null) return null;
|
|
958
969
|
const { target } = progress;
|
|
959
970
|
const realNetLoss = progress.realNetLoss ?? { amount: 0, currency: target.currency };
|
|
@@ -970,9 +981,9 @@ function statusOf(playerStatus, legacy) {
|
|
|
970
981
|
if (playerStatus !== null) return playerStatus.replace(/^CAMPAIGN_REFERRAL_STATUS_/, "").toLowerCase();
|
|
971
982
|
return LEGACY_STATUS[(legacy ?? "").toUpperCase()] ?? "registered";
|
|
972
983
|
}
|
|
973
|
-
var referralSchema = () =>
|
|
984
|
+
var referralSchema = () => z2__namespace.pipe(
|
|
974
985
|
extension.wire({
|
|
975
|
-
id:
|
|
986
|
+
id: z2__namespace.string(),
|
|
976
987
|
referee_name: optionalText(),
|
|
977
988
|
status: optionalText(),
|
|
978
989
|
player_status: optionalText(),
|
|
@@ -980,7 +991,7 @@ var referralSchema = () => mini.z.pipe(
|
|
|
980
991
|
deadline_at: optionalTimestamp(),
|
|
981
992
|
progress: progressSchema()
|
|
982
993
|
}),
|
|
983
|
-
|
|
994
|
+
z2__namespace.transform(
|
|
984
995
|
(r) => ({
|
|
985
996
|
id: r.id,
|
|
986
997
|
refereeName: r.refereeName,
|
|
@@ -995,7 +1006,7 @@ var historySchema = /* @__PURE__ */ extension.lazy(
|
|
|
995
1006
|
() => extension.wire({
|
|
996
1007
|
referral_code: optionalText(),
|
|
997
1008
|
referrals: nullableList(referralSchema()),
|
|
998
|
-
pagination:
|
|
1009
|
+
pagination: z2__namespace.optional(extension.wire({ page: count2(), limit: count2(), total_items: count2() }))
|
|
999
1010
|
})
|
|
1000
1011
|
);
|
|
1001
1012
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1035,12 +1046,12 @@ function createReferralsApi(transport) {
|
|
|
1035
1046
|
}
|
|
1036
1047
|
var HTTP_URL = "Expected an absolute http(s) URL";
|
|
1037
1048
|
var sessionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1038
|
-
() =>
|
|
1049
|
+
() => z2__namespace.pipe(
|
|
1039
1050
|
extension.wire({
|
|
1040
1051
|
// The separate token only exists on the wire: the schema declares it (strict contract) and the output drops it.
|
|
1041
|
-
operator_token:
|
|
1042
|
-
launch_url:
|
|
1043
|
-
|
|
1052
|
+
operator_token: z2__namespace.string(),
|
|
1053
|
+
launch_url: z2__namespace.string().check(
|
|
1054
|
+
z2__namespace.refine(
|
|
1044
1055
|
(value) => {
|
|
1045
1056
|
try {
|
|
1046
1057
|
const { protocol } = new URL(value);
|
|
@@ -1052,10 +1063,10 @@ var sessionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
|
1052
1063
|
{ message: HTTP_URL }
|
|
1053
1064
|
)
|
|
1054
1065
|
),
|
|
1055
|
-
expires_in_seconds:
|
|
1066
|
+
expires_in_seconds: z2__namespace.number().check(z2__namespace.refine((n) => Number.isFinite(n) && n > 0, { message: "Esperava > 0" }))
|
|
1056
1067
|
}),
|
|
1057
1068
|
// The clock is read when the response is interpreted (= moment of the response).
|
|
1058
|
-
|
|
1069
|
+
z2__namespace.transform(({ launchUrl, expiresInSeconds }) => ({
|
|
1059
1070
|
launchUrl,
|
|
1060
1071
|
expiresInSeconds,
|
|
1061
1072
|
expiresAt: Date.now() + expiresInSeconds * 1e3
|