@orbit-software/sdk 1.86.0 → 1.87.2
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/esm/lib/ads/adsgram.d.ts +4 -0
- package/dist/esm/lib/ads/gigapub.d.ts +2 -0
- package/dist/esm/lib/ads/monetag.d.ts +3 -0
- package/dist/esm/lib/apiRequest.d.ts +16 -0
- package/dist/esm/lib/sentry.d.ts +1 -0
- package/dist/esm/sdk.d.ts +5 -278
- package/dist/esm/sdk.mjs +11083 -11045
- package/dist/esm/sdk.umd.js +81 -81
- package/dist/esm/types/sdk.d.ts +261 -0
- package/dist/esm/utils/analytics.d.ts +9 -0
- package/dist/esm/utils/cloudStorage.d.ts +14 -0
- package/dist/esm/utils/ensureViewportMetaTag.d.ts +5 -0
- package/dist/stats-esm.html +1 -1
- package/dist/stats-umd-react.html +1 -1
- package/dist/stats-umd.html +1 -1
- package/dist/umd/sdk.umd.js +81 -81
- package/dist/umd_react/sdk_react.umd.js +53 -53
- package/package.json +1 -1
- /package/dist/esm/lib/{tma-network.d.ts → ads/tma-network.d.ts} +0 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { InventoryItem, ServiceInvoiceCreatedResponse } from './api';
|
|
2
|
+
export interface CryptoSteamSDKConfig {
|
|
3
|
+
supported_screen_formats: ('landscape' | 'portrait' | 'fullscreen')[];
|
|
4
|
+
supported_devices: string[];
|
|
5
|
+
title: string;
|
|
6
|
+
app_url: string;
|
|
7
|
+
}
|
|
8
|
+
export type Audience = 'start_page_default' | 'start_page_few_ads' | 'start_page_no_ads' | 'start_page_games' | 'banner_test';
|
|
9
|
+
export interface ProfileBalances {
|
|
10
|
+
coins: number;
|
|
11
|
+
gems: number;
|
|
12
|
+
ny2026_tickets: number;
|
|
13
|
+
usdt: number;
|
|
14
|
+
}
|
|
15
|
+
export interface CryptoSteamSDKProfile {
|
|
16
|
+
id: number;
|
|
17
|
+
avatar_ug: string;
|
|
18
|
+
user_name: string;
|
|
19
|
+
first_name: string;
|
|
20
|
+
last_name: string;
|
|
21
|
+
language: string;
|
|
22
|
+
email: string;
|
|
23
|
+
email_confirmed: boolean;
|
|
24
|
+
phone_number: string;
|
|
25
|
+
location: string;
|
|
26
|
+
background_color: string;
|
|
27
|
+
override_ads: boolean;
|
|
28
|
+
ton_address: string;
|
|
29
|
+
audiences: Audience[];
|
|
30
|
+
is_premium: boolean;
|
|
31
|
+
allows_write_to_pm: boolean;
|
|
32
|
+
ads_disabled_until?: string;
|
|
33
|
+
created: string;
|
|
34
|
+
updated: string;
|
|
35
|
+
avatar: string;
|
|
36
|
+
birth_date: string;
|
|
37
|
+
balance_gems: number;
|
|
38
|
+
balance_coins: number;
|
|
39
|
+
experience: number;
|
|
40
|
+
balance_usdt: number;
|
|
41
|
+
minimum_usdt_withdraw: number;
|
|
42
|
+
level: number;
|
|
43
|
+
level_up_exp: number;
|
|
44
|
+
invited: number;
|
|
45
|
+
invited_full: number;
|
|
46
|
+
games_count: number;
|
|
47
|
+
ads_free: boolean;
|
|
48
|
+
is_admin: boolean;
|
|
49
|
+
inventory: InventoryItem[];
|
|
50
|
+
game_id?: number | string;
|
|
51
|
+
onboarding: boolean;
|
|
52
|
+
review_stats: {
|
|
53
|
+
total: number;
|
|
54
|
+
with_comments: number;
|
|
55
|
+
};
|
|
56
|
+
balances: ProfileBalances;
|
|
57
|
+
}
|
|
58
|
+
export interface CryptoSteamSDKShopItem {
|
|
59
|
+
id: number;
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
price: number;
|
|
63
|
+
created: string;
|
|
64
|
+
updated: string;
|
|
65
|
+
}
|
|
66
|
+
export declare enum CryptoSteamSDKAdMediaType {
|
|
67
|
+
Image = "image",
|
|
68
|
+
Gif = "gif",
|
|
69
|
+
Video = "video"
|
|
70
|
+
}
|
|
71
|
+
export interface CryptoSteamSDKAd {
|
|
72
|
+
is_available: boolean;
|
|
73
|
+
url?: string;
|
|
74
|
+
mediaType?: CryptoSteamSDKAdMediaType;
|
|
75
|
+
durationS?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface CryptoSteamSDKWage {
|
|
78
|
+
active_wages: {
|
|
79
|
+
current_value: number;
|
|
80
|
+
id: number;
|
|
81
|
+
max_value: number;
|
|
82
|
+
price: number;
|
|
83
|
+
started_at: string;
|
|
84
|
+
time_limit: string;
|
|
85
|
+
title: string;
|
|
86
|
+
type_id: number;
|
|
87
|
+
}[];
|
|
88
|
+
available_wages: {
|
|
89
|
+
current_value: number;
|
|
90
|
+
id: number;
|
|
91
|
+
max_value: number;
|
|
92
|
+
price: number;
|
|
93
|
+
started_at: string;
|
|
94
|
+
time_limit: string;
|
|
95
|
+
title: string;
|
|
96
|
+
type_id: number;
|
|
97
|
+
}[];
|
|
98
|
+
claimable_wages: {
|
|
99
|
+
current_value: number;
|
|
100
|
+
id: number;
|
|
101
|
+
max_value: number;
|
|
102
|
+
price: number;
|
|
103
|
+
started_at: string;
|
|
104
|
+
time_limit: string;
|
|
105
|
+
title: string;
|
|
106
|
+
type_id: number;
|
|
107
|
+
}[];
|
|
108
|
+
}
|
|
109
|
+
export interface OverlayConfig {
|
|
110
|
+
onOverlayOpen?: () => void;
|
|
111
|
+
onOverlayClose?: () => void;
|
|
112
|
+
variant?: 'light' | 'dark' | 'translucent';
|
|
113
|
+
initialPosition?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
114
|
+
botId?: string;
|
|
115
|
+
authData?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface CryptoSteamSDKTask {
|
|
118
|
+
id: number;
|
|
119
|
+
title: string;
|
|
120
|
+
description: string;
|
|
121
|
+
reward: number;
|
|
122
|
+
group?: string;
|
|
123
|
+
group_position?: number;
|
|
124
|
+
sub_title?: string;
|
|
125
|
+
is_claimable: boolean;
|
|
126
|
+
is_done: boolean;
|
|
127
|
+
}
|
|
128
|
+
export type AdType = 'REWARD' | 'INTERSTITIAL';
|
|
129
|
+
export interface RequestAdOptions {
|
|
130
|
+
onStart?: () => void;
|
|
131
|
+
}
|
|
132
|
+
export interface InitializeOptions {
|
|
133
|
+
mode: 'portal';
|
|
134
|
+
authData?: string;
|
|
135
|
+
disable_startup_ads?: boolean;
|
|
136
|
+
}
|
|
137
|
+
export interface StartupConfig {
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated This field is no longer supported. Fullscreen configuration is now done through Portal.
|
|
140
|
+
*/
|
|
141
|
+
isFullscreen: boolean;
|
|
142
|
+
overlayPosition: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
143
|
+
}
|
|
144
|
+
export interface CryptoSteamSDK {
|
|
145
|
+
version: string;
|
|
146
|
+
onAdStart: (() => void) | null;
|
|
147
|
+
onAdEnd: ((result: boolean) => void) | null;
|
|
148
|
+
initialize: (botId?: string, options?: InitializeOptions) => Promise<void>;
|
|
149
|
+
getConfig: () => Promise<CryptoSteamSDKConfig>;
|
|
150
|
+
isAdEnabled: () => Promise<boolean>;
|
|
151
|
+
requestAd: (options?: RequestAdOptions) => Promise<boolean>;
|
|
152
|
+
requestRewardAd: (options?: RequestAdOptions) => Promise<boolean>;
|
|
153
|
+
getProfile: () => Promise<CryptoSteamSDKProfile>;
|
|
154
|
+
getBalance: () => Promise<BalanceResponse>;
|
|
155
|
+
getWages: () => Promise<CryptoSteamSDKWage>;
|
|
156
|
+
claimWage: (id: number) => Promise<void>;
|
|
157
|
+
startWage: (id: number) => Promise<void>;
|
|
158
|
+
setValueWage: (params: RequestWageValueParams) => Promise<void>;
|
|
159
|
+
trackGameTimeTick: () => void;
|
|
160
|
+
getVersion: () => string;
|
|
161
|
+
initializeOverlay: (config?: OverlayConfig) => void;
|
|
162
|
+
getShopItems: () => Promise<CryptoSteamSDKShopItem[]>;
|
|
163
|
+
getPurchasedShopItem: (itemId: number) => Promise<CryptoSteamSDKShopItem>;
|
|
164
|
+
getPurchasedShopItems: () => Promise<CryptoSteamSDKShopItem[]>;
|
|
165
|
+
buyShopItem: (itemId: number) => Promise<void>;
|
|
166
|
+
openPurchaseConfirmModal: (shopItem: CryptoSteamSDKShopItem, rect?: {
|
|
167
|
+
x: number;
|
|
168
|
+
y: number;
|
|
169
|
+
width: number;
|
|
170
|
+
height: number;
|
|
171
|
+
}) => Promise<PurchaseConfirmResponse>;
|
|
172
|
+
createInvoice: (title: string, description: string, to_user_id: number, amount: number) => Promise<ServiceInvoiceCreatedResponse>;
|
|
173
|
+
getValue: (key: string) => Promise<string>;
|
|
174
|
+
setValue: (key: string, value: string) => Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated
|
|
177
|
+
* @param key
|
|
178
|
+
*/
|
|
179
|
+
getData: (key: string) => Promise<string>;
|
|
180
|
+
/**
|
|
181
|
+
* @deprecated
|
|
182
|
+
* @param key
|
|
183
|
+
* @param value
|
|
184
|
+
*/
|
|
185
|
+
setData: (key: string, value: string) => Promise<void>;
|
|
186
|
+
removeValue: (key: string) => Promise<void>;
|
|
187
|
+
getAllKeyValues: () => Promise<Record<string, string>>;
|
|
188
|
+
getLocale: () => string;
|
|
189
|
+
showSharing: (url: string, text?: string) => void;
|
|
190
|
+
telegramCloudStorage: TelegramCloudStorage;
|
|
191
|
+
gameReady: () => void;
|
|
192
|
+
getAdsgramController: () => AdsgramController | null;
|
|
193
|
+
getLaunchResponse: () => LaunchResponse | null;
|
|
194
|
+
isLaunchedFromPortal: () => boolean;
|
|
195
|
+
setBottomBanner: () => void;
|
|
196
|
+
clearBottomBanner: () => void;
|
|
197
|
+
}
|
|
198
|
+
export interface PortalEmuSDK {
|
|
199
|
+
isAdRunning: () => boolean;
|
|
200
|
+
getValueSync: (key: string) => string;
|
|
201
|
+
setValueSync: (key: string, value: string) => void;
|
|
202
|
+
removeValueSync: (key: string) => Promise<void>;
|
|
203
|
+
reloadAd: () => void;
|
|
204
|
+
getStartParam: () => string;
|
|
205
|
+
requestAd: () => Promise<void>;
|
|
206
|
+
}
|
|
207
|
+
export interface ConfigCache {
|
|
208
|
+
config: CryptoSteamSDKConfig;
|
|
209
|
+
expiresAt: number;
|
|
210
|
+
}
|
|
211
|
+
export interface LaunchResponse {
|
|
212
|
+
tma_ads_key: string;
|
|
213
|
+
ads?: {
|
|
214
|
+
type: 'tma' | 'monetag' | 'adsgram' | 'gigapub';
|
|
215
|
+
tmaAdsKey?: string;
|
|
216
|
+
monetag?: string;
|
|
217
|
+
adsgram?: string;
|
|
218
|
+
gigapub?: string;
|
|
219
|
+
};
|
|
220
|
+
ads_last_showed: string | Date;
|
|
221
|
+
is_ad_cooldown: boolean;
|
|
222
|
+
launched: number;
|
|
223
|
+
total_launches: number;
|
|
224
|
+
}
|
|
225
|
+
export interface PurchaseConfirmResponse {
|
|
226
|
+
status: 'success' | 'error';
|
|
227
|
+
}
|
|
228
|
+
export interface TelegramCloudStorage {
|
|
229
|
+
getValue: (key: string) => Promise<string | null>;
|
|
230
|
+
setValue: (key: string, value: string) => Promise<boolean | null>;
|
|
231
|
+
removeValue: (key: string) => Promise<boolean | null>;
|
|
232
|
+
}
|
|
233
|
+
export interface TMANetworkInterstitialResponse {
|
|
234
|
+
id: string;
|
|
235
|
+
reward: boolean;
|
|
236
|
+
}
|
|
237
|
+
export interface ShowPromiseResult {
|
|
238
|
+
done: boolean;
|
|
239
|
+
description: string;
|
|
240
|
+
state: 'load' | 'render' | 'playing' | 'destroy';
|
|
241
|
+
error: boolean;
|
|
242
|
+
}
|
|
243
|
+
export interface AdsgramController {
|
|
244
|
+
show(): Promise<ShowPromiseResult>;
|
|
245
|
+
}
|
|
246
|
+
export interface AdsgramInitOptions {
|
|
247
|
+
blockId: string;
|
|
248
|
+
}
|
|
249
|
+
export interface BalanceResponse {
|
|
250
|
+
balance: number;
|
|
251
|
+
balance_gems: number;
|
|
252
|
+
balance_coins: number;
|
|
253
|
+
}
|
|
254
|
+
export interface RequestWageValueParams {
|
|
255
|
+
wageId: number;
|
|
256
|
+
value: number;
|
|
257
|
+
}
|
|
258
|
+
export interface ConfirmMessage {
|
|
259
|
+
type: 'confirm' | 'cancel' | 'error';
|
|
260
|
+
message?: string;
|
|
261
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CloudStorageValueValidationResult {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
error?: string;
|
|
4
|
+
byteSize?: number;
|
|
5
|
+
characterCount?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Валидирует значение для Telegram CloudStorage
|
|
9
|
+
* Проверяет:
|
|
10
|
+
* - Максимальный размер в байтах: 4096 байт (не символов!)
|
|
11
|
+
* - Корректная UTF-8 кодировка
|
|
12
|
+
* - Отсутствие нулевых байтов и проблемных управляющих символов
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateCloudStorageValue(value: string): CloudStorageValueValidationResult;
|