@getenginex/sdk-igaming 0.10.0 → 0.11.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 +43 -0
- package/README.md +4 -3
- package/dist/chunk-LMBQDSFV.js +620 -0
- package/dist/chunk-LMBQDSFV.js.map +1 -0
- package/dist/index.cjs +548 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +747 -1
- package/dist/index.d.ts +747 -1
- package/dist/index.js +285 -366
- package/dist/index.js.map +1 -1
- package/dist/query/index.cjs +44 -5
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +17 -2
- package/dist/query/index.d.ts +17 -2
- package/dist/query/index.js +32 -6
- package/dist/query/index.js.map +1 -1
- package/dist/testing/index.cjs +450 -12
- 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 +450 -12
- 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"))),
|
|
@@ -107,7 +108,7 @@ function count() {
|
|
|
107
108
|
return z4__namespace._default(z4__namespace.number(), 0);
|
|
108
109
|
}
|
|
109
110
|
function list(item) {
|
|
110
|
-
return
|
|
111
|
+
return nullableList(item);
|
|
111
112
|
}
|
|
112
113
|
function durationSeconds() {
|
|
113
114
|
return z4__namespace.pipe(
|
|
@@ -530,7 +531,8 @@ var promoCodeOfferSchema = /* @__PURE__ */ extension.lazy(
|
|
|
530
531
|
() => extension.wire({ offer: offerSchema2(), localized_content: localizedContent() })
|
|
531
532
|
);
|
|
532
533
|
function toCursorPage(key, data) {
|
|
533
|
-
const
|
|
534
|
+
const items = data[key];
|
|
535
|
+
const page = { items: Array.isArray(items) ? items : [] };
|
|
534
536
|
if (data.nextCursor) page.nextCursor = data.nextCursor;
|
|
535
537
|
return page;
|
|
536
538
|
}
|
|
@@ -634,17 +636,17 @@ function createBonusApi(transport) {
|
|
|
634
636
|
void 0,
|
|
635
637
|
options
|
|
636
638
|
),
|
|
637
|
-
resolvePromoCode: ({ code, locale }, options) => transport.request({
|
|
639
|
+
resolvePromoCode: ({ code: code2, locale }, options) => transport.request({
|
|
638
640
|
method: "POST",
|
|
639
641
|
path: "/bonus-campaigns/promo-codes/resolve",
|
|
640
|
-
body: { plaintext:
|
|
642
|
+
body: { plaintext: code2, locale },
|
|
641
643
|
auth: "required",
|
|
642
644
|
schema: promoCodeOfferSchema(),
|
|
643
645
|
options
|
|
644
646
|
}),
|
|
645
|
-
redeemPromoCode: ({ code, termsAcceptance }, options) => participationCall(
|
|
647
|
+
redeemPromoCode: ({ code: code2, termsAcceptance }, options) => participationCall(
|
|
646
648
|
"/bonus-campaigns/promo-codes/redeem",
|
|
647
|
-
{ plaintext:
|
|
649
|
+
{ plaintext: code2, terms_acceptance: terms(termsAcceptance) },
|
|
648
650
|
options
|
|
649
651
|
),
|
|
650
652
|
listParticipations: (input, options) => listPage(
|
|
@@ -676,9 +678,9 @@ function createBonusApi(transport) {
|
|
|
676
678
|
auth: "required",
|
|
677
679
|
schema: positionsPage(),
|
|
678
680
|
options
|
|
679
|
-
}).then(({ rows, nextCursor }) => {
|
|
681
|
+
}).then(({ rows, nextCursor: nextCursor2 }) => {
|
|
680
682
|
const page = { items: rows };
|
|
681
|
-
if (
|
|
683
|
+
if (nextCursor2) page.nextCursor = nextCursor2;
|
|
682
684
|
return page;
|
|
683
685
|
})
|
|
684
686
|
};
|
|
@@ -701,12 +703,12 @@ var gameSchema = /* @__PURE__ */ extension.lazy(
|
|
|
701
703
|
})
|
|
702
704
|
);
|
|
703
705
|
var categoriesSchema = /* @__PURE__ */ extension.lazy(
|
|
704
|
-
() =>
|
|
706
|
+
() => nullableList(
|
|
705
707
|
extension.wire({ slug: z4__namespace.string(), name: z4__namespace.string(), icon: z4__namespace.string(), game_count: z4__namespace.number(), priority: z4__namespace.number() })
|
|
706
708
|
)
|
|
707
709
|
);
|
|
708
710
|
var providersSchema = /* @__PURE__ */ extension.lazy(
|
|
709
|
-
() =>
|
|
711
|
+
() => nullableList(extension.wire({ id: z4__namespace.string(), name: z4__namespace.string(), game_count: z4__namespace.number() }))
|
|
710
712
|
);
|
|
711
713
|
var launchSchema = /* @__PURE__ */ extension.lazy(
|
|
712
714
|
() => z4__namespace.pipe(
|
|
@@ -749,7 +751,7 @@ var transactionSchema = /* @__PURE__ */ extension.lazy(
|
|
|
749
751
|
})
|
|
750
752
|
);
|
|
751
753
|
var winnersSchema = /* @__PURE__ */ extension.lazy(
|
|
752
|
-
() =>
|
|
754
|
+
() => nullableList(
|
|
753
755
|
extension.wire({
|
|
754
756
|
player: z4__namespace.string(),
|
|
755
757
|
amount: minorUnits(),
|
|
@@ -980,6 +982,527 @@ function createCasinoApi(transport) {
|
|
|
980
982
|
}
|
|
981
983
|
};
|
|
982
984
|
}
|
|
985
|
+
function keepsClubIdempotencyKey(error) {
|
|
986
|
+
if (!sdk.isEnginexError(error)) return false;
|
|
987
|
+
if (extension.isAmbiguousFailure(error)) return true;
|
|
988
|
+
return error.status >= 400 && !DEFINITIVE_CLUB_STATUS.has(error.status);
|
|
989
|
+
}
|
|
990
|
+
var DEFINITIVE_CLUB_STATUS = /* @__PURE__ */ new Set([400, 403, 404, 422]);
|
|
991
|
+
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})$/;
|
|
992
|
+
var ISO_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
993
|
+
var DECIMAL = /^(?:0|[1-9]\d{0,19})(?:\.\d{1,20})?$/;
|
|
994
|
+
var EXTERNAL_EDITION = /^ext_[A-Za-z0-9_-]+$/;
|
|
995
|
+
var GO_ZERO_TIME = /^0001-01-01T00:00:00(?:\.0+)?(?:Z|[+-]00:00)$/;
|
|
996
|
+
var time = () => z4__namespace.pipe(
|
|
997
|
+
z4__namespace.nullish(
|
|
998
|
+
z4__namespace.string().check(
|
|
999
|
+
z4__namespace.refine(
|
|
1000
|
+
(value) => value === "" || ISO_DATE_TIME.test(value) && !Number.isNaN(Date.parse(value)),
|
|
1001
|
+
"Expected an ISO 8601 date-time"
|
|
1002
|
+
)
|
|
1003
|
+
)
|
|
1004
|
+
),
|
|
1005
|
+
z4__namespace.transform(
|
|
1006
|
+
(value) => value == null || value === "" || Date.parse(value) === 0 || GO_ZERO_TIME.test(value) ? null : value
|
|
1007
|
+
)
|
|
1008
|
+
);
|
|
1009
|
+
var flag = () => z4__namespace._default(z4__namespace.boolean(), false);
|
|
1010
|
+
var textOrEmpty = () => z4__namespace._default(z4__namespace.string(), "");
|
|
1011
|
+
var id = () => z4__namespace.string().check(z4__namespace.minLength(1, "Expected a non-empty id"));
|
|
1012
|
+
var localized = () => extension.mapOf(z4__namespace.string());
|
|
1013
|
+
var units = () => z4__namespace._default(integerText(), 0);
|
|
1014
|
+
var int32 = () => z4__namespace._default(z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value), "Expected an integer")), 0);
|
|
1015
|
+
var rank = () => z4__namespace.number().check(z4__namespace.refine((value) => Number.isSafeInteger(value) && value >= 1, "Expected an integer \u2265 1"));
|
|
1016
|
+
var code = () => z4__namespace.pipe(
|
|
1017
|
+
protoEnum(""),
|
|
1018
|
+
z4__namespace.transform((value) => value === "" ? "unspecified" : value)
|
|
1019
|
+
);
|
|
1020
|
+
var optionalCode = () => z4__namespace.pipe(
|
|
1021
|
+
z4__namespace.nullish(z4__namespace.string()),
|
|
1022
|
+
z4__namespace.transform((value) => value ? value.toLowerCase() : null)
|
|
1023
|
+
);
|
|
1024
|
+
var nullable = (schema) => z4__namespace.pipe(
|
|
1025
|
+
z4__namespace.nullish(schema),
|
|
1026
|
+
z4__namespace.transform((value) => value ?? null)
|
|
1027
|
+
);
|
|
1028
|
+
function uniqueList(item, key) {
|
|
1029
|
+
return z4__namespace.pipe(
|
|
1030
|
+
nullableList(item),
|
|
1031
|
+
z4__namespace.transform((items) => {
|
|
1032
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1033
|
+
return items.filter((value) => {
|
|
1034
|
+
const k = typeof value === "object" && value !== null ? safeKey(() => key(value)) : String(value);
|
|
1035
|
+
if (k === void 0 || seen.has(k)) return false;
|
|
1036
|
+
seen.add(k);
|
|
1037
|
+
return true;
|
|
1038
|
+
});
|
|
1039
|
+
})
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
function safeKey(read) {
|
|
1043
|
+
try {
|
|
1044
|
+
const value = read();
|
|
1045
|
+
return typeof value === "string" && value !== "" ? value : void 0;
|
|
1046
|
+
} catch {
|
|
1047
|
+
return void 0;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
var moneySchema = /* @__PURE__ */ extension.lazy(
|
|
1051
|
+
() => z4__namespace.pipe(
|
|
1052
|
+
extension.wire({
|
|
1053
|
+
currency: extension.currencyCode(),
|
|
1054
|
+
amountMinor: nonNegativeMinorUnits(),
|
|
1055
|
+
decimalPlaces: z4__namespace.optional(extension.decimalPlaces())
|
|
1056
|
+
}),
|
|
1057
|
+
z4__namespace.transform(
|
|
1058
|
+
(m) => ({ amount: m.amountMinor, currency: m.currency, decimalPlaces: m.decimalPlaces ?? null })
|
|
1059
|
+
)
|
|
1060
|
+
)
|
|
1061
|
+
);
|
|
1062
|
+
var alternateSchema = /* @__PURE__ */ extension.lazy(
|
|
1063
|
+
() => extension.wire({ kind: code(), label: localized(), quantity: units() })
|
|
1064
|
+
);
|
|
1065
|
+
var rewardSchema = /* @__PURE__ */ extension.lazy(
|
|
1066
|
+
() => extension.wire({
|
|
1067
|
+
id: textOrEmpty(),
|
|
1068
|
+
label: localized(),
|
|
1069
|
+
kind: code(),
|
|
1070
|
+
quantity: units(),
|
|
1071
|
+
money: nullable(moneySchema()),
|
|
1072
|
+
campaign: nullable(extension.wire({ spins: units(), gameId: optionalText() })),
|
|
1073
|
+
cashback: nullable(
|
|
1074
|
+
extension.wire({
|
|
1075
|
+
percentageBps: int32(),
|
|
1076
|
+
period: optionalCode(),
|
|
1077
|
+
basis: optionalCode(),
|
|
1078
|
+
destination: optionalCode(),
|
|
1079
|
+
startsAt: time(),
|
|
1080
|
+
endsAt: time(),
|
|
1081
|
+
gameIds: uniqueList(z4__namespace.string(), String),
|
|
1082
|
+
zeroBasisAlternate: nullable(alternateSchema()),
|
|
1083
|
+
priorAwardAlternate: nullable(alternateSchema())
|
|
1084
|
+
})
|
|
1085
|
+
),
|
|
1086
|
+
manual: nullable(extension.wire({ deliveryType: optionalCode(), instructions: localized() })),
|
|
1087
|
+
ttlSeconds: units(),
|
|
1088
|
+
editionId: optionalText(),
|
|
1089
|
+
ticketOwnedAlternate: nullable(alternateSchema())
|
|
1090
|
+
})
|
|
1091
|
+
);
|
|
1092
|
+
var receiptSchema = /* @__PURE__ */ extension.lazy(
|
|
1093
|
+
() => extension.wire({
|
|
1094
|
+
id: id(),
|
|
1095
|
+
status: code(),
|
|
1096
|
+
sourceKind: code(),
|
|
1097
|
+
sourceId: optionalText(),
|
|
1098
|
+
sliceId: optionalText(),
|
|
1099
|
+
reward: nullable(rewardSchema()),
|
|
1100
|
+
settlement: nullable(moneySchema()),
|
|
1101
|
+
costCoins: units(),
|
|
1102
|
+
acceptedAt: time(),
|
|
1103
|
+
deliveredAt: time(),
|
|
1104
|
+
expiresAt: time(),
|
|
1105
|
+
tournamentRank: nullable(rank()),
|
|
1106
|
+
ticketConsumed: flag()
|
|
1107
|
+
})
|
|
1108
|
+
);
|
|
1109
|
+
var levelSchema = () => extension.wire({ id: id(), name: localized(), minXp: units(), benefit: localized() });
|
|
1110
|
+
var programSchema = /* @__PURE__ */ extension.lazy(
|
|
1111
|
+
() => extension.wire({
|
|
1112
|
+
enabled: flag(),
|
|
1113
|
+
joined: flag(),
|
|
1114
|
+
membershipRequired: flag(),
|
|
1115
|
+
canJoin: flag(),
|
|
1116
|
+
historyAvailable: flag(),
|
|
1117
|
+
versionId: optionalText(),
|
|
1118
|
+
locale: optionalText(),
|
|
1119
|
+
termsLocale: optionalText(),
|
|
1120
|
+
timeZone: optionalText(),
|
|
1121
|
+
currency: z4__namespace.pipe(
|
|
1122
|
+
z4__namespace._default(currencyOrEmpty(), ""),
|
|
1123
|
+
z4__namespace.transform((value) => value || null)
|
|
1124
|
+
),
|
|
1125
|
+
name: localized(),
|
|
1126
|
+
terms: localized(),
|
|
1127
|
+
coinName: localized(),
|
|
1128
|
+
coverUrl: optionalText(),
|
|
1129
|
+
levels: uniqueList(levelSchema(), (level) => level.id)
|
|
1130
|
+
})
|
|
1131
|
+
);
|
|
1132
|
+
var activitySchema = () => extension.wire({
|
|
1133
|
+
activity: extension.wire({
|
|
1134
|
+
id: id(),
|
|
1135
|
+
kind: code(),
|
|
1136
|
+
name: localized(),
|
|
1137
|
+
terms: localized(),
|
|
1138
|
+
coverUrl: optionalText(),
|
|
1139
|
+
wheelTheme: optionalCode(),
|
|
1140
|
+
playLabel: localized(),
|
|
1141
|
+
slices: uniqueList(extension.wire({ id: id(), reward: nullable(rewardSchema()) }), (slice) => slice.id)
|
|
1142
|
+
}),
|
|
1143
|
+
canPlay: flag(),
|
|
1144
|
+
unavailableReason: optionalCode(),
|
|
1145
|
+
latestReceipt: nullable(receiptSchema()),
|
|
1146
|
+
availableAt: time()
|
|
1147
|
+
});
|
|
1148
|
+
var missionSchema = () => extension.wire({
|
|
1149
|
+
mission: extension.wire({
|
|
1150
|
+
id: id(),
|
|
1151
|
+
title: localized(),
|
|
1152
|
+
terms: localized(),
|
|
1153
|
+
recurrence: code(),
|
|
1154
|
+
countBy: code(),
|
|
1155
|
+
target: units(),
|
|
1156
|
+
coverUrl: optionalText()
|
|
1157
|
+
}),
|
|
1158
|
+
editionId: optionalText(),
|
|
1159
|
+
progress: units(),
|
|
1160
|
+
rightId: optionalText(),
|
|
1161
|
+
rightVersionId: optionalText(),
|
|
1162
|
+
chestOptions: nullableList(rewardSchema()),
|
|
1163
|
+
canClaim: flag(),
|
|
1164
|
+
receipt: nullable(receiptSchema()),
|
|
1165
|
+
endsAt: time(),
|
|
1166
|
+
claimExpiresAt: time(),
|
|
1167
|
+
stampedDays: uniqueList(
|
|
1168
|
+
z4__namespace.string().check(
|
|
1169
|
+
z4__namespace.refine((value) => ISO_DAY.test(value) && !Number.isNaN(Date.parse(value)), "Expected a YYYY-MM-DD day")
|
|
1170
|
+
),
|
|
1171
|
+
String
|
|
1172
|
+
)
|
|
1173
|
+
});
|
|
1174
|
+
var storeItemSchema = () => extension.wire({
|
|
1175
|
+
item: extension.wire({
|
|
1176
|
+
id: id(),
|
|
1177
|
+
label: localized(),
|
|
1178
|
+
terms: localized(),
|
|
1179
|
+
costCoins: units(),
|
|
1180
|
+
reward: nullable(rewardSchema()),
|
|
1181
|
+
coverUrl: optionalText()
|
|
1182
|
+
}),
|
|
1183
|
+
canRedeem: flag(),
|
|
1184
|
+
unavailableReason: optionalCode()
|
|
1185
|
+
});
|
|
1186
|
+
var rewardsSchema = /* @__PURE__ */ extension.lazy(
|
|
1187
|
+
() => extension.wire({
|
|
1188
|
+
xp: units(),
|
|
1189
|
+
coins: units(),
|
|
1190
|
+
levelId: optionalText(),
|
|
1191
|
+
activities: uniqueList(activitySchema(), (state) => state.activity.id),
|
|
1192
|
+
// The same mission may hold several rights (one per period): a repeat is the same mission, right and period.
|
|
1193
|
+
missions: uniqueList(
|
|
1194
|
+
missionSchema(),
|
|
1195
|
+
(state) => typeof state.mission.id === "string" ? JSON.stringify([state.mission.id, state.rightId ?? state.editionId, state.endsAt]) : void 0
|
|
1196
|
+
),
|
|
1197
|
+
storeItems: uniqueList(storeItemSchema(), (state) => state.item.id)
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
1200
|
+
var overviewSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1201
|
+
() => extension.wire({ program: programSchema(), rewards: nullable(rewardsSchema()) })
|
|
1202
|
+
);
|
|
1203
|
+
var nextCursor = () => z4__namespace.pipe(
|
|
1204
|
+
optionalText(),
|
|
1205
|
+
z4__namespace.transform((value) => value ?? void 0)
|
|
1206
|
+
);
|
|
1207
|
+
function compactCursor(page) {
|
|
1208
|
+
if (page.nextCursor === void 0) delete page.nextCursor;
|
|
1209
|
+
return page;
|
|
1210
|
+
}
|
|
1211
|
+
var historySchema = /* @__PURE__ */ extension.lazy(
|
|
1212
|
+
() => z4__namespace.pipe(
|
|
1213
|
+
extension.wire({
|
|
1214
|
+
receipts: uniqueList(receiptSchema(), (receipt) => receipt.id),
|
|
1215
|
+
movements: uniqueList(
|
|
1216
|
+
extension.wire({ id: id(), kind: code(), units: units(), sourceId: optionalText(), occurredAt: time() }),
|
|
1217
|
+
(movement) => movement.id
|
|
1218
|
+
),
|
|
1219
|
+
nextCursor: nextCursor()
|
|
1220
|
+
}),
|
|
1221
|
+
z4__namespace.transform(compactCursor)
|
|
1222
|
+
)
|
|
1223
|
+
);
|
|
1224
|
+
var registrationSchema = /* @__PURE__ */ extension.lazy(
|
|
1225
|
+
() => extension.wire({ id: id(), editionId: id(), versionId: optionalText(), joinedAt: time() })
|
|
1226
|
+
);
|
|
1227
|
+
var isMinorUnits = (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0 || typeof v === "string" && /^\d+$/.test(v) && Number.isSafeInteger(Number(v));
|
|
1228
|
+
var announcedMoney = () => z4__namespace.pipe(
|
|
1229
|
+
extension.wire({
|
|
1230
|
+
currency: z4__namespace.string().check(z4__namespace.regex(/^[A-Z]{3}$/, "Expected a currency code, e.g. BRL")),
|
|
1231
|
+
amountMinor: z4__namespace.union([z4__namespace.string(), z4__namespace.number()]).check(z4__namespace.refine(isMinorUnits, "Expected non-negative minor units")),
|
|
1232
|
+
decimalPlaces: z4__namespace.optional(
|
|
1233
|
+
z4__namespace.number().check(z4__namespace.refine((v) => Number.isInteger(v) && v >= 0 && v <= 8, "Expected decimal places 0 to 8"))
|
|
1234
|
+
)
|
|
1235
|
+
}),
|
|
1236
|
+
// In `'warn'` the amount may come in raw: only an exact non-negative integer becomes `amount`; anything else stays
|
|
1237
|
+
// as it came, so `hasValidAnnouncedAmount` drops the prize (never `Number('1e3')`, never a rounded value).
|
|
1238
|
+
z4__namespace.transform(
|
|
1239
|
+
(m) => ({
|
|
1240
|
+
amount: isMinorUnits(m.amountMinor) ? Number(m.amountMinor) || 0 : m.amountMinor,
|
|
1241
|
+
currency: m.currency,
|
|
1242
|
+
decimalPlaces: m.decimalPlaces ?? null
|
|
1243
|
+
})
|
|
1244
|
+
)
|
|
1245
|
+
);
|
|
1246
|
+
var prizeSchema = () => extension.wire({
|
|
1247
|
+
fromRank: int32(),
|
|
1248
|
+
toRank: int32(),
|
|
1249
|
+
reward: nullable(rewardSchema()),
|
|
1250
|
+
announcedAmount: nullable(announcedMoney()),
|
|
1251
|
+
terms: localized(),
|
|
1252
|
+
offerTerms: nullable(
|
|
1253
|
+
extension.wire({
|
|
1254
|
+
spinDenomination: nullable(moneySchema()),
|
|
1255
|
+
wageringMultiplier: nullable(z4__namespace.string().check(z4__namespace.regex(DECIMAL, "Expected an exact decimal"))),
|
|
1256
|
+
validForSeconds: nullable(integerText()),
|
|
1257
|
+
expiresAt: time(),
|
|
1258
|
+
grantEndsAt: time()
|
|
1259
|
+
})
|
|
1260
|
+
)
|
|
1261
|
+
});
|
|
1262
|
+
function hasValidAnnouncedAmount(prize) {
|
|
1263
|
+
const amount = prize.announcedAmount;
|
|
1264
|
+
if (amount === null) return true;
|
|
1265
|
+
if (typeof amount !== "object") return false;
|
|
1266
|
+
const { amount: value, currency } = amount;
|
|
1267
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 && typeof currency === "string" && /^[A-Z]{3}$/.test(currency);
|
|
1268
|
+
}
|
|
1269
|
+
var tournamentSchema = /* @__PURE__ */ extension.lazy(
|
|
1270
|
+
() => extension.wire({
|
|
1271
|
+
id: id(),
|
|
1272
|
+
source: code(),
|
|
1273
|
+
versionId: optionalText(),
|
|
1274
|
+
title: localized(),
|
|
1275
|
+
terms: localized(),
|
|
1276
|
+
status: code(),
|
|
1277
|
+
startsAt: time(),
|
|
1278
|
+
endsAt: time(),
|
|
1279
|
+
updatedAt: time(),
|
|
1280
|
+
scoringRule: optionalCode(),
|
|
1281
|
+
tieBreak: optionalCode(),
|
|
1282
|
+
currency: z4__namespace.pipe(
|
|
1283
|
+
z4__namespace._default(currencyOrEmpty(), ""),
|
|
1284
|
+
z4__namespace.transform((value) => value || null)
|
|
1285
|
+
),
|
|
1286
|
+
timeZone: optionalText(),
|
|
1287
|
+
gameIds: uniqueList(z4__namespace.string(), String),
|
|
1288
|
+
// An announced amount (an external listing) is display data, not a prize the player wins: one outside the
|
|
1289
|
+
// format (negative, a fraction, ≥ 2^53, a bad currency) fails without the strict mark, so `'warn'` reports it
|
|
1290
|
+
// and drops that prize instead of failing the whole page. Strict mode still rejects it.
|
|
1291
|
+
prizes: z4__namespace.pipe(
|
|
1292
|
+
nullableList(prizeSchema()),
|
|
1293
|
+
z4__namespace.transform((prizes) => prizes.filter(hasValidAnnouncedAmount))
|
|
1294
|
+
),
|
|
1295
|
+
joinMode: optionalCode(),
|
|
1296
|
+
locale: optionalText(),
|
|
1297
|
+
rankingAvailable: flag(),
|
|
1298
|
+
canRegister: flag(),
|
|
1299
|
+
requiresTicket: flag(),
|
|
1300
|
+
registration: nullable(registrationSchema()),
|
|
1301
|
+
personalAward: nullable(receiptSchema()),
|
|
1302
|
+
stale: flag(),
|
|
1303
|
+
registrationStartsAt: time(),
|
|
1304
|
+
registrationEndsAt: time(),
|
|
1305
|
+
coverUrl: optionalText()
|
|
1306
|
+
})
|
|
1307
|
+
);
|
|
1308
|
+
var tournamentPageSchema = /* @__PURE__ */ extension.lazy(
|
|
1309
|
+
() => z4__namespace.pipe(
|
|
1310
|
+
extension.wire({
|
|
1311
|
+
items: uniqueList(tournamentSchema(), (tournament) => tournament.id),
|
|
1312
|
+
externalAvailable: flag(),
|
|
1313
|
+
externalStale: flag(),
|
|
1314
|
+
nextCursor: nextCursor()
|
|
1315
|
+
}),
|
|
1316
|
+
z4__namespace.transform(compactCursor)
|
|
1317
|
+
)
|
|
1318
|
+
);
|
|
1319
|
+
var relatedPageSchema = /* @__PURE__ */ extension.lazy(
|
|
1320
|
+
() => extension.wire({
|
|
1321
|
+
relatedTo: textOrEmpty(),
|
|
1322
|
+
items: uniqueList(
|
|
1323
|
+
extension.wire({
|
|
1324
|
+
id: z4__namespace.string().check(z4__namespace.regex(EXTERNAL_EDITION, "Expected an external edition id")),
|
|
1325
|
+
title: localized(),
|
|
1326
|
+
status: code(),
|
|
1327
|
+
startsAt: time(),
|
|
1328
|
+
endsAt: time()
|
|
1329
|
+
}),
|
|
1330
|
+
(item) => item.id
|
|
1331
|
+
),
|
|
1332
|
+
nextCursor: nextCursor()
|
|
1333
|
+
})
|
|
1334
|
+
);
|
|
1335
|
+
var rankSchema = () => extension.wire({ position: rank(), displayName: textOrEmpty(), score: textOrEmpty() });
|
|
1336
|
+
var rankingSchema = /* @__PURE__ */ extension.lazy(
|
|
1337
|
+
() => extension.wire({ entries: nullableList(rankSchema()), personal: nullable(rankSchema()), updatedAt: time(), final: flag() })
|
|
1338
|
+
);
|
|
1339
|
+
var playSchema = /* @__PURE__ */ extension.lazy(
|
|
1340
|
+
() => extension.wire({ receipt: receiptSchema(), sliceId: optionalText(), rewards: nullable(rewardsSchema()) })
|
|
1341
|
+
);
|
|
1342
|
+
var BASE = "/casino/club";
|
|
1343
|
+
var MAX_ID = 128;
|
|
1344
|
+
var MAX_IDEMPOTENCY_KEY2 = 128;
|
|
1345
|
+
var ROUTES = {
|
|
1346
|
+
overview: { method: "GET", path: BASE },
|
|
1347
|
+
history: { method: "GET", path: `${BASE}/history` },
|
|
1348
|
+
tournaments: { method: "GET", path: `${BASE}/tournaments` },
|
|
1349
|
+
tournament: { method: "GET", path: `${BASE}/tournaments/{editionId}` },
|
|
1350
|
+
ranking: { method: "GET", path: `${BASE}/tournaments/{editionId}/ranking` },
|
|
1351
|
+
membership: { method: "PUT", path: `${BASE}/membership` },
|
|
1352
|
+
play: { method: "POST", path: `${BASE}/activities/{activityId}/plays` },
|
|
1353
|
+
redeem: { method: "POST", path: `${BASE}/rewards/{rewardId}/redemptions` },
|
|
1354
|
+
register: { method: "POST", path: `${BASE}/tournaments/{editionId}/registrations` }
|
|
1355
|
+
};
|
|
1356
|
+
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1357
|
+
function utf8Length(value) {
|
|
1358
|
+
return new TextEncoder().encode(value).length;
|
|
1359
|
+
}
|
|
1360
|
+
function idProblem(name, field, value) {
|
|
1361
|
+
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.`;
|
|
1362
|
+
}
|
|
1363
|
+
function optionalTextProblem(name, field, value) {
|
|
1364
|
+
return value === void 0 || typeof value === "string" ? void 0 : `${name}: ${field} must be text.`;
|
|
1365
|
+
}
|
|
1366
|
+
function limitProblem(name, value) {
|
|
1367
|
+
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.`;
|
|
1368
|
+
}
|
|
1369
|
+
function cursorProblem(name, input) {
|
|
1370
|
+
if (input === void 0) return void 0;
|
|
1371
|
+
if (!isObject(input)) return `${name}: input must be an object.`;
|
|
1372
|
+
return optionalTextProblem(name, "cursor", input.cursor) ?? limitProblem(name, input.limit);
|
|
1373
|
+
}
|
|
1374
|
+
function keyProblem(name, options) {
|
|
1375
|
+
const key = options?.idempotencyKey;
|
|
1376
|
+
if (key === void 0 || key === "") return void 0;
|
|
1377
|
+
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.`;
|
|
1378
|
+
}
|
|
1379
|
+
function membershipProblem(input) {
|
|
1380
|
+
const name = "club.setMembership";
|
|
1381
|
+
if (!isObject(input)) return `${name}: input must be { versionId, joined, termsLocale? }.`;
|
|
1382
|
+
if (typeof input.joined !== "boolean") return `${name}: joined must be true or false.`;
|
|
1383
|
+
const versionProblem = idProblem(name, "versionId", input.versionId);
|
|
1384
|
+
if (versionProblem) return versionProblem;
|
|
1385
|
+
if (input.joined && (typeof input.termsLocale !== "string" || input.termsLocale.trim() === ""))
|
|
1386
|
+
return `${name}: termsLocale must be non-empty text when joining.`;
|
|
1387
|
+
return void 0;
|
|
1388
|
+
}
|
|
1389
|
+
var segment = (value) => encodeURIComponent(value);
|
|
1390
|
+
function requireObject(transport, route, field) {
|
|
1391
|
+
return (value) => {
|
|
1392
|
+
if (isObject(value[field])) return value;
|
|
1393
|
+
throw transport.reportError(
|
|
1394
|
+
{
|
|
1395
|
+
code: "VALIDATION_ERROR",
|
|
1396
|
+
message: `Unexpected gateway response on ${route.method} ${route.path}: ${field}`,
|
|
1397
|
+
status: 200
|
|
1398
|
+
},
|
|
1399
|
+
route
|
|
1400
|
+
);
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
function createClubApi(transport) {
|
|
1404
|
+
const get = (path, query, schema, options) => transport.request({ method: "GET", path, query, auth: "required", schema, options });
|
|
1405
|
+
const write = (method, path, body, schema, options) => (
|
|
1406
|
+
// The key goes only in the `Idempotency-Key` header: the gateway reads it from there when the body has none
|
|
1407
|
+
// (a body key that differed from the header would be refused).
|
|
1408
|
+
transport.request({ method, path, body, auth: "required", idempotent: true, schema, options })
|
|
1409
|
+
);
|
|
1410
|
+
return {
|
|
1411
|
+
getOverview: (_params, options) => get(BASE, {}, overviewSchema2(), options).then(requireObject(transport, ROUTES.overview, "program")),
|
|
1412
|
+
listHistory: (input, options) => {
|
|
1413
|
+
const problem = cursorProblem("club.listHistory", input);
|
|
1414
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.history);
|
|
1415
|
+
return get(
|
|
1416
|
+
ROUTES.history.path,
|
|
1417
|
+
{ cursor: input?.cursor || void 0, limit: input?.limit },
|
|
1418
|
+
historySchema(),
|
|
1419
|
+
options
|
|
1420
|
+
);
|
|
1421
|
+
},
|
|
1422
|
+
listTournaments: (input, options) => {
|
|
1423
|
+
const problem = cursorProblem("club.listTournaments", input);
|
|
1424
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournaments);
|
|
1425
|
+
return get(
|
|
1426
|
+
ROUTES.tournaments.path,
|
|
1427
|
+
{ cursor: input?.cursor || void 0, limit: input?.limit },
|
|
1428
|
+
tournamentPageSchema(),
|
|
1429
|
+
options
|
|
1430
|
+
);
|
|
1431
|
+
},
|
|
1432
|
+
listRelatedTournaments: (input, options) => {
|
|
1433
|
+
const name = "club.listRelatedTournaments";
|
|
1434
|
+
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);
|
|
1435
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournaments);
|
|
1436
|
+
return get(
|
|
1437
|
+
ROUTES.tournaments.path,
|
|
1438
|
+
{ relatedTo: input.editionId, cursor: input.cursor || void 0, limit: input.limit },
|
|
1439
|
+
relatedPageSchema(),
|
|
1440
|
+
options
|
|
1441
|
+
).then(({ relatedTo, items, nextCursor: cursor }) => {
|
|
1442
|
+
if (relatedTo !== input.editionId) return { items: [] };
|
|
1443
|
+
return cursor === void 0 ? { items } : { items, nextCursor: cursor };
|
|
1444
|
+
});
|
|
1445
|
+
},
|
|
1446
|
+
getTournament: (input, options) => {
|
|
1447
|
+
const problem = idProblem("club.getTournament", "editionId", isObject(input) ? input.editionId : void 0);
|
|
1448
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.tournament);
|
|
1449
|
+
return get(`${BASE}/tournaments/${segment(input.editionId)}`, {}, tournamentSchema(), options);
|
|
1450
|
+
},
|
|
1451
|
+
getRanking: (input, options) => {
|
|
1452
|
+
const name = "club.getRanking";
|
|
1453
|
+
const problem = isObject(input) ? idProblem(name, "editionId", input.editionId) ?? limitProblem(name, input.limit) : `${name}: input must be { editionId }.`;
|
|
1454
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.ranking);
|
|
1455
|
+
return get(
|
|
1456
|
+
`${BASE}/tournaments/${segment(input.editionId)}/ranking`,
|
|
1457
|
+
{ limit: input.limit },
|
|
1458
|
+
rankingSchema(),
|
|
1459
|
+
options
|
|
1460
|
+
);
|
|
1461
|
+
},
|
|
1462
|
+
setMembership: (input, options) => {
|
|
1463
|
+
const problem = membershipProblem(input) ?? keyProblem("club.setMembership", options);
|
|
1464
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.membership);
|
|
1465
|
+
const body = input.joined ? { versionId: input.versionId, joined: true, termsLocale: input.termsLocale } : { versionId: input.versionId, joined: false };
|
|
1466
|
+
return write("PUT", ROUTES.membership.path, body, programSchema(), options);
|
|
1467
|
+
},
|
|
1468
|
+
play: (input, options) => {
|
|
1469
|
+
const name = "club.play";
|
|
1470
|
+
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? }.`;
|
|
1471
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.play);
|
|
1472
|
+
const body = { versionId: input.versionId };
|
|
1473
|
+
if (input.optionId) body.optionId = input.optionId;
|
|
1474
|
+
return write("POST", `${BASE}/activities/${segment(input.activityId)}/plays`, body, playSchema(), options).then(
|
|
1475
|
+
requireObject(transport, ROUTES.play, "receipt")
|
|
1476
|
+
);
|
|
1477
|
+
},
|
|
1478
|
+
redeem: (input, options) => {
|
|
1479
|
+
const name = "club.redeem";
|
|
1480
|
+
const problem = isObject(input) ? idProblem(name, "rewardId", input.rewardId) ?? idProblem(name, "versionId", input.versionId) ?? keyProblem(name, options) : `${name}: input must be { rewardId, versionId }.`;
|
|
1481
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.redeem);
|
|
1482
|
+
return write(
|
|
1483
|
+
"POST",
|
|
1484
|
+
`${BASE}/rewards/${segment(input.rewardId)}/redemptions`,
|
|
1485
|
+
{ versionId: input.versionId },
|
|
1486
|
+
receiptSchema(),
|
|
1487
|
+
options
|
|
1488
|
+
);
|
|
1489
|
+
},
|
|
1490
|
+
registerForTournament: (input, options) => {
|
|
1491
|
+
const name = "club.registerForTournament";
|
|
1492
|
+
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? }.`;
|
|
1493
|
+
if (problem !== void 0) return rejectInput(transport, problem, ROUTES.register);
|
|
1494
|
+
const body = { versionId: input.versionId };
|
|
1495
|
+
if (input.ticketId) body.ticketId = input.ticketId;
|
|
1496
|
+
return write(
|
|
1497
|
+
"POST",
|
|
1498
|
+
`${BASE}/tournaments/${segment(input.editionId)}/registrations`,
|
|
1499
|
+
body,
|
|
1500
|
+
registrationSchema(),
|
|
1501
|
+
options
|
|
1502
|
+
);
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
}
|
|
983
1506
|
var ParsedBenefits = class {
|
|
984
1507
|
constructor(value) {
|
|
985
1508
|
this.value = value;
|
|
@@ -1096,7 +1619,7 @@ var MISSION_TYPES = ["daily", "weekly", "event", "permanent"];
|
|
|
1096
1619
|
var OBJECTIVE_TYPES = ["wager", "bet_count", "win_amount", "play_game", "deposit"];
|
|
1097
1620
|
var REWARD_TYPES = ["bonus", "free_spins", "points", "free_bet"];
|
|
1098
1621
|
var USER_MISSION_STATUSES = ["in_progress", "completed", "expired", "claimed"];
|
|
1099
|
-
var
|
|
1622
|
+
var missionSchema2 = /* @__PURE__ */ extension.lazy(
|
|
1100
1623
|
() => extension.wire({
|
|
1101
1624
|
id: z4__namespace.string(),
|
|
1102
1625
|
name: z4__namespace.string(),
|
|
@@ -1146,7 +1669,7 @@ function createMissionsApi(transport) {
|
|
|
1146
1669
|
perPage: input?.perPage,
|
|
1147
1670
|
perPageParam: "limit",
|
|
1148
1671
|
auth: "required",
|
|
1149
|
-
item:
|
|
1672
|
+
item: missionSchema2(),
|
|
1150
1673
|
options
|
|
1151
1674
|
});
|
|
1152
1675
|
},
|
|
@@ -1266,11 +1789,15 @@ var referralSchema = () => z4__namespace.pipe(
|
|
|
1266
1789
|
})
|
|
1267
1790
|
)
|
|
1268
1791
|
);
|
|
1269
|
-
var
|
|
1792
|
+
var historySchema2 = /* @__PURE__ */ extension.lazy(
|
|
1270
1793
|
() => extension.wire({
|
|
1271
1794
|
referral_code: optionalText(),
|
|
1272
1795
|
referrals: nullableList(referralSchema()),
|
|
1273
|
-
|
|
1796
|
+
// A nil pointer (`null`) reads as absent, like an omitted pagination.
|
|
1797
|
+
pagination: z4__namespace.pipe(
|
|
1798
|
+
z4__namespace.nullish(extension.wire({ page: count2(), limit: count2(), total_items: count2() })),
|
|
1799
|
+
z4__namespace.transform((value) => value ?? void 0)
|
|
1800
|
+
)
|
|
1274
1801
|
})
|
|
1275
1802
|
);
|
|
1276
1803
|
var positiveInt = (value, fallback) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 ? value : fallback;
|
|
@@ -1288,7 +1815,7 @@ function createReferralsApi(transport) {
|
|
|
1288
1815
|
path: HISTORY_PATH,
|
|
1289
1816
|
query: { page: requestedPage, limit: requestedPerPage },
|
|
1290
1817
|
auth: "required",
|
|
1291
|
-
schema:
|
|
1818
|
+
schema: historySchema2(),
|
|
1292
1819
|
options
|
|
1293
1820
|
}).then(({ referralCode, referrals, pagination }) => {
|
|
1294
1821
|
const items = Array.isArray(referrals) ? referrals : [];
|
|
@@ -1357,6 +1884,7 @@ function createIgaming(client) {
|
|
|
1357
1884
|
const transport = extension__namespace.getExtensionTransport(client);
|
|
1358
1885
|
const igaming = {
|
|
1359
1886
|
casino: createCasinoApi(transport),
|
|
1887
|
+
club: createClubApi(transport),
|
|
1360
1888
|
bonus: createBonusApi(transport),
|
|
1361
1889
|
missions: createMissionsApi(transport),
|
|
1362
1890
|
loyalty: createLoyaltyApi(transport),
|
|
@@ -1372,9 +1900,13 @@ function createIgaming(client) {
|
|
|
1372
1900
|
});
|
|
1373
1901
|
}
|
|
1374
1902
|
extension__namespace.registerProductClient(igaming, client);
|
|
1903
|
+
Object.defineProperty(igaming, LOCALE, {
|
|
1904
|
+
value: () => typeof transport.getLocale === "function" ? transport.getLocale() : void 0
|
|
1905
|
+
});
|
|
1375
1906
|
return igaming;
|
|
1376
1907
|
}
|
|
1377
1908
|
|
|
1378
1909
|
exports.createIgaming = createIgaming;
|
|
1910
|
+
exports.keepsClubIdempotencyKey = keepsClubIdempotencyKey;
|
|
1379
1911
|
//# sourceMappingURL=index.cjs.map
|
|
1380
1912
|
//# sourceMappingURL=index.cjs.map
|