@gamecore-api/sdk 0.20.0 → 0.24.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 CHANGED
@@ -1,4 +1,4 @@
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
2
  export interface GameCoreOptions {
3
3
  /** Site API key (gc_live_xxx or gc_test_xxx) */
4
4
  apiKey: string;
@@ -111,6 +111,51 @@ export declare class GameCoreClient {
111
111
  success: boolean;
112
112
  requestId: number;
113
113
  }>;
114
+ /**
115
+ * Get the per-site review-payout policy. Storefronts use this on
116
+ * the order success page to decide whether to advertise a
117
+ * cashback bonus for posting a review, and to enforce the
118
+ * minimum text length client-side before submission.
119
+ */
120
+ getReviewPolicy: () => Promise<ReviewPolicy>;
121
+ /**
122
+ * Get FAQ entries for this site. Without `gameId`, returns all
123
+ * active site-wide FAQ entries (rows with `gameId: null`). When
124
+ * `gameId` is provided, returns ONLY entries scoped to that
125
+ * game — site-wide entries are NOT included in the response.
126
+ * Storefronts that want both site-wide and game-specific FAQ
127
+ * on the same page must call this method twice and merge the
128
+ * results client-side. `position` is the display order (lower
129
+ * first); `gameId: null` marks site-wide entries.
130
+ */
131
+ getFaq: (gameId?: number) => Promise<FaqListResponse>;
132
+ /**
133
+ * List published CMS articles of a given type for the current
134
+ * site. Returns a summary projection (no body) — call
135
+ * `getArticle()` to fetch a single article's full content.
136
+ *
137
+ * `locale` defaults to the site's default locale on the
138
+ * server (currently "ru") when omitted. `limit` is capped
139
+ * server-side at 100; `offset` enables pagination.
140
+ */
141
+ getArticles: (type: CmsArticleType, options?: {
142
+ locale?: CmsArticleLocale;
143
+ limit?: number;
144
+ offset?: number;
145
+ }) => Promise<CmsArticleListResponse>;
146
+ /**
147
+ * Fetch a single published CMS article by slug. The server
148
+ * falls back to the RU article when the requested locale is
149
+ * missing — inspect `article.locale` on the response to
150
+ * detect fallback.
151
+ *
152
+ * Throws `GameCoreError(404)` when no published article matches
153
+ * the requested type/slug pair under either the requested or
154
+ * fallback locale.
155
+ */
156
+ getArticle: (type: CmsArticleType, slug: string, options?: {
157
+ locale?: CmsArticleLocale;
158
+ }) => Promise<CmsArticleResponse>;
114
159
  };
