@masterunoco/casinowebengine-api 0.1.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/dist/index.cjs ADDED
@@ -0,0 +1,902 @@
1
+ 'use strict';
2
+
3
+ // src/errors.ts
4
+ var ApiError = class extends Error {
5
+ constructor(params) {
6
+ super(params.message);
7
+ this.name = "ApiError";
8
+ this.status = params.status;
9
+ this.url = params.url;
10
+ this.method = params.method;
11
+ this.payload = params.payload;
12
+ this.requestId = params.requestId ?? null;
13
+ }
14
+ };
15
+ function isApiError(err) {
16
+ return !!err && typeof err === "object" && err.name === "ApiError";
17
+ }
18
+
19
+ // src/http/client.ts
20
+ var HttpClient = class {
21
+ constructor(opts) {
22
+ this.opts = opts;
23
+ }
24
+ setAuthProvider(auth) {
25
+ if (auth) {
26
+ this.opts.auth = auth;
27
+ }
28
+ }
29
+ async request(path, init = {}, authPolicy = "optional") {
30
+ const url = joinUrl(this.opts.baseUrl, path);
31
+ const method = (init.method || "GET").toUpperCase();
32
+ const controller = new AbortController();
33
+ const timer = setTimeout(() => controller.abort(), this.opts.timeoutMs ?? 15e3);
34
+ try {
35
+ const headers = new Headers(this.opts.defaultHeaders || {});
36
+ if (authPolicy !== "none") {
37
+ const token = this.opts.auth?.getToken?.() ?? null;
38
+ if (token) headers.set("Authorization", `JWT ${token}`);
39
+ if (authPolicy === "required" && !token) {
40
+ throw new ApiError({
41
+ status: 401,
42
+ url,
43
+ method,
44
+ message: "Authentication required",
45
+ payload: { code: "AUTH_REQUIRED" }
46
+ });
47
+ }
48
+ }
49
+ if (init.body && !headers.has("Content-Type")) headers.set("Content-Type", "application/json");
50
+ const res = await (this.opts.fetchFn ?? fetch)(url, {
51
+ ...init,
52
+ headers: { ...Object.fromEntries(headers.entries()), ...init.headers || {} },
53
+ signal: controller.signal
54
+ });
55
+ const reqId = res.headers.get("x-request-id") || res.headers.get("x-correlation-id") || null;
56
+ const contentType = res.headers.get("content-type") || "";
57
+ const isJson = contentType.includes("application/json");
58
+ if (!res.ok) {
59
+ const payload = await readBody(res, isJson);
60
+ const message = isJson && typeof payload === "object" && payload && ("message" in payload || "error" in payload) ? String(payload.message ?? payload.error) : res.statusText || `HTTP ${res.status}`;
61
+ throw new ApiError({
62
+ status: res.status,
63
+ url,
64
+ method,
65
+ message,
66
+ payload: (isJson ? payload : payload) ?? null,
67
+ requestId: reqId
68
+ });
69
+ }
70
+ if (isJson) return await res.json();
71
+ const text = await res.text();
72
+ return text ? text : null;
73
+ } catch (err) {
74
+ if (err?.name === "AbortError") {
75
+ throw new ApiError({
76
+ status: 408,
77
+ url,
78
+ method,
79
+ message: "Request timeout",
80
+ payload: { code: "TIMEOUT" }
81
+ });
82
+ }
83
+ if (err instanceof ApiError) throw err;
84
+ throw new ApiError({
85
+ status: 0,
86
+ url,
87
+ method,
88
+ message: err?.message || "Network error",
89
+ payload: { code: "NETWORK_ERROR" }
90
+ });
91
+ } finally {
92
+ clearTimeout(timer);
93
+ }
94
+ }
95
+ get(path, authPolicy) {
96
+ return this.request(path, { method: "GET" }, authPolicy);
97
+ }
98
+ post(path, body, authPolicy) {
99
+ return this.request(
100
+ path,
101
+ { method: "POST", body: body !== void 0 ? JSON.stringify(body) : null },
102
+ authPolicy
103
+ );
104
+ }
105
+ patch(path, body, authPolicy) {
106
+ return this.request(
107
+ path,
108
+ { method: "PATCH", body: body !== void 0 ? JSON.stringify(body) : null },
109
+ authPolicy
110
+ );
111
+ }
112
+ delete(path, authPolicy) {
113
+ return this.request(path, { method: "DELETE" }, authPolicy);
114
+ }
115
+ };
116
+ function joinUrl(base, path) {
117
+ return `${base.replace(/\/+$/, "")}${path.startsWith("/") ? "" : "/"}${path}`;
118
+ }
119
+ async function readBody(res, isJson) {
120
+ try {
121
+ return isJson ? await res.json() : await res.text();
122
+ } catch {
123
+ return null;
124
+ }
125
+ }
126
+
127
+ // src/localStorage.ts
128
+ var LocalStorage = class {
129
+ constructor() {
130
+ this.tokenKey = "gs.token";
131
+ this.userDataKey = "gs.userData";
132
+ this.avatarKey = "gs.avatar";
133
+ this.socketTokenKey = "gs.socketToken";
134
+ this.pinKey = "gs.pin";
135
+ this.pinTokenKey = "gs.pinToken";
136
+ this.geoLocalStorageKey = "gs.visitorLocation";
137
+ }
138
+ isLocalStorageAvailable() {
139
+ return typeof localStorage !== "undefined";
140
+ }
141
+ setToken(token) {
142
+ if (this.isLocalStorageAvailable()) {
143
+ localStorage.setItem(this.tokenKey, token);
144
+ }
145
+ }
146
+ getToken() {
147
+ if (this.isLocalStorageAvailable()) {
148
+ return localStorage.getItem(this.tokenKey);
149
+ }
150
+ return null;
151
+ }
152
+ setUser(data) {
153
+ if (this.isLocalStorageAvailable()) {
154
+ localStorage.setItem(this.userDataKey, JSON.stringify(data));
155
+ }
156
+ }
157
+ getUser() {
158
+ if (this.isLocalStorageAvailable()) {
159
+ const data = localStorage.getItem(this.userDataKey);
160
+ if (data) {
161
+ try {
162
+ return JSON.parse(data);
163
+ } catch {
164
+ return null;
165
+ }
166
+ }
167
+ }
168
+ return null;
169
+ }
170
+ setAvatar(avatarUrl) {
171
+ if (this.isLocalStorageAvailable()) {
172
+ localStorage.setItem(this.avatarKey, avatarUrl);
173
+ }
174
+ }
175
+ getAvatar() {
176
+ if (this.isLocalStorageAvailable()) {
177
+ return localStorage.getItem(this.avatarKey);
178
+ }
179
+ return null;
180
+ }
181
+ setSocketToken(token) {
182
+ if (this.isLocalStorageAvailable()) {
183
+ localStorage.setItem(this.socketTokenKey, token);
184
+ }
185
+ }
186
+ getSocketToken() {
187
+ if (this.isLocalStorageAvailable()) {
188
+ return localStorage.getItem(this.socketTokenKey);
189
+ }
190
+ return null;
191
+ }
192
+ setPin(pin) {
193
+ if (this.isLocalStorageAvailable()) {
194
+ localStorage.setItem(this.pinKey, pin);
195
+ }
196
+ }
197
+ getPin() {
198
+ if (this.isLocalStorageAvailable()) {
199
+ return localStorage.getItem(this.pinKey);
200
+ }
201
+ return null;
202
+ }
203
+ setPinToken(token) {
204
+ if (this.isLocalStorageAvailable()) {
205
+ localStorage.setItem(this.pinTokenKey, token);
206
+ }
207
+ }
208
+ getPinToken() {
209
+ if (this.isLocalStorageAvailable()) {
210
+ return localStorage.getItem(this.pinTokenKey);
211
+ }
212
+ return null;
213
+ }
214
+ setGeolocation(data) {
215
+ if (this.isLocalStorageAvailable()) {
216
+ data.timestamp = Date.now();
217
+ localStorage.setItem(this.geoLocalStorageKey, JSON.stringify(data));
218
+ }
219
+ }
220
+ getGeolocation() {
221
+ if (this.isLocalStorageAvailable()) {
222
+ const data = localStorage.getItem(this.geoLocalStorageKey);
223
+ if (data) {
224
+ try {
225
+ const parsedData = JSON.parse(data);
226
+ if (parsedData.timestamp) {
227
+ const now = Date.now();
228
+ const age = now - parsedData.timestamp;
229
+ const cacheTime = 10 * 60 * 1e3;
230
+ if (age > cacheTime) {
231
+ return null;
232
+ }
233
+ }
234
+ return parsedData;
235
+ } catch {
236
+ return null;
237
+ }
238
+ }
239
+ }
240
+ return null;
241
+ }
242
+ clear() {
243
+ if (this.isLocalStorageAvailable()) {
244
+ localStorage.removeItem(this.tokenKey);
245
+ localStorage.removeItem(this.userDataKey);
246
+ localStorage.removeItem(this.avatarKey);
247
+ localStorage.removeItem(this.socketTokenKey);
248
+ localStorage.removeItem(this.pinKey);
249
+ localStorage.removeItem(this.pinTokenKey);
250
+ localStorage.removeItem(this.geoLocalStorageKey);
251
+ }
252
+ }
253
+ };
254
+ var storage = new LocalStorage();
255
+
256
+ // src/apis/geo.ts
257
+ var GeolocationAPI = class {
258
+ constructor(http) {
259
+ this.http = http;
260
+ this.failObj = {
261
+ ip: "0.0.0.0",
262
+ countryCode: "undefined",
263
+ status: "fail",
264
+ message: "invalid query",
265
+ query: "undefined"
266
+ };
267
+ }
268
+ async getGeolocationFromAPI() {
269
+ try {
270
+ const geo = await this.http.get("/geo/location", "none");
271
+ if (geo.ipAddress && geo.ipVersion) {
272
+ delete geo.ipVersion;
273
+ delete geo.ipAddress;
274
+ storage.setGeolocation(geo);
275
+ return geo;
276
+ }
277
+ } catch {
278
+ return void 0;
279
+ }
280
+ }
281
+ async getGeolocation() {
282
+ const geoData = storage.getGeolocation();
283
+ if (geoData) {
284
+ try {
285
+ const geo = JSON.parse(geoData);
286
+ if (geo && geo.ipVersion) {
287
+ delete geo.ipVersion;
288
+ delete geo.ipAddress;
289
+ return geo;
290
+ } else {
291
+ return this.failObj;
292
+ }
293
+ } catch {
294
+ return this.failObj;
295
+ }
296
+ } else {
297
+ return await this.getGeolocationFromAPI() || this.failObj;
298
+ }
299
+ }
300
+ async getCountryCode() {
301
+ const geo = await this.getGeolocation();
302
+ if (geo && geo.countryCode && geo.countryCode === "undefined") {
303
+ return geo.countryCode;
304
+ } else {
305
+ return false;
306
+ }
307
+ }
308
+ };
309
+
310
+ // src/auth/jwtAuth.ts
311
+ var JwtAuth = class {
312
+ constructor(client) {
313
+ this.client = client;
314
+ this.token = null;
315
+ this.user = null;
316
+ this.token = storage.getToken();
317
+ this.user = storage.getUser();
318
+ }
319
+ setToken(token) {
320
+ if (token) {
321
+ storage.setToken(token);
322
+ this.token = token;
323
+ } else {
324
+ storage.clear();
325
+ }
326
+ }
327
+ setUser(user, token) {
328
+ storage.setUser(user);
329
+ storage.setToken(token);
330
+ this.user = user;
331
+ this.token = token;
332
+ }
333
+ async login(username, password, recaptchaToken) {
334
+ const authPolicy = "none";
335
+ const payload = { username, password, recaptchaToken };
336
+ const res = await this.client.post("/auth/login", payload, authPolicy);
337
+ this.setUser(res.user, res.token);
338
+ return res;
339
+ }
340
+ async GoogleLogin(data) {
341
+ const geo = new GeolocationAPI(this.client);
342
+ const geoData = await geo.getGeolocation();
343
+ if (geoData) {
344
+ data.geo = geoData;
345
+ }
346
+ const authPolicy = "none";
347
+ const res = await this.client.post("/auth/google/signin", data, authPolicy);
348
+ this.setUser(res.user, res.token);
349
+ return res;
350
+ }
351
+ async forgetPassword(email) {
352
+ const authPolicy = "none";
353
+ await this.client.post("/auth/forgot-password", { email }, authPolicy);
354
+ }
355
+ async register(data, param) {
356
+ const geo = new GeolocationAPI(this.client);
357
+ const geoData = await geo.getGeolocation();
358
+ if (geoData) {
359
+ data.geo = geoData;
360
+ }
361
+ let apiRouter = "/auth/signup";
362
+ if (param) {
363
+ apiRouter += `?ref=${param}`;
364
+ }
365
+ const authPolicy = "none";
366
+ const registerData = await this.client.post(apiRouter, data, authPolicy);
367
+ if (registerData.player) {
368
+ const loginData = await this.login(data.username, data.password, data.recaptchaToken);
369
+ return {
370
+ ...registerData,
371
+ ...loginData
372
+ };
373
+ } else {
374
+ return {
375
+ ...registerData
376
+ };
377
+ }
378
+ }
379
+ async registerV2(data, param) {
380
+ const geo = new GeolocationAPI(this.client);
381
+ const geoData = await geo.getGeolocation();
382
+ if (geoData) {
383
+ data.geo = geoData;
384
+ }
385
+ let apiRouter = "/auth/signupv2";
386
+ if (param) {
387
+ apiRouter += `?ref=${param}`;
388
+ }
389
+ const authPolicy = "none";
390
+ const registerData = await this.client.post(apiRouter, data, authPolicy);
391
+ if (registerData.player) {
392
+ const loginData = await this.login(data.username, data.password, data.recaptchaToken);
393
+ return {
394
+ ...registerData,
395
+ ...loginData
396
+ };
397
+ } else {
398
+ return {
399
+ ...registerData
400
+ };
401
+ }
402
+ }
403
+ async registerV2Validate(data) {
404
+ const authPolicy = "none";
405
+ return await this.client.post("/auth/signupv2/validate-username-email", data, authPolicy);
406
+ }
407
+ clear() {
408
+ this.setToken(null);
409
+ this.user = null;
410
+ }
411
+ async logout() {
412
+ const authPolicy = "required";
413
+ await this.client.post("/auth/logout", {}, authPolicy);
414
+ this.clear();
415
+ }
416
+ async pinCode(pin) {
417
+ const authPolicy = "none";
418
+ return await this.client.post("/auth/website", { pin }, authPolicy);
419
+ }
420
+ async pinCheck(token) {
421
+ const authPolicy = "none";
422
+ return await this.client.post("/auth/website/check", { token }, authPolicy);
423
+ }
424
+ getToken() {
425
+ if (!this.token) {
426
+ this.token = storage.getToken();
427
+ }
428
+ return this.token;
429
+ }
430
+ getUser() {
431
+ if (!this.user) {
432
+ this.user = storage.getUser();
433
+ }
434
+ return this.user;
435
+ }
436
+ isAuthenticated() {
437
+ const Token = this.token || this.getToken();
438
+ return !!Token;
439
+ }
440
+ };
441
+
442
+ // src/apis/affiliate.ts
443
+ var AffiliateAPI = class {
444
+ constructor(http) {
445
+ this.http = http;
446
+ }
447
+ async generateReferralCode(description) {
448
+ return await this.http.post(`/referral/generate`, { description });
449
+ }
450
+ async getReferralCode() {
451
+ return await this.http.get(`/referral/get`);
452
+ }
453
+ async getReferralCount() {
454
+ return await this.http.get(`/referral/max-codes`);
455
+ }
456
+ async getReferralStatus() {
457
+ return await this.http.get(`/referral/status`);
458
+ }
459
+ async getReferralFriends(page, limit) {
460
+ return await this.http.get(`/referral/friends?page=${page}&limit=${limit}`);
461
+ }
462
+ async getBannerImage(lang, key) {
463
+ return await this.http.get(`/website-settings?language=${lang}&key=${key}`);
464
+ }
465
+ async getRewards() {
466
+ return await this.http.get(`/referral/rewards`);
467
+ }
468
+ async getAvailablePrizes() {
469
+ return await this.http.get(`/referral/available-prizes`);
470
+ }
471
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
472
+ async getPrizes(params) {
473
+ const queryParams = new URLSearchParams();
474
+ for (const key in params) {
475
+ if (params[key] !== void 0) {
476
+ queryParams.append(key, String(params[key]));
477
+ }
478
+ }
479
+ const query = queryParams.toString();
480
+ return await this.http.get(`/referral/prizes?${query}`);
481
+ }
482
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
483
+ async convert(data) {
484
+ return await this.http.post(`/referral/convert`, data);
485
+ }
486
+ async getSummary() {
487
+ return await this.http.get(`/referral/summary`);
488
+ }
489
+ };
490
+
491
+ // src/apis/content.ts
492
+ var ContentAPI = class {
493
+ constructor(http) {
494
+ this.http = http;
495
+ }
496
+ list() {
497
+ return this.http.get("/content-pages", "none");
498
+ }
499
+ get(slug) {
500
+ return this.http.get(`/content-pages/${slug}`, "none");
501
+ }
502
+ };
503
+
504
+ // src/apis/deposit.ts
505
+ var DepositAPI = class {
506
+ constructor(http) {
507
+ this.http = http;
508
+ }
509
+ charge(data) {
510
+ return this.http.post("/deposit/charge", data, "required");
511
+ }
512
+ getPaymentMethods() {
513
+ return this.http.get("/payment-methods", "required");
514
+ }
515
+ getDeposits(status = "pending", page = 1, limit = 20) {
516
+ return this.http.get(`/payment/${status}?page=${page}&limit=${limit}`, "required");
517
+ }
518
+ };
519
+
520
+ // src/apis/games.ts
521
+ var GamesAPI = class {
522
+ constructor(http) {
523
+ this.http = http;
524
+ }
525
+ /** Public: search games */
526
+ search(request) {
527
+ return this.http.post("/games/search", request, "none");
528
+ }
529
+ getCategories() {
530
+ return this.http.get("/games/categories", "none");
531
+ }
532
+ /** Requires auth: player link */
533
+ getLink(gameId) {
534
+ return this.http.post(`/games/getLink`, { gameId }, "required");
535
+ }
536
+ /** Public: demo link */
537
+ getDemoLink(gameId) {
538
+ return this.http.post("/games/getDemoLink", { gameId }, "none");
539
+ }
540
+ setFavorite(gameId, isFavorite) {
541
+ return this.http.post("/games/favorites", { gameId, isFavorite }, "required");
542
+ }
543
+ getFavorite() {
544
+ return this.http.get("/games/player-favorites", "required");
545
+ }
546
+ getRecentBigWins(category) {
547
+ return this.http.get(`/games/recent-big-wins?category=${category}`, "none");
548
+ }
549
+ getRecent(page = 1, limit = 10) {
550
+ return this.http.get(`/games/recent?page=${page}&limit=${limit}`);
551
+ }
552
+ getGlobalFavorites() {
553
+ return this.http.get("/games/global-favorites", "none");
554
+ }
555
+ getTopRated() {
556
+ const geo = new GeolocationAPI(this.http);
557
+ const countryCode = geo.getCountryCode();
558
+ let url = "/games/top-rated";
559
+ if (countryCode) {
560
+ url += `?region=${countryCode}`;
561
+ }
562
+ return this.http.get(url, "none");
563
+ }
564
+ getProviders() {
565
+ return this.http.get("/games/providers", "none");
566
+ }
567
+ getLobby() {
568
+ const geo = new GeolocationAPI(this.http);
569
+ const countryCode = geo.getCountryCode();
570
+ let url = "/games/lobby";
571
+ if (countryCode) {
572
+ url += `?region=${countryCode}`;
573
+ }
574
+ return this.http.get(url, "none");
575
+ }
576
+ };
577
+
578
+ // src/apis/luckyWheel.ts
579
+ var LuckyWheelAPI = class {
580
+ constructor(http) {
581
+ this.http = http;
582
+ }
583
+ getStatistics() {
584
+ return this.http.get("/lucky-wheel/statistics", "required");
585
+ }
586
+ getWinners() {
587
+ return this.http.get("/lucky-wheel/get-winners?offset=1&limit=100", "none");
588
+ }
589
+ getPrizes() {
590
+ return this.http.get("/lucky-wheel/get-prizes");
591
+ }
592
+ getStatus() {
593
+ return this.http.get("/lucky-wheel/status");
594
+ }
595
+ play(data) {
596
+ return this.http.post("/lucky-wheel/play", data);
597
+ }
598
+ collect(data) {
599
+ return this.http.post("/lucky-wheel/collect", data);
600
+ }
601
+ };
602
+
603
+ // src/apis/media.ts
604
+ var MediaAPI = class {
605
+ constructor(http) {
606
+ this.http = http;
607
+ }
608
+ upload(file) {
609
+ const formData = new FormData();
610
+ formData.append("file", file);
611
+ formData.append("upload_preset", "demo");
612
+ return this.http.post("/media/upload", formData, "none");
613
+ }
614
+ getFileUrl(filePath) {
615
+ return this.http.get(`/media/get-file-url?filePath=${filePath}`);
616
+ }
617
+ };
618
+
619
+ // src/apis/player.ts
620
+ var PlayerAPI = class {
621
+ constructor(http) {
622
+ this.http = http;
623
+ }
624
+ changePassword(data) {
625
+ return this.http.post("/player/change-password", data);
626
+ }
627
+ getBalanceHistory(data) {
628
+ const queryParams = new URLSearchParams();
629
+ if (data.limit !== void 0) queryParams.append("limit", data.limit.toString());
630
+ if (data.startDate !== void 0) queryParams.append("startDate", data.startDate);
631
+ if (data.endDate !== void 0) queryParams.append("endDate", data.endDate);
632
+ const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
633
+ return this.http.get(`/player/balance-history${queryString}`);
634
+ }
635
+ getGameHistory(data) {
636
+ const queryParams = new URLSearchParams();
637
+ if (data.limit !== void 0) queryParams.append("limit", data.limit.toString());
638
+ if (data.startDate !== void 0) queryParams.append("startDate", data.startDate);
639
+ if (data.endDate !== void 0) queryParams.append("endDate", data.endDate);
640
+ const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
641
+ return this.http.get(`/player/game-transaction${queryString}`);
642
+ }
643
+ verifyEmail(data) {
644
+ return this.http.post("/verify/email/send", data);
645
+ }
646
+ verifyEmailCode(data) {
647
+ return this.http.post("/verify/email/confirm", data);
648
+ }
649
+ verifyPhone(data) {
650
+ return this.http.post("/verify/phone/send", data);
651
+ }
652
+ verifyPhoneCode(data) {
653
+ return this.http.post("/verify/phone/confirm", data);
654
+ }
655
+ getVerificationStatus() {
656
+ return this.http.get("/player/verification-status");
657
+ }
658
+ getAvatars() {
659
+ return this.http.get("/avatars/get");
660
+ }
661
+ changeAvatar(data) {
662
+ return this.http.post("/avatars/set", data);
663
+ }
664
+ getPlayerKycDocuments() {
665
+ return this.http.get("/player/kyc-documents");
666
+ }
667
+ createPlayerKycDocument(data) {
668
+ return this.http.post("/player/kyc-documents", data);
669
+ }
670
+ createPlayerTags(data) {
671
+ const requestData = {
672
+ tags: data
673
+ };
674
+ return this.http.post("/player/tags", requestData);
675
+ }
676
+ updateProfile(data) {
677
+ return this.http.patch("/player/profile", data);
678
+ }
679
+ };
680
+
681
+ // src/apis/promotions.ts
682
+ var PromotionsAPI = class {
683
+ constructor(http) {
684
+ this.http = http;
685
+ }
686
+ getActive() {
687
+ return this.http.get("/promotions/active");
688
+ }
689
+ getPublic() {
690
+ return this.http.get("/promotions/public", "none");
691
+ }
692
+ getPromotion(id) {
693
+ return this.http.get(`/promotions/${id}`, "none");
694
+ }
695
+ getProgress() {
696
+ return this.http.get("/promotions/progress");
697
+ }
698
+ activateBonus(id) {
699
+ return this.http.post(`/bonus/activate/${id}`, {});
700
+ }
701
+ cancelBonus(id) {
702
+ return this.http.delete(`/bonus/cancel/${id}`);
703
+ }
704
+ };
705
+
706
+ // src/apis/raffle.ts
707
+ var RaffleAPI = class {
708
+ constructor(http) {
709
+ this.http = http;
710
+ }
711
+ getTickets() {
712
+ return this.http.get("/raffle/tickets");
713
+ }
714
+ getPrizes() {
715
+ return this.http.get("/raffle/prizes");
716
+ }
717
+ getHistory() {
718
+ return this.http.get("/raffle/history");
719
+ }
720
+ getActiveRaffle() {
721
+ return this.http.get("/raffle/current");
722
+ }
723
+ purchaseTickets(data) {
724
+ return this.http.post("/raffle/purchase", data);
725
+ }
726
+ };
727
+
728
+ // src/apis/region.ts
729
+ var RegionAPI = class {
730
+ constructor(http) {
731
+ this.http = http;
732
+ }
733
+ getDepositRegions() {
734
+ return this.http.get("/regions/deposit");
735
+ }
736
+ getWithdrawRegions() {
737
+ return this.http.get("/regions/withdraw");
738
+ }
739
+ getRegions() {
740
+ return this.http.get("/regions", "none");
741
+ }
742
+ getBlockedCountries() {
743
+ return this.http.get("/regions/blocked-countries", "none");
744
+ }
745
+ };
746
+
747
+ // src/apis/settings.ts
748
+ var SettingsAPI = class {
749
+ constructor(http) {
750
+ this.http = http;
751
+ }
752
+ getSettings() {
753
+ return this.http.get("/api/v1/settings", "none");
754
+ }
755
+ getBanner(lang) {
756
+ return this.http.get(`/banners/get/${lang}`, "none");
757
+ }
758
+ getContent() {
759
+ return this.http.get("/content-pages", "none");
760
+ }
761
+ getContentItem(type, lang) {
762
+ return this.http.get(`/content-pages/${type}/${lang}`, "none");
763
+ }
764
+ getAvatar() {
765
+ return this.http.get("/avatars/get", "none");
766
+ }
767
+ getPreferences() {
768
+ return this.http.get("/player/preferences");
769
+ }
770
+ updatePreferences(data) {
771
+ return this.http.patch("/player/preferences", data);
772
+ }
773
+ getCurrencies() {
774
+ return this.http.get("/currencies/get", "none");
775
+ }
776
+ getWebSetting(lang) {
777
+ return this.http.get(`/website-settings?language=${lang}&key[]=footerCasinoItems&key[]=footerSportsItems&key[]=footerSocialMedia&key[]=footerPromoItems&key[]=footerSupportLegalItems&key[]=footerAboutUsItems&key[]=footerAppLinks`, "none");
778
+ }
779
+ getWebSettingProviders(lang) {
780
+ return this.http.get(`/website-settings?language=${lang}&key[]=sectionProviders`, "none");
781
+ }
782
+ getWebSettingPin() {
783
+ return this.http.get(`/website-settings?key[]=isCodeProtected`, "none");
784
+ }
785
+ getWebSettingReferralRules(lang) {
786
+ return this.http.get(`/website-settings?language=${lang}&key[]=referral_rules`, "none");
787
+ }
788
+ getWebSettingReferralFaq(lang) {
789
+ return this.http.get(`/website-settings?language=${lang}&key[]=referral_faq`, "none");
790
+ }
791
+ getWebSettingReferralLearnMore(lang) {
792
+ return this.http.get(`/website-settings?language=${lang}&key[]=referral_learn_more`, "none");
793
+ }
794
+ getWebSettingReferralBanners(lang) {
795
+ return this.http.get(`/website-settings?language=${lang}&key[]=referral_assets`, "none");
796
+ }
797
+ getWebSettingSlotsCategories(lang) {
798
+ return this.http.get(`/website-settings?language=${lang}&key[]=slotsCategories`, "none");
799
+ }
800
+ getWebSettingLiveCasinoCategories(lang) {
801
+ return this.http.get(`/website-settings?language=${lang}&key[]=liveCasinoCategories`, "none");
802
+ }
803
+ getWebsiteAllowedPlayerTags(lang) {
804
+ return this.http.get(`/website-settings?language=${lang}&key[]=allowedPlayerTags`, "none");
805
+ }
806
+ getSupportEmail(lang) {
807
+ return this.http.get(`/website-settings?language=${lang}&key[]=supportEmail`, "none");
808
+ }
809
+ };
810
+
811
+ // src/apis/sport.ts
812
+ var SportAPI = class {
813
+ constructor(http) {
814
+ this.http = http;
815
+ }
816
+ getConfig() {
817
+ return this.http.get("/sport/get-sport-config");
818
+ }
819
+ };
820
+
821
+ // src/apis/voucher.ts
822
+ var VoucherAPI = class {
823
+ constructor(http) {
824
+ this.http = http;
825
+ }
826
+ redeemVoucher(code) {
827
+ return this.http.post("/vouchers/redeem", { code });
828
+ }
829
+ checkVoucher(code) {
830
+ return this.http.get(`/vouchers/check/${code}`, "none");
831
+ }
832
+ };
833
+
834
+ // src/apis/withdraw.ts
835
+ var WithdrawAPI = class {
836
+ constructor(http) {
837
+ this.http = http;
838
+ }
839
+ getWithdraws(status) {
840
+ const statusQuery = status ? `/${status}` : "";
841
+ return this.http.get(`/withdraw${statusQuery}`);
842
+ }
843
+ getWithdrawMethods() {
844
+ return this.http.get("/withdraw/methods", "none");
845
+ }
846
+ withdraw(data) {
847
+ return this.http.post("/withdraw", data);
848
+ }
849
+ rejectWithdraw(withdrawId) {
850
+ return this.http.post(`/withdraw/cancel`, { withdrawId });
851
+ }
852
+ getTrinkparaWithdrawInfo(info) {
853
+ return this.http.get(`/trinkpara/info?info=${info}`);
854
+ }
855
+ getAnindaBankList(methodId) {
856
+ return this.http.get(`/aninda/banks?paymentMethodId=${methodId}`);
857
+ }
858
+ };
859
+
860
+ // src/sdk.ts
861
+ var GameSDK = class {
862
+ constructor(cfg) {
863
+ this.http = new HttpClient({
864
+ baseUrl: cfg.baseUrl.replace(/\/+$/, ""),
865
+ auth: { getToken: () => this.auth.getToken() },
866
+ // <-- uses this.auth (defined below)
867
+ timeoutMs: cfg.timeoutMs ?? 15e3
868
+ });
869
+ this.auth = new JwtAuth(this.http);
870
+ this.affiliate = new AffiliateAPI(this.http);
871
+ this.content = new ContentAPI(this.http);
872
+ this.deposit = new DepositAPI(this.http);
873
+ this.games = new GamesAPI(this.http);
874
+ this.geolocation = new GeolocationAPI(this.http);
875
+ this.luckyWheel = new LuckyWheelAPI(this.http);
876
+ this.media = new MediaAPI(this.http);
877
+ this.player = new PlayerAPI(this.http);
878
+ this.promotions = new PromotionsAPI(this.http);
879
+ this.raffle = new RaffleAPI(this.http);
880
+ this.region = new RegionAPI(this.http);
881
+ this.settings = new SettingsAPI(this.http);
882
+ this.sport = new SportAPI(this.http);
883
+ this.voucher = new VoucherAPI(this.http);
884
+ this.withdraw = new WithdrawAPI(this.http);
885
+ }
886
+ };
887
+ var createGameSDK = (cfg) => new GameSDK(cfg);
888
+
889
+ // src/types/auth.ts
890
+ var USERNAME_REGEX = /^[a-zA-Z0-9_-]+$/;
891
+
892
+ exports.ApiError = ApiError;
893
+ exports.ContentAPI = ContentAPI;
894
+ exports.GameSDK = GameSDK;
895
+ exports.GamesAPI = GamesAPI;
896
+ exports.JwtAuth = JwtAuth;
897
+ exports.PromotionsAPI = PromotionsAPI;
898
+ exports.USERNAME_REGEX = USERNAME_REGEX;
899
+ exports.createGameSDK = createGameSDK;
900
+ exports.isApiError = isApiError;
901
+ //# sourceMappingURL=index.cjs.map
902
+ //# sourceMappingURL=index.cjs.map