@gamecore-api/sdk 0.20.0 → 0.25.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 +104 -1
- package/dist/index.js +41 -4
- package/dist/types.d.ts +154 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { Announcement, AnnouncementBar, CartItem, CashbackPreview, CatalogSection, Category, CategoryInfo, CheckoutRequest, CheckoutResponse, CompleteWithBalanceResult, Conversation, ConversationDetail, CouponResult, DailyBonusClaimResult, DailyBonusStatus, ExchangeRates, Favorite, Game, GameDetail, GiftCard, LegalDocument, LevelStatus, Notification, Order, PagedGamesResponse, PlatformInfo, PaginatedResponse, PaymentInfo, PaymentMethod, Product, ProductFilters, PublicCoupon, Quest, QuestCompleteResult, ReferralCommission, ReferralLink, ReferralPerformance, ReferralStats, Review, ReviewCreateResult, ReviewProof, ReviewStats, ScreenshotsResponse, SearchResult, SiteConfig, SiteStats, SiteUIConfig, SystemRequirementsResponse, TelegramAuthResponse, TelegramBotLoginOptions, TelegramInitResponse, TelegramWidgetRenderOptions, TelegramWidgetUser, TopupMethod, TopupResponse, TopupStatus, Transaction, User, UserBalance, WebPushSubscriptionInput } from "./types";
|
|
1
|
+
import type { Announcement, AnnouncementBar, CartItem, CashbackPreview, CatalogSection, Category, CategoryInfo, CheckoutRequest, CheckoutResponse, CheckoutStatus, CmsArticleListResponse, CmsArticleLocale, CmsArticleResponse, CmsArticleType, CompleteWithBalanceResult, Conversation, ConversationDetail, CouponResult, DailyBonusClaimResult, DailyBonusStatus, DeliveryHelpResponse, ExchangeRates, FaqListResponse, Favorite, Game, GameDetail, GameRequestList, GiftCard, LegalDocument, LevelStatus, Notification, Order, PagedGamesResponse, PlatformInfo, PaginatedResponse, PaymentInfo, PaymentMethod, Product, ProductFilters, ProfileSummary, PublicCoupon, Quest, QuestCompleteResult, ReferralCommission, ReferralLink, ReferralPerformance, ReferralStats, ReferralTransferResult, Review, ReviewCreateResult, ReviewPolicy, ReviewProof, ReviewStats, ScreenshotsResponse, SearchResult, SiteConfig, SiteStats, SiteUIConfig, SystemRequirementsResponse, TelegramAuthResponse, TelegramBotLoginOptions, TelegramInitResponse, TelegramWidgetRenderOptions, TelegramWidgetUser, TopupMethod, TopupResponse, TopupStatus, Transaction, User, UserBalance, WebPushSubscriptionInput } from "./types";
|
|
2
|
+
/** Supported storefront locales — extend as new languages land. */
|
|
3
|
+
export type SdkLocale = "ru" | "en";
|
|
2
4
|
export interface GameCoreOptions {
|
|
3
5
|
/** Site API key (gc_live_xxx or gc_test_xxx) */
|
|
4
6
|
apiKey: string;
|
|
@@ -6,12 +8,29 @@ export interface GameCoreOptions {
|
|
|
6
8
|
baseUrl: string;
|
|
7
9
|
/** Called on 401 — use to redirect to login */
|
|
8
10
|
onAuthError?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Default locale for catalog/CMS responses. When set, every request
|
|
13
|
+
* sends an `Accept-Language` header so the API returns localized
|
|
14
|
+
* name/description fields without each call passing `locale=` itself.
|
|
15
|
+
* Per-call `locale` arguments still take precedence over the default.
|
|
16
|
+
* Omit to keep the legacy behaviour (server falls back to "ru").
|
|
17
|
+
*/
|
|
18
|
+
locale?: SdkLocale;
|
|
9
19
|
}
|
|
10
20
|
export declare class GameCoreClient {
|
|
11
21
|
private apiKey;
|
|
12
22
|
private baseUrl;
|
|
13
23
|
private onAuthError?;
|
|
24
|
+
private defaultLocale?;
|
|
14
25
|
constructor(options: GameCoreOptions);
|
|
26
|
+
/**
|
|
27
|
+
* Switch the client's default locale at runtime — useful for a
|
|
28
|
+
* storefront language switcher that should not have to re-instantiate
|
|
29
|
+
* the client.
|
|
30
|
+
*/
|
|
31
|
+
setLocale(locale: SdkLocale | undefined): void;
|
|
32
|
+
/** Current default locale (undefined when none set). */
|
|
33
|
+
getLocale(): SdkLocale | undefined;
|
|
15
34
|
private request;
|
|
16
35
|
site: {
|
|
17
36
|
/** Get site configuration (modules, auth methods, payments, currency) */
|
|
@@ -111,6 +130,51 @@ export declare class GameCoreClient {
|
|
|
111
130
|
success: boolean;
|
|
112
131
|
requestId: number;
|
|
113
132
|
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Get the per-site review-payout policy. Storefronts use this on
|
|
135
|
+
* the order success page to decide whether to advertise a
|
|
136
|
+
* cashback bonus for posting a review, and to enforce the
|
|
137
|
+
* minimum text length client-side before submission.
|
|
138
|
+
*/
|
|
139
|
+
getReviewPolicy: () => Promise<ReviewPolicy>;
|
|
140
|
+
/**
|
|
141
|
+
* Get FAQ entries for this site. Without `gameId`, returns all
|
|
142
|
+
* active site-wide FAQ entries (rows with `gameId: null`). When
|
|
143
|
+
* `gameId` is provided, returns ONLY entries scoped to that
|
|
144
|
+
* game — site-wide entries are NOT included in the response.
|
|
145
|
+
* Storefronts that want both site-wide and game-specific FAQ
|
|
146
|
+
* on the same page must call this method twice and merge the
|
|
147
|
+
* results client-side. `position` is the display order (lower
|
|
148
|
+
* first); `gameId: null` marks site-wide entries.
|
|
149
|
+
*/
|
|
150
|
+
getFaq: (gameId?: number) => Promise<FaqListResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* List published CMS articles of a given type for the current
|
|
153
|
+
* site. Returns a summary projection (no body) — call
|
|
154
|
+
* `getArticle()` to fetch a single article's full content.
|
|
155
|
+
*
|
|
156
|
+
* `locale` defaults to the site's default locale on the
|
|
157
|
+
* server (currently "ru") when omitted. `limit` is capped
|
|
158
|
+
* server-side at 100; `offset` enables pagination.
|
|
159
|
+
*/
|
|
160
|
+
getArticles: (type: CmsArticleType, options?: {
|
|
161
|
+
locale?: CmsArticleLocale;
|
|
162
|
+
limit?: number;
|
|
163
|
+
offset?: number;
|
|
164
|
+
}) => Promise<CmsArticleListResponse>;
|
|
165
|
+
/**
|
|
166
|
+
* Fetch a single published CMS article by slug. The server
|
|
167
|
+
* falls back to the RU article when the requested locale is
|
|
168
|
+
* missing — inspect `article.locale` on the response to
|
|
169
|
+
* detect fallback.
|
|
170
|
+
*
|
|
171
|
+
* Throws `GameCoreError(404)` when no published article matches
|
|
172
|
+
* the requested type/slug pair under either the requested or
|
|
173
|
+
* fallback locale.
|
|
174
|
+
*/
|
|
175
|
+
getArticle: (type: CmsArticleType, slug: string, options?: {
|
|
176
|
+
locale?: CmsArticleLocale;
|
|
177
|
+
}) => Promise<CmsArticleResponse>;
|
|
114
178
|
};
|
|
115
179
|
auth: {
|
|
116
180
|
/** Start Telegram auth flow → returns bot link for user to click */
|
|
@@ -393,6 +457,15 @@ export declare class GameCoreClient {
|
|
|
393
457
|
* 2026-05-01 (Wave 5 #50).
|
|
394
458
|
*/
|
|
395
459
|
getGameScreenshots: (gameSlug: string) => Promise<ScreenshotsResponse>;
|
|
460
|
+
/**
|
|
461
|
+
* Pre-checkout delivery help (instructions, screenshots,
|
|
462
|
+
* warnings) configured by the operator for a game page. The
|
|
463
|
+
* endpoint returns `{ deliveryHelp: DeliveryHelp | null }` flat
|
|
464
|
+
* — without the `success`/`data` envelope — so the SDK does not
|
|
465
|
+
* auto-unwrap and the response shape mirrors the wire payload
|
|
466
|
+
* directly. `null` means no help content is configured.
|
|
467
|
+
*/
|
|
468
|
+
getDeliveryHelp: (gameSlug: string) => Promise<DeliveryHelpResponse>;
|
|
396
469
|
/** Get categories for a game with product counts and delivery metadata */
|
|
397
470
|
getCategories: (gameSlug: string) => Promise<Category[]>;
|
|
398
471
|
/** Get products for a game with optional filters */
|
|
@@ -537,6 +610,14 @@ export declare class GameCoreClient {
|
|
|
537
610
|
completeWithBalance: (paymentCode: string) => Promise<CompleteWithBalanceResult>;
|
|
538
611
|
/** Get available payment methods for checkout */
|
|
539
612
|
getPaymentMethods: () => Promise<PaymentMethod[]>;
|
|
613
|
+
/**
|
|
614
|
+
* Get the current status of a payment plus its child orders by
|
|
615
|
+
* payment code. Public endpoint — no auth required, so it can
|
|
616
|
+
* power a "track your order" lookup page from a guest's email
|
|
617
|
+
* receipt link. `gatewayPaymentUrl` is `null` once the payment
|
|
618
|
+
* has been completed or expired.
|
|
619
|
+
*/
|
|
620
|
+
getStatus: (code: string) => Promise<CheckoutStatus>;
|
|
540
621
|
};
|
|
541
622
|
orders: {
|
|
542
623
|
/** List all orders for authenticated user */
|
|
@@ -712,6 +793,21 @@ export declare class GameCoreClient {
|
|
|
712
793
|
unsubscribePush: (endpoint: string) => Promise<{
|
|
713
794
|
success: boolean;
|
|
714
795
|
}>;
|
|
796
|
+
/**
|
|
797
|
+
* List the current user's "please add this game" requests,
|
|
798
|
+
* newest first. Status is one of `pending` / `reviewed` /
|
|
799
|
+
* `completed` / `rejected` (string-typed because the server
|
|
800
|
+
* may add new states without an SDK bump).
|
|
801
|
+
*/
|
|
802
|
+
getGameRequests: () => Promise<GameRequestList>;
|
|
803
|
+
/**
|
|
804
|
+
* Aggregated counters for the header / sidebar — cart size,
|
|
805
|
+
* unread notifications, pending review prompts, balances, and
|
|
806
|
+
* whether the user has an open support thread. One round-trip
|
|
807
|
+
* replaces several smaller calls; useful as a SWR pre-fetch on
|
|
808
|
+
* authenticated route shells.
|
|
809
|
+
*/
|
|
810
|
+
getSummary: () => Promise<ProfileSummary>;
|
|
715
811
|
};
|
|
716
812
|
favorites: {
|
|
717
813
|
/** List user's favorite products */
|
|
@@ -807,6 +903,13 @@ export declare class GameCoreClient {
|
|
|
807
903
|
from?: Date | string;
|
|
808
904
|
to?: Date | string;
|
|
809
905
|
}) => Promise<ReferralPerformance>;
|
|
906
|
+
/**
|
|
907
|
+
* Transfer all eligible pending referral commissions to the
|
|
908
|
+
* user's permanent balance. Returns the total transferred amount,
|
|
909
|
+
* how many commissions were moved, and the user's new permanent
|
|
910
|
+
* balance.
|
|
911
|
+
*/
|
|
912
|
+
transferToBalance: () => Promise<ReferralTransferResult>;
|
|
810
913
|
};
|
|
811
914
|
reviews: {
|
|
812
915
|
/** Get public reviews (paginated) */
|
package/dist/index.js
CHANGED
|
@@ -36,16 +36,27 @@ class GameCoreClient {
|
|
|
36
36
|
apiKey;
|
|
37
37
|
baseUrl;
|
|
38
38
|
onAuthError;
|
|
39
|
+
defaultLocale;
|
|
39
40
|
constructor(options) {
|
|
40
41
|
this.apiKey = options.apiKey;
|
|
41
42
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
42
43
|
this.onAuthError = options.onAuthError;
|
|
44
|
+
this.defaultLocale = options.locale;
|
|
45
|
+
}
|
|
46
|
+
setLocale(locale) {
|
|
47
|
+
this.defaultLocale = locale;
|
|
48
|
+
}
|
|
49
|
+
getLocale() {
|
|
50
|
+
return this.defaultLocale;
|
|
43
51
|
}
|
|
44
52
|
async request(method, path, body, options) {
|
|
45
53
|
const headers = {
|
|
46
54
|
"X-Api-Key": this.apiKey,
|
|
47
55
|
"Content-Type": "application/json"
|
|
48
56
|
};
|
|
57
|
+
if (this.defaultLocale) {
|
|
58
|
+
headers["Accept-Language"] = this.defaultLocale;
|
|
59
|
+
}
|
|
49
60
|
if (options?.idempotencyKey) {
|
|
50
61
|
headers["X-Idempotency-Key"] = options.idempotencyKey;
|
|
51
62
|
}
|
|
@@ -87,7 +98,28 @@ class GameCoreClient {
|
|
|
87
98
|
getBanners: () => this.request("GET", "/site/banners"),
|
|
88
99
|
getAnnouncementBar: () => this.request("GET", "/site/announcement-bar"),
|
|
89
100
|
getSitemapData: () => this.request("GET", "/seo/sitemap-data"),
|
|
90
|
-
requestGame: (data) => this.request("POST", "/site/request-game", data)
|
|
101
|
+
requestGame: (data) => this.request("POST", "/site/request-game", data),
|
|
102
|
+
getReviewPolicy: () => this.request("GET", "/site/review-policy"),
|
|
103
|
+
getFaq: (gameId) => {
|
|
104
|
+
const qs = gameId !== undefined ? `?gameId=${encodeURIComponent(gameId)}` : "";
|
|
105
|
+
return this.request("GET", `/site/faq${qs}`);
|
|
106
|
+
},
|
|
107
|
+
getArticles: (type, options) => {
|
|
108
|
+
const params = new URLSearchParams;
|
|
109
|
+
if (options?.locale)
|
|
110
|
+
params.set("locale", options.locale);
|
|
111
|
+
if (options?.limit !== undefined)
|
|
112
|
+
params.set("limit", String(options.limit));
|
|
113
|
+
if (options?.offset !== undefined)
|
|
114
|
+
params.set("offset", String(options.offset));
|
|
115
|
+
const qs = params.toString();
|
|
116
|
+
const path = qs.length > 0 ? `/site/cms/${encodeURIComponent(type)}?${qs}` : `/site/cms/${encodeURIComponent(type)}`;
|
|
117
|
+
return this.request("GET", path);
|
|
118
|
+
},
|
|
119
|
+
getArticle: (type, slug, options) => {
|
|
120
|
+
const qs = options?.locale ? `?locale=${options.locale}` : "";
|
|
121
|
+
return this.request("GET", `/site/cms/${encodeURIComponent(type)}/${encodeURIComponent(slug)}${qs}`);
|
|
122
|
+
}
|
|
91
123
|
};
|
|
92
124
|
auth = {
|
|
93
125
|
initTelegram: () => this.request("POST", "/auth/telegram/init"),
|
|
@@ -259,6 +291,7 @@ class GameCoreClient {
|
|
|
259
291
|
getRecommendations: (gameSlug, limit = 8) => this.request("GET", `/catalog/games/${gameSlug}/recommendations?limit=${limit}`),
|
|
260
292
|
getGameSystemRequirements: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/system-requirements`),
|
|
261
293
|
getGameScreenshots: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/screenshots`),
|
|
294
|
+
getDeliveryHelp: (gameSlug) => this.request("GET", `/catalog/games/${encodeURIComponent(gameSlug)}/delivery-help`),
|
|
262
295
|
getCategories: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/categories`),
|
|
263
296
|
getProducts: (gameSlug, filters) => {
|
|
264
297
|
const qs = new URLSearchParams;
|
|
@@ -306,7 +339,8 @@ class GameCoreClient {
|
|
|
306
339
|
getPaymentMethods: async () => {
|
|
307
340
|
const res = await this.request("GET", "/checkout/payment-methods", undefined, { rawResponse: true });
|
|
308
341
|
return res.methods || [];
|
|
309
|
-
}
|
|
342
|
+
},
|
|
343
|
+
getStatus: (code) => this.request("GET", `/checkout/${encodeURIComponent(code)}/status`)
|
|
310
344
|
};
|
|
311
345
|
orders = {
|
|
312
346
|
list: () => this.request("GET", "/orders"),
|
|
@@ -377,7 +411,9 @@ class GameCoreClient {
|
|
|
377
411
|
subscribePush: (subscription) => this.request("POST", "/profile/push/subscribe", subscription),
|
|
378
412
|
unsubscribePush: (endpoint) => this.request("POST", "/profile/push/unsubscribe", {
|
|
379
413
|
endpoint
|
|
380
|
-
})
|
|
414
|
+
}),
|
|
415
|
+
getGameRequests: () => this.request("GET", "/profile/game-requests"),
|
|
416
|
+
getSummary: () => this.request("GET", "/profile/summary")
|
|
381
417
|
};
|
|
382
418
|
favorites = {
|
|
383
419
|
list: () => this.request("GET", "/favorites"),
|
|
@@ -413,7 +449,8 @@ class GameCoreClient {
|
|
|
413
449
|
}
|
|
414
450
|
const q = qs.toString();
|
|
415
451
|
return this.request("GET", `/referral/performance${q ? `?${q}` : ""}`);
|
|
416
|
-
}
|
|
452
|
+
},
|
|
453
|
+
transferToBalance: async () => this.request("POST", "/referral/transfer")
|
|
417
454
|
};
|
|
418
455
|
reviews = {
|
|
419
456
|
listPublic: (params) => {
|
package/dist/types.d.ts
CHANGED
|
@@ -532,6 +532,30 @@ export interface ScreenshotsResponse {
|
|
|
532
532
|
source: "steam";
|
|
533
533
|
fetchedAt: string;
|
|
534
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
* Pre-checkout delivery help block for a game page. Operators
|
|
537
|
+
* configure copy/screenshots so the storefront can show "how to find
|
|
538
|
+
* your player ID" / "where to look up your login" instructions
|
|
539
|
+
* before the user fills the checkout form. All fields except `label`
|
|
540
|
+
* are optional — the storefront should render whatever combination
|
|
541
|
+
* the operator provided.
|
|
542
|
+
*/
|
|
543
|
+
export interface DeliveryHelp {
|
|
544
|
+
label: string;
|
|
545
|
+
helpText?: string;
|
|
546
|
+
screenshots?: string[];
|
|
547
|
+
warnings?: string[];
|
|
548
|
+
externalUrl?: string;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Response from `gc.catalog.getDeliveryHelp()`. `deliveryHelp` is
|
|
552
|
+
* `null` when the game has no help content configured — the
|
|
553
|
+
* storefront should hide the help panel in that case. The endpoint
|
|
554
|
+
* returns the field flat (no `success`/`data` envelope).
|
|
555
|
+
*/
|
|
556
|
+
export interface DeliveryHelpResponse {
|
|
557
|
+
deliveryHelp: DeliveryHelp | null;
|
|
558
|
+
}
|
|
535
559
|
export interface CheckoutRequest {
|
|
536
560
|
email?: string;
|
|
537
561
|
items: Array<{
|
|
@@ -1085,6 +1109,17 @@ export interface ReferralPerformance {
|
|
|
1085
1109
|
totalTransactions: number;
|
|
1086
1110
|
newMembers: number;
|
|
1087
1111
|
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Result of `gc.referrals.transferToBalance()` — the SDK auto-unwraps
|
|
1114
|
+
* the `{success, data}` envelope so callers receive this inner object
|
|
1115
|
+
* directly. `transferredAmount` is the total moved from pending
|
|
1116
|
+
* commissions to permanent balance.
|
|
1117
|
+
*/
|
|
1118
|
+
export interface ReferralTransferResult {
|
|
1119
|
+
transferredAmount: number;
|
|
1120
|
+
transferredCount: number;
|
|
1121
|
+
newPermanentBalance: number;
|
|
1122
|
+
}
|
|
1088
1123
|
export interface TopupMethod {
|
|
1089
1124
|
type: string;
|
|
1090
1125
|
label: string;
|
|
@@ -1256,6 +1291,125 @@ export interface WebhookPayload {
|
|
|
1256
1291
|
sandbox: boolean;
|
|
1257
1292
|
data: Record<string, unknown>;
|
|
1258
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Per-site review-payout policy. Storefronts use this to render the
|
|
1296
|
+
* "leave a review and get +N% cashback" banner on the order success
|
|
1297
|
+
* page. `enabled: false` means reviews are accepted but no payout is
|
|
1298
|
+
* promised — render the form without the bonus copy.
|
|
1299
|
+
*/
|
|
1300
|
+
export interface ReviewPolicy {
|
|
1301
|
+
enabled: boolean;
|
|
1302
|
+
percent: number;
|
|
1303
|
+
expiresInDays: number;
|
|
1304
|
+
requiresText: boolean;
|
|
1305
|
+
minTextLength: number;
|
|
1306
|
+
}
|
|
1307
|
+
/** Single FAQ entry. `gameId: null` means a global (site-wide) entry. */
|
|
1308
|
+
export interface FaqItem {
|
|
1309
|
+
id: number;
|
|
1310
|
+
question: string;
|
|
1311
|
+
answer: string;
|
|
1312
|
+
gameId: number | null;
|
|
1313
|
+
position: number;
|
|
1314
|
+
}
|
|
1315
|
+
/** Response from `GET /site/faq`. */
|
|
1316
|
+
export interface FaqListResponse {
|
|
1317
|
+
items: FaqItem[];
|
|
1318
|
+
}
|
|
1319
|
+
/** A single "please add this game" request submitted by the current user. */
|
|
1320
|
+
export interface GameRequestItem {
|
|
1321
|
+
id: number;
|
|
1322
|
+
gameName: string;
|
|
1323
|
+
comment: string | null;
|
|
1324
|
+
gameUrl: string | null;
|
|
1325
|
+
status: string;
|
|
1326
|
+
createdAt: string;
|
|
1327
|
+
}
|
|
1328
|
+
/** Inner payload of `GET /profile/game-requests` (envelope auto-unwrapped). */
|
|
1329
|
+
export interface GameRequestList {
|
|
1330
|
+
items: GameRequestItem[];
|
|
1331
|
+
}
|
|
1332
|
+
/** Aggregated profile counters for header / sidebar widgets. */
|
|
1333
|
+
export interface ProfileSummary {
|
|
1334
|
+
cartCount: number;
|
|
1335
|
+
unreadNotifications: number;
|
|
1336
|
+
pendingReviews: number;
|
|
1337
|
+
hasOpenSupportThread: boolean;
|
|
1338
|
+
permanentBalance: number;
|
|
1339
|
+
bonusBalance: number;
|
|
1340
|
+
}
|
|
1341
|
+
/** Status of a checkout payment plus its child orders. Public endpoint. */
|
|
1342
|
+
export interface CheckoutStatus {
|
|
1343
|
+
payment: {
|
|
1344
|
+
code: string;
|
|
1345
|
+
status: string;
|
|
1346
|
+
totalAmount: number;
|
|
1347
|
+
gatewayPaymentUrl: string | null;
|
|
1348
|
+
createdAt: string;
|
|
1349
|
+
completedAt: string | null;
|
|
1350
|
+
};
|
|
1351
|
+
orders: Array<{
|
|
1352
|
+
code: string;
|
|
1353
|
+
status: string;
|
|
1354
|
+
gameName: string;
|
|
1355
|
+
totalAmount: number;
|
|
1356
|
+
}>;
|
|
1357
|
+
}
|
|
1358
|
+
export type CmsArticleType = "news" | "promo" | "footer_block";
|
|
1359
|
+
export type CmsArticleLocale = "ru" | "en";
|
|
1360
|
+
export type CmsArticleStatus = "draft" | "published" | "archived";
|
|
1361
|
+
/**
|
|
1362
|
+
* Summary projection returned by `gc.site.getArticles()` — list pages
|
|
1363
|
+
* stay cheap by omitting the article body. Storefronts call
|
|
1364
|
+
* `gc.site.getArticle(type, slug)` to fetch the full body when the
|
|
1365
|
+
* user opens the article.
|
|
1366
|
+
*
|
|
1367
|
+
* Date fields (`publishedAt`) are ISO-8601 strings on the wire.
|
|
1368
|
+
*/
|
|
1369
|
+
export interface CmsArticleSummary {
|
|
1370
|
+
id: number;
|
|
1371
|
+
type: CmsArticleType;
|
|
1372
|
+
locale: CmsArticleLocale;
|
|
1373
|
+
slug: string;
|
|
1374
|
+
title: string;
|
|
1375
|
+
summary: string | null;
|
|
1376
|
+
coverImage: string | null;
|
|
1377
|
+
publishedAt: string | null;
|
|
1378
|
+
sortOrder: number;
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Full CMS article shape returned by `gc.site.getArticle()`. The
|
|
1382
|
+
* `locale` field reflects the article's actual language — when the
|
|
1383
|
+
* storefront requests `en` and the article only exists in `ru`, the
|
|
1384
|
+
* server falls back and the response carries `locale: "ru"`.
|
|
1385
|
+
*
|
|
1386
|
+
* Date fields are ISO-8601 strings.
|
|
1387
|
+
*/
|
|
1388
|
+
export interface CmsArticle {
|
|
1389
|
+
id: number;
|
|
1390
|
+
siteId: number;
|
|
1391
|
+
type: CmsArticleType;
|
|
1392
|
+
locale: CmsArticleLocale;
|
|
1393
|
+
slug: string;
|
|
1394
|
+
title: string;
|
|
1395
|
+
summary: string | null;
|
|
1396
|
+
body: string;
|
|
1397
|
+
coverImage: string | null;
|
|
1398
|
+
status: CmsArticleStatus;
|
|
1399
|
+
publishedAt: string | null;
|
|
1400
|
+
sortOrder: number;
|
|
1401
|
+
createdAt: string;
|
|
1402
|
+
updatedAt: string;
|
|
1403
|
+
}
|
|
1404
|
+
/** Response from `GET /site/cms/:type`. */
|
|
1405
|
+
export interface CmsArticleListResponse {
|
|
1406
|
+
items: CmsArticleSummary[];
|
|
1407
|
+
total: number;
|
|
1408
|
+
}
|
|
1409
|
+
/** Response from `GET /site/cms/:type/:slug`. */
|
|
1410
|
+
export interface CmsArticleResponse {
|
|
1411
|
+
article: CmsArticle;
|
|
1412
|
+
}
|
|
1259
1413
|
/** Standard API response wrapper. Most endpoints return { success, data } or { success, error }. */
|
|
1260
1414
|
export interface ApiResponse<T = unknown> {
|
|
1261
1415
|
success: boolean;
|