@gamecore-api/sdk 0.8.0 → 0.9.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 +37 -0
- package/dist/index.js +6 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -22,6 +22,19 @@ 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 social proof — recent purchases for trust display */
|
|
26
|
+
getSocialProof: () => Promise<{
|
|
27
|
+
recentPurchases: Array<{
|
|
28
|
+
gameName: string;
|
|
29
|
+
timeAgo: string;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
/** Get theme config (white-label colors, fonts, borderRadius) */
|
|
33
|
+
getThemeConfig: () => Promise<{
|
|
34
|
+
colors: Record<string, string>;
|
|
35
|
+
borderRadius: string;
|
|
36
|
+
font: string;
|
|
37
|
+
}>;
|
|
25
38
|
/** Get site translations for a locale (Record<key, value>) */
|
|
26
39
|
getTranslations: (locale?: string) => Promise<Record<string, string>>;
|
|
27
40
|
/** Get site UI config (header, footer, nav, trust pills) */
|
|
@@ -52,6 +65,10 @@ export declare class GameCoreClient {
|
|
|
52
65
|
initTelegram: () => Promise<TelegramInitResponse>;
|
|
53
66
|
/** Poll Telegram auth status until authenticated or expired */
|
|
54
67
|
pollTelegramStatus: (token: string, intervalMs?: number) => Promise<User>;
|
|
68
|
+
/** Get VK OAuth redirect URL */
|
|
69
|
+
getVkAuthUrl: (redirectUri: string) => Promise<{
|
|
70
|
+
url: string;
|
|
71
|
+
}>;
|
|
55
72
|
/** Verify VK access token and login/register */
|
|
56
73
|
verifyVk: (accessToken: string, ref?: string) => Promise<{
|
|
57
74
|
status: string;
|
|
@@ -187,6 +204,14 @@ export declare class GameCoreClient {
|
|
|
187
204
|
payment: unknown;
|
|
188
205
|
orders: Order[];
|
|
189
206
|
}>;
|
|
207
|
+
/** Preview cancel — check if cancellable and refund amount */
|
|
208
|
+
cancelPreview: (code: string) => Promise<{
|
|
209
|
+
canCancel: boolean;
|
|
210
|
+
reason?: string;
|
|
211
|
+
refundAmount?: number;
|
|
212
|
+
refundTo?: string;
|
|
213
|
+
message?: string;
|
|
214
|
+
}>;
|
|
190
215
|
/** Cancel a pending order */
|
|
191
216
|
cancel: (code: string) => Promise<{
|
|
192
217
|
status: string;
|
|
@@ -218,6 +243,18 @@ export declare class GameCoreClient {
|
|
|
218
243
|
deleteAccount: () => Promise<void>;
|
|
219
244
|
/** Export user data (GDPR) */
|
|
220
245
|
exportData: () => Promise<Record<string, unknown>>;
|
|
246
|
+
/** Get user preferences (language, currency, notifications) */
|
|
247
|
+
getSettings: () => Promise<{
|
|
248
|
+
language: string;
|
|
249
|
+
currency: string;
|
|
250
|
+
emailNotifications: boolean;
|
|
251
|
+
}>;
|
|
252
|
+
/** Update user preferences */
|
|
253
|
+
updateSettings: (data: {
|
|
254
|
+
language?: string;
|
|
255
|
+
currency?: string;
|
|
256
|
+
emailNotifications?: boolean;
|
|
257
|
+
}) => Promise<void>;
|
|
221
258
|
/** Subscribe to broadcast notifications */
|
|
222
259
|
subscribeBroadcast: () => Promise<void>;
|
|
223
260
|
/** Unsubscribe from broadcast notifications */
|
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
|
+
getSocialProof: () => this.request("GET", "/site/social-proof"),
|
|
81
|
+
getThemeConfig: () => this.request("GET", "/site/theme"),
|
|
80
82
|
getTranslations: (locale = "ru") => this.request("GET", `/site/translations?locale=${locale}`),
|
|
81
83
|
getUIConfig: () => this.request("GET", "/site/ui-config"),
|
|
82
84
|
getCookieConsent: () => this.request("GET", "/site/cookie-consent"),
|
|
@@ -103,6 +105,7 @@ class GameCoreClient {
|
|
|
103
105
|
}
|
|
104
106
|
}, intervalMs);
|
|
105
107
|
}),
|
|
108
|
+
getVkAuthUrl: (redirectUri) => this.request("GET", `/auth/vk/url?redirect=${encodeURIComponent(redirectUri)}`),
|
|
106
109
|
verifyVk: (accessToken, ref) => this.request("POST", "/auth/vk/verify", { accessToken, ref }, { rawResponse: true }),
|
|
107
110
|
getMe: () => this.request("GET", "/auth/me", undefined, { rawResponse: true }),
|
|
108
111
|
logout: () => this.request("POST", "/auth/logout"),
|
|
@@ -187,6 +190,7 @@ class GameCoreClient {
|
|
|
187
190
|
list: () => this.request("GET", "/orders"),
|
|
188
191
|
get: (code) => this.request("GET", `/orders/${code}`),
|
|
189
192
|
getByPayment: (paymentCode) => this.request("GET", `/checkout/orders/payment/${paymentCode}`, undefined, { rawResponse: true }),
|
|
193
|
+
cancelPreview: (code) => this.request("GET", `/orders/${code}/cancel-preview`),
|
|
190
194
|
cancel: (code) => this.request("POST", `/orders/${code}/cancel`)
|
|
191
195
|
};
|
|
192
196
|
profile = {
|
|
@@ -208,6 +212,8 @@ class GameCoreClient {
|
|
|
208
212
|
markAllRead: () => this.request("POST", "/profile/notifications/read-all"),
|
|
209
213
|
deleteAccount: () => this.request("POST", "/profile/delete-account"),
|
|
210
214
|
exportData: () => this.request("GET", "/profile/export"),
|
|
215
|
+
getSettings: () => this.request("GET", "/profile/settings"),
|
|
216
|
+
updateSettings: (data) => this.request("PUT", "/profile/settings", data),
|
|
211
217
|
subscribeBroadcast: () => this.request("POST", "/profile/broadcast/subscribe"),
|
|
212
218
|
unsubscribeBroadcast: () => this.request("POST", "/profile/broadcast/unsubscribe"),
|
|
213
219
|
getBroadcastStatus: () => this.request("GET", "/profile/broadcast/status")
|
package/dist/types.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export interface Game {
|
|
|
69
69
|
inStock: boolean;
|
|
70
70
|
soldCount?: number;
|
|
71
71
|
tags?: string[];
|
|
72
|
+
availabilityStatus?: "available" | "coming_soon" | "maintenance" | "discontinued";
|
|
73
|
+
availabilityMessage?: string | null;
|
|
72
74
|
minPrice?: number | null;
|
|
73
75
|
type?: string;
|
|
74
76
|
deliveryTypes?: string[];
|