115
160
  auth: {
116
161
  /** Start Telegram auth flow → returns bot link for user to click */
@@ -393,6 +438,15 @@ export declare class GameCoreClient {
393
438
  * 2026-05-01 (Wave 5 #50).
394
439
  */
395
440
  getGameScreenshots: (gameSlug: string) => Promise<ScreenshotsResponse>;
441
+ /**
442
+ * Pre-checkout delivery help (instructions, screenshots,
443
+ * warnings) configured by the operator for a game page. The
444
+ * endpoint returns `{ deliveryHelp: DeliveryHelp | null }` flat
445
+ * — without the `success`/`data` envelope — so the SDK does not
446
+ * auto-unwrap and the response shape mirrors the wire payload
447
+ * directly. `null` means no help content is configured.
448
+ */
449
+ getDeliveryHelp: (gameSlug: string) => Promise<DeliveryHelpResponse>;
396
450
  /** Get categories for a game with product counts and delivery metadata */
397
451
  getCategories: (gameSlug: string) => Promise<Category[]>;
398
452
  /** Get products for a game with optional filters */
@@ -537,6 +591,14 @@ export declare class GameCoreClient {
537
591
  completeWithBalance: (paymentCode: string) => Promise<CompleteWithBalanceResult>;
538
592
  /** Get available payment methods for checkout */
539
593
  getPaymentMethods: () => Promise<PaymentMethod[]>;
594
+ /**
595
+ * Get the current status of a payment plus its child orders by
596
+ * payment code. Public endpoint — no auth required, so it can
597
+ * power a "track your order" lookup page from a guest's email
598
+ * receipt link. `gatewayPaymentUrl` is `null` once the payment
599
+ * has been completed or expired.
600
+ */
601
+ getStatus: (code: string) => Promise<CheckoutStatus>;
540
602
  };
541
603
  orders: {
542
604
  /** List all orders for authenticated user */
@@ -712,6 +774,21 @@ export declare class GameCoreClient {
712
774
  unsubscribePush: (endpoint: string) => Promise<{
713
775
  success: boolean;
714
776
  }>;
777
+ /**
778
+ * List the current user's "please add this game" requests,
779
+ * newest first. Status is one of `pending` / `reviewed` /
780
+ * `completed` / `rejected` (string-typed because the server
781
+ * may add new states without an SDK bump).
782
+ */
783
+ getGameRequests: () => Promise<GameRequestList>;
784
+ /**
785
+ * Aggregated counters for the header / sidebar — cart size,
786
+ * unread notifications, pending review prompts, balances, and
787
+ * whether the user has an open support thread. One round-trip
788
+ * replaces several smaller calls; useful as a SWR pre-fetch on
789
+ * authenticated route shells.
790
+ */
791
+ getSummary: () => Promise<ProfileSummary>;
715
792
  };
716
793
  favorites: {
717
794
  /** List user's favorite products */
@@ -807,6 +884,13 @@ export declare class GameCoreClient {
807
884
  from?: Date | string;
808
885
  to?: Date | string;
809
886
  }) => Promise<ReferralPerformance>;
887
+ /**
888
+ * Transfer all eligible pending referral commissions to the
889
+ * user's permanent balance. Returns the total transferred amount,
890
+ * how many commissions were moved, and the user's new permanent
891
+ * balance.
892
+ */
893
+ transferToBalance: () => Promise<ReferralTransferResult>;
810
894
  };
811
895
  reviews: {
812
896
  /** Get public reviews (paginated) */
package/dist/index.js CHANGED
@@ -87,7 +87,28 @@ class GameCoreClient {
87
87
  getBanners: () => this.request("GET", "/site/banners"),
88
88
  getAnnouncementBar: () => this.request("GET", "/site/announcement-bar"),
89
89
  getSitemapData: () => this.request("GET", "/seo/sitemap-data"),
90
- requestGame: (data) => this.request("POST", "/site/request-game", data)
90
+ requestGame: (data) => this.request("POST", "/site/request-game", data),
91
+ getReviewPolicy: () => this.request("GET", "/site/review-policy"),
92
+ getFaq: (gameId) => {
93
+ const qs = gameId !== undefined ? `?gameId=${encodeURIComponent(gameId)}` : "";
94
+ return this.request("GET", `/site/faq${qs}`);
95
+ },
96
+ getArticles: (type, options) => {
97
+ const params = new URLSearchParams;
98
+ if (options?.locale)
99
+ params.set("locale", options.locale);
100
+ if (options?.limit !== undefined)
101
+ params.set("limit", String(options.limit));
102
+ if (options?.offset !== undefined)
103
+ params.set("offset", String(options.offset));
104
+ const qs = params.toString();
105
+ const path = qs.length > 0 ? `/site/cms/${encodeURIComponent(type)}?${qs}` : `/site/cms/${encodeURIComponent(type)}`;
106
+ return this.request("GET", path);
107
+ },
108
+ getArticle: (type, slug, options) => {
109
+ const qs = options?.locale ? `?locale=${options.locale}` : "";
110
+ return this.request("GET", `/site/cms/${encodeURIComponent(type)}/${encodeURIComponent(slug)}${qs}`);
111
+ }
91
112
  };
92
113
  auth = {
93
114
  initTelegram: () => this.request("POST", "/auth/telegram/init"),
@@ -259,6 +280,7 @@ class GameCoreClient {
259
280
  getRecommendations: (gameSlug, limit = 8) => this.request("GET", `/catalog/games/${gameSlug}/recommendations?limit=${limit}`),
260
281
  getGameSystemRequirements: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/system-requirements`),
261
282
  getGameScreenshots: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/screenshots`),
283
+ getDeliveryHelp: (gameSlug) => this.request("GET", `/catalog/games/${encodeURIComponent(gameSlug)}/delivery-help`),
262
284
  getCategories: (gameSlug) => this.request("GET", `/catalog/games/${gameSlug}/categories`),
263
285
  getProducts: (gameSlug, filters) => {
264
286
  const qs = new URLSearchParams;
@@ -306,7 +328,8 @@ class GameCoreClient {
306
328
  getPaymentMethods: async () => {
307
329
  const res = await this.request("GET", "/checkout/payment-methods", undefined, { rawResponse: true });
308
330
  return res.methods || [];
309
- }
331
+ },
332
+ getStatus: (code) => this.request("GET", `/checkout/${encodeURIComponent(code)}/status`)
310
333
  };
311
334
  orders = {
312
335
  list: () => this.request("GET", "/orders"),
@@ -377,7 +400,9 @@ class GameCoreClient {
377
400
  subscribePush: (subscription) => this.request("POST", "/profile/push/subscribe", subscription),
378
401
  unsubscribePush: (endpoint) => this.request("POST", "/profile/push/unsubscribe", {
379
402
  endpoint
380
- })
403
+ }),
404
+ getGameRequests: () => this.request("GET", "/profile/game-requests"),
405
+ getSummary: () => this.request("GET", "/profile/summary")
381
406
  };
382
407
  favorites = {
383
408
  list: () => this.request("GET", "/favorites"),
@@ -413,7 +438,8 @@ class GameCoreClient {
413
438
  }
414
439
  const q = qs.toString();
415
440
  return this.request("GET", `/referral/performance${q ? `?${q}` : ""}`);
416
- }
441
+ },
442
+ transferToBalance: async () => this.request("POST", "/referral/transfer")
417
443
  };
418
444
  reviews = {
419
445
  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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamecore-api/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.24.0",
4
4
  "description": "TypeScript SDK for GameCore API — browser-safe, zero dependencies",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",