@gamecore-api/sdk 0.3.1 → 0.5.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 +5 -2
- package/dist/index.js +3 -0
- package/dist/types.d.ts +51 -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,8 @@ 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>;
|
|
23
25
|
/** Get announcement bar settings (text, link, enabled) */
|
|
24
26
|
getAnnouncementBar: () => Promise<AnnouncementBar>;
|
|
25
27
|
};
|
|
@@ -51,12 +53,13 @@ export declare class GameCoreClient {
|
|
|
51
53
|
unlinkProvider: (provider: string) => Promise<void>;
|
|
52
54
|
};
|
|
53
55
|
catalog: {
|
|
54
|
-
/** Get all games with
|
|
56
|
+
/** Get all games. Use inStockOnly:true for only games with products. include:"meta" for categories/deliveryTypes. */
|
|
55
57
|
getGames: (params?: {
|
|
56
58
|
locale?: string;
|
|
57
59
|
type?: string;
|
|
58
60
|
deliveryType?: string;
|
|
59
61
|
include?: string;
|
|
62
|
+
inStockOnly?: boolean;
|
|
60
63
|
}) => Promise<Game[]>;
|
|
61
64
|
/** Get homepage ranked games */
|
|
62
65
|
getHomepageGames: () => Promise<Game[]>;
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,7 @@ 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"),
|
|
79
80
|
getAnnouncementBar: () => this.request("GET", "/site/announcement-bar")
|
|
80
81
|
};
|
|
81
82
|
auth = {
|
|
@@ -115,6 +116,8 @@ class GameCoreClient {
|
|
|
115
116
|
qs.set("deliveryType", params.deliveryType);
|
|
116
117
|
if (params?.include)
|
|
117
118
|
qs.set("include", params.include);
|
|
119
|
+
if (params?.inStockOnly)
|
|
120
|
+
qs.set("inStockOnly", "true");
|
|
118
121
|
const q = qs.toString();
|
|
119
122
|
return this.request("GET", `/catalog/games${q ? `?${q}` : ""}`);
|
|
120
123
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -33,6 +33,10 @@ 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
|
+
};
|
|
36
40
|
}
|
|
37
41
|
export interface ExchangeRates {
|
|
38
42
|
usdToRub: number;
|
|
@@ -54,6 +58,9 @@ export interface Game {
|
|
|
54
58
|
icon: string | null;
|
|
55
59
|
localIcon?: string | null;
|
|
56
60
|
productCount: number;
|
|
61
|
+
inStock: boolean;
|
|
62
|
+
soldCount?: number;
|
|
63
|
+
tags?: string[];
|
|
57
64
|
minPrice?: number | null;
|
|
58
65
|
type?: string;
|
|
59
66
|
deliveryTypes?: string[];
|
|
@@ -68,7 +75,43 @@ export interface GameDetail {
|
|
|
68
75
|
icon: string | null;
|
|
69
76
|
localIcon?: string | null;
|
|
70
77
|
description: string | null;
|
|
78
|
+
inStock?: boolean;
|
|
79
|
+
productCount?: number;
|
|
71
80
|
categories: Category[];
|
|
81
|
+
seo?: SeoContent | null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Per-site SEO content for a game page.
|
|
85
|
+
* Stored in GameCore admin per site and returned with the game detail response.
|
|
86
|
+
* All fields are nullable — filled in by content managers via Claude Code workflow.
|
|
87
|
+
*/
|
|
88
|
+
export interface SeoContent {
|
|
89
|
+
title: string | null;
|
|
90
|
+
h1: string | null;
|
|
91
|
+
metaDescription: string | null;
|
|
92
|
+
metaKeywords: string | null;
|
|
93
|
+
ogTitle: string | null;
|
|
94
|
+
ogDescription: string | null;
|
|
95
|
+
ogImage: string | null;
|
|
96
|
+
canonicalUrl: string | null;
|
|
97
|
+
intro: string | null;
|
|
98
|
+
content: string | null;
|
|
99
|
+
/** Structured content blocks for H2/H3 sections */
|
|
100
|
+
contentSections: Array<{
|
|
101
|
+
heading: string;
|
|
102
|
+
level: number;
|
|
103
|
+
body: string;
|
|
104
|
+
}>;
|
|
105
|
+
faq: Array<{
|
|
106
|
+
question: string;
|
|
107
|
+
answer: string;
|
|
108
|
+
}>;
|
|
109
|
+
keywords: string[];
|
|
110
|
+
/** JSON-LD schema.org object (Product, FAQPage, BreadcrumbList) */
|
|
111
|
+
schemaJsonLd: Record<string, unknown> | null;
|
|
112
|
+
footerText: string | null;
|
|
113
|
+
/** Key cluster identifying the store's SEO theme (e.g. "рублями", "kz-tenge") */
|
|
114
|
+
cluster: string | null;
|
|
72
115
|
}
|
|
73
116
|
export interface Category {
|
|
74
117
|
id: number;
|
|
@@ -94,6 +137,8 @@ export interface FulfillmentMeta {
|
|
|
94
137
|
export interface Product {
|
|
95
138
|
id: number;
|
|
96
139
|
name: string;
|
|
140
|
+
description?: string | null;
|
|
141
|
+
estimatedDelivery?: string;
|
|
97
142
|
icon: string | null;
|
|
98
143
|
price: number | null;
|
|
99
144
|
priceWithoutDiscount?: number;
|
|
@@ -342,6 +387,12 @@ export interface Announcement {
|
|
|
342
387
|
imageUrl?: string | null;
|
|
343
388
|
createdAt: string;
|
|
344
389
|
}
|
|
390
|
+
export interface SiteStats {
|
|
391
|
+
totalCustomers: number;
|
|
392
|
+
totalOrders: number;
|
|
393
|
+
totalGames: number;
|
|
394
|
+
avgDeliveryMinutes: number;
|
|
395
|
+
}
|
|
345
396
|
export interface AnnouncementBar {
|
|
346
397
|
enabled: boolean;
|
|
347
398
|
text: string;
|