@gamecore-api/sdk 0.5.1 → 0.6.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 +11 -1
- package/dist/index.js +7 -0
- package/dist/types.d.ts +11 -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, 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,14 @@ 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 cookie consent config */
|
|
26
|
+
getCookieConsent: () => Promise<{
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
text: string;
|
|
29
|
+
policyUrl: string;
|
|
30
|
+
}>;
|
|
31
|
+
/** Get per-site catalog sections (category tabs config) */
|
|
32
|
+
getCatalogSections: () => Promise<CatalogSection[]>;
|
|
25
33
|
/** Get active hero banners for carousel */
|
|
26
34
|
getBanners: () => Promise<{
|
|
27
35
|
id: number;
|
|
@@ -76,6 +84,8 @@ export declare class GameCoreClient {
|
|
|
76
84
|
getHomepageGames: () => Promise<Game[]>;
|
|
77
85
|
/** Get single game with categories */
|
|
78
86
|
getGame: (slug: string, locale?: string) => Promise<GameDetail>;
|
|
87
|
+
/** Get recommended games (same type, random) */
|
|
88
|
+
getRecommendations: (gameSlug: string, limit?: number) => Promise<Game[]>;
|
|
79
89
|
/** Get categories for a game with product counts and delivery metadata */
|
|
80
90
|
getCategories: (gameSlug: string) => Promise<Category[]>;
|
|
81
91
|
/** Get products for a game with optional filters */
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,8 @@ 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
|
+
getCookieConsent: () => this.request("GET", "/site/cookie-consent"),
|
|
81
|
+
getCatalogSections: () => this.request("GET", "/site/catalog-sections"),
|
|
80
82
|
getBanners: () => this.request("GET", "/site/banners"),
|
|
81
83
|
getAnnouncementBar: () => this.request("GET", "/site/announcement-bar")
|
|
82
84
|
};
|
|
@@ -129,6 +131,7 @@ class GameCoreClient {
|
|
|
129
131
|
const qs = locale ? `?locale=${locale}` : "";
|
|
130
132
|
return this.request("GET", `/catalog/games/${slug}${qs}`);
|
|
131
133
|
},
|
|
134
|
+
getRecommendations: (gameSlug, limit = 8) => this.request("GET", `/catalog/games/${gameSlug}/recommendations?limit=${limit}`),
|
|
132
135
|
getCategories: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/categories`),
|
|
133
136
|
getProducts: (gameSlug, filters) => {
|
|
134
137
|
const qs = new URLSearchParams;
|
|
@@ -140,6 +143,10 @@ class GameCoreClient {
|
|
|
140
143
|
qs.set("platform", filters.platform);
|
|
141
144
|
if (filters?.categoryId)
|
|
142
145
|
qs.set("categoryId", String(filters.categoryId));
|
|
146
|
+
if (filters?.minPrice != null)
|
|
147
|
+
qs.set("minPrice", String(filters.minPrice));
|
|
148
|
+
if (filters?.maxPrice != null)
|
|
149
|
+
qs.set("maxPrice", String(filters.maxPrice));
|
|
143
150
|
const q = qs.toString();
|
|
144
151
|
return this.request("GET", `/catalog/games/${gameSlug}/products${q ? `?${q}` : ""}`);
|
|
145
152
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -169,6 +169,8 @@ export interface ProductFilters {
|
|
|
169
169
|
region?: string;
|
|
170
170
|
platform?: string;
|
|
171
171
|
categoryId?: number;
|
|
172
|
+
minPrice?: number;
|
|
173
|
+
maxPrice?: number;
|
|
172
174
|
}
|
|
173
175
|
export interface SearchResult {
|
|
174
176
|
games: Game[];
|
|
@@ -395,6 +397,15 @@ export interface Announcement {
|
|
|
395
397
|
imageUrl?: string | null;
|
|
396
398
|
createdAt: string;
|
|
397
399
|
}
|
|
400
|
+
export interface CatalogSection {
|
|
401
|
+
id: number;
|
|
402
|
+
slug: string;
|
|
403
|
+
label: string;
|
|
404
|
+
icon: string | null;
|
|
405
|
+
filterType: string;
|
|
406
|
+
filterValue: string;
|
|
407
|
+
sortOrder: number;
|
|
408
|
+
}
|
|
398
409
|
export interface SiteStats {
|
|
399
410
|
totalCustomers: number;
|
|
400
411
|
totalOrders: number;
|