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