@getenginex/sdk-igaming 0.10.1 → 0.12.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 +61 -0
- package/README.md +4 -3
- package/dist/chunk-5ERRD3OA.js +648 -0
- package/dist/chunk-5ERRD3OA.js.map +1 -0
- package/dist/index.cjs +725 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +895 -8
- package/dist/index.d.ts +895 -8
- package/dist/index.js +427 -397
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +73 -7
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +24 -5
- package/dist/query/index.d.ts +24 -5
- package/dist/query/index.js +61 -8
- package/dist/query/index.js.map +1 -1
- package/dist/testing/index.cjs +499 -14
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +42 -4
- package/dist/testing/index.d.ts +42 -4
- package/dist/testing/index.js +499 -14
- package/dist/testing/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ function pageInputProblem(name, input) {
|
|
|
43
43
|
return `${name}: perPage must be an integer from 1 to 100.`;
|
|
44
44
|
return void 0;
|
|
45
45
|
}
|
|
46
|
+
var LOCALE = /* @__PURE__ */ Symbol.for("@getenginex/sdk-igaming/locale");
|
|
46
47
|
function optionalTimestamp() {
|
|
47
48
|
return z4__namespace.pipe(
|
|
48
49
|
z4__namespace.nullish(z4__namespace.string().check(z4__namespace.refine((value) => value === "" || !Number.isNaN(Date.parse(value)), "invalid date"))),
|
|
@@ -61,6 +62,9 @@ function nullableList(item) {
|
|
|
61
62
|
z4__namespace.transform((value) => value ?? [])
|
|
62
63
|
);
|
|
63
64
|
}
|
|
65
|
+
function flagOrNull(value) {
|
|
66
|
+
return typeof value === "boolean" ? value : null;
|
|
67
|
+
}
|
|
64
68
|
function protoEnum(prefix) {
|
|
65
69
|
return z4__namespace.pipe(
|
|
66
70
|
z4__namespace.optional(z4__namespace.union([z4__namespace.string(), z4__namespace.number()])),
|
|
@@ -100,6 +104,31 @@ function integerText() {
|
|
|
100
104
|
z4__namespace.transform(Number)
|
|
101
105
|
);
|
|
102
106
|
}
|
|
107
|
+
var NON_NEGATIVE_INTEGER = "Expected a non-negative integer within the safe range of number";
|
|
108
|
+
function nonNegativeInteger() {
|
|
109
|
+
return z4__namespace.pipe(
|
|
110
|
+
z4__namespace.union([
|
|
111
|
+
z4__namespace.string().check(
|
|
112
|
+
z4__namespace.refine((value) => /^(0|[1-9]\d*)$/.test(value) && Number.isSafeInteger(Number(value)), {
|
|
113
|
+
message: NON_NEGATIVE_INTEGER
|
|
114
|
+
})
|
|
115
|
+
),
|
|
116
|
+
z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value) && value >= 0, { message: NON_NEGATIVE_INTEGER }))
|
|
117
|
+
]),
|
|
118
|
+
// `|| 0`: a JSON `-0` comes out as `0`.
|
|
119
|
+
z4__namespace.transform((value) => Number(value) || 0)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
var MINOR_UNITS_TEXT = "Expected money in minor units as int64 text: canonical digits within the safe range of number";
|
|
123
|
+
function minorUnitsText() {
|
|
124
|
+
return z4__namespace.pipe(
|
|
125
|
+
extension.strictValue(
|
|
126
|
+
(v) => typeof v === "string" && /^(0|[1-9]\d*)$/.test(v) && Number.isSafeInteger(Number(v)),
|
|
127
|
+
MINOR_UNITS_TEXT
|
|
128
|
+
),
|
|
129
|
+
z4__namespace.transform((v) => Number(v))
|
|
130
|
+
);
|
|
131
|
+
}
|
|
103
132
|
function text() {
|
|
104
133
|
return z4__namespace._default(z4__namespace.string(), "");
|
|
105
134
|
}
|
|
@@ -635,17 +664,17 @@ function createBonusApi(transport) {
|
|
|
635
664
|
void 0,
|
|
636
665
|
options
|
|
637
666
|
),
|
|
638
|
-
resolvePromoCode: ({ code, locale }, options) => transport.request({
|
|
667
|
+
resolvePromoCode: ({ code: code2, locale }, options) => transport.request({
|
|
639
668
|
method: "POST",
|
|
640
669
|
path: "/bonus-campaigns/promo-codes/resolve",
|
|
641
|
-
body: { plaintext:
|
|
670
|
+
body: { plaintext: code2, locale },
|
|
642
671
|
auth: "required",
|
|
643
672
|
schema: promoCodeOfferSchema(),
|
|
644
673
|
options
|
|
645
674
|
}),
|
|
646
|
-
redeemPromoCode: ({ code, termsAcceptance }, options) => participationCall(
|
|
675
|
+
redeemPromoCode: ({ code: code2, termsAcceptance }, options) => participationCall(
|
|
647
676
|
"/bonus-campaigns/promo-codes/redeem",
|
|
648
|
-
{ plaintext:
|
|
677
|
+
{ plaintext: code2, terms_acceptance: terms(termsAcceptance) },
|
|
649
678
|
options
|
|
650
679
|
),
|
|
651
680
|
listParticipations: (input, options) => listPage(
|
|
@@ -677,9 +706,9 @@ function createBonusApi(transport) {
|
|
|
677
706
|
auth: "required",
|
|
678
707
|
schema: positionsPage(),
|
|
679
708
|
options
|
|
680
|
-
}).then(({ rows, nextCursor }) => {
|
|
709
|
+
}).then(({ rows, nextCursor: nextCursor2 }) => {
|
|
681
710
|
const page = { items: rows };
|
|
682
|
-
if (
|
|
711
|
+
if (nextCursor2) page.nextCursor = nextCursor2;
|
|
683
712
|
return page;
|
|
684
713
|
})
|
|
685
714
|
};
|
|
@@ -981,6 +1010,527 @@ function createCasinoApi(transport) {
|
|
|
981
1010
|
}
|
|
982
1011
|
};
|
|
983
1012
|
}
|
|
1013
|
+
function keepsClubIdempotencyKey(error) {
|
|
1014
|
+
if (!sdk.isEnginexError(error)) return false;
|
|
1015
|
+
if (extension.isAmbiguousFailure(error)) return true;
|
|
1016
|
+
return error.status >= 400 && !DEFINITIVE_CLUB_STATUS.has(error.status);
|
|
1017
|
+
}
|
|
1018
|
+
var DEFINITIVE_CLUB_STATUS = /* @__PURE__ */ new Set([400, 403, 404, 422]);
|
|
1019
|
+
var ISO_DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
1020
|
+
var ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
1021
|
+
var DECIMAL = /^(?:0|[1-9]\d{0,19})(?:\.\d{1,20})?$/;
|
|
1022
|
+
var EXTERNAL_EDITION = /^ext_[A-Za-z0-9_-]+$/;
|
|
1023
|
+
var GO_ZERO_TIME = /^0001-01-01T00:00:00(?:\.0+)?(?:Z|[+-]00:00)$/;
|
|
1024
|
+
var time = () => z4__namespace.pipe(
|
|
1025
|
+
z4__namespace.nullish(
|
|
1026
|
+
z4__namespace.string().check(
|
|
1027
|
+
z4__namespace.refine(
|
|
1028
|
+
(value) => value === "" || ISO_DATE_TIME.test(value) && !Number.isNaN(Date.parse(value)),
|
|
1029
|
+
"Expected an ISO 8601 date-time"
|
|
1030
|
+
)
|
|
1031
|
+
)
|
|
1032
|
+
),
|
|
1033
|
+
z4__namespace.transform(
|
|
1034
|
+
(value) => value == null || value === "" || Date.parse(value) === 0 || GO_ZERO_TIME.test(value) ? null : value
|
|
1035
|
+
)
|
|
1036
|
+
);
|
|
1037
|
+
var flag = () => z4__namespace._default(z4__namespace.boolean(), false);
|
|
1038
|
+
var textOrEmpty = () => z4__namespace._default(z4__namespace.string(), "");
|
|
1039
|
+
var id = () => z4__namespace.string().check(z4__namespace.minLength(1, "Expected a non-empty id"));
|
|
1040
|
+
var localized = () => extension.mapOf(z4__namespace.string());
|
|
1041
|
+
var units = () => z4__namespace._default(integerText(), 0);
|
|
1042
|
+
var int32 = () => z4__namespace._default(z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value), "Expected an integer")), 0);
|
|
1043
|
+
var rank = () => z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value) && value >= 1, "Expected an integer \u2265 1"));
|
|
1044
|
+
var code = () => z4__namespace.pipe(
|
|
1045
|
+
protoEnum(""),
|
|
1046
|
+
z4__namespace.transform((value) => value === "" ? "unspecified" : value)
|
|
1047
|
+
);
|
|
1048
|
+
var optionalCode = () => z4__namespace.pipe(
|
|
1049
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
1050
|
+
z4__namespace.transform((value) => value ? value.toLowerCase() : null)
|
|
1051
|
+
);
|
|
1052
|
+
var nullable = (schema) => z4__namespace.pipe(
|
|
1053
|
+
z4__namespace.nullish(schema),
|
|
1054
|
+
z4__namespace.transform((value) => value ?? null)
|
|
1055
|
+
);
|
|
1056
|
+
function uniqueList(item, key) {
|
|
1057
|
+
return z4__namespace.pipe(
|
|
1058
|
+
nullableList(item),
|
|
1059
|
+
z4__namespace.transform((items) => {
|
|
1060
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1061
|
+
return items.filter((value) => {
|
|
1062
|
+
const k = typeof value === "object" && value !== null ? safeKey(() => key(value)) : String(value);
|
|
1063
|
+
if (k === void 0 || seen.has(k)) return false;
|
|
1064
|
+
seen.add(k);
|
|
1065
|
+
return true;
|
|
1066
|
+
});
|
|
1067
|
+
})
|
|
1068
|
+
);
|
|
1069
|
+
}
|
|
1070
|
+
function safeKey(read) {
|
|
1071
|
+
try {
|
|
1072
|
+
const value = read();
|
|
1073
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
1074
|
+
} catch {
|
|
1075
|
+
return void 0;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
var moneySchema = /* @__PURE__ */ extension.lazy(
|
|
1079
|
+
() => z4__namespace.pipe(
|
|
1080
|
+
extension.wire({
|
|
1081
|
+
currency: extension.currencyCode(),
|
|
1082
|
+
amountMinor: nonNegativeMinorUnits(),
|
|
1083
|
+
decimalPlaces: z4__namespace.optional(extension.decimalPlaces())
|
|
1084
|
+
}),
|
|
1085
|
+
z4__namespace.transform(
|
|
1086
|
+
(m) => ({ amount: m.amountMinor, currency: m.currency, decimalPlaces: m.decimalPlaces ?? null })
|
|
1087
|
+
)
|
|
1088
|
+
)
|
|
1089
|
+
);
|
|
1090
|
+
var alternateSchema = /* @__PURE__ */ extension.lazy(
|
|
1091
|
+
() => extension.wire({ kind: code(), label: localized(), quantity: units() })
|
|
1092
|
+
);
|
|
1093
|
+
var rewardSchema = /* @__PURE__ */ extension.lazy(
|
|
1094
|
+
() => extension.wire({
|
|
1095
|
+
id: textOrEmpty(),
|
|
1096
|
+
label: localized(),
|
|
1097
|
+
kind: code(),
|
|
1098
|
+
quantity: units(),
|
|
1099
|
+
money: nullable(moneySchema()),
|
|
1100
|
+
campaign: nullable(extension.wire({ spins: units(), gameId: optionalText() })),
|
|
1101
|
+
cashback: nullable(
|
|
1102
|
+
extension.wire({
|
|
1103
|
+
percentageBps: int32(),
|
|
1104
|
+
period: optionalCode(),
|
|
1105
|
+
basis: optionalCode(),
|
|
1106
|
+
destination: optionalCode(),
|
|
1107
|
+
startsAt: time(),
|
|
1108
|
+
endsAt: time(),
|
|
1109
|
+
gameIds: uniqueList(z4__namespace.string(), String),
|
|
1110
|
+
zeroBasisAlternate: nullable(alternateSchema()),
|
|
1111
|
+
priorAwardAlternate: nullable(alternateSchema())
|
|
1112
|
+
})
|
|
1113
|
+
),
|
|
1114
|
+
manual: nullable(extension.wire({ deliveryType: optionalCode(), instructions: localized() })),
|
|
1115
|
+
ttlSeconds: units(),
|
|
1116
|
+
editionId: optionalText(),
|
|
1117
|
+
ticketOwnedAlternate: nullable(alternateSchema())
|
|
1118
|
+
})
|
|
1119
|
+
);
|
|
1120
|
+
var receiptSchema = /* @__PURE__ */ extension.lazy(
|
|
1121
|
+
() => extension.wire({
|
|
1122
|
+
id: id(),
|
|
1123
|
+
status: code(),
|
|
1124
|
+
sourceKind: code(),
|
|
1125
|
+
sourceId: optionalText(),
|
|
1126
|
+
sliceId: optionalText(),
|
|
1127
|
+
reward: nullable(rewardSchema()),
|
|
1128
|
+
settlement: nullable(moneySchema()),
|
|
1129
|
+
costCoins: units(),
|
|
1130
|
+
acceptedAt: time(),
|
|
1131
|
+
deliveredAt: time(),
|
|
1132
|
+
expiresAt: time(),
|
|
1133
|
+
tournamentRank: nullable(rank()),
|
|
1134
|
+
ticketConsumed: flag()
|
|
1135
|
+
})
|
|
1136
|
+
);
|
|
1137
|
+
var levelSchema = () => extension.wire({ id: id(), name: localized(), minXp: units(), benefit: localized() });
|
|
1138
|
+
var programSchema = /* @__PURE__ */ extension.lazy(
|
|
1139
|
+
() => extension.wire({
|
|
1140
|
+
enabled: flag(),
|
|
1141
|
+
joined: flag(),
|
|
1142
|
+
membershipRequired: flag(),
|
|
1143
|
+
canJoin: flag(),
|
|
1144
|
+
historyAvailable: flag(),
|
|
1145
|
+
versionId: optionalText(),
|
|
1146
|
+
locale: optionalText(),
|
|
1147
|
+
termsLocale: optionalText(),
|
|
1148
|
+
timeZone: optionalText(),
|
|
1149
|
+
currency: z4__namespace.pipe(
|
|
1150
|
+
z4__namespace._default(currencyOrEmpty(), ""),
|
|
1151
|
+
z4__namespace.transform((value) => value || null)
|
|
1152
|
+
),
|
|
1153
|
+
name: localized(),
|
|
1154
|
+
terms: localized(),
|
|
1155
|
+
coinName: localized(),
|
|
1156
|
+
coverUrl: optionalText(),
|
|
1157
|
+
levels: uniqueList(levelSchema(), (level) => level.id)
|
|
1158
|
+
})
|
|
1159
|
+
);
|
|
1160
|
+
var activitySchema = () => extension.wire({
|
|
1161
|
+
activity: extension.wire({
|
|
1162
|
+
id: id(),
|
|
1163
|
+
kind: code(),
|
|
1164
|
+
name: localized(),
|
|
1165
|
+
terms: localized(),
|
|
1166
|
+
coverUrl: optionalText(),
|
|
1167
|
+
wheelTheme: optionalCode(),
|
|
1168
|
+
playLabel: localized(),
|
|
1169
|
+
slices: uniqueList(extension.wire({ id: id(), reward: nullable(rewardSchema()) }), (slice) => slice.id)
|
|
1170
|
+
}),
|
|
1171
|
+
canPlay: flag(),
|
|
1172
|
+
unavailableReason: optionalCode(),
|
|
1173
|
+
latestReceipt: nullable(receiptSchema()),
|
|
1174
|
+
availableAt: time()
|
|
1175
|
+
});
|
|
1176
|
+
var missionSchema = () => extension.wire({
|
|
1177
|
+
mission: extension.wire({
|
|
1178
|
+
id: id(),
|
|
1179
|
+
title: localized(),
|
|
1180
|
+
terms: localized(),
|
|
1181
|
+
recurrence: code(),
|
|
1182
|
+
countBy: code(),
|
|
1183
|
+
target: units(),
|
|
1184
|
+
coverUrl: optionalText()
|
|
1185
|
+
}),
|
|
1186
|
+
editionId: optionalText(),
|
|
1187
|
+
progress: units(),
|
|
1188
|
+
rightId: optionalText(),
|
|
1189
|
+
rightVersionId: optionalText(),
|
|
1190
|
+
chestOptions: nullableList(rewardSchema()),
|
|
1191
|
+
canClaim: flag(),
|
|
1192
|
+
receipt: nullable(receiptSchema()),
|
|
1193
|
+
endsAt: time(),
|
|
1194
|
+
claimExpiresAt: time(),
|
|
1195
|
+
stampedDays: uniqueList(
|
|
1196
|
+
z4__namespace.string().check(
|
|
1197
|
+
z4__namespace.refine((value) => ISO_DAY.test(value) && !Number.isNaN(Date.parse(value)), "Expected a YYYY-MM-DD day")
|
|
1198
|
+
),
|
|
1199
|
+
String
|
|
1200
|
+
)
|
|
1201
|
+
});
|
|
1202
|
+
var storeItemSchema = () => extension.wire({
|
|
1203
|
+
item: extension.wire({
|
|
1204
|
+
id: id(),
|
|
1205
|
+
label: localized(),
|
|
1206
|
+
terms: localized(),
|
|
1207
|
+
costCoins: units(),
|
|
1208
|
+
reward: nullable(rewardSchema()),
|
|
1209
|
+
coverUrl: optionalText()
|
|
1210
|
+
}),
|
|
1211
|
+
canRedeem: flag(),
|
|
1212
|
+
unavailableReason: optionalCode()
|
|
1213
|
+
});
|
|
1214
|
+
var rewardsSchema = /* @__PURE__ */ extension.lazy(
|
|
1215
|
+
() => extension.wire({
|
|
1216
|
+
xp: units(),
|
|
1217
|
+
coins: units(),
|
|
1218
|
+
levelId: optionalText(),
|
|
1219
|
+
activities: uniqueList(activitySchema(), (state) => state.activity.id),
|
|
1220
|
+
// The same mission may hold several rights (one per period): a repeat is the same mission, right and period.
|
|
1221
|
+
missions: uniqueList(
|
|
1222
|
+
missionSchema(),
|
|
1223
|
+
(state) => typeof state.mission.id === "string" ? JSON.stringify([state.mission.id, state.rightId ?? state.editionId, state.endsAt]) : void 0
|
|
1224
|
+
),
|
|
1225
|
+
storeItems: uniqueList(storeItemSchema(), (state) => state.item.id)
|
|
1226
|
+
})
|
|
1227
|
+
);
|
|
1228
|
+
var overviewSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1229
|
+
() => extension.wire({ program: programSchema(), rewards: nullable(rewardsSchema()) })
|
|
1230
|
+
);
|
|
1231
|
+
var nextCursor = () => z4__namespace.pipe(
|
|
1232
|
+
optionalText(),
|
|
1233
|
+
z4__namespace.transform((value) => value ?? void 0)
|
|
1234
|
+
);
|
|
1235
|
+
function compactCursor(page) {
|
|
1236
|
+
if (page.nextCursor === void 0) delete page.nextCursor;
|
|
1237
|
+
return page;
|
|
1238
|
+
}
|
|
1239
|
+
var historySchema = /* @__PURE__ */ extension.lazy(
|
|
1240
|
+
() => z4__namespace.pipe(
|
|
1241
|
+
extension.wire({
|
|
1242
|
+
receipts: uniqueList(receiptSchema(), (receipt) => receipt.id),
|
|
1243
|
+
movements: uniqueList(
|
|
1244
|
+
extension.wire({ id: id(), kind: code(), units: units(), sourceId: optionalText(), occurredAt: time() }),
|
|
1245
|
+
(movement) => movement.id
|
|
1246
|
+
),
|
|
1247
|
+
nextCursor: nextCursor()
|
|
1248
|
+
}),
|
|
1249
|
+
z4__namespace.transform(compactCursor)
|
|
1250
|
+
)
|
|
1251
|
+
);
|
|
1252
|
+
var registrationSchema = /* @__PURE__ */ extension.lazy(
|
|
1253
|
+
() => extension.wire({ id: id(), editionId: id(), versionId: optionalText(), joinedAt: time() })
|
|
1254
|
+
);
|
|
1255
|
+
var isMinorUnits = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0 || typeof v === "string" && /^\d+$/.test(v) && Number.isSafeInteger(Number(v));
|
|
1256
|
+
var announcedMoney = () => z4__namespace.pipe(
|
|
1257
|
+
extension.wire({
|
|
1258
|
+
currency: z4__namespace.string().check(z4__namespace.regex(/^[A-Z]{3}$/, "Expected a currency code, e.g. BRL")),
|
|
1259
|
+
amountMinor: z4__namespace.union([z4__namespace.string(), z4__namespace.number()]).check(z4__namespace.refine(isMinorUnits, "Expected non-negative minor units")),
|
|
1260
|
+
decimalPlaces: z4__namespace.optional(
|
|
1261
|
+
z4__namespace.number().check(z4__namespace.refine((v) => Number.isInteger(v) && v >= 0 && v <= 8, "Expected decimal places 0 to 8"))
|
|
1262
|
+
)
|
|
1263
|
+
}),
|
|
1264
|
+
// In `'warn'` the amount may come in raw: only an exact non-negative integer becomes `amount`; anything else stays
|
|
1265
|
+
// as it came, so `hasValidAnnouncedAmount` drops the prize (never `Number('1e3')`, never a rounded value).
|
|
1266
|
+
z4__namespace.transform(
|
|
1267
|
+
(m) => ({
|
|
1268
|
+
amount: isMinorUnits(m.amountMinor) ? Number(m.amountMinor) || 0 : m.amountMinor,
|
|
1269
|
+
currency: m.currency,
|
|
1270
|
+
decimalPlaces: m.decimalPlaces ?? null
|
|
1271
|
+
})
|
|
1272
|
+
)
|
|
1273
|
+
);
|
|
1274
|
+
var prizeSchema = () => extension.wire({
|
|
1275
|
+
fromRank: int32(),
|
|
1276
|
+
toRank: int32(),
|
|
1277
|
+
reward: nullable(rewardSchema()),
|
|
1278
|
+
announcedAmount: nullable(announcedMoney()),
|
|
1279
|
+
terms: localized(),
|
|
1280
|
+
offerTerms: nullable(
|
|
1281
|
+
extension.wire({
|
|
1282
|
+
spinDenomination: nullable(moneySchema()),
|
|
1283
|
+
wageringMultiplier: nullable(z4__namespace.string().check(z4__namespace.regex(DECIMAL, "Expected an exact decimal"))),
|
|
1284
|
+
validForSeconds: nullable(integerText()),
|
|
1285
|
+
expiresAt: time(),
|
|
1286
|
+
grantEndsAt: time()
|
|
1287
|
+
})
|
|
1288
|
+
)
|
|
1289
|
+
});
|
|
1290
|
+
function hasValidAnnouncedAmount(prize) {
|
|
1291
|
+
const amount = prize.announcedAmount;
|
|
1292
|
+
if (amount === null) return true;
|
|
1293
|
+
if (typeof amount !== "object") return false;
|
|
1294
|
+
const { amount: value, currency } = amount;
|
|
1295
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && typeof currency === "string" && /^[A-Z]{3}$/.test(currency);
|
|
1296
|
+
}
|
|
1297
|
+
var tournamentSchema = /* @__PURE__ */ extension.lazy(
|
|
1298
|
+
() => extension.wire({
|
|
1299
|
+
id: id(),
|
|
1300
|
+
source: code(),
|
|
1301
|
+
versionId: optionalText(),
|
|
1302
|
+
title: localized(),
|
|
1303
|
+
terms: localized(),
|
|
1304
|
+
status: code(),
|
|
1305
|
+
startsAt: time(),
|
|
1306
|
+
endsAt: time(),
|
|
1307
|
+
updatedAt: time(),
|
|
1308
|
+
scoringRule: optionalCode(),
|
|
1309
|
+
tieBreak: optionalCode(),
|
|
1310
|
+
currency: z4__namespace.pipe(
|
|
1311
|
+
z4__namespace._default(currencyOrEmpty(), ""),
|
|
1312
|
+
z4__namespace.transform((value) => value || null)
|
|
1313
|
+
),
|
|
1314
|
+
timeZone: optionalText(),
|
|
1315
|
+
gameIds: uniqueList(z4__namespace.string(), String),
|
|
1316
|
+
// An announced amount (an external listing) is display data, not a prize the player wins: one outside the
|
|
1317
|
+
// format (negative, a fraction, ≥ 2^53, a bad currency) fails without the strict mark, so `'warn'` reports it
|
|
1318
|
+
// and drops that prize instead of failing the whole page. Strict mode still rejects it.
|
|
1319
|
+
prizes: z4__namespace.pipe(
|
|
1320
|
+
nullableList(prizeSchema()),
|
|
1321
|
+
z4__namespace.transform((prizes) => prizes.filter(hasValidAnnouncedAmount))
|
|
1322
|
+
),
|
|
1323
|
+
joinMode: optionalCode(),
|
|
1324
|
+
locale: optionalText(),
|
|
1325
|
+
rankingAvailable: flag(),
|
|
1326
|
+
canRegister: flag(),
|
|
1327
|
+
requiresTicket: flag(),
|
|
1328
|
+
registration: nullable(registrationSchema()),
|
|
1329
|
+
personalAward: nullable(receiptSchema()),
|
|
1330
|
+
stale: flag(),
|
|
1331
|
+
registrationStartsAt: time(),
|
|
1332
|
+
registrationEndsAt: time(),
|
|
1333
|
+
coverUrl: optionalText()
|
|
1334
|
+
})
|
|
1335
|
+
);
|
|
1336
|
+
var tournamentPageSchema = /* @__PURE__ */ extension.lazy(
|
|
1337
|
+
() => z4__namespace.pipe(
|
|
1338
|
+
extension.wire({
|
|
1339
|
+
items: uniqueList(tournamentSchema(), (tournament) => tournament.id),
|
|
1340
|
+
externalAvailable: flag(),
|
|
1341
|
+
externalStale: flag(),
|
|
1342
|
+
nextCursor: nextCursor()
|
|
1343
|
+
}),
|
|
1344
|
+
z4__namespace.transform(compactCursor)
|
|
1345
|
+
)
|
|
1346
|
+
);
|
|
1347
|
+
var relatedPageSchema = /* @__PURE__ */ extension.lazy(
|
|
1348
|
+
() => extension.wire({
|
|
1349
|
+
relatedTo: textOrEmpty(),
|
|
1350
|
+
items: uniqueList(
|
|
1351
|
+
extension.wire({
|
|
1352
|
+
id: z4__namespace.string().check(z4__namespace.regex(EXTERNAL_EDITION, "Expected an external edition id")),
|
|
1353
|
+
title: localized(),
|
|
1354
|
+
status: code(),
|
|
1355
|
+
startsAt: time(),
|
|
1356
|
+
endsAt: time()
|
|
1357
|
+
}),
|
|
1358
|
+
(item) => item.id
|
|
1359
|
+
),
|
|
1360
|
+
nextCursor: nextCursor()
|
|
1361
|
+
})
|
|
1362
|
+
);
|
|
1363
|
+
var rankSchema = () => extension.wire({ position: rank(), displayName: textOrEmpty(), score: textOrEmpty() });
|
|
1364
|
+
var rankingSchema = /* @__PURE__ */ extension.lazy(
|
|
1365
|
+
() => extension.wire({ entries: nullableList(rankSchema()), personal: nullable(rankSchema()), updatedAt: time(), final: flag() })
|
|
1366
|
+
);
|
|
1367
|
+
var playSchema = /* @__PURE__ */ extension.lazy(
|
|
1368
|
+
() => extension.wire({ receipt: receiptSchema(), sliceId: optionalText(), rewards: nullable(rewardsSchema()) })
|
|
1369
|
+
);
|
|
1370
|
+
var BASE = "/casino/club";
|
|
1371
|
+
var MAX_ID = 128;
|
|
1372
|
+
var MAX_IDEMPOTENCY_KEY2 = 128;
|
|
1373
|
+
var ROUTES = {
|
|
1374
|
+
overview: { method: "GET", path: BASE },
|
|
1375
|
+
history: { method: "GET", path: `${BASE}/history` },
|
|
1376
|
+
tournaments: { method: "GET", path: `${BASE}/tournaments` },
|
|
1377
|
+
tournament: { method: "GET", path: `${BASE}/tournaments/{editionId}` },
|
|
1378
|
+
ranking: { method: "GET", path: `${BASE}/tournaments/{editionId}/ranking` },
|
|
1379
|
+
membership: { method: "PUT", path: `${BASE}/membership` },
|
|
1380
|
+
play: { method: "POST", path: `${BASE}/activities/{activityId}/plays` },
|
|
1381
|
+
redeem: { method: "POST", path: `${BASE}/rewards/{rewardId}/redemptions` },
|
|
1382
|
+
register: { method: "POST", path: `${BASE}/tournaments/{editionId}/registrations` }
|
|
1383
|
+
};
|
|
1384
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1385
|
+
function utf8Length(value) {
|
|
1386
|
+
return new TextEncoder().encode(value).length;
|
|
1387
|
+
}
|
|
1388
|
+
function idProblem(name, field, value) {
|
|
1389
|
+
return typeof value === "string" && value.trim() !== "" && utf8Length(value) <= MAX_ID ? void 0 : `${name}: ${field} must be non-empty text up to ${MAX_ID} UTF-8 bytes.`;
|
|
1390
|
+
}
|
|
1391
|
+
function optionalTextProblem(name, field, value) {
|
|
1392
|
+
return value === void 0 || typeof value === "string" ? void 0 : `${name}: ${field} must be text.`;
|
|
1393
|
+
}
|
|
1394
|
+
function limitProblem(name, value) {
|
|
1395
|
+
return value === void 0 || typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 100 ? void 0 : `${name}: limit must be an integer from 1 to 100.`;
|
|
1396
|
+
}
|
|
1397
|
+
function cursorProblem(name, input) {
|
|
1398
|
+
if (input === void 0) return void 0;
|
|
1399
|
+
if (!isObject(input)) return `${name}: input must be an object.`;
|
|
1400
|
+
return optionalTextProblem(name, "cursor", input.cursor) ?? limitProblem(name, input.limit);
|
|
1401
|
+
}
|
|
1402
|
+
function keyProblem(name, options) {
|
|
1403
|
+
const key = options?.idempotencyKey;
|
|
1404
|
+
if (key === void 0 || key === "") return void 0;
|
|
1405
|
+
return typeof key === "string" && key === key.trim() && /^[\x20-\x7E]+$/.test(key) && key.length <= MAX_IDEMPOTENCY_KEY2 ? void 0 : `${name}: idempotencyKey must be printable ASCII without surrounding spaces, up to ${MAX_IDEMPOTENCY_KEY2} characters.`;
|
|
1406
|
+
}
|
|
1407
|
+
function membershipProblem(input) {
|
|
1408
|
+
const name = "club.setMembership";
|
|
1409
|
+
if (!isObject(input)) return `${name}: input must be { versionId, joined, termsLocale? }.`;
|
|
1410
|
+
if (typeof input.joined !== "boolean") return `${name}: joined must be true or false.`;
|
|
1411
|
+
const versionProblem = idProblem(name, "versionId", input.versionId);
|
|
1412
|
+
if (versionProblem) return versionProblem;
|
|
1413
|
+
if (input.joined && (typeof input.termsLocale !== "string" || input.termsLocale.trim() === ""))
|
|
1414
|
+
return `${name}: termsLocale must be non-empty text when joining.`;
|
|
1415
|
+
return void 0;
|
|
1416
|
+
}
|
|
1417
|
+
var segment = (value) => encodeURIComponent(value);
|
|
1418
|
+
function requireObject(transport, route, field) {
|
|
1419
|
+
return (value) => {
|
|
1420
|
+
if (isObject(value[field])) return value;
|
|
1421
|
+
throw transport.reportError(
|
|
1422
|
+
{
|
|
1423
|
+
code: "VALIDATION_ERROR",
|
|
1424
|
+
message: `Unexpected gateway response on ${route.method} ${route.path}: ${field}`,
|
|
1425
|
+
status: 200
|
|
1426
|
+
},
|
|
1427
|
+
route
|
|
1428
|
+
);
|
|
1429
|
+
};
|
|
1430
|
+
}
|
|
1431
|
+
function createClubApi(transport) {
|
|
1432
|
+
const get = (path, query, schema, options) => transport.request({ method: "GET", path, query, auth: "required", schema, options });
|
|
1433
|
+
const write = (method, path, body, schema, options) => (
|
|
1434
|
+
// The key goes only in the `Idempotency-Key` header: the gateway reads it from there when the body has none
|
|
1435
|
+
// (a body key that differed from the header would be refused).
|
|
1436
|
+
transport.request({ method, path, body, auth: "required", idempotent: true, schema, options })
|
|
1437
|
+
);
|
|
1438
|
+
return {
|
|
1439
|
+
getOverview: (_params, options) => get(BASE, {}, overviewSchema2(), options).then(requireObject(transport, ROUTES.overview, "program")),
|
|
1440
|
+
listHistory: (input, options) => {
|
|
1441
|
+
const problem = cursorProblem("club.listHistory", input);
|
|
1442
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.history);
|
|
1443
|
+
return get(
|
|
1444
|
+
ROUTES.history.path,
|
|
1445
|
+
{ cursor: input?.cursor || void 0, limit: input?.limit },
|
|
1446
|
+
historySchema(),
|
|
1447
|
+
options
|
|
1448
|
+
);
|
|
1449
|
+
},
|
|
1450
|
+
listTournaments: (input, options) => {
|
|
1451
|
+
const problem = cursorProblem("club.listTournaments", input);
|
|
1452
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournaments);
|
|
1453
|
+
return get(
|
|
1454
|
+
ROUTES.tournaments.path,
|
|
1455
|
+
{ cursor: input?.cursor || void 0, limit: input?.limit },
|
|
1456
|
+
tournamentPageSchema(),
|
|
1457
|
+
options
|
|
1458
|
+
);
|
|
1459
|
+
},
|
|
1460
|
+
listRelatedTournaments: (input, options) => {
|
|
1461
|
+
const name = "club.listRelatedTournaments";
|
|
1462
|
+
const problem = !isObject(input) ? `${name}: input must be { editionId }.` : typeof input.editionId !== "string" || utf8Length(input.editionId) > MAX_ID || !EXTERNAL_EDITION.test(input.editionId) ? `${name}: editionId must be an external edition id (ext_...), up to ${MAX_ID} characters.` : cursorProblem(name, input);
|
|
1463
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournaments);
|
|
1464
|
+
return get(
|
|
1465
|
+
ROUTES.tournaments.path,
|
|
1466
|
+
{ relatedTo: input.editionId, cursor: input.cursor || void 0, limit: input.limit },
|
|
1467
|
+
relatedPageSchema(),
|
|
1468
|
+
options
|
|
1469
|
+
).then(({ relatedTo, items, nextCursor: cursor }) => {
|
|
1470
|
+
if (relatedTo !== input.editionId) return { items: [] };
|
|
1471
|
+
return cursor === void 0 ? { items } : { items, nextCursor: cursor };
|
|
1472
|
+
});
|
|
1473
|
+
},
|
|
1474
|
+
getTournament: (input, options) => {
|
|
1475
|
+
const problem = idProblem("club.getTournament", "editionId", isObject(input) ? input.editionId : void 0);
|
|
1476
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournament);
|
|
1477
|
+
return get(`${BASE}/tournaments/${segment(input.editionId)}`, {}, tournamentSchema(), options);
|
|
1478
|
+
},
|
|
1479
|
+
getRanking: (input, options) => {
|
|
1480
|
+
const name = "club.getRanking";
|
|
1481
|
+
const problem = isObject(input) ? idProblem(name, "editionId", input.editionId) ?? limitProblem(name, input.limit) : `${name}: input must be { editionId }.`;
|
|
1482
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.ranking);
|
|
1483
|
+
return get(
|
|
1484
|
+
`${BASE}/tournaments/${segment(input.editionId)}/ranking`,
|
|
1485
|
+
{ limit: input.limit },
|
|
1486
|
+
rankingSchema(),
|
|
1487
|
+
options
|
|
1488
|
+
);
|
|
1489
|
+
},
|
|
1490
|
+
setMembership: (input, options) => {
|
|
1491
|
+
const problem = membershipProblem(input) ?? keyProblem("club.setMembership", options);
|
|
1492
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.membership);
|
|
1493
|
+
const body = input.joined ? { versionId: input.versionId, joined: true, termsLocale: input.termsLocale } : { versionId: input.versionId, joined: false };
|
|
1494
|
+
return write("PUT", ROUTES.membership.path, body, programSchema(), options);
|
|
1495
|
+
},
|
|
1496
|
+
play: (input, options) => {
|
|
1497
|
+
const name = "club.play";
|
|
1498
|
+
const problem = isObject(input) ? idProblem(name, "activityId", input.activityId) ?? idProblem(name, "versionId", input.versionId) ?? optionalTextProblem(name, "optionId", input.optionId) ?? keyProblem(name, options) : `${name}: input must be { activityId, versionId, optionId? }.`;
|
|
1499
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.play);
|
|
1500
|
+
const body = { versionId: input.versionId };
|
|
1501
|
+
if (input.optionId) body.optionId = input.optionId;
|
|
1502
|
+
return write("POST", `${BASE}/activities/${segment(input.activityId)}/plays`, body, playSchema(), options).then(
|
|
1503
|
+
requireObject(transport, ROUTES.play, "receipt")
|
|
1504
|
+
);
|
|
1505
|
+
},
|
|
1506
|
+
redeem: (input, options) => {
|
|
1507
|
+
const name = "club.redeem";
|
|
1508
|
+
const problem = isObject(input) ? idProblem(name, "rewardId", input.rewardId) ?? idProblem(name, "versionId", input.versionId) ?? keyProblem(name, options) : `${name}: input must be { rewardId, versionId }.`;
|
|
1509
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.redeem);
|
|
1510
|
+
return write(
|
|
1511
|
+
"POST",
|
|
1512
|
+
`${BASE}/rewards/${segment(input.rewardId)}/redemptions`,
|
|
1513
|
+
{ versionId: input.versionId },
|
|
1514
|
+
receiptSchema(),
|
|
1515
|
+
options
|
|
1516
|
+
);
|
|
1517
|
+
},
|
|
1518
|
+
registerForTournament: (input, options) => {
|
|
1519
|
+
const name = "club.registerForTournament";
|
|
1520
|
+
const problem = isObject(input) ? idProblem(name, "editionId", input.editionId) ?? idProblem(name, "versionId", input.versionId) ?? optionalTextProblem(name, "ticketId", input.ticketId) ?? keyProblem(name, options) : `${name}: input must be { editionId, versionId, ticketId? }.`;
|
|
1521
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.register);
|
|
1522
|
+
const body = { versionId: input.versionId };
|
|
1523
|
+
if (input.ticketId) body.ticketId = input.ticketId;
|
|
1524
|
+
return write(
|
|
1525
|
+
"POST",
|
|
1526
|
+
`${BASE}/tournaments/${segment(input.editionId)}/registrations`,
|
|
1527
|
+
body,
|
|
1528
|
+
registrationSchema(),
|
|
1529
|
+
options
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
984
1534
|
var ParsedBenefits = class {
|
|
985
1535
|
constructor(value) {
|
|
986
1536
|
this.value = value;
|
|
@@ -1006,45 +1556,110 @@ var tierBenefits = () => z4__namespace.pipe(
|
|
|
1006
1556
|
return z4__namespace.NEVER;
|
|
1007
1557
|
})
|
|
1008
1558
|
);
|
|
1559
|
+
var optionalFlag = () => z4__namespace.nullish(z4__namespace.boolean());
|
|
1560
|
+
var countOrNull = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
|
1561
|
+
var currencyOrNull = () => z4__namespace.pipe(
|
|
1562
|
+
z4__namespace.nullish(currencyOrEmpty()),
|
|
1563
|
+
z4__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
1564
|
+
);
|
|
1565
|
+
var ISO_CURRENCY = /^[A-Z]{3}$/;
|
|
1566
|
+
var pendingCurrency = () => z4__namespace.pipe(
|
|
1567
|
+
z4__namespace.nullish(
|
|
1568
|
+
z4__namespace.string().check(z4__namespace.refine((value) => value === "" || ISO_CURRENCY.test(value), "Expected a currency code"))
|
|
1569
|
+
),
|
|
1570
|
+
z4__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
1571
|
+
);
|
|
1572
|
+
var pendingSchema = () => extension.wire({
|
|
1573
|
+
idempotency_key: optionalText(),
|
|
1574
|
+
points: nonNegativeInteger(),
|
|
1575
|
+
currency: pendingCurrency()
|
|
1576
|
+
});
|
|
1577
|
+
function pendingOrNull(value) {
|
|
1578
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
1579
|
+
const { idempotencyKey, points, currency } = value;
|
|
1580
|
+
if (idempotencyKey !== null && typeof idempotencyKey !== "string") return null;
|
|
1581
|
+
const count3 = countOrNull(points);
|
|
1582
|
+
if (count3 === null) return null;
|
|
1583
|
+
const code2 = typeof currency === "string" && ISO_CURRENCY.test(currency) ? currency : null;
|
|
1584
|
+
return { idempotencyKey, points: count3, currency: code2 };
|
|
1585
|
+
}
|
|
1009
1586
|
var loyaltySchema = /* @__PURE__ */ extension.lazy(
|
|
1010
1587
|
() => z4__namespace.pipe(
|
|
1011
1588
|
extension.wire({
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1589
|
+
// Counters: the gateway always writes them; absent (an answer with only `available: false`) is `0`, never
|
|
1590
|
+
// `undefined`.
|
|
1591
|
+
total_points_earned: z4__namespace._default(integerText(), 0),
|
|
1592
|
+
current_points: z4__namespace._default(integerText(), 0),
|
|
1593
|
+
points_redeemed: z4__namespace._default(integerText(), 0),
|
|
1015
1594
|
current_tier: optionalText(),
|
|
1016
|
-
tier_points: integerText(),
|
|
1595
|
+
tier_points: z4__namespace._default(integerText(), 0),
|
|
1017
1596
|
lifetime_wagered: z4__namespace._default(minorUnits(), 0),
|
|
1018
1597
|
lifetime_deposited: z4__namespace._default(minorUnits(), 0),
|
|
1019
1598
|
tier_benefits_json: tierBenefits(),
|
|
1020
|
-
tier_expires_at: optionalTimestamp()
|
|
1599
|
+
tier_expires_at: optionalTimestamp(),
|
|
1600
|
+
available: optionalFlag(),
|
|
1601
|
+
program_active: optionalFlag(),
|
|
1602
|
+
history_available: optionalFlag(),
|
|
1603
|
+
can_redeem: optionalFlag(),
|
|
1604
|
+
min_redemption: z4__namespace.nullish(nonNegativeInteger()),
|
|
1605
|
+
// A rate, not an amount to show: a malformed one (a negative, a fraction, ≥ 2^53) follows the normal rule
|
|
1606
|
+
// and, in `'warn'`, becomes `null`, so the page still renders and only the redemption is unavailable.
|
|
1607
|
+
point_value_cents: z4__namespace.nullish(nonNegativeInteger()),
|
|
1608
|
+
redemption_currency: currencyOrNull(),
|
|
1609
|
+
redemption_decimal_places: z4__namespace.nullish(extension.decimalPlaces()),
|
|
1610
|
+
pending_redemption: z4__namespace.nullish(pendingSchema())
|
|
1021
1611
|
}),
|
|
1022
|
-
z4__namespace.transform((
|
|
1023
|
-
const benefits = tierBenefitsJson instanceof ParsedBenefits ? tierBenefitsJson.value : null;
|
|
1024
|
-
return {
|
|
1612
|
+
z4__namespace.transform((data) => {
|
|
1613
|
+
const benefits = data.tierBenefitsJson instanceof ParsedBenefits ? data.tierBenefitsJson.value : null;
|
|
1614
|
+
return {
|
|
1615
|
+
totalPointsEarned: data.totalPointsEarned,
|
|
1616
|
+
currentPoints: data.currentPoints,
|
|
1617
|
+
pointsRedeemed: data.pointsRedeemed,
|
|
1618
|
+
currentTier: data.currentTier,
|
|
1619
|
+
tierPoints: data.tierPoints,
|
|
1620
|
+
lifetimeWagered: data.lifetimeWagered,
|
|
1621
|
+
lifetimeDeposited: data.lifetimeDeposited,
|
|
1622
|
+
tierBenefits: benefits,
|
|
1623
|
+
tierExpiresAt: data.tierExpiresAt,
|
|
1624
|
+
available: flagOrNull(data.available),
|
|
1625
|
+
programActive: flagOrNull(data.programActive),
|
|
1626
|
+
historyAvailable: flagOrNull(data.historyAvailable),
|
|
1627
|
+
canRedeem: flagOrNull(data.canRedeem),
|
|
1628
|
+
minRedemption: countOrNull(data.minRedemption),
|
|
1629
|
+
pointValue: countOrNull(data.pointValueCents),
|
|
1630
|
+
redemptionCurrency: data.redemptionCurrency,
|
|
1631
|
+
redemptionDecimalPlaces: data.redemptionDecimalPlaces ?? null,
|
|
1632
|
+
pendingRedemption: pendingOrNull(data.pendingRedemption)
|
|
1633
|
+
};
|
|
1025
1634
|
})
|
|
1026
1635
|
)
|
|
1027
1636
|
);
|
|
1637
|
+
var VALUE_MISMATCH = "Expected value and value_minor to carry the same amount";
|
|
1638
|
+
var redeemWire = () => extension.wire({
|
|
1639
|
+
success: z4__namespace.optional(z4__namespace.boolean()),
|
|
1640
|
+
message: z4__namespace.optional(z4__namespace.string()),
|
|
1641
|
+
redeemed_points: integerText(),
|
|
1642
|
+
value: z4__namespace.nullish(nonNegativeMinorUnits()),
|
|
1643
|
+
value_minor: z4__namespace.nullish(minorUnitsText()),
|
|
1644
|
+
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
1645
|
+
currency: currencyOrNull(),
|
|
1646
|
+
currency_decimal_places: z4__namespace.nullish(extension.decimalPlaces()),
|
|
1647
|
+
bonus_id: optionalText()
|
|
1648
|
+
});
|
|
1649
|
+
var sameAmount = () => extension.strictValue((v) => {
|
|
1650
|
+
const { value, valueMinor } = v;
|
|
1651
|
+
return value == null || valueMinor == null || value === valueMinor;
|
|
1652
|
+
}, VALUE_MISMATCH);
|
|
1028
1653
|
var redeemSchema = /* @__PURE__ */ extension.lazy(
|
|
1029
1654
|
() => z4__namespace.pipe(
|
|
1030
|
-
|
|
1031
|
-
success: z4__namespace.optional(z4__namespace.boolean()),
|
|
1032
|
-
message: z4__namespace.optional(z4__namespace.string()),
|
|
1033
|
-
redeemed_points: integerText(),
|
|
1034
|
-
value: z4__namespace.nullish(minorUnits()),
|
|
1035
|
-
// Currency strict even in `'warn'`; absent, `null` and `''` still become `null`.
|
|
1036
|
-
currency: z4__namespace.pipe(
|
|
1037
|
-
z4__namespace.nullish(currencyOrEmpty()),
|
|
1038
|
-
z4__namespace.transform((value) => value == null || value === "" ? null : value)
|
|
1039
|
-
),
|
|
1040
|
-
bonus_id: optionalText()
|
|
1041
|
-
}),
|
|
1655
|
+
z4__namespace.pipe(redeemWire(), sameAmount()),
|
|
1042
1656
|
z4__namespace.transform((data) => ({
|
|
1043
1657
|
success: data.success,
|
|
1044
1658
|
message: data.message,
|
|
1045
1659
|
redeemedPoints: data.redeemedPoints,
|
|
1046
|
-
value: data.value ?? null,
|
|
1660
|
+
value: data.valueMinor ?? data.value ?? null,
|
|
1047
1661
|
currency: data.currency,
|
|
1662
|
+
currencyDecimalPlaces: data.currencyDecimalPlaces ?? null,
|
|
1048
1663
|
bonusId: data.bonusId
|
|
1049
1664
|
}))
|
|
1050
1665
|
)
|
|
@@ -1097,7 +1712,7 @@ var MISSION_TYPES = ["daily", "weekly", "event", "permanent"];
|
|
|
1097
1712
|
var OBJECTIVE_TYPES = ["wager", "bet_count", "win_amount", "play_game", "deposit"];
|
|
1098
1713
|
var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
1099
1714
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
1100
|
-
var
|
|
1715
|
+
var missionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1101
1716
|
() => extension.wire({
|
|
1102
1717
|
id: z4__namespace.string(),
|
|
1103
1718
|
name: z4__namespace.string(),
|
|
@@ -1113,28 +1728,73 @@ var missionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
1113
1728
|
valid_to: optionalTimestamp()
|
|
1114
1729
|
})
|
|
1115
1730
|
);
|
|
1731
|
+
var userMissionFields = () => ({
|
|
1732
|
+
id: z4__namespace.string(),
|
|
1733
|
+
mission_id: z4__namespace.string(),
|
|
1734
|
+
mission_name: z4__namespace._default(z4__namespace.string(), ""),
|
|
1735
|
+
current_progress: integerText(),
|
|
1736
|
+
target_value: integerText(),
|
|
1737
|
+
progress_percentage: z4__namespace.number(),
|
|
1738
|
+
status: openUnion(USER_MISSION_STATUSES),
|
|
1739
|
+
reward_type: openUnion(REWARD_TYPES),
|
|
1740
|
+
reward_value: minorUnits(),
|
|
1741
|
+
period_end: optionalTimestamp(),
|
|
1742
|
+
completed_at: optionalTimestamp()
|
|
1743
|
+
});
|
|
1116
1744
|
var userMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
1745
|
+
() => z4__namespace.pipe(
|
|
1746
|
+
extension.wire({ missions: nullableList(extension.wire(userMissionFields())) }),
|
|
1747
|
+
z4__namespace.transform((data) => data.missions)
|
|
1748
|
+
)
|
|
1749
|
+
);
|
|
1750
|
+
var historyMissionSchema = () => z4__namespace.pipe(
|
|
1751
|
+
extension.wire({
|
|
1752
|
+
...userMissionFields(),
|
|
1753
|
+
claimed_at: optionalTimestamp(),
|
|
1754
|
+
offer_active: z4__namespace.nullish(z4__namespace.boolean()),
|
|
1755
|
+
description: optionalText(),
|
|
1756
|
+
mission_type: z4__namespace.nullish(openUnion(MISSION_TYPES)),
|
|
1757
|
+
objective_type: z4__namespace.nullish(openUnion(OBJECTIVE_TYPES)),
|
|
1758
|
+
target_game_category: optionalText()
|
|
1759
|
+
}),
|
|
1760
|
+
// In `'warn'` a divergent `offer_active` arrives raw: the SDK delivers `null`, never the text `"false"`.
|
|
1761
|
+
z4__namespace.transform(
|
|
1762
|
+
(m) => ({
|
|
1763
|
+
...m,
|
|
1764
|
+
offerActive: flagOrNull(m.offerActive),
|
|
1765
|
+
missionType: m.missionType ?? null,
|
|
1766
|
+
objectiveType: m.objectiveType ?? null
|
|
1767
|
+
})
|
|
1768
|
+
)
|
|
1769
|
+
);
|
|
1770
|
+
var myMissionsSchema = /* @__PURE__ */ extension.lazy(
|
|
1117
1771
|
() => z4__namespace.pipe(
|
|
1118
1772
|
extension.wire({
|
|
1119
|
-
missions: nullableList(
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
mission_name: z4__namespace._default(z4__namespace.string(), ""),
|
|
1124
|
-
current_progress: integerText(),
|
|
1125
|
-
target_value: integerText(),
|
|
1126
|
-
progress_percentage: z4__namespace.number(),
|
|
1127
|
-
status: openUnion(USER_MISSION_STATUSES),
|
|
1128
|
-
reward_type: openUnion(REWARD_TYPES),
|
|
1129
|
-
reward_value: minorUnits(),
|
|
1130
|
-
period_end: optionalTimestamp(),
|
|
1131
|
-
completed_at: optionalTimestamp()
|
|
1132
|
-
})
|
|
1133
|
-
)
|
|
1773
|
+
missions: nullableList(historyMissionSchema()),
|
|
1774
|
+
available: z4__namespace.nullish(z4__namespace.boolean()),
|
|
1775
|
+
offers_available: z4__namespace.nullish(z4__namespace.boolean()),
|
|
1776
|
+
history_available: z4__namespace.nullish(z4__namespace.boolean())
|
|
1134
1777
|
}),
|
|
1135
|
-
z4__namespace.transform(
|
|
1778
|
+
z4__namespace.transform(
|
|
1779
|
+
(data) => ({
|
|
1780
|
+
missions: data.missions,
|
|
1781
|
+
available: flagOrNull(data.available),
|
|
1782
|
+
offersAvailable: flagOrNull(data.offersAvailable),
|
|
1783
|
+
historyAvailable: flagOrNull(data.historyAvailable)
|
|
1784
|
+
})
|
|
1785
|
+
)
|
|
1136
1786
|
)
|
|
1137
1787
|
);
|
|
1788
|
+
var MY_MISSIONS_ROUTE = { method: "GET", path: "/my/missions" };
|
|
1789
|
+
function getMineInputProblem(input) {
|
|
1790
|
+
if (input === void 0) return void 0;
|
|
1791
|
+
if (typeof input !== "object" || input === null || Array.isArray(input))
|
|
1792
|
+
return "missions.getMine: input must be an object { includeHistory? }.";
|
|
1793
|
+
const { includeHistory } = input;
|
|
1794
|
+
if (includeHistory !== void 0 && typeof includeHistory !== "boolean")
|
|
1795
|
+
return "missions.getMine: includeHistory must be a boolean.";
|
|
1796
|
+
return void 0;
|
|
1797
|
+
}
|
|
1138
1798
|
function createMissionsApi(transport) {
|
|
1139
1799
|
return {
|
|
1140
1800
|
list: (input, options) => {
|
|
@@ -1147,17 +1807,23 @@ function createMissionsApi(transport) {
|
|
|
1147
1807
|
perPage: input?.perPage,
|
|
1148
1808
|
perPageParam: "limit",
|
|
1149
1809
|
auth: "required",
|
|
1150
|
-
item:
|
|
1810
|
+
item: missionSchema2(),
|
|
1151
1811
|
options
|
|
1152
1812
|
});
|
|
1153
1813
|
},
|
|
1154
|
-
listMine: (_params, options) => transport.request({
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1814
|
+
listMine: (_params, options) => transport.request({ ...MY_MISSIONS_ROUTE, auth: "required", schema: userMissionsSchema(), options }),
|
|
1815
|
+
getMine: (input, options) => {
|
|
1816
|
+
const problem = getMineInputProblem(input);
|
|
1817
|
+
if (problem !== void 0) return rejectInput(transport, problem, MY_MISSIONS_ROUTE);
|
|
1818
|
+
return transport.request({
|
|
1819
|
+
...MY_MISSIONS_ROUTE,
|
|
1820
|
+
// The gateway only honors the literal `true`; `false` sends nothing (the same request as `listMine`).
|
|
1821
|
+
query: input?.includeHistory === true ? { include_history: "true" } : void 0,
|
|
1822
|
+
auth: "required",
|
|
1823
|
+
schema: myMissionsSchema(),
|
|
1824
|
+
options
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1161
1827
|
};
|
|
1162
1828
|
}
|
|
1163
1829
|
var DEFAULT_PER_PAGE = 20;
|
|
@@ -1267,7 +1933,7 @@ var referralSchema = () => z4__namespace.pipe(
|
|
|
1267
1933
|
})
|
|
1268
1934
|
)
|
|
1269
1935
|
);
|
|
1270
|
-
var
|
|
1936
|
+
var historySchema2 = /* @__PURE__ */ extension.lazy(
|
|
1271
1937
|
() => extension.wire({
|
|
1272
1938
|
referral_code: optionalText(),
|
|
1273
1939
|
referrals: nullableList(referralSchema()),
|
|
@@ -1293,7 +1959,7 @@ function createReferralsApi(transport) {
|
|
|
1293
1959
|
path: HISTORY_PATH,
|
|
1294
1960
|
query: { page: requestedPage, limit: requestedPerPage },
|
|
1295
1961
|
auth: "required",
|
|
1296
|
-
schema:
|
|
1962
|
+
schema: historySchema2(),
|
|
1297
1963
|
options
|
|
1298
1964
|
}).then(({ referralCode, referrals, pagination }) => {
|
|
1299
1965
|
const items = Array.isArray(referrals) ? referrals : [];
|
|
@@ -1362,6 +2028,7 @@ function createIgaming(client) {
|
|
|
1362
2028
|
const transport = extension__namespace.getExtensionTransport(client);
|
|
1363
2029
|
const igaming = {
|
|
1364
2030
|
casino: createCasinoApi(transport),
|
|
2031
|
+
club: createClubApi(transport),
|
|
1365
2032
|
bonus: createBonusApi(transport),
|
|
1366
2033
|
missions: createMissionsApi(transport),
|
|
1367
2034
|
loyalty: createLoyaltyApi(transport),
|
|
@@ -1377,9 +2044,13 @@ function createIgaming(client) {
|
|
|
1377
2044
|
});
|
|
1378
2045
|
}
|
|
1379
2046
|
extension__namespace.registerProductClient(igaming, client);
|
|
2047
|
+
Object.defineProperty(igaming, LOCALE, {
|
|
2048
|
+
value: () => typeof transport.getLocale === "function" ? transport.getLocale() : void 0
|
|
2049
|
+
});
|
|
1380
2050
|
return igaming;
|
|
1381
2051
|
}
|
|
1382
2052
|
|
|
1383
2053
|
exports.createIgaming = createIgaming;
|
|
2054
|
+
exports.keepsClubIdempotencyKey = keepsClubIdempotencyKey;
|
|
1384
2055
|
//# sourceMappingURL=index.cjs.map
|
|
1385
2056
|
//# sourceMappingURL=index.cjs.map
|