@gamecore-api/sdk 0.4.0 → 0.5.1
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 +6 -0
- package/dist/types.d.ts +22 -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, 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, 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;
|
|
@@ -20,6 +20,18 @@ export declare class GameCoreClient {
|
|
|
20
20
|
getRates: () => Promise<ExchangeRates>;
|
|
21
21
|
/** Get legal document by type (privacy, terms, etc.) */
|
|
22
22
|
getLegal: (type: string, locale?: string) => Promise<LegalDocument>;
|
|
23
|
+
/** Get site statistics for trust signals (cached 5 min on server) */
|
|
24
|
+
getStats: () => Promise<SiteStats>;
|
|
25
|
+
/** Get active hero banners for carousel */
|
|
26
|
+
getBanners: () => Promise<{
|
|
27
|
+
id: number;
|
|
28
|
+
title: string | null;
|
|
29
|
+
description: string | null;
|
|
30
|
+
imageUrl: string | null;
|
|
31
|
+
color: string | null;
|
|
32
|
+
scope: string;
|
|
33
|
+
priority: number;
|
|
34
|
+
}[]>;
|
|
23
35
|
/** Get announcement bar settings (text, link, enabled) */
|
|
24
36
|
getAnnouncementBar: () => Promise<AnnouncementBar>;
|
|
25
37
|
};
|
|
@@ -58,6 +70,7 @@ export declare class GameCoreClient {
|
|
|
58
70
|
deliveryType?: string;
|
|
59
71
|
include?: string;
|
|
60
72
|
inStockOnly?: boolean;
|
|
73
|
+
sort?: "popular" | "name" | "new" | "soldCount";
|
|
61
74
|
}) => Promise<Game[]>;
|
|
62
75
|
/** Get homepage ranked games */
|
|
63
76
|
getHomepageGames: () => Promise<Game[]>;
|
|
@@ -234,6 +247,7 @@ export declare class GameCoreClient {
|
|
|
234
247
|
/** Get public reviews (paginated) */
|
|
235
248
|
listPublic: (params?: {
|
|
236
249
|
gameSlug?: string;
|
|
250
|
+
productId?: number;
|
|
237
251
|
limit?: number;
|
|
238
252
|
offset?: number;
|
|
239
253
|
}) => Promise<PaginatedResponse<Review>>;
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,8 @@ class GameCoreClient {
|
|
|
76
76
|
getConfig: () => this.request("GET", "/site/config"),
|
|
77
77
|
getRates: () => this.request("GET", "/rates"),
|
|
78
78
|
getLegal: (type, locale) => this.request("GET", `/legal/${type}${locale ? `?locale=${locale}` : ""}`),
|
|
79
|
+
getStats: () => this.request("GET", "/site/stats"),
|
|
80
|
+
getBanners: () => this.request("GET", "/site/banners"),
|
|
79
81
|
getAnnouncementBar: () => this.request("GET", "/site/announcement-bar")
|
|
80
82
|
};
|
|
81
83
|
auth = {
|
|
@@ -117,6 +119,8 @@ class GameCoreClient {
|
|
|
117
119
|
qs.set("include", params.include);
|
|
118
120
|
if (params?.inStockOnly)
|
|
119
121
|
qs.set("inStockOnly", "true");
|
|
122
|
+
if (params?.sort)
|
|
123
|
+
qs.set("sort", params.sort);
|
|
120
124
|
const q = qs.toString();
|
|
121
125
|
return this.request("GET", `/catalog/games${q ? `?${q}` : ""}`);
|
|
122
126
|
},
|
|
@@ -213,6 +217,8 @@ class GameCoreClient {
|
|
|
213
217
|
const qs = new URLSearchParams;
|
|
214
218
|
if (params?.gameSlug)
|
|
215
219
|
qs.set("gameSlug", params.gameSlug);
|
|
220
|
+
if (params?.productId)
|
|
221
|
+
qs.set("productId", String(params.productId));
|
|
216
222
|
if (params?.limit)
|
|
217
223
|
qs.set("limit", String(params.limit));
|
|
218
224
|
if (params?.offset)
|
package/dist/types.d.ts
CHANGED
|
@@ -33,6 +33,18 @@ export interface SiteConfig {
|
|
|
33
33
|
rateMode: "auto" | "manual";
|
|
34
34
|
currentRate: number;
|
|
35
35
|
supportedLocales?: string[];
|
|
36
|
+
maintenance?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
message: string | null;
|
|
39
|
+
};
|
|
40
|
+
analytics?: {
|
|
41
|
+
yandex: {
|
|
42
|
+
counterId: string;
|
|
43
|
+
} | null;
|
|
44
|
+
google: {
|
|
45
|
+
measurementId: string;
|
|
46
|
+
} | null;
|
|
47
|
+
};
|
|
36
48
|
}
|
|
37
49
|
export interface ExchangeRates {
|
|
38
50
|
usdToRub: number;
|
|
@@ -55,6 +67,8 @@ export interface Game {
|
|
|
55
67
|
localIcon?: string | null;
|
|
56
68
|
productCount: number;
|
|
57
69
|
inStock: boolean;
|
|
70
|
+
soldCount?: number;
|
|
71
|
+
tags?: string[];
|
|
58
72
|
minPrice?: number | null;
|
|
59
73
|
type?: string;
|
|
60
74
|
deliveryTypes?: string[];
|
|
@@ -131,6 +145,8 @@ export interface FulfillmentMeta {
|
|
|
131
145
|
export interface Product {
|
|
132
146
|
id: number;
|
|
133
147
|
name: string;
|
|
148
|
+
description?: string | null;
|
|
149
|
+
estimatedDelivery?: string;
|
|
134
150
|
icon: string | null;
|
|
135
151
|
price: number | null;
|
|
136
152
|
priceWithoutDiscount?: number;
|
|
@@ -379,6 +395,12 @@ export interface Announcement {
|
|
|
379
395
|
imageUrl?: string | null;
|
|
380
396
|
createdAt: string;
|
|
381
397
|
}
|
|
398
|
+
export interface SiteStats {
|
|
399
|
+
totalCustomers: number;
|
|
400
|
+
totalOrders: number;
|
|
401
|
+
totalGames: number;
|
|
402
|
+
avgDeliveryMinutes: number;
|
|
403
|
+
}
|
|
382
404
|
export interface AnnouncementBar {
|
|
383
405
|
enabled: boolean;
|
|
384
406
|
text: string;
|