@gamecore-api/sdk 0.5.1 → 0.7.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/client.d.ts +15 -1
- package/dist/index.js +9 -0
- package/dist/types.d.ts +48 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TelegramInitResponse, User, SiteConfig, ExchangeRates, LegalDocument, Game, GameDetail, Product, SearchResult, Category, CartItem, CheckoutRequest, CheckoutResponse, Order, UserBalance, LevelStatus, Transaction, Notification, Favorite, Review, ReviewStats, CouponResult, ReferralStats, ReferralLink, ReferralCommission, TopupMethod, TopupResponse, TopupStatus, GiftCard, Announcement, AnnouncementBar, SiteStats, ProductFilters, PaginatedResponse } from "./types";
|
|
1
|
+
import type { TelegramInitResponse, User, SiteConfig, ExchangeRates, LegalDocument, Game, GameDetail, Product, SearchResult, Category, CartItem, CheckoutRequest, CheckoutResponse, Order, UserBalance, LevelStatus, Transaction, Notification, Favorite, Review, ReviewStats, CouponResult, ReferralStats, ReferralLink, ReferralCommission, TopupMethod, TopupResponse, TopupStatus, GiftCard, Announcement, AnnouncementBar, SiteUIConfig, CatalogSection, SiteStats, ProductFilters, PaginatedResponse } from "./types";
|
|
2
2
|
export interface GameCoreOptions {
|
|
3
3
|
/** Site API key (gc_live_xxx or gc_test_xxx) */
|
|
4
4
|
apiKey: string;
|
|
@@ -22,6 +22,18 @@ export declare class GameCoreClient {
|
|
|
22
22
|
getLegal: (type: string, locale?: string) => Promise<LegalDocument>;
|
|
23
23
|
/** Get site statistics for trust signals (cached 5 min on server) */
|
|
24
24
|
getStats: () => Promise<SiteStats>;
|
|
25
|
+
/** Get site translations for a locale (Record<key, value>) */
|
|
26
|
+
getTranslations: (locale?: string) => Promise<Record<string, string>>;
|
|
27
|
+
/** Get site UI config (header, footer, nav, trust pills) */
|
|
28
|
+
getUIConfig: () => Promise<SiteUIConfig>;
|
|
29
|
+
/** Get cookie consent config */
|
|
30
|
+
getCookieConsent: () => Promise<{
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
text: string;
|
|
33
|
+
policyUrl: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** Get per-site catalog sections (category tabs config) */
|
|
36
|
+
getCatalogSections: () => Promise<CatalogSection[]>;
|
|
25
37
|
/** Get active hero banners for carousel */
|
|
26
38
|
getBanners: () => Promise<{
|
|
27
39
|
id: number;
|
|
@@ -76,6 +88,8 @@ export declare class GameCoreClient {
|
|
|
76
88
|
getHomepageGames: () => Promise<Game[]>;
|
|
77
89
|
/** Get single game with categories */
|
|
78
90
|
getGame: (slug: string, locale?: string) => Promise<GameDetail>;
|
|
91
|
+
/** Get recommended games (same type, random) */
|
|
92
|
+
getRecommendations: (gameSlug: string, limit?: number) => Promise<Game[]>;
|
|
79
93
|
/** Get categories for a game with product counts and delivery metadata */
|
|
80
94
|
getCategories: (gameSlug: string) => Promise<Category[]>;
|
|
81
95
|
/** Get products for a game with optional filters */
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,10 @@ class GameCoreClient {
|
|
|
77
77
|
getRates: () => this.request("GET", "/rates"),
|
|
78
78
|
getLegal: (type, locale) => this.request("GET", `/legal/${type}${locale ? `?locale=${locale}` : ""}`),
|
|
79
79
|
getStats: () => this.request("GET", "/site/stats"),
|
|
80
|
+
getTranslations: (locale = "ru") => this.request("GET", `/site/translations?locale=${locale}`),
|
|
81
|
+
getUIConfig: () => this.request("GET", "/site/ui-config"),
|
|
82
|
+
getCookieConsent: () => this.request("GET", "/site/cookie-consent"),
|
|
83
|
+
getCatalogSections: () => this.request("GET", "/site/catalog-sections"),
|
|
80
84
|
getBanners: () => this.request("GET", "/site/banners"),
|
|
81
85
|
getAnnouncementBar: () => this.request("GET", "/site/announcement-bar")
|
|
82
86
|
};
|
|
@@ -129,6 +133,7 @@ class GameCoreClient {
|
|
|
129
133
|
const qs = locale ? `?locale=${locale}` : "";
|
|
130
134
|
return this.request("GET", `/catalog/games/${slug}${qs}`);
|
|
131
135
|
},
|
|
136
|
+
getRecommendations: (gameSlug, limit = 8) => this.request("GET", `/catalog/games/${gameSlug}/recommendations?limit=${limit}`),
|
|
132
137
|
getCategories: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/categories`),
|
|
133
138
|
getProducts: (gameSlug, filters) => {
|
|
134
139
|
const qs = new URLSearchParams;
|
|
@@ -140,6 +145,10 @@ class GameCoreClient {
|
|
|
140
145
|
qs.set("platform", filters.platform);
|
|
141
146
|
if (filters?.categoryId)
|
|
142
147
|
qs.set("categoryId", String(filters.categoryId));
|
|
148
|
+
if (filters?.minPrice != null)
|
|
149
|
+
qs.set("minPrice", String(filters.minPrice));
|
|
150
|
+
if (filters?.maxPrice != null)
|
|
151
|
+
qs.set("maxPrice", String(filters.maxPrice));
|
|
143
152
|
const q = qs.toString();
|
|
144
153
|
return this.request("GET", `/catalog/games/${gameSlug}/products${q ? `?${q}` : ""}`);
|
|
145
154
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ export interface GameDetail {
|
|
|
82
82
|
name: string;
|
|
83
83
|
icon: string | null;
|
|
84
84
|
localIcon?: string | null;
|
|
85
|
+
coverImage?: string | null;
|
|
86
|
+
images?: string[];
|
|
85
87
|
description: string | null;
|
|
86
88
|
inStock?: boolean;
|
|
87
89
|
productCount?: number;
|
|
@@ -169,6 +171,8 @@ export interface ProductFilters {
|
|
|
169
171
|
region?: string;
|
|
170
172
|
platform?: string;
|
|
171
173
|
categoryId?: number;
|
|
174
|
+
minPrice?: number;
|
|
175
|
+
maxPrice?: number;
|
|
172
176
|
}
|
|
173
177
|
export interface SearchResult {
|
|
174
178
|
games: Game[];
|
|
@@ -395,6 +399,50 @@ export interface Announcement {
|
|
|
395
399
|
imageUrl?: string | null;
|
|
396
400
|
createdAt: string;
|
|
397
401
|
}
|
|
402
|
+
export interface SiteUIConfig {
|
|
403
|
+
header: {
|
|
404
|
+
logoText?: string | null;
|
|
405
|
+
logoUrl?: string | null;
|
|
406
|
+
navLinks: Array<{
|
|
407
|
+
label: string;
|
|
408
|
+
href: string;
|
|
409
|
+
order: number;
|
|
410
|
+
enabled: boolean;
|
|
411
|
+
}>;
|
|
412
|
+
showSearch: boolean;
|
|
413
|
+
showThemeToggle: boolean;
|
|
414
|
+
};
|
|
415
|
+
footer: {
|
|
416
|
+
paymentMethods: Array<{
|
|
417
|
+
name: string;
|
|
418
|
+
icon?: string;
|
|
419
|
+
}>;
|
|
420
|
+
legalLinks: Array<{
|
|
421
|
+
label: string;
|
|
422
|
+
href: string;
|
|
423
|
+
}>;
|
|
424
|
+
socialLinks: Array<{
|
|
425
|
+
platform: string;
|
|
426
|
+
url: string;
|
|
427
|
+
icon?: string;
|
|
428
|
+
}>;
|
|
429
|
+
copyrightText?: string | null;
|
|
430
|
+
};
|
|
431
|
+
trustPills: Array<{
|
|
432
|
+
text: string;
|
|
433
|
+
icon?: string;
|
|
434
|
+
enabled: boolean;
|
|
435
|
+
}>;
|
|
436
|
+
}
|
|
437
|
+
export interface CatalogSection {
|
|
438
|
+
id: number;
|
|
439
|
+
slug: string;
|
|
440
|
+
label: string;
|
|
441
|
+
icon: string | null;
|
|
442
|
+
filterType: string;
|
|
443
|
+
filterValue: string;
|
|
444
|
+
sortOrder: number;
|
|
445
|
+
}
|
|
398
446
|
export interface SiteStats {
|
|
399
447
|
totalCustomers: number;
|
|
400
448
|
totalOrders: number;
|